| [ Index ] |
PHP Cross Reference of WordPress Trunk (Updated Daily) |
[Summary view] [Print] [Text view]
1 /******/ (() => { // webpackBootstrap 2 /******/ var __webpack_modules__ = ({ 3 4 /***/ 197: 5 /***/ (() => { 6 7 /* (ignored) */ 8 9 /***/ }), 10 11 /***/ 271: 12 /***/ ((module, __unused_webpack_exports, __webpack_require__) => { 13 14 "use strict"; 15 16 17 let Container = __webpack_require__(683) 18 19 let LazyResult, Processor 20 21 class Document extends Container { 22 constructor(defaults) { 23 // type needs to be passed to super, otherwise child roots won't be normalized correctly 24 super({ type: 'document', ...defaults }) 25 26 if (!this.nodes) { 27 this.nodes = [] 28 } 29 } 30 31 toResult(opts = {}) { 32 let lazy = new LazyResult(new Processor(), this, opts) 33 34 return lazy.stringify() 35 } 36 } 37 38 Document.registerLazyResult = dependant => { 39 LazyResult = dependant 40 } 41 42 Document.registerProcessor = dependant => { 43 Processor = dependant 44 } 45 46 module.exports = Document 47 Document.default = Document 48 49 50 /***/ }), 51 52 /***/ 346: 53 /***/ ((module) => { 54 55 "use strict"; 56 57 58 const DEFAULT_RAW = { 59 after: '\n', 60 beforeClose: '\n', 61 beforeComment: '\n', 62 beforeDecl: '\n', 63 beforeOpen: ' ', 64 beforeRule: '\n', 65 colon: ': ', 66 commentLeft: ' ', 67 commentRight: ' ', 68 emptyBody: '', 69 indent: ' ', 70 semicolon: false 71 } 72 73 function capitalize(str) { 74 return str[0].toUpperCase() + str.slice(1) 75 } 76 77 class Stringifier { 78 constructor(builder) { 79 this.builder = builder 80 } 81 82 atrule(node, semicolon) { 83 let name = '@' + node.name 84 let params = node.params ? this.rawValue(node, 'params') : '' 85 86 if (typeof node.raws.afterName !== 'undefined') { 87 name += node.raws.afterName 88 } else if (params) { 89 name += ' ' 90 } 91 92 if (node.nodes) { 93 this.block(node, name + params) 94 } else { 95 let end = (node.raws.between || '') + (semicolon ? ';' : '') 96 this.builder(name + params + end, node) 97 } 98 } 99 100 beforeAfter(node, detect) { 101 let value 102 if (node.type === 'decl') { 103 value = this.raw(node, null, 'beforeDecl') 104 } else if (node.type === 'comment') { 105 value = this.raw(node, null, 'beforeComment') 106 } else if (detect === 'before') { 107 value = this.raw(node, null, 'beforeRule') 108 } else { 109 value = this.raw(node, null, 'beforeClose') 110 } 111 112 let buf = node.parent 113 let depth = 0 114 while (buf && buf.type !== 'root') { 115 depth += 1 116 buf = buf.parent 117 } 118 119 if (value.includes('\n')) { 120 let indent = this.raw(node, null, 'indent') 121 if (indent.length) { 122 for (let step = 0; step < depth; step++) value += indent 123 } 124 } 125 126 return value 127 } 128 129 block(node, start) { 130 let between = this.raw(node, 'between', 'beforeOpen') 131 this.builder(start + between + '{', node, 'start') 132 133 let after 134 if (node.nodes && node.nodes.length) { 135 this.body(node) 136 after = this.raw(node, 'after') 137 } else { 138 after = this.raw(node, 'after', 'emptyBody') 139 } 140 141 if (after) this.builder(after) 142 this.builder('}', node, 'end') 143 } 144 145 body(node) { 146 let last = node.nodes.length - 1 147 while (last > 0) { 148 if (node.nodes[last].type !== 'comment') break 149 last -= 1 150 } 151 152 let semicolon = this.raw(node, 'semicolon') 153 for (let i = 0; i < node.nodes.length; i++) { 154 let child = node.nodes[i] 155 let before = this.raw(child, 'before') 156 if (before) this.builder(before) 157 this.stringify(child, last !== i || semicolon) 158 } 159 } 160 161 comment(node) { 162 let left = this.raw(node, 'left', 'commentLeft') 163 let right = this.raw(node, 'right', 'commentRight') 164 this.builder('/*' + left + node.text + right + '*/', node) 165 } 166 167 decl(node, semicolon) { 168 let between = this.raw(node, 'between', 'colon') 169 let string = node.prop + between + this.rawValue(node, 'value') 170 171 if (node.important) { 172 string += node.raws.important || ' !important' 173 } 174 175 if (semicolon) string += ';' 176 this.builder(string, node) 177 } 178 179 document(node) { 180 this.body(node) 181 } 182 183 raw(node, own, detect) { 184 let value 185 if (!detect) detect = own 186 187 // Already had 188 if (own) { 189 value = node.raws[own] 190 if (typeof value !== 'undefined') return value 191 } 192 193 let parent = node.parent 194 195 if (detect === 'before') { 196 // Hack for first rule in CSS 197 if (!parent || (parent.type === 'root' && parent.first === node)) { 198 return '' 199 } 200 201 // `root` nodes in `document` should use only their own raws 202 if (parent && parent.type === 'document') { 203 return '' 204 } 205 } 206 207 // Floating child without parent 208 if (!parent) return DEFAULT_RAW[detect] 209 210 // Detect style by other nodes 211 let root = node.root() 212 if (!root.rawCache) root.rawCache = {} 213 if (typeof root.rawCache[detect] !== 'undefined') { 214 return root.rawCache[detect] 215 } 216 217 if (detect === 'before' || detect === 'after') { 218 return this.beforeAfter(node, detect) 219 } else { 220 let method = 'raw' + capitalize(detect) 221 if (this[method]) { 222 value = this[method](root, node) 223 } else { 224 root.walk(i => { 225 value = i.raws[own] 226 if (typeof value !== 'undefined') return false 227 }) 228 } 229 } 230 231 if (typeof value === 'undefined') value = DEFAULT_RAW[detect] 232 233 root.rawCache[detect] = value 234 return value 235 } 236 237 rawBeforeClose(root) { 238 let value 239 root.walk(i => { 240 if (i.nodes && i.nodes.length > 0) { 241 if (typeof i.raws.after !== 'undefined') { 242 value = i.raws.after 243 if (value.includes('\n')) { 244 value = value.replace(/[^\n]+$/, '') 245 } 246 return false 247 } 248 } 249 }) 250 if (value) value = value.replace(/\S/g, '') 251 return value 252 } 253 254 rawBeforeComment(root, node) { 255 let value 256 root.walkComments(i => { 257 if (typeof i.raws.before !== 'undefined') { 258 value = i.raws.before 259 if (value.includes('\n')) { 260 value = value.replace(/[^\n]+$/, '') 261 } 262 return false 263 } 264 }) 265 if (typeof value === 'undefined') { 266 value = this.raw(node, null, 'beforeDecl') 267 } else if (value) { 268 value = value.replace(/\S/g, '') 269 } 270 return value 271 } 272 273 rawBeforeDecl(root, node) { 274 let value 275 root.walkDecls(i => { 276 if (typeof i.raws.before !== 'undefined') { 277 value = i.raws.before 278 if (value.includes('\n')) { 279 value = value.replace(/[^\n]+$/, '') 280 } 281 return false 282 } 283 }) 284 if (typeof value === 'undefined') { 285 value = this.raw(node, null, 'beforeRule') 286 } else if (value) { 287 value = value.replace(/\S/g, '') 288 } 289 return value 290 } 291 292 rawBeforeOpen(root) { 293 let value 294 root.walk(i => { 295 if (i.type !== 'decl') { 296 value = i.raws.between 297 if (typeof value !== 'undefined') return false 298 } 299 }) 300 return value 301 } 302 303 rawBeforeRule(root) { 304 let value 305 root.walk(i => { 306 if (i.nodes && (i.parent !== root || root.first !== i)) { 307 if (typeof i.raws.before !== 'undefined') { 308 value = i.raws.before 309 if (value.includes('\n')) { 310 value = value.replace(/[^\n]+$/, '') 311 } 312 return false 313 } 314 } 315 }) 316 if (value) value = value.replace(/\S/g, '') 317 return value 318 } 319 320 rawColon(root) { 321 let value 322 root.walkDecls(i => { 323 if (typeof i.raws.between !== 'undefined') { 324 value = i.raws.between.replace(/[^\s:]/g, '') 325 return false 326 } 327 }) 328 return value 329 } 330 331 rawEmptyBody(root) { 332 let value 333 root.walk(i => { 334 if (i.nodes && i.nodes.length === 0) { 335 value = i.raws.after 336 if (typeof value !== 'undefined') return false 337 } 338 }) 339 return value 340 } 341 342 rawIndent(root) { 343 if (root.raws.indent) return root.raws.indent 344 let value 345 root.walk(i => { 346 let p = i.parent 347 if (p && p !== root && p.parent && p.parent === root) { 348 if (typeof i.raws.before !== 'undefined') { 349 let parts = i.raws.before.split('\n') 350 value = parts[parts.length - 1] 351 value = value.replace(/\S/g, '') 352 return false 353 } 354 } 355 }) 356 return value 357 } 358 359 rawSemicolon(root) { 360 let value 361 root.walk(i => { 362 if (i.nodes && i.nodes.length && i.last.type === 'decl') { 363 value = i.raws.semicolon 364 if (typeof value !== 'undefined') return false 365 } 366 }) 367 return value 368 } 369 370 rawValue(node, prop) { 371 let value = node[prop] 372 let raw = node.raws[prop] 373 if (raw && raw.value === value) { 374 return raw.raw 375 } 376 377 return value 378 } 379 380 root(node) { 381 this.body(node) 382 if (node.raws.after) this.builder(node.raws.after) 383 } 384 385 rule(node) { 386 this.block(node, this.rawValue(node, 'selector')) 387 if (node.raws.ownSemicolon) { 388 this.builder(node.raws.ownSemicolon, node, 'end') 389 } 390 } 391 392 stringify(node, semicolon) { 393 /* c8 ignore start */ 394 if (!this[node.type]) { 395 throw new Error( 396 'Unknown AST node type ' + 397 node.type + 398 '. ' + 399 'Maybe you need to change PostCSS stringifier.' 400 ) 401 } 402 /* c8 ignore stop */ 403 this[node.type](node, semicolon) 404 } 405 } 406 407 module.exports = Stringifier 408 Stringifier.default = Stringifier 409 410 411 /***/ }), 412 413 /***/ 356: 414 /***/ ((module, __unused_webpack_exports, __webpack_require__) => { 415 416 "use strict"; 417 418 419 let pico = __webpack_require__(2775) 420 421 let terminalHighlight = __webpack_require__(9746) 422 423 class CssSyntaxError extends Error { 424 constructor(message, line, column, source, file, plugin) { 425 super(message) 426 this.name = 'CssSyntaxError' 427 this.reason = message 428 429 if (file) { 430 this.file = file 431 } 432 if (source) { 433 this.source = source 434 } 435 if (plugin) { 436 this.plugin = plugin 437 } 438 if (typeof line !== 'undefined' && typeof column !== 'undefined') { 439 if (typeof line === 'number') { 440 this.line = line 441 this.column = column 442 } else { 443 this.line = line.line 444 this.column = line.column 445 this.endLine = column.line 446 this.endColumn = column.column 447 } 448 } 449 450 this.setMessage() 451 452 if (Error.captureStackTrace) { 453 Error.captureStackTrace(this, CssSyntaxError) 454 } 455 } 456 457 setMessage() { 458 this.message = this.plugin ? this.plugin + ': ' : '' 459 this.message += this.file ? this.file : '<css input>' 460 if (typeof this.line !== 'undefined') { 461 this.message += ':' + this.line + ':' + this.column 462 } 463 this.message += ': ' + this.reason 464 } 465 466 showSourceCode(color) { 467 if (!this.source) return '' 468 469 let css = this.source 470 if (color == null) color = pico.isColorSupported 471 472 let aside = text => text 473 let mark = text => text 474 let highlight = text => text 475 if (color) { 476 let { bold, gray, red } = pico.createColors(true) 477 mark = text => bold(red(text)) 478 aside = text => gray(text) 479 if (terminalHighlight) { 480 highlight = text => terminalHighlight(text) 481 } 482 } 483 484 let lines = css.split(/\r?\n/) 485 let start = Math.max(this.line - 3, 0) 486 let end = Math.min(this.line + 2, lines.length) 487 let maxWidth = String(end).length 488 489 return lines 490 .slice(start, end) 491 .map((line, index) => { 492 let number = start + 1 + index 493 let gutter = ' ' + (' ' + number).slice(-maxWidth) + ' | ' 494 if (number === this.line) { 495 if (line.length > 160) { 496 let padding = 20 497 let subLineStart = Math.max(0, this.column - padding) 498 let subLineEnd = Math.max( 499 this.column + padding, 500 this.endColumn + padding 501 ) 502 let subLine = line.slice(subLineStart, subLineEnd) 503 504 let spacing = 505 aside(gutter.replace(/\d/g, ' ')) + 506 line 507 .slice(0, Math.min(this.column - 1, padding - 1)) 508 .replace(/[^\t]/g, ' ') 509 510 return ( 511 mark('>') + 512 aside(gutter) + 513 highlight(subLine) + 514 '\n ' + 515 spacing + 516 mark('^') 517 ) 518 } 519 520 let spacing = 521 aside(gutter.replace(/\d/g, ' ')) + 522 line.slice(0, this.column - 1).replace(/[^\t]/g, ' ') 523 524 return ( 525 mark('>') + 526 aside(gutter) + 527 highlight(line) + 528 '\n ' + 529 spacing + 530 mark('^') 531 ) 532 } 533 534 return ' ' + aside(gutter) + highlight(line) 535 }) 536 .join('\n') 537 } 538 539 toString() { 540 let code = this.showSourceCode() 541 if (code) { 542 code = '\n\n' + code + '\n' 543 } 544 return this.name + ': ' + this.message + code 545 } 546 } 547 548 module.exports = CssSyntaxError 549 CssSyntaxError.default = CssSyntaxError 550 551 552 /***/ }), 553 554 /***/ 448: 555 /***/ ((module, __unused_webpack_exports, __webpack_require__) => { 556 557 "use strict"; 558 559 560 let Container = __webpack_require__(683) 561 let Document = __webpack_require__(271) 562 let MapGenerator = __webpack_require__(1670) 563 let parse = __webpack_require__(4295) 564 let Result = __webpack_require__(9055) 565 let Root = __webpack_require__(9434) 566 let stringify = __webpack_require__(633) 567 let { isClean, my } = __webpack_require__(1381) 568 let warnOnce = __webpack_require__(3122) 569 570 const TYPE_TO_CLASS_NAME = { 571 atrule: 'AtRule', 572 comment: 'Comment', 573 decl: 'Declaration', 574 document: 'Document', 575 root: 'Root', 576 rule: 'Rule' 577 } 578 579 const PLUGIN_PROPS = { 580 AtRule: true, 581 AtRuleExit: true, 582 Comment: true, 583 CommentExit: true, 584 Declaration: true, 585 DeclarationExit: true, 586 Document: true, 587 DocumentExit: true, 588 Once: true, 589 OnceExit: true, 590 postcssPlugin: true, 591 prepare: true, 592 Root: true, 593 RootExit: true, 594 Rule: true, 595 RuleExit: true 596 } 597 598 const NOT_VISITORS = { 599 Once: true, 600 postcssPlugin: true, 601 prepare: true 602 } 603 604 const CHILDREN = 0 605 606 function isPromise(obj) { 607 return typeof obj === 'object' && typeof obj.then === 'function' 608 } 609 610 function getEvents(node) { 611 let key = false 612 let type = TYPE_TO_CLASS_NAME[node.type] 613 if (node.type === 'decl') { 614 key = node.prop.toLowerCase() 615 } else if (node.type === 'atrule') { 616 key = node.name.toLowerCase() 617 } 618 619 if (key && node.append) { 620 return [ 621 type, 622 type + '-' + key, 623 CHILDREN, 624 type + 'Exit', 625 type + 'Exit-' + key 626 ] 627 } else if (key) { 628 return [type, type + '-' + key, type + 'Exit', type + 'Exit-' + key] 629 } else if (node.append) { 630 return [type, CHILDREN, type + 'Exit'] 631 } else { 632 return [type, type + 'Exit'] 633 } 634 } 635 636 function toStack(node) { 637 let events 638 if (node.type === 'document') { 639 events = ['Document', CHILDREN, 'DocumentExit'] 640 } else if (node.type === 'root') { 641 events = ['Root', CHILDREN, 'RootExit'] 642 } else { 643 events = getEvents(node) 644 } 645 646 return { 647 eventIndex: 0, 648 events, 649 iterator: 0, 650 node, 651 visitorIndex: 0, 652 visitors: [] 653 } 654 } 655 656 function cleanMarks(node) { 657 node[isClean] = false 658 if (node.nodes) node.nodes.forEach(i => cleanMarks(i)) 659 return node 660 } 661 662 let postcss = {} 663 664 class LazyResult { 665 get content() { 666 return this.stringify().content 667 } 668 669 get css() { 670 return this.stringify().css 671 } 672 673 get map() { 674 return this.stringify().map 675 } 676 677 get messages() { 678 return this.sync().messages 679 } 680 681 get opts() { 682 return this.result.opts 683 } 684 685 get processor() { 686 return this.result.processor 687 } 688 689 get root() { 690 return this.sync().root 691 } 692 693 get [Symbol.toStringTag]() { 694 return 'LazyResult' 695 } 696 697 constructor(processor, css, opts) { 698 this.stringified = false 699 this.processed = false 700 701 let root 702 if ( 703 typeof css === 'object' && 704 css !== null && 705 (css.type === 'root' || css.type === 'document') 706 ) { 707 root = cleanMarks(css) 708 } else if (css instanceof LazyResult || css instanceof Result) { 709 root = cleanMarks(css.root) 710 if (css.map) { 711 if (typeof opts.map === 'undefined') opts.map = {} 712 if (!opts.map.inline) opts.map.inline = false 713 opts.map.prev = css.map 714 } 715 } else { 716 let parser = parse 717 if (opts.syntax) parser = opts.syntax.parse 718 if (opts.parser) parser = opts.parser 719 if (parser.parse) parser = parser.parse 720 721 try { 722 root = parser(css, opts) 723 } catch (error) { 724 this.processed = true 725 this.error = error 726 } 727 728 if (root && !root[my]) { 729 /* c8 ignore next 2 */ 730 Container.rebuild(root) 731 } 732 } 733 734 this.result = new Result(processor, root, opts) 735 this.helpers = { ...postcss, postcss, result: this.result } 736 this.plugins = this.processor.plugins.map(plugin => { 737 if (typeof plugin === 'object' && plugin.prepare) { 738 return { ...plugin, ...plugin.prepare(this.result) } 739 } else { 740 return plugin 741 } 742 }) 743 } 744 745 async() { 746 if (this.error) return Promise.reject(this.error) 747 if (this.processed) return Promise.resolve(this.result) 748 if (!this.processing) { 749 this.processing = this.runAsync() 750 } 751 return this.processing 752 } 753 754 catch(onRejected) { 755 return this.async().catch(onRejected) 756 } 757 758 finally(onFinally) { 759 return this.async().then(onFinally, onFinally) 760 } 761 762 getAsyncError() { 763 throw new Error('Use process(css).then(cb) to work with async plugins') 764 } 765 766 handleError(error, node) { 767 let plugin = this.result.lastPlugin 768 try { 769 if (node) node.addToError(error) 770 this.error = error 771 if (error.name === 'CssSyntaxError' && !error.plugin) { 772 error.plugin = plugin.postcssPlugin 773 error.setMessage() 774 } else if (plugin.postcssVersion) { 775 if (false) {} 776 } 777 } catch (err) { 778 /* c8 ignore next 3 */ 779 // eslint-disable-next-line no-console 780 if (console && console.error) console.error(err) 781 } 782 return error 783 } 784 785 prepareVisitors() { 786 this.listeners = {} 787 let add = (plugin, type, cb) => { 788 if (!this.listeners[type]) this.listeners[type] = [] 789 this.listeners[type].push([plugin, cb]) 790 } 791 for (let plugin of this.plugins) { 792 if (typeof plugin === 'object') { 793 for (let event in plugin) { 794 if (!PLUGIN_PROPS[event] && /^[A-Z]/.test(event)) { 795 throw new Error( 796 `Unknown event $event} in $plugin.postcssPlugin}. ` + 797 `Try to update PostCSS ($this.processor.version} now).` 798 ) 799 } 800 if (!NOT_VISITORS[event]) { 801 if (typeof plugin[event] === 'object') { 802 for (let filter in plugin[event]) { 803 if (filter === '*') { 804 add(plugin, event, plugin[event][filter]) 805 } else { 806 add( 807 plugin, 808 event + '-' + filter.toLowerCase(), 809 plugin[event][filter] 810 ) 811 } 812 } 813 } else if (typeof plugin[event] === 'function') { 814 add(plugin, event, plugin[event]) 815 } 816 } 817 } 818 } 819 } 820 this.hasListener = Object.keys(this.listeners).length > 0 821 } 822 823 async runAsync() { 824 this.plugin = 0 825 for (let i = 0; i < this.plugins.length; i++) { 826 let plugin = this.plugins[i] 827 let promise = this.runOnRoot(plugin) 828 if (isPromise(promise)) { 829 try { 830 await promise 831 } catch (error) { 832 throw this.handleError(error) 833 } 834 } 835 } 836 837 this.prepareVisitors() 838 if (this.hasListener) { 839 let root = this.result.root 840 while (!root[isClean]) { 841 root[isClean] = true 842 let stack = [toStack(root)] 843 while (stack.length > 0) { 844 let promise = this.visitTick(stack) 845 if (isPromise(promise)) { 846 try { 847 await promise 848 } catch (e) { 849 let node = stack[stack.length - 1].node 850 throw this.handleError(e, node) 851 } 852 } 853 } 854 } 855 856 if (this.listeners.OnceExit) { 857 for (let [plugin, visitor] of this.listeners.OnceExit) { 858 this.result.lastPlugin = plugin 859 try { 860 if (root.type === 'document') { 861 let roots = root.nodes.map(subRoot => 862 visitor(subRoot, this.helpers) 863 ) 864 865 await Promise.all(roots) 866 } else { 867 await visitor(root, this.helpers) 868 } 869 } catch (e) { 870 throw this.handleError(e) 871 } 872 } 873 } 874 } 875 876 this.processed = true 877 return this.stringify() 878 } 879 880 runOnRoot(plugin) { 881 this.result.lastPlugin = plugin 882 try { 883 if (typeof plugin === 'object' && plugin.Once) { 884 if (this.result.root.type === 'document') { 885 let roots = this.result.root.nodes.map(root => 886 plugin.Once(root, this.helpers) 887 ) 888 889 if (isPromise(roots[0])) { 890 return Promise.all(roots) 891 } 892 893 return roots 894 } 895 896 return plugin.Once(this.result.root, this.helpers) 897 } else if (typeof plugin === 'function') { 898 return plugin(this.result.root, this.result) 899 } 900 } catch (error) { 901 throw this.handleError(error) 902 } 903 } 904 905 stringify() { 906 if (this.error) throw this.error 907 if (this.stringified) return this.result 908 this.stringified = true 909 910 this.sync() 911 912 let opts = this.result.opts 913 let str = stringify 914 if (opts.syntax) str = opts.syntax.stringify 915 if (opts.stringifier) str = opts.stringifier 916 if (str.stringify) str = str.stringify 917 918 let map = new MapGenerator(str, this.result.root, this.result.opts) 919 let data = map.generate() 920 this.result.css = data[0] 921 this.result.map = data[1] 922 923 return this.result 924 } 925 926 sync() { 927 if (this.error) throw this.error 928 if (this.processed) return this.result 929 this.processed = true 930 931 if (this.processing) { 932 throw this.getAsyncError() 933 } 934 935 for (let plugin of this.plugins) { 936 let promise = this.runOnRoot(plugin) 937 if (isPromise(promise)) { 938 throw this.getAsyncError() 939 } 940 } 941 942 this.prepareVisitors() 943 if (this.hasListener) { 944 let root = this.result.root 945 while (!root[isClean]) { 946 root[isClean] = true 947 this.walkSync(root) 948 } 949 if (this.listeners.OnceExit) { 950 if (root.type === 'document') { 951 for (let subRoot of root.nodes) { 952 this.visitSync(this.listeners.OnceExit, subRoot) 953 } 954 } else { 955 this.visitSync(this.listeners.OnceExit, root) 956 } 957 } 958 } 959 960 return this.result 961 } 962 963 then(onFulfilled, onRejected) { 964 if (false) {} 965 return this.async().then(onFulfilled, onRejected) 966 } 967 968 toString() { 969 return this.css 970 } 971 972 visitSync(visitors, node) { 973 for (let [plugin, visitor] of visitors) { 974 this.result.lastPlugin = plugin 975 let promise 976 try { 977 promise = visitor(node, this.helpers) 978 } catch (e) { 979 throw this.handleError(e, node.proxyOf) 980 } 981 if (node.type !== 'root' && node.type !== 'document' && !node.parent) { 982 return true 983 } 984 if (isPromise(promise)) { 985 throw this.getAsyncError() 986 } 987 } 988 } 989 990 visitTick(stack) { 991 let visit = stack[stack.length - 1] 992 let { node, visitors } = visit 993 994 if (node.type !== 'root' && node.type !== 'document' && !node.parent) { 995 stack.pop() 996 return 997 } 998 999 if (visitors.length > 0 && visit.visitorIndex < visitors.length) { 1000 let [plugin, visitor] = visitors[visit.visitorIndex] 1001 visit.visitorIndex += 1 1002 if (visit.visitorIndex === visitors.length) { 1003 visit.visitors = [] 1004 visit.visitorIndex = 0 1005 } 1006 this.result.lastPlugin = plugin 1007 try { 1008 return visitor(node.toProxy(), this.helpers) 1009 } catch (e) { 1010 throw this.handleError(e, node) 1011 } 1012 } 1013 1014 if (visit.iterator !== 0) { 1015 let iterator = visit.iterator 1016 let child 1017 while ((child = node.nodes[node.indexes[iterator]])) { 1018 node.indexes[iterator] += 1 1019 if (!child[isClean]) { 1020 child[isClean] = true 1021 stack.push(toStack(child)) 1022 return 1023 } 1024 } 1025 visit.iterator = 0 1026 delete node.indexes[iterator] 1027 } 1028 1029 let events = visit.events 1030 while (visit.eventIndex < events.length) { 1031 let event = events[visit.eventIndex] 1032 visit.eventIndex += 1 1033 if (event === CHILDREN) { 1034 if (node.nodes && node.nodes.length) { 1035 node[isClean] = true 1036 visit.iterator = node.getIterator() 1037 } 1038 return 1039 } else if (this.listeners[event]) { 1040 visit.visitors = this.listeners[event] 1041 return 1042 } 1043 } 1044 stack.pop() 1045 } 1046 1047 walkSync(node) { 1048 node[isClean] = true 1049 let events = getEvents(node) 1050 for (let event of events) { 1051 if (event === CHILDREN) { 1052 if (node.nodes) { 1053 node.each(child => { 1054 if (!child[isClean]) this.walkSync(child) 1055 }) 1056 } 1057 } else { 1058 let visitors = this.listeners[event] 1059 if (visitors) { 1060 if (this.visitSync(visitors, node.toProxy())) return 1061 } 1062 } 1063 } 1064 } 1065 1066 warnings() { 1067 return this.sync().warnings() 1068 } 1069 } 1070 1071 LazyResult.registerPostcss = dependant => { 1072 postcss = dependant 1073 } 1074 1075 module.exports = LazyResult 1076 LazyResult.default = LazyResult 1077 1078 Root.registerLazyResult(LazyResult) 1079 Document.registerLazyResult(LazyResult) 1080 1081 1082 /***/ }), 1083 1084 /***/ 461: 1085 /***/ ((module, __unused_webpack_exports, __webpack_require__) => { 1086 1087 // Load in dependencies 1088 var computedStyle = __webpack_require__(6109); 1089 1090 /** 1091 * Calculate the `line-height` of a given node 1092 * @param {HTMLElement} node Element to calculate line height of. Must be in the DOM. 1093 * @returns {Number} `line-height` of the element in pixels 1094 */ 1095 function lineHeight(node) { 1096 // Grab the line-height via style 1097 var lnHeightStr = computedStyle(node, 'line-height'); 1098 var lnHeight = parseFloat(lnHeightStr, 10); 1099 1100 // If the lineHeight did not contain a unit (i.e. it was numeric), convert it to ems (e.g. '2.3' === '2.3em') 1101 if (lnHeightStr === lnHeight + '') { 1102 // Save the old lineHeight style and update the em unit to the element 1103 var _lnHeightStyle = node.style.lineHeight; 1104 node.style.lineHeight = lnHeightStr + 'em'; 1105 1106 // Calculate the em based height 1107 lnHeightStr = computedStyle(node, 'line-height'); 1108 lnHeight = parseFloat(lnHeightStr, 10); 1109 1110 // Revert the lineHeight style 1111 if (_lnHeightStyle) { 1112 node.style.lineHeight = _lnHeightStyle; 1113 } else { 1114 delete node.style.lineHeight; 1115 } 1116 } 1117 1118 // If the lineHeight is in `pt`, convert it to pixels (4px for 3pt) 1119 // DEV: `em` units are converted to `pt` in IE6 1120 // Conversion ratio from https://developer.mozilla.org/en-US/docs/Web/CSS/length 1121 if (lnHeightStr.indexOf('pt') !== -1) { 1122 lnHeight *= 4; 1123 lnHeight /= 3; 1124 // Otherwise, if the lineHeight is in `mm`, convert it to pixels (96px for 25.4mm) 1125 } else if (lnHeightStr.indexOf('mm') !== -1) { 1126 lnHeight *= 96; 1127 lnHeight /= 25.4; 1128 // Otherwise, if the lineHeight is in `cm`, convert it to pixels (96px for 2.54cm) 1129 } else if (lnHeightStr.indexOf('cm') !== -1) { 1130 lnHeight *= 96; 1131 lnHeight /= 2.54; 1132 // Otherwise, if the lineHeight is in `in`, convert it to pixels (96px for 1in) 1133 } else if (lnHeightStr.indexOf('in') !== -1) { 1134 lnHeight *= 96; 1135 // Otherwise, if the lineHeight is in `pc`, convert it to pixels (12pt for 1pc) 1136 } else if (lnHeightStr.indexOf('pc') !== -1) { 1137 lnHeight *= 16; 1138 } 1139 1140 // Continue our computation 1141 lnHeight = Math.round(lnHeight); 1142 1143 // If the line-height is "normal", calculate by font-size 1144 if (lnHeightStr === 'normal') { 1145 // Create a temporary node 1146 var nodeName = node.nodeName; 1147 var _node = document.createElement(nodeName); 1148 _node.innerHTML = ' '; 1149 1150 // If we have a text area, reset it to only 1 row 1151 // https://github.com/twolfson/line-height/issues/4 1152 if (nodeName.toUpperCase() === 'TEXTAREA') { 1153 _node.setAttribute('rows', '1'); 1154 } 1155 1156 // Set the font-size of the element 1157 var fontSizeStr = computedStyle(node, 'font-size'); 1158 _node.style.fontSize = fontSizeStr; 1159 1160 // Remove default padding/border which can affect offset height 1161 // https://github.com/twolfson/line-height/issues/4 1162 // https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/offsetHeight 1163 _node.style.padding = '0px'; 1164 _node.style.border = '0px'; 1165 1166 // Append it to the body 1167 var body = document.body; 1168 body.appendChild(_node); 1169 1170 // Assume the line height of the element is the height 1171 var height = _node.offsetHeight; 1172 lnHeight = height; 1173 1174 // Remove our child from the DOM 1175 body.removeChild(_node); 1176 } 1177 1178 // Return the calculated height 1179 return lnHeight; 1180 } 1181 1182 // Export lineHeight 1183 module.exports = lineHeight; 1184 1185 1186 /***/ }), 1187 1188 /***/ 628: 1189 /***/ ((module, __unused_webpack_exports, __webpack_require__) => { 1190 1191 "use strict"; 1192 /** 1193 * Copyright (c) 2013-present, Facebook, Inc. 1194 * 1195 * This source code is licensed under the MIT license found in the 1196 * LICENSE file in the root directory of this source tree. 1197 */ 1198 1199 1200 1201 var ReactPropTypesSecret = __webpack_require__(4067); 1202 1203 function emptyFunction() {} 1204 function emptyFunctionWithReset() {} 1205 emptyFunctionWithReset.resetWarningCache = emptyFunction; 1206 1207 module.exports = function() { 1208 function shim(props, propName, componentName, location, propFullName, secret) { 1209 if (secret === ReactPropTypesSecret) { 1210 // It is still safe when called from React. 1211 return; 1212 } 1213 var err = new Error( 1214 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' + 1215 'Use PropTypes.checkPropTypes() to call them. ' + 1216 'Read more at http://fb.me/use-check-prop-types' 1217 ); 1218 err.name = 'Invariant Violation'; 1219 throw err; 1220 }; 1221 shim.isRequired = shim; 1222 function getShim() { 1223 return shim; 1224 }; 1225 // Important! 1226 // Keep this list in sync with production version in `./factoryWithTypeCheckers.js`. 1227 var ReactPropTypes = { 1228 array: shim, 1229 bigint: shim, 1230 bool: shim, 1231 func: shim, 1232 number: shim, 1233 object: shim, 1234 string: shim, 1235 symbol: shim, 1236 1237 any: shim, 1238 arrayOf: getShim, 1239 element: shim, 1240 elementType: shim, 1241 instanceOf: getShim, 1242 node: shim, 1243 objectOf: getShim, 1244 oneOf: getShim, 1245 oneOfType: getShim, 1246 shape: getShim, 1247 exact: getShim, 1248 1249 checkPropTypes: emptyFunctionWithReset, 1250 resetWarningCache: emptyFunction 1251 }; 1252 1253 ReactPropTypes.PropTypes = ReactPropTypes; 1254 1255 return ReactPropTypes; 1256 }; 1257 1258 1259 /***/ }), 1260 1261 /***/ 633: 1262 /***/ ((module, __unused_webpack_exports, __webpack_require__) => { 1263 1264 "use strict"; 1265 1266 1267 let Stringifier = __webpack_require__(346) 1268 1269 function stringify(node, builder) { 1270 let str = new Stringifier(builder) 1271 str.stringify(node) 1272 } 1273 1274 module.exports = stringify 1275 stringify.default = stringify 1276 1277 1278 /***/ }), 1279 1280 /***/ 683: 1281 /***/ ((module, __unused_webpack_exports, __webpack_require__) => { 1282 1283 "use strict"; 1284 1285 1286 let Comment = __webpack_require__(6589) 1287 let Declaration = __webpack_require__(1516) 1288 let Node = __webpack_require__(7490) 1289 let { isClean, my } = __webpack_require__(1381) 1290 1291 let AtRule, parse, Root, Rule 1292 1293 function cleanSource(nodes) { 1294 return nodes.map(i => { 1295 if (i.nodes) i.nodes = cleanSource(i.nodes) 1296 delete i.source 1297 return i 1298 }) 1299 } 1300 1301 function markTreeDirty(node) { 1302 node[isClean] = false 1303 if (node.proxyOf.nodes) { 1304 for (let i of node.proxyOf.nodes) { 1305 markTreeDirty(i) 1306 } 1307 } 1308 } 1309 1310 class Container extends Node { 1311 get first() { 1312 if (!this.proxyOf.nodes) return undefined 1313 return this.proxyOf.nodes[0] 1314 } 1315 1316 get last() { 1317 if (!this.proxyOf.nodes) return undefined 1318 return this.proxyOf.nodes[this.proxyOf.nodes.length - 1] 1319 } 1320 1321 append(...children) { 1322 for (let child of children) { 1323 let nodes = this.normalize(child, this.last) 1324 for (let node of nodes) this.proxyOf.nodes.push(node) 1325 } 1326 1327 this.markDirty() 1328 1329 return this 1330 } 1331 1332 cleanRaws(keepBetween) { 1333 super.cleanRaws(keepBetween) 1334 if (this.nodes) { 1335 for (let node of this.nodes) node.cleanRaws(keepBetween) 1336 } 1337 } 1338 1339 each(callback) { 1340 if (!this.proxyOf.nodes) return undefined 1341 let iterator = this.getIterator() 1342 1343 let index, result 1344 while (this.indexes[iterator] < this.proxyOf.nodes.length) { 1345 index = this.indexes[iterator] 1346 result = callback(this.proxyOf.nodes[index], index) 1347 if (result === false) break 1348 1349 this.indexes[iterator] += 1 1350 } 1351 1352 delete this.indexes[iterator] 1353 return result 1354 } 1355 1356 every(condition) { 1357 return this.nodes.every(condition) 1358 } 1359 1360 getIterator() { 1361 if (!this.lastEach) this.lastEach = 0 1362 if (!this.indexes) this.indexes = {} 1363 1364 this.lastEach += 1 1365 let iterator = this.lastEach 1366 this.indexes[iterator] = 0 1367 1368 return iterator 1369 } 1370 1371 getProxyProcessor() { 1372 return { 1373 get(node, prop) { 1374 if (prop === 'proxyOf') { 1375 return node 1376 } else if (!node[prop]) { 1377 return node[prop] 1378 } else if ( 1379 prop === 'each' || 1380 (typeof prop === 'string' && prop.startsWith('walk')) 1381 ) { 1382 return (...args) => { 1383 return node[prop]( 1384 ...args.map(i => { 1385 if (typeof i === 'function') { 1386 return (child, index) => i(child.toProxy(), index) 1387 } else { 1388 return i 1389 } 1390 }) 1391 ) 1392 } 1393 } else if (prop === 'every' || prop === 'some') { 1394 return cb => { 1395 return node[prop]((child, ...other) => 1396 cb(child.toProxy(), ...other) 1397 ) 1398 } 1399 } else if (prop === 'root') { 1400 return () => node.root().toProxy() 1401 } else if (prop === 'nodes') { 1402 return node.nodes.map(i => i.toProxy()) 1403 } else if (prop === 'first' || prop === 'last') { 1404 return node[prop].toProxy() 1405 } else { 1406 return node[prop] 1407 } 1408 }, 1409 1410 set(node, prop, value) { 1411 if (node[prop] === value) return true 1412 node[prop] = value 1413 if (prop === 'name' || prop === 'params' || prop === 'selector') { 1414 node.markDirty() 1415 } 1416 return true 1417 } 1418 } 1419 } 1420 1421 index(child) { 1422 if (typeof child === 'number') return child 1423 if (child.proxyOf) child = child.proxyOf 1424 return this.proxyOf.nodes.indexOf(child) 1425 } 1426 1427 insertAfter(exist, add) { 1428 let existIndex = this.index(exist) 1429 let nodes = this.normalize(add, this.proxyOf.nodes[existIndex]).reverse() 1430 existIndex = this.index(exist) 1431 for (let node of nodes) this.proxyOf.nodes.splice(existIndex + 1, 0, node) 1432 1433 let index 1434 for (let id in this.indexes) { 1435 index = this.indexes[id] 1436 if (existIndex < index) { 1437 this.indexes[id] = index + nodes.length 1438 } 1439 } 1440 1441 this.markDirty() 1442 1443 return this 1444 } 1445 1446 insertBefore(exist, add) { 1447 let existIndex = this.index(exist) 1448 let type = existIndex === 0 ? 'prepend' : false 1449 let nodes = this.normalize( 1450 add, 1451 this.proxyOf.nodes[existIndex], 1452 type 1453 ).reverse() 1454 existIndex = this.index(exist) 1455 for (let node of nodes) this.proxyOf.nodes.splice(existIndex, 0, node) 1456 1457 let index 1458 for (let id in this.indexes) { 1459 index = this.indexes[id] 1460 if (existIndex <= index) { 1461 this.indexes[id] = index + nodes.length 1462 } 1463 } 1464 1465 this.markDirty() 1466 1467 return this 1468 } 1469 1470 normalize(nodes, sample) { 1471 if (typeof nodes === 'string') { 1472 nodes = cleanSource(parse(nodes).nodes) 1473 } else if (typeof nodes === 'undefined') { 1474 nodes = [] 1475 } else if (Array.isArray(nodes)) { 1476 nodes = nodes.slice(0) 1477 for (let i of nodes) { 1478 if (i.parent) i.parent.removeChild(i, 'ignore') 1479 } 1480 } else if (nodes.type === 'root' && this.type !== 'document') { 1481 nodes = nodes.nodes.slice(0) 1482 for (let i of nodes) { 1483 if (i.parent) i.parent.removeChild(i, 'ignore') 1484 } 1485 } else if (nodes.type) { 1486 nodes = [nodes] 1487 } else if (nodes.prop) { 1488 if (typeof nodes.value === 'undefined') { 1489 throw new Error('Value field is missed in node creation') 1490 } else if (typeof nodes.value !== 'string') { 1491 nodes.value = String(nodes.value) 1492 } 1493 nodes = [new Declaration(nodes)] 1494 } else if (nodes.selector || nodes.selectors) { 1495 nodes = [new Rule(nodes)] 1496 } else if (nodes.name) { 1497 nodes = [new AtRule(nodes)] 1498 } else if (nodes.text) { 1499 nodes = [new Comment(nodes)] 1500 } else { 1501 throw new Error('Unknown node type in node creation') 1502 } 1503 1504 let processed = nodes.map(i => { 1505 /* c8 ignore next */ 1506 if (!i[my]) Container.rebuild(i) 1507 i = i.proxyOf 1508 if (i.parent) i.parent.removeChild(i) 1509 if (i[isClean]) markTreeDirty(i) 1510 1511 if (!i.raws) i.raws = {} 1512 if (typeof i.raws.before === 'undefined') { 1513 if (sample && typeof sample.raws.before !== 'undefined') { 1514 i.raws.before = sample.raws.before.replace(/\S/g, '') 1515 } 1516 } 1517 i.parent = this.proxyOf 1518 return i 1519 }) 1520 1521 return processed 1522 } 1523 1524 prepend(...children) { 1525 children = children.reverse() 1526 for (let child of children) { 1527 let nodes = this.normalize(child, this.first, 'prepend').reverse() 1528 for (let node of nodes) this.proxyOf.nodes.unshift(node) 1529 for (let id in this.indexes) { 1530 this.indexes[id] = this.indexes[id] + nodes.length 1531 } 1532 } 1533 1534 this.markDirty() 1535 1536 return this 1537 } 1538 1539 push(child) { 1540 child.parent = this 1541 this.proxyOf.nodes.push(child) 1542 return this 1543 } 1544 1545 removeAll() { 1546 for (let node of this.proxyOf.nodes) node.parent = undefined 1547 this.proxyOf.nodes = [] 1548 1549 this.markDirty() 1550 1551 return this 1552 } 1553 1554 removeChild(child) { 1555 child = this.index(child) 1556 this.proxyOf.nodes[child].parent = undefined 1557 this.proxyOf.nodes.splice(child, 1) 1558 1559 let index 1560 for (let id in this.indexes) { 1561 index = this.indexes[id] 1562 if (index >= child) { 1563 this.indexes[id] = index - 1 1564 } 1565 } 1566 1567 this.markDirty() 1568 1569 return this 1570 } 1571 1572 replaceValues(pattern, opts, callback) { 1573 if (!callback) { 1574 callback = opts 1575 opts = {} 1576 } 1577 1578 this.walkDecls(decl => { 1579 if (opts.props && !opts.props.includes(decl.prop)) return 1580 if (opts.fast && !decl.value.includes(opts.fast)) return 1581 1582 decl.value = decl.value.replace(pattern, callback) 1583 }) 1584 1585 this.markDirty() 1586 1587 return this 1588 } 1589 1590 some(condition) { 1591 return this.nodes.some(condition) 1592 } 1593 1594 walk(callback) { 1595 return this.each((child, i) => { 1596 let result 1597 try { 1598 result = callback(child, i) 1599 } catch (e) { 1600 throw child.addToError(e) 1601 } 1602 if (result !== false && child.walk) { 1603 result = child.walk(callback) 1604 } 1605 1606 return result 1607 }) 1608 } 1609 1610 walkAtRules(name, callback) { 1611 if (!callback) { 1612 callback = name 1613 return this.walk((child, i) => { 1614 if (child.type === 'atrule') { 1615 return callback(child, i) 1616 } 1617 }) 1618 } 1619 if (name instanceof RegExp) { 1620 return this.walk((child, i) => { 1621 if (child.type === 'atrule' && name.test(child.name)) { 1622 return callback(child, i) 1623 } 1624 }) 1625 } 1626 return this.walk((child, i) => { 1627 if (child.type === 'atrule' && child.name === name) { 1628 return callback(child, i) 1629 } 1630 }) 1631 } 1632 1633 walkComments(callback) { 1634 return this.walk((child, i) => { 1635 if (child.type === 'comment') { 1636 return callback(child, i) 1637 } 1638 }) 1639 } 1640 1641 walkDecls(prop, callback) { 1642 if (!callback) { 1643 callback = prop 1644 return this.walk((child, i) => { 1645 if (child.type === 'decl') { 1646 return callback(child, i) 1647 } 1648 }) 1649 } 1650 if (prop instanceof RegExp) { 1651 return this.walk((child, i) => { 1652 if (child.type === 'decl' && prop.test(child.prop)) { 1653 return callback(child, i) 1654 } 1655 }) 1656 } 1657 return this.walk((child, i) => { 1658 if (child.type === 'decl' && child.prop === prop) { 1659 return callback(child, i) 1660 } 1661 }) 1662 } 1663 1664 walkRules(selector, callback) { 1665 if (!callback) { 1666 callback = selector 1667 1668 return this.walk((child, i) => { 1669 if (child.type === 'rule') { 1670 return callback(child, i) 1671 } 1672 }) 1673 } 1674 if (selector instanceof RegExp) { 1675 return this.walk((child, i) => { 1676 if (child.type === 'rule' && selector.test(child.selector)) { 1677 return callback(child, i) 1678 } 1679 }) 1680 } 1681 return this.walk((child, i) => { 1682 if (child.type === 'rule' && child.selector === selector) { 1683 return callback(child, i) 1684 } 1685 }) 1686 } 1687 } 1688 1689 Container.registerParse = dependant => { 1690 parse = dependant 1691 } 1692 1693 Container.registerRule = dependant => { 1694 Rule = dependant 1695 } 1696 1697 Container.registerAtRule = dependant => { 1698 AtRule = dependant 1699 } 1700 1701 Container.registerRoot = dependant => { 1702 Root = dependant 1703 } 1704 1705 module.exports = Container 1706 Container.default = Container 1707 1708 /* c8 ignore start */ 1709 Container.rebuild = node => { 1710 if (node.type === 'atrule') { 1711 Object.setPrototypeOf(node, AtRule.prototype) 1712 } else if (node.type === 'rule') { 1713 Object.setPrototypeOf(node, Rule.prototype) 1714 } else if (node.type === 'decl') { 1715 Object.setPrototypeOf(node, Declaration.prototype) 1716 } else if (node.type === 'comment') { 1717 Object.setPrototypeOf(node, Comment.prototype) 1718 } else if (node.type === 'root') { 1719 Object.setPrototypeOf(node, Root.prototype) 1720 } 1721 1722 node[my] = true 1723 1724 if (node.nodes) { 1725 node.nodes.forEach(child => { 1726 Container.rebuild(child) 1727 }) 1728 } 1729 } 1730 /* c8 ignore stop */ 1731 1732 1733 /***/ }), 1734 1735 /***/ 1087: 1736 /***/ ((module, __unused_webpack_exports, __webpack_require__) => { 1737 1738 "use strict"; 1739 /** 1740 * Copyright 2013-2015, Facebook, Inc. 1741 * All rights reserved. 1742 * 1743 * This source code is licensed under the BSD-style license found in the 1744 * LICENSE file in the root directory of this source tree. An additional grant 1745 * of patent rights can be found in the PATENTS file in the same directory. 1746 * 1747 * @providesModule isEventSupported 1748 */ 1749 1750 1751 1752 var ExecutionEnvironment = __webpack_require__(8202); 1753 1754 var useHasFeature; 1755 if (ExecutionEnvironment.canUseDOM) { 1756 useHasFeature = 1757 document.implementation && 1758 document.implementation.hasFeature && 1759 // always returns true in newer browsers as per the standard. 1760 // @see http://dom.spec.whatwg.org/#dom-domimplementation-hasfeature 1761 document.implementation.hasFeature('', '') !== true; 1762 } 1763 1764 /** 1765 * Checks if an event is supported in the current execution environment. 1766 * 1767 * NOTE: This will not work correctly for non-generic events such as `change`, 1768 * `reset`, `load`, `error`, and `select`. 1769 * 1770 * Borrows from Modernizr. 1771 * 1772 * @param {string} eventNameSuffix Event name, e.g. "click". 1773 * @param {?boolean} capture Check if the capture phase is supported. 1774 * @return {boolean} True if the event is supported. 1775 * @internal 1776 * @license Modernizr 3.0.0pre (Custom Build) | MIT 1777 */ 1778 function isEventSupported(eventNameSuffix, capture) { 1779 if (!ExecutionEnvironment.canUseDOM || 1780 capture && !('addEventListener' in document)) { 1781 return false; 1782 } 1783 1784 var eventName = 'on' + eventNameSuffix; 1785 var isSupported = eventName in document; 1786 1787 if (!isSupported) { 1788 var element = document.createElement('div'); 1789 element.setAttribute(eventName, 'return;'); 1790 isSupported = typeof element[eventName] === 'function'; 1791 } 1792 1793 if (!isSupported && useHasFeature && eventNameSuffix === 'wheel') { 1794 // This is the only way to test support for the `wheel` event in IE9+. 1795 isSupported = document.implementation.hasFeature('Events.wheel', '3.0'); 1796 } 1797 1798 return isSupported; 1799 } 1800 1801 module.exports = isEventSupported; 1802 1803 1804 /***/ }), 1805 1806 /***/ 1326: 1807 /***/ ((module, __unused_webpack_exports, __webpack_require__) => { 1808 1809 "use strict"; 1810 1811 1812 let Container = __webpack_require__(683) 1813 1814 class AtRule extends Container { 1815 constructor(defaults) { 1816 super(defaults) 1817 this.type = 'atrule' 1818 } 1819 1820 append(...children) { 1821 if (!this.proxyOf.nodes) this.nodes = [] 1822 return super.append(...children) 1823 } 1824 1825 prepend(...children) { 1826 if (!this.proxyOf.nodes) this.nodes = [] 1827 return super.prepend(...children) 1828 } 1829 } 1830 1831 module.exports = AtRule 1832 AtRule.default = AtRule 1833 1834 Container.registerAtRule(AtRule) 1835 1836 1837 /***/ }), 1838 1839 /***/ 1381: 1840 /***/ ((module) => { 1841 1842 "use strict"; 1843 1844 1845 module.exports.isClean = Symbol('isClean') 1846 1847 module.exports.my = Symbol('my') 1848 1849 1850 /***/ }), 1851 1852 /***/ 1443: 1853 /***/ ((module) => { 1854 1855 module.exports = function postcssPrefixSelector(options) { 1856 const prefix = options.prefix; 1857 const prefixWithSpace = /\s+$/.test(prefix) ? prefix : `$prefix} `; 1858 const ignoreFiles = options.ignoreFiles ? [].concat(options.ignoreFiles) : []; 1859 const includeFiles = options.includeFiles 1860 ? [].concat(options.includeFiles) 1861 : []; 1862 1863 return function (root) { 1864 if ( 1865 ignoreFiles.length && 1866 root.source.input.file && 1867 isFileInArray(root.source.input.file, ignoreFiles) 1868 ) { 1869 return; 1870 } 1871 if ( 1872 includeFiles.length && 1873 root.source.input.file && 1874 !isFileInArray(root.source.input.file, includeFiles) 1875 ) { 1876 return; 1877 } 1878 1879 root.walkRules((rule) => { 1880 const keyframeRules = [ 1881 'keyframes', 1882 '-webkit-keyframes', 1883 '-moz-keyframes', 1884 '-o-keyframes', 1885 '-ms-keyframes', 1886 ]; 1887 1888 if (rule.parent && keyframeRules.includes(rule.parent.name)) { 1889 return; 1890 } 1891 1892 rule.selectors = rule.selectors.map((selector) => { 1893 if (options.exclude && excludeSelector(selector, options.exclude)) { 1894 return selector; 1895 } 1896 1897 if (options.transform) { 1898 return options.transform( 1899 prefix, 1900 selector, 1901 prefixWithSpace + selector, 1902 root.source.input.file, 1903 rule 1904 ); 1905 } 1906 1907 return prefixWithSpace + selector; 1908 }); 1909 }); 1910 }; 1911 }; 1912 1913 function isFileInArray(file, arr) { 1914 return arr.some((ruleOrString) => { 1915 if (ruleOrString instanceof RegExp) { 1916 return ruleOrString.test(file); 1917 } 1918 1919 return file.includes(ruleOrString); 1920 }); 1921 } 1922 1923 function excludeSelector(selector, excludeArr) { 1924 return excludeArr.some((excludeRule) => { 1925 if (excludeRule instanceof RegExp) { 1926 return excludeRule.test(selector); 1927 } 1928 1929 return selector === excludeRule; 1930 }); 1931 } 1932 1933 1934 /***/ }), 1935 1936 /***/ 1516: 1937 /***/ ((module, __unused_webpack_exports, __webpack_require__) => { 1938 1939 "use strict"; 1940 1941 1942 let Node = __webpack_require__(7490) 1943 1944 class Declaration extends Node { 1945 get variable() { 1946 return this.prop.startsWith('--') || this.prop[0] === '$' 1947 } 1948 1949 constructor(defaults) { 1950 if ( 1951 defaults && 1952 typeof defaults.value !== 'undefined' && 1953 typeof defaults.value !== 'string' 1954 ) { 1955 defaults = { ...defaults, value: String(defaults.value) } 1956 } 1957 super(defaults) 1958 this.type = 'decl' 1959 } 1960 } 1961 1962 module.exports = Declaration 1963 Declaration.default = Declaration 1964 1965 1966 /***/ }), 1967 1968 /***/ 1524: 1969 /***/ ((module) => { 1970 1971 var minus = "-".charCodeAt(0); 1972 var plus = "+".charCodeAt(0); 1973 var dot = ".".charCodeAt(0); 1974 var exp = "e".charCodeAt(0); 1975 var EXP = "E".charCodeAt(0); 1976 1977 // Check if three code points would start a number 1978 // https://www.w3.org/TR/css-syntax-3/#starts-with-a-number 1979 function likeNumber(value) { 1980 var code = value.charCodeAt(0); 1981 var nextCode; 1982 1983 if (code === plus || code === minus) { 1984 nextCode = value.charCodeAt(1); 1985 1986 if (nextCode >= 48 && nextCode <= 57) { 1987 return true; 1988 } 1989 1990 var nextNextCode = value.charCodeAt(2); 1991 1992 if (nextCode === dot && nextNextCode >= 48 && nextNextCode <= 57) { 1993 return true; 1994 } 1995 1996 return false; 1997 } 1998 1999 if (code === dot) { 2000 nextCode = value.charCodeAt(1); 2001 2002 if (nextCode >= 48 && nextCode <= 57) { 2003 return true; 2004 } 2005 2006 return false; 2007 } 2008 2009 if (code >= 48 && code <= 57) { 2010 return true; 2011 } 2012 2013 return false; 2014 } 2015 2016 // Consume a number 2017 // https://www.w3.org/TR/css-syntax-3/#consume-number 2018 module.exports = function(value) { 2019 var pos = 0; 2020 var length = value.length; 2021 var code; 2022 var nextCode; 2023 var nextNextCode; 2024 2025 if (length === 0 || !likeNumber(value)) { 2026 return false; 2027 } 2028 2029 code = value.charCodeAt(pos); 2030 2031 if (code === plus || code === minus) { 2032 pos++; 2033 } 2034 2035 while (pos < length) { 2036 code = value.charCodeAt(pos); 2037 2038 if (code < 48 || code > 57) { 2039 break; 2040 } 2041 2042 pos += 1; 2043 } 2044 2045 code = value.charCodeAt(pos); 2046 nextCode = value.charCodeAt(pos + 1); 2047 2048 if (code === dot && nextCode >= 48 && nextCode <= 57) { 2049 pos += 2; 2050 2051 while (pos < length) { 2052 code = value.charCodeAt(pos); 2053 2054 if (code < 48 || code > 57) { 2055 break; 2056 } 2057 2058 pos += 1; 2059 } 2060 } 2061 2062 code = value.charCodeAt(pos); 2063 nextCode = value.charCodeAt(pos + 1); 2064 nextNextCode = value.charCodeAt(pos + 2); 2065 2066 if ( 2067 (code === exp || code === EXP) && 2068 ((nextCode >= 48 && nextCode <= 57) || 2069 ((nextCode === plus || nextCode === minus) && 2070 nextNextCode >= 48 && 2071 nextNextCode <= 57)) 2072 ) { 2073 pos += nextCode === plus || nextCode === minus ? 3 : 2; 2074 2075 while (pos < length) { 2076 code = value.charCodeAt(pos); 2077 2078 if (code < 48 || code > 57) { 2079 break; 2080 } 2081 2082 pos += 1; 2083 } 2084 } 2085 2086 return { 2087 number: value.slice(0, pos), 2088 unit: value.slice(pos) 2089 }; 2090 }; 2091 2092 2093 /***/ }), 2094 2095 /***/ 1544: 2096 /***/ ((module, __unused_webpack_exports, __webpack_require__) => { 2097 2098 var parse = __webpack_require__(8491); 2099 var walk = __webpack_require__(3815); 2100 var stringify = __webpack_require__(4725); 2101 2102 function ValueParser(value) { 2103 if (this instanceof ValueParser) { 2104 this.nodes = parse(value); 2105 return this; 2106 } 2107 return new ValueParser(value); 2108 } 2109 2110 ValueParser.prototype.toString = function() { 2111 return Array.isArray(this.nodes) ? stringify(this.nodes) : ""; 2112 }; 2113 2114 ValueParser.prototype.walk = function(cb, bubble) { 2115 walk(this.nodes, cb, bubble); 2116 return this; 2117 }; 2118 2119 ValueParser.unit = __webpack_require__(1524); 2120 2121 ValueParser.walk = walk; 2122 2123 ValueParser.stringify = stringify; 2124 2125 module.exports = ValueParser; 2126 2127 2128 /***/ }), 2129 2130 /***/ 1609: 2131 /***/ ((module) => { 2132 2133 "use strict"; 2134 module.exports = window["React"]; 2135 2136 /***/ }), 2137 2138 /***/ 1670: 2139 /***/ ((module, __unused_webpack_exports, __webpack_require__) => { 2140 2141 "use strict"; 2142 2143 2144 let { dirname, relative, resolve, sep } = __webpack_require__(197) 2145 let { SourceMapConsumer, SourceMapGenerator } = __webpack_require__(1866) 2146 let { pathToFileURL } = __webpack_require__(2739) 2147 2148 let Input = __webpack_require__(5380) 2149 2150 let sourceMapAvailable = Boolean(SourceMapConsumer && SourceMapGenerator) 2151 let pathAvailable = Boolean(dirname && resolve && relative && sep) 2152 2153 class MapGenerator { 2154 constructor(stringify, root, opts, cssString) { 2155 this.stringify = stringify 2156 this.mapOpts = opts.map || {} 2157 this.root = root 2158 this.opts = opts 2159 this.css = cssString 2160 this.originalCSS = cssString 2161 this.usesFileUrls = !this.mapOpts.from && this.mapOpts.absolute 2162 2163 this.memoizedFileURLs = new Map() 2164 this.memoizedPaths = new Map() 2165 this.memoizedURLs = new Map() 2166 } 2167 2168 addAnnotation() { 2169 let content 2170 2171 if (this.isInline()) { 2172 content = 2173 'data:application/json;base64,' + this.toBase64(this.map.toString()) 2174 } else if (typeof this.mapOpts.annotation === 'string') { 2175 content = this.mapOpts.annotation 2176 } else if (typeof this.mapOpts.annotation === 'function') { 2177 content = this.mapOpts.annotation(this.opts.to, this.root) 2178 } else { 2179 content = this.outputFile() + '.map' 2180 } 2181 let eol = '\n' 2182 if (this.css.includes('\r\n')) eol = '\r\n' 2183 2184 this.css += eol + '/*# sourceMappingURL=' + content + ' */' 2185 } 2186 2187 applyPrevMaps() { 2188 for (let prev of this.previous()) { 2189 let from = this.toUrl(this.path(prev.file)) 2190 let root = prev.root || dirname(prev.file) 2191 let map 2192 2193 if (this.mapOpts.sourcesContent === false) { 2194 map = new SourceMapConsumer(prev.text) 2195 if (map.sourcesContent) { 2196 map.sourcesContent = null 2197 } 2198 } else { 2199 map = prev.consumer() 2200 } 2201 2202 this.map.applySourceMap(map, from, this.toUrl(this.path(root))) 2203 } 2204 } 2205 2206 clearAnnotation() { 2207 if (this.mapOpts.annotation === false) return 2208 2209 if (this.root) { 2210 let node 2211 for (let i = this.root.nodes.length - 1; i >= 0; i--) { 2212 node = this.root.nodes[i] 2213 if (node.type !== 'comment') continue 2214 if (node.text.startsWith('# sourceMappingURL=')) { 2215 this.root.removeChild(i) 2216 } 2217 } 2218 } else if (this.css) { 2219 this.css = this.css.replace(/\n*\/\*#[\S\s]*?\*\/$/gm, '') 2220 } 2221 } 2222 2223 generate() { 2224 this.clearAnnotation() 2225 if (pathAvailable && sourceMapAvailable && this.isMap()) { 2226 return this.generateMap() 2227 } else { 2228 let result = '' 2229 this.stringify(this.root, i => { 2230 result += i 2231 }) 2232 return [result] 2233 } 2234 } 2235 2236 generateMap() { 2237 if (this.root) { 2238 this.generateString() 2239 } else if (this.previous().length === 1) { 2240 let prev = this.previous()[0].consumer() 2241 prev.file = this.outputFile() 2242 this.map = SourceMapGenerator.fromSourceMap(prev, { 2243 ignoreInvalidMapping: true 2244 }) 2245 } else { 2246 this.map = new SourceMapGenerator({ 2247 file: this.outputFile(), 2248 ignoreInvalidMapping: true 2249 }) 2250 this.map.addMapping({ 2251 generated: { column: 0, line: 1 }, 2252 original: { column: 0, line: 1 }, 2253 source: this.opts.from 2254 ? this.toUrl(this.path(this.opts.from)) 2255 : '<no source>' 2256 }) 2257 } 2258 2259 if (this.isSourcesContent()) this.setSourcesContent() 2260 if (this.root && this.previous().length > 0) this.applyPrevMaps() 2261 if (this.isAnnotation()) this.addAnnotation() 2262 2263 if (this.isInline()) { 2264 return [this.css] 2265 } else { 2266 return [this.css, this.map] 2267 } 2268 } 2269 2270 generateString() { 2271 this.css = '' 2272 this.map = new SourceMapGenerator({ 2273 file: this.outputFile(), 2274 ignoreInvalidMapping: true 2275 }) 2276 2277 let line = 1 2278 let column = 1 2279 2280 let noSource = '<no source>' 2281 let mapping = { 2282 generated: { column: 0, line: 0 }, 2283 original: { column: 0, line: 0 }, 2284 source: '' 2285 } 2286 2287 let last, lines 2288 this.stringify(this.root, (str, node, type) => { 2289 this.css += str 2290 2291 if (node && type !== 'end') { 2292 mapping.generated.line = line 2293 mapping.generated.column = column - 1 2294 if (node.source && node.source.start) { 2295 mapping.source = this.sourcePath(node) 2296 mapping.original.line = node.source.start.line 2297 mapping.original.column = node.source.start.column - 1 2298 this.map.addMapping(mapping) 2299 } else { 2300 mapping.source = noSource 2301 mapping.original.line = 1 2302 mapping.original.column = 0 2303 this.map.addMapping(mapping) 2304 } 2305 } 2306 2307 lines = str.match(/\n/g) 2308 if (lines) { 2309 line += lines.length 2310 last = str.lastIndexOf('\n') 2311 column = str.length - last 2312 } else { 2313 column += str.length 2314 } 2315 2316 if (node && type !== 'start') { 2317 let p = node.parent || { raws: {} } 2318 let childless = 2319 node.type === 'decl' || (node.type === 'atrule' && !node.nodes) 2320 if (!childless || node !== p.last || p.raws.semicolon) { 2321 if (node.source && node.source.end) { 2322 mapping.source = this.sourcePath(node) 2323 mapping.original.line = node.source.end.line 2324 mapping.original.column = node.source.end.column - 1 2325 mapping.generated.line = line 2326 mapping.generated.column = column - 2 2327 this.map.addMapping(mapping) 2328 } else { 2329 mapping.source = noSource 2330 mapping.original.line = 1 2331 mapping.original.column = 0 2332 mapping.generated.line = line 2333 mapping.generated.column = column - 1 2334 this.map.addMapping(mapping) 2335 } 2336 } 2337 } 2338 }) 2339 } 2340 2341 isAnnotation() { 2342 if (this.isInline()) { 2343 return true 2344 } 2345 if (typeof this.mapOpts.annotation !== 'undefined') { 2346 return this.mapOpts.annotation 2347 } 2348 if (this.previous().length) { 2349 return this.previous().some(i => i.annotation) 2350 } 2351 return true 2352 } 2353 2354 isInline() { 2355 if (typeof this.mapOpts.inline !== 'undefined') { 2356 return this.mapOpts.inline 2357 } 2358 2359 let annotation = this.mapOpts.annotation 2360 if (typeof annotation !== 'undefined' && annotation !== true) { 2361 return false 2362 } 2363 2364 if (this.previous().length) { 2365 return this.previous().some(i => i.inline) 2366 } 2367 return true 2368 } 2369 2370 isMap() { 2371 if (typeof this.opts.map !== 'undefined') { 2372 return !!this.opts.map 2373 } 2374 return this.previous().length > 0 2375 } 2376 2377 isSourcesContent() { 2378 if (typeof this.mapOpts.sourcesContent !== 'undefined') { 2379 return this.mapOpts.sourcesContent 2380 } 2381 if (this.previous().length) { 2382 return this.previous().some(i => i.withContent()) 2383 } 2384 return true 2385 } 2386 2387 outputFile() { 2388 if (this.opts.to) { 2389 return this.path(this.opts.to) 2390 } else if (this.opts.from) { 2391 return this.path(this.opts.from) 2392 } else { 2393 return 'to.css' 2394 } 2395 } 2396 2397 path(file) { 2398 if (this.mapOpts.absolute) return file 2399 if (file.charCodeAt(0) === 60 /* `<` */) return file 2400 if (/^\w+:\/\//.test(file)) return file 2401 let cached = this.memoizedPaths.get(file) 2402 if (cached) return cached 2403 2404 let from = this.opts.to ? dirname(this.opts.to) : '.' 2405 2406 if (typeof this.mapOpts.annotation === 'string') { 2407 from = dirname(resolve(from, this.mapOpts.annotation)) 2408 } 2409 2410 let path = relative(from, file) 2411 this.memoizedPaths.set(file, path) 2412 2413 return path 2414 } 2415 2416 previous() { 2417 if (!this.previousMaps) { 2418 this.previousMaps = [] 2419 if (this.root) { 2420 this.root.walk(node => { 2421 if (node.source && node.source.input.map) { 2422 let map = node.source.input.map 2423 if (!this.previousMaps.includes(map)) { 2424 this.previousMaps.push(map) 2425 } 2426 } 2427 }) 2428 } else { 2429 let input = new Input(this.originalCSS, this.opts) 2430 if (input.map) this.previousMaps.push(input.map) 2431 } 2432 } 2433 2434 return this.previousMaps 2435 } 2436 2437 setSourcesContent() { 2438 let already = {} 2439 if (this.root) { 2440 this.root.walk(node => { 2441 if (node.source) { 2442 let from = node.source.input.from 2443 if (from && !already[from]) { 2444 already[from] = true 2445 let fromUrl = this.usesFileUrls 2446 ? this.toFileUrl(from) 2447 : this.toUrl(this.path(from)) 2448 this.map.setSourceContent(fromUrl, node.source.input.css) 2449 } 2450 } 2451 }) 2452 } else if (this.css) { 2453 let from = this.opts.from 2454 ? this.toUrl(this.path(this.opts.from)) 2455 : '<no source>' 2456 this.map.setSourceContent(from, this.css) 2457 } 2458 } 2459 2460 sourcePath(node) { 2461 if (this.mapOpts.from) { 2462 return this.toUrl(this.mapOpts.from) 2463 } else if (this.usesFileUrls) { 2464 return this.toFileUrl(node.source.input.from) 2465 } else { 2466 return this.toUrl(this.path(node.source.input.from)) 2467 } 2468 } 2469 2470 toBase64(str) { 2471 if (Buffer) { 2472 return Buffer.from(str).toString('base64') 2473 } else { 2474 return window.btoa(unescape(encodeURIComponent(str))) 2475 } 2476 } 2477 2478 toFileUrl(path) { 2479 let cached = this.memoizedFileURLs.get(path) 2480 if (cached) return cached 2481 2482 if (pathToFileURL) { 2483 let fileURL = pathToFileURL(path).toString() 2484 this.memoizedFileURLs.set(path, fileURL) 2485 2486 return fileURL 2487 } else { 2488 throw new Error( 2489 '`map.absolute` option is not available in this PostCSS build' 2490 ) 2491 } 2492 } 2493 2494 toUrl(path) { 2495 let cached = this.memoizedURLs.get(path) 2496 if (cached) return cached 2497 2498 if (sep === '\\') { 2499 path = path.replace(/\\/g, '/') 2500 } 2501 2502 let url = encodeURI(path).replace(/[#?]/g, encodeURIComponent) 2503 this.memoizedURLs.set(path, url) 2504 2505 return url 2506 } 2507 } 2508 2509 module.exports = MapGenerator 2510 2511 2512 /***/ }), 2513 2514 /***/ 1866: 2515 /***/ (() => { 2516 2517 /* (ignored) */ 2518 2519 /***/ }), 2520 2521 /***/ 2213: 2522 /***/ ((module) => { 2523 2524 /** 2525 * Copyright 2004-present Facebook. All Rights Reserved. 2526 * 2527 * @providesModule UserAgent_DEPRECATED 2528 */ 2529 2530 /** 2531 * Provides entirely client-side User Agent and OS detection. You should prefer 2532 * the non-deprecated UserAgent module when possible, which exposes our 2533 * authoritative server-side PHP-based detection to the client. 2534 * 2535 * Usage is straightforward: 2536 * 2537 * if (UserAgent_DEPRECATED.ie()) { 2538 * // IE 2539 * } 2540 * 2541 * You can also do version checks: 2542 * 2543 * if (UserAgent_DEPRECATED.ie() >= 7) { 2544 * // IE7 or better 2545 * } 2546 * 2547 * The browser functions will return NaN if the browser does not match, so 2548 * you can also do version compares the other way: 2549 * 2550 * if (UserAgent_DEPRECATED.ie() < 7) { 2551 * // IE6 or worse 2552 * } 2553 * 2554 * Note that the version is a float and may include a minor version number, 2555 * so you should always use range operators to perform comparisons, not 2556 * strict equality. 2557 * 2558 * **Note:** You should **strongly** prefer capability detection to browser 2559 * version detection where it's reasonable: 2560 * 2561 * http://www.quirksmode.org/js/support.html 2562 * 2563 * Further, we have a large number of mature wrapper functions and classes 2564 * which abstract away many browser irregularities. Check the documentation, 2565 * grep for things, or ask on javascript@lists.facebook.com before writing yet 2566 * another copy of "event || window.event". 2567 * 2568 */ 2569 2570 var _populated = false; 2571 2572 // Browsers 2573 var _ie, _firefox, _opera, _webkit, _chrome; 2574 2575 // Actual IE browser for compatibility mode 2576 var _ie_real_version; 2577 2578 // Platforms 2579 var _osx, _windows, _linux, _android; 2580 2581 // Architectures 2582 var _win64; 2583 2584 // Devices 2585 var _iphone, _ipad, _native; 2586 2587 var _mobile; 2588 2589 function _populate() { 2590 if (_populated) { 2591 return; 2592 } 2593 2594 _populated = true; 2595 2596 // To work around buggy JS libraries that can't handle multi-digit 2597 // version numbers, Opera 10's user agent string claims it's Opera 2598 // 9, then later includes a Version/X.Y field: 2599 // 2600 // Opera/9.80 (foo) Presto/2.2.15 Version/10.10 2601 var uas = navigator.userAgent; 2602 var agent = /(?:MSIE.(\d+\.\d+))|(?:(?:Firefox|GranParadiso|Iceweasel).(\d+\.\d+))|(?:Opera(?:.+Version.|.)(\d+\.\d+))|(?:AppleWebKit.(\d+(?:\.\d+)?))|(?:Trident\/\d+\.\d+.*rv:(\d+\.\d+))/.exec(uas); 2603 var os = /(Mac OS X)|(Windows)|(Linux)/.exec(uas); 2604 2605 _iphone = /\b(iPhone|iP[ao]d)/.exec(uas); 2606 _ipad = /\b(iP[ao]d)/.exec(uas); 2607 _android = /Android/i.exec(uas); 2608 _native = /FBAN\/\w+;/i.exec(uas); 2609 _mobile = /Mobile/i.exec(uas); 2610 2611 // Note that the IE team blog would have you believe you should be checking 2612 // for 'Win64; x64'. But MSDN then reveals that you can actually be coming 2613 // from either x64 or ia64; so ultimately, you should just check for Win64 2614 // as in indicator of whether you're in 64-bit IE. 32-bit IE on 64-bit 2615 // Windows will send 'WOW64' instead. 2616 _win64 = !!(/Win64/.exec(uas)); 2617 2618 if (agent) { 2619 _ie = agent[1] ? parseFloat(agent[1]) : ( 2620 agent[5] ? parseFloat(agent[5]) : NaN); 2621 // IE compatibility mode 2622 if (_ie && document && document.documentMode) { 2623 _ie = document.documentMode; 2624 } 2625 // grab the "true" ie version from the trident token if available 2626 var trident = /(?:Trident\/(\d+.\d+))/.exec(uas); 2627 _ie_real_version = trident ? parseFloat(trident[1]) + 4 : _ie; 2628 2629 _firefox = agent[2] ? parseFloat(agent[2]) : NaN; 2630 _opera = agent[3] ? parseFloat(agent[3]) : NaN; 2631 _webkit = agent[4] ? parseFloat(agent[4]) : NaN; 2632 if (_webkit) { 2633 // We do not add the regexp to the above test, because it will always 2634 // match 'safari' only since 'AppleWebKit' appears before 'Chrome' in 2635 // the userAgent string. 2636 agent = /(?:Chrome\/(\d+\.\d+))/.exec(uas); 2637 _chrome = agent && agent[1] ? parseFloat(agent[1]) : NaN; 2638 } else { 2639 _chrome = NaN; 2640 } 2641 } else { 2642 _ie = _firefox = _opera = _chrome = _webkit = NaN; 2643 } 2644 2645 if (os) { 2646 if (os[1]) { 2647 // Detect OS X version. If no version number matches, set _osx to true. 2648 // Version examples: 10, 10_6_1, 10.7 2649 // Parses version number as a float, taking only first two sets of 2650 // digits. If only one set of digits is found, returns just the major 2651 // version number. 2652 var ver = /(?:Mac OS X (\d+(?:[._]\d+)?))/.exec(uas); 2653 2654 _osx = ver ? parseFloat(ver[1].replace('_', '.')) : true; 2655 } else { 2656 _osx = false; 2657 } 2658 _windows = !!os[2]; 2659 _linux = !!os[3]; 2660 } else { 2661 _osx = _windows = _linux = false; 2662 } 2663 } 2664 2665 var UserAgent_DEPRECATED = { 2666 2667 /** 2668 * Check if the UA is Internet Explorer. 2669 * 2670 * 2671 * @return float|NaN Version number (if match) or NaN. 2672 */ 2673 ie: function() { 2674 return _populate() || _ie; 2675 }, 2676 2677 /** 2678 * Check if we're in Internet Explorer compatibility mode. 2679 * 2680 * @return bool true if in compatibility mode, false if 2681 * not compatibility mode or not ie 2682 */ 2683 ieCompatibilityMode: function() { 2684 return _populate() || (_ie_real_version > _ie); 2685 }, 2686 2687 2688 /** 2689 * Whether the browser is 64-bit IE. Really, this is kind of weak sauce; we 2690 * only need this because Skype can't handle 64-bit IE yet. We need to remove 2691 * this when we don't need it -- tracked by #601957. 2692 */ 2693 ie64: function() { 2694 return UserAgent_DEPRECATED.ie() && _win64; 2695 }, 2696 2697 /** 2698 * Check if the UA is Firefox. 2699 * 2700 * 2701 * @return float|NaN Version number (if match) or NaN. 2702 */ 2703 firefox: function() { 2704 return _populate() || _firefox; 2705 }, 2706 2707 2708 /** 2709 * Check if the UA is Opera. 2710 * 2711 * 2712 * @return float|NaN Version number (if match) or NaN. 2713 */ 2714 opera: function() { 2715 return _populate() || _opera; 2716 }, 2717 2718 2719 /** 2720 * Check if the UA is WebKit. 2721 * 2722 * 2723 * @return float|NaN Version number (if match) or NaN. 2724 */ 2725 webkit: function() { 2726 return _populate() || _webkit; 2727 }, 2728 2729 /** 2730 * For Push 2731 * WILL BE REMOVED VERY SOON. Use UserAgent_DEPRECATED.webkit 2732 */ 2733 safari: function() { 2734 return UserAgent_DEPRECATED.webkit(); 2735 }, 2736 2737 /** 2738 * Check if the UA is a Chrome browser. 2739 * 2740 * 2741 * @return float|NaN Version number (if match) or NaN. 2742 */ 2743 chrome : function() { 2744 return _populate() || _chrome; 2745 }, 2746 2747 2748 /** 2749 * Check if the user is running Windows. 2750 * 2751 * @return bool `true' if the user's OS is Windows. 2752 */ 2753 windows: function() { 2754 return _populate() || _windows; 2755 }, 2756 2757 2758 /** 2759 * Check if the user is running Mac OS X. 2760 * 2761 * @return float|bool Returns a float if a version number is detected, 2762 * otherwise true/false. 2763 */ 2764 osx: function() { 2765 return _populate() || _osx; 2766 }, 2767 2768 /** 2769 * Check if the user is running Linux. 2770 * 2771 * @return bool `true' if the user's OS is some flavor of Linux. 2772 */ 2773 linux: function() { 2774 return _populate() || _linux; 2775 }, 2776 2777 /** 2778 * Check if the user is running on an iPhone or iPod platform. 2779 * 2780 * @return bool `true' if the user is running some flavor of the 2781 * iPhone OS. 2782 */ 2783 iphone: function() { 2784 return _populate() || _iphone; 2785 }, 2786 2787 mobile: function() { 2788 return _populate() || (_iphone || _ipad || _android || _mobile); 2789 }, 2790 2791 nativeApp: function() { 2792 // webviews inside of the native apps 2793 return _populate() || _native; 2794 }, 2795 2796 android: function() { 2797 return _populate() || _android; 2798 }, 2799 2800 ipad: function() { 2801 return _populate() || _ipad; 2802 } 2803 }; 2804 2805 module.exports = UserAgent_DEPRECATED; 2806 2807 2808 /***/ }), 2809 2810 /***/ 2327: 2811 /***/ ((module) => { 2812 2813 "use strict"; 2814 2815 2816 const SINGLE_QUOTE = "'".charCodeAt(0) 2817 const DOUBLE_QUOTE = '"'.charCodeAt(0) 2818 const BACKSLASH = '\\'.charCodeAt(0) 2819 const SLASH = '/'.charCodeAt(0) 2820 const NEWLINE = '\n'.charCodeAt(0) 2821 const SPACE = ' '.charCodeAt(0) 2822 const FEED = '\f'.charCodeAt(0) 2823 const TAB = '\t'.charCodeAt(0) 2824 const CR = '\r'.charCodeAt(0) 2825 const OPEN_SQUARE = '['.charCodeAt(0) 2826 const CLOSE_SQUARE = ']'.charCodeAt(0) 2827 const OPEN_PARENTHESES = '('.charCodeAt(0) 2828 const CLOSE_PARENTHESES = ')'.charCodeAt(0) 2829 const OPEN_CURLY = '{'.charCodeAt(0) 2830 const CLOSE_CURLY = '}'.charCodeAt(0) 2831 const SEMICOLON = ';'.charCodeAt(0) 2832 const ASTERISK = '*'.charCodeAt(0) 2833 const COLON = ':'.charCodeAt(0) 2834 const AT = '@'.charCodeAt(0) 2835 2836 const RE_AT_END = /[\t\n\f\r "#'()/;[\\\]{}]/g 2837 const RE_WORD_END = /[\t\n\f\r !"#'():;@[\\\]{}]|\/(?=\*)/g 2838 const RE_BAD_BRACKET = /.[\r\n"'(/\\]/ 2839 const RE_HEX_ESCAPE = /[\da-f]/i 2840 2841 module.exports = function tokenizer(input, options = {}) { 2842 let css = input.css.valueOf() 2843 let ignore = options.ignoreErrors 2844 2845 let code, content, escape, next, quote 2846 let currentToken, escaped, escapePos, n, prev 2847 2848 let length = css.length 2849 let pos = 0 2850 let buffer = [] 2851 let returned = [] 2852 2853 function position() { 2854 return pos 2855 } 2856 2857 function unclosed(what) { 2858 throw input.error('Unclosed ' + what, pos) 2859 } 2860 2861 function endOfFile() { 2862 return returned.length === 0 && pos >= length 2863 } 2864 2865 function nextToken(opts) { 2866 if (returned.length) return returned.pop() 2867 if (pos >= length) return 2868 2869 let ignoreUnclosed = opts ? opts.ignoreUnclosed : false 2870 2871 code = css.charCodeAt(pos) 2872 2873 switch (code) { 2874 case NEWLINE: 2875 case SPACE: 2876 case TAB: 2877 case CR: 2878 case FEED: { 2879 next = pos 2880 do { 2881 next += 1 2882 code = css.charCodeAt(next) 2883 } while ( 2884 code === SPACE || 2885 code === NEWLINE || 2886 code === TAB || 2887 code === CR || 2888 code === FEED 2889 ) 2890 2891 currentToken = ['space', css.slice(pos, next)] 2892 pos = next - 1 2893 break 2894 } 2895 2896 case OPEN_SQUARE: 2897 case CLOSE_SQUARE: 2898 case OPEN_CURLY: 2899 case CLOSE_CURLY: 2900 case COLON: 2901 case SEMICOLON: 2902 case CLOSE_PARENTHESES: { 2903 let controlChar = String.fromCharCode(code) 2904 currentToken = [controlChar, controlChar, pos] 2905 break 2906 } 2907 2908 case OPEN_PARENTHESES: { 2909 prev = buffer.length ? buffer.pop()[1] : '' 2910 n = css.charCodeAt(pos + 1) 2911 if ( 2912 prev === 'url' && 2913 n !== SINGLE_QUOTE && 2914 n !== DOUBLE_QUOTE && 2915 n !== SPACE && 2916 n !== NEWLINE && 2917 n !== TAB && 2918 n !== FEED && 2919 n !== CR 2920 ) { 2921 next = pos 2922 do { 2923 escaped = false 2924 next = css.indexOf(')', next + 1) 2925 if (next === -1) { 2926 if (ignore || ignoreUnclosed) { 2927 next = pos 2928 break 2929 } else { 2930 unclosed('bracket') 2931 } 2932 } 2933 escapePos = next 2934 while (css.charCodeAt(escapePos - 1) === BACKSLASH) { 2935 escapePos -= 1 2936 escaped = !escaped 2937 } 2938 } while (escaped) 2939 2940 currentToken = ['brackets', css.slice(pos, next + 1), pos, next] 2941 2942 pos = next 2943 } else { 2944 next = css.indexOf(')', pos + 1) 2945 content = css.slice(pos, next + 1) 2946 2947 if (next === -1 || RE_BAD_BRACKET.test(content)) { 2948 currentToken = ['(', '(', pos] 2949 } else { 2950 currentToken = ['brackets', content, pos, next] 2951 pos = next 2952 } 2953 } 2954 2955 break 2956 } 2957 2958 case SINGLE_QUOTE: 2959 case DOUBLE_QUOTE: { 2960 quote = code === SINGLE_QUOTE ? "'" : '"' 2961 next = pos 2962 do { 2963 escaped = false 2964 next = css.indexOf(quote, next + 1) 2965 if (next === -1) { 2966 if (ignore || ignoreUnclosed) { 2967 next = pos + 1 2968 break 2969 } else { 2970 unclosed('string') 2971 } 2972 } 2973 escapePos = next 2974 while (css.charCodeAt(escapePos - 1) === BACKSLASH) { 2975 escapePos -= 1 2976 escaped = !escaped 2977 } 2978 } while (escaped) 2979 2980 currentToken = ['string', css.slice(pos, next + 1), pos, next] 2981 pos = next 2982 break 2983 } 2984 2985 case AT: { 2986 RE_AT_END.lastIndex = pos + 1 2987 RE_AT_END.test(css) 2988 if (RE_AT_END.lastIndex === 0) { 2989 next = css.length - 1 2990 } else { 2991 next = RE_AT_END.lastIndex - 2 2992 } 2993 2994 currentToken = ['at-word', css.slice(pos, next + 1), pos, next] 2995 2996 pos = next 2997 break 2998 } 2999 3000 case BACKSLASH: { 3001 next = pos 3002 escape = true 3003 while (css.charCodeAt(next + 1) === BACKSLASH) { 3004 next += 1 3005 escape = !escape 3006 } 3007 code = css.charCodeAt(next + 1) 3008 if ( 3009 escape && 3010 code !== SLASH && 3011 code !== SPACE && 3012 code !== NEWLINE && 3013 code !== TAB && 3014 code !== CR && 3015 code !== FEED 3016 ) { 3017 next += 1 3018 if (RE_HEX_ESCAPE.test(css.charAt(next))) { 3019 while (RE_HEX_ESCAPE.test(css.charAt(next + 1))) { 3020 next += 1 3021 } 3022 if (css.charCodeAt(next + 1) === SPACE) { 3023 next += 1 3024 } 3025 } 3026 } 3027 3028 currentToken = ['word', css.slice(pos, next + 1), pos, next] 3029 3030 pos = next 3031 break 3032 } 3033 3034 default: { 3035 if (code === SLASH && css.charCodeAt(pos + 1) === ASTERISK) { 3036 next = css.indexOf('*/', pos + 2) + 1 3037 if (next === 0) { 3038 if (ignore || ignoreUnclosed) { 3039 next = css.length 3040 } else { 3041 unclosed('comment') 3042 } 3043 } 3044 3045 currentToken = ['comment', css.slice(pos, next + 1), pos, next] 3046 pos = next 3047 } else { 3048 RE_WORD_END.lastIndex = pos + 1 3049 RE_WORD_END.test(css) 3050 if (RE_WORD_END.lastIndex === 0) { 3051 next = css.length - 1 3052 } else { 3053 next = RE_WORD_END.lastIndex - 2 3054 } 3055 3056 currentToken = ['word', css.slice(pos, next + 1), pos, next] 3057 buffer.push(currentToken) 3058 pos = next 3059 } 3060 3061 break 3062 } 3063 } 3064 3065 pos++ 3066 return currentToken 3067 } 3068 3069 function back(token) { 3070 returned.push(token) 3071 } 3072 3073 return { 3074 back, 3075 endOfFile, 3076 nextToken, 3077 position 3078 } 3079 } 3080 3081 3082 /***/ }), 3083 3084 /***/ 2739: 3085 /***/ (() => { 3086 3087 /* (ignored) */ 3088 3089 /***/ }), 3090 3091 /***/ 2775: 3092 /***/ ((module) => { 3093 3094 var x=String; 3095 var create=function() {return {isColorSupported:false,reset:x,bold:x,dim:x,italic:x,underline:x,inverse:x,hidden:x,strikethrough:x,black:x,red:x,green:x,yellow:x,blue:x,magenta:x,cyan:x,white:x,gray:x,bgBlack:x,bgRed:x,bgGreen:x,bgYellow:x,bgBlue:x,bgMagenta:x,bgCyan:x,bgWhite:x,blackBright:x,redBright:x,greenBright:x,yellowBright:x,blueBright:x,magentaBright:x,cyanBright:x,whiteBright:x,bgBlackBright:x,bgRedBright:x,bgGreenBright:x,bgYellowBright:x,bgBlueBright:x,bgMagentaBright:x,bgCyanBright:x,bgWhiteBright:x}}; 3096 module.exports=create(); 3097 module.exports.createColors = create; 3098 3099 3100 /***/ }), 3101 3102 /***/ 3122: 3103 /***/ ((module) => { 3104 3105 "use strict"; 3106 /* eslint-disable no-console */ 3107 3108 3109 let printed = {} 3110 3111 module.exports = function warnOnce(message) { 3112 if (printed[message]) return 3113 printed[message] = true 3114 3115 if (typeof console !== 'undefined' && console.warn) { 3116 console.warn(message) 3117 } 3118 } 3119 3120 3121 /***/ }), 3122 3123 /***/ 3815: 3124 /***/ ((module) => { 3125 3126 module.exports = function walk(nodes, cb, bubble) { 3127 var i, max, node, result; 3128 3129 for (i = 0, max = nodes.length; i < max; i += 1) { 3130 node = nodes[i]; 3131 if (!bubble) { 3132 result = cb(node, i, nodes); 3133 } 3134 3135 if ( 3136 result !== false && 3137 node.type === "function" && 3138 Array.isArray(node.nodes) 3139 ) { 3140 walk(node.nodes, cb, bubble); 3141 } 3142 3143 if (bubble) { 3144 cb(node, i, nodes); 3145 } 3146 } 3147 }; 3148 3149 3150 /***/ }), 3151 3152 /***/ 3937: 3153 /***/ ((module, __unused_webpack_exports, __webpack_require__) => { 3154 3155 "use strict"; 3156 3157 3158 let AtRule = __webpack_require__(1326) 3159 let Comment = __webpack_require__(6589) 3160 let Declaration = __webpack_require__(1516) 3161 let Root = __webpack_require__(9434) 3162 let Rule = __webpack_require__(4092) 3163 let tokenizer = __webpack_require__(2327) 3164 3165 const SAFE_COMMENT_NEIGHBOR = { 3166 empty: true, 3167 space: true 3168 } 3169 3170 function findLastWithPosition(tokens) { 3171 for (let i = tokens.length - 1; i >= 0; i--) { 3172 let token = tokens[i] 3173 let pos = token[3] || token[2] 3174 if (pos) return pos 3175 } 3176 } 3177 3178 class Parser { 3179 constructor(input) { 3180 this.input = input 3181 3182 this.root = new Root() 3183 this.current = this.root 3184 this.spaces = '' 3185 this.semicolon = false 3186 3187 this.createTokenizer() 3188 this.root.source = { input, start: { column: 1, line: 1, offset: 0 } } 3189 } 3190 3191 atrule(token) { 3192 let node = new AtRule() 3193 node.name = token[1].slice(1) 3194 if (node.name === '') { 3195 this.unnamedAtrule(node, token) 3196 } 3197 this.init(node, token[2]) 3198 3199 let type 3200 let prev 3201 let shift 3202 let last = false 3203 let open = false 3204 let params = [] 3205 let brackets = [] 3206 3207 while (!this.tokenizer.endOfFile()) { 3208 token = this.tokenizer.nextToken() 3209 type = token[0] 3210 3211 if (type === '(' || type === '[') { 3212 brackets.push(type === '(' ? ')' : ']') 3213 } else if (type === '{' && brackets.length > 0) { 3214 brackets.push('}') 3215 } else if (type === brackets[brackets.length - 1]) { 3216 brackets.pop() 3217 } 3218 3219 if (brackets.length === 0) { 3220 if (type === ';') { 3221 node.source.end = this.getPosition(token[2]) 3222 node.source.end.offset++ 3223 this.semicolon = true 3224 break 3225 } else if (type === '{') { 3226 open = true 3227 break 3228 } else if (type === '}') { 3229 if (params.length > 0) { 3230 shift = params.length - 1 3231 prev = params[shift] 3232 while (prev && prev[0] === 'space') { 3233 prev = params[--shift] 3234 } 3235 if (prev) { 3236 node.source.end = this.getPosition(prev[3] || prev[2]) 3237 node.source.end.offset++ 3238 } 3239 } 3240 this.end(token) 3241 break 3242 } else { 3243 params.push(token) 3244 } 3245 } else { 3246 params.push(token) 3247 } 3248 3249 if (this.tokenizer.endOfFile()) { 3250 last = true 3251 break 3252 } 3253 } 3254 3255 node.raws.between = this.spacesAndCommentsFromEnd(params) 3256 if (params.length) { 3257 node.raws.afterName = this.spacesAndCommentsFromStart(params) 3258 this.raw(node, 'params', params) 3259 if (last) { 3260 token = params[params.length - 1] 3261 node.source.end = this.getPosition(token[3] || token[2]) 3262 node.source.end.offset++ 3263 this.spaces = node.raws.between 3264 node.raws.between = '' 3265 } 3266 } else { 3267 node.raws.afterName = '' 3268 node.params = '' 3269 } 3270 3271 if (open) { 3272 node.nodes = [] 3273 this.current = node 3274 } 3275 } 3276 3277 checkMissedSemicolon(tokens) { 3278 let colon = this.colon(tokens) 3279 if (colon === false) return 3280 3281 let founded = 0 3282 let token 3283 for (let j = colon - 1; j >= 0; j--) { 3284 token = tokens[j] 3285 if (token[0] !== 'space') { 3286 founded += 1 3287 if (founded === 2) break 3288 } 3289 } 3290 // If the token is a word, e.g. `!important`, `red` or any other valid property's value. 3291 // Then we need to return the colon after that word token. [3] is the "end" colon of that word. 3292 // And because we need it after that one we do +1 to get the next one. 3293 throw this.input.error( 3294 'Missed semicolon', 3295 token[0] === 'word' ? token[3] + 1 : token[2] 3296 ) 3297 } 3298 3299 colon(tokens) { 3300 let brackets = 0 3301 let prev, token, type 3302 for (let [i, element] of tokens.entries()) { 3303 token = element 3304 type = token[0] 3305 3306 if (type === '(') { 3307 brackets += 1 3308 } 3309 if (type === ')') { 3310 brackets -= 1 3311 } 3312 if (brackets === 0 && type === ':') { 3313 if (!prev) { 3314 this.doubleColon(token) 3315 } else if (prev[0] === 'word' && prev[1] === 'progid') { 3316 continue 3317 } else { 3318 return i 3319 } 3320 } 3321 3322 prev = token 3323 } 3324 return false 3325 } 3326 3327 comment(token) { 3328 let node = new Comment() 3329 this.init(node, token[2]) 3330 node.source.end = this.getPosition(token[3] || token[2]) 3331 node.source.end.offset++ 3332 3333 let text = token[1].slice(2, -2) 3334 if (/^\s*$/.test(text)) { 3335 node.text = '' 3336 node.raws.left = text 3337 node.raws.right = '' 3338 } else { 3339 let match = text.match(/^(\s*)([^]*\S)(\s*)$/) 3340 node.text = match[2] 3341 node.raws.left = match[1] 3342 node.raws.right = match[3] 3343 } 3344 } 3345 3346 createTokenizer() { 3347 this.tokenizer = tokenizer(this.input) 3348 } 3349 3350 decl(tokens, customProperty) { 3351 let node = new Declaration() 3352 this.init(node, tokens[0][2]) 3353 3354 let last = tokens[tokens.length - 1] 3355 if (last[0] === ';') { 3356 this.semicolon = true 3357 tokens.pop() 3358 } 3359 3360 node.source.end = this.getPosition( 3361 last[3] || last[2] || findLastWithPosition(tokens) 3362 ) 3363 node.source.end.offset++ 3364 3365 while (tokens[0][0] !== 'word') { 3366 if (tokens.length === 1) this.unknownWord(tokens) 3367 node.raws.before += tokens.shift()[1] 3368 } 3369 node.source.start = this.getPosition(tokens[0][2]) 3370 3371 node.prop = '' 3372 while (tokens.length) { 3373 let type = tokens[0][0] 3374 if (type === ':' || type === 'space' || type === 'comment') { 3375 break 3376 } 3377 node.prop += tokens.shift()[1] 3378 } 3379 3380 node.raws.between = '' 3381 3382 let token 3383 while (tokens.length) { 3384 token = tokens.shift() 3385 3386 if (token[0] === ':') { 3387 node.raws.between += token[1] 3388 break 3389 } else { 3390 if (token[0] === 'word' && /\w/.test(token[1])) { 3391 this.unknownWord([token]) 3392 } 3393 node.raws.between += token[1] 3394 } 3395 } 3396 3397 if (node.prop[0] === '_' || node.prop[0] === '*') { 3398 node.raws.before += node.prop[0] 3399 node.prop = node.prop.slice(1) 3400 } 3401 3402 let firstSpaces = [] 3403 let next 3404 while (tokens.length) { 3405 next = tokens[0][0] 3406 if (next !== 'space' && next !== 'comment') break 3407 firstSpaces.push(tokens.shift()) 3408 } 3409 3410 this.precheckMissedSemicolon(tokens) 3411 3412 for (let i = tokens.length - 1; i >= 0; i--) { 3413 token = tokens[i] 3414 if (token[1].toLowerCase() === '!important') { 3415 node.important = true 3416 let string = this.stringFrom(tokens, i) 3417 string = this.spacesFromEnd(tokens) + string 3418 if (string !== ' !important') node.raws.important = string 3419 break 3420 } else if (token[1].toLowerCase() === 'important') { 3421 let cache = tokens.slice(0) 3422 let str = '' 3423 for (let j = i; j > 0; j--) { 3424 let type = cache[j][0] 3425 if (str.trim().startsWith('!') && type !== 'space') { 3426 break 3427 } 3428 str = cache.pop()[1] + str 3429 } 3430 if (str.trim().startsWith('!')) { 3431 node.important = true 3432 node.raws.important = str 3433 tokens = cache 3434 } 3435 } 3436 3437 if (token[0] !== 'space' && token[0] !== 'comment') { 3438 break 3439 } 3440 } 3441 3442 let hasWord = tokens.some(i => i[0] !== 'space' && i[0] !== 'comment') 3443 3444 if (hasWord) { 3445 node.raws.between += firstSpaces.map(i => i[1]).join('') 3446 firstSpaces = [] 3447 } 3448 this.raw(node, 'value', firstSpaces.concat(tokens), customProperty) 3449 3450 if (node.value.includes(':') && !customProperty) { 3451 this.checkMissedSemicolon(tokens) 3452 } 3453 } 3454 3455 doubleColon(token) { 3456 throw this.input.error( 3457 'Double colon', 3458 { offset: token[2] }, 3459 { offset: token[2] + token[1].length } 3460 ) 3461 } 3462 3463 emptyRule(token) { 3464 let node = new Rule() 3465 this.init(node, token[2]) 3466 node.selector = '' 3467 node.raws.between = '' 3468 this.current = node 3469 } 3470 3471 end(token) { 3472 if (this.current.nodes && this.current.nodes.length) { 3473 this.current.raws.semicolon = this.semicolon 3474 } 3475 this.semicolon = false 3476 3477 this.current.raws.after = (this.current.raws.after || '') + this.spaces 3478 this.spaces = '' 3479 3480 if (this.current.parent) { 3481 this.current.source.end = this.getPosition(token[2]) 3482 this.current.source.end.offset++ 3483 this.current = this.current.parent 3484 } else { 3485 this.unexpectedClose(token) 3486 } 3487 } 3488 3489 endFile() { 3490 if (this.current.parent) this.unclosedBlock() 3491 if (this.current.nodes && this.current.nodes.length) { 3492 this.current.raws.semicolon = this.semicolon 3493 } 3494 this.current.raws.after = (this.current.raws.after || '') + this.spaces 3495 this.root.source.end = this.getPosition(this.tokenizer.position()) 3496 } 3497 3498 freeSemicolon(token) { 3499 this.spaces += token[1] 3500 if (this.current.nodes) { 3501 let prev = this.current.nodes[this.current.nodes.length - 1] 3502 if (prev && prev.type === 'rule' && !prev.raws.ownSemicolon) { 3503 prev.raws.ownSemicolon = this.spaces 3504 this.spaces = '' 3505 prev.source.end = this.getPosition(token[2]) 3506 prev.source.end.offset += prev.raws.ownSemicolon.length 3507 } 3508 } 3509 } 3510 3511 // Helpers 3512 3513 getPosition(offset) { 3514 let pos = this.input.fromOffset(offset) 3515 return { 3516 column: pos.col, 3517 line: pos.line, 3518 offset 3519 } 3520 } 3521 3522 init(node, offset) { 3523 this.current.push(node) 3524 node.source = { 3525 input: this.input, 3526 start: this.getPosition(offset) 3527 } 3528 node.raws.before = this.spaces 3529 this.spaces = '' 3530 if (node.type !== 'comment') this.semicolon = false 3531 } 3532 3533 other(start) { 3534 let end = false 3535 let type = null 3536 let colon = false 3537 let bracket = null 3538 let brackets = [] 3539 let customProperty = start[1].startsWith('--') 3540 3541 let tokens = [] 3542 let token = start 3543 while (token) { 3544 type = token[0] 3545 tokens.push(token) 3546 3547 if (type === '(' || type === '[') { 3548 if (!bracket) bracket = token 3549 brackets.push(type === '(' ? ')' : ']') 3550 } else if (customProperty && colon && type === '{') { 3551 if (!bracket) bracket = token 3552 brackets.push('}') 3553 } else if (brackets.length === 0) { 3554 if (type === ';') { 3555 if (colon) { 3556 this.decl(tokens, customProperty) 3557 return 3558 } else { 3559 break 3560 } 3561 } else if (type === '{') { 3562 this.rule(tokens) 3563 return 3564 } else if (type === '}') { 3565 this.tokenizer.back(tokens.pop()) 3566 end = true 3567 break 3568 } else if (type === ':') { 3569 colon = true 3570 } 3571 } else if (type === brackets[brackets.length - 1]) { 3572 brackets.pop() 3573 if (brackets.length === 0) bracket = null 3574 } 3575 3576 token = this.tokenizer.nextToken() 3577 } 3578 3579 if (this.tokenizer.endOfFile()) end = true 3580 if (brackets.length > 0) this.unclosedBracket(bracket) 3581 3582 if (end && colon) { 3583 if (!customProperty) { 3584 while (tokens.length) { 3585 token = tokens[tokens.length - 1][0] 3586 if (token !== 'space' && token !== 'comment') break 3587 this.tokenizer.back(tokens.pop()) 3588 } 3589 } 3590 this.decl(tokens, customProperty) 3591 } else { 3592 this.unknownWord(tokens) 3593 } 3594 } 3595 3596 parse() { 3597 let token 3598 while (!this.tokenizer.endOfFile()) { 3599 token = this.tokenizer.nextToken() 3600 3601 switch (token[0]) { 3602 case 'space': 3603 this.spaces += token[1] 3604 break 3605 3606 case ';': 3607 this.freeSemicolon(token) 3608 break 3609 3610 case '}': 3611 this.end(token) 3612 break 3613 3614 case 'comment': 3615 this.comment(token) 3616 break 3617 3618 case 'at-word': 3619 this.atrule(token) 3620 break 3621 3622 case '{': 3623 this.emptyRule(token) 3624 break 3625 3626 default: 3627 this.other(token) 3628 break 3629 } 3630 } 3631 this.endFile() 3632 } 3633 3634 precheckMissedSemicolon(/* tokens */) { 3635 // Hook for Safe Parser 3636 } 3637 3638 raw(node, prop, tokens, customProperty) { 3639 let token, type 3640 let length = tokens.length 3641 let value = '' 3642 let clean = true 3643 let next, prev 3644 3645 for (let i = 0; i < length; i += 1) { 3646 token = tokens[i] 3647 type = token[0] 3648 if (type === 'space' && i === length - 1 && !customProperty) { 3649 clean = false 3650 } else if (type === 'comment') { 3651 prev = tokens[i - 1] ? tokens[i - 1][0] : 'empty' 3652 next = tokens[i + 1] ? tokens[i + 1][0] : 'empty' 3653 if (!SAFE_COMMENT_NEIGHBOR[prev] && !SAFE_COMMENT_NEIGHBOR[next]) { 3654 if (value.slice(-1) === ',') { 3655 clean = false 3656 } else { 3657 value += token[1] 3658 } 3659 } else { 3660 clean = false 3661 } 3662 } else { 3663 value += token[1] 3664 } 3665 } 3666 if (!clean) { 3667 let raw = tokens.reduce((all, i) => all + i[1], '') 3668 node.raws[prop] = { raw, value } 3669 } 3670 node[prop] = value 3671 } 3672 3673 rule(tokens) { 3674 tokens.pop() 3675 3676 let node = new Rule() 3677 this.init(node, tokens[0][2]) 3678 3679 node.raws.between = this.spacesAndCommentsFromEnd(tokens) 3680 this.raw(node, 'selector', tokens) 3681 this.current = node 3682 } 3683 3684 spacesAndCommentsFromEnd(tokens) { 3685 let lastTokenType 3686 let spaces = '' 3687 while (tokens.length) { 3688 lastTokenType = tokens[tokens.length - 1][0] 3689 if (lastTokenType !== 'space' && lastTokenType !== 'comment') break 3690 spaces = tokens.pop()[1] + spaces 3691 } 3692 return spaces 3693 } 3694 3695 // Errors 3696 3697 spacesAndCommentsFromStart(tokens) { 3698 let next 3699 let spaces = '' 3700 while (tokens.length) { 3701 next = tokens[0][0] 3702 if (next !== 'space' && next !== 'comment') break 3703 spaces += tokens.shift()[1] 3704 } 3705 return spaces 3706 } 3707 3708 spacesFromEnd(tokens) { 3709 let lastTokenType 3710 let spaces = '' 3711 while (tokens.length) { 3712 lastTokenType = tokens[tokens.length - 1][0] 3713 if (lastTokenType !== 'space') break 3714 spaces = tokens.pop()[1] + spaces 3715 } 3716 return spaces 3717 } 3718 3719 stringFrom(tokens, from) { 3720 let result = '' 3721 for (let i = from; i < tokens.length; i++) { 3722 result += tokens[i][1] 3723 } 3724 tokens.splice(from, tokens.length - from) 3725 return result 3726 } 3727 3728 unclosedBlock() { 3729 let pos = this.current.source.start 3730 throw this.input.error('Unclosed block', pos.line, pos.column) 3731 } 3732 3733 unclosedBracket(bracket) { 3734 throw this.input.error( 3735 'Unclosed bracket', 3736 { offset: bracket[2] }, 3737 { offset: bracket[2] + 1 } 3738 ) 3739 } 3740 3741 unexpectedClose(token) { 3742 throw this.input.error( 3743 'Unexpected }', 3744 { offset: token[2] }, 3745 { offset: token[2] + 1 } 3746 ) 3747 } 3748 3749 unknownWord(tokens) { 3750 throw this.input.error( 3751 'Unknown word ' + tokens[0][1], 3752 { offset: tokens[0][2] }, 3753 { offset: tokens[0][2] + tokens[0][1].length } 3754 ) 3755 } 3756 3757 unnamedAtrule(node, token) { 3758 throw this.input.error( 3759 'At-rule without name', 3760 { offset: token[2] }, 3761 { offset: token[2] + token[1].length } 3762 ) 3763 } 3764 } 3765 3766 module.exports = Parser 3767 3768 3769 /***/ }), 3770 3771 /***/ 4067: 3772 /***/ ((module) => { 3773 3774 "use strict"; 3775 /** 3776 * Copyright (c) 2013-present, Facebook, Inc. 3777 * 3778 * This source code is licensed under the MIT license found in the 3779 * LICENSE file in the root directory of this source tree. 3780 */ 3781 3782 3783 3784 var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED'; 3785 3786 module.exports = ReactPropTypesSecret; 3787 3788 3789 /***/ }), 3790 3791 /***/ 4092: 3792 /***/ ((module, __unused_webpack_exports, __webpack_require__) => { 3793 3794 "use strict"; 3795 3796 3797 let Container = __webpack_require__(683) 3798 let list = __webpack_require__(7374) 3799 3800 class Rule extends Container { 3801 get selectors() { 3802 return list.comma(this.selector) 3803 } 3804 3805 set selectors(values) { 3806 let match = this.selector ? this.selector.match(/,\s*/) : null 3807 let sep = match ? match[0] : ',' + this.raw('between', 'beforeOpen') 3808 this.selector = values.join(sep) 3809 } 3810 3811 constructor(defaults) { 3812 super(defaults) 3813 this.type = 'rule' 3814 if (!this.nodes) this.nodes = [] 3815 } 3816 } 3817 3818 module.exports = Rule 3819 Rule.default = Rule 3820 3821 Container.registerRule(Rule) 3822 3823 3824 /***/ }), 3825 3826 /***/ 4132: 3827 /***/ ((__unused_webpack_module, exports, __webpack_require__) => { 3828 3829 "use strict"; 3830 var __webpack_unused_export__; 3831 3832 __webpack_unused_export__ = true; 3833 var TextareaAutosize_1 = __webpack_require__(4462); 3834 exports.A = TextareaAutosize_1.TextareaAutosize; 3835 3836 3837 /***/ }), 3838 3839 /***/ 4295: 3840 /***/ ((module, __unused_webpack_exports, __webpack_require__) => { 3841 3842 "use strict"; 3843 3844 3845 let Container = __webpack_require__(683) 3846 let Input = __webpack_require__(5380) 3847 let Parser = __webpack_require__(3937) 3848 3849 function parse(css, opts) { 3850 let input = new Input(css, opts) 3851 let parser = new Parser(input) 3852 try { 3853 parser.parse() 3854 } catch (e) { 3855 if (false) {} 3856 throw e 3857 } 3858 3859 return parser.root 3860 } 3861 3862 module.exports = parse 3863 parse.default = parse 3864 3865 Container.registerParse(parse) 3866 3867 3868 /***/ }), 3869 3870 /***/ 4306: 3871 /***/ (function(module, exports) { 3872 3873 var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*! 3874 autosize 4.0.4 3875 license: MIT 3876 http://www.jacklmoore.com/autosize 3877 */ 3878 (function (global, factory) { 3879 if (true) { 3880 !(__WEBPACK_AMD_DEFINE_ARRAY__ = [module, exports], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory), 3881 __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? 3882 (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), 3883 __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); 3884 } else { var mod; } 3885 })(this, function (module, exports) { 3886 'use strict'; 3887 3888 var map = typeof Map === "function" ? new Map() : function () { 3889 var keys = []; 3890 var values = []; 3891 3892 return { 3893 has: function has(key) { 3894 return keys.indexOf(key) > -1; 3895 }, 3896 get: function get(key) { 3897 return values[keys.indexOf(key)]; 3898 }, 3899 set: function set(key, value) { 3900 if (keys.indexOf(key) === -1) { 3901 keys.push(key); 3902 values.push(value); 3903 } 3904 }, 3905 delete: function _delete(key) { 3906 var index = keys.indexOf(key); 3907 if (index > -1) { 3908 keys.splice(index, 1); 3909 values.splice(index, 1); 3910 } 3911 } 3912 }; 3913 }(); 3914 3915 var createEvent = function createEvent(name) { 3916 return new Event(name, { bubbles: true }); 3917 }; 3918 try { 3919 new Event('test'); 3920 } catch (e) { 3921 // IE does not support `new Event()` 3922 createEvent = function createEvent(name) { 3923 var evt = document.createEvent('Event'); 3924 evt.initEvent(name, true, false); 3925 return evt; 3926 }; 3927 } 3928 3929 function assign(ta) { 3930 if (!ta || !ta.nodeName || ta.nodeName !== 'TEXTAREA' || map.has(ta)) return; 3931 3932 var heightOffset = null; 3933 var clientWidth = null; 3934 var cachedHeight = null; 3935 3936 function init() { 3937 var style = window.getComputedStyle(ta, null); 3938 3939 if (style.resize === 'vertical') { 3940 ta.style.resize = 'none'; 3941 } else if (style.resize === 'both') { 3942 ta.style.resize = 'horizontal'; 3943 } 3944 3945 if (style.boxSizing === 'content-box') { 3946 heightOffset = -(parseFloat(style.paddingTop) + parseFloat(style.paddingBottom)); 3947 } else { 3948 heightOffset = parseFloat(style.borderTopWidth) + parseFloat(style.borderBottomWidth); 3949 } 3950 // Fix when a textarea is not on document body and heightOffset is Not a Number 3951 if (isNaN(heightOffset)) { 3952 heightOffset = 0; 3953 } 3954 3955 update(); 3956 } 3957 3958 function changeOverflow(value) { 3959 { 3960 // Chrome/Safari-specific fix: 3961 // When the textarea y-overflow is hidden, Chrome/Safari do not reflow the text to account for the space 3962 // made available by removing the scrollbar. The following forces the necessary text reflow. 3963 var width = ta.style.width; 3964 ta.style.width = '0px'; 3965 // Force reflow: 3966 /* jshint ignore:start */ 3967 ta.offsetWidth; 3968 /* jshint ignore:end */ 3969 ta.style.width = width; 3970 } 3971 3972 ta.style.overflowY = value; 3973 } 3974 3975 function getParentOverflows(el) { 3976 var arr = []; 3977 3978 while (el && el.parentNode && el.parentNode instanceof Element) { 3979 if (el.parentNode.scrollTop) { 3980 arr.push({ 3981 node: el.parentNode, 3982 scrollTop: el.parentNode.scrollTop 3983 }); 3984 } 3985 el = el.parentNode; 3986 } 3987 3988 return arr; 3989 } 3990 3991 function resize() { 3992 if (ta.scrollHeight === 0) { 3993 // If the scrollHeight is 0, then the element probably has display:none or is detached from the DOM. 3994 return; 3995 } 3996 3997 var overflows = getParentOverflows(ta); 3998 var docTop = document.documentElement && document.documentElement.scrollTop; // Needed for Mobile IE (ticket #240) 3999 4000 ta.style.height = ''; 4001 ta.style.height = ta.scrollHeight + heightOffset + 'px'; 4002 4003 // used to check if an update is actually necessary on window.resize 4004 clientWidth = ta.clientWidth; 4005 4006 // prevents scroll-position jumping 4007 overflows.forEach(function (el) { 4008 el.node.scrollTop = el.scrollTop; 4009 }); 4010 4011 if (docTop) { 4012 document.documentElement.scrollTop = docTop; 4013 } 4014 } 4015 4016 function update() { 4017 resize(); 4018 4019 var styleHeight = Math.round(parseFloat(ta.style.height)); 4020 var computed = window.getComputedStyle(ta, null); 4021 4022 // Using offsetHeight as a replacement for computed.height in IE, because IE does not account use of border-box 4023 var actualHeight = computed.boxSizing === 'content-box' ? Math.round(parseFloat(computed.height)) : ta.offsetHeight; 4024 4025 // The actual height not matching the style height (set via the resize method) indicates that 4026 // the max-height has been exceeded, in which case the overflow should be allowed. 4027 if (actualHeight < styleHeight) { 4028 if (computed.overflowY === 'hidden') { 4029 changeOverflow('scroll'); 4030 resize(); 4031 actualHeight = computed.boxSizing === 'content-box' ? Math.round(parseFloat(window.getComputedStyle(ta, null).height)) : ta.offsetHeight; 4032 } 4033 } else { 4034 // Normally keep overflow set to hidden, to avoid flash of scrollbar as the textarea expands. 4035 if (computed.overflowY !== 'hidden') { 4036 changeOverflow('hidden'); 4037 resize(); 4038 actualHeight = computed.boxSizing === 'content-box' ? Math.round(parseFloat(window.getComputedStyle(ta, null).height)) : ta.offsetHeight; 4039 } 4040 } 4041 4042 if (cachedHeight !== actualHeight) { 4043 cachedHeight = actualHeight; 4044 var evt = createEvent('autosize:resized'); 4045 try { 4046 ta.dispatchEvent(evt); 4047 } catch (err) { 4048 // Firefox will throw an error on dispatchEvent for a detached element 4049 // https://bugzilla.mozilla.org/show_bug.cgi?id=889376 4050 } 4051 } 4052 } 4053 4054 var pageResize = function pageResize() { 4055 if (ta.clientWidth !== clientWidth) { 4056 update(); 4057 } 4058 }; 4059 4060 var destroy = function (style) { 4061 window.removeEventListener('resize', pageResize, false); 4062 ta.removeEventListener('input', update, false); 4063 ta.removeEventListener('keyup', update, false); 4064 ta.removeEventListener('autosize:destroy', destroy, false); 4065 ta.removeEventListener('autosize:update', update, false); 4066 4067 Object.keys(style).forEach(function (key) { 4068 ta.style[key] = style[key]; 4069 }); 4070 4071 map.delete(ta); 4072 }.bind(ta, { 4073 height: ta.style.height, 4074 resize: ta.style.resize, 4075 overflowY: ta.style.overflowY, 4076 overflowX: ta.style.overflowX, 4077 wordWrap: ta.style.wordWrap 4078 }); 4079 4080 ta.addEventListener('autosize:destroy', destroy, false); 4081 4082 // IE9 does not fire onpropertychange or oninput for deletions, 4083 // so binding to onkeyup to catch most of those events. 4084 // There is no way that I know of to detect something like 'cut' in IE9. 4085 if ('onpropertychange' in ta && 'oninput' in ta) { 4086 ta.addEventListener('keyup', update, false); 4087 } 4088 4089 window.addEventListener('resize', pageResize, false); 4090 ta.addEventListener('input', update, false); 4091 ta.addEventListener('autosize:update', update, false); 4092 ta.style.overflowX = 'hidden'; 4093 ta.style.wordWrap = 'break-word'; 4094 4095 map.set(ta, { 4096 destroy: destroy, 4097 update: update 4098 }); 4099 4100 init(); 4101 } 4102 4103 function destroy(ta) { 4104 var methods = map.get(ta); 4105 if (methods) { 4106 methods.destroy(); 4107 } 4108 } 4109 4110 function update(ta) { 4111 var methods = map.get(ta); 4112 if (methods) { 4113 methods.update(); 4114 } 4115 } 4116 4117 var autosize = null; 4118 4119 // Do nothing in Node.js environment and IE8 (or lower) 4120 if (typeof window === 'undefined' || typeof window.getComputedStyle !== 'function') { 4121 autosize = function autosize(el) { 4122 return el; 4123 }; 4124 autosize.destroy = function (el) { 4125 return el; 4126 }; 4127 autosize.update = function (el) { 4128 return el; 4129 }; 4130 } else { 4131 autosize = function autosize(el, options) { 4132 if (el) { 4133 Array.prototype.forEach.call(el.length ? el : [el], function (x) { 4134 return assign(x, options); 4135 }); 4136 } 4137 return el; 4138 }; 4139 autosize.destroy = function (el) { 4140 if (el) { 4141 Array.prototype.forEach.call(el.length ? el : [el], destroy); 4142 } 4143 return el; 4144 }; 4145 autosize.update = function (el) { 4146 if (el) { 4147 Array.prototype.forEach.call(el.length ? el : [el], update); 4148 } 4149 return el; 4150 }; 4151 } 4152 4153 exports.default = autosize; 4154 module.exports = exports['default']; 4155 }); 4156 4157 /***/ }), 4158 4159 /***/ 4462: 4160 /***/ (function(__unused_webpack_module, exports, __webpack_require__) { 4161 4162 "use strict"; 4163 4164 var __extends = (this && this.__extends) || (function () { 4165 var extendStatics = Object.setPrototypeOf || 4166 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || 4167 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; 4168 return function (d, b) { 4169 extendStatics(d, b); 4170 function __() { this.constructor = d; } 4171 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 4172 }; 4173 })(); 4174 var __assign = (this && this.__assign) || Object.assign || function(t) { 4175 for (var s, i = 1, n = arguments.length; i < n; i++) { 4176 s = arguments[i]; 4177 for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) 4178 t[p] = s[p]; 4179 } 4180 return t; 4181 }; 4182 var __rest = (this && this.__rest) || function (s, e) { 4183 var t = {}; 4184 for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) 4185 t[p] = s[p]; 4186 if (s != null && typeof Object.getOwnPropertySymbols === "function") 4187 for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0) 4188 t[p[i]] = s[p[i]]; 4189 return t; 4190 }; 4191 exports.__esModule = true; 4192 var React = __webpack_require__(1609); 4193 var PropTypes = __webpack_require__(5826); 4194 var autosize = __webpack_require__(4306); 4195 var _getLineHeight = __webpack_require__(461); 4196 var getLineHeight = _getLineHeight; 4197 var RESIZED = "autosize:resized"; 4198 /** 4199 * A light replacement for built-in textarea component 4200 * which automaticaly adjusts its height to match the content 4201 */ 4202 var TextareaAutosizeClass = /** @class */ (function (_super) { 4203 __extends(TextareaAutosizeClass, _super); 4204 function TextareaAutosizeClass() { 4205 var _this = _super !== null && _super.apply(this, arguments) || this; 4206 _this.state = { 4207 lineHeight: null 4208 }; 4209 _this.textarea = null; 4210 _this.onResize = function (e) { 4211 if (_this.props.onResize) { 4212 _this.props.onResize(e); 4213 } 4214 }; 4215 _this.updateLineHeight = function () { 4216 if (_this.textarea) { 4217 _this.setState({ 4218 lineHeight: getLineHeight(_this.textarea) 4219 }); 4220 } 4221 }; 4222 _this.onChange = function (e) { 4223 var onChange = _this.props.onChange; 4224 _this.currentValue = e.currentTarget.value; 4225 onChange && onChange(e); 4226 }; 4227 return _this; 4228 } 4229 TextareaAutosizeClass.prototype.componentDidMount = function () { 4230 var _this = this; 4231 var _a = this.props, maxRows = _a.maxRows, async = _a.async; 4232 if (typeof maxRows === "number") { 4233 this.updateLineHeight(); 4234 } 4235 if (typeof maxRows === "number" || async) { 4236 /* 4237 the defer is needed to: 4238 - force "autosize" to activate the scrollbar when this.props.maxRows is passed 4239 - support StyledComponents (see #71) 4240 */ 4241 setTimeout(function () { return _this.textarea && autosize(_this.textarea); }); 4242 } 4243 else { 4244 this.textarea && autosize(this.textarea); 4245 } 4246 if (this.textarea) { 4247 this.textarea.addEventListener(RESIZED, this.onResize); 4248 } 4249 }; 4250 TextareaAutosizeClass.prototype.componentWillUnmount = function () { 4251 if (this.textarea) { 4252 this.textarea.removeEventListener(RESIZED, this.onResize); 4253 autosize.destroy(this.textarea); 4254 } 4255 }; 4256 TextareaAutosizeClass.prototype.render = function () { 4257 var _this = this; 4258 var _a = this, _b = _a.props, onResize = _b.onResize, maxRows = _b.maxRows, onChange = _b.onChange, style = _b.style, innerRef = _b.innerRef, children = _b.children, props = __rest(_b, ["onResize", "maxRows", "onChange", "style", "innerRef", "children"]), lineHeight = _a.state.lineHeight; 4259 var maxHeight = maxRows && lineHeight ? lineHeight * maxRows : null; 4260 return (React.createElement("textarea", __assign({}, props, { onChange: this.onChange, style: maxHeight ? __assign({}, style, { maxHeight: maxHeight }) : style, ref: function (element) { 4261 _this.textarea = element; 4262 if (typeof _this.props.innerRef === 'function') { 4263 _this.props.innerRef(element); 4264 } 4265 else if (_this.props.innerRef) { 4266 _this.props.innerRef.current = element; 4267 } 4268 } }), children)); 4269 }; 4270 TextareaAutosizeClass.prototype.componentDidUpdate = function () { 4271 this.textarea && autosize.update(this.textarea); 4272 }; 4273 TextareaAutosizeClass.defaultProps = { 4274 rows: 1, 4275 async: false 4276 }; 4277 TextareaAutosizeClass.propTypes = { 4278 rows: PropTypes.number, 4279 maxRows: PropTypes.number, 4280 onResize: PropTypes.func, 4281 innerRef: PropTypes.any, 4282 async: PropTypes.bool 4283 }; 4284 return TextareaAutosizeClass; 4285 }(React.Component)); 4286 exports.TextareaAutosize = React.forwardRef(function (props, ref) { 4287 return React.createElement(TextareaAutosizeClass, __assign({}, props, { innerRef: ref })); 4288 }); 4289 4290 4291 /***/ }), 4292 4293 /***/ 4725: 4294 /***/ ((module) => { 4295 4296 function stringifyNode(node, custom) { 4297 var type = node.type; 4298 var value = node.value; 4299 var buf; 4300 var customResult; 4301 4302 if (custom && (customResult = custom(node)) !== undefined) { 4303 return customResult; 4304 } else if (type === "word" || type === "space") { 4305 return value; 4306 } else if (type === "string") { 4307 buf = node.quote || ""; 4308 return buf + value + (node.unclosed ? "" : buf); 4309 } else if (type === "comment") { 4310 return "/*" + value + (node.unclosed ? "" : "*/"); 4311 } else if (type === "div") { 4312 return (node.before || "") + value + (node.after || ""); 4313 } else if (Array.isArray(node.nodes)) { 4314 buf = stringify(node.nodes, custom); 4315 if (type !== "function") { 4316 return buf; 4317 } 4318 return ( 4319 value + 4320 "(" + 4321 (node.before || "") + 4322 buf + 4323 (node.after || "") + 4324 (node.unclosed ? "" : ")") 4325 ); 4326 } 4327 return value; 4328 } 4329 4330 function stringify(nodes, custom) { 4331 var result, i; 4332 4333 if (Array.isArray(nodes)) { 4334 result = ""; 4335 for (i = nodes.length - 1; ~i; i -= 1) { 4336 result = stringifyNode(nodes[i], custom) + result; 4337 } 4338 return result; 4339 } 4340 return stringifyNode(nodes, custom); 4341 } 4342 4343 module.exports = stringify; 4344 4345 4346 /***/ }), 4347 4348 /***/ 5042: 4349 /***/ ((module) => { 4350 4351 // This alphabet uses `A-Za-z0-9_-` symbols. 4352 // The order of characters is optimized for better gzip and brotli compression. 4353 // References to the same file (works both for gzip and brotli): 4354 // `'use`, `andom`, and `rict'` 4355 // References to the brotli default dictionary: 4356 // `-26T`, `1983`, `40px`, `75px`, `bush`, `jack`, `mind`, `very`, and `wolf` 4357 let urlAlphabet = 4358 'useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict' 4359 4360 let customAlphabet = (alphabet, defaultSize = 21) => { 4361 return (size = defaultSize) => { 4362 let id = '' 4363 // A compact alternative for `for (var i = 0; i < step; i++)`. 4364 let i = size | 0 4365 while (i--) { 4366 // `| 0` is more compact and faster than `Math.floor()`. 4367 id += alphabet[(Math.random() * alphabet.length) | 0] 4368 } 4369 return id 4370 } 4371 } 4372 4373 let nanoid = (size = 21) => { 4374 let id = '' 4375 // A compact alternative for `for (var i = 0; i < step; i++)`. 4376 let i = size | 0 4377 while (i--) { 4378 // `| 0` is more compact and faster than `Math.floor()`. 4379 id += urlAlphabet[(Math.random() * 64) | 0] 4380 } 4381 return id 4382 } 4383 4384 module.exports = { nanoid, customAlphabet } 4385 4386 4387 /***/ }), 4388 4389 /***/ 5215: 4390 /***/ ((module) => { 4391 4392 "use strict"; 4393 4394 4395 // do not edit .js files directly - edit src/index.jst 4396 4397 4398 4399 module.exports = function equal(a, b) { 4400 if (a === b) return true; 4401 4402 if (a && b && typeof a == 'object' && typeof b == 'object') { 4403 if (a.constructor !== b.constructor) return false; 4404 4405 var length, i, keys; 4406 if (Array.isArray(a)) { 4407 length = a.length; 4408 if (length != b.length) return false; 4409 for (i = length; i-- !== 0;) 4410 if (!equal(a[i], b[i])) return false; 4411 return true; 4412 } 4413 4414 4415 4416 if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags; 4417 if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf(); 4418 if (a.toString !== Object.prototype.toString) return a.toString() === b.toString(); 4419 4420 keys = Object.keys(a); 4421 length = keys.length; 4422 if (length !== Object.keys(b).length) return false; 4423 4424 for (i = length; i-- !== 0;) 4425 if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false; 4426 4427 for (i = length; i-- !== 0;) { 4428 var key = keys[i]; 4429 4430 if (!equal(a[key], b[key])) return false; 4431 } 4432 4433 return true; 4434 } 4435 4436 // true if both NaN, false otherwise 4437 return a!==a && b!==b; 4438 }; 4439 4440 4441 /***/ }), 4442 4443 /***/ 5380: 4444 /***/ ((module, __unused_webpack_exports, __webpack_require__) => { 4445 4446 "use strict"; 4447 4448 4449 let { nanoid } = __webpack_require__(5042) 4450 let { isAbsolute, resolve } = __webpack_require__(197) 4451 let { SourceMapConsumer, SourceMapGenerator } = __webpack_require__(1866) 4452 let { fileURLToPath, pathToFileURL } = __webpack_require__(2739) 4453 4454 let CssSyntaxError = __webpack_require__(356) 4455 let PreviousMap = __webpack_require__(5696) 4456 let terminalHighlight = __webpack_require__(9746) 4457 4458 let fromOffsetCache = Symbol('fromOffsetCache') 4459 4460 let sourceMapAvailable = Boolean(SourceMapConsumer && SourceMapGenerator) 4461 let pathAvailable = Boolean(resolve && isAbsolute) 4462 4463 class Input { 4464 get from() { 4465 return this.file || this.id 4466 } 4467 4468 constructor(css, opts = {}) { 4469 if ( 4470 css === null || 4471 typeof css === 'undefined' || 4472 (typeof css === 'object' && !css.toString) 4473 ) { 4474 throw new Error(`PostCSS received $css} instead of CSS string`) 4475 } 4476 4477 this.css = css.toString() 4478 4479 if (this.css[0] === '\uFEFF' || this.css[0] === '\uFFFE') { 4480 this.hasBOM = true 4481 this.css = this.css.slice(1) 4482 } else { 4483 this.hasBOM = false 4484 } 4485 4486 this.document = this.css 4487 if (opts.document) this.document = opts.document.toString() 4488 4489 if (opts.from) { 4490 if ( 4491 !pathAvailable || 4492 /^\w+:\/\//.test(opts.from) || 4493 isAbsolute(opts.from) 4494 ) { 4495 this.file = opts.from 4496 } else { 4497 this.file = resolve(opts.from) 4498 } 4499 } 4500 4501 if (pathAvailable && sourceMapAvailable) { 4502 let map = new PreviousMap(this.css, opts) 4503 if (map.text) { 4504 this.map = map 4505 let file = map.consumer().file 4506 if (!this.file && file) this.file = this.mapResolve(file) 4507 } 4508 } 4509 4510 if (!this.file) { 4511 this.id = '<input css ' + nanoid(6) + '>' 4512 } 4513 if (this.map) this.map.file = this.from 4514 } 4515 4516 error(message, line, column, opts = {}) { 4517 let endColumn, endLine, result 4518 4519 if (line && typeof line === 'object') { 4520 let start = line 4521 let end = column 4522 if (typeof start.offset === 'number') { 4523 let pos = this.fromOffset(start.offset) 4524 line = pos.line 4525 column = pos.col 4526 } else { 4527 line = start.line 4528 column = start.column 4529 } 4530 if (typeof end.offset === 'number') { 4531 let pos = this.fromOffset(end.offset) 4532 endLine = pos.line 4533 endColumn = pos.col 4534 } else { 4535 endLine = end.line 4536 endColumn = end.column 4537 } 4538 } else if (!column) { 4539 let pos = this.fromOffset(line) 4540 line = pos.line 4541 column = pos.col 4542 } 4543 4544 let origin = this.origin(line, column, endLine, endColumn) 4545 if (origin) { 4546 result = new CssSyntaxError( 4547 message, 4548 origin.endLine === undefined 4549 ? origin.line 4550 : { column: origin.column, line: origin.line }, 4551 origin.endLine === undefined 4552 ? origin.column 4553 : { column: origin.endColumn, line: origin.endLine }, 4554 origin.source, 4555 origin.file, 4556 opts.plugin 4557 ) 4558 } else { 4559 result = new CssSyntaxError( 4560 message, 4561 endLine === undefined ? line : { column, line }, 4562 endLine === undefined ? column : { column: endColumn, line: endLine }, 4563 this.css, 4564 this.file, 4565 opts.plugin 4566 ) 4567 } 4568 4569 result.input = { column, endColumn, endLine, line, source: this.css } 4570 if (this.file) { 4571 if (pathToFileURL) { 4572 result.input.url = pathToFileURL(this.file).toString() 4573 } 4574 result.input.file = this.file 4575 } 4576 4577 return result 4578 } 4579 4580 fromOffset(offset) { 4581 let lastLine, lineToIndex 4582 if (!this[fromOffsetCache]) { 4583 let lines = this.css.split('\n') 4584 lineToIndex = new Array(lines.length) 4585 let prevIndex = 0 4586 4587 for (let i = 0, l = lines.length; i < l; i++) { 4588 lineToIndex[i] = prevIndex 4589 prevIndex += lines[i].length + 1 4590 } 4591 4592 this[fromOffsetCache] = lineToIndex 4593 } else { 4594 lineToIndex = this[fromOffsetCache] 4595 } 4596 lastLine = lineToIndex[lineToIndex.length - 1] 4597 4598 let min = 0 4599 if (offset >= lastLine) { 4600 min = lineToIndex.length - 1 4601 } else { 4602 let max = lineToIndex.length - 2 4603 let mid 4604 while (min < max) { 4605 mid = min + ((max - min) >> 1) 4606 if (offset < lineToIndex[mid]) { 4607 max = mid - 1 4608 } else if (offset >= lineToIndex[mid + 1]) { 4609 min = mid + 1 4610 } else { 4611 min = mid 4612 break 4613 } 4614 } 4615 } 4616 return { 4617 col: offset - lineToIndex[min] + 1, 4618 line: min + 1 4619 } 4620 } 4621 4622 mapResolve(file) { 4623 if (/^\w+:\/\//.test(file)) { 4624 return file 4625 } 4626 return resolve(this.map.consumer().sourceRoot || this.map.root || '.', file) 4627 } 4628 4629 origin(line, column, endLine, endColumn) { 4630 if (!this.map) return false 4631 let consumer = this.map.consumer() 4632 4633 let from = consumer.originalPositionFor({ column, line }) 4634 if (!from.source) return false 4635 4636 let to 4637 if (typeof endLine === 'number') { 4638 to = consumer.originalPositionFor({ column: endColumn, line: endLine }) 4639 } 4640 4641 let fromUrl 4642 4643 if (isAbsolute(from.source)) { 4644 fromUrl = pathToFileURL(from.source) 4645 } else { 4646 fromUrl = new URL( 4647 from.source, 4648 this.map.consumer().sourceRoot || pathToFileURL(this.map.mapFile) 4649 ) 4650 } 4651 4652 let result = { 4653 column: from.column, 4654 endColumn: to && to.column, 4655 endLine: to && to.line, 4656 line: from.line, 4657 url: fromUrl.toString() 4658 } 4659 4660 if (fromUrl.protocol === 'file:') { 4661 if (fileURLToPath) { 4662 result.file = fileURLToPath(fromUrl) 4663 } else { 4664 /* c8 ignore next 2 */ 4665 throw new Error(`file: protocol is not available in this PostCSS build`) 4666 } 4667 } 4668 4669 let source = consumer.sourceContentFor(from.source) 4670 if (source) result.source = source 4671 4672 return result 4673 } 4674 4675 toJSON() { 4676 let json = {} 4677 for (let name of ['hasBOM', 'css', 'file', 'id']) { 4678 if (this[name] != null) { 4679 json[name] = this[name] 4680 } 4681 } 4682 if (this.map) { 4683 json.map = { ...this.map } 4684 if (json.map.consumerCache) { 4685 json.map.consumerCache = undefined 4686 } 4687 } 4688 return json 4689 } 4690 } 4691 4692 module.exports = Input 4693 Input.default = Input 4694 4695 if (terminalHighlight && terminalHighlight.registerInput) { 4696 terminalHighlight.registerInput(Input) 4697 } 4698 4699 4700 /***/ }), 4701 4702 /***/ 5404: 4703 /***/ ((module, __unused_webpack_exports, __webpack_require__) => { 4704 4705 const CSSValueParser = __webpack_require__(1544) 4706 4707 /** 4708 * @type {import('postcss').PluginCreator} 4709 */ 4710 module.exports = (opts) => { 4711 4712 const DEFAULTS = { 4713 skipHostRelativeUrls: true, 4714 } 4715 const config = Object.assign(DEFAULTS, opts) 4716 4717 return { 4718 postcssPlugin: 'rebaseUrl', 4719 4720 Declaration(decl) { 4721 // The faster way to find Declaration node 4722 const parsedValue = CSSValueParser(decl.value) 4723 4724 let valueChanged = false 4725 parsedValue.walk(node => { 4726 if (node.type !== 'function' || node.value !== 'url') { 4727 return 4728 } 4729 4730 const urlVal = node.nodes[0].value 4731 4732 // bases relative URLs with rootUrl 4733 const basedUrl = new URL(urlVal, opts.rootUrl) 4734 4735 // skip host-relative, already normalized URLs (e.g. `/images/image.jpg`, without `..`s) 4736 if ((basedUrl.pathname === urlVal) && config.skipHostRelativeUrls) { 4737 return false // skip this value 4738 } 4739 4740 node.nodes[0].value = basedUrl.toString() 4741 valueChanged = true 4742 4743 return false // do not walk deeper 4744 }) 4745 4746 if (valueChanged) { 4747 decl.value = CSSValueParser.stringify(parsedValue) 4748 } 4749 4750 } 4751 } 4752 } 4753 4754 module.exports.postcss = true 4755 4756 4757 /***/ }), 4758 4759 /***/ 5417: 4760 /***/ ((__unused_webpack_module, exports) => { 4761 4762 "use strict"; 4763 /*istanbul ignore start*/ 4764 4765 4766 Object.defineProperty(exports, "__esModule", ({ 4767 value: true 4768 })); 4769 exports["default"] = Diff; 4770 4771 /*istanbul ignore end*/ 4772 function Diff() {} 4773 4774 Diff.prototype = { 4775 /*istanbul ignore start*/ 4776 4777 /*istanbul ignore end*/ 4778 diff: function diff(oldString, newString) { 4779 /*istanbul ignore start*/ 4780 var 4781 /*istanbul ignore end*/ 4782 options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; 4783 var callback = options.callback; 4784 4785 if (typeof options === 'function') { 4786 callback = options; 4787 options = {}; 4788 } 4789 4790 this.options = options; 4791 var self = this; 4792 4793 function done(value) { 4794 if (callback) { 4795 setTimeout(function () { 4796 callback(undefined, value); 4797 }, 0); 4798 return true; 4799 } else { 4800 return value; 4801 } 4802 } // Allow subclasses to massage the input prior to running 4803 4804 4805 oldString = this.castInput(oldString); 4806 newString = this.castInput(newString); 4807 oldString = this.removeEmpty(this.tokenize(oldString)); 4808 newString = this.removeEmpty(this.tokenize(newString)); 4809 var newLen = newString.length, 4810 oldLen = oldString.length; 4811 var editLength = 1; 4812 var maxEditLength = newLen + oldLen; 4813 var bestPath = [{ 4814 newPos: -1, 4815 components: [] 4816 }]; // Seed editLength = 0, i.e. the content starts with the same values 4817 4818 var oldPos = this.extractCommon(bestPath[0], newString, oldString, 0); 4819 4820 if (bestPath[0].newPos + 1 >= newLen && oldPos + 1 >= oldLen) { 4821 // Identity per the equality and tokenizer 4822 return done([{ 4823 value: this.join(newString), 4824 count: newString.length 4825 }]); 4826 } // Main worker method. checks all permutations of a given edit length for acceptance. 4827 4828 4829 function execEditLength() { 4830 for (var diagonalPath = -1 * editLength; diagonalPath <= editLength; diagonalPath += 2) { 4831 var basePath = 4832 /*istanbul ignore start*/ 4833 void 0 4834 /*istanbul ignore end*/ 4835 ; 4836 4837 var addPath = bestPath[diagonalPath - 1], 4838 removePath = bestPath[diagonalPath + 1], 4839 _oldPos = (removePath ? removePath.newPos : 0) - diagonalPath; 4840 4841 if (addPath) { 4842 // No one else is going to attempt to use this value, clear it 4843 bestPath[diagonalPath - 1] = undefined; 4844 } 4845 4846 var canAdd = addPath && addPath.newPos + 1 < newLen, 4847 canRemove = removePath && 0 <= _oldPos && _oldPos < oldLen; 4848 4849 if (!canAdd && !canRemove) { 4850 // If this path is a terminal then prune 4851 bestPath[diagonalPath] = undefined; 4852 continue; 4853 } // Select the diagonal that we want to branch from. We select the prior 4854 // path whose position in the new string is the farthest from the origin 4855 // and does not pass the bounds of the diff graph 4856 4857 4858 if (!canAdd || canRemove && addPath.newPos < removePath.newPos) { 4859 basePath = clonePath(removePath); 4860 self.pushComponent(basePath.components, undefined, true); 4861 } else { 4862 basePath = addPath; // No need to clone, we've pulled it from the list 4863 4864 basePath.newPos++; 4865 self.pushComponent(basePath.components, true, undefined); 4866 } 4867 4868 _oldPos = self.extractCommon(basePath, newString, oldString, diagonalPath); // If we have hit the end of both strings, then we are done 4869 4870 if (basePath.newPos + 1 >= newLen && _oldPos + 1 >= oldLen) { 4871 return done(buildValues(self, basePath.components, newString, oldString, self.useLongestToken)); 4872 } else { 4873 // Otherwise track this path as a potential candidate and continue. 4874 bestPath[diagonalPath] = basePath; 4875 } 4876 } 4877 4878 editLength++; 4879 } // Performs the length of edit iteration. Is a bit fugly as this has to support the 4880 // sync and async mode which is never fun. Loops over execEditLength until a value 4881 // is produced. 4882 4883 4884 if (callback) { 4885 (function exec() { 4886 setTimeout(function () { 4887 // This should not happen, but we want to be safe. 4888 4889 /* istanbul ignore next */ 4890 if (editLength > maxEditLength) { 4891 return callback(); 4892 } 4893 4894 if (!execEditLength()) { 4895 exec(); 4896 } 4897 }, 0); 4898 })(); 4899 } else { 4900 while (editLength <= maxEditLength) { 4901 var ret = execEditLength(); 4902 4903 if (ret) { 4904 return ret; 4905 } 4906 } 4907 } 4908 }, 4909 4910 /*istanbul ignore start*/ 4911 4912 /*istanbul ignore end*/ 4913 pushComponent: function pushComponent(components, added, removed) { 4914 var last = components[components.length - 1]; 4915 4916 if (last && last.added === added && last.removed === removed) { 4917 // We need to clone here as the component clone operation is just 4918 // as shallow array clone 4919 components[components.length - 1] = { 4920 count: last.count + 1, 4921 added: added, 4922 removed: removed 4923 }; 4924 } else { 4925 components.push({ 4926 count: 1, 4927 added: added, 4928 removed: removed 4929 }); 4930 } 4931 }, 4932 4933 /*istanbul ignore start*/ 4934 4935 /*istanbul ignore end*/ 4936 extractCommon: function extractCommon(basePath, newString, oldString, diagonalPath) { 4937 var newLen = newString.length, 4938 oldLen = oldString.length, 4939 newPos = basePath.newPos, 4940 oldPos = newPos - diagonalPath, 4941 commonCount = 0; 4942 4943 while (newPos + 1 < newLen && oldPos + 1 < oldLen && this.equals(newString[newPos + 1], oldString[oldPos + 1])) { 4944 newPos++; 4945 oldPos++; 4946 commonCount++; 4947 } 4948 4949 if (commonCount) { 4950 basePath.components.push({ 4951 count: commonCount 4952 }); 4953 } 4954 4955 basePath.newPos = newPos; 4956 return oldPos; 4957 }, 4958 4959 /*istanbul ignore start*/ 4960 4961 /*istanbul ignore end*/ 4962 equals: function equals(left, right) { 4963 if (this.options.comparator) { 4964 return this.options.comparator(left, right); 4965 } else { 4966 return left === right || this.options.ignoreCase && left.toLowerCase() === right.toLowerCase(); 4967 } 4968 }, 4969 4970 /*istanbul ignore start*/ 4971 4972 /*istanbul ignore end*/ 4973 removeEmpty: function removeEmpty(array) { 4974 var ret = []; 4975 4976 for (var i = 0; i < array.length; i++) { 4977 if (array[i]) { 4978 ret.push(array[i]); 4979 } 4980 } 4981 4982 return ret; 4983 }, 4984 4985 /*istanbul ignore start*/ 4986 4987 /*istanbul ignore end*/ 4988 castInput: function castInput(value) { 4989 return value; 4990 }, 4991 4992 /*istanbul ignore start*/ 4993 4994 /*istanbul ignore end*/ 4995 tokenize: function tokenize(value) { 4996 return value.split(''); 4997 }, 4998 4999 /*istanbul ignore start*/ 5000 5001 /*istanbul ignore end*/ 5002 join: function join(chars) { 5003 return chars.join(''); 5004 } 5005 }; 5006 5007 function buildValues(diff, components, newString, oldString, useLongestToken) { 5008 var componentPos = 0, 5009 componentLen = components.length, 5010 newPos = 0, 5011 oldPos = 0; 5012 5013 for (; componentPos < componentLen; componentPos++) { 5014 var component = components[componentPos]; 5015 5016 if (!component.removed) { 5017 if (!component.added && useLongestToken) { 5018 var value = newString.slice(newPos, newPos + component.count); 5019 value = value.map(function (value, i) { 5020 var oldValue = oldString[oldPos + i]; 5021 return oldValue.length > value.length ? oldValue : value; 5022 }); 5023 component.value = diff.join(value); 5024 } else { 5025 component.value = diff.join(newString.slice(newPos, newPos + component.count)); 5026 } 5027 5028 newPos += component.count; // Common case 5029 5030 if (!component.added) { 5031 oldPos += component.count; 5032 } 5033 } else { 5034 component.value = diff.join(oldString.slice(oldPos, oldPos + component.count)); 5035 oldPos += component.count; // Reverse add and remove so removes are output first to match common convention 5036 // The diffing algorithm is tied to add then remove output and this is the simplest 5037 // route to get the desired output with minimal overhead. 5038 5039 if (componentPos && components[componentPos - 1].added) { 5040 var tmp = components[componentPos - 1]; 5041 components[componentPos - 1] = components[componentPos]; 5042 components[componentPos] = tmp; 5043 } 5044 } 5045 } // Special case handle for when one terminal is ignored (i.e. whitespace). 5046 // For this case we merge the terminal into the prior string and drop the change. 5047 // This is only available for string mode. 5048 5049 5050 var lastComponent = components[componentLen - 1]; 5051 5052 if (componentLen > 1 && typeof lastComponent.value === 'string' && (lastComponent.added || lastComponent.removed) && diff.equals('', lastComponent.value)) { 5053 components[componentLen - 2].value += lastComponent.value; 5054 components.pop(); 5055 } 5056 5057 return components; 5058 } 5059 5060 function clonePath(path) { 5061 return { 5062 newPos: path.newPos, 5063 components: path.components.slice(0) 5064 }; 5065 } 5066 5067 5068 /***/ }), 5069 5070 /***/ 5696: 5071 /***/ ((module, __unused_webpack_exports, __webpack_require__) => { 5072 5073 "use strict"; 5074 5075 5076 let { existsSync, readFileSync } = __webpack_require__(9977) 5077 let { dirname, join } = __webpack_require__(197) 5078 let { SourceMapConsumer, SourceMapGenerator } = __webpack_require__(1866) 5079 5080 function fromBase64(str) { 5081 if (Buffer) { 5082 return Buffer.from(str, 'base64').toString() 5083 } else { 5084 /* c8 ignore next 2 */ 5085 return window.atob(str) 5086 } 5087 } 5088 5089 class PreviousMap { 5090 constructor(css, opts) { 5091 if (opts.map === false) return 5092 this.loadAnnotation(css) 5093 this.inline = this.startWith(this.annotation, 'data:') 5094 5095 let prev = opts.map ? opts.map.prev : undefined 5096 let text = this.loadMap(opts.from, prev) 5097 if (!this.mapFile && opts.from) { 5098 this.mapFile = opts.from 5099 } 5100 if (this.mapFile) this.root = dirname(this.mapFile) 5101 if (text) this.text = text 5102 } 5103 5104 consumer() { 5105 if (!this.consumerCache) { 5106 this.consumerCache = new SourceMapConsumer(this.text) 5107 } 5108 return this.consumerCache 5109 } 5110 5111 decodeInline(text) { 5112 let baseCharsetUri = /^data:application\/json;charset=utf-?8;base64,/ 5113 let baseUri = /^data:application\/json;base64,/ 5114 let charsetUri = /^data:application\/json;charset=utf-?8,/ 5115 let uri = /^data:application\/json,/ 5116 5117 let uriMatch = text.match(charsetUri) || text.match(uri) 5118 if (uriMatch) { 5119 return decodeURIComponent(text.substr(uriMatch[0].length)) 5120 } 5121 5122 let baseUriMatch = text.match(baseCharsetUri) || text.match(baseUri) 5123 if (baseUriMatch) { 5124 return fromBase64(text.substr(baseUriMatch[0].length)) 5125 } 5126 5127 let encoding = text.match(/data:application\/json;([^,]+),/)[1] 5128 throw new Error('Unsupported source map encoding ' + encoding) 5129 } 5130 5131 getAnnotationURL(sourceMapString) { 5132 return sourceMapString.replace(/^\/\*\s*# sourceMappingURL=/, '').trim() 5133 } 5134 5135 isMap(map) { 5136 if (typeof map !== 'object') return false 5137 return ( 5138 typeof map.mappings === 'string' || 5139 typeof map._mappings === 'string' || 5140 Array.isArray(map.sections) 5141 ) 5142 } 5143 5144 loadAnnotation(css) { 5145 let comments = css.match(/\/\*\s*# sourceMappingURL=/g) 5146 if (!comments) return 5147 5148 // sourceMappingURLs from comments, strings, etc. 5149 let start = css.lastIndexOf(comments.pop()) 5150 let end = css.indexOf('*/', start) 5151 5152 if (start > -1 && end > -1) { 5153 // Locate the last sourceMappingURL to avoid pickin 5154 this.annotation = this.getAnnotationURL(css.substring(start, end)) 5155 } 5156 } 5157 5158 loadFile(path) { 5159 this.root = dirname(path) 5160 if (existsSync(path)) { 5161 this.mapFile = path 5162 return readFileSync(path, 'utf-8').toString().trim() 5163 } 5164 } 5165 5166 loadMap(file, prev) { 5167 if (prev === false) return false 5168 5169 if (prev) { 5170 if (typeof prev === 'string') { 5171 return prev 5172 } else if (typeof prev === 'function') { 5173 let prevPath = prev(file) 5174 if (prevPath) { 5175 let map = this.loadFile(prevPath) 5176 if (!map) { 5177 throw new Error( 5178 'Unable to load previous source map: ' + prevPath.toString() 5179 ) 5180 } 5181 return map 5182 } 5183 } else if (prev instanceof SourceMapConsumer) { 5184 return SourceMapGenerator.fromSourceMap(prev).toString() 5185 } else if (prev instanceof SourceMapGenerator) { 5186 return prev.toString() 5187 } else if (this.isMap(prev)) { 5188 return JSON.stringify(prev) 5189 } else { 5190 throw new Error( 5191 'Unsupported previous source map format: ' + prev.toString() 5192 ) 5193 } 5194 } else if (this.inline) { 5195 return this.decodeInline(this.annotation) 5196 } else if (this.annotation) { 5197 let map = this.annotation 5198 if (file) map = join(dirname(file), map) 5199 return this.loadFile(map) 5200 } 5201 } 5202 5203 startWith(string, start) { 5204 if (!string) return false 5205 return string.substr(0, start.length) === start 5206 } 5207 5208 withContent() { 5209 return !!( 5210 this.consumer().sourcesContent && 5211 this.consumer().sourcesContent.length > 0 5212 ) 5213 } 5214 } 5215 5216 module.exports = PreviousMap 5217 PreviousMap.default = PreviousMap 5218 5219 5220 /***/ }), 5221 5222 /***/ 5776: 5223 /***/ ((module) => { 5224 5225 "use strict"; 5226 5227 5228 class Warning { 5229 constructor(text, opts = {}) { 5230 this.type = 'warning' 5231 this.text = text 5232 5233 if (opts.node && opts.node.source) { 5234 let range = opts.node.rangeBy(opts) 5235 this.line = range.start.line 5236 this.column = range.start.column 5237 this.endLine = range.end.line 5238 this.endColumn = range.end.column 5239 } 5240 5241 for (let opt in opts) this[opt] = opts[opt] 5242 } 5243 5244 toString() { 5245 if (this.node) { 5246 return this.node.error(this.text, { 5247 index: this.index, 5248 plugin: this.plugin, 5249 word: this.word 5250 }).message 5251 } 5252 5253 if (this.plugin) { 5254 return this.plugin + ': ' + this.text 5255 } 5256 5257 return this.text 5258 } 5259 } 5260 5261 module.exports = Warning 5262 Warning.default = Warning 5263 5264 5265 /***/ }), 5266 5267 /***/ 5826: 5268 /***/ ((module, __unused_webpack_exports, __webpack_require__) => { 5269 5270 /** 5271 * Copyright (c) 2013-present, Facebook, Inc. 5272 * 5273 * This source code is licensed under the MIT license found in the 5274 * LICENSE file in the root directory of this source tree. 5275 */ 5276 5277 if (false) { var throwOnDirectAccess, ReactIs; } else { 5278 // By explicitly using `prop-types` you are opting into new production behavior. 5279 // http://fb.me/prop-types-in-prod 5280 module.exports = __webpack_require__(628)(); 5281 } 5282 5283 5284 /***/ }), 5285 5286 /***/ 6109: 5287 /***/ ((module) => { 5288 5289 // This code has been refactored for 140 bytes 5290 // You can see the original here: https://github.com/twolfson/computedStyle/blob/04cd1da2e30fa45844f95f5cb1ac898e9b9ef050/lib/computedStyle.js 5291 var computedStyle = function (el, prop, getComputedStyle) { 5292 getComputedStyle = window.getComputedStyle; 5293 5294 // In one fell swoop 5295 return ( 5296 // If we have getComputedStyle 5297 getComputedStyle ? 5298 // Query it 5299 // TODO: From CSS-Query notes, we might need (node, null) for FF 5300 getComputedStyle(el) : 5301 5302 // Otherwise, we are in IE and use currentStyle 5303 el.currentStyle 5304 )[ 5305 // Switch to camelCase for CSSOM 5306 // DEV: Grabbed from jQuery 5307 // https://github.com/jquery/jquery/blob/1.9-stable/src/css.js#L191-L194 5308 // https://github.com/jquery/jquery/blob/1.9-stable/src/core.js#L593-L597 5309 prop.replace(/-(\w)/gi, function (word, letter) { 5310 return letter.toUpperCase(); 5311 }) 5312 ]; 5313 }; 5314 5315 module.exports = computedStyle; 5316 5317 5318 /***/ }), 5319 5320 /***/ 6589: 5321 /***/ ((module, __unused_webpack_exports, __webpack_require__) => { 5322 5323 "use strict"; 5324 5325 5326 let Node = __webpack_require__(7490) 5327 5328 class Comment extends Node { 5329 constructor(defaults) { 5330 super(defaults) 5331 this.type = 'comment' 5332 } 5333 } 5334 5335 module.exports = Comment 5336 Comment.default = Comment 5337 5338 5339 /***/ }), 5340 5341 /***/ 7191: 5342 /***/ ((module, __unused_webpack_exports, __webpack_require__) => { 5343 5344 "use strict"; 5345 /** 5346 * Copyright (c) 2015, Facebook, Inc. 5347 * All rights reserved. 5348 * 5349 * This source code is licensed under the BSD-style license found in the 5350 * LICENSE file in the root directory of this source tree. An additional grant 5351 * of patent rights can be found in the PATENTS file in the same directory. 5352 * 5353 * @providesModule normalizeWheel 5354 * @typechecks 5355 */ 5356 5357 5358 5359 var UserAgent_DEPRECATED = __webpack_require__(2213); 5360 5361 var isEventSupported = __webpack_require__(1087); 5362 5363 5364 // Reasonable defaults 5365 var PIXEL_STEP = 10; 5366 var LINE_HEIGHT = 40; 5367 var PAGE_HEIGHT = 800; 5368 5369 /** 5370 * Mouse wheel (and 2-finger trackpad) support on the web sucks. It is 5371 * complicated, thus this doc is long and (hopefully) detailed enough to answer 5372 * your questions. 5373 * 5374 * If you need to react to the mouse wheel in a predictable way, this code is 5375 * like your bestest friend. * hugs * 5376 * 5377 * As of today, there are 4 DOM event types you can listen to: 5378 * 5379 * 'wheel' -- Chrome(31+), FF(17+), IE(9+) 5380 * 'mousewheel' -- Chrome, IE(6+), Opera, Safari 5381 * 'MozMousePixelScroll' -- FF(3.5 only!) (2010-2013) -- don't bother! 5382 * 'DOMMouseScroll' -- FF(0.9.7+) since 2003 5383 * 5384 * So what to do? The is the best: 5385 * 5386 * normalizeWheel.getEventType(); 5387 * 5388 * In your event callback, use this code to get sane interpretation of the 5389 * deltas. This code will return an object with properties: 5390 * 5391 * spinX -- normalized spin speed (use for zoom) - x plane 5392 * spinY -- " - y plane 5393 * pixelX -- normalized distance (to pixels) - x plane 5394 * pixelY -- " - y plane 5395 * 5396 * Wheel values are provided by the browser assuming you are using the wheel to 5397 * scroll a web page by a number of lines or pixels (or pages). Values can vary 5398 * significantly on different platforms and browsers, forgetting that you can 5399 * scroll at different speeds. Some devices (like trackpads) emit more events 5400 * at smaller increments with fine granularity, and some emit massive jumps with 5401 * linear speed or acceleration. 5402 * 5403 * This code does its best to normalize the deltas for you: 5404 * 5405 * - spin is trying to normalize how far the wheel was spun (or trackpad 5406 * dragged). This is super useful for zoom support where you want to 5407 * throw away the chunky scroll steps on the PC and make those equal to 5408 * the slow and smooth tiny steps on the Mac. Key data: This code tries to 5409 * resolve a single slow step on a wheel to 1. 5410 * 5411 * - pixel is normalizing the desired scroll delta in pixel units. You'll 5412 * get the crazy differences between browsers, but at least it'll be in 5413 * pixels! 5414 * 5415 * - positive value indicates scrolling DOWN/RIGHT, negative UP/LEFT. This 5416 * should translate to positive value zooming IN, negative zooming OUT. 5417 * This matches the newer 'wheel' event. 5418 * 5419 * Why are there spinX, spinY (or pixels)? 5420 * 5421 * - spinX is a 2-finger side drag on the trackpad, and a shift + wheel turn 5422 * with a mouse. It results in side-scrolling in the browser by default. 5423 * 5424 * - spinY is what you expect -- it's the classic axis of a mouse wheel. 5425 * 5426 * - I dropped spinZ/pixelZ. It is supported by the DOM 3 'wheel' event and 5427 * probably is by browsers in conjunction with fancy 3D controllers .. but 5428 * you know. 5429 * 5430 * Implementation info: 5431 * 5432 * Examples of 'wheel' event if you scroll slowly (down) by one step with an 5433 * average mouse: 5434 * 5435 * OS X + Chrome (mouse) - 4 pixel delta (wheelDelta -120) 5436 * OS X + Safari (mouse) - N/A pixel delta (wheelDelta -12) 5437 * OS X + Firefox (mouse) - 0.1 line delta (wheelDelta N/A) 5438 * Win8 + Chrome (mouse) - 100 pixel delta (wheelDelta -120) 5439 * Win8 + Firefox (mouse) - 3 line delta (wheelDelta -120) 5440 * 5441 * On the trackpad: 5442 * 5443 * OS X + Chrome (trackpad) - 2 pixel delta (wheelDelta -6) 5444 * OS X + Firefox (trackpad) - 1 pixel delta (wheelDelta N/A) 5445 * 5446 * On other/older browsers.. it's more complicated as there can be multiple and 5447 * also missing delta values. 5448 * 5449 * The 'wheel' event is more standard: 5450 * 5451 * http://www.w3.org/TR/DOM-Level-3-Events/#events-wheelevents 5452 * 5453 * The basics is that it includes a unit, deltaMode (pixels, lines, pages), and 5454 * deltaX, deltaY and deltaZ. Some browsers provide other values to maintain 5455 * backward compatibility with older events. Those other values help us 5456 * better normalize spin speed. Example of what the browsers provide: 5457 * 5458 * | event.wheelDelta | event.detail 5459 * ------------------+------------------+-------------- 5460 * Safari v5/OS X | -120 | 0 5461 * Safari v5/Win7 | -120 | 0 5462 * Chrome v17/OS X | -120 | 0 5463 * Chrome v17/Win7 | -120 | 0 5464 * IE9/Win7 | -120 | undefined 5465 * Firefox v4/OS X | undefined | 1 5466 * Firefox v4/Win7 | undefined | 3 5467 * 5468 */ 5469 function normalizeWheel(/*object*/ event) /*object*/ { 5470 var sX = 0, sY = 0, // spinX, spinY 5471 pX = 0, pY = 0; // pixelX, pixelY 5472 5473 // Legacy 5474 if ('detail' in event) { sY = event.detail; } 5475 if ('wheelDelta' in event) { sY = -event.wheelDelta / 120; } 5476 if ('wheelDeltaY' in event) { sY = -event.wheelDeltaY / 120; } 5477 if ('wheelDeltaX' in event) { sX = -event.wheelDeltaX / 120; } 5478 5479 // side scrolling on FF with DOMMouseScroll 5480 if ( 'axis' in event && event.axis === event.HORIZONTAL_AXIS ) { 5481 sX = sY; 5482 sY = 0; 5483 } 5484 5485 pX = sX * PIXEL_STEP; 5486 pY = sY * PIXEL_STEP; 5487 5488 if ('deltaY' in event) { pY = event.deltaY; } 5489 if ('deltaX' in event) { pX = event.deltaX; } 5490 5491 if ((pX || pY) && event.deltaMode) { 5492 if (event.deltaMode == 1) { // delta in LINE units 5493 pX *= LINE_HEIGHT; 5494 pY *= LINE_HEIGHT; 5495 } else { // delta in PAGE units 5496 pX *= PAGE_HEIGHT; 5497 pY *= PAGE_HEIGHT; 5498 } 5499 } 5500 5501 // Fall-back if spin cannot be determined 5502 if (pX && !sX) { sX = (pX < 1) ? -1 : 1; } 5503 if (pY && !sY) { sY = (pY < 1) ? -1 : 1; } 5504 5505 return { spinX : sX, 5506 spinY : sY, 5507 pixelX : pX, 5508 pixelY : pY }; 5509 } 5510 5511 5512 /** 5513 * The best combination if you prefer spinX + spinY normalization. It favors 5514 * the older DOMMouseScroll for Firefox, as FF does not include wheelDelta with 5515 * 'wheel' event, making spin speed determination impossible. 5516 */ 5517 normalizeWheel.getEventType = function() /*string*/ { 5518 return (UserAgent_DEPRECATED.firefox()) 5519 ? 'DOMMouseScroll' 5520 : (isEventSupported('wheel')) 5521 ? 'wheel' 5522 : 'mousewheel'; 5523 }; 5524 5525 module.exports = normalizeWheel; 5526 5527 5528 /***/ }), 5529 5530 /***/ 7374: 5531 /***/ ((module) => { 5532 5533 "use strict"; 5534 5535 5536 let list = { 5537 comma(string) { 5538 return list.split(string, [','], true) 5539 }, 5540 5541 space(string) { 5542 let spaces = [' ', '\n', '\t'] 5543 return list.split(string, spaces) 5544 }, 5545 5546 split(string, separators, last) { 5547 let array = [] 5548 let current = '' 5549 let split = false 5550 5551 let func = 0 5552 let inQuote = false 5553 let prevQuote = '' 5554 let escape = false 5555 5556 for (let letter of string) { 5557 if (escape) { 5558 escape = false 5559 } else if (letter === '\\') { 5560 escape = true 5561 } else if (inQuote) { 5562 if (letter === prevQuote) { 5563 inQuote = false 5564 } 5565 } else if (letter === '"' || letter === "'") { 5566 inQuote = true 5567 prevQuote = letter 5568 } else if (letter === '(') { 5569 func += 1 5570 } else if (letter === ')') { 5571 if (func > 0) func -= 1 5572 } else if (func === 0) { 5573 if (separators.includes(letter)) split = true 5574 } 5575 5576 if (split) { 5577 if (current !== '') array.push(current.trim()) 5578 current = '' 5579 split = false 5580 } else { 5581 current += letter 5582 } 5583 } 5584 5585 if (last || current !== '') array.push(current.trim()) 5586 return array 5587 } 5588 } 5589 5590 module.exports = list 5591 list.default = list 5592 5593 5594 /***/ }), 5595 5596 /***/ 7490: 5597 /***/ ((module, __unused_webpack_exports, __webpack_require__) => { 5598 5599 "use strict"; 5600 5601 5602 let CssSyntaxError = __webpack_require__(356) 5603 let Stringifier = __webpack_require__(346) 5604 let stringify = __webpack_require__(633) 5605 let { isClean, my } = __webpack_require__(1381) 5606 5607 function cloneNode(obj, parent) { 5608 let cloned = new obj.constructor() 5609 5610 for (let i in obj) { 5611 if (!Object.prototype.hasOwnProperty.call(obj, i)) { 5612 /* c8 ignore next 2 */ 5613 continue 5614 } 5615 if (i === 'proxyCache') continue 5616 let value = obj[i] 5617 let type = typeof value 5618 5619 if (i === 'parent' && type === 'object') { 5620 if (parent) cloned[i] = parent 5621 } else if (i === 'source') { 5622 cloned[i] = value 5623 } else if (Array.isArray(value)) { 5624 cloned[i] = value.map(j => cloneNode(j, cloned)) 5625 } else { 5626 if (type === 'object' && value !== null) value = cloneNode(value) 5627 cloned[i] = value 5628 } 5629 } 5630 5631 return cloned 5632 } 5633 5634 function sourceOffset(inputCSS, position) { 5635 // Not all custom syntaxes support `offset` in `source.start` and `source.end` 5636 if ( 5637 position && 5638 typeof position.offset !== 'undefined' 5639 ) { 5640 return position.offset; 5641 } 5642 5643 let column = 1 5644 let line = 1 5645 let offset = 0 5646 5647 for (let i = 0; i < inputCSS.length; i++) { 5648 if (line === position.line && column === position.column) { 5649 offset = i 5650 break 5651 } 5652 5653 if (inputCSS[i] === '\n') { 5654 column = 1 5655 line += 1 5656 } else { 5657 column += 1 5658 } 5659 } 5660 5661 return offset 5662 } 5663 5664 class Node { 5665 get proxyOf() { 5666 return this 5667 } 5668 5669 constructor(defaults = {}) { 5670 this.raws = {} 5671 this[isClean] = false 5672 this[my] = true 5673 5674 for (let name in defaults) { 5675 if (name === 'nodes') { 5676 this.nodes = [] 5677 for (let node of defaults[name]) { 5678 if (typeof node.clone === 'function') { 5679 this.append(node.clone()) 5680 } else { 5681 this.append(node) 5682 } 5683 } 5684 } else { 5685 this[name] = defaults[name] 5686 } 5687 } 5688 } 5689 5690 addToError(error) { 5691 error.postcssNode = this 5692 if (error.stack && this.source && /\n\s{4}at /.test(error.stack)) { 5693 let s = this.source 5694 error.stack = error.stack.replace( 5695 /\n\s{4}at /, 5696 `$&$s.input.from}:$s.start.line}:$s.start.column}$&` 5697 ) 5698 } 5699 return error 5700 } 5701 5702 after(add) { 5703 this.parent.insertAfter(this, add) 5704 return this 5705 } 5706 5707 assign(overrides = {}) { 5708 for (let name in overrides) { 5709 this[name] = overrides[name] 5710 } 5711 return this 5712 } 5713 5714 before(add) { 5715 this.parent.insertBefore(this, add) 5716 return this 5717 } 5718 5719 cleanRaws(keepBetween) { 5720 delete this.raws.before 5721 delete this.raws.after 5722 if (!keepBetween) delete this.raws.between 5723 } 5724 5725 clone(overrides = {}) { 5726 let cloned = cloneNode(this) 5727 for (let name in overrides) { 5728 cloned[name] = overrides[name] 5729 } 5730 return cloned 5731 } 5732 5733 cloneAfter(overrides = {}) { 5734 let cloned = this.clone(overrides) 5735 this.parent.insertAfter(this, cloned) 5736 return cloned 5737 } 5738 5739 cloneBefore(overrides = {}) { 5740 let cloned = this.clone(overrides) 5741 this.parent.insertBefore(this, cloned) 5742 return cloned 5743 } 5744 5745 error(message, opts = {}) { 5746 if (this.source) { 5747 let { end, start } = this.rangeBy(opts) 5748 return this.source.input.error( 5749 message, 5750 { column: start.column, line: start.line }, 5751 { column: end.column, line: end.line }, 5752 opts 5753 ) 5754 } 5755 return new CssSyntaxError(message) 5756 } 5757 5758 getProxyProcessor() { 5759 return { 5760 get(node, prop) { 5761 if (prop === 'proxyOf') { 5762 return node 5763 } else if (prop === 'root') { 5764 return () => node.root().toProxy() 5765 } else { 5766 return node[prop] 5767 } 5768 }, 5769 5770 set(node, prop, value) { 5771 if (node[prop] === value) return true 5772 node[prop] = value 5773 if ( 5774 prop === 'prop' || 5775 prop === 'value' || 5776 prop === 'name' || 5777 prop === 'params' || 5778 prop === 'important' || 5779 /* c8 ignore next */ 5780 prop === 'text' 5781 ) { 5782 node.markDirty() 5783 } 5784 return true 5785 } 5786 } 5787 } 5788 5789 /* c8 ignore next 3 */ 5790 markClean() { 5791 this[isClean] = true 5792 } 5793 5794 markDirty() { 5795 if (this[isClean]) { 5796 this[isClean] = false 5797 let next = this 5798 while ((next = next.parent)) { 5799 next[isClean] = false 5800 } 5801 } 5802 } 5803 5804 next() { 5805 if (!this.parent) return undefined 5806 let index = this.parent.index(this) 5807 return this.parent.nodes[index + 1] 5808 } 5809 5810 positionBy(opts) { 5811 let pos = this.source.start 5812 if (opts.index) { 5813 pos = this.positionInside(opts.index) 5814 } else if (opts.word) { 5815 let inputString = ('document' in this.source.input) 5816 ? this.source.input.document 5817 : this.source.input.css 5818 let stringRepresentation = inputString.slice( 5819 sourceOffset(inputString, this.source.start), 5820 sourceOffset(inputString, this.source.end) 5821 ) 5822 let index = stringRepresentation.indexOf(opts.word) 5823 if (index !== -1) pos = this.positionInside(index) 5824 } 5825 return pos 5826 } 5827 5828 positionInside(index) { 5829 let column = this.source.start.column 5830 let line = this.source.start.line 5831 let inputString = ('document' in this.source.input) 5832 ? this.source.input.document 5833 : this.source.input.css 5834 let offset = sourceOffset(inputString, this.source.start) 5835 let end = offset + index 5836 5837 for (let i = offset; i < end; i++) { 5838 if (inputString[i] === '\n') { 5839 column = 1 5840 line += 1 5841 } else { 5842 column += 1 5843 } 5844 } 5845 5846 return { column, line } 5847 } 5848 5849 prev() { 5850 if (!this.parent) return undefined 5851 let index = this.parent.index(this) 5852 return this.parent.nodes[index - 1] 5853 } 5854 5855 rangeBy(opts) { 5856 let start = { 5857 column: this.source.start.column, 5858 line: this.source.start.line 5859 } 5860 let end = this.source.end 5861 ? { 5862 column: this.source.end.column + 1, 5863 line: this.source.end.line 5864 } 5865 : { 5866 column: start.column + 1, 5867 line: start.line 5868 } 5869 5870 if (opts.word) { 5871 let inputString = ('document' in this.source.input) 5872 ? this.source.input.document 5873 : this.source.input.css 5874 let stringRepresentation = inputString.slice( 5875 sourceOffset(inputString, this.source.start), 5876 sourceOffset(inputString, this.source.end) 5877 ) 5878 let index = stringRepresentation.indexOf(opts.word) 5879 if (index !== -1) { 5880 start = this.positionInside(index) 5881 end = this.positionInside( 5882 index + opts.word.length, 5883 ) 5884 } 5885 } else { 5886 if (opts.start) { 5887 start = { 5888 column: opts.start.column, 5889 line: opts.start.line 5890 } 5891 } else if (opts.index) { 5892 start = this.positionInside(opts.index) 5893 } 5894 5895 if (opts.end) { 5896 end = { 5897 column: opts.end.column, 5898 line: opts.end.line 5899 } 5900 } else if (typeof opts.endIndex === 'number') { 5901 end = this.positionInside(opts.endIndex) 5902 } else if (opts.index) { 5903 end = this.positionInside(opts.index + 1) 5904 } 5905 } 5906 5907 if ( 5908 end.line < start.line || 5909 (end.line === start.line && end.column <= start.column) 5910 ) { 5911 end = { column: start.column + 1, line: start.line } 5912 } 5913 5914 return { end, start } 5915 } 5916 5917 raw(prop, defaultType) { 5918 let str = new Stringifier() 5919 return str.raw(this, prop, defaultType) 5920 } 5921 5922 remove() { 5923 if (this.parent) { 5924 this.parent.removeChild(this) 5925 } 5926 this.parent = undefined 5927 return this 5928 } 5929 5930 replaceWith(...nodes) { 5931 if (this.parent) { 5932 let bookmark = this 5933 let foundSelf = false 5934 for (let node of nodes) { 5935 if (node === this) { 5936 foundSelf = true 5937 } else if (foundSelf) { 5938 this.parent.insertAfter(bookmark, node) 5939 bookmark = node 5940 } else { 5941 this.parent.insertBefore(bookmark, node) 5942 } 5943 } 5944 5945 if (!foundSelf) { 5946 this.remove() 5947 } 5948 } 5949 5950 return this 5951 } 5952 5953 root() { 5954 let result = this 5955 while (result.parent && result.parent.type !== 'document') { 5956 result = result.parent 5957 } 5958 return result 5959 } 5960 5961 toJSON(_, inputs) { 5962 let fixed = {} 5963 let emitInputs = inputs == null 5964 inputs = inputs || new Map() 5965 let inputsNextIndex = 0 5966 5967 for (let name in this) { 5968 if (!Object.prototype.hasOwnProperty.call(this, name)) { 5969 /* c8 ignore next 2 */ 5970 continue 5971 } 5972 if (name === 'parent' || name === 'proxyCache') continue 5973 let value = this[name] 5974 5975 if (Array.isArray(value)) { 5976 fixed[name] = value.map(i => { 5977 if (typeof i === 'object' && i.toJSON) { 5978 return i.toJSON(null, inputs) 5979 } else { 5980 return i 5981 } 5982 }) 5983 } else if (typeof value === 'object' && value.toJSON) { 5984 fixed[name] = value.toJSON(null, inputs) 5985 } else if (name === 'source') { 5986 let inputId = inputs.get(value.input) 5987 if (inputId == null) { 5988 inputId = inputsNextIndex 5989 inputs.set(value.input, inputsNextIndex) 5990 inputsNextIndex++ 5991 } 5992 fixed[name] = { 5993 end: value.end, 5994 inputId, 5995 start: value.start 5996 } 5997 } else { 5998 fixed[name] = value 5999 } 6000 } 6001 6002 if (emitInputs) { 6003 fixed.inputs = [...inputs.keys()].map(input => input.toJSON()) 6004 } 6005 6006 return fixed 6007 } 6008 6009 toProxy() { 6010 if (!this.proxyCache) { 6011 this.proxyCache = new Proxy(this, this.getProxyProcessor()) 6012 } 6013 return this.proxyCache 6014 } 6015 6016 toString(stringifier = stringify) { 6017 if (stringifier.stringify) stringifier = stringifier.stringify 6018 let result = '' 6019 stringifier(this, i => { 6020 result += i 6021 }) 6022 return result 6023 } 6024 6025 warn(result, text, opts) { 6026 let data = { node: this } 6027 for (let i in opts) data[i] = opts[i] 6028 return result.warn(text, data) 6029 } 6030 } 6031 6032 module.exports = Node 6033 Node.default = Node 6034 6035 6036 /***/ }), 6037 6038 /***/ 7520: 6039 /***/ ((module, __unused_webpack_exports, __webpack_require__) => { 6040 6041 module.exports = __webpack_require__(7191); 6042 6043 6044 /***/ }), 6045 6046 /***/ 7661: 6047 /***/ ((module, __unused_webpack_exports, __webpack_require__) => { 6048 6049 "use strict"; 6050 6051 6052 let MapGenerator = __webpack_require__(1670) 6053 let parse = __webpack_require__(4295) 6054 const Result = __webpack_require__(9055) 6055 let stringify = __webpack_require__(633) 6056 let warnOnce = __webpack_require__(3122) 6057 6058 class NoWorkResult { 6059 get content() { 6060 return this.result.css 6061 } 6062 6063 get css() { 6064 return this.result.css 6065 } 6066 6067 get map() { 6068 return this.result.map 6069 } 6070 6071 get messages() { 6072 return [] 6073 } 6074 6075 get opts() { 6076 return this.result.opts 6077 } 6078 6079 get processor() { 6080 return this.result.processor 6081 } 6082 6083 get root() { 6084 if (this._root) { 6085 return this._root 6086 } 6087 6088 let root 6089 let parser = parse 6090 6091 try { 6092 root = parser(this._css, this._opts) 6093 } catch (error) { 6094 this.error = error 6095 } 6096 6097 if (this.error) { 6098 throw this.error 6099 } else { 6100 this._root = root 6101 return root 6102 } 6103 } 6104 6105 get [Symbol.toStringTag]() { 6106 return 'NoWorkResult' 6107 } 6108 6109 constructor(processor, css, opts) { 6110 css = css.toString() 6111 this.stringified = false 6112 6113 this._processor = processor 6114 this._css = css 6115 this._opts = opts 6116 this._map = undefined 6117 let root 6118 6119 let str = stringify 6120 this.result = new Result(this._processor, root, this._opts) 6121 this.result.css = css 6122 6123 let self = this 6124 Object.defineProperty(this.result, 'root', { 6125 get() { 6126 return self.root 6127 } 6128 }) 6129 6130 let map = new MapGenerator(str, root, this._opts, css) 6131 if (map.isMap()) { 6132 let [generatedCSS, generatedMap] = map.generate() 6133 if (generatedCSS) { 6134 this.result.css = generatedCSS 6135 } 6136 if (generatedMap) { 6137 this.result.map = generatedMap 6138 } 6139 } else { 6140 map.clearAnnotation() 6141 this.result.css = map.css 6142 } 6143 } 6144 6145 async() { 6146 if (this.error) return Promise.reject(this.error) 6147 return Promise.resolve(this.result) 6148 } 6149 6150 catch(onRejected) { 6151 return this.async().catch(onRejected) 6152 } 6153 6154 finally(onFinally) { 6155 return this.async().then(onFinally, onFinally) 6156 } 6157 6158 sync() { 6159 if (this.error) throw this.error 6160 return this.result 6161 } 6162 6163 then(onFulfilled, onRejected) { 6164 if (false) {} 6165 6166 return this.async().then(onFulfilled, onRejected) 6167 } 6168 6169 toString() { 6170 return this._css 6171 } 6172 6173 warnings() { 6174 return [] 6175 } 6176 } 6177 6178 module.exports = NoWorkResult 6179 NoWorkResult.default = NoWorkResult 6180 6181 6182 /***/ }), 6183 6184 /***/ 7734: 6185 /***/ ((module) => { 6186 6187 "use strict"; 6188 6189 6190 // do not edit .js files directly - edit src/index.jst 6191 6192 6193 var envHasBigInt64Array = typeof BigInt64Array !== 'undefined'; 6194 6195 6196 module.exports = function equal(a, b) { 6197 if (a === b) return true; 6198 6199 if (a && b && typeof a == 'object' && typeof b == 'object') { 6200 if (a.constructor !== b.constructor) return false; 6201 6202 var length, i, keys; 6203 if (Array.isArray(a)) { 6204 length = a.length; 6205 if (length != b.length) return false; 6206 for (i = length; i-- !== 0;) 6207 if (!equal(a[i], b[i])) return false; 6208 return true; 6209 } 6210 6211 6212 if ((a instanceof Map) && (b instanceof Map)) { 6213 if (a.size !== b.size) return false; 6214 for (i of a.entries()) 6215 if (!b.has(i[0])) return false; 6216 for (i of a.entries()) 6217 if (!equal(i[1], b.get(i[0]))) return false; 6218 return true; 6219 } 6220 6221 if ((a instanceof Set) && (b instanceof Set)) { 6222 if (a.size !== b.size) return false; 6223 for (i of a.entries()) 6224 if (!b.has(i[0])) return false; 6225 return true; 6226 } 6227 6228 if (ArrayBuffer.isView(a) && ArrayBuffer.isView(b)) { 6229 length = a.length; 6230 if (length != b.length) return false; 6231 for (i = length; i-- !== 0;) 6232 if (a[i] !== b[i]) return false; 6233 return true; 6234 } 6235 6236 6237 if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags; 6238 if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf(); 6239 if (a.toString !== Object.prototype.toString) return a.toString() === b.toString(); 6240 6241 keys = Object.keys(a); 6242 length = keys.length; 6243 if (length !== Object.keys(b).length) return false; 6244 6245 for (i = length; i-- !== 0;) 6246 if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false; 6247 6248 for (i = length; i-- !== 0;) { 6249 var key = keys[i]; 6250 6251 if (!equal(a[key], b[key])) return false; 6252 } 6253 6254 return true; 6255 } 6256 6257 // true if both NaN, false otherwise 6258 return a!==a && b!==b; 6259 }; 6260 6261 6262 /***/ }), 6263 6264 /***/ 8021: 6265 /***/ ((__unused_webpack_module, exports, __webpack_require__) => { 6266 6267 "use strict"; 6268 var __webpack_unused_export__; 6269 /*istanbul ignore start*/ 6270 6271 6272 __webpack_unused_export__ = ({ 6273 value: true 6274 }); 6275 exports.JJ = diffChars; 6276 __webpack_unused_export__ = void 0; 6277 6278 /*istanbul ignore end*/ 6279 var 6280 /*istanbul ignore start*/ 6281 _base = _interopRequireDefault(__webpack_require__(5417)) 6282 /*istanbul ignore end*/ 6283 ; 6284 6285 /*istanbul ignore start*/ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 6286 6287 /*istanbul ignore end*/ 6288 var characterDiff = new 6289 /*istanbul ignore start*/ 6290 _base 6291 /*istanbul ignore end*/ 6292 . 6293 /*istanbul ignore start*/ 6294 default 6295 /*istanbul ignore end*/ 6296 (); 6297 6298 /*istanbul ignore start*/ 6299 __webpack_unused_export__ = characterDiff; 6300 6301 /*istanbul ignore end*/ 6302 function diffChars(oldStr, newStr, options) { 6303 return characterDiff.diff(oldStr, newStr, options); 6304 } 6305 6306 6307 /***/ }), 6308 6309 /***/ 8202: 6310 /***/ ((module) => { 6311 6312 "use strict"; 6313 /** 6314 * Copyright (c) 2015, Facebook, Inc. 6315 * All rights reserved. 6316 * 6317 * This source code is licensed under the BSD-style license found in the 6318 * LICENSE file in the root directory of this source tree. An additional grant 6319 * of patent rights can be found in the PATENTS file in the same directory. 6320 * 6321 * @providesModule ExecutionEnvironment 6322 */ 6323 6324 /*jslint evil: true */ 6325 6326 6327 6328 var canUseDOM = !!( 6329 typeof window !== 'undefined' && 6330 window.document && 6331 window.document.createElement 6332 ); 6333 6334 /** 6335 * Simple, lightweight module assisting with the detection and context of 6336 * Worker. Helps avoid circular dependencies and allows code to reason about 6337 * whether or not they are in a Worker, even if they never include the main 6338 * `ReactWorker` dependency. 6339 */ 6340 var ExecutionEnvironment = { 6341 6342 canUseDOM: canUseDOM, 6343 6344 canUseWorkers: typeof Worker !== 'undefined', 6345 6346 canUseEventListeners: 6347 canUseDOM && !!(window.addEventListener || window.attachEvent), 6348 6349 canUseViewport: canUseDOM && !!window.screen, 6350 6351 isInWorker: !canUseDOM // For now, this is true - might change in the future. 6352 6353 }; 6354 6355 module.exports = ExecutionEnvironment; 6356 6357 6358 /***/ }), 6359 6360 /***/ 8491: 6361 /***/ ((module) => { 6362 6363 var openParentheses = "(".charCodeAt(0); 6364 var closeParentheses = ")".charCodeAt(0); 6365 var singleQuote = "'".charCodeAt(0); 6366 var doubleQuote = '"'.charCodeAt(0); 6367 var backslash = "\\".charCodeAt(0); 6368 var slash = "/".charCodeAt(0); 6369 var comma = ",".charCodeAt(0); 6370 var colon = ":".charCodeAt(0); 6371 var star = "*".charCodeAt(0); 6372 var uLower = "u".charCodeAt(0); 6373 var uUpper = "U".charCodeAt(0); 6374 var plus = "+".charCodeAt(0); 6375 var isUnicodeRange = /^[a-f0-9?-]+$/i; 6376 6377 module.exports = function(input) { 6378 var tokens = []; 6379 var value = input; 6380 6381 var next, 6382 quote, 6383 prev, 6384 token, 6385 escape, 6386 escapePos, 6387 whitespacePos, 6388 parenthesesOpenPos; 6389 var pos = 0; 6390 var code = value.charCodeAt(pos); 6391 var max = value.length; 6392 var stack = [{ nodes: tokens }]; 6393 var balanced = 0; 6394 var parent; 6395 6396 var name = ""; 6397 var before = ""; 6398 var after = ""; 6399 6400 while (pos < max) { 6401 // Whitespaces 6402 if (code <= 32) { 6403 next = pos; 6404 do { 6405 next += 1; 6406 code = value.charCodeAt(next); 6407 } while (code <= 32); 6408 token = value.slice(pos, next); 6409 6410 prev = tokens[tokens.length - 1]; 6411 if (code === closeParentheses && balanced) { 6412 after = token; 6413 } else if (prev && prev.type === "div") { 6414 prev.after = token; 6415 prev.sourceEndIndex += token.length; 6416 } else if ( 6417 code === comma || 6418 code === colon || 6419 (code === slash && 6420 value.charCodeAt(next + 1) !== star && 6421 (!parent || 6422 (parent && parent.type === "function" && parent.value !== "calc"))) 6423 ) { 6424 before = token; 6425 } else { 6426 tokens.push({ 6427 type: "space", 6428 sourceIndex: pos, 6429 sourceEndIndex: next, 6430 value: token 6431 }); 6432 } 6433 6434 pos = next; 6435 6436 // Quotes 6437 } else if (code === singleQuote || code === doubleQuote) { 6438 next = pos; 6439 quote = code === singleQuote ? "'" : '"'; 6440 token = { 6441 type: "string", 6442 sourceIndex: pos, 6443 quote: quote 6444 }; 6445 do { 6446 escape = false; 6447 next = value.indexOf(quote, next + 1); 6448 if (~next) { 6449 escapePos = next; 6450 while (value.charCodeAt(escapePos - 1) === backslash) { 6451 escapePos -= 1; 6452 escape = !escape; 6453 } 6454 } else { 6455 value += quote; 6456 next = value.length - 1; 6457 token.unclosed = true; 6458 } 6459 } while (escape); 6460 token.value = value.slice(pos + 1, next); 6461 token.sourceEndIndex = token.unclosed ? next : next + 1; 6462 tokens.push(token); 6463 pos = next + 1; 6464 code = value.charCodeAt(pos); 6465 6466 // Comments 6467 } else if (code === slash && value.charCodeAt(pos + 1) === star) { 6468 next = value.indexOf("*/", pos); 6469 6470 token = { 6471 type: "comment", 6472 sourceIndex: pos, 6473 sourceEndIndex: next + 2 6474 }; 6475 6476 if (next === -1) { 6477 token.unclosed = true; 6478 next = value.length; 6479 token.sourceEndIndex = next; 6480 } 6481 6482 token.value = value.slice(pos + 2, next); 6483 tokens.push(token); 6484 6485 pos = next + 2; 6486 code = value.charCodeAt(pos); 6487 6488 // Operation within calc 6489 } else if ( 6490 (code === slash || code === star) && 6491 parent && 6492 parent.type === "function" && 6493 parent.value === "calc" 6494 ) { 6495 token = value[pos]; 6496 tokens.push({ 6497 type: "word", 6498 sourceIndex: pos - before.length, 6499 sourceEndIndex: pos + token.length, 6500 value: token 6501 }); 6502 pos += 1; 6503 code = value.charCodeAt(pos); 6504 6505 // Dividers 6506 } else if (code === slash || code === comma || code === colon) { 6507 token = value[pos]; 6508 6509 tokens.push({ 6510 type: "div", 6511 sourceIndex: pos - before.length, 6512 sourceEndIndex: pos + token.length, 6513 value: token, 6514 before: before, 6515 after: "" 6516 }); 6517 before = ""; 6518 6519 pos += 1; 6520 code = value.charCodeAt(pos); 6521 6522 // Open parentheses 6523 } else if (openParentheses === code) { 6524 // Whitespaces after open parentheses 6525 next = pos; 6526 do { 6527 next += 1; 6528 code = value.charCodeAt(next); 6529 } while (code <= 32); 6530 parenthesesOpenPos = pos; 6531 token = { 6532 type: "function", 6533 sourceIndex: pos - name.length, 6534 value: name, 6535 before: value.slice(parenthesesOpenPos + 1, next) 6536 }; 6537 pos = next; 6538 6539 if (name === "url" && code !== singleQuote && code !== doubleQuote) { 6540 next -= 1; 6541 do { 6542 escape = false; 6543 next = value.indexOf(")", next + 1); 6544 if (~next) { 6545 escapePos = next; 6546 while (value.charCodeAt(escapePos - 1) === backslash) { 6547 escapePos -= 1; 6548 escape = !escape; 6549 } 6550 } else { 6551 value += ")"; 6552 next = value.length - 1; 6553 token.unclosed = true; 6554 } 6555 } while (escape); 6556 // Whitespaces before closed 6557 whitespacePos = next; 6558 do { 6559 whitespacePos -= 1; 6560 code = value.charCodeAt(whitespacePos); 6561 } while (code <= 32); 6562 if (parenthesesOpenPos < whitespacePos) { 6563 if (pos !== whitespacePos + 1) { 6564 token.nodes = [ 6565 { 6566 type: "word", 6567 sourceIndex: pos, 6568 sourceEndIndex: whitespacePos + 1, 6569 value: value.slice(pos, whitespacePos + 1) 6570 } 6571 ]; 6572 } else { 6573 token.nodes = []; 6574 } 6575 if (token.unclosed && whitespacePos + 1 !== next) { 6576 token.after = ""; 6577 token.nodes.push({ 6578 type: "space", 6579 sourceIndex: whitespacePos + 1, 6580 sourceEndIndex: next, 6581 value: value.slice(whitespacePos + 1, next) 6582 }); 6583 } else { 6584 token.after = value.slice(whitespacePos + 1, next); 6585 token.sourceEndIndex = next; 6586 } 6587 } else { 6588 token.after = ""; 6589 token.nodes = []; 6590 } 6591 pos = next + 1; 6592 token.sourceEndIndex = token.unclosed ? next : pos; 6593 code = value.charCodeAt(pos); 6594 tokens.push(token); 6595 } else { 6596 balanced += 1; 6597 token.after = ""; 6598 token.sourceEndIndex = pos + 1; 6599 tokens.push(token); 6600 stack.push(token); 6601 tokens = token.nodes = []; 6602 parent = token; 6603 } 6604 name = ""; 6605 6606 // Close parentheses 6607 } else if (closeParentheses === code && balanced) { 6608 pos += 1; 6609 code = value.charCodeAt(pos); 6610 6611 parent.after = after; 6612 parent.sourceEndIndex += after.length; 6613 after = ""; 6614 balanced -= 1; 6615 stack[stack.length - 1].sourceEndIndex = pos; 6616 stack.pop(); 6617 parent = stack[balanced]; 6618 tokens = parent.nodes; 6619 6620 // Words 6621 } else { 6622 next = pos; 6623 do { 6624 if (code === backslash) { 6625 next += 1; 6626 } 6627 next += 1; 6628 code = value.charCodeAt(next); 6629 } while ( 6630 next < max && 6631 !( 6632 code <= 32 || 6633 code === singleQuote || 6634 code === doubleQuote || 6635 code === comma || 6636 code === colon || 6637 code === slash || 6638 code === openParentheses || 6639 (code === star && 6640 parent && 6641 parent.type === "function" && 6642 parent.value === "calc") || 6643 (code === slash && 6644 parent.type === "function" && 6645 parent.value === "calc") || 6646 (code === closeParentheses && balanced) 6647 ) 6648 ); 6649 token = value.slice(pos, next); 6650 6651 if (openParentheses === code) { 6652 name = token; 6653 } else if ( 6654 (uLower === token.charCodeAt(0) || uUpper === token.charCodeAt(0)) && 6655 plus === token.charCodeAt(1) && 6656 isUnicodeRange.test(token.slice(2)) 6657 ) { 6658 tokens.push({ 6659 type: "unicode-range", 6660 sourceIndex: pos, 6661 sourceEndIndex: next, 6662 value: token 6663 }); 6664 } else { 6665 tokens.push({ 6666 type: "word", 6667 sourceIndex: pos, 6668 sourceEndIndex: next, 6669 value: token 6670 }); 6671 } 6672 6673 pos = next; 6674 } 6675 } 6676 6677 for (pos = stack.length - 1; pos; pos -= 1) { 6678 stack[pos].unclosed = true; 6679 stack[pos].sourceEndIndex = value.length; 6680 } 6681 6682 return stack[0].nodes; 6683 }; 6684 6685 6686 /***/ }), 6687 6688 /***/ 9055: 6689 /***/ ((module, __unused_webpack_exports, __webpack_require__) => { 6690 6691 "use strict"; 6692 6693 6694 let Warning = __webpack_require__(5776) 6695 6696 class Result { 6697 get content() { 6698 return this.css 6699 } 6700 6701 constructor(processor, root, opts) { 6702 this.processor = processor 6703 this.messages = [] 6704 this.root = root 6705 this.opts = opts 6706 this.css = undefined 6707 this.map = undefined 6708 } 6709 6710 toString() { 6711 return this.css 6712 } 6713 6714 warn(text, opts = {}) { 6715 if (!opts.plugin) { 6716 if (this.lastPlugin && this.lastPlugin.postcssPlugin) { 6717 opts.plugin = this.lastPlugin.postcssPlugin 6718 } 6719 } 6720 6721 let warning = new Warning(text, opts) 6722 this.messages.push(warning) 6723 6724 return warning 6725 } 6726 6727 warnings() { 6728 return this.messages.filter(i => i.type === 'warning') 6729 } 6730 } 6731 6732 module.exports = Result 6733 Result.default = Result 6734 6735 6736 /***/ }), 6737 6738 /***/ 9434: 6739 /***/ ((module, __unused_webpack_exports, __webpack_require__) => { 6740 6741 "use strict"; 6742 6743 6744 let Container = __webpack_require__(683) 6745 6746 let LazyResult, Processor 6747 6748 class Root extends Container { 6749 constructor(defaults) { 6750 super(defaults) 6751 this.type = 'root' 6752 if (!this.nodes) this.nodes = [] 6753 } 6754 6755 normalize(child, sample, type) { 6756 let nodes = super.normalize(child) 6757 6758 if (sample) { 6759 if (type === 'prepend') { 6760 if (this.nodes.length > 1) { 6761 sample.raws.before = this.nodes[1].raws.before 6762 } else { 6763 delete sample.raws.before 6764 } 6765 } else if (this.first !== sample) { 6766 for (let node of nodes) { 6767 node.raws.before = sample.raws.before 6768 } 6769 } 6770 } 6771 6772 return nodes 6773 } 6774 6775 removeChild(child, ignore) { 6776 let index = this.index(child) 6777 6778 if (!ignore && index === 0 && this.nodes.length > 1) { 6779 this.nodes[1].raws.before = this.nodes[index].raws.before 6780 } 6781 6782 return super.removeChild(child) 6783 } 6784 6785 toResult(opts = {}) { 6786 let lazy = new LazyResult(new Processor(), this, opts) 6787 return lazy.stringify() 6788 } 6789 } 6790 6791 Root.registerLazyResult = dependant => { 6792 LazyResult = dependant 6793 } 6794 6795 Root.registerProcessor = dependant => { 6796 Processor = dependant 6797 } 6798 6799 module.exports = Root 6800 Root.default = Root 6801 6802 Container.registerRoot(Root) 6803 6804 6805 /***/ }), 6806 6807 /***/ 9656: 6808 /***/ ((module, __unused_webpack_exports, __webpack_require__) => { 6809 6810 "use strict"; 6811 6812 6813 let Document = __webpack_require__(271) 6814 let LazyResult = __webpack_require__(448) 6815 let NoWorkResult = __webpack_require__(7661) 6816 let Root = __webpack_require__(9434) 6817 6818 class Processor { 6819 constructor(plugins = []) { 6820 this.version = '8.5.3' 6821 this.plugins = this.normalize(plugins) 6822 } 6823 6824 normalize(plugins) { 6825 let normalized = [] 6826 for (let i of plugins) { 6827 if (i.postcss === true) { 6828 i = i() 6829 } else if (i.postcss) { 6830 i = i.postcss 6831 } 6832 6833 if (typeof i === 'object' && Array.isArray(i.plugins)) { 6834 normalized = normalized.concat(i.plugins) 6835 } else if (typeof i === 'object' && i.postcssPlugin) { 6836 normalized.push(i) 6837 } else if (typeof i === 'function') { 6838 normalized.push(i) 6839 } else if (typeof i === 'object' && (i.parse || i.stringify)) { 6840 if (false) {} 6841 } else { 6842 throw new Error(i + ' is not a PostCSS plugin') 6843 } 6844 } 6845 return normalized 6846 } 6847 6848 process(css, opts = {}) { 6849 if ( 6850 !this.plugins.length && 6851 !opts.parser && 6852 !opts.stringifier && 6853 !opts.syntax 6854 ) { 6855 return new NoWorkResult(this, css, opts) 6856 } else { 6857 return new LazyResult(this, css, opts) 6858 } 6859 } 6860 6861 use(plugin) { 6862 this.plugins = this.plugins.concat(this.normalize([plugin])) 6863 return this 6864 } 6865 } 6866 6867 module.exports = Processor 6868 Processor.default = Processor 6869 6870 Root.registerProcessor(Processor) 6871 Document.registerProcessor(Processor) 6872 6873 6874 /***/ }), 6875 6876 /***/ 9681: 6877 /***/ ((module) => { 6878 6879 var characterMap = { 6880 "À": "A", 6881 "Á": "A", 6882 "Â": "A", 6883 "Ã": "A", 6884 "Ä": "A", 6885 "Å": "A", 6886 "Ấ": "A", 6887 "Ắ": "A", 6888 "Ẳ": "A", 6889 "Ẵ": "A", 6890 "Ặ": "A", 6891 "Æ": "AE", 6892 "Ầ": "A", 6893 "Ằ": "A", 6894 "Ȃ": "A", 6895 "Ả": "A", 6896 "Ạ": "A", 6897 "Ẩ": "A", 6898 "Ẫ": "A", 6899 "Ậ": "A", 6900 "Ç": "C", 6901 "Ḉ": "C", 6902 "È": "E", 6903 "É": "E", 6904 "Ê": "E", 6905 "Ë": "E", 6906 "Ế": "E", 6907 "Ḗ": "E", 6908 "Ề": "E", 6909 "Ḕ": "E", 6910 "Ḝ": "E", 6911 "Ȇ": "E", 6912 "Ẻ": "E", 6913 "Ẽ": "E", 6914 "Ẹ": "E", 6915 "Ể": "E", 6916 "Ễ": "E", 6917 "Ệ": "E", 6918 "Ì": "I", 6919 "Í": "I", 6920 "Î": "I", 6921 "Ï": "I", 6922 "Ḯ": "I", 6923 "Ȋ": "I", 6924 "Ỉ": "I", 6925 "Ị": "I", 6926 "Ð": "D", 6927 "Ñ": "N", 6928 "Ò": "O", 6929 "Ó": "O", 6930 "Ô": "O", 6931 "Õ": "O", 6932 "Ö": "O", 6933 "Ø": "O", 6934 "Ố": "O", 6935 "Ṍ": "O", 6936 "Ṓ": "O", 6937 "Ȏ": "O", 6938 "Ỏ": "O", 6939 "Ọ": "O", 6940 "Ổ": "O", 6941 "Ỗ": "O", 6942 "Ộ": "O", 6943 "Ờ": "O", 6944 "Ở": "O", 6945 "Ỡ": "O", 6946 "Ớ": "O", 6947 "Ợ": "O", 6948 "Ù": "U", 6949 "Ú": "U", 6950 "Û": "U", 6951 "Ü": "U", 6952 "Ủ": "U", 6953 "Ụ": "U", 6954 "Ử": "U", 6955 "Ữ": "U", 6956 "Ự": "U", 6957 "Ý": "Y", 6958 "à": "a", 6959 "á": "a", 6960 "â": "a", 6961 "ã": "a", 6962 "ä": "a", 6963 "å": "a", 6964 "ấ": "a", 6965 "ắ": "a", 6966 "ẳ": "a", 6967 "ẵ": "a", 6968 "ặ": "a", 6969 "æ": "ae", 6970 "ầ": "a", 6971 "ằ": "a", 6972 "ȃ": "a", 6973 "ả": "a", 6974 "ạ": "a", 6975 "ẩ": "a", 6976 "ẫ": "a", 6977 "ậ": "a", 6978 "ç": "c", 6979 "ḉ": "c", 6980 "è": "e", 6981 "é": "e", 6982 "ê": "e", 6983 "ë": "e", 6984 "ế": "e", 6985 "ḗ": "e", 6986 "ề": "e", 6987 "ḕ": "e", 6988 "ḝ": "e", 6989 "ȇ": "e", 6990 "ẻ": "e", 6991 "ẽ": "e", 6992 "ẹ": "e", 6993 "ể": "e", 6994 "ễ": "e", 6995 "ệ": "e", 6996 "ì": "i", 6997 "í": "i", 6998 "î": "i", 6999 "ï": "i", 7000 "ḯ": "i", 7001 "ȋ": "i", 7002 "ỉ": "i", 7003 "ị": "i", 7004 "ð": "d", 7005 "ñ": "n", 7006 "ò": "o", 7007 "ó": "o", 7008 "ô": "o", 7009 "õ": "o", 7010 "ö": "o", 7011 "ø": "o", 7012 "ố": "o", 7013 "ṍ": "o", 7014 "ṓ": "o", 7015 "ȏ": "o", 7016 "ỏ": "o", 7017 "ọ": "o", 7018 "ổ": "o", 7019 "ỗ": "o", 7020 "ộ": "o", 7021 "ờ": "o", 7022 "ở": "o", 7023 "ỡ": "o", 7024 "ớ": "o", 7025 "ợ": "o", 7026 "ù": "u", 7027 "ú": "u", 7028 "û": "u", 7029 "ü": "u", 7030 "ủ": "u", 7031 "ụ": "u", 7032 "ử": "u", 7033 "ữ": "u", 7034 "ự": "u", 7035 "ý": "y", 7036 "ÿ": "y", 7037 "Ā": "A", 7038 "ā": "a", 7039 "Ă": "A", 7040 "ă": "a", 7041 "Ą": "A", 7042 "ą": "a", 7043 "Ć": "C", 7044 "ć": "c", 7045 "Ĉ": "C", 7046 "ĉ": "c", 7047 "Ċ": "C", 7048 "ċ": "c", 7049 "Č": "C", 7050 "č": "c", 7051 "C̆": "C", 7052 "c̆": "c", 7053 "Ď": "D", 7054 "ď": "d", 7055 "Đ": "D", 7056 "đ": "d", 7057 "Ē": "E", 7058 "ē": "e", 7059 "Ĕ": "E", 7060 "ĕ": "e", 7061 "Ė": "E", 7062 "ė": "e", 7063 "Ę": "E", 7064 "ę": "e", 7065 "Ě": "E", 7066 "ě": "e", 7067 "Ĝ": "G", 7068 "Ǵ": "G", 7069 "ĝ": "g", 7070 "ǵ": "g", 7071 "Ğ": "G", 7072 "ğ": "g", 7073 "Ġ": "G", 7074 "ġ": "g", 7075 "Ģ": "G", 7076 "ģ": "g", 7077 "Ĥ": "H", 7078 "ĥ": "h", 7079 "Ħ": "H", 7080 "ħ": "h", 7081 "Ḫ": "H", 7082 "ḫ": "h", 7083 "Ĩ": "I", 7084 "ĩ": "i", 7085 "Ī": "I", 7086 "ī": "i", 7087 "Ĭ": "I", 7088 "ĭ": "i", 7089 "Į": "I", 7090 "į": "i", 7091 "İ": "I", 7092 "ı": "i", 7093 "IJ": "IJ", 7094 "ij": "ij", 7095 "Ĵ": "J", 7096 "ĵ": "j", 7097 "Ķ": "K", 7098 "ķ": "k", 7099 "Ḱ": "K", 7100 "ḱ": "k", 7101 "K̆": "K", 7102 "k̆": "k", 7103 "Ĺ": "L", 7104 "ĺ": "l", 7105 "Ļ": "L", 7106 "ļ": "l", 7107 "Ľ": "L", 7108 "ľ": "l", 7109 "Ŀ": "L", 7110 "ŀ": "l", 7111 "Ł": "l", 7112 "ł": "l", 7113 "Ḿ": "M", 7114 "ḿ": "m", 7115 "M̆": "M", 7116 "m̆": "m", 7117 "Ń": "N", 7118 "ń": "n", 7119 "Ņ": "N", 7120 "ņ": "n", 7121 "Ň": "N", 7122 "ň": "n", 7123 "ʼn": "n", 7124 "N̆": "N", 7125 "n̆": "n", 7126 "Ō": "O", 7127 "ō": "o", 7128 "Ŏ": "O", 7129 "ŏ": "o", 7130 "Ő": "O", 7131 "ő": "o", 7132 "Œ": "OE", 7133 "œ": "oe", 7134 "P̆": "P", 7135 "p̆": "p", 7136 "Ŕ": "R", 7137 "ŕ": "r", 7138 "Ŗ": "R", 7139 "ŗ": "r", 7140 "Ř": "R", 7141 "ř": "r", 7142 "R̆": "R", 7143 "r̆": "r", 7144 "Ȓ": "R", 7145 "ȓ": "r", 7146 "Ś": "S", 7147 "ś": "s", 7148 "Ŝ": "S", 7149 "ŝ": "s", 7150 "Ş": "S", 7151 "Ș": "S", 7152 "ș": "s", 7153 "ş": "s", 7154 "Š": "S", 7155 "š": "s", 7156 "Ţ": "T", 7157 "ţ": "t", 7158 "ț": "t", 7159 "Ț": "T", 7160 "Ť": "T", 7161 "ť": "t", 7162 "Ŧ": "T", 7163 "ŧ": "t", 7164 "T̆": "T", 7165 "t̆": "t", 7166 "Ũ": "U", 7167 "ũ": "u", 7168 "Ū": "U", 7169 "ū": "u", 7170 "Ŭ": "U", 7171 "ŭ": "u", 7172 "Ů": "U", 7173 "ů": "u", 7174 "Ű": "U", 7175 "ű": "u", 7176 "Ų": "U", 7177 "ų": "u", 7178 "Ȗ": "U", 7179 "ȗ": "u", 7180 "V̆": "V", 7181 "v̆": "v", 7182 "Ŵ": "W", 7183 "ŵ": "w", 7184 "Ẃ": "W", 7185 "ẃ": "w", 7186 "X̆": "X", 7187 "x̆": "x", 7188 "Ŷ": "Y", 7189 "ŷ": "y", 7190 "Ÿ": "Y", 7191 "Y̆": "Y", 7192 "y̆": "y", 7193 "Ź": "Z", 7194 "ź": "z", 7195 "Ż": "Z", 7196 "ż": "z", 7197 "Ž": "Z", 7198 "ž": "z", 7199 "ſ": "s", 7200 "ƒ": "f", 7201 "Ơ": "O", 7202 "ơ": "o", 7203 "Ư": "U", 7204 "ư": "u", 7205 "Ǎ": "A", 7206 "ǎ": "a", 7207 "Ǐ": "I", 7208 "ǐ": "i", 7209 "Ǒ": "O", 7210 "ǒ": "o", 7211 "Ǔ": "U", 7212 "ǔ": "u", 7213 "Ǖ": "U", 7214 "ǖ": "u", 7215 "Ǘ": "U", 7216 "ǘ": "u", 7217 "Ǚ": "U", 7218 "ǚ": "u", 7219 "Ǜ": "U", 7220 "ǜ": "u", 7221 "Ứ": "U", 7222 "ứ": "u", 7223 "Ṹ": "U", 7224 "ṹ": "u", 7225 "Ǻ": "A", 7226 "ǻ": "a", 7227 "Ǽ": "AE", 7228 "ǽ": "ae", 7229 "Ǿ": "O", 7230 "ǿ": "o", 7231 "Þ": "TH", 7232 "þ": "th", 7233 "Ṕ": "P", 7234 "ṕ": "p", 7235 "Ṥ": "S", 7236 "ṥ": "s", 7237 "X́": "X", 7238 "x́": "x", 7239 "Ѓ": "Г", 7240 "ѓ": "г", 7241 "Ќ": "К", 7242 "ќ": "к", 7243 "A̋": "A", 7244 "a̋": "a", 7245 "E̋": "E", 7246 "e̋": "e", 7247 "I̋": "I", 7248 "i̋": "i", 7249 "Ǹ": "N", 7250 "ǹ": "n", 7251 "Ồ": "O", 7252 "ồ": "o", 7253 "Ṑ": "O", 7254 "ṑ": "o", 7255 "Ừ": "U", 7256 "ừ": "u", 7257 "Ẁ": "W", 7258 "ẁ": "w", 7259 "Ỳ": "Y", 7260 "ỳ": "y", 7261 "Ȁ": "A", 7262 "ȁ": "a", 7263 "Ȅ": "E", 7264 "ȅ": "e", 7265 "Ȉ": "I", 7266 "ȉ": "i", 7267 "Ȍ": "O", 7268 "ȍ": "o", 7269 "Ȑ": "R", 7270 "ȑ": "r", 7271 "Ȕ": "U", 7272 "ȕ": "u", 7273 "B̌": "B", 7274 "b̌": "b", 7275 "Č̣": "C", 7276 "č̣": "c", 7277 "Ê̌": "E", 7278 "ê̌": "e", 7279 "F̌": "F", 7280 "f̌": "f", 7281 "Ǧ": "G", 7282 "ǧ": "g", 7283 "Ȟ": "H", 7284 "ȟ": "h", 7285 "J̌": "J", 7286 "ǰ": "j", 7287 "Ǩ": "K", 7288 "ǩ": "k", 7289 "M̌": "M", 7290 "m̌": "m", 7291 "P̌": "P", 7292 "p̌": "p", 7293 "Q̌": "Q", 7294 "q̌": "q", 7295 "Ř̩": "R", 7296 "ř̩": "r", 7297 "Ṧ": "S", 7298 "ṧ": "s", 7299 "V̌": "V", 7300 "v̌": "v", 7301 "W̌": "W", 7302 "w̌": "w", 7303 "X̌": "X", 7304 "x̌": "x", 7305 "Y̌": "Y", 7306 "y̌": "y", 7307 "A̧": "A", 7308 "a̧": "a", 7309 "B̧": "B", 7310 "b̧": "b", 7311 "Ḑ": "D", 7312 "ḑ": "d", 7313 "Ȩ": "E", 7314 "ȩ": "e", 7315 "Ɛ̧": "E", 7316 "ɛ̧": "e", 7317 "Ḩ": "H", 7318 "ḩ": "h", 7319 "I̧": "I", 7320 "i̧": "i", 7321 "Ɨ̧": "I", 7322 "ɨ̧": "i", 7323 "M̧": "M", 7324 "m̧": "m", 7325 "O̧": "O", 7326 "o̧": "o", 7327 "Q̧": "Q", 7328 "q̧": "q", 7329 "U̧": "U", 7330 "u̧": "u", 7331 "X̧": "X", 7332 "x̧": "x", 7333 "Z̧": "Z", 7334 "z̧": "z", 7335 "й":"и", 7336 "Й":"И", 7337 "ё":"е", 7338 "Ё":"Е", 7339 }; 7340 7341 var chars = Object.keys(characterMap).join('|'); 7342 var allAccents = new RegExp(chars, 'g'); 7343 var firstAccent = new RegExp(chars, ''); 7344 7345 function matcher(match) { 7346 return characterMap[match]; 7347 } 7348 7349 var removeAccents = function(string) { 7350 return string.replace(allAccents, matcher); 7351 }; 7352 7353 var hasAccents = function(string) { 7354 return !!string.match(firstAccent); 7355 }; 7356 7357 module.exports = removeAccents; 7358 module.exports.has = hasAccents; 7359 module.exports.remove = removeAccents; 7360 7361 7362 /***/ }), 7363 7364 /***/ 9746: 7365 /***/ (() => { 7366 7367 /* (ignored) */ 7368 7369 /***/ }), 7370 7371 /***/ 9977: 7372 /***/ (() => { 7373 7374 /* (ignored) */ 7375 7376 /***/ }) 7377 7378 /******/ }); 7379 /************************************************************************/ 7380 /******/ // The module cache 7381 /******/ var __webpack_module_cache__ = {}; 7382 /******/ 7383 /******/ // The require function 7384 /******/ function __webpack_require__(moduleId) { 7385 /******/ // Check if module is in cache 7386 /******/ var cachedModule = __webpack_module_cache__[moduleId]; 7387 /******/ if (cachedModule !== undefined) { 7388 /******/ return cachedModule.exports; 7389 /******/ } 7390 /******/ // Create a new module (and put it into the cache) 7391 /******/ var module = __webpack_module_cache__[moduleId] = { 7392 /******/ // no module.id needed 7393 /******/ // no module.loaded needed 7394 /******/ exports: {} 7395 /******/ }; 7396 /******/ 7397 /******/ // Execute the module function 7398 /******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__); 7399 /******/ 7400 /******/ // Return the exports of the module 7401 /******/ return module.exports; 7402 /******/ } 7403 /******/ 7404 /************************************************************************/ 7405 /******/ /* webpack/runtime/compat get default export */ 7406 /******/ (() => { 7407 /******/ // getDefaultExport function for compatibility with non-harmony modules 7408 /******/ __webpack_require__.n = (module) => { 7409 /******/ var getter = module && module.__esModule ? 7410 /******/ () => (module['default']) : 7411 /******/ () => (module); 7412 /******/ __webpack_require__.d(getter, { a: getter }); 7413 /******/ return getter; 7414 /******/ }; 7415 /******/ })(); 7416 /******/ 7417 /******/ /* webpack/runtime/define property getters */ 7418 /******/ (() => { 7419 /******/ // define getter functions for harmony exports 7420 /******/ __webpack_require__.d = (exports, definition) => { 7421 /******/ for(var key in definition) { 7422 /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { 7423 /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); 7424 /******/ } 7425 /******/ } 7426 /******/ }; 7427 /******/ })(); 7428 /******/ 7429 /******/ /* webpack/runtime/hasOwnProperty shorthand */ 7430 /******/ (() => { 7431 /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) 7432 /******/ })(); 7433 /******/ 7434 /******/ /* webpack/runtime/make namespace object */ 7435 /******/ (() => { 7436 /******/ // define __esModule on exports 7437 /******/ __webpack_require__.r = (exports) => { 7438 /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { 7439 /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); 7440 /******/ } 7441 /******/ Object.defineProperty(exports, '__esModule', { value: true }); 7442 /******/ }; 7443 /******/ })(); 7444 /******/ 7445 /************************************************************************/ 7446 var __webpack_exports__ = {}; 7447 // This entry needs to be wrapped in an IIFE because it needs to be in strict mode. 7448 (() => { 7449 "use strict"; 7450 // ESM COMPAT FLAG 7451 __webpack_require__.r(__webpack_exports__); 7452 7453 // EXPORTS 7454 __webpack_require__.d(__webpack_exports__, { 7455 AlignmentControl: () => (/* reexport */ AlignmentControl), 7456 AlignmentToolbar: () => (/* reexport */ AlignmentToolbar), 7457 Autocomplete: () => (/* reexport */ autocomplete_default), 7458 BlockAlignmentControl: () => (/* reexport */ BlockAlignmentControl), 7459 BlockAlignmentToolbar: () => (/* reexport */ BlockAlignmentToolbar), 7460 BlockBreadcrumb: () => (/* reexport */ block_breadcrumb_default), 7461 BlockCanvas: () => (/* reexport */ block_canvas_default), 7462 BlockColorsStyleSelector: () => (/* reexport */ color_style_selector_default), 7463 BlockContextProvider: () => (/* reexport */ BlockContextProvider), 7464 BlockControls: () => (/* reexport */ block_controls_default), 7465 BlockEdit: () => (/* reexport */ BlockEdit), 7466 BlockEditorKeyboardShortcuts: () => (/* reexport */ keyboard_shortcuts_default), 7467 BlockEditorProvider: () => (/* reexport */ provider_provider_default), 7468 BlockFormatControls: () => (/* reexport */ BlockFormatControls), 7469 BlockIcon: () => (/* reexport */ block_icon_default), 7470 BlockInspector: () => (/* reexport */ block_inspector_default), 7471 BlockList: () => (/* reexport */ BlockList), 7472 BlockMover: () => (/* reexport */ block_mover_default), 7473 BlockNavigationDropdown: () => (/* reexport */ dropdown_default), 7474 BlockPopover: () => (/* reexport */ block_popover_default), 7475 BlockPreview: () => (/* reexport */ block_preview_default), 7476 BlockSelectionClearer: () => (/* reexport */ BlockSelectionClearer), 7477 BlockSettingsMenu: () => (/* reexport */ block_settings_menu_default), 7478 BlockSettingsMenuControls: () => (/* reexport */ block_settings_menu_controls_default), 7479 BlockStyles: () => (/* reexport */ block_styles_default), 7480 BlockTitle: () => (/* reexport */ BlockTitle), 7481 BlockToolbar: () => (/* reexport */ BlockToolbar), 7482 BlockTools: () => (/* reexport */ BlockTools), 7483 BlockVerticalAlignmentControl: () => (/* reexport */ BlockVerticalAlignmentControl), 7484 BlockVerticalAlignmentToolbar: () => (/* reexport */ BlockVerticalAlignmentToolbar), 7485 ButtonBlockAppender: () => (/* reexport */ button_block_appender_default), 7486 ButtonBlockerAppender: () => (/* reexport */ ButtonBlockerAppender), 7487 ColorPalette: () => (/* reexport */ color_palette_default), 7488 ColorPaletteControl: () => (/* reexport */ ColorPaletteControl), 7489 ContrastChecker: () => (/* reexport */ contrast_checker_default), 7490 CopyHandler: () => (/* reexport */ CopyHandler), 7491 DefaultBlockAppender: () => (/* reexport */ DefaultBlockAppender), 7492 FontSizePicker: () => (/* reexport */ font_size_picker_default), 7493 HeadingLevelDropdown: () => (/* reexport */ HeadingLevelDropdown), 7494 HeightControl: () => (/* reexport */ HeightControl), 7495 InnerBlocks: () => (/* reexport */ inner_blocks_default), 7496 Inserter: () => (/* reexport */ inserter_default), 7497 InspectorAdvancedControls: () => (/* reexport */ InspectorAdvancedControls), 7498 InspectorControls: () => (/* reexport */ inspector_controls_default), 7499 JustifyContentControl: () => (/* reexport */ JustifyContentControl), 7500 JustifyToolbar: () => (/* reexport */ JustifyToolbar), 7501 LineHeightControl: () => (/* reexport */ line_height_control_default), 7502 LinkControl: () => (/* reexport */ link_control_default), 7503 MediaPlaceholder: () => (/* reexport */ media_placeholder_default), 7504 MediaReplaceFlow: () => (/* reexport */ media_replace_flow_default), 7505 MediaUpload: () => (/* reexport */ media_upload_default), 7506 MediaUploadCheck: () => (/* reexport */ check_default), 7507 MultiSelectScrollIntoView: () => (/* reexport */ MultiSelectScrollIntoView), 7508 NavigableToolbar: () => (/* reexport */ NavigableToolbar), 7509 ObserveTyping: () => (/* reexport */ observe_typing_default), 7510 PanelColorSettings: () => (/* reexport */ panel_color_settings_default), 7511 PlainText: () => (/* reexport */ plain_text_default), 7512 RecursionProvider: () => (/* reexport */ RecursionProvider), 7513 RichText: () => (/* reexport */ rich_text_default), 7514 RichTextShortcut: () => (/* reexport */ RichTextShortcut), 7515 RichTextToolbarButton: () => (/* reexport */ RichTextToolbarButton), 7516 SETTINGS_DEFAULTS: () => (/* reexport */ SETTINGS_DEFAULTS), 7517 SkipToSelectedBlock: () => (/* reexport */ SkipToSelectedBlock), 7518 Typewriter: () => (/* reexport */ typewriter_default), 7519 URLInput: () => (/* reexport */ url_input_default), 7520 URLInputButton: () => (/* reexport */ button_default), 7521 URLPopover: () => (/* reexport */ url_popover_default), 7522 Warning: () => (/* reexport */ warning_default), 7523 WritingFlow: () => (/* reexport */ writing_flow_default), 7524 __experimentalBlockAlignmentMatrixControl: () => (/* reexport */ block_alignment_matrix_control_default), 7525 __experimentalBlockFullHeightAligmentControl: () => (/* reexport */ block_full_height_alignment_control_default), 7526 __experimentalBlockPatternSetup: () => (/* reexport */ block_pattern_setup_default), 7527 __experimentalBlockPatternsList: () => (/* reexport */ block_patterns_list_default), 7528 __experimentalBlockVariationPicker: () => (/* reexport */ block_variation_picker_default), 7529 __experimentalBlockVariationTransforms: () => (/* reexport */ block_variation_transforms_default), 7530 __experimentalBorderRadiusControl: () => (/* reexport */ BorderRadiusControl), 7531 __experimentalColorGradientControl: () => (/* reexport */ control_default), 7532 __experimentalColorGradientSettingsDropdown: () => (/* reexport */ ColorGradientSettingsDropdown), 7533 __experimentalDateFormatPicker: () => (/* reexport */ DateFormatPicker), 7534 __experimentalDuotoneControl: () => (/* reexport */ duotone_control_default), 7535 __experimentalFontAppearanceControl: () => (/* reexport */ FontAppearanceControl), 7536 __experimentalFontFamilyControl: () => (/* reexport */ FontFamilyControl), 7537 __experimentalGetBorderClassesAndStyles: () => (/* reexport */ getBorderClassesAndStyles), 7538 __experimentalGetColorClassesAndStyles: () => (/* reexport */ getColorClassesAndStyles), 7539 __experimentalGetElementClassName: () => (/* reexport */ __experimentalGetElementClassName), 7540 __experimentalGetGapCSSValue: () => (/* reexport */ getGapCSSValue), 7541 __experimentalGetGradientClass: () => (/* reexport */ __experimentalGetGradientClass), 7542 __experimentalGetGradientObjectByGradientValue: () => (/* reexport */ __experimentalGetGradientObjectByGradientValue), 7543 __experimentalGetShadowClassesAndStyles: () => (/* reexport */ getShadowClassesAndStyles), 7544 __experimentalGetSpacingClassesAndStyles: () => (/* reexport */ getSpacingClassesAndStyles), 7545 __experimentalImageEditor: () => (/* reexport */ ImageEditor), 7546 __experimentalImageSizeControl: () => (/* reexport */ ImageSizeControl), 7547 __experimentalImageURLInputUI: () => (/* reexport */ ImageURLInputUI), 7548 __experimentalInspectorPopoverHeader: () => (/* reexport */ InspectorPopoverHeader), 7549 __experimentalLetterSpacingControl: () => (/* reexport */ LetterSpacingControl), 7550 __experimentalLibrary: () => (/* reexport */ library_default), 7551 __experimentalLinkControl: () => (/* reexport */ DeprecatedExperimentalLinkControl), 7552 __experimentalLinkControlSearchInput: () => (/* reexport */ __experimentalLinkControlSearchInput), 7553 __experimentalLinkControlSearchItem: () => (/* reexport */ __experimentalLinkControlSearchItem), 7554 __experimentalLinkControlSearchResults: () => (/* reexport */ __experimentalLinkControlSearchResults), 7555 __experimentalListView: () => (/* reexport */ list_view_list_view_default), 7556 __experimentalPanelColorGradientSettings: () => (/* reexport */ panel_color_gradient_settings_default), 7557 __experimentalPreviewOptions: () => (/* reexport */ PreviewOptions), 7558 __experimentalPublishDateTimePicker: () => (/* reexport */ publish_date_time_picker_default), 7559 __experimentalRecursionProvider: () => (/* reexport */ DeprecatedExperimentalRecursionProvider), 7560 __experimentalResponsiveBlockControl: () => (/* reexport */ responsive_block_control_default), 7561 __experimentalSpacingSizesControl: () => (/* reexport */ SpacingSizesControl), 7562 __experimentalTextDecorationControl: () => (/* reexport */ TextDecorationControl), 7563 __experimentalTextTransformControl: () => (/* reexport */ TextTransformControl), 7564 __experimentalUnitControl: () => (/* reexport */ UnitControl), 7565 __experimentalUseBlockOverlayActive: () => (/* reexport */ useBlockOverlayActive), 7566 __experimentalUseBlockPreview: () => (/* reexport */ useBlockPreview), 7567 __experimentalUseBorderProps: () => (/* reexport */ useBorderProps), 7568 __experimentalUseColorProps: () => (/* reexport */ useColorProps), 7569 __experimentalUseCustomSides: () => (/* reexport */ useCustomSides), 7570 __experimentalUseGradient: () => (/* reexport */ __experimentalUseGradient), 7571 __experimentalUseHasRecursion: () => (/* reexport */ DeprecatedExperimentalUseHasRecursion), 7572 __experimentalUseMultipleOriginColorsAndGradients: () => (/* reexport */ useMultipleOriginColorsAndGradients), 7573 __experimentalUseResizeCanvas: () => (/* reexport */ useResizeCanvas), 7574 __experimentalWritingModeControl: () => (/* reexport */ WritingModeControl), 7575 __unstableBlockNameContext: () => (/* reexport */ block_name_context_default), 7576 __unstableBlockSettingsMenuFirstItem: () => (/* reexport */ block_settings_menu_first_item_default), 7577 __unstableBlockToolbarLastItem: () => (/* reexport */ block_toolbar_last_item_default), 7578 __unstableEditorStyles: () => (/* reexport */ editor_styles_default), 7579 __unstableIframe: () => (/* reexport */ iframe_default), 7580 __unstableInserterMenuExtension: () => (/* reexport */ inserter_menu_extension_default), 7581 __unstableRichTextInputEvent: () => (/* reexport */ __unstableRichTextInputEvent), 7582 __unstableUseBlockSelectionClearer: () => (/* reexport */ useBlockSelectionClearer), 7583 __unstableUseClipboardHandler: () => (/* reexport */ __unstableUseClipboardHandler), 7584 __unstableUseMouseMoveTypingReset: () => (/* reexport */ useMouseMoveTypingReset), 7585 __unstableUseTypewriter: () => (/* reexport */ useTypewriter), 7586 __unstableUseTypingObserver: () => (/* reexport */ useTypingObserver), 7587 createCustomColorsHOC: () => (/* reexport */ createCustomColorsHOC), 7588 getColorClassName: () => (/* reexport */ getColorClassName), 7589 getColorObjectByAttributeValues: () => (/* reexport */ getColorObjectByAttributeValues), 7590 getColorObjectByColorValue: () => (/* reexport */ getColorObjectByColorValue), 7591 getComputedFluidTypographyValue: () => (/* reexport */ getComputedFluidTypographyValue), 7592 getCustomValueFromPreset: () => (/* reexport */ getCustomValueFromPreset), 7593 getFontSize: () => (/* reexport */ utils_getFontSize), 7594 getFontSizeClass: () => (/* reexport */ getFontSizeClass), 7595 getFontSizeObjectByValue: () => (/* reexport */ utils_getFontSizeObjectByValue), 7596 getGradientSlugByValue: () => (/* reexport */ getGradientSlugByValue), 7597 getGradientValueBySlug: () => (/* reexport */ getGradientValueBySlug), 7598 getPxFromCssUnit: () => (/* reexport */ get_px_from_css_unit_default), 7599 getSpacingPresetCssVar: () => (/* reexport */ getSpacingPresetCssVar), 7600 getTypographyClassesAndStyles: () => (/* reexport */ getTypographyClassesAndStyles), 7601 isValueSpacingPreset: () => (/* reexport */ isValueSpacingPreset), 7602 privateApis: () => (/* reexport */ privateApis), 7603 store: () => (/* reexport */ store), 7604 storeConfig: () => (/* reexport */ storeConfig), 7605 transformStyles: () => (/* reexport */ transform_styles_default), 7606 useBlockBindingsUtils: () => (/* reexport */ useBlockBindingsUtils), 7607 useBlockCommands: () => (/* reexport */ useBlockCommands), 7608 useBlockDisplayInformation: () => (/* reexport */ useBlockDisplayInformation), 7609 useBlockEditContext: () => (/* reexport */ useBlockEditContext), 7610 useBlockEditingMode: () => (/* reexport */ useBlockEditingMode), 7611 useBlockProps: () => (/* reexport */ use_block_props_useBlockProps), 7612 useCachedTruthy: () => (/* reexport */ useCachedTruthy), 7613 useHasRecursion: () => (/* reexport */ useHasRecursion), 7614 useInnerBlocksProps: () => (/* reexport */ useInnerBlocksProps), 7615 useSetting: () => (/* reexport */ useSetting), 7616 useSettings: () => (/* reexport */ use_settings_useSettings), 7617 useStyleOverride: () => (/* reexport */ useStyleOverride), 7618 withColorContext: () => (/* reexport */ with_color_context_default), 7619 withColors: () => (/* reexport */ withColors), 7620 withFontSizes: () => (/* reexport */ with_font_sizes_default) 7621 }); 7622 7623 // NAMESPACE OBJECT: ./node_modules/@wordpress/block-editor/build-module/store/private-selectors.js 7624 var private_selectors_namespaceObject = {}; 7625 __webpack_require__.r(private_selectors_namespaceObject); 7626 __webpack_require__.d(private_selectors_namespaceObject, { 7627 getAllPatterns: () => (getAllPatterns), 7628 getBlockRemovalRules: () => (getBlockRemovalRules), 7629 getBlockSettings: () => (getBlockSettings), 7630 getBlockStyles: () => (getBlockStyles), 7631 getBlockWithoutAttributes: () => (getBlockWithoutAttributes), 7632 getClosestAllowedInsertionPoint: () => (getClosestAllowedInsertionPoint), 7633 getClosestAllowedInsertionPointForPattern: () => (getClosestAllowedInsertionPointForPattern), 7634 getContentLockingParent: () => (getContentLockingParent), 7635 getEnabledBlockParents: () => (getEnabledBlockParents), 7636 getEnabledClientIdsTree: () => (getEnabledClientIdsTree), 7637 getExpandedBlock: () => (getExpandedBlock), 7638 getInserterMediaCategories: () => (getInserterMediaCategories), 7639 getInsertionPoint: () => (getInsertionPoint), 7640 getLastFocus: () => (getLastFocus), 7641 getLastInsertedBlocksClientIds: () => (getLastInsertedBlocksClientIds), 7642 getOpenedBlockSettingsMenu: () => (getOpenedBlockSettingsMenu), 7643 getParentSectionBlock: () => (getParentSectionBlock), 7644 getPatternBySlug: () => (getPatternBySlug), 7645 getRegisteredInserterMediaCategories: () => (getRegisteredInserterMediaCategories), 7646 getRemovalPromptData: () => (getRemovalPromptData), 7647 getReusableBlocks: () => (getReusableBlocks), 7648 getSectionRootClientId: () => (getSectionRootClientId), 7649 getStyleOverrides: () => (getStyleOverrides), 7650 getTemporarilyEditingAsBlocks: () => (getTemporarilyEditingAsBlocks), 7651 getTemporarilyEditingFocusModeToRevert: () => (getTemporarilyEditingFocusModeToRevert), 7652 getZoomLevel: () => (getZoomLevel), 7653 hasAllowedPatterns: () => (hasAllowedPatterns), 7654 hasBlockSpotlight: () => (private_selectors_hasBlockSpotlight), 7655 isBlockHidden: () => (isBlockHidden), 7656 isBlockInterfaceHidden: () => (private_selectors_isBlockInterfaceHidden), 7657 isBlockSubtreeDisabled: () => (isBlockSubtreeDisabled), 7658 isContainerInsertableToInContentOnlyMode: () => (isContainerInsertableToInContentOnlyMode), 7659 isDragging: () => (private_selectors_isDragging), 7660 isSectionBlock: () => (isSectionBlock), 7661 isZoomOut: () => (isZoomOut) 7662 }); 7663 7664 // NAMESPACE OBJECT: ./node_modules/@wordpress/block-editor/build-module/store/selectors.js 7665 var selectors_namespaceObject = {}; 7666 __webpack_require__.r(selectors_namespaceObject); 7667 __webpack_require__.d(selectors_namespaceObject, { 7668 __experimentalGetActiveBlockIdByBlockNames: () => (__experimentalGetActiveBlockIdByBlockNames), 7669 __experimentalGetAllowedBlocks: () => (__experimentalGetAllowedBlocks), 7670 __experimentalGetAllowedPatterns: () => (__experimentalGetAllowedPatterns), 7671 __experimentalGetBlockListSettingsForBlocks: () => (__experimentalGetBlockListSettingsForBlocks), 7672 __experimentalGetDirectInsertBlock: () => (__experimentalGetDirectInsertBlock), 7673 __experimentalGetGlobalBlocksByName: () => (__experimentalGetGlobalBlocksByName), 7674 __experimentalGetLastBlockAttributeChanges: () => (__experimentalGetLastBlockAttributeChanges), 7675 __experimentalGetParsedPattern: () => (__experimentalGetParsedPattern), 7676 __experimentalGetPatternTransformItems: () => (__experimentalGetPatternTransformItems), 7677 __experimentalGetPatternsByBlockTypes: () => (__experimentalGetPatternsByBlockTypes), 7678 __experimentalGetReusableBlockTitle: () => (__experimentalGetReusableBlockTitle), 7679 __unstableGetBlockWithoutInnerBlocks: () => (__unstableGetBlockWithoutInnerBlocks), 7680 __unstableGetClientIdWithClientIdsTree: () => (__unstableGetClientIdWithClientIdsTree), 7681 __unstableGetClientIdsTree: () => (__unstableGetClientIdsTree), 7682 __unstableGetContentLockingParent: () => (__unstableGetContentLockingParent), 7683 __unstableGetSelectedBlocksWithPartialSelection: () => (__unstableGetSelectedBlocksWithPartialSelection), 7684 __unstableGetTemporarilyEditingAsBlocks: () => (__unstableGetTemporarilyEditingAsBlocks), 7685 __unstableGetTemporarilyEditingFocusModeToRevert: () => (__unstableGetTemporarilyEditingFocusModeToRevert), 7686 __unstableGetVisibleBlocks: () => (__unstableGetVisibleBlocks), 7687 __unstableHasActiveBlockOverlayActive: () => (__unstableHasActiveBlockOverlayActive), 7688 __unstableIsFullySelected: () => (__unstableIsFullySelected), 7689 __unstableIsLastBlockChangeIgnored: () => (__unstableIsLastBlockChangeIgnored), 7690 __unstableIsSelectionCollapsed: () => (__unstableIsSelectionCollapsed), 7691 __unstableIsSelectionMergeable: () => (__unstableIsSelectionMergeable), 7692 __unstableIsWithinBlockOverlay: () => (__unstableIsWithinBlockOverlay), 7693 __unstableSelectionHasUnmergeableBlock: () => (__unstableSelectionHasUnmergeableBlock), 7694 areInnerBlocksControlled: () => (areInnerBlocksControlled), 7695 canEditBlock: () => (canEditBlock), 7696 canInsertBlockType: () => (canInsertBlockType), 7697 canInsertBlocks: () => (canInsertBlocks), 7698 canLockBlockType: () => (canLockBlockType), 7699 canMoveBlock: () => (canMoveBlock), 7700 canMoveBlocks: () => (canMoveBlocks), 7701 canRemoveBlock: () => (canRemoveBlock), 7702 canRemoveBlocks: () => (canRemoveBlocks), 7703 didAutomaticChange: () => (didAutomaticChange), 7704 getAdjacentBlockClientId: () => (getAdjacentBlockClientId), 7705 getAllowedBlocks: () => (getAllowedBlocks), 7706 getBlock: () => (getBlock), 7707 getBlockAttributes: () => (getBlockAttributes), 7708 getBlockCount: () => (getBlockCount), 7709 getBlockEditingMode: () => (getBlockEditingMode), 7710 getBlockHierarchyRootClientId: () => (getBlockHierarchyRootClientId), 7711 getBlockIndex: () => (getBlockIndex), 7712 getBlockInsertionPoint: () => (getBlockInsertionPoint), 7713 getBlockListSettings: () => (getBlockListSettings), 7714 getBlockMode: () => (getBlockMode), 7715 getBlockName: () => (getBlockName), 7716 getBlockNamesByClientId: () => (getBlockNamesByClientId), 7717 getBlockOrder: () => (getBlockOrder), 7718 getBlockParents: () => (getBlockParents), 7719 getBlockParentsByBlockName: () => (getBlockParentsByBlockName), 7720 getBlockRootClientId: () => (getBlockRootClientId), 7721 getBlockSelectionEnd: () => (getBlockSelectionEnd), 7722 getBlockSelectionStart: () => (getBlockSelectionStart), 7723 getBlockTransformItems: () => (getBlockTransformItems), 7724 getBlocks: () => (getBlocks), 7725 getBlocksByClientId: () => (getBlocksByClientId), 7726 getBlocksByName: () => (getBlocksByName), 7727 getClientIdsOfDescendants: () => (getClientIdsOfDescendants), 7728 getClientIdsWithDescendants: () => (getClientIdsWithDescendants), 7729 getDirectInsertBlock: () => (getDirectInsertBlock), 7730 getDraggedBlockClientIds: () => (getDraggedBlockClientIds), 7731 getFirstMultiSelectedBlockClientId: () => (getFirstMultiSelectedBlockClientId), 7732 getGlobalBlockCount: () => (getGlobalBlockCount), 7733 getHoveredBlockClientId: () => (getHoveredBlockClientId), 7734 getInserterItems: () => (getInserterItems), 7735 getLastMultiSelectedBlockClientId: () => (getLastMultiSelectedBlockClientId), 7736 getLowestCommonAncestorWithSelectedBlock: () => (getLowestCommonAncestorWithSelectedBlock), 7737 getMultiSelectedBlockClientIds: () => (getMultiSelectedBlockClientIds), 7738 getMultiSelectedBlocks: () => (getMultiSelectedBlocks), 7739 getMultiSelectedBlocksEndClientId: () => (getMultiSelectedBlocksEndClientId), 7740 getMultiSelectedBlocksStartClientId: () => (getMultiSelectedBlocksStartClientId), 7741 getNextBlockClientId: () => (getNextBlockClientId), 7742 getPatternsByBlockTypes: () => (getPatternsByBlockTypes), 7743 getPreviousBlockClientId: () => (getPreviousBlockClientId), 7744 getSelectedBlock: () => (getSelectedBlock), 7745 getSelectedBlockClientId: () => (getSelectedBlockClientId), 7746 getSelectedBlockClientIds: () => (getSelectedBlockClientIds), 7747 getSelectedBlockCount: () => (getSelectedBlockCount), 7748 getSelectedBlocksInitialCaretPosition: () => (getSelectedBlocksInitialCaretPosition), 7749 getSelectionEnd: () => (getSelectionEnd), 7750 getSelectionStart: () => (getSelectionStart), 7751 getSettings: () => (getSettings), 7752 getTemplate: () => (getTemplate), 7753 getTemplateLock: () => (getTemplateLock), 7754 hasBlockMovingClientId: () => (hasBlockMovingClientId), 7755 hasDraggedInnerBlock: () => (hasDraggedInnerBlock), 7756 hasInserterItems: () => (hasInserterItems), 7757 hasMultiSelection: () => (hasMultiSelection), 7758 hasSelectedBlock: () => (hasSelectedBlock), 7759 hasSelectedInnerBlock: () => (hasSelectedInnerBlock), 7760 isAncestorBeingDragged: () => (isAncestorBeingDragged), 7761 isAncestorMultiSelected: () => (isAncestorMultiSelected), 7762 isBlockBeingDragged: () => (isBlockBeingDragged), 7763 isBlockHighlighted: () => (isBlockHighlighted), 7764 isBlockInsertionPointVisible: () => (isBlockInsertionPointVisible), 7765 isBlockMultiSelected: () => (isBlockMultiSelected), 7766 isBlockSelected: () => (isBlockSelected), 7767 isBlockValid: () => (isBlockValid), 7768 isBlockVisible: () => (isBlockVisible), 7769 isBlockWithinSelection: () => (isBlockWithinSelection), 7770 isCaretWithinFormattedText: () => (isCaretWithinFormattedText), 7771 isDraggingBlocks: () => (isDraggingBlocks), 7772 isFirstMultiSelectedBlock: () => (isFirstMultiSelectedBlock), 7773 isGroupable: () => (isGroupable), 7774 isLastBlockChangePersistent: () => (isLastBlockChangePersistent), 7775 isMultiSelecting: () => (selectors_isMultiSelecting), 7776 isSelectionEnabled: () => (selectors_isSelectionEnabled), 7777 isTyping: () => (selectors_isTyping), 7778 isUngroupable: () => (isUngroupable), 7779 isValidTemplate: () => (isValidTemplate), 7780 wasBlockJustInserted: () => (wasBlockJustInserted) 7781 }); 7782 7783 // NAMESPACE OBJECT: ./node_modules/@wordpress/block-editor/build-module/store/private-actions.js 7784 var private_actions_namespaceObject = {}; 7785 __webpack_require__.r(private_actions_namespaceObject); 7786 __webpack_require__.d(private_actions_namespaceObject, { 7787 __experimentalUpdateSettings: () => (__experimentalUpdateSettings), 7788 clearBlockRemovalPrompt: () => (clearBlockRemovalPrompt), 7789 deleteStyleOverride: () => (deleteStyleOverride), 7790 ensureDefaultBlock: () => (ensureDefaultBlock), 7791 expandBlock: () => (expandBlock), 7792 hideBlockInterface: () => (hideBlockInterface), 7793 modifyContentLockBlock: () => (modifyContentLockBlock), 7794 privateRemoveBlocks: () => (privateRemoveBlocks), 7795 resetZoomLevel: () => (resetZoomLevel), 7796 setBlockRemovalRules: () => (setBlockRemovalRules), 7797 setInsertionPoint: () => (setInsertionPoint), 7798 setLastFocus: () => (setLastFocus), 7799 setOpenedBlockSettingsMenu: () => (setOpenedBlockSettingsMenu), 7800 setStyleOverride: () => (setStyleOverride), 7801 setZoomLevel: () => (setZoomLevel), 7802 showBlockInterface: () => (showBlockInterface), 7803 startDragging: () => (startDragging), 7804 stopDragging: () => (stopDragging), 7805 stopEditingAsBlocks: () => (stopEditingAsBlocks), 7806 toggleBlockSpotlight: () => (toggleBlockSpotlight) 7807 }); 7808 7809 // NAMESPACE OBJECT: ./node_modules/@wordpress/block-editor/build-module/store/actions.js 7810 var actions_namespaceObject = {}; 7811 __webpack_require__.r(actions_namespaceObject); 7812 __webpack_require__.d(actions_namespaceObject, { 7813 __unstableDeleteSelection: () => (__unstableDeleteSelection), 7814 __unstableExpandSelection: () => (__unstableExpandSelection), 7815 __unstableMarkAutomaticChange: () => (__unstableMarkAutomaticChange), 7816 __unstableMarkLastChangeAsPersistent: () => (__unstableMarkLastChangeAsPersistent), 7817 __unstableMarkNextChangeAsNotPersistent: () => (__unstableMarkNextChangeAsNotPersistent), 7818 __unstableSaveReusableBlock: () => (__unstableSaveReusableBlock), 7819 __unstableSetEditorMode: () => (__unstableSetEditorMode), 7820 __unstableSetTemporarilyEditingAsBlocks: () => (__unstableSetTemporarilyEditingAsBlocks), 7821 __unstableSplitSelection: () => (__unstableSplitSelection), 7822 clearSelectedBlock: () => (clearSelectedBlock), 7823 duplicateBlocks: () => (duplicateBlocks), 7824 enterFormattedText: () => (enterFormattedText), 7825 exitFormattedText: () => (exitFormattedText), 7826 flashBlock: () => (flashBlock), 7827 hideInsertionPoint: () => (hideInsertionPoint), 7828 hoverBlock: () => (hoverBlock), 7829 insertAfterBlock: () => (insertAfterBlock), 7830 insertBeforeBlock: () => (insertBeforeBlock), 7831 insertBlock: () => (insertBlock), 7832 insertBlocks: () => (insertBlocks), 7833 insertDefaultBlock: () => (insertDefaultBlock), 7834 mergeBlocks: () => (mergeBlocks), 7835 moveBlockToPosition: () => (moveBlockToPosition), 7836 moveBlocksDown: () => (moveBlocksDown), 7837 moveBlocksToPosition: () => (moveBlocksToPosition), 7838 moveBlocksUp: () => (moveBlocksUp), 7839 multiSelect: () => (multiSelect), 7840 receiveBlocks: () => (receiveBlocks), 7841 registerInserterMediaCategory: () => (registerInserterMediaCategory), 7842 removeBlock: () => (removeBlock), 7843 removeBlocks: () => (removeBlocks), 7844 replaceBlock: () => (replaceBlock), 7845 replaceBlocks: () => (replaceBlocks), 7846 replaceInnerBlocks: () => (replaceInnerBlocks), 7847 resetBlocks: () => (resetBlocks), 7848 resetSelection: () => (resetSelection), 7849 selectBlock: () => (selectBlock), 7850 selectNextBlock: () => (selectNextBlock), 7851 selectPreviousBlock: () => (selectPreviousBlock), 7852 selectionChange: () => (selectionChange), 7853 setBlockEditingMode: () => (setBlockEditingMode), 7854 setBlockMovingClientId: () => (setBlockMovingClientId), 7855 setBlockVisibility: () => (setBlockVisibility), 7856 setHasControlledInnerBlocks: () => (setHasControlledInnerBlocks), 7857 setTemplateValidity: () => (setTemplateValidity), 7858 showInsertionPoint: () => (showInsertionPoint), 7859 startDraggingBlocks: () => (startDraggingBlocks), 7860 startMultiSelect: () => (startMultiSelect), 7861 startTyping: () => (startTyping), 7862 stopDraggingBlocks: () => (stopDraggingBlocks), 7863 stopMultiSelect: () => (stopMultiSelect), 7864 stopTyping: () => (stopTyping), 7865 synchronizeTemplate: () => (synchronizeTemplate), 7866 toggleBlockHighlight: () => (toggleBlockHighlight), 7867 toggleBlockMode: () => (toggleBlockMode), 7868 toggleSelection: () => (toggleSelection), 7869 unsetBlockEditingMode: () => (unsetBlockEditingMode), 7870 updateBlock: () => (updateBlock), 7871 updateBlockAttributes: () => (updateBlockAttributes), 7872 updateBlockListSettings: () => (updateBlockListSettings), 7873 updateSettings: () => (updateSettings), 7874 validateBlocksToTemplate: () => (validateBlocksToTemplate) 7875 }); 7876 7877 // NAMESPACE OBJECT: ./node_modules/@wordpress/upload-media/build-module/store/selectors.js 7878 var store_selectors_namespaceObject = {}; 7879 __webpack_require__.r(store_selectors_namespaceObject); 7880 __webpack_require__.d(store_selectors_namespaceObject, { 7881 getItems: () => (getItems), 7882 getSettings: () => (selectors_getSettings), 7883 isUploading: () => (isUploading), 7884 isUploadingById: () => (isUploadingById), 7885 isUploadingByUrl: () => (isUploadingByUrl) 7886 }); 7887 7888 // NAMESPACE OBJECT: ./node_modules/@wordpress/upload-media/build-module/store/private-selectors.js 7889 var store_private_selectors_namespaceObject = {}; 7890 __webpack_require__.r(store_private_selectors_namespaceObject); 7891 __webpack_require__.d(store_private_selectors_namespaceObject, { 7892 getAllItems: () => (getAllItems), 7893 getBlobUrls: () => (getBlobUrls), 7894 getItem: () => (getItem), 7895 getPausedUploadForPost: () => (getPausedUploadForPost), 7896 isBatchUploaded: () => (isBatchUploaded), 7897 isPaused: () => (isPaused), 7898 isUploadingToPost: () => (isUploadingToPost) 7899 }); 7900 7901 // NAMESPACE OBJECT: ./node_modules/@wordpress/upload-media/build-module/store/actions.js 7902 var store_actions_namespaceObject = {}; 7903 __webpack_require__.r(store_actions_namespaceObject); 7904 __webpack_require__.d(store_actions_namespaceObject, { 7905 addItems: () => (addItems), 7906 cancelItem: () => (cancelItem) 7907 }); 7908 7909 // NAMESPACE OBJECT: ./node_modules/@wordpress/upload-media/build-module/store/private-actions.js 7910 var store_private_actions_namespaceObject = {}; 7911 __webpack_require__.r(store_private_actions_namespaceObject); 7912 __webpack_require__.d(store_private_actions_namespaceObject, { 7913 addItem: () => (addItem), 7914 finishOperation: () => (finishOperation), 7915 pauseQueue: () => (pauseQueue), 7916 prepareItem: () => (prepareItem), 7917 processItem: () => (processItem), 7918 removeItem: () => (removeItem), 7919 resumeQueue: () => (resumeQueue), 7920 revokeBlobUrls: () => (revokeBlobUrls), 7921 updateSettings: () => (private_actions_updateSettings), 7922 uploadItem: () => (uploadItem) 7923 }); 7924 7925 // NAMESPACE OBJECT: ./node_modules/@wordpress/block-editor/build-module/components/global-styles/index.js 7926 var global_styles_namespaceObject = {}; 7927 __webpack_require__.r(global_styles_namespaceObject); 7928 __webpack_require__.d(global_styles_namespaceObject, { 7929 AdvancedPanel: () => (AdvancedPanel), 7930 BackgroundPanel: () => (background_panel_BackgroundImagePanel), 7931 BorderPanel: () => (BorderPanel), 7932 ColorPanel: () => (ColorPanel), 7933 DimensionsPanel: () => (DimensionsPanel), 7934 FiltersPanel: () => (FiltersPanel), 7935 GlobalStylesContext: () => (GlobalStylesContext), 7936 ImageSettingsPanel: () => (ImageSettingsPanel), 7937 TypographyPanel: () => (TypographyPanel), 7938 areGlobalStyleConfigsEqual: () => (areGlobalStyleConfigsEqual), 7939 getBlockCSSSelector: () => (getBlockCSSSelector), 7940 getBlockSelectors: () => (getBlockSelectors), 7941 getGlobalStylesChanges: () => (getGlobalStylesChanges), 7942 getLayoutStyles: () => (getLayoutStyles), 7943 toStyles: () => (toStyles), 7944 useGlobalSetting: () => (useGlobalSetting), 7945 useGlobalStyle: () => (useGlobalStyle), 7946 useGlobalStylesOutput: () => (useGlobalStylesOutput), 7947 useGlobalStylesOutputWithConfig: () => (useGlobalStylesOutputWithConfig), 7948 useGlobalStylesReset: () => (useGlobalStylesReset), 7949 useHasBackgroundPanel: () => (useHasBackgroundPanel), 7950 useHasBorderPanel: () => (useHasBorderPanel), 7951 useHasBorderPanelControls: () => (useHasBorderPanelControls), 7952 useHasColorPanel: () => (useHasColorPanel), 7953 useHasDimensionsPanel: () => (useHasDimensionsPanel), 7954 useHasFiltersPanel: () => (useHasFiltersPanel), 7955 useHasImageSettingsPanel: () => (useHasImageSettingsPanel), 7956 useHasTypographyPanel: () => (useHasTypographyPanel), 7957 useSettingsForBlockElement: () => (useSettingsForBlockElement) 7958 }); 7959 7960 ;// external "ReactJSXRuntime" 7961 const external_ReactJSXRuntime_namespaceObject = window["ReactJSXRuntime"]; 7962 ;// external ["wp","blocks"] 7963 const external_wp_blocks_namespaceObject = window["wp"]["blocks"]; 7964 ;// external ["wp","element"] 7965 const external_wp_element_namespaceObject = window["wp"]["element"]; 7966 ;// external ["wp","data"] 7967 const external_wp_data_namespaceObject = window["wp"]["data"]; 7968 ;// external ["wp","compose"] 7969 const external_wp_compose_namespaceObject = window["wp"]["compose"]; 7970 ;// external ["wp","hooks"] 7971 const external_wp_hooks_namespaceObject = window["wp"]["hooks"]; 7972 ;// ./node_modules/@wordpress/block-editor/build-module/components/block-edit/context.js 7973 7974 const mayDisplayControlsKey = Symbol("mayDisplayControls"); 7975 const mayDisplayParentControlsKey = Symbol("mayDisplayParentControls"); 7976 const blockEditingModeKey = Symbol("blockEditingMode"); 7977 const blockBindingsKey = Symbol("blockBindings"); 7978 const isPreviewModeKey = Symbol("isPreviewMode"); 7979 const DEFAULT_BLOCK_EDIT_CONTEXT = { 7980 name: "", 7981 isSelected: false 7982 }; 7983 const Context = (0,external_wp_element_namespaceObject.createContext)(DEFAULT_BLOCK_EDIT_CONTEXT); 7984 Context.displayName = "BlockEditContext"; 7985 const { Provider } = Context; 7986 function useBlockEditContext() { 7987 return (0,external_wp_element_namespaceObject.useContext)(Context); 7988 } 7989 7990 7991 ;// external ["wp","deprecated"] 7992 const external_wp_deprecated_namespaceObject = window["wp"]["deprecated"]; 7993 var external_wp_deprecated_default = /*#__PURE__*/__webpack_require__.n(external_wp_deprecated_namespaceObject); 7994 // EXTERNAL MODULE: ./node_modules/fast-deep-equal/es6/index.js 7995 var es6 = __webpack_require__(7734); 7996 var es6_default = /*#__PURE__*/__webpack_require__.n(es6); 7997 ;// external ["wp","i18n"] 7998 const external_wp_i18n_namespaceObject = window["wp"]["i18n"]; 7999 ;// ./node_modules/@wordpress/block-editor/build-module/store/defaults.js 8000 8001 const PREFERENCES_DEFAULTS = { 8002 insertUsage: {} 8003 }; 8004 const SETTINGS_DEFAULTS = { 8005 alignWide: false, 8006 supportsLayout: true, 8007 // colors setting is not used anymore now defaults are passed from theme.json on the server and core has its own defaults. 8008 // The setting is only kept for backward compatibility purposes. 8009 colors: [ 8010 { 8011 name: (0,external_wp_i18n_namespaceObject.__)("Black"), 8012 slug: "black", 8013 color: "#000000" 8014 }, 8015 { 8016 name: (0,external_wp_i18n_namespaceObject.__)("Cyan bluish gray"), 8017 slug: "cyan-bluish-gray", 8018 color: "#abb8c3" 8019 }, 8020 { 8021 name: (0,external_wp_i18n_namespaceObject.__)("White"), 8022 slug: "white", 8023 color: "#ffffff" 8024 }, 8025 { 8026 name: (0,external_wp_i18n_namespaceObject.__)("Pale pink"), 8027 slug: "pale-pink", 8028 color: "#f78da7" 8029 }, 8030 { name: (0,external_wp_i18n_namespaceObject.__)("Vivid red"), slug: "vivid-red", color: "#cf2e2e" }, 8031 { 8032 name: (0,external_wp_i18n_namespaceObject.__)("Luminous vivid orange"), 8033 slug: "luminous-vivid-orange", 8034 color: "#ff6900" 8035 }, 8036 { 8037 name: (0,external_wp_i18n_namespaceObject.__)("Luminous vivid amber"), 8038 slug: "luminous-vivid-amber", 8039 color: "#fcb900" 8040 }, 8041 { 8042 name: (0,external_wp_i18n_namespaceObject.__)("Light green cyan"), 8043 slug: "light-green-cyan", 8044 color: "#7bdcb5" 8045 }, 8046 { 8047 name: (0,external_wp_i18n_namespaceObject.__)("Vivid green cyan"), 8048 slug: "vivid-green-cyan", 8049 color: "#00d084" 8050 }, 8051 { 8052 name: (0,external_wp_i18n_namespaceObject.__)("Pale cyan blue"), 8053 slug: "pale-cyan-blue", 8054 color: "#8ed1fc" 8055 }, 8056 { 8057 name: (0,external_wp_i18n_namespaceObject.__)("Vivid cyan blue"), 8058 slug: "vivid-cyan-blue", 8059 color: "#0693e3" 8060 }, 8061 { 8062 name: (0,external_wp_i18n_namespaceObject.__)("Vivid purple"), 8063 slug: "vivid-purple", 8064 color: "#9b51e0" 8065 } 8066 ], 8067 // fontSizes setting is not used anymore now defaults are passed from theme.json on the server and core has its own defaults. 8068 // The setting is only kept for backward compatibility purposes. 8069 fontSizes: [ 8070 { 8071 name: (0,external_wp_i18n_namespaceObject._x)("Small", "font size name"), 8072 size: 13, 8073 slug: "small" 8074 }, 8075 { 8076 name: (0,external_wp_i18n_namespaceObject._x)("Normal", "font size name"), 8077 size: 16, 8078 slug: "normal" 8079 }, 8080 { 8081 name: (0,external_wp_i18n_namespaceObject._x)("Medium", "font size name"), 8082 size: 20, 8083 slug: "medium" 8084 }, 8085 { 8086 name: (0,external_wp_i18n_namespaceObject._x)("Large", "font size name"), 8087 size: 36, 8088 slug: "large" 8089 }, 8090 { 8091 name: (0,external_wp_i18n_namespaceObject._x)("Huge", "font size name"), 8092 size: 42, 8093 slug: "huge" 8094 } 8095 ], 8096 // Image default size slug. 8097 imageDefaultSize: "large", 8098 imageSizes: [ 8099 { slug: "thumbnail", name: (0,external_wp_i18n_namespaceObject.__)("Thumbnail") }, 8100 { slug: "medium", name: (0,external_wp_i18n_namespaceObject.__)("Medium") }, 8101 { slug: "large", name: (0,external_wp_i18n_namespaceObject.__)("Large") }, 8102 { slug: "full", name: (0,external_wp_i18n_namespaceObject.__)("Full Size") } 8103 ], 8104 // Allow plugin to disable Image Editor if need be. 8105 imageEditing: true, 8106 // This is current max width of the block inner area 8107 // It's used to constraint image resizing and this value could be overridden later by themes 8108 maxWidth: 580, 8109 // Allowed block types for the editor, defaulting to true (all supported). 8110 allowedBlockTypes: true, 8111 // Maximum upload size in bytes allowed for the site. 8112 maxUploadFileSize: 0, 8113 // List of allowed mime types and file extensions. 8114 allowedMimeTypes: null, 8115 // Allows to disable block locking interface. 8116 canLockBlocks: true, 8117 // Allows to disable Openverse media category in the inserter. 8118 enableOpenverseMediaCategory: true, 8119 clearBlockSelection: true, 8120 __experimentalCanUserUseUnfilteredHTML: false, 8121 __experimentalBlockDirectory: false, 8122 __mobileEnablePageTemplates: false, 8123 __experimentalBlockPatterns: [], 8124 __experimentalBlockPatternCategories: [], 8125 isPreviewMode: false, 8126 // These settings will be completely revamped in the future. 8127 // The goal is to evolve this into an API which will instruct 8128 // the block inspector to animate transitions between what it 8129 // displays based on the relationship between the selected block 8130 // and its parent, and only enable it if the parent is controlling 8131 // its children blocks. 8132 blockInspectorAnimation: { 8133 animationParent: "core/navigation", 8134 "core/navigation": { enterDirection: "leftToRight" }, 8135 "core/navigation-submenu": { enterDirection: "rightToLeft" }, 8136 "core/navigation-link": { enterDirection: "rightToLeft" }, 8137 "core/search": { enterDirection: "rightToLeft" }, 8138 "core/social-links": { enterDirection: "rightToLeft" }, 8139 "core/page-list": { enterDirection: "rightToLeft" }, 8140 "core/spacer": { enterDirection: "rightToLeft" }, 8141 "core/home-link": { enterDirection: "rightToLeft" }, 8142 "core/site-title": { enterDirection: "rightToLeft" }, 8143 "core/site-logo": { enterDirection: "rightToLeft" } 8144 }, 8145 generateAnchors: false, 8146 // gradients setting is not used anymore now defaults are passed from theme.json on the server and core has its own defaults. 8147 // The setting is only kept for backward compatibility purposes. 8148 gradients: [ 8149 { 8150 name: (0,external_wp_i18n_namespaceObject.__)("Vivid cyan blue to vivid purple"), 8151 gradient: "linear-gradient(135deg,rgba(6,147,227,1) 0%,rgb(155,81,224) 100%)", 8152 slug: "vivid-cyan-blue-to-vivid-purple" 8153 }, 8154 { 8155 name: (0,external_wp_i18n_namespaceObject.__)("Light green cyan to vivid green cyan"), 8156 gradient: "linear-gradient(135deg,rgb(122,220,180) 0%,rgb(0,208,130) 100%)", 8157 slug: "light-green-cyan-to-vivid-green-cyan" 8158 }, 8159 { 8160 name: (0,external_wp_i18n_namespaceObject.__)("Luminous vivid amber to luminous vivid orange"), 8161 gradient: "linear-gradient(135deg,rgba(252,185,0,1) 0%,rgba(255,105,0,1) 100%)", 8162 slug: "luminous-vivid-amber-to-luminous-vivid-orange" 8163 }, 8164 { 8165 name: (0,external_wp_i18n_namespaceObject.__)("Luminous vivid orange to vivid red"), 8166 gradient: "linear-gradient(135deg,rgba(255,105,0,1) 0%,rgb(207,46,46) 100%)", 8167 slug: "luminous-vivid-orange-to-vivid-red" 8168 }, 8169 { 8170 name: (0,external_wp_i18n_namespaceObject.__)("Very light gray to cyan bluish gray"), 8171 gradient: "linear-gradient(135deg,rgb(238,238,238) 0%,rgb(169,184,195) 100%)", 8172 slug: "very-light-gray-to-cyan-bluish-gray" 8173 }, 8174 { 8175 name: (0,external_wp_i18n_namespaceObject.__)("Cool to warm spectrum"), 8176 gradient: "linear-gradient(135deg,rgb(74,234,220) 0%,rgb(151,120,209) 20%,rgb(207,42,186) 40%,rgb(238,44,130) 60%,rgb(251,105,98) 80%,rgb(254,248,76) 100%)", 8177 slug: "cool-to-warm-spectrum" 8178 }, 8179 { 8180 name: (0,external_wp_i18n_namespaceObject.__)("Blush light purple"), 8181 gradient: "linear-gradient(135deg,rgb(255,206,236) 0%,rgb(152,150,240) 100%)", 8182 slug: "blush-light-purple" 8183 }, 8184 { 8185 name: (0,external_wp_i18n_namespaceObject.__)("Blush bordeaux"), 8186 gradient: "linear-gradient(135deg,rgb(254,205,165) 0%,rgb(254,45,45) 50%,rgb(107,0,62) 100%)", 8187 slug: "blush-bordeaux" 8188 }, 8189 { 8190 name: (0,external_wp_i18n_namespaceObject.__)("Luminous dusk"), 8191 gradient: "linear-gradient(135deg,rgb(255,203,112) 0%,rgb(199,81,192) 50%,rgb(65,88,208) 100%)", 8192 slug: "luminous-dusk" 8193 }, 8194 { 8195 name: (0,external_wp_i18n_namespaceObject.__)("Pale ocean"), 8196 gradient: "linear-gradient(135deg,rgb(255,245,203) 0%,rgb(182,227,212) 50%,rgb(51,167,181) 100%)", 8197 slug: "pale-ocean" 8198 }, 8199 { 8200 name: (0,external_wp_i18n_namespaceObject.__)("Electric grass"), 8201 gradient: "linear-gradient(135deg,rgb(202,248,128) 0%,rgb(113,206,126) 100%)", 8202 slug: "electric-grass" 8203 }, 8204 { 8205 name: (0,external_wp_i18n_namespaceObject.__)("Midnight"), 8206 gradient: "linear-gradient(135deg,rgb(2,3,129) 0%,rgb(40,116,252) 100%)", 8207 slug: "midnight" 8208 } 8209 ], 8210 __unstableResolvedAssets: { styles: [], scripts: [] } 8211 }; 8212 8213 8214 ;// ./node_modules/@wordpress/block-editor/build-module/store/array.js 8215 function insertAt(array, elements, index) { 8216 return [ 8217 ...array.slice(0, index), 8218 ...Array.isArray(elements) ? elements : [elements], 8219 ...array.slice(index) 8220 ]; 8221 } 8222 function moveTo(array, from, to, count = 1) { 8223 const withoutMovedElements = [...array]; 8224 withoutMovedElements.splice(from, count); 8225 return insertAt( 8226 withoutMovedElements, 8227 array.slice(from, from + count), 8228 to 8229 ); 8230 } 8231 8232 8233 ;// ./node_modules/@wordpress/block-editor/build-module/store/private-keys.js 8234 const globalStylesDataKey = Symbol("globalStylesDataKey"); 8235 const globalStylesLinksDataKey = Symbol("globalStylesLinks"); 8236 const selectBlockPatternsKey = Symbol("selectBlockPatternsKey"); 8237 const reusableBlocksSelectKey = Symbol("reusableBlocksSelect"); 8238 const sectionRootClientIdKey = Symbol("sectionRootClientIdKey"); 8239 const mediaEditKey = Symbol("mediaEditKey"); 8240 const essentialFormatKey = Symbol("essentialFormat"); 8241 8242 8243 ;// external ["wp","privateApis"] 8244 const external_wp_privateApis_namespaceObject = window["wp"]["privateApis"]; 8245 ;// ./node_modules/@wordpress/block-editor/build-module/lock-unlock.js 8246 8247 const { lock, unlock } = (0,external_wp_privateApis_namespaceObject.__dangerousOptInToUnstableAPIsOnlyForCoreModules)( 8248 "I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.", 8249 "@wordpress/block-editor" 8250 ); 8251 8252 8253 ;// ./node_modules/@wordpress/block-editor/build-module/store/reducer.js 8254 8255 8256 8257 8258 8259 8260 8261 8262 8263 const { isContentBlock } = unlock(external_wp_blocks_namespaceObject.privateApis); 8264 const identity = (x) => x; 8265 function mapBlockOrder(blocks2, rootClientId = "") { 8266 const result = /* @__PURE__ */ new Map(); 8267 const current = []; 8268 result.set(rootClientId, current); 8269 blocks2.forEach((block) => { 8270 const { clientId, innerBlocks } = block; 8271 current.push(clientId); 8272 mapBlockOrder(innerBlocks, clientId).forEach( 8273 (order, subClientId) => { 8274 result.set(subClientId, order); 8275 } 8276 ); 8277 }); 8278 return result; 8279 } 8280 function mapBlockParents(blocks2, rootClientId = "") { 8281 const result = []; 8282 const stack = [[rootClientId, blocks2]]; 8283 while (stack.length) { 8284 const [parent, currentBlocks] = stack.shift(); 8285 currentBlocks.forEach(({ innerBlocks, ...block }) => { 8286 result.push([block.clientId, parent]); 8287 if (innerBlocks?.length) { 8288 stack.push([block.clientId, innerBlocks]); 8289 } 8290 }); 8291 } 8292 return result; 8293 } 8294 function flattenBlocks(blocks2, transform = identity) { 8295 const result = []; 8296 const stack = [...blocks2]; 8297 while (stack.length) { 8298 const { innerBlocks, ...block } = stack.shift(); 8299 stack.push(...innerBlocks); 8300 result.push([block.clientId, transform(block)]); 8301 } 8302 return result; 8303 } 8304 function getFlattenedClientIds(blocks2) { 8305 const result = {}; 8306 const stack = [...blocks2]; 8307 while (stack.length) { 8308 const { innerBlocks, ...block } = stack.shift(); 8309 stack.push(...innerBlocks); 8310 result[block.clientId] = true; 8311 } 8312 return result; 8313 } 8314 function getFlattenedBlocksWithoutAttributes(blocks2) { 8315 return flattenBlocks(blocks2, (block) => { 8316 const { attributes, ...restBlock } = block; 8317 return restBlock; 8318 }); 8319 } 8320 function getFlattenedBlockAttributes(blocks2) { 8321 return flattenBlocks(blocks2, (block) => block.attributes); 8322 } 8323 function hasSameKeys(a, b) { 8324 return es6_default()(Object.keys(a), Object.keys(b)); 8325 } 8326 function isUpdatingSameBlockAttribute(action, lastAction) { 8327 return action.type === "UPDATE_BLOCK_ATTRIBUTES" && lastAction !== void 0 && lastAction.type === "UPDATE_BLOCK_ATTRIBUTES" && es6_default()(action.clientIds, lastAction.clientIds) && hasSameKeys(action.attributes, lastAction.attributes); 8328 } 8329 function updateBlockTreeForBlocks(state, blocks2) { 8330 const treeToUpdate = state.tree; 8331 const stack = [...blocks2]; 8332 const flattenedBlocks = [...blocks2]; 8333 while (stack.length) { 8334 const block = stack.shift(); 8335 stack.push(...block.innerBlocks); 8336 flattenedBlocks.push(...block.innerBlocks); 8337 } 8338 for (const block of flattenedBlocks) { 8339 treeToUpdate.set(block.clientId, {}); 8340 } 8341 for (const block of flattenedBlocks) { 8342 treeToUpdate.set( 8343 block.clientId, 8344 Object.assign(treeToUpdate.get(block.clientId), { 8345 ...state.byClientId.get(block.clientId), 8346 attributes: state.attributes.get(block.clientId), 8347 innerBlocks: block.innerBlocks.map( 8348 (subBlock) => treeToUpdate.get(subBlock.clientId) 8349 ) 8350 }) 8351 ); 8352 } 8353 } 8354 function updateParentInnerBlocksInTree(state, updatedClientIds, updateChildrenOfUpdatedClientIds = false) { 8355 const treeToUpdate = state.tree; 8356 const uncontrolledParents = /* @__PURE__ */ new Set([]); 8357 const controlledParents = /* @__PURE__ */ new Set(); 8358 for (const clientId of updatedClientIds) { 8359 let current = updateChildrenOfUpdatedClientIds ? clientId : state.parents.get(clientId); 8360 do { 8361 if (state.controlledInnerBlocks[current]) { 8362 controlledParents.add(current); 8363 break; 8364 } else { 8365 uncontrolledParents.add(current); 8366 current = state.parents.get(current); 8367 } 8368 } while (current !== void 0); 8369 } 8370 for (const clientId of uncontrolledParents) { 8371 treeToUpdate.set(clientId, { ...treeToUpdate.get(clientId) }); 8372 } 8373 for (const clientId of uncontrolledParents) { 8374 treeToUpdate.get(clientId).innerBlocks = (state.order.get(clientId) || []).map((subClientId) => treeToUpdate.get(subClientId)); 8375 } 8376 for (const clientId of controlledParents) { 8377 treeToUpdate.set("controlled||" + clientId, { 8378 innerBlocks: (state.order.get(clientId) || []).map( 8379 (subClientId) => treeToUpdate.get(subClientId) 8380 ) 8381 }); 8382 } 8383 } 8384 const withBlockTree = (reducer) => (state = {}, action) => { 8385 const newState = reducer(state, action); 8386 if (newState === state) { 8387 return state; 8388 } 8389 newState.tree = state.tree ? state.tree : /* @__PURE__ */ new Map(); 8390 switch (action.type) { 8391 case "RECEIVE_BLOCKS": 8392 case "INSERT_BLOCKS": { 8393 newState.tree = new Map(newState.tree); 8394 updateBlockTreeForBlocks(newState, action.blocks); 8395 updateParentInnerBlocksInTree( 8396 newState, 8397 action.rootClientId ? [action.rootClientId] : [""], 8398 true 8399 ); 8400 break; 8401 } 8402 case "UPDATE_BLOCK": 8403 newState.tree = new Map(newState.tree); 8404 newState.tree.set(action.clientId, { 8405 ...newState.tree.get(action.clientId), 8406 ...newState.byClientId.get(action.clientId), 8407 attributes: newState.attributes.get(action.clientId) 8408 }); 8409 updateParentInnerBlocksInTree( 8410 newState, 8411 [action.clientId], 8412 false 8413 ); 8414 break; 8415 case "SYNC_DERIVED_BLOCK_ATTRIBUTES": 8416 case "UPDATE_BLOCK_ATTRIBUTES": { 8417 newState.tree = new Map(newState.tree); 8418 action.clientIds.forEach((clientId) => { 8419 newState.tree.set(clientId, { 8420 ...newState.tree.get(clientId), 8421 attributes: newState.attributes.get(clientId) 8422 }); 8423 }); 8424 updateParentInnerBlocksInTree( 8425 newState, 8426 action.clientIds, 8427 false 8428 ); 8429 break; 8430 } 8431 case "REPLACE_BLOCKS_AUGMENTED_WITH_CHILDREN": { 8432 const inserterClientIds = getFlattenedClientIds( 8433 action.blocks 8434 ); 8435 newState.tree = new Map(newState.tree); 8436 action.replacedClientIds.forEach((clientId) => { 8437 newState.tree.delete(clientId); 8438 if (!inserterClientIds[clientId]) { 8439 newState.tree.delete("controlled||" + clientId); 8440 } 8441 }); 8442 updateBlockTreeForBlocks(newState, action.blocks); 8443 updateParentInnerBlocksInTree( 8444 newState, 8445 action.blocks.map((b) => b.clientId), 8446 false 8447 ); 8448 const parentsOfRemovedBlocks2 = []; 8449 for (const clientId of action.clientIds) { 8450 const parentId = state.parents.get(clientId); 8451 if (parentId !== void 0 && (parentId === "" || newState.byClientId.get(parentId))) { 8452 parentsOfRemovedBlocks2.push(parentId); 8453 } 8454 } 8455 updateParentInnerBlocksInTree( 8456 newState, 8457 parentsOfRemovedBlocks2, 8458 true 8459 ); 8460 break; 8461 } 8462 case "REMOVE_BLOCKS_AUGMENTED_WITH_CHILDREN": 8463 const parentsOfRemovedBlocks = []; 8464 for (const clientId of action.clientIds) { 8465 const parentId = state.parents.get(clientId); 8466 if (parentId !== void 0 && (parentId === "" || newState.byClientId.get(parentId))) { 8467 parentsOfRemovedBlocks.push(parentId); 8468 } 8469 } 8470 newState.tree = new Map(newState.tree); 8471 action.removedClientIds.forEach((clientId) => { 8472 newState.tree.delete(clientId); 8473 newState.tree.delete("controlled||" + clientId); 8474 }); 8475 updateParentInnerBlocksInTree( 8476 newState, 8477 parentsOfRemovedBlocks, 8478 true 8479 ); 8480 break; 8481 case "MOVE_BLOCKS_TO_POSITION": { 8482 const updatedBlockUids = []; 8483 if (action.fromRootClientId) { 8484 updatedBlockUids.push(action.fromRootClientId); 8485 } else { 8486 updatedBlockUids.push(""); 8487 } 8488 if (action.toRootClientId) { 8489 updatedBlockUids.push(action.toRootClientId); 8490 } 8491 newState.tree = new Map(newState.tree); 8492 updateParentInnerBlocksInTree( 8493 newState, 8494 updatedBlockUids, 8495 true 8496 ); 8497 break; 8498 } 8499 case "MOVE_BLOCKS_UP": 8500 case "MOVE_BLOCKS_DOWN": { 8501 const updatedBlockUids = [ 8502 action.rootClientId ? action.rootClientId : "" 8503 ]; 8504 newState.tree = new Map(newState.tree); 8505 updateParentInnerBlocksInTree( 8506 newState, 8507 updatedBlockUids, 8508 true 8509 ); 8510 break; 8511 } 8512 case "SAVE_REUSABLE_BLOCK_SUCCESS": { 8513 const updatedBlockUids = []; 8514 newState.attributes.forEach((attributes, clientId) => { 8515 if (newState.byClientId.get(clientId).name === "core/block" && attributes.ref === action.updatedId) { 8516 updatedBlockUids.push(clientId); 8517 } 8518 }); 8519 newState.tree = new Map(newState.tree); 8520 updatedBlockUids.forEach((clientId) => { 8521 newState.tree.set(clientId, { 8522 ...newState.byClientId.get(clientId), 8523 attributes: newState.attributes.get(clientId), 8524 innerBlocks: newState.tree.get(clientId).innerBlocks 8525 }); 8526 }); 8527 updateParentInnerBlocksInTree( 8528 newState, 8529 updatedBlockUids, 8530 false 8531 ); 8532 } 8533 } 8534 return newState; 8535 }; 8536 function withPersistentBlockChange(reducer) { 8537 let lastAction; 8538 let markNextChangeAsNotPersistent = false; 8539 let explicitPersistent; 8540 return (state, action) => { 8541 let nextState = reducer(state, action); 8542 let nextIsPersistentChange; 8543 if (action.type === "SET_EXPLICIT_PERSISTENT") { 8544 explicitPersistent = action.isPersistentChange; 8545 nextIsPersistentChange = state.isPersistentChange ?? true; 8546 } 8547 if (explicitPersistent !== void 0) { 8548 nextIsPersistentChange = explicitPersistent; 8549 return nextIsPersistentChange === nextState.isPersistentChange ? nextState : { 8550 ...nextState, 8551 isPersistentChange: nextIsPersistentChange 8552 }; 8553 } 8554 const isExplicitPersistentChange = action.type === "MARK_LAST_CHANGE_AS_PERSISTENT" || markNextChangeAsNotPersistent; 8555 if (state === nextState && !isExplicitPersistentChange) { 8556 markNextChangeAsNotPersistent = action.type === "MARK_NEXT_CHANGE_AS_NOT_PERSISTENT"; 8557 nextIsPersistentChange = state?.isPersistentChange ?? true; 8558 if (state.isPersistentChange === nextIsPersistentChange) { 8559 return state; 8560 } 8561 return { 8562 ...nextState, 8563 isPersistentChange: nextIsPersistentChange 8564 }; 8565 } 8566 nextState = { 8567 ...nextState, 8568 isPersistentChange: isExplicitPersistentChange ? !markNextChangeAsNotPersistent : !isUpdatingSameBlockAttribute(action, lastAction) 8569 }; 8570 lastAction = action; 8571 markNextChangeAsNotPersistent = action.type === "MARK_NEXT_CHANGE_AS_NOT_PERSISTENT"; 8572 return nextState; 8573 }; 8574 } 8575 function withIgnoredBlockChange(reducer) { 8576 const IGNORED_ACTION_TYPES = /* @__PURE__ */ new Set(["RECEIVE_BLOCKS"]); 8577 return (state, action) => { 8578 const nextState = reducer(state, action); 8579 if (nextState !== state) { 8580 nextState.isIgnoredChange = IGNORED_ACTION_TYPES.has(action.type); 8581 } 8582 return nextState; 8583 }; 8584 } 8585 const withInnerBlocksRemoveCascade = (reducer) => (state, action) => { 8586 const getAllChildren = (clientIds) => { 8587 let result = clientIds; 8588 for (let i = 0; i < result.length; i++) { 8589 if (!state.order.get(result[i]) || action.keepControlledInnerBlocks && action.keepControlledInnerBlocks[result[i]]) { 8590 continue; 8591 } 8592 if (result === clientIds) { 8593 result = [...result]; 8594 } 8595 result.push(...state.order.get(result[i])); 8596 } 8597 return result; 8598 }; 8599 if (state) { 8600 switch (action.type) { 8601 case "REMOVE_BLOCKS": 8602 action = { 8603 ...action, 8604 type: "REMOVE_BLOCKS_AUGMENTED_WITH_CHILDREN", 8605 removedClientIds: getAllChildren(action.clientIds) 8606 }; 8607 break; 8608 case "REPLACE_BLOCKS": 8609 action = { 8610 ...action, 8611 type: "REPLACE_BLOCKS_AUGMENTED_WITH_CHILDREN", 8612 replacedClientIds: getAllChildren(action.clientIds) 8613 }; 8614 break; 8615 } 8616 } 8617 return reducer(state, action); 8618 }; 8619 const withBlockReset = (reducer) => (state, action) => { 8620 if (action.type === "RESET_BLOCKS") { 8621 const newState = { 8622 ...state, 8623 byClientId: new Map( 8624 getFlattenedBlocksWithoutAttributes(action.blocks) 8625 ), 8626 attributes: new Map(getFlattenedBlockAttributes(action.blocks)), 8627 order: mapBlockOrder(action.blocks), 8628 parents: new Map(mapBlockParents(action.blocks)), 8629 controlledInnerBlocks: {} 8630 }; 8631 newState.tree = new Map(state?.tree); 8632 updateBlockTreeForBlocks(newState, action.blocks); 8633 newState.tree.set("", { 8634 innerBlocks: action.blocks.map( 8635 (subBlock) => newState.tree.get(subBlock.clientId) 8636 ) 8637 }); 8638 return newState; 8639 } 8640 return reducer(state, action); 8641 }; 8642 const withReplaceInnerBlocks = (reducer) => (state, action) => { 8643 if (action.type !== "REPLACE_INNER_BLOCKS") { 8644 return reducer(state, action); 8645 } 8646 const nestedControllers = {}; 8647 if (Object.keys(state.controlledInnerBlocks).length) { 8648 const stack = [...action.blocks]; 8649 while (stack.length) { 8650 const { innerBlocks, ...block } = stack.shift(); 8651 stack.push(...innerBlocks); 8652 if (!!state.controlledInnerBlocks[block.clientId]) { 8653 nestedControllers[block.clientId] = true; 8654 } 8655 } 8656 } 8657 let stateAfterBlocksRemoval = state; 8658 if (state.order.get(action.rootClientId)) { 8659 stateAfterBlocksRemoval = reducer(stateAfterBlocksRemoval, { 8660 type: "REMOVE_BLOCKS", 8661 keepControlledInnerBlocks: nestedControllers, 8662 clientIds: state.order.get(action.rootClientId) 8663 }); 8664 } 8665 let stateAfterInsert = stateAfterBlocksRemoval; 8666 if (action.blocks.length) { 8667 stateAfterInsert = reducer(stateAfterInsert, { 8668 ...action, 8669 type: "INSERT_BLOCKS", 8670 index: 0 8671 }); 8672 const stateAfterInsertOrder = new Map(stateAfterInsert.order); 8673 Object.keys(nestedControllers).forEach((key) => { 8674 if (state.order.get(key)) { 8675 stateAfterInsertOrder.set(key, state.order.get(key)); 8676 } 8677 }); 8678 stateAfterInsert.order = stateAfterInsertOrder; 8679 stateAfterInsert.tree = new Map(stateAfterInsert.tree); 8680 Object.keys(nestedControllers).forEach((_key) => { 8681 const key = `controlled||$_key}`; 8682 if (state.tree.has(key)) { 8683 stateAfterInsert.tree.set(key, state.tree.get(key)); 8684 } 8685 }); 8686 } 8687 return stateAfterInsert; 8688 }; 8689 const withSaveReusableBlock = (reducer) => (state, action) => { 8690 if (state && action.type === "SAVE_REUSABLE_BLOCK_SUCCESS") { 8691 const { id, updatedId } = action; 8692 if (id === updatedId) { 8693 return state; 8694 } 8695 state = { ...state }; 8696 state.attributes = new Map(state.attributes); 8697 state.attributes.forEach((attributes, clientId) => { 8698 const { name } = state.byClientId.get(clientId); 8699 if (name === "core/block" && attributes.ref === id) { 8700 state.attributes.set(clientId, { 8701 ...attributes, 8702 ref: updatedId 8703 }); 8704 } 8705 }); 8706 } 8707 return reducer(state, action); 8708 }; 8709 const withResetControlledBlocks = (reducer) => (state, action) => { 8710 if (action.type === "SET_HAS_CONTROLLED_INNER_BLOCKS") { 8711 const tempState = reducer(state, { 8712 type: "REPLACE_INNER_BLOCKS", 8713 rootClientId: action.clientId, 8714 blocks: [] 8715 }); 8716 return reducer(tempState, action); 8717 } 8718 return reducer(state, action); 8719 }; 8720 const blocks = (0,external_wp_compose_namespaceObject.pipe)( 8721 external_wp_data_namespaceObject.combineReducers, 8722 withSaveReusableBlock, 8723 // Needs to be before withBlockCache. 8724 withBlockTree, 8725 // Needs to be before withInnerBlocksRemoveCascade. 8726 withInnerBlocksRemoveCascade, 8727 withReplaceInnerBlocks, 8728 // Needs to be after withInnerBlocksRemoveCascade. 8729 withBlockReset, 8730 withPersistentBlockChange, 8731 withIgnoredBlockChange, 8732 withResetControlledBlocks 8733 )({ 8734 // The state is using a Map instead of a plain object for performance reasons. 8735 // You can run the "./test/performance.js" unit test to check the impact 8736 // code changes can have on this reducer. 8737 byClientId(state = /* @__PURE__ */ new Map(), action) { 8738 switch (action.type) { 8739 case "RECEIVE_BLOCKS": 8740 case "INSERT_BLOCKS": { 8741 const newState = new Map(state); 8742 getFlattenedBlocksWithoutAttributes(action.blocks).forEach( 8743 ([key, value]) => { 8744 newState.set(key, value); 8745 } 8746 ); 8747 return newState; 8748 } 8749 case "UPDATE_BLOCK": { 8750 if (!state.has(action.clientId)) { 8751 return state; 8752 } 8753 const { attributes, ...changes } = action.updates; 8754 if (Object.values(changes).length === 0) { 8755 return state; 8756 } 8757 const newState = new Map(state); 8758 newState.set(action.clientId, { 8759 ...state.get(action.clientId), 8760 ...changes 8761 }); 8762 return newState; 8763 } 8764 case "REPLACE_BLOCKS_AUGMENTED_WITH_CHILDREN": { 8765 if (!action.blocks) { 8766 return state; 8767 } 8768 const newState = new Map(state); 8769 action.replacedClientIds.forEach((clientId) => { 8770 newState.delete(clientId); 8771 }); 8772 getFlattenedBlocksWithoutAttributes(action.blocks).forEach( 8773 ([key, value]) => { 8774 newState.set(key, value); 8775 } 8776 ); 8777 return newState; 8778 } 8779 case "REMOVE_BLOCKS_AUGMENTED_WITH_CHILDREN": { 8780 const newState = new Map(state); 8781 action.removedClientIds.forEach((clientId) => { 8782 newState.delete(clientId); 8783 }); 8784 return newState; 8785 } 8786 } 8787 return state; 8788 }, 8789 // The state is using a Map instead of a plain object for performance reasons. 8790 // You can run the "./test/performance.js" unit test to check the impact 8791 // code changes can have on this reducer. 8792 attributes(state = /* @__PURE__ */ new Map(), action) { 8793 switch (action.type) { 8794 case "RECEIVE_BLOCKS": 8795 case "INSERT_BLOCKS": { 8796 const newState = new Map(state); 8797 getFlattenedBlockAttributes(action.blocks).forEach( 8798 ([key, value]) => { 8799 newState.set(key, value); 8800 } 8801 ); 8802 return newState; 8803 } 8804 case "UPDATE_BLOCK": { 8805 if (!state.get(action.clientId) || !action.updates.attributes) { 8806 return state; 8807 } 8808 const newState = new Map(state); 8809 newState.set(action.clientId, { 8810 ...state.get(action.clientId), 8811 ...action.updates.attributes 8812 }); 8813 return newState; 8814 } 8815 case "SYNC_DERIVED_BLOCK_ATTRIBUTES": 8816 case "UPDATE_BLOCK_ATTRIBUTES": { 8817 if (action.clientIds.every((id) => !state.get(id))) { 8818 return state; 8819 } 8820 let hasChange = false; 8821 const newState = new Map(state); 8822 for (const clientId of action.clientIds) { 8823 const updatedAttributeEntries = Object.entries( 8824 !!action.options?.uniqueByBlock ? action.attributes[clientId] : action.attributes ?? {} 8825 ); 8826 if (updatedAttributeEntries.length === 0) { 8827 continue; 8828 } 8829 let hasUpdatedAttributes = false; 8830 const existingAttributes = state.get(clientId); 8831 const newAttributes = {}; 8832 updatedAttributeEntries.forEach(([key, value]) => { 8833 if (existingAttributes[key] !== value) { 8834 hasUpdatedAttributes = true; 8835 newAttributes[key] = value; 8836 } 8837 }); 8838 hasChange = hasChange || hasUpdatedAttributes; 8839 if (hasUpdatedAttributes) { 8840 newState.set(clientId, { 8841 ...existingAttributes, 8842 ...newAttributes 8843 }); 8844 } 8845 } 8846 return hasChange ? newState : state; 8847 } 8848 case "REPLACE_BLOCKS_AUGMENTED_WITH_CHILDREN": { 8849 if (!action.blocks) { 8850 return state; 8851 } 8852 const newState = new Map(state); 8853 action.replacedClientIds.forEach((clientId) => { 8854 newState.delete(clientId); 8855 }); 8856 getFlattenedBlockAttributes(action.blocks).forEach( 8857 ([key, value]) => { 8858 newState.set(key, value); 8859 } 8860 ); 8861 return newState; 8862 } 8863 case "REMOVE_BLOCKS_AUGMENTED_WITH_CHILDREN": { 8864 const newState = new Map(state); 8865 action.removedClientIds.forEach((clientId) => { 8866 newState.delete(clientId); 8867 }); 8868 return newState; 8869 } 8870 } 8871 return state; 8872 }, 8873 // The state is using a Map instead of a plain object for performance reasons. 8874 // You can run the "./test/performance.js" unit test to check the impact 8875 // code changes can have on this reducer. 8876 order(state = /* @__PURE__ */ new Map(), action) { 8877 switch (action.type) { 8878 case "RECEIVE_BLOCKS": { 8879 const blockOrder = mapBlockOrder(action.blocks); 8880 const newState = new Map(state); 8881 blockOrder.forEach((order, clientId) => { 8882 if (clientId !== "") { 8883 newState.set(clientId, order); 8884 } 8885 }); 8886 newState.set( 8887 "", 8888 (state.get("") ?? []).concat(blockOrder[""]) 8889 ); 8890 return newState; 8891 } 8892 case "INSERT_BLOCKS": { 8893 const { rootClientId = "" } = action; 8894 const subState = state.get(rootClientId) || []; 8895 const mappedBlocks = mapBlockOrder( 8896 action.blocks, 8897 rootClientId 8898 ); 8899 const { index = subState.length } = action; 8900 const newState = new Map(state); 8901 mappedBlocks.forEach((order, clientId) => { 8902 newState.set(clientId, order); 8903 }); 8904 newState.set( 8905 rootClientId, 8906 insertAt( 8907 subState, 8908 mappedBlocks.get(rootClientId), 8909 index 8910 ) 8911 ); 8912 return newState; 8913 } 8914 case "MOVE_BLOCKS_TO_POSITION": { 8915 const { 8916 fromRootClientId = "", 8917 toRootClientId = "", 8918 clientIds 8919 } = action; 8920 const { index = state.get(toRootClientId).length } = action; 8921 if (fromRootClientId === toRootClientId) { 8922 const subState = state.get(toRootClientId); 8923 const fromIndex = subState.indexOf(clientIds[0]); 8924 const newState2 = new Map(state); 8925 newState2.set( 8926 toRootClientId, 8927 moveTo( 8928 state.get(toRootClientId), 8929 fromIndex, 8930 index, 8931 clientIds.length 8932 ) 8933 ); 8934 return newState2; 8935 } 8936 const newState = new Map(state); 8937 newState.set( 8938 fromRootClientId, 8939 state.get(fromRootClientId)?.filter((id) => !clientIds.includes(id)) ?? [] 8940 ); 8941 newState.set( 8942 toRootClientId, 8943 insertAt(state.get(toRootClientId), clientIds, index) 8944 ); 8945 return newState; 8946 } 8947 case "MOVE_BLOCKS_UP": { 8948 const { clientIds, rootClientId = "" } = action; 8949 const firstClientId = clientIds[0]; 8950 const subState = state.get(rootClientId); 8951 if (!subState.length || firstClientId === subState[0]) { 8952 return state; 8953 } 8954 const firstIndex = subState.indexOf(firstClientId); 8955 const newState = new Map(state); 8956 newState.set( 8957 rootClientId, 8958 moveTo( 8959 subState, 8960 firstIndex, 8961 firstIndex - 1, 8962 clientIds.length 8963 ) 8964 ); 8965 return newState; 8966 } 8967 case "MOVE_BLOCKS_DOWN": { 8968 const { clientIds, rootClientId = "" } = action; 8969 const firstClientId = clientIds[0]; 8970 const lastClientId = clientIds[clientIds.length - 1]; 8971 const subState = state.get(rootClientId); 8972 if (!subState.length || lastClientId === subState[subState.length - 1]) { 8973 return state; 8974 } 8975 const firstIndex = subState.indexOf(firstClientId); 8976 const newState = new Map(state); 8977 newState.set( 8978 rootClientId, 8979 moveTo( 8980 subState, 8981 firstIndex, 8982 firstIndex + 1, 8983 clientIds.length 8984 ) 8985 ); 8986 return newState; 8987 } 8988 case "REPLACE_BLOCKS_AUGMENTED_WITH_CHILDREN": { 8989 const { clientIds } = action; 8990 if (!action.blocks) { 8991 return state; 8992 } 8993 const mappedBlocks = mapBlockOrder(action.blocks); 8994 const newState = new Map(state); 8995 action.replacedClientIds.forEach((clientId) => { 8996 newState.delete(clientId); 8997 }); 8998 mappedBlocks.forEach((order, clientId) => { 8999 if (clientId !== "") { 9000 newState.set(clientId, order); 9001 } 9002 }); 9003 newState.forEach((order, clientId) => { 9004 const newSubOrder = Object.values(order).reduce( 9005 (result, subClientId) => { 9006 if (subClientId === clientIds[0]) { 9007 return [...result, ...mappedBlocks.get("")]; 9008 } 9009 if (clientIds.indexOf(subClientId) === -1) { 9010 result.push(subClientId); 9011 } 9012 return result; 9013 }, 9014 [] 9015 ); 9016 newState.set(clientId, newSubOrder); 9017 }); 9018 return newState; 9019 } 9020 case "REMOVE_BLOCKS_AUGMENTED_WITH_CHILDREN": { 9021 const newState = new Map(state); 9022 action.removedClientIds.forEach((clientId) => { 9023 newState.delete(clientId); 9024 }); 9025 newState.forEach((order, clientId) => { 9026 const newSubOrder = order?.filter( 9027 (id) => !action.removedClientIds.includes(id) 9028 ) ?? []; 9029 if (newSubOrder.length !== order.length) { 9030 newState.set(clientId, newSubOrder); 9031 } 9032 }); 9033 return newState; 9034 } 9035 } 9036 return state; 9037 }, 9038 // While technically redundant data as the inverse of `order`, it serves as 9039 // an optimization for the selectors which derive the ancestry of a block. 9040 parents(state = /* @__PURE__ */ new Map(), action) { 9041 switch (action.type) { 9042 case "RECEIVE_BLOCKS": { 9043 const newState = new Map(state); 9044 mapBlockParents(action.blocks).forEach( 9045 ([key, value]) => { 9046 newState.set(key, value); 9047 } 9048 ); 9049 return newState; 9050 } 9051 case "INSERT_BLOCKS": { 9052 const newState = new Map(state); 9053 mapBlockParents( 9054 action.blocks, 9055 action.rootClientId || "" 9056 ).forEach(([key, value]) => { 9057 newState.set(key, value); 9058 }); 9059 return newState; 9060 } 9061 case "MOVE_BLOCKS_TO_POSITION": { 9062 const newState = new Map(state); 9063 action.clientIds.forEach((id) => { 9064 newState.set(id, action.toRootClientId || ""); 9065 }); 9066 return newState; 9067 } 9068 case "REPLACE_BLOCKS_AUGMENTED_WITH_CHILDREN": { 9069 const newState = new Map(state); 9070 action.replacedClientIds.forEach((clientId) => { 9071 newState.delete(clientId); 9072 }); 9073 mapBlockParents( 9074 action.blocks, 9075 state.get(action.clientIds[0]) 9076 ).forEach(([key, value]) => { 9077 newState.set(key, value); 9078 }); 9079 return newState; 9080 } 9081 case "REMOVE_BLOCKS_AUGMENTED_WITH_CHILDREN": { 9082 const newState = new Map(state); 9083 action.removedClientIds.forEach((clientId) => { 9084 newState.delete(clientId); 9085 }); 9086 return newState; 9087 } 9088 } 9089 return state; 9090 }, 9091 controlledInnerBlocks(state = {}, { type, clientId, hasControlledInnerBlocks }) { 9092 if (type === "SET_HAS_CONTROLLED_INNER_BLOCKS") { 9093 return { 9094 ...state, 9095 [clientId]: hasControlledInnerBlocks 9096 }; 9097 } 9098 return state; 9099 } 9100 }); 9101 function isBlockInterfaceHidden(state = false, action) { 9102 switch (action.type) { 9103 case "HIDE_BLOCK_INTERFACE": 9104 return true; 9105 case "SHOW_BLOCK_INTERFACE": 9106 return false; 9107 } 9108 return state; 9109 } 9110 function isTyping(state = false, action) { 9111 switch (action.type) { 9112 case "START_TYPING": 9113 return true; 9114 case "STOP_TYPING": 9115 return false; 9116 } 9117 return state; 9118 } 9119 function isDragging(state = false, action) { 9120 switch (action.type) { 9121 case "START_DRAGGING": 9122 return true; 9123 case "STOP_DRAGGING": 9124 return false; 9125 } 9126 return state; 9127 } 9128 function draggedBlocks(state = [], action) { 9129 switch (action.type) { 9130 case "START_DRAGGING_BLOCKS": 9131 return action.clientIds; 9132 case "STOP_DRAGGING_BLOCKS": 9133 return []; 9134 } 9135 return state; 9136 } 9137 function blockVisibility(state = {}, action) { 9138 if (action.type === "SET_BLOCK_VISIBILITY") { 9139 return { 9140 ...state, 9141 ...action.updates 9142 }; 9143 } 9144 return state; 9145 } 9146 function selectionHelper(state = {}, action) { 9147 switch (action.type) { 9148 case "CLEAR_SELECTED_BLOCK": { 9149 if (state.clientId) { 9150 return {}; 9151 } 9152 return state; 9153 } 9154 case "SELECT_BLOCK": 9155 if (action.clientId === state.clientId) { 9156 return state; 9157 } 9158 return { clientId: action.clientId }; 9159 case "REPLACE_INNER_BLOCKS": 9160 case "INSERT_BLOCKS": { 9161 if (!action.updateSelection || !action.blocks.length) { 9162 return state; 9163 } 9164 return { clientId: action.blocks[0].clientId }; 9165 } 9166 case "REMOVE_BLOCKS": 9167 if (!action.clientIds || !action.clientIds.length || action.clientIds.indexOf(state.clientId) === -1) { 9168 return state; 9169 } 9170 return {}; 9171 case "REPLACE_BLOCKS": { 9172 if (action.clientIds.indexOf(state.clientId) === -1) { 9173 return state; 9174 } 9175 const blockToSelect = action.blocks[action.indexToSelect] || action.blocks[action.blocks.length - 1]; 9176 if (!blockToSelect) { 9177 return {}; 9178 } 9179 if (blockToSelect.clientId === state.clientId) { 9180 return state; 9181 } 9182 return { clientId: blockToSelect.clientId }; 9183 } 9184 } 9185 return state; 9186 } 9187 function selection(state = {}, action) { 9188 switch (action.type) { 9189 case "SELECTION_CHANGE": 9190 if (action.clientId) { 9191 return { 9192 selectionStart: { 9193 clientId: action.clientId, 9194 attributeKey: action.attributeKey, 9195 offset: action.startOffset 9196 }, 9197 selectionEnd: { 9198 clientId: action.clientId, 9199 attributeKey: action.attributeKey, 9200 offset: action.endOffset 9201 } 9202 }; 9203 } 9204 return { 9205 selectionStart: action.start || state.selectionStart, 9206 selectionEnd: action.end || state.selectionEnd 9207 }; 9208 case "RESET_SELECTION": 9209 const { selectionStart: selectionStart2, selectionEnd: selectionEnd2 } = action; 9210 return { 9211 selectionStart: selectionStart2, 9212 selectionEnd: selectionEnd2 9213 }; 9214 case "MULTI_SELECT": 9215 const { start, end } = action; 9216 if (start === state.selectionStart?.clientId && end === state.selectionEnd?.clientId) { 9217 return state; 9218 } 9219 return { 9220 selectionStart: { clientId: start }, 9221 selectionEnd: { clientId: end } 9222 }; 9223 case "RESET_BLOCKS": 9224 const startClientId = state?.selectionStart?.clientId; 9225 const endClientId = state?.selectionEnd?.clientId; 9226 if (!startClientId && !endClientId) { 9227 return state; 9228 } 9229 if (!action.blocks.some( 9230 (block) => block.clientId === startClientId 9231 )) { 9232 return { 9233 selectionStart: {}, 9234 selectionEnd: {} 9235 }; 9236 } 9237 if (!action.blocks.some( 9238 (block) => block.clientId === endClientId 9239 )) { 9240 return { 9241 ...state, 9242 selectionEnd: state.selectionStart 9243 }; 9244 } 9245 } 9246 const selectionStart = selectionHelper(state.selectionStart, action); 9247 const selectionEnd = selectionHelper(state.selectionEnd, action); 9248 if (selectionStart === state.selectionStart && selectionEnd === state.selectionEnd) { 9249 return state; 9250 } 9251 return { 9252 selectionStart, 9253 selectionEnd 9254 }; 9255 } 9256 function isMultiSelecting(state = false, action) { 9257 switch (action.type) { 9258 case "START_MULTI_SELECT": 9259 return true; 9260 case "STOP_MULTI_SELECT": 9261 return false; 9262 } 9263 return state; 9264 } 9265 function isSelectionEnabled(state = true, action) { 9266 switch (action.type) { 9267 case "TOGGLE_SELECTION": 9268 return action.isSelectionEnabled; 9269 } 9270 return state; 9271 } 9272 function removalPromptData(state = false, action) { 9273 switch (action.type) { 9274 case "DISPLAY_BLOCK_REMOVAL_PROMPT": 9275 const { clientIds, selectPrevious, message } = action; 9276 return { 9277 clientIds, 9278 selectPrevious, 9279 message 9280 }; 9281 case "CLEAR_BLOCK_REMOVAL_PROMPT": 9282 return false; 9283 } 9284 return state; 9285 } 9286 function blockRemovalRules(state = false, action) { 9287 switch (action.type) { 9288 case "SET_BLOCK_REMOVAL_RULES": 9289 return action.rules; 9290 } 9291 return state; 9292 } 9293 function initialPosition(state = null, action) { 9294 if (action.type === "REPLACE_BLOCKS" && action.initialPosition !== void 0) { 9295 return action.initialPosition; 9296 } else if ([ 9297 "MULTI_SELECT", 9298 "SELECT_BLOCK", 9299 "RESET_SELECTION", 9300 "INSERT_BLOCKS", 9301 "REPLACE_INNER_BLOCKS" 9302 ].includes(action.type)) { 9303 return action.initialPosition; 9304 } 9305 return state; 9306 } 9307 function blocksMode(state = {}, action) { 9308 if (action.type === "TOGGLE_BLOCK_MODE") { 9309 const { clientId } = action; 9310 return { 9311 ...state, 9312 [clientId]: state[clientId] && state[clientId] === "html" ? "visual" : "html" 9313 }; 9314 } 9315 return state; 9316 } 9317 function insertionCue(state = null, action) { 9318 switch (action.type) { 9319 case "SHOW_INSERTION_POINT": { 9320 const { 9321 rootClientId, 9322 index, 9323 __unstableWithInserter, 9324 operation, 9325 nearestSide 9326 } = action; 9327 const nextState = { 9328 rootClientId, 9329 index, 9330 __unstableWithInserter, 9331 operation, 9332 nearestSide 9333 }; 9334 return es6_default()(state, nextState) ? state : nextState; 9335 } 9336 case "HIDE_INSERTION_POINT": 9337 return null; 9338 } 9339 return state; 9340 } 9341 function template(state = { isValid: true }, action) { 9342 switch (action.type) { 9343 case "SET_TEMPLATE_VALIDITY": 9344 return { 9345 ...state, 9346 isValid: action.isValid 9347 }; 9348 } 9349 return state; 9350 } 9351 function settings(state = SETTINGS_DEFAULTS, action) { 9352 switch (action.type) { 9353 case "UPDATE_SETTINGS": { 9354 const updatedSettings = action.reset ? { 9355 ...SETTINGS_DEFAULTS, 9356 ...action.settings 9357 } : { 9358 ...state, 9359 ...action.settings 9360 }; 9361 Object.defineProperty(updatedSettings, "__unstableIsPreviewMode", { 9362 get() { 9363 external_wp_deprecated_default()("__unstableIsPreviewMode", { 9364 since: "6.8", 9365 alternative: "isPreviewMode" 9366 }); 9367 return this.isPreviewMode; 9368 } 9369 }); 9370 return updatedSettings; 9371 } 9372 } 9373 return state; 9374 } 9375 function preferences(state = PREFERENCES_DEFAULTS, action) { 9376 switch (action.type) { 9377 case "INSERT_BLOCKS": 9378 case "REPLACE_BLOCKS": { 9379 const nextInsertUsage = action.blocks.reduce( 9380 (prevUsage, block) => { 9381 const { attributes, name: blockName } = block; 9382 let id = blockName; 9383 const match = (0,external_wp_data_namespaceObject.select)(external_wp_blocks_namespaceObject.store).getActiveBlockVariation( 9384 blockName, 9385 attributes 9386 ); 9387 if (match?.name) { 9388 id += "/" + match.name; 9389 } 9390 if (blockName === "core/block") { 9391 id += "/" + attributes.ref; 9392 } 9393 return { 9394 ...prevUsage, 9395 [id]: { 9396 time: action.time, 9397 count: prevUsage[id] ? prevUsage[id].count + 1 : 1 9398 } 9399 }; 9400 }, 9401 state.insertUsage 9402 ); 9403 return { 9404 ...state, 9405 insertUsage: nextInsertUsage 9406 }; 9407 } 9408 } 9409 return state; 9410 } 9411 const blockListSettings = (state = {}, action) => { 9412 switch (action.type) { 9413 // Even if the replaced blocks have the same client ID, our logic 9414 // should correct the state. 9415 case "REPLACE_BLOCKS": 9416 case "REMOVE_BLOCKS": { 9417 return Object.fromEntries( 9418 Object.entries(state).filter( 9419 ([id]) => !action.clientIds.includes(id) 9420 ) 9421 ); 9422 } 9423 case "UPDATE_BLOCK_LIST_SETTINGS": { 9424 const updates = typeof action.clientId === "string" ? { [action.clientId]: action.settings } : action.clientId; 9425 for (const clientId in updates) { 9426 if (!updates[clientId]) { 9427 if (!state[clientId]) { 9428 delete updates[clientId]; 9429 } 9430 } else if (es6_default()(state[clientId], updates[clientId])) { 9431 delete updates[clientId]; 9432 } 9433 } 9434 if (Object.keys(updates).length === 0) { 9435 return state; 9436 } 9437 const merged = { ...state, ...updates }; 9438 for (const clientId in updates) { 9439 if (!updates[clientId]) { 9440 delete merged[clientId]; 9441 } 9442 } 9443 return merged; 9444 } 9445 } 9446 return state; 9447 }; 9448 function lastBlockAttributesChange(state = null, action) { 9449 switch (action.type) { 9450 case "UPDATE_BLOCK": 9451 if (!action.updates.attributes) { 9452 break; 9453 } 9454 return { [action.clientId]: action.updates.attributes }; 9455 case "UPDATE_BLOCK_ATTRIBUTES": 9456 return action.clientIds.reduce( 9457 (accumulator, id) => ({ 9458 ...accumulator, 9459 [id]: !!action.options?.uniqueByBlock ? action.attributes[id] : action.attributes 9460 }), 9461 {} 9462 ); 9463 } 9464 return state; 9465 } 9466 function highlightedBlock(state, action) { 9467 switch (action.type) { 9468 case "TOGGLE_BLOCK_HIGHLIGHT": 9469 const { clientId, isHighlighted } = action; 9470 if (isHighlighted) { 9471 return clientId; 9472 } else if (state === clientId) { 9473 return null; 9474 } 9475 return state; 9476 case "SELECT_BLOCK": 9477 if (action.clientId !== state) { 9478 return null; 9479 } 9480 } 9481 return state; 9482 } 9483 function hasBlockSpotlight(state, action) { 9484 switch (action.type) { 9485 case "TOGGLE_BLOCK_SPOTLIGHT": 9486 const { clientId, hasBlockSpotlight: _hasBlockSpotlight } = action; 9487 if (_hasBlockSpotlight) { 9488 return clientId; 9489 } else if (state === clientId) { 9490 return null; 9491 } 9492 return state; 9493 case "SELECT_BLOCK": 9494 if (action.clientId !== state) { 9495 return null; 9496 } 9497 return state; 9498 case "SELECTION_CHANGE": 9499 if (action.start?.clientId !== state || action.end?.clientId !== state) { 9500 return null; 9501 } 9502 return state; 9503 case "CLEAR_SELECTED_BLOCK": 9504 return null; 9505 } 9506 return state; 9507 } 9508 function expandedBlock(state = null, action) { 9509 switch (action.type) { 9510 case "SET_BLOCK_EXPANDED_IN_LIST_VIEW": 9511 return action.clientId; 9512 case "SELECT_BLOCK": 9513 if (action.clientId !== state) { 9514 return null; 9515 } 9516 } 9517 return state; 9518 } 9519 function lastBlockInserted(state = {}, action) { 9520 switch (action.type) { 9521 case "INSERT_BLOCKS": 9522 case "REPLACE_BLOCKS": 9523 if (!action.blocks.length) { 9524 return state; 9525 } 9526 const clientIds = action.blocks.map((block) => { 9527 return block.clientId; 9528 }); 9529 const source = action.meta?.source; 9530 return { clientIds, source }; 9531 case "RESET_BLOCKS": 9532 return {}; 9533 } 9534 return state; 9535 } 9536 function temporarilyEditingAsBlocks(state = "", action) { 9537 if (action.type === "SET_TEMPORARILY_EDITING_AS_BLOCKS") { 9538 return action.temporarilyEditingAsBlocks; 9539 } 9540 return state; 9541 } 9542 function temporarilyEditingFocusModeRevert(state = "", action) { 9543 if (action.type === "SET_TEMPORARILY_EDITING_AS_BLOCKS") { 9544 return action.focusModeToRevert; 9545 } 9546 return state; 9547 } 9548 function blockEditingModes(state = /* @__PURE__ */ new Map(), action) { 9549 switch (action.type) { 9550 case "SET_BLOCK_EDITING_MODE": 9551 if (state.get(action.clientId) === action.mode) { 9552 return state; 9553 } 9554 return new Map(state).set(action.clientId, action.mode); 9555 case "UNSET_BLOCK_EDITING_MODE": { 9556 if (!state.has(action.clientId)) { 9557 return state; 9558 } 9559 const newState = new Map(state); 9560 newState.delete(action.clientId); 9561 return newState; 9562 } 9563 case "RESET_BLOCKS": { 9564 return state.has("") ? (/* @__PURE__ */ new Map()).set("", state.get("")) : state; 9565 } 9566 } 9567 return state; 9568 } 9569 function openedBlockSettingsMenu(state = null, action) { 9570 if ("SET_OPENED_BLOCK_SETTINGS_MENU" === action.type) { 9571 return action?.clientId ?? null; 9572 } 9573 return state; 9574 } 9575 function styleOverrides(state = /* @__PURE__ */ new Map(), action) { 9576 switch (action.type) { 9577 case "SET_STYLE_OVERRIDE": 9578 return new Map(state).set(action.id, action.style); 9579 case "DELETE_STYLE_OVERRIDE": { 9580 const newState = new Map(state); 9581 newState.delete(action.id); 9582 return newState; 9583 } 9584 } 9585 return state; 9586 } 9587 function registeredInserterMediaCategories(state = [], action) { 9588 switch (action.type) { 9589 case "REGISTER_INSERTER_MEDIA_CATEGORY": 9590 return [...state, action.category]; 9591 } 9592 return state; 9593 } 9594 function lastFocus(state = false, action) { 9595 switch (action.type) { 9596 case "LAST_FOCUS": 9597 return action.lastFocus; 9598 } 9599 return state; 9600 } 9601 function zoomLevel(state = 100, action) { 9602 switch (action.type) { 9603 case "SET_ZOOM_LEVEL": 9604 return action.zoom; 9605 case "RESET_ZOOM_LEVEL": 9606 return 100; 9607 } 9608 return state; 9609 } 9610 function insertionPoint(state = null, action) { 9611 switch (action.type) { 9612 case "SET_INSERTION_POINT": 9613 return action.value; 9614 case "SELECT_BLOCK": 9615 return null; 9616 } 9617 return state; 9618 } 9619 const combinedReducers = (0,external_wp_data_namespaceObject.combineReducers)({ 9620 blocks, 9621 isDragging, 9622 isTyping, 9623 isBlockInterfaceHidden, 9624 draggedBlocks, 9625 selection, 9626 isMultiSelecting, 9627 isSelectionEnabled, 9628 initialPosition, 9629 blocksMode, 9630 blockListSettings, 9631 insertionPoint, 9632 insertionCue, 9633 template, 9634 settings, 9635 preferences, 9636 lastBlockAttributesChange, 9637 lastFocus, 9638 expandedBlock, 9639 highlightedBlock, 9640 lastBlockInserted, 9641 temporarilyEditingAsBlocks, 9642 temporarilyEditingFocusModeRevert, 9643 blockVisibility, 9644 blockEditingModes, 9645 styleOverrides, 9646 removalPromptData, 9647 blockRemovalRules, 9648 openedBlockSettingsMenu, 9649 registeredInserterMediaCategories, 9650 zoomLevel, 9651 hasBlockSpotlight 9652 }); 9653 function getBlockTreeBlock(state, clientId) { 9654 if (clientId === "") { 9655 const rootBlock = state.blocks.tree.get(clientId); 9656 if (!rootBlock) { 9657 return; 9658 } 9659 return { 9660 clientId: "", 9661 ...rootBlock 9662 }; 9663 } 9664 if (!state.blocks.controlledInnerBlocks[clientId]) { 9665 return state.blocks.tree.get(clientId); 9666 } 9667 const controlledTree = state.blocks.tree.get(`controlled||$clientId}`); 9668 const regularTree = state.blocks.tree.get(clientId); 9669 return { 9670 ...regularTree, 9671 innerBlocks: controlledTree?.innerBlocks 9672 }; 9673 } 9674 function traverseBlockTree(state, clientId, callback) { 9675 const tree = getBlockTreeBlock(state, clientId); 9676 if (!tree) { 9677 return; 9678 } 9679 callback(tree); 9680 if (!tree?.innerBlocks?.length) { 9681 return; 9682 } 9683 for (const innerBlock of tree?.innerBlocks) { 9684 traverseBlockTree(state, innerBlock.clientId, callback); 9685 } 9686 } 9687 function findParentInClientIdsList(state, clientId, clientIds) { 9688 if (!clientIds.length) { 9689 return; 9690 } 9691 let parent = state.blocks.parents.get(clientId); 9692 while (parent !== void 0) { 9693 if (clientIds.includes(parent)) { 9694 return parent; 9695 } 9696 parent = state.blocks.parents.get(parent); 9697 } 9698 } 9699 function hasBindings(block) { 9700 return block?.attributes?.metadata?.bindings && Object.keys(block?.attributes?.metadata?.bindings).length; 9701 } 9702 function getDerivedBlockEditingModesForTree(state, treeClientId = "") { 9703 const isZoomedOut = state?.zoomLevel < 100 || state?.zoomLevel === "auto-scaled"; 9704 const derivedBlockEditingModes = /* @__PURE__ */ new Map(); 9705 const sectionRootClientId = state.settings?.[sectionRootClientIdKey]; 9706 const sectionClientIds = state.blocks.order.get(sectionRootClientId); 9707 const hasDisabledBlocks = Array.from(state.blockEditingModes).some( 9708 ([, mode]) => mode === "disabled" 9709 ); 9710 const templatePartClientIds = []; 9711 const syncedPatternClientIds = []; 9712 Object.keys(state.blocks.controlledInnerBlocks).forEach((clientId) => { 9713 const block = state.blocks.byClientId?.get(clientId); 9714 if (block?.name === "core/template-part") { 9715 templatePartClientIds.push(clientId); 9716 } 9717 if (block?.name === "core/block") { 9718 syncedPatternClientIds.push(clientId); 9719 } 9720 }); 9721 const contentOnlyTemplateLockedClientIds = Object.keys( 9722 state.blockListSettings 9723 ).filter( 9724 (clientId) => state.blockListSettings[clientId]?.templateLock === "contentOnly" 9725 ); 9726 const unsyncedPatternClientIds = !!window?.__experimentalContentOnlyPatternInsertion ? Array.from(state.blocks.attributes.keys()).filter( 9727 (clientId) => state.blocks.attributes.get(clientId)?.metadata?.patternName 9728 ) : []; 9729 const contentOnlyParents = [ 9730 ...contentOnlyTemplateLockedClientIds, 9731 ...unsyncedPatternClientIds, 9732 ...window?.__experimentalContentOnlyPatternInsertion ? templatePartClientIds : [] 9733 ]; 9734 traverseBlockTree(state, treeClientId, (block) => { 9735 const { clientId, name: blockName } = block; 9736 if (state.blockEditingModes.has(clientId)) { 9737 return; 9738 } 9739 if (hasDisabledBlocks) { 9740 let ancestorBlockEditingMode; 9741 let parent = state.blocks.parents.get(clientId); 9742 while (parent !== void 0) { 9743 if (state.blockEditingModes.has(parent)) { 9744 ancestorBlockEditingMode = state.blockEditingModes.get(parent); 9745 } 9746 if (ancestorBlockEditingMode) { 9747 break; 9748 } 9749 parent = state.blocks.parents.get(parent); 9750 } 9751 if (ancestorBlockEditingMode === "disabled") { 9752 derivedBlockEditingModes.set(clientId, "disabled"); 9753 return; 9754 } 9755 } 9756 if (isZoomedOut) { 9757 if (clientId === sectionRootClientId) { 9758 derivedBlockEditingModes.set(clientId, "contentOnly"); 9759 return; 9760 } 9761 if (!sectionClientIds?.length) { 9762 derivedBlockEditingModes.set(clientId, "disabled"); 9763 return; 9764 } 9765 if (sectionClientIds.includes(clientId)) { 9766 derivedBlockEditingModes.set(clientId, "contentOnly"); 9767 return; 9768 } 9769 derivedBlockEditingModes.set(clientId, "disabled"); 9770 return; 9771 } 9772 if (syncedPatternClientIds.length) { 9773 if (syncedPatternClientIds.includes(clientId)) { 9774 if (findParentInClientIdsList( 9775 state, 9776 clientId, 9777 syncedPatternClientIds 9778 )) { 9779 derivedBlockEditingModes.set(clientId, "disabled"); 9780 return; 9781 } 9782 return; 9783 } 9784 const parentPatternClientId = findParentInClientIdsList( 9785 state, 9786 clientId, 9787 syncedPatternClientIds 9788 ); 9789 if (parentPatternClientId) { 9790 if (findParentInClientIdsList( 9791 state, 9792 parentPatternClientId, 9793 syncedPatternClientIds 9794 )) { 9795 derivedBlockEditingModes.set(clientId, "disabled"); 9796 return; 9797 } 9798 if (hasBindings(block)) { 9799 derivedBlockEditingModes.set(clientId, "contentOnly"); 9800 return; 9801 } 9802 derivedBlockEditingModes.set(clientId, "disabled"); 9803 } 9804 } 9805 if (contentOnlyParents.length) { 9806 const hasContentOnlyParent = !!findParentInClientIdsList( 9807 state, 9808 clientId, 9809 contentOnlyParents 9810 ); 9811 if (hasContentOnlyParent) { 9812 if (isContentBlock(blockName)) { 9813 derivedBlockEditingModes.set(clientId, "contentOnly"); 9814 } else { 9815 derivedBlockEditingModes.set(clientId, "disabled"); 9816 } 9817 } 9818 } 9819 }); 9820 return derivedBlockEditingModes; 9821 } 9822 function getDerivedBlockEditingModesUpdates({ 9823 prevState, 9824 nextState, 9825 addedBlocks, 9826 removedClientIds 9827 }) { 9828 const prevDerivedBlockEditingModes = prevState.derivedBlockEditingModes; 9829 let nextDerivedBlockEditingModes; 9830 removedClientIds?.forEach((clientId) => { 9831 traverseBlockTree(prevState, clientId, (block) => { 9832 if (prevDerivedBlockEditingModes.has(block.clientId)) { 9833 if (!nextDerivedBlockEditingModes) { 9834 nextDerivedBlockEditingModes = new Map( 9835 prevDerivedBlockEditingModes 9836 ); 9837 } 9838 nextDerivedBlockEditingModes.delete(block.clientId); 9839 } 9840 }); 9841 }); 9842 addedBlocks?.forEach((addedBlock) => { 9843 const updates = getDerivedBlockEditingModesForTree( 9844 nextState, 9845 addedBlock.clientId 9846 ); 9847 if (updates.size) { 9848 if (!nextDerivedBlockEditingModes) { 9849 nextDerivedBlockEditingModes = new Map([ 9850 ...prevDerivedBlockEditingModes?.size ? prevDerivedBlockEditingModes : [], 9851 ...updates 9852 ]); 9853 } else { 9854 nextDerivedBlockEditingModes = new Map([ 9855 ...nextDerivedBlockEditingModes?.size ? nextDerivedBlockEditingModes : [], 9856 ...updates 9857 ]); 9858 } 9859 } 9860 }); 9861 return nextDerivedBlockEditingModes; 9862 } 9863 function withDerivedBlockEditingModes(reducer) { 9864 return (state, action) => { 9865 const nextState = reducer(state, action); 9866 if (action.type !== "SET_EDITOR_MODE" && nextState === state) { 9867 return state; 9868 } 9869 switch (action.type) { 9870 case "REMOVE_BLOCKS": { 9871 const nextDerivedBlockEditingModes = getDerivedBlockEditingModesUpdates({ 9872 prevState: state, 9873 nextState, 9874 removedClientIds: action.clientIds 9875 }); 9876 if (nextDerivedBlockEditingModes) { 9877 return { 9878 ...nextState, 9879 derivedBlockEditingModes: nextDerivedBlockEditingModes ?? state.derivedBlockEditingModes 9880 }; 9881 } 9882 break; 9883 } 9884 case "RECEIVE_BLOCKS": 9885 case "INSERT_BLOCKS": { 9886 const nextDerivedBlockEditingModes = getDerivedBlockEditingModesUpdates({ 9887 prevState: state, 9888 nextState, 9889 addedBlocks: action.blocks 9890 }); 9891 if (nextDerivedBlockEditingModes) { 9892 return { 9893 ...nextState, 9894 derivedBlockEditingModes: nextDerivedBlockEditingModes ?? state.derivedBlockEditingModes 9895 }; 9896 } 9897 break; 9898 } 9899 case "UPDATE_BLOCK_ATTRIBUTES": { 9900 const addedBlocks = []; 9901 const removedClientIds = []; 9902 for (const clientId of action?.clientIds) { 9903 const attributes = action.options?.uniqueByBlock ? action.attributes[clientId] : action.attributes; 9904 if (!attributes) { 9905 break; 9906 } 9907 if ( 9908 // patternName is switching from falsy to truthy, indicating 9909 // this block is becoming an unsynced pattern. 9910 attributes.metadata?.patternName && !state.blocks.attributes.get(clientId)?.metadata?.patternName 9911 ) { 9912 addedBlocks.push( 9913 nextState.blocks.tree.get(clientId) 9914 ); 9915 } else if ( 9916 // patternName is switching from truthy to falsy, this block is becoming 9917 // a regular block but was an unsynced pattern. 9918 // Check that `metadata` is part of the included attributes, as 9919 // `updateBlockAttributes` merges attributes, if it isn't present 9920 // the previous `metadata` would be retained. 9921 attributes.metadata && !attributes.metadata?.patternName && state.blocks.attributes.get(clientId)?.metadata?.patternName 9922 ) { 9923 removedClientIds.push(clientId); 9924 } 9925 } 9926 if (!addedBlocks?.length && !removedClientIds?.length) { 9927 break; 9928 } 9929 const nextDerivedBlockEditingModes = getDerivedBlockEditingModesUpdates({ 9930 prevState: state, 9931 nextState, 9932 addedBlocks, 9933 removedClientIds 9934 }); 9935 if (nextDerivedBlockEditingModes) { 9936 return { 9937 ...nextState, 9938 derivedBlockEditingModes: nextDerivedBlockEditingModes ?? state.derivedBlockEditingModes 9939 }; 9940 } 9941 break; 9942 } 9943 case "UPDATE_BLOCK_LIST_SETTINGS": { 9944 const addedBlocks = []; 9945 const removedClientIds = []; 9946 const updates = typeof action.clientId === "string" ? { [action.clientId]: action.settings } : action.clientId; 9947 for (const clientId in updates) { 9948 const isNewContentOnlyBlock = state.blockListSettings[clientId]?.templateLock !== "contentOnly" && nextState.blockListSettings[clientId]?.templateLock === "contentOnly"; 9949 const wasContentOnlyBlock = state.blockListSettings[clientId]?.templateLock === "contentOnly" && nextState.blockListSettings[clientId]?.templateLock !== "contentOnly"; 9950 if (isNewContentOnlyBlock) { 9951 addedBlocks.push( 9952 nextState.blocks.tree.get(clientId) 9953 ); 9954 } else if (wasContentOnlyBlock) { 9955 removedClientIds.push(clientId); 9956 } 9957 } 9958 if (!addedBlocks.length && !removedClientIds.length) { 9959 break; 9960 } 9961 const nextDerivedBlockEditingModes = getDerivedBlockEditingModesUpdates({ 9962 prevState: state, 9963 nextState, 9964 addedBlocks, 9965 removedClientIds 9966 }); 9967 if (nextDerivedBlockEditingModes) { 9968 return { 9969 ...nextState, 9970 derivedBlockEditingModes: nextDerivedBlockEditingModes ?? state.derivedBlockEditingModes 9971 }; 9972 } 9973 break; 9974 } 9975 case "SET_BLOCK_EDITING_MODE": 9976 case "UNSET_BLOCK_EDITING_MODE": 9977 case "SET_HAS_CONTROLLED_INNER_BLOCKS": { 9978 const updatedBlock = getBlockTreeBlock( 9979 nextState, 9980 action.clientId 9981 ); 9982 if (!updatedBlock) { 9983 break; 9984 } 9985 const nextDerivedBlockEditingModes = getDerivedBlockEditingModesUpdates({ 9986 prevState: state, 9987 nextState, 9988 removedClientIds: [action.clientId], 9989 addedBlocks: [updatedBlock] 9990 }); 9991 if (nextDerivedBlockEditingModes) { 9992 return { 9993 ...nextState, 9994 derivedBlockEditingModes: nextDerivedBlockEditingModes ?? state.derivedBlockEditingModes 9995 }; 9996 } 9997 break; 9998 } 9999 case "REPLACE_BLOCKS": { 10000 const nextDerivedBlockEditingModes = getDerivedBlockEditingModesUpdates({ 10001 prevState: state, 10002 nextState, 10003 addedBlocks: action.blocks, 10004 removedClientIds: action.clientIds 10005 }); 10006 if (nextDerivedBlockEditingModes) { 10007 return { 10008 ...nextState, 10009 derivedBlockEditingModes: nextDerivedBlockEditingModes ?? state.derivedBlockEditingModes 10010 }; 10011 } 10012 break; 10013 } 10014 case "REPLACE_INNER_BLOCKS": { 10015 const removedClientIds = state.blocks.order.get( 10016 action.rootClientId 10017 ); 10018 const nextDerivedBlockEditingModes = getDerivedBlockEditingModesUpdates({ 10019 prevState: state, 10020 nextState, 10021 addedBlocks: action.blocks, 10022 removedClientIds 10023 }); 10024 if (nextDerivedBlockEditingModes) { 10025 return { 10026 ...nextState, 10027 derivedBlockEditingModes: nextDerivedBlockEditingModes ?? state.derivedBlockEditingModes 10028 }; 10029 } 10030 break; 10031 } 10032 case "MOVE_BLOCKS_TO_POSITION": { 10033 const addedBlocks = action.clientIds.map((clientId) => { 10034 return nextState.blocks.byClientId.get(clientId); 10035 }); 10036 const nextDerivedBlockEditingModes = getDerivedBlockEditingModesUpdates({ 10037 prevState: state, 10038 nextState, 10039 addedBlocks, 10040 removedClientIds: action.clientIds 10041 }); 10042 if (nextDerivedBlockEditingModes) { 10043 return { 10044 ...nextState, 10045 derivedBlockEditingModes: nextDerivedBlockEditingModes ?? state.derivedBlockEditingModes 10046 }; 10047 } 10048 break; 10049 } 10050 case "UPDATE_SETTINGS": { 10051 if (state?.settings?.[sectionRootClientIdKey] !== nextState?.settings?.[sectionRootClientIdKey]) { 10052 return { 10053 ...nextState, 10054 derivedBlockEditingModes: getDerivedBlockEditingModesForTree(nextState) 10055 }; 10056 } 10057 break; 10058 } 10059 case "RESET_BLOCKS": 10060 case "SET_EDITOR_MODE": 10061 case "RESET_ZOOM_LEVEL": 10062 case "SET_ZOOM_LEVEL": { 10063 return { 10064 ...nextState, 10065 derivedBlockEditingModes: getDerivedBlockEditingModesForTree(nextState) 10066 }; 10067 } 10068 } 10069 nextState.derivedBlockEditingModes = state?.derivedBlockEditingModes ?? /* @__PURE__ */ new Map(); 10070 return nextState; 10071 }; 10072 } 10073 function withAutomaticChangeReset(reducer) { 10074 return (state, action) => { 10075 const nextState = reducer(state, action); 10076 if (!state) { 10077 return nextState; 10078 } 10079 nextState.automaticChangeStatus = state.automaticChangeStatus; 10080 if (action.type === "MARK_AUTOMATIC_CHANGE") { 10081 return { 10082 ...nextState, 10083 automaticChangeStatus: "pending" 10084 }; 10085 } 10086 if (action.type === "MARK_AUTOMATIC_CHANGE_FINAL" && state.automaticChangeStatus === "pending") { 10087 return { 10088 ...nextState, 10089 automaticChangeStatus: "final" 10090 }; 10091 } 10092 if (nextState.blocks === state.blocks && nextState.selection === state.selection) { 10093 return nextState; 10094 } 10095 if (nextState.automaticChangeStatus !== "final" && nextState.selection !== state.selection) { 10096 return nextState; 10097 } 10098 return { 10099 ...nextState, 10100 automaticChangeStatus: void 0 10101 }; 10102 }; 10103 } 10104 var reducer_default = (0,external_wp_compose_namespaceObject.pipe)( 10105 withDerivedBlockEditingModes, 10106 withAutomaticChangeReset 10107 )(combinedReducers); 10108 10109 10110 ;// external ["wp","primitives"] 10111 const external_wp_primitives_namespaceObject = window["wp"]["primitives"]; 10112 ;// ./node_modules/@wordpress/icons/build-module/library/symbol.js 10113 10114 10115 var symbol_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 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" }) }); 10116 10117 10118 ;// external ["wp","richText"] 10119 const external_wp_richText_namespaceObject = window["wp"]["richText"]; 10120 ;// external ["wp","blockSerializationDefaultParser"] 10121 const external_wp_blockSerializationDefaultParser_namespaceObject = window["wp"]["blockSerializationDefaultParser"]; 10122 ;// ./node_modules/@wordpress/block-editor/build-module/store/constants.js 10123 const STORE_NAME = "core/block-editor"; 10124 10125 10126 ;// ./node_modules/@wordpress/block-editor/build-module/utils/object.js 10127 function setImmutably(object, path, value) { 10128 path = Array.isArray(path) ? [...path] : [path]; 10129 object = Array.isArray(object) ? [...object] : { ...object }; 10130 const leaf = path.pop(); 10131 let prev = object; 10132 for (const key of path) { 10133 const lvl = prev[key]; 10134 prev = prev[key] = Array.isArray(lvl) ? [...lvl] : { ...lvl }; 10135 } 10136 prev[leaf] = value; 10137 return object; 10138 } 10139 const getValueFromObjectPath = (object, path, defaultValue) => { 10140 const arrayPath = Array.isArray(path) ? path : path.split("."); 10141 let value = object; 10142 arrayPath.forEach((fieldName) => { 10143 value = value?.[fieldName]; 10144 }); 10145 return value ?? defaultValue; 10146 }; 10147 function uniqByProperty(array, property) { 10148 const seen = /* @__PURE__ */ new Set(); 10149 return array.filter((item) => { 10150 const value = item[property]; 10151 return seen.has(value) ? false : seen.add(value); 10152 }); 10153 } 10154 10155 10156 ;// ./node_modules/@wordpress/block-editor/build-module/store/get-block-settings.js 10157 10158 10159 10160 10161 const blockedPaths = [ 10162 "color", 10163 "border", 10164 "dimensions", 10165 "typography", 10166 "spacing" 10167 ]; 10168 const deprecatedFlags = { 10169 "color.palette": (settings) => settings.colors, 10170 "color.gradients": (settings) => settings.gradients, 10171 "color.custom": (settings) => settings.disableCustomColors === void 0 ? void 0 : !settings.disableCustomColors, 10172 "color.customGradient": (settings) => settings.disableCustomGradients === void 0 ? void 0 : !settings.disableCustomGradients, 10173 "typography.fontSizes": (settings) => settings.fontSizes, 10174 "typography.customFontSize": (settings) => settings.disableCustomFontSizes === void 0 ? void 0 : !settings.disableCustomFontSizes, 10175 "typography.lineHeight": (settings) => settings.enableCustomLineHeight, 10176 "spacing.units": (settings) => { 10177 if (settings.enableCustomUnits === void 0) { 10178 return; 10179 } 10180 if (settings.enableCustomUnits === true) { 10181 return ["px", "em", "rem", "vh", "vw", "%"]; 10182 } 10183 return settings.enableCustomUnits; 10184 }, 10185 "spacing.padding": (settings) => settings.enableCustomSpacing 10186 }; 10187 const prefixedFlags = { 10188 /* 10189 * These were only available in the plugin 10190 * and can be removed when the minimum WordPress version 10191 * for the plugin is 5.9. 10192 */ 10193 "border.customColor": "border.color", 10194 "border.customStyle": "border.style", 10195 "border.customWidth": "border.width", 10196 "typography.customFontStyle": "typography.fontStyle", 10197 "typography.customFontWeight": "typography.fontWeight", 10198 "typography.customLetterSpacing": "typography.letterSpacing", 10199 "typography.customTextDecorations": "typography.textDecoration", 10200 "typography.customTextTransforms": "typography.textTransform", 10201 /* 10202 * These were part of WordPress 5.8 and we need to keep them. 10203 */ 10204 "border.customRadius": "border.radius", 10205 "spacing.customMargin": "spacing.margin", 10206 "spacing.customPadding": "spacing.padding", 10207 "typography.customLineHeight": "typography.lineHeight" 10208 }; 10209 const removeCustomPrefixes = (path) => { 10210 return prefixedFlags[path] || path; 10211 }; 10212 function getBlockSettings(state, clientId, ...paths) { 10213 const blockName = getBlockName(state, clientId); 10214 const candidates = []; 10215 if (clientId) { 10216 let id = clientId; 10217 do { 10218 const name = getBlockName(state, id); 10219 if ((0,external_wp_blocks_namespaceObject.hasBlockSupport)(name, "__experimentalSettings", false)) { 10220 candidates.push(id); 10221 } 10222 } while (id = state.blocks.parents.get(id)); 10223 } 10224 return paths.map((path) => { 10225 if (blockedPaths.includes(path)) { 10226 console.warn( 10227 "Top level useSetting paths are disabled. Please use a subpath to query the information needed." 10228 ); 10229 return void 0; 10230 } 10231 let result = (0,external_wp_hooks_namespaceObject.applyFilters)( 10232 "blockEditor.useSetting.before", 10233 void 0, 10234 path, 10235 clientId, 10236 blockName 10237 ); 10238 if (void 0 !== result) { 10239 return result; 10240 } 10241 const normalizedPath = removeCustomPrefixes(path); 10242 for (const candidateClientId of candidates) { 10243 const candidateAtts = getBlockAttributes( 10244 state, 10245 candidateClientId 10246 ); 10247 result = getValueFromObjectPath( 10248 candidateAtts.settings?.blocks?.[blockName], 10249 normalizedPath 10250 ) ?? getValueFromObjectPath( 10251 candidateAtts.settings, 10252 normalizedPath 10253 ); 10254 if (result !== void 0) { 10255 break; 10256 } 10257 } 10258 const settings = getSettings(state); 10259 if (result === void 0 && blockName) { 10260 result = getValueFromObjectPath( 10261 settings.__experimentalFeatures?.blocks?.[blockName], 10262 normalizedPath 10263 ); 10264 } 10265 if (result === void 0) { 10266 result = getValueFromObjectPath( 10267 settings.__experimentalFeatures, 10268 normalizedPath 10269 ); 10270 } 10271 if (result !== void 0) { 10272 if (external_wp_blocks_namespaceObject.__EXPERIMENTAL_PATHS_WITH_OVERRIDE[normalizedPath]) { 10273 return result.custom ?? result.theme ?? result.default; 10274 } 10275 return result; 10276 } 10277 const deprecatedSettingsValue = deprecatedFlags[normalizedPath]?.(settings); 10278 if (deprecatedSettingsValue !== void 0) { 10279 return deprecatedSettingsValue; 10280 } 10281 return normalizedPath === "typography.dropCap" ? true : void 0; 10282 }); 10283 } 10284 10285 10286 ;// ./node_modules/@wordpress/block-editor/build-module/store/private-selectors.js 10287 10288 10289 10290 10291 10292 10293 10294 const { isContentBlock: private_selectors_isContentBlock } = unlock(external_wp_blocks_namespaceObject.privateApis); 10295 10296 function private_selectors_isBlockInterfaceHidden(state) { 10297 return state.isBlockInterfaceHidden; 10298 } 10299 function getLastInsertedBlocksClientIds(state) { 10300 return state?.lastBlockInserted?.clientIds; 10301 } 10302 function getBlockWithoutAttributes(state, clientId) { 10303 return state.blocks.byClientId.get(clientId); 10304 } 10305 const isBlockSubtreeDisabled = (state, clientId) => { 10306 const isChildSubtreeDisabled = (childClientId) => { 10307 return getBlockEditingMode(state, childClientId) === "disabled" && getBlockOrder(state, childClientId).every( 10308 isChildSubtreeDisabled 10309 ); 10310 }; 10311 return getBlockOrder(state, clientId).every(isChildSubtreeDisabled); 10312 }; 10313 function isContainerInsertableToInContentOnlyMode(state, blockName, rootClientId) { 10314 const isBlockContentBlock = private_selectors_isContentBlock(blockName); 10315 const rootBlockName = getBlockName(state, rootClientId); 10316 const isContainerContentBlock = private_selectors_isContentBlock(rootBlockName); 10317 const isRootBlockMain = getSectionRootClientId(state) === rootClientId; 10318 return isRootBlockMain || isContainerContentBlock && isBlockContentBlock; 10319 } 10320 function getEnabledClientIdsTreeUnmemoized(state, rootClientId) { 10321 const blockOrder = getBlockOrder(state, rootClientId); 10322 const result = []; 10323 for (const clientId of blockOrder) { 10324 const innerBlocks = getEnabledClientIdsTreeUnmemoized( 10325 state, 10326 clientId 10327 ); 10328 if (getBlockEditingMode(state, clientId) !== "disabled") { 10329 result.push({ clientId, innerBlocks }); 10330 } else { 10331 result.push(...innerBlocks); 10332 } 10333 } 10334 return result; 10335 } 10336 const getEnabledClientIdsTree = (0,external_wp_data_namespaceObject.createRegistrySelector)( 10337 () => (0,external_wp_data_namespaceObject.createSelector)(getEnabledClientIdsTreeUnmemoized, (state) => [ 10338 state.blocks.order, 10339 state.derivedBlockEditingModes, 10340 state.blockEditingModes 10341 ]) 10342 ); 10343 const getEnabledBlockParents = (0,external_wp_data_namespaceObject.createSelector)( 10344 (state, clientId, ascending = false) => { 10345 return getBlockParents(state, clientId, ascending).filter( 10346 (parent) => getBlockEditingMode(state, parent) !== "disabled" 10347 ); 10348 }, 10349 (state) => [ 10350 state.blocks.parents, 10351 state.blockEditingModes, 10352 state.settings.templateLock, 10353 state.blockListSettings 10354 ] 10355 ); 10356 function getRemovalPromptData(state) { 10357 return state.removalPromptData; 10358 } 10359 function getBlockRemovalRules(state) { 10360 return state.blockRemovalRules; 10361 } 10362 function getOpenedBlockSettingsMenu(state) { 10363 return state.openedBlockSettingsMenu; 10364 } 10365 const getStyleOverrides = (0,external_wp_data_namespaceObject.createSelector)( 10366 (state) => { 10367 const clientIds = getClientIdsWithDescendants(state); 10368 const clientIdMap = clientIds.reduce((acc, clientId, index) => { 10369 acc[clientId] = index; 10370 return acc; 10371 }, {}); 10372 return [...state.styleOverrides].sort((overrideA, overrideB) => { 10373 const [, { clientId: clientIdA }] = overrideA; 10374 const [, { clientId: clientIdB }] = overrideB; 10375 const aIndex = clientIdMap[clientIdA] ?? -1; 10376 const bIndex = clientIdMap[clientIdB] ?? -1; 10377 return aIndex - bIndex; 10378 }); 10379 }, 10380 (state) => [state.blocks.order, state.styleOverrides] 10381 ); 10382 function getRegisteredInserterMediaCategories(state) { 10383 return state.registeredInserterMediaCategories; 10384 } 10385 const getInserterMediaCategories = (0,external_wp_data_namespaceObject.createSelector)( 10386 (state) => { 10387 const { 10388 settings: { 10389 inserterMediaCategories, 10390 allowedMimeTypes, 10391 enableOpenverseMediaCategory 10392 }, 10393 registeredInserterMediaCategories 10394 } = state; 10395 if (!inserterMediaCategories && !registeredInserterMediaCategories.length || !allowedMimeTypes) { 10396 return; 10397 } 10398 const coreInserterMediaCategoriesNames = inserterMediaCategories?.map(({ name }) => name) || []; 10399 const mergedCategories = [ 10400 ...inserterMediaCategories || [], 10401 ...(registeredInserterMediaCategories || []).filter( 10402 ({ name }) => !coreInserterMediaCategoriesNames.includes(name) 10403 ) 10404 ]; 10405 return mergedCategories.filter((category) => { 10406 if (!enableOpenverseMediaCategory && category.name === "openverse") { 10407 return false; 10408 } 10409 return Object.values(allowedMimeTypes).some( 10410 (mimeType) => mimeType.startsWith(`$category.mediaType}/`) 10411 ); 10412 }); 10413 }, 10414 (state) => [ 10415 state.settings.inserterMediaCategories, 10416 state.settings.allowedMimeTypes, 10417 state.settings.enableOpenverseMediaCategory, 10418 state.registeredInserterMediaCategories 10419 ] 10420 ); 10421 const hasAllowedPatterns = (0,external_wp_data_namespaceObject.createRegistrySelector)( 10422 (select) => (0,external_wp_data_namespaceObject.createSelector)( 10423 (state, rootClientId = null) => { 10424 const { getAllPatterns: getAllPatterns2 } = unlock(select(STORE_NAME)); 10425 const patterns = getAllPatterns2(); 10426 const { allowedBlockTypes } = getSettings(state); 10427 return patterns.some((pattern) => { 10428 const { inserter = true } = pattern; 10429 if (!inserter) { 10430 return false; 10431 } 10432 const grammar = getGrammar(pattern); 10433 return checkAllowListRecursive(grammar, allowedBlockTypes) && grammar.every( 10434 ({ name: blockName }) => canInsertBlockType(state, blockName, rootClientId) 10435 ); 10436 }); 10437 }, 10438 (state, rootClientId) => [ 10439 ...getAllPatternsDependants(select)(state), 10440 ...getInsertBlockTypeDependants(select)(state, rootClientId) 10441 ] 10442 ) 10443 ); 10444 const getPatternBySlug = (0,external_wp_data_namespaceObject.createRegistrySelector)( 10445 (select) => (0,external_wp_data_namespaceObject.createSelector)( 10446 (state, patternName) => { 10447 if (patternName?.startsWith("core/block/")) { 10448 const _id = parseInt( 10449 patternName.slice("core/block/".length), 10450 10 10451 ); 10452 const block = unlock(select(STORE_NAME)).getReusableBlocks().find(({ id }) => id === _id); 10453 if (!block) { 10454 return null; 10455 } 10456 return mapUserPattern( 10457 block, 10458 state.settings.__experimentalUserPatternCategories 10459 ); 10460 } 10461 return [ 10462 // This setting is left for back compat. 10463 ...state.settings.__experimentalBlockPatterns ?? [], 10464 ...state.settings[selectBlockPatternsKey]?.(select) ?? [] 10465 ].find(({ name }) => name === patternName); 10466 }, 10467 (state, patternName) => patternName?.startsWith("core/block/") ? [ 10468 unlock(select(STORE_NAME)).getReusableBlocks(), 10469 state.settings.__experimentalReusableBlocks 10470 ] : [ 10471 state.settings.__experimentalBlockPatterns, 10472 state.settings[selectBlockPatternsKey]?.(select) 10473 ] 10474 ) 10475 ); 10476 const getAllPatterns = (0,external_wp_data_namespaceObject.createRegistrySelector)( 10477 (select) => (0,external_wp_data_namespaceObject.createSelector)((state) => { 10478 return [ 10479 ...unlock(select(STORE_NAME)).getReusableBlocks().map( 10480 (userPattern) => mapUserPattern( 10481 userPattern, 10482 state.settings.__experimentalUserPatternCategories 10483 ) 10484 ), 10485 // This setting is left for back compat. 10486 ...state.settings.__experimentalBlockPatterns ?? [], 10487 ...state.settings[selectBlockPatternsKey]?.(select) ?? [] 10488 ].filter( 10489 (x, index, arr) => index === arr.findIndex((y) => x.name === y.name) 10490 ); 10491 }, getAllPatternsDependants(select)) 10492 ); 10493 const EMPTY_ARRAY = []; 10494 const getReusableBlocks = (0,external_wp_data_namespaceObject.createRegistrySelector)( 10495 (select) => (state) => { 10496 const reusableBlocksSelect = state.settings[reusableBlocksSelectKey]; 10497 return (reusableBlocksSelect ? reusableBlocksSelect(select) : state.settings.__experimentalReusableBlocks) ?? EMPTY_ARRAY; 10498 } 10499 ); 10500 function getLastFocus(state) { 10501 return state.lastFocus; 10502 } 10503 function private_selectors_isDragging(state) { 10504 return state.isDragging; 10505 } 10506 function getExpandedBlock(state) { 10507 return state.expandedBlock; 10508 } 10509 const getContentLockingParent = (state, clientId) => { 10510 let current = clientId; 10511 let result; 10512 while (!result && (current = state.blocks.parents.get(current))) { 10513 if (getTemplateLock(state, current) === "contentOnly") { 10514 result = current; 10515 } 10516 } 10517 return result; 10518 }; 10519 const getParentSectionBlock = (state, clientId) => { 10520 let current = clientId; 10521 let result; 10522 while (!result && (current = state.blocks.parents.get(current))) { 10523 if (isSectionBlock(state, current)) { 10524 result = current; 10525 } 10526 } 10527 return result; 10528 }; 10529 function isSectionBlock(state, clientId) { 10530 const blockName = getBlockName(state, clientId); 10531 if (blockName === "core/block" || getTemplateLock(state, clientId) === "contentOnly") { 10532 return true; 10533 } 10534 const attributes = getBlockAttributes(state, clientId); 10535 const isTemplatePart = blockName === "core/template-part"; 10536 if ((attributes?.metadata?.patternName || isTemplatePart) && !!window?.__experimentalContentOnlyPatternInsertion) { 10537 return true; 10538 } 10539 return false; 10540 } 10541 function getTemporarilyEditingAsBlocks(state) { 10542 return state.temporarilyEditingAsBlocks; 10543 } 10544 function getTemporarilyEditingFocusModeToRevert(state) { 10545 return state.temporarilyEditingFocusModeRevert; 10546 } 10547 const getBlockStyles = (0,external_wp_data_namespaceObject.createSelector)( 10548 (state, clientIds) => clientIds.reduce((styles, clientId) => { 10549 styles[clientId] = state.blocks.attributes.get(clientId)?.style; 10550 return styles; 10551 }, {}), 10552 (state, clientIds) => [ 10553 ...clientIds.map( 10554 (clientId) => state.blocks.attributes.get(clientId)?.style 10555 ) 10556 ] 10557 ); 10558 function getSectionRootClientId(state) { 10559 return state.settings?.[sectionRootClientIdKey]; 10560 } 10561 function isZoomOut(state) { 10562 return state.zoomLevel === "auto-scaled" || state.zoomLevel < 100; 10563 } 10564 function getZoomLevel(state) { 10565 return state.zoomLevel; 10566 } 10567 function getClosestAllowedInsertionPoint(state, name, clientId = "") { 10568 const blockNames = Array.isArray(name) ? name : [name]; 10569 const areBlockNamesAllowedInClientId = (id) => blockNames.every( 10570 (currentName) => canInsertBlockType(state, currentName, id) 10571 ); 10572 if (!clientId) { 10573 if (areBlockNamesAllowedInClientId(clientId)) { 10574 return clientId; 10575 } 10576 const sectionRootClientId = getSectionRootClientId(state); 10577 if (sectionRootClientId && areBlockNamesAllowedInClientId(sectionRootClientId)) { 10578 return sectionRootClientId; 10579 } 10580 return null; 10581 } 10582 let current = clientId; 10583 while (current !== null && !areBlockNamesAllowedInClientId(current)) { 10584 const parentClientId = getBlockRootClientId(state, current); 10585 current = parentClientId; 10586 } 10587 return current; 10588 } 10589 function getClosestAllowedInsertionPointForPattern(state, pattern, clientId) { 10590 const { allowedBlockTypes } = getSettings(state); 10591 const isAllowed = checkAllowListRecursive( 10592 getGrammar(pattern), 10593 allowedBlockTypes 10594 ); 10595 if (!isAllowed) { 10596 return null; 10597 } 10598 const names = getGrammar(pattern).map(({ blockName: name }) => name); 10599 return getClosestAllowedInsertionPoint(state, names, clientId); 10600 } 10601 function getInsertionPoint(state) { 10602 return state.insertionPoint; 10603 } 10604 const isBlockHidden = (state, clientId) => { 10605 const blockName = getBlockName(state, clientId); 10606 if (!(0,external_wp_blocks_namespaceObject.hasBlockSupport)(state, blockName, "blockVisibility", true)) { 10607 return false; 10608 } 10609 const attributes = state.blocks.attributes.get(clientId); 10610 return attributes?.metadata?.blockVisibility === false; 10611 }; 10612 function private_selectors_hasBlockSpotlight(state) { 10613 return !!state.hasBlockSpotlight; 10614 } 10615 10616 10617 ;// ./node_modules/@wordpress/block-editor/build-module/components/inserter/block-patterns-tab/utils.js 10618 10619 const INSERTER_PATTERN_TYPES = { 10620 user: "user", 10621 theme: "theme", 10622 directory: "directory" 10623 }; 10624 const INSERTER_SYNC_TYPES = { 10625 full: "fully", 10626 unsynced: "unsynced" 10627 }; 10628 const allPatternsCategory = { 10629 name: "allPatterns", 10630 label: (0,external_wp_i18n_namespaceObject._x)("All", "patterns") 10631 }; 10632 const myPatternsCategory = { 10633 name: "myPatterns", 10634 label: (0,external_wp_i18n_namespaceObject.__)("My patterns") 10635 }; 10636 const starterPatternsCategory = { 10637 name: "core/starter-content", 10638 label: (0,external_wp_i18n_namespaceObject.__)("Starter content") 10639 }; 10640 function isPatternFiltered(pattern, sourceFilter, syncFilter) { 10641 const isUserPattern = pattern.name.startsWith("core/block"); 10642 const isDirectoryPattern = pattern.source === "core" || pattern.source?.startsWith("pattern-directory"); 10643 if (sourceFilter === INSERTER_PATTERN_TYPES.theme && (isUserPattern || isDirectoryPattern)) { 10644 return true; 10645 } 10646 if (sourceFilter === INSERTER_PATTERN_TYPES.directory && (isUserPattern || !isDirectoryPattern)) { 10647 return true; 10648 } 10649 if (sourceFilter === INSERTER_PATTERN_TYPES.user && pattern.type !== INSERTER_PATTERN_TYPES.user) { 10650 return true; 10651 } 10652 if (syncFilter === INSERTER_SYNC_TYPES.full && pattern.syncStatus !== "") { 10653 return true; 10654 } 10655 if (syncFilter === INSERTER_SYNC_TYPES.unsynced && pattern.syncStatus !== "unsynced" && isUserPattern) { 10656 return true; 10657 } 10658 return false; 10659 } 10660 10661 10662 ;// ./node_modules/@wordpress/block-editor/build-module/store/utils.js 10663 10664 10665 10666 10667 10668 10669 10670 10671 const isFiltered = Symbol("isFiltered"); 10672 const parsedPatternCache = /* @__PURE__ */ new WeakMap(); 10673 const grammarMapCache = /* @__PURE__ */ new WeakMap(); 10674 function mapUserPattern(userPattern, __experimentalUserPatternCategories = []) { 10675 return { 10676 name: `core/block/$userPattern.id}`, 10677 id: userPattern.id, 10678 type: INSERTER_PATTERN_TYPES.user, 10679 title: userPattern.title?.raw, 10680 categories: userPattern.wp_pattern_category?.map((catId) => { 10681 const category = __experimentalUserPatternCategories.find( 10682 ({ id }) => id === catId 10683 ); 10684 return category ? category.slug : catId; 10685 }), 10686 content: userPattern.content?.raw, 10687 syncStatus: userPattern.wp_pattern_sync_status 10688 }; 10689 } 10690 function parsePattern(pattern) { 10691 const blocks = (0,external_wp_blocks_namespaceObject.parse)(pattern.content, { 10692 __unstableSkipMigrationLogs: true 10693 }); 10694 if (blocks.length === 1) { 10695 blocks[0].attributes = { 10696 ...blocks[0].attributes, 10697 metadata: { 10698 ...blocks[0].attributes.metadata || {}, 10699 categories: pattern.categories, 10700 patternName: pattern.name, 10701 name: blocks[0].attributes.metadata?.name || pattern.title 10702 } 10703 }; 10704 } 10705 return { 10706 ...pattern, 10707 blocks 10708 }; 10709 } 10710 function getParsedPattern(pattern) { 10711 let parsedPattern = parsedPatternCache.get(pattern); 10712 if (!parsedPattern) { 10713 parsedPattern = parsePattern(pattern); 10714 parsedPatternCache.set(pattern, parsedPattern); 10715 } 10716 return parsedPattern; 10717 } 10718 function getGrammar(pattern) { 10719 let grammarMap = grammarMapCache.get(pattern); 10720 if (!grammarMap) { 10721 grammarMap = (0,external_wp_blockSerializationDefaultParser_namespaceObject.parse)(pattern.content); 10722 grammarMap = grammarMap.filter((block) => block.blockName !== null); 10723 grammarMapCache.set(pattern, grammarMap); 10724 } 10725 return grammarMap; 10726 } 10727 const checkAllowList = (list, item, defaultResult = null) => { 10728 if (typeof list === "boolean") { 10729 return list; 10730 } 10731 if (Array.isArray(list)) { 10732 if (list.includes("core/post-content") && item === null) { 10733 return true; 10734 } 10735 return list.includes(item); 10736 } 10737 return defaultResult; 10738 }; 10739 const checkAllowListRecursive = (blocks, allowedBlockTypes) => { 10740 if (typeof allowedBlockTypes === "boolean") { 10741 return allowedBlockTypes; 10742 } 10743 const blocksQueue = [...blocks]; 10744 while (blocksQueue.length > 0) { 10745 const block = blocksQueue.shift(); 10746 const isAllowed = checkAllowList( 10747 allowedBlockTypes, 10748 block.name || block.blockName, 10749 true 10750 ); 10751 if (!isAllowed) { 10752 return false; 10753 } 10754 block.innerBlocks?.forEach((innerBlock) => { 10755 blocksQueue.push(innerBlock); 10756 }); 10757 } 10758 return true; 10759 }; 10760 const getAllPatternsDependants = (select) => (state) => { 10761 return [ 10762 state.settings.__experimentalBlockPatterns, 10763 state.settings.__experimentalUserPatternCategories, 10764 state.settings.__experimentalReusableBlocks, 10765 state.settings[selectBlockPatternsKey]?.(select), 10766 state.blockPatterns, 10767 unlock(select(STORE_NAME)).getReusableBlocks() 10768 ]; 10769 }; 10770 const getInsertBlockTypeDependants = () => (state, rootClientId) => { 10771 return [ 10772 state.blockListSettings[rootClientId], 10773 state.blocks.byClientId.get(rootClientId), 10774 state.settings.allowedBlockTypes, 10775 state.settings.templateLock, 10776 getBlockEditingMode(state, rootClientId), 10777 getSectionRootClientId(state), 10778 isSectionBlock(state, rootClientId) 10779 ]; 10780 }; 10781 10782 10783 ;// ./node_modules/@wordpress/block-editor/build-module/utils/sorting.js 10784 const comparator = (field, items, order) => { 10785 return (a, b) => { 10786 let cmpA, cmpB; 10787 if (typeof field === "function") { 10788 cmpA = field(a); 10789 cmpB = field(b); 10790 } else { 10791 cmpA = a[field]; 10792 cmpB = b[field]; 10793 } 10794 if (cmpA > cmpB) { 10795 return order === "asc" ? 1 : -1; 10796 } else if (cmpB > cmpA) { 10797 return order === "asc" ? -1 : 1; 10798 } 10799 const orderA = items.findIndex((item) => item === a); 10800 const orderB = items.findIndex((item) => item === b); 10801 if (orderA > orderB) { 10802 return 1; 10803 } else if (orderB > orderA) { 10804 return -1; 10805 } 10806 return 0; 10807 }; 10808 }; 10809 function orderBy(items, field, order = "asc") { 10810 return items.concat().sort(comparator(field, items, order)); 10811 } 10812 10813 10814 ;// ./node_modules/@wordpress/block-editor/build-module/store/selectors.js 10815 10816 10817 10818 10819 10820 10821 10822 10823 10824 10825 10826 10827 const { isContentBlock: selectors_isContentBlock } = unlock(external_wp_blocks_namespaceObject.privateApis); 10828 const MILLISECONDS_PER_HOUR = 3600 * 1e3; 10829 const MILLISECONDS_PER_DAY = 24 * 3600 * 1e3; 10830 const MILLISECONDS_PER_WEEK = 7 * 24 * 3600 * 1e3; 10831 const selectors_EMPTY_ARRAY = []; 10832 const EMPTY_SET = /* @__PURE__ */ new Set(); 10833 const DEFAULT_INSERTER_OPTIONS = { 10834 [isFiltered]: true 10835 }; 10836 function getBlockName(state, clientId) { 10837 const block = state.blocks.byClientId.get(clientId); 10838 const socialLinkName = "core/social-link"; 10839 if (external_wp_element_namespaceObject.Platform.OS !== "web" && block?.name === socialLinkName) { 10840 const attributes = state.blocks.attributes.get(clientId); 10841 const { service } = attributes ?? {}; 10842 return service ? `$socialLinkName}-$service}` : socialLinkName; 10843 } 10844 return block ? block.name : null; 10845 } 10846 function isBlockValid(state, clientId) { 10847 const block = state.blocks.byClientId.get(clientId); 10848 return !!block && block.isValid; 10849 } 10850 function getBlockAttributes(state, clientId) { 10851 const block = state.blocks.byClientId.get(clientId); 10852 if (!block) { 10853 return null; 10854 } 10855 return state.blocks.attributes.get(clientId); 10856 } 10857 function getBlock(state, clientId) { 10858 if (!state.blocks.byClientId.has(clientId)) { 10859 return null; 10860 } 10861 return state.blocks.tree.get(clientId); 10862 } 10863 const __unstableGetBlockWithoutInnerBlocks = (0,external_wp_data_namespaceObject.createSelector)( 10864 (state, clientId) => { 10865 const block = state.blocks.byClientId.get(clientId); 10866 if (!block) { 10867 return null; 10868 } 10869 return { 10870 ...block, 10871 attributes: getBlockAttributes(state, clientId) 10872 }; 10873 }, 10874 (state, clientId) => [ 10875 state.blocks.byClientId.get(clientId), 10876 state.blocks.attributes.get(clientId) 10877 ] 10878 ); 10879 function getBlocks(state, rootClientId) { 10880 const treeKey = !rootClientId || !areInnerBlocksControlled(state, rootClientId) ? rootClientId || "" : "controlled||" + rootClientId; 10881 return state.blocks.tree.get(treeKey)?.innerBlocks || selectors_EMPTY_ARRAY; 10882 } 10883 const __unstableGetClientIdWithClientIdsTree = (0,external_wp_data_namespaceObject.createSelector)( 10884 (state, clientId) => { 10885 external_wp_deprecated_default()( 10886 "wp.data.select( 'core/block-editor' ).__unstableGetClientIdWithClientIdsTree", 10887 { 10888 since: "6.3", 10889 version: "6.5" 10890 } 10891 ); 10892 return { 10893 clientId, 10894 innerBlocks: __unstableGetClientIdsTree(state, clientId) 10895 }; 10896 }, 10897 (state) => [state.blocks.order] 10898 ); 10899 const __unstableGetClientIdsTree = (0,external_wp_data_namespaceObject.createSelector)( 10900 (state, rootClientId = "") => { 10901 external_wp_deprecated_default()( 10902 "wp.data.select( 'core/block-editor' ).__unstableGetClientIdsTree", 10903 { 10904 since: "6.3", 10905 version: "6.5" 10906 } 10907 ); 10908 return getBlockOrder(state, rootClientId).map( 10909 (clientId) => __unstableGetClientIdWithClientIdsTree(state, clientId) 10910 ); 10911 }, 10912 (state) => [state.blocks.order] 10913 ); 10914 const getClientIdsOfDescendants = (0,external_wp_data_namespaceObject.createSelector)( 10915 (state, rootIds) => { 10916 rootIds = Array.isArray(rootIds) ? [...rootIds] : [rootIds]; 10917 const ids = []; 10918 for (const rootId of rootIds) { 10919 const order = state.blocks.order.get(rootId); 10920 if (order) { 10921 ids.push(...order); 10922 } 10923 } 10924 let index = 0; 10925 while (index < ids.length) { 10926 const id = ids[index]; 10927 const order = state.blocks.order.get(id); 10928 if (order) { 10929 ids.splice(index + 1, 0, ...order); 10930 } 10931 index++; 10932 } 10933 return ids; 10934 }, 10935 (state) => [state.blocks.order] 10936 ); 10937 const getClientIdsWithDescendants = (state) => getClientIdsOfDescendants(state, ""); 10938 const getGlobalBlockCount = (0,external_wp_data_namespaceObject.createSelector)( 10939 (state, blockName) => { 10940 const clientIds = getClientIdsWithDescendants(state); 10941 if (!blockName) { 10942 return clientIds.length; 10943 } 10944 let count = 0; 10945 for (const clientId of clientIds) { 10946 const block = state.blocks.byClientId.get(clientId); 10947 if (block.name === blockName) { 10948 count++; 10949 } 10950 } 10951 return count; 10952 }, 10953 (state) => [state.blocks.order, state.blocks.byClientId] 10954 ); 10955 const getBlocksByName = (0,external_wp_data_namespaceObject.createSelector)( 10956 (state, blockName) => { 10957 if (!blockName) { 10958 return selectors_EMPTY_ARRAY; 10959 } 10960 const blockNames = Array.isArray(blockName) ? blockName : [blockName]; 10961 const clientIds = getClientIdsWithDescendants(state); 10962 const foundBlocks = clientIds.filter((clientId) => { 10963 const block = state.blocks.byClientId.get(clientId); 10964 return blockNames.includes(block.name); 10965 }); 10966 return foundBlocks.length > 0 ? foundBlocks : selectors_EMPTY_ARRAY; 10967 }, 10968 (state) => [state.blocks.order, state.blocks.byClientId] 10969 ); 10970 function __experimentalGetGlobalBlocksByName(state, blockName) { 10971 external_wp_deprecated_default()( 10972 "wp.data.select( 'core/block-editor' ).__experimentalGetGlobalBlocksByName", 10973 { 10974 since: "6.5", 10975 alternative: `wp.data.select( 'core/block-editor' ).getBlocksByName` 10976 } 10977 ); 10978 return getBlocksByName(state, blockName); 10979 } 10980 const getBlocksByClientId = (0,external_wp_data_namespaceObject.createSelector)( 10981 (state, clientIds) => (Array.isArray(clientIds) ? clientIds : [clientIds]).map( 10982 (clientId) => getBlock(state, clientId) 10983 ), 10984 (state, clientIds) => (Array.isArray(clientIds) ? clientIds : [clientIds]).map( 10985 (clientId) => state.blocks.tree.get(clientId) 10986 ) 10987 ); 10988 const getBlockNamesByClientId = (0,external_wp_data_namespaceObject.createSelector)( 10989 (state, clientIds) => getBlocksByClientId(state, clientIds).filter(Boolean).map((block) => block.name), 10990 (state, clientIds) => getBlocksByClientId(state, clientIds) 10991 ); 10992 function getBlockCount(state, rootClientId) { 10993 return getBlockOrder(state, rootClientId).length; 10994 } 10995 function getSelectionStart(state) { 10996 return state.selection.selectionStart; 10997 } 10998 function getSelectionEnd(state) { 10999 return state.selection.selectionEnd; 11000 } 11001 function getBlockSelectionStart(state) { 11002 return state.selection.selectionStart.clientId; 11003 } 11004 function getBlockSelectionEnd(state) { 11005 return state.selection.selectionEnd.clientId; 11006 } 11007 function getSelectedBlockCount(state) { 11008 const multiSelectedBlockCount = getMultiSelectedBlockClientIds(state).length; 11009 if (multiSelectedBlockCount) { 11010 return multiSelectedBlockCount; 11011 } 11012 return state.selection.selectionStart.clientId ? 1 : 0; 11013 } 11014 function hasSelectedBlock(state) { 11015 const { selectionStart, selectionEnd } = state.selection; 11016 return !!selectionStart.clientId && selectionStart.clientId === selectionEnd.clientId; 11017 } 11018 function getSelectedBlockClientId(state) { 11019 const { selectionStart, selectionEnd } = state.selection; 11020 const { clientId } = selectionStart; 11021 if (!clientId || clientId !== selectionEnd.clientId) { 11022 return null; 11023 } 11024 return clientId; 11025 } 11026 function getSelectedBlock(state) { 11027 const clientId = getSelectedBlockClientId(state); 11028 return clientId ? getBlock(state, clientId) : null; 11029 } 11030 function getBlockRootClientId(state, clientId) { 11031 return state.blocks.parents.get(clientId) ?? null; 11032 } 11033 const getBlockParents = (0,external_wp_data_namespaceObject.createSelector)( 11034 (state, clientId, ascending = false) => { 11035 const parents = []; 11036 let current = clientId; 11037 while (current = state.blocks.parents.get(current)) { 11038 parents.push(current); 11039 } 11040 if (!parents.length) { 11041 return selectors_EMPTY_ARRAY; 11042 } 11043 return ascending ? parents : parents.reverse(); 11044 }, 11045 (state) => [state.blocks.parents] 11046 ); 11047 const getBlockParentsByBlockName = (0,external_wp_data_namespaceObject.createSelector)( 11048 (state, clientId, blockName, ascending = false) => { 11049 const parents = getBlockParents(state, clientId, ascending); 11050 const hasName = Array.isArray(blockName) ? (name) => blockName.includes(name) : (name) => blockName === name; 11051 return parents.filter((id) => hasName(getBlockName(state, id))); 11052 }, 11053 (state) => [state.blocks.parents] 11054 ); 11055 function getBlockHierarchyRootClientId(state, clientId) { 11056 let current = clientId; 11057 let parent; 11058 do { 11059 parent = current; 11060 current = state.blocks.parents.get(current); 11061 } while (current); 11062 return parent; 11063 } 11064 function getLowestCommonAncestorWithSelectedBlock(state, clientId) { 11065 const selectedId = getSelectedBlockClientId(state); 11066 const clientParents = [...getBlockParents(state, clientId), clientId]; 11067 const selectedParents = [ 11068 ...getBlockParents(state, selectedId), 11069 selectedId 11070 ]; 11071 let lowestCommonAncestor; 11072 const maxDepth = Math.min(clientParents.length, selectedParents.length); 11073 for (let index = 0; index < maxDepth; index++) { 11074 if (clientParents[index] === selectedParents[index]) { 11075 lowestCommonAncestor = clientParents[index]; 11076 } else { 11077 break; 11078 } 11079 } 11080 return lowestCommonAncestor; 11081 } 11082 function getAdjacentBlockClientId(state, startClientId, modifier = 1) { 11083 if (startClientId === void 0) { 11084 startClientId = getSelectedBlockClientId(state); 11085 } 11086 if (startClientId === void 0) { 11087 if (modifier < 0) { 11088 startClientId = getFirstMultiSelectedBlockClientId(state); 11089 } else { 11090 startClientId = getLastMultiSelectedBlockClientId(state); 11091 } 11092 } 11093 if (!startClientId) { 11094 return null; 11095 } 11096 const rootClientId = getBlockRootClientId(state, startClientId); 11097 if (rootClientId === null) { 11098 return null; 11099 } 11100 const { order } = state.blocks; 11101 const orderSet = order.get(rootClientId); 11102 const index = orderSet.indexOf(startClientId); 11103 const nextIndex = index + 1 * modifier; 11104 if (nextIndex < 0) { 11105 return null; 11106 } 11107 if (nextIndex === orderSet.length) { 11108 return null; 11109 } 11110 return orderSet[nextIndex]; 11111 } 11112 function getPreviousBlockClientId(state, startClientId) { 11113 return getAdjacentBlockClientId(state, startClientId, -1); 11114 } 11115 function getNextBlockClientId(state, startClientId) { 11116 return getAdjacentBlockClientId(state, startClientId, 1); 11117 } 11118 function getSelectedBlocksInitialCaretPosition(state) { 11119 return state.initialPosition; 11120 } 11121 const getSelectedBlockClientIds = (0,external_wp_data_namespaceObject.createSelector)( 11122 (state) => { 11123 const { selectionStart, selectionEnd } = state.selection; 11124 if (!selectionStart.clientId || !selectionEnd.clientId) { 11125 return selectors_EMPTY_ARRAY; 11126 } 11127 if (selectionStart.clientId === selectionEnd.clientId) { 11128 return [selectionStart.clientId]; 11129 } 11130 const rootClientId = getBlockRootClientId( 11131 state, 11132 selectionStart.clientId 11133 ); 11134 if (rootClientId === null) { 11135 return selectors_EMPTY_ARRAY; 11136 } 11137 const blockOrder = getBlockOrder(state, rootClientId); 11138 const startIndex = blockOrder.indexOf(selectionStart.clientId); 11139 const endIndex = blockOrder.indexOf(selectionEnd.clientId); 11140 if (startIndex > endIndex) { 11141 return blockOrder.slice(endIndex, startIndex + 1); 11142 } 11143 return blockOrder.slice(startIndex, endIndex + 1); 11144 }, 11145 (state) => [ 11146 state.blocks.order, 11147 state.selection.selectionStart.clientId, 11148 state.selection.selectionEnd.clientId 11149 ] 11150 ); 11151 function getMultiSelectedBlockClientIds(state) { 11152 const { selectionStart, selectionEnd } = state.selection; 11153 if (selectionStart.clientId === selectionEnd.clientId) { 11154 return selectors_EMPTY_ARRAY; 11155 } 11156 return getSelectedBlockClientIds(state); 11157 } 11158 const getMultiSelectedBlocks = (0,external_wp_data_namespaceObject.createSelector)( 11159 (state) => { 11160 const multiSelectedBlockClientIds = getMultiSelectedBlockClientIds(state); 11161 if (!multiSelectedBlockClientIds.length) { 11162 return selectors_EMPTY_ARRAY; 11163 } 11164 return multiSelectedBlockClientIds.map( 11165 (clientId) => getBlock(state, clientId) 11166 ); 11167 }, 11168 (state) => [ 11169 ...getSelectedBlockClientIds.getDependants(state), 11170 state.blocks.byClientId, 11171 state.blocks.order, 11172 state.blocks.attributes 11173 ] 11174 ); 11175 function getFirstMultiSelectedBlockClientId(state) { 11176 return getMultiSelectedBlockClientIds(state)[0] || null; 11177 } 11178 function getLastMultiSelectedBlockClientId(state) { 11179 const selectedClientIds = getMultiSelectedBlockClientIds(state); 11180 return selectedClientIds[selectedClientIds.length - 1] || null; 11181 } 11182 function isFirstMultiSelectedBlock(state, clientId) { 11183 return getFirstMultiSelectedBlockClientId(state) === clientId; 11184 } 11185 function isBlockMultiSelected(state, clientId) { 11186 return getMultiSelectedBlockClientIds(state).indexOf(clientId) !== -1; 11187 } 11188 const isAncestorMultiSelected = (0,external_wp_data_namespaceObject.createSelector)( 11189 (state, clientId) => { 11190 let ancestorClientId = clientId; 11191 let isMultiSelected = false; 11192 while (ancestorClientId && !isMultiSelected) { 11193 ancestorClientId = getBlockRootClientId(state, ancestorClientId); 11194 isMultiSelected = isBlockMultiSelected(state, ancestorClientId); 11195 } 11196 return isMultiSelected; 11197 }, 11198 (state) => [ 11199 state.blocks.order, 11200 state.selection.selectionStart.clientId, 11201 state.selection.selectionEnd.clientId 11202 ] 11203 ); 11204 function getMultiSelectedBlocksStartClientId(state) { 11205 const { selectionStart, selectionEnd } = state.selection; 11206 if (selectionStart.clientId === selectionEnd.clientId) { 11207 return null; 11208 } 11209 return selectionStart.clientId || null; 11210 } 11211 function getMultiSelectedBlocksEndClientId(state) { 11212 const { selectionStart, selectionEnd } = state.selection; 11213 if (selectionStart.clientId === selectionEnd.clientId) { 11214 return null; 11215 } 11216 return selectionEnd.clientId || null; 11217 } 11218 function __unstableIsFullySelected(state) { 11219 const selectionAnchor = getSelectionStart(state); 11220 const selectionFocus = getSelectionEnd(state); 11221 return !selectionAnchor.attributeKey && !selectionFocus.attributeKey && typeof selectionAnchor.offset === "undefined" && typeof selectionFocus.offset === "undefined"; 11222 } 11223 function __unstableIsSelectionCollapsed(state) { 11224 const selectionAnchor = getSelectionStart(state); 11225 const selectionFocus = getSelectionEnd(state); 11226 return !!selectionAnchor && !!selectionFocus && selectionAnchor.clientId === selectionFocus.clientId && selectionAnchor.attributeKey === selectionFocus.attributeKey && selectionAnchor.offset === selectionFocus.offset; 11227 } 11228 function __unstableSelectionHasUnmergeableBlock(state) { 11229 return getSelectedBlockClientIds(state).some((clientId) => { 11230 const blockName = getBlockName(state, clientId); 11231 const blockType = (0,external_wp_blocks_namespaceObject.getBlockType)(blockName); 11232 return !blockType.merge; 11233 }); 11234 } 11235 function __unstableIsSelectionMergeable(state, isForward) { 11236 const selectionAnchor = getSelectionStart(state); 11237 const selectionFocus = getSelectionEnd(state); 11238 if (selectionAnchor.clientId === selectionFocus.clientId) { 11239 return false; 11240 } 11241 if (!selectionAnchor.attributeKey || !selectionFocus.attributeKey || typeof selectionAnchor.offset === "undefined" || typeof selectionFocus.offset === "undefined") { 11242 return false; 11243 } 11244 const anchorRootClientId = getBlockRootClientId( 11245 state, 11246 selectionAnchor.clientId 11247 ); 11248 const focusRootClientId = getBlockRootClientId( 11249 state, 11250 selectionFocus.clientId 11251 ); 11252 if (anchorRootClientId !== focusRootClientId) { 11253 return false; 11254 } 11255 const blockOrder = getBlockOrder(state, anchorRootClientId); 11256 const anchorIndex = blockOrder.indexOf(selectionAnchor.clientId); 11257 const focusIndex = blockOrder.indexOf(selectionFocus.clientId); 11258 let selectionStart, selectionEnd; 11259 if (anchorIndex > focusIndex) { 11260 selectionStart = selectionFocus; 11261 selectionEnd = selectionAnchor; 11262 } else { 11263 selectionStart = selectionAnchor; 11264 selectionEnd = selectionFocus; 11265 } 11266 const targetBlockClientId = isForward ? selectionEnd.clientId : selectionStart.clientId; 11267 const blockToMergeClientId = isForward ? selectionStart.clientId : selectionEnd.clientId; 11268 const targetBlockName = getBlockName(state, targetBlockClientId); 11269 const targetBlockType = (0,external_wp_blocks_namespaceObject.getBlockType)(targetBlockName); 11270 if (!targetBlockType.merge) { 11271 return false; 11272 } 11273 const blockToMerge = getBlock(state, blockToMergeClientId); 11274 if (blockToMerge.name === targetBlockName) { 11275 return true; 11276 } 11277 const blocksToMerge = (0,external_wp_blocks_namespaceObject.switchToBlockType)(blockToMerge, targetBlockName); 11278 return blocksToMerge && blocksToMerge.length; 11279 } 11280 const __unstableGetSelectedBlocksWithPartialSelection = (state) => { 11281 const selectionAnchor = getSelectionStart(state); 11282 const selectionFocus = getSelectionEnd(state); 11283 if (selectionAnchor.clientId === selectionFocus.clientId) { 11284 return selectors_EMPTY_ARRAY; 11285 } 11286 if (!selectionAnchor.attributeKey || !selectionFocus.attributeKey || typeof selectionAnchor.offset === "undefined" || typeof selectionFocus.offset === "undefined") { 11287 return selectors_EMPTY_ARRAY; 11288 } 11289 const anchorRootClientId = getBlockRootClientId( 11290 state, 11291 selectionAnchor.clientId 11292 ); 11293 const focusRootClientId = getBlockRootClientId( 11294 state, 11295 selectionFocus.clientId 11296 ); 11297 if (anchorRootClientId !== focusRootClientId) { 11298 return selectors_EMPTY_ARRAY; 11299 } 11300 const blockOrder = getBlockOrder(state, anchorRootClientId); 11301 const anchorIndex = blockOrder.indexOf(selectionAnchor.clientId); 11302 const focusIndex = blockOrder.indexOf(selectionFocus.clientId); 11303 const [selectionStart, selectionEnd] = anchorIndex > focusIndex ? [selectionFocus, selectionAnchor] : [selectionAnchor, selectionFocus]; 11304 const blockA = getBlock(state, selectionStart.clientId); 11305 const blockB = getBlock(state, selectionEnd.clientId); 11306 const htmlA = blockA.attributes[selectionStart.attributeKey]; 11307 const htmlB = blockB.attributes[selectionEnd.attributeKey]; 11308 let valueA = (0,external_wp_richText_namespaceObject.create)({ html: htmlA }); 11309 let valueB = (0,external_wp_richText_namespaceObject.create)({ html: htmlB }); 11310 valueA = (0,external_wp_richText_namespaceObject.remove)(valueA, 0, selectionStart.offset); 11311 valueB = (0,external_wp_richText_namespaceObject.remove)(valueB, selectionEnd.offset, valueB.text.length); 11312 return [ 11313 { 11314 ...blockA, 11315 attributes: { 11316 ...blockA.attributes, 11317 [selectionStart.attributeKey]: (0,external_wp_richText_namespaceObject.toHTMLString)({ 11318 value: valueA 11319 }) 11320 } 11321 }, 11322 { 11323 ...blockB, 11324 attributes: { 11325 ...blockB.attributes, 11326 [selectionEnd.attributeKey]: (0,external_wp_richText_namespaceObject.toHTMLString)({ 11327 value: valueB 11328 }) 11329 } 11330 } 11331 ]; 11332 }; 11333 function getBlockOrder(state, rootClientId) { 11334 return state.blocks.order.get(rootClientId || "") || selectors_EMPTY_ARRAY; 11335 } 11336 function getBlockIndex(state, clientId) { 11337 const rootClientId = getBlockRootClientId(state, clientId); 11338 return getBlockOrder(state, rootClientId).indexOf(clientId); 11339 } 11340 function isBlockSelected(state, clientId) { 11341 const { selectionStart, selectionEnd } = state.selection; 11342 if (selectionStart.clientId !== selectionEnd.clientId) { 11343 return false; 11344 } 11345 return selectionStart.clientId === clientId; 11346 } 11347 function hasSelectedInnerBlock(state, clientId, deep = false) { 11348 const selectedBlockClientIds = getSelectedBlockClientIds(state); 11349 if (!selectedBlockClientIds.length) { 11350 return false; 11351 } 11352 if (deep) { 11353 return selectedBlockClientIds.some( 11354 (id) => ( 11355 // Pass true because we don't care about order and it's more 11356 // performant. 11357 getBlockParents(state, id, true).includes(clientId) 11358 ) 11359 ); 11360 } 11361 return selectedBlockClientIds.some( 11362 (id) => getBlockRootClientId(state, id) === clientId 11363 ); 11364 } 11365 function hasDraggedInnerBlock(state, clientId, deep = false) { 11366 return getBlockOrder(state, clientId).some( 11367 (innerClientId) => isBlockBeingDragged(state, innerClientId) || deep && hasDraggedInnerBlock(state, innerClientId, deep) 11368 ); 11369 } 11370 function isBlockWithinSelection(state, clientId) { 11371 if (!clientId) { 11372 return false; 11373 } 11374 const clientIds = getMultiSelectedBlockClientIds(state); 11375 const index = clientIds.indexOf(clientId); 11376 return index > -1 && index < clientIds.length - 1; 11377 } 11378 function hasMultiSelection(state) { 11379 const { selectionStart, selectionEnd } = state.selection; 11380 return selectionStart.clientId !== selectionEnd.clientId; 11381 } 11382 function selectors_isMultiSelecting(state) { 11383 return state.isMultiSelecting; 11384 } 11385 function selectors_isSelectionEnabled(state) { 11386 return state.isSelectionEnabled; 11387 } 11388 function getBlockMode(state, clientId) { 11389 return state.blocksMode[clientId] || "visual"; 11390 } 11391 function selectors_isTyping(state) { 11392 return state.isTyping; 11393 } 11394 function isDraggingBlocks(state) { 11395 return !!state.draggedBlocks.length; 11396 } 11397 function getDraggedBlockClientIds(state) { 11398 return state.draggedBlocks; 11399 } 11400 function isBlockBeingDragged(state, clientId) { 11401 return state.draggedBlocks.includes(clientId); 11402 } 11403 function isAncestorBeingDragged(state, clientId) { 11404 if (!isDraggingBlocks(state)) { 11405 return false; 11406 } 11407 const parents = getBlockParents(state, clientId); 11408 return parents.some( 11409 (parentClientId) => isBlockBeingDragged(state, parentClientId) 11410 ); 11411 } 11412 function isCaretWithinFormattedText() { 11413 external_wp_deprecated_default()( 11414 'wp.data.select( "core/block-editor" ).isCaretWithinFormattedText', 11415 { 11416 since: "6.1", 11417 version: "6.3" 11418 } 11419 ); 11420 return false; 11421 } 11422 const getBlockInsertionPoint = (0,external_wp_data_namespaceObject.createSelector)( 11423 (state) => { 11424 let rootClientId, index; 11425 const { 11426 insertionCue, 11427 selection: { selectionEnd } 11428 } = state; 11429 if (insertionCue !== null) { 11430 return insertionCue; 11431 } 11432 const { clientId } = selectionEnd; 11433 if (clientId) { 11434 rootClientId = getBlockRootClientId(state, clientId) || void 0; 11435 index = getBlockIndex(state, selectionEnd.clientId) + 1; 11436 } else { 11437 index = getBlockOrder(state).length; 11438 } 11439 return { rootClientId, index }; 11440 }, 11441 (state) => [ 11442 state.insertionCue, 11443 state.selection.selectionEnd.clientId, 11444 state.blocks.parents, 11445 state.blocks.order 11446 ] 11447 ); 11448 function isBlockInsertionPointVisible(state) { 11449 return state.insertionCue !== null; 11450 } 11451 function isValidTemplate(state) { 11452 return state.template.isValid; 11453 } 11454 function getTemplate(state) { 11455 return state.settings.template; 11456 } 11457 function getTemplateLock(state, rootClientId) { 11458 if (!rootClientId) { 11459 return state.settings.templateLock ?? false; 11460 } 11461 return getBlockListSettings(state, rootClientId)?.templateLock ?? false; 11462 } 11463 const isBlockVisibleInTheInserter = (state, blockNameOrType, rootClientId = null) => { 11464 let blockType; 11465 let blockName; 11466 if (blockNameOrType && "object" === typeof blockNameOrType) { 11467 blockType = blockNameOrType; 11468 blockName = blockNameOrType.name; 11469 } else { 11470 blockType = (0,external_wp_blocks_namespaceObject.getBlockType)(blockNameOrType); 11471 blockName = blockNameOrType; 11472 } 11473 if (!blockType) { 11474 return false; 11475 } 11476 const { allowedBlockTypes } = getSettings(state); 11477 const isBlockAllowedInEditor = checkAllowList( 11478 allowedBlockTypes, 11479 blockName, 11480 true 11481 ); 11482 if (!isBlockAllowedInEditor) { 11483 return false; 11484 } 11485 const parents = (Array.isArray(blockType.parent) ? blockType.parent : []).concat(Array.isArray(blockType.ancestor) ? blockType.ancestor : []); 11486 if (parents.length > 0) { 11487 if (parents.includes("core/post-content")) { 11488 return true; 11489 } 11490 let current = rootClientId; 11491 let hasParent = false; 11492 do { 11493 if (parents.includes(getBlockName(state, current))) { 11494 hasParent = true; 11495 break; 11496 } 11497 current = state.blocks.parents.get(current); 11498 } while (current); 11499 return hasParent; 11500 } 11501 return true; 11502 }; 11503 const canInsertBlockTypeUnmemoized = (state, blockName, rootClientId = null) => { 11504 if (!isBlockVisibleInTheInserter(state, blockName, rootClientId)) { 11505 return false; 11506 } 11507 let blockType; 11508 if (blockName && "object" === typeof blockName) { 11509 blockType = blockName; 11510 blockName = blockType.name; 11511 } else { 11512 blockType = (0,external_wp_blocks_namespaceObject.getBlockType)(blockName); 11513 } 11514 if (getTemplateLock(state, rootClientId)) { 11515 return false; 11516 } 11517 const blockEditingMode = getBlockEditingMode(state, rootClientId ?? ""); 11518 if (blockEditingMode === "disabled") { 11519 return false; 11520 } 11521 const parentBlockListSettings = getBlockListSettings(state, rootClientId); 11522 if (rootClientId && parentBlockListSettings === void 0) { 11523 return false; 11524 } 11525 const isContentRoleBlock = selectors_isContentBlock(blockName); 11526 const isParentSectionBlock = !!isSectionBlock(state, rootClientId); 11527 const isBlockWithinSection = !!getParentSectionBlock( 11528 state, 11529 rootClientId 11530 ); 11531 if ((isParentSectionBlock || isBlockWithinSection) && !isContentRoleBlock) { 11532 return false; 11533 } 11534 if ((isParentSectionBlock || blockEditingMode === "contentOnly") && !isContainerInsertableToInContentOnlyMode( 11535 state, 11536 blockName, 11537 rootClientId 11538 )) { 11539 return false; 11540 } 11541 const parentName = getBlockName(state, rootClientId); 11542 const parentBlockType = (0,external_wp_blocks_namespaceObject.getBlockType)(parentName); 11543 const parentAllowedChildBlocks = parentBlockType?.allowedBlocks; 11544 let hasParentAllowedBlock = checkAllowList( 11545 parentAllowedChildBlocks, 11546 blockName 11547 ); 11548 if (hasParentAllowedBlock !== false) { 11549 const parentAllowedBlocks = parentBlockListSettings?.allowedBlocks; 11550 const hasParentListAllowedBlock = checkAllowList( 11551 parentAllowedBlocks, 11552 blockName 11553 ); 11554 if (hasParentListAllowedBlock !== null) { 11555 hasParentAllowedBlock = hasParentListAllowedBlock; 11556 } 11557 } 11558 const blockAllowedParentBlocks = blockType.parent; 11559 const hasBlockAllowedParent = checkAllowList( 11560 blockAllowedParentBlocks, 11561 parentName 11562 ); 11563 let hasBlockAllowedAncestor = true; 11564 const blockAllowedAncestorBlocks = blockType.ancestor; 11565 if (blockAllowedAncestorBlocks) { 11566 const ancestors = [ 11567 rootClientId, 11568 ...getBlockParents(state, rootClientId) 11569 ]; 11570 hasBlockAllowedAncestor = ancestors.some( 11571 (ancestorClientId) => checkAllowList( 11572 blockAllowedAncestorBlocks, 11573 getBlockName(state, ancestorClientId) 11574 ) 11575 ); 11576 } 11577 const canInsert = hasBlockAllowedAncestor && (hasParentAllowedBlock === null && hasBlockAllowedParent === null || hasParentAllowedBlock === true || hasBlockAllowedParent === true); 11578 if (!canInsert) { 11579 return canInsert; 11580 } 11581 return (0,external_wp_hooks_namespaceObject.applyFilters)( 11582 "blockEditor.__unstableCanInsertBlockType", 11583 canInsert, 11584 blockType, 11585 rootClientId, 11586 { 11587 // Pass bound selectors of the current registry. If we're in a nested 11588 // context, the data will differ from the one selected from the root 11589 // registry. 11590 getBlock: getBlock.bind(null, state), 11591 getBlockParentsByBlockName: getBlockParentsByBlockName.bind( 11592 null, 11593 state 11594 ) 11595 } 11596 ); 11597 }; 11598 const canInsertBlockType = (0,external_wp_data_namespaceObject.createRegistrySelector)( 11599 (select) => (0,external_wp_data_namespaceObject.createSelector)( 11600 canInsertBlockTypeUnmemoized, 11601 (state, blockName, rootClientId) => getInsertBlockTypeDependants(select)(state, rootClientId) 11602 ) 11603 ); 11604 function canInsertBlocks(state, clientIds, rootClientId = null) { 11605 return clientIds.every( 11606 (id) => canInsertBlockType(state, getBlockName(state, id), rootClientId) 11607 ); 11608 } 11609 function canRemoveBlock(state, clientId) { 11610 const attributes = getBlockAttributes(state, clientId); 11611 if (attributes === null) { 11612 return true; 11613 } 11614 if (attributes.lock?.remove !== void 0) { 11615 return !attributes.lock.remove; 11616 } 11617 const rootClientId = getBlockRootClientId(state, clientId); 11618 if (getTemplateLock(state, rootClientId)) { 11619 return false; 11620 } 11621 const isBlockWithinSection = !!getParentSectionBlock(state, clientId); 11622 const isContentRoleBlock = selectors_isContentBlock( 11623 getBlockName(state, clientId) 11624 ); 11625 if (isBlockWithinSection && !isContentRoleBlock) { 11626 return false; 11627 } 11628 const isParentSectionBlock = !!isSectionBlock(state, rootClientId); 11629 const rootBlockEditingMode = getBlockEditingMode(state, rootClientId); 11630 if ((isParentSectionBlock || rootBlockEditingMode === "contentOnly") && !isContainerInsertableToInContentOnlyMode( 11631 state, 11632 getBlockName(state, clientId), 11633 rootClientId 11634 )) { 11635 return false; 11636 } 11637 return rootBlockEditingMode !== "disabled"; 11638 } 11639 function canRemoveBlocks(state, clientIds) { 11640 return clientIds.every((clientId) => canRemoveBlock(state, clientId)); 11641 } 11642 function canMoveBlock(state, clientId) { 11643 const attributes = getBlockAttributes(state, clientId); 11644 if (attributes === null) { 11645 return true; 11646 } 11647 if (attributes.lock?.move !== void 0) { 11648 return !attributes.lock.move; 11649 } 11650 const rootClientId = getBlockRootClientId(state, clientId); 11651 const templateLock = getTemplateLock(state, rootClientId); 11652 if (templateLock === "all" || templateLock === "contentOnly") { 11653 return false; 11654 } 11655 const isBlockWithinSection = !!getParentSectionBlock(state, clientId); 11656 const isContentRoleBlock = selectors_isContentBlock( 11657 getBlockName(state, clientId) 11658 ); 11659 if (isBlockWithinSection && !isContentRoleBlock) { 11660 return false; 11661 } 11662 const isParentSectionBlock = !!isSectionBlock(state, rootClientId); 11663 const rootBlockEditingMode = getBlockEditingMode(state, rootClientId); 11664 if ((isParentSectionBlock || rootBlockEditingMode === "contentOnly") && !isContainerInsertableToInContentOnlyMode( 11665 state, 11666 getBlockName(state, clientId), 11667 rootClientId 11668 )) { 11669 return false; 11670 } 11671 return getBlockEditingMode(state, rootClientId) !== "disabled"; 11672 } 11673 function canMoveBlocks(state, clientIds) { 11674 return clientIds.every((clientId) => canMoveBlock(state, clientId)); 11675 } 11676 function canEditBlock(state, clientId) { 11677 const attributes = getBlockAttributes(state, clientId); 11678 if (attributes === null) { 11679 return true; 11680 } 11681 const { lock } = attributes; 11682 return !lock?.edit; 11683 } 11684 function canLockBlockType(state, nameOrType) { 11685 if (!(0,external_wp_blocks_namespaceObject.hasBlockSupport)(nameOrType, "lock", true)) { 11686 return false; 11687 } 11688 return !!state.settings?.canLockBlocks; 11689 } 11690 function getInsertUsage(state, id) { 11691 return state.preferences.insertUsage?.[id] ?? null; 11692 } 11693 const canIncludeBlockTypeInInserter = (state, blockType, rootClientId) => { 11694 if (!(0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockType, "inserter", true)) { 11695 return false; 11696 } 11697 return canInsertBlockTypeUnmemoized(state, blockType.name, rootClientId); 11698 }; 11699 const getItemFromVariation = (state, item) => (variation) => { 11700 const variationId = `$item.id}/$variation.name}`; 11701 const { time, count = 0 } = getInsertUsage(state, variationId) || {}; 11702 return { 11703 ...item, 11704 id: variationId, 11705 icon: variation.icon || item.icon, 11706 title: variation.title || item.title, 11707 description: variation.description || item.description, 11708 category: variation.category || item.category, 11709 // If `example` is explicitly undefined for the variation, the preview will not be shown. 11710 example: variation.hasOwnProperty("example") ? variation.example : item.example, 11711 initialAttributes: { 11712 ...item.initialAttributes, 11713 ...variation.attributes 11714 }, 11715 innerBlocks: variation.innerBlocks, 11716 keywords: variation.keywords || item.keywords, 11717 frecency: calculateFrecency(time, count) 11718 }; 11719 }; 11720 const calculateFrecency = (time, count) => { 11721 if (!time) { 11722 return count; 11723 } 11724 const duration = Date.now() - time; 11725 switch (true) { 11726 case duration < MILLISECONDS_PER_HOUR: 11727 return count * 4; 11728 case duration < MILLISECONDS_PER_DAY: 11729 return count * 2; 11730 case duration < MILLISECONDS_PER_WEEK: 11731 return count / 2; 11732 default: 11733 return count / 4; 11734 } 11735 }; 11736 const buildBlockTypeItem = (state, { buildScope = "inserter" }) => (blockType) => { 11737 const id = blockType.name; 11738 let isDisabled = false; 11739 if (!(0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockType.name, "multiple", true)) { 11740 isDisabled = getBlocksByClientId( 11741 state, 11742 getClientIdsWithDescendants(state) 11743 ).some(({ name }) => name === blockType.name); 11744 } 11745 const { time, count = 0 } = getInsertUsage(state, id) || {}; 11746 const blockItemBase = { 11747 id, 11748 name: blockType.name, 11749 title: blockType.title, 11750 icon: blockType.icon, 11751 isDisabled, 11752 frecency: calculateFrecency(time, count) 11753 }; 11754 if (buildScope === "transform") { 11755 return blockItemBase; 11756 } 11757 const inserterVariations = (0,external_wp_blocks_namespaceObject.getBlockVariations)( 11758 blockType.name, 11759 "inserter" 11760 ); 11761 return { 11762 ...blockItemBase, 11763 initialAttributes: {}, 11764 description: blockType.description, 11765 category: blockType.category, 11766 keywords: blockType.keywords, 11767 parent: blockType.parent, 11768 ancestor: blockType.ancestor, 11769 variations: inserterVariations, 11770 example: blockType.example, 11771 utility: 1 11772 // Deprecated. 11773 }; 11774 }; 11775 const getInserterItems = (0,external_wp_data_namespaceObject.createRegistrySelector)( 11776 (select) => (0,external_wp_data_namespaceObject.createSelector)( 11777 (state, rootClientId = null, options = DEFAULT_INSERTER_OPTIONS) => { 11778 const buildReusableBlockInserterItem = (reusableBlock) => { 11779 const icon = !reusableBlock.wp_pattern_sync_status ? { 11780 src: symbol_default, 11781 foreground: "var(--wp-block-synced-color)" 11782 } : symbol_default; 11783 const userPattern = mapUserPattern(reusableBlock); 11784 const { time, count = 0 } = getInsertUsage(state, userPattern.name) || {}; 11785 const frecency = calculateFrecency(time, count); 11786 return { 11787 id: userPattern.name, 11788 name: "core/block", 11789 initialAttributes: { ref: reusableBlock.id }, 11790 title: userPattern.title, 11791 icon, 11792 category: "reusable", 11793 keywords: ["reusable"], 11794 isDisabled: false, 11795 utility: 1, 11796 // Deprecated. 11797 frecency, 11798 content: userPattern.content, 11799 get blocks() { 11800 return getParsedPattern(userPattern).blocks; 11801 }, 11802 syncStatus: userPattern.syncStatus 11803 }; 11804 }; 11805 const patternInserterItems = canInsertBlockTypeUnmemoized( 11806 state, 11807 "core/block", 11808 rootClientId 11809 ) ? unlock(select(STORE_NAME)).getReusableBlocks().map(buildReusableBlockInserterItem) : []; 11810 const buildBlockTypeInserterItem = buildBlockTypeItem(state, { 11811 buildScope: "inserter" 11812 }); 11813 let blockTypeInserterItems = (0,external_wp_blocks_namespaceObject.getBlockTypes)().filter( 11814 (blockType) => (0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockType, "inserter", true) 11815 ).map(buildBlockTypeInserterItem); 11816 if (options[isFiltered] !== false) { 11817 blockTypeInserterItems = blockTypeInserterItems.filter( 11818 (blockType) => canIncludeBlockTypeInInserter( 11819 state, 11820 blockType, 11821 rootClientId 11822 ) 11823 ); 11824 } else { 11825 blockTypeInserterItems = blockTypeInserterItems.filter( 11826 (blockType) => isBlockVisibleInTheInserter( 11827 state, 11828 blockType, 11829 rootClientId 11830 ) 11831 ).map((blockType) => ({ 11832 ...blockType, 11833 isAllowedInCurrentRoot: canIncludeBlockTypeInInserter( 11834 state, 11835 blockType, 11836 rootClientId 11837 ) 11838 })); 11839 } 11840 const items = blockTypeInserterItems.reduce( 11841 (accumulator, item) => { 11842 const { variations = [] } = item; 11843 if (!variations.some(({ isDefault }) => isDefault)) { 11844 accumulator.push(item); 11845 } 11846 if (variations.length) { 11847 const variationMapper = getItemFromVariation( 11848 state, 11849 item 11850 ); 11851 accumulator.push( 11852 ...variations.map(variationMapper) 11853 ); 11854 } 11855 return accumulator; 11856 }, 11857 [] 11858 ); 11859 const groupByType = (blocks, block) => { 11860 const { core, noncore } = blocks; 11861 const type = block.name.startsWith("core/") ? core : noncore; 11862 type.push(block); 11863 return blocks; 11864 }; 11865 const { core: coreItems, noncore: nonCoreItems } = items.reduce( 11866 groupByType, 11867 { core: [], noncore: [] } 11868 ); 11869 const sortedBlockTypes = [...coreItems, ...nonCoreItems]; 11870 return [...sortedBlockTypes, ...patternInserterItems]; 11871 }, 11872 (state, rootClientId) => [ 11873 (0,external_wp_blocks_namespaceObject.getBlockTypes)(), 11874 unlock(select(STORE_NAME)).getReusableBlocks(), 11875 state.blocks.order, 11876 state.preferences.insertUsage, 11877 ...getInsertBlockTypeDependants(select)(state, rootClientId) 11878 ] 11879 ) 11880 ); 11881 const getBlockTransformItems = (0,external_wp_data_namespaceObject.createRegistrySelector)( 11882 (select) => (0,external_wp_data_namespaceObject.createSelector)( 11883 (state, blocks, rootClientId = null) => { 11884 const normalizedBlocks = Array.isArray(blocks) ? blocks : [blocks]; 11885 const buildBlockTypeTransformItem = buildBlockTypeItem(state, { 11886 buildScope: "transform" 11887 }); 11888 const blockTypeTransformItems = (0,external_wp_blocks_namespaceObject.getBlockTypes)().filter( 11889 (blockType) => canIncludeBlockTypeInInserter( 11890 state, 11891 blockType, 11892 rootClientId 11893 ) 11894 ).map(buildBlockTypeTransformItem); 11895 const itemsByName = Object.fromEntries( 11896 Object.entries(blockTypeTransformItems).map( 11897 ([, value]) => [value.name, value] 11898 ) 11899 ); 11900 const possibleTransforms = (0,external_wp_blocks_namespaceObject.getPossibleBlockTransformations)( 11901 normalizedBlocks 11902 ).reduce((accumulator, block) => { 11903 if (itemsByName[block?.name]) { 11904 accumulator.push(itemsByName[block.name]); 11905 } 11906 return accumulator; 11907 }, []); 11908 return orderBy( 11909 possibleTransforms, 11910 (block) => itemsByName[block.name].frecency, 11911 "desc" 11912 ); 11913 }, 11914 (state, blocks, rootClientId) => [ 11915 (0,external_wp_blocks_namespaceObject.getBlockTypes)(), 11916 state.preferences.insertUsage, 11917 ...getInsertBlockTypeDependants(select)(state, rootClientId) 11918 ] 11919 ) 11920 ); 11921 const hasInserterItems = (state, rootClientId = null) => { 11922 const hasBlockType = (0,external_wp_blocks_namespaceObject.getBlockTypes)().some( 11923 (blockType) => canIncludeBlockTypeInInserter(state, blockType, rootClientId) 11924 ); 11925 if (hasBlockType) { 11926 return true; 11927 } 11928 const hasReusableBlock = canInsertBlockTypeUnmemoized( 11929 state, 11930 "core/block", 11931 rootClientId 11932 ); 11933 return hasReusableBlock; 11934 }; 11935 const getAllowedBlocks = (0,external_wp_data_namespaceObject.createRegistrySelector)( 11936 (select) => (0,external_wp_data_namespaceObject.createSelector)( 11937 (state, rootClientId = null) => { 11938 if (!rootClientId) { 11939 return; 11940 } 11941 const blockTypes = (0,external_wp_blocks_namespaceObject.getBlockTypes)().filter( 11942 (blockType) => canIncludeBlockTypeInInserter(state, blockType, rootClientId) 11943 ); 11944 const hasReusableBlock = canInsertBlockTypeUnmemoized( 11945 state, 11946 "core/block", 11947 rootClientId 11948 ); 11949 if (hasReusableBlock) { 11950 blockTypes.push("core/block"); 11951 } 11952 return blockTypes; 11953 }, 11954 (state, rootClientId) => [ 11955 (0,external_wp_blocks_namespaceObject.getBlockTypes)(), 11956 ...getInsertBlockTypeDependants(select)(state, rootClientId) 11957 ] 11958 ) 11959 ); 11960 const __experimentalGetAllowedBlocks = (0,external_wp_data_namespaceObject.createSelector)( 11961 (state, rootClientId = null) => { 11962 external_wp_deprecated_default()( 11963 'wp.data.select( "core/block-editor" ).__experimentalGetAllowedBlocks', 11964 { 11965 alternative: 'wp.data.select( "core/block-editor" ).getAllowedBlocks', 11966 since: "6.2", 11967 version: "6.4" 11968 } 11969 ); 11970 return getAllowedBlocks(state, rootClientId); 11971 }, 11972 (state, rootClientId) => getAllowedBlocks.getDependants(state, rootClientId) 11973 ); 11974 function getDirectInsertBlock(state, rootClientId = null) { 11975 if (!rootClientId) { 11976 return; 11977 } 11978 const { defaultBlock, directInsert } = state.blockListSettings[rootClientId] ?? {}; 11979 if (!defaultBlock || !directInsert) { 11980 return; 11981 } 11982 return defaultBlock; 11983 } 11984 function __experimentalGetDirectInsertBlock(state, rootClientId = null) { 11985 external_wp_deprecated_default()( 11986 'wp.data.select( "core/block-editor" ).__experimentalGetDirectInsertBlock', 11987 { 11988 alternative: 'wp.data.select( "core/block-editor" ).getDirectInsertBlock', 11989 since: "6.3", 11990 version: "6.4" 11991 } 11992 ); 11993 return getDirectInsertBlock(state, rootClientId); 11994 } 11995 const __experimentalGetParsedPattern = (0,external_wp_data_namespaceObject.createRegistrySelector)( 11996 (select) => (state, patternName) => { 11997 const pattern = unlock(select(STORE_NAME)).getPatternBySlug( 11998 patternName 11999 ); 12000 return pattern ? getParsedPattern(pattern) : null; 12001 } 12002 ); 12003 const getAllowedPatternsDependants = (select) => (state, rootClientId) => [ 12004 ...getAllPatternsDependants(select)(state), 12005 ...getInsertBlockTypeDependants(select)(state, rootClientId) 12006 ]; 12007 const patternsWithParsedBlocks = /* @__PURE__ */ new WeakMap(); 12008 function enhancePatternWithParsedBlocks(pattern) { 12009 let enhancedPattern = patternsWithParsedBlocks.get(pattern); 12010 if (!enhancedPattern) { 12011 enhancedPattern = { 12012 ...pattern, 12013 get blocks() { 12014 return getParsedPattern(pattern).blocks; 12015 } 12016 }; 12017 patternsWithParsedBlocks.set(pattern, enhancedPattern); 12018 } 12019 return enhancedPattern; 12020 } 12021 const __experimentalGetAllowedPatterns = (0,external_wp_data_namespaceObject.createRegistrySelector)( 12022 (select) => { 12023 return (0,external_wp_data_namespaceObject.createSelector)( 12024 (state, rootClientId = null, options = DEFAULT_INSERTER_OPTIONS) => { 12025 const { getAllPatterns } = unlock(select(STORE_NAME)); 12026 const patterns = getAllPatterns(); 12027 const { allowedBlockTypes } = getSettings(state); 12028 const parsedPatterns = patterns.filter(({ inserter = true }) => !!inserter).map(enhancePatternWithParsedBlocks); 12029 const availableParsedPatterns = parsedPatterns.filter( 12030 (pattern) => checkAllowListRecursive( 12031 getGrammar(pattern), 12032 allowedBlockTypes 12033 ) 12034 ); 12035 const patternsAllowed = availableParsedPatterns.filter( 12036 (pattern) => getGrammar(pattern).every( 12037 ({ blockName: name }) => options[isFiltered] !== false ? canInsertBlockType( 12038 state, 12039 name, 12040 rootClientId 12041 ) : isBlockVisibleInTheInserter( 12042 state, 12043 name, 12044 rootClientId 12045 ) 12046 ) 12047 ); 12048 return patternsAllowed; 12049 }, 12050 getAllowedPatternsDependants(select) 12051 ); 12052 } 12053 ); 12054 const getPatternsByBlockTypes = (0,external_wp_data_namespaceObject.createRegistrySelector)( 12055 (select) => (0,external_wp_data_namespaceObject.createSelector)( 12056 (state, blockNames, rootClientId = null) => { 12057 if (!blockNames) { 12058 return selectors_EMPTY_ARRAY; 12059 } 12060 const patterns = select(STORE_NAME).__experimentalGetAllowedPatterns( 12061 rootClientId 12062 ); 12063 const normalizedBlockNames = Array.isArray(blockNames) ? blockNames : [blockNames]; 12064 const filteredPatterns = patterns.filter( 12065 (pattern) => pattern?.blockTypes?.some?.( 12066 (blockName) => normalizedBlockNames.includes(blockName) 12067 ) 12068 ); 12069 if (filteredPatterns.length === 0) { 12070 return selectors_EMPTY_ARRAY; 12071 } 12072 return filteredPatterns; 12073 }, 12074 (state, blockNames, rootClientId) => getAllowedPatternsDependants(select)(state, rootClientId) 12075 ) 12076 ); 12077 const __experimentalGetPatternsByBlockTypes = (0,external_wp_data_namespaceObject.createRegistrySelector)( 12078 (select) => { 12079 external_wp_deprecated_default()( 12080 'wp.data.select( "core/block-editor" ).__experimentalGetPatternsByBlockTypes', 12081 { 12082 alternative: 'wp.data.select( "core/block-editor" ).getPatternsByBlockTypes', 12083 since: "6.2", 12084 version: "6.4" 12085 } 12086 ); 12087 return select(STORE_NAME).getPatternsByBlockTypes; 12088 } 12089 ); 12090 const __experimentalGetPatternTransformItems = (0,external_wp_data_namespaceObject.createRegistrySelector)( 12091 (select) => (0,external_wp_data_namespaceObject.createSelector)( 12092 (state, blocks, rootClientId = null) => { 12093 if (!blocks) { 12094 return selectors_EMPTY_ARRAY; 12095 } 12096 if (blocks.some( 12097 ({ clientId, innerBlocks }) => innerBlocks.length || areInnerBlocksControlled(state, clientId) 12098 )) { 12099 return selectors_EMPTY_ARRAY; 12100 } 12101 const selectedBlockNames = Array.from( 12102 new Set(blocks.map(({ name }) => name)) 12103 ); 12104 return select(STORE_NAME).getPatternsByBlockTypes( 12105 selectedBlockNames, 12106 rootClientId 12107 ); 12108 }, 12109 (state, blocks, rootClientId) => getAllowedPatternsDependants(select)(state, rootClientId) 12110 ) 12111 ); 12112 function getBlockListSettings(state, clientId) { 12113 return state.blockListSettings[clientId]; 12114 } 12115 function getSettings(state) { 12116 return state.settings; 12117 } 12118 function isLastBlockChangePersistent(state) { 12119 return state.blocks.isPersistentChange; 12120 } 12121 const __experimentalGetBlockListSettingsForBlocks = (0,external_wp_data_namespaceObject.createSelector)( 12122 (state, clientIds = []) => { 12123 return clientIds.reduce((blockListSettingsForBlocks, clientId) => { 12124 if (!state.blockListSettings[clientId]) { 12125 return blockListSettingsForBlocks; 12126 } 12127 return { 12128 ...blockListSettingsForBlocks, 12129 [clientId]: state.blockListSettings[clientId] 12130 }; 12131 }, {}); 12132 }, 12133 (state) => [state.blockListSettings] 12134 ); 12135 const __experimentalGetReusableBlockTitle = (0,external_wp_data_namespaceObject.createRegistrySelector)( 12136 (select) => (0,external_wp_data_namespaceObject.createSelector)( 12137 (state, ref) => { 12138 external_wp_deprecated_default()( 12139 "wp.data.select( 'core/block-editor' ).__experimentalGetReusableBlockTitle", 12140 { 12141 since: "6.6", 12142 version: "6.8" 12143 } 12144 ); 12145 const reusableBlock = unlock(select(STORE_NAME)).getReusableBlocks().find((block) => block.id === ref); 12146 if (!reusableBlock) { 12147 return null; 12148 } 12149 return reusableBlock.title?.raw; 12150 }, 12151 () => [unlock(select(STORE_NAME)).getReusableBlocks()] 12152 ) 12153 ); 12154 function __unstableIsLastBlockChangeIgnored(state) { 12155 return state.blocks.isIgnoredChange; 12156 } 12157 function __experimentalGetLastBlockAttributeChanges(state) { 12158 return state.lastBlockAttributesChange; 12159 } 12160 function hasBlockMovingClientId() { 12161 external_wp_deprecated_default()( 12162 'wp.data.select( "core/block-editor" ).hasBlockMovingClientId', 12163 { 12164 since: "6.7", 12165 hint: "Block moving mode feature has been removed" 12166 } 12167 ); 12168 return false; 12169 } 12170 function didAutomaticChange(state) { 12171 return !!state.automaticChangeStatus; 12172 } 12173 function isBlockHighlighted(state, clientId) { 12174 return state.highlightedBlock === clientId; 12175 } 12176 function areInnerBlocksControlled(state, clientId) { 12177 return !!state.blocks.controlledInnerBlocks[clientId]; 12178 } 12179 const __experimentalGetActiveBlockIdByBlockNames = (0,external_wp_data_namespaceObject.createSelector)( 12180 (state, validBlockNames) => { 12181 if (!validBlockNames.length) { 12182 return null; 12183 } 12184 const selectedBlockClientId = getSelectedBlockClientId(state); 12185 if (validBlockNames.includes( 12186 getBlockName(state, selectedBlockClientId) 12187 )) { 12188 return selectedBlockClientId; 12189 } 12190 const multiSelectedBlockClientIds = getMultiSelectedBlockClientIds(state); 12191 const entityAreaParents = getBlockParentsByBlockName( 12192 state, 12193 selectedBlockClientId || multiSelectedBlockClientIds[0], 12194 validBlockNames 12195 ); 12196 if (entityAreaParents) { 12197 return entityAreaParents[entityAreaParents.length - 1]; 12198 } 12199 return null; 12200 }, 12201 (state, validBlockNames) => [ 12202 state.selection.selectionStart.clientId, 12203 state.selection.selectionEnd.clientId, 12204 validBlockNames 12205 ] 12206 ); 12207 function wasBlockJustInserted(state, clientId, source) { 12208 const { lastBlockInserted } = state; 12209 return lastBlockInserted.clientIds?.includes(clientId) && lastBlockInserted.source === source; 12210 } 12211 function isBlockVisible(state, clientId) { 12212 return state.blockVisibility?.[clientId] ?? true; 12213 } 12214 function getHoveredBlockClientId() { 12215 external_wp_deprecated_default()( 12216 "wp.data.select( 'core/block-editor' ).getHoveredBlockClientId", 12217 { 12218 since: "6.9", 12219 version: "7.1" 12220 } 12221 ); 12222 return void 0; 12223 } 12224 const __unstableGetVisibleBlocks = (0,external_wp_data_namespaceObject.createSelector)( 12225 (state) => { 12226 const visibleBlocks = new Set( 12227 Object.keys(state.blockVisibility).filter( 12228 (key) => state.blockVisibility[key] 12229 ) 12230 ); 12231 if (visibleBlocks.size === 0) { 12232 return EMPTY_SET; 12233 } 12234 return visibleBlocks; 12235 }, 12236 (state) => [state.blockVisibility] 12237 ); 12238 function __unstableHasActiveBlockOverlayActive(state, clientId) { 12239 if (getBlockEditingMode(state, clientId) !== "default") { 12240 return false; 12241 } 12242 if (!canEditBlock(state, clientId)) { 12243 return true; 12244 } 12245 if (isZoomOut(state)) { 12246 const sectionRootClientId = getSectionRootClientId(state); 12247 if (sectionRootClientId) { 12248 const sectionClientIds = getBlockOrder( 12249 state, 12250 sectionRootClientId 12251 ); 12252 if (sectionClientIds?.includes(clientId)) { 12253 return true; 12254 } 12255 } else if (clientId && !getBlockRootClientId(state, clientId)) { 12256 return true; 12257 } 12258 } 12259 const blockSupportDisable = (0,external_wp_blocks_namespaceObject.hasBlockSupport)( 12260 getBlockName(state, clientId), 12261 "__experimentalDisableBlockOverlay", 12262 false 12263 ); 12264 const shouldEnableIfUnselected = blockSupportDisable ? false : areInnerBlocksControlled(state, clientId); 12265 return shouldEnableIfUnselected && !isBlockSelected(state, clientId) && !hasSelectedInnerBlock(state, clientId, true); 12266 } 12267 function __unstableIsWithinBlockOverlay(state, clientId) { 12268 let parent = state.blocks.parents.get(clientId); 12269 while (!!parent) { 12270 if (__unstableHasActiveBlockOverlayActive(state, parent)) { 12271 return true; 12272 } 12273 parent = state.blocks.parents.get(parent); 12274 } 12275 return false; 12276 } 12277 function getBlockEditingMode(state, clientId = "") { 12278 if (clientId === null) { 12279 clientId = ""; 12280 } 12281 if (state.derivedBlockEditingModes?.has(clientId)) { 12282 return state.derivedBlockEditingModes.get(clientId); 12283 } 12284 if (state.blockEditingModes.has(clientId)) { 12285 return state.blockEditingModes.get(clientId); 12286 } 12287 return "default"; 12288 } 12289 const isUngroupable = (0,external_wp_data_namespaceObject.createRegistrySelector)( 12290 (select) => (state, clientId = "") => { 12291 const _clientId = clientId || getSelectedBlockClientId(state); 12292 if (!_clientId) { 12293 return false; 12294 } 12295 const { getGroupingBlockName } = select(external_wp_blocks_namespaceObject.store); 12296 const block = getBlock(state, _clientId); 12297 const groupingBlockName = getGroupingBlockName(); 12298 const _isUngroupable = block && (block.name === groupingBlockName || (0,external_wp_blocks_namespaceObject.getBlockType)(block.name)?.transforms?.ungroup) && !!block.innerBlocks.length; 12299 return _isUngroupable && canRemoveBlock(state, _clientId); 12300 } 12301 ); 12302 const isGroupable = (0,external_wp_data_namespaceObject.createRegistrySelector)( 12303 (select) => (state, clientIds = selectors_EMPTY_ARRAY) => { 12304 const { getGroupingBlockName } = select(external_wp_blocks_namespaceObject.store); 12305 const groupingBlockName = getGroupingBlockName(); 12306 const _clientIds = clientIds?.length ? clientIds : getSelectedBlockClientIds(state); 12307 const rootClientId = _clientIds?.length ? getBlockRootClientId(state, _clientIds[0]) : void 0; 12308 const groupingBlockAvailable = canInsertBlockType( 12309 state, 12310 groupingBlockName, 12311 rootClientId 12312 ); 12313 const _isGroupable = groupingBlockAvailable && _clientIds.length; 12314 return _isGroupable && canRemoveBlocks(state, _clientIds); 12315 } 12316 ); 12317 const __unstableGetContentLockingParent = (state, clientId) => { 12318 external_wp_deprecated_default()( 12319 "wp.data.select( 'core/block-editor' ).__unstableGetContentLockingParent", 12320 { 12321 since: "6.1", 12322 version: "6.7" 12323 } 12324 ); 12325 return getContentLockingParent(state, clientId); 12326 }; 12327 function __unstableGetTemporarilyEditingAsBlocks(state) { 12328 external_wp_deprecated_default()( 12329 "wp.data.select( 'core/block-editor' ).__unstableGetTemporarilyEditingAsBlocks", 12330 { 12331 since: "6.1", 12332 version: "6.7" 12333 } 12334 ); 12335 return getTemporarilyEditingAsBlocks(state); 12336 } 12337 function __unstableGetTemporarilyEditingFocusModeToRevert(state) { 12338 external_wp_deprecated_default()( 12339 "wp.data.select( 'core/block-editor' ).__unstableGetTemporarilyEditingFocusModeToRevert", 12340 { 12341 since: "6.5", 12342 version: "6.7" 12343 } 12344 ); 12345 return getTemporarilyEditingFocusModeToRevert(state); 12346 } 12347 12348 12349 ;// external ["wp","a11y"] 12350 const external_wp_a11y_namespaceObject = window["wp"]["a11y"]; 12351 ;// ./node_modules/@wordpress/block-editor/build-module/store/private-actions.js 12352 12353 12354 12355 12356 12357 12358 const castArray = (maybeArray) => Array.isArray(maybeArray) ? maybeArray : [maybeArray]; 12359 const privateSettings = [ 12360 "inserterMediaCategories", 12361 "blockInspectorAnimation", 12362 "mediaSideload" 12363 ]; 12364 function __experimentalUpdateSettings(settings, { stripExperimentalSettings = false, reset = false } = {}) { 12365 let incomingSettings = settings; 12366 if (Object.hasOwn(incomingSettings, "__unstableIsPreviewMode")) { 12367 external_wp_deprecated_default()( 12368 "__unstableIsPreviewMode argument in wp.data.dispatch('core/block-editor').updateSettings", 12369 { 12370 since: "6.8", 12371 alternative: "isPreviewMode" 12372 } 12373 ); 12374 incomingSettings = { ...incomingSettings }; 12375 incomingSettings.isPreviewMode = incomingSettings.__unstableIsPreviewMode; 12376 delete incomingSettings.__unstableIsPreviewMode; 12377 } 12378 let cleanSettings = incomingSettings; 12379 if (stripExperimentalSettings && external_wp_element_namespaceObject.Platform.OS === "web") { 12380 cleanSettings = {}; 12381 for (const key in incomingSettings) { 12382 if (!privateSettings.includes(key)) { 12383 cleanSettings[key] = incomingSettings[key]; 12384 } 12385 } 12386 } 12387 return { 12388 type: "UPDATE_SETTINGS", 12389 settings: cleanSettings, 12390 reset 12391 }; 12392 } 12393 function hideBlockInterface() { 12394 return { 12395 type: "HIDE_BLOCK_INTERFACE" 12396 }; 12397 } 12398 function showBlockInterface() { 12399 return { 12400 type: "SHOW_BLOCK_INTERFACE" 12401 }; 12402 } 12403 const privateRemoveBlocks = (clientIds, selectPrevious = true, forceRemove = false) => ({ select, dispatch, registry }) => { 12404 if (!clientIds || !clientIds.length) { 12405 return; 12406 } 12407 clientIds = castArray(clientIds); 12408 const canRemoveBlocks = select.canRemoveBlocks(clientIds); 12409 if (!canRemoveBlocks) { 12410 return; 12411 } 12412 const rules = !forceRemove && select.getBlockRemovalRules(); 12413 if (rules) { 12414 let flattenBlocks2 = function(blocks) { 12415 const result = []; 12416 const stack = [...blocks]; 12417 while (stack.length) { 12418 const { innerBlocks, ...block } = stack.shift(); 12419 stack.push(...innerBlocks); 12420 result.push(block); 12421 } 12422 return result; 12423 }; 12424 var flattenBlocks = flattenBlocks2; 12425 const blockList = clientIds.map(select.getBlock); 12426 const flattenedBlocks = flattenBlocks2(blockList); 12427 let message; 12428 for (const rule of rules) { 12429 message = rule.callback(flattenedBlocks); 12430 if (message) { 12431 dispatch( 12432 displayBlockRemovalPrompt( 12433 clientIds, 12434 selectPrevious, 12435 message 12436 ) 12437 ); 12438 return; 12439 } 12440 } 12441 } 12442 if (selectPrevious) { 12443 dispatch.selectPreviousBlock(clientIds[0], selectPrevious); 12444 } 12445 registry.batch(() => { 12446 dispatch({ type: "REMOVE_BLOCKS", clientIds }); 12447 dispatch(ensureDefaultBlock()); 12448 }); 12449 }; 12450 const ensureDefaultBlock = () => ({ select, dispatch }) => { 12451 const count = select.getBlockCount(); 12452 if (count > 0) { 12453 return; 12454 } 12455 const { __unstableHasCustomAppender } = select.getSettings(); 12456 if (__unstableHasCustomAppender) { 12457 return; 12458 } 12459 dispatch.insertDefaultBlock(); 12460 }; 12461 function displayBlockRemovalPrompt(clientIds, selectPrevious, message) { 12462 return { 12463 type: "DISPLAY_BLOCK_REMOVAL_PROMPT", 12464 clientIds, 12465 selectPrevious, 12466 message 12467 }; 12468 } 12469 function clearBlockRemovalPrompt() { 12470 return { 12471 type: "CLEAR_BLOCK_REMOVAL_PROMPT" 12472 }; 12473 } 12474 function setBlockRemovalRules(rules = false) { 12475 return { 12476 type: "SET_BLOCK_REMOVAL_RULES", 12477 rules 12478 }; 12479 } 12480 function setOpenedBlockSettingsMenu(clientId) { 12481 return { 12482 type: "SET_OPENED_BLOCK_SETTINGS_MENU", 12483 clientId 12484 }; 12485 } 12486 function setStyleOverride(id, style) { 12487 return { 12488 type: "SET_STYLE_OVERRIDE", 12489 id, 12490 style 12491 }; 12492 } 12493 function deleteStyleOverride(id) { 12494 return { 12495 type: "DELETE_STYLE_OVERRIDE", 12496 id 12497 }; 12498 } 12499 function setLastFocus(lastFocus = null) { 12500 return { 12501 type: "LAST_FOCUS", 12502 lastFocus 12503 }; 12504 } 12505 function stopEditingAsBlocks(clientId) { 12506 return ({ select, dispatch, registry }) => { 12507 const focusModeToRevert = unlock( 12508 registry.select(store) 12509 ).getTemporarilyEditingFocusModeToRevert(); 12510 dispatch.__unstableMarkNextChangeAsNotPersistent(); 12511 dispatch.updateBlockAttributes(clientId, { 12512 templateLock: "contentOnly" 12513 }); 12514 dispatch.updateBlockListSettings(clientId, { 12515 ...select.getBlockListSettings(clientId), 12516 templateLock: "contentOnly" 12517 }); 12518 dispatch.updateSettings({ focusMode: focusModeToRevert }); 12519 dispatch.__unstableSetTemporarilyEditingAsBlocks(); 12520 }; 12521 } 12522 function startDragging() { 12523 return { 12524 type: "START_DRAGGING" 12525 }; 12526 } 12527 function stopDragging() { 12528 return { 12529 type: "STOP_DRAGGING" 12530 }; 12531 } 12532 function expandBlock(clientId) { 12533 return { 12534 type: "SET_BLOCK_EXPANDED_IN_LIST_VIEW", 12535 clientId 12536 }; 12537 } 12538 function setInsertionPoint(value) { 12539 return { 12540 type: "SET_INSERTION_POINT", 12541 value 12542 }; 12543 } 12544 const modifyContentLockBlock = (clientId) => ({ select, dispatch }) => { 12545 dispatch.selectBlock(clientId); 12546 dispatch.__unstableMarkNextChangeAsNotPersistent(); 12547 dispatch.updateBlockAttributes(clientId, { 12548 templateLock: void 0 12549 }); 12550 dispatch.updateBlockListSettings(clientId, { 12551 ...select.getBlockListSettings(clientId), 12552 templateLock: false 12553 }); 12554 const focusModeToRevert = select.getSettings().focusMode; 12555 dispatch.updateSettings({ focusMode: true }); 12556 dispatch.__unstableSetTemporarilyEditingAsBlocks( 12557 clientId, 12558 focusModeToRevert 12559 ); 12560 }; 12561 const setZoomLevel = (zoom = 100) => ({ select, dispatch }) => { 12562 if (zoom !== 100) { 12563 const firstSelectedClientId = select.getBlockSelectionStart(); 12564 const sectionRootClientId = select.getSectionRootClientId(); 12565 if (firstSelectedClientId) { 12566 let sectionClientId; 12567 if (sectionRootClientId) { 12568 const sectionClientIds = select.getBlockOrder(sectionRootClientId); 12569 if (sectionClientIds?.includes(firstSelectedClientId)) { 12570 sectionClientId = firstSelectedClientId; 12571 } else { 12572 sectionClientId = select.getBlockParents(firstSelectedClientId).find( 12573 (parent) => sectionClientIds.includes(parent) 12574 ); 12575 } 12576 } else { 12577 sectionClientId = select.getBlockHierarchyRootClientId( 12578 firstSelectedClientId 12579 ); 12580 } 12581 if (sectionClientId) { 12582 dispatch.selectBlock(sectionClientId); 12583 } else { 12584 dispatch.clearSelectedBlock(); 12585 } 12586 (0,external_wp_a11y_namespaceObject.speak)((0,external_wp_i18n_namespaceObject.__)("You are currently in zoom-out mode.")); 12587 } 12588 } 12589 dispatch({ 12590 type: "SET_ZOOM_LEVEL", 12591 zoom 12592 }); 12593 }; 12594 function resetZoomLevel() { 12595 return { 12596 type: "RESET_ZOOM_LEVEL" 12597 }; 12598 } 12599 function toggleBlockSpotlight(clientId, hasBlockSpotlight) { 12600 return { 12601 type: "TOGGLE_BLOCK_SPOTLIGHT", 12602 clientId, 12603 hasBlockSpotlight 12604 }; 12605 } 12606 12607 12608 ;// external ["wp","notices"] 12609 const external_wp_notices_namespaceObject = window["wp"]["notices"]; 12610 ;// external ["wp","preferences"] 12611 const external_wp_preferences_namespaceObject = window["wp"]["preferences"]; 12612 ;// ./node_modules/@wordpress/block-editor/build-module/utils/selection.js 12613 12614 const START_OF_SELECTED_AREA = "\x86"; 12615 function retrieveSelectedAttribute(blockAttributes) { 12616 if (!blockAttributes) { 12617 return; 12618 } 12619 return Object.keys(blockAttributes).find((name) => { 12620 const value = blockAttributes[name]; 12621 return (typeof value === "string" || value instanceof external_wp_richText_namespaceObject.RichTextData) && // To do: refactor this to use rich text's selection instead, so we 12622 // no longer have to use on this hack inserting a special character. 12623 value.toString().indexOf(START_OF_SELECTED_AREA) !== -1; 12624 }); 12625 } 12626 function findRichTextAttributeKey(blockType) { 12627 for (const [key, value] of Object.entries(blockType.attributes)) { 12628 if (value.source === "rich-text" || value.source === "html") { 12629 return key; 12630 } 12631 } 12632 } 12633 12634 12635 ;// ./node_modules/@wordpress/block-editor/build-module/store/actions.js 12636 12637 12638 12639 12640 12641 12642 12643 12644 12645 const actions_castArray = (maybeArray) => Array.isArray(maybeArray) ? maybeArray : [maybeArray]; 12646 const resetBlocks = (blocks) => ({ dispatch }) => { 12647 dispatch({ type: "RESET_BLOCKS", blocks }); 12648 dispatch(validateBlocksToTemplate(blocks)); 12649 }; 12650 const validateBlocksToTemplate = (blocks) => ({ select, dispatch }) => { 12651 const template = select.getTemplate(); 12652 const templateLock = select.getTemplateLock(); 12653 const isBlocksValidToTemplate = !template || templateLock !== "all" || (0,external_wp_blocks_namespaceObject.doBlocksMatchTemplate)(blocks, template); 12654 const isValidTemplate = select.isValidTemplate(); 12655 if (isBlocksValidToTemplate !== isValidTemplate) { 12656 dispatch.setTemplateValidity(isBlocksValidToTemplate); 12657 return isBlocksValidToTemplate; 12658 } 12659 }; 12660 function resetSelection(selectionStart, selectionEnd, initialPosition) { 12661 return { 12662 type: "RESET_SELECTION", 12663 selectionStart, 12664 selectionEnd, 12665 initialPosition 12666 }; 12667 } 12668 function receiveBlocks(blocks) { 12669 external_wp_deprecated_default()('wp.data.dispatch( "core/block-editor" ).receiveBlocks', { 12670 since: "5.9", 12671 alternative: "resetBlocks or insertBlocks" 12672 }); 12673 return { 12674 type: "RECEIVE_BLOCKS", 12675 blocks 12676 }; 12677 } 12678 function updateBlockAttributes(clientIds, attributes, options = { uniqueByBlock: false }) { 12679 if (typeof options === "boolean") { 12680 options = { uniqueByBlock: options }; 12681 } 12682 return { 12683 type: "UPDATE_BLOCK_ATTRIBUTES", 12684 clientIds: actions_castArray(clientIds), 12685 attributes, 12686 options 12687 }; 12688 } 12689 function updateBlock(clientId, updates) { 12690 return { 12691 type: "UPDATE_BLOCK", 12692 clientId, 12693 updates 12694 }; 12695 } 12696 function selectBlock(clientId, initialPosition = 0) { 12697 return { 12698 type: "SELECT_BLOCK", 12699 initialPosition, 12700 clientId 12701 }; 12702 } 12703 function hoverBlock() { 12704 external_wp_deprecated_default()('wp.data.dispatch( "core/block-editor" ).hoverBlock', { 12705 since: "6.9", 12706 version: "7.1" 12707 }); 12708 return { 12709 type: "DO_NOTHING" 12710 }; 12711 } 12712 const selectPreviousBlock = (clientId, fallbackToParent = false) => ({ select, dispatch }) => { 12713 const previousBlockClientId = select.getPreviousBlockClientId(clientId); 12714 if (previousBlockClientId) { 12715 dispatch.selectBlock(previousBlockClientId, -1); 12716 } else if (fallbackToParent) { 12717 const firstParentClientId = select.getBlockRootClientId(clientId); 12718 if (firstParentClientId) { 12719 dispatch.selectBlock(firstParentClientId, -1); 12720 } 12721 } 12722 }; 12723 const selectNextBlock = (clientId) => ({ select, dispatch }) => { 12724 const nextBlockClientId = select.getNextBlockClientId(clientId); 12725 if (nextBlockClientId) { 12726 dispatch.selectBlock(nextBlockClientId); 12727 } 12728 }; 12729 function startMultiSelect() { 12730 return { 12731 type: "START_MULTI_SELECT" 12732 }; 12733 } 12734 function stopMultiSelect() { 12735 return { 12736 type: "STOP_MULTI_SELECT" 12737 }; 12738 } 12739 const multiSelect = (start, end, __experimentalInitialPosition = 0) => ({ select, dispatch }) => { 12740 const startBlockRootClientId = select.getBlockRootClientId(start); 12741 const endBlockRootClientId = select.getBlockRootClientId(end); 12742 if (startBlockRootClientId !== endBlockRootClientId) { 12743 return; 12744 } 12745 dispatch({ 12746 type: "MULTI_SELECT", 12747 start, 12748 end, 12749 initialPosition: __experimentalInitialPosition 12750 }); 12751 const blockCount = select.getSelectedBlockCount(); 12752 (0,external_wp_a11y_namespaceObject.speak)( 12753 (0,external_wp_i18n_namespaceObject.sprintf)( 12754 /* translators: %s: number of selected blocks */ 12755 (0,external_wp_i18n_namespaceObject._n)("%s block selected.", "%s blocks selected.", blockCount), 12756 blockCount 12757 ), 12758 "assertive" 12759 ); 12760 }; 12761 function clearSelectedBlock() { 12762 return { 12763 type: "CLEAR_SELECTED_BLOCK" 12764 }; 12765 } 12766 function toggleSelection(isSelectionEnabled = true) { 12767 return { 12768 type: "TOGGLE_SELECTION", 12769 isSelectionEnabled 12770 }; 12771 } 12772 const replaceBlocks = (clientIds, blocks, indexToSelect, initialPosition = 0, meta) => ({ select, dispatch, registry }) => { 12773 clientIds = actions_castArray(clientIds); 12774 blocks = actions_castArray(blocks); 12775 const rootClientId = select.getBlockRootClientId(clientIds[0]); 12776 for (let index = 0; index < blocks.length; index++) { 12777 const block = blocks[index]; 12778 const canInsertBlock = select.canInsertBlockType( 12779 block.name, 12780 rootClientId 12781 ); 12782 if (!canInsertBlock) { 12783 return; 12784 } 12785 } 12786 registry.batch(() => { 12787 dispatch({ 12788 type: "REPLACE_BLOCKS", 12789 clientIds, 12790 blocks, 12791 time: Date.now(), 12792 indexToSelect, 12793 initialPosition, 12794 meta 12795 }); 12796 dispatch.ensureDefaultBlock(); 12797 }); 12798 }; 12799 function replaceBlock(clientId, block) { 12800 return replaceBlocks(clientId, block); 12801 } 12802 const createOnMove = (type) => (clientIds, rootClientId) => ({ select, dispatch }) => { 12803 const canMoveBlocks = select.canMoveBlocks(clientIds); 12804 if (!canMoveBlocks) { 12805 return; 12806 } 12807 dispatch({ type, clientIds: actions_castArray(clientIds), rootClientId }); 12808 }; 12809 const moveBlocksDown = createOnMove("MOVE_BLOCKS_DOWN"); 12810 const moveBlocksUp = createOnMove("MOVE_BLOCKS_UP"); 12811 const moveBlocksToPosition = (clientIds, fromRootClientId = "", toRootClientId = "", index) => ({ select, dispatch }) => { 12812 const canMoveBlocks = select.canMoveBlocks(clientIds); 12813 if (!canMoveBlocks) { 12814 return; 12815 } 12816 if (fromRootClientId !== toRootClientId) { 12817 const canRemoveBlocks = select.canRemoveBlocks(clientIds); 12818 if (!canRemoveBlocks) { 12819 return; 12820 } 12821 const canInsertBlocks = select.canInsertBlocks( 12822 clientIds, 12823 toRootClientId 12824 ); 12825 if (!canInsertBlocks) { 12826 return; 12827 } 12828 } 12829 dispatch({ 12830 type: "MOVE_BLOCKS_TO_POSITION", 12831 fromRootClientId, 12832 toRootClientId, 12833 clientIds, 12834 index 12835 }); 12836 }; 12837 function moveBlockToPosition(clientId, fromRootClientId = "", toRootClientId = "", index) { 12838 return moveBlocksToPosition( 12839 [clientId], 12840 fromRootClientId, 12841 toRootClientId, 12842 index 12843 ); 12844 } 12845 function insertBlock(block, index, rootClientId, updateSelection, meta) { 12846 return insertBlocks( 12847 [block], 12848 index, 12849 rootClientId, 12850 updateSelection, 12851 0, 12852 meta 12853 ); 12854 } 12855 const insertBlocks = (blocks, index, rootClientId, updateSelection = true, initialPosition = 0, meta) => ({ select, dispatch }) => { 12856 if (initialPosition !== null && typeof initialPosition === "object") { 12857 meta = initialPosition; 12858 initialPosition = 0; 12859 external_wp_deprecated_default()( 12860 "meta argument in wp.data.dispatch('core/block-editor')", 12861 { 12862 since: "5.8", 12863 hint: "The meta argument is now the 6th argument of the function" 12864 } 12865 ); 12866 } 12867 blocks = actions_castArray(blocks); 12868 const allowedBlocks = []; 12869 for (const block of blocks) { 12870 const isValid = select.canInsertBlockType( 12871 block.name, 12872 rootClientId 12873 ); 12874 if (isValid) { 12875 allowedBlocks.push(block); 12876 } 12877 } 12878 if (allowedBlocks.length) { 12879 dispatch({ 12880 type: "INSERT_BLOCKS", 12881 blocks: allowedBlocks, 12882 index, 12883 rootClientId, 12884 time: Date.now(), 12885 updateSelection, 12886 initialPosition: updateSelection ? initialPosition : null, 12887 meta 12888 }); 12889 } 12890 }; 12891 function showInsertionPoint(rootClientId, index, __unstableOptions = {}) { 12892 const { __unstableWithInserter, operation, nearestSide } = __unstableOptions; 12893 return { 12894 type: "SHOW_INSERTION_POINT", 12895 rootClientId, 12896 index, 12897 __unstableWithInserter, 12898 operation, 12899 nearestSide 12900 }; 12901 } 12902 const hideInsertionPoint = () => ({ select, dispatch }) => { 12903 if (!select.isBlockInsertionPointVisible()) { 12904 return; 12905 } 12906 dispatch({ 12907 type: "HIDE_INSERTION_POINT" 12908 }); 12909 }; 12910 function setTemplateValidity(isValid) { 12911 return { 12912 type: "SET_TEMPLATE_VALIDITY", 12913 isValid 12914 }; 12915 } 12916 const synchronizeTemplate = () => ({ select, dispatch }) => { 12917 dispatch({ type: "SYNCHRONIZE_TEMPLATE" }); 12918 const blocks = select.getBlocks(); 12919 const template = select.getTemplate(); 12920 const updatedBlockList = (0,external_wp_blocks_namespaceObject.synchronizeBlocksWithTemplate)( 12921 blocks, 12922 template 12923 ); 12924 dispatch.resetBlocks(updatedBlockList); 12925 }; 12926 const __unstableDeleteSelection = (isForward) => ({ registry, select, dispatch }) => { 12927 const selectionAnchor = select.getSelectionStart(); 12928 const selectionFocus = select.getSelectionEnd(); 12929 if (selectionAnchor.clientId === selectionFocus.clientId) { 12930 return; 12931 } 12932 if (!selectionAnchor.attributeKey || !selectionFocus.attributeKey || typeof selectionAnchor.offset === "undefined" || typeof selectionFocus.offset === "undefined") { 12933 return false; 12934 } 12935 const anchorRootClientId = select.getBlockRootClientId( 12936 selectionAnchor.clientId 12937 ); 12938 const focusRootClientId = select.getBlockRootClientId( 12939 selectionFocus.clientId 12940 ); 12941 if (anchorRootClientId !== focusRootClientId) { 12942 return; 12943 } 12944 const blockOrder = select.getBlockOrder(anchorRootClientId); 12945 const anchorIndex = blockOrder.indexOf(selectionAnchor.clientId); 12946 const focusIndex = blockOrder.indexOf(selectionFocus.clientId); 12947 let selectionStart, selectionEnd; 12948 if (anchorIndex > focusIndex) { 12949 selectionStart = selectionFocus; 12950 selectionEnd = selectionAnchor; 12951 } else { 12952 selectionStart = selectionAnchor; 12953 selectionEnd = selectionFocus; 12954 } 12955 const targetSelection = isForward ? selectionEnd : selectionStart; 12956 const targetBlock = select.getBlock(targetSelection.clientId); 12957 const targetBlockType = (0,external_wp_blocks_namespaceObject.getBlockType)(targetBlock.name); 12958 if (!targetBlockType.merge) { 12959 return; 12960 } 12961 const selectionA = selectionStart; 12962 const selectionB = selectionEnd; 12963 const blockA = select.getBlock(selectionA.clientId); 12964 const blockB = select.getBlock(selectionB.clientId); 12965 const htmlA = blockA.attributes[selectionA.attributeKey]; 12966 const htmlB = blockB.attributes[selectionB.attributeKey]; 12967 let valueA = (0,external_wp_richText_namespaceObject.create)({ html: htmlA }); 12968 let valueB = (0,external_wp_richText_namespaceObject.create)({ html: htmlB }); 12969 valueA = (0,external_wp_richText_namespaceObject.remove)(valueA, selectionA.offset, valueA.text.length); 12970 valueB = (0,external_wp_richText_namespaceObject.insert)(valueB, START_OF_SELECTED_AREA, 0, selectionB.offset); 12971 const cloneA = (0,external_wp_blocks_namespaceObject.cloneBlock)(blockA, { 12972 [selectionA.attributeKey]: (0,external_wp_richText_namespaceObject.toHTMLString)({ value: valueA }) 12973 }); 12974 const cloneB = (0,external_wp_blocks_namespaceObject.cloneBlock)(blockB, { 12975 [selectionB.attributeKey]: (0,external_wp_richText_namespaceObject.toHTMLString)({ value: valueB }) 12976 }); 12977 const followingBlock = isForward ? cloneA : cloneB; 12978 const blocksWithTheSameType = blockA.name === blockB.name ? [followingBlock] : (0,external_wp_blocks_namespaceObject.switchToBlockType)(followingBlock, targetBlockType.name); 12979 if (!blocksWithTheSameType || !blocksWithTheSameType.length) { 12980 return; 12981 } 12982 let updatedAttributes; 12983 if (isForward) { 12984 const blockToMerge = blocksWithTheSameType.pop(); 12985 updatedAttributes = targetBlockType.merge( 12986 blockToMerge.attributes, 12987 cloneB.attributes 12988 ); 12989 } else { 12990 const blockToMerge = blocksWithTheSameType.shift(); 12991 updatedAttributes = targetBlockType.merge( 12992 cloneA.attributes, 12993 blockToMerge.attributes 12994 ); 12995 } 12996 const newAttributeKey = retrieveSelectedAttribute(updatedAttributes); 12997 const convertedHtml = updatedAttributes[newAttributeKey]; 12998 const convertedValue = (0,external_wp_richText_namespaceObject.create)({ html: convertedHtml }); 12999 const newOffset = convertedValue.text.indexOf(START_OF_SELECTED_AREA); 13000 const newValue = (0,external_wp_richText_namespaceObject.remove)(convertedValue, newOffset, newOffset + 1); 13001 const newHtml = (0,external_wp_richText_namespaceObject.toHTMLString)({ value: newValue }); 13002 updatedAttributes[newAttributeKey] = newHtml; 13003 const selectedBlockClientIds = select.getSelectedBlockClientIds(); 13004 const replacement = [ 13005 ...isForward ? blocksWithTheSameType : [], 13006 { 13007 // Preserve the original client ID. 13008 ...targetBlock, 13009 attributes: { 13010 ...targetBlock.attributes, 13011 ...updatedAttributes 13012 } 13013 }, 13014 ...isForward ? [] : blocksWithTheSameType 13015 ]; 13016 registry.batch(() => { 13017 dispatch.selectionChange( 13018 targetBlock.clientId, 13019 newAttributeKey, 13020 newOffset, 13021 newOffset 13022 ); 13023 dispatch.replaceBlocks( 13024 selectedBlockClientIds, 13025 replacement, 13026 0, 13027 // If we don't pass the `indexToSelect` it will default to the last block. 13028 select.getSelectedBlocksInitialCaretPosition() 13029 ); 13030 }); 13031 }; 13032 const __unstableSplitSelection = (blocks = []) => ({ registry, select, dispatch }) => { 13033 const selectionAnchor = select.getSelectionStart(); 13034 const selectionFocus = select.getSelectionEnd(); 13035 const anchorRootClientId = select.getBlockRootClientId( 13036 selectionAnchor.clientId 13037 ); 13038 const focusRootClientId = select.getBlockRootClientId( 13039 selectionFocus.clientId 13040 ); 13041 if (anchorRootClientId !== focusRootClientId) { 13042 return; 13043 } 13044 const blockOrder = select.getBlockOrder(anchorRootClientId); 13045 const anchorIndex = blockOrder.indexOf(selectionAnchor.clientId); 13046 const focusIndex = blockOrder.indexOf(selectionFocus.clientId); 13047 let selectionStart, selectionEnd; 13048 if (anchorIndex > focusIndex) { 13049 selectionStart = selectionFocus; 13050 selectionEnd = selectionAnchor; 13051 } else { 13052 selectionStart = selectionAnchor; 13053 selectionEnd = selectionFocus; 13054 } 13055 const selectionA = selectionStart; 13056 const selectionB = selectionEnd; 13057 const blockA = select.getBlock(selectionA.clientId); 13058 const blockB = select.getBlock(selectionB.clientId); 13059 const blockAType = (0,external_wp_blocks_namespaceObject.getBlockType)(blockA.name); 13060 const blockBType = (0,external_wp_blocks_namespaceObject.getBlockType)(blockB.name); 13061 const attributeKeyA = typeof selectionA.attributeKey === "string" ? selectionA.attributeKey : findRichTextAttributeKey(blockAType); 13062 const attributeKeyB = typeof selectionB.attributeKey === "string" ? selectionB.attributeKey : findRichTextAttributeKey(blockBType); 13063 const blockAttributes = select.getBlockAttributes( 13064 selectionA.clientId 13065 ); 13066 const bindings = blockAttributes?.metadata?.bindings; 13067 if (bindings?.[attributeKeyA]) { 13068 if (blocks.length) { 13069 const { createWarningNotice } = registry.dispatch(external_wp_notices_namespaceObject.store); 13070 createWarningNotice( 13071 (0,external_wp_i18n_namespaceObject.__)( 13072 "Blocks can't be inserted into other blocks with bindings" 13073 ), 13074 { 13075 type: "snackbar" 13076 } 13077 ); 13078 return; 13079 } 13080 dispatch.insertAfterBlock(selectionA.clientId); 13081 return; 13082 } 13083 if (!attributeKeyA || !attributeKeyB || typeof selectionAnchor.offset === "undefined" || typeof selectionFocus.offset === "undefined") { 13084 return; 13085 } 13086 if (selectionA.clientId === selectionB.clientId && attributeKeyA === attributeKeyB && selectionA.offset === selectionB.offset) { 13087 if (blocks.length) { 13088 if ((0,external_wp_blocks_namespaceObject.isUnmodifiedDefaultBlock)(blockA)) { 13089 dispatch.replaceBlocks( 13090 [selectionA.clientId], 13091 blocks, 13092 blocks.length - 1, 13093 -1 13094 ); 13095 return; 13096 } 13097 } else if (!select.getBlockOrder(selectionA.clientId).length) { 13098 let createEmpty2 = function() { 13099 const defaultBlockName2 = (0,external_wp_blocks_namespaceObject.getDefaultBlockName)(); 13100 return select.canInsertBlockType( 13101 defaultBlockName2, 13102 anchorRootClientId 13103 ) ? (0,external_wp_blocks_namespaceObject.createBlock)(defaultBlockName2) : (0,external_wp_blocks_namespaceObject.createBlock)( 13104 select.getBlockName(selectionA.clientId) 13105 ); 13106 }; 13107 var createEmpty = createEmpty2; 13108 const length = blockAttributes[attributeKeyA].length; 13109 if (selectionA.offset === 0 && length) { 13110 dispatch.insertBlocks( 13111 [createEmpty2()], 13112 select.getBlockIndex(selectionA.clientId), 13113 anchorRootClientId, 13114 false 13115 ); 13116 return; 13117 } 13118 if (selectionA.offset === length) { 13119 dispatch.insertBlocks( 13120 [createEmpty2()], 13121 select.getBlockIndex(selectionA.clientId) + 1, 13122 anchorRootClientId 13123 ); 13124 return; 13125 } 13126 } 13127 } 13128 const htmlA = blockA.attributes[attributeKeyA]; 13129 const htmlB = blockB.attributes[attributeKeyB]; 13130 let valueA = (0,external_wp_richText_namespaceObject.create)({ html: htmlA }); 13131 let valueB = (0,external_wp_richText_namespaceObject.create)({ html: htmlB }); 13132 valueA = (0,external_wp_richText_namespaceObject.remove)(valueA, selectionA.offset, valueA.text.length); 13133 valueB = (0,external_wp_richText_namespaceObject.remove)(valueB, 0, selectionB.offset); 13134 let head = { 13135 // Preserve the original client ID. 13136 ...blockA, 13137 // If both start and end are the same, should only copy innerBlocks 13138 // once. 13139 innerBlocks: blockA.clientId === blockB.clientId ? [] : blockA.innerBlocks, 13140 attributes: { 13141 ...blockA.attributes, 13142 [attributeKeyA]: (0,external_wp_richText_namespaceObject.toHTMLString)({ value: valueA }) 13143 } 13144 }; 13145 let tail = { 13146 ...blockB, 13147 // Only preserve the original client ID if the end is different. 13148 clientId: blockA.clientId === blockB.clientId ? (0,external_wp_blocks_namespaceObject.createBlock)(blockB.name).clientId : blockB.clientId, 13149 attributes: { 13150 ...blockB.attributes, 13151 [attributeKeyB]: (0,external_wp_richText_namespaceObject.toHTMLString)({ value: valueB }) 13152 } 13153 }; 13154 const defaultBlockName = (0,external_wp_blocks_namespaceObject.getDefaultBlockName)(); 13155 if ( 13156 // A block is only split when the selection is within the same 13157 // block. 13158 blockA.clientId === blockB.clientId && defaultBlockName && tail.name !== defaultBlockName && select.canInsertBlockType(defaultBlockName, anchorRootClientId) 13159 ) { 13160 const switched = (0,external_wp_blocks_namespaceObject.switchToBlockType)(tail, defaultBlockName); 13161 if (switched?.length === 1) { 13162 tail = switched[0]; 13163 } 13164 } 13165 if (!blocks.length) { 13166 dispatch.replaceBlocks(select.getSelectedBlockClientIds(), [ 13167 head, 13168 tail 13169 ]); 13170 return; 13171 } 13172 let selection; 13173 const output = []; 13174 const clonedBlocks = [...blocks]; 13175 const firstBlock = clonedBlocks.shift(); 13176 const headType = (0,external_wp_blocks_namespaceObject.getBlockType)(head.name); 13177 const firstBlocks = headType.merge && firstBlock.name === headType.name ? [firstBlock] : (0,external_wp_blocks_namespaceObject.switchToBlockType)(firstBlock, headType.name); 13178 if (firstBlocks?.length) { 13179 const first = firstBlocks.shift(); 13180 head = { 13181 ...head, 13182 attributes: { 13183 ...head.attributes, 13184 ...headType.merge(head.attributes, first.attributes) 13185 } 13186 }; 13187 output.push(head); 13188 selection = { 13189 clientId: head.clientId, 13190 attributeKey: attributeKeyA, 13191 offset: (0,external_wp_richText_namespaceObject.create)({ html: head.attributes[attributeKeyA] }).text.length 13192 }; 13193 clonedBlocks.unshift(...firstBlocks); 13194 } else { 13195 if (!(0,external_wp_blocks_namespaceObject.isUnmodifiedBlock)(head)) { 13196 output.push(head); 13197 } 13198 output.push(firstBlock); 13199 } 13200 const lastBlock = clonedBlocks.pop(); 13201 const tailType = (0,external_wp_blocks_namespaceObject.getBlockType)(tail.name); 13202 if (clonedBlocks.length) { 13203 output.push(...clonedBlocks); 13204 } 13205 if (lastBlock) { 13206 const lastBlocks = tailType.merge && tailType.name === lastBlock.name ? [lastBlock] : (0,external_wp_blocks_namespaceObject.switchToBlockType)(lastBlock, tailType.name); 13207 if (lastBlocks?.length) { 13208 const last = lastBlocks.pop(); 13209 output.push({ 13210 ...tail, 13211 attributes: { 13212 ...tail.attributes, 13213 ...tailType.merge(last.attributes, tail.attributes) 13214 } 13215 }); 13216 output.push(...lastBlocks); 13217 selection = { 13218 clientId: tail.clientId, 13219 attributeKey: attributeKeyB, 13220 offset: (0,external_wp_richText_namespaceObject.create)({ 13221 html: last.attributes[attributeKeyB] 13222 }).text.length 13223 }; 13224 } else { 13225 output.push(lastBlock); 13226 if (!(0,external_wp_blocks_namespaceObject.isUnmodifiedBlock)(tail)) { 13227 output.push(tail); 13228 } 13229 } 13230 } else if (!(0,external_wp_blocks_namespaceObject.isUnmodifiedBlock)(tail)) { 13231 output.push(tail); 13232 } 13233 registry.batch(() => { 13234 dispatch.replaceBlocks( 13235 select.getSelectedBlockClientIds(), 13236 output, 13237 output.length - 1, 13238 0 13239 ); 13240 if (selection) { 13241 dispatch.selectionChange( 13242 selection.clientId, 13243 selection.attributeKey, 13244 selection.offset, 13245 selection.offset 13246 ); 13247 } 13248 }); 13249 }; 13250 const __unstableExpandSelection = () => ({ select, dispatch }) => { 13251 const selectionAnchor = select.getSelectionStart(); 13252 const selectionFocus = select.getSelectionEnd(); 13253 dispatch.selectionChange({ 13254 start: { clientId: selectionAnchor.clientId }, 13255 end: { clientId: selectionFocus.clientId } 13256 }); 13257 }; 13258 const mergeBlocks = (firstBlockClientId, secondBlockClientId) => ({ registry, select, dispatch }) => { 13259 const clientIdA = firstBlockClientId; 13260 const clientIdB = secondBlockClientId; 13261 const blockA = select.getBlock(clientIdA); 13262 const blockAType = (0,external_wp_blocks_namespaceObject.getBlockType)(blockA.name); 13263 if (!blockAType || select.getBlockEditingMode(clientIdA) === "disabled" || select.getBlockEditingMode(clientIdB) === "disabled") { 13264 return; 13265 } 13266 const blockB = select.getBlock(clientIdB); 13267 if (!blockAType.merge && (0,external_wp_blocks_namespaceObject.getBlockSupport)(blockA.name, "__experimentalOnMerge")) { 13268 const blocksWithTheSameType2 = (0,external_wp_blocks_namespaceObject.switchToBlockType)( 13269 blockB, 13270 blockAType.name 13271 ); 13272 if (blocksWithTheSameType2?.length !== 1) { 13273 dispatch.selectBlock(blockA.clientId); 13274 return; 13275 } 13276 const [blockWithSameType] = blocksWithTheSameType2; 13277 if (blockWithSameType.innerBlocks.length < 1) { 13278 dispatch.selectBlock(blockA.clientId); 13279 return; 13280 } 13281 registry.batch(() => { 13282 dispatch.insertBlocks( 13283 blockWithSameType.innerBlocks, 13284 void 0, 13285 clientIdA 13286 ); 13287 dispatch.removeBlock(clientIdB); 13288 dispatch.selectBlock( 13289 blockWithSameType.innerBlocks[0].clientId 13290 ); 13291 const nextBlockClientId = select.getNextBlockClientId(clientIdA); 13292 if (nextBlockClientId && select.getBlockName(clientIdA) === select.getBlockName(nextBlockClientId)) { 13293 const rootAttributes = select.getBlockAttributes(clientIdA); 13294 const previousRootAttributes = select.getBlockAttributes(nextBlockClientId); 13295 if (Object.keys(rootAttributes).every( 13296 (key) => rootAttributes[key] === previousRootAttributes[key] 13297 )) { 13298 dispatch.moveBlocksToPosition( 13299 select.getBlockOrder(nextBlockClientId), 13300 nextBlockClientId, 13301 clientIdA 13302 ); 13303 dispatch.removeBlock(nextBlockClientId, false); 13304 } 13305 } 13306 }); 13307 return; 13308 } 13309 if ((0,external_wp_blocks_namespaceObject.isUnmodifiedDefaultBlock)(blockA)) { 13310 dispatch.removeBlock( 13311 clientIdA, 13312 select.isBlockSelected(clientIdA) 13313 ); 13314 return; 13315 } 13316 if ((0,external_wp_blocks_namespaceObject.isUnmodifiedDefaultBlock)(blockB)) { 13317 dispatch.removeBlock( 13318 clientIdB, 13319 select.isBlockSelected(clientIdB) 13320 ); 13321 return; 13322 } 13323 if (!blockAType.merge) { 13324 if ((0,external_wp_blocks_namespaceObject.isUnmodifiedBlock)(blockB, "content")) { 13325 dispatch.removeBlock( 13326 clientIdB, 13327 select.isBlockSelected(clientIdB) 13328 ); 13329 } else { 13330 dispatch.selectBlock(blockA.clientId); 13331 } 13332 return; 13333 } 13334 const blockBType = (0,external_wp_blocks_namespaceObject.getBlockType)(blockB.name); 13335 const { clientId, attributeKey, offset } = select.getSelectionStart(); 13336 const selectedBlockType = clientId === clientIdA ? blockAType : blockBType; 13337 const attributeDefinition = selectedBlockType.attributes[attributeKey]; 13338 const canRestoreTextSelection = (clientId === clientIdA || clientId === clientIdB) && attributeKey !== void 0 && offset !== void 0 && // We cannot restore text selection if the RichText identifier 13339 // is not a defined block attribute key. This can be the case if the 13340 // fallback instance ID is used to store selection (and no RichText 13341 // identifier is set), or when the identifier is wrong. 13342 !!attributeDefinition; 13343 if (!attributeDefinition) { 13344 if (typeof attributeKey === "number") { 13345 window.console.error( 13346 `RichText needs an identifier prop that is the block attribute key of the attribute it controls. Its type is expected to be a string, but was $typeof attributeKey}` 13347 ); 13348 } else { 13349 window.console.error( 13350 "The RichText identifier prop does not match any attributes defined by the block." 13351 ); 13352 } 13353 } 13354 const cloneA = (0,external_wp_blocks_namespaceObject.cloneBlock)(blockA); 13355 const cloneB = (0,external_wp_blocks_namespaceObject.cloneBlock)(blockB); 13356 if (canRestoreTextSelection) { 13357 const selectedBlock = clientId === clientIdA ? cloneA : cloneB; 13358 const html = selectedBlock.attributes[attributeKey]; 13359 const value = (0,external_wp_richText_namespaceObject.insert)( 13360 (0,external_wp_richText_namespaceObject.create)({ html }), 13361 START_OF_SELECTED_AREA, 13362 offset, 13363 offset 13364 ); 13365 selectedBlock.attributes[attributeKey] = (0,external_wp_richText_namespaceObject.toHTMLString)({ 13366 value 13367 }); 13368 } 13369 const blocksWithTheSameType = blockA.name === blockB.name ? [cloneB] : (0,external_wp_blocks_namespaceObject.switchToBlockType)(cloneB, blockA.name); 13370 if (!blocksWithTheSameType || !blocksWithTheSameType.length) { 13371 return; 13372 } 13373 const updatedAttributes = blockAType.merge( 13374 cloneA.attributes, 13375 blocksWithTheSameType[0].attributes 13376 ); 13377 if (canRestoreTextSelection) { 13378 const newAttributeKey = retrieveSelectedAttribute(updatedAttributes); 13379 const convertedHtml = updatedAttributes[newAttributeKey]; 13380 const convertedValue = (0,external_wp_richText_namespaceObject.create)({ html: convertedHtml }); 13381 const newOffset = convertedValue.text.indexOf( 13382 START_OF_SELECTED_AREA 13383 ); 13384 const newValue = (0,external_wp_richText_namespaceObject.remove)(convertedValue, newOffset, newOffset + 1); 13385 const newHtml = (0,external_wp_richText_namespaceObject.toHTMLString)({ value: newValue }); 13386 updatedAttributes[newAttributeKey] = newHtml; 13387 dispatch.selectionChange( 13388 blockA.clientId, 13389 newAttributeKey, 13390 newOffset, 13391 newOffset 13392 ); 13393 } 13394 dispatch.replaceBlocks( 13395 [blockA.clientId, blockB.clientId], 13396 [ 13397 { 13398 ...blockA, 13399 attributes: { 13400 ...blockA.attributes, 13401 ...updatedAttributes 13402 } 13403 }, 13404 ...blocksWithTheSameType.slice(1) 13405 ], 13406 0 13407 // If we don't pass the `indexToSelect` it will default to the last block. 13408 ); 13409 }; 13410 const removeBlocks = (clientIds, selectPrevious = true) => privateRemoveBlocks(clientIds, selectPrevious); 13411 function removeBlock(clientId, selectPrevious) { 13412 return removeBlocks([clientId], selectPrevious); 13413 } 13414 function replaceInnerBlocks(rootClientId, blocks, updateSelection = false, initialPosition = 0) { 13415 return { 13416 type: "REPLACE_INNER_BLOCKS", 13417 rootClientId, 13418 blocks, 13419 updateSelection, 13420 initialPosition: updateSelection ? initialPosition : null, 13421 time: Date.now() 13422 }; 13423 } 13424 function toggleBlockMode(clientId) { 13425 return { 13426 type: "TOGGLE_BLOCK_MODE", 13427 clientId 13428 }; 13429 } 13430 function startTyping() { 13431 return { 13432 type: "START_TYPING" 13433 }; 13434 } 13435 function stopTyping() { 13436 return { 13437 type: "STOP_TYPING" 13438 }; 13439 } 13440 function startDraggingBlocks(clientIds = []) { 13441 return { 13442 type: "START_DRAGGING_BLOCKS", 13443 clientIds 13444 }; 13445 } 13446 function stopDraggingBlocks() { 13447 return { 13448 type: "STOP_DRAGGING_BLOCKS" 13449 }; 13450 } 13451 function enterFormattedText() { 13452 external_wp_deprecated_default()('wp.data.dispatch( "core/block-editor" ).enterFormattedText', { 13453 since: "6.1", 13454 version: "6.3" 13455 }); 13456 return { 13457 type: "DO_NOTHING" 13458 }; 13459 } 13460 function exitFormattedText() { 13461 external_wp_deprecated_default()('wp.data.dispatch( "core/block-editor" ).exitFormattedText', { 13462 since: "6.1", 13463 version: "6.3" 13464 }); 13465 return { 13466 type: "DO_NOTHING" 13467 }; 13468 } 13469 function selectionChange(clientId, attributeKey, startOffset, endOffset) { 13470 if (typeof clientId === "string") { 13471 return { 13472 type: "SELECTION_CHANGE", 13473 clientId, 13474 attributeKey, 13475 startOffset, 13476 endOffset 13477 }; 13478 } 13479 return { type: "SELECTION_CHANGE", ...clientId }; 13480 } 13481 const insertDefaultBlock = (attributes, rootClientId, index) => ({ dispatch }) => { 13482 const defaultBlockName = (0,external_wp_blocks_namespaceObject.getDefaultBlockName)(); 13483 if (!defaultBlockName) { 13484 return; 13485 } 13486 const block = (0,external_wp_blocks_namespaceObject.createBlock)(defaultBlockName, attributes); 13487 return dispatch.insertBlock(block, index, rootClientId); 13488 }; 13489 function updateBlockListSettings(clientId, settings) { 13490 return { 13491 type: "UPDATE_BLOCK_LIST_SETTINGS", 13492 clientId, 13493 settings 13494 }; 13495 } 13496 function updateSettings(settings) { 13497 return __experimentalUpdateSettings(settings, { 13498 stripExperimentalSettings: true 13499 }); 13500 } 13501 function __unstableSaveReusableBlock(id, updatedId) { 13502 return { 13503 type: "SAVE_REUSABLE_BLOCK_SUCCESS", 13504 id, 13505 updatedId 13506 }; 13507 } 13508 function __unstableMarkLastChangeAsPersistent() { 13509 return { type: "MARK_LAST_CHANGE_AS_PERSISTENT" }; 13510 } 13511 function __unstableMarkNextChangeAsNotPersistent() { 13512 return { type: "MARK_NEXT_CHANGE_AS_NOT_PERSISTENT" }; 13513 } 13514 const __unstableMarkAutomaticChange = () => ({ dispatch }) => { 13515 dispatch({ type: "MARK_AUTOMATIC_CHANGE" }); 13516 const { requestIdleCallback = (cb) => setTimeout(cb, 100) } = window; 13517 requestIdleCallback(() => { 13518 dispatch({ type: "MARK_AUTOMATIC_CHANGE_FINAL" }); 13519 }); 13520 }; 13521 const __unstableSetEditorMode = (mode) => ({ registry }) => { 13522 registry.dispatch(external_wp_preferences_namespaceObject.store).set("core", "editorTool", mode); 13523 if (mode === "navigation") { 13524 (0,external_wp_a11y_namespaceObject.speak)((0,external_wp_i18n_namespaceObject.__)("You are currently in Write mode.")); 13525 } else if (mode === "edit") { 13526 (0,external_wp_a11y_namespaceObject.speak)((0,external_wp_i18n_namespaceObject.__)("You are currently in Design mode.")); 13527 } 13528 }; 13529 function setBlockMovingClientId() { 13530 external_wp_deprecated_default()( 13531 'wp.data.dispatch( "core/block-editor" ).setBlockMovingClientId', 13532 { 13533 since: "6.7", 13534 hint: "Block moving mode feature has been removed" 13535 } 13536 ); 13537 return { 13538 type: "DO_NOTHING" 13539 }; 13540 } 13541 const duplicateBlocks = (clientIds, updateSelection = true) => ({ select, dispatch }) => { 13542 if (!clientIds || !clientIds.length) { 13543 return; 13544 } 13545 const blocks = select.getBlocksByClientId(clientIds); 13546 if (blocks.some((block) => !block)) { 13547 return; 13548 } 13549 const blockNames = blocks.map((block) => block.name); 13550 if (blockNames.some( 13551 (blockName) => !(0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockName, "multiple", true) 13552 )) { 13553 return; 13554 } 13555 const rootClientId = select.getBlockRootClientId(clientIds[0]); 13556 const clientIdsArray = actions_castArray(clientIds); 13557 const lastSelectedIndex = select.getBlockIndex( 13558 clientIdsArray[clientIdsArray.length - 1] 13559 ); 13560 const clonedBlocks = blocks.map( 13561 (block) => (0,external_wp_blocks_namespaceObject.__experimentalCloneSanitizedBlock)(block) 13562 ); 13563 dispatch.insertBlocks( 13564 clonedBlocks, 13565 lastSelectedIndex + 1, 13566 rootClientId, 13567 updateSelection 13568 ); 13569 if (clonedBlocks.length > 1 && updateSelection) { 13570 dispatch.multiSelect( 13571 clonedBlocks[0].clientId, 13572 clonedBlocks[clonedBlocks.length - 1].clientId 13573 ); 13574 } 13575 return clonedBlocks.map((block) => block.clientId); 13576 }; 13577 const insertBeforeBlock = (clientId) => ({ select, dispatch }) => { 13578 if (!clientId) { 13579 return; 13580 } 13581 const rootClientId = select.getBlockRootClientId(clientId); 13582 const isLocked = select.getTemplateLock(rootClientId); 13583 if (isLocked) { 13584 return; 13585 } 13586 const blockIndex = select.getBlockIndex(clientId); 13587 const directInsertBlock = rootClientId ? select.getDirectInsertBlock(rootClientId) : null; 13588 if (!directInsertBlock) { 13589 return dispatch.insertDefaultBlock({}, rootClientId, blockIndex); 13590 } 13591 const copiedAttributes = {}; 13592 if (directInsertBlock.attributesToCopy) { 13593 const attributes = select.getBlockAttributes(clientId); 13594 directInsertBlock.attributesToCopy.forEach((key) => { 13595 if (attributes[key]) { 13596 copiedAttributes[key] = attributes[key]; 13597 } 13598 }); 13599 } 13600 const block = (0,external_wp_blocks_namespaceObject.createBlock)(directInsertBlock.name, { 13601 ...directInsertBlock.attributes, 13602 ...copiedAttributes 13603 }); 13604 return dispatch.insertBlock(block, blockIndex, rootClientId); 13605 }; 13606 const insertAfterBlock = (clientId) => ({ select, dispatch }) => { 13607 if (!clientId) { 13608 return; 13609 } 13610 const rootClientId = select.getBlockRootClientId(clientId); 13611 const isLocked = select.getTemplateLock(rootClientId); 13612 if (isLocked) { 13613 return; 13614 } 13615 const blockIndex = select.getBlockIndex(clientId); 13616 const directInsertBlock = rootClientId ? select.getDirectInsertBlock(rootClientId) : null; 13617 if (!directInsertBlock) { 13618 return dispatch.insertDefaultBlock( 13619 {}, 13620 rootClientId, 13621 blockIndex + 1 13622 ); 13623 } 13624 const copiedAttributes = {}; 13625 if (directInsertBlock.attributesToCopy) { 13626 const attributes = select.getBlockAttributes(clientId); 13627 directInsertBlock.attributesToCopy.forEach((key) => { 13628 if (attributes[key]) { 13629 copiedAttributes[key] = attributes[key]; 13630 } 13631 }); 13632 } 13633 const block = (0,external_wp_blocks_namespaceObject.createBlock)(directInsertBlock.name, { 13634 ...directInsertBlock.attributes, 13635 ...copiedAttributes 13636 }); 13637 return dispatch.insertBlock(block, blockIndex + 1, rootClientId); 13638 }; 13639 function toggleBlockHighlight(clientId, isHighlighted) { 13640 return { 13641 type: "TOGGLE_BLOCK_HIGHLIGHT", 13642 clientId, 13643 isHighlighted 13644 }; 13645 } 13646 const flashBlock = (clientId, timeout = 150) => async ({ dispatch }) => { 13647 dispatch(toggleBlockHighlight(clientId, true)); 13648 await new Promise((resolve) => setTimeout(resolve, timeout)); 13649 dispatch(toggleBlockHighlight(clientId, false)); 13650 }; 13651 function setHasControlledInnerBlocks(clientId, hasControlledInnerBlocks) { 13652 return { 13653 type: "SET_HAS_CONTROLLED_INNER_BLOCKS", 13654 hasControlledInnerBlocks, 13655 clientId 13656 }; 13657 } 13658 function setBlockVisibility(updates) { 13659 return { 13660 type: "SET_BLOCK_VISIBILITY", 13661 updates 13662 }; 13663 } 13664 function __unstableSetTemporarilyEditingAsBlocks(temporarilyEditingAsBlocks, focusModeToRevert) { 13665 return { 13666 type: "SET_TEMPORARILY_EDITING_AS_BLOCKS", 13667 temporarilyEditingAsBlocks, 13668 focusModeToRevert 13669 }; 13670 } 13671 const registerInserterMediaCategory = (category) => ({ select, dispatch }) => { 13672 if (!category || typeof category !== "object") { 13673 console.error( 13674 "Category should be an `InserterMediaCategory` object." 13675 ); 13676 return; 13677 } 13678 if (!category.name) { 13679 console.error( 13680 "Category should have a `name` that should be unique among all media categories." 13681 ); 13682 return; 13683 } 13684 if (!category.labels?.name) { 13685 console.error("Category should have a `labels.name`."); 13686 return; 13687 } 13688 if (!["image", "audio", "video"].includes(category.mediaType)) { 13689 console.error( 13690 "Category should have `mediaType` property that is one of `image|audio|video`." 13691 ); 13692 return; 13693 } 13694 if (!category.fetch || typeof category.fetch !== "function") { 13695 console.error( 13696 "Category should have a `fetch` function defined with the following signature `(InserterMediaRequest) => Promise<InserterMediaItem[]>`." 13697 ); 13698 return; 13699 } 13700 const registeredInserterMediaCategories = select.getRegisteredInserterMediaCategories(); 13701 if (registeredInserterMediaCategories.some( 13702 ({ name }) => name === category.name 13703 )) { 13704 console.error( 13705 `A category is already registered with the same name: "$category.name}".` 13706 ); 13707 return; 13708 } 13709 if (registeredInserterMediaCategories.some( 13710 ({ labels: { name } = {} }) => name === category.labels?.name 13711 )) { 13712 console.error( 13713 `A category is already registered with the same labels.name: "$category.labels.name}".` 13714 ); 13715 return; 13716 } 13717 dispatch({ 13718 type: "REGISTER_INSERTER_MEDIA_CATEGORY", 13719 category: { ...category, isExternalResource: true } 13720 }); 13721 }; 13722 function setBlockEditingMode(clientId = "", mode) { 13723 return { 13724 type: "SET_BLOCK_EDITING_MODE", 13725 clientId, 13726 mode 13727 }; 13728 } 13729 function unsetBlockEditingMode(clientId = "") { 13730 return { 13731 type: "UNSET_BLOCK_EDITING_MODE", 13732 clientId 13733 }; 13734 } 13735 13736 13737 ;// ./node_modules/@wordpress/block-editor/build-module/store/index.js 13738 13739 13740 13741 13742 13743 13744 13745 13746 const storeConfig = { 13747 reducer: reducer_default, 13748 selectors: selectors_namespaceObject, 13749 actions: actions_namespaceObject 13750 }; 13751 const store = (0,external_wp_data_namespaceObject.createReduxStore)(STORE_NAME, { 13752 ...storeConfig, 13753 persist: ["preferences"] 13754 }); 13755 const registeredStore = (0,external_wp_data_namespaceObject.registerStore)(STORE_NAME, { 13756 ...storeConfig, 13757 persist: ["preferences"] 13758 }); 13759 unlock(registeredStore).registerPrivateActions(private_actions_namespaceObject); 13760 unlock(registeredStore).registerPrivateSelectors(private_selectors_namespaceObject); 13761 unlock(store).registerPrivateActions(private_actions_namespaceObject); 13762 unlock(store).registerPrivateSelectors(private_selectors_namespaceObject); 13763 13764 13765 ;// ./node_modules/@wordpress/block-editor/build-module/components/use-settings/index.js 13766 13767 13768 13769 13770 13771 function use_settings_useSettings(...paths) { 13772 const { clientId = null } = useBlockEditContext(); 13773 return (0,external_wp_data_namespaceObject.useSelect)( 13774 (select) => unlock(select(store)).getBlockSettings( 13775 clientId, 13776 ...paths 13777 ), 13778 [clientId, ...paths] 13779 ); 13780 } 13781 function useSetting(path) { 13782 external_wp_deprecated_default()("wp.blockEditor.useSetting", { 13783 since: "6.5", 13784 alternative: "wp.blockEditor.useSettings", 13785 note: "The new useSettings function can retrieve multiple settings at once, with better performance." 13786 }); 13787 const [value] = use_settings_useSettings(path); 13788 return value; 13789 } 13790 13791 13792 ;// external ["wp","styleEngine"] 13793 const external_wp_styleEngine_namespaceObject = window["wp"]["styleEngine"]; 13794 ;// ./node_modules/@wordpress/block-editor/build-module/components/font-sizes/fluid-utils.js 13795 const DEFAULT_MAXIMUM_VIEWPORT_WIDTH = "1600px"; 13796 const DEFAULT_MINIMUM_VIEWPORT_WIDTH = "320px"; 13797 const DEFAULT_SCALE_FACTOR = 1; 13798 const DEFAULT_MINIMUM_FONT_SIZE_FACTOR_MIN = 0.25; 13799 const DEFAULT_MINIMUM_FONT_SIZE_FACTOR_MAX = 0.75; 13800 const DEFAULT_MINIMUM_FONT_SIZE_LIMIT = "14px"; 13801 function getComputedFluidTypographyValue({ 13802 minimumFontSize, 13803 maximumFontSize, 13804 fontSize, 13805 minimumViewportWidth = DEFAULT_MINIMUM_VIEWPORT_WIDTH, 13806 maximumViewportWidth = DEFAULT_MAXIMUM_VIEWPORT_WIDTH, 13807 scaleFactor = DEFAULT_SCALE_FACTOR, 13808 minimumFontSizeLimit 13809 }) { 13810 minimumFontSizeLimit = !!getTypographyValueAndUnit(minimumFontSizeLimit) ? minimumFontSizeLimit : DEFAULT_MINIMUM_FONT_SIZE_LIMIT; 13811 if (fontSize) { 13812 const fontSizeParsed = getTypographyValueAndUnit(fontSize); 13813 if (!fontSizeParsed?.unit) { 13814 return null; 13815 } 13816 const minimumFontSizeLimitParsed = getTypographyValueAndUnit( 13817 minimumFontSizeLimit, 13818 { 13819 coerceTo: fontSizeParsed.unit 13820 } 13821 ); 13822 if (!!minimumFontSizeLimitParsed?.value && !minimumFontSize && !maximumFontSize) { 13823 if (fontSizeParsed?.value <= minimumFontSizeLimitParsed?.value) { 13824 return null; 13825 } 13826 } 13827 if (!maximumFontSize) { 13828 maximumFontSize = `$fontSizeParsed.value}$fontSizeParsed.unit}`; 13829 } 13830 if (!minimumFontSize) { 13831 const fontSizeValueInPx = fontSizeParsed.unit === "px" ? fontSizeParsed.value : fontSizeParsed.value * 16; 13832 const minimumFontSizeFactor = Math.min( 13833 Math.max( 13834 1 - 0.075 * Math.log2(fontSizeValueInPx), 13835 DEFAULT_MINIMUM_FONT_SIZE_FACTOR_MIN 13836 ), 13837 DEFAULT_MINIMUM_FONT_SIZE_FACTOR_MAX 13838 ); 13839 const calculatedMinimumFontSize = roundToPrecision( 13840 fontSizeParsed.value * minimumFontSizeFactor, 13841 3 13842 ); 13843 if (!!minimumFontSizeLimitParsed?.value && calculatedMinimumFontSize < minimumFontSizeLimitParsed?.value) { 13844 minimumFontSize = `$minimumFontSizeLimitParsed.value}$minimumFontSizeLimitParsed.unit}`; 13845 } else { 13846 minimumFontSize = `$calculatedMinimumFontSize}$fontSizeParsed.unit}`; 13847 } 13848 } 13849 } 13850 const minimumFontSizeParsed = getTypographyValueAndUnit(minimumFontSize); 13851 const fontSizeUnit = minimumFontSizeParsed?.unit || "rem"; 13852 const maximumFontSizeParsed = getTypographyValueAndUnit(maximumFontSize, { 13853 coerceTo: fontSizeUnit 13854 }); 13855 if (!minimumFontSizeParsed || !maximumFontSizeParsed) { 13856 return null; 13857 } 13858 const minimumFontSizeRem = getTypographyValueAndUnit(minimumFontSize, { 13859 coerceTo: "rem" 13860 }); 13861 const maximumViewportWidthParsed = getTypographyValueAndUnit( 13862 maximumViewportWidth, 13863 { coerceTo: fontSizeUnit } 13864 ); 13865 const minimumViewportWidthParsed = getTypographyValueAndUnit( 13866 minimumViewportWidth, 13867 { coerceTo: fontSizeUnit } 13868 ); 13869 if (!maximumViewportWidthParsed || !minimumViewportWidthParsed || !minimumFontSizeRem) { 13870 return null; 13871 } 13872 const linearDenominator = maximumViewportWidthParsed.value - minimumViewportWidthParsed.value; 13873 if (!linearDenominator) { 13874 return null; 13875 } 13876 const minViewportWidthOffsetValue = roundToPrecision( 13877 minimumViewportWidthParsed.value / 100, 13878 3 13879 ); 13880 const viewportWidthOffset = roundToPrecision(minViewportWidthOffsetValue, 3) + fontSizeUnit; 13881 const linearFactor = 100 * ((maximumFontSizeParsed.value - minimumFontSizeParsed.value) / linearDenominator); 13882 const linearFactorScaled = roundToPrecision( 13883 (linearFactor || 1) * scaleFactor, 13884 3 13885 ); 13886 const fluidTargetFontSize = `$minimumFontSizeRem.value}$minimumFontSizeRem.unit} + ((1vw - $viewportWidthOffset}) * $linearFactorScaled})`; 13887 return `clamp($minimumFontSize}, $fluidTargetFontSize}, $maximumFontSize})`; 13888 } 13889 function getTypographyValueAndUnit(rawValue, options = {}) { 13890 if (typeof rawValue !== "string" && typeof rawValue !== "number") { 13891 return null; 13892 } 13893 if (isFinite(rawValue)) { 13894 rawValue = `$rawValue}px`; 13895 } 13896 const { coerceTo, rootSizeValue, acceptableUnits } = { 13897 coerceTo: "", 13898 // Default browser font size. Later we could inject some JS to compute this `getComputedStyle( document.querySelector( "html" ) ).fontSize`. 13899 rootSizeValue: 16, 13900 acceptableUnits: ["rem", "px", "em"], 13901 ...options 13902 }; 13903 const acceptableUnitsGroup = acceptableUnits?.join("|"); 13904 const regexUnits = new RegExp( 13905 `^(\\d*\\.?\\d+)($acceptableUnitsGroup}){1,1}$` 13906 ); 13907 const matches = rawValue.match(regexUnits); 13908 if (!matches || matches.length < 3) { 13909 return null; 13910 } 13911 let [, value, unit] = matches; 13912 let returnValue = parseFloat(value); 13913 if ("px" === coerceTo && ("em" === unit || "rem" === unit)) { 13914 returnValue = returnValue * rootSizeValue; 13915 unit = coerceTo; 13916 } 13917 if ("px" === unit && ("em" === coerceTo || "rem" === coerceTo)) { 13918 returnValue = returnValue / rootSizeValue; 13919 unit = coerceTo; 13920 } 13921 if (("em" === coerceTo || "rem" === coerceTo) && ("em" === unit || "rem" === unit)) { 13922 unit = coerceTo; 13923 } 13924 return { 13925 value: roundToPrecision(returnValue, 3), 13926 unit 13927 }; 13928 } 13929 function roundToPrecision(value, digits = 3) { 13930 const base = Math.pow(10, digits); 13931 return Number.isFinite(value) ? parseFloat(Math.round(value * base) / base) : void 0; 13932 } 13933 13934 13935 ;// ./node_modules/@wordpress/block-editor/build-module/utils/format-font-style.js 13936 13937 function formatFontStyle(fontStyle) { 13938 if (!fontStyle) { 13939 return {}; 13940 } 13941 if (typeof fontStyle === "object") { 13942 return fontStyle; 13943 } 13944 let name; 13945 switch (fontStyle) { 13946 case "normal": 13947 name = (0,external_wp_i18n_namespaceObject._x)("Regular", "font style"); 13948 break; 13949 case "italic": 13950 name = (0,external_wp_i18n_namespaceObject._x)("Italic", "font style"); 13951 break; 13952 case "oblique": 13953 name = (0,external_wp_i18n_namespaceObject._x)("Oblique", "font style"); 13954 break; 13955 default: 13956 name = fontStyle; 13957 break; 13958 } 13959 return { name, value: fontStyle }; 13960 } 13961 13962 13963 ;// ./node_modules/@wordpress/block-editor/build-module/utils/format-font-weight.js 13964 13965 function formatFontWeight(fontWeight) { 13966 if (!fontWeight) { 13967 return {}; 13968 } 13969 if (typeof fontWeight === "object") { 13970 return fontWeight; 13971 } 13972 let name; 13973 switch (fontWeight) { 13974 case "normal": 13975 case "400": 13976 name = (0,external_wp_i18n_namespaceObject._x)("Regular", "font weight"); 13977 break; 13978 case "bold": 13979 case "700": 13980 name = (0,external_wp_i18n_namespaceObject._x)("Bold", "font weight"); 13981 break; 13982 case "100": 13983 name = (0,external_wp_i18n_namespaceObject._x)("Thin", "font weight"); 13984 break; 13985 case "200": 13986 name = (0,external_wp_i18n_namespaceObject._x)("Extra Light", "font weight"); 13987 break; 13988 case "300": 13989 name = (0,external_wp_i18n_namespaceObject._x)("Light", "font weight"); 13990 break; 13991 case "500": 13992 name = (0,external_wp_i18n_namespaceObject._x)("Medium", "font weight"); 13993 break; 13994 case "600": 13995 name = (0,external_wp_i18n_namespaceObject._x)("Semi Bold", "font weight"); 13996 break; 13997 case "800": 13998 name = (0,external_wp_i18n_namespaceObject._x)("Extra Bold", "font weight"); 13999 break; 14000 case "900": 14001 name = (0,external_wp_i18n_namespaceObject._x)("Black", "font weight"); 14002 break; 14003 case "1000": 14004 name = (0,external_wp_i18n_namespaceObject._x)("Extra Black", "font weight"); 14005 break; 14006 default: 14007 name = fontWeight; 14008 break; 14009 } 14010 return { name, value: fontWeight }; 14011 } 14012 14013 14014 ;// ./node_modules/@wordpress/block-editor/build-module/utils/get-font-styles-and-weights.js 14015 14016 14017 14018 const FONT_STYLES = [ 14019 { 14020 name: (0,external_wp_i18n_namespaceObject._x)("Regular", "font style"), 14021 value: "normal" 14022 }, 14023 { 14024 name: (0,external_wp_i18n_namespaceObject._x)("Italic", "font style"), 14025 value: "italic" 14026 } 14027 ]; 14028 const FONT_WEIGHTS = [ 14029 { 14030 name: (0,external_wp_i18n_namespaceObject._x)("Thin", "font weight"), 14031 value: "100" 14032 }, 14033 { 14034 name: (0,external_wp_i18n_namespaceObject._x)("Extra Light", "font weight"), 14035 value: "200" 14036 }, 14037 { 14038 name: (0,external_wp_i18n_namespaceObject._x)("Light", "font weight"), 14039 value: "300" 14040 }, 14041 { 14042 name: (0,external_wp_i18n_namespaceObject._x)("Regular", "font weight"), 14043 value: "400" 14044 }, 14045 { 14046 name: (0,external_wp_i18n_namespaceObject._x)("Medium", "font weight"), 14047 value: "500" 14048 }, 14049 { 14050 name: (0,external_wp_i18n_namespaceObject._x)("Semi Bold", "font weight"), 14051 value: "600" 14052 }, 14053 { 14054 name: (0,external_wp_i18n_namespaceObject._x)("Bold", "font weight"), 14055 value: "700" 14056 }, 14057 { 14058 name: (0,external_wp_i18n_namespaceObject._x)("Extra Bold", "font weight"), 14059 value: "800" 14060 }, 14061 { 14062 name: (0,external_wp_i18n_namespaceObject._x)("Black", "font weight"), 14063 value: "900" 14064 }, 14065 { 14066 name: (0,external_wp_i18n_namespaceObject._x)("Extra Black", "font weight"), 14067 value: "1000" 14068 } 14069 ]; 14070 function getFontStylesAndWeights(fontFamilyFaces) { 14071 let fontStyles = []; 14072 let fontWeights = []; 14073 const combinedStyleAndWeightOptions = []; 14074 const isSystemFont = !fontFamilyFaces || fontFamilyFaces?.length === 0; 14075 let isVariableFont = false; 14076 fontFamilyFaces?.forEach((face) => { 14077 if ("string" === typeof face.fontWeight && /\s/.test(face.fontWeight.trim())) { 14078 isVariableFont = true; 14079 let [startValue, endValue] = face.fontWeight.split(" "); 14080 startValue = parseInt(startValue.slice(0, 1)); 14081 if (endValue === "1000") { 14082 endValue = 10; 14083 } else { 14084 endValue = parseInt(endValue.slice(0, 1)); 14085 } 14086 for (let i = startValue; i <= endValue; i++) { 14087 const fontWeightValue = `$i.toString()}00`; 14088 if (!fontWeights.some( 14089 (weight) => weight.value === fontWeightValue 14090 )) { 14091 fontWeights.push(formatFontWeight(fontWeightValue)); 14092 } 14093 } 14094 } 14095 const fontWeight = formatFontWeight( 14096 "number" === typeof face.fontWeight ? face.fontWeight.toString() : face.fontWeight 14097 ); 14098 const fontStyle = formatFontStyle(face.fontStyle); 14099 if (fontStyle && Object.keys(fontStyle).length) { 14100 if (!fontStyles.some( 14101 (style) => style.value === fontStyle.value 14102 )) { 14103 fontStyles.push(fontStyle); 14104 } 14105 } 14106 if (fontWeight && Object.keys(fontWeight).length) { 14107 if (!fontWeights.some( 14108 (weight) => weight.value === fontWeight.value 14109 )) { 14110 if (!isVariableFont) { 14111 fontWeights.push(fontWeight); 14112 } 14113 } 14114 } 14115 }); 14116 if (!fontWeights.some((weight) => weight.value >= "600")) { 14117 fontWeights.push({ 14118 name: (0,external_wp_i18n_namespaceObject._x)("Bold", "font weight"), 14119 value: "700" 14120 }); 14121 } 14122 if (!fontStyles.some((style) => style.value === "italic")) { 14123 fontStyles.push({ 14124 name: (0,external_wp_i18n_namespaceObject._x)("Italic", "font style"), 14125 value: "italic" 14126 }); 14127 } 14128 if (isSystemFont) { 14129 fontStyles = FONT_STYLES; 14130 fontWeights = FONT_WEIGHTS; 14131 } 14132 fontStyles = fontStyles.length === 0 ? FONT_STYLES : fontStyles; 14133 fontWeights = fontWeights.length === 0 ? FONT_WEIGHTS : fontWeights; 14134 fontStyles.forEach(({ name: styleName, value: styleValue }) => { 14135 fontWeights.forEach(({ name: weightName, value: weightValue }) => { 14136 const optionName = styleValue === "normal" ? weightName : (0,external_wp_i18n_namespaceObject.sprintf)( 14137 /* translators: 1: Font weight name. 2: Font style name. */ 14138 (0,external_wp_i18n_namespaceObject._x)("%1$s %2$s", "font"), 14139 weightName, 14140 styleName 14141 ); 14142 combinedStyleAndWeightOptions.push({ 14143 key: `$styleValue}-$weightValue}`, 14144 name: optionName, 14145 style: { 14146 fontStyle: styleValue, 14147 fontWeight: weightValue 14148 } 14149 }); 14150 }); 14151 }); 14152 return { 14153 fontStyles, 14154 fontWeights, 14155 combinedStyleAndWeightOptions, 14156 isSystemFont, 14157 isVariableFont 14158 }; 14159 } 14160 14161 14162 ;// ./node_modules/@wordpress/block-editor/build-module/components/global-styles/typography-utils.js 14163 14164 14165 function getTypographyFontSizeValue(preset, settings) { 14166 const { size: defaultSize } = preset; 14167 if (!defaultSize || "0" === defaultSize || false === preset?.fluid) { 14168 return defaultSize; 14169 } 14170 if (!isFluidTypographyEnabled(settings?.typography) && !isFluidTypographyEnabled(preset)) { 14171 return defaultSize; 14172 } 14173 let fluidTypographySettings = getFluidTypographyOptionsFromSettings(settings); 14174 fluidTypographySettings = typeof fluidTypographySettings?.fluid === "object" ? fluidTypographySettings?.fluid : {}; 14175 const fluidFontSizeValue = getComputedFluidTypographyValue({ 14176 minimumFontSize: preset?.fluid?.min, 14177 maximumFontSize: preset?.fluid?.max, 14178 fontSize: defaultSize, 14179 minimumFontSizeLimit: fluidTypographySettings?.minFontSize, 14180 maximumViewportWidth: fluidTypographySettings?.maxViewportWidth, 14181 minimumViewportWidth: fluidTypographySettings?.minViewportWidth 14182 }); 14183 if (!!fluidFontSizeValue) { 14184 return fluidFontSizeValue; 14185 } 14186 return defaultSize; 14187 } 14188 function isFluidTypographyEnabled(typographySettings) { 14189 const fluidSettings = typographySettings?.fluid; 14190 return true === fluidSettings || fluidSettings && typeof fluidSettings === "object" && Object.keys(fluidSettings).length > 0; 14191 } 14192 function getFluidTypographyOptionsFromSettings(settings) { 14193 const typographySettings = settings?.typography; 14194 const layoutSettings = settings?.layout; 14195 const defaultMaxViewportWidth = getTypographyValueAndUnit( 14196 layoutSettings?.wideSize 14197 ) ? layoutSettings?.wideSize : null; 14198 return isFluidTypographyEnabled(typographySettings) && defaultMaxViewportWidth ? { 14199 fluid: { 14200 maxViewportWidth: defaultMaxViewportWidth, 14201 ...typographySettings.fluid 14202 } 14203 } : { 14204 fluid: typographySettings?.fluid 14205 }; 14206 } 14207 function getMergedFontFamiliesAndFontFamilyFaces(settings, selectedFontFamily) { 14208 const fontFamiliesFromSettings = settings?.typography?.fontFamilies; 14209 const fontFamilies = ["default", "theme", "custom"].flatMap( 14210 (key) => fontFamiliesFromSettings?.[key] ?? [] 14211 ); 14212 const fontFamilyFaces = fontFamilies.find( 14213 (family) => family.fontFamily === selectedFontFamily 14214 )?.fontFace ?? []; 14215 return { fontFamilies, fontFamilyFaces }; 14216 } 14217 function findNearestFontWeight(availableFontWeights, newFontWeightValue) { 14218 newFontWeightValue = "number" === typeof newFontWeightValue ? newFontWeightValue.toString() : newFontWeightValue; 14219 if (!newFontWeightValue || typeof newFontWeightValue !== "string") { 14220 return ""; 14221 } 14222 if (!availableFontWeights || availableFontWeights.length === 0) { 14223 return newFontWeightValue; 14224 } 14225 const nearestFontWeight = availableFontWeights?.reduce( 14226 (nearest, { value: fw }) => { 14227 const currentDiff = Math.abs( 14228 parseInt(fw) - parseInt(newFontWeightValue) 14229 ); 14230 const nearestDiff = Math.abs( 14231 parseInt(nearest) - parseInt(newFontWeightValue) 14232 ); 14233 return currentDiff < nearestDiff ? fw : nearest; 14234 }, 14235 availableFontWeights[0]?.value 14236 ); 14237 return nearestFontWeight; 14238 } 14239 function findNearestFontStyle(availableFontStyles, newFontStyleValue) { 14240 if (typeof newFontStyleValue !== "string" || !newFontStyleValue) { 14241 return ""; 14242 } 14243 const validStyles = ["normal", "italic", "oblique"]; 14244 if (!validStyles.includes(newFontStyleValue)) { 14245 return ""; 14246 } 14247 if (!availableFontStyles || availableFontStyles.length === 0 || availableFontStyles.find( 14248 (style) => style.value === newFontStyleValue 14249 )) { 14250 return newFontStyleValue; 14251 } 14252 if (newFontStyleValue === "oblique" && !availableFontStyles.find((style) => style.value === "oblique")) { 14253 return "italic"; 14254 } 14255 return ""; 14256 } 14257 function findNearestStyleAndWeight(fontFamilyFaces, fontStyle, fontWeight) { 14258 let nearestFontStyle = fontStyle; 14259 let nearestFontWeight = fontWeight; 14260 const { fontStyles, fontWeights, combinedStyleAndWeightOptions } = getFontStylesAndWeights(fontFamilyFaces); 14261 const hasFontStyle = fontStyles?.some( 14262 ({ value: fs }) => fs === fontStyle 14263 ); 14264 const hasFontWeight = fontWeights?.some( 14265 ({ value: fw }) => fw?.toString() === fontWeight?.toString() 14266 ); 14267 if (!hasFontStyle) { 14268 nearestFontStyle = fontStyle ? findNearestFontStyle(fontStyles, fontStyle) : combinedStyleAndWeightOptions?.find( 14269 (option) => option.style.fontWeight === findNearestFontWeight(fontWeights, fontWeight) 14270 )?.style?.fontStyle; 14271 } 14272 if (!hasFontWeight) { 14273 nearestFontWeight = fontWeight ? findNearestFontWeight(fontWeights, fontWeight) : combinedStyleAndWeightOptions?.find( 14274 (option) => option.style.fontStyle === (nearestFontStyle || fontStyle) 14275 )?.style?.fontWeight; 14276 } 14277 return { nearestFontStyle, nearestFontWeight }; 14278 } 14279 14280 14281 ;// ./node_modules/@wordpress/block-editor/build-module/components/global-styles/utils.js 14282 14283 14284 14285 14286 14287 const ROOT_BLOCK_SELECTOR = "body"; 14288 const ROOT_CSS_PROPERTIES_SELECTOR = ":root"; 14289 const PRESET_METADATA = [ 14290 { 14291 path: ["color", "palette"], 14292 valueKey: "color", 14293 cssVarInfix: "color", 14294 classes: [ 14295 { classSuffix: "color", propertyName: "color" }, 14296 { 14297 classSuffix: "background-color", 14298 propertyName: "background-color" 14299 }, 14300 { 14301 classSuffix: "border-color", 14302 propertyName: "border-color" 14303 } 14304 ] 14305 }, 14306 { 14307 path: ["color", "gradients"], 14308 valueKey: "gradient", 14309 cssVarInfix: "gradient", 14310 classes: [ 14311 { 14312 classSuffix: "gradient-background", 14313 propertyName: "background" 14314 } 14315 ] 14316 }, 14317 { 14318 path: ["color", "duotone"], 14319 valueKey: "colors", 14320 cssVarInfix: "duotone", 14321 valueFunc: ({ slug }) => `url( '#wp-duotone-$slug}' )`, 14322 classes: [] 14323 }, 14324 { 14325 path: ["shadow", "presets"], 14326 valueKey: "shadow", 14327 cssVarInfix: "shadow", 14328 classes: [] 14329 }, 14330 { 14331 path: ["typography", "fontSizes"], 14332 valueFunc: (preset, settings) => getTypographyFontSizeValue(preset, settings), 14333 valueKey: "size", 14334 cssVarInfix: "font-size", 14335 classes: [{ classSuffix: "font-size", propertyName: "font-size" }] 14336 }, 14337 { 14338 path: ["typography", "fontFamilies"], 14339 valueKey: "fontFamily", 14340 cssVarInfix: "font-family", 14341 classes: [ 14342 { classSuffix: "font-family", propertyName: "font-family" } 14343 ] 14344 }, 14345 { 14346 path: ["spacing", "spacingSizes"], 14347 valueKey: "size", 14348 cssVarInfix: "spacing", 14349 classes: [] 14350 }, 14351 { 14352 path: ["border", "radiusSizes"], 14353 valueKey: "size", 14354 cssVarInfix: "border-radius", 14355 classes: [] 14356 } 14357 ]; 14358 const STYLE_PATH_TO_CSS_VAR_INFIX = { 14359 "color.background": "color", 14360 "color.text": "color", 14361 "filter.duotone": "duotone", 14362 "elements.link.color.text": "color", 14363 "elements.link.:hover.color.text": "color", 14364 "elements.link.typography.fontFamily": "font-family", 14365 "elements.link.typography.fontSize": "font-size", 14366 "elements.button.color.text": "color", 14367 "elements.button.color.background": "color", 14368 "elements.caption.color.text": "color", 14369 "elements.button.typography.fontFamily": "font-family", 14370 "elements.button.typography.fontSize": "font-size", 14371 "elements.heading.color": "color", 14372 "elements.heading.color.background": "color", 14373 "elements.heading.typography.fontFamily": "font-family", 14374 "elements.heading.gradient": "gradient", 14375 "elements.heading.color.gradient": "gradient", 14376 "elements.h1.color": "color", 14377 "elements.h1.color.background": "color", 14378 "elements.h1.typography.fontFamily": "font-family", 14379 "elements.h1.color.gradient": "gradient", 14380 "elements.h2.color": "color", 14381 "elements.h2.color.background": "color", 14382 "elements.h2.typography.fontFamily": "font-family", 14383 "elements.h2.color.gradient": "gradient", 14384 "elements.h3.color": "color", 14385 "elements.h3.color.background": "color", 14386 "elements.h3.typography.fontFamily": "font-family", 14387 "elements.h3.color.gradient": "gradient", 14388 "elements.h4.color": "color", 14389 "elements.h4.color.background": "color", 14390 "elements.h4.typography.fontFamily": "font-family", 14391 "elements.h4.color.gradient": "gradient", 14392 "elements.h5.color": "color", 14393 "elements.h5.color.background": "color", 14394 "elements.h5.typography.fontFamily": "font-family", 14395 "elements.h5.color.gradient": "gradient", 14396 "elements.h6.color": "color", 14397 "elements.h6.color.background": "color", 14398 "elements.h6.typography.fontFamily": "font-family", 14399 "elements.h6.color.gradient": "gradient", 14400 "color.gradient": "gradient", 14401 shadow: "shadow", 14402 "typography.fontSize": "font-size", 14403 "typography.fontFamily": "font-family" 14404 }; 14405 const STYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE = { 14406 "color.background": "backgroundColor", 14407 "color.text": "textColor", 14408 "color.gradient": "gradient", 14409 "typography.fontSize": "fontSize", 14410 "typography.fontFamily": "fontFamily" 14411 }; 14412 function useToolsPanelDropdownMenuProps() { 14413 const isMobile = (0,external_wp_compose_namespaceObject.useViewportMatch)("medium", "<"); 14414 return !isMobile ? { 14415 popoverProps: { 14416 placement: "left-start", 14417 // For non-mobile, inner sidebar width (248px) - button width (24px) - border (1px) + padding (16px) + spacing (20px) 14418 offset: 259 14419 } 14420 } : {}; 14421 } 14422 function findInPresetsBy(features, blockName, presetPath, presetProperty, presetValueValue) { 14423 const orderedPresetsByOrigin = [ 14424 getValueFromObjectPath(features, [ 14425 "blocks", 14426 blockName, 14427 ...presetPath 14428 ]), 14429 getValueFromObjectPath(features, presetPath) 14430 ]; 14431 for (const presetByOrigin of orderedPresetsByOrigin) { 14432 if (presetByOrigin) { 14433 const origins = ["custom", "theme", "default"]; 14434 for (const origin of origins) { 14435 const presets = presetByOrigin[origin]; 14436 if (presets) { 14437 const presetObject = presets.find( 14438 (preset) => preset[presetProperty] === presetValueValue 14439 ); 14440 if (presetObject) { 14441 if (presetProperty === "slug") { 14442 return presetObject; 14443 } 14444 const highestPresetObjectWithSameSlug = findInPresetsBy( 14445 features, 14446 blockName, 14447 presetPath, 14448 "slug", 14449 presetObject.slug 14450 ); 14451 if (highestPresetObjectWithSameSlug[presetProperty] === presetObject[presetProperty]) { 14452 return presetObject; 14453 } 14454 return void 0; 14455 } 14456 } 14457 } 14458 } 14459 } 14460 } 14461 function getPresetVariableFromValue(features, blockName, variableStylePath, presetPropertyValue) { 14462 if (!presetPropertyValue) { 14463 return presetPropertyValue; 14464 } 14465 const cssVarInfix = STYLE_PATH_TO_CSS_VAR_INFIX[variableStylePath]; 14466 const metadata = PRESET_METADATA.find( 14467 (data) => data.cssVarInfix === cssVarInfix 14468 ); 14469 if (!metadata) { 14470 return presetPropertyValue; 14471 } 14472 const { valueKey, path } = metadata; 14473 const presetObject = findInPresetsBy( 14474 features, 14475 blockName, 14476 path, 14477 valueKey, 14478 presetPropertyValue 14479 ); 14480 if (!presetObject) { 14481 return presetPropertyValue; 14482 } 14483 return `var:preset|$cssVarInfix}|$presetObject.slug}`; 14484 } 14485 function getValueFromPresetVariable(features, blockName, variable, [presetType, slug]) { 14486 const metadata = PRESET_METADATA.find( 14487 (data) => data.cssVarInfix === presetType 14488 ); 14489 if (!metadata) { 14490 return variable; 14491 } 14492 const presetObject = findInPresetsBy( 14493 features.settings, 14494 blockName, 14495 metadata.path, 14496 "slug", 14497 slug 14498 ); 14499 if (presetObject) { 14500 const { valueKey } = metadata; 14501 const result = presetObject[valueKey]; 14502 return getValueFromVariable(features, blockName, result); 14503 } 14504 return variable; 14505 } 14506 function getValueFromCustomVariable(features, blockName, variable, path) { 14507 const result = getValueFromObjectPath(features.settings, [ 14508 "blocks", 14509 blockName, 14510 "custom", 14511 ...path 14512 ]) ?? getValueFromObjectPath(features.settings, ["custom", ...path]); 14513 if (!result) { 14514 return variable; 14515 } 14516 return getValueFromVariable(features, blockName, result); 14517 } 14518 function getValueFromVariable(features, blockName, variable) { 14519 if (!variable || typeof variable !== "string") { 14520 if (typeof variable?.ref === "string") { 14521 variable = getValueFromObjectPath(features, variable.ref); 14522 if (!variable || !!variable?.ref) { 14523 return variable; 14524 } 14525 } else { 14526 return variable; 14527 } 14528 } 14529 const USER_VALUE_PREFIX = "var:"; 14530 const THEME_VALUE_PREFIX = "var(--wp--"; 14531 const THEME_VALUE_SUFFIX = ")"; 14532 let parsedVar; 14533 if (variable.startsWith(USER_VALUE_PREFIX)) { 14534 parsedVar = variable.slice(USER_VALUE_PREFIX.length).split("|"); 14535 } else if (variable.startsWith(THEME_VALUE_PREFIX) && variable.endsWith(THEME_VALUE_SUFFIX)) { 14536 parsedVar = variable.slice(THEME_VALUE_PREFIX.length, -THEME_VALUE_SUFFIX.length).split("--"); 14537 } else { 14538 return variable; 14539 } 14540 const [type, ...path] = parsedVar; 14541 if (type === "preset") { 14542 return getValueFromPresetVariable( 14543 features, 14544 blockName, 14545 variable, 14546 path 14547 ); 14548 } 14549 if (type === "custom") { 14550 return getValueFromCustomVariable( 14551 features, 14552 blockName, 14553 variable, 14554 path 14555 ); 14556 } 14557 return variable; 14558 } 14559 function scopeSelector(scope, selector) { 14560 if (!scope || !selector) { 14561 return selector; 14562 } 14563 const scopes = scope.split(","); 14564 const selectors = selector.split(","); 14565 const selectorsScoped = []; 14566 scopes.forEach((outer) => { 14567 selectors.forEach((inner) => { 14568 selectorsScoped.push(`$outer.trim()} $inner.trim()}`); 14569 }); 14570 }); 14571 return selectorsScoped.join(", "); 14572 } 14573 function scopeFeatureSelectors(scope, selectors) { 14574 if (!scope || !selectors) { 14575 return; 14576 } 14577 const featureSelectors = {}; 14578 Object.entries(selectors).forEach(([feature, selector]) => { 14579 if (typeof selector === "string") { 14580 featureSelectors[feature] = scopeSelector(scope, selector); 14581 } 14582 if (typeof selector === "object") { 14583 featureSelectors[feature] = {}; 14584 Object.entries(selector).forEach( 14585 ([subfeature, subfeatureSelector]) => { 14586 featureSelectors[feature][subfeature] = scopeSelector( 14587 scope, 14588 subfeatureSelector 14589 ); 14590 } 14591 ); 14592 } 14593 }); 14594 return featureSelectors; 14595 } 14596 function appendToSelector(selector, toAppend) { 14597 if (!selector.includes(",")) { 14598 return selector + toAppend; 14599 } 14600 const selectors = selector.split(","); 14601 const newSelectors = selectors.map((sel) => sel + toAppend); 14602 return newSelectors.join(","); 14603 } 14604 function areGlobalStyleConfigsEqual(original, variation) { 14605 if (typeof original !== "object" || typeof variation !== "object") { 14606 return original === variation; 14607 } 14608 return es6_default()(original?.styles, variation?.styles) && es6_default()(original?.settings, variation?.settings); 14609 } 14610 function getBlockStyleVariationSelector(variation, blockSelector) { 14611 const variationClass = `.is-style-$variation}`; 14612 if (!blockSelector) { 14613 return variationClass; 14614 } 14615 const ancestorRegex = /((?::\([^)]+\))?\s*)([^\s:]+)/; 14616 const addVariationClass = (_match, group1, group2) => { 14617 return group1 + group2 + variationClass; 14618 }; 14619 const result = blockSelector.split(",").map((part) => part.replace(ancestorRegex, addVariationClass)); 14620 return result.join(","); 14621 } 14622 function getResolvedThemeFilePath(file, themeFileURIs) { 14623 if (!file || !themeFileURIs || !Array.isArray(themeFileURIs)) { 14624 return file; 14625 } 14626 const uri = themeFileURIs.find( 14627 (themeFileUri) => themeFileUri?.name === file 14628 ); 14629 if (!uri?.href) { 14630 return file; 14631 } 14632 return uri?.href; 14633 } 14634 function getResolvedRefValue(ruleValue, tree) { 14635 if (!ruleValue || !tree) { 14636 return ruleValue; 14637 } 14638 if (typeof ruleValue !== "string" && ruleValue?.ref) { 14639 const resolvedRuleValue = (0,external_wp_styleEngine_namespaceObject.getCSSValueFromRawStyle)( 14640 getValueFromObjectPath(tree, ruleValue.ref) 14641 ); 14642 if (resolvedRuleValue?.ref) { 14643 return void 0; 14644 } 14645 if (resolvedRuleValue === void 0) { 14646 return ruleValue; 14647 } 14648 return resolvedRuleValue; 14649 } 14650 return ruleValue; 14651 } 14652 function getResolvedValue(ruleValue, tree) { 14653 if (!ruleValue || !tree) { 14654 return ruleValue; 14655 } 14656 const resolvedValue = getResolvedRefValue(ruleValue, tree); 14657 if (resolvedValue?.url) { 14658 resolvedValue.url = getResolvedThemeFilePath( 14659 resolvedValue.url, 14660 tree?._links?.["wp:theme-file"] 14661 ); 14662 } 14663 return resolvedValue; 14664 } 14665 14666 14667 ;// ./node_modules/@wordpress/block-editor/build-module/components/global-styles/context.js 14668 14669 const DEFAULT_GLOBAL_STYLES_CONTEXT = { 14670 user: {}, 14671 base: {}, 14672 merged: {}, 14673 setUserConfig: () => { 14674 } 14675 }; 14676 const GlobalStylesContext = (0,external_wp_element_namespaceObject.createContext)( 14677 DEFAULT_GLOBAL_STYLES_CONTEXT 14678 ); 14679 GlobalStylesContext.displayName = "GlobalStylesContext"; 14680 14681 14682 ;// ./node_modules/@wordpress/block-editor/build-module/components/global-styles/hooks.js 14683 14684 14685 14686 14687 14688 14689 14690 14691 14692 const EMPTY_CONFIG = { settings: {}, styles: {} }; 14693 const VALID_SETTINGS = [ 14694 "appearanceTools", 14695 "useRootPaddingAwareAlignments", 14696 "background.backgroundImage", 14697 "background.backgroundRepeat", 14698 "background.backgroundSize", 14699 "background.backgroundPosition", 14700 "border.color", 14701 "border.radius", 14702 "border.style", 14703 "border.width", 14704 "border.radiusSizes", 14705 "shadow.presets", 14706 "shadow.defaultPresets", 14707 "color.background", 14708 "color.button", 14709 "color.caption", 14710 "color.custom", 14711 "color.customDuotone", 14712 "color.customGradient", 14713 "color.defaultDuotone", 14714 "color.defaultGradients", 14715 "color.defaultPalette", 14716 "color.duotone", 14717 "color.gradients", 14718 "color.heading", 14719 "color.link", 14720 "color.palette", 14721 "color.text", 14722 "custom", 14723 "dimensions.aspectRatio", 14724 "dimensions.minHeight", 14725 "layout.contentSize", 14726 "layout.definitions", 14727 "layout.wideSize", 14728 "lightbox.enabled", 14729 "lightbox.allowEditing", 14730 "position.fixed", 14731 "position.sticky", 14732 "spacing.customSpacingSize", 14733 "spacing.defaultSpacingSizes", 14734 "spacing.spacingSizes", 14735 "spacing.spacingScale", 14736 "spacing.blockGap", 14737 "spacing.margin", 14738 "spacing.padding", 14739 "spacing.units", 14740 "typography.fluid", 14741 "typography.customFontSize", 14742 "typography.defaultFontSizes", 14743 "typography.dropCap", 14744 "typography.fontFamilies", 14745 "typography.fontSizes", 14746 "typography.fontStyle", 14747 "typography.fontWeight", 14748 "typography.letterSpacing", 14749 "typography.lineHeight", 14750 "typography.textAlign", 14751 "typography.textColumns", 14752 "typography.textDecoration", 14753 "typography.textTransform", 14754 "typography.writingMode" 14755 ]; 14756 const useGlobalStylesReset = () => { 14757 const { user, setUserConfig } = (0,external_wp_element_namespaceObject.useContext)(GlobalStylesContext); 14758 const config = { 14759 settings: user.settings, 14760 styles: user.styles 14761 }; 14762 const canReset = !!config && !es6_default()(config, EMPTY_CONFIG); 14763 return [ 14764 canReset, 14765 (0,external_wp_element_namespaceObject.useCallback)(() => setUserConfig(EMPTY_CONFIG), [setUserConfig]) 14766 ]; 14767 }; 14768 function useGlobalSetting(propertyPath, blockName, source = "all") { 14769 const { setUserConfig, ...configs } = (0,external_wp_element_namespaceObject.useContext)(GlobalStylesContext); 14770 const appendedBlockPath = blockName ? ".blocks." + blockName : ""; 14771 const appendedPropertyPath = propertyPath ? "." + propertyPath : ""; 14772 const contextualPath = `settings$appendedBlockPath}$appendedPropertyPath}`; 14773 const globalPath = `settings$appendedPropertyPath}`; 14774 const sourceKey = source === "all" ? "merged" : source; 14775 const settingValue = (0,external_wp_element_namespaceObject.useMemo)(() => { 14776 const configToUse = configs[sourceKey]; 14777 if (!configToUse) { 14778 throw "Unsupported source"; 14779 } 14780 if (propertyPath) { 14781 return getValueFromObjectPath(configToUse, contextualPath) ?? getValueFromObjectPath(configToUse, globalPath); 14782 } 14783 let result = {}; 14784 VALID_SETTINGS.forEach((setting) => { 14785 const value = getValueFromObjectPath( 14786 configToUse, 14787 `settings$appendedBlockPath}.$setting}` 14788 ) ?? getValueFromObjectPath(configToUse, `settings.$setting}`); 14789 if (value !== void 0) { 14790 result = setImmutably(result, setting.split("."), value); 14791 } 14792 }); 14793 return result; 14794 }, [ 14795 configs, 14796 sourceKey, 14797 propertyPath, 14798 contextualPath, 14799 globalPath, 14800 appendedBlockPath 14801 ]); 14802 const setSetting = (newValue) => { 14803 setUserConfig( 14804 (currentConfig) => setImmutably(currentConfig, contextualPath.split("."), newValue) 14805 ); 14806 }; 14807 return [settingValue, setSetting]; 14808 } 14809 function useGlobalStyle(path, blockName, source = "all", { shouldDecodeEncode = true } = {}) { 14810 const { 14811 merged: mergedConfig, 14812 base: baseConfig, 14813 user: userConfig, 14814 setUserConfig 14815 } = (0,external_wp_element_namespaceObject.useContext)(GlobalStylesContext); 14816 const appendedPath = path ? "." + path : ""; 14817 const finalPath = !blockName ? `styles$appendedPath}` : `styles.blocks.$blockName}$appendedPath}`; 14818 const setStyle = (newValue) => { 14819 setUserConfig( 14820 (currentConfig) => setImmutably( 14821 currentConfig, 14822 finalPath.split("."), 14823 shouldDecodeEncode ? getPresetVariableFromValue( 14824 mergedConfig.settings, 14825 blockName, 14826 path, 14827 newValue 14828 ) : newValue 14829 ) 14830 ); 14831 }; 14832 let rawResult, result; 14833 switch (source) { 14834 case "all": 14835 rawResult = getValueFromObjectPath(mergedConfig, finalPath); 14836 result = shouldDecodeEncode ? getValueFromVariable(mergedConfig, blockName, rawResult) : rawResult; 14837 break; 14838 case "user": 14839 rawResult = getValueFromObjectPath(userConfig, finalPath); 14840 result = shouldDecodeEncode ? getValueFromVariable(mergedConfig, blockName, rawResult) : rawResult; 14841 break; 14842 case "base": 14843 rawResult = getValueFromObjectPath(baseConfig, finalPath); 14844 result = shouldDecodeEncode ? getValueFromVariable(baseConfig, blockName, rawResult) : rawResult; 14845 break; 14846 default: 14847 throw "Unsupported source"; 14848 } 14849 return [result, setStyle]; 14850 } 14851 function useSettingsForBlockElement(parentSettings, blockName, element) { 14852 const { supportedStyles, supports } = (0,external_wp_data_namespaceObject.useSelect)( 14853 (select) => { 14854 return { 14855 supportedStyles: unlock( 14856 select(external_wp_blocks_namespaceObject.store) 14857 ).getSupportedStyles(blockName, element), 14858 supports: select(external_wp_blocks_namespaceObject.store).getBlockType(blockName)?.supports 14859 }; 14860 }, 14861 [blockName, element] 14862 ); 14863 return (0,external_wp_element_namespaceObject.useMemo)(() => { 14864 const updatedSettings = { ...parentSettings }; 14865 if (!supportedStyles.includes("fontSize")) { 14866 updatedSettings.typography = { 14867 ...updatedSettings.typography, 14868 fontSizes: {}, 14869 customFontSize: false, 14870 defaultFontSizes: false 14871 }; 14872 } 14873 if (!supportedStyles.includes("fontFamily")) { 14874 updatedSettings.typography = { 14875 ...updatedSettings.typography, 14876 fontFamilies: {} 14877 }; 14878 } 14879 updatedSettings.color = { 14880 ...updatedSettings.color, 14881 text: updatedSettings.color?.text && supportedStyles.includes("color"), 14882 background: updatedSettings.color?.background && (supportedStyles.includes("background") || supportedStyles.includes("backgroundColor")), 14883 button: updatedSettings.color?.button && supportedStyles.includes("buttonColor"), 14884 heading: updatedSettings.color?.heading && supportedStyles.includes("headingColor"), 14885 link: updatedSettings.color?.link && supportedStyles.includes("linkColor"), 14886 caption: updatedSettings.color?.caption && supportedStyles.includes("captionColor") 14887 }; 14888 if (!supportedStyles.includes("background")) { 14889 updatedSettings.color.gradients = []; 14890 updatedSettings.color.customGradient = false; 14891 } 14892 if (!supportedStyles.includes("filter")) { 14893 updatedSettings.color.defaultDuotone = false; 14894 updatedSettings.color.customDuotone = false; 14895 } 14896 [ 14897 "lineHeight", 14898 "fontStyle", 14899 "fontWeight", 14900 "letterSpacing", 14901 "textAlign", 14902 "textTransform", 14903 "textDecoration", 14904 "writingMode" 14905 ].forEach((key) => { 14906 if (!supportedStyles.includes(key)) { 14907 updatedSettings.typography = { 14908 ...updatedSettings.typography, 14909 [key]: false 14910 }; 14911 } 14912 }); 14913 if (!supportedStyles.includes("columnCount")) { 14914 updatedSettings.typography = { 14915 ...updatedSettings.typography, 14916 textColumns: false 14917 }; 14918 } 14919 ["contentSize", "wideSize"].forEach((key) => { 14920 if (!supportedStyles.includes(key)) { 14921 updatedSettings.layout = { 14922 ...updatedSettings.layout, 14923 [key]: false 14924 }; 14925 } 14926 }); 14927 ["padding", "margin", "blockGap"].forEach((key) => { 14928 if (!supportedStyles.includes(key)) { 14929 updatedSettings.spacing = { 14930 ...updatedSettings.spacing, 14931 [key]: false 14932 }; 14933 } 14934 const sides = Array.isArray(supports?.spacing?.[key]) ? supports?.spacing?.[key] : supports?.spacing?.[key]?.sides; 14935 if (sides?.length && updatedSettings.spacing?.[key]) { 14936 updatedSettings.spacing = { 14937 ...updatedSettings.spacing, 14938 [key]: { 14939 ...updatedSettings.spacing?.[key], 14940 sides 14941 } 14942 }; 14943 } 14944 }); 14945 ["aspectRatio", "minHeight"].forEach((key) => { 14946 if (!supportedStyles.includes(key)) { 14947 updatedSettings.dimensions = { 14948 ...updatedSettings.dimensions, 14949 [key]: false 14950 }; 14951 } 14952 }); 14953 ["radius", "color", "style", "width"].forEach((key) => { 14954 if (!supportedStyles.includes( 14955 "border" + key.charAt(0).toUpperCase() + key.slice(1) 14956 )) { 14957 updatedSettings.border = { 14958 ...updatedSettings.border, 14959 [key]: false 14960 }; 14961 } 14962 }); 14963 ["backgroundImage", "backgroundSize"].forEach((key) => { 14964 if (!supportedStyles.includes(key)) { 14965 updatedSettings.background = { 14966 ...updatedSettings.background, 14967 [key]: false 14968 }; 14969 } 14970 }); 14971 updatedSettings.shadow = supportedStyles.includes("shadow") ? updatedSettings.shadow : false; 14972 if (element) { 14973 updatedSettings.typography.textAlign = false; 14974 } 14975 return updatedSettings; 14976 }, [parentSettings, supportedStyles, supports, element]); 14977 } 14978 function useColorsPerOrigin(settings) { 14979 const customColors = settings?.color?.palette?.custom; 14980 const themeColors = settings?.color?.palette?.theme; 14981 const defaultColors = settings?.color?.palette?.default; 14982 const shouldDisplayDefaultColors = settings?.color?.defaultPalette; 14983 return (0,external_wp_element_namespaceObject.useMemo)(() => { 14984 const result = []; 14985 if (themeColors && themeColors.length) { 14986 result.push({ 14987 name: (0,external_wp_i18n_namespaceObject._x)( 14988 "Theme", 14989 "Indicates this palette comes from the theme." 14990 ), 14991 colors: themeColors 14992 }); 14993 } 14994 if (shouldDisplayDefaultColors && defaultColors && defaultColors.length) { 14995 result.push({ 14996 name: (0,external_wp_i18n_namespaceObject._x)( 14997 "Default", 14998 "Indicates this palette comes from WordPress." 14999 ), 15000 colors: defaultColors 15001 }); 15002 } 15003 if (customColors && customColors.length) { 15004 result.push({ 15005 name: (0,external_wp_i18n_namespaceObject._x)( 15006 "Custom", 15007 "Indicates this palette is created by the user." 15008 ), 15009 colors: customColors 15010 }); 15011 } 15012 return result; 15013 }, [ 15014 customColors, 15015 themeColors, 15016 defaultColors, 15017 shouldDisplayDefaultColors 15018 ]); 15019 } 15020 function useGradientsPerOrigin(settings) { 15021 const customGradients = settings?.color?.gradients?.custom; 15022 const themeGradients = settings?.color?.gradients?.theme; 15023 const defaultGradients = settings?.color?.gradients?.default; 15024 const shouldDisplayDefaultGradients = settings?.color?.defaultGradients; 15025 return (0,external_wp_element_namespaceObject.useMemo)(() => { 15026 const result = []; 15027 if (themeGradients && themeGradients.length) { 15028 result.push({ 15029 name: (0,external_wp_i18n_namespaceObject._x)( 15030 "Theme", 15031 "Indicates this palette comes from the theme." 15032 ), 15033 gradients: themeGradients 15034 }); 15035 } 15036 if (shouldDisplayDefaultGradients && defaultGradients && defaultGradients.length) { 15037 result.push({ 15038 name: (0,external_wp_i18n_namespaceObject._x)( 15039 "Default", 15040 "Indicates this palette comes from WordPress." 15041 ), 15042 gradients: defaultGradients 15043 }); 15044 } 15045 if (customGradients && customGradients.length) { 15046 result.push({ 15047 name: (0,external_wp_i18n_namespaceObject._x)( 15048 "Custom", 15049 "Indicates this palette is created by the user." 15050 ), 15051 gradients: customGradients 15052 }); 15053 } 15054 return result; 15055 }, [ 15056 customGradients, 15057 themeGradients, 15058 defaultGradients, 15059 shouldDisplayDefaultGradients 15060 ]); 15061 } 15062 15063 15064 ;// ./node_modules/clsx/dist/clsx.mjs 15065 function r(e){var t,f,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(f=r(e[t]))&&(n&&(n+=" "),n+=f)}else for(f in e)e[f]&&(n&&(n+=" "),n+=f);return n}function clsx(){for(var e,t,f=0,n="",o=arguments.length;f<o;f++)(e=arguments[f])&&(t=r(e))&&(n&&(n+=" "),n+=t);return n}/* harmony default export */ const dist_clsx = (clsx); 15066 ;// ./node_modules/@wordpress/block-editor/build-module/hooks/utils.js 15067 15068 15069 15070 15071 15072 15073 15074 15075 15076 15077 15078 15079 15080 const utils_cleanEmptyObject = (object) => { 15081 if (object === null || typeof object !== "object" || Array.isArray(object)) { 15082 return object; 15083 } 15084 const cleanedNestedObjects = Object.entries(object).map(([key, value]) => [key, utils_cleanEmptyObject(value)]).filter(([, value]) => value !== void 0); 15085 return !cleanedNestedObjects.length ? void 0 : Object.fromEntries(cleanedNestedObjects); 15086 }; 15087 function transformStyles(activeSupports, migrationPaths, result, source, index, results) { 15088 if (Object.values(activeSupports ?? {}).every( 15089 (isActive) => !isActive 15090 )) { 15091 return result; 15092 } 15093 if (results.length === 1 && result.innerBlocks.length === source.length) { 15094 return result; 15095 } 15096 let referenceBlockAttributes = source[0]?.attributes; 15097 if (results.length > 1 && source.length > 1) { 15098 if (source[index]) { 15099 referenceBlockAttributes = source[index]?.attributes; 15100 } else { 15101 return result; 15102 } 15103 } 15104 let returnBlock = result; 15105 Object.entries(activeSupports).forEach(([support, isActive]) => { 15106 if (isActive) { 15107 migrationPaths[support].forEach((path) => { 15108 const styleValue = getValueFromObjectPath( 15109 referenceBlockAttributes, 15110 path 15111 ); 15112 if (styleValue) { 15113 returnBlock = { 15114 ...returnBlock, 15115 attributes: setImmutably( 15116 returnBlock.attributes, 15117 path, 15118 styleValue 15119 ) 15120 }; 15121 } 15122 }); 15123 } 15124 }); 15125 return returnBlock; 15126 } 15127 function shouldSkipSerialization(blockNameOrType, featureSet, feature) { 15128 const support = (0,external_wp_blocks_namespaceObject.getBlockSupport)(blockNameOrType, featureSet); 15129 const skipSerialization = support?.__experimentalSkipSerialization; 15130 if (Array.isArray(skipSerialization)) { 15131 return skipSerialization.includes(feature); 15132 } 15133 return skipSerialization; 15134 } 15135 const pendingStyleOverrides = /* @__PURE__ */ new WeakMap(); 15136 function useStyleOverride({ id, css }) { 15137 return usePrivateStyleOverride({ id, css }); 15138 } 15139 function usePrivateStyleOverride({ 15140 id, 15141 css, 15142 assets, 15143 __unstableType, 15144 variation, 15145 clientId 15146 } = {}) { 15147 const { setStyleOverride, deleteStyleOverride } = unlock( 15148 (0,external_wp_data_namespaceObject.useDispatch)(store) 15149 ); 15150 const registry = (0,external_wp_data_namespaceObject.useRegistry)(); 15151 const fallbackId = (0,external_wp_element_namespaceObject.useId)(); 15152 (0,external_wp_element_namespaceObject.useEffect)(() => { 15153 if (!css && !assets) { 15154 return; 15155 } 15156 const _id = id || fallbackId; 15157 const override = { 15158 id, 15159 css, 15160 assets, 15161 __unstableType, 15162 variation, 15163 clientId 15164 }; 15165 if (!pendingStyleOverrides.get(registry)) { 15166 pendingStyleOverrides.set(registry, []); 15167 } 15168 pendingStyleOverrides.get(registry).push([_id, override]); 15169 window.queueMicrotask(() => { 15170 if (pendingStyleOverrides.get(registry)?.length) { 15171 registry.batch(() => { 15172 pendingStyleOverrides.get(registry).forEach((args) => { 15173 setStyleOverride(...args); 15174 }); 15175 pendingStyleOverrides.set(registry, []); 15176 }); 15177 } 15178 }); 15179 return () => { 15180 const isPending = pendingStyleOverrides.get(registry)?.find(([currentId]) => currentId === _id); 15181 if (isPending) { 15182 pendingStyleOverrides.set( 15183 registry, 15184 pendingStyleOverrides.get(registry).filter(([currentId]) => currentId !== _id) 15185 ); 15186 } else { 15187 deleteStyleOverride(_id); 15188 } 15189 }; 15190 }, [ 15191 id, 15192 css, 15193 clientId, 15194 assets, 15195 __unstableType, 15196 fallbackId, 15197 setStyleOverride, 15198 deleteStyleOverride, 15199 registry 15200 ]); 15201 } 15202 function useBlockSettings(name, parentLayout) { 15203 const [ 15204 backgroundImage, 15205 backgroundSize, 15206 customFontFamilies, 15207 defaultFontFamilies, 15208 themeFontFamilies, 15209 defaultFontSizesEnabled, 15210 customFontSizes, 15211 defaultFontSizes, 15212 themeFontSizes, 15213 customFontSize, 15214 fontStyle, 15215 fontWeight, 15216 lineHeight, 15217 textAlign, 15218 textColumns, 15219 textDecoration, 15220 writingMode, 15221 textTransform, 15222 letterSpacing, 15223 padding, 15224 margin, 15225 blockGap, 15226 defaultSpacingSizesEnabled, 15227 customSpacingSize, 15228 userSpacingSizes, 15229 defaultSpacingSizes, 15230 themeSpacingSizes, 15231 units, 15232 aspectRatio, 15233 minHeight, 15234 layout, 15235 borderColor, 15236 borderRadius, 15237 borderStyle, 15238 borderWidth, 15239 borderRadiusSizes, 15240 customColorsEnabled, 15241 customColors, 15242 customDuotone, 15243 themeColors, 15244 defaultColors, 15245 defaultPalette, 15246 defaultDuotone, 15247 userDuotonePalette, 15248 themeDuotonePalette, 15249 defaultDuotonePalette, 15250 userGradientPalette, 15251 themeGradientPalette, 15252 defaultGradientPalette, 15253 defaultGradients, 15254 areCustomGradientsEnabled, 15255 isBackgroundEnabled, 15256 isLinkEnabled, 15257 isTextEnabled, 15258 isHeadingEnabled, 15259 isButtonEnabled, 15260 shadow 15261 ] = use_settings_useSettings( 15262 "background.backgroundImage", 15263 "background.backgroundSize", 15264 "typography.fontFamilies.custom", 15265 "typography.fontFamilies.default", 15266 "typography.fontFamilies.theme", 15267 "typography.defaultFontSizes", 15268 "typography.fontSizes.custom", 15269 "typography.fontSizes.default", 15270 "typography.fontSizes.theme", 15271 "typography.customFontSize", 15272 "typography.fontStyle", 15273 "typography.fontWeight", 15274 "typography.lineHeight", 15275 "typography.textAlign", 15276 "typography.textColumns", 15277 "typography.textDecoration", 15278 "typography.writingMode", 15279 "typography.textTransform", 15280 "typography.letterSpacing", 15281 "spacing.padding", 15282 "spacing.margin", 15283 "spacing.blockGap", 15284 "spacing.defaultSpacingSizes", 15285 "spacing.customSpacingSize", 15286 "spacing.spacingSizes.custom", 15287 "spacing.spacingSizes.default", 15288 "spacing.spacingSizes.theme", 15289 "spacing.units", 15290 "dimensions.aspectRatio", 15291 "dimensions.minHeight", 15292 "layout", 15293 "border.color", 15294 "border.radius", 15295 "border.style", 15296 "border.width", 15297 "border.radiusSizes", 15298 "color.custom", 15299 "color.palette.custom", 15300 "color.customDuotone", 15301 "color.palette.theme", 15302 "color.palette.default", 15303 "color.defaultPalette", 15304 "color.defaultDuotone", 15305 "color.duotone.custom", 15306 "color.duotone.theme", 15307 "color.duotone.default", 15308 "color.gradients.custom", 15309 "color.gradients.theme", 15310 "color.gradients.default", 15311 "color.defaultGradients", 15312 "color.customGradient", 15313 "color.background", 15314 "color.link", 15315 "color.text", 15316 "color.heading", 15317 "color.button", 15318 "shadow" 15319 ); 15320 const rawSettings = (0,external_wp_element_namespaceObject.useMemo)(() => { 15321 return { 15322 background: { 15323 backgroundImage, 15324 backgroundSize 15325 }, 15326 color: { 15327 palette: { 15328 custom: customColors, 15329 theme: themeColors, 15330 default: defaultColors 15331 }, 15332 gradients: { 15333 custom: userGradientPalette, 15334 theme: themeGradientPalette, 15335 default: defaultGradientPalette 15336 }, 15337 duotone: { 15338 custom: userDuotonePalette, 15339 theme: themeDuotonePalette, 15340 default: defaultDuotonePalette 15341 }, 15342 defaultGradients, 15343 defaultPalette, 15344 defaultDuotone, 15345 custom: customColorsEnabled, 15346 customGradient: areCustomGradientsEnabled, 15347 customDuotone, 15348 background: isBackgroundEnabled, 15349 link: isLinkEnabled, 15350 heading: isHeadingEnabled, 15351 button: isButtonEnabled, 15352 text: isTextEnabled 15353 }, 15354 typography: { 15355 fontFamilies: { 15356 custom: customFontFamilies, 15357 default: defaultFontFamilies, 15358 theme: themeFontFamilies 15359 }, 15360 fontSizes: { 15361 custom: customFontSizes, 15362 default: defaultFontSizes, 15363 theme: themeFontSizes 15364 }, 15365 customFontSize, 15366 defaultFontSizes: defaultFontSizesEnabled, 15367 fontStyle, 15368 fontWeight, 15369 lineHeight, 15370 textAlign, 15371 textColumns, 15372 textDecoration, 15373 textTransform, 15374 letterSpacing, 15375 writingMode 15376 }, 15377 spacing: { 15378 spacingSizes: { 15379 custom: userSpacingSizes, 15380 default: defaultSpacingSizes, 15381 theme: themeSpacingSizes 15382 }, 15383 customSpacingSize, 15384 defaultSpacingSizes: defaultSpacingSizesEnabled, 15385 padding, 15386 margin, 15387 blockGap, 15388 units 15389 }, 15390 border: { 15391 color: borderColor, 15392 radius: borderRadius, 15393 style: borderStyle, 15394 width: borderWidth, 15395 radiusSizes: borderRadiusSizes 15396 }, 15397 dimensions: { 15398 aspectRatio, 15399 minHeight 15400 }, 15401 layout, 15402 parentLayout, 15403 shadow 15404 }; 15405 }, [ 15406 backgroundImage, 15407 backgroundSize, 15408 customFontFamilies, 15409 defaultFontFamilies, 15410 themeFontFamilies, 15411 defaultFontSizesEnabled, 15412 customFontSizes, 15413 defaultFontSizes, 15414 themeFontSizes, 15415 customFontSize, 15416 fontStyle, 15417 fontWeight, 15418 lineHeight, 15419 textAlign, 15420 textColumns, 15421 textDecoration, 15422 textTransform, 15423 letterSpacing, 15424 writingMode, 15425 padding, 15426 margin, 15427 blockGap, 15428 defaultSpacingSizesEnabled, 15429 customSpacingSize, 15430 userSpacingSizes, 15431 defaultSpacingSizes, 15432 themeSpacingSizes, 15433 units, 15434 aspectRatio, 15435 minHeight, 15436 layout, 15437 parentLayout, 15438 borderColor, 15439 borderRadius, 15440 borderStyle, 15441 borderWidth, 15442 borderRadiusSizes, 15443 customColorsEnabled, 15444 customColors, 15445 customDuotone, 15446 themeColors, 15447 defaultColors, 15448 defaultPalette, 15449 defaultDuotone, 15450 userDuotonePalette, 15451 themeDuotonePalette, 15452 defaultDuotonePalette, 15453 userGradientPalette, 15454 themeGradientPalette, 15455 defaultGradientPalette, 15456 defaultGradients, 15457 areCustomGradientsEnabled, 15458 isBackgroundEnabled, 15459 isLinkEnabled, 15460 isTextEnabled, 15461 isHeadingEnabled, 15462 isButtonEnabled, 15463 shadow 15464 ]); 15465 return useSettingsForBlockElement(rawSettings, name); 15466 } 15467 function createBlockEditFilter(features) { 15468 features = features.map((settings) => { 15469 return { ...settings, Edit: (0,external_wp_element_namespaceObject.memo)(settings.edit) }; 15470 }); 15471 const withBlockEditHooks = (0,external_wp_compose_namespaceObject.createHigherOrderComponent)( 15472 (OriginalBlockEdit) => (props) => { 15473 const context = useBlockEditContext(); 15474 return [ 15475 ...features.map((feature, i) => { 15476 const { 15477 Edit, 15478 hasSupport, 15479 attributeKeys = [], 15480 shareWithChildBlocks 15481 } = feature; 15482 const shouldDisplayControls = context[mayDisplayControlsKey] || context[mayDisplayParentControlsKey] && shareWithChildBlocks; 15483 if (!shouldDisplayControls || !hasSupport(props.name)) { 15484 return null; 15485 } 15486 const neededProps = {}; 15487 for (const key of attributeKeys) { 15488 if (props.attributes[key]) { 15489 neededProps[key] = props.attributes[key]; 15490 } 15491 } 15492 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 15493 Edit, 15494 { 15495 name: props.name, 15496 isSelected: props.isSelected, 15497 clientId: props.clientId, 15498 setAttributes: props.setAttributes, 15499 __unstableParentLayout: props.__unstableParentLayout, 15500 ...neededProps 15501 }, 15502 i 15503 ); 15504 }), 15505 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(OriginalBlockEdit, { ...props }, "edit") 15506 ]; 15507 }, 15508 "withBlockEditHooks" 15509 ); 15510 (0,external_wp_hooks_namespaceObject.addFilter)("editor.BlockEdit", "core/editor/hooks", withBlockEditHooks); 15511 } 15512 function BlockProps({ 15513 index, 15514 useBlockProps: hook, 15515 setAllWrapperProps, 15516 ...props 15517 }) { 15518 const wrapperProps = hook(props); 15519 const setWrapperProps = (next) => setAllWrapperProps((prev) => { 15520 const nextAll = [...prev]; 15521 nextAll[index] = next; 15522 return nextAll; 15523 }); 15524 (0,external_wp_element_namespaceObject.useEffect)(() => { 15525 setWrapperProps(wrapperProps); 15526 return () => { 15527 setWrapperProps(void 0); 15528 }; 15529 }); 15530 return null; 15531 } 15532 const BlockPropsPure = (0,external_wp_element_namespaceObject.memo)(BlockProps); 15533 function createBlockListBlockFilter(features) { 15534 const withBlockListBlockHooks = (0,external_wp_compose_namespaceObject.createHigherOrderComponent)( 15535 (BlockListBlock) => (props) => { 15536 const [allWrapperProps, setAllWrapperProps] = (0,external_wp_element_namespaceObject.useState)( 15537 Array(features.length).fill(void 0) 15538 ); 15539 return [ 15540 ...features.map((feature, i) => { 15541 const { 15542 hasSupport, 15543 attributeKeys = [], 15544 useBlockProps, 15545 isMatch 15546 } = feature; 15547 const neededProps = {}; 15548 for (const key of attributeKeys) { 15549 if (props.attributes[key]) { 15550 neededProps[key] = props.attributes[key]; 15551 } 15552 } 15553 if ( 15554 // Skip rendering if none of the needed attributes are 15555 // set. 15556 !Object.keys(neededProps).length || !hasSupport(props.name) || isMatch && !isMatch(neededProps) 15557 ) { 15558 return null; 15559 } 15560 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 15561 BlockPropsPure, 15562 { 15563 index: i, 15564 useBlockProps, 15565 setAllWrapperProps, 15566 name: props.name, 15567 clientId: props.clientId, 15568 ...neededProps 15569 }, 15570 i 15571 ); 15572 }), 15573 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 15574 BlockListBlock, 15575 { 15576 ...props, 15577 wrapperProps: allWrapperProps.filter(Boolean).reduce((acc, wrapperProps) => { 15578 return { 15579 ...acc, 15580 ...wrapperProps, 15581 className: dist_clsx( 15582 acc.className, 15583 wrapperProps.className 15584 ), 15585 style: { 15586 ...acc.style, 15587 ...wrapperProps.style 15588 } 15589 }; 15590 }, props.wrapperProps || {}) 15591 }, 15592 "edit" 15593 ) 15594 ]; 15595 }, 15596 "withBlockListBlockHooks" 15597 ); 15598 (0,external_wp_hooks_namespaceObject.addFilter)( 15599 "editor.BlockListBlock", 15600 "core/editor/hooks", 15601 withBlockListBlockHooks 15602 ); 15603 } 15604 function createBlockSaveFilter(features) { 15605 function extraPropsFromHooks(props, name, attributes) { 15606 return features.reduce((accu, feature) => { 15607 const { hasSupport, attributeKeys = [], addSaveProps } = feature; 15608 const neededAttributes = {}; 15609 for (const key of attributeKeys) { 15610 if (attributes[key]) { 15611 neededAttributes[key] = attributes[key]; 15612 } 15613 } 15614 if ( 15615 // Skip rendering if none of the needed attributes are 15616 // set. 15617 !Object.keys(neededAttributes).length || !hasSupport(name) 15618 ) { 15619 return accu; 15620 } 15621 return addSaveProps(accu, name, neededAttributes); 15622 }, props); 15623 } 15624 (0,external_wp_hooks_namespaceObject.addFilter)( 15625 "blocks.getSaveContent.extraProps", 15626 "core/editor/hooks", 15627 extraPropsFromHooks, 15628 0 15629 ); 15630 (0,external_wp_hooks_namespaceObject.addFilter)( 15631 "blocks.getSaveContent.extraProps", 15632 "core/editor/hooks", 15633 (props) => { 15634 if (props.hasOwnProperty("className") && !props.className) { 15635 delete props.className; 15636 } 15637 return props; 15638 } 15639 ); 15640 } 15641 15642 15643 ;// ./node_modules/@wordpress/block-editor/build-module/hooks/compat.js 15644 15645 15646 function migrateLightBlockWrapper(settings) { 15647 const { apiVersion = 1 } = settings; 15648 if (apiVersion < 2 && (0,external_wp_blocks_namespaceObject.hasBlockSupport)(settings, "lightBlockWrapper", false)) { 15649 settings.apiVersion = 2; 15650 } 15651 return settings; 15652 } 15653 (0,external_wp_hooks_namespaceObject.addFilter)( 15654 "blocks.registerBlockType", 15655 "core/compat/migrateLightBlockWrapper", 15656 migrateLightBlockWrapper 15657 ); 15658 15659 ;// external ["wp","components"] 15660 const external_wp_components_namespaceObject = window["wp"]["components"]; 15661 ;// ./node_modules/@wordpress/block-editor/build-module/components/block-controls/groups.js 15662 15663 const BlockControlsDefault = (0,external_wp_components_namespaceObject.createSlotFill)("BlockControls"); 15664 const BlockControlsBlock = (0,external_wp_components_namespaceObject.createSlotFill)("BlockControlsBlock"); 15665 const BlockControlsInline = (0,external_wp_components_namespaceObject.createSlotFill)("BlockFormatControls"); 15666 const BlockControlsOther = (0,external_wp_components_namespaceObject.createSlotFill)("BlockControlsOther"); 15667 const BlockControlsParent = (0,external_wp_components_namespaceObject.createSlotFill)("BlockControlsParent"); 15668 const groups = { 15669 default: BlockControlsDefault, 15670 block: BlockControlsBlock, 15671 inline: BlockControlsInline, 15672 other: BlockControlsOther, 15673 parent: BlockControlsParent 15674 }; 15675 var groups_default = groups; 15676 15677 15678 ;// ./node_modules/@wordpress/block-editor/build-module/components/block-controls/hook.js 15679 15680 15681 function useBlockControlsFill(group, shareWithChildBlocks) { 15682 const context = useBlockEditContext(); 15683 if (context[mayDisplayControlsKey]) { 15684 return groups_default[group]?.Fill; 15685 } 15686 if (context[mayDisplayParentControlsKey] && shareWithChildBlocks) { 15687 return groups_default.parent.Fill; 15688 } 15689 return null; 15690 } 15691 15692 15693 ;// ./node_modules/@wordpress/block-editor/build-module/components/block-controls/fill.js 15694 15695 15696 15697 function BlockControlsFill({ 15698 group = "default", 15699 controls, 15700 children, 15701 __experimentalShareWithChildBlocks = false 15702 }) { 15703 const Fill = useBlockControlsFill( 15704 group, 15705 __experimentalShareWithChildBlocks 15706 ); 15707 if (!Fill) { 15708 return null; 15709 } 15710 const innerMarkup = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 15711 group === "default" && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarGroup, { controls }), 15712 children 15713 ] }); 15714 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalStyleProvider, { document, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Fill, { children: (fillProps) => { 15715 const { forwardedContext = [] } = fillProps; 15716 return forwardedContext.reduce( 15717 (inner, [Provider, props]) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Provider, { ...props, children: inner }), 15718 innerMarkup 15719 ); 15720 } }) }); 15721 } 15722 15723 15724 ;// external ["wp","warning"] 15725 const external_wp_warning_namespaceObject = window["wp"]["warning"]; 15726 var external_wp_warning_default = /*#__PURE__*/__webpack_require__.n(external_wp_warning_namespaceObject); 15727 ;// ./node_modules/@wordpress/block-editor/build-module/components/block-controls/slot.js 15728 15729 15730 15731 15732 15733 15734 const { ComponentsContext } = unlock(external_wp_components_namespaceObject.privateApis); 15735 function BlockControlsSlot({ group = "default", ...props }) { 15736 const toolbarState = (0,external_wp_element_namespaceObject.useContext)(external_wp_components_namespaceObject.__experimentalToolbarContext); 15737 const contextState = (0,external_wp_element_namespaceObject.useContext)(ComponentsContext); 15738 const fillProps = (0,external_wp_element_namespaceObject.useMemo)( 15739 () => ({ 15740 forwardedContext: [ 15741 [external_wp_components_namespaceObject.__experimentalToolbarContext.Provider, { value: toolbarState }], 15742 [ComponentsContext.Provider, { value: contextState }] 15743 ] 15744 }), 15745 [toolbarState, contextState] 15746 ); 15747 const slotFill = groups_default[group]; 15748 const fills = (0,external_wp_components_namespaceObject.__experimentalUseSlotFills)(slotFill.name); 15749 if (!slotFill) { 15750 external_wp_warning_default()(`Unknown BlockControls group "$group}" provided.`); 15751 return null; 15752 } 15753 if (!fills?.length) { 15754 return null; 15755 } 15756 const { Slot } = slotFill; 15757 const slot = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Slot, { ...props, bubblesVirtually: true, fillProps }); 15758 if (group === "default") { 15759 return slot; 15760 } 15761 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarGroup, { children: slot }); 15762 } 15763 15764 15765 ;// ./node_modules/@wordpress/block-editor/build-module/components/block-controls/index.js 15766 15767 15768 15769 const BlockControls = BlockControlsFill; 15770 BlockControls.Slot = BlockControlsSlot; 15771 const BlockFormatControls = (props) => { 15772 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockControlsFill, { group: "inline", ...props }); 15773 }; 15774 BlockFormatControls.Slot = (props) => { 15775 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockControlsSlot, { group: "inline", ...props }); 15776 }; 15777 var block_controls_default = BlockControls; 15778 15779 15780 ;// ./node_modules/@wordpress/icons/build-module/library/justify-left.js 15781 15782 15783 var justify_left_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M9 9v6h11V9H9zM4 20h1.5V4H4v16z" }) }); 15784 15785 15786 ;// ./node_modules/@wordpress/icons/build-module/library/justify-center.js 15787 15788 15789 var justify_center_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M12.5 15v5H11v-5H4V9h7V4h1.5v5h7v6h-7Z" }) }); 15790 15791 15792 ;// ./node_modules/@wordpress/icons/build-module/library/justify-right.js 15793 15794 15795 var justify_right_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M4 15h11V9H4v6zM18.5 4v16H20V4h-1.5z" }) }); 15796 15797 15798 ;// ./node_modules/@wordpress/icons/build-module/library/justify-space-between.js 15799 15800 15801 var justify_space_between_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M9 15h6V9H9v6zm-5 5h1.5V4H4v16zM18.5 4v16H20V4h-1.5z" }) }); 15802 15803 15804 ;// ./node_modules/@wordpress/icons/build-module/library/justify-stretch.js 15805 15806 15807 var justify_stretch_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M4 4H5.5V20H4V4ZM7 10L17 10V14L7 14V10ZM20 4H18.5V20H20V4Z" }) }); 15808 15809 15810 ;// ./node_modules/@wordpress/icons/build-module/library/arrow-right.js 15811 15812 15813 var arrow_right_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "m14.5 6.5-1 1 3.7 3.7H4v1.6h13.2l-3.7 3.7 1 1 5.6-5.5z" }) }); 15814 15815 15816 ;// ./node_modules/@wordpress/icons/build-module/library/arrow-down.js 15817 15818 15819 var arrow_down_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 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" }) }); 15820 15821 15822 ;// ./node_modules/@wordpress/block-editor/build-module/layouts/definitions.js 15823 const LAYOUT_DEFINITIONS = { 15824 default: { 15825 name: "default", 15826 slug: "flow", 15827 className: "is-layout-flow", 15828 baseStyles: [ 15829 { 15830 selector: " > .alignleft", 15831 rules: { 15832 float: "left", 15833 "margin-inline-start": "0", 15834 "margin-inline-end": "2em" 15835 } 15836 }, 15837 { 15838 selector: " > .alignright", 15839 rules: { 15840 float: "right", 15841 "margin-inline-start": "2em", 15842 "margin-inline-end": "0" 15843 } 15844 }, 15845 { 15846 selector: " > .aligncenter", 15847 rules: { 15848 "margin-left": "auto !important", 15849 "margin-right": "auto !important" 15850 } 15851 } 15852 ], 15853 spacingStyles: [ 15854 { 15855 selector: " > :first-child", 15856 rules: { 15857 "margin-block-start": "0" 15858 } 15859 }, 15860 { 15861 selector: " > :last-child", 15862 rules: { 15863 "margin-block-end": "0" 15864 } 15865 }, 15866 { 15867 selector: " > *", 15868 rules: { 15869 "margin-block-start": null, 15870 "margin-block-end": "0" 15871 } 15872 } 15873 ] 15874 }, 15875 constrained: { 15876 name: "constrained", 15877 slug: "constrained", 15878 className: "is-layout-constrained", 15879 baseStyles: [ 15880 { 15881 selector: " > .alignleft", 15882 rules: { 15883 float: "left", 15884 "margin-inline-start": "0", 15885 "margin-inline-end": "2em" 15886 } 15887 }, 15888 { 15889 selector: " > .alignright", 15890 rules: { 15891 float: "right", 15892 "margin-inline-start": "2em", 15893 "margin-inline-end": "0" 15894 } 15895 }, 15896 { 15897 selector: " > .aligncenter", 15898 rules: { 15899 "margin-left": "auto !important", 15900 "margin-right": "auto !important" 15901 } 15902 }, 15903 { 15904 selector: " > :where(:not(.alignleft):not(.alignright):not(.alignfull))", 15905 rules: { 15906 "max-width": "var(--wp--style--global--content-size)", 15907 "margin-left": "auto !important", 15908 "margin-right": "auto !important" 15909 } 15910 }, 15911 { 15912 selector: " > .alignwide", 15913 rules: { 15914 "max-width": "var(--wp--style--global--wide-size)" 15915 } 15916 } 15917 ], 15918 spacingStyles: [ 15919 { 15920 selector: " > :first-child", 15921 rules: { 15922 "margin-block-start": "0" 15923 } 15924 }, 15925 { 15926 selector: " > :last-child", 15927 rules: { 15928 "margin-block-end": "0" 15929 } 15930 }, 15931 { 15932 selector: " > *", 15933 rules: { 15934 "margin-block-start": null, 15935 "margin-block-end": "0" 15936 } 15937 } 15938 ] 15939 }, 15940 flex: { 15941 name: "flex", 15942 slug: "flex", 15943 className: "is-layout-flex", 15944 displayMode: "flex", 15945 baseStyles: [ 15946 { 15947 selector: "", 15948 rules: { 15949 "flex-wrap": "wrap", 15950 "align-items": "center" 15951 } 15952 }, 15953 { 15954 selector: " > :is(*, div)", 15955 // :is(*, div) instead of just * increases the specificity by 001. 15956 rules: { 15957 margin: "0" 15958 } 15959 } 15960 ], 15961 spacingStyles: [ 15962 { 15963 selector: "", 15964 rules: { 15965 gap: null 15966 } 15967 } 15968 ] 15969 }, 15970 grid: { 15971 name: "grid", 15972 slug: "grid", 15973 className: "is-layout-grid", 15974 displayMode: "grid", 15975 baseStyles: [ 15976 { 15977 selector: " > :is(*, div)", 15978 // :is(*, div) instead of just * increases the specificity by 001. 15979 rules: { 15980 margin: "0" 15981 } 15982 } 15983 ], 15984 spacingStyles: [ 15985 { 15986 selector: "", 15987 rules: { 15988 gap: null 15989 } 15990 } 15991 ] 15992 } 15993 }; 15994 15995 15996 ;// ./node_modules/@wordpress/block-editor/build-module/layouts/utils.js 15997 15998 15999 function appendSelectors(selectors, append = "") { 16000 return selectors.split(",").map( 16001 (subselector) => `$subselector}$append ? ` $append}` : ""}` 16002 ).join(","); 16003 } 16004 function getBlockGapCSS(selector, layoutDefinitions = LAYOUT_DEFINITIONS, layoutType, blockGapValue) { 16005 let output = ""; 16006 if (layoutDefinitions?.[layoutType]?.spacingStyles?.length && blockGapValue) { 16007 layoutDefinitions[layoutType].spacingStyles.forEach((gapStyle) => { 16008 output += `$appendSelectors( 16009 selector, 16010 gapStyle.selector.trim() 16011 )} { `; 16012 output += Object.entries(gapStyle.rules).map( 16013 ([cssProperty, value]) => `$cssProperty}: $value ? value : blockGapValue}` 16014 ).join("; "); 16015 output += "; }"; 16016 }); 16017 } 16018 return output; 16019 } 16020 function getAlignmentsInfo(layout) { 16021 const { contentSize, wideSize, type = "default" } = layout; 16022 const alignmentInfo = {}; 16023 const sizeRegex = /^(?!0)\d+(px|em|rem|vw|vh|%|svw|lvw|dvw|svh|lvh|dvh|vi|svi|lvi|dvi|vb|svb|lvb|dvb|vmin|svmin|lvmin|dvmin|vmax|svmax|lvmax|dvmax)?$/i; 16024 if (sizeRegex.test(contentSize) && type === "constrained") { 16025 alignmentInfo.none = (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)("Max %s wide"), contentSize); 16026 } 16027 if (sizeRegex.test(wideSize)) { 16028 alignmentInfo.wide = (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)("Max %s wide"), wideSize); 16029 } 16030 return alignmentInfo; 16031 } 16032 16033 16034 ;// ./node_modules/@wordpress/icons/build-module/library/sides-all.js 16035 16036 16037 var sides_all_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "m7.5 6h9v-1.5h-9zm0 13.5h9v-1.5h-9zm-3-3h1.5v-9h-1.5zm13.5-9v9h1.5v-9z" }) }); 16038 16039 16040 ;// ./node_modules/@wordpress/icons/build-module/library/sides-horizontal.js 16041 16042 16043 var sides_horizontal_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: [ 16044 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 16045 external_wp_primitives_namespaceObject.Path, 16046 { 16047 d: "m7.5 6h9v-1.5h-9zm0 13.5h9v-1.5h-9zm-3-3h1.5v-9h-1.5zm13.5-9v9h1.5v-9z", 16048 style: { opacity: 0.25 } 16049 } 16050 ), 16051 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "m4.5 7.5v9h1.5v-9z" }), 16052 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "m18 7.5v9h1.5v-9z" }) 16053 ] }); 16054 16055 16056 ;// ./node_modules/@wordpress/icons/build-module/library/sides-vertical.js 16057 16058 16059 var sides_vertical_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: [ 16060 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 16061 external_wp_primitives_namespaceObject.Path, 16062 { 16063 d: "m7.5 6h9v-1.5h-9zm0 13.5h9v-1.5h-9zm-3-3h1.5v-9h-1.5zm13.5-9v9h1.5v-9z", 16064 style: { opacity: 0.25 } 16065 } 16066 ), 16067 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "m7.5 6h9v-1.5h-9z" }), 16068 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "m7.5 19.5h9v-1.5h-9z" }) 16069 ] }); 16070 16071 16072 ;// ./node_modules/@wordpress/icons/build-module/library/sides-top.js 16073 16074 16075 var sides_top_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: [ 16076 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 16077 external_wp_primitives_namespaceObject.Path, 16078 { 16079 d: "m7.5 6h9v-1.5h-9zm0 13.5h9v-1.5h-9zm-3-3h1.5v-9h-1.5zm13.5-9v9h1.5v-9z", 16080 style: { opacity: 0.25 } 16081 } 16082 ), 16083 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "m16.5 6h-9v-1.5h9z" }) 16084 ] }); 16085 16086 16087 ;// ./node_modules/@wordpress/icons/build-module/library/sides-right.js 16088 16089 16090 var sides_right_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: [ 16091 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 16092 external_wp_primitives_namespaceObject.Path, 16093 { 16094 d: "m7.5 6h9v-1.5h-9zm0 13.5h9v-1.5h-9zm-3-3h1.5v-9h-1.5zm13.5-9v9h1.5v-9z", 16095 style: { opacity: 0.25 } 16096 } 16097 ), 16098 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "m18 16.5v-9h1.5v9z" }) 16099 ] }); 16100 16101 16102 ;// ./node_modules/@wordpress/icons/build-module/library/sides-bottom.js 16103 16104 16105 var sides_bottom_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: [ 16106 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 16107 external_wp_primitives_namespaceObject.Path, 16108 { 16109 d: "m7.5 6h9v-1.5h-9zm0 13.5h9v-1.5h-9zm-3-3h1.5v-9h-1.5zm13.5-9v9h1.5v-9z", 16110 style: { opacity: 0.25 } 16111 } 16112 ), 16113 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "m16.5 19.5h-9v-1.5h9z" }) 16114 ] }); 16115 16116 16117 ;// ./node_modules/@wordpress/icons/build-module/library/sides-left.js 16118 16119 16120 var sides_left_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: [ 16121 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 16122 external_wp_primitives_namespaceObject.Path, 16123 { 16124 d: "m7.5 6h9v-1.5h-9zm0 13.5h9v-1.5h-9zm-3-3h1.5v-9h-1.5zm13.5-9v9h1.5v-9z", 16125 style: { opacity: 0.25 } 16126 } 16127 ), 16128 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "m4.5 16.5v-9h1.5v9z" }) 16129 ] }); 16130 16131 16132 ;// ./node_modules/@wordpress/block-editor/build-module/components/spacing-sizes-control/utils.js 16133 16134 16135 const RANGE_CONTROL_MAX_SIZE = 8; 16136 const ALL_SIDES = ["top", "right", "bottom", "left"]; 16137 const DEFAULT_VALUES = { 16138 top: void 0, 16139 right: void 0, 16140 bottom: void 0, 16141 left: void 0 16142 }; 16143 const ICONS = { 16144 custom: sides_all_default, 16145 axial: sides_all_default, 16146 horizontal: sides_horizontal_default, 16147 vertical: sides_vertical_default, 16148 top: sides_top_default, 16149 right: sides_right_default, 16150 bottom: sides_bottom_default, 16151 left: sides_left_default 16152 }; 16153 const LABELS = { 16154 default: (0,external_wp_i18n_namespaceObject.__)("Spacing control"), 16155 top: (0,external_wp_i18n_namespaceObject.__)("Top"), 16156 bottom: (0,external_wp_i18n_namespaceObject.__)("Bottom"), 16157 left: (0,external_wp_i18n_namespaceObject.__)("Left"), 16158 right: (0,external_wp_i18n_namespaceObject.__)("Right"), 16159 mixed: (0,external_wp_i18n_namespaceObject.__)("Mixed"), 16160 vertical: (0,external_wp_i18n_namespaceObject.__)("Vertical"), 16161 horizontal: (0,external_wp_i18n_namespaceObject.__)("Horizontal"), 16162 axial: (0,external_wp_i18n_namespaceObject.__)("Horizontal & vertical"), 16163 custom: (0,external_wp_i18n_namespaceObject.__)("Custom") 16164 }; 16165 const VIEWS = { 16166 axial: "axial", 16167 top: "top", 16168 right: "right", 16169 bottom: "bottom", 16170 left: "left", 16171 custom: "custom" 16172 }; 16173 function isValueSpacingPreset(value) { 16174 if (!value?.includes) { 16175 return false; 16176 } 16177 return value === "0" || value.includes("var:preset|spacing|"); 16178 } 16179 function getCustomValueFromPreset(value, spacingSizes) { 16180 if (!isValueSpacingPreset(value)) { 16181 return value; 16182 } 16183 const slug = getSpacingPresetSlug(value); 16184 const spacingSize = spacingSizes.find( 16185 (size) => String(size.slug) === slug 16186 ); 16187 return spacingSize?.size; 16188 } 16189 function getPresetValueFromCustomValue(value, spacingSizes) { 16190 if (!value || isValueSpacingPreset(value) || value === "0") { 16191 return value; 16192 } 16193 const spacingMatch = spacingSizes.find( 16194 (size) => String(size.size) === String(value) 16195 ); 16196 if (spacingMatch?.slug) { 16197 return `var:preset|spacing|$spacingMatch.slug}`; 16198 } 16199 return value; 16200 } 16201 function getSpacingPresetCssVar(value) { 16202 if (!value) { 16203 return; 16204 } 16205 const slug = value.match(/var:preset\|spacing\|(.+)/); 16206 if (!slug) { 16207 return value; 16208 } 16209 return `var(--wp--preset--spacing--$slug[1]})`; 16210 } 16211 function getSpacingPresetSlug(value) { 16212 if (!value) { 16213 return; 16214 } 16215 if (value === "0" || value === "default") { 16216 return value; 16217 } 16218 const slug = value.match(/var:preset\|spacing\|(.+)/); 16219 return slug ? slug[1] : void 0; 16220 } 16221 function getSliderValueFromPreset(presetValue, spacingSizes) { 16222 if (presetValue === void 0) { 16223 return 0; 16224 } 16225 const slug = parseFloat(presetValue, 10) === 0 ? "0" : getSpacingPresetSlug(presetValue); 16226 const sliderValue = spacingSizes.findIndex((spacingSize) => { 16227 return String(spacingSize.slug) === slug; 16228 }); 16229 return sliderValue !== -1 ? sliderValue : NaN; 16230 } 16231 function hasAxisSupport(sides, axis) { 16232 if (!sides || !sides.length) { 16233 return false; 16234 } 16235 const hasHorizontalSupport = sides.includes("horizontal") || sides.includes("left") && sides.includes("right"); 16236 const hasVerticalSupport = sides.includes("vertical") || sides.includes("top") && sides.includes("bottom"); 16237 if (axis === "horizontal") { 16238 return hasHorizontalSupport; 16239 } 16240 if (axis === "vertical") { 16241 return hasVerticalSupport; 16242 } 16243 return hasHorizontalSupport || hasVerticalSupport; 16244 } 16245 function hasBalancedSidesSupport(sides = []) { 16246 const counts = { top: 0, right: 0, bottom: 0, left: 0 }; 16247 sides.forEach((side) => counts[side] += 1); 16248 return (counts.top + counts.bottom) % 2 === 0 && (counts.left + counts.right) % 2 === 0; 16249 } 16250 function getInitialView(values = {}, sides) { 16251 const { top, right, bottom, left } = values; 16252 const sideValues = [top, right, bottom, left].filter(Boolean); 16253 const hasMatchingAxialValues = top === bottom && left === right && (!!top || !!left); 16254 const hasNoValuesAndBalancedSides = !sideValues.length && hasBalancedSidesSupport(sides); 16255 const hasOnlyAxialSides = sides?.includes("horizontal") && sides?.includes("vertical") && sides?.length === 2; 16256 if (hasAxisSupport(sides) && (hasMatchingAxialValues || hasNoValuesAndBalancedSides)) { 16257 return VIEWS.axial; 16258 } 16259 if (hasOnlyAxialSides && sideValues.length === 1) { 16260 let side; 16261 Object.entries(values).some(([key, value]) => { 16262 side = key; 16263 return value !== void 0; 16264 }); 16265 return side; 16266 } 16267 if (sides?.length === 1 && !sideValues.length) { 16268 return sides[0]; 16269 } 16270 return VIEWS.custom; 16271 } 16272 16273 16274 ;// ./node_modules/@wordpress/block-editor/build-module/hooks/gap.js 16275 16276 function getGapBoxControlValueFromStyle(blockGapValue) { 16277 if (!blockGapValue) { 16278 return null; 16279 } 16280 const isValueString = typeof blockGapValue === "string"; 16281 return { 16282 top: isValueString ? blockGapValue : blockGapValue?.top, 16283 left: isValueString ? blockGapValue : blockGapValue?.left 16284 }; 16285 } 16286 function getGapCSSValue(blockGapValue, defaultValue = "0") { 16287 const blockGapBoxControlValue = getGapBoxControlValueFromStyle(blockGapValue); 16288 if (!blockGapBoxControlValue) { 16289 return null; 16290 } 16291 const row = getSpacingPresetCssVar(blockGapBoxControlValue?.top) || defaultValue; 16292 const column = getSpacingPresetCssVar(blockGapBoxControlValue?.left) || defaultValue; 16293 return row === column ? row : `$row} $column}`; 16294 } 16295 16296 16297 ;// ./node_modules/@wordpress/icons/build-module/library/justify-top.js 16298 16299 16300 var justify_top_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M9 20h6V9H9v11zM4 4v1.5h16V4H4z" }) }); 16301 16302 16303 ;// ./node_modules/@wordpress/icons/build-module/library/justify-center-vertical.js 16304 16305 16306 var justify_center_vertical_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M20 11h-5V4H9v7H4v1.5h5V20h6v-7.5h5z" }) }); 16307 16308 16309 ;// ./node_modules/@wordpress/icons/build-module/library/justify-bottom.js 16310 16311 16312 var justify_bottom_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M15 4H9v11h6V4zM4 18.5V20h16v-1.5H4z" }) }); 16313 16314 16315 ;// ./node_modules/@wordpress/icons/build-module/library/justify-stretch-vertical.js 16316 16317 16318 var justify_stretch_vertical_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M4 4L20 4L20 5.5L4 5.5L4 4ZM10 7L14 7L14 17L10 17L10 7ZM20 18.5L4 18.5L4 20L20 20L20 18.5Z" }) }); 16319 16320 16321 ;// ./node_modules/@wordpress/icons/build-module/library/justify-space-between-vertical.js 16322 16323 16324 var justify_space_between_vertical_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M7 4H17V8L7 8V4ZM7 16L17 16V20L7 20V16ZM20 11.25H4V12.75H20V11.25Z" }) }); 16325 16326 16327 ;// ./node_modules/@wordpress/block-editor/build-module/components/block-vertical-alignment-control/ui.js 16328 16329 16330 16331 16332 const BLOCK_ALIGNMENTS_CONTROLS = { 16333 top: { 16334 icon: justify_top_default, 16335 title: (0,external_wp_i18n_namespaceObject._x)("Align top", "Block vertical alignment setting") 16336 }, 16337 center: { 16338 icon: justify_center_vertical_default, 16339 title: (0,external_wp_i18n_namespaceObject._x)("Align middle", "Block vertical alignment setting") 16340 }, 16341 bottom: { 16342 icon: justify_bottom_default, 16343 title: (0,external_wp_i18n_namespaceObject._x)("Align bottom", "Block vertical alignment setting") 16344 }, 16345 stretch: { 16346 icon: justify_stretch_vertical_default, 16347 title: (0,external_wp_i18n_namespaceObject._x)("Stretch to fill", "Block vertical alignment setting") 16348 }, 16349 "space-between": { 16350 icon: justify_space_between_vertical_default, 16351 title: (0,external_wp_i18n_namespaceObject._x)("Space between", "Block vertical alignment setting") 16352 } 16353 }; 16354 const DEFAULT_CONTROLS = ["top", "center", "bottom"]; 16355 const DEFAULT_CONTROL = "top"; 16356 function BlockVerticalAlignmentUI({ 16357 value, 16358 onChange, 16359 controls = DEFAULT_CONTROLS, 16360 isCollapsed = true, 16361 isToolbar 16362 }) { 16363 function applyOrUnset(align) { 16364 return () => onChange(value === align ? void 0 : align); 16365 } 16366 const activeAlignment = BLOCK_ALIGNMENTS_CONTROLS[value]; 16367 const defaultAlignmentControl = BLOCK_ALIGNMENTS_CONTROLS[DEFAULT_CONTROL]; 16368 const UIComponent = isToolbar ? external_wp_components_namespaceObject.ToolbarGroup : external_wp_components_namespaceObject.ToolbarDropdownMenu; 16369 const extraProps = isToolbar ? { isCollapsed } : {}; 16370 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 16371 UIComponent, 16372 { 16373 icon: activeAlignment ? activeAlignment.icon : defaultAlignmentControl.icon, 16374 label: (0,external_wp_i18n_namespaceObject._x)( 16375 "Change vertical alignment", 16376 "Block vertical alignment setting label" 16377 ), 16378 controls: controls.map((control) => { 16379 return { 16380 ...BLOCK_ALIGNMENTS_CONTROLS[control], 16381 isActive: value === control, 16382 role: isCollapsed ? "menuitemradio" : void 0, 16383 onClick: applyOrUnset(control) 16384 }; 16385 }), 16386 ...extraProps 16387 } 16388 ); 16389 } 16390 var ui_default = BlockVerticalAlignmentUI; 16391 16392 16393 ;// ./node_modules/@wordpress/block-editor/build-module/components/block-vertical-alignment-control/index.js 16394 16395 16396 const BlockVerticalAlignmentControl = (props) => { 16397 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ui_default, { ...props, isToolbar: false }); 16398 }; 16399 const BlockVerticalAlignmentToolbar = (props) => { 16400 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ui_default, { ...props, isToolbar: true }); 16401 }; 16402 16403 16404 ;// ./node_modules/@wordpress/block-editor/build-module/components/justify-content-control/ui.js 16405 16406 16407 16408 16409 const icons = { 16410 left: justify_left_default, 16411 center: justify_center_default, 16412 right: justify_right_default, 16413 "space-between": justify_space_between_default, 16414 stretch: justify_stretch_default 16415 }; 16416 function JustifyContentUI({ 16417 allowedControls = ["left", "center", "right", "space-between"], 16418 isCollapsed = true, 16419 onChange, 16420 value, 16421 popoverProps, 16422 isToolbar 16423 }) { 16424 const handleClick = (next) => { 16425 if (next === value) { 16426 onChange(void 0); 16427 } else { 16428 onChange(next); 16429 } 16430 }; 16431 const icon = value ? icons[value] : icons.left; 16432 const allControls = [ 16433 { 16434 name: "left", 16435 icon: justify_left_default, 16436 title: (0,external_wp_i18n_namespaceObject.__)("Justify items left"), 16437 isActive: "left" === value, 16438 onClick: () => handleClick("left") 16439 }, 16440 { 16441 name: "center", 16442 icon: justify_center_default, 16443 title: (0,external_wp_i18n_namespaceObject.__)("Justify items center"), 16444 isActive: "center" === value, 16445 onClick: () => handleClick("center") 16446 }, 16447 { 16448 name: "right", 16449 icon: justify_right_default, 16450 title: (0,external_wp_i18n_namespaceObject.__)("Justify items right"), 16451 isActive: "right" === value, 16452 onClick: () => handleClick("right") 16453 }, 16454 { 16455 name: "space-between", 16456 icon: justify_space_between_default, 16457 title: (0,external_wp_i18n_namespaceObject.__)("Space between items"), 16458 isActive: "space-between" === value, 16459 onClick: () => handleClick("space-between") 16460 }, 16461 { 16462 name: "stretch", 16463 icon: justify_stretch_default, 16464 title: (0,external_wp_i18n_namespaceObject.__)("Stretch items"), 16465 isActive: "stretch" === value, 16466 onClick: () => handleClick("stretch") 16467 } 16468 ]; 16469 const UIComponent = isToolbar ? external_wp_components_namespaceObject.ToolbarGroup : external_wp_components_namespaceObject.ToolbarDropdownMenu; 16470 const extraProps = isToolbar ? { isCollapsed } : {}; 16471 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 16472 UIComponent, 16473 { 16474 icon, 16475 popoverProps, 16476 label: (0,external_wp_i18n_namespaceObject.__)("Change items justification"), 16477 controls: allControls.filter( 16478 (elem) => allowedControls.includes(elem.name) 16479 ), 16480 ...extraProps 16481 } 16482 ); 16483 } 16484 var ui_ui_default = JustifyContentUI; 16485 16486 16487 ;// ./node_modules/@wordpress/block-editor/build-module/components/justify-content-control/index.js 16488 16489 16490 const JustifyContentControl = (props) => { 16491 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ui_ui_default, { ...props, isToolbar: false }); 16492 }; 16493 const JustifyToolbar = (props) => { 16494 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ui_ui_default, { ...props, isToolbar: true }); 16495 }; 16496 16497 16498 ;// ./node_modules/@wordpress/block-editor/build-module/layouts/flex.js 16499 16500 16501 16502 16503 16504 16505 16506 16507 16508 const justifyContentMap = { 16509 left: "flex-start", 16510 right: "flex-end", 16511 center: "center", 16512 "space-between": "space-between" 16513 }; 16514 const alignItemsMap = { 16515 left: "flex-start", 16516 right: "flex-end", 16517 center: "center", 16518 stretch: "stretch" 16519 }; 16520 const verticalAlignmentMap = { 16521 top: "flex-start", 16522 center: "center", 16523 bottom: "flex-end", 16524 stretch: "stretch", 16525 "space-between": "space-between" 16526 }; 16527 const defaultAlignments = { 16528 horizontal: "center", 16529 vertical: "top" 16530 }; 16531 const flexWrapOptions = ["wrap", "nowrap"]; 16532 var flex_default = { 16533 name: "flex", 16534 label: (0,external_wp_i18n_namespaceObject.__)("Flex"), 16535 inspectorControls: function FlexLayoutInspectorControls({ 16536 layout = {}, 16537 onChange, 16538 layoutBlockSupport = {} 16539 }) { 16540 const { allowOrientation = true, allowJustification = true } = layoutBlockSupport; 16541 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 16542 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, { children: [ 16543 allowJustification && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 16544 FlexLayoutJustifyContentControl, 16545 { 16546 layout, 16547 onChange 16548 } 16549 ) }), 16550 allowOrientation && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 16551 OrientationControl, 16552 { 16553 layout, 16554 onChange 16555 } 16556 ) }) 16557 ] }), 16558 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(FlexWrapControl, { layout, onChange }) 16559 ] }); 16560 }, 16561 toolBarControls: function FlexLayoutToolbarControls({ 16562 layout = {}, 16563 onChange, 16564 layoutBlockSupport 16565 }) { 16566 const { allowVerticalAlignment = true, allowJustification = true } = layoutBlockSupport; 16567 if (!allowJustification && !allowVerticalAlignment) { 16568 return null; 16569 } 16570 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(block_controls_default, { group: "block", __experimentalShareWithChildBlocks: true, children: [ 16571 allowJustification && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 16572 FlexLayoutJustifyContentControl, 16573 { 16574 layout, 16575 onChange, 16576 isToolbar: true 16577 } 16578 ), 16579 allowVerticalAlignment && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 16580 FlexLayoutVerticalAlignmentControl, 16581 { 16582 layout, 16583 onChange 16584 } 16585 ) 16586 ] }); 16587 }, 16588 getLayoutStyle: function getLayoutStyle({ 16589 selector, 16590 layout, 16591 style, 16592 blockName, 16593 hasBlockGapSupport, 16594 layoutDefinitions = LAYOUT_DEFINITIONS 16595 }) { 16596 const { orientation = "horizontal" } = layout; 16597 const blockGapValue = style?.spacing?.blockGap && !shouldSkipSerialization(blockName, "spacing", "blockGap") ? getGapCSSValue(style?.spacing?.blockGap, "0.5em") : void 0; 16598 const justifyContent = justifyContentMap[layout.justifyContent]; 16599 const flexWrap = flexWrapOptions.includes(layout.flexWrap) ? layout.flexWrap : "wrap"; 16600 const verticalAlignment = verticalAlignmentMap[layout.verticalAlignment]; 16601 const alignItems = alignItemsMap[layout.justifyContent] || alignItemsMap.left; 16602 let output = ""; 16603 const rules = []; 16604 if (flexWrap && flexWrap !== "wrap") { 16605 rules.push(`flex-wrap: $flexWrap}`); 16606 } 16607 if (orientation === "horizontal") { 16608 if (verticalAlignment) { 16609 rules.push(`align-items: $verticalAlignment}`); 16610 } 16611 if (justifyContent) { 16612 rules.push(`justify-content: $justifyContent}`); 16613 } 16614 } else { 16615 if (verticalAlignment) { 16616 rules.push(`justify-content: $verticalAlignment}`); 16617 } 16618 rules.push("flex-direction: column"); 16619 rules.push(`align-items: $alignItems}`); 16620 } 16621 if (rules.length) { 16622 output = `$appendSelectors(selector)} { 16623 $rules.join("; ")}; 16624 }`; 16625 } 16626 if (hasBlockGapSupport && blockGapValue) { 16627 output += getBlockGapCSS( 16628 selector, 16629 layoutDefinitions, 16630 "flex", 16631 blockGapValue 16632 ); 16633 } 16634 return output; 16635 }, 16636 getOrientation(layout) { 16637 const { orientation = "horizontal" } = layout; 16638 return orientation; 16639 }, 16640 getAlignments() { 16641 return []; 16642 } 16643 }; 16644 function FlexLayoutVerticalAlignmentControl({ layout, onChange }) { 16645 const { orientation = "horizontal" } = layout; 16646 const defaultVerticalAlignment = orientation === "horizontal" ? defaultAlignments.horizontal : defaultAlignments.vertical; 16647 const { verticalAlignment = defaultVerticalAlignment } = layout; 16648 const onVerticalAlignmentChange = (value) => { 16649 onChange({ 16650 ...layout, 16651 verticalAlignment: value 16652 }); 16653 }; 16654 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 16655 BlockVerticalAlignmentControl, 16656 { 16657 onChange: onVerticalAlignmentChange, 16658 value: verticalAlignment, 16659 controls: orientation === "horizontal" ? ["top", "center", "bottom", "stretch"] : ["top", "center", "bottom", "space-between"] 16660 } 16661 ); 16662 } 16663 const POPOVER_PROPS = { 16664 placement: "bottom-start" 16665 }; 16666 function FlexLayoutJustifyContentControl({ 16667 layout, 16668 onChange, 16669 isToolbar = false 16670 }) { 16671 const { justifyContent = "left", orientation = "horizontal" } = layout; 16672 const onJustificationChange = (value) => { 16673 onChange({ 16674 ...layout, 16675 justifyContent: value 16676 }); 16677 }; 16678 const allowedControls = ["left", "center", "right"]; 16679 if (orientation === "horizontal") { 16680 allowedControls.push("space-between"); 16681 } else { 16682 allowedControls.push("stretch"); 16683 } 16684 if (isToolbar) { 16685 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 16686 JustifyContentControl, 16687 { 16688 allowedControls, 16689 value: justifyContent, 16690 onChange: onJustificationChange, 16691 popoverProps: POPOVER_PROPS 16692 } 16693 ); 16694 } 16695 const justificationOptions = [ 16696 { 16697 value: "left", 16698 icon: justify_left_default, 16699 label: (0,external_wp_i18n_namespaceObject.__)("Justify items left") 16700 }, 16701 { 16702 value: "center", 16703 icon: justify_center_default, 16704 label: (0,external_wp_i18n_namespaceObject.__)("Justify items center") 16705 }, 16706 { 16707 value: "right", 16708 icon: justify_right_default, 16709 label: (0,external_wp_i18n_namespaceObject.__)("Justify items right") 16710 } 16711 ]; 16712 if (orientation === "horizontal") { 16713 justificationOptions.push({ 16714 value: "space-between", 16715 icon: justify_space_between_default, 16716 label: (0,external_wp_i18n_namespaceObject.__)("Space between items") 16717 }); 16718 } else { 16719 justificationOptions.push({ 16720 value: "stretch", 16721 icon: justify_stretch_default, 16722 label: (0,external_wp_i18n_namespaceObject.__)("Stretch items") 16723 }); 16724 } 16725 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 16726 external_wp_components_namespaceObject.__experimentalToggleGroupControl, 16727 { 16728 __next40pxDefaultSize: true, 16729 __nextHasNoMarginBottom: true, 16730 label: (0,external_wp_i18n_namespaceObject.__)("Justification"), 16731 value: justifyContent, 16732 onChange: onJustificationChange, 16733 className: "block-editor-hooks__flex-layout-justification-controls", 16734 children: justificationOptions.map(({ value, icon, label }) => { 16735 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 16736 external_wp_components_namespaceObject.__experimentalToggleGroupControlOptionIcon, 16737 { 16738 value, 16739 icon, 16740 label 16741 }, 16742 value 16743 ); 16744 }) 16745 } 16746 ); 16747 } 16748 function FlexWrapControl({ layout, onChange }) { 16749 const { flexWrap = "wrap" } = layout; 16750 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 16751 external_wp_components_namespaceObject.ToggleControl, 16752 { 16753 __nextHasNoMarginBottom: true, 16754 label: (0,external_wp_i18n_namespaceObject.__)("Allow to wrap to multiple lines"), 16755 onChange: (value) => { 16756 onChange({ 16757 ...layout, 16758 flexWrap: value ? "wrap" : "nowrap" 16759 }); 16760 }, 16761 checked: flexWrap === "wrap" 16762 } 16763 ); 16764 } 16765 function OrientationControl({ layout, onChange }) { 16766 const { 16767 orientation = "horizontal", 16768 verticalAlignment, 16769 justifyContent 16770 } = layout; 16771 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 16772 external_wp_components_namespaceObject.__experimentalToggleGroupControl, 16773 { 16774 __next40pxDefaultSize: true, 16775 __nextHasNoMarginBottom: true, 16776 className: "block-editor-hooks__flex-layout-orientation-controls", 16777 label: (0,external_wp_i18n_namespaceObject.__)("Orientation"), 16778 value: orientation, 16779 onChange: (value) => { 16780 let newVerticalAlignment = verticalAlignment; 16781 let newJustification = justifyContent; 16782 if (value === "horizontal") { 16783 if (verticalAlignment === "space-between") { 16784 newVerticalAlignment = "center"; 16785 } 16786 if (justifyContent === "stretch") { 16787 newJustification = "left"; 16788 } 16789 } else { 16790 if (verticalAlignment === "stretch") { 16791 newVerticalAlignment = "top"; 16792 } 16793 if (justifyContent === "space-between") { 16794 newJustification = "left"; 16795 } 16796 } 16797 return onChange({ 16798 ...layout, 16799 orientation: value, 16800 verticalAlignment: newVerticalAlignment, 16801 justifyContent: newJustification 16802 }); 16803 }, 16804 children: [ 16805 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 16806 external_wp_components_namespaceObject.__experimentalToggleGroupControlOptionIcon, 16807 { 16808 icon: arrow_right_default, 16809 value: "horizontal", 16810 label: (0,external_wp_i18n_namespaceObject.__)("Horizontal") 16811 } 16812 ), 16813 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 16814 external_wp_components_namespaceObject.__experimentalToggleGroupControlOptionIcon, 16815 { 16816 icon: arrow_down_default, 16817 value: "vertical", 16818 label: (0,external_wp_i18n_namespaceObject.__)("Vertical") 16819 } 16820 ) 16821 ] 16822 } 16823 ); 16824 } 16825 16826 16827 ;// ./node_modules/@wordpress/block-editor/build-module/layouts/flow.js 16828 16829 16830 16831 16832 16833 var flow_default = { 16834 name: "default", 16835 label: (0,external_wp_i18n_namespaceObject.__)("Flow"), 16836 inspectorControls: function DefaultLayoutInspectorControls() { 16837 return null; 16838 }, 16839 toolBarControls: function DefaultLayoutToolbarControls() { 16840 return null; 16841 }, 16842 getLayoutStyle: function getLayoutStyle({ 16843 selector, 16844 style, 16845 blockName, 16846 hasBlockGapSupport, 16847 layoutDefinitions = LAYOUT_DEFINITIONS 16848 }) { 16849 const blockGapStyleValue = getGapCSSValue(style?.spacing?.blockGap); 16850 let blockGapValue = ""; 16851 if (!shouldSkipSerialization(blockName, "spacing", "blockGap")) { 16852 if (blockGapStyleValue?.top) { 16853 blockGapValue = getGapCSSValue(blockGapStyleValue?.top); 16854 } else if (typeof blockGapStyleValue === "string") { 16855 blockGapValue = getGapCSSValue(blockGapStyleValue); 16856 } 16857 } 16858 let output = ""; 16859 if (hasBlockGapSupport && blockGapValue) { 16860 output += getBlockGapCSS( 16861 selector, 16862 layoutDefinitions, 16863 "default", 16864 blockGapValue 16865 ); 16866 } 16867 return output; 16868 }, 16869 getOrientation() { 16870 return "vertical"; 16871 }, 16872 getAlignments(layout, isBlockBasedTheme) { 16873 const alignmentInfo = getAlignmentsInfo(layout); 16874 if (layout.alignments !== void 0) { 16875 if (!layout.alignments.includes("none")) { 16876 layout.alignments.unshift("none"); 16877 } 16878 return layout.alignments.map((alignment) => ({ 16879 name: alignment, 16880 info: alignmentInfo[alignment] 16881 })); 16882 } 16883 const alignments = [ 16884 { name: "left" }, 16885 { name: "center" }, 16886 { name: "right" } 16887 ]; 16888 if (!isBlockBasedTheme) { 16889 const { contentSize, wideSize } = layout; 16890 if (contentSize) { 16891 alignments.unshift({ name: "full" }); 16892 } 16893 if (wideSize) { 16894 alignments.unshift({ 16895 name: "wide", 16896 info: alignmentInfo.wide 16897 }); 16898 } 16899 } 16900 alignments.unshift({ name: "none", info: alignmentInfo.none }); 16901 return alignments; 16902 } 16903 }; 16904 16905 16906 ;// ./node_modules/@wordpress/icons/build-module/icon/index.js 16907 16908 var icon_default = (0,external_wp_element_namespaceObject.forwardRef)( 16909 ({ icon, size = 24, ...props }, ref) => { 16910 return (0,external_wp_element_namespaceObject.cloneElement)(icon, { 16911 width: size, 16912 height: size, 16913 ...props, 16914 ref 16915 }); 16916 } 16917 ); 16918 16919 16920 ;// ./node_modules/@wordpress/icons/build-module/library/align-none.js 16921 16922 16923 var align_none_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M19 5.5H5V4h14v1.5ZM19 20H5v-1.5h14V20ZM5 9h14v6H5V9Z" }) }); 16924 16925 16926 ;// ./node_modules/@wordpress/icons/build-module/library/stretch-wide.js 16927 16928 16929 var stretch_wide_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M16 5.5H8V4h8v1.5ZM16 20H8v-1.5h8V20ZM5 9h14v6H5V9Z" }) }); 16930 16931 16932 ;// ./node_modules/@wordpress/block-editor/build-module/layouts/constrained.js 16933 16934 16935 16936 16937 16938 16939 16940 16941 16942 16943 16944 var constrained_default = { 16945 name: "constrained", 16946 label: (0,external_wp_i18n_namespaceObject.__)("Constrained"), 16947 inspectorControls: function DefaultLayoutInspectorControls({ 16948 layout, 16949 onChange, 16950 layoutBlockSupport = {} 16951 }) { 16952 const { wideSize, contentSize, justifyContent = "center" } = layout; 16953 const { 16954 allowJustification = true, 16955 allowCustomContentAndWideSize = true 16956 } = layoutBlockSupport; 16957 const onJustificationChange = (value) => { 16958 onChange({ 16959 ...layout, 16960 justifyContent: value 16961 }); 16962 }; 16963 const justificationOptions = [ 16964 { 16965 value: "left", 16966 icon: justify_left_default, 16967 label: (0,external_wp_i18n_namespaceObject.__)("Justify items left") 16968 }, 16969 { 16970 value: "center", 16971 icon: justify_center_default, 16972 label: (0,external_wp_i18n_namespaceObject.__)("Justify items center") 16973 }, 16974 { 16975 value: "right", 16976 icon: justify_right_default, 16977 label: (0,external_wp_i18n_namespaceObject.__)("Justify items right") 16978 } 16979 ]; 16980 const [availableUnits] = use_settings_useSettings("spacing.units"); 16981 const units = (0,external_wp_components_namespaceObject.__experimentalUseCustomUnits)({ 16982 availableUnits: availableUnits || ["%", "px", "em", "rem", "vw"] 16983 }); 16984 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 16985 external_wp_components_namespaceObject.__experimentalVStack, 16986 { 16987 spacing: 4, 16988 className: "block-editor-hooks__layout-constrained", 16989 children: [ 16990 allowCustomContentAndWideSize && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 16991 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 16992 external_wp_components_namespaceObject.__experimentalUnitControl, 16993 { 16994 __next40pxDefaultSize: true, 16995 label: (0,external_wp_i18n_namespaceObject.__)("Content width"), 16996 labelPosition: "top", 16997 value: contentSize || wideSize || "", 16998 onChange: (nextWidth) => { 16999 nextWidth = 0 > parseFloat(nextWidth) ? "0" : nextWidth; 17000 onChange({ 17001 ...layout, 17002 contentSize: nextWidth 17003 }); 17004 }, 17005 units, 17006 prefix: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalInputControlPrefixWrapper, { variant: "icon", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(icon_default, { icon: align_none_default }) }) 17007 } 17008 ), 17009 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 17010 external_wp_components_namespaceObject.__experimentalUnitControl, 17011 { 17012 __next40pxDefaultSize: true, 17013 label: (0,external_wp_i18n_namespaceObject.__)("Wide width"), 17014 labelPosition: "top", 17015 value: wideSize || contentSize || "", 17016 onChange: (nextWidth) => { 17017 nextWidth = 0 > parseFloat(nextWidth) ? "0" : nextWidth; 17018 onChange({ 17019 ...layout, 17020 wideSize: nextWidth 17021 }); 17022 }, 17023 units, 17024 prefix: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalInputControlPrefixWrapper, { variant: "icon", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(icon_default, { icon: stretch_wide_default }) }) 17025 } 17026 ), 17027 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { className: "block-editor-hooks__layout-constrained-helptext", children: (0,external_wp_i18n_namespaceObject.__)( 17028 "Customize the width for all elements that are assigned to the center or wide columns." 17029 ) }) 17030 ] }), 17031 allowJustification && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 17032 external_wp_components_namespaceObject.__experimentalToggleGroupControl, 17033 { 17034 __next40pxDefaultSize: true, 17035 __nextHasNoMarginBottom: true, 17036 label: (0,external_wp_i18n_namespaceObject.__)("Justification"), 17037 value: justifyContent, 17038 onChange: onJustificationChange, 17039 children: justificationOptions.map( 17040 ({ value, icon, label }) => { 17041 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 17042 external_wp_components_namespaceObject.__experimentalToggleGroupControlOptionIcon, 17043 { 17044 value, 17045 icon, 17046 label 17047 }, 17048 value 17049 ); 17050 } 17051 ) 17052 } 17053 ) 17054 ] 17055 } 17056 ); 17057 }, 17058 toolBarControls: function DefaultLayoutToolbarControls({ 17059 layout = {}, 17060 onChange, 17061 layoutBlockSupport 17062 }) { 17063 const { allowJustification = true } = layoutBlockSupport; 17064 if (!allowJustification) { 17065 return null; 17066 } 17067 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(block_controls_default, { group: "block", __experimentalShareWithChildBlocks: true, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 17068 DefaultLayoutJustifyContentControl, 17069 { 17070 layout, 17071 onChange 17072 } 17073 ) }); 17074 }, 17075 getLayoutStyle: function getLayoutStyle({ 17076 selector, 17077 layout = {}, 17078 style, 17079 blockName, 17080 hasBlockGapSupport, 17081 layoutDefinitions = LAYOUT_DEFINITIONS 17082 }) { 17083 const { contentSize, wideSize, justifyContent } = layout; 17084 const blockGapStyleValue = getGapCSSValue(style?.spacing?.blockGap); 17085 let blockGapValue = ""; 17086 if (!shouldSkipSerialization(blockName, "spacing", "blockGap")) { 17087 if (blockGapStyleValue?.top) { 17088 blockGapValue = getGapCSSValue(blockGapStyleValue?.top); 17089 } else if (typeof blockGapStyleValue === "string") { 17090 blockGapValue = getGapCSSValue(blockGapStyleValue); 17091 } 17092 } 17093 const marginLeft = justifyContent === "left" ? "0 !important" : "auto !important"; 17094 const marginRight = justifyContent === "right" ? "0 !important" : "auto !important"; 17095 let output = !!contentSize || !!wideSize ? ` 17096 $appendSelectors( 17097 selector, 17098 "> :where(:not(.alignleft):not(.alignright):not(.alignfull))" 17099 )} { 17100 max-width: $contentSize ?? wideSize}; 17101 margin-left: $marginLeft}; 17102 margin-right: $marginRight}; 17103 } 17104 $appendSelectors(selector, "> .alignwide")} { 17105 max-width: $wideSize ?? contentSize}; 17106 } 17107 $appendSelectors(selector, "> .alignfull")} { 17108 max-width: none; 17109 } 17110 ` : ""; 17111 if (justifyContent === "left") { 17112 output += `$appendSelectors( 17113 selector, 17114 "> :where(:not(.alignleft):not(.alignright):not(.alignfull))" 17115 )} 17116 { margin-left: $marginLeft}; }`; 17117 } else if (justifyContent === "right") { 17118 output += `$appendSelectors( 17119 selector, 17120 "> :where(:not(.alignleft):not(.alignright):not(.alignfull))" 17121 )} 17122 { margin-right: $marginRight}; }`; 17123 } 17124 if (style?.spacing?.padding) { 17125 const paddingValues = (0,external_wp_styleEngine_namespaceObject.getCSSRules)(style); 17126 paddingValues.forEach((rule) => { 17127 if (rule.key === "paddingRight") { 17128 const paddingRightValue = rule.value === "0" ? "0px" : rule.value; 17129 output += ` 17130 $appendSelectors(selector, "> .alignfull")} { 17131 margin-right: calc($paddingRightValue} * -1); 17132 } 17133 `; 17134 } else if (rule.key === "paddingLeft") { 17135 const paddingLeftValue = rule.value === "0" ? "0px" : rule.value; 17136 output += ` 17137 $appendSelectors(selector, "> .alignfull")} { 17138 margin-left: calc($paddingLeftValue} * -1); 17139 } 17140 `; 17141 } 17142 }); 17143 } 17144 if (hasBlockGapSupport && blockGapValue) { 17145 output += getBlockGapCSS( 17146 selector, 17147 layoutDefinitions, 17148 "constrained", 17149 blockGapValue 17150 ); 17151 } 17152 return output; 17153 }, 17154 getOrientation() { 17155 return "vertical"; 17156 }, 17157 getAlignments(layout) { 17158 const alignmentInfo = getAlignmentsInfo(layout); 17159 if (layout.alignments !== void 0) { 17160 if (!layout.alignments.includes("none")) { 17161 layout.alignments.unshift("none"); 17162 } 17163 return layout.alignments.map((alignment) => ({ 17164 name: alignment, 17165 info: alignmentInfo[alignment] 17166 })); 17167 } 17168 const { contentSize, wideSize } = layout; 17169 const alignments = [ 17170 { name: "left" }, 17171 { name: "center" }, 17172 { name: "right" } 17173 ]; 17174 if (contentSize) { 17175 alignments.unshift({ name: "full" }); 17176 } 17177 if (wideSize) { 17178 alignments.unshift({ name: "wide", info: alignmentInfo.wide }); 17179 } 17180 alignments.unshift({ name: "none", info: alignmentInfo.none }); 17181 return alignments; 17182 } 17183 }; 17184 const constrained_POPOVER_PROPS = { 17185 placement: "bottom-start" 17186 }; 17187 function DefaultLayoutJustifyContentControl({ layout, onChange }) { 17188 const { justifyContent = "center" } = layout; 17189 const onJustificationChange = (value) => { 17190 onChange({ 17191 ...layout, 17192 justifyContent: value 17193 }); 17194 }; 17195 const allowedControls = ["left", "center", "right"]; 17196 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 17197 JustifyContentControl, 17198 { 17199 allowedControls, 17200 value: justifyContent, 17201 onChange: onJustificationChange, 17202 popoverProps: constrained_POPOVER_PROPS 17203 } 17204 ); 17205 } 17206 17207 17208 ;// ./node_modules/@wordpress/block-editor/build-module/layouts/grid.js 17209 17210 17211 17212 17213 17214 17215 17216 17217 const RANGE_CONTROL_MAX_VALUES = { 17218 px: 600, 17219 "%": 100, 17220 vw: 100, 17221 vh: 100, 17222 em: 38, 17223 rem: 38, 17224 svw: 100, 17225 lvw: 100, 17226 dvw: 100, 17227 svh: 100, 17228 lvh: 100, 17229 dvh: 100, 17230 vi: 100, 17231 svi: 100, 17232 lvi: 100, 17233 dvi: 100, 17234 vb: 100, 17235 svb: 100, 17236 lvb: 100, 17237 dvb: 100, 17238 vmin: 100, 17239 svmin: 100, 17240 lvmin: 100, 17241 dvmin: 100, 17242 vmax: 100, 17243 svmax: 100, 17244 lvmax: 100, 17245 dvmax: 100 17246 }; 17247 const units = [ 17248 { value: "px", label: "px", default: 0 }, 17249 { value: "rem", label: "rem", default: 0 }, 17250 { value: "em", label: "em", default: 0 } 17251 ]; 17252 var grid_default = { 17253 name: "grid", 17254 label: (0,external_wp_i18n_namespaceObject.__)("Grid"), 17255 inspectorControls: function GridLayoutInspectorControls({ 17256 layout = {}, 17257 onChange, 17258 layoutBlockSupport = {} 17259 }) { 17260 const { allowSizingOnChildren = false } = layoutBlockSupport; 17261 const showColumnsControl = window.__experimentalEnableGridInteractivity || !!layout?.columnCount; 17262 const showMinWidthControl = window.__experimentalEnableGridInteractivity || !layout?.columnCount; 17263 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 17264 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 17265 GridLayoutTypeControl, 17266 { 17267 layout, 17268 onChange 17269 } 17270 ), 17271 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 4, children: [ 17272 showColumnsControl && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 17273 GridLayoutColumnsAndRowsControl, 17274 { 17275 layout, 17276 onChange, 17277 allowSizingOnChildren 17278 } 17279 ), 17280 showMinWidthControl && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 17281 GridLayoutMinimumWidthControl, 17282 { 17283 layout, 17284 onChange 17285 } 17286 ) 17287 ] }) 17288 ] }); 17289 }, 17290 toolBarControls: function GridLayoutToolbarControls() { 17291 return null; 17292 }, 17293 getLayoutStyle: function getLayoutStyle({ 17294 selector, 17295 layout, 17296 style, 17297 blockName, 17298 hasBlockGapSupport, 17299 layoutDefinitions = LAYOUT_DEFINITIONS 17300 }) { 17301 const { 17302 minimumColumnWidth = null, 17303 columnCount = null, 17304 rowCount = null 17305 } = layout; 17306 if (false) {} 17307 const blockGapValue = style?.spacing?.blockGap && !shouldSkipSerialization(blockName, "spacing", "blockGap") ? getGapCSSValue(style?.spacing?.blockGap, "0.5em") : void 0; 17308 let output = ""; 17309 const rules = []; 17310 if (minimumColumnWidth && columnCount > 0) { 17311 const maxValue = `max($minimumColumnWidth}, ( 100% - ($blockGapValue || "1.2rem"}*$columnCount - 1}) ) / $columnCount})`; 17312 rules.push( 17313 `grid-template-columns: repeat(auto-fill, minmax($maxValue}, 1fr))`, 17314 `container-type: inline-size` 17315 ); 17316 if (rowCount) { 17317 rules.push( 17318 `grid-template-rows: repeat($rowCount}, minmax(1rem, auto))` 17319 ); 17320 } 17321 } else if (columnCount) { 17322 rules.push( 17323 `grid-template-columns: repeat($columnCount}, minmax(0, 1fr))` 17324 ); 17325 if (rowCount) { 17326 rules.push( 17327 `grid-template-rows: repeat($rowCount}, minmax(1rem, auto))` 17328 ); 17329 } 17330 } else { 17331 rules.push( 17332 `grid-template-columns: repeat(auto-fill, minmax(min($minimumColumnWidth || "12rem"}, 100%), 1fr))`, 17333 "container-type: inline-size" 17334 ); 17335 } 17336 if (rules.length) { 17337 output = `$appendSelectors(selector)} { $rules.join( 17338 "; " 17339 )}; }`; 17340 } 17341 if (hasBlockGapSupport && blockGapValue) { 17342 output += getBlockGapCSS( 17343 selector, 17344 layoutDefinitions, 17345 "grid", 17346 blockGapValue 17347 ); 17348 } 17349 return output; 17350 }, 17351 getOrientation() { 17352 return "horizontal"; 17353 }, 17354 getAlignments() { 17355 return []; 17356 } 17357 }; 17358 function GridLayoutMinimumWidthControl({ layout, onChange }) { 17359 const { minimumColumnWidth, columnCount, isManualPlacement } = layout; 17360 const defaultValue = isManualPlacement || columnCount ? null : "12rem"; 17361 const value = minimumColumnWidth || defaultValue; 17362 const [quantity, unit = "rem"] = (0,external_wp_components_namespaceObject.__experimentalParseQuantityAndUnitFromRawValue)(value); 17363 const handleSliderChange = (next) => { 17364 onChange({ 17365 ...layout, 17366 minimumColumnWidth: [next, unit].join("") 17367 }); 17368 }; 17369 const handleUnitChange = (newUnit) => { 17370 let newValue; 17371 if (["em", "rem"].includes(newUnit) && unit === "px") { 17372 newValue = (quantity / 16).toFixed(2) + newUnit; 17373 } else if (["em", "rem"].includes(unit) && newUnit === "px") { 17374 newValue = Math.round(quantity * 16) + newUnit; 17375 } 17376 onChange({ 17377 ...layout, 17378 minimumColumnWidth: newValue 17379 }); 17380 }; 17381 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("fieldset", { className: "block-editor-hooks__grid-layout-minimum-width-control", children: [ 17382 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.BaseControl.VisualLabel, { as: "legend", children: (0,external_wp_i18n_namespaceObject.__)("Minimum column width") }), 17383 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, { gap: 4, children: [ 17384 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { isBlock: true, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 17385 external_wp_components_namespaceObject.__experimentalUnitControl, 17386 { 17387 size: "__unstable-large", 17388 onChange: (newValue) => { 17389 onChange({ 17390 ...layout, 17391 minimumColumnWidth: newValue === "" ? void 0 : newValue 17392 }); 17393 }, 17394 onUnitChange: handleUnitChange, 17395 value, 17396 units, 17397 min: 0, 17398 label: (0,external_wp_i18n_namespaceObject.__)("Minimum column width"), 17399 hideLabelFromVision: true 17400 } 17401 ) }), 17402 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { isBlock: true, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 17403 external_wp_components_namespaceObject.RangeControl, 17404 { 17405 __next40pxDefaultSize: true, 17406 __nextHasNoMarginBottom: true, 17407 onChange: handleSliderChange, 17408 value: quantity || 0, 17409 min: 0, 17410 max: RANGE_CONTROL_MAX_VALUES[unit] || 600, 17411 withInputField: false, 17412 label: (0,external_wp_i18n_namespaceObject.__)("Minimum column width"), 17413 hideLabelFromVision: true 17414 } 17415 ) }) 17416 ] }) 17417 ] }); 17418 } 17419 function GridLayoutColumnsAndRowsControl({ 17420 layout, 17421 onChange, 17422 allowSizingOnChildren 17423 }) { 17424 const defaultColumnCount = window.__experimentalEnableGridInteractivity ? void 0 : 3; 17425 const { 17426 columnCount = defaultColumnCount, 17427 rowCount, 17428 isManualPlacement 17429 } = layout; 17430 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("fieldset", { className: "block-editor-hooks__grid-layout-columns-and-rows-controls", children: [ 17431 (!window.__experimentalEnableGridInteractivity || !isManualPlacement) && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.BaseControl.VisualLabel, { as: "legend", children: (0,external_wp_i18n_namespaceObject.__)("Columns") }), 17432 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, { gap: 4, children: [ 17433 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { isBlock: true, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 17434 external_wp_components_namespaceObject.__experimentalNumberControl, 17435 { 17436 size: "__unstable-large", 17437 onChange: (value) => { 17438 if (window.__experimentalEnableGridInteractivity) { 17439 const defaultNewColumnCount = isManualPlacement ? 1 : void 0; 17440 const newColumnCount = value === "" || value === "0" ? defaultNewColumnCount : parseInt(value, 10); 17441 onChange({ 17442 ...layout, 17443 columnCount: newColumnCount 17444 }); 17445 } else { 17446 const newColumnCount = value === "" || value === "0" ? 1 : parseInt(value, 10); 17447 onChange({ 17448 ...layout, 17449 columnCount: newColumnCount 17450 }); 17451 } 17452 }, 17453 value: columnCount, 17454 min: 1, 17455 label: (0,external_wp_i18n_namespaceObject.__)("Columns"), 17456 hideLabelFromVision: !window.__experimentalEnableGridInteractivity || !isManualPlacement 17457 } 17458 ) }), 17459 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { isBlock: true, children: window.__experimentalEnableGridInteractivity && allowSizingOnChildren && isManualPlacement ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 17460 external_wp_components_namespaceObject.__experimentalNumberControl, 17461 { 17462 size: "__unstable-large", 17463 onChange: (value) => { 17464 const newRowCount = value === "" || value === "0" ? 1 : parseInt(value, 10); 17465 onChange({ 17466 ...layout, 17467 rowCount: newRowCount 17468 }); 17469 }, 17470 value: rowCount, 17471 min: 1, 17472 label: (0,external_wp_i18n_namespaceObject.__)("Rows") 17473 } 17474 ) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 17475 external_wp_components_namespaceObject.RangeControl, 17476 { 17477 __next40pxDefaultSize: true, 17478 __nextHasNoMarginBottom: true, 17479 value: columnCount ?? 1, 17480 onChange: (value) => onChange({ 17481 ...layout, 17482 columnCount: value === "" || value === "0" ? 1 : value 17483 }), 17484 min: 1, 17485 max: 16, 17486 withInputField: false, 17487 label: (0,external_wp_i18n_namespaceObject.__)("Columns"), 17488 hideLabelFromVision: true 17489 } 17490 ) }) 17491 ] }) 17492 ] }) }); 17493 } 17494 function GridLayoutTypeControl({ layout, onChange }) { 17495 const { columnCount, rowCount, minimumColumnWidth, isManualPlacement } = layout; 17496 const [tempColumnCount, setTempColumnCount] = (0,external_wp_element_namespaceObject.useState)( 17497 columnCount || 3 17498 ); 17499 const [tempRowCount, setTempRowCount] = (0,external_wp_element_namespaceObject.useState)(rowCount); 17500 const [tempMinimumColumnWidth, setTempMinimumColumnWidth] = (0,external_wp_element_namespaceObject.useState)( 17501 minimumColumnWidth || "12rem" 17502 ); 17503 const gridPlacement = isManualPlacement || !!columnCount && !window.__experimentalEnableGridInteractivity ? "manual" : "auto"; 17504 const onChangeType = (value) => { 17505 if (value === "manual") { 17506 setTempMinimumColumnWidth(minimumColumnWidth || "12rem"); 17507 } else { 17508 setTempColumnCount(columnCount || 3); 17509 setTempRowCount(rowCount); 17510 } 17511 onChange({ 17512 ...layout, 17513 columnCount: value === "manual" ? tempColumnCount : null, 17514 rowCount: value === "manual" && window.__experimentalEnableGridInteractivity ? tempRowCount : void 0, 17515 isManualPlacement: value === "manual" && window.__experimentalEnableGridInteractivity ? true : void 0, 17516 minimumColumnWidth: value === "auto" ? tempMinimumColumnWidth : null 17517 }); 17518 }; 17519 const helpText = gridPlacement === "manual" ? (0,external_wp_i18n_namespaceObject.__)( 17520 "Grid items can be manually placed in any position on the grid." 17521 ) : (0,external_wp_i18n_namespaceObject.__)( 17522 "Grid items are placed automatically depending on their order." 17523 ); 17524 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 17525 external_wp_components_namespaceObject.__experimentalToggleGroupControl, 17526 { 17527 __next40pxDefaultSize: true, 17528 __nextHasNoMarginBottom: true, 17529 label: (0,external_wp_i18n_namespaceObject.__)("Grid item position"), 17530 value: gridPlacement, 17531 onChange: onChangeType, 17532 isBlock: true, 17533 help: window.__experimentalEnableGridInteractivity ? helpText : void 0, 17534 children: [ 17535 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 17536 external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, 17537 { 17538 value: "auto", 17539 label: (0,external_wp_i18n_namespaceObject.__)("Auto") 17540 }, 17541 "auto" 17542 ), 17543 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 17544 external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, 17545 { 17546 value: "manual", 17547 label: (0,external_wp_i18n_namespaceObject.__)("Manual") 17548 }, 17549 "manual" 17550 ) 17551 ] 17552 } 17553 ); 17554 } 17555 17556 17557 ;// ./node_modules/@wordpress/block-editor/build-module/layouts/index.js 17558 17559 17560 17561 17562 const layoutTypes = [flow_default, flex_default, constrained_default, grid_default]; 17563 function getLayoutType(name = "default") { 17564 return layoutTypes.find((layoutType) => layoutType.name === name); 17565 } 17566 function getLayoutTypes() { 17567 return layoutTypes; 17568 } 17569 17570 17571 ;// ./node_modules/@wordpress/block-editor/build-module/components/block-list/layout.js 17572 17573 17574 17575 17576 const defaultLayout = { type: "default" }; 17577 const Layout = (0,external_wp_element_namespaceObject.createContext)(defaultLayout); 17578 Layout.displayName = "BlockLayoutContext"; 17579 const LayoutProvider = Layout.Provider; 17580 function useLayout() { 17581 return (0,external_wp_element_namespaceObject.useContext)(Layout); 17582 } 17583 function LayoutStyle({ layout = {}, css, ...props }) { 17584 const layoutType = getLayoutType(layout.type); 17585 const [blockGapSupport] = use_settings_useSettings("spacing.blockGap"); 17586 const hasBlockGapSupport = blockGapSupport !== null; 17587 if (layoutType) { 17588 if (css) { 17589 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("style", { children: css }); 17590 } 17591 const layoutStyle = layoutType.getLayoutStyle?.({ 17592 hasBlockGapSupport, 17593 layout, 17594 ...props 17595 }); 17596 if (layoutStyle) { 17597 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("style", { children: layoutStyle }); 17598 } 17599 } 17600 return null; 17601 } 17602 17603 17604 ;// ./node_modules/@wordpress/block-editor/build-module/components/block-alignment-control/use-available-alignments.js 17605 17606 17607 17608 17609 const use_available_alignments_EMPTY_ARRAY = []; 17610 const use_available_alignments_DEFAULT_CONTROLS = ["none", "left", "center", "right", "wide", "full"]; 17611 const WIDE_CONTROLS = ["wide", "full"]; 17612 function useAvailableAlignments(controls = use_available_alignments_DEFAULT_CONTROLS) { 17613 if (!controls.includes("none")) { 17614 controls = ["none", ...controls]; 17615 } 17616 const isNoneOnly = controls.length === 1 && controls[0] === "none"; 17617 const [wideControlsEnabled, themeSupportsLayout, isBlockBasedTheme] = (0,external_wp_data_namespaceObject.useSelect)( 17618 (select) => { 17619 if (isNoneOnly) { 17620 return [false, false, false]; 17621 } 17622 const settings = select(store).getSettings(); 17623 return [ 17624 settings.alignWide ?? false, 17625 settings.supportsLayout, 17626 settings.__unstableIsBlockBasedTheme 17627 ]; 17628 }, 17629 [isNoneOnly] 17630 ); 17631 const layout = useLayout(); 17632 if (isNoneOnly) { 17633 return use_available_alignments_EMPTY_ARRAY; 17634 } 17635 const layoutType = getLayoutType(layout?.type); 17636 if (themeSupportsLayout) { 17637 const layoutAlignments = layoutType.getAlignments( 17638 layout, 17639 isBlockBasedTheme 17640 ); 17641 const alignments2 = layoutAlignments.filter( 17642 (alignment) => controls.includes(alignment.name) 17643 ); 17644 if (alignments2.length === 1 && alignments2[0].name === "none") { 17645 return use_available_alignments_EMPTY_ARRAY; 17646 } 17647 return alignments2; 17648 } 17649 if (layoutType.name !== "default" && layoutType.name !== "constrained") { 17650 return use_available_alignments_EMPTY_ARRAY; 17651 } 17652 const alignments = controls.filter((control) => { 17653 if (layout.alignments) { 17654 return layout.alignments.includes(control); 17655 } 17656 if (!wideControlsEnabled && WIDE_CONTROLS.includes(control)) { 17657 return false; 17658 } 17659 return use_available_alignments_DEFAULT_CONTROLS.includes(control); 17660 }).map((name) => ({ name })); 17661 if (alignments.length === 1 && alignments[0].name === "none") { 17662 return use_available_alignments_EMPTY_ARRAY; 17663 } 17664 return alignments; 17665 } 17666 17667 17668 ;// ./node_modules/@wordpress/icons/build-module/library/position-left.js 17669 17670 17671 var position_left_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M5 5.5h8V4H5v1.5ZM5 20h8v-1.5H5V20ZM19 9H5v6h14V9Z" }) }); 17672 17673 17674 ;// ./node_modules/@wordpress/icons/build-module/library/position-center.js 17675 17676 17677 var position_center_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M19 5.5H5V4h14v1.5ZM19 20H5v-1.5h14V20ZM7 9h10v6H7V9Z" }) }); 17678 17679 17680 ;// ./node_modules/@wordpress/icons/build-module/library/position-right.js 17681 17682 17683 var position_right_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M19 5.5h-8V4h8v1.5ZM19 20h-8v-1.5h8V20ZM5 9h14v6H5V9Z" }) }); 17684 17685 17686 ;// ./node_modules/@wordpress/icons/build-module/library/stretch-full-width.js 17687 17688 17689 var stretch_full_width_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M5 4h14v11H5V4Zm11 16H8v-1.5h8V20Z" }) }); 17690 17691 17692 ;// ./node_modules/@wordpress/block-editor/build-module/components/block-alignment-control/constants.js 17693 17694 17695 const constants_BLOCK_ALIGNMENTS_CONTROLS = { 17696 none: { 17697 icon: align_none_default, 17698 title: (0,external_wp_i18n_namespaceObject._x)("None", "Alignment option") 17699 }, 17700 left: { 17701 icon: position_left_default, 17702 title: (0,external_wp_i18n_namespaceObject.__)("Align left") 17703 }, 17704 center: { 17705 icon: position_center_default, 17706 title: (0,external_wp_i18n_namespaceObject.__)("Align center") 17707 }, 17708 right: { 17709 icon: position_right_default, 17710 title: (0,external_wp_i18n_namespaceObject.__)("Align right") 17711 }, 17712 wide: { 17713 icon: stretch_wide_default, 17714 title: (0,external_wp_i18n_namespaceObject.__)("Wide width") 17715 }, 17716 full: { 17717 icon: stretch_full_width_default, 17718 title: (0,external_wp_i18n_namespaceObject.__)("Full width") 17719 } 17720 }; 17721 const constants_DEFAULT_CONTROL = "none"; 17722 17723 17724 ;// ./node_modules/@wordpress/block-editor/build-module/components/block-alignment-control/ui.js 17725 17726 17727 17728 17729 17730 17731 function BlockAlignmentUI({ 17732 value, 17733 onChange, 17734 controls, 17735 isToolbar, 17736 isCollapsed = true 17737 }) { 17738 const enabledControls = useAvailableAlignments(controls); 17739 const hasEnabledControls = !!enabledControls.length; 17740 if (!hasEnabledControls) { 17741 return null; 17742 } 17743 function onChangeAlignment(align) { 17744 onChange([value, "none"].includes(align) ? void 0 : align); 17745 } 17746 const activeAlignmentControl = constants_BLOCK_ALIGNMENTS_CONTROLS[value]; 17747 const defaultAlignmentControl = constants_BLOCK_ALIGNMENTS_CONTROLS[constants_DEFAULT_CONTROL]; 17748 const UIComponent = isToolbar ? external_wp_components_namespaceObject.ToolbarGroup : external_wp_components_namespaceObject.ToolbarDropdownMenu; 17749 const commonProps = { 17750 icon: activeAlignmentControl ? activeAlignmentControl.icon : defaultAlignmentControl.icon, 17751 label: (0,external_wp_i18n_namespaceObject.__)("Align") 17752 }; 17753 const extraProps = isToolbar ? { 17754 isCollapsed, 17755 controls: enabledControls.map(({ name: controlName }) => { 17756 return { 17757 ...constants_BLOCK_ALIGNMENTS_CONTROLS[controlName], 17758 isActive: value === controlName || !value && controlName === "none", 17759 role: isCollapsed ? "menuitemradio" : void 0, 17760 onClick: () => onChangeAlignment(controlName) 17761 }; 17762 }) 17763 } : { 17764 toggleProps: { description: (0,external_wp_i18n_namespaceObject.__)("Change alignment") }, 17765 children: ({ onClose }) => { 17766 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuGroup, { className: "block-editor-block-alignment-control__menu-group", children: enabledControls.map( 17767 ({ name: controlName, info }) => { 17768 const { icon, title } = constants_BLOCK_ALIGNMENTS_CONTROLS[controlName]; 17769 const isSelected = controlName === value || !value && controlName === "none"; 17770 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 17771 external_wp_components_namespaceObject.MenuItem, 17772 { 17773 icon, 17774 iconPosition: "left", 17775 className: dist_clsx( 17776 "components-dropdown-menu__menu-item", 17777 { 17778 "is-active": isSelected 17779 } 17780 ), 17781 isSelected, 17782 onClick: () => { 17783 onChangeAlignment( 17784 controlName 17785 ); 17786 onClose(); 17787 }, 17788 role: "menuitemradio", 17789 info, 17790 children: title 17791 }, 17792 controlName 17793 ); 17794 } 17795 ) }) }); 17796 } 17797 }; 17798 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(UIComponent, { ...commonProps, ...extraProps }); 17799 } 17800 var block_alignment_control_ui_ui_default = BlockAlignmentUI; 17801 17802 17803 ;// ./node_modules/@wordpress/block-editor/build-module/components/block-alignment-control/index.js 17804 17805 17806 const BlockAlignmentControl = (props) => { 17807 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(block_alignment_control_ui_ui_default, { ...props, isToolbar: false }); 17808 }; 17809 const BlockAlignmentToolbar = (props) => { 17810 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(block_alignment_control_ui_ui_default, { ...props, isToolbar: true }); 17811 }; 17812 17813 17814 ;// ./node_modules/@wordpress/block-editor/build-module/components/block-editing-mode/index.js 17815 17816 17817 17818 17819 function useBlockEditingMode(mode) { 17820 const context = useBlockEditContext(); 17821 const { clientId = "" } = context; 17822 const { setBlockEditingMode, unsetBlockEditingMode } = (0,external_wp_data_namespaceObject.useDispatch)(store); 17823 const globalBlockEditingMode = (0,external_wp_data_namespaceObject.useSelect)( 17824 (select) => ( 17825 // Avoid adding the subscription if not needed! 17826 clientId ? null : select(store).getBlockEditingMode() 17827 ), 17828 [clientId] 17829 ); 17830 (0,external_wp_element_namespaceObject.useEffect)(() => { 17831 if (mode) { 17832 setBlockEditingMode(clientId, mode); 17833 } 17834 return () => { 17835 if (mode) { 17836 unsetBlockEditingMode(clientId); 17837 } 17838 }; 17839 }, [clientId, mode, setBlockEditingMode, unsetBlockEditingMode]); 17840 return clientId ? context[blockEditingModeKey] : globalBlockEditingMode; 17841 } 17842 17843 17844 ;// ./node_modules/@wordpress/block-editor/build-module/hooks/align.js 17845 17846 17847 17848 17849 17850 17851 17852 const ALL_ALIGNMENTS = ["left", "center", "right", "wide", "full"]; 17853 const WIDE_ALIGNMENTS = ["wide", "full"]; 17854 function getValidAlignments(blockAlign, hasWideBlockSupport = true, hasWideEnabled = true) { 17855 let validAlignments; 17856 if (Array.isArray(blockAlign)) { 17857 validAlignments = ALL_ALIGNMENTS.filter( 17858 (value) => blockAlign.includes(value) 17859 ); 17860 } else if (blockAlign === true) { 17861 validAlignments = [...ALL_ALIGNMENTS]; 17862 } else { 17863 validAlignments = []; 17864 } 17865 if (!hasWideEnabled || blockAlign === true && !hasWideBlockSupport) { 17866 return validAlignments.filter( 17867 (alignment) => !WIDE_ALIGNMENTS.includes(alignment) 17868 ); 17869 } 17870 return validAlignments; 17871 } 17872 function addAttribute(settings) { 17873 if ("type" in (settings.attributes?.align ?? {})) { 17874 return settings; 17875 } 17876 if ((0,external_wp_blocks_namespaceObject.hasBlockSupport)(settings, "align")) { 17877 settings.attributes = { 17878 ...settings.attributes, 17879 align: { 17880 type: "string", 17881 // Allow for '' since it is used by the `updateAlignment` function 17882 // in toolbar controls for special cases with defined default values. 17883 enum: [...ALL_ALIGNMENTS, ""] 17884 } 17885 }; 17886 } 17887 return settings; 17888 } 17889 function BlockEditAlignmentToolbarControlsPure({ 17890 name: blockName, 17891 align, 17892 setAttributes 17893 }) { 17894 const blockAllowedAlignments = getValidAlignments( 17895 (0,external_wp_blocks_namespaceObject.getBlockSupport)(blockName, "align"), 17896 (0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockName, "alignWide", true) 17897 ); 17898 const validAlignments = useAvailableAlignments( 17899 blockAllowedAlignments 17900 ).map(({ name }) => name); 17901 const blockEditingMode = useBlockEditingMode(); 17902 if (!validAlignments.length || blockEditingMode !== "default") { 17903 return null; 17904 } 17905 const updateAlignment = (nextAlign) => { 17906 if (!nextAlign) { 17907 const blockType = (0,external_wp_blocks_namespaceObject.getBlockType)(blockName); 17908 const blockDefaultAlign = blockType?.attributes?.align?.default; 17909 if (blockDefaultAlign) { 17910 nextAlign = ""; 17911 } 17912 } 17913 setAttributes({ align: nextAlign }); 17914 }; 17915 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(block_controls_default, { group: "block", __experimentalShareWithChildBlocks: true, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 17916 BlockAlignmentControl, 17917 { 17918 value: align, 17919 onChange: updateAlignment, 17920 controls: validAlignments 17921 } 17922 ) }); 17923 } 17924 var align_default = { 17925 shareWithChildBlocks: true, 17926 edit: BlockEditAlignmentToolbarControlsPure, 17927 useBlockProps, 17928 addSaveProps: addAssignedAlign, 17929 attributeKeys: ["align"], 17930 hasSupport(name) { 17931 return (0,external_wp_blocks_namespaceObject.hasBlockSupport)(name, "align", false); 17932 } 17933 }; 17934 function useBlockProps({ name, align }) { 17935 const blockAllowedAlignments = getValidAlignments( 17936 (0,external_wp_blocks_namespaceObject.getBlockSupport)(name, "align"), 17937 (0,external_wp_blocks_namespaceObject.hasBlockSupport)(name, "alignWide", true) 17938 ); 17939 const validAlignments = useAvailableAlignments(blockAllowedAlignments); 17940 if (validAlignments.some((alignment) => alignment.name === align)) { 17941 return { "data-align": align }; 17942 } 17943 return {}; 17944 } 17945 function addAssignedAlign(props, blockType, attributes) { 17946 const { align } = attributes; 17947 const blockAlign = (0,external_wp_blocks_namespaceObject.getBlockSupport)(blockType, "align"); 17948 const hasWideBlockSupport = (0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockType, "alignWide", true); 17949 const isAlignValid = getValidAlignments( 17950 blockAlign, 17951 hasWideBlockSupport 17952 ).includes(align); 17953 if (isAlignValid) { 17954 props.className = dist_clsx(`align$align}`, props.className); 17955 } 17956 return props; 17957 } 17958 (0,external_wp_hooks_namespaceObject.addFilter)( 17959 "blocks.registerBlockType", 17960 "core/editor/align/addAttribute", 17961 addAttribute 17962 ); 17963 17964 17965 ;// ./node_modules/@wordpress/block-editor/build-module/components/inspector-controls/groups.js 17966 17967 const InspectorControlsDefault = (0,external_wp_components_namespaceObject.createSlotFill)("InspectorControls"); 17968 const InspectorControlsAdvanced = (0,external_wp_components_namespaceObject.createSlotFill)("InspectorAdvancedControls"); 17969 const InspectorControlsBindings = (0,external_wp_components_namespaceObject.createSlotFill)("InspectorControlsBindings"); 17970 const InspectorControlsBackground = (0,external_wp_components_namespaceObject.createSlotFill)( 17971 "InspectorControlsBackground" 17972 ); 17973 const InspectorControlsBorder = (0,external_wp_components_namespaceObject.createSlotFill)("InspectorControlsBorder"); 17974 const InspectorControlsColor = (0,external_wp_components_namespaceObject.createSlotFill)("InspectorControlsColor"); 17975 const InspectorControlsFilter = (0,external_wp_components_namespaceObject.createSlotFill)("InspectorControlsFilter"); 17976 const InspectorControlsDimensions = (0,external_wp_components_namespaceObject.createSlotFill)( 17977 "InspectorControlsDimensions" 17978 ); 17979 const InspectorControlsPosition = (0,external_wp_components_namespaceObject.createSlotFill)("InspectorControlsPosition"); 17980 const InspectorControlsTypography = (0,external_wp_components_namespaceObject.createSlotFill)( 17981 "InspectorControlsTypography" 17982 ); 17983 const InspectorControlsListView = (0,external_wp_components_namespaceObject.createSlotFill)("InspectorControlsListView"); 17984 const InspectorControlsStyles = (0,external_wp_components_namespaceObject.createSlotFill)("InspectorControlsStyles"); 17985 const InspectorControlsEffects = (0,external_wp_components_namespaceObject.createSlotFill)("InspectorControlsEffects"); 17986 const groups_groups = { 17987 default: InspectorControlsDefault, 17988 advanced: InspectorControlsAdvanced, 17989 background: InspectorControlsBackground, 17990 bindings: InspectorControlsBindings, 17991 border: InspectorControlsBorder, 17992 color: InspectorControlsColor, 17993 dimensions: InspectorControlsDimensions, 17994 effects: InspectorControlsEffects, 17995 filter: InspectorControlsFilter, 17996 list: InspectorControlsListView, 17997 position: InspectorControlsPosition, 17998 settings: InspectorControlsDefault, 17999 // Alias for default. 18000 styles: InspectorControlsStyles, 18001 typography: InspectorControlsTypography 18002 }; 18003 var groups_groups_default = groups_groups; 18004 const PrivateInspectorControlsAllowedBlocks = (0,external_wp_components_namespaceObject.createSlotFill)( 18005 Symbol("PrivateInspectorControlsAllowedBlocks") 18006 ); 18007 18008 18009 ;// ./node_modules/@wordpress/block-editor/build-module/components/inspector-controls/fill.js 18010 18011 18012 18013 18014 18015 18016 18017 function InspectorControlsFill({ 18018 children, 18019 group = "default", 18020 __experimentalGroup, 18021 resetAllFilter 18022 }) { 18023 if (__experimentalGroup) { 18024 external_wp_deprecated_default()( 18025 "`__experimentalGroup` property in `InspectorControlsFill`", 18026 { 18027 since: "6.2", 18028 version: "6.4", 18029 alternative: "`group`" 18030 } 18031 ); 18032 group = __experimentalGroup; 18033 } 18034 const context = useBlockEditContext(); 18035 const Fill = groups_groups_default[group]?.Fill; 18036 if (!Fill) { 18037 external_wp_warning_default()(`Unknown InspectorControls group "$group}" provided.`); 18038 return null; 18039 } 18040 if (!context[mayDisplayControlsKey]) { 18041 return null; 18042 } 18043 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalStyleProvider, { document, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Fill, { children: (fillProps) => { 18044 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 18045 ToolsPanelInspectorControl, 18046 { 18047 fillProps, 18048 children, 18049 resetAllFilter 18050 } 18051 ); 18052 } }) }); 18053 } 18054 function RegisterResetAll({ resetAllFilter, children }) { 18055 const { registerResetAllFilter, deregisterResetAllFilter } = (0,external_wp_element_namespaceObject.useContext)(external_wp_components_namespaceObject.__experimentalToolsPanelContext); 18056 (0,external_wp_element_namespaceObject.useEffect)(() => { 18057 if (resetAllFilter && registerResetAllFilter && deregisterResetAllFilter) { 18058 registerResetAllFilter(resetAllFilter); 18059 return () => { 18060 deregisterResetAllFilter(resetAllFilter); 18061 }; 18062 } 18063 }, [resetAllFilter, registerResetAllFilter, deregisterResetAllFilter]); 18064 return children; 18065 } 18066 function ToolsPanelInspectorControl({ children, resetAllFilter, fillProps }) { 18067 const { forwardedContext = [] } = fillProps; 18068 const innerMarkup = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(RegisterResetAll, { resetAllFilter, children }); 18069 return forwardedContext.reduce( 18070 (inner, [Provider, props]) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Provider, { ...props, children: inner }), 18071 innerMarkup 18072 ); 18073 } 18074 18075 18076 ;// ./node_modules/@wordpress/block-editor/build-module/components/inspector-controls/block-support-tools-panel.js 18077 18078 18079 18080 18081 18082 18083 18084 function BlockSupportToolsPanel({ children, group, label }) { 18085 const { updateBlockAttributes } = (0,external_wp_data_namespaceObject.useDispatch)(store); 18086 const { 18087 getBlockAttributes, 18088 getMultiSelectedBlockClientIds, 18089 getSelectedBlockClientId, 18090 hasMultiSelection 18091 } = (0,external_wp_data_namespaceObject.useSelect)(store); 18092 const dropdownMenuProps = useToolsPanelDropdownMenuProps(); 18093 const panelId = getSelectedBlockClientId(); 18094 const resetAll = (0,external_wp_element_namespaceObject.useCallback)( 18095 (resetFilters = []) => { 18096 const newAttributes = {}; 18097 const clientIds = hasMultiSelection() ? getMultiSelectedBlockClientIds() : [panelId]; 18098 clientIds.forEach((clientId) => { 18099 const { style } = getBlockAttributes(clientId); 18100 let newBlockAttributes = { style }; 18101 resetFilters.forEach((resetFilter) => { 18102 newBlockAttributes = { 18103 ...newBlockAttributes, 18104 ...resetFilter(newBlockAttributes) 18105 }; 18106 }); 18107 newBlockAttributes = { 18108 ...newBlockAttributes, 18109 style: utils_cleanEmptyObject(newBlockAttributes.style) 18110 }; 18111 newAttributes[clientId] = newBlockAttributes; 18112 }); 18113 updateBlockAttributes(clientIds, newAttributes, true); 18114 }, 18115 [ 18116 getBlockAttributes, 18117 getMultiSelectedBlockClientIds, 18118 hasMultiSelection, 18119 panelId, 18120 updateBlockAttributes 18121 ] 18122 ); 18123 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 18124 external_wp_components_namespaceObject.__experimentalToolsPanel, 18125 { 18126 className: `$group}-block-support-panel`, 18127 label, 18128 resetAll, 18129 panelId, 18130 hasInnerWrapper: true, 18131 shouldRenderPlaceholderItems: true, 18132 __experimentalFirstVisibleItemClass: "first", 18133 __experimentalLastVisibleItemClass: "last", 18134 dropdownMenuProps, 18135 children 18136 }, 18137 panelId 18138 ); 18139 } 18140 18141 18142 ;// ./node_modules/@wordpress/block-editor/build-module/components/inspector-controls/block-support-slot-container.js 18143 18144 18145 18146 function BlockSupportSlotContainer({ 18147 Slot, 18148 fillProps, 18149 ...props 18150 }) { 18151 const toolsPanelContext = (0,external_wp_element_namespaceObject.useContext)(external_wp_components_namespaceObject.__experimentalToolsPanelContext); 18152 const computedFillProps = (0,external_wp_element_namespaceObject.useMemo)( 18153 () => ({ 18154 ...fillProps ?? {}, 18155 forwardedContext: [ 18156 ...fillProps?.forwardedContext ?? [], 18157 [external_wp_components_namespaceObject.__experimentalToolsPanelContext.Provider, { value: toolsPanelContext }] 18158 ] 18159 }), 18160 [toolsPanelContext, fillProps] 18161 ); 18162 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Slot, { ...props, fillProps: computedFillProps, bubblesVirtually: true }); 18163 } 18164 18165 18166 ;// ./node_modules/@wordpress/block-editor/build-module/components/inspector-controls/slot.js 18167 18168 18169 18170 18171 18172 18173 18174 function InspectorControlsSlot({ 18175 __experimentalGroup, 18176 group = "default", 18177 label, 18178 fillProps, 18179 ...props 18180 }) { 18181 if (__experimentalGroup) { 18182 external_wp_deprecated_default()( 18183 "`__experimentalGroup` property in `InspectorControlsSlot`", 18184 { 18185 since: "6.2", 18186 version: "6.4", 18187 alternative: "`group`" 18188 } 18189 ); 18190 group = __experimentalGroup; 18191 } 18192 const slotFill = groups_groups_default[group]; 18193 const fills = (0,external_wp_components_namespaceObject.__experimentalUseSlotFills)(slotFill?.name); 18194 if (!slotFill) { 18195 external_wp_warning_default()(`Unknown InspectorControls group "$group}" provided.`); 18196 return null; 18197 } 18198 if (!fills?.length) { 18199 return null; 18200 } 18201 const { Slot } = slotFill; 18202 if (label) { 18203 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockSupportToolsPanel, { group, label, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 18204 BlockSupportSlotContainer, 18205 { 18206 ...props, 18207 fillProps, 18208 Slot 18209 } 18210 ) }); 18211 } 18212 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Slot, { ...props, fillProps, bubblesVirtually: true }); 18213 } 18214 18215 18216 ;// ./node_modules/@wordpress/block-editor/build-module/components/inspector-controls/index.js 18217 18218 18219 18220 const InspectorControls = InspectorControlsFill; 18221 InspectorControls.Slot = InspectorControlsSlot; 18222 const InspectorAdvancedControls = (props) => { 18223 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(InspectorControlsFill, { ...props, group: "advanced" }); 18224 }; 18225 InspectorAdvancedControls.Slot = (props) => { 18226 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(InspectorControlsSlot, { ...props, group: "advanced" }); 18227 }; 18228 InspectorAdvancedControls.slotName = "InspectorAdvancedControls"; 18229 var inspector_controls_default = InspectorControls; 18230 18231 18232 ;// ./node_modules/@wordpress/icons/build-module/library/reset.js 18233 18234 18235 var reset_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M7 11.5h10V13H7z" }) }); 18236 18237 18238 ;// external ["wp","url"] 18239 const external_wp_url_namespaceObject = window["wp"]["url"]; 18240 ;// external ["wp","dom"] 18241 const external_wp_dom_namespaceObject = window["wp"]["dom"]; 18242 ;// external ["wp","blob"] 18243 const external_wp_blob_namespaceObject = window["wp"]["blob"]; 18244 ;// external ["wp","keycodes"] 18245 const external_wp_keycodes_namespaceObject = window["wp"]["keycodes"]; 18246 ;// ./node_modules/@wordpress/icons/build-module/library/media.js 18247 18248 18249 var media_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: [ 18250 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "m7 6.5 4 2.5-4 2.5z" }), 18251 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 18252 external_wp_primitives_namespaceObject.Path, 18253 { 18254 fillRule: "evenodd", 18255 clipRule: "evenodd", 18256 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" 18257 } 18258 ) 18259 ] }); 18260 18261 18262 ;// ./node_modules/@wordpress/icons/build-module/library/upload.js 18263 18264 18265 var upload_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 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" }) }); 18266 18267 18268 ;// ./node_modules/@wordpress/icons/build-module/library/post-featured-image.js 18269 18270 18271 var post_featured_image_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M19 3H5c-.6 0-1 .4-1 1v7c0 .5.4 1 1 1h14c.5 0 1-.4 1-1V4c0-.6-.4-1-1-1zM5.5 10.5v-.4l1.8-1.3 1.3.8c.3.2.7.2.9-.1L11 8.1l2.4 2.4H5.5zm13 0h-2.9l-4-4c-.3-.3-.8-.3-1.1 0L8.9 8l-1.2-.8c-.3-.2-.6-.2-.9 0l-1.3 1V4.5h13v6zM4 20h9v-1.5H4V20zm0-4h16v-1.5H4V16z" }) }); 18272 18273 18274 ;// ./node_modules/@wordpress/block-editor/build-module/components/media-upload/index.js 18275 18276 const MediaUpload = () => null; 18277 var media_upload_default = (0,external_wp_components_namespaceObject.withFilters)("editor.MediaUpload")(MediaUpload); 18278 18279 18280 ;// ./node_modules/@wordpress/block-editor/build-module/components/media-upload/check.js 18281 18282 18283 function MediaUploadCheck({ fallback = null, children }) { 18284 const hasUploadPermissions = (0,external_wp_data_namespaceObject.useSelect)((select) => { 18285 const { getSettings } = select(store); 18286 return !!getSettings().mediaUpload; 18287 }, []); 18288 return hasUploadPermissions ? children : fallback; 18289 } 18290 var check_default = MediaUploadCheck; 18291 18292 18293 ;// external ["wp","isShallowEqual"] 18294 const external_wp_isShallowEqual_namespaceObject = window["wp"]["isShallowEqual"]; 18295 var external_wp_isShallowEqual_default = /*#__PURE__*/__webpack_require__.n(external_wp_isShallowEqual_namespaceObject); 18296 ;// ./node_modules/@wordpress/icons/build-module/library/link-off.js 18297 18298 18299 var link_off_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M17.031 4.703 15.576 4l-1.56 3H14v.03l-2.324 4.47H9.5V13h1.396l-1.502 2.889h-.95a3.694 3.694 0 0 1 0-7.389H10V7H8.444a5.194 5.194 0 1 0 0 10.389h.17L7.5 19.53l1.416.719L15.049 8.5h.507a3.694 3.694 0 0 1 0 7.39H14v1.5h1.556a5.194 5.194 0 0 0 .273-10.383l1.202-2.304Z" }) }); 18300 18301 18302 ;// ./node_modules/@wordpress/icons/build-module/library/keyboard-return.js 18303 18304 18305 var keyboard_return_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "m6.734 16.106 2.176-2.38-1.093-1.028-3.846 4.158 3.846 4.158 1.093-1.028-2.176-2.38h2.811c1.125 0 2.25.03 3.374 0 1.428-.001 3.362-.25 4.963-1.277 1.66-1.065 2.868-2.906 2.868-5.859 0-2.479-1.327-4.896-3.65-5.93-1.82-.813-3.044-.8-4.806-.788l-.567.002v1.5c.184 0 .368 0 .553-.002 1.82-.007 2.704-.014 4.21.657 1.854.827 2.76 2.657 2.76 4.561 0 2.472-.973 3.824-2.178 4.596-1.258.807-2.864 1.04-4.163 1.04h-.02c-1.115.03-2.229 0-3.344 0H6.734Z" }) }); 18306 18307 18308 ;// ./node_modules/@wordpress/icons/build-module/library/chevron-left-small.js 18309 18310 18311 var chevron_left_small_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "m13.1 16-3.4-4 3.4-4 1.1 1-2.6 3 2.6 3-1.1 1z" }) }); 18312 18313 18314 ;// ./node_modules/@wordpress/icons/build-module/library/chevron-right-small.js 18315 18316 18317 var chevron_right_small_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M10.8622 8.04053L14.2805 12.0286L10.8622 16.0167L9.72327 15.0405L12.3049 12.0286L9.72327 9.01672L10.8622 8.04053Z" }) }); 18318 18319 18320 ;// ./node_modules/@wordpress/block-editor/build-module/components/link-control/settings-drawer.js 18321 18322 18323 18324 18325 18326 18327 function LinkSettingsDrawer({ children, settingsOpen, setSettingsOpen }) { 18328 const prefersReducedMotion = (0,external_wp_compose_namespaceObject.useReducedMotion)(); 18329 const MaybeAnimatePresence = prefersReducedMotion ? external_wp_element_namespaceObject.Fragment : external_wp_components_namespaceObject.__unstableAnimatePresence; 18330 const MaybeMotionDiv = prefersReducedMotion ? "div" : external_wp_components_namespaceObject.__unstableMotion.div; 18331 const id = (0,external_wp_compose_namespaceObject.useInstanceId)(LinkSettingsDrawer); 18332 const settingsDrawerId = `link-control-settings-drawer-$id}`; 18333 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 18334 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 18335 external_wp_components_namespaceObject.Button, 18336 { 18337 __next40pxDefaultSize: true, 18338 className: "block-editor-link-control__drawer-toggle", 18339 "aria-expanded": settingsOpen, 18340 onClick: () => setSettingsOpen(!settingsOpen), 18341 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left_small_default : chevron_right_small_default, 18342 "aria-controls": settingsDrawerId, 18343 children: (0,external_wp_i18n_namespaceObject._x)("Advanced", "Additional link settings") 18344 } 18345 ), 18346 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(MaybeAnimatePresence, { children: settingsOpen && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 18347 MaybeMotionDiv, 18348 { 18349 className: "block-editor-link-control__drawer", 18350 hidden: !settingsOpen, 18351 id: settingsDrawerId, 18352 initial: "collapsed", 18353 animate: "open", 18354 exit: "collapsed", 18355 variants: { 18356 open: { opacity: 1, height: "auto" }, 18357 collapsed: { opacity: 0, height: 0 } 18358 }, 18359 transition: { 18360 duration: 0.1 18361 }, 18362 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-link-control__drawer-inner", children }) 18363 } 18364 ) }) 18365 ] }); 18366 } 18367 var settings_drawer_default = LinkSettingsDrawer; 18368 18369 18370 // EXTERNAL MODULE: external "React" 18371 var external_React_ = __webpack_require__(1609); 18372 ;// ./node_modules/@wordpress/block-editor/build-module/components/url-input/index.js 18373 18374 18375 18376 18377 18378 18379 18380 18381 18382 18383 18384 function isFunction(maybeFunc) { 18385 return typeof maybeFunc === "function"; 18386 } 18387 class URLInput extends external_wp_element_namespaceObject.Component { 18388 constructor(props) { 18389 super(props); 18390 this.onChange = this.onChange.bind(this); 18391 this.onFocus = this.onFocus.bind(this); 18392 this.onKeyDown = this.onKeyDown.bind(this); 18393 this.selectLink = this.selectLink.bind(this); 18394 this.handleOnClick = this.handleOnClick.bind(this); 18395 this.bindSuggestionNode = this.bindSuggestionNode.bind(this); 18396 this.autocompleteRef = props.autocompleteRef || (0,external_wp_element_namespaceObject.createRef)(); 18397 this.inputRef = props.inputRef || (0,external_wp_element_namespaceObject.createRef)(); 18398 this.updateSuggestions = (0,external_wp_compose_namespaceObject.debounce)( 18399 this.updateSuggestions.bind(this), 18400 200 18401 ); 18402 this.suggestionNodes = []; 18403 this.suggestionsRequest = null; 18404 this.state = { 18405 suggestions: [], 18406 showSuggestions: false, 18407 suggestionsValue: null, 18408 selectedSuggestion: null, 18409 suggestionsListboxId: "", 18410 suggestionOptionIdPrefix: "" 18411 }; 18412 } 18413 componentDidUpdate(prevProps) { 18414 const { showSuggestions, selectedSuggestion } = this.state; 18415 const { value, __experimentalShowInitialSuggestions = false } = this.props; 18416 if (showSuggestions && selectedSuggestion !== null && this.suggestionNodes[selectedSuggestion]) { 18417 this.suggestionNodes[selectedSuggestion].scrollIntoView({ 18418 behavior: "instant", 18419 block: "nearest", 18420 inline: "nearest" 18421 }); 18422 } 18423 if (prevProps.value !== value && !this.props.disableSuggestions) { 18424 if (value?.length) { 18425 this.updateSuggestions(value); 18426 } else if (__experimentalShowInitialSuggestions) { 18427 this.updateSuggestions(); 18428 } 18429 } 18430 } 18431 componentDidMount() { 18432 if (this.shouldShowInitialSuggestions()) { 18433 this.updateSuggestions(); 18434 } 18435 } 18436 componentWillUnmount() { 18437 this.suggestionsRequest?.cancel?.(); 18438 this.suggestionsRequest = null; 18439 } 18440 bindSuggestionNode(index) { 18441 return (ref) => { 18442 this.suggestionNodes[index] = ref; 18443 }; 18444 } 18445 shouldShowInitialSuggestions() { 18446 const { __experimentalShowInitialSuggestions = false, value } = this.props; 18447 return __experimentalShowInitialSuggestions && !(value && value.length); 18448 } 18449 updateSuggestions(value = "") { 18450 const { 18451 __experimentalFetchLinkSuggestions: fetchLinkSuggestions, 18452 __experimentalHandleURLSuggestions: handleURLSuggestions 18453 } = this.props; 18454 if (!fetchLinkSuggestions) { 18455 return; 18456 } 18457 const isInitialSuggestions = !value?.length; 18458 value = value.trim(); 18459 if (!isInitialSuggestions && (value.length < 2 || !handleURLSuggestions && (0,external_wp_url_namespaceObject.isURL)(value))) { 18460 this.suggestionsRequest?.cancel?.(); 18461 this.suggestionsRequest = null; 18462 this.setState({ 18463 suggestions: [], 18464 showSuggestions: false, 18465 suggestionsValue: value, 18466 selectedSuggestion: null, 18467 loading: false 18468 }); 18469 return; 18470 } 18471 this.setState({ 18472 selectedSuggestion: null, 18473 loading: true 18474 }); 18475 const request = fetchLinkSuggestions(value, { 18476 isInitialSuggestions 18477 }); 18478 request.then((suggestions) => { 18479 if (this.suggestionsRequest !== request) { 18480 return; 18481 } 18482 this.setState({ 18483 suggestions, 18484 suggestionsValue: value, 18485 loading: false, 18486 showSuggestions: !!suggestions.length 18487 }); 18488 if (!!suggestions.length) { 18489 this.props.debouncedSpeak( 18490 (0,external_wp_i18n_namespaceObject.sprintf)( 18491 /* translators: %d: number of results. */ 18492 (0,external_wp_i18n_namespaceObject._n)( 18493 "%d result found, use up and down arrow keys to navigate.", 18494 "%d results found, use up and down arrow keys to navigate.", 18495 suggestions.length 18496 ), 18497 suggestions.length 18498 ), 18499 "assertive" 18500 ); 18501 } else { 18502 this.props.debouncedSpeak( 18503 (0,external_wp_i18n_namespaceObject.__)("No results."), 18504 "assertive" 18505 ); 18506 } 18507 }).catch(() => { 18508 if (this.suggestionsRequest !== request) { 18509 return; 18510 } 18511 this.setState({ 18512 loading: false 18513 }); 18514 }).finally(() => { 18515 if (this.suggestionsRequest === request) { 18516 this.suggestionsRequest = null; 18517 } 18518 }); 18519 this.suggestionsRequest = request; 18520 } 18521 onChange(newValue) { 18522 this.props.onChange(newValue); 18523 } 18524 onFocus() { 18525 const { suggestions } = this.state; 18526 const { disableSuggestions, value } = this.props; 18527 if (value && !disableSuggestions && !(suggestions && suggestions.length) && this.suggestionsRequest === null) { 18528 this.updateSuggestions(value); 18529 } 18530 } 18531 onKeyDown(event) { 18532 this.props.onKeyDown?.(event); 18533 const { showSuggestions, selectedSuggestion, suggestions, loading } = this.state; 18534 if (!showSuggestions || !suggestions.length || loading) { 18535 switch (event.keyCode) { 18536 // When UP is pressed, if the caret is at the start of the text, move it to the 0 18537 // position. 18538 case external_wp_keycodes_namespaceObject.UP: { 18539 if (0 !== event.target.selectionStart) { 18540 event.preventDefault(); 18541 event.target.setSelectionRange(0, 0); 18542 } 18543 break; 18544 } 18545 // When DOWN is pressed, if the caret is not at the end of the text, move it to the 18546 // last position. 18547 case external_wp_keycodes_namespaceObject.DOWN: { 18548 if (this.props.value.length !== event.target.selectionStart) { 18549 event.preventDefault(); 18550 event.target.setSelectionRange( 18551 this.props.value.length, 18552 this.props.value.length 18553 ); 18554 } 18555 break; 18556 } 18557 // Submitting while loading should trigger onSubmit. 18558 case external_wp_keycodes_namespaceObject.ENTER: { 18559 if (this.props.onSubmit) { 18560 event.preventDefault(); 18561 this.props.onSubmit(null, event); 18562 } 18563 break; 18564 } 18565 } 18566 return; 18567 } 18568 const suggestion = this.state.suggestions[this.state.selectedSuggestion]; 18569 switch (event.keyCode) { 18570 case external_wp_keycodes_namespaceObject.UP: { 18571 event.preventDefault(); 18572 const previousIndex = !selectedSuggestion ? suggestions.length - 1 : selectedSuggestion - 1; 18573 this.setState({ 18574 selectedSuggestion: previousIndex 18575 }); 18576 break; 18577 } 18578 case external_wp_keycodes_namespaceObject.DOWN: { 18579 event.preventDefault(); 18580 const nextIndex = selectedSuggestion === null || selectedSuggestion === suggestions.length - 1 ? 0 : selectedSuggestion + 1; 18581 this.setState({ 18582 selectedSuggestion: nextIndex 18583 }); 18584 break; 18585 } 18586 case external_wp_keycodes_namespaceObject.TAB: { 18587 if (this.state.selectedSuggestion !== null) { 18588 this.selectLink(suggestion); 18589 this.props.speak((0,external_wp_i18n_namespaceObject.__)("Link selected.")); 18590 } 18591 break; 18592 } 18593 case external_wp_keycodes_namespaceObject.ENTER: { 18594 event.preventDefault(); 18595 if (this.state.selectedSuggestion !== null) { 18596 this.selectLink(suggestion); 18597 if (this.props.onSubmit) { 18598 this.props.onSubmit(suggestion, event); 18599 } 18600 } else if (this.props.onSubmit) { 18601 this.props.onSubmit(null, event); 18602 } 18603 break; 18604 } 18605 } 18606 } 18607 selectLink(suggestion) { 18608 this.props.onChange(suggestion.url, suggestion); 18609 this.setState({ 18610 selectedSuggestion: null, 18611 showSuggestions: false 18612 }); 18613 } 18614 handleOnClick(suggestion) { 18615 this.selectLink(suggestion); 18616 this.inputRef.current.focus(); 18617 } 18618 static getDerivedStateFromProps({ 18619 value, 18620 instanceId, 18621 disableSuggestions, 18622 __experimentalShowInitialSuggestions = false 18623 }, { showSuggestions }) { 18624 let shouldShowSuggestions = showSuggestions; 18625 const hasValue = value && value.length; 18626 if (!__experimentalShowInitialSuggestions && !hasValue) { 18627 shouldShowSuggestions = false; 18628 } 18629 if (disableSuggestions === true) { 18630 shouldShowSuggestions = false; 18631 } 18632 return { 18633 showSuggestions: shouldShowSuggestions, 18634 suggestionsListboxId: `block-editor-url-input-suggestions-$instanceId}`, 18635 suggestionOptionIdPrefix: `block-editor-url-input-suggestion-$instanceId}` 18636 }; 18637 } 18638 render() { 18639 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 18640 this.renderControl(), 18641 this.renderSuggestions() 18642 ] }); 18643 } 18644 renderControl() { 18645 const { 18646 label = null, 18647 className, 18648 isFullWidth, 18649 instanceId, 18650 placeholder = (0,external_wp_i18n_namespaceObject.__)("Paste URL or type to search"), 18651 __experimentalRenderControl: renderControl, 18652 value = "", 18653 hideLabelFromVision = false, 18654 help = null, 18655 disabled = false 18656 } = this.props; 18657 const { 18658 loading, 18659 showSuggestions, 18660 selectedSuggestion, 18661 suggestionsListboxId, 18662 suggestionOptionIdPrefix 18663 } = this.state; 18664 const inputId = `url-input-control-$instanceId}`; 18665 const controlProps = { 18666 id: inputId, 18667 // Passes attribute to label for the for attribute 18668 label, 18669 className: dist_clsx("block-editor-url-input", className, { 18670 "is-full-width": isFullWidth 18671 }), 18672 hideLabelFromVision 18673 }; 18674 const inputProps = { 18675 id: inputId, 18676 value, 18677 required: true, 18678 type: "text", 18679 onChange: disabled ? () => { 18680 } : this.onChange, 18681 // Disable onChange when disabled 18682 onFocus: disabled ? () => { 18683 } : this.onFocus, 18684 // Disable onFocus when disabled 18685 placeholder, 18686 onKeyDown: disabled ? () => { 18687 } : this.onKeyDown, 18688 // Disable onKeyDown when disabled 18689 role: "combobox", 18690 "aria-label": label ? void 0 : (0,external_wp_i18n_namespaceObject.__)("URL"), 18691 // Ensure input always has an accessible label 18692 "aria-expanded": showSuggestions, 18693 "aria-autocomplete": "list", 18694 "aria-owns": suggestionsListboxId, 18695 "aria-activedescendant": selectedSuggestion !== null ? `$suggestionOptionIdPrefix}-$selectedSuggestion}` : void 0, 18696 ref: this.inputRef, 18697 disabled, 18698 suffix: this.props.suffix, 18699 help 18700 }; 18701 if (renderControl) { 18702 return renderControl(controlProps, inputProps, loading); 18703 } 18704 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.BaseControl, { __nextHasNoMarginBottom: true, ...controlProps, children: [ 18705 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalInputControl, { ...inputProps, __next40pxDefaultSize: true }), 18706 loading && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {}) 18707 ] }); 18708 } 18709 renderSuggestions() { 18710 const { 18711 className, 18712 __experimentalRenderSuggestions: renderSuggestions 18713 } = this.props; 18714 const { 18715 showSuggestions, 18716 suggestions, 18717 suggestionsValue, 18718 selectedSuggestion, 18719 suggestionsListboxId, 18720 suggestionOptionIdPrefix, 18721 loading 18722 } = this.state; 18723 if (!showSuggestions || suggestions.length === 0) { 18724 return null; 18725 } 18726 const suggestionsListProps = { 18727 id: suggestionsListboxId, 18728 ref: this.autocompleteRef, 18729 role: "listbox" 18730 }; 18731 const buildSuggestionItemProps = (suggestion, index) => { 18732 return { 18733 role: "option", 18734 tabIndex: "-1", 18735 id: `$suggestionOptionIdPrefix}-$index}`, 18736 ref: this.bindSuggestionNode(index), 18737 "aria-selected": index === selectedSuggestion ? true : void 0 18738 }; 18739 }; 18740 if (isFunction(renderSuggestions)) { 18741 return renderSuggestions({ 18742 suggestions, 18743 selectedSuggestion, 18744 suggestionsListProps, 18745 buildSuggestionItemProps, 18746 isLoading: loading, 18747 handleSuggestionClick: this.handleOnClick, 18748 isInitialSuggestions: !suggestionsValue?.length, 18749 currentInputValue: suggestionsValue 18750 }); 18751 } 18752 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Popover, { placement: "bottom", focusOnMount: false, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 18753 "div", 18754 { 18755 ...suggestionsListProps, 18756 className: dist_clsx("block-editor-url-input__suggestions", { 18757 [`$className}__suggestions`]: className 18758 }), 18759 children: suggestions.map((suggestion, index) => /* @__PURE__ */ (0,external_React_.createElement)( 18760 external_wp_components_namespaceObject.Button, 18761 { 18762 __next40pxDefaultSize: true, 18763 ...buildSuggestionItemProps(suggestion, index), 18764 key: suggestion.id, 18765 className: dist_clsx( 18766 "block-editor-url-input__suggestion", 18767 { 18768 "is-selected": index === selectedSuggestion 18769 } 18770 ), 18771 onClick: () => this.handleOnClick(suggestion) 18772 }, 18773 suggestion.title 18774 )) 18775 } 18776 ) }); 18777 } 18778 } 18779 var url_input_default = (0,external_wp_compose_namespaceObject.compose)( 18780 external_wp_compose_namespaceObject.withSafeTimeout, 18781 external_wp_components_namespaceObject.withSpokenMessages, 18782 external_wp_compose_namespaceObject.withInstanceId, 18783 (0,external_wp_data_namespaceObject.withSelect)((select, props) => { 18784 if (isFunction(props.__experimentalFetchLinkSuggestions)) { 18785 return; 18786 } 18787 const { getSettings } = select(store); 18788 return { 18789 __experimentalFetchLinkSuggestions: getSettings().__experimentalFetchLinkSuggestions 18790 }; 18791 }) 18792 )(URLInput); 18793 18794 18795 ;// ./node_modules/@wordpress/icons/build-module/library/plus.js 18796 18797 18798 var plus_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M11 12.5V17.5H12.5V12.5H17.5V11H12.5V6H11V11H6V12.5H11Z" }) }); 18799 18800 18801 ;// ./node_modules/@wordpress/block-editor/build-module/components/link-control/search-create-button.js 18802 18803 18804 18805 18806 18807 const LinkControlSearchCreate = ({ 18808 searchTerm, 18809 onClick, 18810 itemProps, 18811 buttonText 18812 }) => { 18813 if (!searchTerm) { 18814 return null; 18815 } 18816 let text; 18817 if (buttonText) { 18818 text = typeof buttonText === "function" ? buttonText(searchTerm) : buttonText; 18819 } else { 18820 text = (0,external_wp_element_namespaceObject.createInterpolateElement)( 18821 (0,external_wp_i18n_namespaceObject.sprintf)( 18822 /* translators: %s: search term. */ 18823 (0,external_wp_i18n_namespaceObject.__)("Create: <mark>%s</mark>"), 18824 searchTerm 18825 ), 18826 { mark: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("mark", {}) } 18827 ); 18828 } 18829 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 18830 external_wp_components_namespaceObject.MenuItem, 18831 { 18832 ...itemProps, 18833 iconPosition: "left", 18834 icon: plus_default, 18835 className: "block-editor-link-control__search-item", 18836 onClick, 18837 children: text 18838 } 18839 ); 18840 }; 18841 var search_create_button_default = LinkControlSearchCreate; 18842 18843 18844 ;// ./node_modules/@wordpress/icons/build-module/library/post-list.js 18845 18846 18847 var post_list_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M18 5.5H6a.5.5 0 0 0-.5.5v12a.5.5 0 0 0 .5.5h12a.5.5 0 0 0 .5-.5V6a.5.5 0 0 0-.5-.5ZM6 4h12a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2Zm1 5h1.5v1.5H7V9Zm1.5 4.5H7V15h1.5v-1.5ZM10 9h7v1.5h-7V9Zm7 4.5h-7V15h7v-1.5Z" }) }); 18848 18849 18850 ;// ./node_modules/@wordpress/icons/build-module/library/page.js 18851 18852 18853 var page_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: [ 18854 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M15.5 7.5h-7V9h7V7.5Zm-7 3.5h7v1.5h-7V11Zm7 3.5h-7V16h7v-1.5Z" }), 18855 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 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" }) 18856 ] }); 18857 18858 18859 ;// ./node_modules/@wordpress/icons/build-module/library/tag.js 18860 18861 18862 var tag_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 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" }) }); 18863 18864 18865 ;// ./node_modules/@wordpress/icons/build-module/library/category.js 18866 18867 18868 var category_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 18869 external_wp_primitives_namespaceObject.Path, 18870 { 18871 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", 18872 fillRule: "evenodd", 18873 clipRule: "evenodd" 18874 } 18875 ) }); 18876 18877 18878 ;// ./node_modules/@wordpress/icons/build-module/library/file.js 18879 18880 18881 var file_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 18882 external_wp_primitives_namespaceObject.Path, 18883 { 18884 fillRule: "evenodd", 18885 clipRule: "evenodd", 18886 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" 18887 } 18888 ) }); 18889 18890 18891 ;// ./node_modules/@wordpress/icons/build-module/library/globe.js 18892 18893 18894 var globe_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M12 4c-4.4 0-8 3.6-8 8s3.6 8 8 8 8-3.6 8-8-3.6-8-8-8Zm6.5 8c0 .6 0 1.2-.2 1.8h-2.7c0-.6.2-1.1.2-1.8s0-1.2-.2-1.8h2.7c.2.6.2 1.1.2 1.8Zm-.9-3.2h-2.4c-.3-.9-.7-1.8-1.1-2.4-.1-.2-.2-.4-.3-.5 1.6.5 3 1.6 3.8 3ZM12.8 17c-.3.5-.6 1-.8 1.3-.2-.3-.5-.8-.8-1.3-.3-.5-.6-1.1-.8-1.7h3.3c-.2.6-.5 1.2-.8 1.7Zm-2.9-3.2c-.1-.6-.2-1.1-.2-1.8s0-1.2.2-1.8H14c.1.6.2 1.1.2 1.8s0 1.2-.2 1.8H9.9ZM11.2 7c.3-.5.6-1 .8-1.3.2.3.5.8.8 1.3.3.5.6 1.1.8 1.7h-3.3c.2-.6.5-1.2.8-1.7Zm-1-1.2c-.1.2-.2.3-.3.5-.4.7-.8 1.5-1.1 2.4H6.4c.8-1.4 2.2-2.5 3.8-3Zm-1.8 8H5.7c-.2-.6-.2-1.1-.2-1.8s0-1.2.2-1.8h2.7c0 .6-.2 1.1-.2 1.8s0 1.2.2 1.8Zm-2 1.4h2.4c.3.9.7 1.8 1.1 2.4.1.2.2.4.3.5-1.6-.5-3-1.6-3.8-3Zm7.4 3c.1-.2.2-.3.3-.5.4-.7.8-1.5 1.1-2.4h2.4c-.8 1.4-2.2 2.5-3.8 3Z" }) }); 18895 18896 18897 ;// ./node_modules/@wordpress/icons/build-module/library/home.js 18898 18899 18900 var home_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M12 4L4 7.9V20h16V7.9L12 4zm6.5 14.5H14V13h-4v5.5H5.5V8.8L12 5.7l6.5 3.1v9.7z" }) }); 18901 18902 18903 ;// ./node_modules/@wordpress/icons/build-module/library/verse.js 18904 18905 18906 var verse_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 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" }) }); 18907 18908 18909 ;// ./node_modules/@wordpress/block-editor/build-module/components/link-control/search-item.js 18910 18911 18912 18913 18914 18915 18916 18917 18918 const TYPES = { 18919 post: { 18920 icon: post_list_default, 18921 label: (0,external_wp_i18n_namespaceObject.__)("Post") 18922 }, 18923 page: { 18924 icon: page_default, 18925 label: (0,external_wp_i18n_namespaceObject.__)("Page") 18926 }, 18927 post_tag: { 18928 icon: tag_default, 18929 label: (0,external_wp_i18n_namespaceObject.__)("Tag") 18930 }, 18931 category: { 18932 icon: category_default, 18933 label: (0,external_wp_i18n_namespaceObject.__)("Category") 18934 }, 18935 attachment: { 18936 icon: file_default, 18937 label: (0,external_wp_i18n_namespaceObject.__)("Attachment") 18938 } 18939 }; 18940 function SearchItemIcon({ isURL, suggestion }) { 18941 let icon = null; 18942 if (isURL) { 18943 icon = globe_default; 18944 } else if (suggestion.type in TYPES) { 18945 icon = TYPES[suggestion.type].icon; 18946 if (suggestion.type === "page") { 18947 if (suggestion.isFrontPage) { 18948 icon = home_default; 18949 } 18950 if (suggestion.isBlogHome) { 18951 icon = verse_default; 18952 } 18953 } 18954 } 18955 if (icon) { 18956 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 18957 icon_default, 18958 { 18959 className: "block-editor-link-control__search-item-icon", 18960 icon 18961 } 18962 ); 18963 } 18964 return null; 18965 } 18966 function addLeadingSlash(url) { 18967 const trimmedURL = url?.trim(); 18968 if (!trimmedURL?.length) { 18969 return url; 18970 } 18971 return url?.replace(/^\/?/, "/"); 18972 } 18973 function removeTrailingSlash(url) { 18974 const trimmedURL = url?.trim(); 18975 if (!trimmedURL?.length) { 18976 return url; 18977 } 18978 return url?.replace(/\/$/, ""); 18979 } 18980 const partialRight = (fn, ...partialArgs) => (...args) => fn(...args, ...partialArgs); 18981 const defaultTo = (d) => (v) => { 18982 return v === null || v === void 0 || v !== v ? d : v; 18983 }; 18984 function getURLForDisplay(url) { 18985 if (!url) { 18986 return url; 18987 } 18988 return (0,external_wp_compose_namespaceObject.pipe)( 18989 external_wp_url_namespaceObject.safeDecodeURI, 18990 external_wp_url_namespaceObject.getPath, 18991 defaultTo(""), 18992 partialRight(external_wp_url_namespaceObject.filterURLForDisplay, 24), 18993 removeTrailingSlash, 18994 addLeadingSlash 18995 )(url); 18996 } 18997 const LinkControlSearchItem = ({ 18998 itemProps, 18999 suggestion, 19000 searchTerm, 19001 onClick, 19002 isURL = false, 19003 shouldShowType = false 19004 }) => { 19005 const info = isURL ? (0,external_wp_i18n_namespaceObject.__)("Press ENTER to add this link") : getURLForDisplay(suggestion.url); 19006 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 19007 external_wp_components_namespaceObject.MenuItem, 19008 { 19009 ...itemProps, 19010 info, 19011 iconPosition: "left", 19012 icon: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SearchItemIcon, { suggestion, isURL }), 19013 onClick, 19014 shortcut: shouldShowType && getVisualTypeName(suggestion), 19015 className: "block-editor-link-control__search-item", 19016 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 19017 external_wp_components_namespaceObject.TextHighlight, 19018 { 19019 text: (0,external_wp_dom_namespaceObject.__unstableStripHTML)(suggestion.title), 19020 highlight: searchTerm 19021 } 19022 ) 19023 } 19024 ); 19025 }; 19026 function getVisualTypeName(suggestion) { 19027 if (suggestion.isFrontPage) { 19028 return (0,external_wp_i18n_namespaceObject.__)("Front page"); 19029 } 19030 if (suggestion.isBlogHome) { 19031 return (0,external_wp_i18n_namespaceObject.__)("Blog home"); 19032 } 19033 if (suggestion.type in TYPES) { 19034 return TYPES[suggestion.type].label; 19035 } 19036 return suggestion.type; 19037 } 19038 var search_item_default = LinkControlSearchItem; 19039 const __experimentalLinkControlSearchItem = (props) => { 19040 external_wp_deprecated_default()("wp.blockEditor.__experimentalLinkControlSearchItem", { 19041 since: "6.8" 19042 }); 19043 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(LinkControlSearchItem, { ...props }); 19044 }; 19045 19046 19047 ;// ./node_modules/@wordpress/block-editor/build-module/components/link-control/constants.js 19048 19049 const CREATE_TYPE = "__CREATE__"; 19050 const TEL_TYPE = "tel"; 19051 const URL_TYPE = "link"; 19052 const MAILTO_TYPE = "mailto"; 19053 const INTERNAL_TYPE = "internal"; 19054 const LINK_ENTRY_TYPES = [ 19055 URL_TYPE, 19056 MAILTO_TYPE, 19057 TEL_TYPE, 19058 INTERNAL_TYPE 19059 ]; 19060 const DEFAULT_LINK_SETTINGS = [ 19061 { 19062 id: "opensInNewTab", 19063 title: (0,external_wp_i18n_namespaceObject.__)("Open in new tab") 19064 } 19065 ]; 19066 19067 19068 ;// ./node_modules/@wordpress/block-editor/build-module/components/link-control/search-results.js 19069 19070 19071 19072 19073 19074 19075 19076 19077 function LinkControlSearchResults({ 19078 withCreateSuggestion, 19079 currentInputValue, 19080 handleSuggestionClick, 19081 suggestionsListProps, 19082 buildSuggestionItemProps, 19083 suggestions, 19084 selectedSuggestion, 19085 isLoading, 19086 isInitialSuggestions, 19087 createSuggestionButtonText, 19088 suggestionsQuery 19089 }) { 19090 const resultsListClasses = dist_clsx( 19091 "block-editor-link-control__search-results", 19092 { 19093 "is-loading": isLoading 19094 } 19095 ); 19096 const isSingleDirectEntryResult = suggestions.length === 1 && LINK_ENTRY_TYPES.includes(suggestions[0].type); 19097 const shouldShowCreateSuggestion = withCreateSuggestion && !isSingleDirectEntryResult && !isInitialSuggestions; 19098 const shouldShowSuggestionsTypes = !suggestionsQuery?.type; 19099 const labelText = isInitialSuggestions ? (0,external_wp_i18n_namespaceObject.__)("Suggestions") : (0,external_wp_i18n_namespaceObject.sprintf)( 19100 /* translators: %s: search term. */ 19101 (0,external_wp_i18n_namespaceObject.__)('Search results for "%s"'), 19102 currentInputValue 19103 ); 19104 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-link-control__search-results-wrapper", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 19105 "div", 19106 { 19107 ...suggestionsListProps, 19108 className: resultsListClasses, 19109 "aria-label": labelText, 19110 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuGroup, { children: suggestions.map((suggestion, index) => { 19111 if (shouldShowCreateSuggestion && CREATE_TYPE === suggestion.type) { 19112 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 19113 search_create_button_default, 19114 { 19115 searchTerm: currentInputValue, 19116 buttonText: createSuggestionButtonText, 19117 onClick: () => handleSuggestionClick(suggestion), 19118 itemProps: buildSuggestionItemProps( 19119 suggestion, 19120 index 19121 ), 19122 isSelected: index === selectedSuggestion 19123 }, 19124 suggestion.type 19125 ); 19126 } 19127 if (CREATE_TYPE === suggestion.type) { 19128 return null; 19129 } 19130 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 19131 search_item_default, 19132 { 19133 itemProps: buildSuggestionItemProps( 19134 suggestion, 19135 index 19136 ), 19137 suggestion, 19138 index, 19139 onClick: () => { 19140 handleSuggestionClick(suggestion); 19141 }, 19142 isSelected: index === selectedSuggestion, 19143 isURL: LINK_ENTRY_TYPES.includes( 19144 suggestion.type 19145 ), 19146 searchTerm: currentInputValue, 19147 shouldShowType: shouldShowSuggestionsTypes, 19148 isFrontPage: suggestion?.isFrontPage, 19149 isBlogHome: suggestion?.isBlogHome 19150 }, 19151 `$suggestion.id}-$suggestion.type}` 19152 ); 19153 }) }) 19154 } 19155 ) }); 19156 } 19157 var search_results_default = LinkControlSearchResults; 19158 const __experimentalLinkControlSearchResults = (props) => { 19159 external_wp_deprecated_default()("wp.blockEditor.__experimentalLinkControlSearchResults", { 19160 since: "6.8" 19161 }); 19162 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(LinkControlSearchResults, { ...props }); 19163 }; 19164 19165 19166 ;// ./node_modules/@wordpress/block-editor/build-module/components/link-control/is-url-like.js 19167 19168 function isURLLike(val) { 19169 const hasSpaces = val.includes(" "); 19170 if (hasSpaces) { 19171 return false; 19172 } 19173 const protocol = (0,external_wp_url_namespaceObject.getProtocol)(val); 19174 const protocolIsValid = (0,external_wp_url_namespaceObject.isValidProtocol)(protocol); 19175 const mayBeTLD = hasPossibleTLD(val); 19176 const isWWW = val?.startsWith("www."); 19177 const isInternal = val?.startsWith("#") && (0,external_wp_url_namespaceObject.isValidFragment)(val); 19178 return protocolIsValid || isWWW || isInternal || mayBeTLD; 19179 } 19180 function hasPossibleTLD(url, maxLength = 6) { 19181 const cleanedURL = url.split(/[?#]/)[0]; 19182 const regex = new RegExp( 19183 `(?<=\\S)\\.(?:[a-zA-Z_]{2,$maxLength}})(?:\\/|$)` 19184 ); 19185 return regex.test(cleanedURL); 19186 } 19187 19188 19189 ;// ./node_modules/@wordpress/block-editor/build-module/components/link-control/use-search-handler.js 19190 19191 19192 19193 19194 19195 19196 const handleNoop = () => Promise.resolve([]); 19197 const handleDirectEntry = (val) => { 19198 let type = URL_TYPE; 19199 const protocol = (0,external_wp_url_namespaceObject.getProtocol)(val) || ""; 19200 if (protocol.includes("mailto")) { 19201 type = MAILTO_TYPE; 19202 } 19203 if (protocol.includes("tel")) { 19204 type = TEL_TYPE; 19205 } 19206 if (val?.startsWith("#")) { 19207 type = INTERNAL_TYPE; 19208 } 19209 return Promise.resolve([ 19210 { 19211 id: val, 19212 title: val, 19213 url: type === "URL" ? (0,external_wp_url_namespaceObject.prependHTTP)(val) : val, 19214 type 19215 } 19216 ]); 19217 }; 19218 const handleEntitySearch = async (val, suggestionsQuery, fetchSearchSuggestions, withCreateSuggestion, pageOnFront, pageForPosts) => { 19219 const { isInitialSuggestions } = suggestionsQuery; 19220 const results = await fetchSearchSuggestions(val, suggestionsQuery); 19221 results.map((result) => { 19222 if (Number(result.id) === pageOnFront) { 19223 result.isFrontPage = true; 19224 return result; 19225 } else if (Number(result.id) === pageForPosts) { 19226 result.isBlogHome = true; 19227 return result; 19228 } 19229 return result; 19230 }); 19231 if (isInitialSuggestions) { 19232 return results; 19233 } 19234 return isURLLike(val) || !withCreateSuggestion ? results : results.concat({ 19235 // the `id` prop is intentionally omitted here because it 19236 // is never exposed as part of the component's public API. 19237 // see: https://github.com/WordPress/gutenberg/pull/19775#discussion_r378931316. 19238 title: val, 19239 // Must match the existing `<input>`s text value. 19240 url: val, 19241 // Must match the existing `<input>`s text value. 19242 type: CREATE_TYPE 19243 }); 19244 }; 19245 function useSearchHandler(suggestionsQuery, allowDirectEntry, withCreateSuggestion) { 19246 const { fetchSearchSuggestions, pageOnFront, pageForPosts } = (0,external_wp_data_namespaceObject.useSelect)( 19247 (select) => { 19248 const { getSettings } = select(store); 19249 return { 19250 pageOnFront: getSettings().pageOnFront, 19251 pageForPosts: getSettings().pageForPosts, 19252 fetchSearchSuggestions: getSettings().__experimentalFetchLinkSuggestions 19253 }; 19254 }, 19255 [] 19256 ); 19257 const directEntryHandler = allowDirectEntry ? handleDirectEntry : handleNoop; 19258 return (0,external_wp_element_namespaceObject.useCallback)( 19259 (val, { isInitialSuggestions }) => { 19260 return isURLLike(val) ? directEntryHandler(val, { isInitialSuggestions }) : handleEntitySearch( 19261 val, 19262 { ...suggestionsQuery, isInitialSuggestions }, 19263 fetchSearchSuggestions, 19264 withCreateSuggestion, 19265 pageOnFront, 19266 pageForPosts 19267 ); 19268 }, 19269 [ 19270 directEntryHandler, 19271 fetchSearchSuggestions, 19272 pageOnFront, 19273 pageForPosts, 19274 suggestionsQuery, 19275 withCreateSuggestion 19276 ] 19277 ); 19278 } 19279 19280 19281 ;// ./node_modules/@wordpress/block-editor/build-module/components/link-control/search-input.js 19282 19283 19284 19285 19286 19287 19288 19289 19290 const noopSearchHandler = () => Promise.resolve([]); 19291 const noop = () => { 19292 }; 19293 const LinkControlSearchInput = (0,external_wp_element_namespaceObject.forwardRef)( 19294 ({ 19295 value, 19296 children, 19297 currentLink = {}, 19298 className = null, 19299 placeholder = null, 19300 withCreateSuggestion = false, 19301 onCreateSuggestion = noop, 19302 onChange = noop, 19303 onSelect = noop, 19304 showSuggestions = true, 19305 renderSuggestions = (props) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(search_results_default, { ...props }), 19306 fetchSuggestions = null, 19307 allowDirectEntry = true, 19308 showInitialSuggestions = false, 19309 suggestionsQuery = {}, 19310 withURLSuggestion = true, 19311 createSuggestionButtonText, 19312 hideLabelFromVision = false, 19313 suffix, 19314 isEntity = false 19315 }, ref) => { 19316 const genericSearchHandler = useSearchHandler( 19317 suggestionsQuery, 19318 allowDirectEntry, 19319 withCreateSuggestion, 19320 withURLSuggestion 19321 ); 19322 const searchHandler = showSuggestions ? fetchSuggestions || genericSearchHandler : noopSearchHandler; 19323 const [focusedSuggestion, setFocusedSuggestion] = (0,external_wp_element_namespaceObject.useState)(); 19324 const onInputChange = (selection, suggestion) => { 19325 onChange(selection); 19326 setFocusedSuggestion(suggestion); 19327 }; 19328 const handleRenderSuggestions = (props) => renderSuggestions({ 19329 ...props, 19330 withCreateSuggestion, 19331 createSuggestionButtonText, 19332 suggestionsQuery, 19333 handleSuggestionClick: (suggestion) => { 19334 if (props.handleSuggestionClick) { 19335 props.handleSuggestionClick(suggestion); 19336 } 19337 onSuggestionSelected(suggestion); 19338 } 19339 }); 19340 const onSuggestionSelected = async (selectedSuggestion) => { 19341 let suggestion = selectedSuggestion; 19342 if (CREATE_TYPE === selectedSuggestion.type) { 19343 try { 19344 suggestion = await onCreateSuggestion( 19345 selectedSuggestion.title 19346 ); 19347 if (suggestion?.url) { 19348 onSelect(suggestion); 19349 } 19350 } catch (e) { 19351 } 19352 return; 19353 } 19354 if (allowDirectEntry || suggestion && Object.keys(suggestion).length >= 1) { 19355 const { id, url, ...restLinkProps } = currentLink ?? {}; 19356 onSelect( 19357 // Some direct entries don't have types or IDs, and we still need to clear the previous ones. 19358 { ...restLinkProps, ...suggestion }, 19359 suggestion 19360 ); 19361 } 19362 }; 19363 const _placeholder = placeholder ?? (0,external_wp_i18n_namespaceObject.__)("Search or type URL"); 19364 const label = hideLabelFromVision && placeholder !== "" ? _placeholder : (0,external_wp_i18n_namespaceObject.__)("Link"); 19365 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-editor-link-control__search-input-container", children: [ 19366 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 19367 url_input_default, 19368 { 19369 disableSuggestions: currentLink?.url === value, 19370 label, 19371 hideLabelFromVision, 19372 className, 19373 value, 19374 onChange: onInputChange, 19375 placeholder: _placeholder, 19376 __experimentalRenderSuggestions: showSuggestions ? handleRenderSuggestions : null, 19377 __experimentalFetchLinkSuggestions: searchHandler, 19378 __experimentalHandleURLSuggestions: true, 19379 __experimentalShowInitialSuggestions: showInitialSuggestions, 19380 onSubmit: (suggestion, event) => { 19381 const hasSuggestion = suggestion || focusedSuggestion; 19382 if (!hasSuggestion && !value?.trim()?.length) { 19383 event.preventDefault(); 19384 } else { 19385 onSuggestionSelected( 19386 hasSuggestion || { url: value } 19387 ); 19388 } 19389 }, 19390 inputRef: ref, 19391 suffix, 19392 disabled: isEntity 19393 } 19394 ), 19395 children 19396 ] }); 19397 } 19398 ); 19399 var search_input_default = LinkControlSearchInput; 19400 const __experimentalLinkControlSearchInput = (props) => { 19401 external_wp_deprecated_default()("wp.blockEditor.__experimentalLinkControlSearchInput", { 19402 since: "6.8" 19403 }); 19404 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(LinkControlSearchInput, { ...props }); 19405 }; 19406 19407 19408 ;// ./node_modules/@wordpress/icons/build-module/library/info.js 19409 19410 19411 var info_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 19412 external_wp_primitives_namespaceObject.Path, 19413 { 19414 fillRule: "evenodd", 19415 clipRule: "evenodd", 19416 d: "M5.5 12a6.5 6.5 0 1 0 13 0 6.5 6.5 0 0 0-13 0ZM12 4a8 8 0 1 0 0 16 8 8 0 0 0 0-16Zm.75 4v1.5h-1.5V8h1.5Zm0 8v-5h-1.5v5h1.5Z" 19417 } 19418 ) }); 19419 19420 19421 ;// ./node_modules/@wordpress/icons/build-module/library/pencil.js 19422 19423 19424 var pencil_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "m19 7-3-3-8.5 8.5-1 4 4-1L19 7Zm-7 11.5H5V20h7v-1.5Z" }) }); 19425 19426 19427 ;// ./node_modules/@wordpress/icons/build-module/library/copy-small.js 19428 19429 19430 var copy_small_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 19431 external_wp_primitives_namespaceObject.Path, 19432 { 19433 fillRule: "evenodd", 19434 clipRule: "evenodd", 19435 d: "M5.625 5.5h9.75c.069 0 .125.056.125.125v9.75a.125.125 0 0 1-.125.125h-9.75a.125.125 0 0 1-.125-.125v-9.75c0-.069.056-.125.125-.125ZM4 5.625C4 4.728 4.728 4 5.625 4h9.75C16.273 4 17 4.728 17 5.625v9.75c0 .898-.727 1.625-1.625 1.625h-9.75A1.625 1.625 0 0 1 4 15.375v-9.75Zm14.5 11.656v-9H20v9C20 18.8 18.77 20 17.251 20H6.25v-1.5h11.001c.69 0 1.249-.528 1.249-1.219Z" 19436 } 19437 ) }); 19438 19439 19440 ;// ./node_modules/@wordpress/block-editor/build-module/components/link-control/viewer-slot.js 19441 19442 const { Slot: ViewerSlot, Fill: ViewerFill } = (0,external_wp_components_namespaceObject.createSlotFill)( 19443 "BlockEditorLinkControlViewer" 19444 ); 19445 var viewer_slot_default = (/* unused pure expression or super */ null && (ViewerSlot)); 19446 19447 19448 ;// ./node_modules/@wordpress/block-editor/build-module/components/link-control/use-rich-url-data.js 19449 19450 19451 19452 function reducer(state, action) { 19453 switch (action.type) { 19454 case "RESOLVED": 19455 return { 19456 ...state, 19457 isFetching: false, 19458 richData: action.richData 19459 }; 19460 case "ERROR": 19461 return { 19462 ...state, 19463 isFetching: false, 19464 richData: null 19465 }; 19466 case "LOADING": 19467 return { 19468 ...state, 19469 isFetching: true 19470 }; 19471 default: 19472 throw new Error(`Unexpected action type $action.type}`); 19473 } 19474 } 19475 function useRemoteUrlData(url) { 19476 const [state, dispatch] = (0,external_wp_element_namespaceObject.useReducer)(reducer, { 19477 richData: null, 19478 isFetching: false 19479 }); 19480 const { fetchRichUrlData } = (0,external_wp_data_namespaceObject.useSelect)((select) => { 19481 const { getSettings } = select(store); 19482 return { 19483 fetchRichUrlData: getSettings().__experimentalFetchRichUrlData 19484 }; 19485 }, []); 19486 (0,external_wp_element_namespaceObject.useEffect)(() => { 19487 if (url?.length && fetchRichUrlData && typeof AbortController !== "undefined") { 19488 dispatch({ 19489 type: "LOADING" 19490 }); 19491 const controller = new window.AbortController(); 19492 const signal = controller.signal; 19493 fetchRichUrlData(url, { 19494 signal 19495 }).then((urlData) => { 19496 dispatch({ 19497 type: "RESOLVED", 19498 richData: urlData 19499 }); 19500 }).catch(() => { 19501 if (!signal.aborted) { 19502 dispatch({ 19503 type: "ERROR" 19504 }); 19505 } 19506 }); 19507 return () => { 19508 controller.abort(); 19509 }; 19510 } 19511 }, [url]); 19512 return state; 19513 } 19514 var use_rich_url_data_default = useRemoteUrlData; 19515 19516 19517 ;// ./node_modules/@wordpress/block-editor/build-module/components/link-control/link-preview.js 19518 19519 19520 19521 19522 19523 19524 19525 19526 19527 19528 19529 19530 19531 function filterTitleForDisplay(title) { 19532 return title.replace(/^[a-z\-.\+]+[0-9]*:(\/\/)?/i, "").replace(/^www\./i, ""); 19533 } 19534 function LinkPreview({ 19535 value, 19536 onEditClick, 19537 hasRichPreviews = false, 19538 hasUnlinkControl = false, 19539 onRemove 19540 }) { 19541 const showIconLabels = (0,external_wp_data_namespaceObject.useSelect)( 19542 (select) => select(external_wp_preferences_namespaceObject.store).get("core", "showIconLabels"), 19543 [] 19544 ); 19545 const showRichPreviews = hasRichPreviews ? value?.url : null; 19546 const { richData, isFetching } = use_rich_url_data_default(showRichPreviews); 19547 const hasRichData = richData && Object.keys(richData).length; 19548 const displayURL = value && (0,external_wp_url_namespaceObject.filterURLForDisplay)((0,external_wp_url_namespaceObject.safeDecodeURI)(value.url), 24) || ""; 19549 const isEmptyURL = !value?.url?.length; 19550 const displayTitle = !isEmptyURL && (0,external_wp_dom_namespaceObject.__unstableStripHTML)(richData?.title || value?.title || displayURL); 19551 const isUrlRedundant = !value?.url || filterTitleForDisplay(displayTitle) === displayURL; 19552 let icon; 19553 if (richData?.icon) { 19554 icon = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("img", { src: richData?.icon, alt: "" }); 19555 } else if (isEmptyURL) { 19556 icon = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(icon_default, { icon: info_default, size: 32 }); 19557 } else { 19558 icon = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(icon_default, { icon: globe_default }); 19559 } 19560 const { createNotice } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); 19561 const ref = (0,external_wp_compose_namespaceObject.useCopyToClipboard)(value.url, () => { 19562 createNotice("info", (0,external_wp_i18n_namespaceObject.__)("Link copied to clipboard."), { 19563 isDismissible: true, 19564 type: "snackbar" 19565 }); 19566 }); 19567 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 19568 "div", 19569 { 19570 role: "group", 19571 "aria-label": (0,external_wp_i18n_namespaceObject.__)("Manage link"), 19572 className: dist_clsx("block-editor-link-control__search-item", { 19573 "is-current": true, 19574 "is-rich": hasRichData, 19575 "is-fetching": !!isFetching, 19576 "is-preview": true, 19577 "is-error": isEmptyURL, 19578 "is-url-title": displayTitle === displayURL 19579 }), 19580 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-editor-link-control__search-item-top", children: [ 19581 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 19582 "span", 19583 { 19584 className: "block-editor-link-control__search-item-header", 19585 role: "figure", 19586 "aria-label": ( 19587 /* translators: Accessibility text for the link preview when editing a link. */ 19588 (0,external_wp_i18n_namespaceObject.__)("Link information") 19589 ), 19590 children: [ 19591 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 19592 "span", 19593 { 19594 className: dist_clsx( 19595 "block-editor-link-control__search-item-icon", 19596 { 19597 "is-image": richData?.icon 19598 } 19599 ), 19600 children: icon 19601 } 19602 ), 19603 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "block-editor-link-control__search-item-details", children: !isEmptyURL ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 19604 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 19605 external_wp_components_namespaceObject.ExternalLink, 19606 { 19607 className: "block-editor-link-control__search-item-title", 19608 href: value.url, 19609 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalTruncate, { numberOfLines: 1, children: displayTitle }) 19610 } 19611 ), 19612 !isUrlRedundant && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "block-editor-link-control__search-item-info", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalTruncate, { numberOfLines: 1, children: displayURL }) }) 19613 ] }) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "block-editor-link-control__search-item-error-notice", children: (0,external_wp_i18n_namespaceObject.__)("Link is empty") }) }) 19614 ] 19615 } 19616 ), 19617 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 19618 external_wp_components_namespaceObject.Button, 19619 { 19620 icon: pencil_default, 19621 label: (0,external_wp_i18n_namespaceObject.__)("Edit link"), 19622 onClick: onEditClick, 19623 size: "compact", 19624 showTooltip: !showIconLabels 19625 } 19626 ), 19627 hasUnlinkControl && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 19628 external_wp_components_namespaceObject.Button, 19629 { 19630 icon: link_off_default, 19631 label: (0,external_wp_i18n_namespaceObject.__)("Remove link"), 19632 onClick: onRemove, 19633 size: "compact", 19634 showTooltip: !showIconLabels 19635 } 19636 ), 19637 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 19638 external_wp_components_namespaceObject.Button, 19639 { 19640 icon: copy_small_default, 19641 label: (0,external_wp_i18n_namespaceObject.__)("Copy link"), 19642 ref, 19643 accessibleWhenDisabled: true, 19644 disabled: isEmptyURL, 19645 size: "compact", 19646 showTooltip: !showIconLabels 19647 } 19648 ), 19649 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ViewerSlot, { fillProps: value }) 19650 ] }) 19651 } 19652 ); 19653 } 19654 19655 19656 ;// ./node_modules/@wordpress/block-editor/build-module/components/link-control/settings.js 19657 19658 19659 19660 const settings_noop = () => { 19661 }; 19662 const LinkControlSettings = ({ value, onChange = settings_noop, settings }) => { 19663 if (!settings || !settings.length) { 19664 return null; 19665 } 19666 const handleSettingChange = (setting) => (newValue) => { 19667 onChange({ 19668 ...value, 19669 [setting.id]: newValue 19670 }); 19671 }; 19672 const theSettings = settings.map((setting) => { 19673 if ("render" in setting) { 19674 if (typeof setting.render === "function") { 19675 const renderedContent = setting.render( 19676 setting, 19677 value, 19678 onChange 19679 ); 19680 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 19681 "div", 19682 { 19683 className: "block-editor-link-control__setting", 19684 children: renderedContent 19685 }, 19686 setting.id 19687 ); 19688 } 19689 return null; 19690 } 19691 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 19692 external_wp_components_namespaceObject.CheckboxControl, 19693 { 19694 __nextHasNoMarginBottom: true, 19695 className: "block-editor-link-control__setting", 19696 label: setting.title, 19697 onChange: handleSettingChange(setting), 19698 checked: value ? !!value[setting.id] : false, 19699 help: setting?.help 19700 }, 19701 setting.id 19702 ); 19703 }).filter(Boolean); 19704 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("fieldset", { className: "block-editor-link-control__settings", children: [ 19705 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, { as: "legend", children: (0,external_wp_i18n_namespaceObject.__)("Currently selected link settings") }), 19706 theSettings 19707 ] }); 19708 }; 19709 var settings_default = LinkControlSettings; 19710 19711 19712 ;// ./node_modules/@wordpress/block-editor/build-module/components/link-control/use-create-page.js 19713 19714 19715 function useCreatePage(handleCreatePage) { 19716 const cancelableCreateSuggestion = (0,external_wp_element_namespaceObject.useRef)(); 19717 const [isCreatingPage, setIsCreatingPage] = (0,external_wp_element_namespaceObject.useState)(false); 19718 const [errorMessage, setErrorMessage] = (0,external_wp_element_namespaceObject.useState)(null); 19719 const createPage = async function(suggestionTitle) { 19720 setIsCreatingPage(true); 19721 setErrorMessage(null); 19722 try { 19723 cancelableCreateSuggestion.current = makeCancelable( 19724 // Using Promise.resolve to allow createSuggestion to return a 19725 // non-Promise based value. 19726 Promise.resolve(handleCreatePage(suggestionTitle)) 19727 ); 19728 return await cancelableCreateSuggestion.current.promise; 19729 } catch (error) { 19730 if (error && error.isCanceled) { 19731 return; 19732 } 19733 setErrorMessage( 19734 error.message || (0,external_wp_i18n_namespaceObject.__)( 19735 "An unknown error occurred during creation. Please try again." 19736 ) 19737 ); 19738 throw error; 19739 } finally { 19740 setIsCreatingPage(false); 19741 } 19742 }; 19743 (0,external_wp_element_namespaceObject.useEffect)(() => { 19744 return () => { 19745 if (cancelableCreateSuggestion.current) { 19746 cancelableCreateSuggestion.current.cancel(); 19747 } 19748 }; 19749 }, []); 19750 return { 19751 createPage, 19752 isCreatingPage, 19753 errorMessage 19754 }; 19755 } 19756 const makeCancelable = (promise) => { 19757 let hasCanceled_ = false; 19758 const wrappedPromise = new Promise((resolve, reject) => { 19759 promise.then( 19760 (val) => hasCanceled_ ? reject({ isCanceled: true }) : resolve(val), 19761 (error) => hasCanceled_ ? reject({ isCanceled: true }) : reject(error) 19762 ); 19763 }); 19764 return { 19765 promise: wrappedPromise, 19766 cancel() { 19767 hasCanceled_ = true; 19768 } 19769 }; 19770 }; 19771 19772 19773 // EXTERNAL MODULE: ./node_modules/fast-deep-equal/index.js 19774 var fast_deep_equal = __webpack_require__(5215); 19775 var fast_deep_equal_default = /*#__PURE__*/__webpack_require__.n(fast_deep_equal); 19776 ;// ./node_modules/@wordpress/block-editor/build-module/components/link-control/use-internal-value.js 19777 19778 19779 function useInternalValue(value) { 19780 const [internalValue, setInternalValue] = (0,external_wp_element_namespaceObject.useState)(value || {}); 19781 const [previousValue, setPreviousValue] = (0,external_wp_element_namespaceObject.useState)(value); 19782 if (!fast_deep_equal_default()(value, previousValue)) { 19783 setPreviousValue(value); 19784 setInternalValue(value); 19785 } 19786 const setInternalURLInputValue = (nextValue) => { 19787 setInternalValue({ 19788 ...internalValue, 19789 url: nextValue 19790 }); 19791 }; 19792 const setInternalTextInputValue = (nextValue) => { 19793 setInternalValue({ 19794 ...internalValue, 19795 title: nextValue 19796 }); 19797 }; 19798 const createSetInternalSettingValueHandler = (settingsKeys) => (nextValue) => { 19799 const settingsUpdates = Object.keys(nextValue).reduce( 19800 (acc, key) => { 19801 if (settingsKeys.includes(key)) { 19802 acc[key] = nextValue[key]; 19803 } 19804 return acc; 19805 }, 19806 {} 19807 ); 19808 setInternalValue({ 19809 ...internalValue, 19810 ...settingsUpdates 19811 }); 19812 }; 19813 return [ 19814 internalValue, 19815 setInternalValue, 19816 setInternalURLInputValue, 19817 setInternalTextInputValue, 19818 createSetInternalSettingValueHandler 19819 ]; 19820 } 19821 19822 19823 ;// ./node_modules/@wordpress/block-editor/build-module/components/link-control/index.js 19824 19825 19826 19827 19828 19829 19830 19831 19832 19833 19834 19835 19836 19837 19838 19839 19840 19841 19842 19843 19844 19845 const link_control_noop = () => { 19846 }; 19847 const PREFERENCE_SCOPE = "core/block-editor"; 19848 const PREFERENCE_KEY = "linkControlSettingsDrawer"; 19849 function LinkControl({ 19850 searchInputPlaceholder, 19851 value, 19852 settings = DEFAULT_LINK_SETTINGS, 19853 onChange = link_control_noop, 19854 onRemove, 19855 onCancel, 19856 noDirectEntry = false, 19857 showSuggestions = true, 19858 showInitialSuggestions, 19859 forceIsEditingLink, 19860 createSuggestion, 19861 withCreateSuggestion, 19862 inputValue: propInputValue = "", 19863 suggestionsQuery = {}, 19864 noURLSuggestion = false, 19865 createSuggestionButtonText, 19866 hasRichPreviews = false, 19867 hasTextControl = false, 19868 renderControlBottom = null, 19869 handleEntities = false 19870 }) { 19871 if (withCreateSuggestion === void 0 && createSuggestion) { 19872 withCreateSuggestion = true; 19873 } 19874 const [settingsOpen, setSettingsOpen] = (0,external_wp_element_namespaceObject.useState)(false); 19875 const { advancedSettingsPreference } = (0,external_wp_data_namespaceObject.useSelect)((select) => { 19876 const prefsStore = select(external_wp_preferences_namespaceObject.store); 19877 return { 19878 advancedSettingsPreference: prefsStore.get(PREFERENCE_SCOPE, PREFERENCE_KEY) ?? false 19879 }; 19880 }, []); 19881 const { set: setPreference } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_preferences_namespaceObject.store); 19882 const setSettingsOpenWithPreference = (prefVal) => { 19883 if (setPreference) { 19884 setPreference(PREFERENCE_SCOPE, PREFERENCE_KEY, prefVal); 19885 } 19886 setSettingsOpen(prefVal); 19887 }; 19888 const isSettingsOpen = advancedSettingsPreference || settingsOpen; 19889 const isMountingRef = (0,external_wp_element_namespaceObject.useRef)(true); 19890 const wrapperNode = (0,external_wp_element_namespaceObject.useRef)(); 19891 const textInputRef = (0,external_wp_element_namespaceObject.useRef)(); 19892 const searchInputRef = (0,external_wp_element_namespaceObject.useRef)(); 19893 const isEndingEditWithFocusRef = (0,external_wp_element_namespaceObject.useRef)(false); 19894 const settingsKeys = settings.map(({ id }) => id); 19895 const [ 19896 internalControlValue, 19897 setInternalControlValue, 19898 setInternalURLInputValue, 19899 setInternalTextInputValue, 19900 createSetInternalSettingValueHandler 19901 ] = useInternalValue(value); 19902 const isEntity = handleEntities && !!internalControlValue?.id; 19903 const baseId = (0,external_wp_compose_namespaceObject.useInstanceId)(LinkControl, "link-control"); 19904 const helpTextId = isEntity ? `$baseId}__help` : null; 19905 const valueHasChanges = value && !(0,external_wp_isShallowEqual_namespaceObject.isShallowEqualObjects)(internalControlValue, value); 19906 const [isEditingLink, setIsEditingLink] = (0,external_wp_element_namespaceObject.useState)( 19907 forceIsEditingLink !== void 0 ? forceIsEditingLink : !value || !value.url 19908 ); 19909 const { createPage, isCreatingPage, errorMessage } = useCreatePage(createSuggestion); 19910 (0,external_wp_element_namespaceObject.useEffect)(() => { 19911 if (forceIsEditingLink === void 0) { 19912 return; 19913 } 19914 setIsEditingLink(forceIsEditingLink); 19915 }, [forceIsEditingLink]); 19916 (0,external_wp_element_namespaceObject.useEffect)(() => { 19917 if (isMountingRef.current) { 19918 return; 19919 } 19920 const nextFocusTarget = external_wp_dom_namespaceObject.focus.focusable.find(wrapperNode.current)[0] || wrapperNode.current; 19921 nextFocusTarget.focus(); 19922 isEndingEditWithFocusRef.current = false; 19923 }, [isEditingLink, isCreatingPage]); 19924 (0,external_wp_element_namespaceObject.useEffect)(() => { 19925 isMountingRef.current = false; 19926 return () => { 19927 isMountingRef.current = true; 19928 }; 19929 }, []); 19930 const hasLinkValue = value?.url?.trim()?.length > 0; 19931 const stopEditing = () => { 19932 isEndingEditWithFocusRef.current = !!wrapperNode.current?.contains( 19933 wrapperNode.current.ownerDocument.activeElement 19934 ); 19935 setIsEditingLink(false); 19936 }; 19937 const handleSelectSuggestion = (updatedValue) => { 19938 const nonSettingsChanges = Object.keys(updatedValue).reduce( 19939 (acc, key) => { 19940 if (!settingsKeys.includes(key)) { 19941 acc[key] = updatedValue[key]; 19942 } 19943 return acc; 19944 }, 19945 {} 19946 ); 19947 onChange({ 19948 ...internalControlValue, 19949 ...nonSettingsChanges, 19950 // As title is not a setting, it must be manually applied 19951 // in such a way as to preserve the users changes over 19952 // any "title" value provided by the "suggestion". 19953 title: internalControlValue?.title || updatedValue?.title 19954 }); 19955 stopEditing(); 19956 }; 19957 const handleSubmit = () => { 19958 if (valueHasChanges) { 19959 onChange({ 19960 ...value, 19961 ...internalControlValue, 19962 url: currentUrlInputValue 19963 }); 19964 } 19965 stopEditing(); 19966 }; 19967 const handleSubmitWithEnter = (event) => { 19968 const { keyCode } = event; 19969 if (keyCode === external_wp_keycodes_namespaceObject.ENTER && !currentInputIsEmpty) { 19970 event.preventDefault(); 19971 handleSubmit(); 19972 } 19973 }; 19974 const resetInternalValues = () => { 19975 setInternalControlValue(value); 19976 }; 19977 const handleCancel = (event) => { 19978 event.preventDefault(); 19979 event.stopPropagation(); 19980 resetInternalValues(); 19981 if (hasLinkValue) { 19982 stopEditing(); 19983 } else { 19984 onRemove?.(); 19985 } 19986 onCancel?.(); 19987 }; 19988 const [shouldFocusSearchInput, setShouldFocusSearchInput] = (0,external_wp_element_namespaceObject.useState)(false); 19989 const handleUnlink = () => { 19990 const { id, kind, type, ...restValue } = internalControlValue; 19991 setInternalControlValue({ 19992 ...restValue, 19993 id: void 0, 19994 kind: void 0, 19995 type: void 0, 19996 url: void 0 19997 }); 19998 setShouldFocusSearchInput(true); 19999 }; 20000 (0,external_wp_element_namespaceObject.useEffect)(() => { 20001 if (shouldFocusSearchInput) { 20002 searchInputRef.current?.focus(); 20003 setShouldFocusSearchInput(false); 20004 } 20005 }, [shouldFocusSearchInput]); 20006 const currentUrlInputValue = propInputValue || internalControlValue?.url || ""; 20007 const currentInputIsEmpty = !currentUrlInputValue?.trim()?.length; 20008 const shownUnlinkControl = onRemove && value && !isEditingLink && !isCreatingPage; 20009 const showActions = isEditingLink && hasLinkValue; 20010 const showTextControl = hasLinkValue && hasTextControl; 20011 const isEditing = (isEditingLink || !value) && !isCreatingPage; 20012 const isDisabled = !valueHasChanges || currentInputIsEmpty; 20013 const showSettings = !!settings?.length && isEditingLink && hasLinkValue; 20014 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 20015 "div", 20016 { 20017 tabIndex: -1, 20018 ref: wrapperNode, 20019 className: "block-editor-link-control", 20020 children: [ 20021 isCreatingPage && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-editor-link-control__loading", children: [ 20022 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {}), 20023 " ", 20024 (0,external_wp_i18n_namespaceObject.__)("Creating"), 20025 "\u2026" 20026 ] }), 20027 isEditing && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 20028 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 20029 "div", 20030 { 20031 className: dist_clsx({ 20032 "block-editor-link-control__search-input-wrapper": true, 20033 "has-text-control": showTextControl, 20034 "has-actions": showActions 20035 }), 20036 children: [ 20037 showTextControl && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 20038 external_wp_components_namespaceObject.TextControl, 20039 { 20040 __nextHasNoMarginBottom: true, 20041 ref: textInputRef, 20042 className: "block-editor-link-control__field block-editor-link-control__text-content", 20043 label: (0,external_wp_i18n_namespaceObject.__)("Text"), 20044 value: internalControlValue?.title, 20045 onChange: setInternalTextInputValue, 20046 onKeyDown: handleSubmitWithEnter, 20047 __next40pxDefaultSize: true 20048 } 20049 ), 20050 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 20051 search_input_default, 20052 { 20053 ref: searchInputRef, 20054 currentLink: value, 20055 className: "block-editor-link-control__field block-editor-link-control__search-input", 20056 placeholder: searchInputPlaceholder, 20057 value: currentUrlInputValue, 20058 withCreateSuggestion, 20059 onCreateSuggestion: createPage, 20060 onChange: setInternalURLInputValue, 20061 onSelect: handleSelectSuggestion, 20062 showInitialSuggestions, 20063 allowDirectEntry: !noDirectEntry, 20064 showSuggestions, 20065 suggestionsQuery, 20066 withURLSuggestion: !noURLSuggestion, 20067 createSuggestionButtonText, 20068 hideLabelFromVision: !showTextControl, 20069 isEntity, 20070 suffix: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 20071 SearchSuffixControl, 20072 { 20073 isEntity, 20074 showActions, 20075 isDisabled, 20076 onUnlink: handleUnlink, 20077 onSubmit: handleSubmit, 20078 helpTextId 20079 } 20080 ) 20081 } 20082 ), 20083 isEntity && helpTextId && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 20084 "p", 20085 { 20086 id: helpTextId, 20087 className: "block-editor-link-control__help", 20088 children: (0,external_wp_i18n_namespaceObject.sprintf)( 20089 /* translators: %s: entity type (e.g., page, post) */ 20090 (0,external_wp_i18n_namespaceObject.__)("Synced with the selected %s."), 20091 internalControlValue?.type || "item" 20092 ) 20093 } 20094 ) 20095 ] 20096 } 20097 ), 20098 errorMessage && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 20099 external_wp_components_namespaceObject.Notice, 20100 { 20101 className: "block-editor-link-control__search-error", 20102 status: "error", 20103 isDismissible: false, 20104 children: errorMessage 20105 } 20106 ) 20107 ] }), 20108 value && !isEditingLink && !isCreatingPage && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 20109 LinkPreview, 20110 { 20111 value, 20112 onEditClick: () => setIsEditingLink(true), 20113 hasRichPreviews, 20114 hasUnlinkControl: shownUnlinkControl, 20115 onRemove: () => { 20116 onRemove(); 20117 setIsEditingLink(true); 20118 } 20119 }, 20120 value?.url 20121 ), 20122 showSettings && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-link-control__tools", children: !currentInputIsEmpty && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 20123 settings_drawer_default, 20124 { 20125 settingsOpen: isSettingsOpen, 20126 setSettingsOpen: setSettingsOpenWithPreference, 20127 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 20128 settings_default, 20129 { 20130 value: internalControlValue, 20131 settings, 20132 onChange: createSetInternalSettingValueHandler( 20133 settingsKeys 20134 ) 20135 } 20136 ) 20137 } 20138 ) }), 20139 showActions && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 20140 external_wp_components_namespaceObject.__experimentalHStack, 20141 { 20142 justify: "right", 20143 className: "block-editor-link-control__search-actions", 20144 children: [ 20145 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 20146 external_wp_components_namespaceObject.Button, 20147 { 20148 __next40pxDefaultSize: true, 20149 variant: "tertiary", 20150 onClick: handleCancel, 20151 children: (0,external_wp_i18n_namespaceObject.__)("Cancel") 20152 } 20153 ), 20154 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 20155 external_wp_components_namespaceObject.Button, 20156 { 20157 __next40pxDefaultSize: true, 20158 variant: "primary", 20159 onClick: isDisabled ? link_control_noop : handleSubmit, 20160 className: "block-editor-link-control__search-submit", 20161 "aria-disabled": isDisabled, 20162 children: (0,external_wp_i18n_namespaceObject.__)("Apply") 20163 } 20164 ) 20165 ] 20166 } 20167 ), 20168 !isCreatingPage && renderControlBottom && renderControlBottom() 20169 ] 20170 } 20171 ); 20172 } 20173 function SearchSuffixControl({ 20174 isEntity, 20175 showActions, 20176 isDisabled, 20177 onUnlink, 20178 onSubmit, 20179 helpTextId 20180 }) { 20181 if (isEntity) { 20182 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 20183 external_wp_components_namespaceObject.Button, 20184 { 20185 icon: link_off_default, 20186 onClick: onUnlink, 20187 "aria-describedby": helpTextId, 20188 showTooltip: true, 20189 label: (0,external_wp_i18n_namespaceObject.__)("Unsync and edit"), 20190 __next40pxDefaultSize: true 20191 } 20192 ); 20193 } 20194 if (showActions) { 20195 return void 0; 20196 } 20197 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalInputControlSuffixWrapper, { variant: "control", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 20198 external_wp_components_namespaceObject.Button, 20199 { 20200 onClick: isDisabled ? link_control_noop : onSubmit, 20201 label: (0,external_wp_i18n_namespaceObject.__)("Submit"), 20202 icon: keyboard_return_default, 20203 className: "block-editor-link-control__search-submit", 20204 "aria-disabled": isDisabled, 20205 size: "small" 20206 } 20207 ) }); 20208 } 20209 LinkControl.ViewerFill = ViewerFill; 20210 LinkControl.DEFAULT_LINK_SETTINGS = DEFAULT_LINK_SETTINGS; 20211 const DeprecatedExperimentalLinkControl = (props) => { 20212 external_wp_deprecated_default()("wp.blockEditor.__experimentalLinkControl", { 20213 since: "6.8", 20214 alternative: "wp.blockEditor.LinkControl" 20215 }); 20216 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(LinkControl, { ...props }); 20217 }; 20218 DeprecatedExperimentalLinkControl.ViewerFill = LinkControl.ViewerFill; 20219 DeprecatedExperimentalLinkControl.DEFAULT_LINK_SETTINGS = LinkControl.DEFAULT_LINK_SETTINGS; 20220 var link_control_default = LinkControl; 20221 20222 20223 ;// ./node_modules/@wordpress/block-editor/build-module/components/media-replace-flow/index.js 20224 20225 20226 20227 20228 20229 20230 20231 20232 20233 20234 20235 20236 20237 20238 const media_replace_flow_noop = () => { 20239 }; 20240 let uniqueId = 0; 20241 const MediaReplaceFlow = ({ 20242 mediaURL, 20243 mediaId, 20244 mediaIds, 20245 allowedTypes, 20246 accept, 20247 onError, 20248 onSelect, 20249 onSelectURL, 20250 onReset, 20251 onToggleFeaturedImage, 20252 useFeaturedImage, 20253 onFilesUpload = media_replace_flow_noop, 20254 name = (0,external_wp_i18n_namespaceObject.__)("Replace"), 20255 createNotice, 20256 removeNotice, 20257 children, 20258 multiple = false, 20259 addToGallery, 20260 handleUpload = true, 20261 popoverProps, 20262 renderToggle 20263 }) => { 20264 const { getSettings } = (0,external_wp_data_namespaceObject.useSelect)(store); 20265 const errorNoticeID = `block-editor/media-replace-flow/error-notice/${++uniqueId}`; 20266 const onUploadError = (message) => { 20267 const safeMessage = (0,external_wp_dom_namespaceObject.__unstableStripHTML)(message); 20268 if (onError) { 20269 onError(safeMessage); 20270 return; 20271 } 20272 setTimeout(() => { 20273 createNotice("error", safeMessage, { 20274 speak: true, 20275 id: errorNoticeID, 20276 isDismissible: true 20277 }); 20278 }, 1e3); 20279 }; 20280 const selectMedia = (media, closeMenu) => { 20281 if (useFeaturedImage && onToggleFeaturedImage) { 20282 onToggleFeaturedImage(); 20283 } 20284 closeMenu(); 20285 onSelect(media); 20286 (0,external_wp_a11y_namespaceObject.speak)((0,external_wp_i18n_namespaceObject.__)("The media file has been replaced")); 20287 removeNotice(errorNoticeID); 20288 }; 20289 const uploadFiles = (event, closeMenu) => { 20290 const files = event.target.files; 20291 if (!handleUpload) { 20292 closeMenu(); 20293 return onSelect(files); 20294 } 20295 onFilesUpload(files); 20296 getSettings().mediaUpload({ 20297 allowedTypes, 20298 filesList: files, 20299 onFileChange: ([media]) => { 20300 selectMedia(media, closeMenu); 20301 }, 20302 onError: onUploadError 20303 }); 20304 }; 20305 const openOnArrowDown = (event) => { 20306 if (event.keyCode === external_wp_keycodes_namespaceObject.DOWN) { 20307 event.preventDefault(); 20308 event.target.click(); 20309 } 20310 }; 20311 const onlyAllowsImages = () => { 20312 if (!allowedTypes || allowedTypes.length === 0) { 20313 return false; 20314 } 20315 return allowedTypes.every( 20316 (allowedType) => allowedType === "image" || allowedType.startsWith("image/") 20317 ); 20318 }; 20319 const gallery = multiple && onlyAllowsImages(); 20320 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 20321 external_wp_components_namespaceObject.Dropdown, 20322 { 20323 popoverProps, 20324 contentClassName: "block-editor-media-replace-flow__options", 20325 renderToggle: ({ isOpen, onToggle }) => { 20326 if (renderToggle) { 20327 return renderToggle({ 20328 "aria-expanded": isOpen, 20329 "aria-haspopup": "true", 20330 onClick: onToggle, 20331 onKeyDown: openOnArrowDown, 20332 children: name 20333 }); 20334 } 20335 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 20336 external_wp_components_namespaceObject.ToolbarButton, 20337 { 20338 "aria-expanded": isOpen, 20339 "aria-haspopup": "true", 20340 onClick: onToggle, 20341 onKeyDown: openOnArrowDown, 20342 children: name 20343 } 20344 ); 20345 }, 20346 renderContent: ({ onClose }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 20347 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.NavigableMenu, { className: "block-editor-media-replace-flow__media-upload-menu", children: [ 20348 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(check_default, { children: [ 20349 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 20350 media_upload_default, 20351 { 20352 gallery, 20353 addToGallery, 20354 multiple, 20355 value: multiple ? mediaIds : mediaId, 20356 onSelect: (media) => selectMedia(media, onClose), 20357 allowedTypes, 20358 render: ({ open }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 20359 external_wp_components_namespaceObject.MenuItem, 20360 { 20361 icon: media_default, 20362 onClick: open, 20363 children: (0,external_wp_i18n_namespaceObject.__)("Open Media Library") 20364 } 20365 ) 20366 } 20367 ), 20368 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 20369 external_wp_components_namespaceObject.FormFileUpload, 20370 { 20371 onChange: (event) => { 20372 uploadFiles(event, onClose); 20373 }, 20374 accept, 20375 multiple: !!multiple, 20376 render: ({ openFileDialog }) => { 20377 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 20378 external_wp_components_namespaceObject.MenuItem, 20379 { 20380 icon: upload_default, 20381 onClick: () => { 20382 openFileDialog(); 20383 }, 20384 children: (0,external_wp_i18n_namespaceObject._x)("Upload", "verb") 20385 } 20386 ); 20387 } 20388 } 20389 ) 20390 ] }), 20391 onToggleFeaturedImage && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 20392 external_wp_components_namespaceObject.MenuItem, 20393 { 20394 icon: post_featured_image_default, 20395 onClick: onToggleFeaturedImage, 20396 isPressed: useFeaturedImage, 20397 children: (0,external_wp_i18n_namespaceObject.__)("Use featured image") 20398 } 20399 ), 20400 mediaURL && onReset && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 20401 external_wp_components_namespaceObject.MenuItem, 20402 { 20403 onClick: () => { 20404 onReset(); 20405 onClose(); 20406 }, 20407 children: (0,external_wp_i18n_namespaceObject.__)("Reset") 20408 } 20409 ), 20410 typeof children === "function" ? children({ onClose }) : children 20411 ] }), 20412 onSelectURL && // eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions 20413 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("form", { className: "block-editor-media-flow__url-input", children: [ 20414 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "block-editor-media-replace-flow__image-url-label", children: (0,external_wp_i18n_namespaceObject.__)("Current media URL:") }), 20415 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 20416 link_control_default, 20417 { 20418 value: { url: mediaURL }, 20419 settings: [], 20420 showSuggestions: false, 20421 onChange: ({ url }) => { 20422 onSelectURL(url); 20423 }, 20424 searchInputPlaceholder: (0,external_wp_i18n_namespaceObject.__)( 20425 "Paste or type URL" 20426 ) 20427 } 20428 ) 20429 ] }) 20430 ] }) 20431 } 20432 ); 20433 }; 20434 var media_replace_flow_default = (0,external_wp_compose_namespaceObject.compose)([ 20435 (0,external_wp_data_namespaceObject.withDispatch)((dispatch) => { 20436 const { createNotice, removeNotice } = dispatch(external_wp_notices_namespaceObject.store); 20437 return { 20438 createNotice, 20439 removeNotice 20440 }; 20441 }), 20442 (0,external_wp_components_namespaceObject.withFilters)("editor.MediaReplaceFlow") 20443 ])(MediaReplaceFlow); 20444 20445 20446 ;// ./node_modules/@wordpress/block-editor/build-module/components/background-image-control/index.js 20447 20448 20449 20450 20451 20452 20453 20454 20455 20456 20457 20458 20459 20460 20461 20462 20463 20464 const IMAGE_BACKGROUND_TYPE = "image"; 20465 const BACKGROUND_POPOVER_PROPS = { 20466 placement: "left-start", 20467 offset: 36, 20468 shift: true, 20469 className: "block-editor-global-styles-background-panel__popover" 20470 }; 20471 const background_image_control_noop = () => { 20472 }; 20473 const focusToggleButton = (containerRef) => { 20474 window.requestAnimationFrame(() => { 20475 const [toggleButton] = external_wp_dom_namespaceObject.focus.tabbable.find(containerRef?.current); 20476 if (!toggleButton) { 20477 return; 20478 } 20479 toggleButton.focus(); 20480 }); 20481 }; 20482 function backgroundSizeHelpText(value) { 20483 if (value === "cover" || value === void 0) { 20484 return (0,external_wp_i18n_namespaceObject.__)("Image covers the space evenly."); 20485 } 20486 if (value === "contain") { 20487 return (0,external_wp_i18n_namespaceObject.__)("Image is contained without distortion."); 20488 } 20489 return (0,external_wp_i18n_namespaceObject.__)("Image has a fixed width."); 20490 } 20491 const coordsToBackgroundPosition = (value) => { 20492 if (!value || isNaN(value.x) && isNaN(value.y)) { 20493 return void 0; 20494 } 20495 const x = isNaN(value.x) ? 0.5 : value.x; 20496 const y = isNaN(value.y) ? 0.5 : value.y; 20497 return `$x * 100}% $y * 100}%`; 20498 }; 20499 const backgroundPositionToCoords = (value) => { 20500 if (!value) { 20501 return { x: void 0, y: void 0 }; 20502 } 20503 let [x, y] = value.split(" ").map((v) => parseFloat(v) / 100); 20504 x = isNaN(x) ? void 0 : x; 20505 y = isNaN(y) ? x : y; 20506 return { x, y }; 20507 }; 20508 function InspectorImagePreviewItem({ 20509 as = "span", 20510 imgUrl, 20511 toggleProps = {}, 20512 filename, 20513 label, 20514 onToggleCallback = background_image_control_noop 20515 }) { 20516 const { isOpen, ...restToggleProps } = toggleProps; 20517 (0,external_wp_element_namespaceObject.useEffect)(() => { 20518 if (typeof isOpen !== "undefined") { 20519 onToggleCallback(isOpen); 20520 } 20521 }, [isOpen, onToggleCallback]); 20522 const renderPreviewContent = () => { 20523 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 20524 external_wp_components_namespaceObject.__experimentalHStack, 20525 { 20526 justify: "flex-start", 20527 as: "span", 20528 className: "block-editor-global-styles-background-panel__inspector-preview-inner", 20529 children: [ 20530 imgUrl && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 20531 "span", 20532 { 20533 className: "block-editor-global-styles-background-panel__inspector-image-indicator-wrapper", 20534 "aria-hidden": true, 20535 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 20536 "span", 20537 { 20538 className: "block-editor-global-styles-background-panel__inspector-image-indicator", 20539 style: { 20540 backgroundImage: `url($imgUrl})` 20541 } 20542 } 20543 ) 20544 } 20545 ), 20546 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.FlexItem, { as: "span", style: imgUrl ? {} : { flexGrow: 1 }, children: [ 20547 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 20548 external_wp_components_namespaceObject.__experimentalTruncate, 20549 { 20550 numberOfLines: 1, 20551 className: "block-editor-global-styles-background-panel__inspector-media-replace-title", 20552 children: label 20553 } 20554 ), 20555 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, { as: "span", children: imgUrl ? (0,external_wp_i18n_namespaceObject.sprintf)( 20556 /* translators: %s: file name */ 20557 (0,external_wp_i18n_namespaceObject.__)("Background image: %s"), 20558 filename || label 20559 ) : (0,external_wp_i18n_namespaceObject.__)("No background image selected") }) 20560 ] }) 20561 ] 20562 } 20563 ); 20564 }; 20565 return as === "button" ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, ...restToggleProps, children: renderPreviewContent() }) : renderPreviewContent(); 20566 } 20567 function BackgroundControlsPanel({ 20568 label, 20569 filename, 20570 url: imgUrl, 20571 children, 20572 onToggle: onToggleCallback = background_image_control_noop, 20573 hasImageValue, 20574 onReset, 20575 containerRef 20576 }) { 20577 if (!hasImageValue) { 20578 return; 20579 } 20580 const imgLabel = label || (0,external_wp_url_namespaceObject.getFilename)(imgUrl) || (0,external_wp_i18n_namespaceObject.__)("Add background image"); 20581 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 20582 external_wp_components_namespaceObject.Dropdown, 20583 { 20584 popoverProps: BACKGROUND_POPOVER_PROPS, 20585 renderToggle: ({ onToggle, isOpen }) => { 20586 const toggleProps = { 20587 onClick: onToggle, 20588 className: "block-editor-global-styles-background-panel__dropdown-toggle", 20589 "aria-expanded": isOpen, 20590 "aria-label": (0,external_wp_i18n_namespaceObject.__)( 20591 "Background size, position and repeat options." 20592 ), 20593 isOpen 20594 }; 20595 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 20596 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 20597 InspectorImagePreviewItem, 20598 { 20599 imgUrl, 20600 filename, 20601 label: imgLabel, 20602 toggleProps, 20603 as: "button", 20604 onToggleCallback 20605 } 20606 ), 20607 onReset && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 20608 external_wp_components_namespaceObject.Button, 20609 { 20610 __next40pxDefaultSize: true, 20611 label: (0,external_wp_i18n_namespaceObject.__)("Reset"), 20612 className: "block-editor-global-styles-background-panel__reset", 20613 size: "small", 20614 icon: reset_default, 20615 onClick: () => { 20616 onReset(); 20617 if (isOpen) { 20618 onToggle(); 20619 } 20620 focusToggleButton(containerRef); 20621 } 20622 } 20623 ) 20624 ] }); 20625 }, 20626 renderContent: () => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 20627 external_wp_components_namespaceObject.__experimentalDropdownContentWrapper, 20628 { 20629 className: "block-editor-global-styles-background-panel__dropdown-content-wrapper", 20630 paddingSize: "medium", 20631 children 20632 } 20633 ) 20634 } 20635 ); 20636 } 20637 function LoadingSpinner() { 20638 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Placeholder, { className: "block-editor-global-styles-background-panel__loading", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {}) }); 20639 } 20640 function BackgroundImageControls({ 20641 onChange, 20642 style, 20643 inheritedValue, 20644 onRemoveImage = background_image_control_noop, 20645 onResetImage = background_image_control_noop, 20646 displayInPanel, 20647 defaultValues, 20648 containerRef 20649 }) { 20650 const [isUploading, setIsUploading] = (0,external_wp_element_namespaceObject.useState)(false); 20651 const { getSettings } = (0,external_wp_data_namespaceObject.useSelect)(store); 20652 const { id, title, url } = style?.background?.backgroundImage || { 20653 ...inheritedValue?.background?.backgroundImage 20654 }; 20655 const { createErrorNotice } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); 20656 const onUploadError = (message) => { 20657 createErrorNotice(message, { type: "snackbar" }); 20658 setIsUploading(false); 20659 }; 20660 const resetBackgroundImage = () => onChange( 20661 setImmutably( 20662 style, 20663 ["background", "backgroundImage"], 20664 void 0 20665 ) 20666 ); 20667 const onSelectMedia = (media) => { 20668 if (!media || !media.url) { 20669 resetBackgroundImage(); 20670 setIsUploading(false); 20671 return; 20672 } 20673 if ((0,external_wp_blob_namespaceObject.isBlobURL)(media.url)) { 20674 setIsUploading(true); 20675 return; 20676 } 20677 if (media.media_type && media.media_type !== IMAGE_BACKGROUND_TYPE || !media.media_type && media.type && media.type !== IMAGE_BACKGROUND_TYPE) { 20678 onUploadError( 20679 (0,external_wp_i18n_namespaceObject.__)("Only images can be used as a background image.") 20680 ); 20681 return; 20682 } 20683 const sizeValue = style?.background?.backgroundSize || defaultValues?.backgroundSize; 20684 const positionValue = style?.background?.backgroundPosition; 20685 onChange( 20686 setImmutably(style, ["background"], { 20687 ...style?.background, 20688 backgroundImage: { 20689 url: media.url, 20690 id: media.id, 20691 source: "file", 20692 title: media.title || void 0 20693 }, 20694 backgroundPosition: ( 20695 /* 20696 * A background image uploaded and set in the editor receives a default background position of '50% 0', 20697 * when the background image size is the equivalent of "Tile". 20698 * This is to increase the chance that the image's focus point is visible. 20699 * This is in-editor only to assist with the user experience. 20700 */ 20701 !positionValue && ("auto" === sizeValue || !sizeValue) ? "50% 0" : positionValue 20702 ), 20703 backgroundSize: sizeValue 20704 }) 20705 ); 20706 setIsUploading(false); 20707 focusToggleButton(containerRef); 20708 }; 20709 const onFilesDrop = (filesList) => { 20710 getSettings().mediaUpload({ 20711 allowedTypes: [IMAGE_BACKGROUND_TYPE], 20712 filesList, 20713 onFileChange([image]) { 20714 onSelectMedia(image); 20715 }, 20716 onError: onUploadError, 20717 multiple: false 20718 }); 20719 }; 20720 const hasValue = hasBackgroundImageValue(style); 20721 const onRemove = () => onChange( 20722 setImmutably(style, ["background"], { 20723 backgroundImage: "none" 20724 }) 20725 ); 20726 const canRemove = !hasValue && hasBackgroundImageValue(inheritedValue); 20727 const imgLabel = title || (0,external_wp_url_namespaceObject.getFilename)(url) || (0,external_wp_i18n_namespaceObject.__)("Add background image"); 20728 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-editor-global-styles-background-panel__image-tools-panel-item", children: [ 20729 isUploading && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(LoadingSpinner, {}), 20730 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 20731 media_replace_flow_default, 20732 { 20733 mediaId: id, 20734 mediaURL: url, 20735 allowedTypes: [IMAGE_BACKGROUND_TYPE], 20736 accept: "image/*", 20737 onSelect: onSelectMedia, 20738 popoverProps: { 20739 className: dist_clsx({ 20740 "block-editor-global-styles-background-panel__media-replace-popover": displayInPanel 20741 }) 20742 }, 20743 name: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 20744 InspectorImagePreviewItem, 20745 { 20746 imgUrl: url, 20747 filename: title, 20748 label: imgLabel 20749 } 20750 ), 20751 renderToggle: (props) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { ...props, __next40pxDefaultSize: true }), 20752 onError: onUploadError, 20753 onReset: () => { 20754 focusToggleButton(containerRef); 20755 onResetImage(); 20756 }, 20757 children: canRemove && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 20758 external_wp_components_namespaceObject.MenuItem, 20759 { 20760 onClick: () => { 20761 focusToggleButton(containerRef); 20762 onRemove(); 20763 onRemoveImage(); 20764 }, 20765 children: (0,external_wp_i18n_namespaceObject.__)("Remove") 20766 } 20767 ) 20768 } 20769 ), 20770 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 20771 external_wp_components_namespaceObject.DropZone, 20772 { 20773 onFilesDrop, 20774 label: (0,external_wp_i18n_namespaceObject.__)("Drop to upload") 20775 } 20776 ) 20777 ] }); 20778 } 20779 function BackgroundSizeControls({ 20780 onChange, 20781 style, 20782 inheritedValue, 20783 defaultValues 20784 }) { 20785 const sizeValue = style?.background?.backgroundSize || inheritedValue?.background?.backgroundSize; 20786 const repeatValue = style?.background?.backgroundRepeat || inheritedValue?.background?.backgroundRepeat; 20787 const imageValue = style?.background?.backgroundImage?.url || inheritedValue?.background?.backgroundImage?.url; 20788 const isUploadedImage = style?.background?.backgroundImage?.id; 20789 const positionValue = style?.background?.backgroundPosition || inheritedValue?.background?.backgroundPosition; 20790 const attachmentValue = style?.background?.backgroundAttachment || inheritedValue?.background?.backgroundAttachment; 20791 let currentValueForToggle = !sizeValue && isUploadedImage ? defaultValues?.backgroundSize : sizeValue || "auto"; 20792 currentValueForToggle = !["cover", "contain", "auto"].includes( 20793 currentValueForToggle 20794 ) ? "auto" : currentValueForToggle; 20795 const repeatCheckedValue = !(repeatValue === "no-repeat" || currentValueForToggle === "cover" && repeatValue === void 0); 20796 const updateBackgroundSize = (next) => { 20797 let nextRepeat = repeatValue; 20798 let nextPosition = positionValue; 20799 if (next === "contain") { 20800 nextRepeat = "no-repeat"; 20801 nextPosition = void 0; 20802 } 20803 if (next === "cover") { 20804 nextRepeat = void 0; 20805 nextPosition = void 0; 20806 } 20807 if ((currentValueForToggle === "cover" || currentValueForToggle === "contain") && next === "auto") { 20808 nextRepeat = void 0; 20809 if (!!style?.background?.backgroundImage?.id) { 20810 nextPosition = "50% 0"; 20811 } 20812 } 20813 if (!next && currentValueForToggle === "auto") { 20814 next = "auto"; 20815 } 20816 onChange( 20817 setImmutably(style, ["background"], { 20818 ...style?.background, 20819 backgroundPosition: nextPosition, 20820 backgroundRepeat: nextRepeat, 20821 backgroundSize: next 20822 }) 20823 ); 20824 }; 20825 const updateBackgroundPosition = (next) => { 20826 onChange( 20827 setImmutably( 20828 style, 20829 ["background", "backgroundPosition"], 20830 coordsToBackgroundPosition(next) 20831 ) 20832 ); 20833 }; 20834 const toggleIsRepeated = () => onChange( 20835 setImmutably( 20836 style, 20837 ["background", "backgroundRepeat"], 20838 repeatCheckedValue === true ? "no-repeat" : "repeat" 20839 ) 20840 ); 20841 const toggleScrollWithPage = () => onChange( 20842 setImmutably( 20843 style, 20844 ["background", "backgroundAttachment"], 20845 attachmentValue === "fixed" ? "scroll" : "fixed" 20846 ) 20847 ); 20848 const backgroundPositionValue = !positionValue && isUploadedImage && "contain" === sizeValue ? defaultValues?.backgroundPosition : positionValue; 20849 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 3, className: "single-column", children: [ 20850 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 20851 external_wp_components_namespaceObject.FocalPointPicker, 20852 { 20853 __nextHasNoMarginBottom: true, 20854 label: (0,external_wp_i18n_namespaceObject.__)("Focal point"), 20855 url: imageValue, 20856 value: backgroundPositionToCoords(backgroundPositionValue), 20857 onChange: updateBackgroundPosition 20858 } 20859 ), 20860 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 20861 external_wp_components_namespaceObject.ToggleControl, 20862 { 20863 __nextHasNoMarginBottom: true, 20864 label: (0,external_wp_i18n_namespaceObject.__)("Fixed background"), 20865 checked: attachmentValue === "fixed", 20866 onChange: toggleScrollWithPage 20867 } 20868 ), 20869 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 20870 external_wp_components_namespaceObject.__experimentalToggleGroupControl, 20871 { 20872 __nextHasNoMarginBottom: true, 20873 size: "__unstable-large", 20874 label: (0,external_wp_i18n_namespaceObject.__)("Size"), 20875 value: currentValueForToggle, 20876 onChange: updateBackgroundSize, 20877 isBlock: true, 20878 help: backgroundSizeHelpText( 20879 sizeValue || defaultValues?.backgroundSize 20880 ), 20881 children: [ 20882 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 20883 external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, 20884 { 20885 value: "cover", 20886 label: (0,external_wp_i18n_namespaceObject._x)( 20887 "Cover", 20888 "Size option for background image control" 20889 ) 20890 }, 20891 "cover" 20892 ), 20893 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 20894 external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, 20895 { 20896 value: "contain", 20897 label: (0,external_wp_i18n_namespaceObject._x)( 20898 "Contain", 20899 "Size option for background image control" 20900 ) 20901 }, 20902 "contain" 20903 ), 20904 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 20905 external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, 20906 { 20907 value: "auto", 20908 label: (0,external_wp_i18n_namespaceObject._x)( 20909 "Tile", 20910 "Size option for background image control" 20911 ) 20912 }, 20913 "tile" 20914 ) 20915 ] 20916 } 20917 ), 20918 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "flex-start", spacing: 2, as: "span", children: [ 20919 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 20920 external_wp_components_namespaceObject.__experimentalUnitControl, 20921 { 20922 "aria-label": (0,external_wp_i18n_namespaceObject.__)("Background image width"), 20923 onChange: updateBackgroundSize, 20924 value: sizeValue, 20925 size: "__unstable-large", 20926 __unstableInputWidth: "100px", 20927 min: 0, 20928 placeholder: (0,external_wp_i18n_namespaceObject.__)("Auto"), 20929 disabled: currentValueForToggle !== "auto" || currentValueForToggle === void 0 20930 } 20931 ), 20932 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 20933 external_wp_components_namespaceObject.ToggleControl, 20934 { 20935 __nextHasNoMarginBottom: true, 20936 label: (0,external_wp_i18n_namespaceObject.__)("Repeat"), 20937 checked: repeatCheckedValue, 20938 onChange: toggleIsRepeated, 20939 disabled: currentValueForToggle === "cover" 20940 } 20941 ) 20942 ] }) 20943 ] }); 20944 } 20945 function BackgroundImagePanel({ 20946 value, 20947 onChange, 20948 inheritedValue = value, 20949 settings, 20950 defaultValues = {} 20951 }) { 20952 const { globalStyles, _links } = (0,external_wp_data_namespaceObject.useSelect)((select) => { 20953 const { getSettings } = select(store); 20954 const _settings = getSettings(); 20955 return { 20956 globalStyles: _settings[globalStylesDataKey], 20957 _links: _settings[globalStylesLinksDataKey] 20958 }; 20959 }, []); 20960 const resolvedInheritedValue = (0,external_wp_element_namespaceObject.useMemo)(() => { 20961 const resolvedValues = { 20962 background: {} 20963 }; 20964 if (!inheritedValue?.background) { 20965 return inheritedValue; 20966 } 20967 Object.entries(inheritedValue?.background).forEach( 20968 ([key, backgroundValue]) => { 20969 resolvedValues.background[key] = getResolvedValue( 20970 backgroundValue, 20971 { 20972 styles: globalStyles, 20973 _links 20974 } 20975 ); 20976 } 20977 ); 20978 return resolvedValues; 20979 }, [globalStyles, _links, inheritedValue]); 20980 const resetBackground = () => onChange(setImmutably(value, ["background"], {})); 20981 const { title, url } = value?.background?.backgroundImage || { 20982 ...resolvedInheritedValue?.background?.backgroundImage 20983 }; 20984 const hasImageValue = hasBackgroundImageValue(value) || hasBackgroundImageValue(resolvedInheritedValue); 20985 const imageValue = value?.background?.backgroundImage || inheritedValue?.background?.backgroundImage; 20986 const shouldShowBackgroundImageControls = hasImageValue && "none" !== imageValue && (settings?.background?.backgroundSize || settings?.background?.backgroundPosition || settings?.background?.backgroundRepeat); 20987 const [isDropDownOpen, setIsDropDownOpen] = (0,external_wp_element_namespaceObject.useState)(false); 20988 const containerRef = (0,external_wp_element_namespaceObject.useRef)(); 20989 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 20990 "div", 20991 { 20992 ref: containerRef, 20993 className: dist_clsx( 20994 "block-editor-global-styles-background-panel__inspector-media-replace-container", 20995 { 20996 "is-open": isDropDownOpen 20997 } 20998 ), 20999 children: shouldShowBackgroundImageControls ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 21000 BackgroundControlsPanel, 21001 { 21002 label: title, 21003 filename: title, 21004 url, 21005 onToggle: setIsDropDownOpen, 21006 hasImageValue, 21007 onReset: resetBackground, 21008 containerRef, 21009 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 3, className: "single-column", children: [ 21010 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 21011 BackgroundImageControls, 21012 { 21013 onChange, 21014 style: value, 21015 inheritedValue: resolvedInheritedValue, 21016 displayInPanel: true, 21017 onResetImage: () => { 21018 setIsDropDownOpen(false); 21019 resetBackground(); 21020 }, 21021 onRemoveImage: () => setIsDropDownOpen(false), 21022 defaultValues, 21023 containerRef 21024 } 21025 ), 21026 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 21027 BackgroundSizeControls, 21028 { 21029 onChange, 21030 style: value, 21031 defaultValues, 21032 inheritedValue: resolvedInheritedValue 21033 } 21034 ) 21035 ] }) 21036 } 21037 ) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 21038 BackgroundImageControls, 21039 { 21040 onChange, 21041 style: value, 21042 inheritedValue: resolvedInheritedValue, 21043 defaultValues, 21044 onResetImage: () => { 21045 setIsDropDownOpen(false); 21046 resetBackground(); 21047 }, 21048 onRemoveImage: () => setIsDropDownOpen(false), 21049 containerRef 21050 } 21051 ) 21052 } 21053 ); 21054 } 21055 21056 21057 ;// ./node_modules/@wordpress/block-editor/build-module/components/global-styles/background-panel.js 21058 21059 21060 21061 21062 21063 21064 21065 const background_panel_DEFAULT_CONTROLS = { 21066 backgroundImage: true 21067 }; 21068 function useHasBackgroundPanel(settings) { 21069 return external_wp_element_namespaceObject.Platform.OS === "web" && settings?.background?.backgroundImage; 21070 } 21071 function hasBackgroundSizeValue(style) { 21072 return style?.background?.backgroundPosition !== void 0 || style?.background?.backgroundSize !== void 0; 21073 } 21074 function hasBackgroundImageValue(style) { 21075 return !!style?.background?.backgroundImage?.id || // Supports url() string values in theme.json. 21076 "string" === typeof style?.background?.backgroundImage || !!style?.background?.backgroundImage?.url; 21077 } 21078 function BackgroundToolsPanel({ 21079 resetAllFilter, 21080 onChange, 21081 value, 21082 panelId, 21083 children, 21084 headerLabel 21085 }) { 21086 const dropdownMenuProps = useToolsPanelDropdownMenuProps(); 21087 const resetAll = () => { 21088 const updatedValue = resetAllFilter(value); 21089 onChange(updatedValue); 21090 }; 21091 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 21092 external_wp_components_namespaceObject.__experimentalToolsPanel, 21093 { 21094 label: headerLabel, 21095 resetAll, 21096 panelId, 21097 dropdownMenuProps, 21098 children 21099 } 21100 ); 21101 } 21102 function background_panel_BackgroundImagePanel({ 21103 as: Wrapper = BackgroundToolsPanel, 21104 value, 21105 onChange, 21106 inheritedValue, 21107 settings, 21108 panelId, 21109 defaultControls = background_panel_DEFAULT_CONTROLS, 21110 defaultValues = {}, 21111 headerLabel = (0,external_wp_i18n_namespaceObject.__)("Background image") 21112 }) { 21113 const showBackgroundImageControl = useHasBackgroundPanel(settings); 21114 const resetBackground = () => onChange(setImmutably(value, ["background"], {})); 21115 const resetAllFilter = (0,external_wp_element_namespaceObject.useCallback)((previousValue) => { 21116 return { 21117 ...previousValue, 21118 background: {} 21119 }; 21120 }, []); 21121 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 21122 Wrapper, 21123 { 21124 resetAllFilter, 21125 value, 21126 onChange, 21127 panelId, 21128 headerLabel, 21129 children: showBackgroundImageControl && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 21130 external_wp_components_namespaceObject.__experimentalToolsPanelItem, 21131 { 21132 hasValue: () => !!value?.background, 21133 label: (0,external_wp_i18n_namespaceObject.__)("Image"), 21134 onDeselect: resetBackground, 21135 isShownByDefault: defaultControls.backgroundImage, 21136 panelId, 21137 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 21138 BackgroundImagePanel, 21139 { 21140 value, 21141 onChange, 21142 settings, 21143 inheritedValue, 21144 defaultControls, 21145 defaultValues 21146 } 21147 ) 21148 } 21149 ) 21150 } 21151 ); 21152 } 21153 21154 21155 ;// ./node_modules/@wordpress/block-editor/build-module/hooks/background.js 21156 21157 21158 21159 21160 21161 21162 21163 21164 21165 const BACKGROUND_SUPPORT_KEY = "background"; 21166 const BACKGROUND_BLOCK_DEFAULT_VALUES = { 21167 backgroundSize: "cover", 21168 backgroundPosition: "50% 50%" 21169 // used only when backgroundSize is 'contain'. 21170 }; 21171 function hasBackgroundSupport(blockName, feature = "any") { 21172 const support = (0,external_wp_blocks_namespaceObject.getBlockSupport)(blockName, BACKGROUND_SUPPORT_KEY); 21173 if (support === true) { 21174 return true; 21175 } 21176 if (feature === "any") { 21177 return !!support?.backgroundImage || !!support?.backgroundSize || !!support?.backgroundRepeat; 21178 } 21179 return !!support?.[feature]; 21180 } 21181 function setBackgroundStyleDefaults(backgroundStyle) { 21182 if (!backgroundStyle || !backgroundStyle?.backgroundImage?.url) { 21183 return; 21184 } 21185 let backgroundStylesWithDefaults; 21186 if (!backgroundStyle?.backgroundSize) { 21187 backgroundStylesWithDefaults = { 21188 backgroundSize: BACKGROUND_BLOCK_DEFAULT_VALUES.backgroundSize 21189 }; 21190 } 21191 if ("contain" === backgroundStyle?.backgroundSize && !backgroundStyle?.backgroundPosition) { 21192 backgroundStylesWithDefaults = { 21193 backgroundPosition: BACKGROUND_BLOCK_DEFAULT_VALUES.backgroundPosition 21194 }; 21195 } 21196 return backgroundStylesWithDefaults; 21197 } 21198 function background_useBlockProps({ name, style }) { 21199 if (!hasBackgroundSupport(name) || !style?.background?.backgroundImage) { 21200 return; 21201 } 21202 const backgroundStyles = setBackgroundStyleDefaults(style?.background); 21203 if (!backgroundStyles) { 21204 return; 21205 } 21206 return { 21207 style: { 21208 ...backgroundStyles 21209 } 21210 }; 21211 } 21212 function getBackgroundImageClasses(style) { 21213 return hasBackgroundImageValue(style) ? "has-background" : ""; 21214 } 21215 function BackgroundInspectorControl({ children }) { 21216 const resetAllFilter = (0,external_wp_element_namespaceObject.useCallback)((attributes) => { 21217 return { 21218 ...attributes, 21219 style: { 21220 ...attributes.style, 21221 background: void 0 21222 } 21223 }; 21224 }, []); 21225 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls_default, { group: "background", resetAllFilter, children }); 21226 } 21227 function background_BackgroundImagePanel({ 21228 clientId, 21229 name, 21230 setAttributes, 21231 settings 21232 }) { 21233 const { style, inheritedValue } = (0,external_wp_data_namespaceObject.useSelect)( 21234 (select) => { 21235 const { getBlockAttributes, getSettings } = select(store); 21236 const _settings = getSettings(); 21237 return { 21238 style: getBlockAttributes(clientId)?.style, 21239 /* 21240 * To ensure we pass down the right inherited values: 21241 * @TODO 1. Pass inherited value down to all block style controls, 21242 * See: packages/block-editor/src/hooks/style.js 21243 * @TODO 2. Add support for block style variations, 21244 * See implementation: packages/block-editor/src/hooks/block-style-variation.js 21245 */ 21246 inheritedValue: _settings[globalStylesDataKey]?.blocks?.[name] 21247 }; 21248 }, 21249 [clientId, name] 21250 ); 21251 if (!useHasBackgroundPanel(settings) || !hasBackgroundSupport(name, "backgroundImage")) { 21252 return null; 21253 } 21254 const onChange = (newStyle) => { 21255 setAttributes({ 21256 style: utils_cleanEmptyObject(newStyle) 21257 }); 21258 }; 21259 const updatedSettings = { 21260 ...settings, 21261 background: { 21262 ...settings.background, 21263 backgroundSize: settings?.background?.backgroundSize && hasBackgroundSupport(name, "backgroundSize") 21264 } 21265 }; 21266 const defaultControls = (0,external_wp_blocks_namespaceObject.getBlockSupport)(name, [ 21267 BACKGROUND_SUPPORT_KEY, 21268 "defaultControls" 21269 ]); 21270 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 21271 background_panel_BackgroundImagePanel, 21272 { 21273 inheritedValue, 21274 as: BackgroundInspectorControl, 21275 panelId: clientId, 21276 defaultValues: BACKGROUND_BLOCK_DEFAULT_VALUES, 21277 settings: updatedSettings, 21278 onChange, 21279 defaultControls, 21280 value: style 21281 } 21282 ); 21283 } 21284 var background_default = { 21285 useBlockProps: background_useBlockProps, 21286 attributeKeys: ["style"], 21287 hasSupport: hasBackgroundSupport 21288 }; 21289 21290 21291 ;// ./node_modules/@wordpress/block-editor/build-module/hooks/lock.js 21292 21293 function lock_addAttribute(settings) { 21294 if ("type" in (settings.attributes?.lock ?? {})) { 21295 return settings; 21296 } 21297 settings.attributes = { 21298 ...settings.attributes, 21299 lock: { 21300 type: "object" 21301 } 21302 }; 21303 return settings; 21304 } 21305 (0,external_wp_hooks_namespaceObject.addFilter)("blocks.registerBlockType", "core/lock/addAttribute", lock_addAttribute); 21306 21307 21308 ;// ./node_modules/@wordpress/icons/build-module/library/block-default.js 21309 21310 21311 var block_default_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M19 8h-1V6h-5v2h-2V6H6v2H5c-1.1 0-2 .9-2 2v8c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2v-8c0-1.1-.9-2-2-2zm.5 10c0 .3-.2.5-.5.5H5c-.3 0-.5-.2-.5-.5v-8c0-.3.2-.5.5-.5h14c.3 0 .5.2.5.5v8z" }) }); 21312 21313 21314 ;// ./node_modules/@wordpress/block-editor/build-module/components/block-icon/index.js 21315 21316 21317 21318 21319 21320 function BlockIcon({ icon, showColors = false, className, context }) { 21321 if (icon?.src === "block-default") { 21322 icon = { 21323 src: block_default_default 21324 }; 21325 } 21326 const renderedIcon = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { icon: icon && icon.src ? icon.src : icon, context }); 21327 const style = showColors ? { 21328 backgroundColor: icon && icon.background, 21329 color: icon && icon.foreground 21330 } : {}; 21331 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 21332 "span", 21333 { 21334 style, 21335 className: dist_clsx("block-editor-block-icon", className, { 21336 "has-colors": showColors 21337 }), 21338 children: renderedIcon 21339 } 21340 ); 21341 } 21342 var block_icon_default = (0,external_wp_element_namespaceObject.memo)(BlockIcon); 21343 21344 21345 ;// ./node_modules/@wordpress/block-editor/build-module/components/block-manager/checklist.js 21346 21347 21348 21349 function BlockTypesChecklist({ blockTypes, value, onItemChange }) { 21350 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("ul", { className: "block-editor-block-manager__checklist", children: blockTypes.map((blockType) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 21351 "li", 21352 { 21353 className: "block-editor-block-manager__checklist-item", 21354 children: [ 21355 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 21356 external_wp_components_namespaceObject.CheckboxControl, 21357 { 21358 __nextHasNoMarginBottom: true, 21359 label: blockType.title, 21360 checked: value.includes(blockType.name), 21361 onChange: (...args) => onItemChange(blockType, ...args) 21362 } 21363 ), 21364 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(block_icon_default, { icon: blockType.icon }) 21365 ] 21366 }, 21367 blockType.name 21368 )) }); 21369 } 21370 var checklist_default = BlockTypesChecklist; 21371 21372 21373 ;// ./node_modules/@wordpress/block-editor/build-module/components/block-manager/category.js 21374 21375 21376 21377 21378 21379 function BlockManagerCategory({ 21380 title, 21381 blockTypes, 21382 selectedBlockTypes, 21383 onChange 21384 }) { 21385 const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(BlockManagerCategory); 21386 const toggleVisible = (0,external_wp_element_namespaceObject.useCallback)( 21387 (blockType, nextIsChecked) => { 21388 if (nextIsChecked) { 21389 onChange([...selectedBlockTypes, blockType]); 21390 } else { 21391 onChange( 21392 selectedBlockTypes.filter( 21393 ({ name }) => name !== blockType.name 21394 ) 21395 ); 21396 } 21397 }, 21398 [selectedBlockTypes, onChange] 21399 ); 21400 const toggleAllVisible = (0,external_wp_element_namespaceObject.useCallback)( 21401 (nextIsChecked) => { 21402 if (nextIsChecked) { 21403 onChange([ 21404 ...selectedBlockTypes, 21405 ...blockTypes.filter( 21406 (blockType) => !selectedBlockTypes.find( 21407 ({ name }) => name === blockType.name 21408 ) 21409 ) 21410 ]); 21411 } else { 21412 onChange( 21413 selectedBlockTypes.filter( 21414 (selectedBlockType) => !blockTypes.find( 21415 ({ name }) => name === selectedBlockType.name 21416 ) 21417 ) 21418 ); 21419 } 21420 }, 21421 [blockTypes, selectedBlockTypes, onChange] 21422 ); 21423 if (!blockTypes.length) { 21424 return null; 21425 } 21426 const checkedBlockNames = blockTypes.map(({ name }) => name).filter( 21427 (type) => (selectedBlockTypes ?? []).some( 21428 (selectedBlockType) => selectedBlockType.name === type 21429 ) 21430 ); 21431 const titleId = "block-editor-block-manager__category-title-" + instanceId; 21432 const isAllChecked = checkedBlockNames.length === blockTypes.length; 21433 const isIndeterminate = !isAllChecked && checkedBlockNames.length > 0; 21434 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 21435 "div", 21436 { 21437 role: "group", 21438 "aria-labelledby": titleId, 21439 className: "block-editor-block-manager__category", 21440 children: [ 21441 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 21442 external_wp_components_namespaceObject.CheckboxControl, 21443 { 21444 __nextHasNoMarginBottom: true, 21445 checked: isAllChecked, 21446 onChange: toggleAllVisible, 21447 className: "block-editor-block-manager__category-title", 21448 indeterminate: isIndeterminate, 21449 label: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { id: titleId, children: title }) 21450 } 21451 ), 21452 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 21453 checklist_default, 21454 { 21455 blockTypes, 21456 value: checkedBlockNames, 21457 onItemChange: toggleVisible 21458 } 21459 ) 21460 ] 21461 } 21462 ); 21463 } 21464 var category_category_default = BlockManagerCategory; 21465 21466 21467 ;// ./node_modules/@wordpress/block-editor/build-module/components/block-manager/index.js 21468 21469 21470 21471 21472 21473 21474 21475 21476 21477 function BlockManager({ 21478 blockTypes, 21479 selectedBlockTypes, 21480 onChange, 21481 showSelectAll = true 21482 }) { 21483 const debouncedSpeak = (0,external_wp_compose_namespaceObject.useDebounce)(external_wp_a11y_namespaceObject.speak, 500); 21484 const [search, setSearch] = (0,external_wp_element_namespaceObject.useState)(""); 21485 const { categories, isMatchingSearchTerm } = (0,external_wp_data_namespaceObject.useSelect)((select) => { 21486 return { 21487 categories: select(external_wp_blocks_namespaceObject.store).getCategories(), 21488 isMatchingSearchTerm: select(external_wp_blocks_namespaceObject.store).isMatchingSearchTerm 21489 }; 21490 }, []); 21491 const filteredBlockTypes = blockTypes.filter((blockType) => { 21492 return !search || isMatchingSearchTerm(blockType, search); 21493 }); 21494 const isIndeterminate = selectedBlockTypes.length > 0 && selectedBlockTypes.length !== blockTypes.length; 21495 const isAllChecked = blockTypes.length > 0 && selectedBlockTypes.length === blockTypes.length; 21496 (0,external_wp_element_namespaceObject.useEffect)(() => { 21497 if (!search) { 21498 return; 21499 } 21500 const count = filteredBlockTypes.length; 21501 const resultsFoundMessage = (0,external_wp_i18n_namespaceObject.sprintf)( 21502 /* translators: %d: number of results. */ 21503 (0,external_wp_i18n_namespaceObject._n)("%d result found.", "%d results found.", count), 21504 count 21505 ); 21506 debouncedSpeak(resultsFoundMessage); 21507 }, [filteredBlockTypes?.length, search, debouncedSpeak]); 21508 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { className: "block-editor-block-manager__content", spacing: 4, children: [ 21509 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 21510 external_wp_components_namespaceObject.SearchControl, 21511 { 21512 __nextHasNoMarginBottom: true, 21513 label: (0,external_wp_i18n_namespaceObject.__)("Search for a block"), 21514 placeholder: (0,external_wp_i18n_namespaceObject.__)("Search for a block"), 21515 value: search, 21516 onChange: (nextSearch) => setSearch(nextSearch), 21517 className: "block-editor-block-manager__search" 21518 } 21519 ), 21520 showSelectAll && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 21521 external_wp_components_namespaceObject.CheckboxControl, 21522 { 21523 className: "block-editor-block-manager__select-all", 21524 label: (0,external_wp_i18n_namespaceObject.__)("Select all"), 21525 checked: isAllChecked, 21526 onChange: () => { 21527 if (isAllChecked) { 21528 onChange([]); 21529 } else { 21530 onChange(blockTypes); 21531 } 21532 }, 21533 indeterminate: isIndeterminate, 21534 __nextHasNoMarginBottom: true 21535 } 21536 ), 21537 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 21538 "div", 21539 { 21540 tabIndex: "0", 21541 role: "region", 21542 "aria-label": (0,external_wp_i18n_namespaceObject.__)("Available block types"), 21543 className: "block-editor-block-manager__results", 21544 children: [ 21545 filteredBlockTypes.length === 0 && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { className: "block-editor-block-manager__no-results", children: (0,external_wp_i18n_namespaceObject.__)("No blocks found.") }), 21546 categories.map((category) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 21547 category_category_default, 21548 { 21549 title: category.title, 21550 blockTypes: filteredBlockTypes.filter( 21551 (blockType) => blockType.category === category.slug 21552 ), 21553 selectedBlockTypes, 21554 onChange 21555 }, 21556 category.slug 21557 )), 21558 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 21559 category_category_default, 21560 { 21561 title: (0,external_wp_i18n_namespaceObject.__)("Uncategorized"), 21562 blockTypes: filteredBlockTypes.filter( 21563 ({ category }) => !category 21564 ), 21565 selectedBlockTypes, 21566 onChange 21567 } 21568 ) 21569 ] 21570 } 21571 ) 21572 ] }); 21573 } 21574 21575 21576 ;// ./node_modules/@wordpress/block-editor/build-module/components/block-allowed-blocks/modal.js 21577 21578 21579 21580 21581 21582 21583 21584 function BlockAllowedBlocksModal({ 21585 clientId, 21586 blockTypes, 21587 selectedBlockTypes, 21588 onClose 21589 }) { 21590 const [currentSelectedBlockTypes, setCurrentSelectedBlockTypes] = (0,external_wp_element_namespaceObject.useState)(selectedBlockTypes); 21591 const { updateBlockAttributes } = (0,external_wp_data_namespaceObject.useDispatch)(store); 21592 const handleSubmit = () => { 21593 const isFullySelected = currentSelectedBlockTypes.length === blockTypes.length; 21594 const newBlockNames = currentSelectedBlockTypes.map( 21595 ({ name }) => name 21596 ); 21597 updateBlockAttributes(clientId, { 21598 allowedBlocks: isFullySelected ? void 0 : newBlockNames 21599 }); 21600 onClose(); 21601 }; 21602 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 21603 external_wp_components_namespaceObject.Modal, 21604 { 21605 title: (0,external_wp_i18n_namespaceObject.__)("Manage allowed blocks"), 21606 onRequestClose: onClose, 21607 overlayClassName: "block-editor-block-allowed-blocks-modal", 21608 focusOnMount: "firstContentElement", 21609 size: "medium", 21610 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 21611 external_wp_components_namespaceObject.__experimentalVStack, 21612 { 21613 as: "form", 21614 onSubmit: (e) => { 21615 e.preventDefault(); 21616 handleSubmit(); 21617 }, 21618 spacing: "4", 21619 children: [ 21620 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { children: (0,external_wp_i18n_namespaceObject.__)( 21621 "Select which blocks can be added inside this container." 21622 ) }), 21623 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 21624 BlockManager, 21625 { 21626 blockTypes, 21627 selectedBlockTypes: currentSelectedBlockTypes, 21628 onChange: (newSelectedBlockTypes) => { 21629 setCurrentSelectedBlockTypes(newSelectedBlockTypes); 21630 } 21631 } 21632 ), 21633 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 21634 external_wp_components_namespaceObject.Flex, 21635 { 21636 className: "block-editor-block-allowed-blocks-modal__actions", 21637 justify: "flex-end", 21638 expanded: false, 21639 children: [ 21640 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 21641 external_wp_components_namespaceObject.Button, 21642 { 21643 variant: "tertiary", 21644 onClick: onClose, 21645 __next40pxDefaultSize: true, 21646 children: (0,external_wp_i18n_namespaceObject.__)("Cancel") 21647 } 21648 ) }), 21649 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 21650 external_wp_components_namespaceObject.Button, 21651 { 21652 variant: "primary", 21653 type: "submit", 21654 __next40pxDefaultSize: true, 21655 children: (0,external_wp_i18n_namespaceObject.__)("Apply") 21656 } 21657 ) }) 21658 ] 21659 } 21660 ) 21661 ] 21662 } 21663 ) 21664 } 21665 ); 21666 } 21667 21668 21669 ;// ./node_modules/@wordpress/block-editor/build-module/components/block-allowed-blocks/allowed-blocks-control.js 21670 21671 21672 21673 21674 21675 21676 21677 21678 function BlockAllowedBlocksControl({ clientId }) { 21679 const [isBlockControlOpened, setIsBlockControlOpened] = (0,external_wp_element_namespaceObject.useState)(false); 21680 const { blockTypes, selectedBlockNames } = (0,external_wp_data_namespaceObject.useSelect)( 21681 (select) => { 21682 const { getBlockAttributes } = select(store); 21683 return { 21684 blockTypes: select(external_wp_blocks_namespaceObject.store).getBlockTypes(), 21685 selectedBlockNames: getBlockAttributes(clientId)?.allowedBlocks 21686 }; 21687 }, 21688 [clientId] 21689 ); 21690 const filteredBlockTypes = blockTypes.filter( 21691 (blockType) => (0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockType, "inserter", true) && (!blockType.parent || blockType.parent.includes("core/post-content")) 21692 ); 21693 if (!filteredBlockTypes) { 21694 return null; 21695 } 21696 const selectedBlockTypes = selectedBlockNames === void 0 ? filteredBlockTypes : filteredBlockTypes.filter( 21697 (blockType) => selectedBlockNames.includes(blockType.name) 21698 ); 21699 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-editor-block-allowed-blocks-control", children: [ 21700 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 21701 external_wp_components_namespaceObject.BaseControl, 21702 { 21703 help: (0,external_wp_i18n_namespaceObject.__)( 21704 "Specify which blocks are allowed inside this container." 21705 ), 21706 __nextHasNoMarginBottom: true, 21707 children: [ 21708 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.BaseControl.VisualLabel, { children: (0,external_wp_i18n_namespaceObject.__)("Allowed Blocks") }), 21709 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 21710 external_wp_components_namespaceObject.Button, 21711 { 21712 __next40pxDefaultSize: true, 21713 variant: "secondary", 21714 onClick: () => { 21715 setIsBlockControlOpened(true); 21716 }, 21717 className: "block-editor-block-allowed-blocks-control__button", 21718 children: (0,external_wp_i18n_namespaceObject.__)("Manage allowed blocks") 21719 } 21720 ) 21721 ] 21722 } 21723 ), 21724 isBlockControlOpened && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 21725 BlockAllowedBlocksModal, 21726 { 21727 clientId, 21728 blockTypes: filteredBlockTypes, 21729 selectedBlockTypes, 21730 onClose: () => setIsBlockControlOpened(false) 21731 } 21732 ) 21733 ] }); 21734 } 21735 21736 21737 ;// ./node_modules/@wordpress/block-editor/build-module/hooks/allowed-blocks.js 21738 21739 21740 21741 21742 21743 21744 21745 function BlockEditAllowedBlocksControlPure({ clientId }) { 21746 const isContentOnly = (0,external_wp_data_namespaceObject.useSelect)( 21747 (select) => { 21748 return select(store).getBlockEditingMode(clientId) === "contentOnly"; 21749 }, 21750 [clientId] 21751 ); 21752 if (isContentOnly) { 21753 return null; 21754 } 21755 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PrivateInspectorControlsAllowedBlocks.Fill, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockAllowedBlocksControl, { clientId }) }); 21756 } 21757 var allowed_blocks_default = { 21758 edit: BlockEditAllowedBlocksControlPure, 21759 attributeKeys: ["allowedBlocks"], 21760 hasSupport(name) { 21761 return (0,external_wp_blocks_namespaceObject.hasBlockSupport)(name, "allowedBlocks"); 21762 } 21763 }; 21764 function allowed_blocks_addAttribute(settings) { 21765 if (settings?.attributes?.allowedBlocks?.type) { 21766 return settings; 21767 } 21768 if ((0,external_wp_blocks_namespaceObject.hasBlockSupport)(settings, "allowedBlocks")) { 21769 settings.attributes = { 21770 ...settings.attributes, 21771 allowedBlocks: { 21772 type: "array" 21773 } 21774 }; 21775 } 21776 return settings; 21777 } 21778 (0,external_wp_hooks_namespaceObject.addFilter)( 21779 "blocks.registerBlockType", 21780 "core/allowedBlocks/attribute", 21781 allowed_blocks_addAttribute 21782 ); 21783 21784 21785 ;// ./node_modules/@wordpress/block-editor/build-module/hooks/anchor.js 21786 21787 21788 21789 21790 21791 21792 21793 21794 const ANCHOR_REGEX = /[\s#]/g; 21795 const ANCHOR_SCHEMA = { 21796 type: "string", 21797 source: "attribute", 21798 attribute: "id", 21799 selector: "*" 21800 }; 21801 function anchor_addAttribute(settings) { 21802 if ("type" in (settings.attributes?.anchor ?? {})) { 21803 return settings; 21804 } 21805 if ((0,external_wp_blocks_namespaceObject.hasBlockSupport)(settings, "anchor")) { 21806 settings.attributes = { 21807 ...settings.attributes, 21808 anchor: ANCHOR_SCHEMA 21809 }; 21810 } 21811 return settings; 21812 } 21813 function BlockEditAnchorControlPure({ anchor, setAttributes }) { 21814 const blockEditingMode = useBlockEditingMode(); 21815 if (blockEditingMode !== "default") { 21816 return null; 21817 } 21818 const isWeb = external_wp_element_namespaceObject.Platform.OS === "web"; 21819 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls_default, { group: "advanced", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 21820 external_wp_components_namespaceObject.TextControl, 21821 { 21822 __nextHasNoMarginBottom: true, 21823 __next40pxDefaultSize: true, 21824 className: "html-anchor-control", 21825 label: (0,external_wp_i18n_namespaceObject.__)("HTML anchor"), 21826 help: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 21827 (0,external_wp_i18n_namespaceObject.__)( 21828 "Enter a word or two \u2014 without spaces \u2014 to make a unique web address just for this block, called an \u201Canchor\u201D. Then, you\u2019ll be able to link directly to this section of your page." 21829 ), 21830 isWeb && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 21831 " ", 21832 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 21833 external_wp_components_namespaceObject.ExternalLink, 21834 { 21835 href: (0,external_wp_i18n_namespaceObject.__)( 21836 "https://wordpress.org/documentation/article/page-jumps/" 21837 ), 21838 children: (0,external_wp_i18n_namespaceObject.__)("Learn more about anchors") 21839 } 21840 ) 21841 ] }) 21842 ] }), 21843 value: anchor || "", 21844 placeholder: !isWeb ? (0,external_wp_i18n_namespaceObject.__)("Add an anchor") : null, 21845 onChange: (nextValue) => { 21846 nextValue = nextValue.replace(ANCHOR_REGEX, "-"); 21847 setAttributes({ 21848 anchor: nextValue 21849 }); 21850 }, 21851 autoCapitalize: "none", 21852 autoComplete: "off" 21853 } 21854 ) }); 21855 } 21856 var anchor_default = { 21857 addSaveProps, 21858 edit: BlockEditAnchorControlPure, 21859 attributeKeys: ["anchor"], 21860 hasSupport(name) { 21861 return (0,external_wp_blocks_namespaceObject.hasBlockSupport)(name, "anchor"); 21862 } 21863 }; 21864 function addSaveProps(extraProps, blockType, attributes) { 21865 if ((0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockType, "anchor")) { 21866 extraProps.id = attributes.anchor === "" ? null : attributes.anchor; 21867 } 21868 return extraProps; 21869 } 21870 (0,external_wp_hooks_namespaceObject.addFilter)("blocks.registerBlockType", "core/anchor/attribute", anchor_addAttribute); 21871 21872 21873 ;// ./node_modules/@wordpress/block-editor/build-module/hooks/aria-label.js 21874 21875 21876 function aria_label_addAttribute(settings) { 21877 if (settings?.attributes?.ariaLabel?.type) { 21878 return settings; 21879 } 21880 if ((0,external_wp_blocks_namespaceObject.hasBlockSupport)(settings, "ariaLabel")) { 21881 settings.attributes = { 21882 ...settings.attributes, 21883 ariaLabel: { 21884 type: "string" 21885 } 21886 }; 21887 } 21888 return settings; 21889 } 21890 function aria_label_addSaveProps(extraProps, blockType, attributes) { 21891 if ((0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockType, "ariaLabel")) { 21892 extraProps["aria-label"] = attributes.ariaLabel === "" ? null : attributes.ariaLabel; 21893 } 21894 return extraProps; 21895 } 21896 var aria_label_default = { 21897 addSaveProps: aria_label_addSaveProps, 21898 attributeKeys: ["ariaLabel"], 21899 hasSupport(name) { 21900 return (0,external_wp_blocks_namespaceObject.hasBlockSupport)(name, "ariaLabel"); 21901 } 21902 }; 21903 (0,external_wp_hooks_namespaceObject.addFilter)( 21904 "blocks.registerBlockType", 21905 "core/ariaLabel/attribute", 21906 aria_label_addAttribute 21907 ); 21908 21909 21910 ;// ./node_modules/@wordpress/block-editor/build-module/hooks/custom-class-name.js 21911 21912 21913 21914 21915 21916 21917 21918 21919 function custom_class_name_addAttribute(settings) { 21920 if ((0,external_wp_blocks_namespaceObject.hasBlockSupport)(settings, "customClassName", true)) { 21921 settings.attributes = { 21922 ...settings.attributes, 21923 className: { 21924 type: "string" 21925 } 21926 }; 21927 } 21928 return settings; 21929 } 21930 function CustomClassNameControlsPure({ className, setAttributes }) { 21931 const blockEditingMode = useBlockEditingMode(); 21932 if (blockEditingMode !== "default") { 21933 return null; 21934 } 21935 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls_default, { group: "advanced", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 21936 external_wp_components_namespaceObject.TextControl, 21937 { 21938 __nextHasNoMarginBottom: true, 21939 __next40pxDefaultSize: true, 21940 autoComplete: "off", 21941 label: (0,external_wp_i18n_namespaceObject.__)("Additional CSS class(es)"), 21942 value: className || "", 21943 onChange: (nextValue) => { 21944 setAttributes({ 21945 className: nextValue !== "" ? nextValue : void 0 21946 }); 21947 }, 21948 help: (0,external_wp_i18n_namespaceObject.__)("Separate multiple classes with spaces.") 21949 } 21950 ) }); 21951 } 21952 var custom_class_name_default = { 21953 edit: CustomClassNameControlsPure, 21954 addSaveProps: custom_class_name_addSaveProps, 21955 attributeKeys: ["className"], 21956 hasSupport(name) { 21957 return (0,external_wp_blocks_namespaceObject.hasBlockSupport)(name, "customClassName", true); 21958 } 21959 }; 21960 function custom_class_name_addSaveProps(extraProps, blockType, attributes) { 21961 if ((0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockType, "customClassName", true) && attributes.className) { 21962 extraProps.className = dist_clsx( 21963 extraProps.className, 21964 attributes.className 21965 ); 21966 } 21967 return extraProps; 21968 } 21969 function addTransforms(result, source, index, results) { 21970 if (!(0,external_wp_blocks_namespaceObject.hasBlockSupport)(result.name, "customClassName", true)) { 21971 return result; 21972 } 21973 if (results.length === 1 && result.innerBlocks.length === source.length) { 21974 return result; 21975 } 21976 if (results.length === 1 && source.length > 1 || results.length > 1 && source.length === 1) { 21977 return result; 21978 } 21979 if (source[index]) { 21980 const originClassName = source[index]?.attributes.className; 21981 if (originClassName && result.attributes.className === void 0) { 21982 return { 21983 ...result, 21984 attributes: { 21985 ...result.attributes, 21986 className: originClassName 21987 } 21988 }; 21989 } 21990 } 21991 return result; 21992 } 21993 (0,external_wp_hooks_namespaceObject.addFilter)( 21994 "blocks.registerBlockType", 21995 "core/editor/custom-class-name/attribute", 21996 custom_class_name_addAttribute 21997 ); 21998 (0,external_wp_hooks_namespaceObject.addFilter)( 21999 "blocks.switchToBlockType.transformedBlock", 22000 "core/customClassName/addTransforms", 22001 addTransforms 22002 ); 22003 22004 22005 ;// ./node_modules/@wordpress/block-editor/build-module/hooks/generated-class-name.js 22006 22007 22008 function addGeneratedClassName(extraProps, blockType) { 22009 if ((0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockType, "className", true)) { 22010 if (typeof extraProps.className === "string") { 22011 extraProps.className = [ 22012 .../* @__PURE__ */ new Set([ 22013 (0,external_wp_blocks_namespaceObject.getBlockDefaultClassName)(blockType.name), 22014 ...extraProps.className.split(" ") 22015 ]) 22016 ].join(" ").trim(); 22017 } else { 22018 extraProps.className = (0,external_wp_blocks_namespaceObject.getBlockDefaultClassName)(blockType.name); 22019 } 22020 } 22021 return extraProps; 22022 } 22023 (0,external_wp_hooks_namespaceObject.addFilter)( 22024 "blocks.getSaveContent.extraProps", 22025 "core/generated-class-name/save-props", 22026 addGeneratedClassName 22027 ); 22028 22029 22030 ;// ./node_modules/colord/index.mjs 22031 var colord_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,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)||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)*(colord_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()})}; 22032 22033 ;// ./node_modules/colord/plugins/names.mjs 22034 /* harmony default export */ function names(e,f){var a={white:"#ffffff",bisque:"#ffe4c4",blue:"#0000ff",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",antiquewhite:"#faebd7",aqua:"#00ffff",azure:"#f0ffff",whitesmoke:"#f5f5f5",papayawhip:"#ffefd5",plum:"#dda0dd",blanchedalmond:"#ffebcd",black:"#000000",gold:"#ffd700",goldenrod:"#daa520",gainsboro:"#dcdcdc",cornsilk:"#fff8dc",cornflowerblue:"#6495ed",burlywood:"#deb887",aquamarine:"#7fffd4",beige:"#f5f5dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkkhaki:"#bdb76b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",peachpuff:"#ffdab9",darkmagenta:"#8b008b",darkred:"#8b0000",darkorchid:"#9932cc",darkorange:"#ff8c00",darkslateblue:"#483d8b",gray:"#808080",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",deeppink:"#ff1493",deepskyblue:"#00bfff",wheat:"#f5deb3",firebrick:"#b22222",floralwhite:"#fffaf0",ghostwhite:"#f8f8ff",darkviolet:"#9400d3",magenta:"#ff00ff",green:"#008000",dodgerblue:"#1e90ff",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",blueviolet:"#8a2be2",forestgreen:"#228b22",lawngreen:"#7cfc00",indianred:"#cd5c5c",indigo:"#4b0082",fuchsia:"#ff00ff",brown:"#a52a2a",maroon:"#800000",mediumblue:"#0000cd",lightcoral:"#f08080",darkturquoise:"#00ced1",lightcyan:"#e0ffff",ivory:"#fffff0",lightyellow:"#ffffe0",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",linen:"#faf0e6",mediumaquamarine:"#66cdaa",lemonchiffon:"#fffacd",lime:"#00ff00",khaki:"#f0e68c",mediumseagreen:"#3cb371",limegreen:"#32cd32",mediumspringgreen:"#00fa9a",lightskyblue:"#87cefa",lightblue:"#add8e6",midnightblue:"#191970",lightpink:"#ffb6c1",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",mintcream:"#f5fffa",lightslategray:"#778899",lightslategrey:"#778899",navajowhite:"#ffdead",navy:"#000080",mediumvioletred:"#c71585",powderblue:"#b0e0e6",palegoldenrod:"#eee8aa",oldlace:"#fdf5e6",paleturquoise:"#afeeee",mediumturquoise:"#48d1cc",mediumorchid:"#ba55d3",rebeccapurple:"#663399",lightsteelblue:"#b0c4de",mediumslateblue:"#7b68ee",thistle:"#d8bfd8",tan:"#d2b48c",orchid:"#da70d6",mediumpurple:"#9370db",purple:"#800080",pink:"#ffc0cb",skyblue:"#87ceeb",springgreen:"#00ff7f",palegreen:"#98fb98",red:"#ff0000",yellow:"#ffff00",slateblue:"#6a5acd",lavenderblush:"#fff0f5",peru:"#cd853f",palevioletred:"#db7093",violet:"#ee82ee",teal:"#008080",slategray:"#708090",slategrey:"#708090",aliceblue:"#f0f8ff",darkseagreen:"#8fbc8f",darkolivegreen:"#556b2f",greenyellow:"#adff2f",seagreen:"#2e8b57",seashell:"#fff5ee",tomato:"#ff6347",silver:"#c0c0c0",sienna:"#a0522d",lavender:"#e6e6fa",lightgreen:"#90ee90",orange:"#ffa500",orangered:"#ff4500",steelblue:"#4682b4",royalblue:"#4169e1",turquoise:"#40e0d0",yellowgreen:"#9acd32",salmon:"#fa8072",saddlebrown:"#8b4513",sandybrown:"#f4a460",rosybrown:"#bc8f8f",darksalmon:"#e9967a",lightgoldenrodyellow:"#fafad2",snow:"#fffafa",lightgrey:"#d3d3d3",lightgray:"#d3d3d3",dimgray:"#696969",dimgrey:"#696969",olivedrab:"#6b8e23",olive:"#808000"},r={};for(var d in a)r[a[d]]=d;var l={};e.prototype.toName=function(f){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return"transparent";var d,i,n=r[this.toHex()];if(n)return n;if(null==f?void 0:f.closest){var o=this.toRgb(),t=1/0,b="black";if(!l.length)for(var c in a)l[c]=new e(a[c]).toRgb();for(var g in a){var u=(d=o,i=l[g],Math.pow(d.r-i.r,2)+Math.pow(d.g-i.g,2)+Math.pow(d.b-i.b,2));u<t&&(t=u,b=g)}return b}};f.string.push([function(f){var r=f.toLowerCase(),d="transparent"===r?"#0000":a[r];return d?new e(d).toRgb():null},"name"])} 22035 22036 ;// ./node_modules/colord/plugins/a11y.mjs 22037 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}} 22038 22039 ;// ./node_modules/@wordpress/block-editor/build-module/components/colors/utils.js 22040 22041 22042 22043 22044 22045 k([names, a11y]); 22046 const { kebabCase } = unlock(external_wp_components_namespaceObject.privateApis); 22047 const getColorObjectByAttributeValues = (colors, definedColor, customColor) => { 22048 if (definedColor) { 22049 const colorObj = colors?.find( 22050 (color) => color.slug === definedColor 22051 ); 22052 if (colorObj) { 22053 return colorObj; 22054 } 22055 } 22056 return { 22057 color: customColor 22058 }; 22059 }; 22060 const getColorObjectByColorValue = (colors, colorValue) => { 22061 return colors?.find((color) => color.color === colorValue); 22062 }; 22063 function getColorClassName(colorContextName, colorSlug) { 22064 if (!colorContextName || !colorSlug) { 22065 return void 0; 22066 } 22067 return `has-$kebabCase(colorSlug)}-$colorContextName}`; 22068 } 22069 function getMostReadableColor(colors, colorValue) { 22070 const colordColor = w(colorValue); 22071 const getColorContrast = ({ color }) => colordColor.contrast(color); 22072 const maxContrast = Math.max(...colors.map(getColorContrast)); 22073 return colors.find((color) => getColorContrast(color) === maxContrast).color; 22074 } 22075 22076 22077 ;// ./node_modules/@wordpress/block-editor/build-module/components/colors-gradients/use-multiple-origin-colors-and-gradients.js 22078 22079 22080 22081 function useMultipleOriginColorsAndGradients() { 22082 const [ 22083 enableCustomColors, 22084 customColors, 22085 themeColors, 22086 defaultColors, 22087 shouldDisplayDefaultColors, 22088 enableCustomGradients, 22089 customGradients, 22090 themeGradients, 22091 defaultGradients, 22092 shouldDisplayDefaultGradients 22093 ] = use_settings_useSettings( 22094 "color.custom", 22095 "color.palette.custom", 22096 "color.palette.theme", 22097 "color.palette.default", 22098 "color.defaultPalette", 22099 "color.customGradient", 22100 "color.gradients.custom", 22101 "color.gradients.theme", 22102 "color.gradients.default", 22103 "color.defaultGradients" 22104 ); 22105 const colorGradientSettings = { 22106 disableCustomColors: !enableCustomColors, 22107 disableCustomGradients: !enableCustomGradients 22108 }; 22109 colorGradientSettings.colors = (0,external_wp_element_namespaceObject.useMemo)(() => { 22110 const result = []; 22111 if (themeColors && themeColors.length) { 22112 result.push({ 22113 name: (0,external_wp_i18n_namespaceObject._x)( 22114 "Theme", 22115 "Indicates this palette comes from the theme." 22116 ), 22117 slug: "theme", 22118 colors: themeColors 22119 }); 22120 } 22121 if (shouldDisplayDefaultColors && defaultColors && defaultColors.length) { 22122 result.push({ 22123 name: (0,external_wp_i18n_namespaceObject._x)( 22124 "Default", 22125 "Indicates this palette comes from WordPress." 22126 ), 22127 slug: "default", 22128 colors: defaultColors 22129 }); 22130 } 22131 if (customColors && customColors.length) { 22132 result.push({ 22133 name: (0,external_wp_i18n_namespaceObject._x)( 22134 "Custom", 22135 "Indicates this palette is created by the user." 22136 ), 22137 slug: "custom", 22138 colors: customColors 22139 }); 22140 } 22141 return result; 22142 }, [ 22143 customColors, 22144 themeColors, 22145 defaultColors, 22146 shouldDisplayDefaultColors 22147 ]); 22148 colorGradientSettings.gradients = (0,external_wp_element_namespaceObject.useMemo)(() => { 22149 const result = []; 22150 if (themeGradients && themeGradients.length) { 22151 result.push({ 22152 name: (0,external_wp_i18n_namespaceObject._x)( 22153 "Theme", 22154 "Indicates this palette comes from the theme." 22155 ), 22156 slug: "theme", 22157 gradients: themeGradients 22158 }); 22159 } 22160 if (shouldDisplayDefaultGradients && defaultGradients && defaultGradients.length) { 22161 result.push({ 22162 name: (0,external_wp_i18n_namespaceObject._x)( 22163 "Default", 22164 "Indicates this palette comes from WordPress." 22165 ), 22166 slug: "default", 22167 gradients: defaultGradients 22168 }); 22169 } 22170 if (customGradients && customGradients.length) { 22171 result.push({ 22172 name: (0,external_wp_i18n_namespaceObject._x)( 22173 "Custom", 22174 "Indicates this palette is created by the user." 22175 ), 22176 slug: "custom", 22177 gradients: customGradients 22178 }); 22179 } 22180 return result; 22181 }, [ 22182 customGradients, 22183 themeGradients, 22184 defaultGradients, 22185 shouldDisplayDefaultGradients 22186 ]); 22187 colorGradientSettings.hasColorsOrGradients = !!colorGradientSettings.colors.length || !!colorGradientSettings.gradients.length; 22188 return colorGradientSettings; 22189 } 22190 22191 22192 ;// ./node_modules/@wordpress/icons/build-module/library/link.js 22193 22194 22195 var link_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M10 17.389H8.444A5.194 5.194 0 1 1 8.444 7H10v1.5H8.444a3.694 3.694 0 0 0 0 7.389H10v1.5ZM14 7h1.556a5.194 5.194 0 0 1 0 10.39H14v-1.5h1.556a3.694 3.694 0 0 0 0-7.39H14V7Zm-4.5 6h5v-1.5h-5V13Z" }) }); 22196 22197 22198 ;// ./node_modules/@wordpress/block-editor/build-module/components/border-radius-control/linked-button.js 22199 22200 22201 22202 22203 function LinkedButton({ isLinked, ...props }) { 22204 const label = isLinked ? (0,external_wp_i18n_namespaceObject.__)("Unlink radii") : (0,external_wp_i18n_namespaceObject.__)("Link radii"); 22205 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 22206 external_wp_components_namespaceObject.Button, 22207 { 22208 ...props, 22209 className: "components-border-radius-control__linked-button", 22210 size: "small", 22211 icon: isLinked ? link_default : link_off_default, 22212 iconSize: 24, 22213 label 22214 } 22215 ); 22216 } 22217 22218 22219 ;// ./node_modules/@wordpress/block-editor/build-module/components/border-radius-control/utils.js 22220 22221 function mode(inputArray) { 22222 const arr = [...inputArray]; 22223 return arr.sort( 22224 (a, b) => inputArray.filter((v) => v === b).length - inputArray.filter((v) => v === a).length 22225 ).shift(); 22226 } 22227 function getAllUnit(selectedUnits = {}) { 22228 const { flat, ...cornerUnits } = selectedUnits; 22229 return flat || mode(Object.values(cornerUnits).filter(Boolean)) || "px"; 22230 } 22231 function getAllValue(values = {}) { 22232 if (typeof values === "string") { 22233 return values; 22234 } 22235 const parsedQuantitiesAndUnits = Object.values(values).map( 22236 (value2) => (0,external_wp_components_namespaceObject.__experimentalParseQuantityAndUnitFromRawValue)(value2) 22237 ); 22238 const allValues = parsedQuantitiesAndUnits.map( 22239 (value2) => value2[0] ?? "" 22240 ); 22241 const allUnits = parsedQuantitiesAndUnits.map((value2) => value2[1]); 22242 const value = allValues.every((v) => v === allValues[0]) ? allValues[0] : ""; 22243 const unit = mode(allUnits); 22244 const allValue = value === 0 || value ? `$value}$unit || ""}` : void 0; 22245 return allValue; 22246 } 22247 function hasMixedValues(values = {}) { 22248 if (typeof values === "string") { 22249 return false; 22250 } 22251 if (!values || typeof values !== "object") { 22252 return false; 22253 } 22254 const cornerValues = Object.values(values); 22255 if (cornerValues.length === 0) { 22256 return false; 22257 } 22258 const firstValue = cornerValues[0]; 22259 const allSame = cornerValues.every((value) => value === firstValue); 22260 return !allSame; 22261 } 22262 function hasDefinedValues(values) { 22263 if (!values) { 22264 return false; 22265 } 22266 if (typeof values === "string") { 22267 return true; 22268 } 22269 const filteredValues = Object.values(values).filter((value) => { 22270 return !!value || value === 0; 22271 }); 22272 return !!filteredValues.length; 22273 } 22274 function isValuePreset(value) { 22275 if (!value?.includes) { 22276 return false; 22277 } 22278 return value === "0" || value.includes("var:preset|border-radius|"); 22279 } 22280 function getPresetSlug(value) { 22281 if (!value) { 22282 return; 22283 } 22284 if (value === "0" || value === "default") { 22285 return value; 22286 } 22287 const slug = value.match(/var:preset\|border-radius\|(.+)/); 22288 return slug ? slug[1] : void 0; 22289 } 22290 function utils_getSliderValueFromPreset(presetValue, presets) { 22291 if (presetValue === void 0) { 22292 return 0; 22293 } 22294 const slug = parseFloat(presetValue, 10) === 0 ? "0" : getPresetSlug(presetValue); 22295 const sliderValue = presets.findIndex((size) => { 22296 return String(size.slug) === slug; 22297 }); 22298 return sliderValue !== -1 ? sliderValue : NaN; 22299 } 22300 function utils_getCustomValueFromPreset(value, presets) { 22301 if (!isValuePreset(value)) { 22302 return value; 22303 } 22304 const slug = parseFloat(value, 10) === 0 ? "0" : getPresetSlug(value); 22305 const radiusSize = presets.find((size) => String(size.slug) === slug); 22306 return radiusSize?.size; 22307 } 22308 function getPresetValueFromControlValue(controlValue, controlType, presets) { 22309 const size = parseInt(controlValue, 10); 22310 if (controlType === "selectList") { 22311 if (size === 0) { 22312 return void 0; 22313 } 22314 } else if (size === 0) { 22315 return "0"; 22316 } 22317 return `var:preset|border-radius|$presets[controlValue]?.slug}`; 22318 } 22319 function utils_getPresetValueFromCustomValue(value, presets) { 22320 if (!value || isValuePreset(value) || value === "0") { 22321 return value; 22322 } 22323 const spacingMatch = presets.find( 22324 (size) => String(size.size) === String(value) 22325 ); 22326 if (spacingMatch?.slug) { 22327 return `var:preset|border-radius|$spacingMatch.slug}`; 22328 } 22329 return value; 22330 } 22331 function convertPresetsToCustomValues(values, presets) { 22332 if (!values || typeof values !== "object") { 22333 return values; 22334 } 22335 const converted = {}; 22336 Object.keys(values).forEach((key) => { 22337 const value = values[key]; 22338 if (isValuePreset(value)) { 22339 const customValue = utils_getCustomValueFromPreset(value, presets); 22340 converted[key] = customValue !== void 0 ? customValue : value; 22341 } else { 22342 converted[key] = value; 22343 } 22344 }); 22345 return converted; 22346 } 22347 22348 22349 ;// ./node_modules/@wordpress/icons/build-module/library/settings.js 22350 22351 22352 var settings_settings_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: [ 22353 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 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" }), 22354 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 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" }) 22355 ] }); 22356 22357 22358 ;// ./node_modules/@wordpress/icons/build-module/library/corner-all.js 22359 22360 22361 var corner_all_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 22362 external_wp_primitives_namespaceObject.Path, 22363 { 22364 fillRule: "evenodd", 22365 clipRule: "evenodd", 22366 d: "M5.75 6A.25.25 0 0 1 6 5.75h3v-1.5H6A1.75 1.75 0 0 0 4.25 6v3h1.5V6ZM18 18.25h-3v1.5h3A1.75 1.75 0 0 0 19.75 18v-3h-1.5v3a.25.25 0 0 1-.25.25ZM18.25 9V6a.25.25 0 0 0-.25-.25h-3v-1.5h3c.966 0 1.75.784 1.75 1.75v3h-1.5Zm-12.5 9v-3h-1.5v3c0 .966.784 1.75 1.75 1.75h3v-1.5H6a.25.25 0 0 1-.25-.25Z" 22367 } 22368 ) }); 22369 22370 22371 ;// ./node_modules/@wordpress/icons/build-module/library/corner-top-left.js 22372 22373 22374 var corner_top_left_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: [ 22375 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.G, { opacity: ".25", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M5.75 6A.25.25 0 0 1 6 5.75h3v-1.5H6A1.75 1.75 0 0 0 4.25 6v3h1.5V6ZM18 18.25h-3v1.5h3A1.75 1.75 0 0 0 19.75 18v-3h-1.5v3a.25.25 0 0 1-.25.25ZM18.25 9V6a.25.25 0 0 0-.25-.25h-3v-1.5h3c.966 0 1.75.784 1.75 1.75v3h-1.5ZM5.75 18v-3h-1.5v3c0 .966.784 1.75 1.75 1.75h3v-1.5H6a.25.25 0 0 1-.25-.25Z" }) }), 22376 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 22377 external_wp_primitives_namespaceObject.Path, 22378 { 22379 fillRule: "evenodd", 22380 clipRule: "evenodd", 22381 d: "M6 5.75a.25.25 0 0 0-.25.25v3h-1.5V6c0-.966.784-1.75 1.75-1.75h3v1.5H6Z" 22382 } 22383 ) 22384 ] }); 22385 22386 22387 ;// ./node_modules/@wordpress/icons/build-module/library/corner-top-right.js 22388 22389 22390 var corner_top_right_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: [ 22391 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.G, { opacity: ".25", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M5.75 6A.25.25 0 0 1 6 5.75h3v-1.5H6A1.75 1.75 0 0 0 4.25 6v3h1.5V6ZM18 18.25h-3v1.5h3A1.75 1.75 0 0 0 19.75 18v-3h-1.5v3a.25.25 0 0 1-.25.25ZM18.25 9V6a.25.25 0 0 0-.25-.25h-3v-1.5h3c.966 0 1.75.784 1.75 1.75v3h-1.5ZM5.75 18v-3h-1.5v3c0 .966.784 1.75 1.75 1.75h3v-1.5H6a.25.25 0 0 1-.25-.25Z" }) }), 22392 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 22393 external_wp_primitives_namespaceObject.Path, 22394 { 22395 fillRule: "evenodd", 22396 clipRule: "evenodd", 22397 d: "M18.25 9V6a.25.25 0 0 0-.25-.25h-3v-1.5h3c.966 0 1.75.784 1.75 1.75v3h-1.5Z" 22398 } 22399 ) 22400 ] }); 22401 22402 22403 ;// ./node_modules/@wordpress/icons/build-module/library/corner-bottom-left.js 22404 22405 22406 var corner_bottom_left_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: [ 22407 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.G, { opacity: ".25", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M5.75 6A.25.25 0 0 1 6 5.75h3v-1.5H6A1.75 1.75 0 0 0 4.25 6v3h1.5V6ZM18 18.25h-3v1.5h3A1.75 1.75 0 0 0 19.75 18v-3h-1.5v3a.25.25 0 0 1-.25.25ZM18.25 9V6a.25.25 0 0 0-.25-.25h-3v-1.5h3c.966 0 1.75.784 1.75 1.75v3h-1.5ZM5.75 18v-3h-1.5v3c0 .966.784 1.75 1.75 1.75h3v-1.5H6a.25.25 0 0 1-.25-.25Z" }) }), 22408 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 22409 external_wp_primitives_namespaceObject.Path, 22410 { 22411 fillRule: "evenodd", 22412 clipRule: "evenodd", 22413 d: "M5.75 15v3c0 .138.112.25.25.25h3v1.5H6A1.75 1.75 0 0 1 4.25 18v-3h1.5Z" 22414 } 22415 ) 22416 ] }); 22417 22418 22419 ;// ./node_modules/@wordpress/icons/build-module/library/corner-bottom-right.js 22420 22421 22422 var corner_bottom_right_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: [ 22423 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.G, { opacity: ".25", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M5.75 6A.25.25 0 0 1 6 5.75h3v-1.5H6A1.75 1.75 0 0 0 4.25 6v3h1.5V6ZM18 18.25h-3v1.5h3A1.75 1.75 0 0 0 19.75 18v-3h-1.5v3a.25.25 0 0 1-.25.25ZM18.25 9V6a.25.25 0 0 0-.25-.25h-3v-1.5h3c.966 0 1.75.784 1.75 1.75v3h-1.5ZM5.75 18v-3h-1.5v3c0 .966.784 1.75 1.75 1.75h3v-1.5H6a.25.25 0 0 1-.25-.25Z" }) }), 22424 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 22425 external_wp_primitives_namespaceObject.Path, 22426 { 22427 fillRule: "evenodd", 22428 clipRule: "evenodd", 22429 d: "M15 18.25h3a.25.25 0 0 0 .25-.25v-3h1.5v3A1.75 1.75 0 0 1 18 19.75h-3v-1.5Z" 22430 } 22431 ) 22432 ] }); 22433 22434 22435 ;// ./node_modules/@wordpress/block-editor/build-module/components/border-radius-control/constants.js 22436 22437 22438 const constants_DEFAULT_VALUES = { 22439 topLeft: void 0, 22440 topRight: void 0, 22441 bottomLeft: void 0, 22442 bottomRight: void 0 22443 }; 22444 const constants_RANGE_CONTROL_MAX_SIZE = 8; 22445 const constants_EMPTY_ARRAY = []; 22446 const CORNERS = { 22447 all: (0,external_wp_i18n_namespaceObject.__)("Border radius"), 22448 topLeft: (0,external_wp_i18n_namespaceObject.__)("Top left"), 22449 topRight: (0,external_wp_i18n_namespaceObject.__)("Top right"), 22450 bottomLeft: (0,external_wp_i18n_namespaceObject.__)("Bottom left"), 22451 bottomRight: (0,external_wp_i18n_namespaceObject.__)("Bottom right") 22452 }; 22453 const constants_ICONS = { 22454 all: corner_all_default, 22455 topLeft: corner_top_left_default, 22456 topRight: corner_top_right_default, 22457 bottomLeft: corner_bottom_left_default, 22458 bottomRight: corner_bottom_right_default 22459 }; 22460 const MIN_BORDER_RADIUS_VALUE = 0; 22461 const MAX_BORDER_RADIUS_VALUES = { 22462 px: 100, 22463 em: 20, 22464 rem: 20 22465 }; 22466 22467 22468 ;// ./node_modules/@wordpress/block-editor/build-module/components/border-radius-control/single-input-control.js 22469 22470 22471 22472 22473 22474 22475 22476 function SingleInputControl({ 22477 corner, 22478 onChange, 22479 selectedUnits, 22480 setSelectedUnits, 22481 values: valuesProp, 22482 units, 22483 presets 22484 }) { 22485 const changeCornerValue = (validatedValue) => { 22486 if (corner === "all") { 22487 onChange({ 22488 topLeft: validatedValue, 22489 topRight: validatedValue, 22490 bottomLeft: validatedValue, 22491 bottomRight: validatedValue 22492 }); 22493 } else { 22494 onChange({ 22495 ...values, 22496 [corner]: validatedValue 22497 }); 22498 } 22499 }; 22500 const onChangeValue = (next) => { 22501 if (!onChange) { 22502 return; 22503 } 22504 const isNumeric = !isNaN(parseFloat(next)); 22505 const nextValue = isNumeric ? next : void 0; 22506 changeCornerValue(nextValue); 22507 }; 22508 const onChangeUnit = (next) => { 22509 const newUnits = { ...selectedUnits }; 22510 if (corner === "all") { 22511 newUnits.topLeft = next; 22512 newUnits.topRight = next; 22513 newUnits.bottomLeft = next; 22514 newUnits.bottomRight = next; 22515 } else { 22516 newUnits[corner] = next; 22517 } 22518 setSelectedUnits(newUnits); 22519 }; 22520 const values = typeof valuesProp !== "string" ? valuesProp : { 22521 topLeft: valuesProp, 22522 topRight: valuesProp, 22523 bottomLeft: valuesProp, 22524 bottomRight: valuesProp 22525 }; 22526 let value; 22527 if (corner === "all") { 22528 const convertedValues = convertPresetsToCustomValues(values, presets); 22529 const customValue = getAllValue(convertedValues); 22530 value = utils_getPresetValueFromCustomValue(customValue, presets); 22531 } else { 22532 value = utils_getPresetValueFromCustomValue(values[corner], presets); 22533 } 22534 const resolvedPresetValue = isValuePreset(value) ? utils_getCustomValueFromPreset(value, presets) : value; 22535 const [parsedQuantity, parsedUnit] = (0,external_wp_components_namespaceObject.__experimentalParseQuantityAndUnitFromRawValue)(resolvedPresetValue); 22536 const computedUnit = value ? parsedUnit : selectedUnits[corner] || selectedUnits.flat || "px"; 22537 const unitConfig = units && units.find((item) => item.value === computedUnit); 22538 const step = unitConfig?.step || 1; 22539 const [showCustomValueControl, setShowCustomValueControl] = (0,external_wp_element_namespaceObject.useState)( 22540 value !== void 0 && !isValuePreset(value) 22541 ); 22542 const showRangeControl = presets.length <= constants_RANGE_CONTROL_MAX_SIZE; 22543 const presetIndex = utils_getSliderValueFromPreset(value, presets); 22544 const rangeTooltip = (newValue) => value === void 0 ? void 0 : presets[newValue]?.name; 22545 const marks = presets.slice(1, presets.length - 1).map((_newValue, index) => ({ 22546 value: index + 1, 22547 label: void 0 22548 })); 22549 const hasPresets = marks.length > 0; 22550 let options = []; 22551 if (!showRangeControl) { 22552 options = [ 22553 ...presets, 22554 { 22555 name: (0,external_wp_i18n_namespaceObject.__)("Custom"), 22556 slug: "custom", 22557 size: resolvedPresetValue 22558 } 22559 ].map((size, index) => ({ 22560 key: index, 22561 name: size.name 22562 })); 22563 } 22564 const icon = constants_ICONS[corner]; 22565 const handleSliderChange = (next) => { 22566 const val = next !== void 0 ? `$next}$computedUnit}` : void 0; 22567 changeCornerValue(val); 22568 }; 22569 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { children: [ 22570 icon && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 22571 external_wp_components_namespaceObject.Icon, 22572 { 22573 className: "components-border-radius-control__icon", 22574 icon, 22575 size: 24 22576 } 22577 ), 22578 (!hasPresets || showCustomValueControl) && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "components-border-radius-control__input-controls-wrapper", children: [ 22579 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Tooltip, { text: CORNERS[corner], placement: "top", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "components-border-radius-control__tooltip-wrapper", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 22580 external_wp_components_namespaceObject.__experimentalUnitControl, 22581 { 22582 className: "components-border-radius-control__unit-control", 22583 "aria-label": CORNERS[corner], 22584 value: [parsedQuantity, computedUnit].join( 22585 "" 22586 ), 22587 onChange: onChangeValue, 22588 onUnitChange: onChangeUnit, 22589 size: "__unstable-large", 22590 min: MIN_BORDER_RADIUS_VALUE, 22591 units 22592 } 22593 ) }) }), 22594 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 22595 external_wp_components_namespaceObject.RangeControl, 22596 { 22597 __next40pxDefaultSize: true, 22598 label: (0,external_wp_i18n_namespaceObject.__)("Border radius"), 22599 hideLabelFromVision: true, 22600 className: "components-border-radius-control__range-control", 22601 value: parsedQuantity ?? "", 22602 min: MIN_BORDER_RADIUS_VALUE, 22603 max: MAX_BORDER_RADIUS_VALUES[computedUnit], 22604 initialPosition: 0, 22605 withInputField: false, 22606 onChange: handleSliderChange, 22607 step, 22608 __nextHasNoMarginBottom: true 22609 } 22610 ) 22611 ] }), 22612 hasPresets && showRangeControl && !showCustomValueControl && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 22613 external_wp_components_namespaceObject.RangeControl, 22614 { 22615 __next40pxDefaultSize: true, 22616 className: "components-border-radius-control__range-control", 22617 value: presetIndex, 22618 onChange: (newSize) => { 22619 changeCornerValue( 22620 getPresetValueFromControlValue( 22621 newSize, 22622 "range", 22623 presets 22624 ) 22625 ); 22626 }, 22627 withInputField: false, 22628 "aria-valuenow": presetIndex, 22629 "aria-valuetext": presets[presetIndex]?.name, 22630 renderTooltipContent: rangeTooltip, 22631 min: 0, 22632 max: presets.length - 1, 22633 marks, 22634 label: CORNERS[corner], 22635 hideLabelFromVision: true, 22636 __nextHasNoMarginBottom: true 22637 } 22638 ), 22639 !showRangeControl && !showCustomValueControl && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 22640 external_wp_components_namespaceObject.CustomSelectControl, 22641 { 22642 className: "components-border-radius-control__custom-select-control", 22643 value: options.find( 22644 (option) => option.key === presetIndex 22645 ) || options[options.length - 1], 22646 onChange: (selection) => { 22647 if (selection.selectedItem.key === options.length - 1) { 22648 setShowCustomValueControl(true); 22649 } else { 22650 changeCornerValue( 22651 getPresetValueFromControlValue( 22652 selection.selectedItem.key, 22653 "selectList", 22654 presets 22655 ) 22656 ); 22657 } 22658 }, 22659 options, 22660 label: CORNERS[corner], 22661 hideLabelFromVision: true, 22662 size: "__unstable-large" 22663 } 22664 ), 22665 hasPresets && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 22666 external_wp_components_namespaceObject.Button, 22667 { 22668 label: showCustomValueControl ? (0,external_wp_i18n_namespaceObject.__)("Use border radius preset") : (0,external_wp_i18n_namespaceObject.__)("Set custom border radius"), 22669 icon: settings_settings_default, 22670 onClick: () => { 22671 setShowCustomValueControl(!showCustomValueControl); 22672 }, 22673 isPressed: showCustomValueControl, 22674 size: "small", 22675 className: "components-border-radius-control__custom-toggle", 22676 iconSize: 24 22677 } 22678 ) 22679 ] }); 22680 } 22681 22682 22683 ;// ./node_modules/@wordpress/block-editor/build-module/components/border-radius-control/index.js 22684 22685 22686 22687 22688 22689 22690 22691 22692 22693 function useBorderRadiusSizes(presets) { 22694 const defaultSizes = presets?.default ?? constants_EMPTY_ARRAY; 22695 const customSizes = presets?.custom ?? constants_EMPTY_ARRAY; 22696 const themeSizes = presets?.theme ?? constants_EMPTY_ARRAY; 22697 return (0,external_wp_element_namespaceObject.useMemo)(() => { 22698 const sizes = [ 22699 { name: (0,external_wp_i18n_namespaceObject.__)("None"), slug: "0", size: 0 }, 22700 ...customSizes, 22701 ...themeSizes, 22702 ...defaultSizes 22703 ]; 22704 return sizes.length > constants_RANGE_CONTROL_MAX_SIZE ? [ 22705 { 22706 name: (0,external_wp_i18n_namespaceObject.__)("Default"), 22707 slug: "default", 22708 size: void 0 22709 }, 22710 ...sizes 22711 ] : sizes; 22712 }, [customSizes, themeSizes, defaultSizes]); 22713 } 22714 function BorderRadiusControl({ onChange, values, presets }) { 22715 const [isLinked, setIsLinked] = (0,external_wp_element_namespaceObject.useState)( 22716 !hasDefinedValues(values) || !hasMixedValues(values) 22717 ); 22718 const options = useBorderRadiusSizes(presets); 22719 const [selectedUnits, setSelectedUnits] = (0,external_wp_element_namespaceObject.useState)({ 22720 flat: typeof values === "string" ? (0,external_wp_components_namespaceObject.__experimentalParseQuantityAndUnitFromRawValue)(values)[1] : void 0, 22721 topLeft: (0,external_wp_components_namespaceObject.__experimentalParseQuantityAndUnitFromRawValue)(values?.topLeft)[1], 22722 topRight: (0,external_wp_components_namespaceObject.__experimentalParseQuantityAndUnitFromRawValue)(values?.topRight)[1], 22723 bottomLeft: (0,external_wp_components_namespaceObject.__experimentalParseQuantityAndUnitFromRawValue)(values?.bottomLeft)[1], 22724 bottomRight: (0,external_wp_components_namespaceObject.__experimentalParseQuantityAndUnitFromRawValue)( 22725 values?.bottomRight 22726 )[1] 22727 }); 22728 const [availableUnits] = use_settings_useSettings("spacing.units"); 22729 const units = (0,external_wp_components_namespaceObject.__experimentalUseCustomUnits)({ 22730 availableUnits: availableUnits || ["px", "em", "rem"] 22731 }); 22732 const toggleLinked = () => setIsLinked(!isLinked); 22733 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("fieldset", { className: "components-border-radius-control", children: [ 22734 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { className: "components-border-radius-control__header", children: [ 22735 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.BaseControl.VisualLabel, { as: "legend", children: (0,external_wp_i18n_namespaceObject.__)("Radius") }), 22736 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(LinkedButton, { onClick: toggleLinked, isLinked }) 22737 ] }), 22738 isLinked ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 22739 SingleInputControl, 22740 { 22741 onChange, 22742 selectedUnits, 22743 setSelectedUnits, 22744 values, 22745 units, 22746 corner: "all", 22747 presets: options 22748 } 22749 ) }) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, { children: [ 22750 "topLeft", 22751 "topRight", 22752 "bottomLeft", 22753 "bottomRight" 22754 ].map((corner) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 22755 SingleInputControl, 22756 { 22757 onChange, 22758 selectedUnits, 22759 setSelectedUnits, 22760 values: values || constants_DEFAULT_VALUES, 22761 units, 22762 corner, 22763 presets: options 22764 }, 22765 corner 22766 )) }) 22767 ] }); 22768 } 22769 22770 22771 ;// ./node_modules/@wordpress/icons/build-module/library/check.js 22772 22773 22774 var check_check_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M16.5 7.5 10 13.9l-2.5-2.4-1 1 3.5 3.6 7.5-7.6z" }) }); 22775 22776 22777 ;// ./node_modules/@wordpress/icons/build-module/library/shadow.js 22778 22779 22780 var shadow_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 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" }) }); 22781 22782 22783 ;// ./node_modules/@wordpress/block-editor/build-module/components/global-styles/shadow-panel-components.js 22784 22785 22786 22787 22788 22789 22790 const shadow_panel_components_EMPTY_ARRAY = []; 22791 function ShadowPopoverContainer({ shadow, onShadowChange, settings }) { 22792 const shadows = useShadowPresets(settings); 22793 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-global-styles__shadow-popover-container", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 4, children: [ 22794 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHeading, { level: 5, children: (0,external_wp_i18n_namespaceObject.__)("Drop shadow") }), 22795 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 22796 ShadowPresets, 22797 { 22798 presets: shadows, 22799 activeShadow: shadow, 22800 onSelect: onShadowChange 22801 } 22802 ), 22803 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-global-styles__clear-shadow", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 22804 external_wp_components_namespaceObject.Button, 22805 { 22806 __next40pxDefaultSize: true, 22807 variant: "tertiary", 22808 onClick: () => onShadowChange(void 0), 22809 disabled: !shadow, 22810 accessibleWhenDisabled: true, 22811 children: (0,external_wp_i18n_namespaceObject.__)("Clear") 22812 } 22813 ) }) 22814 ] }) }); 22815 } 22816 function ShadowPresets({ presets, activeShadow, onSelect }) { 22817 return !presets ? null : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 22818 external_wp_components_namespaceObject.Composite, 22819 { 22820 role: "listbox", 22821 className: "block-editor-global-styles__shadow__list", 22822 "aria-label": (0,external_wp_i18n_namespaceObject.__)("Drop shadows"), 22823 children: presets.map(({ name, slug, shadow }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 22824 ShadowIndicator, 22825 { 22826 label: name, 22827 isActive: shadow === activeShadow, 22828 type: slug === "unset" ? "unset" : "preset", 22829 onSelect: () => onSelect(shadow === activeShadow ? void 0 : shadow), 22830 shadow 22831 }, 22832 slug 22833 )) 22834 } 22835 ); 22836 } 22837 function ShadowIndicator({ type, label, isActive, onSelect, shadow }) { 22838 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Tooltip, { text: label, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 22839 external_wp_components_namespaceObject.Composite.Item, 22840 { 22841 role: "option", 22842 "aria-label": label, 22843 "aria-selected": isActive, 22844 className: dist_clsx("block-editor-global-styles__shadow__item", { 22845 "is-active": isActive 22846 }), 22847 render: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 22848 "button", 22849 { 22850 className: dist_clsx( 22851 "block-editor-global-styles__shadow-indicator", 22852 { 22853 unset: type === "unset" 22854 } 22855 ), 22856 onClick: onSelect, 22857 style: { boxShadow: shadow }, 22858 "aria-label": label, 22859 children: isActive && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(icon_default, { icon: check_check_default }) 22860 } 22861 ) 22862 } 22863 ) }); 22864 } 22865 function ShadowPopover({ shadow, onShadowChange, settings }) { 22866 const popoverProps = { 22867 placement: "left-start", 22868 offset: 36, 22869 shift: true 22870 }; 22871 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 22872 external_wp_components_namespaceObject.Dropdown, 22873 { 22874 popoverProps, 22875 className: "block-editor-global-styles__shadow-dropdown", 22876 renderToggle: renderShadowToggle(shadow, onShadowChange), 22877 renderContent: () => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalDropdownContentWrapper, { paddingSize: "medium", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 22878 ShadowPopoverContainer, 22879 { 22880 shadow, 22881 onShadowChange, 22882 settings 22883 } 22884 ) }) 22885 } 22886 ); 22887 } 22888 function renderShadowToggle(shadow, onShadowChange) { 22889 return ({ onToggle, isOpen }) => { 22890 const shadowButtonRef = (0,external_wp_element_namespaceObject.useRef)(void 0); 22891 const toggleProps = { 22892 onClick: onToggle, 22893 className: dist_clsx( 22894 "block-editor-global-styles__shadow-dropdown-toggle", 22895 { "is-open": isOpen } 22896 ), 22897 "aria-expanded": isOpen, 22898 ref: shadowButtonRef 22899 }; 22900 const removeButtonProps = { 22901 onClick: () => { 22902 if (isOpen) { 22903 onToggle(); 22904 } 22905 onShadowChange(void 0); 22906 shadowButtonRef.current?.focus(); 22907 }, 22908 className: dist_clsx( 22909 "block-editor-global-styles__shadow-editor__remove-button", 22910 { "is-open": isOpen } 22911 ), 22912 label: (0,external_wp_i18n_namespaceObject.__)("Remove") 22913 }; 22914 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 22915 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, ...toggleProps, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "flex-start", children: [ 22916 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 22917 icon_default, 22918 { 22919 className: "block-editor-global-styles__toggle-icon", 22920 icon: shadow_default, 22921 size: 24 22922 } 22923 ), 22924 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: (0,external_wp_i18n_namespaceObject.__)("Drop shadow") }) 22925 ] }) }), 22926 !!shadow && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 22927 external_wp_components_namespaceObject.Button, 22928 { 22929 __next40pxDefaultSize: true, 22930 size: "small", 22931 icon: reset_default, 22932 ...removeButtonProps 22933 } 22934 ) 22935 ] }); 22936 }; 22937 } 22938 function useShadowPresets(settings) { 22939 return (0,external_wp_element_namespaceObject.useMemo)(() => { 22940 if (!settings?.shadow) { 22941 return shadow_panel_components_EMPTY_ARRAY; 22942 } 22943 const defaultPresetsEnabled = settings?.shadow?.defaultPresets; 22944 const { 22945 default: defaultShadows, 22946 theme: themeShadows, 22947 custom: customShadows 22948 } = settings?.shadow?.presets ?? {}; 22949 const unsetShadow = { 22950 name: (0,external_wp_i18n_namespaceObject.__)("Unset"), 22951 slug: "unset", 22952 shadow: "none" 22953 }; 22954 const shadowPresets = [ 22955 ...defaultPresetsEnabled && defaultShadows || shadow_panel_components_EMPTY_ARRAY, 22956 ...themeShadows || shadow_panel_components_EMPTY_ARRAY, 22957 ...customShadows || shadow_panel_components_EMPTY_ARRAY 22958 ]; 22959 if (shadowPresets.length) { 22960 shadowPresets.unshift(unsetShadow); 22961 } 22962 return shadowPresets; 22963 }, [settings]); 22964 } 22965 22966 22967 ;// ./node_modules/@wordpress/block-editor/build-module/components/global-styles/border-panel.js 22968 22969 22970 22971 22972 22973 22974 22975 22976 22977 22978 function useHasBorderPanel(settings) { 22979 const controls = Object.values(useHasBorderPanelControls(settings)); 22980 return controls.some(Boolean); 22981 } 22982 function useHasBorderPanelControls(settings) { 22983 const controls = { 22984 hasBorderColor: useHasBorderColorControl(settings), 22985 hasBorderRadius: useHasBorderRadiusControl(settings), 22986 hasBorderStyle: useHasBorderStyleControl(settings), 22987 hasBorderWidth: useHasBorderWidthControl(settings), 22988 hasShadow: useHasShadowControl(settings) 22989 }; 22990 return controls; 22991 } 22992 function useHasBorderColorControl(settings) { 22993 return settings?.border?.color; 22994 } 22995 function useHasBorderRadiusControl(settings) { 22996 return settings?.border?.radius; 22997 } 22998 function useHasBorderStyleControl(settings) { 22999 return settings?.border?.style; 23000 } 23001 function useHasBorderWidthControl(settings) { 23002 return settings?.border?.width; 23003 } 23004 function useHasShadowControl(settings) { 23005 const shadows = useShadowPresets(settings); 23006 return !!settings?.shadow && shadows.length > 0; 23007 } 23008 function BorderToolsPanel({ 23009 resetAllFilter, 23010 onChange, 23011 value, 23012 panelId, 23013 children, 23014 label 23015 }) { 23016 const dropdownMenuProps = useToolsPanelDropdownMenuProps(); 23017 const resetAll = () => { 23018 const updatedValue = resetAllFilter(value); 23019 onChange(updatedValue); 23020 }; 23021 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 23022 external_wp_components_namespaceObject.__experimentalToolsPanel, 23023 { 23024 label, 23025 resetAll, 23026 panelId, 23027 dropdownMenuProps, 23028 children 23029 } 23030 ); 23031 } 23032 const border_panel_DEFAULT_CONTROLS = { 23033 radius: true, 23034 color: true, 23035 width: true, 23036 shadow: true 23037 }; 23038 function BorderPanel({ 23039 as: Wrapper = BorderToolsPanel, 23040 value, 23041 onChange, 23042 inheritedValue = value, 23043 settings, 23044 panelId, 23045 name, 23046 defaultControls = border_panel_DEFAULT_CONTROLS 23047 }) { 23048 const colors = useColorsPerOrigin(settings); 23049 const decodeValue = (0,external_wp_element_namespaceObject.useCallback)( 23050 (rawValue) => getValueFromVariable({ settings }, "", rawValue), 23051 [settings] 23052 ); 23053 const encodeColorValue = (colorValue) => { 23054 const allColors = colors.flatMap( 23055 ({ colors: originColors }) => originColors 23056 ); 23057 const colorObject = allColors.find( 23058 ({ color }) => color === colorValue 23059 ); 23060 return colorObject ? "var:preset|color|" + colorObject.slug : colorValue; 23061 }; 23062 const border = (0,external_wp_element_namespaceObject.useMemo)(() => { 23063 if ((0,external_wp_components_namespaceObject.__experimentalHasSplitBorders)(inheritedValue?.border)) { 23064 const borderValue = { ...inheritedValue?.border }; 23065 ["top", "right", "bottom", "left"].forEach((side) => { 23066 borderValue[side] = { 23067 ...borderValue[side], 23068 color: decodeValue(borderValue[side]?.color) 23069 }; 23070 }); 23071 return borderValue; 23072 } 23073 return { 23074 ...inheritedValue?.border, 23075 color: inheritedValue?.border?.color ? decodeValue(inheritedValue?.border?.color) : void 0 23076 }; 23077 }, [inheritedValue?.border, decodeValue]); 23078 const setBorder = (newBorder) => onChange({ ...value, border: newBorder }); 23079 const showBorderColor = useHasBorderColorControl(settings); 23080 const showBorderStyle = useHasBorderStyleControl(settings); 23081 const showBorderWidth = useHasBorderWidthControl(settings); 23082 const showBorderRadius = useHasBorderRadiusControl(settings); 23083 const borderRadiusValues = (0,external_wp_element_namespaceObject.useMemo)(() => { 23084 if (typeof border?.radius !== "object") { 23085 return border?.radius; 23086 } 23087 return { 23088 topLeft: border?.radius?.topLeft, 23089 topRight: border?.radius?.topRight, 23090 bottomLeft: border?.radius?.bottomLeft, 23091 bottomRight: border?.radius?.bottomRight 23092 }; 23093 }, [border?.radius]); 23094 const setBorderRadius = (newBorderRadius) => setBorder({ ...border, radius: newBorderRadius }); 23095 const hasBorderRadius = () => { 23096 const borderValues = value?.border?.radius; 23097 if (typeof borderValues === "object") { 23098 return Object.entries(borderValues).some(Boolean); 23099 } 23100 return !!borderValues; 23101 }; 23102 const hasShadowControl = useHasShadowControl(settings); 23103 const shadow = decodeValue(inheritedValue?.shadow); 23104 const shadowPresets = settings?.shadow?.presets ?? {}; 23105 const mergedShadowPresets = shadowPresets.custom ?? shadowPresets.theme ?? shadowPresets.default ?? []; 23106 const setShadow = (newValue) => { 23107 const slug = mergedShadowPresets?.find( 23108 ({ shadow: shadowName }) => shadowName === newValue 23109 )?.slug; 23110 onChange( 23111 setImmutably( 23112 value, 23113 ["shadow"], 23114 slug ? `var:preset|shadow|$slug}` : newValue || void 0 23115 ) 23116 ); 23117 }; 23118 const hasShadow = () => !!value?.shadow; 23119 const resetShadow = () => setShadow(void 0); 23120 const resetBorder = () => { 23121 if (hasBorderRadius()) { 23122 return setBorder({ radius: value?.border?.radius }); 23123 } 23124 setBorder(void 0); 23125 }; 23126 const onBorderChange = (newBorder) => { 23127 const updatedBorder = { ...newBorder }; 23128 if ((0,external_wp_components_namespaceObject.__experimentalHasSplitBorders)(updatedBorder)) { 23129 ["top", "right", "bottom", "left"].forEach((side) => { 23130 if (updatedBorder[side]) { 23131 updatedBorder[side] = { 23132 ...updatedBorder[side], 23133 color: encodeColorValue(updatedBorder[side]?.color) 23134 }; 23135 } 23136 }); 23137 } else if (updatedBorder) { 23138 updatedBorder.color = encodeColorValue(updatedBorder.color); 23139 } 23140 setBorder({ radius: border?.radius, ...updatedBorder }); 23141 }; 23142 const resetAllFilter = (0,external_wp_element_namespaceObject.useCallback)((previousValue) => { 23143 return { 23144 ...previousValue, 23145 border: void 0, 23146 shadow: void 0 23147 }; 23148 }, []); 23149 const showBorderByDefault = defaultControls?.color || defaultControls?.width; 23150 const hasBorderControl = showBorderColor || showBorderStyle || showBorderWidth || showBorderRadius; 23151 const label = useBorderPanelLabel({ 23152 blockName: name, 23153 hasShadowControl, 23154 hasBorderControl 23155 }); 23156 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 23157 Wrapper, 23158 { 23159 resetAllFilter, 23160 value, 23161 onChange, 23162 panelId, 23163 label, 23164 children: [ 23165 (showBorderWidth || showBorderColor) && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 23166 external_wp_components_namespaceObject.__experimentalToolsPanelItem, 23167 { 23168 hasValue: () => (0,external_wp_components_namespaceObject.__experimentalIsDefinedBorder)(value?.border), 23169 label: (0,external_wp_i18n_namespaceObject.__)("Border"), 23170 onDeselect: () => resetBorder(), 23171 isShownByDefault: showBorderByDefault, 23172 panelId, 23173 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 23174 external_wp_components_namespaceObject.BorderBoxControl, 23175 { 23176 colors, 23177 enableAlpha: true, 23178 enableStyle: showBorderStyle, 23179 onChange: onBorderChange, 23180 popoverOffset: 40, 23181 popoverPlacement: "left-start", 23182 value: border, 23183 __experimentalIsRenderedInSidebar: true, 23184 size: "__unstable-large", 23185 hideLabelFromVision: !hasShadowControl, 23186 label: (0,external_wp_i18n_namespaceObject.__)("Border") 23187 } 23188 ) 23189 } 23190 ), 23191 showBorderRadius && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 23192 external_wp_components_namespaceObject.__experimentalToolsPanelItem, 23193 { 23194 hasValue: hasBorderRadius, 23195 label: (0,external_wp_i18n_namespaceObject.__)("Radius"), 23196 onDeselect: () => setBorderRadius(void 0), 23197 isShownByDefault: defaultControls.radius, 23198 panelId, 23199 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 23200 BorderRadiusControl, 23201 { 23202 presets: settings?.border?.radiusSizes, 23203 values: borderRadiusValues, 23204 onChange: (newValue) => { 23205 setBorderRadius(newValue || void 0); 23206 } 23207 } 23208 ) 23209 } 23210 ), 23211 hasShadowControl && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 23212 external_wp_components_namespaceObject.__experimentalToolsPanelItem, 23213 { 23214 label: (0,external_wp_i18n_namespaceObject.__)("Shadow"), 23215 hasValue: hasShadow, 23216 onDeselect: resetShadow, 23217 isShownByDefault: defaultControls.shadow, 23218 panelId, 23219 children: [ 23220 hasBorderControl ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.BaseControl.VisualLabel, { as: "legend", children: (0,external_wp_i18n_namespaceObject.__)("Shadow") }) : null, 23221 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 23222 ShadowPopover, 23223 { 23224 shadow, 23225 onShadowChange: setShadow, 23226 settings 23227 } 23228 ) 23229 ] 23230 } 23231 ) 23232 ] 23233 } 23234 ); 23235 } 23236 23237 23238 ;// ./node_modules/@wordpress/block-editor/build-module/hooks/border.js 23239 23240 23241 23242 23243 23244 23245 23246 23247 23248 23249 23250 23251 23252 23253 const BORDER_SUPPORT_KEY = "__experimentalBorder"; 23254 const SHADOW_SUPPORT_KEY = "shadow"; 23255 const getColorByProperty = (colors, property, value) => { 23256 let matchedColor; 23257 colors.some( 23258 (origin) => origin.colors.some((color) => { 23259 if (color[property] === value) { 23260 matchedColor = color; 23261 return true; 23262 } 23263 return false; 23264 }) 23265 ); 23266 return matchedColor; 23267 }; 23268 const getMultiOriginColor = ({ colors, namedColor, customColor }) => { 23269 if (namedColor) { 23270 const colorObject2 = getColorByProperty(colors, "slug", namedColor); 23271 if (colorObject2) { 23272 return colorObject2; 23273 } 23274 } 23275 if (!customColor) { 23276 return { color: void 0 }; 23277 } 23278 const colorObject = getColorByProperty(colors, "color", customColor); 23279 return colorObject ? colorObject : { color: customColor }; 23280 }; 23281 function getColorSlugFromVariable(value) { 23282 const namedColor = /var:preset\|color\|(.+)/.exec(value); 23283 if (namedColor && namedColor[1]) { 23284 return namedColor[1]; 23285 } 23286 return null; 23287 } 23288 function styleToAttributes(style) { 23289 if ((0,external_wp_components_namespaceObject.__experimentalHasSplitBorders)(style?.border)) { 23290 return { 23291 style, 23292 borderColor: void 0 23293 }; 23294 } 23295 const borderColorValue = style?.border?.color; 23296 const borderColorSlug = borderColorValue?.startsWith("var:preset|color|") ? borderColorValue.substring("var:preset|color|".length) : void 0; 23297 const updatedStyle = { ...style }; 23298 updatedStyle.border = { 23299 ...updatedStyle.border, 23300 color: borderColorSlug ? void 0 : borderColorValue 23301 }; 23302 return { 23303 style: utils_cleanEmptyObject(updatedStyle), 23304 borderColor: borderColorSlug 23305 }; 23306 } 23307 function attributesToStyle(attributes) { 23308 if ((0,external_wp_components_namespaceObject.__experimentalHasSplitBorders)(attributes.style?.border)) { 23309 return attributes.style; 23310 } 23311 return { 23312 ...attributes.style, 23313 border: { 23314 ...attributes.style?.border, 23315 color: attributes.borderColor ? "var:preset|color|" + attributes.borderColor : attributes.style?.border?.color 23316 } 23317 }; 23318 } 23319 function BordersInspectorControl({ label, children, resetAllFilter }) { 23320 const attributesResetAllFilter = (0,external_wp_element_namespaceObject.useCallback)( 23321 (attributes) => { 23322 const existingStyle = attributesToStyle(attributes); 23323 const updatedStyle = resetAllFilter(existingStyle); 23324 return { 23325 ...attributes, 23326 ...styleToAttributes(updatedStyle) 23327 }; 23328 }, 23329 [resetAllFilter] 23330 ); 23331 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 23332 inspector_controls_default, 23333 { 23334 group: "border", 23335 resetAllFilter: attributesResetAllFilter, 23336 label, 23337 children 23338 } 23339 ); 23340 } 23341 function border_BorderPanel({ clientId, name, setAttributes, settings }) { 23342 const isEnabled = useHasBorderPanel(settings); 23343 function selector(select) { 23344 const { style: style2, borderColor: borderColor2 } = select(store).getBlockAttributes(clientId) || {}; 23345 return { style: style2, borderColor: borderColor2 }; 23346 } 23347 const { style, borderColor } = (0,external_wp_data_namespaceObject.useSelect)(selector, [clientId]); 23348 const value = (0,external_wp_element_namespaceObject.useMemo)(() => { 23349 return attributesToStyle({ style, borderColor }); 23350 }, [style, borderColor]); 23351 const onChange = (newStyle) => { 23352 setAttributes(styleToAttributes(newStyle)); 23353 }; 23354 if (!isEnabled) { 23355 return null; 23356 } 23357 const defaultControls = { 23358 ...(0,external_wp_blocks_namespaceObject.getBlockSupport)(name, [ 23359 BORDER_SUPPORT_KEY, 23360 "__experimentalDefaultControls" 23361 ]), 23362 ...(0,external_wp_blocks_namespaceObject.getBlockSupport)(name, [ 23363 SHADOW_SUPPORT_KEY, 23364 "__experimentalDefaultControls" 23365 ]) 23366 }; 23367 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 23368 BorderPanel, 23369 { 23370 as: BordersInspectorControl, 23371 panelId: clientId, 23372 settings, 23373 value, 23374 onChange, 23375 defaultControls 23376 } 23377 ); 23378 } 23379 function hasBorderSupport(blockName, feature = "any") { 23380 if (external_wp_element_namespaceObject.Platform.OS !== "web") { 23381 return false; 23382 } 23383 const support = (0,external_wp_blocks_namespaceObject.getBlockSupport)(blockName, BORDER_SUPPORT_KEY); 23384 if (support === true) { 23385 return true; 23386 } 23387 if (feature === "any") { 23388 return !!(support?.color || support?.radius || support?.width || support?.style); 23389 } 23390 return !!support?.[feature]; 23391 } 23392 function hasShadowSupport(blockName) { 23393 return hasBlockSupport(blockName, SHADOW_SUPPORT_KEY); 23394 } 23395 function useBorderPanelLabel({ 23396 blockName, 23397 hasBorderControl, 23398 hasShadowControl 23399 } = {}) { 23400 const settings = useBlockSettings(blockName); 23401 const controls = useHasBorderPanelControls(settings); 23402 if (!hasBorderControl && !hasShadowControl && blockName) { 23403 hasBorderControl = controls?.hasBorderColor || controls?.hasBorderStyle || controls?.hasBorderWidth || controls?.hasBorderRadius; 23404 hasShadowControl = controls?.hasShadow; 23405 } 23406 if (hasBorderControl && hasShadowControl) { 23407 return (0,external_wp_i18n_namespaceObject.__)("Border & Shadow"); 23408 } 23409 if (hasShadowControl) { 23410 return (0,external_wp_i18n_namespaceObject.__)("Shadow"); 23411 } 23412 return (0,external_wp_i18n_namespaceObject.__)("Border"); 23413 } 23414 function removeBorderAttribute(style, attribute) { 23415 return cleanEmptyObject({ 23416 ...style, 23417 border: { 23418 ...style?.border, 23419 [attribute]: void 0 23420 } 23421 }); 23422 } 23423 function addAttributes(settings) { 23424 if (!hasBorderSupport(settings, "color")) { 23425 return settings; 23426 } 23427 if (settings.attributes.borderColor) { 23428 return settings; 23429 } 23430 return { 23431 ...settings, 23432 attributes: { 23433 ...settings.attributes, 23434 borderColor: { 23435 type: "string" 23436 } 23437 } 23438 }; 23439 } 23440 function border_addSaveProps(props, blockNameOrType, attributes) { 23441 if (!hasBorderSupport(blockNameOrType, "color") || shouldSkipSerialization(blockNameOrType, BORDER_SUPPORT_KEY, "color")) { 23442 return props; 23443 } 23444 const borderClasses = getBorderClasses(attributes); 23445 const newClassName = dist_clsx(props.className, borderClasses); 23446 props.className = newClassName ? newClassName : void 0; 23447 return props; 23448 } 23449 function getBorderClasses(attributes) { 23450 const { borderColor, style } = attributes; 23451 const borderColorClass = getColorClassName("border-color", borderColor); 23452 return dist_clsx({ 23453 "has-border-color": borderColor || style?.border?.color, 23454 [borderColorClass]: !!borderColorClass 23455 }); 23456 } 23457 function border_useBlockProps({ name, borderColor, style }) { 23458 const { colors } = useMultipleOriginColorsAndGradients(); 23459 if (!hasBorderSupport(name, "color") || shouldSkipSerialization(name, BORDER_SUPPORT_KEY, "color")) { 23460 return {}; 23461 } 23462 const { color: borderColorValue } = getMultiOriginColor({ 23463 colors, 23464 namedColor: borderColor 23465 }); 23466 const { color: borderTopColor } = getMultiOriginColor({ 23467 colors, 23468 namedColor: getColorSlugFromVariable(style?.border?.top?.color) 23469 }); 23470 const { color: borderRightColor } = getMultiOriginColor({ 23471 colors, 23472 namedColor: getColorSlugFromVariable(style?.border?.right?.color) 23473 }); 23474 const { color: borderBottomColor } = getMultiOriginColor({ 23475 colors, 23476 namedColor: getColorSlugFromVariable(style?.border?.bottom?.color) 23477 }); 23478 const { color: borderLeftColor } = getMultiOriginColor({ 23479 colors, 23480 namedColor: getColorSlugFromVariable(style?.border?.left?.color) 23481 }); 23482 const extraStyles = { 23483 borderTopColor: borderTopColor || borderColorValue, 23484 borderRightColor: borderRightColor || borderColorValue, 23485 borderBottomColor: borderBottomColor || borderColorValue, 23486 borderLeftColor: borderLeftColor || borderColorValue 23487 }; 23488 return border_addSaveProps( 23489 { style: utils_cleanEmptyObject(extraStyles) || {} }, 23490 name, 23491 { borderColor, style } 23492 ); 23493 } 23494 var border_default = { 23495 useBlockProps: border_useBlockProps, 23496 addSaveProps: border_addSaveProps, 23497 attributeKeys: ["borderColor", "style"], 23498 hasSupport(name) { 23499 return hasBorderSupport(name, "color"); 23500 } 23501 }; 23502 (0,external_wp_hooks_namespaceObject.addFilter)( 23503 "blocks.registerBlockType", 23504 "core/border/addAttributes", 23505 addAttributes 23506 ); 23507 23508 23509 ;// ./node_modules/@wordpress/block-editor/build-module/components/gradients/use-gradient.js 23510 23511 23512 23513 23514 23515 function __experimentalGetGradientClass(gradientSlug) { 23516 if (!gradientSlug) { 23517 return void 0; 23518 } 23519 return `has-$gradientSlug}-gradient-background`; 23520 } 23521 function getGradientValueBySlug(gradients, slug) { 23522 const gradient = gradients?.find((g) => g.slug === slug); 23523 return gradient && gradient.gradient; 23524 } 23525 function __experimentalGetGradientObjectByGradientValue(gradients, value) { 23526 const gradient = gradients?.find((g) => g.gradient === value); 23527 return gradient; 23528 } 23529 function getGradientSlugByValue(gradients, value) { 23530 const gradient = __experimentalGetGradientObjectByGradientValue( 23531 gradients, 23532 value 23533 ); 23534 return gradient && gradient.slug; 23535 } 23536 function __experimentalUseGradient({ 23537 gradientAttribute = "gradient", 23538 customGradientAttribute = "customGradient" 23539 } = {}) { 23540 const { clientId } = useBlockEditContext(); 23541 const [ 23542 userGradientPalette, 23543 themeGradientPalette, 23544 defaultGradientPalette 23545 ] = use_settings_useSettings( 23546 "color.gradients.custom", 23547 "color.gradients.theme", 23548 "color.gradients.default" 23549 ); 23550 const allGradients = (0,external_wp_element_namespaceObject.useMemo)( 23551 () => [ 23552 ...userGradientPalette || [], 23553 ...themeGradientPalette || [], 23554 ...defaultGradientPalette || [] 23555 ], 23556 [userGradientPalette, themeGradientPalette, defaultGradientPalette] 23557 ); 23558 const { gradient, customGradient } = (0,external_wp_data_namespaceObject.useSelect)( 23559 (select) => { 23560 const { getBlockAttributes } = select(store); 23561 const attributes = getBlockAttributes(clientId) || {}; 23562 return { 23563 customGradient: attributes[customGradientAttribute], 23564 gradient: attributes[gradientAttribute] 23565 }; 23566 }, 23567 [clientId, gradientAttribute, customGradientAttribute] 23568 ); 23569 const { updateBlockAttributes } = (0,external_wp_data_namespaceObject.useDispatch)(store); 23570 const setGradient = (0,external_wp_element_namespaceObject.useCallback)( 23571 (newGradientValue) => { 23572 const slug = getGradientSlugByValue( 23573 allGradients, 23574 newGradientValue 23575 ); 23576 if (slug) { 23577 updateBlockAttributes(clientId, { 23578 [gradientAttribute]: slug, 23579 [customGradientAttribute]: void 0 23580 }); 23581 return; 23582 } 23583 updateBlockAttributes(clientId, { 23584 [gradientAttribute]: void 0, 23585 [customGradientAttribute]: newGradientValue 23586 }); 23587 }, 23588 [allGradients, clientId, updateBlockAttributes] 23589 ); 23590 const gradientClass = __experimentalGetGradientClass(gradient); 23591 let gradientValue; 23592 if (gradient) { 23593 gradientValue = getGradientValueBySlug(allGradients, gradient); 23594 } else { 23595 gradientValue = customGradient; 23596 } 23597 return { gradientClass, gradientValue, setGradient }; 23598 } 23599 23600 23601 ;// ./node_modules/@wordpress/block-editor/build-module/components/colors-gradients/control.js 23602 23603 23604 23605 23606 23607 23608 const { Tabs } = unlock(external_wp_components_namespaceObject.privateApis); 23609 const colorsAndGradientKeys = [ 23610 "colors", 23611 "disableCustomColors", 23612 "gradients", 23613 "disableCustomGradients" 23614 ]; 23615 const TAB_IDS = { color: "color", gradient: "gradient" }; 23616 function ColorGradientControlInner({ 23617 colors, 23618 gradients, 23619 disableCustomColors, 23620 disableCustomGradients, 23621 __experimentalIsRenderedInSidebar, 23622 className, 23623 label, 23624 onColorChange, 23625 onGradientChange, 23626 colorValue, 23627 gradientValue, 23628 clearable, 23629 showTitle = true, 23630 enableAlpha, 23631 headingLevel 23632 }) { 23633 const canChooseAColor = onColorChange && (colors && colors.length > 0 || !disableCustomColors); 23634 const canChooseAGradient = onGradientChange && (gradients && gradients.length > 0 || !disableCustomGradients); 23635 if (!canChooseAColor && !canChooseAGradient) { 23636 return null; 23637 } 23638 const tabPanels = { 23639 [TAB_IDS.color]: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 23640 external_wp_components_namespaceObject.ColorPalette, 23641 { 23642 value: colorValue, 23643 onChange: canChooseAGradient ? (newColor) => { 23644 onColorChange(newColor); 23645 onGradientChange(); 23646 } : onColorChange, 23647 ...{ colors, disableCustomColors }, 23648 __experimentalIsRenderedInSidebar, 23649 clearable, 23650 enableAlpha, 23651 headingLevel 23652 } 23653 ), 23654 [TAB_IDS.gradient]: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 23655 external_wp_components_namespaceObject.GradientPicker, 23656 { 23657 value: gradientValue, 23658 onChange: canChooseAColor ? (newGradient) => { 23659 onGradientChange(newGradient); 23660 onColorChange(); 23661 } : onGradientChange, 23662 ...{ gradients, disableCustomGradients }, 23663 __experimentalIsRenderedInSidebar, 23664 clearable, 23665 headingLevel 23666 } 23667 ) 23668 }; 23669 const renderPanelType = (type) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-color-gradient-control__panel", children: tabPanels[type] }); 23670 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 23671 external_wp_components_namespaceObject.BaseControl, 23672 { 23673 __nextHasNoMarginBottom: true, 23674 className: dist_clsx( 23675 "block-editor-color-gradient-control", 23676 className 23677 ), 23678 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("fieldset", { className: "block-editor-color-gradient-control__fieldset", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 1, children: [ 23679 showTitle && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("legend", { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-color-gradient-control__color-indicator", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.BaseControl.VisualLabel, { children: label }) }) }), 23680 canChooseAColor && canChooseAGradient && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 23681 Tabs, 23682 { 23683 defaultTabId: gradientValue ? TAB_IDS.gradient : !!canChooseAColor && TAB_IDS.color, 23684 children: [ 23685 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(Tabs.TabList, { children: [ 23686 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Tabs.Tab, { tabId: TAB_IDS.color, children: (0,external_wp_i18n_namespaceObject.__)("Color") }), 23687 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Tabs.Tab, { tabId: TAB_IDS.gradient, children: (0,external_wp_i18n_namespaceObject.__)("Gradient") }) 23688 ] }), 23689 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 23690 Tabs.TabPanel, 23691 { 23692 tabId: TAB_IDS.color, 23693 className: "block-editor-color-gradient-control__panel", 23694 focusable: false, 23695 children: tabPanels.color 23696 } 23697 ), 23698 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 23699 Tabs.TabPanel, 23700 { 23701 tabId: TAB_IDS.gradient, 23702 className: "block-editor-color-gradient-control__panel", 23703 focusable: false, 23704 children: tabPanels.gradient 23705 } 23706 ) 23707 ] 23708 } 23709 ) }), 23710 !canChooseAGradient && renderPanelType(TAB_IDS.color), 23711 !canChooseAColor && renderPanelType(TAB_IDS.gradient) 23712 ] }) }) 23713 } 23714 ); 23715 } 23716 function ColorGradientControlSelect(props) { 23717 const [colors, gradients, customColors, customGradients] = use_settings_useSettings( 23718 "color.palette", 23719 "color.gradients", 23720 "color.custom", 23721 "color.customGradient" 23722 ); 23723 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 23724 ColorGradientControlInner, 23725 { 23726 colors, 23727 gradients, 23728 disableCustomColors: !customColors, 23729 disableCustomGradients: !customGradients, 23730 ...props 23731 } 23732 ); 23733 } 23734 function ColorGradientControl(props) { 23735 if (colorsAndGradientKeys.every((key) => props.hasOwnProperty(key))) { 23736 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ColorGradientControlInner, { ...props }); 23737 } 23738 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ColorGradientControlSelect, { ...props }); 23739 } 23740 var control_default = ColorGradientControl; 23741 23742 23743 ;// ./node_modules/@wordpress/block-editor/build-module/components/global-styles/color-panel.js 23744 23745 23746 23747 23748 23749 23750 23751 23752 23753 23754 23755 function useHasColorPanel(settings) { 23756 const hasTextPanel = useHasTextPanel(settings); 23757 const hasBackgroundPanel = useHasBackgroundColorPanel(settings); 23758 const hasLinkPanel = useHasLinkPanel(settings); 23759 const hasHeadingPanel = useHasHeadingPanel(settings); 23760 const hasButtonPanel = useHasButtonPanel(settings); 23761 const hasCaptionPanel = useHasCaptionPanel(settings); 23762 return hasTextPanel || hasBackgroundPanel || hasLinkPanel || hasHeadingPanel || hasButtonPanel || hasCaptionPanel; 23763 } 23764 function useHasTextPanel(settings) { 23765 const colors = useColorsPerOrigin(settings); 23766 return settings?.color?.text && (colors?.length > 0 || settings?.color?.custom); 23767 } 23768 function useHasLinkPanel(settings) { 23769 const colors = useColorsPerOrigin(settings); 23770 return settings?.color?.link && (colors?.length > 0 || settings?.color?.custom); 23771 } 23772 function useHasCaptionPanel(settings) { 23773 const colors = useColorsPerOrigin(settings); 23774 return settings?.color?.caption && (colors?.length > 0 || settings?.color?.custom); 23775 } 23776 function useHasHeadingPanel(settings) { 23777 const colors = useColorsPerOrigin(settings); 23778 const gradients = useGradientsPerOrigin(settings); 23779 return settings?.color?.heading && (colors?.length > 0 || settings?.color?.custom || gradients?.length > 0 || settings?.color?.customGradient); 23780 } 23781 function useHasButtonPanel(settings) { 23782 const colors = useColorsPerOrigin(settings); 23783 const gradients = useGradientsPerOrigin(settings); 23784 return settings?.color?.button && (colors?.length > 0 || settings?.color?.custom || gradients?.length > 0 || settings?.color?.customGradient); 23785 } 23786 function useHasBackgroundColorPanel(settings) { 23787 const colors = useColorsPerOrigin(settings); 23788 const gradients = useGradientsPerOrigin(settings); 23789 return settings?.color?.background && (colors?.length > 0 || settings?.color?.custom || gradients?.length > 0 || settings?.color?.customGradient); 23790 } 23791 function ColorToolsPanel({ 23792 resetAllFilter, 23793 onChange, 23794 value, 23795 panelId, 23796 children 23797 }) { 23798 const dropdownMenuProps = useToolsPanelDropdownMenuProps(); 23799 const resetAll = () => { 23800 const updatedValue = resetAllFilter(value); 23801 onChange(updatedValue); 23802 }; 23803 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 23804 external_wp_components_namespaceObject.__experimentalToolsPanel, 23805 { 23806 label: (0,external_wp_i18n_namespaceObject.__)("Elements"), 23807 resetAll, 23808 panelId, 23809 hasInnerWrapper: true, 23810 headingLevel: 3, 23811 className: "color-block-support-panel", 23812 __experimentalFirstVisibleItemClass: "first", 23813 __experimentalLastVisibleItemClass: "last", 23814 dropdownMenuProps, 23815 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "color-block-support-panel__inner-wrapper", children }) 23816 } 23817 ); 23818 } 23819 const color_panel_DEFAULT_CONTROLS = { 23820 text: true, 23821 background: true, 23822 link: true, 23823 heading: true, 23824 button: true, 23825 caption: true 23826 }; 23827 const popoverProps = { 23828 placement: "left-start", 23829 offset: 36, 23830 shift: true, 23831 flip: true, 23832 resize: false 23833 }; 23834 const { Tabs: color_panel_Tabs } = unlock(external_wp_components_namespaceObject.privateApis); 23835 const LabeledColorIndicators = ({ indicators, label }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "flex-start", children: [ 23836 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalZStack, { isLayered: false, offset: -8, children: indicators.map((indicator, index) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Flex, { expanded: false, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ColorIndicator, { colorValue: indicator }) }, index)) }), 23837 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { className: "block-editor-panel-color-gradient-settings__color-name", children: label }) 23838 ] }); 23839 function ColorPanelTab({ 23840 isGradient, 23841 inheritedValue, 23842 userValue, 23843 setValue, 23844 colorGradientControlSettings 23845 }) { 23846 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 23847 control_default, 23848 { 23849 ...colorGradientControlSettings, 23850 showTitle: false, 23851 enableAlpha: true, 23852 __experimentalIsRenderedInSidebar: true, 23853 colorValue: isGradient ? void 0 : inheritedValue, 23854 gradientValue: isGradient ? inheritedValue : void 0, 23855 onColorChange: isGradient ? void 0 : setValue, 23856 onGradientChange: isGradient ? setValue : void 0, 23857 clearable: inheritedValue === userValue, 23858 headingLevel: 3 23859 } 23860 ); 23861 } 23862 function ColorPanelDropdown({ 23863 label, 23864 hasValue, 23865 resetValue, 23866 isShownByDefault, 23867 indicators, 23868 tabs, 23869 colorGradientControlSettings, 23870 panelId 23871 }) { 23872 const currentTab = tabs.find((tab) => tab.userValue !== void 0); 23873 const { key: firstTabKey, ...firstTab } = tabs[0] ?? {}; 23874 const colorGradientDropdownButtonRef = (0,external_wp_element_namespaceObject.useRef)(void 0); 23875 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 23876 external_wp_components_namespaceObject.__experimentalToolsPanelItem, 23877 { 23878 className: "block-editor-tools-panel-color-gradient-settings__item", 23879 hasValue, 23880 label, 23881 onDeselect: resetValue, 23882 isShownByDefault, 23883 panelId, 23884 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 23885 external_wp_components_namespaceObject.Dropdown, 23886 { 23887 popoverProps, 23888 className: "block-editor-tools-panel-color-gradient-settings__dropdown", 23889 renderToggle: ({ onToggle, isOpen }) => { 23890 const toggleProps = { 23891 onClick: onToggle, 23892 className: dist_clsx( 23893 "block-editor-panel-color-gradient-settings__dropdown", 23894 { "is-open": isOpen } 23895 ), 23896 "aria-expanded": isOpen, 23897 ref: colorGradientDropdownButtonRef 23898 }; 23899 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 23900 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { ...toggleProps, __next40pxDefaultSize: true, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 23901 LabeledColorIndicators, 23902 { 23903 indicators, 23904 label 23905 } 23906 ) }), 23907 hasValue() && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 23908 external_wp_components_namespaceObject.Button, 23909 { 23910 __next40pxDefaultSize: true, 23911 label: (0,external_wp_i18n_namespaceObject.__)("Reset"), 23912 className: "block-editor-panel-color-gradient-settings__reset", 23913 size: "small", 23914 icon: reset_default, 23915 onClick: () => { 23916 resetValue(); 23917 if (isOpen) { 23918 onToggle(); 23919 } 23920 colorGradientDropdownButtonRef.current?.focus(); 23921 } 23922 } 23923 ) 23924 ] }); 23925 }, 23926 renderContent: () => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalDropdownContentWrapper, { paddingSize: "none", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-editor-panel-color-gradient-settings__dropdown-content", children: [ 23927 tabs.length === 1 && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 23928 ColorPanelTab, 23929 { 23930 ...firstTab, 23931 colorGradientControlSettings 23932 }, 23933 firstTabKey 23934 ), 23935 tabs.length > 1 && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(color_panel_Tabs, { defaultTabId: currentTab?.key, children: [ 23936 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(color_panel_Tabs.TabList, { children: tabs.map((tab) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 23937 color_panel_Tabs.Tab, 23938 { 23939 tabId: tab.key, 23940 children: tab.label 23941 }, 23942 tab.key 23943 )) }), 23944 tabs.map((tab) => { 23945 const { key: tabKey, ...restTabProps } = tab; 23946 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 23947 color_panel_Tabs.TabPanel, 23948 { 23949 tabId: tabKey, 23950 focusable: false, 23951 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 23952 ColorPanelTab, 23953 { 23954 ...restTabProps, 23955 colorGradientControlSettings 23956 }, 23957 tabKey 23958 ) 23959 }, 23960 tabKey 23961 ); 23962 }) 23963 ] }) 23964 ] }) }) 23965 } 23966 ) 23967 } 23968 ); 23969 } 23970 function ColorPanel({ 23971 as: Wrapper = ColorToolsPanel, 23972 value, 23973 onChange, 23974 inheritedValue = value, 23975 settings, 23976 panelId, 23977 defaultControls = color_panel_DEFAULT_CONTROLS, 23978 children 23979 }) { 23980 const colors = useColorsPerOrigin(settings); 23981 const gradients = useGradientsPerOrigin(settings); 23982 const areCustomSolidsEnabled = settings?.color?.custom; 23983 const areCustomGradientsEnabled = settings?.color?.customGradient; 23984 const hasSolidColors = colors.length > 0 || areCustomSolidsEnabled; 23985 const hasGradientColors = gradients.length > 0 || areCustomGradientsEnabled; 23986 const decodeValue = (rawValue) => getValueFromVariable({ settings }, "", rawValue); 23987 const encodeColorValue = (colorValue) => { 23988 const allColors = colors.flatMap( 23989 ({ colors: originColors }) => originColors 23990 ); 23991 const colorObject = allColors.find( 23992 ({ color }) => color === colorValue 23993 ); 23994 return colorObject ? "var:preset|color|" + colorObject.slug : colorValue; 23995 }; 23996 const encodeGradientValue = (gradientValue) => { 23997 const allGradients = gradients.flatMap( 23998 ({ gradients: originGradients }) => originGradients 23999 ); 24000 const gradientObject = allGradients.find( 24001 ({ gradient: gradient2 }) => gradient2 === gradientValue 24002 ); 24003 return gradientObject ? "var:preset|gradient|" + gradientObject.slug : gradientValue; 24004 }; 24005 const showBackgroundPanel = useHasBackgroundColorPanel(settings); 24006 const backgroundColor = decodeValue(inheritedValue?.color?.background); 24007 const userBackgroundColor = decodeValue(value?.color?.background); 24008 const gradient = decodeValue(inheritedValue?.color?.gradient); 24009 const userGradient = decodeValue(value?.color?.gradient); 24010 const hasBackground = () => !!userBackgroundColor || !!userGradient; 24011 const setBackgroundColor = (newColor) => { 24012 const newValue = setImmutably( 24013 value, 24014 ["color", "background"], 24015 encodeColorValue(newColor) 24016 ); 24017 newValue.color.gradient = void 0; 24018 onChange(newValue); 24019 }; 24020 const setGradient = (newGradient) => { 24021 const newValue = setImmutably( 24022 value, 24023 ["color", "gradient"], 24024 encodeGradientValue(newGradient) 24025 ); 24026 newValue.color.background = void 0; 24027 onChange(newValue); 24028 }; 24029 const resetBackground = () => { 24030 const newValue = setImmutably( 24031 value, 24032 ["color", "background"], 24033 void 0 24034 ); 24035 newValue.color.gradient = void 0; 24036 onChange(newValue); 24037 }; 24038 const showLinkPanel = useHasLinkPanel(settings); 24039 const linkColor = decodeValue( 24040 inheritedValue?.elements?.link?.color?.text 24041 ); 24042 const userLinkColor = decodeValue(value?.elements?.link?.color?.text); 24043 const setLinkColor = (newColor) => { 24044 onChange( 24045 setImmutably( 24046 value, 24047 ["elements", "link", "color", "text"], 24048 encodeColorValue(newColor) 24049 ) 24050 ); 24051 }; 24052 const hoverLinkColor = decodeValue( 24053 inheritedValue?.elements?.link?.[":hover"]?.color?.text 24054 ); 24055 const userHoverLinkColor = decodeValue( 24056 value?.elements?.link?.[":hover"]?.color?.text 24057 ); 24058 const setHoverLinkColor = (newColor) => { 24059 onChange( 24060 setImmutably( 24061 value, 24062 ["elements", "link", ":hover", "color", "text"], 24063 encodeColorValue(newColor) 24064 ) 24065 ); 24066 }; 24067 const hasLink = () => !!userLinkColor || !!userHoverLinkColor; 24068 const resetLink = () => { 24069 let newValue = setImmutably( 24070 value, 24071 ["elements", "link", ":hover", "color", "text"], 24072 void 0 24073 ); 24074 newValue = setImmutably( 24075 newValue, 24076 ["elements", "link", "color", "text"], 24077 void 0 24078 ); 24079 onChange(newValue); 24080 }; 24081 const showTextPanel = useHasTextPanel(settings); 24082 const textColor = decodeValue(inheritedValue?.color?.text); 24083 const userTextColor = decodeValue(value?.color?.text); 24084 const hasTextColor = () => !!userTextColor; 24085 const setTextColor = (newColor) => { 24086 let changedObject = setImmutably( 24087 value, 24088 ["color", "text"], 24089 encodeColorValue(newColor) 24090 ); 24091 if (textColor === linkColor) { 24092 changedObject = setImmutably( 24093 changedObject, 24094 ["elements", "link", "color", "text"], 24095 encodeColorValue(newColor) 24096 ); 24097 } 24098 onChange(changedObject); 24099 }; 24100 const resetTextColor = () => setTextColor(void 0); 24101 const elements = [ 24102 { 24103 name: "caption", 24104 label: (0,external_wp_i18n_namespaceObject.__)("Captions"), 24105 showPanel: useHasCaptionPanel(settings) 24106 }, 24107 { 24108 name: "button", 24109 label: (0,external_wp_i18n_namespaceObject.__)("Button"), 24110 showPanel: useHasButtonPanel(settings) 24111 }, 24112 { 24113 name: "heading", 24114 label: (0,external_wp_i18n_namespaceObject.__)("Heading"), 24115 showPanel: useHasHeadingPanel(settings) 24116 }, 24117 { 24118 name: "h1", 24119 label: (0,external_wp_i18n_namespaceObject.__)("H1"), 24120 showPanel: useHasHeadingPanel(settings) 24121 }, 24122 { 24123 name: "h2", 24124 label: (0,external_wp_i18n_namespaceObject.__)("H2"), 24125 showPanel: useHasHeadingPanel(settings) 24126 }, 24127 { 24128 name: "h3", 24129 label: (0,external_wp_i18n_namespaceObject.__)("H3"), 24130 showPanel: useHasHeadingPanel(settings) 24131 }, 24132 { 24133 name: "h4", 24134 label: (0,external_wp_i18n_namespaceObject.__)("H4"), 24135 showPanel: useHasHeadingPanel(settings) 24136 }, 24137 { 24138 name: "h5", 24139 label: (0,external_wp_i18n_namespaceObject.__)("H5"), 24140 showPanel: useHasHeadingPanel(settings) 24141 }, 24142 { 24143 name: "h6", 24144 label: (0,external_wp_i18n_namespaceObject.__)("H6"), 24145 showPanel: useHasHeadingPanel(settings) 24146 } 24147 ]; 24148 const resetAllFilter = (0,external_wp_element_namespaceObject.useCallback)((previousValue) => { 24149 return { 24150 ...previousValue, 24151 color: void 0, 24152 elements: { 24153 ...previousValue?.elements, 24154 link: { 24155 ...previousValue?.elements?.link, 24156 color: void 0, 24157 ":hover": { 24158 color: void 0 24159 } 24160 }, 24161 ...elements.reduce((acc, element) => { 24162 return { 24163 ...acc, 24164 [element.name]: { 24165 ...previousValue?.elements?.[element.name], 24166 color: void 0 24167 } 24168 }; 24169 }, {}) 24170 } 24171 }; 24172 }, []); 24173 const items = [ 24174 showTextPanel && { 24175 key: "text", 24176 label: (0,external_wp_i18n_namespaceObject.__)("Text"), 24177 hasValue: hasTextColor, 24178 resetValue: resetTextColor, 24179 isShownByDefault: defaultControls.text, 24180 indicators: [textColor], 24181 tabs: [ 24182 { 24183 key: "text", 24184 label: (0,external_wp_i18n_namespaceObject.__)("Text"), 24185 inheritedValue: textColor, 24186 setValue: setTextColor, 24187 userValue: userTextColor 24188 } 24189 ] 24190 }, 24191 showBackgroundPanel && { 24192 key: "background", 24193 label: (0,external_wp_i18n_namespaceObject.__)("Background"), 24194 hasValue: hasBackground, 24195 resetValue: resetBackground, 24196 isShownByDefault: defaultControls.background, 24197 indicators: [gradient ?? backgroundColor], 24198 tabs: [ 24199 hasSolidColors && { 24200 key: "background", 24201 label: (0,external_wp_i18n_namespaceObject.__)("Color"), 24202 inheritedValue: backgroundColor, 24203 setValue: setBackgroundColor, 24204 userValue: userBackgroundColor 24205 }, 24206 hasGradientColors && { 24207 key: "gradient", 24208 label: (0,external_wp_i18n_namespaceObject.__)("Gradient"), 24209 inheritedValue: gradient, 24210 setValue: setGradient, 24211 userValue: userGradient, 24212 isGradient: true 24213 } 24214 ].filter(Boolean) 24215 }, 24216 showLinkPanel && { 24217 key: "link", 24218 label: (0,external_wp_i18n_namespaceObject.__)("Link"), 24219 hasValue: hasLink, 24220 resetValue: resetLink, 24221 isShownByDefault: defaultControls.link, 24222 indicators: [linkColor, hoverLinkColor], 24223 tabs: [ 24224 { 24225 key: "link", 24226 label: (0,external_wp_i18n_namespaceObject.__)("Default"), 24227 inheritedValue: linkColor, 24228 setValue: setLinkColor, 24229 userValue: userLinkColor 24230 }, 24231 { 24232 key: "hover", 24233 label: (0,external_wp_i18n_namespaceObject.__)("Hover"), 24234 inheritedValue: hoverLinkColor, 24235 setValue: setHoverLinkColor, 24236 userValue: userHoverLinkColor 24237 } 24238 ] 24239 } 24240 ].filter(Boolean); 24241 elements.forEach(({ name, label, showPanel }) => { 24242 if (!showPanel) { 24243 return; 24244 } 24245 const elementBackgroundColor = decodeValue( 24246 inheritedValue?.elements?.[name]?.color?.background 24247 ); 24248 const elementGradient = decodeValue( 24249 inheritedValue?.elements?.[name]?.color?.gradient 24250 ); 24251 const elementTextColor = decodeValue( 24252 inheritedValue?.elements?.[name]?.color?.text 24253 ); 24254 const elementBackgroundUserColor = decodeValue( 24255 value?.elements?.[name]?.color?.background 24256 ); 24257 const elementGradientUserColor = decodeValue( 24258 value?.elements?.[name]?.color?.gradient 24259 ); 24260 const elementTextUserColor = decodeValue( 24261 value?.elements?.[name]?.color?.text 24262 ); 24263 const hasElement = () => !!(elementTextUserColor || elementBackgroundUserColor || elementGradientUserColor); 24264 const resetElement = () => { 24265 const newValue = setImmutably( 24266 value, 24267 ["elements", name, "color", "background"], 24268 void 0 24269 ); 24270 newValue.elements[name].color.gradient = void 0; 24271 newValue.elements[name].color.text = void 0; 24272 onChange(newValue); 24273 }; 24274 const setElementTextColor = (newTextColor) => { 24275 onChange( 24276 setImmutably( 24277 value, 24278 ["elements", name, "color", "text"], 24279 encodeColorValue(newTextColor) 24280 ) 24281 ); 24282 }; 24283 const setElementBackgroundColor = (newBackgroundColor) => { 24284 const newValue = setImmutably( 24285 value, 24286 ["elements", name, "color", "background"], 24287 encodeColorValue(newBackgroundColor) 24288 ); 24289 newValue.elements[name].color.gradient = void 0; 24290 onChange(newValue); 24291 }; 24292 const setElementGradient = (newGradient) => { 24293 const newValue = setImmutably( 24294 value, 24295 ["elements", name, "color", "gradient"], 24296 encodeGradientValue(newGradient) 24297 ); 24298 newValue.elements[name].color.background = void 0; 24299 onChange(newValue); 24300 }; 24301 const supportsTextColor = true; 24302 const supportsBackground = name !== "caption"; 24303 items.push({ 24304 key: name, 24305 label, 24306 hasValue: hasElement, 24307 resetValue: resetElement, 24308 isShownByDefault: defaultControls[name], 24309 indicators: supportsTextColor && supportsBackground ? [ 24310 elementTextColor, 24311 elementGradient ?? elementBackgroundColor 24312 ] : [ 24313 supportsTextColor ? elementTextColor : elementGradient ?? elementBackgroundColor 24314 ], 24315 tabs: [ 24316 hasSolidColors && supportsTextColor && { 24317 key: "text", 24318 label: (0,external_wp_i18n_namespaceObject.__)("Text"), 24319 inheritedValue: elementTextColor, 24320 setValue: setElementTextColor, 24321 userValue: elementTextUserColor 24322 }, 24323 hasSolidColors && supportsBackground && { 24324 key: "background", 24325 label: (0,external_wp_i18n_namespaceObject.__)("Background"), 24326 inheritedValue: elementBackgroundColor, 24327 setValue: setElementBackgroundColor, 24328 userValue: elementBackgroundUserColor 24329 }, 24330 hasGradientColors && supportsBackground && { 24331 key: "gradient", 24332 label: (0,external_wp_i18n_namespaceObject.__)("Gradient"), 24333 inheritedValue: elementGradient, 24334 setValue: setElementGradient, 24335 userValue: elementGradientUserColor, 24336 isGradient: true 24337 } 24338 ].filter(Boolean) 24339 }); 24340 }); 24341 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 24342 Wrapper, 24343 { 24344 resetAllFilter, 24345 value, 24346 onChange, 24347 panelId, 24348 children: [ 24349 items.map((item) => { 24350 const { key, ...restItem } = item; 24351 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 24352 ColorPanelDropdown, 24353 { 24354 ...restItem, 24355 colorGradientControlSettings: { 24356 colors, 24357 disableCustomColors: !areCustomSolidsEnabled, 24358 gradients, 24359 disableCustomGradients: !areCustomGradientsEnabled 24360 }, 24361 panelId 24362 }, 24363 key 24364 ); 24365 }), 24366 children 24367 ] 24368 } 24369 ); 24370 } 24371 24372 24373 ;// ./node_modules/@wordpress/block-editor/build-module/components/contrast-checker/index.js 24374 24375 24376 24377 24378 24379 24380 24381 k([names, a11y]); 24382 function ContrastChecker({ 24383 backgroundColor, 24384 fallbackBackgroundColor, 24385 fallbackTextColor, 24386 fallbackLinkColor, 24387 fontSize, 24388 // Font size value in pixels. 24389 isLargeText, 24390 textColor, 24391 linkColor, 24392 enableAlphaChecker = false 24393 }) { 24394 const currentBackgroundColor = backgroundColor || fallbackBackgroundColor; 24395 if (!currentBackgroundColor) { 24396 return null; 24397 } 24398 const currentTextColor = textColor || fallbackTextColor; 24399 const currentLinkColor = linkColor || fallbackLinkColor; 24400 if (!currentTextColor && !currentLinkColor) { 24401 return null; 24402 } 24403 const textColors = [ 24404 { 24405 color: currentTextColor, 24406 description: (0,external_wp_i18n_namespaceObject.__)("text color") 24407 }, 24408 { 24409 color: currentLinkColor, 24410 description: (0,external_wp_i18n_namespaceObject.__)("link color") 24411 } 24412 ]; 24413 const colordBackgroundColor = w(currentBackgroundColor); 24414 const backgroundColorHasTransparency = colordBackgroundColor.alpha() < 1; 24415 const backgroundColorBrightness = colordBackgroundColor.brightness(); 24416 const isReadableOptions = { 24417 level: "AA", 24418 size: isLargeText || isLargeText !== false && fontSize >= 24 ? "large" : "small" 24419 }; 24420 let message = ""; 24421 let speakMessage = ""; 24422 for (const item of textColors) { 24423 if (!item.color) { 24424 continue; 24425 } 24426 const colordTextColor = w(item.color); 24427 const isColordTextReadable = colordTextColor.isReadable( 24428 colordBackgroundColor, 24429 isReadableOptions 24430 ); 24431 const textHasTransparency = colordTextColor.alpha() < 1; 24432 if (!isColordTextReadable) { 24433 if (backgroundColorHasTransparency || textHasTransparency) { 24434 continue; 24435 } 24436 message = backgroundColorBrightness < colordTextColor.brightness() ? (0,external_wp_i18n_namespaceObject.sprintf)( 24437 // translators: %s is a type of text color, e.g., "text color" or "link color". 24438 (0,external_wp_i18n_namespaceObject.__)( 24439 "This color combination may be hard for people to read. Try using a darker background color and/or a brighter %s." 24440 ), 24441 item.description 24442 ) : (0,external_wp_i18n_namespaceObject.sprintf)( 24443 // translators: %s is a type of text color, e.g., "text color" or "link color". 24444 (0,external_wp_i18n_namespaceObject.__)( 24445 "This color combination may be hard for people to read. Try using a brighter background color and/or a darker %s." 24446 ), 24447 item.description 24448 ); 24449 speakMessage = (0,external_wp_i18n_namespaceObject.__)( 24450 "This color combination may be hard for people to read." 24451 ); 24452 break; 24453 } 24454 if (textHasTransparency && enableAlphaChecker) { 24455 message = (0,external_wp_i18n_namespaceObject.__)("Transparent text may be hard for people to read."); 24456 speakMessage = (0,external_wp_i18n_namespaceObject.__)( 24457 "Transparent text may be hard for people to read." 24458 ); 24459 } 24460 } 24461 if (!message) { 24462 return null; 24463 } 24464 (0,external_wp_a11y_namespaceObject.speak)(speakMessage); 24465 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-contrast-checker", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 24466 external_wp_components_namespaceObject.Notice, 24467 { 24468 spokenMessage: null, 24469 status: "warning", 24470 isDismissible: false, 24471 children: message 24472 } 24473 ) }); 24474 } 24475 var contrast_checker_default = ContrastChecker; 24476 24477 24478 ;// ./node_modules/@wordpress/block-editor/build-module/components/provider/block-refs-provider.js 24479 24480 24481 24482 const BlockRefs = (0,external_wp_element_namespaceObject.createContext)({ refsMap: (0,external_wp_compose_namespaceObject.observableMap)() }); 24483 BlockRefs.displayName = "BlockRefsContext"; 24484 function BlockRefsProvider({ children }) { 24485 const value = (0,external_wp_element_namespaceObject.useMemo)(() => ({ refsMap: (0,external_wp_compose_namespaceObject.observableMap)() }), []); 24486 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockRefs.Provider, { value, children }); 24487 } 24488 24489 24490 ;// ./node_modules/@wordpress/block-editor/build-module/components/block-list/use-block-props/use-block-refs.js 24491 24492 24493 24494 function useBlockRefProvider(clientId) { 24495 const { refsMap } = (0,external_wp_element_namespaceObject.useContext)(BlockRefs); 24496 return (0,external_wp_compose_namespaceObject.useRefEffect)( 24497 (element) => { 24498 refsMap.set(clientId, element); 24499 return () => refsMap.delete(clientId); 24500 }, 24501 [clientId] 24502 ); 24503 } 24504 function assignRef(ref, value) { 24505 if (typeof ref === "function") { 24506 ref(value); 24507 } else if (ref) { 24508 ref.current = value; 24509 } 24510 } 24511 function useBlockElementRef(clientId, ref) { 24512 const { refsMap } = (0,external_wp_element_namespaceObject.useContext)(BlockRefs); 24513 (0,external_wp_element_namespaceObject.useLayoutEffect)(() => { 24514 assignRef(ref, refsMap.get(clientId)); 24515 const unsubscribe = refsMap.subscribe( 24516 clientId, 24517 () => assignRef(ref, refsMap.get(clientId)) 24518 ); 24519 return () => { 24520 unsubscribe(); 24521 assignRef(ref, null); 24522 }; 24523 }, [refsMap, clientId, ref]); 24524 } 24525 function useBlockElement(clientId) { 24526 const [blockElement, setBlockElement] = (0,external_wp_element_namespaceObject.useState)(null); 24527 useBlockElementRef(clientId, setBlockElement); 24528 return blockElement; 24529 } 24530 24531 24532 ;// ./node_modules/@wordpress/block-editor/build-module/hooks/contrast-checker.js 24533 24534 24535 24536 24537 function getComputedValue(node, property) { 24538 return node.ownerDocument.defaultView.getComputedStyle(node).getPropertyValue(property); 24539 } 24540 function getBlockElementColors(blockEl) { 24541 if (!blockEl) { 24542 return {}; 24543 } 24544 const firstLinkElement = blockEl.querySelector("a"); 24545 const linkColor = !!firstLinkElement?.innerText ? getComputedValue(firstLinkElement, "color") : void 0; 24546 const textColor = getComputedValue(blockEl, "color"); 24547 let backgroundColorNode = blockEl; 24548 let backgroundColor = getComputedValue( 24549 backgroundColorNode, 24550 "background-color" 24551 ); 24552 while (backgroundColor === "rgba(0, 0, 0, 0)" && backgroundColorNode.parentNode && backgroundColorNode.parentNode.nodeType === backgroundColorNode.parentNode.ELEMENT_NODE) { 24553 backgroundColorNode = backgroundColorNode.parentNode; 24554 backgroundColor = getComputedValue( 24555 backgroundColorNode, 24556 "background-color" 24557 ); 24558 } 24559 return { 24560 textColor, 24561 backgroundColor, 24562 linkColor 24563 }; 24564 } 24565 function contrast_checker_reducer(prevColors, newColors) { 24566 const hasChanged = Object.keys(newColors).some( 24567 (key) => prevColors[key] !== newColors[key] 24568 ); 24569 return hasChanged ? newColors : prevColors; 24570 } 24571 function BlockColorContrastChecker({ clientId }) { 24572 const blockEl = useBlockElement(clientId); 24573 const [colors, setColors] = (0,external_wp_element_namespaceObject.useReducer)(contrast_checker_reducer, {}); 24574 (0,external_wp_element_namespaceObject.useLayoutEffect)(() => { 24575 if (!blockEl) { 24576 return; 24577 } 24578 function updateColors() { 24579 setColors(getBlockElementColors(blockEl)); 24580 } 24581 window.requestAnimationFrame( 24582 () => window.requestAnimationFrame(updateColors) 24583 ); 24584 }); 24585 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 24586 contrast_checker_default, 24587 { 24588 backgroundColor: colors.backgroundColor, 24589 textColor: colors.textColor, 24590 linkColor: colors.linkColor, 24591 enableAlphaChecker: true 24592 } 24593 ); 24594 } 24595 24596 24597 ;// ./node_modules/@wordpress/block-editor/build-module/hooks/color.js 24598 24599 24600 24601 24602 24603 24604 24605 24606 24607 24608 24609 24610 24611 24612 24613 const COLOR_SUPPORT_KEY = "color"; 24614 const hasColorSupport = (blockNameOrType) => { 24615 const colorSupport = (0,external_wp_blocks_namespaceObject.getBlockSupport)(blockNameOrType, COLOR_SUPPORT_KEY); 24616 return colorSupport && (colorSupport.link === true || colorSupport.gradient === true || colorSupport.background !== false || colorSupport.text !== false); 24617 }; 24618 const hasLinkColorSupport = (blockType) => { 24619 if (external_wp_element_namespaceObject.Platform.OS !== "web") { 24620 return false; 24621 } 24622 const colorSupport = (0,external_wp_blocks_namespaceObject.getBlockSupport)(blockType, COLOR_SUPPORT_KEY); 24623 return colorSupport !== null && typeof colorSupport === "object" && !!colorSupport.link; 24624 }; 24625 const hasGradientSupport = (blockNameOrType) => { 24626 const colorSupport = (0,external_wp_blocks_namespaceObject.getBlockSupport)(blockNameOrType, COLOR_SUPPORT_KEY); 24627 return colorSupport !== null && typeof colorSupport === "object" && !!colorSupport.gradients; 24628 }; 24629 const hasBackgroundColorSupport = (blockType) => { 24630 const colorSupport = (0,external_wp_blocks_namespaceObject.getBlockSupport)(blockType, COLOR_SUPPORT_KEY); 24631 return colorSupport && colorSupport.background !== false; 24632 }; 24633 const hasTextColorSupport = (blockType) => { 24634 const colorSupport = (0,external_wp_blocks_namespaceObject.getBlockSupport)(blockType, COLOR_SUPPORT_KEY); 24635 return colorSupport && colorSupport.text !== false; 24636 }; 24637 function color_addAttributes(settings) { 24638 if (!hasColorSupport(settings)) { 24639 return settings; 24640 } 24641 if (!settings.attributes.backgroundColor) { 24642 Object.assign(settings.attributes, { 24643 backgroundColor: { 24644 type: "string" 24645 } 24646 }); 24647 } 24648 if (!settings.attributes.textColor) { 24649 Object.assign(settings.attributes, { 24650 textColor: { 24651 type: "string" 24652 } 24653 }); 24654 } 24655 if (hasGradientSupport(settings) && !settings.attributes.gradient) { 24656 Object.assign(settings.attributes, { 24657 gradient: { 24658 type: "string" 24659 } 24660 }); 24661 } 24662 return settings; 24663 } 24664 function color_addSaveProps(props, blockNameOrType, attributes) { 24665 if (!hasColorSupport(blockNameOrType) || shouldSkipSerialization(blockNameOrType, COLOR_SUPPORT_KEY)) { 24666 return props; 24667 } 24668 const hasGradient = hasGradientSupport(blockNameOrType); 24669 const { backgroundColor, textColor, gradient, style } = attributes; 24670 const shouldSerialize = (feature) => !shouldSkipSerialization( 24671 blockNameOrType, 24672 COLOR_SUPPORT_KEY, 24673 feature 24674 ); 24675 const textClass = shouldSerialize("text") ? getColorClassName("color", textColor) : void 0; 24676 const gradientClass = shouldSerialize("gradients") ? __experimentalGetGradientClass(gradient) : void 0; 24677 const backgroundClass = shouldSerialize("background") ? getColorClassName("background-color", backgroundColor) : void 0; 24678 const serializeHasBackground = shouldSerialize("background") || shouldSerialize("gradients"); 24679 const hasBackground = backgroundColor || style?.color?.background || hasGradient && (gradient || style?.color?.gradient); 24680 const newClassName = dist_clsx(props.className, textClass, gradientClass, { 24681 // Don't apply the background class if there's a custom gradient. 24682 [backgroundClass]: (!hasGradient || !style?.color?.gradient) && !!backgroundClass, 24683 "has-text-color": shouldSerialize("text") && (textColor || style?.color?.text), 24684 "has-background": serializeHasBackground && hasBackground, 24685 "has-link-color": shouldSerialize("link") && style?.elements?.link?.color 24686 }); 24687 props.className = newClassName ? newClassName : void 0; 24688 return props; 24689 } 24690 function color_styleToAttributes(style) { 24691 const textColorValue = style?.color?.text; 24692 const textColorSlug = textColorValue?.startsWith("var:preset|color|") ? textColorValue.substring("var:preset|color|".length) : void 0; 24693 const backgroundColorValue = style?.color?.background; 24694 const backgroundColorSlug = backgroundColorValue?.startsWith( 24695 "var:preset|color|" 24696 ) ? backgroundColorValue.substring("var:preset|color|".length) : void 0; 24697 const gradientValue = style?.color?.gradient; 24698 const gradientSlug = gradientValue?.startsWith("var:preset|gradient|") ? gradientValue.substring("var:preset|gradient|".length) : void 0; 24699 const updatedStyle = { ...style }; 24700 updatedStyle.color = { 24701 ...updatedStyle.color, 24702 text: textColorSlug ? void 0 : textColorValue, 24703 background: backgroundColorSlug ? void 0 : backgroundColorValue, 24704 gradient: gradientSlug ? void 0 : gradientValue 24705 }; 24706 return { 24707 style: utils_cleanEmptyObject(updatedStyle), 24708 textColor: textColorSlug, 24709 backgroundColor: backgroundColorSlug, 24710 gradient: gradientSlug 24711 }; 24712 } 24713 function color_attributesToStyle(attributes) { 24714 return { 24715 ...attributes.style, 24716 color: { 24717 ...attributes.style?.color, 24718 text: attributes.textColor ? "var:preset|color|" + attributes.textColor : attributes.style?.color?.text, 24719 background: attributes.backgroundColor ? "var:preset|color|" + attributes.backgroundColor : attributes.style?.color?.background, 24720 gradient: attributes.gradient ? "var:preset|gradient|" + attributes.gradient : attributes.style?.color?.gradient 24721 } 24722 }; 24723 } 24724 function ColorInspectorControl({ children, resetAllFilter }) { 24725 const attributesResetAllFilter = (0,external_wp_element_namespaceObject.useCallback)( 24726 (attributes) => { 24727 const existingStyle = color_attributesToStyle(attributes); 24728 const updatedStyle = resetAllFilter(existingStyle); 24729 return { 24730 ...attributes, 24731 ...color_styleToAttributes(updatedStyle) 24732 }; 24733 }, 24734 [resetAllFilter] 24735 ); 24736 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 24737 inspector_controls_default, 24738 { 24739 group: "color", 24740 resetAllFilter: attributesResetAllFilter, 24741 children 24742 } 24743 ); 24744 } 24745 function ColorEdit({ clientId, name, setAttributes, settings }) { 24746 const isEnabled = useHasColorPanel(settings); 24747 function selector(select) { 24748 const { style: style2, textColor: textColor2, backgroundColor: backgroundColor2, gradient: gradient2 } = select(store).getBlockAttributes(clientId) || {}; 24749 return { style: style2, textColor: textColor2, backgroundColor: backgroundColor2, gradient: gradient2 }; 24750 } 24751 const { style, textColor, backgroundColor, gradient } = (0,external_wp_data_namespaceObject.useSelect)( 24752 selector, 24753 [clientId] 24754 ); 24755 const value = (0,external_wp_element_namespaceObject.useMemo)(() => { 24756 return color_attributesToStyle({ 24757 style, 24758 textColor, 24759 backgroundColor, 24760 gradient 24761 }); 24762 }, [style, textColor, backgroundColor, gradient]); 24763 const onChange = (newStyle) => { 24764 setAttributes(color_styleToAttributes(newStyle)); 24765 }; 24766 if (!isEnabled) { 24767 return null; 24768 } 24769 const defaultControls = (0,external_wp_blocks_namespaceObject.getBlockSupport)(name, [ 24770 COLOR_SUPPORT_KEY, 24771 "__experimentalDefaultControls" 24772 ]); 24773 const enableContrastChecking = external_wp_element_namespaceObject.Platform.OS === "web" && !value?.color?.gradient && (settings?.color?.text || settings?.color?.link) && // Contrast checking is enabled by default. 24774 // Deactivating it requires `enableContrastChecker` to have 24775 // an explicit value of `false`. 24776 false !== (0,external_wp_blocks_namespaceObject.getBlockSupport)(name, [ 24777 COLOR_SUPPORT_KEY, 24778 "enableContrastChecker" 24779 ]); 24780 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 24781 ColorPanel, 24782 { 24783 as: ColorInspectorControl, 24784 panelId: clientId, 24785 settings, 24786 value, 24787 onChange, 24788 defaultControls, 24789 enableContrastChecker: false !== (0,external_wp_blocks_namespaceObject.getBlockSupport)(name, [ 24790 COLOR_SUPPORT_KEY, 24791 "enableContrastChecker" 24792 ]), 24793 children: enableContrastChecking && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockColorContrastChecker, { clientId }) 24794 } 24795 ); 24796 } 24797 function color_useBlockProps({ 24798 name, 24799 backgroundColor, 24800 textColor, 24801 gradient, 24802 style 24803 }) { 24804 const [userPalette, themePalette, defaultPalette] = use_settings_useSettings( 24805 "color.palette.custom", 24806 "color.palette.theme", 24807 "color.palette.default" 24808 ); 24809 const colors = (0,external_wp_element_namespaceObject.useMemo)( 24810 () => [ 24811 ...userPalette || [], 24812 ...themePalette || [], 24813 ...defaultPalette || [] 24814 ], 24815 [userPalette, themePalette, defaultPalette] 24816 ); 24817 if (!hasColorSupport(name) || shouldSkipSerialization(name, COLOR_SUPPORT_KEY)) { 24818 return {}; 24819 } 24820 const extraStyles = {}; 24821 if (textColor && !shouldSkipSerialization(name, COLOR_SUPPORT_KEY, "text")) { 24822 extraStyles.color = getColorObjectByAttributeValues( 24823 colors, 24824 textColor 24825 )?.color; 24826 } 24827 if (backgroundColor && !shouldSkipSerialization(name, COLOR_SUPPORT_KEY, "background")) { 24828 extraStyles.backgroundColor = getColorObjectByAttributeValues( 24829 colors, 24830 backgroundColor 24831 )?.color; 24832 } 24833 const saveProps = color_addSaveProps({ style: extraStyles }, name, { 24834 textColor, 24835 backgroundColor, 24836 gradient, 24837 style 24838 }); 24839 const hasBackgroundValue = backgroundColor || style?.color?.background || gradient || style?.color?.gradient; 24840 return { 24841 ...saveProps, 24842 className: dist_clsx( 24843 saveProps.className, 24844 // Add background image classes in the editor, if not already handled by background color values. 24845 !hasBackgroundValue && getBackgroundImageClasses(style) 24846 ) 24847 }; 24848 } 24849 var color_default = { 24850 useBlockProps: color_useBlockProps, 24851 addSaveProps: color_addSaveProps, 24852 attributeKeys: ["backgroundColor", "textColor", "gradient", "style"], 24853 hasSupport: hasColorSupport 24854 }; 24855 const MIGRATION_PATHS = { 24856 linkColor: [["style", "elements", "link", "color", "text"]], 24857 textColor: [["textColor"], ["style", "color", "text"]], 24858 backgroundColor: [ 24859 ["backgroundColor"], 24860 ["style", "color", "background"] 24861 ], 24862 gradient: [["gradient"], ["style", "color", "gradient"]] 24863 }; 24864 function color_addTransforms(result, source, index, results) { 24865 const destinationBlockType = result.name; 24866 const activeSupports = { 24867 linkColor: hasLinkColorSupport(destinationBlockType), 24868 textColor: hasTextColorSupport(destinationBlockType), 24869 backgroundColor: hasBackgroundColorSupport(destinationBlockType), 24870 gradient: hasGradientSupport(destinationBlockType) 24871 }; 24872 return transformStyles( 24873 activeSupports, 24874 MIGRATION_PATHS, 24875 result, 24876 source, 24877 index, 24878 results 24879 ); 24880 } 24881 (0,external_wp_hooks_namespaceObject.addFilter)( 24882 "blocks.registerBlockType", 24883 "core/color/addAttribute", 24884 color_addAttributes 24885 ); 24886 (0,external_wp_hooks_namespaceObject.addFilter)( 24887 "blocks.switchToBlockType.transformedBlock", 24888 "core/color/addTransforms", 24889 color_addTransforms 24890 ); 24891 24892 24893 ;// ./node_modules/@wordpress/block-editor/build-module/components/font-family/index.js 24894 24895 24896 24897 24898 24899 24900 function FontFamilyControl({ 24901 /** Start opting into the larger default height that will become the default size in a future version. */ 24902 __next40pxDefaultSize = false, 24903 /** Start opting into the new margin-free styles that will become the default in a future version. */ 24904 __nextHasNoMarginBottom = false, 24905 value = "", 24906 onChange, 24907 fontFamilies, 24908 className, 24909 ...props 24910 }) { 24911 const [blockLevelFontFamilies] = use_settings_useSettings("typography.fontFamilies"); 24912 if (!fontFamilies) { 24913 fontFamilies = blockLevelFontFamilies; 24914 } 24915 if (!fontFamilies || fontFamilies.length === 0) { 24916 return null; 24917 } 24918 const options = [ 24919 { 24920 key: "", 24921 name: (0,external_wp_i18n_namespaceObject.__)("Default") 24922 }, 24923 ...fontFamilies.map(({ fontFamily, name }) => ({ 24924 key: fontFamily, 24925 name: name || fontFamily, 24926 style: { fontFamily } 24927 })) 24928 ]; 24929 if (!__nextHasNoMarginBottom) { 24930 external_wp_deprecated_default()( 24931 "Bottom margin styles for wp.blockEditor.FontFamilyControl", 24932 { 24933 since: "6.7", 24934 version: "7.0", 24935 hint: "Set the `__nextHasNoMarginBottom` prop to true to start opting into the new styles, which will become the default in a future version" 24936 } 24937 ); 24938 } 24939 if (!__next40pxDefaultSize && (props.size === void 0 || props.size === "default")) { 24940 external_wp_deprecated_default()( 24941 `36px default size for wp.blockEditor.__experimentalFontFamilyControl`, 24942 { 24943 since: "6.8", 24944 version: "7.1", 24945 hint: "Set the `__next40pxDefaultSize` prop to true to start opting into the new default size, which will become the default in a future version." 24946 } 24947 ); 24948 } 24949 const selectedValue = options.find((option) => option.key === value) ?? ""; 24950 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 24951 external_wp_components_namespaceObject.CustomSelectControl, 24952 { 24953 __next40pxDefaultSize, 24954 __shouldNotWarnDeprecated36pxSize: true, 24955 label: (0,external_wp_i18n_namespaceObject.__)("Font"), 24956 value: selectedValue, 24957 onChange: ({ selectedItem }) => onChange(selectedItem.key), 24958 options, 24959 className: dist_clsx("block-editor-font-family-control", className, { 24960 "is-next-has-no-margin-bottom": __nextHasNoMarginBottom 24961 }), 24962 ...props 24963 } 24964 ); 24965 } 24966 24967 24968 ;// ./node_modules/@wordpress/block-editor/build-module/components/font-appearance-control/index.js 24969 24970 24971 24972 24973 24974 24975 const getFontAppearanceLabel = (hasFontStyles, hasFontWeights) => { 24976 if (!hasFontStyles) { 24977 return (0,external_wp_i18n_namespaceObject.__)("Font weight"); 24978 } 24979 if (!hasFontWeights) { 24980 return (0,external_wp_i18n_namespaceObject.__)("Font style"); 24981 } 24982 return (0,external_wp_i18n_namespaceObject.__)("Appearance"); 24983 }; 24984 function FontAppearanceControl(props) { 24985 const { 24986 /** Start opting into the larger default height that will become the default size in a future version. */ 24987 __next40pxDefaultSize = false, 24988 onChange, 24989 hasFontStyles = true, 24990 hasFontWeights = true, 24991 fontFamilyFaces, 24992 value: { fontStyle, fontWeight }, 24993 ...otherProps 24994 } = props; 24995 const hasStylesOrWeights = hasFontStyles || hasFontWeights; 24996 const label = getFontAppearanceLabel(hasFontStyles, hasFontWeights); 24997 const defaultOption = { 24998 key: "default", 24999 name: (0,external_wp_i18n_namespaceObject.__)("Default"), 25000 style: { fontStyle: void 0, fontWeight: void 0 } 25001 }; 25002 const { fontStyles, fontWeights, combinedStyleAndWeightOptions } = getFontStylesAndWeights(fontFamilyFaces); 25003 const combineOptions = () => { 25004 const combinedOptions = [defaultOption]; 25005 if (combinedStyleAndWeightOptions) { 25006 combinedOptions.push(...combinedStyleAndWeightOptions); 25007 } 25008 return combinedOptions; 25009 }; 25010 const styleOptions = () => { 25011 const combinedOptions = [defaultOption]; 25012 fontStyles.forEach(({ name, value }) => { 25013 combinedOptions.push({ 25014 key: value, 25015 name, 25016 style: { fontStyle: value, fontWeight: void 0 } 25017 }); 25018 }); 25019 return combinedOptions; 25020 }; 25021 const weightOptions = () => { 25022 const combinedOptions = [defaultOption]; 25023 fontWeights.forEach(({ name, value }) => { 25024 combinedOptions.push({ 25025 key: value, 25026 name, 25027 style: { fontStyle: void 0, fontWeight: value } 25028 }); 25029 }); 25030 return combinedOptions; 25031 }; 25032 const selectOptions = (0,external_wp_element_namespaceObject.useMemo)(() => { 25033 if (hasFontStyles && hasFontWeights) { 25034 return combineOptions(); 25035 } 25036 return hasFontStyles ? styleOptions() : weightOptions(); 25037 }, [ 25038 props.options, 25039 fontStyles, 25040 fontWeights, 25041 combinedStyleAndWeightOptions 25042 ]); 25043 const currentSelection = selectOptions.find( 25044 (option) => option.style.fontStyle === fontStyle && option.style.fontWeight === fontWeight 25045 ) || selectOptions[0]; 25046 const getDescribedBy = () => { 25047 if (!currentSelection) { 25048 return (0,external_wp_i18n_namespaceObject.__)("No selected font appearance"); 25049 } 25050 if (!hasFontStyles) { 25051 return (0,external_wp_i18n_namespaceObject.sprintf)( 25052 // translators: %s: Currently selected font weight. 25053 (0,external_wp_i18n_namespaceObject.__)("Currently selected font weight: %s"), 25054 currentSelection.name 25055 ); 25056 } 25057 if (!hasFontWeights) { 25058 return (0,external_wp_i18n_namespaceObject.sprintf)( 25059 // translators: %s: Currently selected font style. 25060 (0,external_wp_i18n_namespaceObject.__)("Currently selected font style: %s"), 25061 currentSelection.name 25062 ); 25063 } 25064 return (0,external_wp_i18n_namespaceObject.sprintf)( 25065 // translators: %s: Currently selected font appearance. 25066 (0,external_wp_i18n_namespaceObject.__)("Currently selected font appearance: %s"), 25067 currentSelection.name 25068 ); 25069 }; 25070 if (!__next40pxDefaultSize && (otherProps.size === void 0 || otherProps.size === "default")) { 25071 external_wp_deprecated_default()( 25072 `36px default size for wp.blockEditor.__experimentalFontAppearanceControl`, 25073 { 25074 since: "6.8", 25075 version: "7.1", 25076 hint: "Set the `__next40pxDefaultSize` prop to true to start opting into the new default size, which will become the default in a future version." 25077 } 25078 ); 25079 } 25080 return hasStylesOrWeights && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 25081 external_wp_components_namespaceObject.CustomSelectControl, 25082 { 25083 ...otherProps, 25084 className: "components-font-appearance-control", 25085 __next40pxDefaultSize, 25086 __shouldNotWarnDeprecated36pxSize: true, 25087 label, 25088 describedBy: getDescribedBy(), 25089 options: selectOptions, 25090 value: currentSelection, 25091 onChange: ({ selectedItem }) => onChange(selectedItem.style) 25092 } 25093 ); 25094 } 25095 25096 25097 ;// ./node_modules/@wordpress/block-editor/build-module/components/line-height-control/utils.js 25098 const BASE_DEFAULT_VALUE = 1.5; 25099 const STEP = 0.01; 25100 const SPIN_FACTOR = 10; 25101 const RESET_VALUE = ""; 25102 function isLineHeightDefined(lineHeight) { 25103 return lineHeight !== void 0 && lineHeight !== RESET_VALUE; 25104 } 25105 25106 25107 ;// ./node_modules/@wordpress/block-editor/build-module/components/line-height-control/index.js 25108 25109 25110 25111 25112 25113 const line_height_control_LineHeightControl = ({ 25114 /** Start opting into the larger default height that will become the default size in a future version. */ 25115 __next40pxDefaultSize = false, 25116 value: lineHeight, 25117 onChange, 25118 __unstableInputWidth = "60px", 25119 ...otherProps 25120 }) => { 25121 const isDefined = isLineHeightDefined(lineHeight); 25122 const adjustNextValue = (nextValue, wasTypedOrPasted) => { 25123 if (isDefined) { 25124 return nextValue; 25125 } 25126 const spin = STEP * SPIN_FACTOR; 25127 switch (`$nextValue}`) { 25128 case `$spin}`: 25129 return BASE_DEFAULT_VALUE + spin; 25130 case "0": { 25131 if (wasTypedOrPasted) { 25132 return nextValue; 25133 } 25134 return BASE_DEFAULT_VALUE - spin; 25135 } 25136 case "": 25137 return BASE_DEFAULT_VALUE; 25138 default: 25139 return nextValue; 25140 } 25141 }; 25142 const stateReducer = (state, action) => { 25143 const wasTypedOrPasted = ["insertText", "insertFromPaste"].includes( 25144 action.payload.event.nativeEvent?.inputType 25145 ); 25146 const value2 = adjustNextValue(state.value, wasTypedOrPasted); 25147 return { ...state, value: value2 }; 25148 }; 25149 const value = isDefined ? lineHeight : RESET_VALUE; 25150 const handleOnChange = (nextValue, { event }) => { 25151 if (nextValue === "") { 25152 onChange(); 25153 return; 25154 } 25155 if (event.type === "click") { 25156 onChange(adjustNextValue(`$nextValue}`, false)); 25157 return; 25158 } 25159 onChange(`$nextValue}`); 25160 }; 25161 if (!__next40pxDefaultSize && (otherProps.size === void 0 || otherProps.size === "default")) { 25162 external_wp_deprecated_default()(`36px default size for wp.blockEditor.LineHeightControl`, { 25163 since: "6.8", 25164 version: "7.1", 25165 hint: "Set the `__next40pxDefaultSize` prop to true to start opting into the new default size, which will become the default in a future version." 25166 }); 25167 } 25168 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-line-height-control", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 25169 external_wp_components_namespaceObject.__experimentalNumberControl, 25170 { 25171 ...otherProps, 25172 __shouldNotWarnDeprecated36pxSize: true, 25173 __next40pxDefaultSize, 25174 __unstableInputWidth, 25175 __unstableStateReducer: stateReducer, 25176 onChange: handleOnChange, 25177 label: (0,external_wp_i18n_namespaceObject.__)("Line height"), 25178 placeholder: BASE_DEFAULT_VALUE, 25179 step: STEP, 25180 spinFactor: SPIN_FACTOR, 25181 value, 25182 min: 0, 25183 spinControls: "custom" 25184 } 25185 ) }); 25186 }; 25187 var line_height_control_default = line_height_control_LineHeightControl; 25188 25189 25190 ;// ./node_modules/@wordpress/block-editor/build-module/components/letter-spacing-control/index.js 25191 25192 25193 25194 25195 25196 function LetterSpacingControl({ 25197 __next40pxDefaultSize = false, 25198 value, 25199 onChange, 25200 __unstableInputWidth = "60px", 25201 ...otherProps 25202 }) { 25203 const [availableUnits] = use_settings_useSettings("spacing.units"); 25204 const units = (0,external_wp_components_namespaceObject.__experimentalUseCustomUnits)({ 25205 availableUnits: availableUnits || ["px", "em", "rem"], 25206 defaultValues: { px: 2, em: 0.2, rem: 0.2 } 25207 }); 25208 if (!__next40pxDefaultSize && (otherProps.size === void 0 || otherProps.size === "default")) { 25209 external_wp_deprecated_default()( 25210 `36px default size for wp.blockEditor.__experimentalLetterSpacingControl`, 25211 { 25212 since: "6.8", 25213 version: "7.1", 25214 hint: "Set the `__next40pxDefaultSize` prop to true to start opting into the new default size, which will become the default in a future version." 25215 } 25216 ); 25217 } 25218 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 25219 external_wp_components_namespaceObject.__experimentalUnitControl, 25220 { 25221 __next40pxDefaultSize, 25222 __shouldNotWarnDeprecated36pxSize: true, 25223 ...otherProps, 25224 label: (0,external_wp_i18n_namespaceObject.__)("Letter spacing"), 25225 value, 25226 __unstableInputWidth, 25227 units, 25228 onChange 25229 } 25230 ); 25231 } 25232 25233 25234 ;// ./node_modules/@wordpress/icons/build-module/library/align-left.js 25235 25236 25237 var align_left_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M13 5.5H4V4h9v1.5Zm7 7H4V11h16v1.5Zm-7 7H4V18h9v1.5Z" }) }); 25238 25239 25240 ;// ./node_modules/@wordpress/icons/build-module/library/align-center.js 25241 25242 25243 var align_center_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M7.5 5.5h9V4h-9v1.5Zm-3.5 7h16V11H4v1.5Zm3.5 7h9V18h-9v1.5Z" }) }); 25244 25245 25246 ;// ./node_modules/@wordpress/icons/build-module/library/align-right.js 25247 25248 25249 var align_right_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M11.111 5.5H20V4h-8.889v1.5ZM4 12.5h16V11H4v1.5Zm7.111 7H20V18h-8.889v1.5Z" }) }); 25250 25251 25252 ;// ./node_modules/@wordpress/icons/build-module/library/align-justify.js 25253 25254 25255 var align_justify_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M4 12.8h16v-1.5H4v1.5zm0 7h12.4v-1.5H4v1.5zM4 4.3v1.5h16V4.3H4z" }) }); 25256 25257 25258 ;// ./node_modules/@wordpress/block-editor/build-module/components/text-alignment-control/index.js 25259 25260 25261 25262 25263 25264 25265 const TEXT_ALIGNMENT_OPTIONS = [ 25266 { 25267 label: (0,external_wp_i18n_namespaceObject.__)("Align text left"), 25268 value: "left", 25269 icon: align_left_default 25270 }, 25271 { 25272 label: (0,external_wp_i18n_namespaceObject.__)("Align text center"), 25273 value: "center", 25274 icon: align_center_default 25275 }, 25276 { 25277 label: (0,external_wp_i18n_namespaceObject.__)("Align text right"), 25278 value: "right", 25279 icon: align_right_default 25280 }, 25281 { 25282 label: (0,external_wp_i18n_namespaceObject.__)("Justify text"), 25283 value: "justify", 25284 icon: align_justify_default 25285 } 25286 ]; 25287 const DEFAULT_OPTIONS = ["left", "center", "right"]; 25288 function TextAlignmentControl({ 25289 className, 25290 value, 25291 onChange, 25292 options = DEFAULT_OPTIONS 25293 }) { 25294 const validOptions = (0,external_wp_element_namespaceObject.useMemo)( 25295 () => TEXT_ALIGNMENT_OPTIONS.filter( 25296 (option) => options.includes(option.value) 25297 ), 25298 [options] 25299 ); 25300 if (!validOptions.length) { 25301 return null; 25302 } 25303 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 25304 external_wp_components_namespaceObject.__experimentalToggleGroupControl, 25305 { 25306 isDeselectable: true, 25307 __nextHasNoMarginBottom: true, 25308 __next40pxDefaultSize: true, 25309 label: (0,external_wp_i18n_namespaceObject.__)("Text alignment"), 25310 className: dist_clsx( 25311 "block-editor-text-alignment-control", 25312 className 25313 ), 25314 value, 25315 onChange: (newValue) => { 25316 onChange(newValue === value ? void 0 : newValue); 25317 }, 25318 children: validOptions.map((option) => { 25319 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 25320 external_wp_components_namespaceObject.__experimentalToggleGroupControlOptionIcon, 25321 { 25322 value: option.value, 25323 icon: option.icon, 25324 label: option.label 25325 }, 25326 option.value 25327 ); 25328 }) 25329 } 25330 ); 25331 } 25332 25333 25334 ;// ./node_modules/@wordpress/icons/build-module/library/format-uppercase.js 25335 25336 25337 var format_uppercase_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M6.1 6.8L2.1 18h1.6l1.1-3h4.3l1.1 3h1.6l-4-11.2H6.1zm-.8 6.8L7 8.9l1.7 4.7H5.3zm15.1-.7c-.4-.5-.9-.8-1.6-1 .4-.2.7-.5.8-.9.2-.4.3-.9.3-1.4 0-.9-.3-1.6-.8-2-.6-.5-1.3-.7-2.4-.7h-3.5V18h4.2c1.1 0 2-.3 2.6-.8.6-.6 1-1.4 1-2.4-.1-.8-.3-1.4-.6-1.9zm-5.7-4.7h1.8c.6 0 1.1.1 1.4.4.3.2.5.7.5 1.3 0 .6-.2 1.1-.5 1.3-.3.2-.8.4-1.4.4h-1.8V8.2zm4 8c-.4.3-.9.5-1.5.5h-2.6v-3.8h2.6c1.4 0 2 .6 2 1.9.1.6-.1 1-.5 1.4z" }) }); 25338 25339 25340 ;// ./node_modules/@wordpress/icons/build-module/library/format-lowercase.js 25341 25342 25343 var format_lowercase_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M11 16.8c-.1-.1-.2-.3-.3-.5v-2.6c0-.9-.1-1.7-.3-2.2-.2-.5-.5-.9-.9-1.2-.4-.2-.9-.3-1.6-.3-.5 0-1 .1-1.5.2s-.9.3-1.2.6l.2 1.2c.4-.3.7-.4 1.1-.5.3-.1.7-.2 1-.2.6 0 1 .1 1.3.4.3.2.4.7.4 1.4-1.2 0-2.3.2-3.3.7s-1.4 1.1-1.4 2.1c0 .7.2 1.2.7 1.6.4.4 1 .6 1.8.6.9 0 1.7-.4 2.4-1.2.1.3.2.5.4.7.1.2.3.3.6.4.3.1.6.1 1.1.1h.1l.2-1.2h-.1c-.4.1-.6 0-.7-.1zM9.2 16c-.2.3-.5.6-.9.8-.3.1-.7.2-1.1.2-.4 0-.7-.1-.9-.3-.2-.2-.3-.5-.3-.9 0-.6.2-1 .7-1.3.5-.3 1.3-.4 2.5-.5v2zm10.6-3.9c-.3-.6-.7-1.1-1.2-1.5-.6-.4-1.2-.6-1.9-.6-.5 0-.9.1-1.4.3-.4.2-.8.5-1.1.8V6h-1.4v12h1.3l.2-1c.2.4.6.6 1 .8.4.2.9.3 1.4.3.7 0 1.2-.2 1.8-.5.5-.4 1-.9 1.3-1.5.3-.6.5-1.3.5-2.1-.1-.6-.2-1.3-.5-1.9zm-1.7 4c-.4.5-.9.8-1.6.8s-1.2-.2-1.7-.7c-.4-.5-.7-1.2-.7-2.1 0-.9.2-1.6.7-2.1.4-.5 1-.7 1.7-.7s1.2.3 1.6.8c.4.5.6 1.2.6 2s-.2 1.4-.6 2z" }) }); 25344 25345 25346 ;// ./node_modules/@wordpress/icons/build-module/library/format-capitalize.js 25347 25348 25349 var format_capitalize_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M7.1 6.8L3.1 18h1.6l1.1-3h4.3l1.1 3h1.6l-4-11.2H7.1zm-.8 6.8L8 8.9l1.7 4.7H6.3zm14.5-1.5c-.3-.6-.7-1.1-1.2-1.5-.6-.4-1.2-.6-1.9-.6-.5 0-.9.1-1.4.3-.4.2-.8.5-1.1.8V6h-1.4v12h1.3l.2-1c.2.4.6.6 1 .8.4.2.9.3 1.4.3.7 0 1.2-.2 1.8-.5.5-.4 1-.9 1.3-1.5.3-.6.5-1.3.5-2.1-.1-.6-.2-1.3-.5-1.9zm-1.7 4c-.4.5-.9.8-1.6.8s-1.2-.2-1.7-.7c-.4-.5-.7-1.2-.7-2.1 0-.9.2-1.6.7-2.1.4-.5 1-.7 1.7-.7s1.2.3 1.6.8c.4.5.6 1.2.6 2 .1.8-.2 1.4-.6 2z" }) }); 25350 25351 25352 ;// ./node_modules/@wordpress/block-editor/build-module/components/text-transform-control/index.js 25353 25354 25355 25356 25357 25358 const TEXT_TRANSFORMS = [ 25359 { 25360 label: (0,external_wp_i18n_namespaceObject.__)("None"), 25361 value: "none", 25362 icon: reset_default 25363 }, 25364 { 25365 label: (0,external_wp_i18n_namespaceObject.__)("Uppercase"), 25366 value: "uppercase", 25367 icon: format_uppercase_default 25368 }, 25369 { 25370 label: (0,external_wp_i18n_namespaceObject.__)("Lowercase"), 25371 value: "lowercase", 25372 icon: format_lowercase_default 25373 }, 25374 { 25375 label: (0,external_wp_i18n_namespaceObject.__)("Capitalize"), 25376 value: "capitalize", 25377 icon: format_capitalize_default 25378 } 25379 ]; 25380 function TextTransformControl({ className, value, onChange }) { 25381 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 25382 external_wp_components_namespaceObject.__experimentalToggleGroupControl, 25383 { 25384 isDeselectable: true, 25385 __nextHasNoMarginBottom: true, 25386 __next40pxDefaultSize: true, 25387 label: (0,external_wp_i18n_namespaceObject.__)("Letter case"), 25388 className: dist_clsx( 25389 "block-editor-text-transform-control", 25390 className 25391 ), 25392 value, 25393 onChange: (newValue) => { 25394 onChange(newValue === value ? void 0 : newValue); 25395 }, 25396 children: TEXT_TRANSFORMS.map((option) => { 25397 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 25398 external_wp_components_namespaceObject.__experimentalToggleGroupControlOptionIcon, 25399 { 25400 value: option.value, 25401 icon: option.icon, 25402 label: option.label 25403 }, 25404 option.value 25405 ); 25406 }) 25407 } 25408 ); 25409 } 25410 25411 25412 ;// ./node_modules/@wordpress/icons/build-module/library/format-underline.js 25413 25414 25415 var format_underline_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M7 18v1h10v-1H7zm5-2c1.5 0 2.6-.4 3.4-1.2.8-.8 1.1-2 1.1-3.5V5H15v5.8c0 1.2-.2 2.1-.6 2.8-.4.7-1.2 1-2.4 1s-2-.3-2.4-1c-.4-.7-.6-1.6-.6-2.8V5H7.5v6.2c0 1.5.4 2.7 1.1 3.5.8.9 1.9 1.3 3.4 1.3z" }) }); 25416 25417 25418 ;// ./node_modules/@wordpress/icons/build-module/library/format-strikethrough.js 25419 25420 25421 var format_strikethrough_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M9.1 9v-.5c0-.6.2-1.1.7-1.4.5-.3 1.2-.5 2-.5.7 0 1.4.1 2.1.3.7.2 1.4.5 2.1.9l.2-1.9c-.6-.3-1.2-.5-1.9-.7-.8-.1-1.6-.2-2.4-.2-1.5 0-2.7.3-3.6 1-.8.7-1.2 1.5-1.2 2.6V9h2zM20 12H4v1h8.3c.3.1.6.2.8.3.5.2.9.5 1.1.8.3.3.4.7.4 1.2 0 .7-.2 1.1-.8 1.5-.5.3-1.2.5-2.1.5-.8 0-1.6-.1-2.4-.3-.8-.2-1.5-.5-2.2-.8L7 18.1c.5.2 1.2.4 2 .6.8.2 1.6.3 2.4.3 1.7 0 3-.3 3.9-1 .9-.7 1.3-1.6 1.3-2.8 0-.9-.2-1.7-.7-2.2H20v-1z" }) }); 25422 25423 25424 ;// ./node_modules/@wordpress/block-editor/build-module/components/text-decoration-control/index.js 25425 25426 25427 25428 25429 25430 const TEXT_DECORATIONS = [ 25431 { 25432 label: (0,external_wp_i18n_namespaceObject.__)("None"), 25433 value: "none", 25434 icon: reset_default 25435 }, 25436 { 25437 label: (0,external_wp_i18n_namespaceObject.__)("Underline"), 25438 value: "underline", 25439 icon: format_underline_default 25440 }, 25441 { 25442 label: (0,external_wp_i18n_namespaceObject.__)("Strikethrough"), 25443 value: "line-through", 25444 icon: format_strikethrough_default 25445 } 25446 ]; 25447 function TextDecorationControl({ 25448 value, 25449 onChange, 25450 className 25451 }) { 25452 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 25453 external_wp_components_namespaceObject.__experimentalToggleGroupControl, 25454 { 25455 isDeselectable: true, 25456 __nextHasNoMarginBottom: true, 25457 __next40pxDefaultSize: true, 25458 label: (0,external_wp_i18n_namespaceObject.__)("Decoration"), 25459 className: dist_clsx( 25460 "block-editor-text-decoration-control", 25461 className 25462 ), 25463 value, 25464 onChange: (newValue) => { 25465 onChange(newValue === value ? void 0 : newValue); 25466 }, 25467 children: TEXT_DECORATIONS.map((option) => { 25468 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 25469 external_wp_components_namespaceObject.__experimentalToggleGroupControlOptionIcon, 25470 { 25471 value: option.value, 25472 icon: option.icon, 25473 label: option.label 25474 }, 25475 option.value 25476 ); 25477 }) 25478 } 25479 ); 25480 } 25481 25482 25483 ;// ./node_modules/@wordpress/icons/build-module/library/text-horizontal.js 25484 25485 25486 var text_horizontal_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M8.2 14.4h3.9L13 17h1.7L11 6.5H9.3L5.6 17h1.7l.9-2.6zm2-5.5 1.4 4H8.8l1.4-4zm7.4 7.5-1.3.8.8 1.4H5.5V20h14.3l-2.2-3.6z" }) }); 25487 25488 25489 ;// ./node_modules/@wordpress/icons/build-module/library/text-vertical.js 25490 25491 25492 var text_vertical_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M7 5.6v1.7l2.6.9v3.9L7 13v1.7L17.5 11V9.3L7 5.6zm4.2 6V8.8l4 1.4-4 1.4zm-5.7 5.6V5.5H4v14.3l3.6-2.2-.8-1.3-1.3.9z" }) }); 25493 25494 25495 ;// ./node_modules/@wordpress/block-editor/build-module/components/writing-mode-control/index.js 25496 25497 25498 25499 25500 25501 const WRITING_MODES = [ 25502 { 25503 label: (0,external_wp_i18n_namespaceObject.__)("Horizontal"), 25504 value: "horizontal-tb", 25505 icon: text_horizontal_default 25506 }, 25507 { 25508 label: (0,external_wp_i18n_namespaceObject.__)("Vertical"), 25509 value: (0,external_wp_i18n_namespaceObject.isRTL)() ? "vertical-lr" : "vertical-rl", 25510 icon: text_vertical_default 25511 } 25512 ]; 25513 function WritingModeControl({ className, value, onChange }) { 25514 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 25515 external_wp_components_namespaceObject.__experimentalToggleGroupControl, 25516 { 25517 isDeselectable: true, 25518 __nextHasNoMarginBottom: true, 25519 __next40pxDefaultSize: true, 25520 label: (0,external_wp_i18n_namespaceObject.__)("Orientation"), 25521 className: dist_clsx("block-editor-writing-mode-control", className), 25522 value, 25523 onChange: (newValue) => { 25524 onChange(newValue === value ? void 0 : newValue); 25525 }, 25526 children: WRITING_MODES.map((option) => { 25527 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 25528 external_wp_components_namespaceObject.__experimentalToggleGroupControlOptionIcon, 25529 { 25530 value: option.value, 25531 icon: option.icon, 25532 label: option.label 25533 }, 25534 option.value 25535 ); 25536 }) 25537 } 25538 ); 25539 } 25540 25541 25542 ;// ./node_modules/@wordpress/block-editor/build-module/components/global-styles/typography-panel.js 25543 25544 25545 25546 25547 25548 25549 25550 25551 25552 25553 25554 25555 25556 25557 25558 const MIN_TEXT_COLUMNS = 1; 25559 const MAX_TEXT_COLUMNS = 6; 25560 function useHasTypographyPanel(settings) { 25561 const hasFontFamily = useHasFontFamilyControl(settings); 25562 const hasLineHeight = useHasLineHeightControl(settings); 25563 const hasFontAppearance = useHasAppearanceControl(settings); 25564 const hasLetterSpacing = useHasLetterSpacingControl(settings); 25565 const hasTextAlign = useHasTextAlignmentControl(settings); 25566 const hasTextTransform = useHasTextTransformControl(settings); 25567 const hasTextDecoration = useHasTextDecorationControl(settings); 25568 const hasWritingMode = useHasWritingModeControl(settings); 25569 const hasTextColumns = useHasTextColumnsControl(settings); 25570 const hasFontSize = useHasFontSizeControl(settings); 25571 return hasFontFamily || hasLineHeight || hasFontAppearance || hasLetterSpacing || hasTextAlign || hasTextTransform || hasFontSize || hasTextDecoration || hasWritingMode || hasTextColumns; 25572 } 25573 function useHasFontSizeControl(settings) { 25574 return settings?.typography?.defaultFontSizes !== false && settings?.typography?.fontSizes?.default?.length || settings?.typography?.fontSizes?.theme?.length || settings?.typography?.fontSizes?.custom?.length || settings?.typography?.customFontSize; 25575 } 25576 function useHasFontFamilyControl(settings) { 25577 return ["default", "theme", "custom"].some( 25578 (key) => settings?.typography?.fontFamilies?.[key]?.length 25579 ); 25580 } 25581 function useHasLineHeightControl(settings) { 25582 return settings?.typography?.lineHeight; 25583 } 25584 function useHasAppearanceControl(settings) { 25585 return settings?.typography?.fontStyle || settings?.typography?.fontWeight; 25586 } 25587 function useAppearanceControlLabel(settings) { 25588 if (!settings?.typography?.fontStyle) { 25589 return (0,external_wp_i18n_namespaceObject.__)("Font weight"); 25590 } 25591 if (!settings?.typography?.fontWeight) { 25592 return (0,external_wp_i18n_namespaceObject.__)("Font style"); 25593 } 25594 return (0,external_wp_i18n_namespaceObject.__)("Appearance"); 25595 } 25596 function useHasLetterSpacingControl(settings) { 25597 return settings?.typography?.letterSpacing; 25598 } 25599 function useHasTextTransformControl(settings) { 25600 return settings?.typography?.textTransform; 25601 } 25602 function useHasTextAlignmentControl(settings) { 25603 return settings?.typography?.textAlign; 25604 } 25605 function useHasTextDecorationControl(settings) { 25606 return settings?.typography?.textDecoration; 25607 } 25608 function useHasWritingModeControl(settings) { 25609 return settings?.typography?.writingMode; 25610 } 25611 function useHasTextColumnsControl(settings) { 25612 return settings?.typography?.textColumns; 25613 } 25614 function getMergedFontSizes(settings) { 25615 const fontSizes = settings?.typography?.fontSizes; 25616 const defaultFontSizesEnabled = !!settings?.typography?.defaultFontSizes; 25617 return [ 25618 ...fontSizes?.custom ?? [], 25619 ...fontSizes?.theme ?? [], 25620 ...defaultFontSizesEnabled ? fontSizes?.default ?? [] : [] 25621 ]; 25622 } 25623 function TypographyToolsPanel({ 25624 resetAllFilter, 25625 onChange, 25626 value, 25627 panelId, 25628 children 25629 }) { 25630 const dropdownMenuProps = useToolsPanelDropdownMenuProps(); 25631 const resetAll = () => { 25632 const updatedValue = resetAllFilter(value); 25633 onChange(updatedValue); 25634 }; 25635 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 25636 external_wp_components_namespaceObject.__experimentalToolsPanel, 25637 { 25638 label: (0,external_wp_i18n_namespaceObject.__)("Typography"), 25639 resetAll, 25640 panelId, 25641 dropdownMenuProps, 25642 children 25643 } 25644 ); 25645 } 25646 const typography_panel_DEFAULT_CONTROLS = { 25647 fontFamily: true, 25648 fontSize: true, 25649 fontAppearance: true, 25650 lineHeight: true, 25651 letterSpacing: true, 25652 textAlign: true, 25653 textTransform: true, 25654 textDecoration: true, 25655 writingMode: true, 25656 textColumns: true 25657 }; 25658 function TypographyPanel({ 25659 as: Wrapper = TypographyToolsPanel, 25660 value, 25661 onChange, 25662 inheritedValue = value, 25663 settings, 25664 panelId, 25665 defaultControls = typography_panel_DEFAULT_CONTROLS 25666 }) { 25667 const decodeValue = (rawValue) => getValueFromVariable({ settings }, "", rawValue); 25668 const hasFontFamilyEnabled = useHasFontFamilyControl(settings); 25669 const fontFamily = decodeValue(inheritedValue?.typography?.fontFamily); 25670 const { fontFamilies, fontFamilyFaces } = (0,external_wp_element_namespaceObject.useMemo)(() => { 25671 return getMergedFontFamiliesAndFontFamilyFaces(settings, fontFamily); 25672 }, [settings, fontFamily]); 25673 const setFontFamily = (newValue) => { 25674 const slug = fontFamilies?.find( 25675 ({ fontFamily: f }) => f === newValue 25676 )?.slug; 25677 onChange( 25678 setImmutably( 25679 value, 25680 ["typography", "fontFamily"], 25681 slug ? `var:preset|font-family|$slug}` : newValue || void 0 25682 ) 25683 ); 25684 }; 25685 const hasFontFamily = () => !!value?.typography?.fontFamily; 25686 const resetFontFamily = () => setFontFamily(void 0); 25687 const hasFontSizeEnabled = useHasFontSizeControl(settings); 25688 const disableCustomFontSizes = !settings?.typography?.customFontSize; 25689 const mergedFontSizes = getMergedFontSizes(settings); 25690 const fontSize = decodeValue(inheritedValue?.typography?.fontSize); 25691 const currentFontSizeSlug = (() => { 25692 const rawValue = inheritedValue?.typography?.fontSize; 25693 if (!rawValue || typeof rawValue !== "string") { 25694 return void 0; 25695 } 25696 if (rawValue.startsWith("var:preset|font-size|")) { 25697 return rawValue.replace("var:preset|font-size|", ""); 25698 } 25699 const cssVarMatch = rawValue.match( 25700 /^var\(--wp--preset--font-size--([^)]+)\)$/ 25701 ); 25702 if (cssVarMatch) { 25703 return cssVarMatch[1]; 25704 } 25705 return void 0; 25706 })(); 25707 const setFontSize = (newValue, metadata) => { 25708 const actualValue = !!metadata?.slug ? `var:preset|font-size|$metadata?.slug}` : newValue; 25709 onChange( 25710 setImmutably( 25711 value, 25712 ["typography", "fontSize"], 25713 actualValue || void 0 25714 ) 25715 ); 25716 }; 25717 const hasFontSize = () => !!value?.typography?.fontSize; 25718 const resetFontSize = () => setFontSize(void 0); 25719 const hasAppearanceControl = useHasAppearanceControl(settings); 25720 const appearanceControlLabel = useAppearanceControlLabel(settings); 25721 const hasFontStyles = settings?.typography?.fontStyle; 25722 const hasFontWeights = settings?.typography?.fontWeight; 25723 const fontStyle = decodeValue(inheritedValue?.typography?.fontStyle); 25724 const fontWeight = decodeValue(inheritedValue?.typography?.fontWeight); 25725 const { nearestFontStyle, nearestFontWeight } = findNearestStyleAndWeight( 25726 fontFamilyFaces, 25727 fontStyle, 25728 fontWeight 25729 ); 25730 const setFontAppearance = (0,external_wp_element_namespaceObject.useCallback)( 25731 ({ fontStyle: newFontStyle, fontWeight: newFontWeight }) => { 25732 if (newFontStyle !== fontStyle || newFontWeight !== fontWeight) { 25733 onChange({ 25734 ...value, 25735 typography: { 25736 ...value?.typography, 25737 fontStyle: newFontStyle || void 0, 25738 fontWeight: newFontWeight || void 0 25739 } 25740 }); 25741 } 25742 }, 25743 [fontStyle, fontWeight, onChange, value] 25744 ); 25745 const hasFontAppearance = () => !!value?.typography?.fontStyle || !!value?.typography?.fontWeight; 25746 const resetFontAppearance = (0,external_wp_element_namespaceObject.useCallback)(() => { 25747 setFontAppearance({}); 25748 }, [setFontAppearance]); 25749 (0,external_wp_element_namespaceObject.useEffect)(() => { 25750 if (nearestFontStyle && nearestFontWeight) { 25751 setFontAppearance({ 25752 fontStyle: nearestFontStyle, 25753 fontWeight: nearestFontWeight 25754 }); 25755 } else { 25756 resetFontAppearance(); 25757 } 25758 }, [ 25759 nearestFontStyle, 25760 nearestFontWeight, 25761 resetFontAppearance, 25762 setFontAppearance 25763 ]); 25764 const hasLineHeightEnabled = useHasLineHeightControl(settings); 25765 const lineHeight = decodeValue(inheritedValue?.typography?.lineHeight); 25766 const setLineHeight = (newValue) => { 25767 onChange( 25768 setImmutably( 25769 value, 25770 ["typography", "lineHeight"], 25771 newValue || void 0 25772 ) 25773 ); 25774 }; 25775 const hasLineHeight = () => value?.typography?.lineHeight !== void 0; 25776 const resetLineHeight = () => setLineHeight(void 0); 25777 const hasLetterSpacingControl = useHasLetterSpacingControl(settings); 25778 const letterSpacing = decodeValue( 25779 inheritedValue?.typography?.letterSpacing 25780 ); 25781 const setLetterSpacing = (newValue) => { 25782 onChange( 25783 setImmutably( 25784 value, 25785 ["typography", "letterSpacing"], 25786 newValue || void 0 25787 ) 25788 ); 25789 }; 25790 const hasLetterSpacing = () => !!value?.typography?.letterSpacing; 25791 const resetLetterSpacing = () => setLetterSpacing(void 0); 25792 const hasTextColumnsControl = useHasTextColumnsControl(settings); 25793 const textColumns = decodeValue(inheritedValue?.typography?.textColumns); 25794 const setTextColumns = (newValue) => { 25795 onChange( 25796 setImmutably( 25797 value, 25798 ["typography", "textColumns"], 25799 newValue || void 0 25800 ) 25801 ); 25802 }; 25803 const hasTextColumns = () => !!value?.typography?.textColumns; 25804 const resetTextColumns = () => setTextColumns(void 0); 25805 const hasTextTransformControl = useHasTextTransformControl(settings); 25806 const textTransform = decodeValue( 25807 inheritedValue?.typography?.textTransform 25808 ); 25809 const setTextTransform = (newValue) => { 25810 onChange( 25811 setImmutably( 25812 value, 25813 ["typography", "textTransform"], 25814 newValue || void 0 25815 ) 25816 ); 25817 }; 25818 const hasTextTransform = () => !!value?.typography?.textTransform; 25819 const resetTextTransform = () => setTextTransform(void 0); 25820 const hasTextDecorationControl = useHasTextDecorationControl(settings); 25821 const textDecoration = decodeValue( 25822 inheritedValue?.typography?.textDecoration 25823 ); 25824 const setTextDecoration = (newValue) => { 25825 onChange( 25826 setImmutably( 25827 value, 25828 ["typography", "textDecoration"], 25829 newValue || void 0 25830 ) 25831 ); 25832 }; 25833 const hasTextDecoration = () => !!value?.typography?.textDecoration; 25834 const resetTextDecoration = () => setTextDecoration(void 0); 25835 const hasWritingModeControl = useHasWritingModeControl(settings); 25836 const writingMode = decodeValue(inheritedValue?.typography?.writingMode); 25837 const setWritingMode = (newValue) => { 25838 onChange( 25839 setImmutably( 25840 value, 25841 ["typography", "writingMode"], 25842 newValue || void 0 25843 ) 25844 ); 25845 }; 25846 const hasWritingMode = () => !!value?.typography?.writingMode; 25847 const resetWritingMode = () => setWritingMode(void 0); 25848 const hasTextAlignmentControl = useHasTextAlignmentControl(settings); 25849 const textAlign = decodeValue(inheritedValue?.typography?.textAlign); 25850 const setTextAlign = (newValue) => { 25851 onChange( 25852 setImmutably( 25853 value, 25854 ["typography", "textAlign"], 25855 newValue || void 0 25856 ) 25857 ); 25858 }; 25859 const hasTextAlign = () => !!value?.typography?.textAlign; 25860 const resetTextAlign = () => setTextAlign(void 0); 25861 const resetAllFilter = (0,external_wp_element_namespaceObject.useCallback)((previousValue) => { 25862 return { 25863 ...previousValue, 25864 typography: {} 25865 }; 25866 }, []); 25867 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 25868 Wrapper, 25869 { 25870 resetAllFilter, 25871 value, 25872 onChange, 25873 panelId, 25874 children: [ 25875 hasFontFamilyEnabled && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 25876 external_wp_components_namespaceObject.__experimentalToolsPanelItem, 25877 { 25878 label: (0,external_wp_i18n_namespaceObject.__)("Font"), 25879 hasValue: hasFontFamily, 25880 onDeselect: resetFontFamily, 25881 isShownByDefault: defaultControls.fontFamily, 25882 panelId, 25883 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 25884 FontFamilyControl, 25885 { 25886 fontFamilies, 25887 value: fontFamily, 25888 onChange: setFontFamily, 25889 size: "__unstable-large", 25890 __nextHasNoMarginBottom: true 25891 } 25892 ) 25893 } 25894 ), 25895 hasFontSizeEnabled && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 25896 external_wp_components_namespaceObject.__experimentalToolsPanelItem, 25897 { 25898 label: (0,external_wp_i18n_namespaceObject.__)("Size"), 25899 hasValue: hasFontSize, 25900 onDeselect: resetFontSize, 25901 isShownByDefault: defaultControls.fontSize, 25902 panelId, 25903 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 25904 external_wp_components_namespaceObject.FontSizePicker, 25905 { 25906 value: currentFontSizeSlug || fontSize, 25907 valueMode: currentFontSizeSlug ? "slug" : "literal", 25908 onChange: setFontSize, 25909 fontSizes: mergedFontSizes, 25910 disableCustomFontSizes, 25911 withReset: false, 25912 withSlider: true, 25913 size: "__unstable-large" 25914 } 25915 ) 25916 } 25917 ), 25918 hasAppearanceControl && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 25919 external_wp_components_namespaceObject.__experimentalToolsPanelItem, 25920 { 25921 className: "single-column", 25922 label: appearanceControlLabel, 25923 hasValue: hasFontAppearance, 25924 onDeselect: resetFontAppearance, 25925 isShownByDefault: defaultControls.fontAppearance, 25926 panelId, 25927 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 25928 FontAppearanceControl, 25929 { 25930 value: { 25931 fontStyle, 25932 fontWeight 25933 }, 25934 onChange: setFontAppearance, 25935 hasFontStyles, 25936 hasFontWeights, 25937 fontFamilyFaces, 25938 size: "__unstable-large" 25939 } 25940 ) 25941 } 25942 ), 25943 hasLineHeightEnabled && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 25944 external_wp_components_namespaceObject.__experimentalToolsPanelItem, 25945 { 25946 className: "single-column", 25947 label: (0,external_wp_i18n_namespaceObject.__)("Line height"), 25948 hasValue: hasLineHeight, 25949 onDeselect: resetLineHeight, 25950 isShownByDefault: defaultControls.lineHeight, 25951 panelId, 25952 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 25953 line_height_control_default, 25954 { 25955 __unstableInputWidth: "auto", 25956 value: lineHeight, 25957 onChange: setLineHeight, 25958 size: "__unstable-large" 25959 } 25960 ) 25961 } 25962 ), 25963 hasLetterSpacingControl && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 25964 external_wp_components_namespaceObject.__experimentalToolsPanelItem, 25965 { 25966 className: "single-column", 25967 label: (0,external_wp_i18n_namespaceObject.__)("Letter spacing"), 25968 hasValue: hasLetterSpacing, 25969 onDeselect: resetLetterSpacing, 25970 isShownByDefault: defaultControls.letterSpacing, 25971 panelId, 25972 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 25973 LetterSpacingControl, 25974 { 25975 value: letterSpacing, 25976 onChange: setLetterSpacing, 25977 size: "__unstable-large", 25978 __unstableInputWidth: "auto" 25979 } 25980 ) 25981 } 25982 ), 25983 hasTextColumnsControl && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 25984 external_wp_components_namespaceObject.__experimentalToolsPanelItem, 25985 { 25986 className: "single-column", 25987 label: (0,external_wp_i18n_namespaceObject.__)("Columns"), 25988 hasValue: hasTextColumns, 25989 onDeselect: resetTextColumns, 25990 isShownByDefault: defaultControls.textColumns, 25991 panelId, 25992 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 25993 external_wp_components_namespaceObject.__experimentalNumberControl, 25994 { 25995 label: (0,external_wp_i18n_namespaceObject.__)("Columns"), 25996 max: MAX_TEXT_COLUMNS, 25997 min: MIN_TEXT_COLUMNS, 25998 onChange: setTextColumns, 25999 size: "__unstable-large", 26000 spinControls: "custom", 26001 value: textColumns, 26002 initialPosition: 1 26003 } 26004 ) 26005 } 26006 ), 26007 hasTextDecorationControl && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 26008 external_wp_components_namespaceObject.__experimentalToolsPanelItem, 26009 { 26010 className: "single-column", 26011 label: (0,external_wp_i18n_namespaceObject.__)("Decoration"), 26012 hasValue: hasTextDecoration, 26013 onDeselect: resetTextDecoration, 26014 isShownByDefault: defaultControls.textDecoration, 26015 panelId, 26016 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 26017 TextDecorationControl, 26018 { 26019 value: textDecoration, 26020 onChange: setTextDecoration, 26021 size: "__unstable-large", 26022 __unstableInputWidth: "auto" 26023 } 26024 ) 26025 } 26026 ), 26027 hasWritingModeControl && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 26028 external_wp_components_namespaceObject.__experimentalToolsPanelItem, 26029 { 26030 className: "single-column", 26031 label: (0,external_wp_i18n_namespaceObject.__)("Orientation"), 26032 hasValue: hasWritingMode, 26033 onDeselect: resetWritingMode, 26034 isShownByDefault: defaultControls.writingMode, 26035 panelId, 26036 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 26037 WritingModeControl, 26038 { 26039 value: writingMode, 26040 onChange: setWritingMode, 26041 size: "__unstable-large", 26042 __nextHasNoMarginBottom: true 26043 } 26044 ) 26045 } 26046 ), 26047 hasTextTransformControl && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 26048 external_wp_components_namespaceObject.__experimentalToolsPanelItem, 26049 { 26050 label: (0,external_wp_i18n_namespaceObject.__)("Letter case"), 26051 hasValue: hasTextTransform, 26052 onDeselect: resetTextTransform, 26053 isShownByDefault: defaultControls.textTransform, 26054 panelId, 26055 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 26056 TextTransformControl, 26057 { 26058 value: textTransform, 26059 onChange: setTextTransform, 26060 showNone: true, 26061 isBlock: true, 26062 size: "__unstable-large", 26063 __nextHasNoMarginBottom: true 26064 } 26065 ) 26066 } 26067 ), 26068 hasTextAlignmentControl && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 26069 external_wp_components_namespaceObject.__experimentalToolsPanelItem, 26070 { 26071 label: (0,external_wp_i18n_namespaceObject.__)("Text alignment"), 26072 hasValue: hasTextAlign, 26073 onDeselect: resetTextAlign, 26074 isShownByDefault: defaultControls.textAlign, 26075 panelId, 26076 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 26077 TextAlignmentControl, 26078 { 26079 value: textAlign, 26080 onChange: setTextAlign, 26081 size: "__unstable-large", 26082 __nextHasNoMarginBottom: true 26083 } 26084 ) 26085 } 26086 ) 26087 ] 26088 } 26089 ); 26090 } 26091 26092 26093 ;// ./node_modules/@wordpress/block-editor/build-module/hooks/line-height.js 26094 26095 26096 26097 26098 26099 const LINE_HEIGHT_SUPPORT_KEY = "typography.lineHeight"; 26100 function LineHeightEdit(props) { 26101 const { 26102 attributes: { style }, 26103 setAttributes 26104 } = props; 26105 const onChange = (newLineHeightValue) => { 26106 const newStyle = { 26107 ...style, 26108 typography: { 26109 ...style?.typography, 26110 lineHeight: newLineHeightValue 26111 } 26112 }; 26113 setAttributes({ style: cleanEmptyObject(newStyle) }); 26114 }; 26115 return /* @__PURE__ */ jsx( 26116 LineHeightControl, 26117 { 26118 __unstableInputWidth: "100%", 26119 value: style?.typography?.lineHeight, 26120 onChange, 26121 size: "__unstable-large" 26122 } 26123 ); 26124 } 26125 function useIsLineHeightDisabled({ name: blockName } = {}) { 26126 const [isEnabled] = useSettings("typography.lineHeight"); 26127 return !isEnabled || !hasBlockSupport(blockName, LINE_HEIGHT_SUPPORT_KEY); 26128 } 26129 26130 26131 ;// external ["wp","tokenList"] 26132 const external_wp_tokenList_namespaceObject = window["wp"]["tokenList"]; 26133 var external_wp_tokenList_default = /*#__PURE__*/__webpack_require__.n(external_wp_tokenList_namespaceObject); 26134 ;// ./node_modules/@wordpress/block-editor/build-module/hooks/font-family.js 26135 26136 26137 26138 26139 26140 26141 26142 const FONT_FAMILY_SUPPORT_KEY = "typography.__experimentalFontFamily"; 26143 const { kebabCase: font_family_kebabCase } = unlock(external_wp_components_namespaceObject.privateApis); 26144 function font_family_addAttributes(settings) { 26145 if (!(0,external_wp_blocks_namespaceObject.hasBlockSupport)(settings, FONT_FAMILY_SUPPORT_KEY)) { 26146 return settings; 26147 } 26148 if (!settings.attributes.fontFamily) { 26149 Object.assign(settings.attributes, { 26150 fontFamily: { 26151 type: "string" 26152 } 26153 }); 26154 } 26155 return settings; 26156 } 26157 function font_family_addSaveProps(props, blockType, attributes) { 26158 if (!(0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockType, FONT_FAMILY_SUPPORT_KEY)) { 26159 return props; 26160 } 26161 if (shouldSkipSerialization( 26162 blockType, 26163 TYPOGRAPHY_SUPPORT_KEY, 26164 "fontFamily" 26165 )) { 26166 return props; 26167 } 26168 if (!attributes?.fontFamily) { 26169 return props; 26170 } 26171 const classes = new (external_wp_tokenList_default())(props.className); 26172 classes.add(`has-$font_family_kebabCase(attributes?.fontFamily)}-font-family`); 26173 const newClassName = classes.value; 26174 props.className = newClassName ? newClassName : void 0; 26175 return props; 26176 } 26177 function font_family_useBlockProps({ name, fontFamily }) { 26178 return font_family_addSaveProps({}, name, { fontFamily }); 26179 } 26180 var font_family_default = { 26181 useBlockProps: font_family_useBlockProps, 26182 addSaveProps: font_family_addSaveProps, 26183 attributeKeys: ["fontFamily"], 26184 hasSupport(name) { 26185 return (0,external_wp_blocks_namespaceObject.hasBlockSupport)(name, FONT_FAMILY_SUPPORT_KEY); 26186 } 26187 }; 26188 function resetFontFamily({ setAttributes }) { 26189 setAttributes({ fontFamily: void 0 }); 26190 } 26191 (0,external_wp_hooks_namespaceObject.addFilter)( 26192 "blocks.registerBlockType", 26193 "core/fontFamily/addAttribute", 26194 font_family_addAttributes 26195 ); 26196 26197 26198 ;// ./node_modules/@wordpress/block-editor/build-module/components/font-sizes/utils.js 26199 26200 26201 const { kebabCase: utils_kebabCase } = unlock(external_wp_components_namespaceObject.privateApis); 26202 const utils_getFontSize = (fontSizes, fontSizeAttribute, customFontSizeAttribute) => { 26203 if (fontSizeAttribute) { 26204 const fontSizeObject = fontSizes?.find( 26205 ({ slug }) => slug === fontSizeAttribute 26206 ); 26207 if (fontSizeObject) { 26208 return fontSizeObject; 26209 } 26210 } 26211 return { 26212 size: customFontSizeAttribute 26213 }; 26214 }; 26215 function utils_getFontSizeObjectByValue(fontSizes, value) { 26216 const fontSizeObject = fontSizes?.find(({ size }) => size === value); 26217 if (fontSizeObject) { 26218 return fontSizeObject; 26219 } 26220 return { 26221 size: value 26222 }; 26223 } 26224 function getFontSizeClass(fontSizeSlug) { 26225 if (!fontSizeSlug) { 26226 return; 26227 } 26228 return `has-$utils_kebabCase(fontSizeSlug)}-font-size`; 26229 } 26230 26231 26232 ;// ./node_modules/@wordpress/block-editor/build-module/hooks/font-size.js 26233 26234 26235 26236 26237 26238 26239 26240 26241 26242 const FONT_SIZE_SUPPORT_KEY = "typography.fontSize"; 26243 function font_size_addAttributes(settings) { 26244 if (!(0,external_wp_blocks_namespaceObject.hasBlockSupport)(settings, FONT_SIZE_SUPPORT_KEY)) { 26245 return settings; 26246 } 26247 if (!settings.attributes.fontSize) { 26248 Object.assign(settings.attributes, { 26249 fontSize: { 26250 type: "string" 26251 } 26252 }); 26253 } 26254 return settings; 26255 } 26256 function font_size_addSaveProps(props, blockNameOrType, attributes) { 26257 if (!(0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockNameOrType, FONT_SIZE_SUPPORT_KEY)) { 26258 return props; 26259 } 26260 if (shouldSkipSerialization( 26261 blockNameOrType, 26262 TYPOGRAPHY_SUPPORT_KEY, 26263 "fontSize" 26264 )) { 26265 return props; 26266 } 26267 const classes = new (external_wp_tokenList_default())(props.className); 26268 classes.add(getFontSizeClass(attributes.fontSize)); 26269 const newClassName = classes.value; 26270 props.className = newClassName ? newClassName : void 0; 26271 return props; 26272 } 26273 function FontSizeEdit(props) { 26274 const { 26275 attributes: { fontSize, style }, 26276 setAttributes 26277 } = props; 26278 const [fontSizes] = useSettings("typography.fontSizes"); 26279 const onChange = (value, selectedItem) => { 26280 const fontSizeSlug = selectedItem?.slug || getFontSizeObjectByValue(fontSizes, value).slug; 26281 setAttributes({ 26282 style: cleanEmptyObject({ 26283 ...style, 26284 typography: { 26285 ...style?.typography, 26286 fontSize: fontSizeSlug ? void 0 : value 26287 } 26288 }), 26289 fontSize: fontSizeSlug 26290 }); 26291 }; 26292 const fontSizeObject = getFontSize( 26293 fontSizes, 26294 fontSize, 26295 style?.typography?.fontSize 26296 ); 26297 const fontSizeValue = fontSizeObject?.size || style?.typography?.fontSize || fontSize; 26298 return /* @__PURE__ */ jsx( 26299 FontSizePicker, 26300 { 26301 onChange, 26302 value: fontSize || fontSizeValue, 26303 valueMode: fontSize ? "slug" : "literal", 26304 withReset: false, 26305 withSlider: true, 26306 size: "__unstable-large" 26307 } 26308 ); 26309 } 26310 function useIsFontSizeDisabled({ name: blockName } = {}) { 26311 const [fontSizes] = useSettings("typography.fontSizes"); 26312 const hasFontSizes = !!fontSizes?.length; 26313 return !hasBlockSupport(blockName, FONT_SIZE_SUPPORT_KEY) || !hasFontSizes; 26314 } 26315 function font_size_useBlockProps({ name, fontSize, style }) { 26316 const [fontSizes, fluidTypographySettings, layoutSettings] = use_settings_useSettings( 26317 "typography.fontSizes", 26318 "typography.fluid", 26319 "layout" 26320 ); 26321 if (!(0,external_wp_blocks_namespaceObject.hasBlockSupport)(name, FONT_SIZE_SUPPORT_KEY) || shouldSkipSerialization(name, TYPOGRAPHY_SUPPORT_KEY, "fontSize") || !fontSize && !style?.typography?.fontSize) { 26322 return; 26323 } 26324 let props; 26325 if (style?.typography?.fontSize) { 26326 props = { 26327 style: { 26328 fontSize: getTypographyFontSizeValue( 26329 { size: style.typography.fontSize }, 26330 { 26331 typography: { 26332 fluid: fluidTypographySettings 26333 }, 26334 layout: layoutSettings 26335 } 26336 ) 26337 } 26338 }; 26339 } 26340 if (fontSize) { 26341 props = { 26342 style: { 26343 fontSize: utils_getFontSize( 26344 fontSizes, 26345 fontSize, 26346 style?.typography?.fontSize 26347 ).size 26348 } 26349 }; 26350 } 26351 if (!props) { 26352 return; 26353 } 26354 return font_size_addSaveProps(props, name, { fontSize }); 26355 } 26356 var font_size_default = { 26357 useBlockProps: font_size_useBlockProps, 26358 addSaveProps: font_size_addSaveProps, 26359 attributeKeys: ["fontSize", "style"], 26360 hasSupport(name) { 26361 return (0,external_wp_blocks_namespaceObject.hasBlockSupport)(name, FONT_SIZE_SUPPORT_KEY); 26362 } 26363 }; 26364 const font_size_MIGRATION_PATHS = { 26365 fontSize: [["fontSize"], ["style", "typography", "fontSize"]] 26366 }; 26367 function font_size_addTransforms(result, source, index, results) { 26368 const destinationBlockType = result.name; 26369 const activeSupports = { 26370 fontSize: (0,external_wp_blocks_namespaceObject.hasBlockSupport)( 26371 destinationBlockType, 26372 FONT_SIZE_SUPPORT_KEY 26373 ) 26374 }; 26375 return transformStyles( 26376 activeSupports, 26377 font_size_MIGRATION_PATHS, 26378 result, 26379 source, 26380 index, 26381 results 26382 ); 26383 } 26384 (0,external_wp_hooks_namespaceObject.addFilter)( 26385 "blocks.registerBlockType", 26386 "core/font/addAttribute", 26387 font_size_addAttributes 26388 ); 26389 (0,external_wp_hooks_namespaceObject.addFilter)( 26390 "blocks.switchToBlockType.transformedBlock", 26391 "core/font-size/addTransforms", 26392 font_size_addTransforms 26393 ); 26394 26395 26396 ;// ./node_modules/@wordpress/block-editor/build-module/components/alignment-control/ui.js 26397 26398 26399 26400 26401 const DEFAULT_ALIGNMENT_CONTROLS = [ 26402 { 26403 icon: align_left_default, 26404 title: (0,external_wp_i18n_namespaceObject.__)("Align text left"), 26405 align: "left" 26406 }, 26407 { 26408 icon: align_center_default, 26409 title: (0,external_wp_i18n_namespaceObject.__)("Align text center"), 26410 align: "center" 26411 }, 26412 { 26413 icon: align_right_default, 26414 title: (0,external_wp_i18n_namespaceObject.__)("Align text right"), 26415 align: "right" 26416 } 26417 ]; 26418 const ui_POPOVER_PROPS = { 26419 placement: "bottom-start" 26420 }; 26421 function AlignmentUI({ 26422 value, 26423 onChange, 26424 alignmentControls = DEFAULT_ALIGNMENT_CONTROLS, 26425 label = (0,external_wp_i18n_namespaceObject.__)("Align text"), 26426 description = (0,external_wp_i18n_namespaceObject.__)("Change text alignment"), 26427 isCollapsed = true, 26428 isToolbar 26429 }) { 26430 function applyOrUnset(align) { 26431 return () => onChange(value === align ? void 0 : align); 26432 } 26433 const activeAlignment = alignmentControls.find( 26434 (control) => control.align === value 26435 ); 26436 function setIcon() { 26437 if (activeAlignment) { 26438 return activeAlignment.icon; 26439 } 26440 return (0,external_wp_i18n_namespaceObject.isRTL)() ? align_right_default : align_left_default; 26441 } 26442 const UIComponent = isToolbar ? external_wp_components_namespaceObject.ToolbarGroup : external_wp_components_namespaceObject.ToolbarDropdownMenu; 26443 const extraProps = isToolbar ? { isCollapsed } : { 26444 toggleProps: { 26445 description 26446 }, 26447 popoverProps: ui_POPOVER_PROPS 26448 }; 26449 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 26450 UIComponent, 26451 { 26452 icon: setIcon(), 26453 label, 26454 controls: alignmentControls.map((control) => { 26455 const { align } = control; 26456 const isActive = value === align; 26457 return { 26458 ...control, 26459 isActive, 26460 role: isCollapsed ? "menuitemradio" : void 0, 26461 onClick: applyOrUnset(align) 26462 }; 26463 }), 26464 ...extraProps 26465 } 26466 ); 26467 } 26468 var alignment_control_ui_ui_default = AlignmentUI; 26469 26470 26471 ;// ./node_modules/@wordpress/block-editor/build-module/components/alignment-control/index.js 26472 26473 26474 const AlignmentControl = (props) => { 26475 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(alignment_control_ui_ui_default, { ...props, isToolbar: false }); 26476 }; 26477 const AlignmentToolbar = (props) => { 26478 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(alignment_control_ui_ui_default, { ...props, isToolbar: true }); 26479 }; 26480 26481 26482 ;// ./node_modules/@wordpress/block-editor/build-module/hooks/text-align.js 26483 26484 26485 26486 26487 26488 26489 26490 26491 26492 const TEXT_ALIGN_SUPPORT_KEY = "typography.textAlign"; 26493 const text_align_TEXT_ALIGNMENT_OPTIONS = [ 26494 { 26495 icon: align_left_default, 26496 title: (0,external_wp_i18n_namespaceObject.__)("Align text left"), 26497 align: "left" 26498 }, 26499 { 26500 icon: align_center_default, 26501 title: (0,external_wp_i18n_namespaceObject.__)("Align text center"), 26502 align: "center" 26503 }, 26504 { 26505 icon: align_right_default, 26506 title: (0,external_wp_i18n_namespaceObject.__)("Align text right"), 26507 align: "right" 26508 } 26509 ]; 26510 const VALID_TEXT_ALIGNMENTS = ["left", "center", "right"]; 26511 const NO_TEXT_ALIGNMENTS = []; 26512 function getValidTextAlignments(blockTextAlign) { 26513 if (Array.isArray(blockTextAlign)) { 26514 return VALID_TEXT_ALIGNMENTS.filter( 26515 (textAlign) => blockTextAlign.includes(textAlign) 26516 ); 26517 } 26518 return blockTextAlign === true ? VALID_TEXT_ALIGNMENTS : NO_TEXT_ALIGNMENTS; 26519 } 26520 function BlockEditTextAlignmentToolbarControlsPure({ 26521 style, 26522 name: blockName, 26523 setAttributes 26524 }) { 26525 const settings = useBlockSettings(blockName); 26526 const hasTextAlignControl = settings?.typography?.textAlign; 26527 const blockEditingMode = useBlockEditingMode(); 26528 if (!hasTextAlignControl || blockEditingMode !== "default") { 26529 return null; 26530 } 26531 const validTextAlignments = getValidTextAlignments( 26532 (0,external_wp_blocks_namespaceObject.getBlockSupport)(blockName, TEXT_ALIGN_SUPPORT_KEY) 26533 ); 26534 if (!validTextAlignments.length) { 26535 return null; 26536 } 26537 const textAlignmentControls = text_align_TEXT_ALIGNMENT_OPTIONS.filter( 26538 (control) => validTextAlignments.includes(control.align) 26539 ); 26540 const onChange = (newTextAlignValue) => { 26541 const newStyle = { 26542 ...style, 26543 typography: { 26544 ...style?.typography, 26545 textAlign: newTextAlignValue 26546 } 26547 }; 26548 setAttributes({ style: utils_cleanEmptyObject(newStyle) }); 26549 }; 26550 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(block_controls_default, { group: "block", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 26551 AlignmentControl, 26552 { 26553 value: style?.typography?.textAlign, 26554 onChange, 26555 alignmentControls: textAlignmentControls 26556 } 26557 ) }); 26558 } 26559 var text_align_default = { 26560 edit: BlockEditTextAlignmentToolbarControlsPure, 26561 useBlockProps: text_align_useBlockProps, 26562 addSaveProps: addAssignedTextAlign, 26563 attributeKeys: ["style"], 26564 hasSupport(name) { 26565 return (0,external_wp_blocks_namespaceObject.hasBlockSupport)(name, TEXT_ALIGN_SUPPORT_KEY, false); 26566 } 26567 }; 26568 function text_align_useBlockProps({ name, style }) { 26569 if (!style?.typography?.textAlign) { 26570 return null; 26571 } 26572 const validTextAlignments = getValidTextAlignments( 26573 (0,external_wp_blocks_namespaceObject.getBlockSupport)(name, TEXT_ALIGN_SUPPORT_KEY) 26574 ); 26575 if (!validTextAlignments.length) { 26576 return null; 26577 } 26578 if (shouldSkipSerialization(name, TYPOGRAPHY_SUPPORT_KEY, "textAlign")) { 26579 return null; 26580 } 26581 const textAlign = style.typography.textAlign; 26582 const className = dist_clsx({ 26583 [`has-text-align-$textAlign}`]: textAlign 26584 }); 26585 return { className }; 26586 } 26587 function addAssignedTextAlign(props, blockType, attributes) { 26588 if (!attributes?.style?.typography?.textAlign) { 26589 return props; 26590 } 26591 const { textAlign } = attributes.style.typography; 26592 const blockTextAlign = (0,external_wp_blocks_namespaceObject.getBlockSupport)(blockType, TEXT_ALIGN_SUPPORT_KEY); 26593 const isTextAlignValid = getValidTextAlignments(blockTextAlign).includes(textAlign); 26594 if (isTextAlignValid && !shouldSkipSerialization( 26595 blockType, 26596 TYPOGRAPHY_SUPPORT_KEY, 26597 "textAlign" 26598 )) { 26599 props.className = dist_clsx( 26600 `has-text-align-$textAlign}`, 26601 props.className 26602 ); 26603 } 26604 return props; 26605 } 26606 26607 26608 ;// ./node_modules/@wordpress/block-editor/build-module/utils/fit-text-utils.js 26609 function generateCSSRule(elementSelector, fontSize) { 26610 return `$elementSelector} { font-size: $fontSize}px !important; }`; 26611 } 26612 function findOptimalFontSize(textElement, elementSelector, applyStylesFn) { 26613 const alreadyHasScrollableHeight = textElement.scrollHeight > textElement.clientHeight; 26614 let minSize = 5; 26615 let maxSize = 600; 26616 let bestSize = minSize; 26617 while (minSize <= maxSize) { 26618 const midSize = Math.floor((minSize + maxSize) / 2); 26619 applyStylesFn(generateCSSRule(elementSelector, midSize)); 26620 const fitsWidth = textElement.scrollWidth <= textElement.clientWidth; 26621 const fitsHeight = alreadyHasScrollableHeight || textElement.scrollHeight <= textElement.clientHeight; 26622 if (fitsWidth && fitsHeight) { 26623 bestSize = midSize; 26624 minSize = midSize + 1; 26625 } else { 26626 maxSize = midSize - 1; 26627 } 26628 } 26629 return bestSize; 26630 } 26631 function optimizeFitText(textElement, elementSelector, applyStylesFn) { 26632 if (!textElement) { 26633 return; 26634 } 26635 applyStylesFn(""); 26636 const optimalSize = findOptimalFontSize( 26637 textElement, 26638 elementSelector, 26639 applyStylesFn 26640 ); 26641 const cssRule = generateCSSRule(elementSelector, optimalSize); 26642 applyStylesFn(cssRule); 26643 } 26644 26645 26646 ;// ./node_modules/@wordpress/block-editor/build-module/hooks/fit-text.js 26647 26648 26649 26650 26651 26652 26653 26654 26655 26656 26657 26658 const FIT_TEXT_SUPPORT_KEY = "typography.fitText"; 26659 function fit_text_addAttributes(settings) { 26660 if (!(0,external_wp_blocks_namespaceObject.hasBlockSupport)(settings, FIT_TEXT_SUPPORT_KEY)) { 26661 return settings; 26662 } 26663 if (settings.attributes?.fitText) { 26664 return settings; 26665 } 26666 return { 26667 ...settings, 26668 attributes: { 26669 ...settings.attributes, 26670 fitText: { 26671 type: "boolean" 26672 } 26673 } 26674 }; 26675 } 26676 function useFitText({ fitText, name, clientId }) { 26677 const hasFitTextSupport2 = (0,external_wp_blocks_namespaceObject.hasBlockSupport)(name, FIT_TEXT_SUPPORT_KEY); 26678 const blockElement = useBlockElement(clientId); 26679 const blockAttributes = (0,external_wp_data_namespaceObject.useSelect)( 26680 (select) => { 26681 if (!clientId) { 26682 return; 26683 } 26684 return select(store).getBlockAttributes(clientId); 26685 }, 26686 [clientId] 26687 ); 26688 const applyFitText = (0,external_wp_element_namespaceObject.useCallback)(() => { 26689 if (!blockElement || !hasFitTextSupport2 || !fitText) { 26690 return; 26691 } 26692 const styleId = `fit-text-$clientId}`; 26693 let styleElement = blockElement.ownerDocument.getElementById(styleId); 26694 if (!styleElement) { 26695 styleElement = blockElement.ownerDocument.createElement("style"); 26696 styleElement.id = styleId; 26697 blockElement.ownerDocument.head.appendChild(styleElement); 26698 } 26699 const blockSelector = `#block-$clientId}`; 26700 const applyStylesFn = (css) => { 26701 styleElement.textContent = css; 26702 }; 26703 optimizeFitText(blockElement, blockSelector, applyStylesFn); 26704 }, [blockElement, clientId, hasFitTextSupport2, fitText]); 26705 (0,external_wp_element_namespaceObject.useEffect)(() => { 26706 if (!fitText || !blockElement || !clientId || !hasFitTextSupport2) { 26707 return; 26708 } 26709 applyFitText(); 26710 const currentElement = blockElement; 26711 let resizeObserver; 26712 if (window.ResizeObserver && currentElement.parentElement) { 26713 resizeObserver = new window.ResizeObserver(applyFitText); 26714 resizeObserver.observe(currentElement.parentElement); 26715 } 26716 return () => { 26717 if (resizeObserver) { 26718 resizeObserver.disconnect(); 26719 } 26720 const styleId = `fit-text-$clientId}`; 26721 const styleElement = currentElement.ownerDocument.getElementById(styleId); 26722 if (styleElement) { 26723 styleElement.remove(); 26724 } 26725 }; 26726 }, [fitText, clientId, applyFitText, blockElement, hasFitTextSupport2]); 26727 (0,external_wp_element_namespaceObject.useEffect)(() => { 26728 if (fitText && blockElement && hasFitTextSupport2) { 26729 const frameId = window.requestAnimationFrame(() => { 26730 if (blockElement) { 26731 applyFitText(); 26732 } 26733 }); 26734 return () => window.cancelAnimationFrame(frameId); 26735 } 26736 }, [ 26737 blockAttributes, 26738 fitText, 26739 applyFitText, 26740 blockElement, 26741 hasFitTextSupport2 26742 ]); 26743 } 26744 function FitTextControl({ 26745 clientId, 26746 fitText = false, 26747 setAttributes, 26748 name, 26749 fontSize, 26750 style 26751 }) { 26752 if (!(0,external_wp_blocks_namespaceObject.hasBlockSupport)(name, FIT_TEXT_SUPPORT_KEY)) { 26753 return null; 26754 } 26755 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls_default, { group: "typography", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 26756 external_wp_components_namespaceObject.__experimentalToolsPanelItem, 26757 { 26758 hasValue: () => fitText, 26759 label: (0,external_wp_i18n_namespaceObject.__)("Fit text"), 26760 onDeselect: () => setAttributes({ fitText: void 0 }), 26761 resetAllFilter: () => ({ fitText: void 0 }), 26762 panelId: clientId, 26763 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 26764 external_wp_components_namespaceObject.ToggleControl, 26765 { 26766 __nextHasNoMarginBottom: true, 26767 label: (0,external_wp_i18n_namespaceObject.__)("Fit text"), 26768 checked: fitText, 26769 onChange: () => { 26770 const newFitText = !fitText || void 0; 26771 const updates = { fitText: newFitText }; 26772 if (newFitText) { 26773 if (fontSize) { 26774 updates.fontSize = void 0; 26775 } 26776 if (style?.typography?.fontSize) { 26777 updates.style = { 26778 ...style, 26779 typography: { 26780 ...style?.typography, 26781 fontSize: void 0 26782 } 26783 }; 26784 } 26785 } 26786 setAttributes(updates); 26787 }, 26788 help: fitText ? (0,external_wp_i18n_namespaceObject.__)("Text will resize to fit its container.") : (0,external_wp_i18n_namespaceObject.__)( 26789 "The text will resize to fit its container, resetting other font size settings." 26790 ) 26791 } 26792 ) 26793 } 26794 ) }); 26795 } 26796 function fit_text_addSaveProps(props, blockType, attributes) { 26797 if (!(0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockType, FIT_TEXT_SUPPORT_KEY)) { 26798 return props; 26799 } 26800 const { fitText } = attributes; 26801 if (!fitText) { 26802 return props; 26803 } 26804 const className = props.className ? `$props.className} has-fit-text` : "has-fit-text"; 26805 return { 26806 ...props, 26807 className 26808 }; 26809 } 26810 function fit_text_useBlockProps({ name, fitText, clientId }) { 26811 useFitText({ fitText, name, clientId }); 26812 if (!fitText || !(0,external_wp_blocks_namespaceObject.hasBlockSupport)(name, FIT_TEXT_SUPPORT_KEY)) { 26813 return {}; 26814 } 26815 return { 26816 className: "has-fit-text" 26817 }; 26818 } 26819 (0,external_wp_hooks_namespaceObject.addFilter)( 26820 "blocks.registerBlockType", 26821 "core/fit-text/addAttribute", 26822 fit_text_addAttributes 26823 ); 26824 const hasFitTextSupport = (blockNameOrType) => { 26825 return (0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockNameOrType, FIT_TEXT_SUPPORT_KEY); 26826 }; 26827 var fit_text_default = { 26828 useBlockProps: fit_text_useBlockProps, 26829 addSaveProps: fit_text_addSaveProps, 26830 attributeKeys: ["fitText", "fontSize", "style"], 26831 hasSupport: hasFitTextSupport, 26832 edit: FitTextControl 26833 }; 26834 26835 26836 ;// ./node_modules/@wordpress/block-editor/build-module/hooks/typography.js 26837 26838 26839 26840 26841 26842 26843 26844 26845 26846 26847 26848 26849 26850 function omit(object, keys) { 26851 return Object.fromEntries( 26852 Object.entries(object).filter(([key]) => !keys.includes(key)) 26853 ); 26854 } 26855 const LETTER_SPACING_SUPPORT_KEY = "typography.__experimentalLetterSpacing"; 26856 const TEXT_TRANSFORM_SUPPORT_KEY = "typography.__experimentalTextTransform"; 26857 const TEXT_DECORATION_SUPPORT_KEY = "typography.__experimentalTextDecoration"; 26858 const TEXT_COLUMNS_SUPPORT_KEY = "typography.textColumns"; 26859 const FONT_STYLE_SUPPORT_KEY = "typography.__experimentalFontStyle"; 26860 const FONT_WEIGHT_SUPPORT_KEY = "typography.__experimentalFontWeight"; 26861 const WRITING_MODE_SUPPORT_KEY = "typography.__experimentalWritingMode"; 26862 const TYPOGRAPHY_SUPPORT_KEY = "typography"; 26863 const TYPOGRAPHY_SUPPORT_KEYS = [ 26864 LINE_HEIGHT_SUPPORT_KEY, 26865 FONT_SIZE_SUPPORT_KEY, 26866 FONT_STYLE_SUPPORT_KEY, 26867 FONT_WEIGHT_SUPPORT_KEY, 26868 FONT_FAMILY_SUPPORT_KEY, 26869 TEXT_ALIGN_SUPPORT_KEY, 26870 TEXT_COLUMNS_SUPPORT_KEY, 26871 TEXT_DECORATION_SUPPORT_KEY, 26872 WRITING_MODE_SUPPORT_KEY, 26873 TEXT_TRANSFORM_SUPPORT_KEY, 26874 LETTER_SPACING_SUPPORT_KEY, 26875 FIT_TEXT_SUPPORT_KEY 26876 ]; 26877 function typography_styleToAttributes(style) { 26878 const updatedStyle = { ...omit(style, ["fontFamily"]) }; 26879 const fontSizeValue = style?.typography?.fontSize; 26880 const fontFamilyValue = style?.typography?.fontFamily; 26881 const fontSizeSlug = typeof fontSizeValue === "string" && fontSizeValue?.startsWith("var:preset|font-size|") ? fontSizeValue.substring("var:preset|font-size|".length) : void 0; 26882 const fontFamilySlug = fontFamilyValue?.startsWith( 26883 "var:preset|font-family|" 26884 ) ? fontFamilyValue.substring("var:preset|font-family|".length) : void 0; 26885 updatedStyle.typography = { 26886 ...omit(updatedStyle.typography, ["fontFamily"]), 26887 fontSize: fontSizeSlug ? void 0 : fontSizeValue 26888 }; 26889 return { 26890 style: utils_cleanEmptyObject(updatedStyle), 26891 fontFamily: fontFamilySlug, 26892 fontSize: fontSizeSlug 26893 }; 26894 } 26895 function typography_attributesToStyle(attributes) { 26896 return { 26897 ...attributes.style, 26898 typography: { 26899 ...attributes.style?.typography, 26900 fontFamily: attributes.fontFamily ? "var:preset|font-family|" + attributes.fontFamily : void 0, 26901 fontSize: attributes.fontSize ? "var:preset|font-size|" + attributes.fontSize : attributes.style?.typography?.fontSize 26902 } 26903 }; 26904 } 26905 function TypographyInspectorControl({ children, resetAllFilter }) { 26906 const attributesResetAllFilter = (0,external_wp_element_namespaceObject.useCallback)( 26907 (attributes) => { 26908 const existingStyle = typography_attributesToStyle(attributes); 26909 const updatedStyle = resetAllFilter(existingStyle); 26910 return { 26911 ...attributes, 26912 ...typography_styleToAttributes(updatedStyle) 26913 }; 26914 }, 26915 [resetAllFilter] 26916 ); 26917 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 26918 inspector_controls_default, 26919 { 26920 group: "typography", 26921 resetAllFilter: attributesResetAllFilter, 26922 children 26923 } 26924 ); 26925 } 26926 function typography_TypographyPanel({ clientId, name, setAttributes, settings }) { 26927 function selector(select) { 26928 const { style: style2, fontFamily: fontFamily2, fontSize: fontSize2, fitText: fitText2 } = select(store).getBlockAttributes(clientId) || {}; 26929 return { style: style2, fontFamily: fontFamily2, fontSize: fontSize2, fitText: fitText2 }; 26930 } 26931 const { style, fontFamily, fontSize, fitText } = (0,external_wp_data_namespaceObject.useSelect)(selector, [ 26932 clientId 26933 ]); 26934 const isEnabled = useHasTypographyPanel(settings); 26935 const value = (0,external_wp_element_namespaceObject.useMemo)( 26936 () => typography_attributesToStyle({ style, fontFamily, fontSize }), 26937 [style, fontSize, fontFamily] 26938 ); 26939 const onChange = (newStyle) => { 26940 const newAttributes = typography_styleToAttributes(newStyle); 26941 const hasFontSize = newAttributes.fontSize || newAttributes.style?.typography?.fontSize; 26942 if (hasFontSize && fitText) { 26943 newAttributes.fitText = void 0; 26944 } 26945 setAttributes(newAttributes); 26946 }; 26947 if (!isEnabled) { 26948 return null; 26949 } 26950 const defaultControls = (0,external_wp_blocks_namespaceObject.getBlockSupport)(name, [ 26951 TYPOGRAPHY_SUPPORT_KEY, 26952 "__experimentalDefaultControls" 26953 ]); 26954 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 26955 TypographyPanel, 26956 { 26957 as: TypographyInspectorControl, 26958 panelId: clientId, 26959 settings, 26960 value, 26961 onChange, 26962 defaultControls 26963 } 26964 ); 26965 } 26966 const hasTypographySupport = (blockName) => { 26967 return TYPOGRAPHY_SUPPORT_KEYS.some( 26968 (key) => hasBlockSupport(blockName, key) 26969 ); 26970 }; 26971 26972 26973 ;// ./node_modules/@wordpress/block-editor/build-module/components/spacing-sizes-control/hooks/use-spacing-sizes.js 26974 26975 26976 26977 26978 const use_spacing_sizes_EMPTY_ARRAY = []; 26979 const compare = new Intl.Collator("und", { numeric: true }).compare; 26980 function useSpacingSizes() { 26981 const [ 26982 customSpacingSizes, 26983 themeSpacingSizes, 26984 defaultSpacingSizes, 26985 defaultSpacingSizesEnabled 26986 ] = use_settings_useSettings( 26987 "spacing.spacingSizes.custom", 26988 "spacing.spacingSizes.theme", 26989 "spacing.spacingSizes.default", 26990 "spacing.defaultSpacingSizes" 26991 ); 26992 const customSizes = customSpacingSizes ?? use_spacing_sizes_EMPTY_ARRAY; 26993 const themeSizes = themeSpacingSizes ?? use_spacing_sizes_EMPTY_ARRAY; 26994 const defaultSizes = defaultSpacingSizes && defaultSpacingSizesEnabled !== false ? defaultSpacingSizes : use_spacing_sizes_EMPTY_ARRAY; 26995 return (0,external_wp_element_namespaceObject.useMemo)(() => { 26996 const sizes = [ 26997 { name: (0,external_wp_i18n_namespaceObject.__)("None"), slug: "0", size: 0 }, 26998 ...customSizes, 26999 ...themeSizes, 27000 ...defaultSizes 27001 ]; 27002 if (sizes.every(({ slug }) => /^[0-9]/.test(slug))) { 27003 sizes.sort((a, b) => compare(a.slug, b.slug)); 27004 } 27005 return sizes.length > RANGE_CONTROL_MAX_SIZE ? [ 27006 { 27007 name: (0,external_wp_i18n_namespaceObject.__)("Default"), 27008 slug: "default", 27009 size: void 0 27010 }, 27011 ...sizes 27012 ] : sizes; 27013 }, [customSizes, themeSizes, defaultSizes]); 27014 } 27015 27016 27017 ;// ./node_modules/@wordpress/block-editor/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js 27018 27019 27020 27021 27022 27023 27024 27025 27026 27027 27028 const CUSTOM_VALUE_SETTINGS = { 27029 px: { max: 300, steps: 1 }, 27030 "%": { max: 100, steps: 1 }, 27031 vw: { max: 100, steps: 1 }, 27032 vh: { max: 100, steps: 1 }, 27033 em: { max: 10, steps: 0.1 }, 27034 rm: { max: 10, steps: 0.1 }, 27035 svw: { max: 100, steps: 1 }, 27036 lvw: { max: 100, steps: 1 }, 27037 dvw: { max: 100, steps: 1 }, 27038 svh: { max: 100, steps: 1 }, 27039 lvh: { max: 100, steps: 1 }, 27040 dvh: { max: 100, steps: 1 }, 27041 vi: { max: 100, steps: 1 }, 27042 svi: { max: 100, steps: 1 }, 27043 lvi: { max: 100, steps: 1 }, 27044 dvi: { max: 100, steps: 1 }, 27045 vb: { max: 100, steps: 1 }, 27046 svb: { max: 100, steps: 1 }, 27047 lvb: { max: 100, steps: 1 }, 27048 dvb: { max: 100, steps: 1 }, 27049 vmin: { max: 100, steps: 1 }, 27050 svmin: { max: 100, steps: 1 }, 27051 lvmin: { max: 100, steps: 1 }, 27052 dvmin: { max: 100, steps: 1 }, 27053 vmax: { max: 100, steps: 1 }, 27054 svmax: { max: 100, steps: 1 }, 27055 lvmax: { max: 100, steps: 1 }, 27056 dvmax: { max: 100, steps: 1 } 27057 }; 27058 function SpacingInputControl({ 27059 icon, 27060 isMixed = false, 27061 minimumCustomValue, 27062 onChange, 27063 onMouseOut, 27064 onMouseOver, 27065 showSideInLabel = true, 27066 side, 27067 spacingSizes, 27068 type, 27069 value 27070 }) { 27071 value = getPresetValueFromCustomValue(value, spacingSizes); 27072 let selectListSizes = spacingSizes; 27073 const showRangeControl = spacingSizes.length <= RANGE_CONTROL_MAX_SIZE; 27074 const disableCustomSpacingSizes = (0,external_wp_data_namespaceObject.useSelect)((select) => { 27075 const editorSettings = select(store).getSettings(); 27076 return editorSettings?.disableCustomSpacingSizes; 27077 }); 27078 const [showCustomValueControl, setShowCustomValueControl] = (0,external_wp_element_namespaceObject.useState)( 27079 !disableCustomSpacingSizes && value !== void 0 && !isValueSpacingPreset(value) 27080 ); 27081 const [minValue, setMinValue] = (0,external_wp_element_namespaceObject.useState)(minimumCustomValue); 27082 const previousValue = (0,external_wp_compose_namespaceObject.usePrevious)(value); 27083 if (!!value && previousValue !== value && !isValueSpacingPreset(value) && showCustomValueControl !== true) { 27084 setShowCustomValueControl(true); 27085 } 27086 const [availableUnits] = use_settings_useSettings("spacing.units"); 27087 const units = (0,external_wp_components_namespaceObject.__experimentalUseCustomUnits)({ 27088 availableUnits: availableUnits || ["px", "em", "rem"] 27089 }); 27090 let currentValue = null; 27091 const showCustomValueInSelectList = !showRangeControl && !showCustomValueControl && value !== void 0 && (!isValueSpacingPreset(value) || isValueSpacingPreset(value) && isMixed); 27092 if (showCustomValueInSelectList) { 27093 selectListSizes = [ 27094 ...spacingSizes, 27095 { 27096 name: !isMixed ? ( 27097 // translators: %s: A custom measurement, e.g. a number followed by a unit like 12px. 27098 (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)("Custom (%s)"), value) 27099 ) : (0,external_wp_i18n_namespaceObject.__)("Mixed"), 27100 slug: "custom", 27101 size: value 27102 } 27103 ]; 27104 currentValue = selectListSizes.length - 1; 27105 } else if (!isMixed) { 27106 currentValue = !showCustomValueControl ? getSliderValueFromPreset(value, spacingSizes) : getCustomValueFromPreset(value, spacingSizes); 27107 } 27108 const selectedUnit = (0,external_wp_element_namespaceObject.useMemo)( 27109 () => (0,external_wp_components_namespaceObject.__experimentalParseQuantityAndUnitFromRawValue)(currentValue), 27110 [currentValue] 27111 )[1] || units[0]?.value; 27112 const setInitialValue = () => { 27113 if (value === void 0) { 27114 onChange("0"); 27115 } 27116 }; 27117 const customTooltipContent = (newValue) => value === void 0 ? void 0 : spacingSizes[newValue]?.name; 27118 const customRangeValue = parseFloat(currentValue, 10); 27119 const getNewCustomValue = (newSize) => { 27120 const isNumeric = !isNaN(parseFloat(newSize)); 27121 const nextValue = isNumeric ? newSize : void 0; 27122 return nextValue; 27123 }; 27124 const getNewPresetValue = (newSize, controlType) => { 27125 const size = parseInt(newSize, 10); 27126 if (controlType === "selectList") { 27127 if (size === 0) { 27128 return void 0; 27129 } 27130 if (size === 1) { 27131 return "0"; 27132 } 27133 } else if (size === 0) { 27134 return "0"; 27135 } 27136 return `var:preset|spacing|$spacingSizes[newSize]?.slug}`; 27137 }; 27138 const handleCustomValueSliderChange = (next) => { 27139 onChange([next, selectedUnit].join("")); 27140 }; 27141 const allPlaceholder = isMixed ? (0,external_wp_i18n_namespaceObject.__)("Mixed") : null; 27142 const options = selectListSizes.map((size, index) => ({ 27143 key: index, 27144 name: size.name 27145 })); 27146 const marks = spacingSizes.slice(1, spacingSizes.length - 1).map((_newValue, index) => ({ 27147 value: index + 1, 27148 label: void 0 27149 })); 27150 const sideLabel = ALL_SIDES.includes(side) && showSideInLabel ? LABELS[side] : ""; 27151 const typeLabel = showSideInLabel ? type?.toLowerCase() : type; 27152 const ariaLabel = (0,external_wp_i18n_namespaceObject.sprintf)( 27153 // translators: 1: The side of the block being modified (top, bottom, left etc.). 2. Type of spacing being modified (padding, margin, etc). 27154 (0,external_wp_i18n_namespaceObject._x)("%1$s %2$s", "spacing"), 27155 sideLabel, 27156 typeLabel 27157 ).trim(); 27158 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { className: "spacing-sizes-control__wrapper", children: [ 27159 icon && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 27160 external_wp_components_namespaceObject.Icon, 27161 { 27162 className: "spacing-sizes-control__icon", 27163 icon, 27164 size: 24 27165 } 27166 ), 27167 showCustomValueControl && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 27168 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 27169 external_wp_components_namespaceObject.__experimentalUnitControl, 27170 { 27171 onMouseOver, 27172 onMouseOut, 27173 onFocus: onMouseOver, 27174 onBlur: onMouseOut, 27175 onChange: (newSize) => onChange(getNewCustomValue(newSize)), 27176 value: currentValue, 27177 units, 27178 min: minValue, 27179 placeholder: allPlaceholder, 27180 disableUnits: isMixed, 27181 label: ariaLabel, 27182 hideLabelFromVision: true, 27183 className: "spacing-sizes-control__custom-value-input", 27184 size: "__unstable-large", 27185 onDragStart: () => { 27186 if (value?.charAt(0) === "-") { 27187 setMinValue(0); 27188 } 27189 }, 27190 onDrag: () => { 27191 if (value?.charAt(0) === "-") { 27192 setMinValue(0); 27193 } 27194 }, 27195 onDragEnd: () => { 27196 setMinValue(minimumCustomValue); 27197 } 27198 } 27199 ), 27200 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 27201 external_wp_components_namespaceObject.RangeControl, 27202 { 27203 __next40pxDefaultSize: true, 27204 onMouseOver, 27205 onMouseOut, 27206 onFocus: onMouseOver, 27207 onBlur: onMouseOut, 27208 value: customRangeValue, 27209 min: 0, 27210 max: CUSTOM_VALUE_SETTINGS[selectedUnit]?.max ?? 10, 27211 step: CUSTOM_VALUE_SETTINGS[selectedUnit]?.steps ?? 0.1, 27212 withInputField: false, 27213 onChange: handleCustomValueSliderChange, 27214 className: "spacing-sizes-control__custom-value-range", 27215 __nextHasNoMarginBottom: true, 27216 label: ariaLabel, 27217 hideLabelFromVision: true 27218 } 27219 ) 27220 ] }), 27221 showRangeControl && !showCustomValueControl && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 27222 external_wp_components_namespaceObject.RangeControl, 27223 { 27224 __next40pxDefaultSize: true, 27225 onMouseOver, 27226 onMouseOut, 27227 className: "spacing-sizes-control__range-control", 27228 value: currentValue, 27229 onChange: (newSize) => onChange(getNewPresetValue(newSize)), 27230 onMouseDown: (event) => { 27231 if (event?.nativeEvent?.offsetX < 35) { 27232 setInitialValue(); 27233 } 27234 }, 27235 withInputField: false, 27236 "aria-valuenow": currentValue, 27237 "aria-valuetext": spacingSizes[currentValue]?.name, 27238 renderTooltipContent: customTooltipContent, 27239 min: 0, 27240 max: spacingSizes.length - 1, 27241 marks, 27242 label: ariaLabel, 27243 hideLabelFromVision: true, 27244 __nextHasNoMarginBottom: true, 27245 onFocus: onMouseOver, 27246 onBlur: onMouseOut 27247 } 27248 ), 27249 !showRangeControl && !showCustomValueControl && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 27250 external_wp_components_namespaceObject.CustomSelectControl, 27251 { 27252 className: "spacing-sizes-control__custom-select-control", 27253 value: ( 27254 // passing empty string as a fallback to continue using the 27255 // component in controlled mode 27256 options.find( 27257 (option) => option.key === currentValue 27258 ) || "" 27259 ), 27260 onChange: (selection) => { 27261 onChange( 27262 getNewPresetValue( 27263 selection.selectedItem.key, 27264 "selectList" 27265 ) 27266 ); 27267 }, 27268 options, 27269 label: ariaLabel, 27270 hideLabelFromVision: true, 27271 size: "__unstable-large", 27272 onMouseOver, 27273 onMouseOut, 27274 onFocus: onMouseOver, 27275 onBlur: onMouseOut 27276 } 27277 ), 27278 !disableCustomSpacingSizes && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 27279 external_wp_components_namespaceObject.Button, 27280 { 27281 label: showCustomValueControl ? (0,external_wp_i18n_namespaceObject.__)("Use size preset") : (0,external_wp_i18n_namespaceObject.__)("Set custom size"), 27282 icon: settings_settings_default, 27283 onClick: () => { 27284 setShowCustomValueControl(!showCustomValueControl); 27285 }, 27286 isPressed: showCustomValueControl, 27287 size: "small", 27288 className: "spacing-sizes-control__custom-toggle", 27289 iconSize: 24 27290 } 27291 ) 27292 ] }); 27293 } 27294 27295 27296 ;// ./node_modules/@wordpress/block-editor/build-module/components/spacing-sizes-control/input-controls/axial.js 27297 27298 27299 27300 const groupedSides = ["vertical", "horizontal"]; 27301 function AxialInputControls({ 27302 minimumCustomValue, 27303 onChange, 27304 onMouseOut, 27305 onMouseOver, 27306 sides, 27307 spacingSizes, 27308 type, 27309 values 27310 }) { 27311 const createHandleOnChange = (side) => (next) => { 27312 if (!onChange) { 27313 return; 27314 } 27315 const nextValues = { 27316 ...Object.keys(values).reduce((acc, key) => { 27317 acc[key] = getPresetValueFromCustomValue( 27318 values[key], 27319 spacingSizes 27320 ); 27321 return acc; 27322 }, {}) 27323 }; 27324 if (side === "vertical") { 27325 nextValues.top = next; 27326 nextValues.bottom = next; 27327 } 27328 if (side === "horizontal") { 27329 nextValues.left = next; 27330 nextValues.right = next; 27331 } 27332 onChange(nextValues); 27333 }; 27334 const filteredSides = sides?.length ? groupedSides.filter((side) => hasAxisSupport(sides, side)) : groupedSides; 27335 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: filteredSides.map((side) => { 27336 const axisValue = side === "vertical" ? values.top : values.left; 27337 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 27338 SpacingInputControl, 27339 { 27340 icon: ICONS[side], 27341 label: LABELS[side], 27342 minimumCustomValue, 27343 onChange: createHandleOnChange(side), 27344 onMouseOut, 27345 onMouseOver, 27346 side, 27347 spacingSizes, 27348 type, 27349 value: axisValue, 27350 withInputField: false 27351 }, 27352 `spacing-sizes-control-$side}` 27353 ); 27354 }) }); 27355 } 27356 27357 27358 ;// ./node_modules/@wordpress/block-editor/build-module/components/spacing-sizes-control/input-controls/separated.js 27359 27360 27361 27362 function SeparatedInputControls({ 27363 minimumCustomValue, 27364 onChange, 27365 onMouseOut, 27366 onMouseOver, 27367 sides, 27368 spacingSizes, 27369 type, 27370 values 27371 }) { 27372 const filteredSides = sides?.length ? ALL_SIDES.filter((side) => sides.includes(side)) : ALL_SIDES; 27373 const createHandleOnChange = (side) => (next) => { 27374 const nextValues = { 27375 ...Object.keys(values).reduce((acc, key) => { 27376 acc[key] = getPresetValueFromCustomValue( 27377 values[key], 27378 spacingSizes 27379 ); 27380 return acc; 27381 }, {}) 27382 }; 27383 nextValues[side] = next; 27384 onChange(nextValues); 27385 }; 27386 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: filteredSides.map((side) => { 27387 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 27388 SpacingInputControl, 27389 { 27390 icon: ICONS[side], 27391 label: LABELS[side], 27392 minimumCustomValue, 27393 onChange: createHandleOnChange(side), 27394 onMouseOut, 27395 onMouseOver, 27396 side, 27397 spacingSizes, 27398 type, 27399 value: values[side], 27400 withInputField: false 27401 }, 27402 `spacing-sizes-control-$side}` 27403 ); 27404 }) }); 27405 } 27406 27407 27408 ;// ./node_modules/@wordpress/block-editor/build-module/components/spacing-sizes-control/input-controls/single.js 27409 27410 27411 27412 function single_SingleInputControl({ 27413 minimumCustomValue, 27414 onChange, 27415 onMouseOut, 27416 onMouseOver, 27417 showSideInLabel, 27418 side, 27419 spacingSizes, 27420 type, 27421 values 27422 }) { 27423 const createHandleOnChange = (currentSide) => (next) => { 27424 const nextValues = { 27425 ...Object.keys(values).reduce((acc, key) => { 27426 acc[key] = getPresetValueFromCustomValue( 27427 values[key], 27428 spacingSizes 27429 ); 27430 return acc; 27431 }, {}) 27432 }; 27433 nextValues[currentSide] = next; 27434 onChange(nextValues); 27435 }; 27436 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 27437 SpacingInputControl, 27438 { 27439 label: LABELS[side], 27440 minimumCustomValue, 27441 onChange: createHandleOnChange(side), 27442 onMouseOut, 27443 onMouseOver, 27444 showSideInLabel, 27445 side, 27446 spacingSizes, 27447 type, 27448 value: values[side], 27449 withInputField: false 27450 } 27451 ); 27452 } 27453 27454 27455 ;// ./node_modules/@wordpress/block-editor/build-module/components/spacing-sizes-control/linked-button.js 27456 27457 27458 27459 27460 function linked_button_LinkedButton({ isLinked, ...props }) { 27461 const label = isLinked ? (0,external_wp_i18n_namespaceObject.__)("Unlink sides") : (0,external_wp_i18n_namespaceObject.__)("Link sides"); 27462 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 27463 external_wp_components_namespaceObject.Button, 27464 { 27465 ...props, 27466 size: "small", 27467 icon: isLinked ? link_default : link_off_default, 27468 iconSize: 24, 27469 label 27470 } 27471 ); 27472 } 27473 27474 27475 ;// ./node_modules/@wordpress/block-editor/build-module/components/spacing-sizes-control/index.js 27476 27477 27478 27479 27480 27481 27482 27483 27484 27485 27486 function SpacingSizesControl({ 27487 inputProps, 27488 label: labelProp, 27489 minimumCustomValue = 0, 27490 onChange, 27491 onMouseOut, 27492 onMouseOver, 27493 showSideInLabel = true, 27494 sides = ALL_SIDES, 27495 useSelect, 27496 values 27497 }) { 27498 const spacingSizes = useSpacingSizes(); 27499 const inputValues = values || DEFAULT_VALUES; 27500 const hasOneSide = sides?.length === 1; 27501 const hasOnlyAxialSides = sides?.includes("horizontal") && sides?.includes("vertical") && sides?.length === 2; 27502 const [view, setView] = (0,external_wp_element_namespaceObject.useState)(getInitialView(inputValues, sides)); 27503 const toggleLinked = () => { 27504 setView(view === VIEWS.axial ? VIEWS.custom : VIEWS.axial); 27505 }; 27506 const handleOnChange = (nextValue) => { 27507 const newValues = { ...values, ...nextValue }; 27508 onChange(newValues); 27509 }; 27510 const inputControlProps = { 27511 ...inputProps, 27512 minimumCustomValue, 27513 onChange: handleOnChange, 27514 onMouseOut, 27515 onMouseOver, 27516 sides, 27517 spacingSizes, 27518 type: labelProp, 27519 useSelect, 27520 values: inputValues 27521 }; 27522 const renderControls = () => { 27523 if (view === VIEWS.axial) { 27524 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(AxialInputControls, { ...inputControlProps }); 27525 } 27526 if (view === VIEWS.custom) { 27527 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SeparatedInputControls, { ...inputControlProps }); 27528 } 27529 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 27530 single_SingleInputControl, 27531 { 27532 side: view, 27533 ...inputControlProps, 27534 showSideInLabel 27535 } 27536 ); 27537 }; 27538 const sideLabel = ALL_SIDES.includes(view) && showSideInLabel ? LABELS[view] : ""; 27539 const label = (0,external_wp_i18n_namespaceObject.sprintf)( 27540 // translators: 1: The side of the block being modified (top, bottom, left etc.). 2. Type of spacing being modified (padding, margin, etc). 27541 (0,external_wp_i18n_namespaceObject._x)("%1$s %2$s", "spacing"), 27542 labelProp, 27543 sideLabel 27544 ).trim(); 27545 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("fieldset", { className: "spacing-sizes-control", children: [ 27546 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { className: "spacing-sizes-control__header", children: [ 27547 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 27548 external_wp_components_namespaceObject.BaseControl.VisualLabel, 27549 { 27550 as: "legend", 27551 className: "spacing-sizes-control__label", 27552 children: label 27553 } 27554 ), 27555 !hasOneSide && !hasOnlyAxialSides && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 27556 linked_button_LinkedButton, 27557 { 27558 label: labelProp, 27559 onClick: toggleLinked, 27560 isLinked: view === VIEWS.axial 27561 } 27562 ) 27563 ] }), 27564 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 0.5, children: renderControls() }) 27565 ] }); 27566 } 27567 27568 27569 ;// ./node_modules/@wordpress/block-editor/build-module/components/height-control/index.js 27570 27571 27572 27573 27574 27575 const RANGE_CONTROL_CUSTOM_SETTINGS = { 27576 px: { max: 1e3, step: 1 }, 27577 "%": { max: 100, step: 1 }, 27578 vw: { max: 100, step: 1 }, 27579 vh: { max: 100, step: 1 }, 27580 em: { max: 50, step: 0.1 }, 27581 rem: { max: 50, step: 0.1 }, 27582 svw: { max: 100, step: 1 }, 27583 lvw: { max: 100, step: 1 }, 27584 dvw: { max: 100, step: 1 }, 27585 svh: { max: 100, step: 1 }, 27586 lvh: { max: 100, step: 1 }, 27587 dvh: { max: 100, step: 1 }, 27588 vi: { max: 100, step: 1 }, 27589 svi: { max: 100, step: 1 }, 27590 lvi: { max: 100, step: 1 }, 27591 dvi: { max: 100, step: 1 }, 27592 vb: { max: 100, step: 1 }, 27593 svb: { max: 100, step: 1 }, 27594 lvb: { max: 100, step: 1 }, 27595 dvb: { max: 100, step: 1 }, 27596 vmin: { max: 100, step: 1 }, 27597 svmin: { max: 100, step: 1 }, 27598 lvmin: { max: 100, step: 1 }, 27599 dvmin: { max: 100, step: 1 }, 27600 vmax: { max: 100, step: 1 }, 27601 svmax: { max: 100, step: 1 }, 27602 lvmax: { max: 100, step: 1 }, 27603 dvmax: { max: 100, step: 1 } 27604 }; 27605 function HeightControl({ 27606 label = (0,external_wp_i18n_namespaceObject.__)("Height"), 27607 onChange, 27608 value 27609 }) { 27610 const customRangeValue = parseFloat(value); 27611 const [availableUnits] = use_settings_useSettings("spacing.units"); 27612 const units = (0,external_wp_components_namespaceObject.__experimentalUseCustomUnits)({ 27613 availableUnits: availableUnits || [ 27614 "%", 27615 "px", 27616 "em", 27617 "rem", 27618 "vh", 27619 "vw" 27620 ] 27621 }); 27622 const selectedUnit = (0,external_wp_element_namespaceObject.useMemo)( 27623 () => (0,external_wp_components_namespaceObject.__experimentalParseQuantityAndUnitFromRawValue)(value), 27624 [value] 27625 )[1] || units[0]?.value || "px"; 27626 const handleSliderChange = (next) => { 27627 onChange([next, selectedUnit].join("")); 27628 }; 27629 const handleUnitChange = (newUnit) => { 27630 const [currentValue, currentUnit] = (0,external_wp_components_namespaceObject.__experimentalParseQuantityAndUnitFromRawValue)(value); 27631 if (["em", "rem"].includes(newUnit) && currentUnit === "px") { 27632 onChange((currentValue / 16).toFixed(2) + newUnit); 27633 } else if (["em", "rem"].includes(currentUnit) && newUnit === "px") { 27634 onChange(Math.round(currentValue * 16) + newUnit); 27635 } else if ([ 27636 "%", 27637 "vw", 27638 "svw", 27639 "lvw", 27640 "dvw", 27641 "vh", 27642 "svh", 27643 "lvh", 27644 "dvh", 27645 "vi", 27646 "svi", 27647 "lvi", 27648 "dvi", 27649 "vb", 27650 "svb", 27651 "lvb", 27652 "dvb", 27653 "vmin", 27654 "svmin", 27655 "lvmin", 27656 "dvmin", 27657 "vmax", 27658 "svmax", 27659 "lvmax", 27660 "dvmax" 27661 ].includes(newUnit) && currentValue > 100) { 27662 onChange(100 + newUnit); 27663 } 27664 }; 27665 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("fieldset", { className: "block-editor-height-control", children: [ 27666 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.BaseControl.VisualLabel, { as: "legend", children: label }), 27667 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, { children: [ 27668 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { isBlock: true, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 27669 external_wp_components_namespaceObject.__experimentalUnitControl, 27670 { 27671 value, 27672 units, 27673 onChange, 27674 onUnitChange: handleUnitChange, 27675 min: 0, 27676 size: "__unstable-large", 27677 label, 27678 hideLabelFromVision: true 27679 } 27680 ) }), 27681 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { isBlock: true, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { marginX: 2, marginBottom: 0, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 27682 external_wp_components_namespaceObject.RangeControl, 27683 { 27684 __next40pxDefaultSize: true, 27685 value: customRangeValue, 27686 min: 0, 27687 max: RANGE_CONTROL_CUSTOM_SETTINGS[selectedUnit]?.max ?? 100, 27688 step: RANGE_CONTROL_CUSTOM_SETTINGS[selectedUnit]?.step ?? 0.1, 27689 withInputField: false, 27690 onChange: handleSliderChange, 27691 __nextHasNoMarginBottom: true, 27692 label, 27693 hideLabelFromVision: true 27694 } 27695 ) }) }) 27696 ] }) 27697 ] }); 27698 } 27699 27700 27701 ;// ./node_modules/@wordpress/block-editor/build-module/components/grid/use-get-number-of-blocks-before-cell.js 27702 27703 27704 function useGetNumberOfBlocksBeforeCell(gridClientId, numColumns) { 27705 const { getBlockOrder, getBlockAttributes } = (0,external_wp_data_namespaceObject.useSelect)(store); 27706 const getNumberOfBlocksBeforeCell = (column, row) => { 27707 const targetIndex = (row - 1) * numColumns + column - 1; 27708 let count = 0; 27709 for (const clientId of getBlockOrder(gridClientId)) { 27710 const { columnStart, rowStart } = getBlockAttributes(clientId).style?.layout ?? {}; 27711 const cellIndex = (rowStart - 1) * numColumns + columnStart - 1; 27712 if (cellIndex < targetIndex) { 27713 count++; 27714 } 27715 } 27716 return count; 27717 }; 27718 return getNumberOfBlocksBeforeCell; 27719 } 27720 27721 27722 ;// ./node_modules/@wordpress/block-editor/build-module/components/child-layout-control/index.js 27723 27724 27725 27726 27727 27728 27729 27730 27731 function helpText(selfStretch, parentLayout) { 27732 const { orientation = "horizontal" } = parentLayout; 27733 if (selfStretch === "fill") { 27734 return (0,external_wp_i18n_namespaceObject.__)("Stretch to fill available space."); 27735 } 27736 if (selfStretch === "fixed" && orientation === "horizontal") { 27737 return (0,external_wp_i18n_namespaceObject.__)("Specify a fixed width."); 27738 } else if (selfStretch === "fixed") { 27739 return (0,external_wp_i18n_namespaceObject.__)("Specify a fixed height."); 27740 } 27741 return (0,external_wp_i18n_namespaceObject.__)("Fit contents."); 27742 } 27743 function ChildLayoutControl({ 27744 value: childLayout = {}, 27745 onChange, 27746 parentLayout, 27747 isShownByDefault, 27748 panelId 27749 }) { 27750 const { 27751 type: parentType, 27752 default: { type: defaultParentType = "default" } = {} 27753 } = parentLayout ?? {}; 27754 const parentLayoutType = parentType || defaultParentType; 27755 if (parentLayoutType === "flex") { 27756 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 27757 FlexControls, 27758 { 27759 childLayout, 27760 onChange, 27761 parentLayout, 27762 isShownByDefault, 27763 panelId 27764 } 27765 ); 27766 } else if (parentLayoutType === "grid") { 27767 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 27768 GridControls, 27769 { 27770 childLayout, 27771 onChange, 27772 parentLayout, 27773 isShownByDefault, 27774 panelId 27775 } 27776 ); 27777 } 27778 return null; 27779 } 27780 function FlexControls({ 27781 childLayout, 27782 onChange, 27783 parentLayout, 27784 isShownByDefault, 27785 panelId 27786 }) { 27787 const { selfStretch, flexSize } = childLayout; 27788 const { orientation = "horizontal" } = parentLayout ?? {}; 27789 const hasFlexValue = () => !!selfStretch; 27790 const flexResetLabel = orientation === "horizontal" ? (0,external_wp_i18n_namespaceObject.__)("Width") : (0,external_wp_i18n_namespaceObject.__)("Height"); 27791 const [availableUnits] = use_settings_useSettings("spacing.units"); 27792 const units = (0,external_wp_components_namespaceObject.__experimentalUseCustomUnits)({ 27793 availableUnits: availableUnits || [ 27794 "%", 27795 "px", 27796 "em", 27797 "rem", 27798 "vh", 27799 "vw" 27800 ] 27801 }); 27802 const resetFlex = () => { 27803 onChange({ 27804 selfStretch: void 0, 27805 flexSize: void 0 27806 }); 27807 }; 27808 (0,external_wp_element_namespaceObject.useEffect)(() => { 27809 if (selfStretch === "fixed" && !flexSize) { 27810 onChange({ 27811 ...childLayout, 27812 selfStretch: "fit" 27813 }); 27814 } 27815 }, []); 27816 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 27817 external_wp_components_namespaceObject.__experimentalVStack, 27818 { 27819 as: external_wp_components_namespaceObject.__experimentalToolsPanelItem, 27820 spacing: 2, 27821 hasValue: hasFlexValue, 27822 label: flexResetLabel, 27823 onDeselect: resetFlex, 27824 isShownByDefault, 27825 panelId, 27826 children: [ 27827 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 27828 external_wp_components_namespaceObject.__experimentalToggleGroupControl, 27829 { 27830 __nextHasNoMarginBottom: true, 27831 size: "__unstable-large", 27832 label: childLayoutOrientation(parentLayout), 27833 value: selfStretch || "fit", 27834 help: helpText(selfStretch, parentLayout), 27835 onChange: (value) => { 27836 const newFlexSize = value !== "fixed" ? null : flexSize; 27837 onChange({ 27838 selfStretch: value, 27839 flexSize: newFlexSize 27840 }); 27841 }, 27842 isBlock: true, 27843 children: [ 27844 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 27845 external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, 27846 { 27847 value: "fit", 27848 label: (0,external_wp_i18n_namespaceObject._x)( 27849 "Fit", 27850 "Intrinsic block width in flex layout" 27851 ) 27852 }, 27853 "fit" 27854 ), 27855 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 27856 external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, 27857 { 27858 value: "fill", 27859 label: (0,external_wp_i18n_namespaceObject._x)( 27860 "Grow", 27861 "Block with expanding width in flex layout" 27862 ) 27863 }, 27864 "fill" 27865 ), 27866 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 27867 external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, 27868 { 27869 value: "fixed", 27870 label: (0,external_wp_i18n_namespaceObject._x)( 27871 "Fixed", 27872 "Block with fixed width in flex layout" 27873 ) 27874 }, 27875 "fixed" 27876 ) 27877 ] 27878 } 27879 ), 27880 selfStretch === "fixed" && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 27881 external_wp_components_namespaceObject.__experimentalUnitControl, 27882 { 27883 size: "__unstable-large", 27884 units, 27885 onChange: (value) => { 27886 onChange({ 27887 selfStretch, 27888 flexSize: value 27889 }); 27890 }, 27891 value: flexSize, 27892 min: 0, 27893 label: flexResetLabel, 27894 hideLabelFromVision: true 27895 } 27896 ) 27897 ] 27898 } 27899 ); 27900 } 27901 function childLayoutOrientation(parentLayout) { 27902 const { orientation = "horizontal" } = parentLayout; 27903 return orientation === "horizontal" ? (0,external_wp_i18n_namespaceObject.__)("Width") : (0,external_wp_i18n_namespaceObject.__)("Height"); 27904 } 27905 function GridControls({ 27906 childLayout, 27907 onChange, 27908 parentLayout, 27909 isShownByDefault, 27910 panelId 27911 }) { 27912 const { columnStart, rowStart, columnSpan, rowSpan } = childLayout; 27913 const { columnCount, rowCount } = parentLayout ?? {}; 27914 const rootClientId = (0,external_wp_data_namespaceObject.useSelect)( 27915 (select) => select(store).getBlockRootClientId(panelId) 27916 ); 27917 const { moveBlocksToPosition, __unstableMarkNextChangeAsNotPersistent } = (0,external_wp_data_namespaceObject.useDispatch)(store); 27918 const getNumberOfBlocksBeforeCell = useGetNumberOfBlocksBeforeCell( 27919 rootClientId, 27920 columnCount || 3 27921 ); 27922 const hasStartValue = () => !!columnStart || !!rowStart; 27923 const hasSpanValue = () => !!columnSpan || !!rowSpan; 27924 const resetGridStarts = () => { 27925 onChange({ 27926 columnStart: void 0, 27927 rowStart: void 0 27928 }); 27929 }; 27930 const resetGridSpans = () => { 27931 onChange({ 27932 columnSpan: void 0, 27933 rowSpan: void 0 27934 }); 27935 }; 27936 const maxColumnSpan = columnCount ? columnCount - (columnStart ?? 1) + 1 : void 0; 27937 const maxRowSpan = window.__experimentalEnableGridInteractivity && rowCount ? rowCount - (rowStart ?? 1) + 1 : void 0; 27938 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 27939 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 27940 external_wp_components_namespaceObject.Flex, 27941 { 27942 as: external_wp_components_namespaceObject.__experimentalToolsPanelItem, 27943 hasValue: hasSpanValue, 27944 label: (0,external_wp_i18n_namespaceObject.__)("Grid span"), 27945 onDeselect: resetGridSpans, 27946 isShownByDefault, 27947 panelId, 27948 children: [ 27949 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { style: { width: "50%" }, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 27950 external_wp_components_namespaceObject.__experimentalInputControl, 27951 { 27952 size: "__unstable-large", 27953 label: (0,external_wp_i18n_namespaceObject.__)("Column span"), 27954 type: "number", 27955 onChange: (value) => { 27956 const newColumnSpan = value === "" ? 1 : parseInt(value, 10); 27957 const constrainedValue = maxColumnSpan ? Math.min(newColumnSpan, maxColumnSpan) : newColumnSpan; 27958 onChange({ 27959 columnStart, 27960 rowStart, 27961 rowSpan, 27962 columnSpan: constrainedValue 27963 }); 27964 }, 27965 value: columnSpan ?? 1, 27966 min: 1, 27967 max: maxColumnSpan 27968 } 27969 ) }), 27970 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { style: { width: "50%" }, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 27971 external_wp_components_namespaceObject.__experimentalInputControl, 27972 { 27973 size: "__unstable-large", 27974 label: (0,external_wp_i18n_namespaceObject.__)("Row span"), 27975 type: "number", 27976 onChange: (value) => { 27977 const newRowSpan = value === "" ? 1 : parseInt(value, 10); 27978 const constrainedValue = maxRowSpan ? Math.min(newRowSpan, maxRowSpan) : newRowSpan; 27979 onChange({ 27980 columnStart, 27981 rowStart, 27982 columnSpan, 27983 rowSpan: constrainedValue 27984 }); 27985 }, 27986 value: rowSpan ?? 1, 27987 min: 1, 27988 max: maxRowSpan 27989 } 27990 ) }) 27991 ] 27992 } 27993 ), 27994 window.__experimentalEnableGridInteractivity && // Use Flex with an explicit width on the FlexItem instead of HStack to 27995 // work around an issue in webkit where inputs with a max attribute are 27996 // sized incorrectly. 27997 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 27998 external_wp_components_namespaceObject.Flex, 27999 { 28000 as: external_wp_components_namespaceObject.__experimentalToolsPanelItem, 28001 hasValue: hasStartValue, 28002 label: (0,external_wp_i18n_namespaceObject.__)("Grid placement"), 28003 onDeselect: resetGridStarts, 28004 isShownByDefault: false, 28005 panelId, 28006 children: [ 28007 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { style: { width: "50%" }, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 28008 external_wp_components_namespaceObject.__experimentalInputControl, 28009 { 28010 size: "__unstable-large", 28011 label: (0,external_wp_i18n_namespaceObject.__)("Column"), 28012 type: "number", 28013 onChange: (value) => { 28014 const newColumnStart = value === "" ? 1 : parseInt(value, 10); 28015 onChange({ 28016 columnStart: newColumnStart, 28017 rowStart, 28018 columnSpan, 28019 rowSpan 28020 }); 28021 __unstableMarkNextChangeAsNotPersistent(); 28022 moveBlocksToPosition( 28023 [panelId], 28024 rootClientId, 28025 rootClientId, 28026 getNumberOfBlocksBeforeCell( 28027 newColumnStart, 28028 rowStart 28029 ) 28030 ); 28031 }, 28032 value: columnStart ?? 1, 28033 min: 1, 28034 max: columnCount ? columnCount - (columnSpan ?? 1) + 1 : void 0 28035 } 28036 ) }), 28037 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { style: { width: "50%" }, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 28038 external_wp_components_namespaceObject.__experimentalInputControl, 28039 { 28040 size: "__unstable-large", 28041 label: (0,external_wp_i18n_namespaceObject.__)("Row"), 28042 type: "number", 28043 onChange: (value) => { 28044 const newRowStart = value === "" ? 1 : parseInt(value, 10); 28045 onChange({ 28046 columnStart, 28047 rowStart: newRowStart, 28048 columnSpan, 28049 rowSpan 28050 }); 28051 __unstableMarkNextChangeAsNotPersistent(); 28052 moveBlocksToPosition( 28053 [panelId], 28054 rootClientId, 28055 rootClientId, 28056 getNumberOfBlocksBeforeCell( 28057 columnStart, 28058 newRowStart 28059 ) 28060 ); 28061 }, 28062 value: rowStart ?? 1, 28063 min: 1, 28064 max: rowCount ? rowCount - (rowSpan ?? 1) + 1 : void 0 28065 } 28066 ) }) 28067 ] 28068 } 28069 ) 28070 ] }); 28071 } 28072 28073 28074 ;// ./node_modules/@wordpress/block-editor/build-module/components/dimensions-tool/aspect-ratio-tool.js 28075 28076 28077 28078 28079 function AspectRatioTool({ 28080 panelId, 28081 value, 28082 onChange = () => { 28083 }, 28084 options, 28085 defaultValue = "auto", 28086 hasValue, 28087 isShownByDefault = true 28088 }) { 28089 const displayValue = value ?? "auto"; 28090 const [defaultRatios, themeRatios, showDefaultRatios] = use_settings_useSettings( 28091 "dimensions.aspectRatios.default", 28092 "dimensions.aspectRatios.theme", 28093 "dimensions.defaultAspectRatios" 28094 ); 28095 const themeOptions = themeRatios?.map(({ name, ratio }) => ({ 28096 label: name, 28097 value: ratio 28098 })); 28099 const defaultOptions = defaultRatios?.map(({ name, ratio }) => ({ 28100 label: name, 28101 value: ratio 28102 })); 28103 const aspectRatioOptions = [ 28104 { 28105 label: (0,external_wp_i18n_namespaceObject._x)( 28106 "Original", 28107 "Aspect ratio option for dimensions control" 28108 ), 28109 value: "auto" 28110 }, 28111 ...showDefaultRatios ? defaultOptions : [], 28112 ...themeOptions ? themeOptions : [], 28113 { 28114 label: (0,external_wp_i18n_namespaceObject._x)("Custom", "Aspect ratio option for dimensions control"), 28115 value: "custom", 28116 disabled: true, 28117 hidden: true 28118 } 28119 ]; 28120 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 28121 external_wp_components_namespaceObject.__experimentalToolsPanelItem, 28122 { 28123 hasValue: hasValue ? hasValue : () => displayValue !== defaultValue, 28124 label: (0,external_wp_i18n_namespaceObject.__)("Aspect ratio"), 28125 onDeselect: () => onChange(void 0), 28126 isShownByDefault, 28127 panelId, 28128 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 28129 external_wp_components_namespaceObject.SelectControl, 28130 { 28131 label: (0,external_wp_i18n_namespaceObject.__)("Aspect ratio"), 28132 value: displayValue, 28133 options: options ?? aspectRatioOptions, 28134 onChange, 28135 size: "__unstable-large", 28136 __nextHasNoMarginBottom: true 28137 } 28138 ) 28139 } 28140 ); 28141 } 28142 28143 28144 ;// ./node_modules/@wordpress/block-editor/build-module/components/global-styles/dimensions-panel.js 28145 28146 28147 28148 28149 28150 28151 28152 28153 28154 28155 28156 28157 28158 const AXIAL_SIDES = ["horizontal", "vertical"]; 28159 function useHasDimensionsPanel(settings) { 28160 const hasContentSize = useHasContentSize(settings); 28161 const hasWideSize = useHasWideSize(settings); 28162 const hasPadding = useHasPadding(settings); 28163 const hasMargin = useHasMargin(settings); 28164 const hasGap = useHasGap(settings); 28165 const hasMinHeight = useHasMinHeight(settings); 28166 const hasAspectRatio = useHasAspectRatio(settings); 28167 const hasChildLayout = useHasChildLayout(settings); 28168 return external_wp_element_namespaceObject.Platform.OS === "web" && (hasContentSize || hasWideSize || hasPadding || hasMargin || hasGap || hasMinHeight || hasAspectRatio || hasChildLayout); 28169 } 28170 function useHasContentSize(settings) { 28171 return settings?.layout?.contentSize; 28172 } 28173 function useHasWideSize(settings) { 28174 return settings?.layout?.wideSize; 28175 } 28176 function useHasPadding(settings) { 28177 return settings?.spacing?.padding; 28178 } 28179 function useHasMargin(settings) { 28180 return settings?.spacing?.margin; 28181 } 28182 function useHasGap(settings) { 28183 return settings?.spacing?.blockGap; 28184 } 28185 function useHasMinHeight(settings) { 28186 return settings?.dimensions?.minHeight; 28187 } 28188 function useHasAspectRatio(settings) { 28189 return settings?.dimensions?.aspectRatio; 28190 } 28191 function useHasChildLayout(settings) { 28192 const { 28193 type: parentLayoutType = "default", 28194 default: { type: defaultParentLayoutType = "default" } = {}, 28195 allowSizingOnChildren = false 28196 } = settings?.parentLayout ?? {}; 28197 const support = (defaultParentLayoutType === "flex" || parentLayoutType === "flex" || defaultParentLayoutType === "grid" || parentLayoutType === "grid") && allowSizingOnChildren; 28198 return !!settings?.layout && support; 28199 } 28200 function useHasSpacingPresets(settings) { 28201 const { defaultSpacingSizes, spacingSizes } = settings?.spacing || {}; 28202 return defaultSpacingSizes !== false && spacingSizes?.default?.length > 0 || spacingSizes?.theme?.length > 0 || spacingSizes?.custom?.length > 0; 28203 } 28204 function filterValuesBySides(values, sides) { 28205 if (!sides || !values) { 28206 return values; 28207 } 28208 const filteredValues = {}; 28209 sides.forEach((side) => { 28210 if (side === "vertical") { 28211 filteredValues.top = values.top; 28212 filteredValues.bottom = values.bottom; 28213 } 28214 if (side === "horizontal") { 28215 filteredValues.left = values.left; 28216 filteredValues.right = values.right; 28217 } 28218 filteredValues[side] = values?.[side]; 28219 }); 28220 return filteredValues; 28221 } 28222 function splitStyleValue(value) { 28223 if (value && typeof value === "string") { 28224 return { 28225 top: value, 28226 right: value, 28227 bottom: value, 28228 left: value 28229 }; 28230 } 28231 return value; 28232 } 28233 function splitGapValue(value, isAxialGap) { 28234 if (!value) { 28235 return value; 28236 } 28237 if (typeof value === "string") { 28238 return isAxialGap ? { top: value, right: value, bottom: value, left: value } : { top: value }; 28239 } 28240 return { 28241 ...value, 28242 right: value?.left, 28243 bottom: value?.top 28244 }; 28245 } 28246 function DimensionsToolsPanel({ 28247 resetAllFilter, 28248 onChange, 28249 value, 28250 panelId, 28251 children 28252 }) { 28253 const dropdownMenuProps = useToolsPanelDropdownMenuProps(); 28254 const resetAll = () => { 28255 const updatedValue = resetAllFilter(value); 28256 onChange(updatedValue); 28257 }; 28258 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 28259 external_wp_components_namespaceObject.__experimentalToolsPanel, 28260 { 28261 label: (0,external_wp_i18n_namespaceObject.__)("Dimensions"), 28262 resetAll, 28263 panelId, 28264 dropdownMenuProps, 28265 children 28266 } 28267 ); 28268 } 28269 const dimensions_panel_DEFAULT_CONTROLS = { 28270 contentSize: true, 28271 wideSize: true, 28272 padding: true, 28273 margin: true, 28274 blockGap: true, 28275 minHeight: true, 28276 aspectRatio: true, 28277 childLayout: true 28278 }; 28279 function DimensionsPanel({ 28280 as: Wrapper = DimensionsToolsPanel, 28281 value, 28282 onChange, 28283 inheritedValue = value, 28284 settings, 28285 panelId, 28286 defaultControls = dimensions_panel_DEFAULT_CONTROLS, 28287 onVisualize = () => { 28288 }, 28289 // Special case because the layout controls are not part of the dimensions panel 28290 // in global styles but not in block inspector. 28291 includeLayoutControls = false 28292 }) { 28293 const { dimensions, spacing } = settings; 28294 const decodeValue = (rawValue) => { 28295 if (rawValue && typeof rawValue === "object") { 28296 return Object.keys(rawValue).reduce((acc, key) => { 28297 acc[key] = getValueFromVariable( 28298 { settings: { dimensions, spacing } }, 28299 "", 28300 rawValue[key] 28301 ); 28302 return acc; 28303 }, {}); 28304 } 28305 return getValueFromVariable( 28306 { settings: { dimensions, spacing } }, 28307 "", 28308 rawValue 28309 ); 28310 }; 28311 const showSpacingPresetsControl = useHasSpacingPresets(settings); 28312 const units = (0,external_wp_components_namespaceObject.__experimentalUseCustomUnits)({ 28313 availableUnits: settings?.spacing?.units || [ 28314 "%", 28315 "px", 28316 "em", 28317 "rem", 28318 "vw" 28319 ] 28320 }); 28321 const minimumMargin = -Infinity; 28322 const [minMarginValue, setMinMarginValue] = (0,external_wp_element_namespaceObject.useState)(minimumMargin); 28323 const showContentSizeControl = useHasContentSize(settings) && includeLayoutControls; 28324 const contentSizeValue = decodeValue(inheritedValue?.layout?.contentSize); 28325 const setContentSizeValue = (newValue) => { 28326 onChange( 28327 setImmutably( 28328 value, 28329 ["layout", "contentSize"], 28330 newValue || void 0 28331 ) 28332 ); 28333 }; 28334 const hasUserSetContentSizeValue = () => !!value?.layout?.contentSize; 28335 const resetContentSizeValue = () => setContentSizeValue(void 0); 28336 const showWideSizeControl = useHasWideSize(settings) && includeLayoutControls; 28337 const wideSizeValue = decodeValue(inheritedValue?.layout?.wideSize); 28338 const setWideSizeValue = (newValue) => { 28339 onChange( 28340 setImmutably( 28341 value, 28342 ["layout", "wideSize"], 28343 newValue || void 0 28344 ) 28345 ); 28346 }; 28347 const hasUserSetWideSizeValue = () => !!value?.layout?.wideSize; 28348 const resetWideSizeValue = () => setWideSizeValue(void 0); 28349 const showPaddingControl = useHasPadding(settings); 28350 const rawPadding = decodeValue(inheritedValue?.spacing?.padding); 28351 const paddingValues = splitStyleValue(rawPadding); 28352 const paddingSides = Array.isArray(settings?.spacing?.padding) ? settings?.spacing?.padding : settings?.spacing?.padding?.sides; 28353 const isAxialPadding = paddingSides && paddingSides.some((side) => AXIAL_SIDES.includes(side)); 28354 const setPaddingValues = (newPaddingValues) => { 28355 const padding = filterValuesBySides(newPaddingValues, paddingSides); 28356 onChange(setImmutably(value, ["spacing", "padding"], padding)); 28357 }; 28358 const hasPaddingValue = () => !!value?.spacing?.padding && Object.keys(value?.spacing?.padding).length; 28359 const resetPaddingValue = () => setPaddingValues(void 0); 28360 const onMouseOverPadding = () => onVisualize("padding"); 28361 const showMarginControl = useHasMargin(settings); 28362 const rawMargin = decodeValue(inheritedValue?.spacing?.margin); 28363 const marginValues = splitStyleValue(rawMargin); 28364 const marginSides = Array.isArray(settings?.spacing?.margin) ? settings?.spacing?.margin : settings?.spacing?.margin?.sides; 28365 const isAxialMargin = marginSides && marginSides.some((side) => AXIAL_SIDES.includes(side)); 28366 const setMarginValues = (newMarginValues) => { 28367 const margin = filterValuesBySides(newMarginValues, marginSides); 28368 onChange(setImmutably(value, ["spacing", "margin"], margin)); 28369 }; 28370 const hasMarginValue = () => !!value?.spacing?.margin && Object.keys(value?.spacing?.margin).length; 28371 const resetMarginValue = () => setMarginValues(void 0); 28372 const onMouseOverMargin = () => onVisualize("margin"); 28373 const showGapControl = useHasGap(settings); 28374 const gapSides = Array.isArray(settings?.spacing?.blockGap) ? settings?.spacing?.blockGap : settings?.spacing?.blockGap?.sides; 28375 const isAxialGap = gapSides && gapSides.some((side) => AXIAL_SIDES.includes(side)); 28376 const gapValue = decodeValue(inheritedValue?.spacing?.blockGap); 28377 const gapValues = splitGapValue(gapValue, isAxialGap); 28378 const setGapValue = (newGapValue) => { 28379 onChange( 28380 setImmutably(value, ["spacing", "blockGap"], newGapValue) 28381 ); 28382 }; 28383 const setGapValues = (nextBoxGapValue) => { 28384 if (!nextBoxGapValue) { 28385 setGapValue(null); 28386 } 28387 if (!isAxialGap && nextBoxGapValue?.hasOwnProperty("top")) { 28388 setGapValue(nextBoxGapValue.top); 28389 } else { 28390 setGapValue({ 28391 top: nextBoxGapValue?.top, 28392 left: nextBoxGapValue?.left 28393 }); 28394 } 28395 }; 28396 const resetGapValue = () => setGapValue(void 0); 28397 const hasGapValue = () => !!value?.spacing?.blockGap; 28398 const showMinHeightControl = useHasMinHeight(settings); 28399 const minHeightValue = decodeValue(inheritedValue?.dimensions?.minHeight); 28400 const setMinHeightValue = (newValue) => { 28401 const tempValue = setImmutably( 28402 value, 28403 ["dimensions", "minHeight"], 28404 newValue 28405 ); 28406 onChange( 28407 setImmutably( 28408 tempValue, 28409 ["dimensions", "aspectRatio"], 28410 void 0 28411 ) 28412 ); 28413 }; 28414 const resetMinHeightValue = () => { 28415 setMinHeightValue(void 0); 28416 }; 28417 const hasMinHeightValue = () => !!value?.dimensions?.minHeight; 28418 const showAspectRatioControl = useHasAspectRatio(settings); 28419 const aspectRatioValue = decodeValue( 28420 inheritedValue?.dimensions?.aspectRatio 28421 ); 28422 const setAspectRatioValue = (newValue) => { 28423 const tempValue = setImmutably( 28424 value, 28425 ["dimensions", "aspectRatio"], 28426 newValue 28427 ); 28428 onChange( 28429 setImmutably(tempValue, ["dimensions", "minHeight"], void 0) 28430 ); 28431 }; 28432 const hasAspectRatioValue = () => !!value?.dimensions?.aspectRatio; 28433 const showChildLayoutControl = useHasChildLayout(settings); 28434 const childLayout = inheritedValue?.layout; 28435 const setChildLayout = (newChildLayout) => { 28436 onChange({ 28437 ...value, 28438 layout: { 28439 ...newChildLayout 28440 } 28441 }); 28442 }; 28443 const resetAllFilter = (0,external_wp_element_namespaceObject.useCallback)((previousValue) => { 28444 return { 28445 ...previousValue, 28446 layout: utils_cleanEmptyObject({ 28447 ...previousValue?.layout, 28448 contentSize: void 0, 28449 wideSize: void 0, 28450 selfStretch: void 0, 28451 flexSize: void 0, 28452 columnStart: void 0, 28453 rowStart: void 0, 28454 columnSpan: void 0, 28455 rowSpan: void 0 28456 }), 28457 spacing: { 28458 ...previousValue?.spacing, 28459 padding: void 0, 28460 margin: void 0, 28461 blockGap: void 0 28462 }, 28463 dimensions: { 28464 ...previousValue?.dimensions, 28465 minHeight: void 0, 28466 aspectRatio: void 0 28467 } 28468 }; 28469 }, []); 28470 const onMouseLeaveControls = () => onVisualize(false); 28471 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 28472 Wrapper, 28473 { 28474 resetAllFilter, 28475 value, 28476 onChange, 28477 panelId, 28478 children: [ 28479 (showContentSizeControl || showWideSizeControl) && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "span-columns", children: (0,external_wp_i18n_namespaceObject.__)("Set the width of the main content area.") }), 28480 showContentSizeControl && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 28481 external_wp_components_namespaceObject.__experimentalToolsPanelItem, 28482 { 28483 label: (0,external_wp_i18n_namespaceObject.__)("Content width"), 28484 hasValue: hasUserSetContentSizeValue, 28485 onDeselect: resetContentSizeValue, 28486 isShownByDefault: defaultControls.contentSize ?? dimensions_panel_DEFAULT_CONTROLS.contentSize, 28487 panelId, 28488 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 28489 external_wp_components_namespaceObject.__experimentalUnitControl, 28490 { 28491 __next40pxDefaultSize: true, 28492 label: (0,external_wp_i18n_namespaceObject.__)("Content width"), 28493 labelPosition: "top", 28494 value: contentSizeValue || "", 28495 onChange: (nextContentSize) => { 28496 setContentSizeValue(nextContentSize); 28497 }, 28498 units, 28499 prefix: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalInputControlPrefixWrapper, { variant: "icon", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(icon_default, { icon: align_none_default }) }) 28500 } 28501 ) 28502 } 28503 ), 28504 showWideSizeControl && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 28505 external_wp_components_namespaceObject.__experimentalToolsPanelItem, 28506 { 28507 label: (0,external_wp_i18n_namespaceObject.__)("Wide width"), 28508 hasValue: hasUserSetWideSizeValue, 28509 onDeselect: resetWideSizeValue, 28510 isShownByDefault: defaultControls.wideSize ?? dimensions_panel_DEFAULT_CONTROLS.wideSize, 28511 panelId, 28512 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 28513 external_wp_components_namespaceObject.__experimentalUnitControl, 28514 { 28515 __next40pxDefaultSize: true, 28516 label: (0,external_wp_i18n_namespaceObject.__)("Wide width"), 28517 labelPosition: "top", 28518 value: wideSizeValue || "", 28519 onChange: (nextWideSize) => { 28520 setWideSizeValue(nextWideSize); 28521 }, 28522 units, 28523 prefix: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalInputControlPrefixWrapper, { variant: "icon", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(icon_default, { icon: stretch_wide_default }) }) 28524 } 28525 ) 28526 } 28527 ), 28528 showPaddingControl && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 28529 external_wp_components_namespaceObject.__experimentalToolsPanelItem, 28530 { 28531 hasValue: hasPaddingValue, 28532 label: (0,external_wp_i18n_namespaceObject.__)("Padding"), 28533 onDeselect: resetPaddingValue, 28534 isShownByDefault: defaultControls.padding ?? dimensions_panel_DEFAULT_CONTROLS.padding, 28535 className: dist_clsx({ 28536 "tools-panel-item-spacing": showSpacingPresetsControl 28537 }), 28538 panelId, 28539 children: [ 28540 !showSpacingPresetsControl && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 28541 external_wp_components_namespaceObject.BoxControl, 28542 { 28543 __next40pxDefaultSize: true, 28544 values: paddingValues, 28545 onChange: setPaddingValues, 28546 label: (0,external_wp_i18n_namespaceObject.__)("Padding"), 28547 sides: paddingSides, 28548 units, 28549 allowReset: false, 28550 splitOnAxis: isAxialPadding, 28551 inputProps: { 28552 onMouseOver: onMouseOverPadding, 28553 onMouseOut: onMouseLeaveControls 28554 } 28555 } 28556 ), 28557 showSpacingPresetsControl && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 28558 SpacingSizesControl, 28559 { 28560 values: paddingValues, 28561 onChange: setPaddingValues, 28562 label: (0,external_wp_i18n_namespaceObject.__)("Padding"), 28563 sides: paddingSides, 28564 units, 28565 allowReset: false, 28566 onMouseOver: onMouseOverPadding, 28567 onMouseOut: onMouseLeaveControls 28568 } 28569 ) 28570 ] 28571 } 28572 ), 28573 showMarginControl && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 28574 external_wp_components_namespaceObject.__experimentalToolsPanelItem, 28575 { 28576 hasValue: hasMarginValue, 28577 label: (0,external_wp_i18n_namespaceObject.__)("Margin"), 28578 onDeselect: resetMarginValue, 28579 isShownByDefault: defaultControls.margin ?? dimensions_panel_DEFAULT_CONTROLS.margin, 28580 className: dist_clsx({ 28581 "tools-panel-item-spacing": showSpacingPresetsControl 28582 }), 28583 panelId, 28584 children: [ 28585 !showSpacingPresetsControl && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 28586 external_wp_components_namespaceObject.BoxControl, 28587 { 28588 __next40pxDefaultSize: true, 28589 values: marginValues, 28590 onChange: setMarginValues, 28591 inputProps: { 28592 min: minMarginValue, 28593 onDragStart: () => { 28594 setMinMarginValue(0); 28595 }, 28596 onDragEnd: () => { 28597 setMinMarginValue(minimumMargin); 28598 }, 28599 onMouseOver: onMouseOverMargin, 28600 onMouseOut: onMouseLeaveControls 28601 }, 28602 label: (0,external_wp_i18n_namespaceObject.__)("Margin"), 28603 sides: marginSides, 28604 units, 28605 allowReset: false, 28606 splitOnAxis: isAxialMargin 28607 } 28608 ), 28609 showSpacingPresetsControl && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 28610 SpacingSizesControl, 28611 { 28612 values: marginValues, 28613 onChange: setMarginValues, 28614 minimumCustomValue: -Infinity, 28615 label: (0,external_wp_i18n_namespaceObject.__)("Margin"), 28616 sides: marginSides, 28617 units, 28618 allowReset: false, 28619 onMouseOver: onMouseOverMargin, 28620 onMouseOut: onMouseLeaveControls 28621 } 28622 ) 28623 ] 28624 } 28625 ), 28626 showGapControl && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 28627 external_wp_components_namespaceObject.__experimentalToolsPanelItem, 28628 { 28629 hasValue: hasGapValue, 28630 label: (0,external_wp_i18n_namespaceObject.__)("Block spacing"), 28631 onDeselect: resetGapValue, 28632 isShownByDefault: defaultControls.blockGap ?? dimensions_panel_DEFAULT_CONTROLS.blockGap, 28633 className: dist_clsx({ 28634 "tools-panel-item-spacing": showSpacingPresetsControl, 28635 "single-column": ( 28636 // If UnitControl is used, should be single-column. 28637 !showSpacingPresetsControl && !isAxialGap 28638 ) 28639 }), 28640 panelId, 28641 children: [ 28642 !showSpacingPresetsControl && (isAxialGap ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 28643 external_wp_components_namespaceObject.BoxControl, 28644 { 28645 __next40pxDefaultSize: true, 28646 label: (0,external_wp_i18n_namespaceObject.__)("Block spacing"), 28647 min: 0, 28648 onChange: setGapValues, 28649 units, 28650 sides: gapSides, 28651 values: gapValues, 28652 allowReset: false, 28653 splitOnAxis: isAxialGap 28654 } 28655 ) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 28656 external_wp_components_namespaceObject.__experimentalUnitControl, 28657 { 28658 __next40pxDefaultSize: true, 28659 label: (0,external_wp_i18n_namespaceObject.__)("Block spacing"), 28660 min: 0, 28661 onChange: setGapValue, 28662 units, 28663 value: gapValue 28664 } 28665 )), 28666 showSpacingPresetsControl && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 28667 SpacingSizesControl, 28668 { 28669 label: (0,external_wp_i18n_namespaceObject.__)("Block spacing"), 28670 min: 0, 28671 onChange: setGapValues, 28672 showSideInLabel: false, 28673 sides: isAxialGap ? gapSides : ["top"], 28674 values: gapValues, 28675 allowReset: false 28676 } 28677 ) 28678 ] 28679 } 28680 ), 28681 showChildLayoutControl && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 28682 ChildLayoutControl, 28683 { 28684 value: childLayout, 28685 onChange: setChildLayout, 28686 parentLayout: settings?.parentLayout, 28687 panelId, 28688 isShownByDefault: defaultControls.childLayout ?? dimensions_panel_DEFAULT_CONTROLS.childLayout 28689 } 28690 ), 28691 showMinHeightControl && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 28692 external_wp_components_namespaceObject.__experimentalToolsPanelItem, 28693 { 28694 hasValue: hasMinHeightValue, 28695 label: (0,external_wp_i18n_namespaceObject.__)("Minimum height"), 28696 onDeselect: resetMinHeightValue, 28697 isShownByDefault: defaultControls.minHeight ?? dimensions_panel_DEFAULT_CONTROLS.minHeight, 28698 panelId, 28699 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 28700 HeightControl, 28701 { 28702 label: (0,external_wp_i18n_namespaceObject.__)("Minimum height"), 28703 value: minHeightValue, 28704 onChange: setMinHeightValue 28705 } 28706 ) 28707 } 28708 ), 28709 showAspectRatioControl && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 28710 AspectRatioTool, 28711 { 28712 hasValue: hasAspectRatioValue, 28713 value: aspectRatioValue, 28714 onChange: setAspectRatioValue, 28715 panelId, 28716 isShownByDefault: defaultControls.aspectRatio ?? dimensions_panel_DEFAULT_CONTROLS.aspectRatio 28717 } 28718 ) 28719 ] 28720 } 28721 ); 28722 } 28723 28724 28725 ;// ./node_modules/@wordpress/block-editor/build-module/components/block-popover/use-popover-scroll.js 28726 28727 28728 const scrollContainerCache = /* @__PURE__ */ new WeakMap(); 28729 function usePopoverScroll(contentRef) { 28730 const effect = (0,external_wp_compose_namespaceObject.useRefEffect)( 28731 (node) => { 28732 function onWheel(event) { 28733 const { deltaX, deltaY, target } = event; 28734 const contentEl = contentRef.current; 28735 let scrollContainer = scrollContainerCache.get(contentEl); 28736 if (!scrollContainer) { 28737 scrollContainer = (0,external_wp_dom_namespaceObject.getScrollContainer)(contentEl); 28738 scrollContainerCache.set(contentEl, scrollContainer); 28739 } 28740 const eventScrollContainer = (0,external_wp_dom_namespaceObject.getScrollContainer)(target); 28741 if (!node.contains(eventScrollContainer)) { 28742 scrollContainer.scrollBy(deltaX, deltaY); 28743 } 28744 } 28745 const options = { passive: true }; 28746 node.addEventListener("wheel", onWheel, options); 28747 return () => { 28748 node.removeEventListener("wheel", onWheel, options); 28749 }; 28750 }, 28751 [contentRef] 28752 ); 28753 return contentRef ? effect : null; 28754 } 28755 var use_popover_scroll_default = usePopoverScroll; 28756 28757 28758 ;// ./node_modules/@wordpress/block-editor/build-module/utils/dom.js 28759 const BLOCK_SELECTOR = ".block-editor-block-list__block"; 28760 const APPENDER_SELECTOR = ".block-list-appender"; 28761 const BLOCK_APPENDER_CLASS = ".block-editor-button-block-appender"; 28762 function isInSameBlock(a, b) { 28763 return a.closest(BLOCK_SELECTOR) === b.closest(BLOCK_SELECTOR); 28764 } 28765 function isInsideRootBlock(blockElement, element) { 28766 const parentBlock = element.closest( 28767 [BLOCK_SELECTOR, APPENDER_SELECTOR, BLOCK_APPENDER_CLASS].join(",") 28768 ); 28769 return parentBlock === blockElement; 28770 } 28771 function getBlockClientId(node) { 28772 while (node && node.nodeType !== node.ELEMENT_NODE) { 28773 node = node.parentNode; 28774 } 28775 if (!node) { 28776 return; 28777 } 28778 const elementNode = ( 28779 /** @type {Element} */ 28780 node 28781 ); 28782 const blockNode = elementNode.closest(BLOCK_SELECTOR); 28783 if (!blockNode) { 28784 return; 28785 } 28786 return blockNode.id.slice("block-".length); 28787 } 28788 function rectUnion(rect1, rect2) { 28789 const left = Math.min(rect1.left, rect2.left); 28790 const right = Math.max(rect1.right, rect2.right); 28791 const bottom = Math.max(rect1.bottom, rect2.bottom); 28792 const top = Math.min(rect1.top, rect2.top); 28793 return new window.DOMRectReadOnly(left, top, right - left, bottom - top); 28794 } 28795 function isElementVisible(element) { 28796 const viewport = element.ownerDocument.defaultView; 28797 if (!viewport) { 28798 return false; 28799 } 28800 if (element.classList.contains("components-visually-hidden")) { 28801 return false; 28802 } 28803 const bounds = element.getBoundingClientRect(); 28804 if (bounds.width === 0 || bounds.height === 0) { 28805 return false; 28806 } 28807 if (element.checkVisibility) { 28808 return element.checkVisibility?.({ 28809 opacityProperty: true, 28810 contentVisibilityAuto: true, 28811 visibilityProperty: true 28812 }); 28813 } 28814 const style = viewport.getComputedStyle(element); 28815 if (style.display === "none" || style.visibility === "hidden" || style.opacity === "0") { 28816 return false; 28817 } 28818 return true; 28819 } 28820 function isScrollable(element) { 28821 const style = window.getComputedStyle(element); 28822 return style.overflowX === "auto" || style.overflowX === "scroll" || style.overflowY === "auto" || style.overflowY === "scroll"; 28823 } 28824 const WITH_OVERFLOW_ELEMENT_BLOCKS = ["core/navigation"]; 28825 function getElementBounds(element) { 28826 const viewport = element.ownerDocument.defaultView; 28827 if (!viewport) { 28828 return new window.DOMRectReadOnly(); 28829 } 28830 let bounds = element.getBoundingClientRect(); 28831 const dataType = element.getAttribute("data-type"); 28832 if (dataType && WITH_OVERFLOW_ELEMENT_BLOCKS.includes(dataType)) { 28833 const stack = [element]; 28834 let currentElement; 28835 while (currentElement = stack.pop()) { 28836 if (!isScrollable(currentElement)) { 28837 for (const child of currentElement.children) { 28838 if (isElementVisible(child)) { 28839 const childBounds = child.getBoundingClientRect(); 28840 bounds = rectUnion(bounds, childBounds); 28841 stack.push(child); 28842 } 28843 } 28844 } 28845 } 28846 } 28847 const left = Math.max(bounds.left, 0); 28848 const right = Math.min(bounds.right, viewport.innerWidth); 28849 bounds = new window.DOMRectReadOnly( 28850 left, 28851 bounds.top, 28852 right - left, 28853 bounds.height 28854 ); 28855 return bounds; 28856 } 28857 28858 28859 ;// ./node_modules/@wordpress/block-editor/build-module/components/block-popover/index.js 28860 28861 28862 28863 28864 28865 28866 28867 28868 const MAX_POPOVER_RECOMPUTE_COUNTER = Number.MAX_SAFE_INTEGER; 28869 function BlockPopover({ 28870 clientId, 28871 bottomClientId, 28872 children, 28873 __unstablePopoverSlot, 28874 __unstableContentRef, 28875 shift = true, 28876 ...props 28877 }, ref) { 28878 const selectedElement = useBlockElement(clientId); 28879 const lastSelectedElement = useBlockElement(bottomClientId ?? clientId); 28880 const mergedRefs = (0,external_wp_compose_namespaceObject.useMergeRefs)([ 28881 ref, 28882 use_popover_scroll_default(__unstableContentRef) 28883 ]); 28884 const [ 28885 popoverDimensionsRecomputeCounter, 28886 forceRecomputePopoverDimensions 28887 ] = (0,external_wp_element_namespaceObject.useReducer)( 28888 // Module is there to make sure that the counter doesn't overflow. 28889 (s) => (s + 1) % MAX_POPOVER_RECOMPUTE_COUNTER, 28890 0 28891 ); 28892 (0,external_wp_element_namespaceObject.useLayoutEffect)(() => { 28893 if (!selectedElement) { 28894 return; 28895 } 28896 const observer = new window.MutationObserver( 28897 forceRecomputePopoverDimensions 28898 ); 28899 observer.observe(selectedElement, { attributes: true }); 28900 return () => { 28901 observer.disconnect(); 28902 }; 28903 }, [selectedElement]); 28904 const popoverAnchor = (0,external_wp_element_namespaceObject.useMemo)(() => { 28905 if ( 28906 // popoverDimensionsRecomputeCounter is by definition always equal or greater 28907 // than 0. This check is only there to satisfy the correctness of the 28908 // exhaustive-deps rule for the `useMemo` hook. 28909 popoverDimensionsRecomputeCounter < 0 || !selectedElement || bottomClientId && !lastSelectedElement 28910 ) { 28911 return void 0; 28912 } 28913 return { 28914 getBoundingClientRect() { 28915 return lastSelectedElement ? rectUnion( 28916 getElementBounds(selectedElement), 28917 getElementBounds(lastSelectedElement) 28918 ) : getElementBounds(selectedElement); 28919 }, 28920 contextElement: selectedElement 28921 }; 28922 }, [ 28923 popoverDimensionsRecomputeCounter, 28924 selectedElement, 28925 bottomClientId, 28926 lastSelectedElement 28927 ]); 28928 if (!selectedElement || bottomClientId && !lastSelectedElement) { 28929 return null; 28930 } 28931 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 28932 external_wp_components_namespaceObject.Popover, 28933 { 28934 ref: mergedRefs, 28935 animate: false, 28936 focusOnMount: false, 28937 anchor: popoverAnchor, 28938 __unstableSlotName: __unstablePopoverSlot, 28939 inline: !__unstablePopoverSlot, 28940 placement: "top-start", 28941 resize: false, 28942 flip: false, 28943 shift, 28944 ...props, 28945 className: dist_clsx("block-editor-block-popover", props.className), 28946 variant: "unstyled", 28947 children 28948 } 28949 ); 28950 } 28951 const PrivateBlockPopover = (0,external_wp_element_namespaceObject.forwardRef)(BlockPopover); 28952 const PublicBlockPopover = ({ clientId, bottomClientId, children, ...props }, ref) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 28953 PrivateBlockPopover, 28954 { 28955 ...props, 28956 bottomClientId, 28957 clientId, 28958 __unstableContentRef: void 0, 28959 __unstablePopoverSlot: void 0, 28960 ref, 28961 children 28962 } 28963 ); 28964 var block_popover_default = (0,external_wp_element_namespaceObject.forwardRef)(PublicBlockPopover); 28965 28966 28967 ;// ./node_modules/@wordpress/block-editor/build-module/components/block-popover/cover.js 28968 28969 28970 28971 28972 function BlockPopoverCover({ 28973 clientId, 28974 bottomClientId, 28975 children, 28976 shift = false, 28977 additionalStyles, 28978 ...props 28979 }, ref) { 28980 bottomClientId ??= clientId; 28981 const selectedElement = useBlockElement(clientId); 28982 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 28983 PrivateBlockPopover, 28984 { 28985 ref, 28986 clientId, 28987 bottomClientId, 28988 shift, 28989 ...props, 28990 children: selectedElement && clientId === bottomClientId ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 28991 CoverContainer, 28992 { 28993 selectedElement, 28994 additionalStyles, 28995 children 28996 } 28997 ) : children 28998 } 28999 ); 29000 } 29001 function CoverContainer({ 29002 selectedElement, 29003 additionalStyles = {}, 29004 children 29005 }) { 29006 const [width, setWidth] = (0,external_wp_element_namespaceObject.useState)(selectedElement.offsetWidth); 29007 const [height, setHeight] = (0,external_wp_element_namespaceObject.useState)(selectedElement.offsetHeight); 29008 (0,external_wp_element_namespaceObject.useEffect)(() => { 29009 const observer = new window.ResizeObserver(() => { 29010 setWidth(selectedElement.offsetWidth); 29011 setHeight(selectedElement.offsetHeight); 29012 }); 29013 observer.observe(selectedElement, { box: "border-box" }); 29014 return () => observer.disconnect(); 29015 }, [selectedElement]); 29016 const style = (0,external_wp_element_namespaceObject.useMemo)(() => { 29017 return { 29018 position: "absolute", 29019 width, 29020 height, 29021 ...additionalStyles 29022 }; 29023 }, [width, height, additionalStyles]); 29024 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { style, children }); 29025 } 29026 var cover_default = (0,external_wp_element_namespaceObject.forwardRef)(BlockPopoverCover); 29027 29028 29029 ;// ./node_modules/@wordpress/block-editor/build-module/hooks/spacing-visualizer.js 29030 29031 29032 29033 29034 29035 function SpacingVisualizer({ clientId, value, computeStyle, forceShow }) { 29036 const blockElement = useBlockElement(clientId); 29037 const [style, updateStyle] = (0,external_wp_element_namespaceObject.useReducer)( 29038 () => computeStyle(blockElement) 29039 ); 29040 (0,external_wp_element_namespaceObject.useEffect)(() => { 29041 if (!blockElement) { 29042 return; 29043 } 29044 const observer = new window.MutationObserver(updateStyle); 29045 observer.observe(blockElement, { 29046 attributes: true, 29047 attributeFilter: ["style", "class"] 29048 }); 29049 return () => { 29050 observer.disconnect(); 29051 }; 29052 }, [blockElement]); 29053 const previousValueRef = (0,external_wp_element_namespaceObject.useRef)(value); 29054 const [isActive, setIsActive] = (0,external_wp_element_namespaceObject.useState)(false); 29055 (0,external_wp_element_namespaceObject.useEffect)(() => { 29056 if (external_wp_isShallowEqual_default()(value, previousValueRef.current) || forceShow) { 29057 return; 29058 } 29059 setIsActive(true); 29060 previousValueRef.current = value; 29061 const timeout = setTimeout(() => { 29062 setIsActive(false); 29063 }, 400); 29064 return () => { 29065 setIsActive(false); 29066 clearTimeout(timeout); 29067 }; 29068 }, [value, forceShow]); 29069 if (!isActive && !forceShow) { 29070 return null; 29071 } 29072 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 29073 cover_default, 29074 { 29075 clientId, 29076 __unstablePopoverSlot: "block-toolbar", 29077 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor__spacing-visualizer", style }) 29078 } 29079 ); 29080 } 29081 function getComputedCSS(element, property) { 29082 return element.ownerDocument.defaultView.getComputedStyle(element).getPropertyValue(property); 29083 } 29084 function MarginVisualizer({ clientId, value, forceShow }) { 29085 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 29086 SpacingVisualizer, 29087 { 29088 clientId, 29089 value: value?.spacing?.margin, 29090 computeStyle: (blockElement) => { 29091 const top = getComputedCSS(blockElement, "margin-top"); 29092 const right = getComputedCSS(blockElement, "margin-right"); 29093 const bottom = getComputedCSS(blockElement, "margin-bottom"); 29094 const left = getComputedCSS(blockElement, "margin-left"); 29095 return { 29096 borderTopWidth: top, 29097 borderRightWidth: right, 29098 borderBottomWidth: bottom, 29099 borderLeftWidth: left, 29100 top: top ? `-$top}` : 0, 29101 right: right ? `-$right}` : 0, 29102 bottom: bottom ? `-$bottom}` : 0, 29103 left: left ? `-$left}` : 0 29104 }; 29105 }, 29106 forceShow 29107 } 29108 ); 29109 } 29110 function PaddingVisualizer({ clientId, value, forceShow }) { 29111 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 29112 SpacingVisualizer, 29113 { 29114 clientId, 29115 value: value?.spacing?.padding, 29116 computeStyle: (blockElement) => ({ 29117 borderTopWidth: getComputedCSS(blockElement, "padding-top"), 29118 borderRightWidth: getComputedCSS( 29119 blockElement, 29120 "padding-right" 29121 ), 29122 borderBottomWidth: getComputedCSS( 29123 blockElement, 29124 "padding-bottom" 29125 ), 29126 borderLeftWidth: getComputedCSS(blockElement, "padding-left") 29127 }), 29128 forceShow 29129 } 29130 ); 29131 } 29132 29133 29134 ;// ./node_modules/@wordpress/block-editor/build-module/hooks/dimensions.js 29135 29136 29137 29138 29139 29140 29141 29142 29143 29144 29145 29146 29147 const DIMENSIONS_SUPPORT_KEY = "dimensions"; 29148 const SPACING_SUPPORT_KEY = "spacing"; 29149 const dimensions_ALL_SIDES = (/* unused pure expression or super */ null && (["top", "right", "bottom", "left"])); 29150 const dimensions_AXIAL_SIDES = (/* unused pure expression or super */ null && (["vertical", "horizontal"])); 29151 function useVisualizer() { 29152 const [property, setProperty] = (0,external_wp_element_namespaceObject.useState)(false); 29153 const { hideBlockInterface, showBlockInterface } = unlock( 29154 (0,external_wp_data_namespaceObject.useDispatch)(store) 29155 ); 29156 (0,external_wp_element_namespaceObject.useEffect)(() => { 29157 if (!property) { 29158 showBlockInterface(); 29159 } else { 29160 hideBlockInterface(); 29161 } 29162 }, [property, showBlockInterface, hideBlockInterface]); 29163 return [property, setProperty]; 29164 } 29165 function DimensionsInspectorControl({ children, resetAllFilter }) { 29166 const attributesResetAllFilter = (0,external_wp_element_namespaceObject.useCallback)( 29167 (attributes) => { 29168 const existingStyle = attributes.style; 29169 const updatedStyle = resetAllFilter(existingStyle); 29170 return { 29171 ...attributes, 29172 style: updatedStyle 29173 }; 29174 }, 29175 [resetAllFilter] 29176 ); 29177 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 29178 inspector_controls_default, 29179 { 29180 group: "dimensions", 29181 resetAllFilter: attributesResetAllFilter, 29182 children 29183 } 29184 ); 29185 } 29186 function dimensions_DimensionsPanel({ clientId, name, setAttributes, settings }) { 29187 const isEnabled = useHasDimensionsPanel(settings); 29188 const value = (0,external_wp_data_namespaceObject.useSelect)( 29189 (select) => select(store).getBlockAttributes(clientId)?.style, 29190 [clientId] 29191 ); 29192 const [visualizedProperty, setVisualizedProperty] = useVisualizer(); 29193 const onChange = (newStyle) => { 29194 setAttributes({ 29195 style: utils_cleanEmptyObject(newStyle) 29196 }); 29197 }; 29198 if (!isEnabled) { 29199 return null; 29200 } 29201 const defaultDimensionsControls = (0,external_wp_blocks_namespaceObject.getBlockSupport)(name, [ 29202 DIMENSIONS_SUPPORT_KEY, 29203 "__experimentalDefaultControls" 29204 ]); 29205 const defaultSpacingControls = (0,external_wp_blocks_namespaceObject.getBlockSupport)(name, [ 29206 SPACING_SUPPORT_KEY, 29207 "__experimentalDefaultControls" 29208 ]); 29209 const defaultControls = { 29210 ...defaultDimensionsControls, 29211 ...defaultSpacingControls 29212 }; 29213 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 29214 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 29215 DimensionsPanel, 29216 { 29217 as: DimensionsInspectorControl, 29218 panelId: clientId, 29219 settings, 29220 value, 29221 onChange, 29222 defaultControls, 29223 onVisualize: setVisualizedProperty 29224 } 29225 ), 29226 !!settings?.spacing?.padding && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 29227 PaddingVisualizer, 29228 { 29229 forceShow: visualizedProperty === "padding", 29230 clientId, 29231 value 29232 } 29233 ), 29234 !!settings?.spacing?.margin && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 29235 MarginVisualizer, 29236 { 29237 forceShow: visualizedProperty === "margin", 29238 clientId, 29239 value 29240 } 29241 ) 29242 ] }); 29243 } 29244 function hasDimensionsSupport(blockName, feature = "any") { 29245 if (external_wp_element_namespaceObject.Platform.OS !== "web") { 29246 return false; 29247 } 29248 const support = (0,external_wp_blocks_namespaceObject.getBlockSupport)(blockName, DIMENSIONS_SUPPORT_KEY); 29249 if (support === true) { 29250 return true; 29251 } 29252 if (feature === "any") { 29253 return !!(support?.aspectRatio || !!support?.minHeight); 29254 } 29255 return !!support?.[feature]; 29256 } 29257 var dimensions_default = { 29258 useBlockProps: dimensions_useBlockProps, 29259 attributeKeys: ["minHeight", "style"], 29260 hasSupport(name) { 29261 return hasDimensionsSupport(name, "aspectRatio"); 29262 } 29263 }; 29264 function dimensions_useBlockProps({ name, minHeight, style }) { 29265 if (!hasDimensionsSupport(name, "aspectRatio") || shouldSkipSerialization(name, DIMENSIONS_SUPPORT_KEY, "aspectRatio")) { 29266 return {}; 29267 } 29268 const className = dist_clsx({ 29269 "has-aspect-ratio": !!style?.dimensions?.aspectRatio 29270 }); 29271 const inlineStyleOverrides = {}; 29272 if (style?.dimensions?.aspectRatio) { 29273 inlineStyleOverrides.minHeight = "unset"; 29274 } else if (minHeight || style?.dimensions?.minHeight) { 29275 inlineStyleOverrides.aspectRatio = "unset"; 29276 } 29277 return { className, style: inlineStyleOverrides }; 29278 } 29279 function useCustomSides() { 29280 external_wp_deprecated_default()("wp.blockEditor.__experimentalUseCustomSides", { 29281 since: "6.3", 29282 version: "6.4" 29283 }); 29284 } 29285 29286 29287 ;// ./node_modules/@wordpress/block-editor/build-module/hooks/style.js 29288 29289 29290 29291 29292 29293 29294 29295 29296 29297 29298 29299 29300 29301 29302 const styleSupportKeys = [ 29303 ...TYPOGRAPHY_SUPPORT_KEYS, 29304 BORDER_SUPPORT_KEY, 29305 COLOR_SUPPORT_KEY, 29306 DIMENSIONS_SUPPORT_KEY, 29307 BACKGROUND_SUPPORT_KEY, 29308 SPACING_SUPPORT_KEY, 29309 SHADOW_SUPPORT_KEY 29310 ]; 29311 const hasStyleSupport = (nameOrType) => styleSupportKeys.some((key) => (0,external_wp_blocks_namespaceObject.hasBlockSupport)(nameOrType, key)); 29312 function getInlineStyles(styles = {}) { 29313 const output = {}; 29314 (0,external_wp_styleEngine_namespaceObject.getCSSRules)(styles).forEach((rule) => { 29315 output[rule.key] = rule.value; 29316 }); 29317 return output; 29318 } 29319 function style_addAttribute(settings) { 29320 if (!hasStyleSupport(settings)) { 29321 return settings; 29322 } 29323 if (!settings.attributes.style) { 29324 Object.assign(settings.attributes, { 29325 style: { 29326 type: "object" 29327 } 29328 }); 29329 } 29330 return settings; 29331 } 29332 const skipSerializationPathsEdit = { 29333 [`$BORDER_SUPPORT_KEY}.__experimentalSkipSerialization`]: ["border"], 29334 [`$COLOR_SUPPORT_KEY}.__experimentalSkipSerialization`]: [ 29335 COLOR_SUPPORT_KEY 29336 ], 29337 [`$TYPOGRAPHY_SUPPORT_KEY}.__experimentalSkipSerialization`]: [ 29338 TYPOGRAPHY_SUPPORT_KEY 29339 ], 29340 [`$DIMENSIONS_SUPPORT_KEY}.__experimentalSkipSerialization`]: [ 29341 DIMENSIONS_SUPPORT_KEY 29342 ], 29343 [`$SPACING_SUPPORT_KEY}.__experimentalSkipSerialization`]: [ 29344 SPACING_SUPPORT_KEY 29345 ], 29346 [`$SHADOW_SUPPORT_KEY}.__experimentalSkipSerialization`]: [ 29347 SHADOW_SUPPORT_KEY 29348 ] 29349 }; 29350 const skipSerializationPathsSave = { 29351 ...skipSerializationPathsEdit, 29352 [`$DIMENSIONS_SUPPORT_KEY}.aspectRatio`]: [ 29353 `$DIMENSIONS_SUPPORT_KEY}.aspectRatio` 29354 ], 29355 // Skip serialization of aspect ratio in save mode. 29356 [`$BACKGROUND_SUPPORT_KEY}`]: [BACKGROUND_SUPPORT_KEY] 29357 // Skip serialization of background support in save mode. 29358 }; 29359 const skipSerializationPathsSaveChecks = { 29360 [`$DIMENSIONS_SUPPORT_KEY}.aspectRatio`]: true, 29361 [`$BACKGROUND_SUPPORT_KEY}`]: true 29362 }; 29363 const renamedFeatures = { gradients: "gradient" }; 29364 function omitStyle(style, paths, preserveReference = false) { 29365 if (!style) { 29366 return style; 29367 } 29368 let newStyle = style; 29369 if (!preserveReference) { 29370 newStyle = JSON.parse(JSON.stringify(style)); 29371 } 29372 if (!Array.isArray(paths)) { 29373 paths = [paths]; 29374 } 29375 paths.forEach((path) => { 29376 if (!Array.isArray(path)) { 29377 path = path.split("."); 29378 } 29379 if (path.length > 1) { 29380 const [firstSubpath, ...restPath] = path; 29381 omitStyle(newStyle[firstSubpath], [restPath], true); 29382 } else if (path.length === 1) { 29383 delete newStyle[path[0]]; 29384 } 29385 }); 29386 return newStyle; 29387 } 29388 function style_addSaveProps(props, blockNameOrType, attributes, skipPaths = skipSerializationPathsSave) { 29389 if (!hasStyleSupport(blockNameOrType)) { 29390 return props; 29391 } 29392 let { style } = attributes; 29393 Object.entries(skipPaths).forEach(([indicator, path]) => { 29394 const skipSerialization = skipSerializationPathsSaveChecks[indicator] || (0,external_wp_blocks_namespaceObject.getBlockSupport)(blockNameOrType, indicator); 29395 if (skipSerialization === true) { 29396 style = omitStyle(style, path); 29397 } 29398 if (Array.isArray(skipSerialization)) { 29399 skipSerialization.forEach((featureName) => { 29400 const feature = renamedFeatures[featureName] || featureName; 29401 style = omitStyle(style, [[...path, feature]]); 29402 }); 29403 } 29404 }); 29405 props.style = { 29406 ...getInlineStyles(style), 29407 ...props.style 29408 }; 29409 return props; 29410 } 29411 function BlockStyleControls({ 29412 clientId, 29413 name, 29414 setAttributes, 29415 __unstableParentLayout 29416 }) { 29417 const settings = useBlockSettings(name, __unstableParentLayout); 29418 const blockEditingMode = useBlockEditingMode(); 29419 const passedProps = { 29420 clientId, 29421 name, 29422 setAttributes, 29423 settings: { 29424 ...settings, 29425 typography: { 29426 ...settings.typography, 29427 // The text alignment UI for individual blocks is rendered in 29428 // the block toolbar, so disable it here. 29429 textAlign: false 29430 } 29431 } 29432 }; 29433 if (blockEditingMode !== "default") { 29434 return null; 29435 } 29436 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 29437 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ColorEdit, { ...passedProps }), 29438 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(background_BackgroundImagePanel, { ...passedProps }), 29439 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(typography_TypographyPanel, { ...passedProps }), 29440 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(border_BorderPanel, { ...passedProps }), 29441 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(dimensions_DimensionsPanel, { ...passedProps }) 29442 ] }); 29443 } 29444 var style_default = { 29445 edit: BlockStyleControls, 29446 hasSupport: hasStyleSupport, 29447 addSaveProps: style_addSaveProps, 29448 attributeKeys: ["style"], 29449 useBlockProps: style_useBlockProps 29450 }; 29451 const elementTypes = [ 29452 { elementType: "button" }, 29453 { elementType: "link", pseudo: [":hover"] }, 29454 { 29455 elementType: "heading", 29456 elements: ["h1", "h2", "h3", "h4", "h5", "h6"] 29457 } 29458 ]; 29459 const STYLE_BLOCK_PROPS_REFERENCE = {}; 29460 function style_useBlockProps({ name, style }) { 29461 const blockElementsContainerIdentifier = (0,external_wp_compose_namespaceObject.useInstanceId)( 29462 STYLE_BLOCK_PROPS_REFERENCE, 29463 "wp-elements" 29464 ); 29465 const baseElementSelector = `.$blockElementsContainerIdentifier}`; 29466 const blockElementStyles = style?.elements; 29467 const styles = (0,external_wp_element_namespaceObject.useMemo)(() => { 29468 if (!blockElementStyles) { 29469 return; 29470 } 29471 const elementCSSRules = []; 29472 elementTypes.forEach(({ elementType, pseudo, elements }) => { 29473 const skipSerialization = shouldSkipSerialization( 29474 name, 29475 COLOR_SUPPORT_KEY, 29476 elementType 29477 ); 29478 if (skipSerialization) { 29479 return; 29480 } 29481 const elementStyles = blockElementStyles?.[elementType]; 29482 if (elementStyles) { 29483 const selector = scopeSelector( 29484 baseElementSelector, 29485 external_wp_blocks_namespaceObject.__EXPERIMENTAL_ELEMENTS[elementType] 29486 ); 29487 elementCSSRules.push( 29488 (0,external_wp_styleEngine_namespaceObject.compileCSS)(elementStyles, { selector }) 29489 ); 29490 if (pseudo) { 29491 pseudo.forEach((pseudoSelector) => { 29492 if (elementStyles[pseudoSelector]) { 29493 elementCSSRules.push( 29494 (0,external_wp_styleEngine_namespaceObject.compileCSS)(elementStyles[pseudoSelector], { 29495 selector: scopeSelector( 29496 baseElementSelector, 29497 `$external_wp_blocks_namespaceObject.__EXPERIMENTAL_ELEMENTS[elementType]}$pseudoSelector}` 29498 ) 29499 }) 29500 ); 29501 } 29502 }); 29503 } 29504 } 29505 if (elements) { 29506 elements.forEach((element) => { 29507 if (blockElementStyles[element]) { 29508 elementCSSRules.push( 29509 (0,external_wp_styleEngine_namespaceObject.compileCSS)(blockElementStyles[element], { 29510 selector: scopeSelector( 29511 baseElementSelector, 29512 external_wp_blocks_namespaceObject.__EXPERIMENTAL_ELEMENTS[element] 29513 ) 29514 }) 29515 ); 29516 } 29517 }); 29518 } 29519 }); 29520 return elementCSSRules.length > 0 ? elementCSSRules.join("") : void 0; 29521 }, [baseElementSelector, blockElementStyles, name]); 29522 useStyleOverride({ css: styles }); 29523 return style_addSaveProps( 29524 { className: blockElementsContainerIdentifier }, 29525 name, 29526 { style }, 29527 skipSerializationPathsEdit 29528 ); 29529 } 29530 (0,external_wp_hooks_namespaceObject.addFilter)( 29531 "blocks.registerBlockType", 29532 "core/style/addAttribute", 29533 style_addAttribute 29534 ); 29535 29536 29537 ;// ./node_modules/@wordpress/block-editor/build-module/hooks/settings.js 29538 29539 29540 const hasSettingsSupport = (blockType) => (0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockType, "__experimentalSettings", false); 29541 function settings_addAttribute(settings) { 29542 if (!hasSettingsSupport(settings)) { 29543 return settings; 29544 } 29545 if (!settings?.attributes?.settings) { 29546 settings.attributes = { 29547 ...settings.attributes, 29548 settings: { 29549 type: "object" 29550 } 29551 }; 29552 } 29553 return settings; 29554 } 29555 (0,external_wp_hooks_namespaceObject.addFilter)( 29556 "blocks.registerBlockType", 29557 "core/settings/addAttribute", 29558 settings_addAttribute 29559 ); 29560 29561 ;// ./node_modules/@wordpress/icons/build-module/library/filter.js 29562 29563 29564 var filter_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M12 4 4 19h16L12 4zm0 3.2 5.5 10.3H12V7.2z" }) }); 29565 29566 29567 ;// ./node_modules/@wordpress/block-editor/build-module/components/duotone-control/index.js 29568 29569 29570 29571 29572 29573 29574 function DuotoneControl({ 29575 id: idProp, 29576 colorPalette, 29577 duotonePalette, 29578 disableCustomColors, 29579 disableCustomDuotone, 29580 value, 29581 onChange 29582 }) { 29583 let toolbarIcon; 29584 if (value === "unset") { 29585 toolbarIcon = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ColorIndicator, { className: "block-editor-duotone-control__unset-indicator" }); 29586 } else if (value) { 29587 toolbarIcon = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.DuotoneSwatch, { values: value }); 29588 } else { 29589 toolbarIcon = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(icon_default, { icon: filter_default }); 29590 } 29591 const actionLabel = (0,external_wp_i18n_namespaceObject.__)("Apply duotone filter"); 29592 const id = (0,external_wp_compose_namespaceObject.useInstanceId)(DuotoneControl, "duotone-control", idProp); 29593 const descriptionId = `$id}__description`; 29594 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 29595 external_wp_components_namespaceObject.Dropdown, 29596 { 29597 popoverProps: { 29598 className: "block-editor-duotone-control__popover", 29599 headerTitle: (0,external_wp_i18n_namespaceObject.__)("Duotone") 29600 }, 29601 renderToggle: ({ isOpen, onToggle }) => { 29602 const openOnArrowDown = (event) => { 29603 if (!isOpen && event.keyCode === external_wp_keycodes_namespaceObject.DOWN) { 29604 event.preventDefault(); 29605 onToggle(); 29606 } 29607 }; 29608 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 29609 external_wp_components_namespaceObject.ToolbarButton, 29610 { 29611 showTooltip: true, 29612 onClick: onToggle, 29613 "aria-haspopup": "true", 29614 "aria-expanded": isOpen, 29615 onKeyDown: openOnArrowDown, 29616 label: actionLabel, 29617 icon: toolbarIcon 29618 } 29619 ); 29620 }, 29621 renderContent: () => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.MenuGroup, { label: (0,external_wp_i18n_namespaceObject.__)("Duotone"), children: [ 29622 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { children: (0,external_wp_i18n_namespaceObject.__)( 29623 "Create a two-tone color effect without losing your original image." 29624 ) }), 29625 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 29626 external_wp_components_namespaceObject.DuotonePicker, 29627 { 29628 "aria-label": actionLabel, 29629 "aria-describedby": descriptionId, 29630 colorPalette, 29631 duotonePalette, 29632 disableCustomColors, 29633 disableCustomDuotone, 29634 value, 29635 onChange 29636 } 29637 ) 29638 ] }) 29639 } 29640 ); 29641 } 29642 var duotone_control_default = DuotoneControl; 29643 29644 29645 ;// ./node_modules/@wordpress/block-editor/build-module/components/duotone/utils.js 29646 29647 function getValuesFromColors(colors = []) { 29648 const values = { r: [], g: [], b: [], a: [] }; 29649 colors.forEach((color) => { 29650 const rgbColor = w(color).toRgb(); 29651 values.r.push(rgbColor.r / 255); 29652 values.g.push(rgbColor.g / 255); 29653 values.b.push(rgbColor.b / 255); 29654 values.a.push(rgbColor.a); 29655 }); 29656 return values; 29657 } 29658 function getDuotoneUnsetStylesheet(selector) { 29659 return `$selector}{filter:none}`; 29660 } 29661 function getDuotoneStylesheet(selector, id) { 29662 return `$selector}{filter:url(#$id})}`; 29663 } 29664 function getDuotoneFilter(id, colors) { 29665 const values = getValuesFromColors(colors); 29666 return ` 29667 <svg 29668 xmlns:xlink="http://www.w3.org/1999/xlink" 29669 viewBox="0 0 0 0" 29670 width="0" 29671 height="0" 29672 focusable="false" 29673 role="none" 29674 aria-hidden="true" 29675 style="visibility: hidden; position: absolute; left: -9999px; overflow: hidden;" 29676 > 29677 <defs> 29678 <filter id="$id}"> 29679 <!-- 29680 Use sRGB instead of linearRGB so transparency looks correct. 29681 Use perceptual brightness to convert to grayscale. 29682 --> 29683 <feColorMatrix color-interpolation-filters="sRGB" type="matrix" values=" .299 .587 .114 0 0 .299 .587 .114 0 0 .299 .587 .114 0 0 .299 .587 .114 0 0 "></feColorMatrix> 29684 <!-- Use sRGB instead of linearRGB to be consistent with how CSS gradients work. --> 29685 <feComponentTransfer color-interpolation-filters="sRGB"> 29686 <feFuncR type="table" tableValues="$values.r.join(" ")}"></feFuncR> 29687 <feFuncG type="table" tableValues="$values.g.join(" ")}"></feFuncG> 29688 <feFuncB type="table" tableValues="$values.b.join(" ")}"></feFuncB> 29689 <feFuncA type="table" tableValues="$values.a.join(" ")}"></feFuncA> 29690 </feComponentTransfer> 29691 <!-- Re-mask the image with the original transparency since the feColorMatrix above loses that information. --> 29692 <feComposite in2="SourceGraphic" operator="in"></feComposite> 29693 </filter> 29694 </defs> 29695 </svg>`; 29696 } 29697 29698 29699 ;// ./node_modules/@wordpress/block-editor/build-module/components/global-styles/get-block-css-selector.js 29700 29701 29702 function getBlockCSSSelector(blockType, target = "root", options = {}) { 29703 if (!target) { 29704 return null; 29705 } 29706 const { fallback = false } = options; 29707 const { name, selectors, supports } = blockType; 29708 const hasSelectors = selectors && Object.keys(selectors).length > 0; 29709 const path = Array.isArray(target) ? target.join(".") : target; 29710 let rootSelector = null; 29711 if (hasSelectors && selectors.root) { 29712 rootSelector = selectors?.root; 29713 } else if (supports?.__experimentalSelector) { 29714 rootSelector = supports.__experimentalSelector; 29715 } else { 29716 rootSelector = ".wp-block-" + name.replace("core/", "").replace("/", "-"); 29717 } 29718 if (path === "root") { 29719 return rootSelector; 29720 } 29721 const pathArray = Array.isArray(target) ? target : target.split("."); 29722 if (pathArray.length === 1) { 29723 const fallbackSelector = fallback ? rootSelector : null; 29724 if (hasSelectors) { 29725 const featureSelector2 = getValueFromObjectPath(selectors, `$path}.root`, null) || getValueFromObjectPath(selectors, path, null); 29726 return featureSelector2 || fallbackSelector; 29727 } 29728 const featureSelector = getValueFromObjectPath( 29729 supports, 29730 `$path}.__experimentalSelector`, 29731 null 29732 ); 29733 if (!featureSelector) { 29734 return fallbackSelector; 29735 } 29736 return scopeSelector(rootSelector, featureSelector); 29737 } 29738 let subfeatureSelector; 29739 if (hasSelectors) { 29740 subfeatureSelector = getValueFromObjectPath(selectors, path, null); 29741 } 29742 if (subfeatureSelector) { 29743 return subfeatureSelector; 29744 } 29745 if (fallback) { 29746 return getBlockCSSSelector(blockType, pathArray[0], options); 29747 } 29748 return null; 29749 } 29750 29751 29752 ;// ./node_modules/@wordpress/block-editor/build-module/components/global-styles/filters-panel.js 29753 29754 29755 29756 29757 29758 29759 29760 29761 const filters_panel_EMPTY_ARRAY = []; 29762 function useMultiOriginColorPresets(settings, { presetSetting, defaultSetting }) { 29763 const disableDefault = !settings?.color?.[defaultSetting]; 29764 const userPresets = settings?.color?.[presetSetting]?.custom || filters_panel_EMPTY_ARRAY; 29765 const themePresets = settings?.color?.[presetSetting]?.theme || filters_panel_EMPTY_ARRAY; 29766 const defaultPresets = settings?.color?.[presetSetting]?.default || filters_panel_EMPTY_ARRAY; 29767 return (0,external_wp_element_namespaceObject.useMemo)( 29768 () => [ 29769 ...userPresets, 29770 ...themePresets, 29771 ...disableDefault ? filters_panel_EMPTY_ARRAY : defaultPresets 29772 ], 29773 [disableDefault, userPresets, themePresets, defaultPresets] 29774 ); 29775 } 29776 function useHasFiltersPanel(settings) { 29777 return useHasDuotoneControl(settings); 29778 } 29779 function useHasDuotoneControl(settings) { 29780 return settings.color.customDuotone || settings.color.defaultDuotone || settings.color.duotone.length > 0; 29781 } 29782 function FiltersToolsPanel({ 29783 resetAllFilter, 29784 onChange, 29785 value, 29786 panelId, 29787 children 29788 }) { 29789 const dropdownMenuProps = useToolsPanelDropdownMenuProps(); 29790 const resetAll = () => { 29791 const updatedValue = resetAllFilter(value); 29792 onChange(updatedValue); 29793 }; 29794 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 29795 external_wp_components_namespaceObject.__experimentalToolsPanel, 29796 { 29797 label: (0,external_wp_i18n_namespaceObject._x)("Filters", "Name for applying graphical effects"), 29798 resetAll, 29799 panelId, 29800 dropdownMenuProps, 29801 children 29802 } 29803 ); 29804 } 29805 const filters_panel_DEFAULT_CONTROLS = { 29806 duotone: true 29807 }; 29808 const filters_panel_popoverProps = { 29809 placement: "left-start", 29810 offset: 36, 29811 shift: true, 29812 className: "block-editor-duotone-control__popover", 29813 headerTitle: (0,external_wp_i18n_namespaceObject.__)("Duotone") 29814 }; 29815 const LabeledColorIndicator = ({ indicator, label }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "flex-start", children: [ 29816 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalZStack, { isLayered: false, offset: -8, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Flex, { expanded: false, children: indicator === "unset" || !indicator ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ColorIndicator, { className: "block-editor-duotone-control__unset-indicator" }) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.DuotoneSwatch, { values: indicator }) }) }), 29817 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { title: label, children: label }) 29818 ] }); 29819 const renderToggle = (duotone, resetDuotone) => ({ onToggle, isOpen }) => { 29820 const duotoneButtonRef = (0,external_wp_element_namespaceObject.useRef)(void 0); 29821 const toggleProps = { 29822 onClick: onToggle, 29823 className: dist_clsx( 29824 "block-editor-global-styles-filters-panel__dropdown-toggle", 29825 { "is-open": isOpen } 29826 ), 29827 "aria-expanded": isOpen, 29828 ref: duotoneButtonRef 29829 }; 29830 const removeButtonProps = { 29831 onClick: () => { 29832 if (isOpen) { 29833 onToggle(); 29834 } 29835 resetDuotone(); 29836 duotoneButtonRef.current?.focus(); 29837 }, 29838 className: "block-editor-panel-duotone-settings__reset", 29839 label: (0,external_wp_i18n_namespaceObject.__)("Reset") 29840 }; 29841 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 29842 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, ...toggleProps, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 29843 LabeledColorIndicator, 29844 { 29845 indicator: duotone, 29846 label: (0,external_wp_i18n_namespaceObject.__)("Duotone") 29847 } 29848 ) }), 29849 duotone && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 29850 external_wp_components_namespaceObject.Button, 29851 { 29852 size: "small", 29853 icon: reset_default, 29854 ...removeButtonProps 29855 } 29856 ) 29857 ] }); 29858 }; 29859 function FiltersPanel({ 29860 as: Wrapper = FiltersToolsPanel, 29861 value, 29862 onChange, 29863 inheritedValue = value, 29864 settings, 29865 panelId, 29866 defaultControls = filters_panel_DEFAULT_CONTROLS 29867 }) { 29868 const decodeValue = (rawValue) => getValueFromVariable({ settings }, "", rawValue); 29869 const hasDuotoneEnabled = useHasDuotoneControl(settings); 29870 const duotonePalette = useMultiOriginColorPresets(settings, { 29871 presetSetting: "duotone", 29872 defaultSetting: "defaultDuotone" 29873 }); 29874 const colorPalette = useMultiOriginColorPresets(settings, { 29875 presetSetting: "palette", 29876 defaultSetting: "defaultPalette" 29877 }); 29878 const duotone = decodeValue(inheritedValue?.filter?.duotone); 29879 const setDuotone = (newValue) => { 29880 const duotonePreset = duotonePalette.find(({ colors }) => { 29881 return colors === newValue; 29882 }); 29883 const duotoneValue = duotonePreset ? `var:preset|duotone|$duotonePreset.slug}` : newValue; 29884 onChange( 29885 setImmutably(value, ["filter", "duotone"], duotoneValue) 29886 ); 29887 }; 29888 const hasDuotone = () => !!value?.filter?.duotone; 29889 const resetDuotone = () => setDuotone(void 0); 29890 const resetAllFilter = (0,external_wp_element_namespaceObject.useCallback)((previousValue) => { 29891 return { 29892 ...previousValue, 29893 filter: { 29894 ...previousValue.filter, 29895 duotone: void 0 29896 } 29897 }; 29898 }, []); 29899 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 29900 Wrapper, 29901 { 29902 resetAllFilter, 29903 value, 29904 onChange, 29905 panelId, 29906 children: hasDuotoneEnabled && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 29907 external_wp_components_namespaceObject.__experimentalToolsPanelItem, 29908 { 29909 label: (0,external_wp_i18n_namespaceObject.__)("Duotone"), 29910 hasValue: hasDuotone, 29911 onDeselect: resetDuotone, 29912 isShownByDefault: defaultControls.duotone, 29913 panelId, 29914 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 29915 external_wp_components_namespaceObject.Dropdown, 29916 { 29917 popoverProps: filters_panel_popoverProps, 29918 className: "block-editor-global-styles-filters-panel__dropdown", 29919 renderToggle: renderToggle(duotone, resetDuotone), 29920 renderContent: () => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalDropdownContentWrapper, { paddingSize: "small", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.MenuGroup, { label: (0,external_wp_i18n_namespaceObject.__)("Duotone"), children: [ 29921 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { children: (0,external_wp_i18n_namespaceObject.__)( 29922 "Create a two-tone color effect without losing your original image." 29923 ) }), 29924 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 29925 external_wp_components_namespaceObject.DuotonePicker, 29926 { 29927 colorPalette, 29928 duotonePalette, 29929 disableCustomColors: true, 29930 disableCustomDuotone: true, 29931 value: duotone, 29932 onChange: setDuotone 29933 } 29934 ) 29935 ] }) }) 29936 } 29937 ) 29938 } 29939 ) 29940 } 29941 ); 29942 } 29943 29944 29945 ;// ./node_modules/@wordpress/block-editor/build-module/hooks/duotone.js 29946 29947 29948 29949 29950 29951 29952 29953 29954 29955 29956 29957 29958 29959 29960 29961 const duotone_EMPTY_ARRAY = []; 29962 const isSafari = window?.navigator.userAgent && window.navigator.userAgent.includes("Safari") && !window.navigator.userAgent.includes("Chrome") && !window.navigator.userAgent.includes("Chromium"); 29963 k([names]); 29964 function useMultiOriginPresets({ presetSetting, defaultSetting }) { 29965 const [enableDefault, userPresets, themePresets, defaultPresets] = use_settings_useSettings( 29966 defaultSetting, 29967 `$presetSetting}.custom`, 29968 `$presetSetting}.theme`, 29969 `$presetSetting}.default` 29970 ); 29971 return (0,external_wp_element_namespaceObject.useMemo)( 29972 () => [ 29973 ...userPresets || duotone_EMPTY_ARRAY, 29974 ...themePresets || duotone_EMPTY_ARRAY, 29975 ...enableDefault && defaultPresets || duotone_EMPTY_ARRAY 29976 ], 29977 [enableDefault, userPresets, themePresets, defaultPresets] 29978 ); 29979 } 29980 function getColorsFromDuotonePreset(duotone, duotonePalette) { 29981 if (!duotone) { 29982 return; 29983 } 29984 const preset = duotonePalette?.find(({ slug }) => { 29985 return duotone === `var:preset|duotone|$slug}`; 29986 }); 29987 return preset ? preset.colors : void 0; 29988 } 29989 function getDuotonePresetFromColors(colors, duotonePalette) { 29990 if (!colors || !Array.isArray(colors)) { 29991 return; 29992 } 29993 const preset = duotonePalette?.find((duotonePreset) => { 29994 return duotonePreset?.colors?.every( 29995 (val, index) => val === colors[index] 29996 ); 29997 }); 29998 return preset ? `var:preset|duotone|$preset.slug}` : void 0; 29999 } 30000 function DuotonePanelPure({ style, setAttributes, name }) { 30001 const duotoneStyle = style?.color?.duotone; 30002 const settings = useBlockSettings(name); 30003 const blockEditingMode = useBlockEditingMode(); 30004 const duotonePalette = useMultiOriginPresets({ 30005 presetSetting: "color.duotone", 30006 defaultSetting: "color.defaultDuotone" 30007 }); 30008 const colorPalette = useMultiOriginPresets({ 30009 presetSetting: "color.palette", 30010 defaultSetting: "color.defaultPalette" 30011 }); 30012 const [enableCustomColors, enableCustomDuotone] = use_settings_useSettings( 30013 "color.custom", 30014 "color.customDuotone" 30015 ); 30016 const disableCustomColors = !enableCustomColors; 30017 const disableCustomDuotone = !enableCustomDuotone || colorPalette?.length === 0 && disableCustomColors; 30018 if (duotonePalette?.length === 0 && disableCustomDuotone) { 30019 return null; 30020 } 30021 if (blockEditingMode !== "default") { 30022 return null; 30023 } 30024 const duotonePresetOrColors = duotoneStyle === "unset" || Array.isArray(duotoneStyle) ? duotoneStyle : getColorsFromDuotonePreset(duotoneStyle, duotonePalette); 30025 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 30026 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls_default, { group: "filter", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 30027 FiltersPanel, 30028 { 30029 value: { filter: { duotone: duotonePresetOrColors } }, 30030 onChange: (newDuotone) => { 30031 const newStyle = { 30032 ...style, 30033 color: { 30034 ...newDuotone?.filter 30035 } 30036 }; 30037 setAttributes({ 30038 style: utils_cleanEmptyObject(newStyle) 30039 }); 30040 }, 30041 settings 30042 } 30043 ) }), 30044 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(block_controls_default, { group: "block", __experimentalShareWithChildBlocks: true, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 30045 duotone_control_default, 30046 { 30047 duotonePalette, 30048 colorPalette, 30049 disableCustomDuotone, 30050 disableCustomColors, 30051 value: duotonePresetOrColors, 30052 onChange: (newDuotone) => { 30053 const maybePreset = getDuotonePresetFromColors( 30054 newDuotone, 30055 duotonePalette 30056 ); 30057 const newStyle = { 30058 ...style, 30059 color: { 30060 ...style?.color, 30061 duotone: maybePreset ?? newDuotone 30062 // use preset or fallback to custom colors. 30063 } 30064 }; 30065 setAttributes({ 30066 style: utils_cleanEmptyObject(newStyle) 30067 }); 30068 }, 30069 settings 30070 } 30071 ) }) 30072 ] }); 30073 } 30074 var duotone_default = { 30075 shareWithChildBlocks: true, 30076 edit: DuotonePanelPure, 30077 useBlockProps: duotone_useBlockProps, 30078 attributeKeys: ["style"], 30079 hasSupport(name) { 30080 return (0,external_wp_blocks_namespaceObject.hasBlockSupport)(name, "filter.duotone"); 30081 } 30082 }; 30083 function addDuotoneAttributes(settings) { 30084 if (!(0,external_wp_blocks_namespaceObject.hasBlockSupport)(settings, "filter.duotone")) { 30085 return settings; 30086 } 30087 if (!settings.attributes.style) { 30088 Object.assign(settings.attributes, { 30089 style: { 30090 type: "object" 30091 } 30092 }); 30093 } 30094 return settings; 30095 } 30096 function useDuotoneStyles({ 30097 clientId, 30098 id: filterId, 30099 selector: duotoneSelector, 30100 attribute: duotoneAttr 30101 }) { 30102 const duotonePalette = useMultiOriginPresets({ 30103 presetSetting: "color.duotone", 30104 defaultSetting: "color.defaultDuotone" 30105 }); 30106 const isCustom = Array.isArray(duotoneAttr); 30107 const duotonePreset = isCustom ? void 0 : getColorsFromDuotonePreset(duotoneAttr, duotonePalette); 30108 const isPreset = typeof duotoneAttr === "string" && duotonePreset; 30109 const isCSS = typeof duotoneAttr === "string" && !isPreset; 30110 let colors = null; 30111 if (isPreset) { 30112 colors = duotonePreset; 30113 } else if (isCSS) { 30114 colors = duotoneAttr; 30115 } else if (isCustom) { 30116 colors = duotoneAttr; 30117 } 30118 const selectors = duotoneSelector.split(","); 30119 const selectorsScoped = selectors.map((selectorPart) => { 30120 return `.$filterId}$selectorPart.trim()}`; 30121 }); 30122 const selector = selectorsScoped.join(", "); 30123 const isValidFilter = Array.isArray(colors) || colors === "unset"; 30124 usePrivateStyleOverride( 30125 isValidFilter ? { 30126 css: colors !== "unset" ? getDuotoneStylesheet(selector, filterId) : getDuotoneUnsetStylesheet(selector), 30127 __unstableType: "presets" 30128 } : void 0 30129 ); 30130 usePrivateStyleOverride( 30131 isValidFilter ? { 30132 assets: colors !== "unset" ? getDuotoneFilter(filterId, colors) : "", 30133 __unstableType: "svgs" 30134 } : void 0 30135 ); 30136 const blockElement = useBlockElement(clientId); 30137 (0,external_wp_element_namespaceObject.useEffect)(() => { 30138 if (!isValidFilter) { 30139 return; 30140 } 30141 if (blockElement && isSafari) { 30142 const display = blockElement.style.display; 30143 blockElement.style.setProperty("display", "inline-block"); 30144 blockElement.offsetHeight; 30145 blockElement.style.setProperty("display", display); 30146 } 30147 }, [isValidFilter, blockElement, colors]); 30148 } 30149 const DUOTONE_BLOCK_PROPS_REFERENCE = {}; 30150 function duotone_useBlockProps({ clientId, name, style }) { 30151 const id = (0,external_wp_compose_namespaceObject.useInstanceId)(DUOTONE_BLOCK_PROPS_REFERENCE); 30152 const selector = (0,external_wp_element_namespaceObject.useMemo)(() => { 30153 const blockType = (0,external_wp_blocks_namespaceObject.getBlockType)(name); 30154 if (blockType) { 30155 const duotoneSupport = (0,external_wp_blocks_namespaceObject.getBlockSupport)( 30156 blockType, 30157 "filter.duotone", 30158 false 30159 ); 30160 if (!duotoneSupport) { 30161 return null; 30162 } 30163 const experimentalDuotone = (0,external_wp_blocks_namespaceObject.getBlockSupport)( 30164 blockType, 30165 "color.__experimentalDuotone", 30166 false 30167 ); 30168 if (experimentalDuotone) { 30169 const rootSelector = getBlockCSSSelector(blockType); 30170 return typeof experimentalDuotone === "string" ? scopeSelector(rootSelector, experimentalDuotone) : rootSelector; 30171 } 30172 return getBlockCSSSelector(blockType, "filter.duotone", { 30173 fallback: true 30174 }); 30175 } 30176 }, [name]); 30177 const attribute = style?.color?.duotone; 30178 const filterClass = `wp-duotone-$id}`; 30179 const shouldRender = selector && attribute; 30180 useDuotoneStyles({ 30181 clientId, 30182 id: filterClass, 30183 selector, 30184 attribute 30185 }); 30186 return { 30187 className: shouldRender ? filterClass : "" 30188 }; 30189 } 30190 (0,external_wp_hooks_namespaceObject.addFilter)( 30191 "blocks.registerBlockType", 30192 "core/editor/duotone/add-attributes", 30193 addDuotoneAttributes 30194 ); 30195 30196 30197 ;// ./node_modules/@wordpress/block-editor/build-module/components/use-block-display-information/index.js 30198 30199 30200 30201 30202 function getPositionTypeLabel(attributes) { 30203 const positionType = attributes?.style?.position?.type; 30204 if (positionType === "sticky") { 30205 return (0,external_wp_i18n_namespaceObject.__)("Sticky"); 30206 } 30207 if (positionType === "fixed") { 30208 return (0,external_wp_i18n_namespaceObject.__)("Fixed"); 30209 } 30210 return null; 30211 } 30212 function useBlockDisplayInformation(clientId) { 30213 return (0,external_wp_data_namespaceObject.useSelect)( 30214 (select) => { 30215 if (!clientId) { 30216 return null; 30217 } 30218 const { getBlockName, getBlockAttributes } = select(store); 30219 const { getBlockType, getActiveBlockVariation } = select(external_wp_blocks_namespaceObject.store); 30220 const blockName = getBlockName(clientId); 30221 const blockType = getBlockType(blockName); 30222 if (!blockType) { 30223 return null; 30224 } 30225 const attributes = getBlockAttributes(clientId); 30226 const match = getActiveBlockVariation(blockName, attributes); 30227 const isSynced = (0,external_wp_blocks_namespaceObject.isReusableBlock)(blockType) || (0,external_wp_blocks_namespaceObject.isTemplatePart)(blockType); 30228 const syncedTitle = isSynced ? (0,external_wp_blocks_namespaceObject.__experimentalGetBlockLabel)(blockType, attributes) : void 0; 30229 const title = syncedTitle || blockType.title; 30230 const positionLabel = getPositionTypeLabel(attributes); 30231 const blockTypeInfo = { 30232 isSynced, 30233 title, 30234 icon: blockType.icon, 30235 description: blockType.description, 30236 anchor: attributes?.anchor, 30237 positionLabel, 30238 positionType: attributes?.style?.position?.type, 30239 name: attributes?.metadata?.name 30240 }; 30241 if (!match) { 30242 return blockTypeInfo; 30243 } 30244 return { 30245 isSynced, 30246 title: match.title || blockType.title, 30247 icon: match.icon || blockType.icon, 30248 description: match.description || blockType.description, 30249 anchor: attributes?.anchor, 30250 positionLabel, 30251 positionType: attributes?.style?.position?.type, 30252 name: attributes?.metadata?.name 30253 }; 30254 }, 30255 [clientId] 30256 ); 30257 } 30258 30259 30260 ;// ./node_modules/@wordpress/block-editor/build-module/hooks/position.js 30261 30262 30263 30264 30265 30266 30267 30268 30269 30270 30271 30272 30273 30274 const POSITION_SUPPORT_KEY = "position"; 30275 const DEFAULT_OPTION = { 30276 key: "default", 30277 value: "", 30278 name: (0,external_wp_i18n_namespaceObject.__)("Default") 30279 }; 30280 const STICKY_OPTION = { 30281 key: "sticky", 30282 value: "sticky", 30283 name: (0,external_wp_i18n_namespaceObject._x)("Sticky", "Name for the value of the CSS position property"), 30284 hint: (0,external_wp_i18n_namespaceObject.__)( 30285 "The block will stick to the top of the window instead of scrolling." 30286 ) 30287 }; 30288 const FIXED_OPTION = { 30289 key: "fixed", 30290 value: "fixed", 30291 name: (0,external_wp_i18n_namespaceObject._x)("Fixed", "Name for the value of the CSS position property"), 30292 hint: (0,external_wp_i18n_namespaceObject.__)("The block will not move when the page is scrolled.") 30293 }; 30294 const POSITION_SIDES = ["top", "right", "bottom", "left"]; 30295 const VALID_POSITION_TYPES = ["sticky", "fixed"]; 30296 function getPositionCSS({ selector, style }) { 30297 let output = ""; 30298 const { type: positionType } = style?.position || {}; 30299 if (!VALID_POSITION_TYPES.includes(positionType)) { 30300 return output; 30301 } 30302 output += `$selector} {`; 30303 output += `position: $positionType};`; 30304 POSITION_SIDES.forEach((side) => { 30305 if (style?.position?.[side] !== void 0) { 30306 output += `$side}: $style.position[side]};`; 30307 } 30308 }); 30309 if (positionType === "sticky" || positionType === "fixed") { 30310 output += `z-index: 10`; 30311 } 30312 output += `}`; 30313 return output; 30314 } 30315 function hasStickyPositionSupport(blockType) { 30316 const support = (0,external_wp_blocks_namespaceObject.getBlockSupport)(blockType, POSITION_SUPPORT_KEY); 30317 return !!(true === support || support?.sticky); 30318 } 30319 function hasFixedPositionSupport(blockType) { 30320 const support = (0,external_wp_blocks_namespaceObject.getBlockSupport)(blockType, POSITION_SUPPORT_KEY); 30321 return !!(true === support || support?.fixed); 30322 } 30323 function hasPositionSupport(blockType) { 30324 const support = (0,external_wp_blocks_namespaceObject.getBlockSupport)(blockType, POSITION_SUPPORT_KEY); 30325 return !!support; 30326 } 30327 function hasPositionValue(props) { 30328 return props.attributes.style?.position?.type !== void 0; 30329 } 30330 function hasStickyOrFixedPositionValue(attributes) { 30331 const positionType = attributes?.style?.position?.type; 30332 return positionType === "sticky" || positionType === "fixed"; 30333 } 30334 function resetPosition({ attributes = {}, setAttributes }) { 30335 const { style = {} } = attributes; 30336 setAttributes({ 30337 style: cleanEmptyObject({ 30338 ...style, 30339 position: { 30340 ...style?.position, 30341 type: void 0, 30342 top: void 0, 30343 right: void 0, 30344 bottom: void 0, 30345 left: void 0 30346 } 30347 }) 30348 }); 30349 } 30350 function useIsPositionDisabled({ name: blockName } = {}) { 30351 const [allowFixed, allowSticky] = use_settings_useSettings( 30352 "position.fixed", 30353 "position.sticky" 30354 ); 30355 const isDisabled = !allowFixed && !allowSticky; 30356 return !hasPositionSupport(blockName) || isDisabled; 30357 } 30358 function PositionPanelPure({ 30359 style = {}, 30360 clientId, 30361 name: blockName, 30362 setAttributes 30363 }) { 30364 const allowFixed = hasFixedPositionSupport(blockName); 30365 const allowSticky = hasStickyPositionSupport(blockName); 30366 const value = style?.position?.type; 30367 const { firstParentClientId } = (0,external_wp_data_namespaceObject.useSelect)( 30368 (select) => { 30369 const { getBlockParents } = select(store); 30370 const parents = getBlockParents(clientId); 30371 return { firstParentClientId: parents[parents.length - 1] }; 30372 }, 30373 [clientId] 30374 ); 30375 const blockInformation = useBlockDisplayInformation(firstParentClientId); 30376 const stickyHelpText = allowSticky && value === STICKY_OPTION.value && blockInformation ? (0,external_wp_i18n_namespaceObject.sprintf)( 30377 /* translators: %s: the name of the parent block. */ 30378 (0,external_wp_i18n_namespaceObject.__)( 30379 "The block will stick to the scrollable area of the parent %s block." 30380 ), 30381 blockInformation.title 30382 ) : null; 30383 const options = (0,external_wp_element_namespaceObject.useMemo)(() => { 30384 const availableOptions = [DEFAULT_OPTION]; 30385 if (allowSticky || value === STICKY_OPTION.value) { 30386 availableOptions.push(STICKY_OPTION); 30387 } 30388 if (allowFixed || value === FIXED_OPTION.value) { 30389 availableOptions.push(FIXED_OPTION); 30390 } 30391 return availableOptions; 30392 }, [allowFixed, allowSticky, value]); 30393 const onChangeType = (next) => { 30394 const placementValue = "0px"; 30395 const newStyle = { 30396 ...style, 30397 position: { 30398 ...style?.position, 30399 type: next, 30400 top: next === "sticky" || next === "fixed" ? placementValue : void 0 30401 } 30402 }; 30403 setAttributes({ 30404 style: utils_cleanEmptyObject(newStyle) 30405 }); 30406 }; 30407 const selectedOption = value ? options.find((option) => option.value === value) || DEFAULT_OPTION : DEFAULT_OPTION; 30408 return external_wp_element_namespaceObject.Platform.select({ 30409 web: options.length > 1 ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls_default, { group: "position", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 30410 external_wp_components_namespaceObject.BaseControl, 30411 { 30412 __nextHasNoMarginBottom: true, 30413 help: stickyHelpText, 30414 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 30415 external_wp_components_namespaceObject.CustomSelectControl, 30416 { 30417 __next40pxDefaultSize: true, 30418 label: (0,external_wp_i18n_namespaceObject.__)("Position"), 30419 hideLabelFromVision: true, 30420 describedBy: (0,external_wp_i18n_namespaceObject.sprintf)( 30421 // translators: %s: Currently selected position. 30422 (0,external_wp_i18n_namespaceObject.__)("Currently selected position: %s"), 30423 selectedOption.name 30424 ), 30425 options, 30426 value: selectedOption, 30427 onChange: ({ selectedItem }) => { 30428 onChangeType(selectedItem.value); 30429 }, 30430 size: "__unstable-large" 30431 } 30432 ) 30433 } 30434 ) }) : null, 30435 native: null 30436 }); 30437 } 30438 var position_default = { 30439 edit: function Edit(props) { 30440 const isPositionDisabled = useIsPositionDisabled(props); 30441 if (isPositionDisabled) { 30442 return null; 30443 } 30444 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PositionPanelPure, { ...props }); 30445 }, 30446 useBlockProps: position_useBlockProps, 30447 attributeKeys: ["style"], 30448 hasSupport(name) { 30449 return (0,external_wp_blocks_namespaceObject.hasBlockSupport)(name, POSITION_SUPPORT_KEY); 30450 } 30451 }; 30452 const POSITION_BLOCK_PROPS_REFERENCE = {}; 30453 function position_useBlockProps({ name, style }) { 30454 const hasPositionBlockSupport = (0,external_wp_blocks_namespaceObject.hasBlockSupport)( 30455 name, 30456 POSITION_SUPPORT_KEY 30457 ); 30458 const isPositionDisabled = useIsPositionDisabled({ name }); 30459 const allowPositionStyles = hasPositionBlockSupport && !isPositionDisabled; 30460 const id = (0,external_wp_compose_namespaceObject.useInstanceId)(POSITION_BLOCK_PROPS_REFERENCE); 30461 const positionSelector = `.wp-container-$id}.wp-container-$id}`; 30462 let css; 30463 if (allowPositionStyles) { 30464 css = getPositionCSS({ 30465 selector: positionSelector, 30466 style 30467 }) || ""; 30468 } 30469 const className = dist_clsx({ 30470 [`wp-container-$id}`]: allowPositionStyles && !!css, 30471 // Only attach a container class if there is generated CSS to be attached. 30472 [`is-position-$style?.position?.type}`]: allowPositionStyles && !!css && !!style?.position?.type 30473 }); 30474 useStyleOverride({ css }); 30475 return { className }; 30476 } 30477 30478 30479 ;// ./node_modules/@wordpress/block-editor/build-module/components/global-styles/use-global-styles-output.js 30480 30481 30482 30483 30484 30485 30486 30487 30488 30489 30490 30491 30492 30493 30494 30495 30496 30497 const ELEMENT_CLASS_NAMES = { 30498 button: "wp-element-button", 30499 caption: "wp-element-caption" 30500 }; 30501 const BLOCK_SUPPORT_FEATURE_LEVEL_SELECTORS = { 30502 __experimentalBorder: "border", 30503 color: "color", 30504 spacing: "spacing", 30505 typography: "typography" 30506 }; 30507 const { kebabCase: use_global_styles_output_kebabCase } = unlock(external_wp_components_namespaceObject.privateApis); 30508 function getPresetsDeclarations(blockPresets = {}, mergedSettings) { 30509 return PRESET_METADATA.reduce( 30510 (declarations, { path, valueKey, valueFunc, cssVarInfix }) => { 30511 const presetByOrigin = getValueFromObjectPath( 30512 blockPresets, 30513 path, 30514 [] 30515 ); 30516 ["default", "theme", "custom"].forEach((origin) => { 30517 if (presetByOrigin[origin]) { 30518 presetByOrigin[origin].forEach((value) => { 30519 if (valueKey && !valueFunc) { 30520 declarations.push( 30521 `--wp--preset--$cssVarInfix}--$use_global_styles_output_kebabCase( 30522 value.slug 30523 )}: $value[valueKey]}` 30524 ); 30525 } else if (valueFunc && typeof valueFunc === "function") { 30526 declarations.push( 30527 `--wp--preset--$cssVarInfix}--$use_global_styles_output_kebabCase( 30528 value.slug 30529 )}: $valueFunc(value, mergedSettings)}` 30530 ); 30531 } 30532 }); 30533 } 30534 }); 30535 return declarations; 30536 }, 30537 [] 30538 ); 30539 } 30540 function getPresetsClasses(blockSelector = "*", blockPresets = {}) { 30541 return PRESET_METADATA.reduce( 30542 (declarations, { path, cssVarInfix, classes }) => { 30543 if (!classes) { 30544 return declarations; 30545 } 30546 const presetByOrigin = getValueFromObjectPath( 30547 blockPresets, 30548 path, 30549 [] 30550 ); 30551 ["default", "theme", "custom"].forEach((origin) => { 30552 if (presetByOrigin[origin]) { 30553 presetByOrigin[origin].forEach(({ slug }) => { 30554 classes.forEach(({ classSuffix, propertyName }) => { 30555 const classSelectorToUse = `.has-$use_global_styles_output_kebabCase( 30556 slug 30557 )}-$classSuffix}`; 30558 const selectorToUse = blockSelector.split(",").map( 30559 (selector) => `$selector}$classSelectorToUse}` 30560 ).join(","); 30561 const value = `var(--wp--preset--$cssVarInfix}--$use_global_styles_output_kebabCase( 30562 slug 30563 )})`; 30564 declarations += `$selectorToUse}{$propertyName}: $value} !important;}`; 30565 }); 30566 }); 30567 } 30568 }); 30569 return declarations; 30570 }, 30571 "" 30572 ); 30573 } 30574 function getPresetsSvgFilters(blockPresets = {}) { 30575 return PRESET_METADATA.filter( 30576 // Duotone are the only type of filters for now. 30577 (metadata) => metadata.path.at(-1) === "duotone" 30578 ).flatMap((metadata) => { 30579 const presetByOrigin = getValueFromObjectPath( 30580 blockPresets, 30581 metadata.path, 30582 {} 30583 ); 30584 return ["default", "theme"].filter((origin) => presetByOrigin[origin]).flatMap( 30585 (origin) => presetByOrigin[origin].map( 30586 (preset) => getDuotoneFilter( 30587 `wp-duotone-$preset.slug}`, 30588 preset.colors 30589 ) 30590 ) 30591 ).join(""); 30592 }); 30593 } 30594 function flattenTree(input = {}, prefix, token) { 30595 let result = []; 30596 Object.keys(input).forEach((key) => { 30597 const newKey = prefix + use_global_styles_output_kebabCase(key.replace("/", "-")); 30598 const newLeaf = input[key]; 30599 if (newLeaf instanceof Object) { 30600 const newPrefix = newKey + token; 30601 result = [...result, ...flattenTree(newLeaf, newPrefix, token)]; 30602 } else { 30603 result.push(`$newKey}: $newLeaf}`); 30604 } 30605 }); 30606 return result; 30607 } 30608 function concatFeatureVariationSelectorString(featureSelector, styleVariationSelector) { 30609 const featureSelectors = featureSelector.split(","); 30610 const combinedSelectors = []; 30611 featureSelectors.forEach((selector) => { 30612 combinedSelectors.push( 30613 `$styleVariationSelector.trim()}$selector.trim()}` 30614 ); 30615 }); 30616 return combinedSelectors.join(", "); 30617 } 30618 const getFeatureDeclarations = (selectors, styles) => { 30619 const declarations = {}; 30620 Object.entries(selectors).forEach(([feature, selector]) => { 30621 if (feature === "root" || !styles?.[feature]) { 30622 return; 30623 } 30624 const isShorthand = typeof selector === "string"; 30625 if (!isShorthand) { 30626 Object.entries(selector).forEach( 30627 ([subfeature, subfeatureSelector]) => { 30628 if (subfeature === "root" || !styles?.[feature][subfeature]) { 30629 return; 30630 } 30631 const subfeatureStyles = { 30632 [feature]: { 30633 [subfeature]: styles[feature][subfeature] 30634 } 30635 }; 30636 const newDeclarations = getStylesDeclarations(subfeatureStyles); 30637 declarations[subfeatureSelector] = [ 30638 ...declarations[subfeatureSelector] || [], 30639 ...newDeclarations 30640 ]; 30641 delete styles[feature][subfeature]; 30642 } 30643 ); 30644 } 30645 if (isShorthand || selector.root) { 30646 const featureSelector = isShorthand ? selector : selector.root; 30647 const featureStyles = { [feature]: styles[feature] }; 30648 const newDeclarations = getStylesDeclarations(featureStyles); 30649 declarations[featureSelector] = [ 30650 ...declarations[featureSelector] || [], 30651 ...newDeclarations 30652 ]; 30653 delete styles[feature]; 30654 } 30655 }); 30656 return declarations; 30657 }; 30658 function getStylesDeclarations(blockStyles = {}, selector = "", useRootPaddingAlign, tree = {}, disableRootPadding = false) { 30659 const isRoot = ROOT_BLOCK_SELECTOR === selector; 30660 const output = Object.entries(external_wp_blocks_namespaceObject.__EXPERIMENTAL_STYLE_PROPERTY).reduce( 30661 (declarations, [key, { value, properties, useEngine, rootOnly }]) => { 30662 if (rootOnly && !isRoot) { 30663 return declarations; 30664 } 30665 const pathToValue = value; 30666 if (pathToValue[0] === "elements" || useEngine) { 30667 return declarations; 30668 } 30669 const styleValue = getValueFromObjectPath( 30670 blockStyles, 30671 pathToValue 30672 ); 30673 if (key === "--wp--style--root--padding" && (typeof styleValue === "string" || !useRootPaddingAlign)) { 30674 return declarations; 30675 } 30676 if (properties && typeof styleValue !== "string") { 30677 Object.entries(properties).forEach((entry) => { 30678 const [name, prop] = entry; 30679 if (!getValueFromObjectPath(styleValue, [prop], false)) { 30680 return; 30681 } 30682 const cssProperty = name.startsWith("--") ? name : use_global_styles_output_kebabCase(name); 30683 declarations.push( 30684 `$cssProperty}: ${(0,external_wp_styleEngine_namespaceObject.getCSSValueFromRawStyle)( 30685 getValueFromObjectPath(styleValue, [prop]) 30686 )}` 30687 ); 30688 }); 30689 } else if (getValueFromObjectPath(blockStyles, pathToValue, false)) { 30690 const cssProperty = key.startsWith("--") ? key : use_global_styles_output_kebabCase(key); 30691 declarations.push( 30692 `$cssProperty}: ${(0,external_wp_styleEngine_namespaceObject.getCSSValueFromRawStyle)( 30693 getValueFromObjectPath(blockStyles, pathToValue) 30694 )}` 30695 ); 30696 } 30697 return declarations; 30698 }, 30699 [] 30700 ); 30701 if (!!blockStyles.background) { 30702 if (blockStyles.background?.backgroundImage) { 30703 blockStyles.background.backgroundImage = getResolvedValue( 30704 blockStyles.background.backgroundImage, 30705 tree 30706 ); 30707 } 30708 if (!isRoot && !!blockStyles.background?.backgroundImage?.id) { 30709 blockStyles = { 30710 ...blockStyles, 30711 background: { 30712 ...blockStyles.background, 30713 ...setBackgroundStyleDefaults(blockStyles.background) 30714 } 30715 }; 30716 } 30717 } 30718 const extraRules = (0,external_wp_styleEngine_namespaceObject.getCSSRules)(blockStyles); 30719 extraRules.forEach((rule) => { 30720 if (isRoot && (useRootPaddingAlign || disableRootPadding) && rule.key.startsWith("padding")) { 30721 return; 30722 } 30723 const cssProperty = rule.key.startsWith("--") ? rule.key : use_global_styles_output_kebabCase(rule.key); 30724 let ruleValue = getResolvedValue(rule.value, tree, null); 30725 if (cssProperty === "font-size") { 30726 ruleValue = getTypographyFontSizeValue( 30727 { size: ruleValue }, 30728 tree?.settings 30729 ); 30730 } 30731 if (cssProperty === "aspect-ratio") { 30732 output.push("min-height: unset"); 30733 } 30734 output.push(`$cssProperty}: $ruleValue}`); 30735 }); 30736 return output; 30737 } 30738 function getLayoutStyles({ 30739 layoutDefinitions = LAYOUT_DEFINITIONS, 30740 style, 30741 selector, 30742 hasBlockGapSupport, 30743 hasFallbackGapSupport, 30744 fallbackGapValue 30745 }) { 30746 let ruleset = ""; 30747 let gapValue = hasBlockGapSupport ? getGapCSSValue(style?.spacing?.blockGap) : ""; 30748 if (hasFallbackGapSupport) { 30749 if (selector === ROOT_BLOCK_SELECTOR) { 30750 gapValue = !gapValue ? "0.5em" : gapValue; 30751 } else if (!hasBlockGapSupport && fallbackGapValue) { 30752 gapValue = fallbackGapValue; 30753 } 30754 } 30755 if (gapValue && layoutDefinitions) { 30756 Object.values(layoutDefinitions).forEach( 30757 ({ className, name, spacingStyles }) => { 30758 if (!hasBlockGapSupport && "flex" !== name && "grid" !== name) { 30759 return; 30760 } 30761 if (spacingStyles?.length) { 30762 spacingStyles.forEach((spacingStyle) => { 30763 const declarations = []; 30764 if (spacingStyle.rules) { 30765 Object.entries(spacingStyle.rules).forEach( 30766 ([cssProperty, cssValue]) => { 30767 declarations.push( 30768 `$cssProperty}: $cssValue ? cssValue : gapValue}` 30769 ); 30770 } 30771 ); 30772 } 30773 if (declarations.length) { 30774 let combinedSelector = ""; 30775 if (!hasBlockGapSupport) { 30776 combinedSelector = selector === ROOT_BLOCK_SELECTOR ? `:where(.$className}$spacingStyle?.selector || ""})` : `:where($selector}.$className}$spacingStyle?.selector || ""})`; 30777 } else { 30778 combinedSelector = selector === ROOT_BLOCK_SELECTOR ? `:root :where(.$className})$spacingStyle?.selector || ""}` : `:root :where($selector}-$className})$spacingStyle?.selector || ""}`; 30779 } 30780 ruleset += `$combinedSelector} { $declarations.join( 30781 "; " 30782 )}; }`; 30783 } 30784 }); 30785 } 30786 } 30787 ); 30788 if (selector === ROOT_BLOCK_SELECTOR && hasBlockGapSupport) { 30789 ruleset += `$ROOT_CSS_PROPERTIES_SELECTOR} { --wp--style--block-gap: $gapValue}; }`; 30790 } 30791 } 30792 if (selector === ROOT_BLOCK_SELECTOR && layoutDefinitions) { 30793 const validDisplayModes = ["block", "flex", "grid"]; 30794 Object.values(layoutDefinitions).forEach( 30795 ({ className, displayMode, baseStyles }) => { 30796 if (displayMode && validDisplayModes.includes(displayMode)) { 30797 ruleset += `$selector} .$className} { display:$displayMode}; }`; 30798 } 30799 if (baseStyles?.length) { 30800 baseStyles.forEach((baseStyle) => { 30801 const declarations = []; 30802 if (baseStyle.rules) { 30803 Object.entries(baseStyle.rules).forEach( 30804 ([cssProperty, cssValue]) => { 30805 declarations.push( 30806 `$cssProperty}: $cssValue}` 30807 ); 30808 } 30809 ); 30810 } 30811 if (declarations.length) { 30812 const combinedSelector = `.$className}$baseStyle?.selector || ""}`; 30813 ruleset += `$combinedSelector} { $declarations.join( 30814 "; " 30815 )}; }`; 30816 } 30817 }); 30818 } 30819 } 30820 ); 30821 } 30822 return ruleset; 30823 } 30824 const STYLE_KEYS = [ 30825 "border", 30826 "color", 30827 "dimensions", 30828 "spacing", 30829 "typography", 30830 "filter", 30831 "outline", 30832 "shadow", 30833 "background" 30834 ]; 30835 function pickStyleKeys(treeToPickFrom) { 30836 if (!treeToPickFrom) { 30837 return {}; 30838 } 30839 const entries = Object.entries(treeToPickFrom); 30840 const pickedEntries = entries.filter( 30841 ([key]) => STYLE_KEYS.includes(key) 30842 ); 30843 const clonedEntries = pickedEntries.map(([key, style]) => [ 30844 key, 30845 JSON.parse(JSON.stringify(style)) 30846 ]); 30847 return Object.fromEntries(clonedEntries); 30848 } 30849 const getNodesWithStyles = (tree, blockSelectors) => { 30850 const nodes = []; 30851 if (!tree?.styles) { 30852 return nodes; 30853 } 30854 const styles = pickStyleKeys(tree.styles); 30855 if (styles) { 30856 nodes.push({ 30857 styles, 30858 selector: ROOT_BLOCK_SELECTOR, 30859 // Root selector (body) styles should not be wrapped in `:root where()` to keep 30860 // specificity at (0,0,1) and maintain backwards compatibility. 30861 skipSelectorWrapper: true 30862 }); 30863 } 30864 Object.entries(external_wp_blocks_namespaceObject.__EXPERIMENTAL_ELEMENTS).forEach(([name, selector]) => { 30865 if (tree.styles?.elements?.[name]) { 30866 nodes.push({ 30867 styles: tree.styles?.elements?.[name], 30868 selector, 30869 // Top level elements that don't use a class name should not receive the 30870 // `:root :where()` wrapper to maintain backwards compatibility. 30871 skipSelectorWrapper: !ELEMENT_CLASS_NAMES[name] 30872 }); 30873 } 30874 }); 30875 Object.entries(tree.styles?.blocks ?? {}).forEach( 30876 ([blockName, node]) => { 30877 const blockStyles = pickStyleKeys(node); 30878 if (node?.variations) { 30879 const variations = {}; 30880 Object.entries(node.variations).forEach( 30881 ([variationName, variation]) => { 30882 variations[variationName] = pickStyleKeys(variation); 30883 if (variation?.css) { 30884 variations[variationName].css = variation.css; 30885 } 30886 const variationSelector = blockSelectors[blockName]?.styleVariationSelectors?.[variationName]; 30887 Object.entries(variation?.elements ?? {}).forEach( 30888 ([element, elementStyles]) => { 30889 if (elementStyles && external_wp_blocks_namespaceObject.__EXPERIMENTAL_ELEMENTS[element]) { 30890 nodes.push({ 30891 styles: elementStyles, 30892 selector: scopeSelector( 30893 variationSelector, 30894 external_wp_blocks_namespaceObject.__EXPERIMENTAL_ELEMENTS[element] 30895 ) 30896 }); 30897 } 30898 } 30899 ); 30900 Object.entries(variation?.blocks ?? {}).forEach( 30901 ([ 30902 variationBlockName, 30903 variationBlockStyles 30904 ]) => { 30905 const variationBlockSelector = scopeSelector( 30906 variationSelector, 30907 blockSelectors[variationBlockName]?.selector 30908 ); 30909 const variationDuotoneSelector = scopeSelector( 30910 variationSelector, 30911 blockSelectors[variationBlockName]?.duotoneSelector 30912 ); 30913 const variationFeatureSelectors = scopeFeatureSelectors( 30914 variationSelector, 30915 blockSelectors[variationBlockName]?.featureSelectors 30916 ); 30917 const variationBlockStyleNodes = pickStyleKeys(variationBlockStyles); 30918 if (variationBlockStyles?.css) { 30919 variationBlockStyleNodes.css = variationBlockStyles.css; 30920 } 30921 nodes.push({ 30922 selector: variationBlockSelector, 30923 duotoneSelector: variationDuotoneSelector, 30924 featureSelectors: variationFeatureSelectors, 30925 fallbackGapValue: blockSelectors[variationBlockName]?.fallbackGapValue, 30926 hasLayoutSupport: blockSelectors[variationBlockName]?.hasLayoutSupport, 30927 styles: variationBlockStyleNodes 30928 }); 30929 Object.entries( 30930 variationBlockStyles.elements ?? {} 30931 ).forEach( 30932 ([ 30933 variationBlockElement, 30934 variationBlockElementStyles 30935 ]) => { 30936 if (variationBlockElementStyles && external_wp_blocks_namespaceObject.__EXPERIMENTAL_ELEMENTS[variationBlockElement]) { 30937 nodes.push({ 30938 styles: variationBlockElementStyles, 30939 selector: scopeSelector( 30940 variationBlockSelector, 30941 external_wp_blocks_namespaceObject.__EXPERIMENTAL_ELEMENTS[variationBlockElement] 30942 ) 30943 }); 30944 } 30945 } 30946 ); 30947 } 30948 ); 30949 } 30950 ); 30951 blockStyles.variations = variations; 30952 } 30953 if (blockSelectors?.[blockName]?.selector) { 30954 nodes.push({ 30955 duotoneSelector: blockSelectors[blockName].duotoneSelector, 30956 fallbackGapValue: blockSelectors[blockName].fallbackGapValue, 30957 hasLayoutSupport: blockSelectors[blockName].hasLayoutSupport, 30958 selector: blockSelectors[blockName].selector, 30959 styles: blockStyles, 30960 featureSelectors: blockSelectors[blockName].featureSelectors, 30961 styleVariationSelectors: blockSelectors[blockName].styleVariationSelectors 30962 }); 30963 } 30964 Object.entries(node?.elements ?? {}).forEach( 30965 ([elementName, value]) => { 30966 if (value && blockSelectors?.[blockName] && external_wp_blocks_namespaceObject.__EXPERIMENTAL_ELEMENTS[elementName]) { 30967 nodes.push({ 30968 styles: value, 30969 selector: blockSelectors[blockName]?.selector.split(",").map((sel) => { 30970 const elementSelectors = external_wp_blocks_namespaceObject.__EXPERIMENTAL_ELEMENTS[elementName].split(","); 30971 return elementSelectors.map( 30972 (elementSelector) => sel + " " + elementSelector 30973 ); 30974 }).join(",") 30975 }); 30976 } 30977 } 30978 ); 30979 } 30980 ); 30981 return nodes; 30982 }; 30983 const getNodesWithSettings = (tree, blockSelectors) => { 30984 const nodes = []; 30985 if (!tree?.settings) { 30986 return nodes; 30987 } 30988 const pickPresets = (treeToPickFrom) => { 30989 let presets2 = {}; 30990 PRESET_METADATA.forEach(({ path }) => { 30991 const value = getValueFromObjectPath(treeToPickFrom, path, false); 30992 if (value !== false) { 30993 presets2 = setImmutably(presets2, path, value); 30994 } 30995 }); 30996 return presets2; 30997 }; 30998 const presets = pickPresets(tree.settings); 30999 const custom = tree.settings?.custom; 31000 if (Object.keys(presets).length > 0 || custom) { 31001 nodes.push({ 31002 presets, 31003 custom, 31004 selector: ROOT_CSS_PROPERTIES_SELECTOR 31005 }); 31006 } 31007 Object.entries(tree.settings?.blocks ?? {}).forEach( 31008 ([blockName, node]) => { 31009 const blockPresets = pickPresets(node); 31010 const blockCustom = node.custom; 31011 if (Object.keys(blockPresets).length > 0 || blockCustom) { 31012 nodes.push({ 31013 presets: blockPresets, 31014 custom: blockCustom, 31015 selector: blockSelectors[blockName]?.selector 31016 }); 31017 } 31018 } 31019 ); 31020 return nodes; 31021 }; 31022 const toCustomProperties = (tree, blockSelectors) => { 31023 const settings = getNodesWithSettings(tree, blockSelectors); 31024 let ruleset = ""; 31025 settings.forEach(({ presets, custom, selector }) => { 31026 const declarations = getPresetsDeclarations(presets, tree?.settings); 31027 const customProps = flattenTree(custom, "--wp--custom--", "--"); 31028 if (customProps.length > 0) { 31029 declarations.push(...customProps); 31030 } 31031 if (declarations.length > 0) { 31032 ruleset += `$selector}{$declarations.join(";")};}`; 31033 } 31034 }); 31035 return ruleset; 31036 }; 31037 const toStyles = (tree, blockSelectors, hasBlockGapSupport, hasFallbackGapSupport, disableLayoutStyles = false, disableRootPadding = false, styleOptions = void 0) => { 31038 const options = { 31039 blockGap: true, 31040 blockStyles: true, 31041 layoutStyles: true, 31042 marginReset: true, 31043 presets: true, 31044 rootPadding: true, 31045 variationStyles: false, 31046 ...styleOptions 31047 }; 31048 const nodesWithStyles = getNodesWithStyles(tree, blockSelectors); 31049 const nodesWithSettings = getNodesWithSettings(tree, blockSelectors); 31050 const useRootPaddingAlign = tree?.settings?.useRootPaddingAwareAlignments; 31051 const { contentSize, wideSize } = tree?.settings?.layout || {}; 31052 const hasBodyStyles = options.marginReset || options.rootPadding || options.layoutStyles; 31053 let ruleset = ""; 31054 if (options.presets && (contentSize || wideSize)) { 31055 ruleset += `$ROOT_CSS_PROPERTIES_SELECTOR} {`; 31056 ruleset = contentSize ? ruleset + ` --wp--style--global--content-size: $contentSize};` : ruleset; 31057 ruleset = wideSize ? ruleset + ` --wp--style--global--wide-size: $wideSize};` : ruleset; 31058 ruleset += "}"; 31059 } 31060 if (hasBodyStyles) { 31061 ruleset += ":where(body) {margin: 0;"; 31062 if (options.rootPadding && useRootPaddingAlign) { 31063 ruleset += `padding-right: 0; padding-left: 0; padding-top: var(--wp--style--root--padding-top); padding-bottom: var(--wp--style--root--padding-bottom) } 31064 .has-global-padding { padding-right: var(--wp--style--root--padding-right); padding-left: var(--wp--style--root--padding-left); } 31065 .has-global-padding > .alignfull { margin-right: calc(var(--wp--style--root--padding-right) * -1); margin-left: calc(var(--wp--style--root--padding-left) * -1); } 31066 .has-global-padding :where(:not(.alignfull.is-layout-flow) > .has-global-padding:not(.wp-block-block, .alignfull)) { padding-right: 0; padding-left: 0; } 31067 .has-global-padding :where(:not(.alignfull.is-layout-flow) > .has-global-padding:not(.wp-block-block, .alignfull)) > .alignfull { margin-left: 0; margin-right: 0; 31068 `; 31069 } 31070 ruleset += "}"; 31071 } 31072 if (options.blockStyles) { 31073 nodesWithStyles.forEach( 31074 ({ 31075 selector, 31076 duotoneSelector, 31077 styles, 31078 fallbackGapValue, 31079 hasLayoutSupport, 31080 featureSelectors, 31081 styleVariationSelectors, 31082 skipSelectorWrapper 31083 }) => { 31084 if (featureSelectors) { 31085 const featureDeclarations = getFeatureDeclarations( 31086 featureSelectors, 31087 styles 31088 ); 31089 Object.entries(featureDeclarations).forEach( 31090 ([cssSelector, declarations]) => { 31091 if (declarations.length) { 31092 const rules = declarations.join(";"); 31093 ruleset += `:root :where($cssSelector}){$rules};}`; 31094 } 31095 } 31096 ); 31097 } 31098 if (duotoneSelector) { 31099 const duotoneStyles = {}; 31100 if (styles?.filter) { 31101 duotoneStyles.filter = styles.filter; 31102 delete styles.filter; 31103 } 31104 const duotoneDeclarations = getStylesDeclarations(duotoneStyles); 31105 if (duotoneDeclarations.length) { 31106 ruleset += `$duotoneSelector}{$duotoneDeclarations.join( 31107 ";" 31108 )};}`; 31109 } 31110 } 31111 if (!disableLayoutStyles && (ROOT_BLOCK_SELECTOR === selector || hasLayoutSupport)) { 31112 ruleset += getLayoutStyles({ 31113 style: styles, 31114 selector, 31115 hasBlockGapSupport, 31116 hasFallbackGapSupport, 31117 fallbackGapValue 31118 }); 31119 } 31120 const styleDeclarations = getStylesDeclarations( 31121 styles, 31122 selector, 31123 useRootPaddingAlign, 31124 tree, 31125 disableRootPadding 31126 ); 31127 if (styleDeclarations?.length) { 31128 const generalSelector = skipSelectorWrapper ? selector : `:root :where($selector})`; 31129 ruleset += `$generalSelector}{$styleDeclarations.join( 31130 ";" 31131 )};}`; 31132 } 31133 if (styles?.css) { 31134 ruleset += processCSSNesting( 31135 styles.css, 31136 `:root :where($selector})` 31137 ); 31138 } 31139 if (options.variationStyles && styleVariationSelectors) { 31140 Object.entries(styleVariationSelectors).forEach( 31141 ([styleVariationName, styleVariationSelector]) => { 31142 const styleVariations = styles?.variations?.[styleVariationName]; 31143 if (styleVariations) { 31144 if (featureSelectors) { 31145 const featureDeclarations = getFeatureDeclarations( 31146 featureSelectors, 31147 styleVariations 31148 ); 31149 Object.entries( 31150 featureDeclarations 31151 ).forEach( 31152 ([baseSelector, declarations]) => { 31153 if (declarations.length) { 31154 const cssSelector = concatFeatureVariationSelectorString( 31155 baseSelector, 31156 styleVariationSelector 31157 ); 31158 const rules = declarations.join(";"); 31159 ruleset += `:root :where($cssSelector}){$rules};}`; 31160 } 31161 } 31162 ); 31163 } 31164 const styleVariationDeclarations = getStylesDeclarations( 31165 styleVariations, 31166 styleVariationSelector, 31167 useRootPaddingAlign, 31168 tree 31169 ); 31170 if (styleVariationDeclarations.length) { 31171 ruleset += `:root :where($styleVariationSelector}){$styleVariationDeclarations.join( 31172 ";" 31173 )};}`; 31174 } 31175 if (styleVariations?.css) { 31176 ruleset += processCSSNesting( 31177 styleVariations.css, 31178 `:root :where($styleVariationSelector})` 31179 ); 31180 } 31181 } 31182 } 31183 ); 31184 } 31185 const pseudoSelectorStyles = Object.entries(styles).filter( 31186 ([key]) => key.startsWith(":") 31187 ); 31188 if (pseudoSelectorStyles?.length) { 31189 pseudoSelectorStyles.forEach( 31190 ([pseudoKey, pseudoStyle]) => { 31191 const pseudoDeclarations = getStylesDeclarations(pseudoStyle); 31192 if (!pseudoDeclarations?.length) { 31193 return; 31194 } 31195 const _selector = selector.split(",").map((sel) => sel + pseudoKey).join(","); 31196 const pseudoRule = `:root :where($_selector}){$pseudoDeclarations.join( 31197 ";" 31198 )};}`; 31199 ruleset += pseudoRule; 31200 } 31201 ); 31202 } 31203 } 31204 ); 31205 } 31206 if (options.layoutStyles) { 31207 ruleset = ruleset + ".wp-site-blocks > .alignleft { float: left; margin-right: 2em; }"; 31208 ruleset = ruleset + ".wp-site-blocks > .alignright { float: right; margin-left: 2em; }"; 31209 ruleset = ruleset + ".wp-site-blocks > .aligncenter { justify-content: center; margin-left: auto; margin-right: auto; }"; 31210 } 31211 if (options.blockGap && hasBlockGapSupport) { 31212 const gapValue = getGapCSSValue(tree?.styles?.spacing?.blockGap) || "0.5em"; 31213 ruleset = ruleset + `:root :where(.wp-site-blocks) > * { margin-block-start: $gapValue}; margin-block-end: 0; }`; 31214 ruleset = ruleset + ":root :where(.wp-site-blocks) > :first-child { margin-block-start: 0; }"; 31215 ruleset = ruleset + ":root :where(.wp-site-blocks) > :last-child { margin-block-end: 0; }"; 31216 } 31217 if (options.presets) { 31218 nodesWithSettings.forEach(({ selector, presets }) => { 31219 if (ROOT_BLOCK_SELECTOR === selector || ROOT_CSS_PROPERTIES_SELECTOR === selector) { 31220 selector = ""; 31221 } 31222 const classes = getPresetsClasses(selector, presets); 31223 if (classes.length > 0) { 31224 ruleset += classes; 31225 } 31226 }); 31227 } 31228 return ruleset; 31229 }; 31230 function toSvgFilters(tree, blockSelectors) { 31231 const nodesWithSettings = getNodesWithSettings(tree, blockSelectors); 31232 return nodesWithSettings.flatMap(({ presets }) => { 31233 return getPresetsSvgFilters(presets); 31234 }); 31235 } 31236 const getSelectorsConfig = (blockType, rootSelector) => { 31237 if (blockType?.selectors && Object.keys(blockType.selectors).length > 0) { 31238 return blockType.selectors; 31239 } 31240 const config = { root: rootSelector }; 31241 Object.entries(BLOCK_SUPPORT_FEATURE_LEVEL_SELECTORS).forEach( 31242 ([featureKey, featureName]) => { 31243 const featureSelector = getBlockCSSSelector( 31244 blockType, 31245 featureKey 31246 ); 31247 if (featureSelector) { 31248 config[featureName] = featureSelector; 31249 } 31250 } 31251 ); 31252 return config; 31253 }; 31254 const getBlockSelectors = (blockTypes, getBlockStyles, variationInstanceId) => { 31255 const result = {}; 31256 blockTypes.forEach((blockType) => { 31257 const name = blockType.name; 31258 const selector = getBlockCSSSelector(blockType); 31259 let duotoneSelector = getBlockCSSSelector( 31260 blockType, 31261 "filter.duotone" 31262 ); 31263 if (!duotoneSelector) { 31264 const rootSelector = getBlockCSSSelector(blockType); 31265 const duotoneSupport = (0,external_wp_blocks_namespaceObject.getBlockSupport)( 31266 blockType, 31267 "color.__experimentalDuotone", 31268 false 31269 ); 31270 duotoneSelector = duotoneSupport && scopeSelector(rootSelector, duotoneSupport); 31271 } 31272 const hasLayoutSupport = !!blockType?.supports?.layout || !!blockType?.supports?.__experimentalLayout; 31273 const fallbackGapValue = blockType?.supports?.spacing?.blockGap?.__experimentalDefault; 31274 const blockStyleVariations = getBlockStyles(name); 31275 const styleVariationSelectors = {}; 31276 blockStyleVariations?.forEach((variation) => { 31277 const variationSuffix = variationInstanceId ? `-$variationInstanceId}` : ""; 31278 const variationName = `$variation.name}$variationSuffix}`; 31279 const styleVariationSelector = getBlockStyleVariationSelector( 31280 variationName, 31281 selector 31282 ); 31283 styleVariationSelectors[variationName] = styleVariationSelector; 31284 }); 31285 const featureSelectors = getSelectorsConfig(blockType, selector); 31286 result[name] = { 31287 duotoneSelector, 31288 fallbackGapValue, 31289 featureSelectors: Object.keys(featureSelectors).length ? featureSelectors : void 0, 31290 hasLayoutSupport, 31291 name, 31292 selector, 31293 styleVariationSelectors: blockStyleVariations?.length ? styleVariationSelectors : void 0 31294 }; 31295 }); 31296 return result; 31297 }; 31298 function updateConfigWithSeparator(config) { 31299 const needsSeparatorStyleUpdate = config.styles?.blocks?.["core/separator"] && config.styles?.blocks?.["core/separator"].color?.background && !config.styles?.blocks?.["core/separator"].color?.text && !config.styles?.blocks?.["core/separator"].border?.color; 31300 if (needsSeparatorStyleUpdate) { 31301 return { 31302 ...config, 31303 styles: { 31304 ...config.styles, 31305 blocks: { 31306 ...config.styles.blocks, 31307 "core/separator": { 31308 ...config.styles.blocks["core/separator"], 31309 color: { 31310 ...config.styles.blocks["core/separator"].color, 31311 text: config.styles?.blocks["core/separator"].color.background 31312 } 31313 } 31314 } 31315 } 31316 }; 31317 } 31318 return config; 31319 } 31320 function processCSSNesting(css, blockSelector) { 31321 let processedCSS = ""; 31322 if (!css || css.trim() === "") { 31323 return processedCSS; 31324 } 31325 const parts = css.split("&"); 31326 parts.forEach((part) => { 31327 if (!part || part.trim() === "") { 31328 return; 31329 } 31330 const isRootCss = !part.includes("{"); 31331 if (isRootCss) { 31332 processedCSS += `:root :where($blockSelector}){$part.trim()}}`; 31333 } else { 31334 const splitPart = part.replace("}", "").split("{"); 31335 if (splitPart.length !== 2) { 31336 return; 31337 } 31338 const [nestedSelector, cssValue] = splitPart; 31339 const matches = nestedSelector.match(/([>+~\s]*::[a-zA-Z-]+)/); 31340 const pseudoPart = matches ? matches[1] : ""; 31341 const withoutPseudoElement = matches ? nestedSelector.replace(pseudoPart, "").trim() : nestedSelector.trim(); 31342 let combinedSelector; 31343 if (withoutPseudoElement === "") { 31344 combinedSelector = blockSelector; 31345 } else { 31346 combinedSelector = nestedSelector.startsWith(" ") ? scopeSelector(blockSelector, withoutPseudoElement) : appendToSelector(blockSelector, withoutPseudoElement); 31347 } 31348 processedCSS += `:root :where($combinedSelector})$pseudoPart}{$cssValue.trim()}}`; 31349 } 31350 }); 31351 return processedCSS; 31352 } 31353 function useGlobalStylesOutputWithConfig(mergedConfig = {}, disableRootPadding) { 31354 const [blockGap] = useGlobalSetting("spacing.blockGap"); 31355 const hasBlockGapSupport = blockGap !== null; 31356 const hasFallbackGapSupport = !hasBlockGapSupport; 31357 const disableLayoutStyles = (0,external_wp_data_namespaceObject.useSelect)((select) => { 31358 const { getSettings } = select(store); 31359 return !!getSettings().disableLayoutStyles; 31360 }); 31361 const { getBlockStyles } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blocks_namespaceObject.store); 31362 return (0,external_wp_element_namespaceObject.useMemo)(() => { 31363 if (!mergedConfig?.styles || !mergedConfig?.settings) { 31364 return []; 31365 } 31366 const updatedConfig = updateConfigWithSeparator(mergedConfig); 31367 const blockSelectors = getBlockSelectors( 31368 (0,external_wp_blocks_namespaceObject.getBlockTypes)(), 31369 getBlockStyles 31370 ); 31371 const customProperties = toCustomProperties( 31372 updatedConfig, 31373 blockSelectors 31374 ); 31375 const globalStyles = toStyles( 31376 updatedConfig, 31377 blockSelectors, 31378 hasBlockGapSupport, 31379 hasFallbackGapSupport, 31380 disableLayoutStyles, 31381 disableRootPadding 31382 ); 31383 const svgs = toSvgFilters(updatedConfig, blockSelectors); 31384 const styles = [ 31385 { 31386 css: customProperties, 31387 isGlobalStyles: true 31388 }, 31389 { 31390 css: globalStyles, 31391 isGlobalStyles: true 31392 }, 31393 // Load custom CSS in own stylesheet so that any invalid CSS entered in the input won't break all the global styles in the editor. 31394 { 31395 css: updatedConfig.styles.css ?? "", 31396 isGlobalStyles: true 31397 }, 31398 { 31399 assets: svgs, 31400 __unstableType: "svg", 31401 isGlobalStyles: true 31402 } 31403 ]; 31404 (0,external_wp_blocks_namespaceObject.getBlockTypes)().forEach((blockType) => { 31405 if (updatedConfig.styles.blocks[blockType.name]?.css) { 31406 const selector = blockSelectors[blockType.name].selector; 31407 styles.push({ 31408 css: processCSSNesting( 31409 updatedConfig.styles.blocks[blockType.name]?.css, 31410 selector 31411 ), 31412 isGlobalStyles: true 31413 }); 31414 } 31415 }); 31416 return [styles, updatedConfig.settings]; 31417 }, [ 31418 hasBlockGapSupport, 31419 hasFallbackGapSupport, 31420 mergedConfig, 31421 disableLayoutStyles, 31422 disableRootPadding, 31423 getBlockStyles 31424 ]); 31425 } 31426 function useGlobalStylesOutput(disableRootPadding = false) { 31427 const { merged: mergedConfig } = (0,external_wp_element_namespaceObject.useContext)(GlobalStylesContext); 31428 return useGlobalStylesOutputWithConfig(mergedConfig, disableRootPadding); 31429 } 31430 31431 31432 ;// ./node_modules/@wordpress/block-editor/build-module/hooks/block-style-variation.js 31433 31434 31435 31436 31437 31438 31439 31440 31441 31442 31443 const VARIATION_PREFIX = "is-style-"; 31444 function getVariationMatches(className) { 31445 if (!className) { 31446 return []; 31447 } 31448 return className.split(/\s+/).reduce((matches, name) => { 31449 if (name.startsWith(VARIATION_PREFIX)) { 31450 const match = name.slice(VARIATION_PREFIX.length); 31451 if (match !== "default") { 31452 matches.push(match); 31453 } 31454 } 31455 return matches; 31456 }, []); 31457 } 31458 function getVariationNameFromClass(className, registeredStyles = []) { 31459 const matches = getVariationMatches(className); 31460 if (!matches) { 31461 return null; 31462 } 31463 for (const variation of matches) { 31464 if (registeredStyles.some((style) => style.name === variation)) { 31465 return variation; 31466 } 31467 } 31468 return null; 31469 } 31470 function OverrideStyles({ override }) { 31471 usePrivateStyleOverride(override); 31472 } 31473 function __unstableBlockStyleVariationOverridesWithConfig({ config }) { 31474 const { getBlockStyles, overrides } = (0,external_wp_data_namespaceObject.useSelect)( 31475 (select) => ({ 31476 getBlockStyles: select(external_wp_blocks_namespaceObject.store).getBlockStyles, 31477 overrides: unlock(select(store)).getStyleOverrides() 31478 }), 31479 [] 31480 ); 31481 const { getBlockName } = (0,external_wp_data_namespaceObject.useSelect)(store); 31482 const overridesWithConfig = (0,external_wp_element_namespaceObject.useMemo)(() => { 31483 if (!overrides?.length) { 31484 return; 31485 } 31486 const newOverrides = []; 31487 const overriddenClientIds = []; 31488 for (const [, override] of overrides) { 31489 if (override?.variation && override?.clientId && /* 31490 * Because this component overwrites existing style overrides, 31491 * filter out any overrides that are already present in the store. 31492 */ 31493 !overriddenClientIds.includes(override.clientId)) { 31494 const blockName = getBlockName(override.clientId); 31495 const configStyles = config?.styles?.blocks?.[blockName]?.variations?.[override.variation]; 31496 if (configStyles) { 31497 const variationConfig = { 31498 settings: config?.settings, 31499 // The variation style data is all that is needed to generate 31500 // the styles for the current application to a block. The variation 31501 // name is updated to match the instance specific class name. 31502 styles: { 31503 blocks: { 31504 [blockName]: { 31505 variations: { 31506 [`$override.variation}-$override.clientId}`]: configStyles 31507 } 31508 } 31509 } 31510 } 31511 }; 31512 const blockSelectors = getBlockSelectors( 31513 (0,external_wp_blocks_namespaceObject.getBlockTypes)(), 31514 getBlockStyles, 31515 override.clientId 31516 ); 31517 const hasBlockGapSupport = false; 31518 const hasFallbackGapSupport = true; 31519 const disableLayoutStyles = true; 31520 const disableRootPadding = true; 31521 const variationStyles = toStyles( 31522 variationConfig, 31523 blockSelectors, 31524 hasBlockGapSupport, 31525 hasFallbackGapSupport, 31526 disableLayoutStyles, 31527 disableRootPadding, 31528 { 31529 blockGap: false, 31530 blockStyles: true, 31531 layoutStyles: false, 31532 marginReset: false, 31533 presets: false, 31534 rootPadding: false, 31535 variationStyles: true 31536 } 31537 ); 31538 newOverrides.push({ 31539 id: `$override.variation}-$override.clientId}`, 31540 css: variationStyles, 31541 __unstableType: "variation", 31542 variation: override.variation, 31543 // The clientId will be stored with the override and used to ensure 31544 // the order of overrides matches the order of blocks so that the 31545 // correct CSS cascade is maintained. 31546 clientId: override.clientId 31547 }); 31548 overriddenClientIds.push(override.clientId); 31549 } 31550 } 31551 } 31552 return newOverrides; 31553 }, [config, overrides, getBlockStyles, getBlockName]); 31554 if (!overridesWithConfig || !overridesWithConfig.length) { 31555 return; 31556 } 31557 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: overridesWithConfig.map((override) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(OverrideStyles, { override }, override.id)) }); 31558 } 31559 function getVariationStylesWithRefValues(globalStyles, name, variation) { 31560 if (!globalStyles?.styles?.blocks?.[name]?.variations?.[variation]) { 31561 return; 31562 } 31563 const replaceRefs = (variationStyles) => { 31564 Object.keys(variationStyles).forEach((key) => { 31565 const value = variationStyles[key]; 31566 if (typeof value === "object" && value !== null) { 31567 if (value.ref !== void 0) { 31568 if (typeof value.ref !== "string" || value.ref.trim() === "") { 31569 delete variationStyles[key]; 31570 } else { 31571 const refValue = getValueFromObjectPath( 31572 globalStyles, 31573 value.ref 31574 ); 31575 if (refValue) { 31576 variationStyles[key] = refValue; 31577 } else { 31578 delete variationStyles[key]; 31579 } 31580 } 31581 } else { 31582 replaceRefs(value); 31583 if (Object.keys(value).length === 0) { 31584 delete variationStyles[key]; 31585 } 31586 } 31587 } 31588 }); 31589 }; 31590 const styles = JSON.parse( 31591 JSON.stringify( 31592 globalStyles.styles.blocks[name].variations[variation] 31593 ) 31594 ); 31595 replaceRefs(styles); 31596 return styles; 31597 } 31598 function useBlockStyleVariation(name, variation, clientId) { 31599 const { merged: mergedConfig } = (0,external_wp_element_namespaceObject.useContext)(GlobalStylesContext); 31600 const { globalSettings, globalStyles } = (0,external_wp_data_namespaceObject.useSelect)((select) => { 31601 const settings = select(store).getSettings(); 31602 return { 31603 globalSettings: settings.__experimentalFeatures, 31604 globalStyles: settings[globalStylesDataKey] 31605 }; 31606 }, []); 31607 return (0,external_wp_element_namespaceObject.useMemo)(() => { 31608 const variationStyles = getVariationStylesWithRefValues( 31609 { 31610 settings: mergedConfig?.settings ?? globalSettings, 31611 styles: mergedConfig?.styles ?? globalStyles 31612 }, 31613 name, 31614 variation 31615 ); 31616 return { 31617 settings: mergedConfig?.settings ?? globalSettings, 31618 // The variation style data is all that is needed to generate 31619 // the styles for the current application to a block. The variation 31620 // name is updated to match the instance specific class name. 31621 styles: { 31622 blocks: { 31623 [name]: { 31624 variations: { 31625 [`$variation}-$clientId}`]: variationStyles 31626 } 31627 } 31628 } 31629 } 31630 }; 31631 }, [ 31632 mergedConfig, 31633 globalSettings, 31634 globalStyles, 31635 variation, 31636 clientId, 31637 name 31638 ]); 31639 } 31640 function block_style_variation_useBlockProps({ name, className, clientId }) { 31641 const { getBlockStyles } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blocks_namespaceObject.store); 31642 const registeredStyles = getBlockStyles(name); 31643 const variation = getVariationNameFromClass(className, registeredStyles); 31644 const variationClass = `$VARIATION_PREFIX}$variation}-$clientId}`; 31645 const { settings, styles } = useBlockStyleVariation( 31646 name, 31647 variation, 31648 clientId 31649 ); 31650 const variationStyles = (0,external_wp_element_namespaceObject.useMemo)(() => { 31651 if (!variation) { 31652 return; 31653 } 31654 const variationConfig = { settings, styles }; 31655 const blockSelectors = getBlockSelectors( 31656 (0,external_wp_blocks_namespaceObject.getBlockTypes)(), 31657 getBlockStyles, 31658 clientId 31659 ); 31660 const hasBlockGapSupport = false; 31661 const hasFallbackGapSupport = true; 31662 const disableLayoutStyles = true; 31663 const disableRootPadding = true; 31664 return toStyles( 31665 variationConfig, 31666 blockSelectors, 31667 hasBlockGapSupport, 31668 hasFallbackGapSupport, 31669 disableLayoutStyles, 31670 disableRootPadding, 31671 { 31672 blockGap: false, 31673 blockStyles: true, 31674 layoutStyles: false, 31675 marginReset: false, 31676 presets: false, 31677 rootPadding: false, 31678 variationStyles: true 31679 } 31680 ); 31681 }, [variation, settings, styles, getBlockStyles, clientId]); 31682 usePrivateStyleOverride({ 31683 id: `variation-$clientId}`, 31684 css: variationStyles, 31685 __unstableType: "variation", 31686 variation, 31687 // The clientId will be stored with the override and used to ensure 31688 // the order of overrides matches the order of blocks so that the 31689 // correct CSS cascade is maintained. 31690 clientId 31691 }); 31692 return variation ? { className: variationClass } : {}; 31693 } 31694 var block_style_variation_default = { 31695 hasSupport: () => true, 31696 attributeKeys: ["className"], 31697 isMatch: ({ className }) => getVariationMatches(className).length > 0, 31698 useBlockProps: block_style_variation_useBlockProps 31699 }; 31700 31701 31702 ;// ./node_modules/@wordpress/block-editor/build-module/hooks/layout.js 31703 31704 31705 31706 31707 31708 31709 31710 31711 31712 31713 31714 31715 31716 31717 31718 31719 const layoutBlockSupportKey = "layout"; 31720 const { kebabCase: layout_kebabCase } = unlock(external_wp_components_namespaceObject.privateApis); 31721 function hasLayoutBlockSupport(blockName) { 31722 return (0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockName, "layout") || (0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockName, "__experimentalLayout"); 31723 } 31724 function useLayoutClasses(blockAttributes = {}, blockName = "") { 31725 const { layout } = blockAttributes; 31726 const { default: defaultBlockLayout } = (0,external_wp_blocks_namespaceObject.getBlockSupport)(blockName, layoutBlockSupportKey) || {}; 31727 const usedLayout = layout?.inherit || layout?.contentSize || layout?.wideSize ? { ...layout, type: "constrained" } : layout || defaultBlockLayout || {}; 31728 const layoutClassnames = []; 31729 if (LAYOUT_DEFINITIONS[usedLayout?.type || "default"]?.className) { 31730 const baseClassName = LAYOUT_DEFINITIONS[usedLayout?.type || "default"]?.className; 31731 const splitBlockName = blockName.split("/"); 31732 const fullBlockName = splitBlockName[0] === "core" ? splitBlockName.pop() : splitBlockName.join("-"); 31733 const compoundClassName = `wp-block-$fullBlockName}-$baseClassName}`; 31734 layoutClassnames.push(baseClassName, compoundClassName); 31735 } 31736 const hasGlobalPadding = (0,external_wp_data_namespaceObject.useSelect)( 31737 (select) => { 31738 return (usedLayout?.inherit || usedLayout?.contentSize || usedLayout?.type === "constrained") && select(store).getSettings().__experimentalFeatures?.useRootPaddingAwareAlignments; 31739 }, 31740 [usedLayout?.contentSize, usedLayout?.inherit, usedLayout?.type] 31741 ); 31742 if (hasGlobalPadding) { 31743 layoutClassnames.push("has-global-padding"); 31744 } 31745 if (usedLayout?.orientation) { 31746 layoutClassnames.push(`is-$layout_kebabCase(usedLayout.orientation)}`); 31747 } 31748 if (usedLayout?.justifyContent) { 31749 layoutClassnames.push( 31750 `is-content-justification-$layout_kebabCase( 31751 usedLayout.justifyContent 31752 )}` 31753 ); 31754 } 31755 if (usedLayout?.flexWrap && usedLayout.flexWrap === "nowrap") { 31756 layoutClassnames.push("is-nowrap"); 31757 } 31758 return layoutClassnames; 31759 } 31760 function useLayoutStyles(blockAttributes = {}, blockName, selector) { 31761 const { layout = {}, style = {} } = blockAttributes; 31762 const usedLayout = layout?.inherit || layout?.contentSize || layout?.wideSize ? { ...layout, type: "constrained" } : layout || {}; 31763 const fullLayoutType = getLayoutType(usedLayout?.type || "default"); 31764 const [blockGapSupport] = use_settings_useSettings("spacing.blockGap"); 31765 const hasBlockGapSupport = blockGapSupport !== null; 31766 return fullLayoutType?.getLayoutStyle?.({ 31767 blockName, 31768 selector, 31769 layout, 31770 style, 31771 hasBlockGapSupport 31772 }); 31773 } 31774 function LayoutPanelPure({ 31775 layout, 31776 setAttributes, 31777 name: blockName, 31778 clientId 31779 }) { 31780 const settings = useBlockSettings(blockName); 31781 const { layout: layoutSettings } = settings; 31782 const { themeSupportsLayout } = (0,external_wp_data_namespaceObject.useSelect)((select) => { 31783 const { getSettings } = select(store); 31784 return { 31785 themeSupportsLayout: getSettings().supportsLayout 31786 }; 31787 }, []); 31788 const blockEditingMode = useBlockEditingMode(); 31789 if (blockEditingMode !== "default") { 31790 return null; 31791 } 31792 const layoutBlockSupport = (0,external_wp_blocks_namespaceObject.getBlockSupport)( 31793 blockName, 31794 layoutBlockSupportKey, 31795 {} 31796 ); 31797 const blockSupportAndThemeSettings = { 31798 ...layoutSettings, 31799 ...layoutBlockSupport 31800 }; 31801 const { 31802 allowSwitching, 31803 allowEditing = true, 31804 allowInheriting = true, 31805 default: defaultBlockLayout 31806 } = blockSupportAndThemeSettings; 31807 if (!allowEditing) { 31808 return null; 31809 } 31810 const blockSupportAndLayout = { 31811 ...layoutBlockSupport, 31812 ...layout 31813 }; 31814 const { type, default: { type: defaultType = "default" } = {} } = blockSupportAndLayout; 31815 const blockLayoutType = type || defaultType; 31816 const showInheritToggle = !!(allowInheriting && (!blockLayoutType || blockLayoutType === "default" || blockLayoutType === "constrained" || blockSupportAndLayout.inherit)); 31817 const usedLayout = layout || defaultBlockLayout || {}; 31818 const { inherit = false, contentSize = null } = usedLayout; 31819 if ((blockLayoutType === "default" || blockLayoutType === "constrained") && !themeSupportsLayout) { 31820 return null; 31821 } 31822 const layoutType = getLayoutType(blockLayoutType); 31823 const constrainedType = getLayoutType("constrained"); 31824 const displayControlsForLegacyLayouts = !usedLayout.type && (contentSize || inherit); 31825 const hasContentSizeOrLegacySettings = !!inherit || !!contentSize; 31826 const onChangeType = (newType) => setAttributes({ layout: { type: newType } }); 31827 const onChangeLayout = (newLayout) => setAttributes({ layout: newLayout }); 31828 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 31829 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls_default, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.PanelBody, { title: (0,external_wp_i18n_namespaceObject.__)("Layout"), children: [ 31830 showInheritToggle && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 31831 external_wp_components_namespaceObject.ToggleControl, 31832 { 31833 __nextHasNoMarginBottom: true, 31834 label: (0,external_wp_i18n_namespaceObject.__)("Inner blocks use content width"), 31835 checked: layoutType?.name === "constrained" || hasContentSizeOrLegacySettings, 31836 onChange: () => setAttributes({ 31837 layout: { 31838 type: layoutType?.name === "constrained" || hasContentSizeOrLegacySettings ? "default" : "constrained" 31839 } 31840 }), 31841 help: layoutType?.name === "constrained" || hasContentSizeOrLegacySettings ? (0,external_wp_i18n_namespaceObject.__)( 31842 "Nested blocks use content width with options for full and wide widths." 31843 ) : (0,external_wp_i18n_namespaceObject.__)( 31844 "Nested blocks will fill the width of this container." 31845 ) 31846 } 31847 ) }), 31848 !inherit && allowSwitching && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 31849 LayoutTypeSwitcher, 31850 { 31851 type: blockLayoutType, 31852 onChange: onChangeType 31853 } 31854 ), 31855 layoutType && layoutType.name !== "default" && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 31856 layoutType.inspectorControls, 31857 { 31858 layout: usedLayout, 31859 onChange: onChangeLayout, 31860 layoutBlockSupport: blockSupportAndThemeSettings, 31861 name: blockName, 31862 clientId 31863 } 31864 ), 31865 constrainedType && displayControlsForLegacyLayouts && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 31866 constrainedType.inspectorControls, 31867 { 31868 layout: usedLayout, 31869 onChange: onChangeLayout, 31870 layoutBlockSupport: blockSupportAndThemeSettings, 31871 name: blockName, 31872 clientId 31873 } 31874 ) 31875 ] }) }), 31876 !inherit && layoutType && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 31877 layoutType.toolBarControls, 31878 { 31879 layout: usedLayout, 31880 onChange: onChangeLayout, 31881 layoutBlockSupport, 31882 name: blockName, 31883 clientId 31884 } 31885 ) 31886 ] }); 31887 } 31888 var layout_default = { 31889 shareWithChildBlocks: true, 31890 edit: LayoutPanelPure, 31891 attributeKeys: ["layout"], 31892 hasSupport(name) { 31893 return hasLayoutBlockSupport(name); 31894 } 31895 }; 31896 function LayoutTypeSwitcher({ type, onChange }) { 31897 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 31898 external_wp_components_namespaceObject.__experimentalToggleGroupControl, 31899 { 31900 __next40pxDefaultSize: true, 31901 isBlock: true, 31902 label: (0,external_wp_i18n_namespaceObject.__)("Layout type"), 31903 __nextHasNoMarginBottom: true, 31904 hideLabelFromVision: true, 31905 isAdaptiveWidth: true, 31906 value: type, 31907 onChange, 31908 children: getLayoutTypes().map(({ name, label }) => { 31909 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 31910 external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, 31911 { 31912 value: name, 31913 label 31914 }, 31915 name 31916 ); 31917 }) 31918 } 31919 ); 31920 } 31921 function layout_addAttribute(settings) { 31922 if ("type" in (settings.attributes?.layout ?? {})) { 31923 return settings; 31924 } 31925 if (hasLayoutBlockSupport(settings)) { 31926 settings.attributes = { 31927 ...settings.attributes, 31928 layout: { 31929 type: "object" 31930 } 31931 }; 31932 } 31933 return settings; 31934 } 31935 function BlockWithLayoutStyles({ 31936 block: BlockListBlock, 31937 props, 31938 blockGapSupport, 31939 layoutClasses 31940 }) { 31941 const { name, attributes } = props; 31942 const id = (0,external_wp_compose_namespaceObject.useInstanceId)(BlockListBlock); 31943 const { layout } = attributes; 31944 const { default: defaultBlockLayout } = (0,external_wp_blocks_namespaceObject.getBlockSupport)(name, layoutBlockSupportKey) || {}; 31945 const usedLayout = layout?.inherit || layout?.contentSize || layout?.wideSize ? { ...layout, type: "constrained" } : layout || defaultBlockLayout || {}; 31946 const selectorPrefix = `wp-container-$layout_kebabCase(name)}-is-layout-`; 31947 const selector = `.$selectorPrefix}$id}`; 31948 const hasBlockGapSupport = blockGapSupport !== null; 31949 const fullLayoutType = getLayoutType(usedLayout?.type || "default"); 31950 const css = fullLayoutType?.getLayoutStyle?.({ 31951 blockName: name, 31952 selector, 31953 layout: usedLayout, 31954 style: attributes?.style, 31955 hasBlockGapSupport 31956 }); 31957 const layoutClassNames = dist_clsx( 31958 { 31959 [`$selectorPrefix}$id}`]: !!css 31960 // Only attach a container class if there is generated CSS to be attached. 31961 }, 31962 layoutClasses 31963 ); 31964 useStyleOverride({ css }); 31965 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 31966 BlockListBlock, 31967 { 31968 ...props, 31969 __unstableLayoutClassNames: layoutClassNames 31970 } 31971 ); 31972 } 31973 const withLayoutStyles = (0,external_wp_compose_namespaceObject.createHigherOrderComponent)( 31974 (BlockListBlock) => (props) => { 31975 const { clientId, name, attributes } = props; 31976 const blockSupportsLayout = hasLayoutBlockSupport(name); 31977 const layoutClasses = useLayoutClasses(attributes, name); 31978 const extraProps = (0,external_wp_data_namespaceObject.useSelect)( 31979 (select) => { 31980 if (!blockSupportsLayout) { 31981 return; 31982 } 31983 const { getSettings, getBlockSettings } = unlock( 31984 select(store) 31985 ); 31986 const { disableLayoutStyles } = getSettings(); 31987 if (disableLayoutStyles) { 31988 return; 31989 } 31990 const [blockGapSupport] = getBlockSettings( 31991 clientId, 31992 "spacing.blockGap" 31993 ); 31994 return { blockGapSupport }; 31995 }, 31996 [blockSupportsLayout, clientId] 31997 ); 31998 if (!extraProps) { 31999 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 32000 BlockListBlock, 32001 { 32002 ...props, 32003 __unstableLayoutClassNames: blockSupportsLayout ? layoutClasses : void 0 32004 } 32005 ); 32006 } 32007 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 32008 BlockWithLayoutStyles, 32009 { 32010 block: BlockListBlock, 32011 props, 32012 layoutClasses, 32013 ...extraProps 32014 } 32015 ); 32016 }, 32017 "withLayoutStyles" 32018 ); 32019 (0,external_wp_hooks_namespaceObject.addFilter)( 32020 "blocks.registerBlockType", 32021 "core/layout/addAttribute", 32022 layout_addAttribute 32023 ); 32024 (0,external_wp_hooks_namespaceObject.addFilter)( 32025 "editor.BlockListBlock", 32026 "core/editor/layout/with-layout-styles", 32027 withLayoutStyles 32028 ); 32029 32030 32031 ;// ./node_modules/@wordpress/block-editor/build-module/components/grid/utils.js 32032 function range(start, length) { 32033 return Array.from({ length }, (_, i) => start + i); 32034 } 32035 class GridRect { 32036 constructor({ 32037 columnStart, 32038 rowStart, 32039 columnEnd, 32040 rowEnd, 32041 columnSpan, 32042 rowSpan 32043 } = {}) { 32044 this.columnStart = columnStart ?? 1; 32045 this.rowStart = rowStart ?? 1; 32046 if (columnSpan !== void 0) { 32047 this.columnEnd = this.columnStart + columnSpan - 1; 32048 } else { 32049 this.columnEnd = columnEnd ?? this.columnStart; 32050 } 32051 if (rowSpan !== void 0) { 32052 this.rowEnd = this.rowStart + rowSpan - 1; 32053 } else { 32054 this.rowEnd = rowEnd ?? this.rowStart; 32055 } 32056 } 32057 get columnSpan() { 32058 return this.columnEnd - this.columnStart + 1; 32059 } 32060 get rowSpan() { 32061 return this.rowEnd - this.rowStart + 1; 32062 } 32063 contains(column, row) { 32064 return column >= this.columnStart && column <= this.columnEnd && row >= this.rowStart && row <= this.rowEnd; 32065 } 32066 containsRect(rect) { 32067 return this.contains(rect.columnStart, rect.rowStart) && this.contains(rect.columnEnd, rect.rowEnd); 32068 } 32069 intersectsRect(rect) { 32070 return this.columnStart <= rect.columnEnd && this.columnEnd >= rect.columnStart && this.rowStart <= rect.rowEnd && this.rowEnd >= rect.rowStart; 32071 } 32072 } 32073 function utils_getComputedCSS(element, property) { 32074 return element.ownerDocument.defaultView.getComputedStyle(element).getPropertyValue(property); 32075 } 32076 function getGridTracks(template, gap) { 32077 const tracks = []; 32078 for (const size of template.split(" ")) { 32079 const previousTrack = tracks[tracks.length - 1]; 32080 const start = previousTrack ? previousTrack.end + gap : 0; 32081 const end = start + parseFloat(size); 32082 tracks.push({ start, end }); 32083 } 32084 return tracks; 32085 } 32086 function getClosestTrack(tracks, position, edge = "start") { 32087 return tracks.reduce( 32088 (closest, track, index) => Math.abs(track[edge] - position) < Math.abs(tracks[closest][edge] - position) ? index : closest, 32089 0 32090 ); 32091 } 32092 function getGridRect(gridElement, rect) { 32093 const columnGap = parseFloat(utils_getComputedCSS(gridElement, "column-gap")); 32094 const rowGap = parseFloat(utils_getComputedCSS(gridElement, "row-gap")); 32095 const gridColumnTracks = getGridTracks( 32096 utils_getComputedCSS(gridElement, "grid-template-columns"), 32097 columnGap 32098 ); 32099 const gridRowTracks = getGridTracks( 32100 utils_getComputedCSS(gridElement, "grid-template-rows"), 32101 rowGap 32102 ); 32103 const columnStart = getClosestTrack(gridColumnTracks, rect.left) + 1; 32104 const rowStart = getClosestTrack(gridRowTracks, rect.top) + 1; 32105 const columnEnd = getClosestTrack(gridColumnTracks, rect.right, "end") + 1; 32106 const rowEnd = getClosestTrack(gridRowTracks, rect.bottom, "end") + 1; 32107 return new GridRect({ 32108 columnStart, 32109 columnEnd, 32110 rowStart, 32111 rowEnd 32112 }); 32113 } 32114 function getGridItemRect(gridItemElement) { 32115 return getGridRect( 32116 gridItemElement.parentElement, 32117 new window.DOMRect( 32118 gridItemElement.offsetLeft, 32119 gridItemElement.offsetTop, 32120 gridItemElement.offsetWidth, 32121 gridItemElement.offsetHeight 32122 ) 32123 ); 32124 } 32125 function getGridInfo(gridElement) { 32126 const gridTemplateColumns = utils_getComputedCSS( 32127 gridElement, 32128 "grid-template-columns" 32129 ); 32130 const gridTemplateRows = utils_getComputedCSS( 32131 gridElement, 32132 "grid-template-rows" 32133 ); 32134 const borderTopWidth = utils_getComputedCSS(gridElement, "border-top-width"); 32135 const borderRightWidth = utils_getComputedCSS( 32136 gridElement, 32137 "border-right-width" 32138 ); 32139 const borderBottomWidth = utils_getComputedCSS( 32140 gridElement, 32141 "border-bottom-width" 32142 ); 32143 const borderLeftWidth = utils_getComputedCSS(gridElement, "border-left-width"); 32144 const paddingTop = utils_getComputedCSS(gridElement, "padding-top"); 32145 const paddingRight = utils_getComputedCSS(gridElement, "padding-right"); 32146 const paddingBottom = utils_getComputedCSS(gridElement, "padding-bottom"); 32147 const paddingLeft = utils_getComputedCSS(gridElement, "padding-left"); 32148 const numColumns = gridTemplateColumns.split(" ").length; 32149 const numRows = gridTemplateRows.split(" ").length; 32150 const numItems = numColumns * numRows; 32151 return { 32152 numColumns, 32153 numRows, 32154 numItems, 32155 currentColor: utils_getComputedCSS(gridElement, "color"), 32156 style: { 32157 gridTemplateColumns, 32158 gridTemplateRows, 32159 gap: utils_getComputedCSS(gridElement, "gap"), 32160 inset: ` 32161 calc($paddingTop} + $borderTopWidth}) 32162 calc($paddingRight} + $borderRightWidth}) 32163 calc($paddingBottom} + $borderBottomWidth}) 32164 calc($paddingLeft} + $borderLeftWidth}) 32165 ` 32166 } 32167 }; 32168 } 32169 32170 32171 ;// ./node_modules/@wordpress/block-editor/build-module/components/inserter/tips.js 32172 32173 32174 32175 32176 const globalTips = [ 32177 (0,external_wp_element_namespaceObject.createInterpolateElement)( 32178 (0,external_wp_i18n_namespaceObject.__)( 32179 "While writing, you can press <kbd>/</kbd> to quickly insert new blocks." 32180 ), 32181 { kbd: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("kbd", {}) } 32182 ), 32183 (0,external_wp_element_namespaceObject.createInterpolateElement)( 32184 (0,external_wp_i18n_namespaceObject.__)( 32185 "Indent a list by pressing <kbd>space</kbd> at the beginning of a line." 32186 ), 32187 { kbd: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("kbd", {}) } 32188 ), 32189 (0,external_wp_element_namespaceObject.createInterpolateElement)( 32190 (0,external_wp_i18n_namespaceObject.__)( 32191 "Outdent a list by pressing <kbd>backspace</kbd> at the beginning of a line." 32192 ), 32193 { kbd: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("kbd", {}) } 32194 ), 32195 (0,external_wp_i18n_namespaceObject.__)("Drag files into the editor to automatically insert media blocks."), 32196 (0,external_wp_i18n_namespaceObject.__)("Change a block's type by pressing the block icon on the toolbar.") 32197 ]; 32198 function Tips() { 32199 const [randomIndex] = (0,external_wp_element_namespaceObject.useState)( 32200 // Disable Reason: I'm not generating an HTML id. 32201 // eslint-disable-next-line no-restricted-syntax 32202 Math.floor(Math.random() * globalTips.length) 32203 ); 32204 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Tip, { children: globalTips[randomIndex] }); 32205 } 32206 var tips_default = Tips; 32207 32208 32209 ;// ./node_modules/@wordpress/icons/build-module/library/chevron-right.js 32210 32211 32212 var chevron_right_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M10.6 6L9.4 7l4.6 5-4.6 5 1.2 1 5.4-6z" }) }); 32213 32214 32215 ;// ./node_modules/@wordpress/icons/build-module/library/chevron-left.js 32216 32217 32218 var chevron_left_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M14.6 7l-1.2-1L8 12l5.4 6 1.2-1-4.6-5z" }) }); 32219 32220 32221 ;// ./node_modules/@wordpress/block-editor/build-module/components/block-card/index.js 32222 32223 32224 32225 32226 32227 32228 32229 32230 32231 32232 const { Badge } = unlock(external_wp_components_namespaceObject.privateApis); 32233 function BlockCard({ 32234 title, 32235 icon, 32236 description, 32237 blockType, 32238 className, 32239 name, 32240 allowParentNavigation, 32241 children 32242 }) { 32243 if (blockType) { 32244 external_wp_deprecated_default()("`blockType` property in `BlockCard component`", { 32245 since: "5.7", 32246 alternative: "`title, icon and description` properties" 32247 }); 32248 ({ title, icon, description } = blockType); 32249 } 32250 const parentNavBlockClientId = (0,external_wp_data_namespaceObject.useSelect)( 32251 (select) => { 32252 if (!allowParentNavigation) { 32253 return; 32254 } 32255 const { getSelectedBlockClientId, getBlockParentsByBlockName } = select(store); 32256 const _selectedBlockClientId = getSelectedBlockClientId(); 32257 return getBlockParentsByBlockName( 32258 _selectedBlockClientId, 32259 "core/navigation", 32260 true 32261 )[0]; 32262 }, 32263 [allowParentNavigation] 32264 ); 32265 const { selectBlock } = (0,external_wp_data_namespaceObject.useDispatch)(store); 32266 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: dist_clsx("block-editor-block-card", className), children: [ 32267 allowParentNavigation && parentNavBlockClientId && // This is only used by the Navigation block for now. It's not ideal having Navigation block specific code here. 32268 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 32269 external_wp_components_namespaceObject.Button, 32270 { 32271 onClick: () => selectBlock(parentNavBlockClientId), 32272 label: (0,external_wp_i18n_namespaceObject.__)("Go to parent Navigation block"), 32273 style: ( 32274 // TODO: This style override is also used in ToolsPanelHeader. 32275 // It should be supported out-of-the-box by Button. 32276 { minWidth: 24, padding: 0 } 32277 ), 32278 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_right_default : chevron_left_default, 32279 size: "small" 32280 } 32281 ), 32282 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(block_icon_default, { icon, showColors: true }), 32283 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 1, children: [ 32284 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("h2", { className: "block-editor-block-card__title", children: [ 32285 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "block-editor-block-card__name", children: !!name?.length ? name : title }), 32286 !!name?.length && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Badge, { children: title }) 32287 ] }), 32288 description && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { className: "block-editor-block-card__description", children: description }), 32289 children 32290 ] }) 32291 ] }); 32292 } 32293 var block_card_default = BlockCard; 32294 32295 32296 ;// ./node_modules/@wordpress/upload-media/build-module/store/types.js 32297 var Type = /* @__PURE__ */ ((Type2) => { 32298 Type2["Unknown"] = "REDUX_UNKNOWN"; 32299 Type2["Add"] = "ADD_ITEM"; 32300 Type2["Prepare"] = "PREPARE_ITEM"; 32301 Type2["Cancel"] = "CANCEL_ITEM"; 32302 Type2["Remove"] = "REMOVE_ITEM"; 32303 Type2["PauseItem"] = "PAUSE_ITEM"; 32304 Type2["ResumeItem"] = "RESUME_ITEM"; 32305 Type2["PauseQueue"] = "PAUSE_QUEUE"; 32306 Type2["ResumeQueue"] = "RESUME_QUEUE"; 32307 Type2["OperationStart"] = "OPERATION_START"; 32308 Type2["OperationFinish"] = "OPERATION_FINISH"; 32309 Type2["AddOperations"] = "ADD_OPERATIONS"; 32310 Type2["CacheBlobUrl"] = "CACHE_BLOB_URL"; 32311 Type2["RevokeBlobUrls"] = "REVOKE_BLOB_URLS"; 32312 Type2["UpdateSettings"] = "UPDATE_SETTINGS"; 32313 return Type2; 32314 })(Type || {}); 32315 var ItemStatus = /* @__PURE__ */ ((ItemStatus2) => { 32316 ItemStatus2["Processing"] = "PROCESSING"; 32317 ItemStatus2["Paused"] = "PAUSED"; 32318 return ItemStatus2; 32319 })(ItemStatus || {}); 32320 var OperationType = /* @__PURE__ */ ((OperationType2) => { 32321 OperationType2["Prepare"] = "PREPARE"; 32322 OperationType2["Upload"] = "UPLOAD"; 32323 return OperationType2; 32324 })(OperationType || {}); 32325 32326 32327 ;// ./node_modules/@wordpress/upload-media/build-module/store/reducer.js 32328 32329 const reducer_noop = () => { 32330 }; 32331 const DEFAULT_STATE = { 32332 queue: [], 32333 queueStatus: "active", 32334 blobUrls: {}, 32335 settings: { 32336 mediaUpload: reducer_noop 32337 } 32338 }; 32339 function reducer_reducer(state = DEFAULT_STATE, action = { type: Type.Unknown }) { 32340 switch (action.type) { 32341 case Type.PauseQueue: { 32342 return { 32343 ...state, 32344 queueStatus: "paused" 32345 }; 32346 } 32347 case Type.ResumeQueue: { 32348 return { 32349 ...state, 32350 queueStatus: "active" 32351 }; 32352 } 32353 case Type.Add: 32354 return { 32355 ...state, 32356 queue: [...state.queue, action.item] 32357 }; 32358 case Type.Cancel: 32359 return { 32360 ...state, 32361 queue: state.queue.map( 32362 (item) => item.id === action.id ? { 32363 ...item, 32364 error: action.error 32365 } : item 32366 ) 32367 }; 32368 case Type.Remove: 32369 return { 32370 ...state, 32371 queue: state.queue.filter((item) => item.id !== action.id) 32372 }; 32373 case Type.OperationStart: { 32374 return { 32375 ...state, 32376 queue: state.queue.map( 32377 (item) => item.id === action.id ? { 32378 ...item, 32379 currentOperation: action.operation 32380 } : item 32381 ) 32382 }; 32383 } 32384 case Type.AddOperations: 32385 return { 32386 ...state, 32387 queue: state.queue.map((item) => { 32388 if (item.id !== action.id) { 32389 return item; 32390 } 32391 return { 32392 ...item, 32393 operations: [ 32394 ...item.operations || [], 32395 ...action.operations 32396 ] 32397 }; 32398 }) 32399 }; 32400 case Type.OperationFinish: 32401 return { 32402 ...state, 32403 queue: state.queue.map((item) => { 32404 if (item.id !== action.id) { 32405 return item; 32406 } 32407 const operations = item.operations ? item.operations.slice(1) : []; 32408 const attachment = item.attachment || action.item.attachment ? { 32409 ...item.attachment, 32410 ...action.item.attachment 32411 } : void 0; 32412 return { 32413 ...item, 32414 currentOperation: void 0, 32415 operations, 32416 ...action.item, 32417 attachment, 32418 additionalData: { 32419 ...item.additionalData, 32420 ...action.item.additionalData 32421 } 32422 }; 32423 }) 32424 }; 32425 case Type.CacheBlobUrl: { 32426 const blobUrls = state.blobUrls[action.id] || []; 32427 return { 32428 ...state, 32429 blobUrls: { 32430 ...state.blobUrls, 32431 [action.id]: [...blobUrls, action.blobUrl] 32432 } 32433 }; 32434 } 32435 case Type.RevokeBlobUrls: { 32436 const newBlobUrls = { ...state.blobUrls }; 32437 delete newBlobUrls[action.id]; 32438 return { 32439 ...state, 32440 blobUrls: newBlobUrls 32441 }; 32442 } 32443 case Type.UpdateSettings: { 32444 return { 32445 ...state, 32446 settings: { 32447 ...state.settings, 32448 ...action.settings 32449 } 32450 }; 32451 } 32452 } 32453 return state; 32454 } 32455 var reducer_reducer_default = reducer_reducer; 32456 32457 32458 ;// ./node_modules/@wordpress/upload-media/build-module/store/selectors.js 32459 function getItems(state) { 32460 return state.queue; 32461 } 32462 function isUploading(state) { 32463 return state.queue.length >= 1; 32464 } 32465 function isUploadingByUrl(state, url) { 32466 return state.queue.some( 32467 (item) => item.attachment?.url === url || item.sourceUrl === url 32468 ); 32469 } 32470 function isUploadingById(state, attachmentId) { 32471 return state.queue.some( 32472 (item) => item.attachment?.id === attachmentId || item.sourceAttachmentId === attachmentId 32473 ); 32474 } 32475 function selectors_getSettings(state) { 32476 return state.settings; 32477 } 32478 32479 32480 ;// ./node_modules/@wordpress/upload-media/build-module/store/private-selectors.js 32481 32482 function getAllItems(state) { 32483 return state.queue; 32484 } 32485 function getItem(state, id) { 32486 return state.queue.find((item) => item.id === id); 32487 } 32488 function isBatchUploaded(state, batchId) { 32489 const batchItems = state.queue.filter( 32490 (item) => batchId === item.batchId 32491 ); 32492 return batchItems.length === 0; 32493 } 32494 function isUploadingToPost(state, postOrAttachmentId) { 32495 return state.queue.some( 32496 (item) => item.currentOperation === OperationType.Upload && item.additionalData.post === postOrAttachmentId 32497 ); 32498 } 32499 function getPausedUploadForPost(state, postOrAttachmentId) { 32500 return state.queue.find( 32501 (item) => item.status === ItemStatus.Paused && item.additionalData.post === postOrAttachmentId 32502 ); 32503 } 32504 function isPaused(state) { 32505 return state.queueStatus === "paused"; 32506 } 32507 function getBlobUrls(state, id) { 32508 return state.blobUrls[id] || []; 32509 } 32510 32511 32512 ;// ./node_modules/@wordpress/upload-media/node_modules/uuid/dist/esm-browser/native.js 32513 const randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto); 32514 /* harmony default export */ const esm_browser_native = ({ 32515 randomUUID 32516 }); 32517 ;// ./node_modules/@wordpress/upload-media/node_modules/uuid/dist/esm-browser/rng.js 32518 // Unique ID creation requires a high quality random # generator. In the browser we therefore 32519 // require the crypto API and do not support built-in fallback to lower quality random number 32520 // generators (like Math.random()). 32521 let getRandomValues; 32522 const rnds8 = new Uint8Array(16); 32523 function rng() { 32524 // lazy load so that environments that need to polyfill have a chance to do so 32525 if (!getRandomValues) { 32526 // getRandomValues needs to be invoked in a context where "this" is a Crypto implementation. 32527 getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto); 32528 32529 if (!getRandomValues) { 32530 throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported'); 32531 } 32532 } 32533 32534 return getRandomValues(rnds8); 32535 } 32536 ;// ./node_modules/@wordpress/upload-media/node_modules/uuid/dist/esm-browser/stringify.js 32537 32538 /** 32539 * Convert array of 16 byte values to UUID string format of the form: 32540 * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX 32541 */ 32542 32543 const byteToHex = []; 32544 32545 for (let i = 0; i < 256; ++i) { 32546 byteToHex.push((i + 0x100).toString(16).slice(1)); 32547 } 32548 32549 function unsafeStringify(arr, offset = 0) { 32550 // Note: Be careful editing this code! It's been tuned for performance 32551 // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434 32552 return byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]; 32553 } 32554 32555 function stringify(arr, offset = 0) { 32556 const uuid = unsafeStringify(arr, offset); // Consistency check for valid UUID. If this throws, it's likely due to one 32557 // of the following: 32558 // - One or more input array values don't map to a hex octet (leading to 32559 // "undefined" in the uuid) 32560 // - Invalid input values for the RFC `version` or `variant` fields 32561 32562 if (!validate(uuid)) { 32563 throw TypeError('Stringified UUID is invalid'); 32564 } 32565 32566 return uuid; 32567 } 32568 32569 /* harmony default export */ const esm_browser_stringify = ((/* unused pure expression or super */ null && (stringify))); 32570 ;// ./node_modules/@wordpress/upload-media/node_modules/uuid/dist/esm-browser/v4.js 32571 32572 32573 32574 32575 function v4(options, buf, offset) { 32576 if (esm_browser_native.randomUUID && !buf && !options) { 32577 return esm_browser_native.randomUUID(); 32578 } 32579 32580 options = options || {}; 32581 const rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved` 32582 32583 rnds[6] = rnds[6] & 0x0f | 0x40; 32584 rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided 32585 32586 if (buf) { 32587 offset = offset || 0; 32588 32589 for (let i = 0; i < 16; ++i) { 32590 buf[offset + i] = rnds[i]; 32591 } 32592 32593 return buf; 32594 } 32595 32596 return unsafeStringify(rnds); 32597 } 32598 32599 /* harmony default export */ const esm_browser_v4 = (v4); 32600 ;// ./node_modules/@wordpress/upload-media/build-module/upload-error.js 32601 class UploadError extends Error { 32602 code; 32603 file; 32604 constructor({ code, message, file, cause }) { 32605 super(message, { cause }); 32606 Object.setPrototypeOf(this, new.target.prototype); 32607 this.code = code; 32608 this.file = file; 32609 } 32610 } 32611 32612 32613 ;// ./node_modules/@wordpress/upload-media/build-module/validate-mime-type.js 32614 32615 32616 function validateMimeType(file, allowedTypes) { 32617 if (!allowedTypes) { 32618 return; 32619 } 32620 const isAllowedType = allowedTypes.some((allowedType) => { 32621 if (allowedType.includes("/")) { 32622 return allowedType === file.type; 32623 } 32624 return file.type.startsWith(`$allowedType}/`); 32625 }); 32626 if (file.type && !isAllowedType) { 32627 throw new UploadError({ 32628 code: "MIME_TYPE_NOT_SUPPORTED", 32629 message: (0,external_wp_i18n_namespaceObject.sprintf)( 32630 // translators: %s: file name. 32631 (0,external_wp_i18n_namespaceObject.__)("%s: Sorry, this file type is not supported here."), 32632 file.name 32633 ), 32634 file 32635 }); 32636 } 32637 } 32638 32639 32640 ;// ./node_modules/@wordpress/upload-media/build-module/get-mime-types-array.js 32641 function getMimeTypesArray(wpMimeTypesObject) { 32642 if (!wpMimeTypesObject) { 32643 return null; 32644 } 32645 return Object.entries(wpMimeTypesObject).flatMap( 32646 ([extensionsString, mime]) => { 32647 const [type] = mime.split("/"); 32648 const extensions = extensionsString.split("|"); 32649 return [ 32650 mime, 32651 ...extensions.map( 32652 (extension) => `$type}/$extension}` 32653 ) 32654 ]; 32655 } 32656 ); 32657 } 32658 32659 32660 ;// ./node_modules/@wordpress/upload-media/build-module/validate-mime-type-for-user.js 32661 32662 32663 32664 function validateMimeTypeForUser(file, wpAllowedMimeTypes) { 32665 const allowedMimeTypesForUser = getMimeTypesArray(wpAllowedMimeTypes); 32666 if (!allowedMimeTypesForUser) { 32667 return; 32668 } 32669 const isAllowedMimeTypeForUser = allowedMimeTypesForUser.includes( 32670 file.type 32671 ); 32672 if (file.type && !isAllowedMimeTypeForUser) { 32673 throw new UploadError({ 32674 code: "MIME_TYPE_NOT_ALLOWED_FOR_USER", 32675 message: (0,external_wp_i18n_namespaceObject.sprintf)( 32676 // translators: %s: file name. 32677 (0,external_wp_i18n_namespaceObject.__)( 32678 "%s: Sorry, you are not allowed to upload this file type." 32679 ), 32680 file.name 32681 ), 32682 file 32683 }); 32684 } 32685 } 32686 32687 32688 ;// ./node_modules/@wordpress/upload-media/build-module/validate-file-size.js 32689 32690 32691 function validateFileSize(file, maxUploadFileSize) { 32692 if (file.size <= 0) { 32693 throw new UploadError({ 32694 code: "EMPTY_FILE", 32695 message: (0,external_wp_i18n_namespaceObject.sprintf)( 32696 // translators: %s: file name. 32697 (0,external_wp_i18n_namespaceObject.__)("%s: This file is empty."), 32698 file.name 32699 ), 32700 file 32701 }); 32702 } 32703 if (maxUploadFileSize && file.size > maxUploadFileSize) { 32704 throw new UploadError({ 32705 code: "SIZE_ABOVE_LIMIT", 32706 message: (0,external_wp_i18n_namespaceObject.sprintf)( 32707 // translators: %s: file name. 32708 (0,external_wp_i18n_namespaceObject.__)( 32709 "%s: This file exceeds the maximum upload size for this site." 32710 ), 32711 file.name 32712 ), 32713 file 32714 }); 32715 } 32716 } 32717 32718 32719 ;// ./node_modules/@wordpress/upload-media/build-module/store/actions.js 32720 32721 32722 32723 32724 32725 function addItems({ 32726 files, 32727 onChange, 32728 onSuccess, 32729 onError, 32730 onBatchSuccess, 32731 additionalData, 32732 allowedTypes 32733 }) { 32734 return async ({ select, dispatch }) => { 32735 const batchId = esm_browser_v4(); 32736 for (const file of files) { 32737 try { 32738 validateMimeType(file, allowedTypes); 32739 validateMimeTypeForUser( 32740 file, 32741 select.getSettings().allowedMimeTypes 32742 ); 32743 } catch (error) { 32744 onError?.(error); 32745 continue; 32746 } 32747 try { 32748 validateFileSize( 32749 file, 32750 select.getSettings().maxUploadFileSize 32751 ); 32752 } catch (error) { 32753 onError?.(error); 32754 continue; 32755 } 32756 dispatch.addItem({ 32757 file, 32758 batchId, 32759 onChange, 32760 onSuccess, 32761 onBatchSuccess, 32762 onError, 32763 additionalData 32764 }); 32765 } 32766 }; 32767 } 32768 function cancelItem(id, error, silent = false) { 32769 return async ({ select, dispatch }) => { 32770 const item = select.getItem(id); 32771 if (!item) { 32772 return; 32773 } 32774 item.abortController?.abort(); 32775 if (!silent) { 32776 const { onError } = item; 32777 onError?.(error ?? new Error("Upload cancelled")); 32778 if (!onError && error) { 32779 console.error("Upload cancelled", error); 32780 } 32781 } 32782 dispatch({ 32783 type: Type.Cancel, 32784 id, 32785 error 32786 }); 32787 dispatch.removeItem(id); 32788 dispatch.revokeBlobUrls(id); 32789 if (item.batchId && select.isBatchUploaded(item.batchId)) { 32790 item.onBatchSuccess?.(); 32791 } 32792 }; 32793 } 32794 32795 32796 ;// ./node_modules/@wordpress/upload-media/build-module/utils.js 32797 32798 32799 function convertBlobToFile(fileOrBlob) { 32800 if (fileOrBlob instanceof File) { 32801 return fileOrBlob; 32802 } 32803 const ext = fileOrBlob.type.split("/")[1]; 32804 const mediaType = "application/pdf" === fileOrBlob.type ? "document" : fileOrBlob.type.split("/")[0]; 32805 return new File([fileOrBlob], `$mediaType}.$ext}`, { 32806 type: fileOrBlob.type 32807 }); 32808 } 32809 function renameFile(file, name) { 32810 return new File([file], name, { 32811 type: file.type, 32812 lastModified: file.lastModified 32813 }); 32814 } 32815 function cloneFile(file) { 32816 return renameFile(file, file.name); 32817 } 32818 function getFileExtension(file) { 32819 return file.includes(".") ? file.split(".").pop() || null : null; 32820 } 32821 function getFileBasename(name) { 32822 return name.includes(".") ? name.split(".").slice(0, -1).join(".") : name; 32823 } 32824 function getFileNameFromUrl(url) { 32825 return getFilename(url) || _x("unnamed", "file name"); 32826 } 32827 32828 32829 ;// ./node_modules/@wordpress/upload-media/build-module/stub-file.js 32830 class StubFile extends File { 32831 constructor(fileName = "stub-file") { 32832 super([], fileName); 32833 } 32834 } 32835 32836 32837 ;// ./node_modules/@wordpress/upload-media/build-module/store/private-actions.js 32838 32839 32840 32841 32842 32843 function addItem({ 32844 file: fileOrBlob, 32845 batchId, 32846 onChange, 32847 onSuccess, 32848 onBatchSuccess, 32849 onError, 32850 additionalData = {}, 32851 sourceUrl, 32852 sourceAttachmentId, 32853 abortController, 32854 operations 32855 }) { 32856 return async ({ dispatch }) => { 32857 const itemId = esm_browser_v4(); 32858 const file = convertBlobToFile(fileOrBlob); 32859 let blobUrl; 32860 if (!(file instanceof StubFile)) { 32861 blobUrl = (0,external_wp_blob_namespaceObject.createBlobURL)(file); 32862 dispatch({ 32863 type: Type.CacheBlobUrl, 32864 id: itemId, 32865 blobUrl 32866 }); 32867 } 32868 dispatch({ 32869 type: Type.Add, 32870 item: { 32871 id: itemId, 32872 batchId, 32873 status: ItemStatus.Processing, 32874 sourceFile: cloneFile(file), 32875 file, 32876 attachment: { 32877 url: blobUrl 32878 }, 32879 additionalData: { 32880 convert_format: false, 32881 ...additionalData 32882 }, 32883 onChange, 32884 onSuccess, 32885 onBatchSuccess, 32886 onError, 32887 sourceUrl, 32888 sourceAttachmentId, 32889 abortController: abortController || new AbortController(), 32890 operations: Array.isArray(operations) ? operations : [OperationType.Prepare] 32891 } 32892 }); 32893 dispatch.processItem(itemId); 32894 }; 32895 } 32896 function processItem(id) { 32897 return async ({ select, dispatch }) => { 32898 if (select.isPaused()) { 32899 return; 32900 } 32901 const item = select.getItem(id); 32902 const { attachment, onChange, onSuccess, onBatchSuccess, batchId } = item; 32903 const operation = Array.isArray(item.operations?.[0]) ? item.operations[0][0] : item.operations?.[0]; 32904 if (attachment) { 32905 onChange?.([attachment]); 32906 } 32907 if (!operation) { 32908 if (attachment) { 32909 onSuccess?.([attachment]); 32910 } 32911 dispatch.revokeBlobUrls(id); 32912 if (batchId && select.isBatchUploaded(batchId)) { 32913 onBatchSuccess?.(); 32914 } 32915 return; 32916 } 32917 if (!operation) { 32918 return; 32919 } 32920 dispatch({ 32921 type: Type.OperationStart, 32922 id, 32923 operation 32924 }); 32925 switch (operation) { 32926 case OperationType.Prepare: 32927 dispatch.prepareItem(item.id); 32928 break; 32929 case OperationType.Upload: 32930 dispatch.uploadItem(id); 32931 break; 32932 } 32933 }; 32934 } 32935 function pauseQueue() { 32936 return { 32937 type: Type.PauseQueue 32938 }; 32939 } 32940 function resumeQueue() { 32941 return async ({ select, dispatch }) => { 32942 dispatch({ 32943 type: Type.ResumeQueue 32944 }); 32945 for (const item of select.getAllItems()) { 32946 dispatch.processItem(item.id); 32947 } 32948 }; 32949 } 32950 function removeItem(id) { 32951 return async ({ select, dispatch }) => { 32952 const item = select.getItem(id); 32953 if (!item) { 32954 return; 32955 } 32956 dispatch({ 32957 type: Type.Remove, 32958 id 32959 }); 32960 }; 32961 } 32962 function finishOperation(id, updates) { 32963 return async ({ dispatch }) => { 32964 dispatch({ 32965 type: Type.OperationFinish, 32966 id, 32967 item: updates 32968 }); 32969 dispatch.processItem(id); 32970 }; 32971 } 32972 function prepareItem(id) { 32973 return async ({ dispatch }) => { 32974 const operations = [OperationType.Upload]; 32975 dispatch({ 32976 type: Type.AddOperations, 32977 id, 32978 operations 32979 }); 32980 dispatch.finishOperation(id, {}); 32981 }; 32982 } 32983 function uploadItem(id) { 32984 return async ({ select, dispatch }) => { 32985 const item = select.getItem(id); 32986 select.getSettings().mediaUpload({ 32987 filesList: [item.file], 32988 additionalData: item.additionalData, 32989 signal: item.abortController?.signal, 32990 onFileChange: ([attachment]) => { 32991 if (!(0,external_wp_blob_namespaceObject.isBlobURL)(attachment.url)) { 32992 dispatch.finishOperation(id, { 32993 attachment 32994 }); 32995 } 32996 }, 32997 onSuccess: ([attachment]) => { 32998 dispatch.finishOperation(id, { 32999 attachment 33000 }); 33001 }, 33002 onError: (error) => { 33003 dispatch.cancelItem(id, error); 33004 } 33005 }); 33006 }; 33007 } 33008 function revokeBlobUrls(id) { 33009 return async ({ select, dispatch }) => { 33010 const blobUrls = select.getBlobUrls(id); 33011 for (const blobUrl of blobUrls) { 33012 (0,external_wp_blob_namespaceObject.revokeBlobURL)(blobUrl); 33013 } 33014 dispatch({ 33015 type: Type.RevokeBlobUrls, 33016 id 33017 }); 33018 }; 33019 } 33020 function private_actions_updateSettings(settings) { 33021 return { 33022 type: Type.UpdateSettings, 33023 settings 33024 }; 33025 } 33026 33027 33028 ;// ./node_modules/@wordpress/upload-media/build-module/lock-unlock.js 33029 33030 const { lock: lock_unlock_lock, unlock: lock_unlock_unlock } = (0,external_wp_privateApis_namespaceObject.__dangerousOptInToUnstableAPIsOnlyForCoreModules)( 33031 "I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.", 33032 "@wordpress/upload-media" 33033 ); 33034 33035 33036 ;// ./node_modules/@wordpress/upload-media/build-module/store/constants.js 33037 const constants_STORE_NAME = "core/upload-media"; 33038 33039 33040 ;// ./node_modules/@wordpress/upload-media/build-module/store/index.js 33041 33042 33043 33044 33045 33046 33047 33048 33049 const store_storeConfig = { 33050 reducer: reducer_reducer_default, 33051 selectors: store_selectors_namespaceObject, 33052 actions: store_actions_namespaceObject 33053 }; 33054 const store_store = (0,external_wp_data_namespaceObject.createReduxStore)(constants_STORE_NAME, { 33055 reducer: reducer_reducer_default, 33056 selectors: store_selectors_namespaceObject, 33057 actions: store_actions_namespaceObject 33058 }); 33059 (0,external_wp_data_namespaceObject.register)(store_store); 33060 lock_unlock_unlock(store_store).registerPrivateActions(store_private_actions_namespaceObject); 33061 lock_unlock_unlock(store_store).registerPrivateSelectors(store_private_selectors_namespaceObject); 33062 33063 33064 ;// ./node_modules/@wordpress/upload-media/build-module/components/provider/with-registry-provider.js 33065 33066 33067 33068 33069 33070 33071 function getSubRegistry(subRegistries, registry, useSubRegistry) { 33072 if (!useSubRegistry) { 33073 return registry; 33074 } 33075 let subRegistry = subRegistries.get(registry); 33076 if (!subRegistry) { 33077 subRegistry = (0,external_wp_data_namespaceObject.createRegistry)({}, registry); 33078 subRegistry.registerStore(constants_STORE_NAME, store_storeConfig); 33079 subRegistries.set(registry, subRegistry); 33080 } 33081 return subRegistry; 33082 } 33083 const withRegistryProvider = (0,external_wp_compose_namespaceObject.createHigherOrderComponent)( 33084 (WrappedComponent) => ({ useSubRegistry = true, ...props }) => { 33085 const registry = (0,external_wp_data_namespaceObject.useRegistry)(); 33086 const [subRegistries] = (0,external_wp_element_namespaceObject.useState)(() => /* @__PURE__ */ new WeakMap()); 33087 const subRegistry = getSubRegistry( 33088 subRegistries, 33089 registry, 33090 useSubRegistry 33091 ); 33092 if (subRegistry === registry) { 33093 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(WrappedComponent, { registry, ...props }); 33094 } 33095 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_data_namespaceObject.RegistryProvider, { value: subRegistry, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(WrappedComponent, { registry: subRegistry, ...props }) }); 33096 }, 33097 "withRegistryProvider" 33098 ); 33099 var with_registry_provider_default = withRegistryProvider; 33100 33101 33102 ;// ./node_modules/@wordpress/upload-media/build-module/components/provider/index.js 33103 33104 33105 33106 33107 33108 33109 const MediaUploadProvider = with_registry_provider_default((props) => { 33110 const { children, settings } = props; 33111 const { updateSettings } = lock_unlock_unlock((0,external_wp_data_namespaceObject.useDispatch)(store_store)); 33112 (0,external_wp_element_namespaceObject.useEffect)(() => { 33113 updateSettings(settings); 33114 }, [settings, updateSettings]); 33115 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children }); 33116 }); 33117 var provider_default = MediaUploadProvider; 33118 33119 33120 ;// ./node_modules/@wordpress/block-editor/build-module/components/provider/with-registry-provider.js 33121 33122 33123 33124 33125 33126 33127 function with_registry_provider_getSubRegistry(subRegistries, registry, useSubRegistry) { 33128 if (!useSubRegistry) { 33129 return registry; 33130 } 33131 let subRegistry = subRegistries.get(registry); 33132 if (!subRegistry) { 33133 subRegistry = (0,external_wp_data_namespaceObject.createRegistry)({}, registry); 33134 subRegistry.registerStore(STORE_NAME, storeConfig); 33135 subRegistries.set(registry, subRegistry); 33136 } 33137 return subRegistry; 33138 } 33139 const with_registry_provider_withRegistryProvider = (0,external_wp_compose_namespaceObject.createHigherOrderComponent)( 33140 (WrappedComponent) => ({ useSubRegistry = true, ...props }) => { 33141 const registry = (0,external_wp_data_namespaceObject.useRegistry)(); 33142 const [subRegistries] = (0,external_wp_element_namespaceObject.useState)(() => /* @__PURE__ */ new WeakMap()); 33143 const subRegistry = with_registry_provider_getSubRegistry( 33144 subRegistries, 33145 registry, 33146 useSubRegistry 33147 ); 33148 if (subRegistry === registry) { 33149 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(WrappedComponent, { registry, ...props }); 33150 } 33151 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_data_namespaceObject.RegistryProvider, { value: subRegistry, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(WrappedComponent, { registry: subRegistry, ...props }) }); 33152 }, 33153 "withRegistryProvider" 33154 ); 33155 var with_registry_provider_with_registry_provider_default = with_registry_provider_withRegistryProvider; 33156 33157 33158 ;// ./node_modules/@wordpress/block-editor/build-module/components/provider/use-block-sync.js 33159 33160 33161 33162 33163 const use_block_sync_noop = () => { 33164 }; 33165 function useBlockSync({ 33166 clientId = null, 33167 value: controlledBlocks, 33168 selection: controlledSelection, 33169 onChange = use_block_sync_noop, 33170 onInput = use_block_sync_noop 33171 }) { 33172 const registry = (0,external_wp_data_namespaceObject.useRegistry)(); 33173 const { 33174 resetBlocks, 33175 resetSelection, 33176 replaceInnerBlocks, 33177 setHasControlledInnerBlocks, 33178 __unstableMarkNextChangeAsNotPersistent 33179 } = registry.dispatch(store); 33180 const { getBlockName, getBlocks, getSelectionStart, getSelectionEnd } = registry.select(store); 33181 const isControlled = (0,external_wp_data_namespaceObject.useSelect)( 33182 (select) => { 33183 return !clientId || select(store).areInnerBlocksControlled(clientId); 33184 }, 33185 [clientId] 33186 ); 33187 const pendingChangesRef = (0,external_wp_element_namespaceObject.useRef)({ incoming: null, outgoing: [] }); 33188 const subscribedRef = (0,external_wp_element_namespaceObject.useRef)(false); 33189 const setControlledBlocks = () => { 33190 if (!controlledBlocks) { 33191 return; 33192 } 33193 __unstableMarkNextChangeAsNotPersistent(); 33194 if (clientId) { 33195 registry.batch(() => { 33196 setHasControlledInnerBlocks(clientId, true); 33197 const storeBlocks = controlledBlocks.map( 33198 (block) => (0,external_wp_blocks_namespaceObject.cloneBlock)(block) 33199 ); 33200 if (subscribedRef.current) { 33201 pendingChangesRef.current.incoming = storeBlocks; 33202 } 33203 __unstableMarkNextChangeAsNotPersistent(); 33204 replaceInnerBlocks(clientId, storeBlocks); 33205 }); 33206 } else { 33207 if (subscribedRef.current) { 33208 pendingChangesRef.current.incoming = controlledBlocks; 33209 } 33210 resetBlocks(controlledBlocks); 33211 } 33212 }; 33213 const unsetControlledBlocks = () => { 33214 __unstableMarkNextChangeAsNotPersistent(); 33215 if (clientId) { 33216 setHasControlledInnerBlocks(clientId, false); 33217 __unstableMarkNextChangeAsNotPersistent(); 33218 replaceInnerBlocks(clientId, []); 33219 } else { 33220 resetBlocks([]); 33221 } 33222 }; 33223 const onInputRef = (0,external_wp_element_namespaceObject.useRef)(onInput); 33224 const onChangeRef = (0,external_wp_element_namespaceObject.useRef)(onChange); 33225 (0,external_wp_element_namespaceObject.useEffect)(() => { 33226 onInputRef.current = onInput; 33227 onChangeRef.current = onChange; 33228 }, [onInput, onChange]); 33229 (0,external_wp_element_namespaceObject.useEffect)(() => { 33230 if (pendingChangesRef.current.outgoing.includes(controlledBlocks)) { 33231 if (pendingChangesRef.current.outgoing[pendingChangesRef.current.outgoing.length - 1] === controlledBlocks) { 33232 pendingChangesRef.current.outgoing = []; 33233 } 33234 } else if (getBlocks(clientId) !== controlledBlocks) { 33235 pendingChangesRef.current.outgoing = []; 33236 setControlledBlocks(); 33237 if (controlledSelection) { 33238 resetSelection( 33239 controlledSelection.selectionStart, 33240 controlledSelection.selectionEnd, 33241 controlledSelection.initialPosition 33242 ); 33243 } 33244 } 33245 }, [controlledBlocks, clientId]); 33246 const isMountedRef = (0,external_wp_element_namespaceObject.useRef)(false); 33247 (0,external_wp_element_namespaceObject.useEffect)(() => { 33248 if (!isMountedRef.current) { 33249 isMountedRef.current = true; 33250 return; 33251 } 33252 if (!isControlled) { 33253 pendingChangesRef.current.outgoing = []; 33254 setControlledBlocks(); 33255 } 33256 }, [isControlled]); 33257 (0,external_wp_element_namespaceObject.useEffect)(() => { 33258 const { 33259 getSelectedBlocksInitialCaretPosition, 33260 isLastBlockChangePersistent, 33261 __unstableIsLastBlockChangeIgnored, 33262 areInnerBlocksControlled 33263 } = registry.select(store); 33264 let blocks = getBlocks(clientId); 33265 let isPersistent = isLastBlockChangePersistent(); 33266 let previousAreBlocksDifferent = false; 33267 subscribedRef.current = true; 33268 const unsubscribe = registry.subscribe(() => { 33269 if (clientId !== null && getBlockName(clientId) === null) { 33270 return; 33271 } 33272 const isStillControlled = !clientId || areInnerBlocksControlled(clientId); 33273 if (!isStillControlled) { 33274 return; 33275 } 33276 const newIsPersistent = isLastBlockChangePersistent(); 33277 const newBlocks = getBlocks(clientId); 33278 const areBlocksDifferent = newBlocks !== blocks; 33279 blocks = newBlocks; 33280 if (areBlocksDifferent && (pendingChangesRef.current.incoming || __unstableIsLastBlockChangeIgnored())) { 33281 pendingChangesRef.current.incoming = null; 33282 isPersistent = newIsPersistent; 33283 return; 33284 } 33285 const didPersistenceChange = previousAreBlocksDifferent && !areBlocksDifferent && newIsPersistent && !isPersistent; 33286 if (areBlocksDifferent || didPersistenceChange) { 33287 isPersistent = newIsPersistent; 33288 pendingChangesRef.current.outgoing.push(blocks); 33289 const updateParent = isPersistent ? onChangeRef.current : onInputRef.current; 33290 updateParent(blocks, { 33291 selection: { 33292 selectionStart: getSelectionStart(), 33293 selectionEnd: getSelectionEnd(), 33294 initialPosition: getSelectedBlocksInitialCaretPosition() 33295 } 33296 }); 33297 } 33298 previousAreBlocksDifferent = areBlocksDifferent; 33299 }, store); 33300 return () => { 33301 subscribedRef.current = false; 33302 unsubscribe(); 33303 }; 33304 }, [registry, clientId]); 33305 (0,external_wp_element_namespaceObject.useEffect)(() => { 33306 return () => { 33307 unsetControlledBlocks(); 33308 }; 33309 }, []); 33310 } 33311 33312 33313 ;// external ["wp","keyboardShortcuts"] 33314 const external_wp_keyboardShortcuts_namespaceObject = window["wp"]["keyboardShortcuts"]; 33315 ;// ./node_modules/@wordpress/block-editor/build-module/components/keyboard-shortcuts/index.js 33316 33317 33318 33319 33320 function KeyboardShortcuts() { 33321 return null; 33322 } 33323 function KeyboardShortcutsRegister() { 33324 const { registerShortcut } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_keyboardShortcuts_namespaceObject.store); 33325 (0,external_wp_element_namespaceObject.useEffect)(() => { 33326 registerShortcut({ 33327 name: "core/block-editor/copy", 33328 category: "block", 33329 description: (0,external_wp_i18n_namespaceObject.__)("Copy the selected block(s)."), 33330 keyCombination: { 33331 modifier: "primary", 33332 character: "c" 33333 } 33334 }); 33335 registerShortcut({ 33336 name: "core/block-editor/cut", 33337 category: "block", 33338 description: (0,external_wp_i18n_namespaceObject.__)("Cut the selected block(s)."), 33339 keyCombination: { 33340 modifier: "primary", 33341 character: "x" 33342 } 33343 }); 33344 registerShortcut({ 33345 name: "core/block-editor/paste", 33346 category: "block", 33347 description: (0,external_wp_i18n_namespaceObject.__)("Paste the selected block(s)."), 33348 keyCombination: { 33349 modifier: "primary", 33350 character: "v" 33351 } 33352 }); 33353 registerShortcut({ 33354 name: "core/block-editor/duplicate", 33355 category: "block", 33356 description: (0,external_wp_i18n_namespaceObject.__)("Duplicate the selected block(s)."), 33357 keyCombination: { 33358 modifier: "primaryShift", 33359 character: "d" 33360 } 33361 }); 33362 registerShortcut({ 33363 name: "core/block-editor/remove", 33364 category: "block", 33365 description: (0,external_wp_i18n_namespaceObject.__)("Remove the selected block(s)."), 33366 keyCombination: { 33367 modifier: "access", 33368 character: "z" 33369 } 33370 }); 33371 registerShortcut({ 33372 name: "core/block-editor/paste-styles", 33373 category: "block", 33374 description: (0,external_wp_i18n_namespaceObject.__)( 33375 "Paste the copied style to the selected block(s)." 33376 ), 33377 keyCombination: { 33378 modifier: "primaryAlt", 33379 character: "v" 33380 } 33381 }); 33382 registerShortcut({ 33383 name: "core/block-editor/insert-before", 33384 category: "block", 33385 description: (0,external_wp_i18n_namespaceObject.__)( 33386 "Insert a new block before the selected block(s)." 33387 ), 33388 keyCombination: { 33389 modifier: "primaryAlt", 33390 character: "t" 33391 } 33392 }); 33393 registerShortcut({ 33394 name: "core/block-editor/insert-after", 33395 category: "block", 33396 description: (0,external_wp_i18n_namespaceObject.__)( 33397 "Insert a new block after the selected block(s)." 33398 ), 33399 keyCombination: { 33400 modifier: "primaryAlt", 33401 character: "y" 33402 } 33403 }); 33404 registerShortcut({ 33405 name: "core/block-editor/delete-multi-selection", 33406 category: "block", 33407 description: (0,external_wp_i18n_namespaceObject.__)("Delete selection."), 33408 keyCombination: { 33409 character: "del" 33410 }, 33411 aliases: [ 33412 { 33413 character: "backspace" 33414 } 33415 ] 33416 }); 33417 registerShortcut({ 33418 name: "core/block-editor/select-all", 33419 category: "selection", 33420 description: (0,external_wp_i18n_namespaceObject.__)( 33421 "Select all text when typing. Press again to select all blocks." 33422 ), 33423 keyCombination: { 33424 modifier: "primary", 33425 character: "a" 33426 } 33427 }); 33428 registerShortcut({ 33429 name: "core/block-editor/unselect", 33430 category: "selection", 33431 description: (0,external_wp_i18n_namespaceObject.__)("Clear selection."), 33432 keyCombination: { 33433 character: "escape" 33434 } 33435 }); 33436 registerShortcut({ 33437 name: "core/block-editor/multi-text-selection", 33438 category: "selection", 33439 description: (0,external_wp_i18n_namespaceObject.__)("Select text across multiple blocks."), 33440 keyCombination: { 33441 modifier: "shift", 33442 character: "arrow" 33443 } 33444 }); 33445 registerShortcut({ 33446 name: "core/block-editor/focus-toolbar", 33447 category: "global", 33448 description: (0,external_wp_i18n_namespaceObject.__)("Navigate to the nearest toolbar."), 33449 keyCombination: { 33450 modifier: "alt", 33451 character: "F10" 33452 } 33453 }); 33454 registerShortcut({ 33455 name: "core/block-editor/move-up", 33456 category: "block", 33457 description: (0,external_wp_i18n_namespaceObject.__)("Move the selected block(s) up."), 33458 keyCombination: { 33459 modifier: "secondary", 33460 character: "t" 33461 } 33462 }); 33463 registerShortcut({ 33464 name: "core/block-editor/move-down", 33465 category: "block", 33466 description: (0,external_wp_i18n_namespaceObject.__)("Move the selected block(s) down."), 33467 keyCombination: { 33468 modifier: "secondary", 33469 character: "y" 33470 } 33471 }); 33472 registerShortcut({ 33473 name: "core/block-editor/collapse-list-view", 33474 category: "list-view", 33475 description: (0,external_wp_i18n_namespaceObject.__)("Collapse all other items."), 33476 keyCombination: { 33477 modifier: "alt", 33478 character: "l" 33479 } 33480 }); 33481 registerShortcut({ 33482 name: "core/block-editor/group", 33483 category: "block", 33484 description: (0,external_wp_i18n_namespaceObject.__)( 33485 "Create a group block from the selected multiple blocks." 33486 ), 33487 keyCombination: { 33488 modifier: "primary", 33489 character: "g" 33490 } 33491 }); 33492 registerShortcut({ 33493 name: "core/block-editor/toggle-block-visibility", 33494 category: "block", 33495 description: (0,external_wp_i18n_namespaceObject.__)("Show or hide the selected block(s)."), 33496 keyCombination: { 33497 modifier: "primaryShift", 33498 character: "h" 33499 } 33500 }); 33501 }, [registerShortcut]); 33502 return null; 33503 } 33504 KeyboardShortcuts.Register = KeyboardShortcutsRegister; 33505 var keyboard_shortcuts_default = KeyboardShortcuts; 33506 33507 33508 ;// ./node_modules/@wordpress/block-editor/build-module/components/provider/use-media-upload-settings.js 33509 33510 function useMediaUploadSettings(settings = {}) { 33511 return (0,external_wp_element_namespaceObject.useMemo)( 33512 () => ({ 33513 mediaUpload: settings.mediaUpload, 33514 mediaSideload: settings.mediaSideload, 33515 maxUploadFileSize: settings.maxUploadFileSize, 33516 allowedMimeTypes: settings.allowedMimeTypes 33517 }), 33518 [settings] 33519 ); 33520 } 33521 var use_media_upload_settings_default = useMediaUploadSettings; 33522 33523 33524 ;// ./node_modules/@wordpress/block-editor/build-module/components/provider/index.js 33525 33526 33527 33528 33529 33530 33531 33532 33533 33534 33535 33536 33537 const provider_noop = () => { 33538 }; 33539 function mediaUpload(registry, { 33540 allowedTypes, 33541 additionalData = {}, 33542 filesList, 33543 onError = provider_noop, 33544 onFileChange, 33545 onSuccess, 33546 onBatchSuccess 33547 }) { 33548 void registry.dispatch(store_store).addItems({ 33549 files: filesList, 33550 onChange: onFileChange, 33551 onSuccess, 33552 onBatchSuccess, 33553 onError: ({ message }) => onError(message), 33554 additionalData, 33555 allowedTypes 33556 }); 33557 } 33558 const ExperimentalBlockEditorProvider = with_registry_provider_with_registry_provider_default( 33559 (props) => { 33560 const { 33561 settings: _settings, 33562 registry, 33563 stripExperimentalSettings = false 33564 } = props; 33565 const mediaUploadSettings = use_media_upload_settings_default(_settings); 33566 let settings = _settings; 33567 if (window.__experimentalMediaProcessing && _settings.mediaUpload) { 33568 settings = (0,external_wp_element_namespaceObject.useMemo)( 33569 () => ({ 33570 ..._settings, 33571 mediaUpload: mediaUpload.bind(null, registry) 33572 }), 33573 [_settings, registry] 33574 ); 33575 } 33576 const { __experimentalUpdateSettings } = unlock( 33577 (0,external_wp_data_namespaceObject.useDispatch)(store) 33578 ); 33579 (0,external_wp_element_namespaceObject.useEffect)(() => { 33580 __experimentalUpdateSettings( 33581 { 33582 ...settings, 33583 __internalIsInitialized: true 33584 }, 33585 { 33586 stripExperimentalSettings, 33587 reset: true 33588 } 33589 ); 33590 }, [ 33591 settings, 33592 stripExperimentalSettings, 33593 __experimentalUpdateSettings 33594 ]); 33595 useBlockSync(props); 33596 const children = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.SlotFillProvider, { passthrough: true, children: [ 33597 !settings?.isPreviewMode && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(keyboard_shortcuts_default.Register, {}), 33598 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockRefsProvider, { children: props.children }) 33599 ] }); 33600 if (window.__experimentalMediaProcessing) { 33601 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 33602 provider_default, 33603 { 33604 settings: mediaUploadSettings, 33605 useSubRegistry: false, 33606 children 33607 } 33608 ); 33609 } 33610 return children; 33611 } 33612 ); 33613 const BlockEditorProvider = (props) => { 33614 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ExperimentalBlockEditorProvider, { ...props, stripExperimentalSettings: true, children: props.children }); 33615 }; 33616 var provider_provider_default = BlockEditorProvider; 33617 33618 33619 ;// ./node_modules/@wordpress/block-editor/build-module/components/block-context/index.js 33620 33621 33622 const block_context_Context = (0,external_wp_element_namespaceObject.createContext)({}); 33623 block_context_Context.displayName = "BlockContext"; 33624 function BlockContextProvider({ value, children }) { 33625 const context = (0,external_wp_element_namespaceObject.useContext)(block_context_Context); 33626 const nextValue = (0,external_wp_element_namespaceObject.useMemo)( 33627 () => ({ ...context, ...value }), 33628 [context, value] 33629 ); 33630 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(block_context_Context.Provider, { value: nextValue, children }); 33631 } 33632 var block_context_default = block_context_Context; 33633 33634 33635 ;// ./node_modules/@wordpress/block-editor/build-module/utils/block-bindings.js 33636 33637 33638 33639 const DEFAULT_ATTRIBUTE = "__default"; 33640 const PATTERN_OVERRIDES_SOURCE = "core/pattern-overrides"; 33641 function isObjectEmpty(object) { 33642 return !object || Object.keys(object).length === 0; 33643 } 33644 function hasPatternOverridesDefaultBinding(bindings) { 33645 return bindings?.[DEFAULT_ATTRIBUTE]?.source === PATTERN_OVERRIDES_SOURCE; 33646 } 33647 function replacePatternOverridesDefaultBinding(bindings, supportedAttributes) { 33648 if (hasPatternOverridesDefaultBinding(bindings)) { 33649 const bindingsWithDefaults = {}; 33650 for (const attributeName of supportedAttributes) { 33651 const bindingSource = bindings[attributeName] ? bindings[attributeName] : { source: PATTERN_OVERRIDES_SOURCE }; 33652 bindingsWithDefaults[attributeName] = bindingSource; 33653 } 33654 return bindingsWithDefaults; 33655 } 33656 return bindings; 33657 } 33658 function useBlockBindingsUtils(clientId) { 33659 const { clientId: contextClientId } = useBlockEditContext(); 33660 const blockClientId = clientId || contextClientId; 33661 const { updateBlockAttributes } = (0,external_wp_data_namespaceObject.useDispatch)(store); 33662 const { getBlockAttributes } = (0,external_wp_data_namespaceObject.useRegistry)().select(store); 33663 const updateBlockBindings = (bindings) => { 33664 const { metadata: { bindings: currentBindings, ...metadata } = {} } = getBlockAttributes(blockClientId); 33665 const newBindings = { ...currentBindings }; 33666 Object.entries(bindings).forEach(([attribute, binding]) => { 33667 if (!binding && newBindings[attribute]) { 33668 delete newBindings[attribute]; 33669 return; 33670 } 33671 newBindings[attribute] = binding; 33672 }); 33673 const newMetadata = { 33674 ...metadata, 33675 bindings: newBindings 33676 }; 33677 if (isObjectEmpty(newMetadata.bindings)) { 33678 delete newMetadata.bindings; 33679 } 33680 updateBlockAttributes(blockClientId, { 33681 metadata: isObjectEmpty(newMetadata) ? void 0 : newMetadata 33682 }); 33683 }; 33684 const removeAllBlockBindings = () => { 33685 const { metadata: { bindings, ...metadata } = {} } = getBlockAttributes(blockClientId); 33686 updateBlockAttributes(blockClientId, { 33687 metadata: isObjectEmpty(metadata) ? void 0 : metadata 33688 }); 33689 }; 33690 return { updateBlockBindings, removeAllBlockBindings }; 33691 } 33692 33693 33694 ;// ./node_modules/@wordpress/block-editor/build-module/components/block-list/private-block-context.js 33695 33696 const PrivateBlockContext = (0,external_wp_element_namespaceObject.createContext)({}); 33697 PrivateBlockContext.displayName = "PrivateBlockContext"; 33698 33699 33700 ;// ./node_modules/@wordpress/block-editor/build-module/components/block-edit/edit.js 33701 33702 33703 33704 33705 33706 33707 33708 33709 33710 33711 33712 const DEFAULT_BLOCK_CONTEXT = {}; 33713 const Edit = (props) => { 33714 const { name } = props; 33715 const blockType = (0,external_wp_blocks_namespaceObject.getBlockType)(name); 33716 if (!blockType) { 33717 return null; 33718 } 33719 const Component = blockType.edit || blockType.save; 33720 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Component, { ...props }); 33721 }; 33722 const EditWithFilters = (0,external_wp_components_namespaceObject.withFilters)("editor.BlockEdit")(Edit); 33723 const EditWithGeneratedProps = (props) => { 33724 const { name, clientId, attributes, setAttributes } = props; 33725 const registry = (0,external_wp_data_namespaceObject.useRegistry)(); 33726 const blockType = (0,external_wp_blocks_namespaceObject.getBlockType)(name); 33727 const blockContext = (0,external_wp_element_namespaceObject.useContext)(block_context_default); 33728 const registeredSources = (0,external_wp_data_namespaceObject.useSelect)( 33729 (select) => unlock(select(external_wp_blocks_namespaceObject.store)).getAllBlockBindingsSources(), 33730 [] 33731 ); 33732 const { bindableAttributes } = (0,external_wp_element_namespaceObject.useContext)(PrivateBlockContext); 33733 const { blockBindings, context, hasPatternOverrides } = (0,external_wp_element_namespaceObject.useMemo)(() => { 33734 const computedContext = blockType?.usesContext ? Object.fromEntries( 33735 Object.entries(blockContext).filter( 33736 ([key]) => blockType.usesContext.includes(key) 33737 ) 33738 ) : DEFAULT_BLOCK_CONTEXT; 33739 if (attributes?.metadata?.bindings) { 33740 Object.values(attributes?.metadata?.bindings || {}).forEach( 33741 (binding) => { 33742 registeredSources[binding?.source]?.usesContext?.forEach( 33743 (key) => { 33744 computedContext[key] = blockContext[key]; 33745 } 33746 ); 33747 } 33748 ); 33749 } 33750 return { 33751 blockBindings: replacePatternOverridesDefaultBinding( 33752 attributes?.metadata?.bindings, 33753 bindableAttributes 33754 ), 33755 context: computedContext, 33756 hasPatternOverrides: hasPatternOverridesDefaultBinding( 33757 attributes?.metadata?.bindings 33758 ) 33759 }; 33760 }, [ 33761 name, 33762 blockType?.usesContext, 33763 blockContext, 33764 attributes?.metadata?.bindings, 33765 registeredSources 33766 ]); 33767 const computedAttributes = (0,external_wp_data_namespaceObject.useSelect)( 33768 (select) => { 33769 if (!blockBindings) { 33770 return attributes; 33771 } 33772 const attributesFromSources = {}; 33773 const blockBindingsBySource = /* @__PURE__ */ new Map(); 33774 for (const [attributeName, binding] of Object.entries( 33775 blockBindings 33776 )) { 33777 const { source: sourceName, args: sourceArgs } = binding; 33778 const source = registeredSources[sourceName]; 33779 if (!source || !bindableAttributes?.includes(attributeName)) { 33780 continue; 33781 } 33782 blockBindingsBySource.set(source, { 33783 ...blockBindingsBySource.get(source), 33784 [attributeName]: { 33785 args: sourceArgs 33786 } 33787 }); 33788 } 33789 if (blockBindingsBySource.size) { 33790 for (const [source, bindings] of blockBindingsBySource) { 33791 let values = {}; 33792 if (!source.getValues) { 33793 Object.keys(bindings).forEach((attr) => { 33794 values[attr] = source.label; 33795 }); 33796 } else { 33797 values = source.getValues({ 33798 select, 33799 context, 33800 clientId, 33801 bindings 33802 }); 33803 } 33804 for (const [attributeName, value] of Object.entries( 33805 values 33806 )) { 33807 if (attributeName === "url" && (!value || !isURLLike(value))) { 33808 attributesFromSources[attributeName] = null; 33809 } else { 33810 attributesFromSources[attributeName] = value; 33811 } 33812 } 33813 } 33814 } 33815 return { 33816 ...attributes, 33817 ...attributesFromSources 33818 }; 33819 }, 33820 [ 33821 attributes, 33822 bindableAttributes, 33823 blockBindings, 33824 clientId, 33825 context, 33826 name, 33827 registeredSources 33828 ] 33829 ); 33830 const setBoundAttributes = (0,external_wp_element_namespaceObject.useCallback)( 33831 (nextAttributes) => { 33832 if (!blockBindings) { 33833 setAttributes(nextAttributes); 33834 return; 33835 } 33836 registry.batch(() => { 33837 const keptAttributes = { ...nextAttributes }; 33838 const blockBindingsBySource = /* @__PURE__ */ new Map(); 33839 for (const [attributeName, newValue] of Object.entries( 33840 keptAttributes 33841 )) { 33842 if (!blockBindings[attributeName] || !bindableAttributes?.includes(attributeName)) { 33843 continue; 33844 } 33845 const binding = blockBindings[attributeName]; 33846 const source = registeredSources[binding?.source]; 33847 if (!source?.setValues) { 33848 continue; 33849 } 33850 blockBindingsBySource.set(source, { 33851 ...blockBindingsBySource.get(source), 33852 [attributeName]: { 33853 args: binding.args, 33854 newValue 33855 } 33856 }); 33857 delete keptAttributes[attributeName]; 33858 } 33859 if (blockBindingsBySource.size) { 33860 for (const [ 33861 source, 33862 bindings 33863 ] of blockBindingsBySource) { 33864 source.setValues({ 33865 select: registry.select, 33866 dispatch: registry.dispatch, 33867 context, 33868 clientId, 33869 bindings 33870 }); 33871 } 33872 } 33873 const hasParentPattern = !!context["pattern/overrides"]; 33874 if ( 33875 // Don't update non-connected attributes if the block is using pattern overrides 33876 // and the editing is happening while overriding the pattern (not editing the original). 33877 !(hasPatternOverrides && hasParentPattern) && Object.keys(keptAttributes).length 33878 ) { 33879 if (hasPatternOverrides) { 33880 delete keptAttributes.caption; 33881 delete keptAttributes.href; 33882 } 33883 setAttributes(keptAttributes); 33884 } 33885 }); 33886 }, 33887 [ 33888 bindableAttributes, 33889 blockBindings, 33890 clientId, 33891 context, 33892 hasPatternOverrides, 33893 setAttributes, 33894 registeredSources, 33895 name, 33896 registry 33897 ] 33898 ); 33899 if (!blockType) { 33900 return null; 33901 } 33902 if (blockType.apiVersion > 1) { 33903 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 33904 EditWithFilters, 33905 { 33906 ...props, 33907 attributes: computedAttributes, 33908 context, 33909 setAttributes: setBoundAttributes 33910 } 33911 ); 33912 } 33913 const generatedClassName = (0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockType, "className", true) ? (0,external_wp_blocks_namespaceObject.getBlockDefaultClassName)(name) : null; 33914 const className = dist_clsx( 33915 generatedClassName, 33916 attributes?.className, 33917 props.className 33918 ); 33919 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 33920 EditWithFilters, 33921 { 33922 ...props, 33923 attributes: computedAttributes, 33924 className, 33925 context, 33926 setAttributes: setBoundAttributes 33927 } 33928 ); 33929 }; 33930 var edit_default = EditWithGeneratedProps; 33931 33932 33933 ;// ./node_modules/@wordpress/icons/build-module/library/more-vertical.js 33934 33935 33936 var more_vertical_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M13 19h-2v-2h2v2zm0-6h-2v-2h2v2zm0-6h-2V5h2v2z" }) }); 33937 33938 33939 ;// ./node_modules/@wordpress/block-editor/build-module/components/warning/index.js 33940 33941 33942 33943 33944 33945 function Warning({ className, actions, children, secondaryActions }) { 33946 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { style: { display: "contents", all: "initial" }, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: dist_clsx(className, "block-editor-warning"), children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-editor-warning__contents", children: [ 33947 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { className: "block-editor-warning__message", children }), 33948 (actions?.length > 0 || secondaryActions) && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-editor-warning__actions", children: [ 33949 actions?.length > 0 && actions.map((action, i) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 33950 "span", 33951 { 33952 className: "block-editor-warning__action", 33953 children: action 33954 }, 33955 i 33956 )), 33957 secondaryActions && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 33958 external_wp_components_namespaceObject.DropdownMenu, 33959 { 33960 className: "block-editor-warning__secondary", 33961 icon: more_vertical_default, 33962 label: (0,external_wp_i18n_namespaceObject.__)("More options"), 33963 popoverProps: { 33964 placement: "bottom-end", 33965 className: "block-editor-warning__dropdown" 33966 }, 33967 noIcons: true, 33968 children: () => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuGroup, { children: secondaryActions.map( 33969 (item, pos) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 33970 external_wp_components_namespaceObject.MenuItem, 33971 { 33972 onClick: item.onClick, 33973 children: item.title 33974 }, 33975 pos 33976 ) 33977 ) }) 33978 } 33979 ) 33980 ] }) 33981 ] }) }) }); 33982 } 33983 var warning_default = Warning; 33984 33985 33986 ;// ./node_modules/@wordpress/block-editor/build-module/components/block-edit/multiple-usage-warning.js 33987 33988 33989 33990 33991 33992 33993 33994 function MultipleUsageWarning({ 33995 originalBlockClientId, 33996 name, 33997 onReplace 33998 }) { 33999 const { selectBlock } = (0,external_wp_data_namespaceObject.useDispatch)(store); 34000 const blockType = (0,external_wp_blocks_namespaceObject.getBlockType)(name); 34001 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 34002 warning_default, 34003 { 34004 actions: [ 34005 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 34006 external_wp_components_namespaceObject.Button, 34007 { 34008 __next40pxDefaultSize: true, 34009 variant: "secondary", 34010 onClick: () => selectBlock(originalBlockClientId), 34011 children: (0,external_wp_i18n_namespaceObject.__)("Find original") 34012 }, 34013 "find-original" 34014 ), 34015 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 34016 external_wp_components_namespaceObject.Button, 34017 { 34018 __next40pxDefaultSize: true, 34019 variant: "secondary", 34020 onClick: () => onReplace([]), 34021 children: (0,external_wp_i18n_namespaceObject.__)("Remove") 34022 }, 34023 "remove" 34024 ) 34025 ], 34026 children: [ 34027 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("strong", { children: [ 34028 blockType?.title, 34029 ": " 34030 ] }), 34031 (0,external_wp_i18n_namespaceObject.__)("This block can only be used once.") 34032 ] 34033 } 34034 ); 34035 } 34036 34037 34038 ;// ./node_modules/@wordpress/block-editor/build-module/components/block-edit/index.js 34039 34040 34041 34042 34043 34044 34045 34046 function BlockEdit({ 34047 mayDisplayControls, 34048 mayDisplayParentControls, 34049 blockEditingMode, 34050 isPreviewMode, 34051 // The remaining props are passed through the BlockEdit filters and are thus 34052 // public API! 34053 ...props 34054 }) { 34055 const { 34056 name, 34057 isSelected, 34058 clientId, 34059 attributes = {}, 34060 __unstableLayoutClassNames 34061 } = props; 34062 const { layout = null, metadata = {} } = attributes; 34063 const { bindings } = metadata; 34064 const layoutSupport = (0,external_wp_blocks_namespaceObject.hasBlockSupport)(name, "layout", false) || (0,external_wp_blocks_namespaceObject.hasBlockSupport)(name, "__experimentalLayout", false); 34065 const { originalBlockClientId } = (0,external_wp_element_namespaceObject.useContext)(PrivateBlockContext); 34066 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 34067 Provider, 34068 { 34069 value: (0,external_wp_element_namespaceObject.useMemo)( 34070 () => ({ 34071 name, 34072 isSelected, 34073 clientId, 34074 layout: layoutSupport ? layout : null, 34075 __unstableLayoutClassNames, 34076 // We use symbols in favour of an __unstable prefix to avoid 34077 // usage outside of the package (this context is exposed). 34078 [mayDisplayControlsKey]: mayDisplayControls, 34079 [mayDisplayParentControlsKey]: mayDisplayParentControls, 34080 [blockEditingModeKey]: blockEditingMode, 34081 [blockBindingsKey]: bindings, 34082 [isPreviewModeKey]: isPreviewMode 34083 }), 34084 [ 34085 name, 34086 isSelected, 34087 clientId, 34088 layoutSupport, 34089 layout, 34090 __unstableLayoutClassNames, 34091 mayDisplayControls, 34092 mayDisplayParentControls, 34093 blockEditingMode, 34094 bindings, 34095 isPreviewMode 34096 ] 34097 ), 34098 children: [ 34099 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(edit_default, { ...props }), 34100 originalBlockClientId && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 34101 MultipleUsageWarning, 34102 { 34103 originalBlockClientId, 34104 name, 34105 onReplace: props.onReplace 34106 } 34107 ) 34108 ] 34109 } 34110 ); 34111 } 34112 34113 34114 // EXTERNAL MODULE: ./node_modules/diff/lib/diff/character.js 34115 var character = __webpack_require__(8021); 34116 ;// ./node_modules/@wordpress/block-editor/build-module/components/block-compare/block-view.js 34117 34118 34119 34120 34121 function BlockView({ 34122 title, 34123 rawContent, 34124 renderedContent, 34125 action, 34126 actionText, 34127 className 34128 }) { 34129 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className, children: [ 34130 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-editor-block-compare__content", children: [ 34131 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("h2", { className: "block-editor-block-compare__heading", children: title }), 34132 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-block-compare__html", children: rawContent }), 34133 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-block-compare__preview edit-post-visual-editor", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_element_namespaceObject.RawHTML, { children: (0,external_wp_dom_namespaceObject.safeHTML)(renderedContent) }) }) 34134 ] }), 34135 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-block-compare__action", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 34136 external_wp_components_namespaceObject.Button, 34137 { 34138 __next40pxDefaultSize: true, 34139 variant: "secondary", 34140 tabIndex: "0", 34141 onClick: action, 34142 children: actionText 34143 } 34144 ) }) 34145 ] }); 34146 } 34147 34148 34149 ;// ./node_modules/@wordpress/block-editor/build-module/components/block-compare/index.js 34150 34151 34152 34153 34154 34155 34156 function BlockCompare({ 34157 block, 34158 onKeep, 34159 onConvert, 34160 convertor, 34161 convertButtonText 34162 }) { 34163 function getDifference(originalContent, newContent) { 34164 const difference2 = (0,character/* diffChars */.JJ)(originalContent, newContent); 34165 return difference2.map((item, pos) => { 34166 const classes = dist_clsx({ 34167 "block-editor-block-compare__added": item.added, 34168 "block-editor-block-compare__removed": item.removed 34169 }); 34170 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: classes, children: item.value }, pos); 34171 }); 34172 } 34173 function getConvertedContent(convertedBlock) { 34174 const newBlocks = Array.isArray(convertedBlock) ? convertedBlock : [convertedBlock]; 34175 const newContent = newBlocks.map( 34176 (item) => (0,external_wp_blocks_namespaceObject.getSaveContent)(item.name, item.attributes, item.innerBlocks) 34177 ); 34178 return newContent.join(""); 34179 } 34180 const converted = getConvertedContent(convertor(block)); 34181 const difference = getDifference(block.originalContent, converted); 34182 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-editor-block-compare__wrapper", children: [ 34183 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 34184 BlockView, 34185 { 34186 title: (0,external_wp_i18n_namespaceObject.__)("Current"), 34187 className: "block-editor-block-compare__current", 34188 action: onKeep, 34189 actionText: (0,external_wp_i18n_namespaceObject.__)("Convert to HTML"), 34190 rawContent: block.originalContent, 34191 renderedContent: block.originalContent 34192 } 34193 ), 34194 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 34195 BlockView, 34196 { 34197 title: (0,external_wp_i18n_namespaceObject.__)("After Conversion"), 34198 className: "block-editor-block-compare__converted", 34199 action: onConvert, 34200 actionText: convertButtonText, 34201 rawContent: difference, 34202 renderedContent: converted 34203 } 34204 ) 34205 ] }); 34206 } 34207 var block_compare_default = BlockCompare; 34208 34209 34210 ;// ./node_modules/@wordpress/block-editor/build-module/components/block-list/block-invalid-warning.js 34211 34212 34213 34214 34215 34216 34217 34218 34219 34220 const blockToBlocks = (block) => (0,external_wp_blocks_namespaceObject.rawHandler)({ 34221 HTML: block.originalContent 34222 }); 34223 function BlockInvalidWarning({ clientId }) { 34224 const { block, canInsertHTMLBlock, canInsertClassicBlock } = (0,external_wp_data_namespaceObject.useSelect)( 34225 (select) => { 34226 const { canInsertBlockType, getBlock, getBlockRootClientId } = select(store); 34227 const rootClientId = getBlockRootClientId(clientId); 34228 return { 34229 block: getBlock(clientId), 34230 canInsertHTMLBlock: canInsertBlockType( 34231 "core/html", 34232 rootClientId 34233 ), 34234 canInsertClassicBlock: canInsertBlockType( 34235 "core/freeform", 34236 rootClientId 34237 ) 34238 }; 34239 }, 34240 [clientId] 34241 ); 34242 const { replaceBlock } = (0,external_wp_data_namespaceObject.useDispatch)(store); 34243 const [compare, setCompare] = (0,external_wp_element_namespaceObject.useState)(false); 34244 const onCompareClose = (0,external_wp_element_namespaceObject.useCallback)(() => setCompare(false), []); 34245 const convert = (0,external_wp_element_namespaceObject.useMemo)( 34246 () => ({ 34247 toClassic() { 34248 const classicBlock = (0,external_wp_blocks_namespaceObject.createBlock)("core/freeform", { 34249 content: block.originalContent 34250 }); 34251 return replaceBlock(block.clientId, classicBlock); 34252 }, 34253 toHTML() { 34254 const htmlBlock = (0,external_wp_blocks_namespaceObject.createBlock)("core/html", { 34255 content: block.originalContent 34256 }); 34257 return replaceBlock(block.clientId, htmlBlock); 34258 }, 34259 toBlocks() { 34260 const newBlocks = blockToBlocks(block); 34261 return replaceBlock(block.clientId, newBlocks); 34262 }, 34263 toRecoveredBlock() { 34264 const recoveredBlock = (0,external_wp_blocks_namespaceObject.createBlock)( 34265 block.name, 34266 block.attributes, 34267 block.innerBlocks 34268 ); 34269 return replaceBlock(block.clientId, recoveredBlock); 34270 } 34271 }), 34272 [block, replaceBlock] 34273 ); 34274 const secondaryActions = (0,external_wp_element_namespaceObject.useMemo)( 34275 () => [ 34276 { 34277 // translators: Button to fix block content 34278 title: (0,external_wp_i18n_namespaceObject._x)("Resolve", "imperative verb"), 34279 onClick: () => setCompare(true) 34280 }, 34281 canInsertHTMLBlock && { 34282 title: (0,external_wp_i18n_namespaceObject.__)("Convert to HTML"), 34283 onClick: convert.toHTML 34284 }, 34285 canInsertClassicBlock && { 34286 title: (0,external_wp_i18n_namespaceObject.__)("Convert to Classic Block"), 34287 onClick: convert.toClassic 34288 } 34289 ].filter(Boolean), 34290 [canInsertHTMLBlock, canInsertClassicBlock, convert] 34291 ); 34292 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 34293 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 34294 warning_default, 34295 { 34296 actions: [ 34297 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 34298 external_wp_components_namespaceObject.Button, 34299 { 34300 __next40pxDefaultSize: true, 34301 onClick: convert.toRecoveredBlock, 34302 variant: "primary", 34303 children: (0,external_wp_i18n_namespaceObject.__)("Attempt recovery") 34304 }, 34305 "recover" 34306 ) 34307 ], 34308 secondaryActions, 34309 children: (0,external_wp_i18n_namespaceObject.__)("Block contains unexpected or invalid content.") 34310 } 34311 ), 34312 compare && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 34313 external_wp_components_namespaceObject.Modal, 34314 { 34315 title: ( 34316 // translators: Dialog title to fix block content 34317 (0,external_wp_i18n_namespaceObject.__)("Resolve Block") 34318 ), 34319 onRequestClose: onCompareClose, 34320 className: "block-editor-block-compare", 34321 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 34322 block_compare_default, 34323 { 34324 block, 34325 onKeep: convert.toHTML, 34326 onConvert: convert.toBlocks, 34327 convertor: blockToBlocks, 34328 convertButtonText: (0,external_wp_i18n_namespaceObject.__)("Convert to Blocks") 34329 } 34330 ) 34331 } 34332 ) 34333 ] }); 34334 } 34335 34336 34337 ;// ./node_modules/@wordpress/block-editor/build-module/components/block-list/block-crash-warning.js 34338 34339 34340 34341 const warning = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(warning_default, { className: "block-editor-block-list__block-crash-warning", children: (0,external_wp_i18n_namespaceObject.__)("This block has encountered an error and cannot be previewed.") }); 34342 var block_crash_warning_default = () => warning; 34343 34344 34345 ;// ./node_modules/@wordpress/block-editor/build-module/components/block-list/block-crash-boundary.js 34346 34347 class BlockCrashBoundary extends external_wp_element_namespaceObject.Component { 34348 constructor() { 34349 super(...arguments); 34350 this.state = { 34351 hasError: false 34352 }; 34353 } 34354 componentDidCatch() { 34355 this.setState({ 34356 hasError: true 34357 }); 34358 } 34359 render() { 34360 if (this.state.hasError) { 34361 return this.props.fallback; 34362 } 34363 return this.props.children; 34364 } 34365 } 34366 var block_crash_boundary_default = BlockCrashBoundary; 34367 34368 34369 // EXTERNAL MODULE: ./node_modules/react-autosize-textarea/lib/index.js 34370 var lib = __webpack_require__(4132); 34371 ;// ./node_modules/@wordpress/block-editor/build-module/components/block-list/block-html.js 34372 34373 34374 34375 34376 34377 34378 function BlockHTML({ clientId }) { 34379 const [html, setHtml] = (0,external_wp_element_namespaceObject.useState)(""); 34380 const block = (0,external_wp_data_namespaceObject.useSelect)( 34381 (select) => select(store).getBlock(clientId), 34382 [clientId] 34383 ); 34384 const { updateBlock } = (0,external_wp_data_namespaceObject.useDispatch)(store); 34385 const onChange = () => { 34386 const blockType = (0,external_wp_blocks_namespaceObject.getBlockType)(block.name); 34387 if (!blockType) { 34388 return; 34389 } 34390 const attributes = (0,external_wp_blocks_namespaceObject.getBlockAttributes)( 34391 blockType, 34392 html, 34393 block.attributes 34394 ); 34395 const content = html ? html : (0,external_wp_blocks_namespaceObject.getSaveContent)(blockType, attributes); 34396 const [isValid] = html ? (0,external_wp_blocks_namespaceObject.validateBlock)({ 34397 ...block, 34398 attributes, 34399 originalContent: content 34400 }) : [true]; 34401 updateBlock(clientId, { 34402 attributes, 34403 originalContent: content, 34404 isValid 34405 }); 34406 if (!html) { 34407 setHtml(content); 34408 } 34409 }; 34410 (0,external_wp_element_namespaceObject.useEffect)(() => { 34411 setHtml((0,external_wp_blocks_namespaceObject.getBlockContent)(block)); 34412 }, [block]); 34413 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 34414 lib/* default */.A, 34415 { 34416 className: "block-editor-block-list__block-html-textarea", 34417 value: html, 34418 onBlur: onChange, 34419 onChange: (event) => setHtml(event.target.value) 34420 } 34421 ); 34422 } 34423 var block_html_default = BlockHTML; 34424 34425 34426 ;// ./node_modules/@react-spring/rafz/dist/esm/index.js 34427 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}}; 34428 34429 ;// ./node_modules/@react-spring/shared/dist/esm/index.js 34430 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}; 34431 34432 ;// ./node_modules/@react-spring/animated/dist/esm/index.js 34433 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; 34434 34435 ;// ./node_modules/@react-spring/core/dist/esm/index.js 34436 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; 34437 34438 ;// external "ReactDOM" 34439 const external_ReactDOM_namespaceObject = window["ReactDOM"]; 34440 ;// ./node_modules/@react-spring/web/dist/esm/index.js 34441 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; 34442 34443 ;// ./node_modules/@wordpress/block-editor/build-module/components/use-moving-animation/index.js 34444 34445 34446 34447 34448 34449 const BLOCK_ANIMATION_THRESHOLD = 200; 34450 function getAbsolutePosition(element) { 34451 return { 34452 top: element.offsetTop, 34453 left: element.offsetLeft 34454 }; 34455 } 34456 function useMovingAnimation({ triggerAnimationOnChange, clientId }) { 34457 const ref = (0,external_wp_element_namespaceObject.useRef)(); 34458 const { 34459 isTyping, 34460 getGlobalBlockCount, 34461 isBlockSelected, 34462 isFirstMultiSelectedBlock, 34463 isBlockMultiSelected, 34464 isAncestorMultiSelected, 34465 isDraggingBlocks 34466 } = (0,external_wp_data_namespaceObject.useSelect)(store); 34467 const { previous, prevRect } = (0,external_wp_element_namespaceObject.useMemo)( 34468 () => ({ 34469 previous: ref.current && getAbsolutePosition(ref.current), 34470 prevRect: ref.current && ref.current.getBoundingClientRect() 34471 }), 34472 [triggerAnimationOnChange] 34473 ); 34474 (0,external_wp_element_namespaceObject.useLayoutEffect)(() => { 34475 if (!previous || !ref.current) { 34476 return; 34477 } 34478 const scrollContainer = (0,external_wp_dom_namespaceObject.getScrollContainer)(ref.current); 34479 const isSelected = isBlockSelected(clientId); 34480 const adjustScrolling = isSelected || isFirstMultiSelectedBlock(clientId); 34481 const isDragging = isDraggingBlocks(); 34482 function preserveScrollPosition() { 34483 if (isDragging) { 34484 return; 34485 } 34486 if (adjustScrolling && prevRect) { 34487 const blockRect = ref.current.getBoundingClientRect(); 34488 const diff = blockRect.top - prevRect.top; 34489 if (diff) { 34490 scrollContainer.scrollTop += diff; 34491 } 34492 } 34493 } 34494 const disableAnimation = window.matchMedia("(prefers-reduced-motion: reduce)").matches || isTyping() || getGlobalBlockCount() > BLOCK_ANIMATION_THRESHOLD; 34495 if (disableAnimation) { 34496 preserveScrollPosition(); 34497 return; 34498 } 34499 const isPartOfSelection = isSelected || isBlockMultiSelected(clientId) || isAncestorMultiSelected(clientId); 34500 if (isPartOfSelection && isDragging) { 34501 return; 34502 } 34503 const zIndex = isPartOfSelection ? "1" : ""; 34504 const controller = new esm_le({ 34505 x: 0, 34506 y: 0, 34507 config: { mass: 5, tension: 2e3, friction: 200 }, 34508 onChange({ value }) { 34509 if (!ref.current) { 34510 return; 34511 } 34512 let { x: x2, y: y2 } = value; 34513 x2 = Math.round(x2); 34514 y2 = Math.round(y2); 34515 const finishedMoving = x2 === 0 && y2 === 0; 34516 ref.current.style.transformOrigin = "center center"; 34517 ref.current.style.transform = finishedMoving ? null : `translate3d($x2}px,$y2}px,0)`; 34518 ref.current.style.zIndex = zIndex; 34519 preserveScrollPosition(); 34520 } 34521 }); 34522 ref.current.style.transform = void 0; 34523 const destination = getAbsolutePosition(ref.current); 34524 const x = Math.round(previous.left - destination.left); 34525 const y = Math.round(previous.top - destination.top); 34526 controller.start({ x: 0, y: 0, from: { x, y } }); 34527 return () => { 34528 controller.stop(); 34529 controller.set({ x: 0, y: 0 }); 34530 }; 34531 }, [ 34532 previous, 34533 prevRect, 34534 clientId, 34535 isTyping, 34536 getGlobalBlockCount, 34537 isBlockSelected, 34538 isFirstMultiSelectedBlock, 34539 isBlockMultiSelected, 34540 isAncestorMultiSelected, 34541 isDraggingBlocks 34542 ]); 34543 return ref; 34544 } 34545 var use_moving_animation_default = useMovingAnimation; 34546 34547 34548 ;// ./node_modules/@wordpress/block-editor/build-module/components/block-list/use-block-props/use-focus-first-element.js 34549 34550 34551 34552 34553 34554 34555 function useFocusFirstElement({ clientId, initialPosition }) { 34556 const ref = (0,external_wp_element_namespaceObject.useRef)(); 34557 const { isBlockSelected, isMultiSelecting, isZoomOut } = unlock( 34558 (0,external_wp_data_namespaceObject.useSelect)(store) 34559 ); 34560 (0,external_wp_element_namespaceObject.useEffect)(() => { 34561 if (!isBlockSelected(clientId) || isMultiSelecting() || isZoomOut()) { 34562 return; 34563 } 34564 if (initialPosition === void 0 || initialPosition === null) { 34565 return; 34566 } 34567 if (!ref.current) { 34568 return; 34569 } 34570 const { ownerDocument } = ref.current; 34571 if (isInsideRootBlock(ref.current, ownerDocument.activeElement)) { 34572 return; 34573 } 34574 const textInputs = external_wp_dom_namespaceObject.focus.tabbable.find(ref.current).filter((node) => (0,external_wp_dom_namespaceObject.isTextField)(node)); 34575 const isReverse = -1 === initialPosition; 34576 const target = textInputs[isReverse ? textInputs.length - 1 : 0] || ref.current; 34577 if (!isInsideRootBlock(ref.current, target)) { 34578 ref.current.focus(); 34579 return; 34580 } 34581 if (!ref.current.getAttribute("contenteditable")) { 34582 const focusElement = external_wp_dom_namespaceObject.focus.tabbable.findNext(ref.current); 34583 if (focusElement && isInsideRootBlock(ref.current, focusElement) && (0,external_wp_dom_namespaceObject.isFormElement)(focusElement)) { 34584 focusElement.focus(); 34585 return; 34586 } 34587 } 34588 (0,external_wp_dom_namespaceObject.placeCaretAtHorizontalEdge)(target, isReverse); 34589 }, [initialPosition, clientId]); 34590 return ref; 34591 } 34592 34593 34594 ;// ./node_modules/@wordpress/block-editor/build-module/components/block-list/use-block-props/use-is-hovered.js 34595 34596 function listener(event) { 34597 if (event.defaultPrevented) { 34598 return; 34599 } 34600 event.preventDefault(); 34601 event.currentTarget.classList.toggle( 34602 "is-hovered", 34603 event.type === "mouseover" 34604 ); 34605 } 34606 function useIsHovered() { 34607 return (0,external_wp_compose_namespaceObject.useRefEffect)((node) => { 34608 node.addEventListener("mouseout", listener); 34609 node.addEventListener("mouseover", listener); 34610 return () => { 34611 node.removeEventListener("mouseout", listener); 34612 node.removeEventListener("mouseover", listener); 34613 node.classList.remove("is-hovered"); 34614 }; 34615 }, []); 34616 } 34617 34618 34619 ;// ./node_modules/@wordpress/block-editor/build-module/components/block-list/use-block-props/use-focus-handler.js 34620 34621 34622 34623 34624 function useFocusHandler(clientId) { 34625 const { isBlockSelected } = (0,external_wp_data_namespaceObject.useSelect)(store); 34626 const { selectBlock, selectionChange } = (0,external_wp_data_namespaceObject.useDispatch)(store); 34627 return (0,external_wp_compose_namespaceObject.useRefEffect)( 34628 (node) => { 34629 function onFocus(event) { 34630 if (node.parentElement.closest('[contenteditable="true"]')) { 34631 return; 34632 } 34633 if (isBlockSelected(clientId)) { 34634 if (!event.target.isContentEditable) { 34635 selectionChange(clientId); 34636 } 34637 return; 34638 } 34639 if (!isInsideRootBlock(node, event.target)) { 34640 return; 34641 } 34642 selectBlock(clientId); 34643 } 34644 node.addEventListener("focusin", onFocus); 34645 return () => { 34646 node.removeEventListener("focusin", onFocus); 34647 }; 34648 }, 34649 [isBlockSelected, selectBlock] 34650 ); 34651 } 34652 34653 34654 ;// ./node_modules/@wordpress/block-editor/build-module/components/block-list/use-block-props/use-selected-block-event-handlers.js 34655 34656 34657 34658 34659 34660 34661 function isColorTransparent(color) { 34662 return !color || color === "transparent" || color === "rgba(0, 0, 0, 0)"; 34663 } 34664 function useEventHandlers({ clientId, isSelected }) { 34665 const { getBlockRootClientId, isZoomOut, hasMultiSelection } = unlock( 34666 (0,external_wp_data_namespaceObject.useSelect)(store) 34667 ); 34668 const { 34669 insertAfterBlock, 34670 removeBlock, 34671 resetZoomLevel, 34672 startDraggingBlocks, 34673 stopDraggingBlocks 34674 } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store)); 34675 return (0,external_wp_compose_namespaceObject.useRefEffect)( 34676 (node) => { 34677 if (!isSelected) { 34678 return; 34679 } 34680 function onKeyDown(event) { 34681 const { keyCode, target } = event; 34682 if (keyCode !== external_wp_keycodes_namespaceObject.ENTER && keyCode !== external_wp_keycodes_namespaceObject.BACKSPACE && keyCode !== external_wp_keycodes_namespaceObject.DELETE) { 34683 return; 34684 } 34685 if (target !== node || (0,external_wp_dom_namespaceObject.isTextField)(target)) { 34686 return; 34687 } 34688 event.preventDefault(); 34689 if (keyCode === external_wp_keycodes_namespaceObject.ENTER && isZoomOut()) { 34690 resetZoomLevel(); 34691 } else if (keyCode === external_wp_keycodes_namespaceObject.ENTER) { 34692 insertAfterBlock(clientId); 34693 } else { 34694 removeBlock(clientId); 34695 } 34696 } 34697 function onDragStart(event) { 34698 if (node !== event.target || node.isContentEditable || node.ownerDocument.activeElement !== node || hasMultiSelection()) { 34699 event.preventDefault(); 34700 return; 34701 } 34702 const data = JSON.stringify({ 34703 type: "block", 34704 srcClientIds: [clientId], 34705 srcRootClientId: getBlockRootClientId(clientId) 34706 }); 34707 event.dataTransfer.effectAllowed = "move"; 34708 event.dataTransfer.clearData(); 34709 event.dataTransfer.setData("wp-blocks", data); 34710 const { ownerDocument } = node; 34711 const { defaultView } = ownerDocument; 34712 const selection = defaultView.getSelection(); 34713 selection.removeAllRanges(); 34714 const dragElement = ownerDocument.createElement("div"); 34715 dragElement.style.width = "1px"; 34716 dragElement.style.height = "1px"; 34717 dragElement.style.position = "fixed"; 34718 dragElement.style.visibility = "hidden"; 34719 ownerDocument.body.appendChild(dragElement); 34720 event.dataTransfer.setDragImage(dragElement, 0, 0); 34721 const rect = node.getBoundingClientRect(); 34722 const clone = node.cloneNode(true); 34723 clone.style.visibility = "hidden"; 34724 clone.style.display = "none"; 34725 const id = node.id; 34726 node.id = null; 34727 let _scale = 1; 34728 { 34729 let parentElement = node; 34730 while (parentElement = parentElement.parentElement) { 34731 const { scale } = defaultView.getComputedStyle(parentElement); 34732 if (scale && scale !== "none") { 34733 _scale = parseFloat(scale); 34734 break; 34735 } 34736 } 34737 } 34738 const inverted = 1 / _scale; 34739 node.after(clone); 34740 const originalNodeProperties = {}; 34741 for (const property of [ 34742 "transform", 34743 "transformOrigin", 34744 "transition", 34745 "zIndex", 34746 "position", 34747 "top", 34748 "left", 34749 "pointerEvents", 34750 "opacity", 34751 "backgroundColor" 34752 ]) { 34753 originalNodeProperties[property] = node.style[property]; 34754 } 34755 const originScrollTop = defaultView.scrollY; 34756 const originScrollLeft = defaultView.scrollX; 34757 const originClientX = event.clientX; 34758 const originClientY = event.clientY; 34759 node.style.position = "relative"; 34760 node.style.top = `$0}px`; 34761 node.style.left = `$0}px`; 34762 const originX = event.clientX - rect.left; 34763 const originY = event.clientY - rect.top; 34764 const dragScale = rect.height > 200 ? 200 / rect.height : 1; 34765 node.style.zIndex = "1000"; 34766 node.style.transformOrigin = `$originX * inverted}px $originY * inverted}px`; 34767 node.style.transition = "transform 0.2s ease-out"; 34768 node.style.transform = `scale($dragScale})`; 34769 node.style.opacity = "0.9"; 34770 if (isColorTransparent( 34771 defaultView.getComputedStyle(node).backgroundColor 34772 )) { 34773 let bgColor = "transparent"; 34774 let parentElement = node; 34775 while (parentElement = parentElement.parentElement) { 34776 const { backgroundColor } = defaultView.getComputedStyle(parentElement); 34777 if (!isColorTransparent(backgroundColor)) { 34778 bgColor = backgroundColor; 34779 break; 34780 } 34781 } 34782 node.style.backgroundColor = bgColor; 34783 } 34784 let hasStarted = false; 34785 function over(e) { 34786 if (!hasStarted) { 34787 hasStarted = true; 34788 node.style.pointerEvents = "none"; 34789 } 34790 const scrollTop = defaultView.scrollY; 34791 const scrollLeft = defaultView.scrollX; 34792 node.style.top = `${(e.clientY - originClientY + scrollTop - originScrollTop) * inverted}px`; 34793 node.style.left = `${(e.clientX - originClientX + scrollLeft - originScrollLeft) * inverted}px`; 34794 } 34795 function end() { 34796 ownerDocument.removeEventListener("dragover", over); 34797 ownerDocument.removeEventListener("dragend", end); 34798 ownerDocument.removeEventListener("drop", end); 34799 ownerDocument.removeEventListener("scroll", over); 34800 for (const [property, value] of Object.entries( 34801 originalNodeProperties 34802 )) { 34803 node.style[property] = value; 34804 } 34805 clone.remove(); 34806 node.id = id; 34807 dragElement.remove(); 34808 stopDraggingBlocks(); 34809 document.body.classList.remove( 34810 "is-dragging-components-draggable" 34811 ); 34812 ownerDocument.documentElement.classList.remove( 34813 "is-dragging" 34814 ); 34815 } 34816 ownerDocument.addEventListener("dragover", over); 34817 ownerDocument.addEventListener("dragend", end); 34818 ownerDocument.addEventListener("drop", end); 34819 ownerDocument.addEventListener("scroll", over); 34820 startDraggingBlocks([clientId]); 34821 document.body.classList.add( 34822 "is-dragging-components-draggable" 34823 ); 34824 ownerDocument.documentElement.classList.add("is-dragging"); 34825 } 34826 node.addEventListener("keydown", onKeyDown); 34827 node.addEventListener("dragstart", onDragStart); 34828 return () => { 34829 node.removeEventListener("keydown", onKeyDown); 34830 node.removeEventListener("dragstart", onDragStart); 34831 }; 34832 }, 34833 [ 34834 clientId, 34835 isSelected, 34836 getBlockRootClientId, 34837 insertAfterBlock, 34838 removeBlock, 34839 isZoomOut, 34840 resetZoomLevel, 34841 hasMultiSelection, 34842 startDraggingBlocks, 34843 stopDraggingBlocks 34844 ] 34845 ); 34846 } 34847 34848 34849 ;// ./node_modules/@wordpress/block-editor/build-module/components/block-list/use-block-props/use-intersection-observer.js 34850 34851 34852 34853 function useIntersectionObserver() { 34854 const observer = (0,external_wp_element_namespaceObject.useContext)(block_list_IntersectionObserver); 34855 return (0,external_wp_compose_namespaceObject.useRefEffect)( 34856 (node) => { 34857 if (observer) { 34858 observer.observe(node); 34859 return () => { 34860 observer.unobserve(node); 34861 }; 34862 } 34863 }, 34864 [observer] 34865 ); 34866 } 34867 34868 34869 ;// ./node_modules/@wordpress/block-editor/build-module/components/block-list/use-block-props/use-scroll-into-view.js 34870 34871 function useScrollIntoView({ isSelected }) { 34872 const prefersReducedMotion = (0,external_wp_compose_namespaceObject.useReducedMotion)(); 34873 return (0,external_wp_compose_namespaceObject.useRefEffect)( 34874 (node) => { 34875 if (isSelected) { 34876 const { ownerDocument } = node; 34877 const { defaultView } = ownerDocument; 34878 if (!defaultView.IntersectionObserver) { 34879 return; 34880 } 34881 const observer = new defaultView.IntersectionObserver( 34882 (entries) => { 34883 if (!entries[0].isIntersecting) { 34884 node.scrollIntoView({ 34885 behavior: prefersReducedMotion ? "instant" : "smooth" 34886 }); 34887 } 34888 observer.disconnect(); 34889 } 34890 ); 34891 observer.observe(node); 34892 return () => { 34893 observer.disconnect(); 34894 }; 34895 } 34896 }, 34897 [isSelected] 34898 ); 34899 } 34900 34901 34902 ;// ./node_modules/@wordpress/block-editor/build-module/components/use-flash-editable-blocks/index.js 34903 34904 34905 34906 34907 function useFlashEditableBlocks({ 34908 clientId = "", 34909 isEnabled = true 34910 } = {}) { 34911 const { getEnabledClientIdsTree } = unlock((0,external_wp_data_namespaceObject.useSelect)(store)); 34912 return (0,external_wp_compose_namespaceObject.useRefEffect)( 34913 (element) => { 34914 if (!isEnabled) { 34915 return; 34916 } 34917 const flashEditableBlocks = () => { 34918 getEnabledClientIdsTree(clientId).forEach( 34919 ({ clientId: id }) => { 34920 const block = element.querySelector( 34921 `[data-block="$id}"]` 34922 ); 34923 if (!block) { 34924 return; 34925 } 34926 block.classList.remove("has-editable-outline"); 34927 block.offsetWidth; 34928 block.classList.add("has-editable-outline"); 34929 } 34930 ); 34931 }; 34932 const handleClick = (event) => { 34933 const shouldFlash = event.target === element || event.target.classList.contains("is-root-container"); 34934 if (!shouldFlash) { 34935 return; 34936 } 34937 if (event.defaultPrevented) { 34938 return; 34939 } 34940 event.preventDefault(); 34941 flashEditableBlocks(); 34942 }; 34943 element.addEventListener("click", handleClick); 34944 return () => element.removeEventListener("click", handleClick); 34945 }, 34946 [isEnabled] 34947 ); 34948 } 34949 34950 34951 ;// ./node_modules/@wordpress/block-editor/build-module/components/block-list/use-block-props/use-firefox-draggable-compatibility.js 34952 34953 const nodesByDocument = /* @__PURE__ */ new Map(); 34954 function add(doc, node) { 34955 let set = nodesByDocument.get(doc); 34956 if (!set) { 34957 set = /* @__PURE__ */ new Set(); 34958 nodesByDocument.set(doc, set); 34959 doc.addEventListener("pointerdown", down); 34960 } 34961 set.add(node); 34962 } 34963 function remove(doc, node) { 34964 const set = nodesByDocument.get(doc); 34965 if (set) { 34966 set.delete(node); 34967 restore(node); 34968 if (set.size === 0) { 34969 nodesByDocument.delete(doc); 34970 doc.removeEventListener("pointerdown", down); 34971 } 34972 } 34973 } 34974 function restore(node) { 34975 const prevDraggable = node.getAttribute("data-draggable"); 34976 if (prevDraggable) { 34977 node.removeAttribute("data-draggable"); 34978 if (prevDraggable === "true" && !node.getAttribute("draggable")) { 34979 node.setAttribute("draggable", "true"); 34980 } 34981 } 34982 } 34983 function down(event) { 34984 const { target } = event; 34985 const { ownerDocument, isContentEditable, tagName } = target; 34986 const isInputOrTextArea = ["INPUT", "TEXTAREA"].includes(tagName); 34987 const nodes = nodesByDocument.get(ownerDocument); 34988 if (isContentEditable || isInputOrTextArea) { 34989 for (const node of nodes) { 34990 if (node.getAttribute("draggable") === "true" && node.contains(target)) { 34991 node.removeAttribute("draggable"); 34992 node.setAttribute("data-draggable", "true"); 34993 } 34994 } 34995 } else { 34996 for (const node of nodes) { 34997 restore(node); 34998 } 34999 } 35000 } 35001 function useFirefoxDraggableCompatibility() { 35002 return (0,external_wp_compose_namespaceObject.useRefEffect)((node) => { 35003 add(node.ownerDocument, node); 35004 return () => { 35005 remove(node.ownerDocument, node); 35006 }; 35007 }, []); 35008 } 35009 35010 35011 ;// ./node_modules/@wordpress/block-editor/build-module/components/block-list/use-block-props/index.js 35012 35013 35014 35015 35016 35017 35018 35019 35020 35021 35022 35023 35024 35025 35026 35027 35028 35029 35030 function use_block_props_useBlockProps(props = {}, { __unstableIsHtml } = {}) { 35031 const { 35032 clientId, 35033 className, 35034 wrapperProps = {}, 35035 isAligned, 35036 index, 35037 mode, 35038 name, 35039 blockApiVersion, 35040 blockTitle, 35041 isSelected, 35042 isSubtreeDisabled, 35043 hasOverlay, 35044 initialPosition, 35045 blockEditingMode, 35046 isHighlighted, 35047 isMultiSelected, 35048 isPartiallySelected, 35049 isReusable, 35050 isDragging, 35051 hasChildSelected, 35052 isEditingDisabled, 35053 hasEditableOutline, 35054 isTemporarilyEditingAsBlocks, 35055 defaultClassName, 35056 isSectionBlock, 35057 canMove, 35058 isBlockHidden 35059 } = (0,external_wp_element_namespaceObject.useContext)(PrivateBlockContext); 35060 const blockLabel = (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)("Block: %s"), blockTitle); 35061 const htmlSuffix = mode === "html" && !__unstableIsHtml ? "-visual" : ""; 35062 const ffDragRef = useFirefoxDraggableCompatibility(); 35063 const mergedRefs = (0,external_wp_compose_namespaceObject.useMergeRefs)([ 35064 props.ref, 35065 useFocusFirstElement({ clientId, initialPosition }), 35066 useBlockRefProvider(clientId), 35067 useFocusHandler(clientId), 35068 useEventHandlers({ clientId, isSelected }), 35069 useIsHovered(), 35070 useIntersectionObserver(), 35071 use_moving_animation_default({ triggerAnimationOnChange: index, clientId }), 35072 (0,external_wp_compose_namespaceObject.useDisabled)({ isDisabled: !hasOverlay }), 35073 useFlashEditableBlocks({ 35074 clientId, 35075 isEnabled: isSectionBlock 35076 }), 35077 useScrollIntoView({ isSelected }), 35078 canMove ? ffDragRef : void 0 35079 ]); 35080 const blockEditContext = useBlockEditContext(); 35081 const hasBlockBindings = !!blockEditContext[blockBindingsKey]; 35082 const bindingsStyle = hasBlockBindings ? { 35083 "--wp-admin-theme-color": "var(--wp-block-synced-color)", 35084 "--wp-admin-theme-color--rgb": "var(--wp-block-synced-color--rgb)" 35085 } : {}; 35086 if (blockApiVersion < 2 && clientId === blockEditContext.clientId) { 35087 external_wp_warning_default()( 35088 `Block type "$name}" must support API version 2 or higher to work correctly with "useBlockProps" method.` 35089 ); 35090 } 35091 let hasNegativeMargin = false; 35092 if (wrapperProps?.style?.marginTop?.charAt(0) === "-" || wrapperProps?.style?.marginBottom?.charAt(0) === "-" || wrapperProps?.style?.marginLeft?.charAt(0) === "-" || wrapperProps?.style?.marginRight?.charAt(0) === "-") { 35093 hasNegativeMargin = true; 35094 } 35095 return { 35096 tabIndex: blockEditingMode === "disabled" ? -1 : 0, 35097 draggable: canMove && !hasChildSelected ? true : void 0, 35098 ...wrapperProps, 35099 ...props, 35100 ref: mergedRefs, 35101 id: `block-$clientId}$htmlSuffix}`, 35102 role: "document", 35103 "aria-label": blockLabel, 35104 "data-block": clientId, 35105 "data-type": name, 35106 "data-title": blockTitle, 35107 inert: isSubtreeDisabled ? "true" : void 0, 35108 className: dist_clsx( 35109 "block-editor-block-list__block", 35110 { 35111 // The wp-block className is important for editor styles. 35112 "wp-block": !isAligned, 35113 "has-block-overlay": hasOverlay, 35114 "is-selected": isSelected, 35115 "is-highlighted": isHighlighted, 35116 "is-multi-selected": isMultiSelected, 35117 "is-partially-selected": isPartiallySelected, 35118 "is-reusable": isReusable, 35119 "is-dragging": isDragging, 35120 "has-child-selected": hasChildSelected, 35121 "is-editing-disabled": isEditingDisabled, 35122 "has-editable-outline": hasEditableOutline, 35123 "has-negative-margin": hasNegativeMargin, 35124 "is-content-locked-temporarily-editing-as-blocks": isTemporarilyEditingAsBlocks, 35125 "is-block-hidden": isBlockHidden 35126 }, 35127 className, 35128 props.className, 35129 wrapperProps.className, 35130 defaultClassName 35131 ), 35132 style: { ...wrapperProps.style, ...props.style, ...bindingsStyle } 35133 }; 35134 } 35135 use_block_props_useBlockProps.save = external_wp_blocks_namespaceObject.__unstableGetBlockProps; 35136 35137 35138 ;// ./node_modules/@wordpress/block-editor/build-module/components/block-list/block.js 35139 35140 35141 35142 35143 35144 35145 35146 35147 35148 35149 35150 35151 35152 35153 35154 35155 35156 35157 function mergeWrapperProps(propsA, propsB) { 35158 const newProps = { 35159 ...propsA, 35160 ...propsB 35161 }; 35162 if (propsA?.hasOwnProperty("className") && propsB?.hasOwnProperty("className")) { 35163 newProps.className = dist_clsx(propsA.className, propsB.className); 35164 } 35165 if (propsA?.hasOwnProperty("style") && propsB?.hasOwnProperty("style")) { 35166 newProps.style = { ...propsA.style, ...propsB.style }; 35167 } 35168 return newProps; 35169 } 35170 function Block({ children, isHtml, ...props }) { 35171 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { ...use_block_props_useBlockProps(props, { __unstableIsHtml: isHtml }), children }); 35172 } 35173 function BlockListBlock({ 35174 block: { __unstableBlockSource }, 35175 mode, 35176 isLocked, 35177 canRemove, 35178 clientId, 35179 isSelected, 35180 isSelectionEnabled, 35181 className, 35182 __unstableLayoutClassNames: layoutClassNames, 35183 name, 35184 isValid, 35185 attributes, 35186 wrapperProps, 35187 setAttributes, 35188 onReplace, 35189 onRemove, 35190 onInsertBlocksAfter, 35191 onMerge, 35192 toggleSelection 35193 }) { 35194 const { 35195 mayDisplayControls, 35196 mayDisplayParentControls, 35197 themeSupportsLayout, 35198 ...context 35199 } = (0,external_wp_element_namespaceObject.useContext)(PrivateBlockContext); 35200 const parentLayout = useLayout() || {}; 35201 let blockEdit = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 35202 BlockEdit, 35203 { 35204 name, 35205 isSelected, 35206 attributes, 35207 setAttributes, 35208 insertBlocksAfter: isLocked ? void 0 : onInsertBlocksAfter, 35209 onReplace: canRemove ? onReplace : void 0, 35210 onRemove: canRemove ? onRemove : void 0, 35211 mergeBlocks: canRemove ? onMerge : void 0, 35212 clientId, 35213 isSelectionEnabled, 35214 toggleSelection, 35215 __unstableLayoutClassNames: layoutClassNames, 35216 __unstableParentLayout: Object.keys(parentLayout).length ? parentLayout : void 0, 35217 mayDisplayControls, 35218 mayDisplayParentControls, 35219 blockEditingMode: context.blockEditingMode, 35220 isPreviewMode: context.isPreviewMode 35221 } 35222 ); 35223 const blockType = (0,external_wp_blocks_namespaceObject.getBlockType)(name); 35224 if (blockType?.getEditWrapperProps) { 35225 wrapperProps = mergeWrapperProps( 35226 wrapperProps, 35227 blockType.getEditWrapperProps(attributes) 35228 ); 35229 } 35230 const isAligned = wrapperProps && !!wrapperProps["data-align"] && !themeSupportsLayout; 35231 const isSticky = className?.includes("is-position-sticky"); 35232 if (isAligned) { 35233 blockEdit = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 35234 "div", 35235 { 35236 className: dist_clsx("wp-block", isSticky && className), 35237 "data-align": wrapperProps["data-align"], 35238 children: blockEdit 35239 } 35240 ); 35241 } 35242 let block; 35243 if (!isValid) { 35244 const saveContent = __unstableBlockSource ? (0,external_wp_blocks_namespaceObject.serializeRawBlock)(__unstableBlockSource) : (0,external_wp_blocks_namespaceObject.getSaveContent)(blockType, attributes); 35245 block = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(Block, { className: "has-warning", children: [ 35246 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockInvalidWarning, { clientId }), 35247 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_element_namespaceObject.RawHTML, { children: (0,external_wp_dom_namespaceObject.safeHTML)(saveContent) }) 35248 ] }); 35249 } else if (mode === "html") { 35250 block = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 35251 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { style: { display: "none" }, children: blockEdit }), 35252 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Block, { isHtml: true, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(block_html_default, { clientId }) }) 35253 ] }); 35254 } else if (blockType?.apiVersion > 1) { 35255 block = blockEdit; 35256 } else { 35257 block = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Block, { children: blockEdit }); 35258 } 35259 const { "data-align": dataAlign, ...restWrapperProps } = wrapperProps ?? {}; 35260 const updatedWrapperProps = { 35261 ...restWrapperProps, 35262 className: dist_clsx( 35263 restWrapperProps.className, 35264 dataAlign && themeSupportsLayout && `align$dataAlign}`, 35265 !(dataAlign && isSticky) && className 35266 ) 35267 }; 35268 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 35269 PrivateBlockContext.Provider, 35270 { 35271 value: { 35272 wrapperProps: updatedWrapperProps, 35273 isAligned, 35274 ...context 35275 }, 35276 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 35277 block_crash_boundary_default, 35278 { 35279 fallback: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Block, { className: "has-warning", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(block_crash_warning_default, {}) }), 35280 children: block 35281 } 35282 ) 35283 } 35284 ); 35285 } 35286 const applyWithDispatch = (0,external_wp_data_namespaceObject.withDispatch)((dispatch, ownProps, registry) => { 35287 const { 35288 updateBlockAttributes, 35289 insertBlocks, 35290 mergeBlocks, 35291 replaceBlocks, 35292 toggleSelection, 35293 __unstableMarkLastChangeAsPersistent, 35294 moveBlocksToPosition, 35295 removeBlock, 35296 selectBlock 35297 } = dispatch(store); 35298 return { 35299 setAttributes(nextAttributes) { 35300 const { getMultiSelectedBlockClientIds } = registry.select(store); 35301 const multiSelectedBlockClientIds = getMultiSelectedBlockClientIds(); 35302 const { clientId, attributes } = ownProps; 35303 const clientIds = multiSelectedBlockClientIds.length ? multiSelectedBlockClientIds : [clientId]; 35304 const newAttributes = typeof nextAttributes === "function" ? nextAttributes(attributes) : nextAttributes; 35305 updateBlockAttributes(clientIds, newAttributes); 35306 }, 35307 onInsertBlocks(blocks, index) { 35308 const { rootClientId } = ownProps; 35309 insertBlocks(blocks, index, rootClientId); 35310 }, 35311 onInsertBlocksAfter(blocks) { 35312 const { clientId, rootClientId } = ownProps; 35313 const { getBlockIndex } = registry.select(store); 35314 const index = getBlockIndex(clientId); 35315 insertBlocks(blocks, index + 1, rootClientId); 35316 }, 35317 onMerge(forward) { 35318 const { clientId, rootClientId } = ownProps; 35319 const { 35320 getPreviousBlockClientId, 35321 getNextBlockClientId, 35322 getBlock, 35323 getBlockAttributes, 35324 getBlockName, 35325 getBlockOrder, 35326 getBlockIndex, 35327 getBlockRootClientId, 35328 canInsertBlockType 35329 } = registry.select(store); 35330 function switchToDefaultOrRemove() { 35331 const block = getBlock(clientId); 35332 const defaultBlockName = (0,external_wp_blocks_namespaceObject.getDefaultBlockName)(); 35333 const defaultBlockType = (0,external_wp_blocks_namespaceObject.getBlockType)(defaultBlockName); 35334 if (getBlockName(clientId) !== defaultBlockName) { 35335 const replacement = (0,external_wp_blocks_namespaceObject.switchToBlockType)( 35336 block, 35337 defaultBlockName 35338 ); 35339 if (replacement && replacement.length) { 35340 replaceBlocks(clientId, replacement); 35341 } 35342 } else if ((0,external_wp_blocks_namespaceObject.isUnmodifiedDefaultBlock)(block)) { 35343 const nextBlockClientId = getNextBlockClientId(clientId); 35344 if (nextBlockClientId) { 35345 registry.batch(() => { 35346 removeBlock(clientId); 35347 selectBlock(nextBlockClientId); 35348 }); 35349 } 35350 } else if (defaultBlockType.merge) { 35351 const attributes = defaultBlockType.merge( 35352 {}, 35353 block.attributes 35354 ); 35355 replaceBlocks( 35356 [clientId], 35357 [(0,external_wp_blocks_namespaceObject.createBlock)(defaultBlockName, attributes)] 35358 ); 35359 } 35360 } 35361 function moveFirstItemUp(_clientId, changeSelection = true) { 35362 const wrapperBlockName = getBlockName(_clientId); 35363 const wrapperBlockType = (0,external_wp_blocks_namespaceObject.getBlockType)(wrapperBlockName); 35364 const isTextualWrapper = wrapperBlockType.category === "text"; 35365 const targetRootClientId = getBlockRootClientId(_clientId); 35366 const blockOrder = getBlockOrder(_clientId); 35367 const [firstClientId] = blockOrder; 35368 if (blockOrder.length === 1 && (0,external_wp_blocks_namespaceObject.isUnmodifiedBlock)(getBlock(firstClientId))) { 35369 removeBlock(_clientId); 35370 } else if (isTextualWrapper) { 35371 registry.batch(() => { 35372 if (canInsertBlockType( 35373 getBlockName(firstClientId), 35374 targetRootClientId 35375 )) { 35376 moveBlocksToPosition( 35377 [firstClientId], 35378 _clientId, 35379 targetRootClientId, 35380 getBlockIndex(_clientId) 35381 ); 35382 } else { 35383 const replacement = (0,external_wp_blocks_namespaceObject.switchToBlockType)( 35384 getBlock(firstClientId), 35385 (0,external_wp_blocks_namespaceObject.getDefaultBlockName)() 35386 ); 35387 if (replacement && replacement.length && replacement.every( 35388 (block) => canInsertBlockType( 35389 block.name, 35390 targetRootClientId 35391 ) 35392 )) { 35393 insertBlocks( 35394 replacement, 35395 getBlockIndex(_clientId), 35396 targetRootClientId, 35397 changeSelection 35398 ); 35399 removeBlock(firstClientId, false); 35400 } else { 35401 switchToDefaultOrRemove(); 35402 } 35403 } 35404 if (!getBlockOrder(_clientId).length && (0,external_wp_blocks_namespaceObject.isUnmodifiedBlock)(getBlock(_clientId))) { 35405 removeBlock(_clientId, false); 35406 } 35407 }); 35408 } else { 35409 switchToDefaultOrRemove(); 35410 } 35411 } 35412 if (forward) { 35413 if (rootClientId) { 35414 const nextRootClientId = getNextBlockClientId(rootClientId); 35415 if (nextRootClientId) { 35416 if (getBlockName(rootClientId) === getBlockName(nextRootClientId)) { 35417 const rootAttributes = getBlockAttributes(rootClientId); 35418 const previousRootAttributes = getBlockAttributes(nextRootClientId); 35419 if (Object.keys(rootAttributes).every( 35420 (key) => rootAttributes[key] === previousRootAttributes[key] 35421 )) { 35422 registry.batch(() => { 35423 moveBlocksToPosition( 35424 getBlockOrder(nextRootClientId), 35425 nextRootClientId, 35426 rootClientId 35427 ); 35428 removeBlock(nextRootClientId, false); 35429 }); 35430 return; 35431 } 35432 } else { 35433 mergeBlocks(rootClientId, nextRootClientId); 35434 return; 35435 } 35436 } 35437 } 35438 const nextBlockClientId = getNextBlockClientId(clientId); 35439 if (!nextBlockClientId) { 35440 return; 35441 } 35442 if (getBlockOrder(nextBlockClientId).length) { 35443 moveFirstItemUp(nextBlockClientId, false); 35444 } else { 35445 mergeBlocks(clientId, nextBlockClientId); 35446 } 35447 } else { 35448 const previousBlockClientId = getPreviousBlockClientId(clientId); 35449 if (previousBlockClientId) { 35450 mergeBlocks(previousBlockClientId, clientId); 35451 } else if (rootClientId) { 35452 const previousRootClientId = getPreviousBlockClientId(rootClientId); 35453 if (previousRootClientId && getBlockName(rootClientId) === getBlockName(previousRootClientId)) { 35454 const rootAttributes = getBlockAttributes(rootClientId); 35455 const previousRootAttributes = getBlockAttributes(previousRootClientId); 35456 if (Object.keys(rootAttributes).every( 35457 (key) => rootAttributes[key] === previousRootAttributes[key] 35458 )) { 35459 registry.batch(() => { 35460 moveBlocksToPosition( 35461 getBlockOrder(rootClientId), 35462 rootClientId, 35463 previousRootClientId 35464 ); 35465 removeBlock(rootClientId, false); 35466 }); 35467 return; 35468 } 35469 } 35470 moveFirstItemUp(rootClientId); 35471 } else { 35472 switchToDefaultOrRemove(); 35473 } 35474 } 35475 }, 35476 onReplace(blocks, indexToSelect, initialPosition) { 35477 if (blocks.length && !(0,external_wp_blocks_namespaceObject.isUnmodifiedDefaultBlock)(blocks[blocks.length - 1])) { 35478 __unstableMarkLastChangeAsPersistent(); 35479 } 35480 const replacementBlocks = blocks?.length === 1 && Array.isArray(blocks[0]) ? blocks[0] : blocks; 35481 replaceBlocks( 35482 [ownProps.clientId], 35483 replacementBlocks, 35484 indexToSelect, 35485 initialPosition 35486 ); 35487 }, 35488 onRemove() { 35489 removeBlock(ownProps.clientId); 35490 }, 35491 toggleSelection(selectionEnabled) { 35492 toggleSelection(selectionEnabled); 35493 } 35494 }; 35495 }); 35496 BlockListBlock = (0,external_wp_compose_namespaceObject.compose)( 35497 applyWithDispatch, 35498 (0,external_wp_components_namespaceObject.withFilters)("editor.BlockListBlock") 35499 )(BlockListBlock); 35500 function BlockListBlockProvider(props) { 35501 const { clientId, rootClientId } = props; 35502 const selectedProps = (0,external_wp_data_namespaceObject.useSelect)( 35503 (select) => { 35504 const { 35505 isBlockSelected, 35506 getBlockMode, 35507 isSelectionEnabled: isSelectionEnabled2, 35508 getTemplateLock, 35509 isSectionBlock: _isSectionBlock, 35510 getBlockWithoutAttributes, 35511 getBlockAttributes, 35512 canRemoveBlock, 35513 canMoveBlock, 35514 getSettings, 35515 getTemporarilyEditingAsBlocks, 35516 getBlockEditingMode, 35517 getBlockName, 35518 isFirstMultiSelectedBlock, 35519 getMultiSelectedBlockClientIds, 35520 hasSelectedInnerBlock, 35521 getBlocksByName, 35522 getBlockIndex, 35523 isBlockMultiSelected, 35524 isBlockSubtreeDisabled, 35525 isBlockHighlighted, 35526 __unstableIsFullySelected, 35527 __unstableSelectionHasUnmergeableBlock, 35528 isBlockBeingDragged, 35529 isDragging: isDragging2, 35530 __unstableHasActiveBlockOverlayActive, 35531 getSelectedBlocksInitialCaretPosition 35532 } = unlock(select(store)); 35533 const blockWithoutAttributes2 = getBlockWithoutAttributes(clientId); 35534 if (!blockWithoutAttributes2) { 35535 return; 35536 } 35537 const { 35538 hasBlockSupport: _hasBlockSupport, 35539 getActiveBlockVariation 35540 } = select(external_wp_blocks_namespaceObject.store); 35541 const attributes2 = getBlockAttributes(clientId); 35542 const { name: blockName, isValid: isValid2 } = blockWithoutAttributes2; 35543 const blockType = (0,external_wp_blocks_namespaceObject.getBlockType)(blockName); 35544 const { 35545 supportsLayout, 35546 isPreviewMode: isPreviewMode2, 35547 __experimentalBlockBindingsSupportedAttributes 35548 } = getSettings(); 35549 const bindableAttributes2 = __experimentalBlockBindingsSupportedAttributes?.[blockName]; 35550 const hasLightBlockWrapper = blockType?.apiVersion > 1; 35551 const previewContext = { 35552 isPreviewMode: isPreviewMode2, 35553 blockWithoutAttributes: blockWithoutAttributes2, 35554 name: blockName, 35555 attributes: attributes2, 35556 isValid: isValid2, 35557 themeSupportsLayout: supportsLayout, 35558 index: getBlockIndex(clientId), 35559 isReusable: (0,external_wp_blocks_namespaceObject.isReusableBlock)(blockType), 35560 className: hasLightBlockWrapper ? attributes2.className : void 0, 35561 defaultClassName: hasLightBlockWrapper ? (0,external_wp_blocks_namespaceObject.getBlockDefaultClassName)(blockName) : void 0, 35562 blockTitle: blockType?.title, 35563 isBlockHidden: attributes2?.metadata?.blockVisibility === false, 35564 bindableAttributes: bindableAttributes2 35565 }; 35566 if (isPreviewMode2) { 35567 return previewContext; 35568 } 35569 const { isBlockHidden: _isBlockHidden } = unlock( 35570 select(store) 35571 ); 35572 const _isSelected = isBlockSelected(clientId); 35573 const canRemove2 = canRemoveBlock(clientId); 35574 const canMove2 = canMoveBlock(clientId); 35575 const match = getActiveBlockVariation(blockName, attributes2); 35576 const isMultiSelected2 = isBlockMultiSelected(clientId); 35577 const checkDeep = true; 35578 const isAncestorOfSelectedBlock = hasSelectedInnerBlock( 35579 clientId, 35580 checkDeep 35581 ); 35582 const blockEditingMode2 = getBlockEditingMode(clientId); 35583 const multiple = (0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockName, "multiple", true); 35584 const blocksWithSameName = multiple ? [] : getBlocksByName(blockName); 35585 const isInvalid = blocksWithSameName.length && blocksWithSameName[0] !== clientId; 35586 return { 35587 ...previewContext, 35588 mode: getBlockMode(clientId), 35589 isSelectionEnabled: isSelectionEnabled2(), 35590 isLocked: !!getTemplateLock(rootClientId), 35591 isSectionBlock: _isSectionBlock(clientId), 35592 canRemove: canRemove2, 35593 canMove: canMove2, 35594 isSelected: _isSelected, 35595 isTemporarilyEditingAsBlocks: getTemporarilyEditingAsBlocks() === clientId, 35596 blockEditingMode: blockEditingMode2, 35597 mayDisplayControls: _isSelected || isFirstMultiSelectedBlock(clientId) && getMultiSelectedBlockClientIds().every( 35598 (id) => getBlockName(id) === blockName 35599 ), 35600 mayDisplayParentControls: _hasBlockSupport( 35601 getBlockName(clientId), 35602 "__experimentalExposeControlsToChildren", 35603 false 35604 ) && hasSelectedInnerBlock(clientId), 35605 blockApiVersion: blockType?.apiVersion || 1, 35606 blockTitle: match?.title || blockType?.title, 35607 isSubtreeDisabled: blockEditingMode2 === "disabled" && isBlockSubtreeDisabled(clientId), 35608 hasOverlay: __unstableHasActiveBlockOverlayActive(clientId) && !isDragging2(), 35609 initialPosition: _isSelected ? getSelectedBlocksInitialCaretPosition() : void 0, 35610 isHighlighted: isBlockHighlighted(clientId), 35611 isMultiSelected: isMultiSelected2, 35612 isPartiallySelected: isMultiSelected2 && !__unstableIsFullySelected() && !__unstableSelectionHasUnmergeableBlock(), 35613 isDragging: isBlockBeingDragged(clientId), 35614 hasChildSelected: isAncestorOfSelectedBlock, 35615 isEditingDisabled: blockEditingMode2 === "disabled", 35616 hasEditableOutline: blockEditingMode2 !== "disabled" && getBlockEditingMode(rootClientId) === "disabled", 35617 originalBlockClientId: isInvalid ? blocksWithSameName[0] : false, 35618 isBlockHidden: _isBlockHidden(clientId) 35619 }; 35620 }, 35621 [clientId, rootClientId] 35622 ); 35623 const { 35624 isPreviewMode, 35625 // Fill values that end up as a public API and may not be defined in 35626 // preview mode. 35627 mode = "visual", 35628 isSelectionEnabled = false, 35629 isLocked = false, 35630 canRemove = false, 35631 canMove = false, 35632 blockWithoutAttributes, 35633 name, 35634 attributes, 35635 isValid, 35636 isSelected = false, 35637 themeSupportsLayout, 35638 isTemporarilyEditingAsBlocks, 35639 blockEditingMode, 35640 mayDisplayControls, 35641 mayDisplayParentControls, 35642 index, 35643 blockApiVersion, 35644 blockTitle, 35645 isSubtreeDisabled, 35646 hasOverlay, 35647 initialPosition, 35648 isHighlighted, 35649 isMultiSelected, 35650 isPartiallySelected, 35651 isReusable, 35652 isDragging, 35653 hasChildSelected, 35654 isSectionBlock, 35655 isEditingDisabled, 35656 hasEditableOutline, 35657 className, 35658 defaultClassName, 35659 originalBlockClientId, 35660 isBlockHidden, 35661 bindableAttributes 35662 } = selectedProps; 35663 const block = (0,external_wp_element_namespaceObject.useMemo)( 35664 () => ({ ...blockWithoutAttributes, attributes }), 35665 [blockWithoutAttributes, attributes] 35666 ); 35667 if (!selectedProps) { 35668 return null; 35669 } 35670 const privateContext = { 35671 isPreviewMode, 35672 clientId, 35673 className, 35674 index, 35675 mode, 35676 name, 35677 blockApiVersion, 35678 blockTitle, 35679 isSelected, 35680 isSubtreeDisabled, 35681 hasOverlay, 35682 initialPosition, 35683 blockEditingMode, 35684 isHighlighted, 35685 isMultiSelected, 35686 isPartiallySelected, 35687 isReusable, 35688 isDragging, 35689 hasChildSelected, 35690 isSectionBlock, 35691 isEditingDisabled, 35692 hasEditableOutline, 35693 isTemporarilyEditingAsBlocks, 35694 defaultClassName, 35695 mayDisplayControls, 35696 mayDisplayParentControls, 35697 originalBlockClientId, 35698 themeSupportsLayout, 35699 canMove, 35700 isBlockHidden, 35701 bindableAttributes 35702 }; 35703 if (isBlockHidden && !isSelected && !isMultiSelected && !hasChildSelected) { 35704 return null; 35705 } 35706 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PrivateBlockContext.Provider, { value: privateContext, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 35707 BlockListBlock, 35708 { 35709 ...props, 35710 ...{ 35711 mode, 35712 isSelectionEnabled, 35713 isLocked, 35714 canRemove, 35715 canMove, 35716 // Users of the editor.BlockListBlock filter used to be able 35717 // to access the block prop. Ideally these blocks would rely 35718 // on the clientId prop only. This is kept for backward 35719 // compatibility reasons. 35720 block, 35721 name, 35722 attributes, 35723 isValid, 35724 isSelected 35725 } 35726 } 35727 ) }); 35728 } 35729 var block_default = (0,external_wp_element_namespaceObject.memo)(BlockListBlockProvider); 35730 35731 35732 ;// external ["wp","htmlEntities"] 35733 const external_wp_htmlEntities_namespaceObject = window["wp"]["htmlEntities"]; 35734 ;// ./node_modules/@wordpress/block-editor/build-module/components/default-block-appender/index.js 35735 35736 35737 35738 35739 35740 35741 35742 35743 const ZWNBSP = "\uFEFF"; 35744 function DefaultBlockAppender({ rootClientId }) { 35745 const { showPrompt, isLocked, placeholder, isManualGrid } = (0,external_wp_data_namespaceObject.useSelect)( 35746 (select) => { 35747 const { 35748 getBlockCount, 35749 getSettings, 35750 getTemplateLock, 35751 getBlockAttributes 35752 } = select(store); 35753 const isEmpty = !getBlockCount(rootClientId); 35754 const { bodyPlaceholder } = getSettings(); 35755 return { 35756 showPrompt: isEmpty, 35757 isLocked: !!getTemplateLock(rootClientId), 35758 placeholder: bodyPlaceholder, 35759 isManualGrid: getBlockAttributes(rootClientId)?.layout?.isManualPlacement 35760 }; 35761 }, 35762 [rootClientId] 35763 ); 35764 const { insertDefaultBlock, startTyping } = (0,external_wp_data_namespaceObject.useDispatch)(store); 35765 if (isLocked || isManualGrid) { 35766 return null; 35767 } 35768 const value = (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(placeholder) || (0,external_wp_i18n_namespaceObject.__)("Type / to choose a block"); 35769 const onAppend = () => { 35770 insertDefaultBlock(void 0, rootClientId); 35771 startTyping(); 35772 }; 35773 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 35774 "div", 35775 { 35776 "data-root-client-id": rootClientId || "", 35777 className: dist_clsx("block-editor-default-block-appender", { 35778 "has-visible-prompt": showPrompt 35779 }), 35780 children: [ 35781 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 35782 "p", 35783 { 35784 tabIndex: "0", 35785 role: "button", 35786 "aria-label": (0,external_wp_i18n_namespaceObject.__)("Add default block"), 35787 className: "block-editor-default-block-appender__content", 35788 onKeyDown: (event) => { 35789 if (external_wp_keycodes_namespaceObject.ENTER === event.keyCode || external_wp_keycodes_namespaceObject.SPACE === event.keyCode) { 35790 onAppend(); 35791 } 35792 }, 35793 onClick: () => onAppend(), 35794 onFocus: () => { 35795 if (showPrompt) { 35796 onAppend(); 35797 } 35798 }, 35799 children: showPrompt ? value : ZWNBSP 35800 } 35801 ), 35802 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 35803 inserter_default, 35804 { 35805 rootClientId, 35806 position: "bottom right", 35807 isAppender: true, 35808 __experimentalIsQuick: true 35809 } 35810 ) 35811 ] 35812 } 35813 ); 35814 } 35815 35816 35817 ;// ./node_modules/@wordpress/block-editor/build-module/components/block-list-appender/index.js 35818 35819 35820 35821 35822 35823 35824 35825 function DefaultAppender({ rootClientId }) { 35826 const canInsertDefaultBlock = (0,external_wp_data_namespaceObject.useSelect)( 35827 (select) => select(store).canInsertBlockType( 35828 (0,external_wp_blocks_namespaceObject.getDefaultBlockName)(), 35829 rootClientId 35830 ) 35831 ); 35832 if (canInsertDefaultBlock) { 35833 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(DefaultBlockAppender, { rootClientId }); 35834 } 35835 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 35836 button_block_appender_default, 35837 { 35838 rootClientId, 35839 className: "block-list-appender__toggle" 35840 } 35841 ); 35842 } 35843 function BlockListAppender({ 35844 rootClientId, 35845 CustomAppender, 35846 className, 35847 tagName: TagName = "div" 35848 }) { 35849 const isDragOver = (0,external_wp_data_namespaceObject.useSelect)( 35850 (select) => { 35851 const { 35852 getBlockInsertionPoint, 35853 isBlockInsertionPointVisible, 35854 getBlockCount 35855 } = select(store); 35856 const insertionPoint = getBlockInsertionPoint(); 35857 return isBlockInsertionPointVisible() && rootClientId === insertionPoint?.rootClientId && getBlockCount(rootClientId) === 0; 35858 }, 35859 [rootClientId] 35860 ); 35861 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 35862 TagName, 35863 { 35864 tabIndex: -1, 35865 className: dist_clsx("block-list-appender wp-block", className, { 35866 "is-drag-over": isDragOver 35867 }), 35868 contentEditable: false, 35869 "data-block": true, 35870 children: CustomAppender ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(CustomAppender, {}) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(DefaultAppender, { rootClientId }) 35871 } 35872 ); 35873 } 35874 35875 35876 ;// ./node_modules/@wordpress/block-editor/build-module/components/block-popover/inbetween.js 35877 35878 35879 35880 35881 35882 35883 35884 35885 35886 const inbetween_MAX_POPOVER_RECOMPUTE_COUNTER = Number.MAX_SAFE_INTEGER; 35887 function BlockPopoverInbetween({ 35888 previousClientId, 35889 nextClientId, 35890 children, 35891 __unstablePopoverSlot, 35892 __unstableContentRef, 35893 operation = "insert", 35894 nearestSide = "right", 35895 ...props 35896 }) { 35897 const [popoverRecomputeCounter, forcePopoverRecompute] = (0,external_wp_element_namespaceObject.useReducer)( 35898 // Module is there to make sure that the counter doesn't overflow. 35899 (s) => (s + 1) % inbetween_MAX_POPOVER_RECOMPUTE_COUNTER, 35900 0 35901 ); 35902 const { orientation, rootClientId, isVisible } = (0,external_wp_data_namespaceObject.useSelect)( 35903 (select) => { 35904 const { 35905 getBlockListSettings, 35906 getBlockRootClientId, 35907 isBlockVisible 35908 } = select(store); 35909 const _rootClientId = getBlockRootClientId( 35910 previousClientId ?? nextClientId 35911 ); 35912 return { 35913 orientation: getBlockListSettings(_rootClientId)?.orientation || "vertical", 35914 rootClientId: _rootClientId, 35915 isVisible: isBlockVisible(previousClientId) && isBlockVisible(nextClientId) 35916 }; 35917 }, 35918 [previousClientId, nextClientId] 35919 ); 35920 const previousElement = useBlockElement(previousClientId); 35921 const nextElement = useBlockElement(nextClientId); 35922 const isVertical = orientation === "vertical"; 35923 const popoverAnchor = (0,external_wp_element_namespaceObject.useMemo)(() => { 35924 if ( 35925 // popoverRecomputeCounter is by definition always equal or greater than 0. 35926 // This check is only there to satisfy the correctness of the 35927 // exhaustive-deps rule for the `useMemo` hook. 35928 popoverRecomputeCounter < 0 || !previousElement && !nextElement || !isVisible 35929 ) { 35930 return void 0; 35931 } 35932 const contextElement = operation === "group" ? nextElement || previousElement : previousElement || nextElement; 35933 return { 35934 contextElement, 35935 getBoundingClientRect() { 35936 const previousRect = previousElement ? previousElement.getBoundingClientRect() : null; 35937 const nextRect = nextElement ? nextElement.getBoundingClientRect() : null; 35938 let left = 0; 35939 let top = 0; 35940 let width = 0; 35941 let height = 0; 35942 if (operation === "group") { 35943 const targetRect = nextRect || previousRect; 35944 top = targetRect.top; 35945 width = 0; 35946 height = targetRect.bottom - targetRect.top; 35947 left = nearestSide === "left" ? targetRect.left - 2 : targetRect.right - 2; 35948 } else if (isVertical) { 35949 top = previousRect ? previousRect.bottom : nextRect.top; 35950 width = previousRect ? previousRect.width : nextRect.width; 35951 height = nextRect && previousRect ? nextRect.top - previousRect.bottom : 0; 35952 left = previousRect ? previousRect.left : nextRect.left; 35953 } else { 35954 top = previousRect ? previousRect.top : nextRect.top; 35955 height = previousRect ? previousRect.height : nextRect.height; 35956 if ((0,external_wp_i18n_namespaceObject.isRTL)()) { 35957 left = nextRect ? nextRect.right : previousRect.left; 35958 width = previousRect && nextRect ? previousRect.left - nextRect.right : 0; 35959 } else { 35960 left = previousRect ? previousRect.right : nextRect.left; 35961 width = previousRect && nextRect ? nextRect.left - previousRect.right : 0; 35962 } 35963 width = Math.max(width, 0); 35964 } 35965 return new window.DOMRect(left, top, width, height); 35966 } 35967 }; 35968 }, [ 35969 previousElement, 35970 nextElement, 35971 popoverRecomputeCounter, 35972 isVertical, 35973 isVisible, 35974 operation, 35975 nearestSide 35976 ]); 35977 const popoverScrollRef = use_popover_scroll_default(__unstableContentRef); 35978 (0,external_wp_element_namespaceObject.useLayoutEffect)(() => { 35979 if (!previousElement) { 35980 return; 35981 } 35982 const observer = new window.MutationObserver(forcePopoverRecompute); 35983 observer.observe(previousElement, { attributes: true }); 35984 return () => { 35985 observer.disconnect(); 35986 }; 35987 }, [previousElement]); 35988 (0,external_wp_element_namespaceObject.useLayoutEffect)(() => { 35989 if (!nextElement) { 35990 return; 35991 } 35992 const observer = new window.MutationObserver(forcePopoverRecompute); 35993 observer.observe(nextElement, { attributes: true }); 35994 return () => { 35995 observer.disconnect(); 35996 }; 35997 }, [nextElement]); 35998 (0,external_wp_element_namespaceObject.useLayoutEffect)(() => { 35999 if (!previousElement) { 36000 return; 36001 } 36002 previousElement.ownerDocument.defaultView.addEventListener( 36003 "resize", 36004 forcePopoverRecompute 36005 ); 36006 return () => { 36007 previousElement.ownerDocument.defaultView?.removeEventListener( 36008 "resize", 36009 forcePopoverRecompute 36010 ); 36011 }; 36012 }, [previousElement]); 36013 if (!previousElement && !nextElement || !isVisible) { 36014 return null; 36015 } 36016 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 36017 external_wp_components_namespaceObject.Popover, 36018 { 36019 ref: popoverScrollRef, 36020 animate: false, 36021 anchor: popoverAnchor, 36022 focusOnMount: false, 36023 __unstableSlotName: __unstablePopoverSlot, 36024 inline: !__unstablePopoverSlot, 36025 ...props, 36026 className: dist_clsx( 36027 "block-editor-block-popover", 36028 "block-editor-block-popover__inbetween", 36029 props.className 36030 ), 36031 resize: false, 36032 flip: false, 36033 placement: "overlay", 36034 variant: "unstyled", 36035 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-block-popover__inbetween-container", children }) 36036 }, 36037 nextClientId + "--" + rootClientId 36038 ); 36039 } 36040 var inbetween_default = BlockPopoverInbetween; 36041 36042 36043 ;// ./node_modules/@wordpress/block-editor/build-module/components/block-popover/drop-zone.js 36044 36045 36046 36047 36048 36049 36050 const animateVariants = { 36051 hide: { opacity: 0, scaleY: 0.75 }, 36052 show: { opacity: 1, scaleY: 1 }, 36053 exit: { opacity: 0, scaleY: 0.9 } 36054 }; 36055 function BlockDropZonePopover({ 36056 __unstablePopoverSlot, 36057 __unstableContentRef 36058 }) { 36059 const { clientId } = (0,external_wp_data_namespaceObject.useSelect)((select) => { 36060 const { getBlockOrder, getBlockInsertionPoint } = select(store); 36061 const insertionPoint = getBlockInsertionPoint(); 36062 const order = getBlockOrder(insertionPoint.rootClientId); 36063 if (!order.length) { 36064 return {}; 36065 } 36066 return { 36067 clientId: order[insertionPoint.index] 36068 }; 36069 }, []); 36070 const reducedMotion = (0,external_wp_compose_namespaceObject.useReducedMotion)(); 36071 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 36072 cover_default, 36073 { 36074 clientId, 36075 __unstablePopoverSlot, 36076 __unstableContentRef, 36077 className: "block-editor-block-popover__drop-zone", 36078 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 36079 external_wp_components_namespaceObject.__unstableMotion.div, 36080 { 36081 "data-testid": "block-popover-drop-zone", 36082 initial: reducedMotion ? animateVariants.show : animateVariants.hide, 36083 animate: animateVariants.show, 36084 exit: reducedMotion ? animateVariants.show : animateVariants.exit, 36085 className: "block-editor-block-popover__drop-zone-foreground" 36086 } 36087 ) 36088 } 36089 ); 36090 } 36091 var drop_zone_default = BlockDropZonePopover; 36092 36093 36094 ;// ./node_modules/@wordpress/block-editor/build-module/components/block-tools/insertion-point.js 36095 36096 36097 36098 36099 36100 36101 36102 36103 36104 36105 36106 const InsertionPointOpenRef = (0,external_wp_element_namespaceObject.createContext)(); 36107 InsertionPointOpenRef.displayName = "InsertionPointOpenRefContext"; 36108 function InbetweenInsertionPointPopover({ 36109 __unstablePopoverSlot, 36110 __unstableContentRef, 36111 operation = "insert", 36112 nearestSide = "right" 36113 }) { 36114 const { selectBlock, hideInsertionPoint } = (0,external_wp_data_namespaceObject.useDispatch)(store); 36115 const openRef = (0,external_wp_element_namespaceObject.useContext)(InsertionPointOpenRef); 36116 const ref = (0,external_wp_element_namespaceObject.useRef)(); 36117 const { 36118 orientation, 36119 previousClientId, 36120 nextClientId, 36121 rootClientId, 36122 isInserterShown, 36123 isDistractionFree, 36124 isZoomOutMode 36125 } = (0,external_wp_data_namespaceObject.useSelect)((select) => { 36126 const { 36127 getBlockOrder, 36128 getBlockListSettings, 36129 getBlockInsertionPoint, 36130 isBlockBeingDragged, 36131 getPreviousBlockClientId, 36132 getNextBlockClientId, 36133 getSettings, 36134 isZoomOut 36135 } = unlock(select(store)); 36136 const insertionPoint = getBlockInsertionPoint(); 36137 const order = getBlockOrder(insertionPoint.rootClientId); 36138 if (!order.length) { 36139 return {}; 36140 } 36141 let _previousClientId = order[insertionPoint.index - 1]; 36142 let _nextClientId = order[insertionPoint.index]; 36143 while (isBlockBeingDragged(_previousClientId)) { 36144 _previousClientId = getPreviousBlockClientId(_previousClientId); 36145 } 36146 while (isBlockBeingDragged(_nextClientId)) { 36147 _nextClientId = getNextBlockClientId(_nextClientId); 36148 } 36149 const settings = getSettings(); 36150 return { 36151 previousClientId: _previousClientId, 36152 nextClientId: _nextClientId, 36153 orientation: getBlockListSettings(insertionPoint.rootClientId)?.orientation || "vertical", 36154 rootClientId: insertionPoint.rootClientId, 36155 isDistractionFree: settings.isDistractionFree, 36156 isInserterShown: insertionPoint?.__unstableWithInserter, 36157 isZoomOutMode: isZoomOut() 36158 }; 36159 }, []); 36160 const { getBlockEditingMode } = (0,external_wp_data_namespaceObject.useSelect)(store); 36161 const disableMotion = (0,external_wp_compose_namespaceObject.useReducedMotion)(); 36162 function onClick(event) { 36163 if (event.target === ref.current && nextClientId && getBlockEditingMode(nextClientId) !== "disabled") { 36164 selectBlock(nextClientId, -1); 36165 } 36166 } 36167 function maybeHideInserterPoint(event) { 36168 if (event.target === ref.current && !openRef.current) { 36169 hideInsertionPoint(); 36170 } 36171 } 36172 function onFocus(event) { 36173 if (event.target !== ref.current) { 36174 openRef.current = true; 36175 } 36176 } 36177 const maybeResetOpenRef = (0,external_wp_element_namespaceObject.useCallback)( 36178 (node) => { 36179 if (!node && openRef.current) { 36180 openRef.current = false; 36181 } 36182 }, 36183 [openRef] 36184 ); 36185 const lineVariants = { 36186 // Initial position starts from the center and invisible. 36187 start: { 36188 opacity: 0, 36189 scale: 0 36190 }, 36191 // The line expands to fill the container. If the inserter is visible it 36192 // is delayed so it appears orchestrated. 36193 rest: { 36194 opacity: 1, 36195 scale: 1, 36196 transition: { delay: isInserterShown ? 0.5 : 0, type: "tween" } 36197 }, 36198 hover: { 36199 opacity: 1, 36200 scale: 1, 36201 transition: { delay: 0.5, type: "tween" } 36202 } 36203 }; 36204 const inserterVariants = { 36205 start: { 36206 scale: disableMotion ? 1 : 0 36207 }, 36208 rest: { 36209 scale: 1, 36210 transition: { delay: 0.4, type: "tween" } 36211 } 36212 }; 36213 if (isDistractionFree) { 36214 return null; 36215 } 36216 if (isZoomOutMode && operation !== "insert") { 36217 return null; 36218 } 36219 const orientationClassname = orientation === "horizontal" || operation === "group" ? "is-horizontal" : "is-vertical"; 36220 const className = dist_clsx( 36221 "block-editor-block-list__insertion-point", 36222 orientationClassname 36223 ); 36224 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 36225 inbetween_default, 36226 { 36227 previousClientId, 36228 nextClientId, 36229 __unstablePopoverSlot, 36230 __unstableContentRef, 36231 operation, 36232 nearestSide, 36233 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 36234 external_wp_components_namespaceObject.__unstableMotion.div, 36235 { 36236 layout: !disableMotion, 36237 initial: disableMotion ? "rest" : "start", 36238 animate: "rest", 36239 whileHover: "hover", 36240 whileTap: "pressed", 36241 exit: "start", 36242 ref, 36243 tabIndex: -1, 36244 onClick, 36245 onFocus, 36246 className: dist_clsx(className, { 36247 "is-with-inserter": isInserterShown 36248 }), 36249 onHoverEnd: maybeHideInserterPoint, 36250 children: [ 36251 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 36252 external_wp_components_namespaceObject.__unstableMotion.div, 36253 { 36254 variants: lineVariants, 36255 className: "block-editor-block-list__insertion-point-indicator", 36256 "data-testid": "block-list-insertion-point-indicator" 36257 } 36258 ), 36259 isInserterShown && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 36260 external_wp_components_namespaceObject.__unstableMotion.div, 36261 { 36262 variants: inserterVariants, 36263 className: dist_clsx( 36264 "block-editor-block-list__insertion-point-inserter" 36265 ), 36266 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 36267 inserter_default, 36268 { 36269 ref: maybeResetOpenRef, 36270 position: "bottom center", 36271 clientId: nextClientId, 36272 rootClientId, 36273 __experimentalIsQuick: true, 36274 onToggle: (isOpen) => { 36275 openRef.current = isOpen; 36276 }, 36277 onSelectOrClose: () => { 36278 openRef.current = false; 36279 } 36280 } 36281 ) 36282 } 36283 ) 36284 ] 36285 } 36286 ) 36287 } 36288 ); 36289 } 36290 function InsertionPoint(props) { 36291 const { insertionPoint, isVisible, isBlockListEmpty } = (0,external_wp_data_namespaceObject.useSelect)( 36292 (select) => { 36293 const { 36294 getBlockInsertionPoint, 36295 isBlockInsertionPointVisible, 36296 getBlockCount 36297 } = select(store); 36298 const blockInsertionPoint = getBlockInsertionPoint(); 36299 return { 36300 insertionPoint: blockInsertionPoint, 36301 isVisible: isBlockInsertionPointVisible(), 36302 isBlockListEmpty: getBlockCount(blockInsertionPoint?.rootClientId) === 0 36303 }; 36304 }, 36305 [] 36306 ); 36307 if (!isVisible || // Don't render the insertion point if the block list is empty. 36308 // The insertion point will be represented by the appender instead. 36309 isBlockListEmpty) { 36310 return null; 36311 } 36312 return insertionPoint.operation === "replace" ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 36313 drop_zone_default, 36314 { 36315 ...props 36316 }, 36317 `$insertionPoint.rootClientId}-$insertionPoint.index}` 36318 ) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 36319 InbetweenInsertionPointPopover, 36320 { 36321 operation: insertionPoint.operation, 36322 nearestSide: insertionPoint.nearestSide, 36323 ...props 36324 } 36325 ); 36326 } 36327 36328 36329 ;// ./node_modules/@wordpress/block-editor/build-module/components/block-list/use-in-between-inserter.js 36330 36331 36332 36333 36334 36335 36336 36337 function useInBetweenInserter() { 36338 const openRef = (0,external_wp_element_namespaceObject.useContext)(InsertionPointOpenRef); 36339 const isInBetweenInserterDisabled = (0,external_wp_data_namespaceObject.useSelect)( 36340 (select) => select(store).getSettings().isDistractionFree || unlock(select(store)).isZoomOut(), 36341 [] 36342 ); 36343 const { 36344 getBlockListSettings, 36345 getBlockIndex, 36346 isMultiSelecting, 36347 getSelectedBlockClientIds, 36348 getSettings, 36349 getTemplateLock, 36350 __unstableIsWithinBlockOverlay, 36351 getBlockEditingMode, 36352 getBlockName, 36353 getBlockAttributes, 36354 getParentSectionBlock 36355 } = unlock((0,external_wp_data_namespaceObject.useSelect)(store)); 36356 const { showInsertionPoint, hideInsertionPoint } = (0,external_wp_data_namespaceObject.useDispatch)(store); 36357 return (0,external_wp_compose_namespaceObject.useRefEffect)( 36358 (node) => { 36359 if (isInBetweenInserterDisabled) { 36360 return; 36361 } 36362 function onMouseMove(event) { 36363 if (openRef === void 0 || openRef.current) { 36364 return; 36365 } 36366 if (event.target.nodeType === event.target.TEXT_NODE) { 36367 return; 36368 } 36369 if (isMultiSelecting()) { 36370 return; 36371 } 36372 if (!event.target.classList.contains( 36373 "block-editor-block-list__layout" 36374 )) { 36375 hideInsertionPoint(); 36376 return; 36377 } 36378 let rootClientId; 36379 if (!event.target.classList.contains("is-root-container")) { 36380 const blockElement = !!event.target.getAttribute( 36381 "data-block" 36382 ) ? event.target : event.target.closest("[data-block]"); 36383 rootClientId = blockElement.getAttribute("data-block"); 36384 } 36385 if (getTemplateLock(rootClientId) || getBlockEditingMode(rootClientId) === "disabled" || getBlockName(rootClientId) === "core/block" || rootClientId && getBlockAttributes(rootClientId).layout?.isManualPlacement) { 36386 return; 36387 } 36388 const blockListSettings = getBlockListSettings(rootClientId); 36389 const orientation = blockListSettings?.orientation || "vertical"; 36390 const captureToolbars = !!blockListSettings?.__experimentalCaptureToolbars; 36391 const offsetTop = event.clientY; 36392 const offsetLeft = event.clientX; 36393 const children = Array.from(event.target.children); 36394 let element = children.find((blockEl) => { 36395 const blockElRect = blockEl.getBoundingClientRect(); 36396 return blockEl.classList.contains("wp-block") && orientation === "vertical" && blockElRect.top > offsetTop || blockEl.classList.contains("wp-block") && orientation === "horizontal" && ((0,external_wp_i18n_namespaceObject.isRTL)() ? blockElRect.right < offsetLeft : blockElRect.left > offsetLeft); 36397 }); 36398 if (!element) { 36399 hideInsertionPoint(); 36400 return; 36401 } 36402 if (!element.id) { 36403 element = element.firstElementChild; 36404 if (!element) { 36405 hideInsertionPoint(); 36406 return; 36407 } 36408 } 36409 const clientId = element.id.slice("block-".length); 36410 if (!clientId || __unstableIsWithinBlockOverlay(clientId) || !!getParentSectionBlock(clientId)) { 36411 return; 36412 } 36413 if (getSelectedBlockClientIds().includes(clientId) && orientation === "vertical" && !captureToolbars && !getSettings().hasFixedToolbar) { 36414 return; 36415 } 36416 const elementRect = element.getBoundingClientRect(); 36417 if (orientation === "horizontal" && (event.clientY > elementRect.bottom || event.clientY < elementRect.top) || orientation === "vertical" && (event.clientX > elementRect.right || event.clientX < elementRect.left)) { 36418 hideInsertionPoint(); 36419 return; 36420 } 36421 const index = getBlockIndex(clientId); 36422 if (index === 0) { 36423 hideInsertionPoint(); 36424 return; 36425 } 36426 showInsertionPoint(rootClientId, index, { 36427 __unstableWithInserter: true 36428 }); 36429 } 36430 node.addEventListener("mousemove", onMouseMove); 36431 return () => { 36432 node.removeEventListener("mousemove", onMouseMove); 36433 }; 36434 }, 36435 [ 36436 openRef, 36437 getBlockListSettings, 36438 getBlockIndex, 36439 isMultiSelecting, 36440 showInsertionPoint, 36441 hideInsertionPoint, 36442 getSelectedBlockClientIds, 36443 isInBetweenInserterDisabled 36444 ] 36445 ); 36446 } 36447 36448 36449 ;// ./node_modules/@wordpress/block-editor/build-module/components/block-selection-clearer/index.js 36450 36451 36452 36453 36454 function useBlockSelectionClearer() { 36455 const { getSettings, hasSelectedBlock, hasMultiSelection } = (0,external_wp_data_namespaceObject.useSelect)(store); 36456 const { clearSelectedBlock } = (0,external_wp_data_namespaceObject.useDispatch)(store); 36457 const { clearBlockSelection: isEnabled } = getSettings(); 36458 return (0,external_wp_compose_namespaceObject.useRefEffect)( 36459 (node) => { 36460 if (!isEnabled) { 36461 return; 36462 } 36463 function onMouseDown(event) { 36464 if (!hasSelectedBlock() && !hasMultiSelection()) { 36465 return; 36466 } 36467 if (event.target !== node) { 36468 return; 36469 } 36470 clearSelectedBlock(); 36471 } 36472 node.addEventListener("mousedown", onMouseDown); 36473 return () => { 36474 node.removeEventListener("mousedown", onMouseDown); 36475 }; 36476 }, 36477 [hasSelectedBlock, hasMultiSelection, clearSelectedBlock, isEnabled] 36478 ); 36479 } 36480 function BlockSelectionClearer(props) { 36481 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { ref: useBlockSelectionClearer(), ...props }); 36482 } 36483 36484 36485 ;// ./node_modules/@wordpress/block-editor/build-module/components/inner-blocks/button-block-appender.js 36486 36487 36488 36489 36490 function ButtonBlockAppender({ 36491 showSeparator, 36492 isFloating, 36493 onAddBlock, 36494 isToggle 36495 }) { 36496 const { clientId } = useBlockEditContext(); 36497 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 36498 button_block_appender_default, 36499 { 36500 className: dist_clsx({ 36501 "block-list-appender__toggle": isToggle 36502 }), 36503 rootClientId: clientId, 36504 showSeparator, 36505 isFloating, 36506 onAddBlock 36507 } 36508 ); 36509 } 36510 36511 36512 ;// ./node_modules/@wordpress/block-editor/build-module/components/inner-blocks/default-block-appender.js 36513 36514 36515 36516 function default_block_appender_DefaultBlockAppender() { 36517 const { clientId } = useBlockEditContext(); 36518 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(DefaultBlockAppender, { rootClientId: clientId }); 36519 } 36520 36521 36522 ;// ./node_modules/@wordpress/block-editor/build-module/components/inner-blocks/use-nested-settings-update.js 36523 36524 36525 36526 36527 36528 36529 const pendingSettingsUpdates = /* @__PURE__ */ new WeakMap(); 36530 function createShallowMemo() { 36531 let value; 36532 return (newValue) => { 36533 if (value === void 0 || !external_wp_isShallowEqual_default()(value, newValue)) { 36534 value = newValue; 36535 } 36536 return value; 36537 }; 36538 } 36539 function useShallowMemo(value) { 36540 const [memo] = (0,external_wp_element_namespaceObject.useState)(createShallowMemo); 36541 return memo(value); 36542 } 36543 function useNestedSettingsUpdate(clientId, parentLock, allowedBlocks, prioritizedInserterBlocks, defaultBlock, directInsert, __experimentalDefaultBlock, __experimentalDirectInsert, templateLock, captureToolbars, orientation, layout) { 36544 const registry = (0,external_wp_data_namespaceObject.useRegistry)(); 36545 const _allowedBlocks = useShallowMemo(allowedBlocks); 36546 const _prioritizedInserterBlocks = useShallowMemo( 36547 prioritizedInserterBlocks 36548 ); 36549 const _templateLock = templateLock === void 0 || parentLock === "contentOnly" ? parentLock : templateLock; 36550 (0,external_wp_element_namespaceObject.useLayoutEffect)(() => { 36551 const newSettings = { 36552 allowedBlocks: _allowedBlocks, 36553 prioritizedInserterBlocks: _prioritizedInserterBlocks, 36554 templateLock: _templateLock 36555 }; 36556 if (captureToolbars !== void 0) { 36557 newSettings.__experimentalCaptureToolbars = captureToolbars; 36558 } 36559 if (orientation !== void 0) { 36560 newSettings.orientation = orientation; 36561 } else { 36562 const layoutType = getLayoutType(layout?.type); 36563 newSettings.orientation = layoutType.getOrientation(layout); 36564 } 36565 if (__experimentalDefaultBlock !== void 0) { 36566 external_wp_deprecated_default()("__experimentalDefaultBlock", { 36567 alternative: "defaultBlock", 36568 since: "6.3", 36569 version: "6.4" 36570 }); 36571 newSettings.defaultBlock = __experimentalDefaultBlock; 36572 } 36573 if (defaultBlock !== void 0) { 36574 newSettings.defaultBlock = defaultBlock; 36575 } 36576 if (__experimentalDirectInsert !== void 0) { 36577 external_wp_deprecated_default()("__experimentalDirectInsert", { 36578 alternative: "directInsert", 36579 since: "6.3", 36580 version: "6.4" 36581 }); 36582 newSettings.directInsert = __experimentalDirectInsert; 36583 } 36584 if (directInsert !== void 0) { 36585 newSettings.directInsert = directInsert; 36586 } 36587 if (newSettings.directInsert !== void 0 && typeof newSettings.directInsert !== "boolean") { 36588 external_wp_deprecated_default()("Using `Function` as a `directInsert` argument", { 36589 alternative: "`boolean` values", 36590 since: "6.5" 36591 }); 36592 } 36593 if (!pendingSettingsUpdates.get(registry)) { 36594 pendingSettingsUpdates.set(registry, {}); 36595 } 36596 pendingSettingsUpdates.get(registry)[clientId] = newSettings; 36597 window.queueMicrotask(() => { 36598 const settings = pendingSettingsUpdates.get(registry); 36599 if (Object.keys(settings).length) { 36600 const { updateBlockListSettings } = registry.dispatch(store); 36601 updateBlockListSettings(settings); 36602 pendingSettingsUpdates.set(registry, {}); 36603 } 36604 }); 36605 }, [ 36606 clientId, 36607 _allowedBlocks, 36608 _prioritizedInserterBlocks, 36609 _templateLock, 36610 defaultBlock, 36611 directInsert, 36612 __experimentalDefaultBlock, 36613 __experimentalDirectInsert, 36614 captureToolbars, 36615 orientation, 36616 layout, 36617 registry 36618 ]); 36619 } 36620 36621 36622 ;// ./node_modules/@wordpress/block-editor/build-module/components/inner-blocks/use-inner-block-template-sync.js 36623 36624 36625 36626 36627 36628 function useInnerBlockTemplateSync(clientId, template, templateLock, templateInsertUpdatesSelection) { 36629 const registry = (0,external_wp_data_namespaceObject.useRegistry)(); 36630 const existingTemplateRef = (0,external_wp_element_namespaceObject.useRef)(null); 36631 (0,external_wp_element_namespaceObject.useLayoutEffect)(() => { 36632 let isCancelled = false; 36633 const { 36634 getBlocks, 36635 getSelectedBlocksInitialCaretPosition, 36636 isBlockSelected 36637 } = registry.select(store); 36638 const { replaceInnerBlocks, __unstableMarkNextChangeAsNotPersistent } = registry.dispatch(store); 36639 window.queueMicrotask(() => { 36640 if (isCancelled) { 36641 return; 36642 } 36643 const currentInnerBlocks = getBlocks(clientId); 36644 const shouldApplyTemplate = currentInnerBlocks.length === 0 || templateLock === "all" || templateLock === "contentOnly"; 36645 const hasTemplateChanged = !es6_default()( 36646 template, 36647 existingTemplateRef.current 36648 ); 36649 if (!shouldApplyTemplate || !hasTemplateChanged) { 36650 return; 36651 } 36652 existingTemplateRef.current = template; 36653 const nextBlocks = (0,external_wp_blocks_namespaceObject.synchronizeBlocksWithTemplate)( 36654 currentInnerBlocks, 36655 template 36656 ); 36657 if (!es6_default()(nextBlocks, currentInnerBlocks)) { 36658 __unstableMarkNextChangeAsNotPersistent(); 36659 replaceInnerBlocks( 36660 clientId, 36661 nextBlocks, 36662 currentInnerBlocks.length === 0 && templateInsertUpdatesSelection && nextBlocks.length !== 0 && isBlockSelected(clientId), 36663 // This ensures the "initialPosition" doesn't change when applying the template 36664 // If we're supposed to focus the block, we'll focus the first inner block 36665 // otherwise, we won't apply any auto-focus. 36666 // This ensures for instance that the focus stays in the inserter when inserting the "buttons" block. 36667 getSelectedBlocksInitialCaretPosition() 36668 ); 36669 } 36670 }); 36671 return () => { 36672 isCancelled = true; 36673 }; 36674 }, [ 36675 template, 36676 templateLock, 36677 clientId, 36678 registry, 36679 templateInsertUpdatesSelection 36680 ]); 36681 } 36682 36683 36684 ;// ./node_modules/@wordpress/block-editor/build-module/components/inner-blocks/use-block-context.js 36685 36686 36687 36688 function useBlockContext(clientId) { 36689 return (0,external_wp_data_namespaceObject.useSelect)( 36690 (select) => { 36691 const block = select(store).getBlock(clientId); 36692 if (!block) { 36693 return void 0; 36694 } 36695 const blockType = select(external_wp_blocks_namespaceObject.store).getBlockType(block.name); 36696 if (!blockType) { 36697 return void 0; 36698 } 36699 if (Object.keys(blockType.providesContext).length === 0) { 36700 return void 0; 36701 } 36702 return Object.fromEntries( 36703 Object.entries(blockType.providesContext).map( 36704 ([contextName, attributeName]) => [ 36705 contextName, 36706 block.attributes[attributeName] 36707 ] 36708 ) 36709 ); 36710 }, 36711 [clientId] 36712 ); 36713 } 36714 36715 36716 ;// ./node_modules/@wordpress/block-editor/build-module/components/use-on-block-drop/index.js 36717 36718 36719 36720 36721 36722 function parseDropEvent(event) { 36723 let result = { 36724 srcRootClientId: null, 36725 srcClientIds: null, 36726 srcIndex: null, 36727 type: null, 36728 blocks: null 36729 }; 36730 if (!event.dataTransfer) { 36731 return result; 36732 } 36733 try { 36734 result = Object.assign( 36735 result, 36736 JSON.parse(event.dataTransfer.getData("wp-blocks")) 36737 ); 36738 } catch (err) { 36739 return result; 36740 } 36741 return result; 36742 } 36743 function onBlockDrop(targetRootClientId, targetBlockIndex, getBlockIndex, getClientIdsOfDescendants, moveBlocks, insertOrReplaceBlocks, clearSelectedBlock, operation, getBlock) { 36744 return (event) => { 36745 const { 36746 srcRootClientId: sourceRootClientId, 36747 srcClientIds: sourceClientIds, 36748 type: dropType, 36749 blocks 36750 } = parseDropEvent(event); 36751 if (dropType === "inserter") { 36752 clearSelectedBlock(); 36753 const blocksToInsert = blocks.map( 36754 (block) => (0,external_wp_blocks_namespaceObject.cloneBlock)(block) 36755 ); 36756 insertOrReplaceBlocks(blocksToInsert, true, null); 36757 } 36758 if (dropType === "block") { 36759 const sourceBlockIndex = getBlockIndex(sourceClientIds[0]); 36760 if (sourceRootClientId === targetRootClientId && sourceBlockIndex === targetBlockIndex) { 36761 return; 36762 } 36763 if (sourceClientIds.includes(targetRootClientId) || getClientIdsOfDescendants(sourceClientIds).some( 36764 (id) => id === targetRootClientId 36765 )) { 36766 return; 36767 } 36768 if (operation === "group") { 36769 const blocksToInsert = sourceClientIds.map( 36770 (clientId) => getBlock(clientId) 36771 ); 36772 insertOrReplaceBlocks( 36773 blocksToInsert, 36774 true, 36775 null, 36776 sourceClientIds 36777 ); 36778 return; 36779 } 36780 const isAtSameLevel = sourceRootClientId === targetRootClientId; 36781 const draggedBlockCount = sourceClientIds.length; 36782 const insertIndex = isAtSameLevel && sourceBlockIndex < targetBlockIndex ? targetBlockIndex - draggedBlockCount : targetBlockIndex; 36783 moveBlocks(sourceClientIds, sourceRootClientId, insertIndex); 36784 } 36785 }; 36786 } 36787 function onFilesDrop(targetRootClientId, getSettings, updateBlockAttributes, canInsertBlockType, insertOrReplaceBlocks) { 36788 return (files) => { 36789 if (!getSettings().mediaUpload) { 36790 return; 36791 } 36792 const transformation = (0,external_wp_blocks_namespaceObject.findTransform)( 36793 (0,external_wp_blocks_namespaceObject.getBlockTransforms)("from"), 36794 (transform) => transform.type === "files" && canInsertBlockType(transform.blockName, targetRootClientId) && transform.isMatch(files) 36795 ); 36796 if (transformation) { 36797 const blocks = transformation.transform( 36798 files, 36799 updateBlockAttributes 36800 ); 36801 insertOrReplaceBlocks(blocks); 36802 } 36803 }; 36804 } 36805 function onHTMLDrop(insertOrReplaceBlocks) { 36806 return (HTML) => { 36807 const blocks = (0,external_wp_blocks_namespaceObject.pasteHandler)({ HTML, mode: "BLOCKS" }); 36808 if (blocks.length) { 36809 insertOrReplaceBlocks(blocks); 36810 } 36811 }; 36812 } 36813 function useOnBlockDrop(targetRootClientId, targetBlockIndex, options = {}) { 36814 const { operation = "insert", nearestSide = "right" } = options; 36815 const { 36816 canInsertBlockType, 36817 getBlockIndex, 36818 getClientIdsOfDescendants, 36819 getBlockOrder, 36820 getBlocksByClientId, 36821 getSettings, 36822 getBlock 36823 } = (0,external_wp_data_namespaceObject.useSelect)(store); 36824 const { getGroupingBlockName } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blocks_namespaceObject.store); 36825 const { 36826 insertBlocks, 36827 moveBlocksToPosition, 36828 updateBlockAttributes, 36829 clearSelectedBlock, 36830 replaceBlocks, 36831 removeBlocks 36832 } = (0,external_wp_data_namespaceObject.useDispatch)(store); 36833 const registry = (0,external_wp_data_namespaceObject.useRegistry)(); 36834 const insertOrReplaceBlocks = (0,external_wp_element_namespaceObject.useCallback)( 36835 (blocks, updateSelection = true, initialPosition = 0, clientIdsToReplace = []) => { 36836 if (!Array.isArray(blocks)) { 36837 blocks = [blocks]; 36838 } 36839 const clientIds = getBlockOrder(targetRootClientId); 36840 const clientId = clientIds[targetBlockIndex]; 36841 if (operation === "replace") { 36842 replaceBlocks(clientId, blocks, void 0, initialPosition); 36843 } else if (operation === "group") { 36844 const targetBlock = getBlock(clientId); 36845 if (nearestSide === "left") { 36846 blocks.push(targetBlock); 36847 } else { 36848 blocks.unshift(targetBlock); 36849 } 36850 const groupInnerBlocks = blocks.map((block) => { 36851 return (0,external_wp_blocks_namespaceObject.createBlock)( 36852 block.name, 36853 block.attributes, 36854 block.innerBlocks 36855 ); 36856 }); 36857 const areAllImages = blocks.every((block) => { 36858 return block.name === "core/image"; 36859 }); 36860 const galleryBlock = canInsertBlockType( 36861 "core/gallery", 36862 targetRootClientId 36863 ); 36864 const wrappedBlocks = (0,external_wp_blocks_namespaceObject.createBlock)( 36865 areAllImages && galleryBlock ? "core/gallery" : getGroupingBlockName(), 36866 { 36867 layout: { 36868 type: "flex", 36869 flexWrap: areAllImages && galleryBlock ? null : "nowrap" 36870 } 36871 }, 36872 groupInnerBlocks 36873 ); 36874 replaceBlocks( 36875 [clientId, ...clientIdsToReplace], 36876 wrappedBlocks, 36877 void 0, 36878 initialPosition 36879 ); 36880 } else { 36881 insertBlocks( 36882 blocks, 36883 targetBlockIndex, 36884 targetRootClientId, 36885 updateSelection, 36886 initialPosition 36887 ); 36888 } 36889 }, 36890 [ 36891 getBlockOrder, 36892 targetRootClientId, 36893 targetBlockIndex, 36894 operation, 36895 replaceBlocks, 36896 getBlock, 36897 nearestSide, 36898 canInsertBlockType, 36899 getGroupingBlockName, 36900 insertBlocks 36901 ] 36902 ); 36903 const moveBlocks = (0,external_wp_element_namespaceObject.useCallback)( 36904 (sourceClientIds, sourceRootClientId, insertIndex) => { 36905 if (operation === "replace") { 36906 const sourceBlocks = getBlocksByClientId(sourceClientIds); 36907 const targetBlockClientIds = getBlockOrder(targetRootClientId); 36908 const targetBlockClientId = targetBlockClientIds[targetBlockIndex]; 36909 registry.batch(() => { 36910 removeBlocks(sourceClientIds, false); 36911 replaceBlocks( 36912 targetBlockClientId, 36913 sourceBlocks, 36914 void 0, 36915 0 36916 ); 36917 }); 36918 } else { 36919 moveBlocksToPosition( 36920 sourceClientIds, 36921 sourceRootClientId, 36922 targetRootClientId, 36923 insertIndex 36924 ); 36925 } 36926 }, 36927 [ 36928 operation, 36929 getBlockOrder, 36930 getBlocksByClientId, 36931 moveBlocksToPosition, 36932 registry, 36933 removeBlocks, 36934 replaceBlocks, 36935 targetBlockIndex, 36936 targetRootClientId 36937 ] 36938 ); 36939 const _onDrop = onBlockDrop( 36940 targetRootClientId, 36941 targetBlockIndex, 36942 getBlockIndex, 36943 getClientIdsOfDescendants, 36944 moveBlocks, 36945 insertOrReplaceBlocks, 36946 clearSelectedBlock, 36947 operation, 36948 getBlock 36949 ); 36950 const _onFilesDrop = onFilesDrop( 36951 targetRootClientId, 36952 getSettings, 36953 updateBlockAttributes, 36954 canInsertBlockType, 36955 insertOrReplaceBlocks 36956 ); 36957 const _onHTMLDrop = onHTMLDrop(insertOrReplaceBlocks); 36958 return (event) => { 36959 const files = (0,external_wp_dom_namespaceObject.getFilesFromDataTransfer)(event.dataTransfer); 36960 const html = event.dataTransfer.getData("text/html"); 36961 if (html) { 36962 _onHTMLDrop(html); 36963 } else if (files.length) { 36964 _onFilesDrop(files); 36965 } else { 36966 _onDrop(event); 36967 } 36968 }; 36969 } 36970 36971 36972 ;// ./node_modules/@wordpress/block-editor/build-module/utils/math.js 36973 function getDistanceFromPointToEdge(point, rect, edge) { 36974 const isHorizontal = edge === "top" || edge === "bottom"; 36975 const { x, y } = point; 36976 const pointLateralPosition = isHorizontal ? x : y; 36977 const pointForwardPosition = isHorizontal ? y : x; 36978 const edgeStart = isHorizontal ? rect.left : rect.top; 36979 const edgeEnd = isHorizontal ? rect.right : rect.bottom; 36980 const edgeForwardPosition = rect[edge]; 36981 let edgeLateralPosition; 36982 if (pointLateralPosition >= edgeStart && pointLateralPosition <= edgeEnd) { 36983 edgeLateralPosition = pointLateralPosition; 36984 } else if (pointLateralPosition < edgeEnd) { 36985 edgeLateralPosition = edgeStart; 36986 } else { 36987 edgeLateralPosition = edgeEnd; 36988 } 36989 return Math.sqrt( 36990 (pointLateralPosition - edgeLateralPosition) ** 2 + (pointForwardPosition - edgeForwardPosition) ** 2 36991 ); 36992 } 36993 function getDistanceToNearestEdge(point, rect, allowedEdges = ["top", "bottom", "left", "right"]) { 36994 let candidateDistance; 36995 let candidateEdge; 36996 allowedEdges.forEach((edge) => { 36997 const distance = getDistanceFromPointToEdge(point, rect, edge); 36998 if (candidateDistance === void 0 || distance < candidateDistance) { 36999 candidateDistance = distance; 37000 candidateEdge = edge; 37001 } 37002 }); 37003 return [candidateDistance, candidateEdge]; 37004 } 37005 function isPointContainedByRect(point, rect) { 37006 return rect.left <= point.x && rect.right >= point.x && rect.top <= point.y && rect.bottom >= point.y; 37007 } 37008 function isPointWithinTopAndBottomBoundariesOfRect(point, rect) { 37009 return rect.top <= point.y && rect.bottom >= point.y; 37010 } 37011 37012 37013 ;// ./node_modules/@wordpress/block-editor/build-module/components/use-block-drop-zone/index.js 37014 37015 37016 37017 37018 37019 37020 37021 37022 37023 const THRESHOLD_DISTANCE = 30; 37024 const MINIMUM_HEIGHT_FOR_THRESHOLD = 120; 37025 const MINIMUM_WIDTH_FOR_THRESHOLD = 120; 37026 function getDropTargetPosition(blocksData, position, orientation = "vertical", options = {}) { 37027 const allowedEdges = orientation === "horizontal" ? ["left", "right"] : ["top", "bottom"]; 37028 let nearestIndex = 0; 37029 let insertPosition = "before"; 37030 let minDistance = Infinity; 37031 let targetBlockIndex = null; 37032 let nearestSide = "right"; 37033 const { 37034 dropZoneElement, 37035 parentBlockOrientation, 37036 rootBlockIndex = 0 37037 } = options; 37038 if (dropZoneElement && parentBlockOrientation !== "horizontal") { 37039 const rect = dropZoneElement.getBoundingClientRect(); 37040 const [distance, edge] = getDistanceToNearestEdge(position, rect, [ 37041 "top", 37042 "bottom" 37043 ]); 37044 if (rect.height > MINIMUM_HEIGHT_FOR_THRESHOLD && distance < THRESHOLD_DISTANCE) { 37045 if (edge === "top") { 37046 return [rootBlockIndex, "before"]; 37047 } 37048 if (edge === "bottom") { 37049 return [rootBlockIndex + 1, "after"]; 37050 } 37051 } 37052 } 37053 const isRightToLeft = (0,external_wp_i18n_namespaceObject.isRTL)(); 37054 if (dropZoneElement && parentBlockOrientation === "horizontal") { 37055 const rect = dropZoneElement.getBoundingClientRect(); 37056 const [distance, edge] = getDistanceToNearestEdge(position, rect, [ 37057 "left", 37058 "right" 37059 ]); 37060 if (rect.width > MINIMUM_WIDTH_FOR_THRESHOLD && distance < THRESHOLD_DISTANCE) { 37061 if (isRightToLeft && edge === "right" || !isRightToLeft && edge === "left") { 37062 return [rootBlockIndex, "before"]; 37063 } 37064 if (isRightToLeft && edge === "left" || !isRightToLeft && edge === "right") { 37065 return [rootBlockIndex + 1, "after"]; 37066 } 37067 } 37068 } 37069 blocksData.forEach( 37070 ({ 37071 isUnmodifiedDefaultBlock, 37072 getBoundingClientRect, 37073 blockIndex, 37074 blockOrientation 37075 }) => { 37076 const rect = getBoundingClientRect(); 37077 if (!rect) { 37078 return; 37079 } 37080 let [distance, edge] = getDistanceToNearestEdge( 37081 position, 37082 rect, 37083 allowedEdges 37084 ); 37085 const [sideDistance, sideEdge] = getDistanceToNearestEdge( 37086 position, 37087 rect, 37088 ["left", "right"] 37089 ); 37090 const isPointInsideRect = isPointContainedByRect(position, rect); 37091 if (isUnmodifiedDefaultBlock && isPointInsideRect) { 37092 distance = 0; 37093 } else if (orientation === "vertical" && blockOrientation !== "horizontal" && (isPointInsideRect && sideDistance < THRESHOLD_DISTANCE || !isPointInsideRect && isPointWithinTopAndBottomBoundariesOfRect( 37094 position, 37095 rect 37096 ))) { 37097 targetBlockIndex = blockIndex; 37098 nearestSide = sideEdge; 37099 } 37100 if (distance < minDistance) { 37101 insertPosition = edge === "bottom" || !isRightToLeft && edge === "right" || isRightToLeft && edge === "left" ? "after" : "before"; 37102 minDistance = distance; 37103 nearestIndex = blockIndex; 37104 } 37105 } 37106 ); 37107 const adjacentIndex = nearestIndex + (insertPosition === "after" ? 1 : -1); 37108 const isNearestBlockUnmodifiedDefaultBlock = !!blocksData[nearestIndex]?.isUnmodifiedDefaultBlock; 37109 const isAdjacentBlockUnmodifiedDefaultBlock = !!blocksData[adjacentIndex]?.isUnmodifiedDefaultBlock; 37110 if (targetBlockIndex !== null) { 37111 return [targetBlockIndex, "group", nearestSide]; 37112 } 37113 if (!isNearestBlockUnmodifiedDefaultBlock && !isAdjacentBlockUnmodifiedDefaultBlock) { 37114 const insertionIndex = insertPosition === "after" ? nearestIndex + 1 : nearestIndex; 37115 return [insertionIndex, "insert"]; 37116 } 37117 return [ 37118 isNearestBlockUnmodifiedDefaultBlock ? nearestIndex : adjacentIndex, 37119 "replace" 37120 ]; 37121 } 37122 function isDropTargetValid(getBlockType, allowedBlocks, draggedBlockNames, targetBlockName) { 37123 let areBlocksAllowed = true; 37124 if (allowedBlocks) { 37125 const allowedBlockNames = allowedBlocks?.map(({ name }) => name); 37126 areBlocksAllowed = draggedBlockNames.every( 37127 (name) => allowedBlockNames?.includes(name) 37128 ); 37129 } 37130 const draggedBlockTypes = draggedBlockNames.map( 37131 (name) => getBlockType(name) 37132 ); 37133 const targetMatchesDraggedBlockParents = draggedBlockTypes.every( 37134 (block) => { 37135 const [allowedParentName] = block?.parent || []; 37136 if (!allowedParentName) { 37137 return true; 37138 } 37139 return allowedParentName === targetBlockName; 37140 } 37141 ); 37142 return areBlocksAllowed && targetMatchesDraggedBlockParents; 37143 } 37144 function isInsertionPoint(targetToCheck, ownerDocument) { 37145 const { defaultView } = ownerDocument; 37146 return !!(defaultView && targetToCheck instanceof defaultView.HTMLElement && targetToCheck.closest("[data-is-insertion-point]")); 37147 } 37148 function useBlockDropZone({ 37149 dropZoneElement, 37150 // An undefined value represents a top-level block. Default to an empty 37151 // string for this so that `targetRootClientId` can be easily compared to 37152 // values returned by the `getRootBlockClientId` selector, which also uses 37153 // an empty string to represent top-level blocks. 37154 rootClientId: targetRootClientId = "", 37155 parentClientId: parentBlockClientId = "", 37156 isDisabled = false 37157 } = {}) { 37158 const registry = (0,external_wp_data_namespaceObject.useRegistry)(); 37159 const [dropTarget, setDropTarget] = (0,external_wp_element_namespaceObject.useState)({ 37160 index: null, 37161 operation: "insert" 37162 }); 37163 const { getBlockType, getBlockVariations, getGroupingBlockName } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blocks_namespaceObject.store); 37164 const { 37165 canInsertBlockType, 37166 getBlockListSettings, 37167 getBlocks, 37168 getBlockIndex, 37169 getDraggedBlockClientIds, 37170 getBlockNamesByClientId, 37171 getAllowedBlocks, 37172 isDragging, 37173 isGroupable, 37174 isZoomOut, 37175 getSectionRootClientId, 37176 getBlockParents 37177 } = unlock((0,external_wp_data_namespaceObject.useSelect)(store)); 37178 const { 37179 showInsertionPoint, 37180 hideInsertionPoint, 37181 startDragging, 37182 stopDragging 37183 } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store)); 37184 const onBlockDrop = useOnBlockDrop( 37185 dropTarget.operation === "before" || dropTarget.operation === "after" ? parentBlockClientId : targetRootClientId, 37186 dropTarget.index, 37187 { 37188 operation: dropTarget.operation, 37189 nearestSide: dropTarget.nearestSide 37190 } 37191 ); 37192 const throttled = (0,external_wp_compose_namespaceObject.useThrottle)( 37193 (0,external_wp_element_namespaceObject.useCallback)( 37194 (event, ownerDocument) => { 37195 if (!isDragging()) { 37196 startDragging(); 37197 } 37198 const draggedBlockClientIds = getDraggedBlockClientIds(); 37199 const targetParents = [ 37200 targetRootClientId, 37201 ...getBlockParents(targetRootClientId, true) 37202 ]; 37203 const isTargetWithinDraggedBlocks = draggedBlockClientIds.some( 37204 (clientId) => targetParents.includes(clientId) 37205 ); 37206 if (isTargetWithinDraggedBlocks) { 37207 return; 37208 } 37209 const allowedBlocks = getAllowedBlocks(targetRootClientId); 37210 const targetBlockName = getBlockNamesByClientId([ 37211 targetRootClientId 37212 ])[0]; 37213 const draggedBlockNames = getBlockNamesByClientId( 37214 draggedBlockClientIds 37215 ); 37216 const isBlockDroppingAllowed = isDropTargetValid( 37217 getBlockType, 37218 allowedBlocks, 37219 draggedBlockNames, 37220 targetBlockName 37221 ); 37222 if (!isBlockDroppingAllowed) { 37223 return; 37224 } 37225 const sectionRootClientId = getSectionRootClientId(); 37226 if (isZoomOut() && sectionRootClientId !== targetRootClientId) { 37227 return; 37228 } 37229 const blocks = getBlocks(targetRootClientId).filter((block) => { 37230 return !((0,external_wp_blocks_namespaceObject.hasBlockSupport)( 37231 block.name, 37232 "blockVisibility", 37233 true 37234 ) && block.attributes?.metadata?.blockVisibility === false); 37235 }); 37236 if (blocks.length === 0) { 37237 registry.batch(() => { 37238 setDropTarget({ 37239 index: 0, 37240 operation: "insert" 37241 }); 37242 showInsertionPoint(targetRootClientId, 0, { 37243 operation: "insert" 37244 }); 37245 }); 37246 return; 37247 } 37248 const blocksData = blocks.map((block) => { 37249 const clientId = block.clientId; 37250 return { 37251 isUnmodifiedDefaultBlock: (0,external_wp_blocks_namespaceObject.isUnmodifiedDefaultBlock)(block), 37252 getBoundingClientRect: () => { 37253 const blockElement = ownerDocument.getElementById( 37254 `block-$clientId}` 37255 ); 37256 return blockElement ? blockElement.getBoundingClientRect() : null; 37257 }, 37258 blockIndex: getBlockIndex(clientId), 37259 blockOrientation: getBlockListSettings(clientId)?.orientation 37260 }; 37261 }); 37262 const dropTargetPosition = getDropTargetPosition( 37263 blocksData, 37264 { x: event.clientX, y: event.clientY }, 37265 getBlockListSettings(targetRootClientId)?.orientation, 37266 { 37267 dropZoneElement, 37268 parentBlockClientId, 37269 parentBlockOrientation: parentBlockClientId ? getBlockListSettings(parentBlockClientId)?.orientation : void 0, 37270 rootBlockIndex: getBlockIndex(targetRootClientId) 37271 } 37272 ); 37273 const [targetIndex, operation, nearestSide] = dropTargetPosition; 37274 const isTargetIndexEmptyDefaultBlock = blocksData[targetIndex]?.isUnmodifiedDefaultBlock; 37275 if (isZoomOut() && !isTargetIndexEmptyDefaultBlock && operation !== "insert") { 37276 return; 37277 } 37278 if (operation === "group") { 37279 const targetBlock = blocks[targetIndex]; 37280 const areAllImages = [ 37281 targetBlock.name, 37282 ...draggedBlockNames 37283 ].every((name) => name === "core/image"); 37284 const canInsertGalleryBlock = canInsertBlockType( 37285 "core/gallery", 37286 targetRootClientId 37287 ); 37288 const areGroupableBlocks = isGroupable([ 37289 targetBlock.clientId, 37290 getDraggedBlockClientIds() 37291 ]); 37292 const groupBlockVariations = getBlockVariations( 37293 getGroupingBlockName(), 37294 "block" 37295 ); 37296 const canInsertRow = groupBlockVariations && groupBlockVariations.find( 37297 ({ name }) => name === "group-row" 37298 ); 37299 if (areAllImages && !canInsertGalleryBlock && (!areGroupableBlocks || !canInsertRow)) { 37300 return; 37301 } 37302 if (!areAllImages && (!areGroupableBlocks || !canInsertRow)) { 37303 return; 37304 } 37305 } 37306 registry.batch(() => { 37307 setDropTarget({ 37308 index: targetIndex, 37309 operation, 37310 nearestSide 37311 }); 37312 const insertionPointClientId = [ 37313 "before", 37314 "after" 37315 ].includes(operation) ? parentBlockClientId : targetRootClientId; 37316 showInsertionPoint(insertionPointClientId, targetIndex, { 37317 operation, 37318 nearestSide 37319 }); 37320 }); 37321 }, 37322 [ 37323 isDragging, 37324 getAllowedBlocks, 37325 targetRootClientId, 37326 getBlockNamesByClientId, 37327 getDraggedBlockClientIds, 37328 getBlockType, 37329 getSectionRootClientId, 37330 isZoomOut, 37331 getBlocks, 37332 getBlockListSettings, 37333 dropZoneElement, 37334 parentBlockClientId, 37335 getBlockIndex, 37336 registry, 37337 startDragging, 37338 showInsertionPoint, 37339 canInsertBlockType, 37340 isGroupable, 37341 getBlockVariations, 37342 getGroupingBlockName 37343 ] 37344 ), 37345 200 37346 ); 37347 return (0,external_wp_compose_namespaceObject.__experimentalUseDropZone)({ 37348 dropZoneElement, 37349 isDisabled, 37350 onDrop: onBlockDrop, 37351 onDragOver(event) { 37352 throttled(event, event.currentTarget.ownerDocument); 37353 }, 37354 onDragLeave(event) { 37355 const { ownerDocument } = event.currentTarget; 37356 if (isInsertionPoint(event.relatedTarget, ownerDocument) || isInsertionPoint(event.target, ownerDocument)) { 37357 return; 37358 } 37359 throttled.cancel(); 37360 hideInsertionPoint(); 37361 }, 37362 onDragEnd() { 37363 throttled.cancel(); 37364 stopDragging(); 37365 hideInsertionPoint(); 37366 } 37367 }); 37368 } 37369 37370 37371 ;// ./node_modules/@wordpress/block-editor/build-module/components/inner-blocks/index.js 37372 37373 37374 37375 37376 37377 37378 37379 37380 37381 37382 37383 37384 37385 37386 37387 37388 37389 37390 const EMPTY_OBJECT = {}; 37391 function BlockContext({ children, clientId }) { 37392 const context = useBlockContext(clientId); 37393 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockContextProvider, { value: context, children }); 37394 } 37395 const BlockListItemsMemo = (0,external_wp_element_namespaceObject.memo)(BlockListItems); 37396 function UncontrolledInnerBlocks(props) { 37397 const { 37398 clientId, 37399 allowedBlocks, 37400 prioritizedInserterBlocks, 37401 defaultBlock, 37402 directInsert, 37403 __experimentalDefaultBlock, 37404 __experimentalDirectInsert, 37405 template, 37406 templateLock, 37407 wrapperRef, 37408 templateInsertUpdatesSelection, 37409 __experimentalCaptureToolbars: captureToolbars, 37410 __experimentalAppenderTagName, 37411 renderAppender, 37412 orientation, 37413 placeholder, 37414 layout, 37415 name, 37416 blockType, 37417 parentLock, 37418 defaultLayout 37419 } = props; 37420 useNestedSettingsUpdate( 37421 clientId, 37422 parentLock, 37423 allowedBlocks, 37424 prioritizedInserterBlocks, 37425 defaultBlock, 37426 directInsert, 37427 __experimentalDefaultBlock, 37428 __experimentalDirectInsert, 37429 templateLock, 37430 captureToolbars, 37431 orientation, 37432 layout 37433 ); 37434 useInnerBlockTemplateSync( 37435 clientId, 37436 template, 37437 templateLock, 37438 templateInsertUpdatesSelection 37439 ); 37440 const defaultLayoutBlockSupport = (0,external_wp_blocks_namespaceObject.getBlockSupport)(name, "layout") || (0,external_wp_blocks_namespaceObject.getBlockSupport)(name, "__experimentalLayout") || EMPTY_OBJECT; 37441 const { allowSizingOnChildren = false } = defaultLayoutBlockSupport; 37442 const usedLayout = layout || defaultLayoutBlockSupport; 37443 const memoedLayout = (0,external_wp_element_namespaceObject.useMemo)( 37444 () => ({ 37445 // Default layout will know about any content/wide size defined by the theme. 37446 ...defaultLayout, 37447 ...usedLayout, 37448 ...allowSizingOnChildren && { 37449 allowSizingOnChildren: true 37450 } 37451 }), 37452 [defaultLayout, usedLayout, allowSizingOnChildren] 37453 ); 37454 const items = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 37455 BlockListItemsMemo, 37456 { 37457 rootClientId: clientId, 37458 renderAppender, 37459 __experimentalAppenderTagName, 37460 layout: memoedLayout, 37461 wrapperRef, 37462 placeholder 37463 } 37464 ); 37465 if (!blockType?.providesContext || Object.keys(blockType.providesContext).length === 0) { 37466 return items; 37467 } 37468 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockContext, { clientId, children: items }); 37469 } 37470 function ControlledInnerBlocks(props) { 37471 useBlockSync(props); 37472 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(UncontrolledInnerBlocks, { ...props }); 37473 } 37474 const ForwardedInnerBlocks = (0,external_wp_element_namespaceObject.forwardRef)((props, ref) => { 37475 const innerBlocksProps = useInnerBlocksProps({ ref }, props); 37476 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-inner-blocks", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { ...innerBlocksProps }) }); 37477 }); 37478 function useInnerBlocksProps(props = {}, options = {}) { 37479 const { 37480 __unstableDisableLayoutClassNames, 37481 __unstableDisableDropZone, 37482 dropZoneElement 37483 } = options; 37484 const { 37485 clientId, 37486 layout = null, 37487 __unstableLayoutClassNames: layoutClassNames = "" 37488 } = useBlockEditContext(); 37489 const selected = (0,external_wp_data_namespaceObject.useSelect)( 37490 (select) => { 37491 const { 37492 getBlockName, 37493 isZoomOut, 37494 getTemplateLock, 37495 getBlockRootClientId, 37496 getBlockEditingMode, 37497 getBlockSettings, 37498 getSectionRootClientId 37499 } = unlock(select(store)); 37500 if (!clientId) { 37501 const sectionRootClientId = getSectionRootClientId(); 37502 return { 37503 isDropZoneDisabled: isZoomOut() && sectionRootClientId !== "" 37504 }; 37505 } 37506 const { hasBlockSupport, getBlockType } = select(external_wp_blocks_namespaceObject.store); 37507 const blockName = getBlockName(clientId); 37508 const blockEditingMode = getBlockEditingMode(clientId); 37509 const parentClientId2 = getBlockRootClientId(clientId); 37510 const [defaultLayout2] = getBlockSettings(clientId, "layout"); 37511 let _isDropZoneDisabled = blockEditingMode === "disabled"; 37512 if (isZoomOut()) { 37513 const sectionRootClientId = getSectionRootClientId(); 37514 _isDropZoneDisabled = clientId !== sectionRootClientId; 37515 } 37516 return { 37517 __experimentalCaptureToolbars: hasBlockSupport( 37518 blockName, 37519 "__experimentalExposeControlsToChildren", 37520 false 37521 ), 37522 name: blockName, 37523 blockType: getBlockType(blockName), 37524 parentLock: getTemplateLock(parentClientId2), 37525 parentClientId: parentClientId2, 37526 isDropZoneDisabled: _isDropZoneDisabled, 37527 defaultLayout: defaultLayout2 37528 }; 37529 }, 37530 [clientId] 37531 ); 37532 const { 37533 __experimentalCaptureToolbars, 37534 name, 37535 blockType, 37536 parentLock, 37537 parentClientId, 37538 isDropZoneDisabled, 37539 defaultLayout 37540 } = selected; 37541 const blockDropZoneRef = useBlockDropZone({ 37542 dropZoneElement, 37543 rootClientId: clientId, 37544 parentClientId 37545 }); 37546 const ref = (0,external_wp_compose_namespaceObject.useMergeRefs)([ 37547 props.ref, 37548 __unstableDisableDropZone || isDropZoneDisabled || layout?.isManualPlacement && window.__experimentalEnableGridInteractivity ? null : blockDropZoneRef 37549 ]); 37550 const innerBlocksProps = { 37551 __experimentalCaptureToolbars, 37552 layout, 37553 name, 37554 blockType, 37555 parentLock, 37556 defaultLayout, 37557 ...options 37558 }; 37559 const InnerBlocks = innerBlocksProps.value && innerBlocksProps.onChange ? ControlledInnerBlocks : UncontrolledInnerBlocks; 37560 return { 37561 ...props, 37562 ref, 37563 className: dist_clsx( 37564 props.className, 37565 "block-editor-block-list__layout", 37566 __unstableDisableLayoutClassNames ? "" : layoutClassNames 37567 ), 37568 children: clientId ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(InnerBlocks, { ...innerBlocksProps, clientId }) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockListItems, { ...options }) 37569 }; 37570 } 37571 useInnerBlocksProps.save = external_wp_blocks_namespaceObject.__unstableGetInnerBlocksProps; 37572 ForwardedInnerBlocks.DefaultBlockAppender = default_block_appender_DefaultBlockAppender; 37573 ForwardedInnerBlocks.ButtonBlockAppender = ButtonBlockAppender; 37574 ForwardedInnerBlocks.Content = () => useInnerBlocksProps.save().children; 37575 var inner_blocks_default = ForwardedInnerBlocks; 37576 37577 37578 ;// ./node_modules/@wordpress/block-editor/build-module/components/observe-typing/index.js 37579 37580 37581 37582 37583 37584 37585 const KEY_DOWN_ELIGIBLE_KEY_CODES = /* @__PURE__ */ new Set([ 37586 external_wp_keycodes_namespaceObject.UP, 37587 external_wp_keycodes_namespaceObject.RIGHT, 37588 external_wp_keycodes_namespaceObject.DOWN, 37589 external_wp_keycodes_namespaceObject.LEFT, 37590 external_wp_keycodes_namespaceObject.ENTER, 37591 external_wp_keycodes_namespaceObject.BACKSPACE 37592 ]); 37593 function isKeyDownEligibleForStartTyping(event) { 37594 const { keyCode, shiftKey } = event; 37595 return !shiftKey && KEY_DOWN_ELIGIBLE_KEY_CODES.has(keyCode); 37596 } 37597 function useMouseMoveTypingReset() { 37598 const isTyping = (0,external_wp_data_namespaceObject.useSelect)( 37599 (select) => select(store).isTyping(), 37600 [] 37601 ); 37602 const { stopTyping } = (0,external_wp_data_namespaceObject.useDispatch)(store); 37603 return (0,external_wp_compose_namespaceObject.useRefEffect)( 37604 (node) => { 37605 if (!isTyping) { 37606 return; 37607 } 37608 const { ownerDocument } = node; 37609 let lastClientX; 37610 let lastClientY; 37611 function stopTypingOnMouseMove(event) { 37612 const { clientX, clientY } = event; 37613 if (lastClientX && lastClientY && (lastClientX !== clientX || lastClientY !== clientY)) { 37614 stopTyping(); 37615 } 37616 lastClientX = clientX; 37617 lastClientY = clientY; 37618 } 37619 ownerDocument.addEventListener( 37620 "mousemove", 37621 stopTypingOnMouseMove 37622 ); 37623 return () => { 37624 ownerDocument.removeEventListener( 37625 "mousemove", 37626 stopTypingOnMouseMove 37627 ); 37628 }; 37629 }, 37630 [isTyping, stopTyping] 37631 ); 37632 } 37633 function useTypingObserver() { 37634 const { isTyping } = (0,external_wp_data_namespaceObject.useSelect)((select) => { 37635 const { isTyping: _isTyping } = select(store); 37636 return { 37637 isTyping: _isTyping() 37638 }; 37639 }, []); 37640 const { startTyping, stopTyping } = (0,external_wp_data_namespaceObject.useDispatch)(store); 37641 const ref1 = useMouseMoveTypingReset(); 37642 const ref2 = (0,external_wp_compose_namespaceObject.useRefEffect)( 37643 (node) => { 37644 const { ownerDocument } = node; 37645 const { defaultView } = ownerDocument; 37646 const selection = defaultView.getSelection(); 37647 if (isTyping) { 37648 let stopTypingOnNonTextField2 = function(event) { 37649 const { target } = event; 37650 timerId = defaultView.setTimeout(() => { 37651 if (!(0,external_wp_dom_namespaceObject.isTextField)(target)) { 37652 stopTyping(); 37653 } 37654 }); 37655 }, stopTypingOnEscapeKey2 = function(event) { 37656 const { keyCode } = event; 37657 if (keyCode === external_wp_keycodes_namespaceObject.ESCAPE || keyCode === external_wp_keycodes_namespaceObject.TAB) { 37658 stopTyping(); 37659 } 37660 }, stopTypingOnSelectionUncollapse2 = function() { 37661 if (!selection.isCollapsed) { 37662 stopTyping(); 37663 } 37664 }; 37665 var stopTypingOnNonTextField = stopTypingOnNonTextField2, stopTypingOnEscapeKey = stopTypingOnEscapeKey2, stopTypingOnSelectionUncollapse = stopTypingOnSelectionUncollapse2; 37666 let timerId; 37667 node.addEventListener("focus", stopTypingOnNonTextField2); 37668 node.addEventListener("keydown", stopTypingOnEscapeKey2); 37669 ownerDocument.addEventListener( 37670 "selectionchange", 37671 stopTypingOnSelectionUncollapse2 37672 ); 37673 return () => { 37674 defaultView.clearTimeout(timerId); 37675 node.removeEventListener( 37676 "focus", 37677 stopTypingOnNonTextField2 37678 ); 37679 node.removeEventListener( 37680 "keydown", 37681 stopTypingOnEscapeKey2 37682 ); 37683 ownerDocument.removeEventListener( 37684 "selectionchange", 37685 stopTypingOnSelectionUncollapse2 37686 ); 37687 }; 37688 } 37689 function startTypingInTextField(event) { 37690 const { type, target } = event; 37691 if (!(0,external_wp_dom_namespaceObject.isTextField)(target) || !node.contains(target)) { 37692 return; 37693 } 37694 if (type === "keydown" && !isKeyDownEligibleForStartTyping(event)) { 37695 return; 37696 } 37697 startTyping(); 37698 } 37699 node.addEventListener("keypress", startTypingInTextField); 37700 node.addEventListener("keydown", startTypingInTextField); 37701 return () => { 37702 node.removeEventListener("keypress", startTypingInTextField); 37703 node.removeEventListener("keydown", startTypingInTextField); 37704 }; 37705 }, 37706 [isTyping, startTyping, stopTyping] 37707 ); 37708 return (0,external_wp_compose_namespaceObject.useMergeRefs)([ref1, ref2]); 37709 } 37710 function ObserveTyping({ children }) { 37711 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { ref: useTypingObserver(), children }); 37712 } 37713 var observe_typing_default = ObserveTyping; 37714 37715 37716 ;// ./node_modules/@wordpress/block-editor/build-module/components/block-list/zoom-out-separator.js 37717 37718 37719 37720 37721 37722 37723 37724 37725 37726 function ZoomOutSeparator({ 37727 clientId, 37728 rootClientId = "", 37729 position = "top" 37730 }) { 37731 const [isDraggedOver, setIsDraggedOver] = (0,external_wp_element_namespaceObject.useState)(false); 37732 const { 37733 sectionRootClientId, 37734 sectionClientIds, 37735 insertionPoint, 37736 blockInsertionPointVisible, 37737 blockInsertionPoint, 37738 blocksBeingDragged 37739 } = (0,external_wp_data_namespaceObject.useSelect)((select) => { 37740 const { 37741 getInsertionPoint, 37742 getBlockOrder, 37743 getSectionRootClientId, 37744 isBlockInsertionPointVisible, 37745 getBlockInsertionPoint, 37746 getDraggedBlockClientIds 37747 } = unlock(select(store)); 37748 const root = getSectionRootClientId(); 37749 const sectionRootClientIds = getBlockOrder(root); 37750 return { 37751 sectionRootClientId: root, 37752 sectionClientIds: sectionRootClientIds, 37753 insertionPoint: getInsertionPoint(), 37754 blockInsertionPoint: getBlockInsertionPoint(), 37755 blockInsertionPointVisible: isBlockInsertionPointVisible(), 37756 blocksBeingDragged: getDraggedBlockClientIds() 37757 }; 37758 }, []); 37759 const isReducedMotion = (0,external_wp_compose_namespaceObject.useReducedMotion)(); 37760 if (!clientId) { 37761 return; 37762 } 37763 let isVisible = false; 37764 const isSectionBlock = rootClientId === sectionRootClientId && sectionClientIds && sectionClientIds.includes(clientId); 37765 if (!isSectionBlock) { 37766 return null; 37767 } 37768 const hasTopInsertionPoint = insertionPoint?.index === 0 && clientId === sectionClientIds[insertionPoint.index]; 37769 const hasBottomInsertionPoint = insertionPoint && insertionPoint.hasOwnProperty("index") && clientId === sectionClientIds[insertionPoint.index - 1]; 37770 if (position === "top") { 37771 isVisible = hasTopInsertionPoint || blockInsertionPointVisible && blockInsertionPoint.index === 0 && clientId === sectionClientIds[blockInsertionPoint.index]; 37772 } 37773 if (position === "bottom") { 37774 isVisible = hasBottomInsertionPoint || blockInsertionPointVisible && clientId === sectionClientIds[blockInsertionPoint.index - 1]; 37775 } 37776 const blockBeingDraggedClientId = blocksBeingDragged[0]; 37777 const isCurrentBlockBeingDragged = blocksBeingDragged.includes(clientId); 37778 const blockBeingDraggedIndex = sectionClientIds.indexOf( 37779 blockBeingDraggedClientId 37780 ); 37781 const blockBeingDraggedPreviousSiblingClientId = blockBeingDraggedIndex > 0 ? sectionClientIds[blockBeingDraggedIndex - 1] : null; 37782 const isCurrentBlockPreviousSiblingOfBlockBeingDragged = blockBeingDraggedPreviousSiblingClientId === clientId; 37783 if (isCurrentBlockBeingDragged || isCurrentBlockPreviousSiblingOfBlockBeingDragged) { 37784 isVisible = false; 37785 } 37786 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__unstableAnimatePresence, { children: isVisible && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 37787 external_wp_components_namespaceObject.__unstableMotion.div, 37788 { 37789 initial: { height: 0 }, 37790 animate: { 37791 // Use a height equal to that of the zoom out frame size. 37792 height: "calc(1 * var(--wp-block-editor-iframe-zoom-out-frame-size) / var(--wp-block-editor-iframe-zoom-out-scale)" 37793 }, 37794 exit: { height: 0 }, 37795 transition: { 37796 type: "tween", 37797 duration: isReducedMotion ? 0 : 0.2, 37798 ease: [0.6, 0, 0.4, 1] 37799 }, 37800 className: dist_clsx( 37801 "block-editor-block-list__zoom-out-separator", 37802 { 37803 "is-dragged-over": isDraggedOver 37804 } 37805 ), 37806 "data-is-insertion-point": "true", 37807 onDragOver: () => setIsDraggedOver(true), 37808 onDragLeave: () => setIsDraggedOver(false), 37809 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 37810 external_wp_components_namespaceObject.__unstableMotion.div, 37811 { 37812 initial: { opacity: 0 }, 37813 animate: { opacity: 1 }, 37814 exit: { opacity: 0, transition: { delay: -0.125 } }, 37815 transition: { 37816 ease: "linear", 37817 duration: 0.1, 37818 delay: 0.125 37819 }, 37820 children: (0,external_wp_i18n_namespaceObject.__)("Drop pattern.") 37821 } 37822 ) 37823 } 37824 ) }); 37825 } 37826 37827 37828 ;// ./node_modules/@wordpress/block-editor/build-module/components/block-list/index.js 37829 37830 37831 37832 37833 37834 37835 37836 37837 37838 37839 37840 37841 37842 37843 37844 37845 37846 const block_list_IntersectionObserver = (0,external_wp_element_namespaceObject.createContext)(); 37847 block_list_IntersectionObserver.displayName = "IntersectionObserverContext"; 37848 const pendingBlockVisibilityUpdatesPerRegistry = /* @__PURE__ */ new WeakMap(); 37849 const delayedBlockVisibilityDebounceOptions = { 37850 trailing: true 37851 }; 37852 function Root({ className, ...settings }) { 37853 const { isOutlineMode, isFocusMode, temporarilyEditingAsBlocks } = (0,external_wp_data_namespaceObject.useSelect)((select) => { 37854 const { 37855 getSettings, 37856 getTemporarilyEditingAsBlocks, 37857 isTyping, 37858 hasBlockSpotlight 37859 } = unlock(select(store)); 37860 const { outlineMode, focusMode } = getSettings(); 37861 return { 37862 isOutlineMode: outlineMode && !isTyping(), 37863 isFocusMode: focusMode || hasBlockSpotlight(), 37864 temporarilyEditingAsBlocks: getTemporarilyEditingAsBlocks() 37865 }; 37866 }, []); 37867 const registry = (0,external_wp_data_namespaceObject.useRegistry)(); 37868 const { setBlockVisibility } = (0,external_wp_data_namespaceObject.useDispatch)(store); 37869 const delayedBlockVisibilityUpdates = (0,external_wp_compose_namespaceObject.useDebounce)( 37870 (0,external_wp_element_namespaceObject.useCallback)(() => { 37871 const updates = {}; 37872 pendingBlockVisibilityUpdatesPerRegistry.get(registry).forEach(([id, isIntersecting]) => { 37873 updates[id] = isIntersecting; 37874 }); 37875 setBlockVisibility(updates); 37876 }, [registry]), 37877 300, 37878 delayedBlockVisibilityDebounceOptions 37879 ); 37880 const intersectionObserver = (0,external_wp_element_namespaceObject.useMemo)(() => { 37881 const { IntersectionObserver: Observer } = window; 37882 if (!Observer) { 37883 return; 37884 } 37885 return new Observer((entries) => { 37886 if (!pendingBlockVisibilityUpdatesPerRegistry.get(registry)) { 37887 pendingBlockVisibilityUpdatesPerRegistry.set(registry, []); 37888 } 37889 for (const entry of entries) { 37890 const clientId = entry.target.getAttribute("data-block"); 37891 pendingBlockVisibilityUpdatesPerRegistry.get(registry).push([clientId, entry.isIntersecting]); 37892 } 37893 delayedBlockVisibilityUpdates(); 37894 }); 37895 }, []); 37896 const innerBlocksProps = useInnerBlocksProps( 37897 { 37898 ref: (0,external_wp_compose_namespaceObject.useMergeRefs)([ 37899 useBlockSelectionClearer(), 37900 useInBetweenInserter(), 37901 useTypingObserver() 37902 ]), 37903 className: dist_clsx("is-root-container", className, { 37904 "is-outline-mode": isOutlineMode, 37905 "is-focus-mode": isFocusMode 37906 }) 37907 }, 37908 settings 37909 ); 37910 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(block_list_IntersectionObserver.Provider, { value: intersectionObserver, children: [ 37911 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { ...innerBlocksProps }), 37912 !!temporarilyEditingAsBlocks && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 37913 StopEditingAsBlocksOnOutsideSelect, 37914 { 37915 clientId: temporarilyEditingAsBlocks 37916 } 37917 ) 37918 ] }); 37919 } 37920 function StopEditingAsBlocksOnOutsideSelect({ clientId }) { 37921 const { stopEditingAsBlocks } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store)); 37922 const isBlockOrDescendantSelected = (0,external_wp_data_namespaceObject.useSelect)( 37923 (select) => { 37924 const { isBlockSelected, hasSelectedInnerBlock } = select(store); 37925 return isBlockSelected(clientId) || hasSelectedInnerBlock(clientId, true); 37926 }, 37927 [clientId] 37928 ); 37929 (0,external_wp_element_namespaceObject.useEffect)(() => { 37930 if (!isBlockOrDescendantSelected) { 37931 stopEditingAsBlocks(clientId); 37932 } 37933 }, [isBlockOrDescendantSelected, clientId, stopEditingAsBlocks]); 37934 return null; 37935 } 37936 function BlockList(settings) { 37937 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Provider, { value: DEFAULT_BLOCK_EDIT_CONTEXT, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Root, { ...settings }) }); 37938 } 37939 const block_list_EMPTY_ARRAY = []; 37940 const block_list_EMPTY_SET = /* @__PURE__ */ new Set(); 37941 function Items({ 37942 placeholder, 37943 rootClientId, 37944 renderAppender: CustomAppender, 37945 __experimentalAppenderTagName, 37946 layout = defaultLayout 37947 }) { 37948 const hasAppender = CustomAppender !== false; 37949 const hasCustomAppender = !!CustomAppender; 37950 const { 37951 order, 37952 isZoomOut, 37953 selectedBlocks, 37954 visibleBlocks, 37955 shouldRenderAppender 37956 } = (0,external_wp_data_namespaceObject.useSelect)( 37957 (select) => { 37958 const { 37959 getSettings, 37960 getBlockOrder, 37961 getSelectedBlockClientIds, 37962 __unstableGetVisibleBlocks, 37963 getTemplateLock, 37964 getBlockEditingMode, 37965 isSectionBlock, 37966 isContainerInsertableToInContentOnlyMode, 37967 getBlockName, 37968 isZoomOut: _isZoomOut, 37969 canInsertBlockType 37970 } = unlock(select(store)); 37971 const _order = getBlockOrder(rootClientId); 37972 if (getSettings().isPreviewMode) { 37973 return { 37974 order: _order, 37975 selectedBlocks: block_list_EMPTY_ARRAY, 37976 visibleBlocks: block_list_EMPTY_SET 37977 }; 37978 } 37979 const selectedBlockClientIds = getSelectedBlockClientIds(); 37980 const selectedBlockClientId = selectedBlockClientIds[0]; 37981 const showRootAppender = !rootClientId && !selectedBlockClientId && (!_order.length || !canInsertBlockType( 37982 (0,external_wp_blocks_namespaceObject.getDefaultBlockName)(), 37983 rootClientId 37984 )); 37985 const hasSelectedRoot = !!(rootClientId && selectedBlockClientId && rootClientId === selectedBlockClientId); 37986 return { 37987 order: _order, 37988 selectedBlocks: selectedBlockClientIds, 37989 visibleBlocks: __unstableGetVisibleBlocks(), 37990 isZoomOut: _isZoomOut(), 37991 shouldRenderAppender: (!isSectionBlock(rootClientId) || isContainerInsertableToInContentOnlyMode( 37992 getBlockName(selectedBlockClientId), 37993 rootClientId 37994 )) && getBlockEditingMode(rootClientId) !== "disabled" && !getTemplateLock(rootClientId) && hasAppender && !_isZoomOut() && (hasCustomAppender || hasSelectedRoot || showRootAppender) 37995 }; 37996 }, 37997 [rootClientId, hasAppender, hasCustomAppender] 37998 ); 37999 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(LayoutProvider, { value: layout, children: [ 38000 order.map((clientId) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 38001 external_wp_data_namespaceObject.AsyncModeProvider, 38002 { 38003 value: ( 38004 // Only provide data asynchronously if the block is 38005 // not visible and not selected. 38006 !visibleBlocks.has(clientId) && !selectedBlocks.includes(clientId) 38007 ), 38008 children: [ 38009 isZoomOut && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 38010 ZoomOutSeparator, 38011 { 38012 clientId, 38013 rootClientId, 38014 position: "top" 38015 } 38016 ), 38017 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 38018 block_default, 38019 { 38020 rootClientId, 38021 clientId 38022 } 38023 ), 38024 isZoomOut && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 38025 ZoomOutSeparator, 38026 { 38027 clientId, 38028 rootClientId, 38029 position: "bottom" 38030 } 38031 ) 38032 ] 38033 }, 38034 clientId 38035 )), 38036 order.length < 1 && placeholder, 38037 shouldRenderAppender && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 38038 BlockListAppender, 38039 { 38040 tagName: __experimentalAppenderTagName, 38041 rootClientId, 38042 CustomAppender 38043 } 38044 ) 38045 ] }); 38046 } 38047 function BlockListItems(props) { 38048 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_data_namespaceObject.AsyncModeProvider, { value: false, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Items, { ...props }) }); 38049 } 38050 38051 38052 ;// ./node_modules/@wordpress/block-editor/build-module/components/writing-flow/use-multi-selection.js 38053 38054 38055 38056 function selector(select) { 38057 const { 38058 isMultiSelecting, 38059 getMultiSelectedBlockClientIds, 38060 hasMultiSelection, 38061 getSelectedBlockClientId, 38062 getSelectedBlocksInitialCaretPosition, 38063 __unstableIsFullySelected 38064 } = select(store); 38065 return { 38066 isMultiSelecting: isMultiSelecting(), 38067 multiSelectedBlockClientIds: getMultiSelectedBlockClientIds(), 38068 hasMultiSelection: hasMultiSelection(), 38069 selectedBlockClientId: getSelectedBlockClientId(), 38070 initialPosition: getSelectedBlocksInitialCaretPosition(), 38071 isFullSelection: __unstableIsFullySelected() 38072 }; 38073 } 38074 function useMultiSelection() { 38075 const { 38076 initialPosition, 38077 isMultiSelecting, 38078 multiSelectedBlockClientIds, 38079 hasMultiSelection, 38080 selectedBlockClientId, 38081 isFullSelection 38082 } = (0,external_wp_data_namespaceObject.useSelect)(selector, []); 38083 return (0,external_wp_compose_namespaceObject.useRefEffect)( 38084 (node) => { 38085 const { ownerDocument } = node; 38086 const { defaultView } = ownerDocument; 38087 if (initialPosition === void 0 || initialPosition === null) { 38088 return; 38089 } 38090 if (!hasMultiSelection || isMultiSelecting) { 38091 return; 38092 } 38093 const { length } = multiSelectedBlockClientIds; 38094 if (length < 2) { 38095 return; 38096 } 38097 if (!isFullSelection) { 38098 return; 38099 } 38100 node.contentEditable = true; 38101 node.focus(); 38102 defaultView.getSelection().removeAllRanges(); 38103 }, 38104 [ 38105 hasMultiSelection, 38106 isMultiSelecting, 38107 multiSelectedBlockClientIds, 38108 selectedBlockClientId, 38109 initialPosition, 38110 isFullSelection 38111 ] 38112 ); 38113 } 38114 38115 38116 ;// ./node_modules/@wordpress/block-editor/build-module/components/writing-flow/use-tab-nav.js 38117 38118 38119 38120 38121 38122 38123 38124 38125 38126 function useTabNav() { 38127 const containerRef = ( 38128 /** @type {typeof useRef<HTMLElement>} */ 38129 (0,external_wp_element_namespaceObject.useRef)() 38130 ); 38131 const focusCaptureBeforeRef = (0,external_wp_element_namespaceObject.useRef)(); 38132 const focusCaptureAfterRef = (0,external_wp_element_namespaceObject.useRef)(); 38133 const { 38134 hasMultiSelection, 38135 getSelectedBlockClientId, 38136 getBlockCount, 38137 getBlockOrder, 38138 getLastFocus, 38139 getSectionRootClientId, 38140 isZoomOut 38141 } = unlock((0,external_wp_data_namespaceObject.useSelect)(store)); 38142 const { setLastFocus } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store)); 38143 const noCaptureRef = (0,external_wp_element_namespaceObject.useRef)(); 38144 function onFocusCapture(event) { 38145 const canvasElement = containerRef.current.ownerDocument === event.target.ownerDocument ? containerRef.current : containerRef.current.ownerDocument.defaultView.frameElement; 38146 if (noCaptureRef.current) { 38147 noCaptureRef.current = null; 38148 } else if (hasMultiSelection()) { 38149 containerRef.current.focus(); 38150 } else if (getSelectedBlockClientId()) { 38151 if (getLastFocus()?.current) { 38152 getLastFocus().current.focus(); 38153 } else { 38154 containerRef.current.querySelector( 38155 `[data-block="$getSelectedBlockClientId()}"]` 38156 ).focus(); 38157 } 38158 } else if (isZoomOut()) { 38159 const sectionRootClientId = getSectionRootClientId(); 38160 const sectionBlocks = getBlockOrder(sectionRootClientId); 38161 if (sectionBlocks.length) { 38162 containerRef.current.querySelector(`[data-block="$sectionBlocks[0]}"]`).focus(); 38163 } else if (sectionRootClientId) { 38164 containerRef.current.querySelector(`[data-block="$sectionRootClientId}"]`).focus(); 38165 } else { 38166 canvasElement.focus(); 38167 } 38168 } else { 38169 const isBefore = ( 38170 // eslint-disable-next-line no-bitwise 38171 event.target.compareDocumentPosition(canvasElement) & event.target.DOCUMENT_POSITION_FOLLOWING 38172 ); 38173 const tabbables = external_wp_dom_namespaceObject.focus.tabbable.find(containerRef.current); 38174 if (tabbables.length) { 38175 const next = isBefore ? tabbables[0] : tabbables[tabbables.length - 1]; 38176 next.focus(); 38177 } 38178 } 38179 } 38180 const before = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 38181 "div", 38182 { 38183 ref: focusCaptureBeforeRef, 38184 tabIndex: "0", 38185 onFocus: onFocusCapture 38186 } 38187 ); 38188 const after = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 38189 "div", 38190 { 38191 ref: focusCaptureAfterRef, 38192 tabIndex: "0", 38193 onFocus: onFocusCapture 38194 } 38195 ); 38196 const ref = (0,external_wp_compose_namespaceObject.useRefEffect)((node) => { 38197 function onKeyDown(event) { 38198 if (event.defaultPrevented) { 38199 return; 38200 } 38201 if (event.keyCode !== external_wp_keycodes_namespaceObject.TAB) { 38202 return; 38203 } 38204 if ( 38205 // Bails in case the focus capture elements aren’t present. They 38206 // may be omitted to avoid silent tab stops in preview mode. 38207 // See: https://github.com/WordPress/gutenberg/pull/59317 38208 !focusCaptureAfterRef.current || !focusCaptureBeforeRef.current 38209 ) { 38210 return; 38211 } 38212 const { target, shiftKey: isShift } = event; 38213 const direction = isShift ? "findPrevious" : "findNext"; 38214 const nextTabbable = external_wp_dom_namespaceObject.focus.tabbable[direction](target); 38215 const currentBlock = target.closest("[data-block]"); 38216 const isElementPartOfSelectedBlock = currentBlock && nextTabbable && (isInSameBlock(currentBlock, nextTabbable) || isInsideRootBlock(currentBlock, nextTabbable)); 38217 if ((0,external_wp_dom_namespaceObject.isFormElement)(nextTabbable) && isElementPartOfSelectedBlock) { 38218 return; 38219 } 38220 const next = isShift ? focusCaptureBeforeRef : focusCaptureAfterRef; 38221 noCaptureRef.current = true; 38222 next.current.focus({ preventScroll: true }); 38223 } 38224 function onFocusOut(event) { 38225 setLastFocus({ ...getLastFocus(), current: event.target }); 38226 const { ownerDocument: ownerDocument2 } = node; 38227 if (!event.relatedTarget && event.target.hasAttribute("data-block") && ownerDocument2.activeElement === ownerDocument2.body && getBlockCount() === 0) { 38228 node.focus(); 38229 } 38230 } 38231 function preventScrollOnTab(event) { 38232 if (event.keyCode !== external_wp_keycodes_namespaceObject.TAB) { 38233 return; 38234 } 38235 if (event.target?.getAttribute("role") === "region") { 38236 return; 38237 } 38238 if (containerRef.current === event.target) { 38239 return; 38240 } 38241 const isShift = event.shiftKey; 38242 const direction = isShift ? "findPrevious" : "findNext"; 38243 const target = external_wp_dom_namespaceObject.focus.tabbable[direction](event.target); 38244 if (target === focusCaptureBeforeRef.current || target === focusCaptureAfterRef.current) { 38245 event.preventDefault(); 38246 target.focus({ preventScroll: true }); 38247 } 38248 } 38249 const { ownerDocument } = node; 38250 const { defaultView } = ownerDocument; 38251 defaultView.addEventListener("keydown", preventScrollOnTab); 38252 node.addEventListener("keydown", onKeyDown); 38253 node.addEventListener("focusout", onFocusOut); 38254 return () => { 38255 defaultView.removeEventListener("keydown", preventScrollOnTab); 38256 node.removeEventListener("keydown", onKeyDown); 38257 node.removeEventListener("focusout", onFocusOut); 38258 }; 38259 }, []); 38260 const mergedRefs = (0,external_wp_compose_namespaceObject.useMergeRefs)([containerRef, ref]); 38261 return [before, mergedRefs, after]; 38262 } 38263 38264 38265 ;// ./node_modules/@wordpress/block-editor/build-module/components/writing-flow/use-arrow-nav.js 38266 38267 38268 38269 38270 38271 38272 function isNavigationCandidate(element, keyCode, hasModifier) { 38273 const isVertical = keyCode === external_wp_keycodes_namespaceObject.UP || keyCode === external_wp_keycodes_namespaceObject.DOWN; 38274 const { tagName } = element; 38275 const elementType = element.getAttribute("type"); 38276 if (isVertical && !hasModifier) { 38277 if (tagName === "INPUT") { 38278 const verticalInputTypes = [ 38279 "date", 38280 "datetime-local", 38281 "month", 38282 "number", 38283 "range", 38284 "time", 38285 "week" 38286 ]; 38287 return !verticalInputTypes.includes(elementType); 38288 } 38289 return true; 38290 } 38291 if (tagName === "INPUT") { 38292 const simpleInputTypes = [ 38293 "button", 38294 "checkbox", 38295 "number", 38296 "color", 38297 "file", 38298 "image", 38299 "radio", 38300 "reset", 38301 "submit" 38302 ]; 38303 return simpleInputTypes.includes(elementType); 38304 } 38305 return tagName !== "TEXTAREA"; 38306 } 38307 function getClosestTabbable(target, isReverse, containerElement, onlyVertical) { 38308 let focusableNodes = external_wp_dom_namespaceObject.focus.focusable.find(containerElement); 38309 if (isReverse) { 38310 focusableNodes.reverse(); 38311 } 38312 focusableNodes = focusableNodes.slice( 38313 focusableNodes.indexOf(target) + 1 38314 ); 38315 let targetRect; 38316 if (onlyVertical) { 38317 targetRect = target.getBoundingClientRect(); 38318 } 38319 function isTabCandidate(node) { 38320 if (node.closest("[inert]")) { 38321 return; 38322 } 38323 if (node.children.length === 1 && isInSameBlock(node, node.firstElementChild) && node.firstElementChild.getAttribute("contenteditable") === "true") { 38324 return; 38325 } 38326 if (!external_wp_dom_namespaceObject.focus.tabbable.isTabbableIndex(node)) { 38327 return false; 38328 } 38329 if (node.isContentEditable && node.contentEditable !== "true") { 38330 return false; 38331 } 38332 if (onlyVertical) { 38333 const nodeRect = node.getBoundingClientRect(); 38334 if (nodeRect.left >= targetRect.right || nodeRect.right <= targetRect.left) { 38335 return false; 38336 } 38337 } 38338 return true; 38339 } 38340 return focusableNodes.find(isTabCandidate); 38341 } 38342 function useArrowNav() { 38343 const { 38344 getMultiSelectedBlocksStartClientId, 38345 getMultiSelectedBlocksEndClientId, 38346 getSettings, 38347 hasMultiSelection, 38348 __unstableIsFullySelected 38349 } = (0,external_wp_data_namespaceObject.useSelect)(store); 38350 const { selectBlock } = (0,external_wp_data_namespaceObject.useDispatch)(store); 38351 return (0,external_wp_compose_namespaceObject.useRefEffect)((node) => { 38352 let verticalRect; 38353 function onMouseDown() { 38354 verticalRect = null; 38355 } 38356 function isClosestTabbableABlock(target, isReverse) { 38357 const closestTabbable = getClosestTabbable( 38358 target, 38359 isReverse, 38360 node 38361 ); 38362 return closestTabbable && getBlockClientId(closestTabbable); 38363 } 38364 function onKeyDown(event) { 38365 if (event.defaultPrevented) { 38366 return; 38367 } 38368 const { keyCode, target, shiftKey, ctrlKey, altKey, metaKey } = event; 38369 const isUp = keyCode === external_wp_keycodes_namespaceObject.UP; 38370 const isDown = keyCode === external_wp_keycodes_namespaceObject.DOWN; 38371 const isLeft = keyCode === external_wp_keycodes_namespaceObject.LEFT; 38372 const isRight = keyCode === external_wp_keycodes_namespaceObject.RIGHT; 38373 const isReverse = isUp || isLeft; 38374 const isHorizontal = isLeft || isRight; 38375 const isVertical = isUp || isDown; 38376 const isNav = isHorizontal || isVertical; 38377 const hasModifier = shiftKey || ctrlKey || altKey || metaKey; 38378 const isNavEdge = isVertical ? external_wp_dom_namespaceObject.isVerticalEdge : external_wp_dom_namespaceObject.isHorizontalEdge; 38379 const { ownerDocument } = node; 38380 const { defaultView } = ownerDocument; 38381 if (!isNav) { 38382 return; 38383 } 38384 if (hasMultiSelection()) { 38385 if (shiftKey) { 38386 return; 38387 } 38388 if (!__unstableIsFullySelected()) { 38389 return; 38390 } 38391 event.preventDefault(); 38392 if (isReverse) { 38393 selectBlock(getMultiSelectedBlocksStartClientId()); 38394 } else { 38395 selectBlock(getMultiSelectedBlocksEndClientId(), -1); 38396 } 38397 return; 38398 } 38399 if (!isNavigationCandidate(target, keyCode, hasModifier)) { 38400 return; 38401 } 38402 if (!isVertical) { 38403 verticalRect = null; 38404 } else if (!verticalRect) { 38405 verticalRect = (0,external_wp_dom_namespaceObject.computeCaretRect)(defaultView); 38406 } 38407 const isReverseDir = (0,external_wp_dom_namespaceObject.isRTL)(target) ? !isReverse : isReverse; 38408 const { keepCaretInsideBlock } = getSettings(); 38409 if (shiftKey) { 38410 if (isClosestTabbableABlock(target, isReverse) && isNavEdge(target, isReverse)) { 38411 node.contentEditable = true; 38412 node.focus(); 38413 } 38414 } else if (isVertical && (0,external_wp_dom_namespaceObject.isVerticalEdge)(target, isReverse) && // When Alt is pressed, only intercept if the caret is also at 38415 // the horizontal edge. 38416 (altKey ? (0,external_wp_dom_namespaceObject.isHorizontalEdge)(target, isReverseDir) : true) && !keepCaretInsideBlock) { 38417 const closestTabbable = getClosestTabbable( 38418 target, 38419 isReverse, 38420 node, 38421 true 38422 ); 38423 if (closestTabbable) { 38424 (0,external_wp_dom_namespaceObject.placeCaretAtVerticalEdge)( 38425 closestTabbable, 38426 // When Alt is pressed, place the caret at the furthest 38427 // horizontal edge and the furthest vertical edge. 38428 altKey ? !isReverse : isReverse, 38429 altKey ? void 0 : verticalRect 38430 ); 38431 event.preventDefault(); 38432 } 38433 } else if (isHorizontal && defaultView.getSelection().isCollapsed && (0,external_wp_dom_namespaceObject.isHorizontalEdge)(target, isReverseDir) && !keepCaretInsideBlock) { 38434 const closestTabbable = getClosestTabbable( 38435 target, 38436 isReverseDir, 38437 node 38438 ); 38439 (0,external_wp_dom_namespaceObject.placeCaretAtHorizontalEdge)(closestTabbable, isReverse); 38440 event.preventDefault(); 38441 } 38442 } 38443 node.addEventListener("mousedown", onMouseDown); 38444 node.addEventListener("keydown", onKeyDown); 38445 return () => { 38446 node.removeEventListener("mousedown", onMouseDown); 38447 node.removeEventListener("keydown", onKeyDown); 38448 }; 38449 }, []); 38450 } 38451 38452 38453 ;// ./node_modules/@wordpress/block-editor/build-module/components/writing-flow/use-select-all.js 38454 38455 38456 38457 38458 38459 function useSelectAll() { 38460 const { getBlockOrder, getSelectedBlockClientIds, getBlockRootClientId } = (0,external_wp_data_namespaceObject.useSelect)(store); 38461 const { multiSelect, selectBlock } = (0,external_wp_data_namespaceObject.useDispatch)(store); 38462 const isMatch = (0,external_wp_keyboardShortcuts_namespaceObject.__unstableUseShortcutEventMatch)(); 38463 return (0,external_wp_compose_namespaceObject.useRefEffect)((node) => { 38464 function onKeyDown(event) { 38465 if (!isMatch("core/block-editor/select-all", event)) { 38466 return; 38467 } 38468 const selectedClientIds = getSelectedBlockClientIds(); 38469 if (selectedClientIds.length < 2 && !(0,external_wp_dom_namespaceObject.isEntirelySelected)(event.target)) { 38470 return; 38471 } 38472 event.preventDefault(); 38473 const [firstSelectedClientId] = selectedClientIds; 38474 const rootClientId = getBlockRootClientId(firstSelectedClientId); 38475 const blockClientIds = getBlockOrder(rootClientId); 38476 if (selectedClientIds.length === blockClientIds.length) { 38477 if (rootClientId) { 38478 node.ownerDocument.defaultView.getSelection().removeAllRanges(); 38479 selectBlock(rootClientId); 38480 } 38481 return; 38482 } 38483 multiSelect( 38484 blockClientIds[0], 38485 blockClientIds[blockClientIds.length - 1] 38486 ); 38487 } 38488 node.addEventListener("keydown", onKeyDown); 38489 return () => { 38490 node.removeEventListener("keydown", onKeyDown); 38491 }; 38492 }, []); 38493 } 38494 38495 38496 ;// ./node_modules/@wordpress/block-editor/build-module/components/writing-flow/use-drag-selection.js 38497 38498 38499 38500 function setContentEditableWrapper(node, value) { 38501 node.contentEditable = value; 38502 if (value) { 38503 node.focus(); 38504 } 38505 } 38506 function useDragSelection() { 38507 const { startMultiSelect, stopMultiSelect } = (0,external_wp_data_namespaceObject.useDispatch)(store); 38508 const { 38509 isSelectionEnabled, 38510 hasSelectedBlock, 38511 isDraggingBlocks, 38512 isMultiSelecting 38513 } = (0,external_wp_data_namespaceObject.useSelect)(store); 38514 return (0,external_wp_compose_namespaceObject.useRefEffect)( 38515 (node) => { 38516 const { ownerDocument } = node; 38517 const { defaultView } = ownerDocument; 38518 let anchorElement; 38519 let rafId; 38520 function onMouseUp() { 38521 stopMultiSelect(); 38522 defaultView.removeEventListener("mouseup", onMouseUp); 38523 rafId = defaultView.requestAnimationFrame(() => { 38524 if (!hasSelectedBlock()) { 38525 return; 38526 } 38527 setContentEditableWrapper(node, false); 38528 const selection = defaultView.getSelection(); 38529 if (selection.rangeCount) { 38530 const range = selection.getRangeAt(0); 38531 const { commonAncestorContainer } = range; 38532 const clonedRange = range.cloneRange(); 38533 if (anchorElement.contains(commonAncestorContainer)) { 38534 anchorElement.focus(); 38535 selection.removeAllRanges(); 38536 selection.addRange(clonedRange); 38537 } 38538 } 38539 }); 38540 } 38541 let lastMouseDownTarget; 38542 function onMouseDown({ target }) { 38543 lastMouseDownTarget = target; 38544 } 38545 function onMouseLeave({ buttons, target, relatedTarget }) { 38546 if (!target.contains(lastMouseDownTarget)) { 38547 return; 38548 } 38549 if (target.contains(relatedTarget)) { 38550 return; 38551 } 38552 if (isDraggingBlocks()) { 38553 return; 38554 } 38555 if (buttons !== 1) { 38556 return; 38557 } 38558 if (isMultiSelecting()) { 38559 return; 38560 } 38561 if (node === target) { 38562 return; 38563 } 38564 if (target.getAttribute("contenteditable") !== "true") { 38565 return; 38566 } 38567 if (!isSelectionEnabled()) { 38568 return; 38569 } 38570 anchorElement = target; 38571 startMultiSelect(); 38572 defaultView.addEventListener("mouseup", onMouseUp); 38573 setContentEditableWrapper(node, true); 38574 } 38575 node.addEventListener("mouseout", onMouseLeave); 38576 node.addEventListener("mousedown", onMouseDown); 38577 return () => { 38578 node.removeEventListener("mouseout", onMouseLeave); 38579 defaultView.removeEventListener("mouseup", onMouseUp); 38580 defaultView.cancelAnimationFrame(rafId); 38581 }; 38582 }, 38583 [ 38584 startMultiSelect, 38585 stopMultiSelect, 38586 isSelectionEnabled, 38587 hasSelectedBlock 38588 ] 38589 ); 38590 } 38591 38592 38593 ;// ./node_modules/@wordpress/block-editor/build-module/components/writing-flow/use-selection-observer.js 38594 38595 38596 38597 38598 38599 38600 function extractSelectionStartNode(selection) { 38601 const { anchorNode, anchorOffset } = selection; 38602 if (anchorNode.nodeType === anchorNode.TEXT_NODE) { 38603 return anchorNode; 38604 } 38605 if (anchorOffset === 0) { 38606 return anchorNode; 38607 } 38608 return anchorNode.childNodes[anchorOffset - 1]; 38609 } 38610 function extractSelectionEndNode(selection) { 38611 const { focusNode, focusOffset } = selection; 38612 if (focusNode.nodeType === focusNode.TEXT_NODE) { 38613 return focusNode; 38614 } 38615 if (focusOffset === focusNode.childNodes.length) { 38616 return focusNode; 38617 } 38618 if (focusOffset === 0 && (0,external_wp_dom_namespaceObject.isSelectionForward)(selection)) { 38619 return focusNode.previousSibling ?? focusNode.parentElement; 38620 } 38621 return focusNode.childNodes[focusOffset]; 38622 } 38623 function findDepth(a, b) { 38624 let depth = 0; 38625 while (a[depth] === b[depth]) { 38626 depth++; 38627 } 38628 return depth; 38629 } 38630 function use_selection_observer_setContentEditableWrapper(node, value) { 38631 if (node.contentEditable !== String(value)) { 38632 node.contentEditable = value; 38633 if (value) { 38634 node.focus(); 38635 } 38636 } 38637 } 38638 function getRichTextElement(node) { 38639 const element = node.nodeType === node.ELEMENT_NODE ? node : node.parentElement; 38640 return element?.closest("[data-wp-block-attribute-key]"); 38641 } 38642 function useSelectionObserver() { 38643 const { multiSelect, selectBlock, selectionChange } = (0,external_wp_data_namespaceObject.useDispatch)(store); 38644 const { getBlockParents, getBlockSelectionStart, isMultiSelecting } = (0,external_wp_data_namespaceObject.useSelect)(store); 38645 return (0,external_wp_compose_namespaceObject.useRefEffect)( 38646 (node) => { 38647 const { ownerDocument } = node; 38648 const { defaultView } = ownerDocument; 38649 function onSelectionChange(event) { 38650 const selection = defaultView.getSelection(); 38651 if (!selection.rangeCount) { 38652 return; 38653 } 38654 const startNode = extractSelectionStartNode(selection); 38655 const endNode = extractSelectionEndNode(selection); 38656 if (!node.contains(startNode) || !node.contains(endNode)) { 38657 return; 38658 } 38659 const isClickShift = event.shiftKey && event.type === "mouseup"; 38660 if (selection.isCollapsed && !isClickShift) { 38661 if (node.contentEditable === "true" && !isMultiSelecting()) { 38662 use_selection_observer_setContentEditableWrapper(node, false); 38663 let element = startNode.nodeType === startNode.ELEMENT_NODE ? startNode : startNode.parentElement; 38664 element = element?.closest("[contenteditable]"); 38665 element?.focus(); 38666 } 38667 return; 38668 } 38669 let startClientId = getBlockClientId(startNode); 38670 let endClientId = getBlockClientId(endNode); 38671 if (isClickShift) { 38672 const selectedClientId = getBlockSelectionStart(); 38673 const clickedClientId = getBlockClientId(event.target); 38674 const focusNodeIsNonSelectable = clickedClientId !== endClientId; 38675 if (startClientId === endClientId && selection.isCollapsed || !endClientId || focusNodeIsNonSelectable) { 38676 endClientId = clickedClientId; 38677 } 38678 if (startClientId !== selectedClientId) { 38679 startClientId = selectedClientId; 38680 } 38681 } 38682 if (startClientId === void 0 && endClientId === void 0) { 38683 use_selection_observer_setContentEditableWrapper(node, false); 38684 return; 38685 } 38686 const isSingularSelection = startClientId === endClientId; 38687 if (isSingularSelection) { 38688 if (!isMultiSelecting()) { 38689 selectBlock(startClientId); 38690 } else { 38691 multiSelect(startClientId, startClientId); 38692 } 38693 } else { 38694 const startPath = [ 38695 ...getBlockParents(startClientId), 38696 startClientId 38697 ]; 38698 const endPath = [ 38699 ...getBlockParents(endClientId), 38700 endClientId 38701 ]; 38702 const depth = findDepth(startPath, endPath); 38703 if (startPath[depth] !== startClientId || endPath[depth] !== endClientId) { 38704 multiSelect(startPath[depth], endPath[depth]); 38705 return; 38706 } 38707 const richTextElementStart = getRichTextElement(startNode); 38708 const richTextElementEnd = getRichTextElement(endNode); 38709 if (richTextElementStart && richTextElementEnd) { 38710 const range = selection.getRangeAt(0); 38711 const richTextDataStart = (0,external_wp_richText_namespaceObject.create)({ 38712 element: richTextElementStart, 38713 range, 38714 __unstableIsEditableTree: true 38715 }); 38716 const richTextDataEnd = (0,external_wp_richText_namespaceObject.create)({ 38717 element: richTextElementEnd, 38718 range, 38719 __unstableIsEditableTree: true 38720 }); 38721 const startOffset = richTextDataStart.start ?? richTextDataStart.end; 38722 const endOffset = richTextDataEnd.start ?? richTextDataEnd.end; 38723 selectionChange({ 38724 start: { 38725 clientId: startClientId, 38726 attributeKey: richTextElementStart.dataset.wpBlockAttributeKey, 38727 offset: startOffset 38728 }, 38729 end: { 38730 clientId: endClientId, 38731 attributeKey: richTextElementEnd.dataset.wpBlockAttributeKey, 38732 offset: endOffset 38733 } 38734 }); 38735 } else { 38736 multiSelect(startClientId, endClientId); 38737 } 38738 } 38739 } 38740 ownerDocument.addEventListener( 38741 "selectionchange", 38742 onSelectionChange 38743 ); 38744 defaultView.addEventListener("mouseup", onSelectionChange); 38745 return () => { 38746 ownerDocument.removeEventListener( 38747 "selectionchange", 38748 onSelectionChange 38749 ); 38750 defaultView.removeEventListener("mouseup", onSelectionChange); 38751 }; 38752 }, 38753 [multiSelect, selectBlock, selectionChange, getBlockParents] 38754 ); 38755 } 38756 38757 38758 ;// ./node_modules/@wordpress/block-editor/build-module/components/writing-flow/use-click-selection.js 38759 38760 38761 38762 38763 function useClickSelection() { 38764 const { selectBlock } = (0,external_wp_data_namespaceObject.useDispatch)(store); 38765 const { isSelectionEnabled, getBlockSelectionStart, hasMultiSelection } = (0,external_wp_data_namespaceObject.useSelect)(store); 38766 return (0,external_wp_compose_namespaceObject.useRefEffect)( 38767 (node) => { 38768 function onMouseDown(event) { 38769 if (!isSelectionEnabled() || event.button !== 0) { 38770 return; 38771 } 38772 const startClientId = getBlockSelectionStart(); 38773 const clickedClientId = getBlockClientId(event.target); 38774 if (event.shiftKey) { 38775 if (startClientId && startClientId !== clickedClientId) { 38776 node.contentEditable = true; 38777 node.focus(); 38778 } 38779 } else if (hasMultiSelection()) { 38780 selectBlock(clickedClientId); 38781 } 38782 } 38783 node.addEventListener("mousedown", onMouseDown); 38784 return () => { 38785 node.removeEventListener("mousedown", onMouseDown); 38786 }; 38787 }, 38788 [ 38789 selectBlock, 38790 isSelectionEnabled, 38791 getBlockSelectionStart, 38792 hasMultiSelection 38793 ] 38794 ); 38795 } 38796 38797 38798 ;// ./node_modules/@wordpress/block-editor/build-module/components/writing-flow/use-input.js 38799 38800 38801 38802 38803 38804 function useInput() { 38805 const { 38806 __unstableIsFullySelected, 38807 getSelectedBlockClientIds, 38808 getSelectedBlockClientId, 38809 __unstableIsSelectionMergeable, 38810 hasMultiSelection, 38811 getBlockName, 38812 canInsertBlockType, 38813 getBlockRootClientId, 38814 getSelectionStart, 38815 getSelectionEnd, 38816 getBlockAttributes 38817 } = (0,external_wp_data_namespaceObject.useSelect)(store); 38818 const { 38819 replaceBlocks, 38820 __unstableSplitSelection, 38821 removeBlocks, 38822 __unstableDeleteSelection, 38823 __unstableExpandSelection, 38824 __unstableMarkAutomaticChange 38825 } = (0,external_wp_data_namespaceObject.useDispatch)(store); 38826 return (0,external_wp_compose_namespaceObject.useRefEffect)((node) => { 38827 function onBeforeInput(event) { 38828 if (node.contentEditable === "true") { 38829 event.preventDefault(); 38830 } 38831 } 38832 function onKeyDown(event) { 38833 if (event.defaultPrevented) { 38834 return; 38835 } 38836 if (!hasMultiSelection()) { 38837 if (event.keyCode === external_wp_keycodes_namespaceObject.ENTER) { 38838 if (event.shiftKey || __unstableIsFullySelected()) { 38839 return; 38840 } 38841 const clientId = getSelectedBlockClientId(); 38842 const blockName = getBlockName(clientId); 38843 const selectionStart = getSelectionStart(); 38844 const selectionEnd = getSelectionEnd(); 38845 if (selectionStart.attributeKey === selectionEnd.attributeKey) { 38846 const selectedAttributeValue = getBlockAttributes(clientId)[selectionStart.attributeKey]; 38847 const transforms = (0,external_wp_blocks_namespaceObject.getBlockTransforms)("from").filter( 38848 ({ type }) => type === "enter" 38849 ); 38850 const transformation = (0,external_wp_blocks_namespaceObject.findTransform)( 38851 transforms, 38852 (item) => { 38853 return item.regExp.test( 38854 selectedAttributeValue 38855 ); 38856 } 38857 ); 38858 if (transformation) { 38859 replaceBlocks( 38860 clientId, 38861 transformation.transform({ 38862 content: selectedAttributeValue 38863 }) 38864 ); 38865 __unstableMarkAutomaticChange(); 38866 return; 38867 } 38868 } 38869 if (!(0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockName, "splitting", false) && !event.__deprecatedOnSplit) { 38870 return; 38871 } 38872 if (canInsertBlockType( 38873 blockName, 38874 getBlockRootClientId(clientId) 38875 )) { 38876 __unstableSplitSelection(); 38877 event.preventDefault(); 38878 } 38879 } 38880 return; 38881 } 38882 if (event.keyCode === external_wp_keycodes_namespaceObject.ENTER) { 38883 node.contentEditable = false; 38884 event.preventDefault(); 38885 if (__unstableIsFullySelected()) { 38886 replaceBlocks( 38887 getSelectedBlockClientIds(), 38888 (0,external_wp_blocks_namespaceObject.createBlock)((0,external_wp_blocks_namespaceObject.getDefaultBlockName)()) 38889 ); 38890 } else { 38891 __unstableSplitSelection(); 38892 } 38893 } else if (event.keyCode === external_wp_keycodes_namespaceObject.BACKSPACE || event.keyCode === external_wp_keycodes_namespaceObject.DELETE) { 38894 node.contentEditable = false; 38895 event.preventDefault(); 38896 if (__unstableIsFullySelected()) { 38897 removeBlocks(getSelectedBlockClientIds()); 38898 } else if (__unstableIsSelectionMergeable()) { 38899 __unstableDeleteSelection(event.keyCode === external_wp_keycodes_namespaceObject.DELETE); 38900 } else { 38901 __unstableExpandSelection(); 38902 } 38903 } else if ( 38904 // If key.length is longer than 1, it's a control key that doesn't 38905 // input anything. 38906 event.key.length === 1 && !(event.metaKey || event.ctrlKey) 38907 ) { 38908 node.contentEditable = false; 38909 if (__unstableIsSelectionMergeable()) { 38910 __unstableDeleteSelection(event.keyCode === external_wp_keycodes_namespaceObject.DELETE); 38911 } else { 38912 event.preventDefault(); 38913 node.ownerDocument.defaultView.getSelection().removeAllRanges(); 38914 } 38915 } 38916 } 38917 function onCompositionStart(event) { 38918 if (!hasMultiSelection()) { 38919 return; 38920 } 38921 node.contentEditable = false; 38922 if (__unstableIsSelectionMergeable()) { 38923 __unstableDeleteSelection(); 38924 } else { 38925 event.preventDefault(); 38926 node.ownerDocument.defaultView.getSelection().removeAllRanges(); 38927 } 38928 } 38929 node.addEventListener("beforeinput", onBeforeInput); 38930 node.addEventListener("keydown", onKeyDown); 38931 node.addEventListener("compositionstart", onCompositionStart); 38932 return () => { 38933 node.removeEventListener("beforeinput", onBeforeInput); 38934 node.removeEventListener("keydown", onKeyDown); 38935 node.removeEventListener("compositionstart", onCompositionStart); 38936 }; 38937 }, []); 38938 } 38939 38940 38941 ;// ./node_modules/@wordpress/block-editor/build-module/utils/use-notify-copy.js 38942 38943 38944 38945 38946 38947 38948 function useNotifyCopy() { 38949 const { getBlockName } = (0,external_wp_data_namespaceObject.useSelect)(store); 38950 const { getBlockType } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blocks_namespaceObject.store); 38951 const { createSuccessNotice } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); 38952 return (0,external_wp_element_namespaceObject.useCallback)( 38953 (eventType, selectedBlockClientIds) => { 38954 let notice = ""; 38955 if (eventType === "copyStyles") { 38956 notice = (0,external_wp_i18n_namespaceObject.__)("Styles copied to clipboard."); 38957 } else if (selectedBlockClientIds.length === 1) { 38958 const clientId = selectedBlockClientIds[0]; 38959 const title = getBlockType(getBlockName(clientId))?.title; 38960 if (eventType === "copy") { 38961 notice = (0,external_wp_i18n_namespaceObject.sprintf)( 38962 // Translators: %s: Name of the block being copied, e.g. "Paragraph". 38963 (0,external_wp_i18n_namespaceObject.__)('Copied "%s" to clipboard.'), 38964 title 38965 ); 38966 } else { 38967 notice = (0,external_wp_i18n_namespaceObject.sprintf)( 38968 // Translators: %s: Name of the block being cut, e.g. "Paragraph". 38969 (0,external_wp_i18n_namespaceObject.__)('Moved "%s" to clipboard.'), 38970 title 38971 ); 38972 } 38973 } else if (eventType === "copy") { 38974 notice = (0,external_wp_i18n_namespaceObject.sprintf)( 38975 // Translators: %d: Number of blocks being copied. 38976 (0,external_wp_i18n_namespaceObject._n)( 38977 "Copied %d block to clipboard.", 38978 "Copied %d blocks to clipboard.", 38979 selectedBlockClientIds.length 38980 ), 38981 selectedBlockClientIds.length 38982 ); 38983 } else { 38984 notice = (0,external_wp_i18n_namespaceObject.sprintf)( 38985 // Translators: %d: Number of blocks being moved. 38986 (0,external_wp_i18n_namespaceObject._n)( 38987 "Moved %d block to clipboard.", 38988 "Moved %d blocks to clipboard.", 38989 selectedBlockClientIds.length 38990 ), 38991 selectedBlockClientIds.length 38992 ); 38993 } 38994 createSuccessNotice(notice, { 38995 type: "snackbar" 38996 }); 38997 }, 38998 [createSuccessNotice, getBlockName, getBlockType] 38999 ); 39000 } 39001 39002 39003 ;// ./node_modules/@wordpress/block-editor/build-module/utils/pasting.js 39004 39005 function removeWindowsFragments(html) { 39006 const startStr = "<!--StartFragment-->"; 39007 const startIdx = html.indexOf(startStr); 39008 if (startIdx > -1) { 39009 html = html.substring(startIdx + startStr.length); 39010 } else { 39011 return html; 39012 } 39013 const endStr = "<!--EndFragment-->"; 39014 const endIdx = html.indexOf(endStr); 39015 if (endIdx > -1) { 39016 html = html.substring(0, endIdx); 39017 } 39018 return html; 39019 } 39020 function removeCharsetMetaTag(html) { 39021 const metaTag = `<meta charset='utf-8'>`; 39022 if (html.startsWith(metaTag)) { 39023 return html.slice(metaTag.length); 39024 } 39025 return html; 39026 } 39027 function getPasteEventData({ clipboardData }) { 39028 let plainText = ""; 39029 let html = ""; 39030 try { 39031 plainText = clipboardData.getData("text/plain"); 39032 html = clipboardData.getData("text/html"); 39033 } catch (error) { 39034 return; 39035 } 39036 html = removeWindowsFragments(html); 39037 html = removeCharsetMetaTag(html); 39038 const files = (0,external_wp_dom_namespaceObject.getFilesFromDataTransfer)(clipboardData); 39039 if (files.length && !shouldDismissPastedFiles(files, html)) { 39040 return { files }; 39041 } 39042 return { html, plainText, files: [] }; 39043 } 39044 function shouldDismissPastedFiles(files, html) { 39045 if (html && files?.length === 1 && files[0].type.indexOf("image/") === 0) { 39046 const IMAGE_TAG = /<\s*img\b/gi; 39047 if (html.match(IMAGE_TAG)?.length !== 1) { 39048 return true; 39049 } 39050 const IMG_WITH_LOCAL_SRC = /<\s*img\b[^>]*\bsrc="file:\/\//i; 39051 if (html.match(IMG_WITH_LOCAL_SRC)) { 39052 return true; 39053 } 39054 } 39055 return false; 39056 } 39057 39058 39059 ;// ./node_modules/@wordpress/block-editor/build-module/components/writing-flow/utils.js 39060 39061 39062 39063 39064 const requiresWrapperOnCopy = Symbol("requiresWrapperOnCopy"); 39065 function setClipboardBlocks(event, blocks, registry) { 39066 let _blocks = blocks; 39067 const [firstBlock] = blocks; 39068 if (firstBlock) { 39069 const firstBlockType = registry.select(external_wp_blocks_namespaceObject.store).getBlockType(firstBlock.name); 39070 if (firstBlockType[requiresWrapperOnCopy]) { 39071 const { getBlockRootClientId, getBlockName, getBlockAttributes } = registry.select(store); 39072 const wrapperBlockClientId = getBlockRootClientId( 39073 firstBlock.clientId 39074 ); 39075 const wrapperBlockName = getBlockName(wrapperBlockClientId); 39076 if (wrapperBlockName) { 39077 _blocks = (0,external_wp_blocks_namespaceObject.createBlock)( 39078 wrapperBlockName, 39079 getBlockAttributes(wrapperBlockClientId), 39080 _blocks 39081 ); 39082 } 39083 } 39084 } 39085 const serialized = (0,external_wp_blocks_namespaceObject.serialize)(_blocks); 39086 event.clipboardData.setData("text/plain", toPlainText(serialized)); 39087 event.clipboardData.setData("text/html", serialized); 39088 } 39089 function getPasteBlocks(event, canUserUseUnfilteredHTML) { 39090 const { plainText, html, files } = getPasteEventData(event); 39091 let blocks = []; 39092 if (files.length) { 39093 const fromTransforms = (0,external_wp_blocks_namespaceObject.getBlockTransforms)("from"); 39094 blocks = files.reduce((accumulator, file) => { 39095 const transformation = (0,external_wp_blocks_namespaceObject.findTransform)( 39096 fromTransforms, 39097 (transform) => transform.type === "files" && transform.isMatch([file]) 39098 ); 39099 if (transformation) { 39100 accumulator.push(transformation.transform([file])); 39101 } 39102 return accumulator; 39103 }, []).flat(); 39104 } else { 39105 blocks = (0,external_wp_blocks_namespaceObject.pasteHandler)({ 39106 HTML: html, 39107 plainText, 39108 mode: "BLOCKS", 39109 canUserUseUnfilteredHTML 39110 }); 39111 } 39112 return blocks; 39113 } 39114 function toPlainText(html) { 39115 html = html.replace(/<br>/g, "\n"); 39116 const plainText = (0,external_wp_dom_namespaceObject.__unstableStripHTML)(html).trim(); 39117 return plainText.replace(/\n\n+/g, "\n\n"); 39118 } 39119 39120 39121 ;// ./node_modules/@wordpress/block-editor/build-module/components/writing-flow/use-clipboard-handler.js 39122 39123 39124 39125 39126 39127 39128 39129 39130 function useClipboardHandler() { 39131 const registry = (0,external_wp_data_namespaceObject.useRegistry)(); 39132 const { 39133 getBlocksByClientId, 39134 getSelectedBlockClientIds, 39135 hasMultiSelection, 39136 getSettings, 39137 getBlockName, 39138 __unstableIsFullySelected, 39139 __unstableIsSelectionCollapsed, 39140 __unstableIsSelectionMergeable, 39141 __unstableGetSelectedBlocksWithPartialSelection, 39142 canInsertBlockType, 39143 getBlockRootClientId 39144 } = (0,external_wp_data_namespaceObject.useSelect)(store); 39145 const { 39146 flashBlock, 39147 removeBlocks, 39148 replaceBlocks, 39149 __unstableDeleteSelection, 39150 __unstableExpandSelection, 39151 __unstableSplitSelection 39152 } = (0,external_wp_data_namespaceObject.useDispatch)(store); 39153 const notifyCopy = useNotifyCopy(); 39154 return (0,external_wp_compose_namespaceObject.useRefEffect)((node) => { 39155 function handler(event) { 39156 if (event.defaultPrevented) { 39157 return; 39158 } 39159 const selectedBlockClientIds = getSelectedBlockClientIds(); 39160 if (selectedBlockClientIds.length === 0) { 39161 return; 39162 } 39163 if (!hasMultiSelection()) { 39164 const { target } = event; 39165 const { ownerDocument } = target; 39166 const hasSelection = event.type === "copy" || event.type === "cut" ? (0,external_wp_dom_namespaceObject.documentHasUncollapsedSelection)(ownerDocument) : (0,external_wp_dom_namespaceObject.documentHasSelection)(ownerDocument) && !ownerDocument.activeElement.isContentEditable; 39167 if (hasSelection) { 39168 return; 39169 } 39170 } 39171 const { activeElement } = event.target.ownerDocument; 39172 if (!node.contains(activeElement)) { 39173 return; 39174 } 39175 const isSelectionMergeable = __unstableIsSelectionMergeable(); 39176 const shouldHandleWholeBlocks = __unstableIsSelectionCollapsed() || __unstableIsFullySelected(); 39177 const expandSelectionIsNeeded = !shouldHandleWholeBlocks && !isSelectionMergeable; 39178 if (event.type === "copy" || event.type === "cut") { 39179 event.preventDefault(); 39180 if (selectedBlockClientIds.length === 1) { 39181 flashBlock(selectedBlockClientIds[0]); 39182 } 39183 if (expandSelectionIsNeeded) { 39184 __unstableExpandSelection(); 39185 } else { 39186 notifyCopy(event.type, selectedBlockClientIds); 39187 let blocks; 39188 if (shouldHandleWholeBlocks) { 39189 blocks = getBlocksByClientId(selectedBlockClientIds); 39190 } else { 39191 const [head, tail] = __unstableGetSelectedBlocksWithPartialSelection(); 39192 const inBetweenBlocks = getBlocksByClientId( 39193 selectedBlockClientIds.slice( 39194 1, 39195 selectedBlockClientIds.length - 1 39196 ) 39197 ); 39198 blocks = [head, ...inBetweenBlocks, tail]; 39199 } 39200 setClipboardBlocks(event, blocks, registry); 39201 } 39202 } 39203 if (event.type === "cut") { 39204 if (shouldHandleWholeBlocks && !expandSelectionIsNeeded) { 39205 removeBlocks(selectedBlockClientIds); 39206 } else { 39207 event.target.ownerDocument.activeElement.contentEditable = false; 39208 __unstableDeleteSelection(); 39209 } 39210 } else if (event.type === "paste") { 39211 const { 39212 __experimentalCanUserUseUnfilteredHTML: canUserUseUnfilteredHTML, 39213 mediaUpload 39214 } = getSettings(); 39215 const isInternal = event.clipboardData.getData("rich-text") === "true"; 39216 if (isInternal) { 39217 return; 39218 } 39219 const { plainText, html, files } = getPasteEventData(event); 39220 const isFullySelected = __unstableIsFullySelected(); 39221 let blocks = []; 39222 if (files.length) { 39223 if (!mediaUpload) { 39224 event.preventDefault(); 39225 return; 39226 } 39227 const fromTransforms = (0,external_wp_blocks_namespaceObject.getBlockTransforms)("from"); 39228 blocks = files.reduce((accumulator, file) => { 39229 const transformation = (0,external_wp_blocks_namespaceObject.findTransform)( 39230 fromTransforms, 39231 (transform) => transform.type === "files" && transform.isMatch([file]) 39232 ); 39233 if (transformation) { 39234 accumulator.push( 39235 transformation.transform([file]) 39236 ); 39237 } 39238 return accumulator; 39239 }, []).flat(); 39240 } else { 39241 blocks = (0,external_wp_blocks_namespaceObject.pasteHandler)({ 39242 HTML: html, 39243 plainText, 39244 mode: isFullySelected ? "BLOCKS" : "AUTO", 39245 canUserUseUnfilteredHTML 39246 }); 39247 } 39248 if (typeof blocks === "string") { 39249 return; 39250 } 39251 if (isFullySelected) { 39252 replaceBlocks( 39253 selectedBlockClientIds, 39254 blocks, 39255 blocks.length - 1, 39256 -1 39257 ); 39258 event.preventDefault(); 39259 return; 39260 } 39261 if (!hasMultiSelection() && !(0,external_wp_blocks_namespaceObject.hasBlockSupport)( 39262 getBlockName(selectedBlockClientIds[0]), 39263 "splitting", 39264 false 39265 ) && !event.__deprecatedOnSplit) { 39266 return; 39267 } 39268 const [firstSelectedClientId] = selectedBlockClientIds; 39269 const rootClientId = getBlockRootClientId( 39270 firstSelectedClientId 39271 ); 39272 const newBlocks = []; 39273 for (const block of blocks) { 39274 if (canInsertBlockType(block.name, rootClientId)) { 39275 newBlocks.push(block); 39276 } else { 39277 const rootBlockName = getBlockName(rootClientId); 39278 const switchedBlocks = block.name !== rootBlockName ? (0,external_wp_blocks_namespaceObject.switchToBlockType)(block, rootBlockName) : [block]; 39279 if (!switchedBlocks) { 39280 return; 39281 } 39282 for (const switchedBlock of switchedBlocks) { 39283 for (const innerBlock of switchedBlock.innerBlocks) { 39284 newBlocks.push(innerBlock); 39285 } 39286 } 39287 } 39288 } 39289 __unstableSplitSelection(newBlocks); 39290 event.preventDefault(); 39291 } 39292 } 39293 node.ownerDocument.addEventListener("copy", handler); 39294 node.ownerDocument.addEventListener("cut", handler); 39295 node.ownerDocument.addEventListener("paste", handler); 39296 return () => { 39297 node.ownerDocument.removeEventListener("copy", handler); 39298 node.ownerDocument.removeEventListener("cut", handler); 39299 node.ownerDocument.removeEventListener("paste", handler); 39300 }; 39301 }, []); 39302 } 39303 39304 39305 ;// ./node_modules/@wordpress/block-editor/build-module/components/writing-flow/index.js 39306 39307 39308 39309 39310 39311 39312 39313 39314 39315 39316 39317 39318 39319 39320 39321 39322 function useWritingFlow() { 39323 const [before, ref, after] = useTabNav(); 39324 const hasMultiSelection = (0,external_wp_data_namespaceObject.useSelect)( 39325 (select) => select(store).hasMultiSelection(), 39326 [] 39327 ); 39328 return [ 39329 before, 39330 (0,external_wp_compose_namespaceObject.useMergeRefs)([ 39331 ref, 39332 useClipboardHandler(), 39333 useInput(), 39334 useDragSelection(), 39335 useSelectionObserver(), 39336 useClickSelection(), 39337 useMultiSelection(), 39338 useSelectAll(), 39339 useArrowNav(), 39340 (0,external_wp_compose_namespaceObject.useRefEffect)( 39341 (node) => { 39342 node.tabIndex = 0; 39343 node.dataset.hasMultiSelection = hasMultiSelection; 39344 if (!hasMultiSelection) { 39345 return () => { 39346 delete node.dataset.hasMultiSelection; 39347 }; 39348 } 39349 node.setAttribute( 39350 "aria-label", 39351 (0,external_wp_i18n_namespaceObject.__)("Multiple selected blocks") 39352 ); 39353 return () => { 39354 delete node.dataset.hasMultiSelection; 39355 node.removeAttribute("aria-label"); 39356 }; 39357 }, 39358 [hasMultiSelection] 39359 ) 39360 ]), 39361 after 39362 ]; 39363 } 39364 function WritingFlow({ children, ...props }, forwardedRef) { 39365 const [before, ref, after] = useWritingFlow(); 39366 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 39367 before, 39368 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 39369 "div", 39370 { 39371 ...props, 39372 ref: (0,external_wp_compose_namespaceObject.useMergeRefs)([ref, forwardedRef]), 39373 className: dist_clsx( 39374 props.className, 39375 "block-editor-writing-flow" 39376 ), 39377 children 39378 } 39379 ), 39380 after 39381 ] }); 39382 } 39383 var writing_flow_default = (0,external_wp_element_namespaceObject.forwardRef)(WritingFlow); 39384 39385 39386 ;// ./node_modules/@wordpress/block-editor/build-module/components/iframe/get-compatibility-styles.js 39387 let compatibilityStyles = null; 39388 function getCompatibilityStyles() { 39389 if (compatibilityStyles) { 39390 return compatibilityStyles; 39391 } 39392 compatibilityStyles = Array.from(document.styleSheets).reduce( 39393 (accumulator, styleSheet) => { 39394 try { 39395 styleSheet.cssRules; 39396 } catch (e) { 39397 return accumulator; 39398 } 39399 const { ownerNode, cssRules } = styleSheet; 39400 if (ownerNode === null) { 39401 return accumulator; 39402 } 39403 if (!cssRules) { 39404 return accumulator; 39405 } 39406 if (ownerNode.id.startsWith("wp-")) { 39407 return accumulator; 39408 } 39409 if (!ownerNode.id) { 39410 return accumulator; 39411 } 39412 function matchFromRules(_cssRules) { 39413 return Array.from(_cssRules).find( 39414 ({ 39415 selectorText, 39416 conditionText, 39417 cssRules: __cssRules 39418 }) => { 39419 if (conditionText) { 39420 return matchFromRules(__cssRules); 39421 } 39422 return selectorText && (selectorText.includes( 39423 ".editor-styles-wrapper" 39424 ) || selectorText.includes(".wp-block")); 39425 } 39426 ); 39427 } 39428 if (matchFromRules(cssRules)) { 39429 const isInline = ownerNode.tagName === "STYLE"; 39430 if (isInline) { 39431 const mainStylesCssId = ownerNode.id.replace( 39432 "-inline-css", 39433 "-css" 39434 ); 39435 const mainStylesElement = document.getElementById(mainStylesCssId); 39436 if (mainStylesElement) { 39437 accumulator.push(mainStylesElement.cloneNode(true)); 39438 } 39439 } 39440 accumulator.push(ownerNode.cloneNode(true)); 39441 if (!isInline) { 39442 const inlineStylesCssId = ownerNode.id.replace( 39443 "-css", 39444 "-inline-css" 39445 ); 39446 const inlineStylesElement = document.getElementById(inlineStylesCssId); 39447 if (inlineStylesElement) { 39448 accumulator.push( 39449 inlineStylesElement.cloneNode(true) 39450 ); 39451 } 39452 } 39453 } 39454 return accumulator; 39455 }, 39456 [] 39457 ); 39458 return compatibilityStyles; 39459 } 39460 39461 39462 ;// ./node_modules/@wordpress/block-editor/build-module/components/iframe/use-scale-canvas.js 39463 39464 39465 function calculateScale({ 39466 frameSize, 39467 containerWidth, 39468 maxContainerWidth, 39469 scaleContainerWidth 39470 }) { 39471 return (Math.min(containerWidth, maxContainerWidth) - frameSize * 2) / scaleContainerWidth; 39472 } 39473 function computeScrollHeightNext(transitionFrom, transitionTo) { 39474 const { scaleValue: prevScale, scrollHeight: prevScrollHeight } = transitionFrom; 39475 const { frameSize, scaleValue } = transitionTo; 39476 return prevScrollHeight * (scaleValue / prevScale) + frameSize * 2; 39477 } 39478 function computeScrollTopNext(transitionFrom, transitionTo) { 39479 const { 39480 containerHeight: prevContainerHeight, 39481 frameSize: prevFrameSize, 39482 scaleValue: prevScale, 39483 scrollTop: prevScrollTop 39484 } = transitionFrom; 39485 const { containerHeight, frameSize, scaleValue, scrollHeight } = transitionTo; 39486 let scrollTopNext = prevScrollTop; 39487 scrollTopNext = (scrollTopNext + prevContainerHeight / 2 - prevFrameSize) / prevScale - prevContainerHeight / 2; 39488 scrollTopNext = (scrollTopNext + containerHeight / 2) * scaleValue + frameSize - containerHeight / 2; 39489 scrollTopNext = prevScrollTop <= prevFrameSize ? 0 : scrollTopNext; 39490 const maxScrollTop = scrollHeight - containerHeight; 39491 return Math.round( 39492 Math.min(Math.max(0, scrollTopNext), Math.max(0, maxScrollTop)) 39493 ); 39494 } 39495 function getAnimationKeyframes(transitionFrom, transitionTo) { 39496 const { 39497 scaleValue: prevScale, 39498 frameSize: prevFrameSize, 39499 scrollTop 39500 } = transitionFrom; 39501 const { scaleValue, frameSize, scrollTop: scrollTopNext } = transitionTo; 39502 return [ 39503 { 39504 translate: `0 0`, 39505 scale: prevScale, 39506 paddingTop: `$prevFrameSize / prevScale}px`, 39507 paddingBottom: `$prevFrameSize / prevScale}px` 39508 }, 39509 { 39510 translate: `0 $scrollTop - scrollTopNext}px`, 39511 scale: scaleValue, 39512 paddingTop: `$frameSize / scaleValue}px`, 39513 paddingBottom: `$frameSize / scaleValue}px` 39514 } 39515 ]; 39516 } 39517 function useScaleCanvas({ 39518 frameSize, 39519 iframeDocument, 39520 maxContainerWidth = 750, 39521 scale 39522 }) { 39523 const [contentResizeListener, { height: contentHeight }] = (0,external_wp_compose_namespaceObject.useResizeObserver)(); 39524 const [ 39525 containerResizeListener, 39526 { width: containerWidth, height: containerHeight } 39527 ] = (0,external_wp_compose_namespaceObject.useResizeObserver)(); 39528 const initialContainerWidthRef = (0,external_wp_element_namespaceObject.useRef)(0); 39529 const isZoomedOut = scale !== 1; 39530 const prefersReducedMotion = (0,external_wp_compose_namespaceObject.useReducedMotion)(); 39531 const isAutoScaled = scale === "auto-scaled"; 39532 const startAnimationRef = (0,external_wp_element_namespaceObject.useRef)(false); 39533 const animationRef = (0,external_wp_element_namespaceObject.useRef)(null); 39534 (0,external_wp_element_namespaceObject.useEffect)(() => { 39535 if (!isZoomedOut) { 39536 initialContainerWidthRef.current = containerWidth; 39537 } 39538 }, [containerWidth, isZoomedOut]); 39539 const scaleContainerWidth = Math.max( 39540 initialContainerWidthRef.current, 39541 containerWidth 39542 ); 39543 const scaleValue = isAutoScaled ? calculateScale({ 39544 frameSize, 39545 containerWidth, 39546 maxContainerWidth, 39547 scaleContainerWidth 39548 }) : scale; 39549 const transitionFromRef = (0,external_wp_element_namespaceObject.useRef)({ 39550 scaleValue, 39551 frameSize, 39552 containerHeight: 0, 39553 scrollTop: 0, 39554 scrollHeight: 0 39555 }); 39556 const transitionToRef = (0,external_wp_element_namespaceObject.useRef)({ 39557 scaleValue, 39558 frameSize, 39559 containerHeight: 0, 39560 scrollTop: 0, 39561 scrollHeight: 0 39562 }); 39563 const startZoomOutAnimation = (0,external_wp_element_namespaceObject.useCallback)(() => { 39564 const { scrollTop } = transitionFromRef.current; 39565 const { scrollTop: scrollTopNext } = transitionToRef.current; 39566 iframeDocument.documentElement.style.setProperty( 39567 "--wp-block-editor-iframe-zoom-out-scroll-top", 39568 `$scrollTop}px` 39569 ); 39570 iframeDocument.documentElement.style.setProperty( 39571 "--wp-block-editor-iframe-zoom-out-scroll-top-next", 39572 `$scrollTopNext}px` 39573 ); 39574 iframeDocument.documentElement.style.setProperty( 39575 "--wp-block-editor-iframe-zoom-out-overflow-behavior", 39576 transitionFromRef.current.scrollHeight === transitionFromRef.current.containerHeight ? "auto" : "scroll" 39577 ); 39578 iframeDocument.documentElement.classList.add("zoom-out-animation"); 39579 return iframeDocument.documentElement.animate( 39580 getAnimationKeyframes( 39581 transitionFromRef.current, 39582 transitionToRef.current 39583 ), 39584 { 39585 easing: "cubic-bezier(0.46, 0.03, 0.52, 0.96)", 39586 duration: 400 39587 } 39588 ); 39589 }, [iframeDocument]); 39590 const finishZoomOutAnimation = (0,external_wp_element_namespaceObject.useCallback)(() => { 39591 startAnimationRef.current = false; 39592 animationRef.current = null; 39593 iframeDocument.documentElement.style.setProperty( 39594 "--wp-block-editor-iframe-zoom-out-scale", 39595 transitionToRef.current.scaleValue 39596 ); 39597 iframeDocument.documentElement.style.setProperty( 39598 "--wp-block-editor-iframe-zoom-out-frame-size", 39599 `$transitionToRef.current.frameSize}px` 39600 ); 39601 iframeDocument.documentElement.classList.remove("zoom-out-animation"); 39602 iframeDocument.documentElement.scrollTop = transitionToRef.current.scrollTop; 39603 iframeDocument.documentElement.style.removeProperty( 39604 "--wp-block-editor-iframe-zoom-out-scroll-top" 39605 ); 39606 iframeDocument.documentElement.style.removeProperty( 39607 "--wp-block-editor-iframe-zoom-out-scroll-top-next" 39608 ); 39609 iframeDocument.documentElement.style.removeProperty( 39610 "--wp-block-editor-iframe-zoom-out-overflow-behavior" 39611 ); 39612 transitionFromRef.current = transitionToRef.current; 39613 }, [iframeDocument]); 39614 const previousIsZoomedOut = (0,external_wp_element_namespaceObject.useRef)(false); 39615 (0,external_wp_element_namespaceObject.useEffect)(() => { 39616 const trigger = iframeDocument && previousIsZoomedOut.current !== isZoomedOut; 39617 previousIsZoomedOut.current = isZoomedOut; 39618 if (!trigger) { 39619 return; 39620 } 39621 startAnimationRef.current = true; 39622 if (!isZoomedOut) { 39623 return; 39624 } 39625 iframeDocument.documentElement.classList.add("is-zoomed-out"); 39626 return () => { 39627 iframeDocument.documentElement.classList.remove("is-zoomed-out"); 39628 }; 39629 }, [iframeDocument, isZoomedOut]); 39630 (0,external_wp_element_namespaceObject.useEffect)(() => { 39631 if (!iframeDocument) { 39632 return; 39633 } 39634 if (isAutoScaled && transitionFromRef.current.scaleValue !== 1) { 39635 transitionFromRef.current.scaleValue = calculateScale({ 39636 frameSize: transitionFromRef.current.frameSize, 39637 containerWidth, 39638 maxContainerWidth, 39639 scaleContainerWidth: containerWidth 39640 }); 39641 } 39642 if (scaleValue < 1) { 39643 if (!startAnimationRef.current) { 39644 iframeDocument.documentElement.style.setProperty( 39645 "--wp-block-editor-iframe-zoom-out-scale", 39646 scaleValue 39647 ); 39648 iframeDocument.documentElement.style.setProperty( 39649 "--wp-block-editor-iframe-zoom-out-frame-size", 39650 `$frameSize}px` 39651 ); 39652 } 39653 iframeDocument.documentElement.style.setProperty( 39654 "--wp-block-editor-iframe-zoom-out-content-height", 39655 `$contentHeight}px` 39656 ); 39657 iframeDocument.documentElement.style.setProperty( 39658 "--wp-block-editor-iframe-zoom-out-inner-height", 39659 `$containerHeight}px` 39660 ); 39661 iframeDocument.documentElement.style.setProperty( 39662 "--wp-block-editor-iframe-zoom-out-container-width", 39663 `$containerWidth}px` 39664 ); 39665 iframeDocument.documentElement.style.setProperty( 39666 "--wp-block-editor-iframe-zoom-out-scale-container-width", 39667 `$scaleContainerWidth}px` 39668 ); 39669 } 39670 if (startAnimationRef.current) { 39671 startAnimationRef.current = false; 39672 if (animationRef.current) { 39673 animationRef.current.reverse(); 39674 const tempTransitionFrom = transitionFromRef.current; 39675 const tempTransitionTo = transitionToRef.current; 39676 transitionFromRef.current = tempTransitionTo; 39677 transitionToRef.current = tempTransitionFrom; 39678 } else { 39679 transitionFromRef.current.scrollTop = iframeDocument.documentElement.scrollTop; 39680 transitionFromRef.current.scrollHeight = iframeDocument.documentElement.scrollHeight; 39681 transitionFromRef.current.containerHeight = containerHeight; 39682 transitionToRef.current = { 39683 scaleValue, 39684 frameSize, 39685 containerHeight: iframeDocument.documentElement.clientHeight 39686 // use clientHeight to get the actual height of the new container after zoom state changes have rendered, as it will be the most up-to-date. 39687 }; 39688 transitionToRef.current.scrollHeight = computeScrollHeightNext( 39689 transitionFromRef.current, 39690 transitionToRef.current 39691 ); 39692 transitionToRef.current.scrollTop = computeScrollTopNext( 39693 transitionFromRef.current, 39694 transitionToRef.current 39695 ); 39696 animationRef.current = startZoomOutAnimation(); 39697 if (prefersReducedMotion) { 39698 finishZoomOutAnimation(); 39699 } else { 39700 animationRef.current.onfinish = finishZoomOutAnimation; 39701 } 39702 } 39703 } 39704 }, [ 39705 startZoomOutAnimation, 39706 finishZoomOutAnimation, 39707 prefersReducedMotion, 39708 isAutoScaled, 39709 scaleValue, 39710 frameSize, 39711 iframeDocument, 39712 contentHeight, 39713 containerWidth, 39714 containerHeight, 39715 maxContainerWidth, 39716 scaleContainerWidth 39717 ]); 39718 return { 39719 isZoomedOut, 39720 scaleContainerWidth, 39721 contentResizeListener, 39722 containerResizeListener 39723 }; 39724 } 39725 39726 39727 ;// ./node_modules/@wordpress/block-editor/build-module/components/iframe/index.js 39728 39729 39730 39731 39732 39733 39734 39735 39736 39737 39738 39739 39740 function bubbleEvent(event, Constructor, frame) { 39741 const init = {}; 39742 for (const key in event) { 39743 init[key] = event[key]; 39744 } 39745 if (event instanceof frame.contentDocument.defaultView.MouseEvent) { 39746 const rect = frame.getBoundingClientRect(); 39747 init.clientX += rect.left; 39748 init.clientY += rect.top; 39749 } 39750 const newEvent = new Constructor(event.type, init); 39751 if (init.defaultPrevented) { 39752 newEvent.preventDefault(); 39753 } 39754 const cancelled = !frame.dispatchEvent(newEvent); 39755 if (cancelled) { 39756 event.preventDefault(); 39757 } 39758 } 39759 function useBubbleEvents(iframeDocument) { 39760 return (0,external_wp_compose_namespaceObject.useRefEffect)(() => { 39761 const { defaultView } = iframeDocument; 39762 if (!defaultView) { 39763 return; 39764 } 39765 const { frameElement } = defaultView; 39766 const html = iframeDocument.documentElement; 39767 const eventTypes = ["dragover", "mousemove"]; 39768 const handlers = {}; 39769 for (const name of eventTypes) { 39770 handlers[name] = (event) => { 39771 const prototype = Object.getPrototypeOf(event); 39772 const constructorName = prototype.constructor.name; 39773 const Constructor = window[constructorName]; 39774 bubbleEvent(event, Constructor, frameElement); 39775 }; 39776 html.addEventListener(name, handlers[name]); 39777 } 39778 return () => { 39779 for (const name of eventTypes) { 39780 html.removeEventListener(name, handlers[name]); 39781 } 39782 }; 39783 }); 39784 } 39785 function Iframe({ 39786 contentRef, 39787 children, 39788 tabIndex = 0, 39789 scale = 1, 39790 frameSize = 0, 39791 readonly, 39792 forwardedRef: ref, 39793 title = (0,external_wp_i18n_namespaceObject.__)("Editor canvas"), 39794 ...props 39795 }) { 39796 const { resolvedAssets, isPreviewMode } = (0,external_wp_data_namespaceObject.useSelect)((select) => { 39797 const { getSettings } = select(store); 39798 const settings = getSettings(); 39799 return { 39800 resolvedAssets: settings.__unstableResolvedAssets, 39801 isPreviewMode: settings.isPreviewMode 39802 }; 39803 }, []); 39804 const { styles = "", scripts = "" } = resolvedAssets; 39805 const [iframeDocument, setIframeDocument] = (0,external_wp_element_namespaceObject.useState)(); 39806 const [bodyClasses, setBodyClasses] = (0,external_wp_element_namespaceObject.useState)([]); 39807 const clearerRef = useBlockSelectionClearer(); 39808 const [before, writingFlowRef, after] = useWritingFlow(); 39809 const setRef = (0,external_wp_compose_namespaceObject.useRefEffect)((node) => { 39810 node._load = () => { 39811 setIframeDocument(node.contentDocument); 39812 }; 39813 let iFrameDocument; 39814 function preventFileDropDefault(event) { 39815 event.preventDefault(); 39816 } 39817 function interceptLinkClicks(event) { 39818 if (event.target.tagName === "A" && event.target.getAttribute("href")?.startsWith("#")) { 39819 event.preventDefault(); 39820 iFrameDocument.defaultView.location.hash = event.target.getAttribute("href").slice(1); 39821 } 39822 } 39823 const { ownerDocument } = node; 39824 setBodyClasses( 39825 Array.from(ownerDocument.body.classList).filter( 39826 (name) => name.startsWith("admin-color-") || name.startsWith("post-type-") || name === "wp-embed-responsive" 39827 ) 39828 ); 39829 function onLoad() { 39830 const { contentDocument } = node; 39831 const { documentElement } = contentDocument; 39832 iFrameDocument = contentDocument; 39833 documentElement.classList.add("block-editor-iframe__html"); 39834 clearerRef(documentElement); 39835 contentDocument.dir = ownerDocument.dir; 39836 for (const compatStyle of getCompatibilityStyles()) { 39837 if (contentDocument.getElementById(compatStyle.id)) { 39838 continue; 39839 } 39840 contentDocument.head.appendChild( 39841 compatStyle.cloneNode(true) 39842 ); 39843 if (!isPreviewMode) { 39844 console.warn( 39845 `$compatStyle.id} was added to the iframe incorrectly. Please use block.json or enqueue_block_assets to add styles to the iframe.`, 39846 compatStyle 39847 ); 39848 } 39849 } 39850 iFrameDocument.addEventListener( 39851 "dragover", 39852 preventFileDropDefault, 39853 false 39854 ); 39855 iFrameDocument.addEventListener( 39856 "drop", 39857 preventFileDropDefault, 39858 false 39859 ); 39860 iFrameDocument.addEventListener("click", interceptLinkClicks); 39861 } 39862 node.addEventListener("load", onLoad); 39863 return () => { 39864 delete node._load; 39865 node.removeEventListener("load", onLoad); 39866 iFrameDocument?.removeEventListener( 39867 "dragover", 39868 preventFileDropDefault 39869 ); 39870 iFrameDocument?.removeEventListener( 39871 "drop", 39872 preventFileDropDefault 39873 ); 39874 iFrameDocument?.removeEventListener("click", interceptLinkClicks); 39875 }; 39876 }, []); 39877 const { 39878 contentResizeListener, 39879 containerResizeListener, 39880 isZoomedOut, 39881 scaleContainerWidth 39882 } = useScaleCanvas({ 39883 scale, 39884 frameSize: parseInt(frameSize), 39885 iframeDocument 39886 }); 39887 const disabledRef = (0,external_wp_compose_namespaceObject.useDisabled)({ isDisabled: !readonly }); 39888 const bodyRef = (0,external_wp_compose_namespaceObject.useMergeRefs)([ 39889 useBubbleEvents(iframeDocument), 39890 contentRef, 39891 clearerRef, 39892 writingFlowRef, 39893 disabledRef 39894 ]); 39895 const html = `<!doctype html> 39896 <html> 39897 <head> 39898 <meta charset="utf-8"> 39899 <base href="$window.location.origin}"> 39900 <script>window.frameElement._load()</script> 39901 <style> 39902 html{ 39903 height: auto !important; 39904 min-height: 100%; 39905 } 39906 /* Lowest specificity to not override global styles */ 39907 :where(body) { 39908 margin: 0; 39909 /* Default background color in case zoom out mode background 39910 colors the html element */ 39911 background-color: white; 39912 } 39913 </style> 39914 $styles} 39915 $scripts} 39916 </head> 39917 <body> 39918 <script>document.currentScript.parentElement.remove()</script> 39919 </body> 39920 </html>`; 39921 const [src, cleanup] = (0,external_wp_element_namespaceObject.useMemo)(() => { 39922 const _src = URL.createObjectURL( 39923 new window.Blob([html], { type: "text/html" }) 39924 ); 39925 return [_src, () => URL.revokeObjectURL(_src)]; 39926 }, [html]); 39927 (0,external_wp_element_namespaceObject.useEffect)(() => cleanup, [cleanup]); 39928 const shouldRenderFocusCaptureElements = tabIndex >= 0 && !isPreviewMode; 39929 const iframe = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 39930 shouldRenderFocusCaptureElements && before, 39931 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 39932 "iframe", 39933 { 39934 ...props, 39935 style: { 39936 ...props.style, 39937 height: props.style?.height, 39938 border: 0 39939 }, 39940 ref: (0,external_wp_compose_namespaceObject.useMergeRefs)([ref, setRef]), 39941 tabIndex, 39942 src, 39943 title, 39944 onKeyDown: (event) => { 39945 if (props.onKeyDown) { 39946 props.onKeyDown(event); 39947 } 39948 if (event.currentTarget.ownerDocument !== event.target.ownerDocument) { 39949 const { stopPropagation } = event.nativeEvent; 39950 event.nativeEvent.stopPropagation = () => { 39951 }; 39952 event.stopPropagation(); 39953 event.nativeEvent.stopPropagation = stopPropagation; 39954 bubbleEvent( 39955 event, 39956 window.KeyboardEvent, 39957 event.currentTarget 39958 ); 39959 } 39960 }, 39961 children: iframeDocument && (0,external_wp_element_namespaceObject.createPortal)( 39962 // We want to prevent React events from bubbling through the iframe 39963 // we bubble these manually. 39964 /* eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions */ 39965 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 39966 "body", 39967 { 39968 ref: bodyRef, 39969 className: dist_clsx( 39970 "block-editor-iframe__body", 39971 "editor-styles-wrapper", 39972 ...bodyClasses 39973 ), 39974 children: [ 39975 contentResizeListener, 39976 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalStyleProvider, { document: iframeDocument, children }) 39977 ] 39978 } 39979 ), 39980 iframeDocument.documentElement 39981 ) 39982 } 39983 ), 39984 shouldRenderFocusCaptureElements && after 39985 ] }); 39986 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-editor-iframe__container", children: [ 39987 containerResizeListener, 39988 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 39989 "div", 39990 { 39991 className: dist_clsx( 39992 "block-editor-iframe__scale-container", 39993 isZoomedOut && "is-zoomed-out" 39994 ), 39995 style: { 39996 "--wp-block-editor-iframe-zoom-out-scale-container-width": isZoomedOut && `$scaleContainerWidth}px` 39997 }, 39998 children: iframe 39999 } 40000 ) 40001 ] }); 40002 } 40003 function IframeIfReady(props, ref) { 40004 const isInitialised = (0,external_wp_data_namespaceObject.useSelect)( 40005 (select) => select(store).getSettings().__internalIsInitialized, 40006 [] 40007 ); 40008 if (!isInitialised) { 40009 return null; 40010 } 40011 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Iframe, { ...props, forwardedRef: ref }); 40012 } 40013 var iframe_default = (0,external_wp_element_namespaceObject.forwardRef)(IframeIfReady); 40014 40015 40016 ;// ./node_modules/parsel-js/dist/parsel.js 40017 const TOKENS = { 40018 attribute: /\[\s*(?:(?<namespace>\*|[-\w\P{ASCII}]*)\|)?(?<name>[-\w\P{ASCII}]+)\s*(?:(?<operator>\W?=)\s*(?<value>.+?)\s*(\s(?<caseSensitive>[iIsS]))?\s*)?\]/gu, 40019 id: /#(?<name>[-\w\P{ASCII}]+)/gu, 40020 class: /\.(?<name>[-\w\P{ASCII}]+)/gu, 40021 comma: /\s*,\s*/g, 40022 combinator: /\s*[\s>+~]\s*/g, 40023 'pseudo-element': /::(?<name>[-\w\P{ASCII}]+)(?:\((?<argument>¶*)\))?/gu, 40024 'pseudo-class': /:(?<name>[-\w\P{ASCII}]+)(?:\((?<argument>¶*)\))?/gu, 40025 universal: /(?:(?<namespace>\*|[-\w\P{ASCII}]*)\|)?\*/gu, 40026 type: /(?:(?<namespace>\*|[-\w\P{ASCII}]*)\|)?(?<name>[-\w\P{ASCII}]+)/gu, // this must be last 40027 }; 40028 const TRIM_TOKENS = new Set(['combinator', 'comma']); 40029 const RECURSIVE_PSEUDO_CLASSES = new Set([ 40030 'not', 40031 'is', 40032 'where', 40033 'has', 40034 'matches', 40035 '-moz-any', 40036 '-webkit-any', 40037 'nth-child', 40038 'nth-last-child', 40039 ]); 40040 const nthChildRegExp = /(?<index>[\dn+-]+)\s+of\s+(?<subtree>.+)/; 40041 const RECURSIVE_PSEUDO_CLASSES_ARGS = { 40042 'nth-child': nthChildRegExp, 40043 'nth-last-child': nthChildRegExp, 40044 }; 40045 const getArgumentPatternByType = (type) => { 40046 switch (type) { 40047 case 'pseudo-element': 40048 case 'pseudo-class': 40049 return new RegExp(TOKENS[type].source.replace('(?<argument>¶*)', '(?<argument>.*)'), 'gu'); 40050 default: 40051 return TOKENS[type]; 40052 } 40053 }; 40054 function gobbleParens(text, offset) { 40055 let nesting = 0; 40056 let result = ''; 40057 for (; offset < text.length; offset++) { 40058 const char = text[offset]; 40059 switch (char) { 40060 case '(': 40061 ++nesting; 40062 break; 40063 case ')': 40064 --nesting; 40065 break; 40066 } 40067 result += char; 40068 if (nesting === 0) { 40069 return result; 40070 } 40071 } 40072 return result; 40073 } 40074 function tokenizeBy(text, grammar = TOKENS) { 40075 if (!text) { 40076 return []; 40077 } 40078 const tokens = [text]; 40079 for (const [type, pattern] of Object.entries(grammar)) { 40080 for (let i = 0; i < tokens.length; i++) { 40081 const token = tokens[i]; 40082 if (typeof token !== 'string') { 40083 continue; 40084 } 40085 pattern.lastIndex = 0; 40086 const match = pattern.exec(token); 40087 if (!match) { 40088 continue; 40089 } 40090 const from = match.index - 1; 40091 const args = []; 40092 const content = match[0]; 40093 const before = token.slice(0, from + 1); 40094 if (before) { 40095 args.push(before); 40096 } 40097 args.push({ 40098 ...match.groups, 40099 type, 40100 content, 40101 }); 40102 const after = token.slice(from + content.length + 1); 40103 if (after) { 40104 args.push(after); 40105 } 40106 tokens.splice(i, 1, ...args); 40107 } 40108 } 40109 let offset = 0; 40110 for (const token of tokens) { 40111 switch (typeof token) { 40112 case 'string': 40113 throw new Error(`Unexpected sequence $token} found at index $offset}`); 40114 case 'object': 40115 offset += token.content.length; 40116 token.pos = [offset - token.content.length, offset]; 40117 if (TRIM_TOKENS.has(token.type)) { 40118 token.content = token.content.trim() || ' '; 40119 } 40120 break; 40121 } 40122 } 40123 return tokens; 40124 } 40125 const STRING_PATTERN = /(['"])([^\\\n]+?)\1/g; 40126 const ESCAPE_PATTERN = /\\./g; 40127 function parsel_tokenize(selector, grammar = TOKENS) { 40128 // Prevent leading/trailing whitespaces from being interpreted as combinators 40129 selector = selector.trim(); 40130 if (selector === '') { 40131 return []; 40132 } 40133 const replacements = []; 40134 // Replace escapes with placeholders. 40135 selector = selector.replace(ESCAPE_PATTERN, (value, offset) => { 40136 replacements.push({ value, offset }); 40137 return '\uE000'.repeat(value.length); 40138 }); 40139 // Replace strings with placeholders. 40140 selector = selector.replace(STRING_PATTERN, (value, quote, content, offset) => { 40141 replacements.push({ value, offset }); 40142 return `$quote}${'\uE001'.repeat(content.length)}$quote}`; 40143 }); 40144 // Replace parentheses with placeholders. 40145 { 40146 let pos = 0; 40147 let offset; 40148 while ((offset = selector.indexOf('(', pos)) > -1) { 40149 const value = gobbleParens(selector, offset); 40150 replacements.push({ value, offset }); 40151 selector = `$selector.substring(0, offset)}(${'¶'.repeat(value.length - 2)})$selector.substring(offset + value.length)}`; 40152 pos = offset + value.length; 40153 } 40154 } 40155 // Now we have no nested structures and we can parse with regexes 40156 const tokens = tokenizeBy(selector, grammar); 40157 // Replace placeholders in reverse order. 40158 const changedTokens = new Set(); 40159 for (const replacement of replacements.reverse()) { 40160 for (const token of tokens) { 40161 const { offset, value } = replacement; 40162 if (!(token.pos[0] <= offset && 40163 offset + value.length <= token.pos[1])) { 40164 continue; 40165 } 40166 const { content } = token; 40167 const tokenOffset = offset - token.pos[0]; 40168 token.content = 40169 content.slice(0, tokenOffset) + 40170 value + 40171 content.slice(tokenOffset + value.length); 40172 if (token.content !== content) { 40173 changedTokens.add(token); 40174 } 40175 } 40176 } 40177 // Update changed tokens. 40178 for (const token of changedTokens) { 40179 const pattern = getArgumentPatternByType(token.type); 40180 if (!pattern) { 40181 throw new Error(`Unknown token type: $token.type}`); 40182 } 40183 pattern.lastIndex = 0; 40184 const match = pattern.exec(token.content); 40185 if (!match) { 40186 throw new Error(`Unable to parse content for $token.type}: $token.content}`); 40187 } 40188 Object.assign(token, match.groups); 40189 } 40190 return tokens; 40191 } 40192 /** 40193 * Convert a flat list of tokens into a tree of complex & compound selectors 40194 */ 40195 function nestTokens(tokens, { list = true } = {}) { 40196 if (list && tokens.find((t) => t.type === 'comma')) { 40197 const selectors = []; 40198 const temp = []; 40199 for (let i = 0; i < tokens.length; i++) { 40200 if (tokens[i].type === 'comma') { 40201 if (temp.length === 0) { 40202 throw new Error('Incorrect comma at ' + i); 40203 } 40204 selectors.push(nestTokens(temp, { list: false })); 40205 temp.length = 0; 40206 } 40207 else { 40208 temp.push(tokens[i]); 40209 } 40210 } 40211 if (temp.length === 0) { 40212 throw new Error('Trailing comma'); 40213 } 40214 else { 40215 selectors.push(nestTokens(temp, { list: false })); 40216 } 40217 return { type: 'list', list: selectors }; 40218 } 40219 for (let i = tokens.length - 1; i >= 0; i--) { 40220 let token = tokens[i]; 40221 if (token.type === 'combinator') { 40222 let left = tokens.slice(0, i); 40223 let right = tokens.slice(i + 1); 40224 return { 40225 type: 'complex', 40226 combinator: token.content, 40227 left: nestTokens(left), 40228 right: nestTokens(right), 40229 }; 40230 } 40231 } 40232 switch (tokens.length) { 40233 case 0: 40234 throw new Error('Could not build AST.'); 40235 case 1: 40236 // If we're here, there are no combinators, so it's just a list. 40237 return tokens[0]; 40238 default: 40239 return { 40240 type: 'compound', 40241 list: [...tokens], // clone to avoid pointers messing up the AST 40242 }; 40243 } 40244 } 40245 /** 40246 * Traverse an AST in depth-first order 40247 */ 40248 function* flatten(node, 40249 /** 40250 * @internal 40251 */ 40252 parent) { 40253 switch (node.type) { 40254 case 'list': 40255 for (let child of node.list) { 40256 yield* flatten(child, node); 40257 } 40258 break; 40259 case 'complex': 40260 yield* flatten(node.left, node); 40261 yield* flatten(node.right, node); 40262 break; 40263 case 'compound': 40264 yield* node.list.map((token) => [token, node]); 40265 break; 40266 default: 40267 yield [node, parent]; 40268 } 40269 } 40270 /** 40271 * Traverse an AST (or part thereof), in depth-first order 40272 */ 40273 function walk(node, visit, 40274 /** 40275 * @internal 40276 */ 40277 parent) { 40278 if (!node) { 40279 return; 40280 } 40281 for (const [token, ast] of flatten(node, parent)) { 40282 visit(token, ast); 40283 } 40284 } 40285 /** 40286 * Parse a CSS selector 40287 * 40288 * @param selector - The selector to parse 40289 * @param options.recursive - Whether to parse the arguments of pseudo-classes like :is(), :has() etc. Defaults to true. 40290 * @param options.list - Whether this can be a selector list (A, B, C etc). Defaults to true. 40291 */ 40292 function parse(selector, { recursive = true, list = true } = {}) { 40293 const tokens = parsel_tokenize(selector); 40294 if (!tokens) { 40295 return; 40296 } 40297 const ast = nestTokens(tokens, { list }); 40298 if (!recursive) { 40299 return ast; 40300 } 40301 for (const [token] of flatten(ast)) { 40302 if (token.type !== 'pseudo-class' || !token.argument) { 40303 continue; 40304 } 40305 if (!RECURSIVE_PSEUDO_CLASSES.has(token.name)) { 40306 continue; 40307 } 40308 let argument = token.argument; 40309 const childArg = RECURSIVE_PSEUDO_CLASSES_ARGS[token.name]; 40310 if (childArg) { 40311 const match = childArg.exec(argument); 40312 if (!match) { 40313 continue; 40314 } 40315 Object.assign(token, match.groups); 40316 argument = match.groups['subtree']; 40317 } 40318 if (!argument) { 40319 continue; 40320 } 40321 Object.assign(token, { 40322 subtree: parse(argument, { 40323 recursive: true, 40324 list: true, 40325 }), 40326 }); 40327 } 40328 return ast; 40329 } 40330 /** 40331 * Converts the given list or (sub)tree to a string. 40332 */ 40333 function parsel_stringify(listOrNode) { 40334 let tokens; 40335 if (Array.isArray(listOrNode)) { 40336 tokens = listOrNode; 40337 } 40338 else { 40339 tokens = [...flatten(listOrNode)].map(([token]) => token); 40340 } 40341 return tokens.map(token => token.content).join(''); 40342 } 40343 /** 40344 * To convert the specificity array to a number 40345 */ 40346 function specificityToNumber(specificity, base) { 40347 base = base || Math.max(...specificity) + 1; 40348 return (specificity[0] * (base << 1) + specificity[1] * base + specificity[2]); 40349 } 40350 /** 40351 * Calculate specificity of a selector. 40352 * 40353 * If the selector is a list, the max specificity is returned. 40354 */ 40355 function specificity(selector) { 40356 let ast = selector; 40357 if (typeof ast === 'string') { 40358 ast = parse(ast, { recursive: true }); 40359 } 40360 if (!ast) { 40361 return []; 40362 } 40363 if (ast.type === 'list' && 'list' in ast) { 40364 let base = 10; 40365 const specificities = ast.list.map((ast) => { 40366 const sp = specificity(ast); 40367 base = Math.max(base, ...specificity(ast)); 40368 return sp; 40369 }); 40370 const numbers = specificities.map((ast) => specificityToNumber(ast, base)); 40371 return specificities[numbers.indexOf(Math.max(...numbers))]; 40372 } 40373 const ret = [0, 0, 0]; 40374 for (const [token] of flatten(ast)) { 40375 switch (token.type) { 40376 case 'id': 40377 ret[0]++; 40378 break; 40379 case 'class': 40380 case 'attribute': 40381 ret[1]++; 40382 break; 40383 case 'pseudo-element': 40384 case 'type': 40385 ret[2]++; 40386 break; 40387 case 'pseudo-class': 40388 if (token.name === 'where') { 40389 break; 40390 } 40391 if (!RECURSIVE_PSEUDO_CLASSES.has(token.name) || 40392 !token.subtree) { 40393 ret[1]++; 40394 break; 40395 } 40396 const sub = specificity(token.subtree); 40397 sub.forEach((s, i) => (ret[i] += s)); 40398 // :nth-child() & :nth-last-child() add (0, 1, 0) to the specificity of their most complex selector 40399 if (token.name === 'nth-child' || 40400 token.name === 'nth-last-child') { 40401 ret[1]++; 40402 } 40403 } 40404 } 40405 return ret; 40406 } 40407 40408 40409 40410 // EXTERNAL MODULE: ./node_modules/postcss/lib/processor.js 40411 var processor = __webpack_require__(9656); 40412 var processor_default = /*#__PURE__*/__webpack_require__.n(processor); 40413 // EXTERNAL MODULE: ./node_modules/postcss/lib/css-syntax-error.js 40414 var css_syntax_error = __webpack_require__(356); 40415 var css_syntax_error_default = /*#__PURE__*/__webpack_require__.n(css_syntax_error); 40416 // EXTERNAL MODULE: ./node_modules/postcss-prefix-selector/index.js 40417 var postcss_prefix_selector = __webpack_require__(1443); 40418 var postcss_prefix_selector_default = /*#__PURE__*/__webpack_require__.n(postcss_prefix_selector); 40419 // EXTERNAL MODULE: ./node_modules/postcss-urlrebase/index.js 40420 var postcss_urlrebase = __webpack_require__(5404); 40421 var postcss_urlrebase_default = /*#__PURE__*/__webpack_require__.n(postcss_urlrebase); 40422 ;// ./node_modules/@wordpress/block-editor/build-module/utils/transform-styles/index.js 40423 40424 40425 40426 40427 40428 const cacheByWrapperSelector = /* @__PURE__ */ new Map(); 40429 const ROOT_SELECTOR_TOKENS = [ 40430 { type: "type", content: "body" }, 40431 { type: "type", content: "html" }, 40432 { type: "pseudo-class", content: ":root" }, 40433 { type: "pseudo-class", content: ":where(body)" }, 40434 { type: "pseudo-class", content: ":where(:root)" }, 40435 { type: "pseudo-class", content: ":where(html)" } 40436 ]; 40437 function prefixRootSelector(prefix, selector) { 40438 const tokenized = parsel_tokenize(selector); 40439 const lastRootIndex = tokenized.findLastIndex(({ content, type }) => { 40440 return ROOT_SELECTOR_TOKENS.some( 40441 (rootSelector) => content === rootSelector.content && type === rootSelector.type 40442 ); 40443 }); 40444 let insertionPoint = -1; 40445 for (let i = lastRootIndex + 1; i < tokenized.length; i++) { 40446 if (tokenized[i].type === "combinator") { 40447 insertionPoint = i; 40448 break; 40449 } 40450 } 40451 const tokenizedPrefix = parsel_tokenize(prefix); 40452 tokenized.splice( 40453 // Insert at the insertion point, or the end. 40454 insertionPoint === -1 ? tokenized.length : insertionPoint, 40455 0, 40456 { 40457 type: "combinator", 40458 content: " " 40459 }, 40460 ...tokenizedPrefix 40461 ); 40462 return parsel_stringify(tokenized); 40463 } 40464 function transformStyle({ css, ignoredSelectors = [], baseURL }, wrapperSelector = "", transformOptions) { 40465 if (!wrapperSelector && !baseURL) { 40466 return css; 40467 } 40468 try { 40469 const excludedSelectors = [ 40470 ...ignoredSelectors, 40471 ...transformOptions?.ignoredSelectors ?? [], 40472 wrapperSelector 40473 ]; 40474 return new (processor_default())( 40475 [ 40476 wrapperSelector && postcss_prefix_selector_default()({ 40477 prefix: wrapperSelector, 40478 transform(prefix, selector, prefixedSelector) { 40479 if (excludedSelectors.some( 40480 (excludedSelector) => excludedSelector instanceof RegExp ? selector.match(excludedSelector) : selector.includes(excludedSelector) 40481 )) { 40482 return selector; 40483 } 40484 const hasRootSelector = ROOT_SELECTOR_TOKENS.some( 40485 (rootSelector) => selector.startsWith(rootSelector.content) 40486 ); 40487 if (hasRootSelector) { 40488 return prefixRootSelector(prefix, selector); 40489 } 40490 return prefixedSelector; 40491 } 40492 }), 40493 baseURL && postcss_urlrebase_default()({ rootUrl: baseURL }) 40494 ].filter(Boolean) 40495 ).process(css, {}).css; 40496 } catch (error) { 40497 if (error instanceof (css_syntax_error_default())) { 40498 console.warn( 40499 "wp.blockEditor.transformStyles Failed to transform CSS.", 40500 error.message + "\n" + error.showSourceCode(false) 40501 ); 40502 } else { 40503 console.warn( 40504 "wp.blockEditor.transformStyles Failed to transform CSS.", 40505 error 40506 ); 40507 } 40508 return null; 40509 } 40510 } 40511 const transform_styles_transformStyles = (styles, wrapperSelector = "", transformOptions) => { 40512 let cache = cacheByWrapperSelector.get(wrapperSelector); 40513 if (!cache) { 40514 cache = /* @__PURE__ */ new WeakMap(); 40515 cacheByWrapperSelector.set(wrapperSelector, cache); 40516 } 40517 return styles.map((style) => { 40518 let css = cache.get(style); 40519 if (!css) { 40520 css = transformStyle(style, wrapperSelector, transformOptions); 40521 cache.set(style, css); 40522 } 40523 return css; 40524 }); 40525 }; 40526 var transform_styles_default = transform_styles_transformStyles; 40527 40528 40529 ;// ./node_modules/@wordpress/block-editor/build-module/components/editor-styles/index.js 40530 40531 40532 40533 40534 40535 40536 40537 40538 40539 40540 k([names, a11y]); 40541 function useDarkThemeBodyClassName(styles, scope) { 40542 return (0,external_wp_element_namespaceObject.useCallback)( 40543 (node) => { 40544 if (!node) { 40545 return; 40546 } 40547 const { ownerDocument } = node; 40548 const { defaultView, body } = ownerDocument; 40549 const canvas = scope ? ownerDocument.querySelector(scope) : body; 40550 let backgroundColor; 40551 if (!canvas) { 40552 const tempCanvas = ownerDocument.createElement("div"); 40553 tempCanvas.classList.add("editor-styles-wrapper"); 40554 body.appendChild(tempCanvas); 40555 backgroundColor = defaultView?.getComputedStyle(tempCanvas, null).getPropertyValue("background-color"); 40556 body.removeChild(tempCanvas); 40557 } else { 40558 backgroundColor = defaultView?.getComputedStyle(canvas, null).getPropertyValue("background-color"); 40559 } 40560 const colordBackgroundColor = w(backgroundColor); 40561 if (colordBackgroundColor.luminance() > 0.5 || colordBackgroundColor.alpha() === 0) { 40562 body.classList.remove("is-dark-theme"); 40563 } else { 40564 body.classList.add("is-dark-theme"); 40565 } 40566 }, 40567 [styles, scope] 40568 ); 40569 } 40570 function EditorStyles({ styles, scope, transformOptions }) { 40571 const overrides = (0,external_wp_data_namespaceObject.useSelect)( 40572 (select) => unlock(select(store)).getStyleOverrides(), 40573 [] 40574 ); 40575 const [transformedStyles, transformedSvgs] = (0,external_wp_element_namespaceObject.useMemo)(() => { 40576 const _styles = Object.values(styles ?? []); 40577 for (const [id, override] of overrides) { 40578 const index = _styles.findIndex(({ id: _id }) => id === _id); 40579 const overrideWithId = { ...override, id }; 40580 if (index === -1) { 40581 _styles.push(overrideWithId); 40582 } else { 40583 _styles[index] = overrideWithId; 40584 } 40585 } 40586 return [ 40587 transform_styles_default( 40588 _styles.filter((style) => style?.css), 40589 scope, 40590 transformOptions 40591 ), 40592 _styles.filter((style) => style.__unstableType === "svgs").map((style) => style.assets).join("") 40593 ]; 40594 }, [styles, overrides, scope, transformOptions]); 40595 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 40596 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 40597 "style", 40598 { 40599 ref: useDarkThemeBodyClassName(transformedStyles, scope) 40600 } 40601 ), 40602 transformedStyles.map((css, index) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("style", { children: css }, index)), 40603 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 40604 external_wp_components_namespaceObject.SVG, 40605 { 40606 xmlns: "http://www.w3.org/2000/svg", 40607 viewBox: "0 0 0 0", 40608 width: "0", 40609 height: "0", 40610 role: "none", 40611 style: { 40612 visibility: "hidden", 40613 position: "absolute", 40614 left: "-9999px", 40615 overflow: "hidden" 40616 }, 40617 dangerouslySetInnerHTML: { __html: transformedSvgs } 40618 } 40619 ) 40620 ] }); 40621 } 40622 var editor_styles_default = (0,external_wp_element_namespaceObject.memo)(EditorStyles); 40623 40624 40625 ;// ./node_modules/@wordpress/block-editor/build-module/components/block-preview/auto.js 40626 40627 40628 40629 40630 40631 40632 40633 40634 40635 const MemoizedBlockList = (0,external_wp_element_namespaceObject.memo)(BlockList); 40636 const MAX_HEIGHT = 2e3; 40637 const EMPTY_ADDITIONAL_STYLES = []; 40638 function ScaledBlockPreview({ 40639 viewportWidth, 40640 containerWidth, 40641 minHeight, 40642 additionalStyles = EMPTY_ADDITIONAL_STYLES 40643 }) { 40644 if (!viewportWidth) { 40645 viewportWidth = containerWidth; 40646 } 40647 const [contentResizeListener, { height: contentHeight }] = (0,external_wp_compose_namespaceObject.useResizeObserver)(); 40648 const { styles } = (0,external_wp_data_namespaceObject.useSelect)((select) => { 40649 const settings = select(store).getSettings(); 40650 return { 40651 styles: settings.styles 40652 }; 40653 }, []); 40654 const editorStyles = (0,external_wp_element_namespaceObject.useMemo)(() => { 40655 if (styles) { 40656 return [ 40657 ...styles, 40658 { 40659 css: "body{height:auto;overflow:hidden;border:none;padding:0;}", 40660 __unstableType: "presets" 40661 }, 40662 ...additionalStyles 40663 ]; 40664 } 40665 return styles; 40666 }, [styles, additionalStyles]); 40667 const scale = containerWidth / viewportWidth; 40668 const aspectRatio = contentHeight ? containerWidth / (contentHeight * scale) : 0; 40669 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 40670 external_wp_components_namespaceObject.Disabled, 40671 { 40672 className: "block-editor-block-preview__content", 40673 style: { 40674 transform: `scale($scale})`, 40675 // Using width + aspect-ratio instead of height here triggers browsers' native 40676 // handling of scrollbar's visibility. It prevents the flickering issue seen 40677 // in https://github.com/WordPress/gutenberg/issues/52027. 40678 // See https://github.com/WordPress/gutenberg/pull/52921 for more info. 40679 aspectRatio, 40680 maxHeight: contentHeight > MAX_HEIGHT ? MAX_HEIGHT * scale : void 0, 40681 minHeight 40682 }, 40683 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 40684 iframe_default, 40685 { 40686 contentRef: (0,external_wp_compose_namespaceObject.useRefEffect)((bodyElement) => { 40687 const { 40688 ownerDocument: { documentElement } 40689 } = bodyElement; 40690 documentElement.classList.add( 40691 "block-editor-block-preview__content-iframe" 40692 ); 40693 documentElement.style.position = "absolute"; 40694 documentElement.style.width = "100%"; 40695 bodyElement.style.boxSizing = "border-box"; 40696 bodyElement.style.position = "absolute"; 40697 bodyElement.style.width = "100%"; 40698 }, []), 40699 "aria-hidden": true, 40700 tabIndex: -1, 40701 style: { 40702 position: "absolute", 40703 width: viewportWidth, 40704 height: contentHeight, 40705 pointerEvents: "none", 40706 // This is a catch-all max-height for patterns. 40707 // See: https://github.com/WordPress/gutenberg/pull/38175. 40708 maxHeight: MAX_HEIGHT, 40709 minHeight: scale !== 0 && scale < 1 && minHeight ? minHeight / scale : minHeight 40710 }, 40711 children: [ 40712 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(editor_styles_default, { styles: editorStyles }), 40713 contentResizeListener, 40714 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(MemoizedBlockList, { renderAppender: false }) 40715 ] 40716 } 40717 ) 40718 } 40719 ); 40720 } 40721 function AutoBlockPreview(props) { 40722 const [containerResizeListener, { width: containerWidth }] = (0,external_wp_compose_namespaceObject.useResizeObserver)(); 40723 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 40724 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { style: { position: "relative", width: "100%", height: 0 }, children: containerResizeListener }), 40725 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-block-preview__container", children: !!containerWidth && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 40726 ScaledBlockPreview, 40727 { 40728 ...props, 40729 containerWidth 40730 } 40731 ) }) 40732 ] }); 40733 } 40734 40735 40736 ;// external ["wp","priorityQueue"] 40737 const external_wp_priorityQueue_namespaceObject = window["wp"]["priorityQueue"]; 40738 ;// ./node_modules/@wordpress/block-editor/build-module/components/block-preview/async.js 40739 40740 40741 const blockPreviewQueue = (0,external_wp_priorityQueue_namespaceObject.createQueue)(); 40742 function Async({ children, placeholder }) { 40743 const [shouldRender, setShouldRender] = (0,external_wp_element_namespaceObject.useState)(false); 40744 (0,external_wp_element_namespaceObject.useEffect)(() => { 40745 const context = {}; 40746 blockPreviewQueue.add(context, () => { 40747 (0,external_wp_element_namespaceObject.flushSync)(() => { 40748 setShouldRender(true); 40749 }); 40750 }); 40751 return () => { 40752 blockPreviewQueue.cancel(context); 40753 }; 40754 }, []); 40755 if (!shouldRender) { 40756 return placeholder; 40757 } 40758 return children; 40759 } 40760 40761 40762 ;// ./node_modules/@wordpress/block-editor/build-module/components/block-preview/index.js 40763 40764 40765 40766 40767 40768 40769 40770 40771 40772 40773 40774 40775 const block_preview_EMPTY_ADDITIONAL_STYLES = []; 40776 function BlockPreview({ 40777 blocks, 40778 viewportWidth = 1200, 40779 minHeight, 40780 additionalStyles = block_preview_EMPTY_ADDITIONAL_STYLES, 40781 // Deprecated props: 40782 __experimentalMinHeight, 40783 __experimentalPadding 40784 }) { 40785 if (__experimentalMinHeight) { 40786 minHeight = __experimentalMinHeight; 40787 external_wp_deprecated_default()("The __experimentalMinHeight prop", { 40788 since: "6.2", 40789 version: "6.4", 40790 alternative: "minHeight" 40791 }); 40792 } 40793 if (__experimentalPadding) { 40794 additionalStyles = [ 40795 ...additionalStyles, 40796 { css: `body { padding: $__experimentalPadding}px; }` } 40797 ]; 40798 external_wp_deprecated_default()("The __experimentalPadding prop of BlockPreview", { 40799 since: "6.2", 40800 version: "6.4", 40801 alternative: "additionalStyles" 40802 }); 40803 } 40804 const originalSettings = (0,external_wp_data_namespaceObject.useSelect)( 40805 (select) => select(store).getSettings(), 40806 [] 40807 ); 40808 const settings = (0,external_wp_element_namespaceObject.useMemo)( 40809 () => ({ 40810 ...originalSettings, 40811 focusMode: false, 40812 // Disable "Spotlight mode". 40813 isPreviewMode: true 40814 }), 40815 [originalSettings] 40816 ); 40817 const renderedBlocks = (0,external_wp_element_namespaceObject.useMemo)( 40818 () => Array.isArray(blocks) ? blocks : [blocks], 40819 [blocks] 40820 ); 40821 if (!blocks || blocks.length === 0) { 40822 return null; 40823 } 40824 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 40825 ExperimentalBlockEditorProvider, 40826 { 40827 value: renderedBlocks, 40828 settings, 40829 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 40830 AutoBlockPreview, 40831 { 40832 viewportWidth, 40833 minHeight, 40834 additionalStyles 40835 } 40836 ) 40837 } 40838 ); 40839 } 40840 const MemoizedBlockPreview = (0,external_wp_element_namespaceObject.memo)(BlockPreview); 40841 MemoizedBlockPreview.Async = Async; 40842 var block_preview_default = MemoizedBlockPreview; 40843 function useBlockPreview({ blocks, props = {}, layout }) { 40844 const originalSettings = (0,external_wp_data_namespaceObject.useSelect)( 40845 (select) => select(store).getSettings(), 40846 [] 40847 ); 40848 const settings = (0,external_wp_element_namespaceObject.useMemo)( 40849 () => ({ 40850 ...originalSettings, 40851 styles: void 0, 40852 // Clear styles included by the parent settings, as they are already output by the parent's EditorStyles. 40853 focusMode: false, 40854 // Disable "Spotlight mode". 40855 isPreviewMode: true 40856 }), 40857 [originalSettings] 40858 ); 40859 const disabledRef = (0,external_wp_compose_namespaceObject.useDisabled)(); 40860 const ref = (0,external_wp_compose_namespaceObject.useMergeRefs)([props.ref, disabledRef]); 40861 const renderedBlocks = (0,external_wp_element_namespaceObject.useMemo)( 40862 () => Array.isArray(blocks) ? blocks : [blocks], 40863 [blocks] 40864 ); 40865 const children = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 40866 ExperimentalBlockEditorProvider, 40867 { 40868 value: renderedBlocks, 40869 settings, 40870 children: [ 40871 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(editor_styles_default, {}), 40872 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockListItems, { renderAppender: false, layout }) 40873 ] 40874 } 40875 ); 40876 return { 40877 ...props, 40878 ref, 40879 className: dist_clsx( 40880 props.className, 40881 "block-editor-block-preview__live-content", 40882 "components-disabled" 40883 ), 40884 children: blocks?.length ? children : null 40885 }; 40886 } 40887 40888 40889 ;// ./node_modules/@wordpress/block-editor/build-module/components/inserter/preview-panel.js 40890 40891 40892 40893 40894 40895 40896 function InserterPreviewPanel({ item }) { 40897 const { name, title, icon, description, initialAttributes, example } = item; 40898 const isReusable = (0,external_wp_blocks_namespaceObject.isReusableBlock)(item); 40899 const blocks = (0,external_wp_element_namespaceObject.useMemo)(() => { 40900 if (!example) { 40901 return (0,external_wp_blocks_namespaceObject.createBlock)(name, initialAttributes); 40902 } 40903 return (0,external_wp_blocks_namespaceObject.getBlockFromExample)(name, { 40904 attributes: { 40905 ...example.attributes, 40906 ...initialAttributes 40907 }, 40908 innerBlocks: example.innerBlocks 40909 }); 40910 }, [name, example, initialAttributes]); 40911 const previewHeight = 144; 40912 const sidebarWidth = 280; 40913 const viewportWidth = example?.viewportWidth ?? 500; 40914 const scale = sidebarWidth / viewportWidth; 40915 const minHeight = scale !== 0 && scale < 1 && previewHeight ? previewHeight / scale : previewHeight; 40916 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-editor-inserter__preview-container", children: [ 40917 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-inserter__preview", children: isReusable || example ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-inserter__preview-content", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 40918 block_preview_default, 40919 { 40920 blocks, 40921 viewportWidth, 40922 minHeight: previewHeight, 40923 additionalStyles: ( 40924 //We want this CSS to be in sync with the one in BlockPreviewPanel. 40925 [ 40926 { 40927 css: ` 40928 body { 40929 padding: 24px; 40930 min-height:$Math.round(minHeight)}px; 40931 display:flex; 40932 align-items:center; 40933 } 40934 .is-root-container { width: 100%; } 40935 ` 40936 } 40937 ] 40938 ) 40939 } 40940 ) }) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-inserter__preview-content-missing", children: (0,external_wp_i18n_namespaceObject.__)("No preview available.") }) }), 40941 !isReusable && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 40942 block_card_default, 40943 { 40944 title, 40945 icon, 40946 description 40947 } 40948 ) 40949 ] }); 40950 } 40951 var preview_panel_default = InserterPreviewPanel; 40952 40953 40954 ;// ./node_modules/@wordpress/block-editor/build-module/components/inserter-listbox/item.js 40955 40956 40957 40958 function InserterListboxItem({ isFirst, as: Component, children, ...props }, ref) { 40959 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 40960 external_wp_components_namespaceObject.Composite.Item, 40961 { 40962 ref, 40963 role: "option", 40964 accessibleWhenDisabled: true, 40965 ...props, 40966 render: (htmlProps) => { 40967 const propsWithTabIndex = { 40968 ...htmlProps, 40969 tabIndex: isFirst ? 0 : htmlProps.tabIndex 40970 }; 40971 if (Component) { 40972 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Component, { ...propsWithTabIndex, children }); 40973 } 40974 if (typeof children === "function") { 40975 return children(propsWithTabIndex); 40976 } 40977 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, ...propsWithTabIndex, children }); 40978 } 40979 } 40980 ); 40981 } 40982 var item_default = (0,external_wp_element_namespaceObject.forwardRef)(InserterListboxItem); 40983 40984 40985 ;// ./node_modules/@wordpress/icons/build-module/library/drag-handle.js 40986 40987 40988 var drag_handle_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M8 7h2V5H8v2zm0 6h2v-2H8v2zm0 6h2v-2H8v2zm6-14v2h2V5h-2zm0 8h2v-2h-2v2zm0 6h2v-2h-2v2z" }) }); 40989 40990 40991 ;// ./node_modules/@wordpress/block-editor/build-module/components/block-draggable/draggable-chip.js 40992 40993 40994 40995 40996 40997 function BlockDraggableChip({ 40998 count, 40999 icon, 41000 isPattern, 41001 fadeWhenDisabled 41002 }) { 41003 const patternLabel = isPattern && (0,external_wp_i18n_namespaceObject.__)("Pattern"); 41004 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-block-draggable-chip-wrapper", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 41005 "div", 41006 { 41007 className: "block-editor-block-draggable-chip", 41008 "data-testid": "block-draggable-chip", 41009 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 41010 external_wp_components_namespaceObject.Flex, 41011 { 41012 justify: "center", 41013 className: "block-editor-block-draggable-chip__content", 41014 children: [ 41015 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: icon ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(block_icon_default, { icon }) : patternLabel || (0,external_wp_i18n_namespaceObject.sprintf)( 41016 /* translators: %d: Number of blocks. */ 41017 (0,external_wp_i18n_namespaceObject._n)("%d block", "%d blocks", count), 41018 count 41019 ) }), 41020 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(block_icon_default, { icon: drag_handle_default }) }), 41021 fadeWhenDisabled && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { className: "block-editor-block-draggable-chip__disabled", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "block-editor-block-draggable-chip__disabled-icon" }) }) 41022 ] 41023 } 41024 ) 41025 } 41026 ) }); 41027 } 41028 41029 41030 ;// ./node_modules/@wordpress/block-editor/build-module/components/inserter-draggable-blocks/index.js 41031 41032 41033 41034 41035 41036 41037 41038 41039 41040 const InserterDraggableBlocks = ({ 41041 isEnabled, 41042 blocks, 41043 icon, 41044 children, 41045 pattern 41046 }) => { 41047 const blockTypeIcon = (0,external_wp_data_namespaceObject.useSelect)( 41048 (select) => { 41049 const { getBlockType } = select(external_wp_blocks_namespaceObject.store); 41050 return blocks.length === 1 && getBlockType(blocks[0].name)?.icon; 41051 }, 41052 [blocks] 41053 ); 41054 const { startDragging, stopDragging } = unlock( 41055 (0,external_wp_data_namespaceObject.useDispatch)(store) 41056 ); 41057 const patternBlock = (0,external_wp_element_namespaceObject.useMemo)(() => { 41058 return pattern?.type === INSERTER_PATTERN_TYPES.user && pattern?.syncStatus !== "unsynced" ? [(0,external_wp_blocks_namespaceObject.createBlock)("core/block", { ref: pattern.id })] : void 0; 41059 }, [pattern?.type, pattern?.syncStatus, pattern?.id]); 41060 if (!isEnabled) { 41061 return children({ 41062 draggable: false, 41063 onDragStart: void 0, 41064 onDragEnd: void 0 41065 }); 41066 } 41067 const draggableBlocks = patternBlock ?? blocks; 41068 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 41069 external_wp_components_namespaceObject.Draggable, 41070 { 41071 __experimentalTransferDataType: "wp-blocks", 41072 transferData: { type: "inserter", blocks: draggableBlocks }, 41073 onDragStart: (event) => { 41074 startDragging(); 41075 for (const block of draggableBlocks) { 41076 const type = `wp-block:$block.name}`; 41077 event.dataTransfer.items.add("", type); 41078 } 41079 }, 41080 onDragEnd: () => { 41081 stopDragging(); 41082 }, 41083 __experimentalDragComponent: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 41084 BlockDraggableChip, 41085 { 41086 count: blocks.length, 41087 icon: icon || !pattern && blockTypeIcon, 41088 isPattern: !!pattern 41089 } 41090 ), 41091 children: ({ onDraggableStart, onDraggableEnd }) => { 41092 return children({ 41093 draggable: true, 41094 onDragStart: onDraggableStart, 41095 onDragEnd: onDraggableEnd 41096 }); 41097 } 41098 } 41099 ); 41100 }; 41101 var inserter_draggable_blocks_default = InserterDraggableBlocks; 41102 41103 41104 ;// ./node_modules/@wordpress/block-editor/build-module/components/inserter-list-item/index.js 41105 41106 41107 41108 41109 41110 41111 41112 41113 41114 function InserterListItem({ 41115 className, 41116 isFirst, 41117 item, 41118 onSelect, 41119 onHover, 41120 isDraggable, 41121 ...props 41122 }) { 41123 const isDraggingRef = (0,external_wp_element_namespaceObject.useRef)(false); 41124 const itemIconStyle = item.icon ? { 41125 backgroundColor: item.icon.background, 41126 color: item.icon.foreground 41127 } : {}; 41128 const blocks = (0,external_wp_element_namespaceObject.useMemo)( 41129 () => [ 41130 (0,external_wp_blocks_namespaceObject.createBlock)( 41131 item.name, 41132 item.initialAttributes, 41133 (0,external_wp_blocks_namespaceObject.createBlocksFromInnerBlocksTemplate)(item.innerBlocks) 41134 ) 41135 ], 41136 [item.name, item.initialAttributes, item.innerBlocks] 41137 ); 41138 const isSynced = (0,external_wp_blocks_namespaceObject.isReusableBlock)(item) && item.syncStatus !== "unsynced" || (0,external_wp_blocks_namespaceObject.isTemplatePart)(item); 41139 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 41140 inserter_draggable_blocks_default, 41141 { 41142 isEnabled: isDraggable && !item.isDisabled, 41143 blocks, 41144 icon: item.icon, 41145 children: ({ draggable, onDragStart, onDragEnd }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 41146 "div", 41147 { 41148 className: dist_clsx( 41149 "block-editor-block-types-list__list-item", 41150 { 41151 "is-synced": isSynced 41152 } 41153 ), 41154 draggable, 41155 onDragStart: (event) => { 41156 isDraggingRef.current = true; 41157 if (onDragStart) { 41158 onHover(null); 41159 onDragStart(event); 41160 } 41161 }, 41162 onDragEnd: (event) => { 41163 isDraggingRef.current = false; 41164 if (onDragEnd) { 41165 onDragEnd(event); 41166 } 41167 }, 41168 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 41169 item_default, 41170 { 41171 isFirst, 41172 className: dist_clsx( 41173 "block-editor-block-types-list__item", 41174 className 41175 ), 41176 disabled: item.isDisabled, 41177 onClick: (event) => { 41178 event.preventDefault(); 41179 onSelect( 41180 item, 41181 (0,external_wp_keycodes_namespaceObject.isAppleOS)() ? event.metaKey : event.ctrlKey 41182 ); 41183 onHover(null); 41184 }, 41185 onKeyDown: (event) => { 41186 const { keyCode } = event; 41187 if (keyCode === external_wp_keycodes_namespaceObject.ENTER) { 41188 event.preventDefault(); 41189 onSelect( 41190 item, 41191 (0,external_wp_keycodes_namespaceObject.isAppleOS)() ? event.metaKey : event.ctrlKey 41192 ); 41193 onHover(null); 41194 } 41195 }, 41196 onMouseEnter: () => { 41197 if (isDraggingRef.current) { 41198 return; 41199 } 41200 onHover(item); 41201 }, 41202 onMouseLeave: () => onHover(null), 41203 ...props, 41204 children: [ 41205 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 41206 "span", 41207 { 41208 className: "block-editor-block-types-list__item-icon", 41209 style: itemIconStyle, 41210 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(block_icon_default, { icon: item.icon, showColors: true }) 41211 } 41212 ), 41213 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "block-editor-block-types-list__item-title", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalTruncate, { numberOfLines: 3, children: item.title }) }) 41214 ] 41215 } 41216 ) 41217 } 41218 ) 41219 } 41220 ); 41221 } 41222 var inserter_list_item_default = (0,external_wp_element_namespaceObject.memo)(InserterListItem); 41223 41224 41225 ;// ./node_modules/@wordpress/block-editor/build-module/components/inserter-listbox/group.js 41226 41227 41228 41229 41230 function InserterListboxGroup(props, ref) { 41231 const [shouldSpeak, setShouldSpeak] = (0,external_wp_element_namespaceObject.useState)(false); 41232 (0,external_wp_element_namespaceObject.useEffect)(() => { 41233 if (shouldSpeak) { 41234 (0,external_wp_a11y_namespaceObject.speak)( 41235 (0,external_wp_i18n_namespaceObject.__)("Use left and right arrow keys to move through blocks") 41236 ); 41237 } 41238 }, [shouldSpeak]); 41239 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 41240 "div", 41241 { 41242 ref, 41243 role: "listbox", 41244 "aria-orientation": "horizontal", 41245 onFocus: () => { 41246 setShouldSpeak(true); 41247 }, 41248 onBlur: (event) => { 41249 const focusingOutsideGroup = !event.currentTarget.contains( 41250 event.relatedTarget 41251 ); 41252 if (focusingOutsideGroup) { 41253 setShouldSpeak(false); 41254 } 41255 }, 41256 ...props 41257 } 41258 ); 41259 } 41260 var group_default = (0,external_wp_element_namespaceObject.forwardRef)(InserterListboxGroup); 41261 41262 41263 ;// ./node_modules/@wordpress/block-editor/build-module/components/inserter-listbox/row.js 41264 41265 41266 41267 function InserterListboxRow(props, ref) { 41268 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Composite.Group, { role: "presentation", ref, ...props }); 41269 } 41270 var row_default = (0,external_wp_element_namespaceObject.forwardRef)(InserterListboxRow); 41271 41272 41273 ;// ./node_modules/@wordpress/block-editor/build-module/components/block-types-list/index.js 41274 41275 41276 41277 41278 41279 function chunk(array, size) { 41280 const chunks = []; 41281 for (let i = 0, j = array.length; i < j; i += size) { 41282 chunks.push(array.slice(i, i + size)); 41283 } 41284 return chunks; 41285 } 41286 function BlockTypesList({ 41287 items = [], 41288 onSelect, 41289 onHover = () => { 41290 }, 41291 children, 41292 label, 41293 isDraggable = true 41294 }) { 41295 const className = "block-editor-block-types-list"; 41296 const listId = (0,external_wp_compose_namespaceObject.useInstanceId)(BlockTypesList, className); 41297 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(group_default, { className, "aria-label": label, children: [ 41298 chunk(items, 3).map((row, i) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(row_default, { children: row.map((item, j) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 41299 inserter_list_item_default, 41300 { 41301 item, 41302 className: (0,external_wp_blocks_namespaceObject.getBlockMenuDefaultClassName)( 41303 item.id 41304 ), 41305 onSelect, 41306 onHover, 41307 isDraggable: isDraggable && !item.isDisabled, 41308 isFirst: i === 0 && j === 0, 41309 rowId: `$listId}-$i}` 41310 }, 41311 item.id 41312 )) }, i)), 41313 children 41314 ] }); 41315 } 41316 var block_types_list_default = BlockTypesList; 41317 41318 41319 ;// ./node_modules/@wordpress/block-editor/build-module/components/inserter/panel.js 41320 41321 41322 function InserterPanel({ title, icon, children }) { 41323 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 41324 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-editor-inserter__panel-header", children: [ 41325 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("h2", { className: "block-editor-inserter__panel-title", children: title }), 41326 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { icon }) 41327 ] }), 41328 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-inserter__panel-content", children }) 41329 ] }); 41330 } 41331 var panel_default = InserterPanel; 41332 41333 41334 ;// ./node_modules/@wordpress/block-editor/build-module/components/inserter/hooks/use-block-types-state.js 41335 41336 41337 41338 41339 41340 41341 41342 41343 const useBlockTypesState = (rootClientId, onInsert, isQuick) => { 41344 const options = (0,external_wp_element_namespaceObject.useMemo)( 41345 () => ({ [isFiltered]: !!isQuick }), 41346 [isQuick] 41347 ); 41348 const [items] = (0,external_wp_data_namespaceObject.useSelect)( 41349 (select) => [ 41350 select(store).getInserterItems( 41351 rootClientId, 41352 options 41353 ) 41354 ], 41355 [rootClientId, options] 41356 ); 41357 const { getClosestAllowedInsertionPoint } = unlock( 41358 (0,external_wp_data_namespaceObject.useSelect)(store) 41359 ); 41360 const { createErrorNotice } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); 41361 const [categories, collections] = (0,external_wp_data_namespaceObject.useSelect)((select) => { 41362 const { getCategories, getCollections } = select(external_wp_blocks_namespaceObject.store); 41363 return [getCategories(), getCollections()]; 41364 }, []); 41365 const onSelectItem = (0,external_wp_element_namespaceObject.useCallback)( 41366 ({ name, initialAttributes, innerBlocks, syncStatus, content }, shouldFocusBlock) => { 41367 const destinationClientId = getClosestAllowedInsertionPoint( 41368 name, 41369 rootClientId 41370 ); 41371 if (destinationClientId === null) { 41372 const title = (0,external_wp_blocks_namespaceObject.getBlockType)(name)?.title ?? name; 41373 createErrorNotice( 41374 (0,external_wp_i18n_namespaceObject.sprintf)( 41375 /* translators: %s: block pattern title. */ 41376 (0,external_wp_i18n_namespaceObject.__)(`Block "%s" can't be inserted.`), 41377 title 41378 ), 41379 { 41380 type: "snackbar", 41381 id: "inserter-notice" 41382 } 41383 ); 41384 return; 41385 } 41386 const insertedBlock = syncStatus === "unsynced" ? (0,external_wp_blocks_namespaceObject.parse)(content, { 41387 __unstableSkipMigrationLogs: true 41388 }) : (0,external_wp_blocks_namespaceObject.createBlock)( 41389 name, 41390 initialAttributes, 41391 (0,external_wp_blocks_namespaceObject.createBlocksFromInnerBlocksTemplate)(innerBlocks) 41392 ); 41393 onInsert( 41394 insertedBlock, 41395 void 0, 41396 shouldFocusBlock, 41397 destinationClientId 41398 ); 41399 }, 41400 [ 41401 getClosestAllowedInsertionPoint, 41402 rootClientId, 41403 onInsert, 41404 createErrorNotice 41405 ] 41406 ); 41407 return [items, categories, collections, onSelectItem]; 41408 }; 41409 var use_block_types_state_default = useBlockTypesState; 41410 41411 41412 ;// ./node_modules/@wordpress/block-editor/build-module/components/inserter-listbox/index.js 41413 41414 41415 41416 41417 41418 41419 function InserterListBoxWrapper({ key, children }) { 41420 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_element_namespaceObject.Fragment, { children }, key); 41421 } 41422 function InserterListbox({ children }) { 41423 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 41424 external_wp_components_namespaceObject.Composite, 41425 { 41426 focusShift: true, 41427 focusWrap: "horizontal", 41428 render: InserterListBoxWrapper, 41429 children 41430 } 41431 ); 41432 } 41433 var inserter_listbox_default = InserterListbox; 41434 41435 41436 ;// ./node_modules/@wordpress/block-editor/build-module/components/inserter/no-results.js 41437 41438 41439 function InserterNoResults() { 41440 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-inserter__no-results", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { children: (0,external_wp_i18n_namespaceObject.__)("No results found.") }) }); 41441 } 41442 var no_results_default = InserterNoResults; 41443 41444 41445 ;// ./node_modules/@wordpress/block-editor/build-module/components/inserter/block-types-tab.js 41446 41447 41448 41449 41450 41451 41452 41453 41454 41455 41456 const getBlockNamespace = (item) => item.name.split("/")[0]; 41457 const MAX_SUGGESTED_ITEMS = 6; 41458 const block_types_tab_EMPTY_ARRAY = []; 41459 function BlockTypesTabPanel({ 41460 items, 41461 collections, 41462 categories, 41463 onSelectItem, 41464 onHover, 41465 showMostUsedBlocks, 41466 className 41467 }) { 41468 const suggestedItems = (0,external_wp_element_namespaceObject.useMemo)(() => { 41469 return orderBy(items, "frecency", "desc").slice( 41470 0, 41471 MAX_SUGGESTED_ITEMS 41472 ); 41473 }, [items]); 41474 const uncategorizedItems = (0,external_wp_element_namespaceObject.useMemo)(() => { 41475 return items.filter((item) => !item.category); 41476 }, [items]); 41477 const itemsPerCollection = (0,external_wp_element_namespaceObject.useMemo)(() => { 41478 const result = { ...collections }; 41479 Object.keys(collections).forEach((namespace) => { 41480 result[namespace] = items.filter( 41481 (item) => getBlockNamespace(item) === namespace 41482 ); 41483 if (result[namespace].length === 0) { 41484 delete result[namespace]; 41485 } 41486 }); 41487 return result; 41488 }, [items, collections]); 41489 (0,external_wp_element_namespaceObject.useEffect)(() => () => onHover(null), []); 41490 const currentlyRenderedCategories = (0,external_wp_compose_namespaceObject.useAsyncList)(categories); 41491 const didRenderAllCategories = categories.length === currentlyRenderedCategories.length; 41492 const collectionEntries = (0,external_wp_element_namespaceObject.useMemo)(() => { 41493 return Object.entries(collections); 41494 }, [collections]); 41495 const currentlyRenderedCollections = (0,external_wp_compose_namespaceObject.useAsyncList)( 41496 didRenderAllCategories ? collectionEntries : block_types_tab_EMPTY_ARRAY 41497 ); 41498 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className, children: [ 41499 showMostUsedBlocks && // Only show the most used blocks if the total amount of block 41500 // is larger than 1 row, otherwise it is not so useful. 41501 items.length > 3 && !!suggestedItems.length && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(panel_default, { title: (0,external_wp_i18n_namespaceObject._x)("Most used", "blocks"), children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 41502 block_types_list_default, 41503 { 41504 items: suggestedItems, 41505 onSelect: onSelectItem, 41506 onHover, 41507 label: (0,external_wp_i18n_namespaceObject._x)("Most used", "blocks") 41508 } 41509 ) }), 41510 currentlyRenderedCategories.map((category) => { 41511 const categoryItems = items.filter( 41512 (item) => item.category === category.slug 41513 ); 41514 if (!categoryItems || !categoryItems.length) { 41515 return null; 41516 } 41517 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 41518 panel_default, 41519 { 41520 title: category.title, 41521 icon: category.icon, 41522 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 41523 block_types_list_default, 41524 { 41525 items: categoryItems, 41526 onSelect: onSelectItem, 41527 onHover, 41528 label: category.title 41529 } 41530 ) 41531 }, 41532 category.slug 41533 ); 41534 }), 41535 didRenderAllCategories && uncategorizedItems.length > 0 && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 41536 panel_default, 41537 { 41538 className: "block-editor-inserter__uncategorized-blocks-panel", 41539 title: (0,external_wp_i18n_namespaceObject.__)("Uncategorized"), 41540 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 41541 block_types_list_default, 41542 { 41543 items: uncategorizedItems, 41544 onSelect: onSelectItem, 41545 onHover, 41546 label: (0,external_wp_i18n_namespaceObject.__)("Uncategorized") 41547 } 41548 ) 41549 } 41550 ), 41551 currentlyRenderedCollections.map( 41552 ([namespace, collection]) => { 41553 const collectionItems = itemsPerCollection[namespace]; 41554 if (!collectionItems || !collectionItems.length) { 41555 return null; 41556 } 41557 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 41558 panel_default, 41559 { 41560 title: collection.title, 41561 icon: collection.icon, 41562 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 41563 block_types_list_default, 41564 { 41565 items: collectionItems, 41566 onSelect: onSelectItem, 41567 onHover, 41568 label: collection.title 41569 } 41570 ) 41571 }, 41572 namespace 41573 ); 41574 } 41575 ) 41576 ] }); 41577 } 41578 function BlockTypesTab({ rootClientId, onInsert, onHover, showMostUsedBlocks }, ref) { 41579 const [items, categories, collections, onSelectItem] = use_block_types_state_default( 41580 rootClientId, 41581 onInsert 41582 ); 41583 if (!items.length) { 41584 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(no_results_default, {}); 41585 } 41586 const itemsForCurrentRoot = []; 41587 const itemsRemaining = []; 41588 for (const item of items) { 41589 if (item.category === "reusable") { 41590 continue; 41591 } 41592 if (item.isAllowedInCurrentRoot) { 41593 itemsForCurrentRoot.push(item); 41594 } else { 41595 itemsRemaining.push(item); 41596 } 41597 } 41598 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(inserter_listbox_default, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { ref, children: [ 41599 !!itemsForCurrentRoot.length && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 41600 BlockTypesTabPanel, 41601 { 41602 items: itemsForCurrentRoot, 41603 categories, 41604 collections, 41605 onSelectItem, 41606 onHover, 41607 showMostUsedBlocks, 41608 className: "block-editor-inserter__insertable-blocks-at-selection" 41609 } 41610 ) }), 41611 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 41612 BlockTypesTabPanel, 41613 { 41614 items: itemsRemaining, 41615 categories, 41616 collections, 41617 onSelectItem, 41618 onHover, 41619 showMostUsedBlocks, 41620 className: "block-editor-inserter__all-blocks" 41621 } 41622 ) 41623 ] }) }); 41624 } 41625 var block_types_tab_default = (0,external_wp_element_namespaceObject.forwardRef)(BlockTypesTab); 41626 41627 41628 ;// ./node_modules/@wordpress/block-editor/build-module/components/inserter/block-patterns-explorer/pattern-explorer-sidebar.js 41629 41630 41631 41632 function PatternCategoriesList({ 41633 selectedCategory, 41634 patternCategories, 41635 onClickCategory 41636 }) { 41637 const baseClassName = "block-editor-block-patterns-explorer__sidebar"; 41638 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: `$baseClassName}__categories-list`, children: patternCategories.map(({ name, label }) => { 41639 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 41640 external_wp_components_namespaceObject.Button, 41641 { 41642 __next40pxDefaultSize: true, 41643 label, 41644 className: `$baseClassName}__categories-list__item`, 41645 isPressed: selectedCategory === name, 41646 onClick: () => { 41647 onClickCategory(name); 41648 }, 41649 children: label 41650 }, 41651 name 41652 ); 41653 }) }); 41654 } 41655 function PatternsExplorerSearch({ searchValue, setSearchValue }) { 41656 const baseClassName = "block-editor-block-patterns-explorer__search"; 41657 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: baseClassName, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 41658 external_wp_components_namespaceObject.SearchControl, 41659 { 41660 __nextHasNoMarginBottom: true, 41661 onChange: setSearchValue, 41662 value: searchValue, 41663 label: (0,external_wp_i18n_namespaceObject.__)("Search"), 41664 placeholder: (0,external_wp_i18n_namespaceObject.__)("Search") 41665 } 41666 ) }); 41667 } 41668 function PatternExplorerSidebar({ 41669 selectedCategory, 41670 patternCategories, 41671 onClickCategory, 41672 searchValue, 41673 setSearchValue 41674 }) { 41675 const baseClassName = "block-editor-block-patterns-explorer__sidebar"; 41676 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: baseClassName, children: [ 41677 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 41678 PatternsExplorerSearch, 41679 { 41680 searchValue, 41681 setSearchValue 41682 } 41683 ), 41684 !searchValue && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 41685 PatternCategoriesList, 41686 { 41687 selectedCategory, 41688 patternCategories, 41689 onClickCategory 41690 } 41691 ) 41692 ] }); 41693 } 41694 var pattern_explorer_sidebar_default = PatternExplorerSidebar; 41695 41696 41697 ;// ./node_modules/@wordpress/block-editor/build-module/components/block-patterns-paging/index.js 41698 41699 41700 41701 function Pagination({ 41702 currentPage, 41703 numPages, 41704 changePage, 41705 totalItems 41706 }) { 41707 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { className: "block-editor-patterns__grid-pagination-wrapper", children: [ 41708 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { variant: "muted", children: (0,external_wp_i18n_namespaceObject.sprintf)( 41709 // translators: %s: Total number of patterns. 41710 (0,external_wp_i18n_namespaceObject._n)("%s item", "%s items", totalItems), 41711 totalItems 41712 ) }), 41713 numPages > 1 && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 41714 external_wp_components_namespaceObject.__experimentalHStack, 41715 { 41716 expanded: false, 41717 spacing: 3, 41718 justify: "flex-start", 41719 className: "block-editor-patterns__grid-pagination", 41720 children: [ 41721 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 41722 external_wp_components_namespaceObject.__experimentalHStack, 41723 { 41724 expanded: false, 41725 spacing: 1, 41726 className: "block-editor-patterns__grid-pagination-previous", 41727 children: [ 41728 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 41729 external_wp_components_namespaceObject.Button, 41730 { 41731 variant: "tertiary", 41732 onClick: () => changePage(1), 41733 disabled: currentPage === 1, 41734 "aria-label": (0,external_wp_i18n_namespaceObject.__)("First page"), 41735 size: "compact", 41736 accessibleWhenDisabled: true, 41737 className: "block-editor-patterns__grid-pagination-button", 41738 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { children: "\xAB" }) 41739 } 41740 ), 41741 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 41742 external_wp_components_namespaceObject.Button, 41743 { 41744 variant: "tertiary", 41745 onClick: () => changePage(currentPage - 1), 41746 disabled: currentPage === 1, 41747 "aria-label": (0,external_wp_i18n_namespaceObject.__)("Previous page"), 41748 size: "compact", 41749 accessibleWhenDisabled: true, 41750 className: "block-editor-patterns__grid-pagination-button", 41751 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { children: "\u2039" }) 41752 } 41753 ) 41754 ] 41755 } 41756 ), 41757 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { variant: "muted", children: (0,external_wp_i18n_namespaceObject.sprintf)( 41758 // translators: 1: Current page number. 2: Total number of pages. 41759 (0,external_wp_i18n_namespaceObject._x)("%1$s of %2$s", "paging"), 41760 currentPage, 41761 numPages 41762 ) }), 41763 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 41764 external_wp_components_namespaceObject.__experimentalHStack, 41765 { 41766 expanded: false, 41767 spacing: 1, 41768 className: "block-editor-patterns__grid-pagination-next", 41769 children: [ 41770 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 41771 external_wp_components_namespaceObject.Button, 41772 { 41773 variant: "tertiary", 41774 onClick: () => changePage(currentPage + 1), 41775 disabled: currentPage === numPages, 41776 "aria-label": (0,external_wp_i18n_namespaceObject.__)("Next page"), 41777 size: "compact", 41778 accessibleWhenDisabled: true, 41779 className: "block-editor-patterns__grid-pagination-button", 41780 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { children: "\u203A" }) 41781 } 41782 ), 41783 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 41784 external_wp_components_namespaceObject.Button, 41785 { 41786 variant: "tertiary", 41787 onClick: () => changePage(numPages), 41788 disabled: currentPage === numPages, 41789 "aria-label": (0,external_wp_i18n_namespaceObject.__)("Last page"), 41790 size: "compact", 41791 accessibleWhenDisabled: true, 41792 className: "block-editor-patterns__grid-pagination-button", 41793 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { children: "\xBB" }) 41794 } 41795 ) 41796 ] 41797 } 41798 ) 41799 ] 41800 } 41801 ) 41802 ] }); 41803 } 41804 41805 41806 ;// ./node_modules/@wordpress/block-editor/build-module/components/block-patterns-list/index.js 41807 41808 41809 41810 41811 41812 41813 41814 41815 41816 41817 41818 41819 const WithToolTip = ({ showTooltip, title, children }) => { 41820 if (showTooltip) { 41821 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Tooltip, { text: title, children }); 41822 } 41823 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children }); 41824 }; 41825 function BlockPattern({ 41826 id, 41827 isDraggable, 41828 pattern, 41829 onClick, 41830 onHover, 41831 showTitlesAsTooltip, 41832 category, 41833 isSelected 41834 }) { 41835 const [isDragging, setIsDragging] = (0,external_wp_element_namespaceObject.useState)(false); 41836 const { blocks, viewportWidth } = pattern; 41837 const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(BlockPattern); 41838 const descriptionId = `block-editor-block-patterns-list__item-description-$instanceId}`; 41839 const isUserPattern = pattern.type === INSERTER_PATTERN_TYPES.user; 41840 const patternBlocks = (0,external_wp_element_namespaceObject.useMemo)(() => { 41841 if (!category || !isDraggable) { 41842 return blocks; 41843 } 41844 return (blocks ?? []).map((block) => { 41845 const clonedBlock = (0,external_wp_blocks_namespaceObject.cloneBlock)(block); 41846 if (clonedBlock.attributes.metadata?.categories?.includes( 41847 category 41848 )) { 41849 clonedBlock.attributes.metadata.categories = [category]; 41850 } 41851 return clonedBlock; 41852 }); 41853 }, [blocks, isDraggable, category]); 41854 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 41855 inserter_draggable_blocks_default, 41856 { 41857 isEnabled: isDraggable, 41858 blocks: patternBlocks, 41859 pattern, 41860 children: ({ draggable, onDragStart, onDragEnd }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 41861 "div", 41862 { 41863 className: "block-editor-block-patterns-list__list-item", 41864 draggable, 41865 onDragStart: (event) => { 41866 setIsDragging(true); 41867 if (onDragStart) { 41868 onHover?.(null); 41869 onDragStart(event); 41870 } 41871 }, 41872 onDragEnd: (event) => { 41873 setIsDragging(false); 41874 if (onDragEnd) { 41875 onDragEnd(event); 41876 } 41877 }, 41878 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 41879 WithToolTip, 41880 { 41881 showTooltip: showTitlesAsTooltip && !isUserPattern, 41882 title: pattern.title, 41883 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 41884 external_wp_components_namespaceObject.Composite.Item, 41885 { 41886 render: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 41887 "div", 41888 { 41889 role: "option", 41890 "aria-label": pattern.title, 41891 "aria-describedby": pattern.description ? descriptionId : void 0, 41892 className: dist_clsx( 41893 "block-editor-block-patterns-list__item", 41894 { 41895 "block-editor-block-patterns-list__list-item-synced": pattern.type === INSERTER_PATTERN_TYPES.user && !pattern.syncStatus, 41896 "is-selected": isSelected 41897 } 41898 ) 41899 } 41900 ), 41901 id, 41902 onClick: () => { 41903 onClick(pattern, blocks); 41904 onHover?.(null); 41905 }, 41906 onMouseEnter: () => { 41907 if (isDragging) { 41908 return; 41909 } 41910 onHover?.(pattern); 41911 }, 41912 onMouseLeave: () => onHover?.(null), 41913 children: [ 41914 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 41915 block_preview_default.Async, 41916 { 41917 placeholder: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockPatternPlaceholder, {}), 41918 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 41919 block_preview_default, 41920 { 41921 blocks, 41922 viewportWidth 41923 } 41924 ) 41925 } 41926 ), 41927 (!showTitlesAsTooltip || isUserPattern) && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 41928 external_wp_components_namespaceObject.__experimentalHStack, 41929 { 41930 className: "block-editor-patterns__pattern-details", 41931 spacing: 2, 41932 children: [ 41933 isUserPattern && !pattern.syncStatus && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-patterns__pattern-icon-wrapper", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 41934 icon_default, 41935 { 41936 className: "block-editor-patterns__pattern-icon", 41937 icon: symbol_default 41938 } 41939 ) }), 41940 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-block-patterns-list__item-title", children: pattern.title }) 41941 ] 41942 } 41943 ), 41944 !!pattern.description && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, { id: descriptionId, children: pattern.description }) 41945 ] 41946 } 41947 ) 41948 } 41949 ) 41950 } 41951 ) 41952 } 41953 ); 41954 } 41955 function BlockPatternPlaceholder() { 41956 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-block-patterns-list__item is-placeholder" }); 41957 } 41958 function BlockPatternsList({ 41959 isDraggable, 41960 blockPatterns, 41961 onHover, 41962 onClickPattern, 41963 orientation, 41964 label = (0,external_wp_i18n_namespaceObject.__)("Block patterns"), 41965 category, 41966 showTitlesAsTooltip, 41967 pagingProps 41968 }, ref) { 41969 const [activeCompositeId, setActiveCompositeId] = (0,external_wp_element_namespaceObject.useState)(void 0); 41970 const [activePattern, setActivePattern] = (0,external_wp_element_namespaceObject.useState)(null); 41971 (0,external_wp_element_namespaceObject.useEffect)(() => { 41972 const firstCompositeItemId = blockPatterns[0]?.name; 41973 setActiveCompositeId(firstCompositeItemId); 41974 }, [blockPatterns]); 41975 const handleClickPattern = (pattern, blocks) => { 41976 setActivePattern(pattern.name); 41977 onClickPattern(pattern, blocks); 41978 }; 41979 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 41980 external_wp_components_namespaceObject.Composite, 41981 { 41982 orientation, 41983 activeId: activeCompositeId, 41984 setActiveId: setActiveCompositeId, 41985 role: "listbox", 41986 className: "block-editor-block-patterns-list", 41987 "aria-label": label, 41988 ref, 41989 children: [ 41990 blockPatterns.map((pattern) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 41991 BlockPattern, 41992 { 41993 id: pattern.name, 41994 pattern, 41995 onClick: handleClickPattern, 41996 onHover, 41997 isDraggable, 41998 showTitlesAsTooltip, 41999 category, 42000 isSelected: !!activePattern && activePattern === pattern.name 42001 }, 42002 pattern.name 42003 )), 42004 pagingProps && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Pagination, { ...pagingProps }) 42005 ] 42006 } 42007 ); 42008 } 42009 var block_patterns_list_default = (0,external_wp_element_namespaceObject.forwardRef)(BlockPatternsList); 42010 42011 42012 ;// ./node_modules/@wordpress/block-editor/build-module/components/inserter/hooks/use-insertion-point.js 42013 42014 42015 42016 42017 42018 42019 42020 function getIndex({ 42021 destinationRootClientId, 42022 destinationIndex, 42023 rootClientId, 42024 registry 42025 }) { 42026 if (rootClientId === destinationRootClientId) { 42027 return destinationIndex; 42028 } 42029 const parents = [ 42030 "", 42031 ...registry.select(store).getBlockParents(destinationRootClientId), 42032 destinationRootClientId 42033 ]; 42034 const parentIndex = parents.indexOf(rootClientId); 42035 if (parentIndex !== -1) { 42036 return registry.select(store).getBlockIndex(parents[parentIndex + 1]) + 1; 42037 } 42038 return registry.select(store).getBlockOrder(rootClientId).length; 42039 } 42040 function useInsertionPoint({ 42041 rootClientId = "", 42042 insertionIndex, 42043 clientId, 42044 isAppender, 42045 onSelect, 42046 shouldFocusBlock = true, 42047 selectBlockOnInsert = true 42048 }) { 42049 const registry = (0,external_wp_data_namespaceObject.useRegistry)(); 42050 const { 42051 getSelectedBlock, 42052 getClosestAllowedInsertionPoint, 42053 isBlockInsertionPointVisible 42054 } = unlock((0,external_wp_data_namespaceObject.useSelect)(store)); 42055 const { destinationRootClientId, destinationIndex } = (0,external_wp_data_namespaceObject.useSelect)( 42056 (select) => { 42057 const { 42058 getSelectedBlockClientId, 42059 getBlockRootClientId, 42060 getBlockIndex, 42061 getBlockOrder, 42062 getInsertionPoint 42063 } = unlock(select(store)); 42064 const selectedBlockClientId = getSelectedBlockClientId(); 42065 let _destinationRootClientId = rootClientId; 42066 let _destinationIndex; 42067 const insertionPoint = getInsertionPoint(); 42068 if (insertionIndex !== void 0) { 42069 _destinationIndex = insertionIndex; 42070 } else if (insertionPoint && insertionPoint.hasOwnProperty("index")) { 42071 _destinationRootClientId = insertionPoint?.rootClientId ? insertionPoint.rootClientId : rootClientId; 42072 _destinationIndex = insertionPoint.index; 42073 } else if (clientId) { 42074 _destinationIndex = getBlockIndex(clientId); 42075 } else if (!isAppender && selectedBlockClientId) { 42076 _destinationRootClientId = getBlockRootClientId( 42077 selectedBlockClientId 42078 ); 42079 _destinationIndex = getBlockIndex(selectedBlockClientId) + 1; 42080 } else { 42081 _destinationIndex = getBlockOrder( 42082 _destinationRootClientId 42083 ).length; 42084 } 42085 return { 42086 destinationRootClientId: _destinationRootClientId, 42087 destinationIndex: _destinationIndex 42088 }; 42089 }, 42090 [rootClientId, insertionIndex, clientId, isAppender] 42091 ); 42092 const { 42093 replaceBlocks, 42094 insertBlocks, 42095 showInsertionPoint, 42096 hideInsertionPoint, 42097 setLastFocus 42098 } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store)); 42099 const onInsertBlocks = (0,external_wp_element_namespaceObject.useCallback)( 42100 (blocks, meta, shouldForceFocusBlock = false, _rootClientId) => { 42101 if (shouldForceFocusBlock || shouldFocusBlock || selectBlockOnInsert) { 42102 setLastFocus(null); 42103 } 42104 const selectedBlock = getSelectedBlock(); 42105 if (!isAppender && selectedBlock && (0,external_wp_blocks_namespaceObject.isUnmodifiedDefaultBlock)(selectedBlock, "content")) { 42106 replaceBlocks( 42107 selectedBlock.clientId, 42108 blocks, 42109 null, 42110 shouldFocusBlock || shouldForceFocusBlock ? 0 : null, 42111 meta 42112 ); 42113 } else { 42114 insertBlocks( 42115 blocks, 42116 isAppender || _rootClientId === void 0 ? destinationIndex : getIndex({ 42117 destinationRootClientId, 42118 destinationIndex, 42119 rootClientId: _rootClientId, 42120 registry 42121 }), 42122 isAppender || _rootClientId === void 0 ? destinationRootClientId : _rootClientId, 42123 selectBlockOnInsert, 42124 shouldFocusBlock || shouldForceFocusBlock ? 0 : null, 42125 meta 42126 ); 42127 } 42128 const blockLength = Array.isArray(blocks) ? blocks.length : 1; 42129 const message = (0,external_wp_i18n_namespaceObject.sprintf)( 42130 // translators: %d: the name of the block that has been added 42131 (0,external_wp_i18n_namespaceObject._n)("%d block added.", "%d blocks added.", blockLength), 42132 blockLength 42133 ); 42134 (0,external_wp_a11y_namespaceObject.speak)(message); 42135 if (onSelect) { 42136 onSelect(blocks); 42137 } 42138 }, 42139 [ 42140 isAppender, 42141 getSelectedBlock, 42142 replaceBlocks, 42143 insertBlocks, 42144 destinationRootClientId, 42145 destinationIndex, 42146 onSelect, 42147 shouldFocusBlock, 42148 selectBlockOnInsert 42149 ] 42150 ); 42151 const onToggleInsertionPoint = (0,external_wp_element_namespaceObject.useCallback)( 42152 (item) => { 42153 if (item && !isBlockInsertionPointVisible()) { 42154 const allowedDestinationRootClientId = getClosestAllowedInsertionPoint( 42155 item.name, 42156 destinationRootClientId 42157 ); 42158 if (allowedDestinationRootClientId !== null) { 42159 showInsertionPoint( 42160 allowedDestinationRootClientId, 42161 getIndex({ 42162 destinationRootClientId, 42163 destinationIndex, 42164 rootClientId: allowedDestinationRootClientId, 42165 registry 42166 }) 42167 ); 42168 } 42169 } else { 42170 hideInsertionPoint(); 42171 } 42172 }, 42173 [ 42174 getClosestAllowedInsertionPoint, 42175 isBlockInsertionPointVisible, 42176 showInsertionPoint, 42177 hideInsertionPoint, 42178 destinationRootClientId, 42179 destinationIndex 42180 ] 42181 ); 42182 return [destinationRootClientId, onInsertBlocks, onToggleInsertionPoint]; 42183 } 42184 var use_insertion_point_default = useInsertionPoint; 42185 42186 42187 ;// ./node_modules/@wordpress/block-editor/build-module/components/inserter/hooks/use-patterns-state.js 42188 42189 42190 42191 42192 42193 42194 42195 42196 42197 const usePatternsState = (onInsert, rootClientId, selectedCategory, isQuick) => { 42198 const options = (0,external_wp_element_namespaceObject.useMemo)( 42199 () => ({ [isFiltered]: !!isQuick }), 42200 [isQuick] 42201 ); 42202 const { patternCategories, patterns, userPatternCategories } = (0,external_wp_data_namespaceObject.useSelect)( 42203 (select) => { 42204 const { getSettings, __experimentalGetAllowedPatterns } = unlock( 42205 select(store) 42206 ); 42207 const { 42208 __experimentalUserPatternCategories, 42209 __experimentalBlockPatternCategories 42210 } = getSettings(); 42211 return { 42212 patterns: __experimentalGetAllowedPatterns( 42213 rootClientId, 42214 options 42215 ), 42216 userPatternCategories: __experimentalUserPatternCategories, 42217 patternCategories: __experimentalBlockPatternCategories 42218 }; 42219 }, 42220 [rootClientId, options] 42221 ); 42222 const { getClosestAllowedInsertionPointForPattern } = unlock( 42223 (0,external_wp_data_namespaceObject.useSelect)(store) 42224 ); 42225 const allCategories = (0,external_wp_element_namespaceObject.useMemo)(() => { 42226 const categories = [...patternCategories]; 42227 userPatternCategories?.forEach((userCategory) => { 42228 if (!categories.find( 42229 (existingCategory) => existingCategory.name === userCategory.name 42230 )) { 42231 categories.push(userCategory); 42232 } 42233 }); 42234 return categories; 42235 }, [patternCategories, userPatternCategories]); 42236 const { createSuccessNotice } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); 42237 const onClickPattern = (0,external_wp_element_namespaceObject.useCallback)( 42238 (pattern, blocks) => { 42239 const destinationRootClientId = isQuick ? rootClientId : getClosestAllowedInsertionPointForPattern( 42240 pattern, 42241 rootClientId 42242 ); 42243 if (destinationRootClientId === null) { 42244 return; 42245 } 42246 const patternBlocks = pattern.type === INSERTER_PATTERN_TYPES.user && pattern.syncStatus !== "unsynced" ? [(0,external_wp_blocks_namespaceObject.createBlock)("core/block", { ref: pattern.id })] : blocks; 42247 onInsert( 42248 (patternBlocks ?? []).map((block) => { 42249 const clonedBlock = (0,external_wp_blocks_namespaceObject.cloneBlock)(block); 42250 if (clonedBlock.attributes.metadata?.categories?.includes( 42251 selectedCategory 42252 )) { 42253 clonedBlock.attributes.metadata.categories = [ 42254 selectedCategory 42255 ]; 42256 } 42257 return clonedBlock; 42258 }), 42259 pattern.name, 42260 false, 42261 destinationRootClientId 42262 ); 42263 createSuccessNotice( 42264 (0,external_wp_i18n_namespaceObject.sprintf)( 42265 /* translators: %s: block pattern title. */ 42266 (0,external_wp_i18n_namespaceObject.__)('Block pattern "%s" inserted.'), 42267 pattern.title 42268 ), 42269 { 42270 type: "snackbar", 42271 id: "inserter-notice" 42272 } 42273 ); 42274 }, 42275 [ 42276 createSuccessNotice, 42277 onInsert, 42278 selectedCategory, 42279 rootClientId, 42280 getClosestAllowedInsertionPointForPattern, 42281 isQuick 42282 ] 42283 ); 42284 return [patterns, allCategories, onClickPattern]; 42285 }; 42286 var use_patterns_state_default = usePatternsState; 42287 42288 42289 // EXTERNAL MODULE: ./node_modules/remove-accents/index.js 42290 var remove_accents = __webpack_require__(9681); 42291 var remove_accents_default = /*#__PURE__*/__webpack_require__.n(remove_accents); 42292 ;// ./node_modules/lower-case/dist.es2015/index.js 42293 /** 42294 * Source: ftp://ftp.unicode.org/Public/UCD/latest/ucd/SpecialCasing.txt 42295 */ 42296 var SUPPORTED_LOCALE = { 42297 tr: { 42298 regexp: /\u0130|\u0049|\u0049\u0307/g, 42299 map: { 42300 İ: "\u0069", 42301 I: "\u0131", 42302 İ: "\u0069", 42303 }, 42304 }, 42305 az: { 42306 regexp: /\u0130/g, 42307 map: { 42308 İ: "\u0069", 42309 I: "\u0131", 42310 İ: "\u0069", 42311 }, 42312 }, 42313 lt: { 42314 regexp: /\u0049|\u004A|\u012E|\u00CC|\u00CD|\u0128/g, 42315 map: { 42316 I: "\u0069\u0307", 42317 J: "\u006A\u0307", 42318 Į: "\u012F\u0307", 42319 Ì: "\u0069\u0307\u0300", 42320 Í: "\u0069\u0307\u0301", 42321 Ĩ: "\u0069\u0307\u0303", 42322 }, 42323 }, 42324 }; 42325 /** 42326 * Localized lower case. 42327 */ 42328 function localeLowerCase(str, locale) { 42329 var lang = SUPPORTED_LOCALE[locale.toLowerCase()]; 42330 if (lang) 42331 return lowerCase(str.replace(lang.regexp, function (m) { return lang.map[m]; })); 42332 return lowerCase(str); 42333 } 42334 /** 42335 * Lower case as a function. 42336 */ 42337 function lowerCase(str) { 42338 return str.toLowerCase(); 42339 } 42340 42341 ;// ./node_modules/no-case/dist.es2015/index.js 42342 42343 // Support camel case ("camelCase" -> "camel Case" and "CAMELCase" -> "CAMEL Case"). 42344 var DEFAULT_SPLIT_REGEXP = [/([a-z0-9])([A-Z])/g, /([A-Z])([A-Z][a-z])/g]; 42345 // Remove all non-word characters. 42346 var DEFAULT_STRIP_REGEXP = /[^A-Z0-9]+/gi; 42347 /** 42348 * Normalize the string into something other libraries can manipulate easier. 42349 */ 42350 function noCase(input, options) { 42351 if (options === void 0) { options = {}; } 42352 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; 42353 var result = dist_es2015_replace(dist_es2015_replace(input, splitRegexp, "$1\0$2"), stripRegexp, "\0"); 42354 var start = 0; 42355 var end = result.length; 42356 // Trim the delimiter from around the output string. 42357 while (result.charAt(start) === "\0") 42358 start++; 42359 while (result.charAt(end - 1) === "\0") 42360 end--; 42361 // Transform each token independently. 42362 return result.slice(start, end).split("\0").map(transform).join(delimiter); 42363 } 42364 /** 42365 * Replace `re` in the input string with the replacement value. 42366 */ 42367 function dist_es2015_replace(input, re, value) { 42368 if (re instanceof RegExp) 42369 return input.replace(re, value); 42370 return re.reduce(function (input, re) { return input.replace(re, value); }, input); 42371 } 42372 42373 ;// ./node_modules/@wordpress/block-editor/build-module/components/inserter/search-items.js 42374 42375 42376 const defaultGetName = (item) => item.name || ""; 42377 const defaultGetTitle = (item) => item.title; 42378 const defaultGetDescription = (item) => item.description || ""; 42379 const defaultGetKeywords = (item) => item.keywords || []; 42380 const defaultGetCategory = (item) => item.category; 42381 const defaultGetCollection = () => null; 42382 const splitRegexp = [ 42383 /([\p{Ll}\p{Lo}\p{N}])([\p{Lu}\p{Lt}])/gu, 42384 // One lowercase or digit, followed by one uppercase. 42385 /([\p{Lu}\p{Lt}])([\p{Lu}\p{Lt}][\p{Ll}\p{Lo}])/gu 42386 // One uppercase followed by one uppercase and one lowercase. 42387 ]; 42388 const stripRegexp = new RegExp("(\\p{C}|\\p{P}|\\p{S})+", "giu"); 42389 const extractedWords = /* @__PURE__ */ new Map(); 42390 const normalizedStrings = /* @__PURE__ */ new Map(); 42391 function extractWords(input = "") { 42392 if (extractedWords.has(input)) { 42393 return extractedWords.get(input); 42394 } 42395 const result = noCase(input, { 42396 splitRegexp, 42397 stripRegexp 42398 }).split(" ").filter(Boolean); 42399 extractedWords.set(input, result); 42400 return result; 42401 } 42402 function normalizeString(input = "") { 42403 if (normalizedStrings.has(input)) { 42404 return normalizedStrings.get(input); 42405 } 42406 let result = remove_accents_default()(input); 42407 result = result.replace(/^\//, ""); 42408 result = result.toLowerCase(); 42409 normalizedStrings.set(input, result); 42410 return result; 42411 } 42412 const getNormalizedSearchTerms = (input = "") => { 42413 return extractWords(normalizeString(input)); 42414 }; 42415 const removeMatchingTerms = (unmatchedTerms, unprocessedTerms) => { 42416 return unmatchedTerms.filter( 42417 (term) => !getNormalizedSearchTerms(unprocessedTerms).some( 42418 (unprocessedTerm) => unprocessedTerm.includes(term) 42419 ) 42420 ); 42421 }; 42422 const searchBlockItems = (items, categories, collections, searchInput) => { 42423 const normalizedSearchTerms = getNormalizedSearchTerms(searchInput); 42424 if (normalizedSearchTerms.length === 0) { 42425 return items; 42426 } 42427 const config = { 42428 getCategory: (item) => categories.find(({ slug }) => slug === item.category)?.title, 42429 getCollection: (item) => collections[item.name.split("/")[0]]?.title 42430 }; 42431 return searchItems(items, searchInput, config); 42432 }; 42433 const searchItems = (items = [], searchInput = "", config = {}) => { 42434 const normalizedSearchTerms = getNormalizedSearchTerms(searchInput); 42435 if (normalizedSearchTerms.length === 0) { 42436 return items; 42437 } 42438 const rankedItems = items.map((item) => { 42439 return [item, getItemSearchRank(item, searchInput, config)]; 42440 }).filter(([, rank]) => rank > 0); 42441 rankedItems.sort(([, rank1], [, rank2]) => rank2 - rank1); 42442 return rankedItems.map(([item]) => item); 42443 }; 42444 function getItemSearchRank(item, searchTerm, config = {}) { 42445 const { 42446 getName = defaultGetName, 42447 getTitle = defaultGetTitle, 42448 getDescription = defaultGetDescription, 42449 getKeywords = defaultGetKeywords, 42450 getCategory = defaultGetCategory, 42451 getCollection = defaultGetCollection 42452 } = config; 42453 const name = getName(item); 42454 const title = getTitle(item); 42455 const description = getDescription(item); 42456 const keywords = getKeywords(item); 42457 const category = getCategory(item); 42458 const collection = getCollection(item); 42459 const normalizedSearchInput = normalizeString(searchTerm); 42460 const normalizedTitle = normalizeString(title); 42461 let rank = 0; 42462 if (normalizedSearchInput === normalizedTitle) { 42463 rank += 30; 42464 } else if (normalizedTitle.startsWith(normalizedSearchInput)) { 42465 rank += 20; 42466 } else { 42467 const terms = [ 42468 name, 42469 title, 42470 description, 42471 ...keywords, 42472 category, 42473 collection 42474 ].join(" "); 42475 const normalizedSearchTerms = extractWords(normalizedSearchInput); 42476 const unmatchedTerms = removeMatchingTerms( 42477 normalizedSearchTerms, 42478 terms 42479 ); 42480 if (unmatchedTerms.length === 0) { 42481 rank += 10; 42482 } 42483 } 42484 if (rank !== 0 && name.startsWith("core/")) { 42485 const isCoreBlockVariation = name !== item.id; 42486 rank += isCoreBlockVariation ? 1 : 2; 42487 } 42488 return rank; 42489 } 42490 42491 42492 ;// ./node_modules/@wordpress/block-editor/build-module/components/inserter/hooks/use-patterns-paging.js 42493 42494 42495 42496 const PAGE_SIZE = 20; 42497 function usePatternsPaging(currentCategoryPatterns, currentCategory, scrollContainerRef, currentFilter = "") { 42498 const [currentPage, setCurrentPage] = (0,external_wp_element_namespaceObject.useState)(1); 42499 const previousCategory = (0,external_wp_compose_namespaceObject.usePrevious)(currentCategory); 42500 const previousFilter = (0,external_wp_compose_namespaceObject.usePrevious)(currentFilter); 42501 if ((previousCategory !== currentCategory || previousFilter !== currentFilter) && currentPage !== 1) { 42502 setCurrentPage(1); 42503 } 42504 const totalItems = currentCategoryPatterns.length; 42505 const pageIndex = currentPage - 1; 42506 const categoryPatterns = (0,external_wp_element_namespaceObject.useMemo)(() => { 42507 return currentCategoryPatterns.slice( 42508 pageIndex * PAGE_SIZE, 42509 pageIndex * PAGE_SIZE + PAGE_SIZE 42510 ); 42511 }, [pageIndex, currentCategoryPatterns]); 42512 const numPages = Math.ceil(currentCategoryPatterns.length / PAGE_SIZE); 42513 const changePage = (page) => { 42514 const scrollContainer = (0,external_wp_dom_namespaceObject.getScrollContainer)( 42515 scrollContainerRef?.current 42516 ); 42517 scrollContainer?.scrollTo(0, 0); 42518 setCurrentPage(page); 42519 }; 42520 (0,external_wp_element_namespaceObject.useEffect)( 42521 function scrollToTopOnCategoryChange() { 42522 const scrollContainer = (0,external_wp_dom_namespaceObject.getScrollContainer)( 42523 scrollContainerRef?.current 42524 ); 42525 scrollContainer?.scrollTo(0, 0); 42526 }, 42527 [currentCategory, scrollContainerRef] 42528 ); 42529 return { 42530 totalItems, 42531 categoryPatterns, 42532 numPages, 42533 changePage, 42534 currentPage 42535 }; 42536 } 42537 42538 42539 ;// ./node_modules/@wordpress/block-editor/build-module/components/inserter/block-patterns-explorer/pattern-list.js 42540 42541 42542 42543 42544 42545 42546 42547 42548 42549 42550 42551 42552 42553 42554 function PatternsListHeader({ filterValue, filteredBlockPatternsLength }) { 42555 if (!filterValue) { 42556 return null; 42557 } 42558 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 42559 external_wp_components_namespaceObject.__experimentalHeading, 42560 { 42561 level: 2, 42562 lineHeight: "48px", 42563 className: "block-editor-block-patterns-explorer__search-results-count", 42564 children: (0,external_wp_i18n_namespaceObject.sprintf)( 42565 /* translators: %d: number of patterns. */ 42566 (0,external_wp_i18n_namespaceObject._n)( 42567 "%d pattern found", 42568 "%d patterns found", 42569 filteredBlockPatternsLength 42570 ), 42571 filteredBlockPatternsLength 42572 ) 42573 } 42574 ); 42575 } 42576 function PatternList({ 42577 searchValue, 42578 selectedCategory, 42579 patternCategories, 42580 rootClientId, 42581 onModalClose 42582 }) { 42583 const container = (0,external_wp_element_namespaceObject.useRef)(); 42584 const debouncedSpeak = (0,external_wp_compose_namespaceObject.useDebounce)(external_wp_a11y_namespaceObject.speak, 500); 42585 const [destinationRootClientId, onInsertBlocks] = use_insertion_point_default({ 42586 rootClientId, 42587 shouldFocusBlock: true 42588 }); 42589 const [patterns, , onClickPattern] = use_patterns_state_default( 42590 onInsertBlocks, 42591 destinationRootClientId, 42592 selectedCategory 42593 ); 42594 const registeredPatternCategories = (0,external_wp_element_namespaceObject.useMemo)( 42595 () => patternCategories.map( 42596 (patternCategory) => patternCategory.name 42597 ), 42598 [patternCategories] 42599 ); 42600 const filteredBlockPatterns = (0,external_wp_element_namespaceObject.useMemo)(() => { 42601 const filteredPatterns = patterns.filter((pattern) => { 42602 if (selectedCategory === allPatternsCategory.name) { 42603 return true; 42604 } 42605 if (selectedCategory === myPatternsCategory.name && pattern.type === INSERTER_PATTERN_TYPES.user) { 42606 return true; 42607 } 42608 if (selectedCategory === starterPatternsCategory.name && pattern.blockTypes?.includes("core/post-content")) { 42609 return true; 42610 } 42611 if (selectedCategory === "uncategorized") { 42612 const hasKnownCategory = pattern.categories?.some( 42613 (category) => registeredPatternCategories.includes(category) 42614 ) ?? false; 42615 return !pattern.categories?.length || !hasKnownCategory; 42616 } 42617 return pattern.categories?.includes(selectedCategory); 42618 }); 42619 if (!searchValue) { 42620 return filteredPatterns; 42621 } 42622 return searchItems(filteredPatterns, searchValue); 42623 }, [ 42624 searchValue, 42625 patterns, 42626 selectedCategory, 42627 registeredPatternCategories 42628 ]); 42629 (0,external_wp_element_namespaceObject.useEffect)(() => { 42630 if (!searchValue) { 42631 return; 42632 } 42633 const count = filteredBlockPatterns.length; 42634 const resultsFoundMessage = (0,external_wp_i18n_namespaceObject.sprintf)( 42635 /* translators: %d: number of results. */ 42636 (0,external_wp_i18n_namespaceObject._n)("%d result found.", "%d results found.", count), 42637 count 42638 ); 42639 debouncedSpeak(resultsFoundMessage); 42640 }, [searchValue, debouncedSpeak, filteredBlockPatterns.length]); 42641 const pagingProps = usePatternsPaging( 42642 filteredBlockPatterns, 42643 selectedCategory, 42644 container 42645 ); 42646 const [previousSearchValue, setPreviousSearchValue] = (0,external_wp_element_namespaceObject.useState)(searchValue); 42647 if (searchValue !== previousSearchValue) { 42648 setPreviousSearchValue(searchValue); 42649 pagingProps.changePage(1); 42650 } 42651 const hasItems = !!filteredBlockPatterns?.length; 42652 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 42653 "div", 42654 { 42655 className: "block-editor-block-patterns-explorer__list", 42656 ref: container, 42657 children: [ 42658 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 42659 PatternsListHeader, 42660 { 42661 filterValue: searchValue, 42662 filteredBlockPatternsLength: filteredBlockPatterns.length 42663 } 42664 ), 42665 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(inserter_listbox_default, { children: hasItems && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 42666 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 42667 block_patterns_list_default, 42668 { 42669 blockPatterns: pagingProps.categoryPatterns, 42670 onClickPattern: (pattern, blocks) => { 42671 onClickPattern(pattern, blocks); 42672 onModalClose(); 42673 }, 42674 isDraggable: false 42675 } 42676 ), 42677 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Pagination, { ...pagingProps }) 42678 ] }) }) 42679 ] 42680 } 42681 ); 42682 } 42683 var pattern_list_default = PatternList; 42684 42685 42686 ;// ./node_modules/@wordpress/block-editor/build-module/components/inserter/block-patterns-tab/use-pattern-categories.js 42687 42688 42689 42690 42691 42692 function hasRegisteredCategory(pattern, allCategories) { 42693 if (!pattern.categories || !pattern.categories.length) { 42694 return false; 42695 } 42696 return pattern.categories.some( 42697 (cat) => allCategories.some((category) => category.name === cat) 42698 ); 42699 } 42700 function usePatternCategories(rootClientId, sourceFilter = "all") { 42701 const [patterns, allCategories] = use_patterns_state_default( 42702 void 0, 42703 rootClientId 42704 ); 42705 const filteredPatterns = (0,external_wp_element_namespaceObject.useMemo)( 42706 () => sourceFilter === "all" ? patterns : patterns.filter( 42707 (pattern) => !isPatternFiltered(pattern, sourceFilter) 42708 ), 42709 [sourceFilter, patterns] 42710 ); 42711 const populatedCategories = (0,external_wp_element_namespaceObject.useMemo)(() => { 42712 const categories = allCategories.filter( 42713 (category) => filteredPatterns.some( 42714 (pattern) => pattern.categories?.includes(category.name) 42715 ) 42716 ).sort((a, b) => a.label.localeCompare(b.label)); 42717 if (filteredPatterns.some( 42718 (pattern) => !hasRegisteredCategory(pattern, allCategories) 42719 ) && !categories.find( 42720 (category) => category.name === "uncategorized" 42721 )) { 42722 categories.push({ 42723 name: "uncategorized", 42724 label: (0,external_wp_i18n_namespaceObject._x)("Uncategorized") 42725 }); 42726 } 42727 if (filteredPatterns.some( 42728 (pattern) => pattern.blockTypes?.includes("core/post-content") 42729 )) { 42730 categories.unshift(starterPatternsCategory); 42731 } 42732 if (filteredPatterns.some( 42733 (pattern) => pattern.type === INSERTER_PATTERN_TYPES.user 42734 )) { 42735 categories.unshift(myPatternsCategory); 42736 } 42737 if (filteredPatterns.length > 0) { 42738 categories.unshift({ 42739 name: allPatternsCategory.name, 42740 label: allPatternsCategory.label 42741 }); 42742 } 42743 (0,external_wp_a11y_namespaceObject.speak)( 42744 (0,external_wp_i18n_namespaceObject.sprintf)( 42745 /* translators: %d: number of categories . */ 42746 (0,external_wp_i18n_namespaceObject._n)( 42747 "%d category button displayed.", 42748 "%d category buttons displayed.", 42749 categories.length 42750 ), 42751 categories.length 42752 ) 42753 ); 42754 return categories; 42755 }, [allCategories, filteredPatterns]); 42756 return populatedCategories; 42757 } 42758 42759 42760 ;// ./node_modules/@wordpress/block-editor/build-module/components/inserter/block-patterns-explorer/index.js 42761 42762 42763 42764 42765 42766 42767 42768 function PatternsExplorer({ initialCategory, rootClientId, onModalClose }) { 42769 const [searchValue, setSearchValue] = (0,external_wp_element_namespaceObject.useState)(""); 42770 const [selectedCategory, setSelectedCategory] = (0,external_wp_element_namespaceObject.useState)( 42771 initialCategory?.name 42772 ); 42773 const patternCategories = usePatternCategories(rootClientId); 42774 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-editor-block-patterns-explorer", children: [ 42775 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 42776 pattern_explorer_sidebar_default, 42777 { 42778 selectedCategory, 42779 patternCategories, 42780 onClickCategory: setSelectedCategory, 42781 searchValue, 42782 setSearchValue 42783 } 42784 ), 42785 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 42786 pattern_list_default, 42787 { 42788 searchValue, 42789 selectedCategory, 42790 patternCategories, 42791 rootClientId, 42792 onModalClose 42793 } 42794 ) 42795 ] }); 42796 } 42797 function PatternsExplorerModal({ onModalClose, ...restProps }) { 42798 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 42799 external_wp_components_namespaceObject.Modal, 42800 { 42801 title: (0,external_wp_i18n_namespaceObject.__)("Patterns"), 42802 onRequestClose: onModalClose, 42803 isFullScreen: true, 42804 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PatternsExplorer, { onModalClose, ...restProps }) 42805 } 42806 ); 42807 } 42808 var block_patterns_explorer_default = PatternsExplorerModal; 42809 42810 42811 ;// ./node_modules/@wordpress/block-editor/build-module/components/inserter/mobile-tab-navigation.js 42812 42813 42814 42815 42816 function ScreenHeader({ title }) { 42817 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 0, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalView, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { marginBottom: 0, paddingX: 4, paddingY: 3, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { spacing: 2, children: [ 42818 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 42819 external_wp_components_namespaceObject.Navigator.BackButton, 42820 { 42821 style: ( 42822 // TODO: This style override is also used in ToolsPanelHeader. 42823 // It should be supported out-of-the-box by Button. 42824 { minWidth: 24, padding: 0 } 42825 ), 42826 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_right_default : chevron_left_default, 42827 size: "small", 42828 label: (0,external_wp_i18n_namespaceObject.__)("Back") 42829 } 42830 ), 42831 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHeading, { level: 5, children: title }) }) 42832 ] }) }) }) }); 42833 } 42834 function MobileTabNavigation({ categories, children }) { 42835 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 42836 external_wp_components_namespaceObject.Navigator, 42837 { 42838 initialPath: "/", 42839 className: "block-editor-inserter__mobile-tab-navigation", 42840 children: [ 42841 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Navigator.Screen, { path: "/", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItemGroup, { children: categories.map((category) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 42842 external_wp_components_namespaceObject.Navigator.Button, 42843 { 42844 path: `/category/$category.name}`, 42845 as: external_wp_components_namespaceObject.__experimentalItem, 42846 isAction: true, 42847 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { children: [ 42848 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexBlock, { children: category.label }), 42849 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 42850 icon_default, 42851 { 42852 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left_default : chevron_right_default 42853 } 42854 ) 42855 ] }) 42856 }, 42857 category.name 42858 )) }) }), 42859 categories.map((category) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 42860 external_wp_components_namespaceObject.Navigator.Screen, 42861 { 42862 path: `/category/$category.name}`, 42863 children: [ 42864 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ScreenHeader, { title: (0,external_wp_i18n_namespaceObject.__)("Back") }), 42865 children(category) 42866 ] 42867 }, 42868 category.name 42869 )) 42870 ] 42871 } 42872 ); 42873 } 42874 42875 42876 ;// ./node_modules/@wordpress/block-editor/build-module/components/inserter/block-patterns-tab/patterns-filter.js 42877 42878 42879 42880 42881 42882 42883 const getShouldDisableSyncFilter = (sourceFilter) => sourceFilter !== "all" && sourceFilter !== "user"; 42884 const getShouldHideSourcesFilter = (category) => { 42885 return category.name === myPatternsCategory.name; 42886 }; 42887 const PATTERN_SOURCE_MENU_OPTIONS = [ 42888 { 42889 value: "all", 42890 label: (0,external_wp_i18n_namespaceObject._x)("All", "patterns") 42891 }, 42892 { 42893 value: INSERTER_PATTERN_TYPES.directory, 42894 label: (0,external_wp_i18n_namespaceObject.__)("Pattern Directory") 42895 }, 42896 { 42897 value: INSERTER_PATTERN_TYPES.theme, 42898 label: (0,external_wp_i18n_namespaceObject.__)("Theme & Plugins") 42899 }, 42900 { 42901 value: INSERTER_PATTERN_TYPES.user, 42902 label: (0,external_wp_i18n_namespaceObject.__)("User") 42903 } 42904 ]; 42905 function PatternsFilter({ 42906 setPatternSyncFilter, 42907 setPatternSourceFilter, 42908 patternSyncFilter, 42909 patternSourceFilter, 42910 scrollContainerRef, 42911 category 42912 }) { 42913 const currentPatternSourceFilter = category.name === myPatternsCategory.name ? INSERTER_PATTERN_TYPES.user : patternSourceFilter; 42914 const shouldDisableSyncFilter = getShouldDisableSyncFilter( 42915 currentPatternSourceFilter 42916 ); 42917 const shouldHideSourcesFilter = getShouldHideSourcesFilter(category); 42918 const patternSyncMenuOptions = (0,external_wp_element_namespaceObject.useMemo)( 42919 () => [ 42920 { 42921 value: "all", 42922 label: (0,external_wp_i18n_namespaceObject._x)("All", "patterns") 42923 }, 42924 { 42925 value: INSERTER_SYNC_TYPES.full, 42926 label: (0,external_wp_i18n_namespaceObject._x)("Synced", "patterns"), 42927 disabled: shouldDisableSyncFilter 42928 }, 42929 { 42930 value: INSERTER_SYNC_TYPES.unsynced, 42931 label: (0,external_wp_i18n_namespaceObject._x)("Not synced", "patterns"), 42932 disabled: shouldDisableSyncFilter 42933 } 42934 ], 42935 [shouldDisableSyncFilter] 42936 ); 42937 function handleSetSourceFilterChange(newSourceFilter) { 42938 setPatternSourceFilter(newSourceFilter); 42939 if (getShouldDisableSyncFilter(newSourceFilter)) { 42940 setPatternSyncFilter("all"); 42941 } 42942 } 42943 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 42944 external_wp_components_namespaceObject.DropdownMenu, 42945 { 42946 popoverProps: { 42947 placement: "right-end" 42948 }, 42949 label: (0,external_wp_i18n_namespaceObject.__)("Filter patterns"), 42950 toggleProps: { size: "compact" }, 42951 icon: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 42952 icon_default, 42953 { 42954 icon: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 42955 external_wp_components_namespaceObject.SVG, 42956 { 42957 width: "24", 42958 height: "24", 42959 viewBox: "0 0 24 24", 42960 fill: "none", 42961 xmlns: "http://www.w3.org/2000/svg", 42962 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 42963 external_wp_components_namespaceObject.Path, 42964 { 42965 d: "M10 17.5H14V16H10V17.5ZM6 6V7.5H18V6H6ZM8 12.5H16V11H8V12.5Z", 42966 fill: "currentColor" 42967 } 42968 ) 42969 } 42970 ) 42971 } 42972 ), 42973 children: () => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 42974 !shouldHideSourcesFilter && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuGroup, { label: (0,external_wp_i18n_namespaceObject.__)("Source"), children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 42975 external_wp_components_namespaceObject.MenuItemsChoice, 42976 { 42977 choices: PATTERN_SOURCE_MENU_OPTIONS, 42978 onSelect: (value) => { 42979 handleSetSourceFilterChange(value); 42980 scrollContainerRef.current?.scrollTo( 42981 0, 42982 0 42983 ); 42984 }, 42985 value: currentPatternSourceFilter 42986 } 42987 ) }), 42988 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuGroup, { label: (0,external_wp_i18n_namespaceObject.__)("Type"), children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 42989 external_wp_components_namespaceObject.MenuItemsChoice, 42990 { 42991 choices: patternSyncMenuOptions, 42992 onSelect: (value) => { 42993 setPatternSyncFilter(value); 42994 scrollContainerRef.current?.scrollTo( 42995 0, 42996 0 42997 ); 42998 }, 42999 value: patternSyncFilter 43000 } 43001 ) }), 43002 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-inserter__patterns-filter-help", children: (0,external_wp_element_namespaceObject.createInterpolateElement)( 43003 (0,external_wp_i18n_namespaceObject.__)( 43004 "Patterns are available from the <Link>WordPress.org Pattern Directory</Link>, bundled in the active theme, or created by users on this site. Only patterns created on this site can be synced." 43005 ), 43006 { 43007 Link: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 43008 external_wp_components_namespaceObject.ExternalLink, 43009 { 43010 href: (0,external_wp_i18n_namespaceObject.__)( 43011 "https://wordpress.org/patterns/" 43012 ) 43013 } 43014 ) 43015 } 43016 ) }) 43017 ] }) 43018 } 43019 ) }); 43020 } 43021 43022 43023 ;// ./node_modules/@wordpress/block-editor/build-module/components/inserter/block-patterns-tab/pattern-category-previews.js 43024 43025 43026 43027 43028 43029 43030 43031 43032 43033 43034 const pattern_category_previews_noop = () => { 43035 }; 43036 function PatternCategoryPreviews({ 43037 rootClientId, 43038 onInsert, 43039 onHover = pattern_category_previews_noop, 43040 category, 43041 showTitlesAsTooltip 43042 }) { 43043 const [allPatterns, , onClickPattern] = use_patterns_state_default( 43044 onInsert, 43045 rootClientId, 43046 category?.name 43047 ); 43048 const [patternSyncFilter, setPatternSyncFilter] = (0,external_wp_element_namespaceObject.useState)("all"); 43049 const [patternSourceFilter, setPatternSourceFilter] = (0,external_wp_element_namespaceObject.useState)("all"); 43050 const availableCategories = usePatternCategories( 43051 rootClientId, 43052 patternSourceFilter 43053 ); 43054 const scrollContainerRef = (0,external_wp_element_namespaceObject.useRef)(); 43055 const currentCategoryPatterns = (0,external_wp_element_namespaceObject.useMemo)( 43056 () => allPatterns.filter((pattern) => { 43057 if (isPatternFiltered( 43058 pattern, 43059 patternSourceFilter, 43060 patternSyncFilter 43061 )) { 43062 return false; 43063 } 43064 if (category.name === allPatternsCategory.name) { 43065 return true; 43066 } 43067 if (category.name === myPatternsCategory.name && pattern.type === INSERTER_PATTERN_TYPES.user) { 43068 return true; 43069 } 43070 if (category.name === starterPatternsCategory.name && pattern.blockTypes?.includes("core/post-content")) { 43071 return true; 43072 } 43073 if (category.name === "uncategorized") { 43074 if (!pattern.categories) { 43075 return true; 43076 } 43077 return !pattern.categories.some( 43078 (catName) => availableCategories.some((c) => c.name === catName) 43079 ); 43080 } 43081 return pattern.categories?.includes(category.name); 43082 }), 43083 [ 43084 allPatterns, 43085 availableCategories, 43086 category.name, 43087 patternSourceFilter, 43088 patternSyncFilter 43089 ] 43090 ); 43091 const pagingProps = usePatternsPaging( 43092 currentCategoryPatterns, 43093 category, 43094 scrollContainerRef 43095 ); 43096 const { changePage } = pagingProps; 43097 (0,external_wp_element_namespaceObject.useEffect)(() => () => onHover(null), []); 43098 const onSetPatternSyncFilter = (0,external_wp_element_namespaceObject.useCallback)( 43099 (value) => { 43100 setPatternSyncFilter(value); 43101 changePage(1); 43102 }, 43103 [setPatternSyncFilter, changePage] 43104 ); 43105 const onSetPatternSourceFilter = (0,external_wp_element_namespaceObject.useCallback)( 43106 (value) => { 43107 setPatternSourceFilter(value); 43108 changePage(1); 43109 }, 43110 [setPatternSourceFilter, changePage] 43111 ); 43112 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 43113 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 43114 external_wp_components_namespaceObject.__experimentalVStack, 43115 { 43116 spacing: 2, 43117 className: "block-editor-inserter__patterns-category-panel-header", 43118 children: [ 43119 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { children: [ 43120 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexBlock, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 43121 external_wp_components_namespaceObject.__experimentalHeading, 43122 { 43123 className: "block-editor-inserter__patterns-category-panel-title", 43124 size: 13, 43125 level: 4, 43126 as: "div", 43127 children: category.label 43128 } 43129 ) }), 43130 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 43131 PatternsFilter, 43132 { 43133 patternSyncFilter, 43134 patternSourceFilter, 43135 setPatternSyncFilter: onSetPatternSyncFilter, 43136 setPatternSourceFilter: onSetPatternSourceFilter, 43137 scrollContainerRef, 43138 category 43139 } 43140 ) 43141 ] }), 43142 !currentCategoryPatterns.length && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 43143 external_wp_components_namespaceObject.__experimentalText, 43144 { 43145 variant: "muted", 43146 className: "block-editor-inserter__patterns-category-no-results", 43147 children: (0,external_wp_i18n_namespaceObject.__)("No results found") 43148 } 43149 ) 43150 ] 43151 } 43152 ), 43153 currentCategoryPatterns.length > 0 && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 43154 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 43155 external_wp_components_namespaceObject.__experimentalText, 43156 { 43157 size: "12", 43158 as: "p", 43159 className: "block-editor-inserter__help-text", 43160 children: (0,external_wp_i18n_namespaceObject.__)("Drag and drop patterns into the canvas.") 43161 } 43162 ), 43163 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 43164 block_patterns_list_default, 43165 { 43166 ref: scrollContainerRef, 43167 blockPatterns: pagingProps.categoryPatterns, 43168 onClickPattern, 43169 onHover, 43170 label: category.label, 43171 orientation: "vertical", 43172 category: category.name, 43173 isDraggable: true, 43174 showTitlesAsTooltip, 43175 patternFilter: patternSourceFilter, 43176 pagingProps 43177 } 43178 ) 43179 ] }) 43180 ] }); 43181 } 43182 43183 43184 ;// ./node_modules/@wordpress/block-editor/build-module/components/inserter/category-tabs/index.js 43185 43186 43187 43188 43189 43190 const { Tabs: category_tabs_Tabs } = unlock(external_wp_components_namespaceObject.privateApis); 43191 function CategoryTabs({ 43192 categories, 43193 selectedCategory, 43194 onSelectCategory, 43195 children 43196 }) { 43197 const ANIMATION_DURATION = 0.25; 43198 const disableMotion = (0,external_wp_compose_namespaceObject.useReducedMotion)(); 43199 const defaultTransition = { 43200 type: "tween", 43201 duration: disableMotion ? 0 : ANIMATION_DURATION, 43202 ease: [0.6, 0, 0.4, 1] 43203 }; 43204 const previousSelectedCategory = (0,external_wp_compose_namespaceObject.usePrevious)(selectedCategory); 43205 const selectedTabId = selectedCategory ? selectedCategory.name : null; 43206 const [activeTabId, setActiveId] = (0,external_wp_element_namespaceObject.useState)(); 43207 const firstTabId = categories?.[0]?.name; 43208 if (selectedTabId === null && !activeTabId && firstTabId) { 43209 setActiveId(firstTabId); 43210 } 43211 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 43212 category_tabs_Tabs, 43213 { 43214 selectOnMove: false, 43215 selectedTabId, 43216 orientation: "vertical", 43217 onSelect: (categoryId) => { 43218 onSelectCategory( 43219 categories.find( 43220 (category) => category.name === categoryId 43221 ) 43222 ); 43223 }, 43224 activeTabId, 43225 onActiveTabIdChange: setActiveId, 43226 children: [ 43227 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(category_tabs_Tabs.TabList, { className: "block-editor-inserter__category-tablist", children: categories.map((category) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 43228 category_tabs_Tabs.Tab, 43229 { 43230 tabId: category.name, 43231 "aria-current": category === selectedCategory ? "true" : void 0, 43232 children: category.label 43233 }, 43234 category.name 43235 )) }), 43236 categories.map((category) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 43237 category_tabs_Tabs.TabPanel, 43238 { 43239 tabId: category.name, 43240 focusable: false, 43241 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 43242 external_wp_components_namespaceObject.__unstableMotion.div, 43243 { 43244 className: "block-editor-inserter__category-panel", 43245 initial: !previousSelectedCategory ? "closed" : "open", 43246 animate: "open", 43247 variants: { 43248 open: { 43249 transform: "translateX( 0 )", 43250 transitionEnd: { 43251 zIndex: "1" 43252 } 43253 }, 43254 closed: { 43255 transform: "translateX( -100% )", 43256 zIndex: "-1" 43257 } 43258 }, 43259 transition: defaultTransition, 43260 children 43261 } 43262 ) 43263 }, 43264 category.name 43265 )) 43266 ] 43267 } 43268 ); 43269 } 43270 var category_tabs_default = CategoryTabs; 43271 43272 43273 ;// ./node_modules/@wordpress/block-editor/build-module/components/inserter/block-patterns-tab/index.js 43274 43275 43276 43277 43278 43279 43280 43281 43282 43283 43284 43285 function BlockPatternsTab({ 43286 onSelectCategory, 43287 selectedCategory, 43288 onInsert, 43289 rootClientId, 43290 children 43291 }) { 43292 const [showPatternsExplorer, setShowPatternsExplorer] = (0,external_wp_element_namespaceObject.useState)(false); 43293 const categories = usePatternCategories(rootClientId); 43294 const isMobile = (0,external_wp_compose_namespaceObject.useViewportMatch)("medium", "<"); 43295 if (!categories.length) { 43296 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(no_results_default, {}); 43297 } 43298 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 43299 !isMobile && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-editor-inserter__block-patterns-tabs-container", children: [ 43300 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 43301 category_tabs_default, 43302 { 43303 categories, 43304 selectedCategory, 43305 onSelectCategory, 43306 children 43307 } 43308 ), 43309 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 43310 external_wp_components_namespaceObject.Button, 43311 { 43312 __next40pxDefaultSize: true, 43313 className: "block-editor-inserter__patterns-explore-button", 43314 onClick: () => setShowPatternsExplorer(true), 43315 variant: "secondary", 43316 children: (0,external_wp_i18n_namespaceObject.__)("Explore all patterns") 43317 } 43318 ) 43319 ] }), 43320 isMobile && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(MobileTabNavigation, { categories, children: (category) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-inserter__category-panel", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 43321 PatternCategoryPreviews, 43322 { 43323 onInsert, 43324 rootClientId, 43325 category 43326 }, 43327 category.name 43328 ) }) }), 43329 showPatternsExplorer && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 43330 block_patterns_explorer_default, 43331 { 43332 initialCategory: selectedCategory || categories[0], 43333 patternCategories: categories, 43334 onModalClose: () => setShowPatternsExplorer(false), 43335 rootClientId 43336 } 43337 ) 43338 ] }); 43339 } 43340 var block_patterns_tab_default = BlockPatternsTab; 43341 43342 43343 ;// ./node_modules/@wordpress/icons/build-module/library/external.js 43344 43345 43346 var external_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 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" }) }); 43347 43348 43349 ;// ./node_modules/@wordpress/block-editor/build-module/components/inserter/media-tab/utils.js 43350 43351 43352 const mediaTypeTag = { image: "img", video: "video", audio: "audio" }; 43353 function getBlockAndPreviewFromMedia(media, mediaType) { 43354 const attributes = { 43355 id: media.id || void 0, 43356 caption: media.caption || void 0 43357 }; 43358 const mediaSrc = media.url; 43359 const alt = media.alt || void 0; 43360 if (mediaType === "image") { 43361 attributes.url = mediaSrc; 43362 attributes.alt = alt; 43363 } else if (["video", "audio"].includes(mediaType)) { 43364 attributes.src = mediaSrc; 43365 } 43366 const PreviewTag = mediaTypeTag[mediaType]; 43367 const preview = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 43368 PreviewTag, 43369 { 43370 src: media.previewUrl || mediaSrc, 43371 alt, 43372 controls: mediaType === "audio" ? true : void 0, 43373 inert: "true", 43374 onError: ({ currentTarget }) => { 43375 if (currentTarget.src === media.previewUrl) { 43376 currentTarget.src = mediaSrc; 43377 } 43378 } 43379 } 43380 ); 43381 return [(0,external_wp_blocks_namespaceObject.createBlock)(`core/$mediaType}`, attributes), preview]; 43382 } 43383 43384 43385 ;// ./node_modules/@wordpress/block-editor/build-module/components/inserter/media-tab/media-preview.js 43386 43387 43388 43389 43390 43391 43392 43393 43394 43395 43396 43397 43398 43399 43400 const ALLOWED_MEDIA_TYPES = ["image"]; 43401 const MEDIA_OPTIONS_POPOVER_PROPS = { 43402 placement: "bottom-end", 43403 className: "block-editor-inserter__media-list__item-preview-options__popover" 43404 }; 43405 function MediaPreviewOptions({ category, media }) { 43406 if (!category.getReportUrl) { 43407 return null; 43408 } 43409 const reportUrl = category.getReportUrl(media); 43410 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 43411 external_wp_components_namespaceObject.DropdownMenu, 43412 { 43413 className: "block-editor-inserter__media-list__item-preview-options", 43414 label: (0,external_wp_i18n_namespaceObject.__)("Options"), 43415 popoverProps: MEDIA_OPTIONS_POPOVER_PROPS, 43416 icon: more_vertical_default, 43417 children: () => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuGroup, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 43418 external_wp_components_namespaceObject.MenuItem, 43419 { 43420 onClick: () => window.open(reportUrl, "_blank").focus(), 43421 icon: external_default, 43422 children: (0,external_wp_i18n_namespaceObject.sprintf)( 43423 /* translators: %s: The media type to report e.g: "image", "video", "audio" */ 43424 (0,external_wp_i18n_namespaceObject.__)("Report %s"), 43425 category.mediaType 43426 ) 43427 } 43428 ) }) 43429 } 43430 ); 43431 } 43432 function InsertExternalImageModal({ onClose, onSubmit }) { 43433 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 43434 external_wp_components_namespaceObject.Modal, 43435 { 43436 title: (0,external_wp_i18n_namespaceObject.__)("Insert external image"), 43437 onRequestClose: onClose, 43438 className: "block-editor-inserter-media-tab-media-preview-inserter-external-image-modal", 43439 children: [ 43440 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 3, children: [ 43441 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { children: (0,external_wp_i18n_namespaceObject.__)( 43442 "This image cannot be uploaded to your Media Library, but it can still be inserted as an external image." 43443 ) }), 43444 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { children: (0,external_wp_i18n_namespaceObject.__)( 43445 "External images can be removed by the external provider without warning and could even have legal compliance issues related to privacy legislation." 43446 ) }) 43447 ] }), 43448 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 43449 external_wp_components_namespaceObject.Flex, 43450 { 43451 className: "block-editor-block-lock-modal__actions", 43452 justify: "flex-end", 43453 expanded: false, 43454 children: [ 43455 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 43456 external_wp_components_namespaceObject.Button, 43457 { 43458 __next40pxDefaultSize: true, 43459 variant: "tertiary", 43460 onClick: onClose, 43461 children: (0,external_wp_i18n_namespaceObject.__)("Cancel") 43462 } 43463 ) }), 43464 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 43465 external_wp_components_namespaceObject.Button, 43466 { 43467 __next40pxDefaultSize: true, 43468 variant: "primary", 43469 onClick: onSubmit, 43470 children: (0,external_wp_i18n_namespaceObject.__)("Insert") 43471 } 43472 ) }) 43473 ] 43474 } 43475 ) 43476 ] 43477 } 43478 ); 43479 } 43480 function MediaPreview({ media, onClick, category }) { 43481 const [showExternalUploadModal, setShowExternalUploadModal] = (0,external_wp_element_namespaceObject.useState)(false); 43482 const [isHovered, setIsHovered] = (0,external_wp_element_namespaceObject.useState)(false); 43483 const [isInserting, setIsInserting] = (0,external_wp_element_namespaceObject.useState)(false); 43484 const [block, preview] = (0,external_wp_element_namespaceObject.useMemo)( 43485 () => getBlockAndPreviewFromMedia(media, category.mediaType), 43486 [media, category.mediaType] 43487 ); 43488 const { createErrorNotice, createSuccessNotice } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); 43489 const { getSettings, getBlock } = (0,external_wp_data_namespaceObject.useSelect)(store); 43490 const { updateBlockAttributes } = (0,external_wp_data_namespaceObject.useDispatch)(store); 43491 const onMediaInsert = (0,external_wp_element_namespaceObject.useCallback)( 43492 (previewBlock) => { 43493 if (isInserting) { 43494 return; 43495 } 43496 const settings = getSettings(); 43497 const clonedBlock = (0,external_wp_blocks_namespaceObject.cloneBlock)(previewBlock); 43498 const { id, url, caption } = clonedBlock.attributes; 43499 if (!id && !settings.mediaUpload) { 43500 setShowExternalUploadModal(true); 43501 return; 43502 } 43503 if (!!id) { 43504 onClick(clonedBlock); 43505 return; 43506 } 43507 setIsInserting(true); 43508 window.fetch(url).then((response) => response.blob()).then((blob) => { 43509 const fileName = (0,external_wp_url_namespaceObject.getFilename)(url) || "image.jpg"; 43510 const file = new File([blob], fileName, { 43511 type: blob.type 43512 }); 43513 settings.mediaUpload({ 43514 filesList: [file], 43515 additionalData: { caption }, 43516 onFileChange([img]) { 43517 if ((0,external_wp_blob_namespaceObject.isBlobURL)(img.url)) { 43518 return; 43519 } 43520 if (!getBlock(clonedBlock.clientId)) { 43521 onClick({ 43522 ...clonedBlock, 43523 attributes: { 43524 ...clonedBlock.attributes, 43525 id: img.id, 43526 url: img.url 43527 } 43528 }); 43529 createSuccessNotice( 43530 (0,external_wp_i18n_namespaceObject.__)("Image uploaded and inserted."), 43531 { type: "snackbar", id: "inserter-notice" } 43532 ); 43533 } else { 43534 updateBlockAttributes(clonedBlock.clientId, { 43535 ...clonedBlock.attributes, 43536 id: img.id, 43537 url: img.url 43538 }); 43539 } 43540 setIsInserting(false); 43541 }, 43542 allowedTypes: ALLOWED_MEDIA_TYPES, 43543 onError(message) { 43544 createErrorNotice(message, { 43545 type: "snackbar", 43546 id: "inserter-notice" 43547 }); 43548 setIsInserting(false); 43549 } 43550 }); 43551 }).catch(() => { 43552 setShowExternalUploadModal(true); 43553 setIsInserting(false); 43554 }); 43555 }, 43556 [ 43557 isInserting, 43558 getSettings, 43559 onClick, 43560 createSuccessNotice, 43561 updateBlockAttributes, 43562 createErrorNotice, 43563 getBlock 43564 ] 43565 ); 43566 const title = typeof media.title === "string" ? media.title : media.title?.rendered || (0,external_wp_i18n_namespaceObject.__)("no title"); 43567 const onMouseEnter = (0,external_wp_element_namespaceObject.useCallback)(() => setIsHovered(true), []); 43568 const onMouseLeave = (0,external_wp_element_namespaceObject.useCallback)(() => setIsHovered(false), []); 43569 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 43570 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(inserter_draggable_blocks_default, { isEnabled: true, blocks: [block], children: ({ draggable, onDragStart, onDragEnd }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 43571 "div", 43572 { 43573 className: dist_clsx( 43574 "block-editor-inserter__media-list__list-item", 43575 { 43576 "is-hovered": isHovered 43577 } 43578 ), 43579 draggable, 43580 onDragStart, 43581 onDragEnd, 43582 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 43583 "div", 43584 { 43585 onMouseEnter, 43586 onMouseLeave, 43587 children: [ 43588 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Tooltip, { text: title, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 43589 external_wp_components_namespaceObject.Composite.Item, 43590 { 43591 render: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 43592 "div", 43593 { 43594 "aria-label": title, 43595 role: "option", 43596 className: "block-editor-inserter__media-list__item" 43597 } 43598 ), 43599 onClick: () => onMediaInsert(block), 43600 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-editor-inserter__media-list__item-preview", children: [ 43601 preview, 43602 isInserting && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-inserter__media-list__item-preview-spinner", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {}) }) 43603 ] }) 43604 } 43605 ) }), 43606 !isInserting && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 43607 MediaPreviewOptions, 43608 { 43609 category, 43610 media 43611 } 43612 ) 43613 ] 43614 } 43615 ) 43616 } 43617 ) }), 43618 showExternalUploadModal && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 43619 InsertExternalImageModal, 43620 { 43621 onClose: () => setShowExternalUploadModal(false), 43622 onSubmit: () => { 43623 onClick((0,external_wp_blocks_namespaceObject.cloneBlock)(block)); 43624 createSuccessNotice((0,external_wp_i18n_namespaceObject.__)("Image inserted."), { 43625 type: "snackbar", 43626 id: "inserter-notice" 43627 }); 43628 setShowExternalUploadModal(false); 43629 } 43630 } 43631 ) 43632 ] }); 43633 } 43634 43635 43636 ;// ./node_modules/@wordpress/block-editor/build-module/components/inserter/media-tab/media-list.js 43637 43638 43639 43640 43641 function MediaList({ 43642 mediaList, 43643 category, 43644 onClick, 43645 label = (0,external_wp_i18n_namespaceObject.__)("Media List") 43646 }) { 43647 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 43648 external_wp_components_namespaceObject.Composite, 43649 { 43650 role: "listbox", 43651 className: "block-editor-inserter__media-list", 43652 "aria-label": label, 43653 children: mediaList.map((media, index) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 43654 MediaPreview, 43655 { 43656 media, 43657 category, 43658 onClick 43659 }, 43660 media.id || media.sourceId || index 43661 )) 43662 } 43663 ); 43664 } 43665 var media_list_default = MediaList; 43666 43667 43668 ;// ./node_modules/@wordpress/block-editor/build-module/components/inserter/media-tab/hooks.js 43669 43670 43671 43672 43673 function useMediaResults(category, query = {}) { 43674 const [mediaList, setMediaList] = (0,external_wp_element_namespaceObject.useState)(); 43675 const [isLoading, setIsLoading] = (0,external_wp_element_namespaceObject.useState)(false); 43676 const lastRequestRef = (0,external_wp_element_namespaceObject.useRef)(); 43677 (0,external_wp_element_namespaceObject.useEffect)(() => { 43678 (async () => { 43679 const key = JSON.stringify({ 43680 category: category.name, 43681 ...query 43682 }); 43683 lastRequestRef.current = key; 43684 setIsLoading(true); 43685 setMediaList([]); 43686 const _media = await category.fetch?.(query); 43687 if (key === lastRequestRef.current) { 43688 setMediaList(_media); 43689 setIsLoading(false); 43690 } 43691 })(); 43692 }, [category.name, ...Object.values(query)]); 43693 return { mediaList, isLoading }; 43694 } 43695 function useMediaCategories(rootClientId) { 43696 const [categories, setCategories] = (0,external_wp_element_namespaceObject.useState)([]); 43697 const inserterMediaCategories = (0,external_wp_data_namespaceObject.useSelect)( 43698 (select) => unlock(select(store)).getInserterMediaCategories(), 43699 [] 43700 ); 43701 const { canInsertImage, canInsertVideo, canInsertAudio } = (0,external_wp_data_namespaceObject.useSelect)( 43702 (select) => { 43703 const { canInsertBlockType } = select(store); 43704 return { 43705 canInsertImage: canInsertBlockType( 43706 "core/image", 43707 rootClientId 43708 ), 43709 canInsertVideo: canInsertBlockType( 43710 "core/video", 43711 rootClientId 43712 ), 43713 canInsertAudio: canInsertBlockType( 43714 "core/audio", 43715 rootClientId 43716 ) 43717 }; 43718 }, 43719 [rootClientId] 43720 ); 43721 (0,external_wp_element_namespaceObject.useEffect)(() => { 43722 (async () => { 43723 const _categories = []; 43724 if (!inserterMediaCategories) { 43725 return; 43726 } 43727 const categoriesHaveMedia = new Map( 43728 await Promise.all( 43729 inserterMediaCategories.map(async (category) => { 43730 if (category.isExternalResource) { 43731 return [category.name, true]; 43732 } 43733 let results = []; 43734 try { 43735 results = await category.fetch({ 43736 per_page: 1 43737 }); 43738 } catch (e) { 43739 } 43740 return [category.name, !!results.length]; 43741 }) 43742 ) 43743 ); 43744 const canInsertMediaType = { 43745 image: canInsertImage, 43746 video: canInsertVideo, 43747 audio: canInsertAudio 43748 }; 43749 inserterMediaCategories.forEach((category) => { 43750 if (canInsertMediaType[category.mediaType] && categoriesHaveMedia.get(category.name)) { 43751 _categories.push(category); 43752 } 43753 }); 43754 if (!!_categories.length) { 43755 setCategories(_categories); 43756 } 43757 })(); 43758 }, [ 43759 canInsertImage, 43760 canInsertVideo, 43761 canInsertAudio, 43762 inserterMediaCategories 43763 ]); 43764 return categories; 43765 } 43766 43767 43768 ;// ./node_modules/@wordpress/block-editor/build-module/components/inserter/media-tab/media-panel.js 43769 43770 43771 43772 43773 43774 43775 43776 const INITIAL_MEDIA_ITEMS_PER_PAGE = 10; 43777 function MediaCategoryPanel({ rootClientId, onInsert, category }) { 43778 const [search, setSearch, debouncedSearch] = (0,external_wp_compose_namespaceObject.useDebouncedInput)(); 43779 const { mediaList, isLoading } = useMediaResults(category, { 43780 per_page: !!debouncedSearch ? 20 : INITIAL_MEDIA_ITEMS_PER_PAGE, 43781 search: debouncedSearch 43782 }); 43783 const baseCssClass = "block-editor-inserter__media-panel"; 43784 const searchLabel = category.labels.search_items || (0,external_wp_i18n_namespaceObject.__)("Search"); 43785 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: baseCssClass, children: [ 43786 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 43787 external_wp_components_namespaceObject.SearchControl, 43788 { 43789 __nextHasNoMarginBottom: true, 43790 className: `$baseCssClass}-search`, 43791 onChange: setSearch, 43792 value: search, 43793 label: searchLabel, 43794 placeholder: searchLabel 43795 } 43796 ), 43797 isLoading && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: `$baseCssClass}-spinner`, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {}) }), 43798 !isLoading && !mediaList?.length && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(no_results_default, {}), 43799 !isLoading && !!mediaList?.length && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 43800 media_list_default, 43801 { 43802 rootClientId, 43803 onClick: onInsert, 43804 mediaList, 43805 category 43806 } 43807 ) 43808 ] }); 43809 } 43810 43811 43812 ;// ./node_modules/@wordpress/block-editor/build-module/components/inserter/media-tab/media-tab.js 43813 43814 43815 43816 43817 43818 43819 43820 43821 43822 43823 43824 43825 43826 const media_tab_ALLOWED_MEDIA_TYPES = ["image", "video", "audio"]; 43827 function MediaTab({ 43828 rootClientId, 43829 selectedCategory, 43830 onSelectCategory, 43831 onInsert, 43832 children 43833 }) { 43834 const mediaCategories = useMediaCategories(rootClientId); 43835 const isMobile = (0,external_wp_compose_namespaceObject.useViewportMatch)("medium", "<"); 43836 const baseCssClass = "block-editor-inserter__media-tabs"; 43837 const onSelectMedia = (0,external_wp_element_namespaceObject.useCallback)( 43838 (media) => { 43839 if (!media?.url) { 43840 return; 43841 } 43842 const [block] = getBlockAndPreviewFromMedia(media, media.type); 43843 onInsert(block); 43844 }, 43845 [onInsert] 43846 ); 43847 const categories = (0,external_wp_element_namespaceObject.useMemo)( 43848 () => mediaCategories.map((mediaCategory) => ({ 43849 ...mediaCategory, 43850 label: mediaCategory.labels.name 43851 })), 43852 [mediaCategories] 43853 ); 43854 if (!categories.length) { 43855 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(no_results_default, {}); 43856 } 43857 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 43858 !isMobile && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: `$baseCssClass}-container`, children: [ 43859 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 43860 category_tabs_default, 43861 { 43862 categories, 43863 selectedCategory, 43864 onSelectCategory, 43865 children 43866 } 43867 ), 43868 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(check_default, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 43869 media_upload_default, 43870 { 43871 multiple: false, 43872 onSelect: onSelectMedia, 43873 allowedTypes: media_tab_ALLOWED_MEDIA_TYPES, 43874 render: ({ open }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 43875 external_wp_components_namespaceObject.Button, 43876 { 43877 __next40pxDefaultSize: true, 43878 onClick: (event) => { 43879 event.target.focus(); 43880 open(); 43881 }, 43882 className: "block-editor-inserter__media-library-button", 43883 variant: "secondary", 43884 "data-unstable-ignore-focus-outside-for-relatedtarget": ".media-modal", 43885 children: (0,external_wp_i18n_namespaceObject.__)("Open Media Library") 43886 } 43887 ) 43888 } 43889 ) }) 43890 ] }), 43891 isMobile && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(MobileTabNavigation, { categories, children: (category) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 43892 MediaCategoryPanel, 43893 { 43894 onInsert, 43895 rootClientId, 43896 category 43897 } 43898 ) }) 43899 ] }); 43900 } 43901 var media_tab_default = MediaTab; 43902 43903 43904 ;// ./node_modules/@wordpress/block-editor/build-module/components/inserter-menu-extension/index.js 43905 43906 const { Fill: __unstableInserterMenuExtension, Slot } = (0,external_wp_components_namespaceObject.createSlotFill)( 43907 "__unstableInserterMenuExtension" 43908 ); 43909 __unstableInserterMenuExtension.Slot = Slot; 43910 var inserter_menu_extension_default = __unstableInserterMenuExtension; 43911 43912 43913 ;// ./node_modules/@wordpress/block-editor/build-module/utils/order-inserter-block-items.js 43914 const orderInserterBlockItems = (items, priority) => { 43915 if (!priority) { 43916 return items; 43917 } 43918 items.sort(({ id: aName }, { id: bName }) => { 43919 let aIndex = priority.indexOf(aName); 43920 let bIndex = priority.indexOf(bName); 43921 if (aIndex < 0) { 43922 aIndex = priority.length; 43923 } 43924 if (bIndex < 0) { 43925 bIndex = priority.length; 43926 } 43927 return aIndex - bIndex; 43928 }); 43929 return items; 43930 }; 43931 43932 43933 ;// ./node_modules/@wordpress/block-editor/build-module/components/inserter/search-results.js 43934 43935 43936 43937 43938 43939 43940 43941 43942 43943 43944 43945 43946 43947 43948 43949 43950 43951 43952 43953 43954 const INITIAL_INSERTER_RESULTS = 9; 43955 const search_results_EMPTY_ARRAY = []; 43956 function InserterSearchResults({ 43957 filterValue, 43958 onSelect, 43959 onHover, 43960 onHoverPattern, 43961 rootClientId, 43962 clientId, 43963 isAppender, 43964 __experimentalInsertionIndex, 43965 maxBlockPatterns, 43966 maxBlockTypes, 43967 showBlockDirectory = false, 43968 isDraggable = true, 43969 shouldFocusBlock = true, 43970 prioritizePatterns, 43971 selectBlockOnInsert, 43972 isQuick 43973 }) { 43974 const debouncedSpeak = (0,external_wp_compose_namespaceObject.useDebounce)(external_wp_a11y_namespaceObject.speak, 500); 43975 const { prioritizedBlocks } = (0,external_wp_data_namespaceObject.useSelect)( 43976 (select) => { 43977 const blockListSettings = select(store).getBlockListSettings(rootClientId); 43978 return { 43979 prioritizedBlocks: blockListSettings?.prioritizedInserterBlocks || search_results_EMPTY_ARRAY 43980 }; 43981 }, 43982 [rootClientId] 43983 ); 43984 const [destinationRootClientId, onInsertBlocks] = use_insertion_point_default({ 43985 onSelect, 43986 rootClientId, 43987 clientId, 43988 isAppender, 43989 insertionIndex: __experimentalInsertionIndex, 43990 shouldFocusBlock, 43991 selectBlockOnInsert 43992 }); 43993 const [ 43994 blockTypes, 43995 blockTypeCategories, 43996 blockTypeCollections, 43997 onSelectBlockType 43998 ] = use_block_types_state_default(destinationRootClientId, onInsertBlocks, isQuick); 43999 const [patterns, , onClickPattern] = use_patterns_state_default( 44000 onInsertBlocks, 44001 destinationRootClientId, 44002 void 0, 44003 isQuick 44004 ); 44005 const filteredBlockPatterns = (0,external_wp_element_namespaceObject.useMemo)(() => { 44006 if (maxBlockPatterns === 0) { 44007 return []; 44008 } 44009 const results = searchItems(patterns, filterValue); 44010 return maxBlockPatterns !== void 0 ? results.slice(0, maxBlockPatterns) : results; 44011 }, [filterValue, patterns, maxBlockPatterns]); 44012 let maxBlockTypesToShow = maxBlockTypes; 44013 if (prioritizePatterns && filteredBlockPatterns.length > 2) { 44014 maxBlockTypesToShow = 0; 44015 } 44016 const filteredBlockTypes = (0,external_wp_element_namespaceObject.useMemo)(() => { 44017 if (maxBlockTypesToShow === 0) { 44018 return []; 44019 } 44020 const nonPatternBlockTypes = blockTypes.filter( 44021 (blockType) => blockType.name !== "core/block" 44022 ); 44023 let orderedItems = orderBy(nonPatternBlockTypes, "frecency", "desc"); 44024 if (!filterValue && prioritizedBlocks.length) { 44025 orderedItems = orderInserterBlockItems( 44026 orderedItems, 44027 prioritizedBlocks 44028 ); 44029 } 44030 const results = searchBlockItems( 44031 orderedItems, 44032 blockTypeCategories, 44033 blockTypeCollections, 44034 filterValue 44035 ); 44036 return maxBlockTypesToShow !== void 0 ? results.slice(0, maxBlockTypesToShow) : results; 44037 }, [ 44038 filterValue, 44039 blockTypes, 44040 blockTypeCategories, 44041 blockTypeCollections, 44042 maxBlockTypesToShow, 44043 prioritizedBlocks 44044 ]); 44045 (0,external_wp_element_namespaceObject.useEffect)(() => { 44046 if (!filterValue) { 44047 return; 44048 } 44049 const count = filteredBlockTypes.length + filteredBlockPatterns.length; 44050 const resultsFoundMessage = (0,external_wp_i18n_namespaceObject.sprintf)( 44051 /* translators: %d: number of results. */ 44052 (0,external_wp_i18n_namespaceObject._n)("%d result found.", "%d results found.", count), 44053 count 44054 ); 44055 debouncedSpeak(resultsFoundMessage); 44056 }, [ 44057 filterValue, 44058 debouncedSpeak, 44059 filteredBlockTypes, 44060 filteredBlockPatterns 44061 ]); 44062 const currentShownBlockTypes = (0,external_wp_compose_namespaceObject.useAsyncList)(filteredBlockTypes, { 44063 step: INITIAL_INSERTER_RESULTS 44064 }); 44065 const hasItems = filteredBlockTypes.length > 0 || filteredBlockPatterns.length > 0; 44066 const blocksUI = !!filteredBlockTypes.length && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 44067 panel_default, 44068 { 44069 title: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, { children: (0,external_wp_i18n_namespaceObject.__)("Blocks") }), 44070 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 44071 block_types_list_default, 44072 { 44073 items: currentShownBlockTypes, 44074 onSelect: onSelectBlockType, 44075 onHover, 44076 label: (0,external_wp_i18n_namespaceObject.__)("Blocks"), 44077 isDraggable 44078 } 44079 ) 44080 } 44081 ); 44082 const patternsUI = !!filteredBlockPatterns.length && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 44083 panel_default, 44084 { 44085 title: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, { children: (0,external_wp_i18n_namespaceObject.__)("Block patterns") }), 44086 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-inserter__quick-inserter-patterns", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 44087 block_patterns_list_default, 44088 { 44089 blockPatterns: filteredBlockPatterns, 44090 onClickPattern, 44091 onHover: onHoverPattern, 44092 isDraggable 44093 } 44094 ) }) 44095 } 44096 ); 44097 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(inserter_listbox_default, { children: [ 44098 !showBlockDirectory && !hasItems && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(no_results_default, {}), 44099 prioritizePatterns ? patternsUI : blocksUI, 44100 !!filteredBlockTypes.length && !!filteredBlockPatterns.length && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-inserter__quick-inserter-separator" }), 44101 prioritizePatterns ? blocksUI : patternsUI, 44102 showBlockDirectory && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 44103 inserter_menu_extension_default.Slot, 44104 { 44105 fillProps: { 44106 onSelect: onSelectBlockType, 44107 onHover, 44108 filterValue, 44109 hasItems, 44110 rootClientId: destinationRootClientId 44111 }, 44112 children: (fills) => { 44113 if (fills.length) { 44114 return fills; 44115 } 44116 if (!hasItems) { 44117 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(no_results_default, {}); 44118 } 44119 return null; 44120 } 44121 } 44122 ) 44123 ] }); 44124 } 44125 var search_results_search_results_default = InserterSearchResults; 44126 44127 44128 ;// ./node_modules/@wordpress/icons/build-module/library/close-small.js 44129 44130 44131 var close_small_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 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" }) }); 44132 44133 44134 ;// ./node_modules/@wordpress/block-editor/build-module/components/tabbed-sidebar/index.js 44135 44136 44137 44138 44139 44140 const { Tabs: tabbed_sidebar_Tabs } = unlock(external_wp_components_namespaceObject.privateApis); 44141 function TabbedSidebar({ defaultTabId, onClose, onSelect, selectedTab, tabs, closeButtonLabel }, ref) { 44142 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-tabbed-sidebar", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 44143 tabbed_sidebar_Tabs, 44144 { 44145 selectOnMove: false, 44146 defaultTabId, 44147 onSelect, 44148 selectedTabId: selectedTab, 44149 children: [ 44150 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-editor-tabbed-sidebar__tablist-and-close-button", children: [ 44151 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 44152 external_wp_components_namespaceObject.Button, 44153 { 44154 className: "block-editor-tabbed-sidebar__close-button", 44155 icon: close_small_default, 44156 label: closeButtonLabel, 44157 onClick: () => onClose(), 44158 size: "compact" 44159 } 44160 ), 44161 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 44162 tabbed_sidebar_Tabs.TabList, 44163 { 44164 className: "block-editor-tabbed-sidebar__tablist", 44165 ref, 44166 children: tabs.map((tab) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 44167 tabbed_sidebar_Tabs.Tab, 44168 { 44169 tabId: tab.name, 44170 className: "block-editor-tabbed-sidebar__tab", 44171 children: tab.title 44172 }, 44173 tab.name 44174 )) 44175 } 44176 ) 44177 ] }), 44178 tabs.map((tab) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 44179 tabbed_sidebar_Tabs.TabPanel, 44180 { 44181 tabId: tab.name, 44182 focusable: false, 44183 className: "block-editor-tabbed-sidebar__tabpanel", 44184 ref: tab.panelRef, 44185 children: tab.panel 44186 }, 44187 tab.name 44188 )) 44189 ] 44190 } 44191 ) }); 44192 } 44193 var tabbed_sidebar_default = (0,external_wp_element_namespaceObject.forwardRef)(TabbedSidebar); 44194 44195 44196 ;// ./node_modules/@wordpress/block-editor/build-module/hooks/use-zoom-out.js 44197 44198 44199 44200 44201 function useZoomOut(enabled = true) { 44202 const { setZoomLevel, resetZoomLevel } = unlock( 44203 (0,external_wp_data_namespaceObject.useDispatch)(store) 44204 ); 44205 const { isZoomedOut, isZoomOut } = (0,external_wp_data_namespaceObject.useSelect)((select) => { 44206 const { isZoomOut: _isZoomOut } = unlock(select(store)); 44207 return { 44208 isZoomedOut: _isZoomOut(), 44209 isZoomOut: _isZoomOut 44210 }; 44211 }, []); 44212 const controlZoomLevelRef = (0,external_wp_element_namespaceObject.useRef)(false); 44213 const isEnabledRef = (0,external_wp_element_namespaceObject.useRef)(enabled); 44214 (0,external_wp_element_namespaceObject.useEffect)(() => { 44215 if (isZoomedOut !== isEnabledRef.current) { 44216 controlZoomLevelRef.current = false; 44217 } 44218 }, [isZoomedOut]); 44219 (0,external_wp_element_namespaceObject.useEffect)(() => { 44220 isEnabledRef.current = enabled; 44221 if (enabled !== isZoomOut()) { 44222 controlZoomLevelRef.current = true; 44223 if (enabled) { 44224 setZoomLevel("auto-scaled"); 44225 } else { 44226 resetZoomLevel(); 44227 } 44228 } 44229 return () => { 44230 if (controlZoomLevelRef.current && isZoomOut()) { 44231 resetZoomLevel(); 44232 } 44233 }; 44234 }, [enabled, isZoomOut, resetZoomLevel, setZoomLevel]); 44235 } 44236 44237 44238 ;// ./node_modules/@wordpress/block-editor/build-module/components/inserter/menu.js 44239 44240 44241 44242 44243 44244 44245 44246 44247 44248 44249 44250 44251 44252 44253 44254 44255 44256 44257 44258 const NOOP = () => { 44259 }; 44260 function InserterMenu({ 44261 rootClientId, 44262 clientId, 44263 isAppender, 44264 __experimentalInsertionIndex, 44265 onSelect, 44266 showInserterHelpPanel, 44267 showMostUsedBlocks, 44268 __experimentalFilterValue = "", 44269 shouldFocusBlock = true, 44270 onPatternCategorySelection, 44271 onClose, 44272 __experimentalInitialTab, 44273 __experimentalInitialCategory 44274 }, ref) { 44275 const { isZoomOutMode, hasSectionRootClientId } = (0,external_wp_data_namespaceObject.useSelect)((select) => { 44276 const { isZoomOut, getSectionRootClientId } = unlock( 44277 select(store) 44278 ); 44279 return { 44280 isZoomOutMode: isZoomOut(), 44281 hasSectionRootClientId: !!getSectionRootClientId() 44282 }; 44283 }, []); 44284 const [filterValue, setFilterValue, delayedFilterValue] = (0,external_wp_compose_namespaceObject.useDebouncedInput)(__experimentalFilterValue); 44285 const [hoveredItem, setHoveredItem] = (0,external_wp_element_namespaceObject.useState)(null); 44286 const [selectedPatternCategory, setSelectedPatternCategory] = (0,external_wp_element_namespaceObject.useState)( 44287 __experimentalInitialCategory 44288 ); 44289 const [patternFilter, setPatternFilter] = (0,external_wp_element_namespaceObject.useState)("all"); 44290 const [selectedMediaCategory, setSelectedMediaCategory] = (0,external_wp_element_namespaceObject.useState)(null); 44291 const isLargeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)("large"); 44292 function getInitialTab() { 44293 if (__experimentalInitialTab) { 44294 return __experimentalInitialTab; 44295 } 44296 if (isZoomOutMode) { 44297 return "patterns"; 44298 } 44299 return "blocks"; 44300 } 44301 const [selectedTab, setSelectedTab] = (0,external_wp_element_namespaceObject.useState)(getInitialTab()); 44302 const shouldUseZoomOut = hasSectionRootClientId && (selectedTab === "patterns" || selectedTab === "media"); 44303 useZoomOut(shouldUseZoomOut && isLargeViewport); 44304 const [destinationRootClientId, onInsertBlocks, onToggleInsertionPoint] = use_insertion_point_default({ 44305 rootClientId, 44306 clientId, 44307 isAppender, 44308 insertionIndex: __experimentalInsertionIndex, 44309 shouldFocusBlock 44310 }); 44311 const blockTypesTabRef = (0,external_wp_element_namespaceObject.useRef)(); 44312 const onInsert = (0,external_wp_element_namespaceObject.useCallback)( 44313 (blocks, meta, shouldForceFocusBlock, _rootClientId) => { 44314 onInsertBlocks( 44315 blocks, 44316 meta, 44317 shouldForceFocusBlock, 44318 _rootClientId 44319 ); 44320 onSelect(blocks); 44321 window.requestAnimationFrame(() => { 44322 if (!shouldFocusBlock && !blockTypesTabRef.current?.contains( 44323 ref.current.ownerDocument.activeElement 44324 )) { 44325 blockTypesTabRef.current?.querySelector("button").focus(); 44326 } 44327 }); 44328 }, 44329 [onInsertBlocks, onSelect, shouldFocusBlock] 44330 ); 44331 const onInsertPattern = (0,external_wp_element_namespaceObject.useCallback)( 44332 (blocks, patternName, ...args) => { 44333 onToggleInsertionPoint(false); 44334 onInsertBlocks(blocks, { patternName }, ...args); 44335 onSelect(); 44336 }, 44337 [onInsertBlocks, onSelect] 44338 ); 44339 const onHover = (0,external_wp_element_namespaceObject.useCallback)( 44340 (item) => { 44341 onToggleInsertionPoint(item); 44342 setHoveredItem(item); 44343 }, 44344 [onToggleInsertionPoint, setHoveredItem] 44345 ); 44346 const onClickPatternCategory = (0,external_wp_element_namespaceObject.useCallback)( 44347 (patternCategory, filter) => { 44348 setSelectedPatternCategory(patternCategory); 44349 setPatternFilter(filter); 44350 onPatternCategorySelection?.(); 44351 }, 44352 [setSelectedPatternCategory, onPatternCategorySelection] 44353 ); 44354 const showPatternPanel = selectedTab === "patterns" && !delayedFilterValue && !!selectedPatternCategory; 44355 const showMediaPanel = selectedTab === "media" && !!selectedMediaCategory; 44356 const inserterSearch = (0,external_wp_element_namespaceObject.useMemo)(() => { 44357 if (selectedTab === "media") { 44358 return null; 44359 } 44360 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 44361 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 44362 external_wp_components_namespaceObject.SearchControl, 44363 { 44364 __nextHasNoMarginBottom: true, 44365 className: "block-editor-inserter__search", 44366 onChange: (value) => { 44367 if (hoveredItem) { 44368 setHoveredItem(null); 44369 } 44370 setFilterValue(value); 44371 }, 44372 value: filterValue, 44373 label: (0,external_wp_i18n_namespaceObject.__)("Search"), 44374 placeholder: (0,external_wp_i18n_namespaceObject.__)("Search") 44375 } 44376 ), 44377 !!delayedFilterValue && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 44378 search_results_search_results_default, 44379 { 44380 filterValue: delayedFilterValue, 44381 onSelect, 44382 onHover, 44383 rootClientId, 44384 clientId, 44385 isAppender, 44386 __experimentalInsertionIndex, 44387 showBlockDirectory: true, 44388 shouldFocusBlock, 44389 prioritizePatterns: selectedTab === "patterns" 44390 } 44391 ) 44392 ] }); 44393 }, [ 44394 selectedTab, 44395 hoveredItem, 44396 setHoveredItem, 44397 setFilterValue, 44398 filterValue, 44399 delayedFilterValue, 44400 onSelect, 44401 onHover, 44402 shouldFocusBlock, 44403 clientId, 44404 rootClientId, 44405 __experimentalInsertionIndex, 44406 isAppender 44407 ]); 44408 const blocksTab = (0,external_wp_element_namespaceObject.useMemo)(() => { 44409 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 44410 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-inserter__block-list", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 44411 block_types_tab_default, 44412 { 44413 ref: blockTypesTabRef, 44414 rootClientId: destinationRootClientId, 44415 onInsert, 44416 onHover, 44417 showMostUsedBlocks 44418 } 44419 ) }), 44420 showInserterHelpPanel && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-editor-inserter__tips", children: [ 44421 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, { as: "h2", children: (0,external_wp_i18n_namespaceObject.__)("A tip for using the block editor") }), 44422 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(tips_default, {}) 44423 ] }) 44424 ] }); 44425 }, [ 44426 destinationRootClientId, 44427 onInsert, 44428 onHover, 44429 showMostUsedBlocks, 44430 showInserterHelpPanel 44431 ]); 44432 const patternsTab = (0,external_wp_element_namespaceObject.useMemo)(() => { 44433 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 44434 block_patterns_tab_default, 44435 { 44436 rootClientId: destinationRootClientId, 44437 onInsert: onInsertPattern, 44438 onSelectCategory: onClickPatternCategory, 44439 selectedCategory: selectedPatternCategory, 44440 children: showPatternPanel && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 44441 PatternCategoryPreviews, 44442 { 44443 rootClientId: destinationRootClientId, 44444 onInsert: onInsertPattern, 44445 category: selectedPatternCategory, 44446 patternFilter, 44447 showTitlesAsTooltip: true 44448 } 44449 ) 44450 } 44451 ); 44452 }, [ 44453 destinationRootClientId, 44454 onInsertPattern, 44455 onClickPatternCategory, 44456 patternFilter, 44457 selectedPatternCategory, 44458 showPatternPanel 44459 ]); 44460 const mediaTab = (0,external_wp_element_namespaceObject.useMemo)(() => { 44461 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 44462 media_tab_default, 44463 { 44464 rootClientId: destinationRootClientId, 44465 selectedCategory: selectedMediaCategory, 44466 onSelectCategory: setSelectedMediaCategory, 44467 onInsert, 44468 children: showMediaPanel && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 44469 MediaCategoryPanel, 44470 { 44471 rootClientId: destinationRootClientId, 44472 onInsert, 44473 category: selectedMediaCategory 44474 } 44475 ) 44476 } 44477 ); 44478 }, [ 44479 destinationRootClientId, 44480 onInsert, 44481 selectedMediaCategory, 44482 setSelectedMediaCategory, 44483 showMediaPanel 44484 ]); 44485 const handleSetSelectedTab = (value) => { 44486 if (value !== "patterns") { 44487 setSelectedPatternCategory(null); 44488 } 44489 setSelectedTab(value); 44490 }; 44491 const tabsRef = (0,external_wp_element_namespaceObject.useRef)(); 44492 (0,external_wp_element_namespaceObject.useLayoutEffect)(() => { 44493 if (tabsRef.current) { 44494 window.requestAnimationFrame(() => { 44495 tabsRef.current.querySelector('[role="tab"][aria-selected="true"]')?.focus(); 44496 }); 44497 } 44498 }, []); 44499 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 44500 "div", 44501 { 44502 className: dist_clsx("block-editor-inserter__menu", { 44503 "show-panel": showPatternPanel || showMediaPanel, 44504 "is-zoom-out": isZoomOutMode 44505 }), 44506 ref, 44507 children: [ 44508 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-inserter__main-area", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 44509 tabbed_sidebar_default, 44510 { 44511 ref: tabsRef, 44512 onSelect: handleSetSelectedTab, 44513 onClose, 44514 selectedTab, 44515 closeButtonLabel: (0,external_wp_i18n_namespaceObject.__)("Close Block Inserter"), 44516 tabs: [ 44517 { 44518 name: "blocks", 44519 title: (0,external_wp_i18n_namespaceObject.__)("Blocks"), 44520 panel: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 44521 inserterSearch, 44522 selectedTab === "blocks" && !delayedFilterValue && blocksTab 44523 ] }) 44524 }, 44525 { 44526 name: "patterns", 44527 title: (0,external_wp_i18n_namespaceObject.__)("Patterns"), 44528 panel: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 44529 inserterSearch, 44530 selectedTab === "patterns" && !delayedFilterValue && patternsTab 44531 ] }) 44532 }, 44533 { 44534 name: "media", 44535 title: (0,external_wp_i18n_namespaceObject.__)("Media"), 44536 panel: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 44537 inserterSearch, 44538 mediaTab 44539 ] }) 44540 } 44541 ] 44542 } 44543 ) }), 44544 showInserterHelpPanel && hoveredItem && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 44545 external_wp_components_namespaceObject.Popover, 44546 { 44547 className: "block-editor-inserter__preview-container__popover", 44548 placement: "right-start", 44549 offset: 16, 44550 focusOnMount: false, 44551 animate: false, 44552 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(preview_panel_default, { item: hoveredItem }) 44553 } 44554 ) 44555 ] 44556 } 44557 ); 44558 } 44559 const PrivateInserterMenu = (0,external_wp_element_namespaceObject.forwardRef)(InserterMenu); 44560 function PublicInserterMenu(props, ref) { 44561 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 44562 PrivateInserterMenu, 44563 { 44564 ...props, 44565 onPatternCategorySelection: NOOP, 44566 ref 44567 } 44568 ); 44569 } 44570 var menu_default = (0,external_wp_element_namespaceObject.forwardRef)(PublicInserterMenu); 44571 44572 44573 ;// ./node_modules/@wordpress/block-editor/build-module/components/inserter/quick-inserter.js 44574 44575 44576 44577 44578 44579 44580 44581 44582 44583 44584 const SEARCH_THRESHOLD = 6; 44585 const SHOWN_BLOCK_TYPES = 6; 44586 const SHOWN_BLOCK_PATTERNS = 2; 44587 function QuickInserter({ 44588 onSelect, 44589 rootClientId, 44590 clientId, 44591 isAppender, 44592 selectBlockOnInsert, 44593 hasSearch = true 44594 }) { 44595 const [filterValue, setFilterValue] = (0,external_wp_element_namespaceObject.useState)(""); 44596 const [destinationRootClientId, onInsertBlocks] = use_insertion_point_default({ 44597 onSelect, 44598 rootClientId, 44599 clientId, 44600 isAppender, 44601 selectBlockOnInsert 44602 }); 44603 const [blockTypes] = use_block_types_state_default( 44604 destinationRootClientId, 44605 onInsertBlocks, 44606 true 44607 ); 44608 const { setInserterIsOpened, insertionIndex } = (0,external_wp_data_namespaceObject.useSelect)( 44609 (select) => { 44610 const { getSettings, getBlockIndex, getBlockCount } = select(store); 44611 const settings = getSettings(); 44612 const index = getBlockIndex(clientId); 44613 const blockCount = getBlockCount(); 44614 return { 44615 setInserterIsOpened: settings.__experimentalSetIsInserterOpened, 44616 insertionIndex: index === -1 ? blockCount : index 44617 }; 44618 }, 44619 [clientId] 44620 ); 44621 const showSearch = hasSearch && blockTypes.length > SEARCH_THRESHOLD; 44622 (0,external_wp_element_namespaceObject.useEffect)(() => { 44623 if (setInserterIsOpened) { 44624 setInserterIsOpened(false); 44625 } 44626 }, [setInserterIsOpened]); 44627 const onBrowseAll = () => { 44628 setInserterIsOpened({ 44629 filterValue, 44630 onSelect, 44631 rootClientId, 44632 insertionIndex 44633 }); 44634 }; 44635 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 44636 "div", 44637 { 44638 className: dist_clsx("block-editor-inserter__quick-inserter", { 44639 "has-search": showSearch, 44640 "has-expand": setInserterIsOpened 44641 }), 44642 children: [ 44643 showSearch && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 44644 external_wp_components_namespaceObject.SearchControl, 44645 { 44646 __nextHasNoMarginBottom: true, 44647 className: "block-editor-inserter__search", 44648 value: filterValue, 44649 onChange: (value) => { 44650 setFilterValue(value); 44651 }, 44652 label: (0,external_wp_i18n_namespaceObject.__)("Search"), 44653 placeholder: (0,external_wp_i18n_namespaceObject.__)("Search") 44654 } 44655 ), 44656 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-inserter__quick-inserter-results", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 44657 search_results_search_results_default, 44658 { 44659 filterValue, 44660 onSelect, 44661 rootClientId, 44662 clientId, 44663 isAppender, 44664 maxBlockPatterns: !!filterValue ? SHOWN_BLOCK_PATTERNS : 0, 44665 maxBlockTypes: SHOWN_BLOCK_TYPES, 44666 isDraggable: false, 44667 selectBlockOnInsert, 44668 isQuick: true 44669 } 44670 ) }), 44671 setInserterIsOpened && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 44672 external_wp_components_namespaceObject.Button, 44673 { 44674 __next40pxDefaultSize: true, 44675 className: "block-editor-inserter__quick-inserter-expand", 44676 onClick: onBrowseAll, 44677 "aria-label": (0,external_wp_i18n_namespaceObject.__)( 44678 "Browse all. This will open the main inserter panel in the editor toolbar." 44679 ), 44680 children: (0,external_wp_i18n_namespaceObject.__)("Browse all") 44681 } 44682 ) 44683 ] 44684 } 44685 ); 44686 } 44687 44688 44689 ;// ./node_modules/@wordpress/block-editor/build-module/components/inserter/index.js 44690 44691 44692 44693 44694 44695 44696 44697 44698 44699 44700 44701 44702 44703 const defaultRenderToggle = ({ 44704 onToggle, 44705 disabled, 44706 isOpen, 44707 blockTitle, 44708 hasSingleBlockType, 44709 toggleProps = {} 44710 }) => { 44711 const { 44712 as: Wrapper = external_wp_components_namespaceObject.Button, 44713 label: labelProp, 44714 onClick, 44715 ...rest 44716 } = toggleProps; 44717 let label = labelProp; 44718 if (!label && hasSingleBlockType) { 44719 label = (0,external_wp_i18n_namespaceObject.sprintf)( 44720 // translators: %s: the name of the block when there is only one 44721 (0,external_wp_i18n_namespaceObject._x)("Add %s", "directly add the only allowed block"), 44722 blockTitle 44723 ); 44724 } else if (!label) { 44725 label = (0,external_wp_i18n_namespaceObject._x)("Add block", "Generic label for block inserter button"); 44726 } 44727 function handleClick(event) { 44728 if (onToggle) { 44729 onToggle(event); 44730 } 44731 if (onClick) { 44732 onClick(event); 44733 } 44734 } 44735 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 44736 Wrapper, 44737 { 44738 __next40pxDefaultSize: toggleProps.as ? void 0 : true, 44739 icon: plus_default, 44740 label, 44741 tooltipPosition: "bottom", 44742 onClick: handleClick, 44743 className: "block-editor-inserter__toggle", 44744 "aria-haspopup": !hasSingleBlockType ? "true" : false, 44745 "aria-expanded": !hasSingleBlockType ? isOpen : false, 44746 disabled, 44747 ...rest 44748 } 44749 ); 44750 }; 44751 class Inserter extends external_wp_element_namespaceObject.Component { 44752 constructor() { 44753 super(...arguments); 44754 this.onToggle = this.onToggle.bind(this); 44755 this.renderToggle = this.renderToggle.bind(this); 44756 this.renderContent = this.renderContent.bind(this); 44757 } 44758 onToggle(isOpen) { 44759 const { onToggle } = this.props; 44760 if (onToggle) { 44761 onToggle(isOpen); 44762 } 44763 } 44764 /** 44765 * Render callback to display Dropdown toggle element. 44766 * 44767 * @param {Object} options 44768 * @param {Function} options.onToggle Callback to invoke when toggle is 44769 * pressed. 44770 * @param {boolean} options.isOpen Whether dropdown is currently open. 44771 * 44772 * @return {Element} Dropdown toggle element. 44773 */ 44774 renderToggle({ onToggle, isOpen }) { 44775 const { 44776 disabled, 44777 blockTitle, 44778 hasSingleBlockType, 44779 directInsertBlock, 44780 toggleProps, 44781 hasItems, 44782 renderToggle = defaultRenderToggle 44783 } = this.props; 44784 return renderToggle({ 44785 onToggle, 44786 isOpen, 44787 disabled: disabled || !hasItems, 44788 blockTitle, 44789 hasSingleBlockType, 44790 directInsertBlock, 44791 toggleProps 44792 }); 44793 } 44794 /** 44795 * Render callback to display Dropdown content element. 44796 * 44797 * @param {Object} options 44798 * @param {Function} options.onClose Callback to invoke when dropdown is 44799 * closed. 44800 * 44801 * @return {Element} Dropdown content element. 44802 */ 44803 renderContent({ onClose }) { 44804 const { 44805 rootClientId, 44806 clientId, 44807 isAppender, 44808 showInserterHelpPanel, 44809 // This prop is experimental to give some time for the quick inserter to mature 44810 // Feel free to make them stable after a few releases. 44811 __experimentalIsQuick: isQuick, 44812 onSelectOrClose, 44813 selectBlockOnInsert 44814 } = this.props; 44815 if (isQuick) { 44816 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 44817 QuickInserter, 44818 { 44819 onSelect: (blocks) => { 44820 const firstBlock = Array.isArray(blocks) && blocks?.length ? blocks[0] : blocks; 44821 if (onSelectOrClose && typeof onSelectOrClose === "function") { 44822 onSelectOrClose(firstBlock); 44823 } 44824 onClose(); 44825 }, 44826 rootClientId, 44827 clientId, 44828 isAppender, 44829 selectBlockOnInsert 44830 } 44831 ); 44832 } 44833 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 44834 menu_default, 44835 { 44836 onSelect: () => { 44837 onClose(); 44838 }, 44839 rootClientId, 44840 clientId, 44841 isAppender, 44842 showInserterHelpPanel 44843 } 44844 ); 44845 } 44846 render() { 44847 const { 44848 position, 44849 hasSingleBlockType, 44850 directInsertBlock, 44851 insertOnlyAllowedBlock, 44852 __experimentalIsQuick: isQuick, 44853 onSelectOrClose 44854 } = this.props; 44855 if (hasSingleBlockType || directInsertBlock) { 44856 return this.renderToggle({ onToggle: insertOnlyAllowedBlock }); 44857 } 44858 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 44859 external_wp_components_namespaceObject.Dropdown, 44860 { 44861 className: "block-editor-inserter", 44862 contentClassName: dist_clsx("block-editor-inserter__popover", { 44863 "is-quick": isQuick 44864 }), 44865 popoverProps: { position, shift: true }, 44866 onToggle: this.onToggle, 44867 expandOnMobile: true, 44868 headerTitle: (0,external_wp_i18n_namespaceObject.__)("Add a block"), 44869 renderToggle: this.renderToggle, 44870 renderContent: this.renderContent, 44871 onClose: onSelectOrClose 44872 } 44873 ); 44874 } 44875 } 44876 var inserter_default = (0,external_wp_compose_namespaceObject.compose)([ 44877 (0,external_wp_data_namespaceObject.withSelect)( 44878 (select, { clientId, rootClientId, shouldDirectInsert = true }) => { 44879 const { 44880 getBlockRootClientId, 44881 hasInserterItems, 44882 getAllowedBlocks, 44883 getDirectInsertBlock 44884 } = select(store); 44885 const { getBlockVariations } = select(external_wp_blocks_namespaceObject.store); 44886 rootClientId = rootClientId || getBlockRootClientId(clientId) || void 0; 44887 const allowedBlocks = getAllowedBlocks(rootClientId); 44888 const directInsertBlock = shouldDirectInsert && getDirectInsertBlock(rootClientId); 44889 const hasSingleBlockType = allowedBlocks?.length === 1 && getBlockVariations(allowedBlocks[0].name, "inserter")?.length === 0; 44890 let allowedBlockType = false; 44891 if (hasSingleBlockType) { 44892 allowedBlockType = allowedBlocks[0]; 44893 } 44894 return { 44895 hasItems: hasInserterItems(rootClientId), 44896 hasSingleBlockType, 44897 blockTitle: allowedBlockType ? allowedBlockType.title : "", 44898 allowedBlockType, 44899 directInsertBlock, 44900 rootClientId 44901 }; 44902 } 44903 ), 44904 (0,external_wp_data_namespaceObject.withDispatch)((dispatch, ownProps, { select }) => { 44905 return { 44906 insertOnlyAllowedBlock() { 44907 const { 44908 rootClientId, 44909 clientId, 44910 isAppender, 44911 hasSingleBlockType, 44912 allowedBlockType, 44913 directInsertBlock, 44914 onSelectOrClose, 44915 selectBlockOnInsert 44916 } = ownProps; 44917 if (!hasSingleBlockType && !directInsertBlock) { 44918 return; 44919 } 44920 function getAdjacentBlockAttributes(attributesToCopy) { 44921 const { getBlock, getPreviousBlockClientId } = select(store); 44922 if (!attributesToCopy || !clientId && !rootClientId) { 44923 return {}; 44924 } 44925 const result = {}; 44926 let adjacentAttributes = {}; 44927 if (!clientId) { 44928 const parentBlock = getBlock(rootClientId); 44929 if (parentBlock?.innerBlocks?.length) { 44930 const lastInnerBlock = parentBlock.innerBlocks[parentBlock.innerBlocks.length - 1]; 44931 if (directInsertBlock && directInsertBlock?.name === lastInnerBlock.name) { 44932 adjacentAttributes = lastInnerBlock.attributes; 44933 } 44934 } 44935 } else { 44936 const currentBlock = getBlock(clientId); 44937 const previousBlock = getBlock( 44938 getPreviousBlockClientId(clientId) 44939 ); 44940 if (currentBlock?.name === previousBlock?.name) { 44941 adjacentAttributes = previousBlock?.attributes || {}; 44942 } 44943 } 44944 attributesToCopy.forEach((attribute) => { 44945 if (adjacentAttributes.hasOwnProperty(attribute)) { 44946 result[attribute] = adjacentAttributes[attribute]; 44947 } 44948 }); 44949 return result; 44950 } 44951 function getInsertionIndex() { 44952 const { 44953 getBlockIndex, 44954 getBlockSelectionEnd, 44955 getBlockOrder, 44956 getBlockRootClientId 44957 } = select(store); 44958 if (clientId) { 44959 return getBlockIndex(clientId); 44960 } 44961 const end = getBlockSelectionEnd(); 44962 if (!isAppender && end && getBlockRootClientId(end) === rootClientId) { 44963 return getBlockIndex(end) + 1; 44964 } 44965 return getBlockOrder(rootClientId).length; 44966 } 44967 const { insertBlock } = dispatch(store); 44968 let blockToInsert; 44969 if (directInsertBlock) { 44970 const newAttributes = getAdjacentBlockAttributes( 44971 directInsertBlock.attributesToCopy 44972 ); 44973 blockToInsert = (0,external_wp_blocks_namespaceObject.createBlock)(directInsertBlock.name, { 44974 ...directInsertBlock.attributes || {}, 44975 ...newAttributes 44976 }); 44977 } else { 44978 blockToInsert = (0,external_wp_blocks_namespaceObject.createBlock)(allowedBlockType.name); 44979 } 44980 insertBlock( 44981 blockToInsert, 44982 getInsertionIndex(), 44983 rootClientId, 44984 selectBlockOnInsert 44985 ); 44986 if (onSelectOrClose) { 44987 onSelectOrClose(blockToInsert); 44988 } 44989 const message = (0,external_wp_i18n_namespaceObject.sprintf)( 44990 // translators: %s: the name of the block that has been added 44991 (0,external_wp_i18n_namespaceObject.__)("%s block added"), 44992 allowedBlockType.title 44993 ); 44994 (0,external_wp_a11y_namespaceObject.speak)(message); 44995 } 44996 }; 44997 }), 44998 // The global inserter should always be visible, we are using ( ! isAppender && ! rootClientId && ! clientId ) as 44999 // a way to detect the global Inserter. 45000 (0,external_wp_compose_namespaceObject.ifCondition)( 45001 ({ hasItems, isAppender, rootClientId, clientId }) => hasItems || !isAppender && !rootClientId && !clientId 45002 ) 45003 ])(Inserter); 45004 45005 45006 ;// ./node_modules/@wordpress/block-editor/build-module/components/button-block-appender/index.js 45007 45008 45009 45010 45011 45012 45013 45014 45015 function button_block_appender_ButtonBlockAppender({ rootClientId, className, onFocus, tabIndex, onSelect }, ref) { 45016 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 45017 inserter_default, 45018 { 45019 position: "bottom center", 45020 rootClientId, 45021 __experimentalIsQuick: true, 45022 onSelectOrClose: (...args) => { 45023 if (onSelect && typeof onSelect === "function") { 45024 onSelect(...args); 45025 } 45026 }, 45027 renderToggle: ({ 45028 onToggle, 45029 disabled, 45030 isOpen, 45031 blockTitle, 45032 hasSingleBlockType 45033 }) => { 45034 const isToggleButton = !hasSingleBlockType; 45035 const label = hasSingleBlockType ? (0,external_wp_i18n_namespaceObject.sprintf)( 45036 // translators: %s: the name of the block when there is only one 45037 (0,external_wp_i18n_namespaceObject._x)( 45038 "Add %s", 45039 "directly add the only allowed block" 45040 ), 45041 blockTitle 45042 ) : (0,external_wp_i18n_namespaceObject._x)( 45043 "Add block", 45044 "Generic label for block inserter button" 45045 ); 45046 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 45047 external_wp_components_namespaceObject.Button, 45048 { 45049 __next40pxDefaultSize: true, 45050 ref, 45051 onFocus, 45052 tabIndex, 45053 className: dist_clsx( 45054 className, 45055 "block-editor-button-block-appender" 45056 ), 45057 onClick: onToggle, 45058 "aria-haspopup": isToggleButton ? "true" : void 0, 45059 "aria-expanded": isToggleButton ? isOpen : void 0, 45060 disabled, 45061 label, 45062 showTooltip: true, 45063 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(icon_default, { icon: plus_default }) 45064 } 45065 ); 45066 }, 45067 isAppender: true 45068 } 45069 ); 45070 } 45071 const ButtonBlockerAppender = (0,external_wp_element_namespaceObject.forwardRef)((props, ref) => { 45072 external_wp_deprecated_default()(`wp.blockEditor.ButtonBlockerAppender`, { 45073 alternative: "wp.blockEditor.ButtonBlockAppender", 45074 since: "5.9" 45075 }); 45076 return button_block_appender_ButtonBlockAppender(props, ref); 45077 }); 45078 var button_block_appender_default = (0,external_wp_element_namespaceObject.forwardRef)(button_block_appender_ButtonBlockAppender); 45079 45080 45081 ;// ./node_modules/@wordpress/block-editor/build-module/components/grid/grid-visualizer.js 45082 45083 45084 45085 45086 45087 45088 45089 45090 45091 45092 45093 45094 function GridVisualizer({ clientId, contentRef, parentLayout }) { 45095 const isDistractionFree = (0,external_wp_data_namespaceObject.useSelect)( 45096 (select) => select(store).getSettings().isDistractionFree, 45097 [] 45098 ); 45099 const gridElement = useBlockElement(clientId); 45100 if (isDistractionFree || !gridElement) { 45101 return null; 45102 } 45103 const isManualGrid = parentLayout?.isManualPlacement && window.__experimentalEnableGridInteractivity; 45104 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 45105 GridVisualizerGrid, 45106 { 45107 gridClientId: clientId, 45108 gridElement, 45109 isManualGrid, 45110 ref: contentRef 45111 } 45112 ); 45113 } 45114 const GridVisualizerGrid = (0,external_wp_element_namespaceObject.forwardRef)( 45115 ({ gridClientId, gridElement, isManualGrid }, ref) => { 45116 const [gridInfo, setGridInfo] = (0,external_wp_element_namespaceObject.useState)( 45117 () => getGridInfo(gridElement) 45118 ); 45119 const [isDroppingAllowed, setIsDroppingAllowed] = (0,external_wp_element_namespaceObject.useState)(false); 45120 (0,external_wp_element_namespaceObject.useEffect)(() => { 45121 const resizeCallback = () => setGridInfo(getGridInfo(gridElement)); 45122 const borderBoxSpy = new window.ResizeObserver(resizeCallback); 45123 borderBoxSpy.observe(gridElement, { box: "border-box" }); 45124 const contentBoxSpy = new window.ResizeObserver(resizeCallback); 45125 contentBoxSpy.observe(gridElement); 45126 return () => { 45127 borderBoxSpy.disconnect(); 45128 contentBoxSpy.disconnect(); 45129 }; 45130 }, [gridElement]); 45131 (0,external_wp_element_namespaceObject.useEffect)(() => { 45132 function onGlobalDrag() { 45133 setIsDroppingAllowed(true); 45134 } 45135 function onGlobalDragEnd() { 45136 setIsDroppingAllowed(false); 45137 } 45138 document.addEventListener("drag", onGlobalDrag); 45139 document.addEventListener("dragend", onGlobalDragEnd); 45140 return () => { 45141 document.removeEventListener("drag", onGlobalDrag); 45142 document.removeEventListener("dragend", onGlobalDragEnd); 45143 }; 45144 }, []); 45145 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 45146 cover_default, 45147 { 45148 className: dist_clsx("block-editor-grid-visualizer", { 45149 "is-dropping-allowed": isDroppingAllowed 45150 }), 45151 clientId: gridClientId, 45152 __unstablePopoverSlot: "__unstable-block-tools-after", 45153 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 45154 "div", 45155 { 45156 ref, 45157 className: "block-editor-grid-visualizer__grid", 45158 style: gridInfo.style, 45159 children: isManualGrid ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 45160 ManualGridVisualizer, 45161 { 45162 gridClientId, 45163 gridInfo 45164 } 45165 ) : Array.from({ length: gridInfo.numItems }, (_, i) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 45166 GridVisualizerCell, 45167 { 45168 color: gridInfo.currentColor 45169 }, 45170 i 45171 )) 45172 } 45173 ) 45174 } 45175 ); 45176 } 45177 ); 45178 function ManualGridVisualizer({ gridClientId, gridInfo }) { 45179 const [highlightedRect, setHighlightedRect] = (0,external_wp_element_namespaceObject.useState)(null); 45180 const gridItemStyles = (0,external_wp_data_namespaceObject.useSelect)( 45181 (select) => { 45182 const { getBlockOrder, getBlockStyles } = unlock( 45183 select(store) 45184 ); 45185 const blockOrder = getBlockOrder(gridClientId); 45186 return getBlockStyles(blockOrder); 45187 }, 45188 [gridClientId] 45189 ); 45190 const occupiedRects = (0,external_wp_element_namespaceObject.useMemo)(() => { 45191 const rects = []; 45192 for (const style of Object.values(gridItemStyles)) { 45193 const { 45194 columnStart, 45195 rowStart, 45196 columnSpan = 1, 45197 rowSpan = 1 45198 } = style?.layout ?? {}; 45199 if (!columnStart || !rowStart) { 45200 continue; 45201 } 45202 rects.push( 45203 new GridRect({ 45204 columnStart, 45205 rowStart, 45206 columnSpan, 45207 rowSpan 45208 }) 45209 ); 45210 } 45211 return rects; 45212 }, [gridItemStyles]); 45213 return range(1, gridInfo.numRows).map( 45214 (row) => range(1, gridInfo.numColumns).map((column) => { 45215 const isCellOccupied = occupiedRects.some( 45216 (rect) => rect.contains(column, row) 45217 ); 45218 const isHighlighted = highlightedRect?.contains(column, row) ?? false; 45219 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 45220 GridVisualizerCell, 45221 { 45222 color: gridInfo.currentColor, 45223 className: isHighlighted && "is-highlighted", 45224 children: isCellOccupied ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 45225 GridVisualizerDropZone, 45226 { 45227 column, 45228 row, 45229 gridClientId, 45230 gridInfo, 45231 setHighlightedRect 45232 } 45233 ) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 45234 GridVisualizerAppender, 45235 { 45236 column, 45237 row, 45238 gridClientId, 45239 gridInfo, 45240 setHighlightedRect 45241 } 45242 ) 45243 }, 45244 `$row}-$column}` 45245 ); 45246 }) 45247 ); 45248 } 45249 function GridVisualizerCell({ color, children, className }) { 45250 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 45251 "div", 45252 { 45253 className: dist_clsx( 45254 "block-editor-grid-visualizer__cell", 45255 className 45256 ), 45257 style: { 45258 boxShadow: `inset 0 0 0 1px color-mix(in srgb, $color} 20%, #0000)`, 45259 color 45260 }, 45261 children 45262 } 45263 ); 45264 } 45265 function useGridVisualizerDropZone(column, row, gridClientId, gridInfo, setHighlightedRect) { 45266 const { 45267 getBlockAttributes, 45268 getBlockRootClientId, 45269 canInsertBlockType, 45270 getBlockName 45271 } = (0,external_wp_data_namespaceObject.useSelect)(store); 45272 const { 45273 updateBlockAttributes, 45274 moveBlocksToPosition, 45275 __unstableMarkNextChangeAsNotPersistent 45276 } = (0,external_wp_data_namespaceObject.useDispatch)(store); 45277 const getNumberOfBlocksBeforeCell = useGetNumberOfBlocksBeforeCell( 45278 gridClientId, 45279 gridInfo.numColumns 45280 ); 45281 return useDropZoneWithValidation({ 45282 validateDrag(srcClientId) { 45283 const blockName = getBlockName(srcClientId); 45284 if (!canInsertBlockType(blockName, gridClientId)) { 45285 return false; 45286 } 45287 const attributes = getBlockAttributes(srcClientId); 45288 const rect = new GridRect({ 45289 columnStart: column, 45290 rowStart: row, 45291 columnSpan: attributes.style?.layout?.columnSpan, 45292 rowSpan: attributes.style?.layout?.rowSpan 45293 }); 45294 const isInBounds = new GridRect({ 45295 columnSpan: gridInfo.numColumns, 45296 rowSpan: gridInfo.numRows 45297 }).containsRect(rect); 45298 return isInBounds; 45299 }, 45300 onDragEnter(srcClientId) { 45301 const attributes = getBlockAttributes(srcClientId); 45302 setHighlightedRect( 45303 new GridRect({ 45304 columnStart: column, 45305 rowStart: row, 45306 columnSpan: attributes.style?.layout?.columnSpan, 45307 rowSpan: attributes.style?.layout?.rowSpan 45308 }) 45309 ); 45310 }, 45311 onDragLeave() { 45312 setHighlightedRect( 45313 (prevHighlightedRect) => prevHighlightedRect?.columnStart === column && prevHighlightedRect?.rowStart === row ? null : prevHighlightedRect 45314 ); 45315 }, 45316 onDrop(srcClientId) { 45317 setHighlightedRect(null); 45318 const attributes = getBlockAttributes(srcClientId); 45319 updateBlockAttributes(srcClientId, { 45320 style: { 45321 ...attributes.style, 45322 layout: { 45323 ...attributes.style?.layout, 45324 columnStart: column, 45325 rowStart: row 45326 } 45327 } 45328 }); 45329 __unstableMarkNextChangeAsNotPersistent(); 45330 moveBlocksToPosition( 45331 [srcClientId], 45332 getBlockRootClientId(srcClientId), 45333 gridClientId, 45334 getNumberOfBlocksBeforeCell(column, row) 45335 ); 45336 } 45337 }); 45338 } 45339 function GridVisualizerDropZone({ 45340 column, 45341 row, 45342 gridClientId, 45343 gridInfo, 45344 setHighlightedRect 45345 }) { 45346 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 45347 "div", 45348 { 45349 className: "block-editor-grid-visualizer__drop-zone", 45350 ref: useGridVisualizerDropZone( 45351 column, 45352 row, 45353 gridClientId, 45354 gridInfo, 45355 setHighlightedRect 45356 ) 45357 } 45358 ); 45359 } 45360 function GridVisualizerAppender({ 45361 column, 45362 row, 45363 gridClientId, 45364 gridInfo, 45365 setHighlightedRect 45366 }) { 45367 const { 45368 updateBlockAttributes, 45369 moveBlocksToPosition, 45370 __unstableMarkNextChangeAsNotPersistent 45371 } = (0,external_wp_data_namespaceObject.useDispatch)(store); 45372 const getNumberOfBlocksBeforeCell = useGetNumberOfBlocksBeforeCell( 45373 gridClientId, 45374 gridInfo.numColumns 45375 ); 45376 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 45377 button_block_appender_default, 45378 { 45379 rootClientId: gridClientId, 45380 className: "block-editor-grid-visualizer__appender", 45381 ref: useGridVisualizerDropZone( 45382 column, 45383 row, 45384 gridClientId, 45385 gridInfo, 45386 setHighlightedRect 45387 ), 45388 style: { 45389 color: gridInfo.currentColor 45390 }, 45391 onSelect: (block) => { 45392 if (!block) { 45393 return; 45394 } 45395 updateBlockAttributes(block.clientId, { 45396 style: { 45397 layout: { 45398 columnStart: column, 45399 rowStart: row 45400 } 45401 } 45402 }); 45403 __unstableMarkNextChangeAsNotPersistent(); 45404 moveBlocksToPosition( 45405 [block.clientId], 45406 gridClientId, 45407 gridClientId, 45408 getNumberOfBlocksBeforeCell(column, row) 45409 ); 45410 } 45411 } 45412 ); 45413 } 45414 function useDropZoneWithValidation({ 45415 validateDrag, 45416 onDragEnter, 45417 onDragLeave, 45418 onDrop 45419 }) { 45420 const { getDraggedBlockClientIds } = (0,external_wp_data_namespaceObject.useSelect)(store); 45421 return (0,external_wp_compose_namespaceObject.__experimentalUseDropZone)({ 45422 onDragEnter() { 45423 const [srcClientId] = getDraggedBlockClientIds(); 45424 if (srcClientId && validateDrag(srcClientId)) { 45425 onDragEnter(srcClientId); 45426 } 45427 }, 45428 onDragLeave() { 45429 onDragLeave(); 45430 }, 45431 onDrop() { 45432 const [srcClientId] = getDraggedBlockClientIds(); 45433 if (srcClientId && validateDrag(srcClientId)) { 45434 onDrop(srcClientId); 45435 } 45436 } 45437 }); 45438 } 45439 45440 45441 ;// ./node_modules/@wordpress/block-editor/build-module/components/grid/grid-item-resizer.js 45442 45443 45444 45445 45446 45447 45448 function GridItemResizer({ 45449 clientId, 45450 bounds, 45451 onChange, 45452 parentLayout 45453 }) { 45454 const blockElement = useBlockElement(clientId); 45455 const rootBlockElement = blockElement?.parentElement; 45456 const { isManualPlacement } = parentLayout; 45457 if (!blockElement || !rootBlockElement) { 45458 return null; 45459 } 45460 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 45461 GridItemResizerInner, 45462 { 45463 clientId, 45464 bounds, 45465 blockElement, 45466 rootBlockElement, 45467 onChange, 45468 isManualGrid: isManualPlacement && window.__experimentalEnableGridInteractivity 45469 } 45470 ); 45471 } 45472 function GridItemResizerInner({ 45473 clientId, 45474 bounds, 45475 blockElement, 45476 rootBlockElement, 45477 onChange, 45478 isManualGrid 45479 }) { 45480 const [resizeDirection, setResizeDirection] = (0,external_wp_element_namespaceObject.useState)(null); 45481 const [enableSide, setEnableSide] = (0,external_wp_element_namespaceObject.useState)({ 45482 top: false, 45483 bottom: false, 45484 left: false, 45485 right: false 45486 }); 45487 (0,external_wp_element_namespaceObject.useEffect)(() => { 45488 const observer = new window.ResizeObserver(() => { 45489 const blockClientRect = blockElement.getBoundingClientRect(); 45490 const rootBlockClientRect = rootBlockElement.getBoundingClientRect(); 45491 setEnableSide({ 45492 top: blockClientRect.top > rootBlockClientRect.top, 45493 bottom: blockClientRect.bottom < rootBlockClientRect.bottom, 45494 left: blockClientRect.left > rootBlockClientRect.left, 45495 right: blockClientRect.right < rootBlockClientRect.right 45496 }); 45497 }); 45498 observer.observe(blockElement); 45499 return () => observer.disconnect(); 45500 }, [blockElement, rootBlockElement]); 45501 const justification = { 45502 right: "left", 45503 left: "right" 45504 }; 45505 const alignment = { 45506 top: "flex-end", 45507 bottom: "flex-start" 45508 }; 45509 const styles = { 45510 display: "flex", 45511 justifyContent: "center", 45512 alignItems: "center", 45513 ...justification[resizeDirection] && { 45514 justifyContent: justification[resizeDirection] 45515 }, 45516 ...alignment[resizeDirection] && { 45517 alignItems: alignment[resizeDirection] 45518 } 45519 }; 45520 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 45521 cover_default, 45522 { 45523 className: "block-editor-grid-item-resizer", 45524 clientId, 45525 __unstablePopoverSlot: "__unstable-block-tools-after", 45526 additionalStyles: styles, 45527 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 45528 external_wp_components_namespaceObject.ResizableBox, 45529 { 45530 className: "block-editor-grid-item-resizer__box", 45531 size: { 45532 width: "100%", 45533 height: "100%" 45534 }, 45535 enable: { 45536 bottom: enableSide.bottom, 45537 bottomLeft: false, 45538 bottomRight: false, 45539 left: enableSide.left, 45540 right: enableSide.right, 45541 top: enableSide.top, 45542 topLeft: false, 45543 topRight: false 45544 }, 45545 bounds, 45546 boundsByDirection: true, 45547 onPointerDown: ({ target, pointerId }) => { 45548 target.setPointerCapture(pointerId); 45549 }, 45550 onResizeStart: (event, direction) => { 45551 setResizeDirection(direction); 45552 }, 45553 onResizeStop: (event, direction, boxElement) => { 45554 const columnGap = parseFloat( 45555 utils_getComputedCSS(rootBlockElement, "column-gap") 45556 ); 45557 const rowGap = parseFloat( 45558 utils_getComputedCSS(rootBlockElement, "row-gap") 45559 ); 45560 const gridColumnTracks = getGridTracks( 45561 utils_getComputedCSS( 45562 rootBlockElement, 45563 "grid-template-columns" 45564 ), 45565 columnGap 45566 ); 45567 const gridRowTracks = getGridTracks( 45568 utils_getComputedCSS( 45569 rootBlockElement, 45570 "grid-template-rows" 45571 ), 45572 rowGap 45573 ); 45574 const rect = new window.DOMRect( 45575 blockElement.offsetLeft + boxElement.offsetLeft, 45576 blockElement.offsetTop + boxElement.offsetTop, 45577 boxElement.offsetWidth, 45578 boxElement.offsetHeight 45579 ); 45580 const columnStart = getClosestTrack(gridColumnTracks, rect.left) + 1; 45581 const rowStart = getClosestTrack(gridRowTracks, rect.top) + 1; 45582 const columnEnd = getClosestTrack(gridColumnTracks, rect.right, "end") + 1; 45583 const rowEnd = getClosestTrack(gridRowTracks, rect.bottom, "end") + 1; 45584 onChange({ 45585 columnSpan: columnEnd - columnStart + 1, 45586 rowSpan: rowEnd - rowStart + 1, 45587 columnStart: isManualGrid ? columnStart : void 0, 45588 rowStart: isManualGrid ? rowStart : void 0 45589 }); 45590 } 45591 } 45592 ) 45593 } 45594 ); 45595 } 45596 45597 45598 ;// ./node_modules/@wordpress/icons/build-module/library/chevron-up.js 45599 45600 45601 var chevron_up_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M6.5 12.4L12 8l5.5 4.4-.9 1.2L12 10l-4.5 3.6-1-1.2z" }) }); 45602 45603 45604 ;// ./node_modules/@wordpress/icons/build-module/library/chevron-down.js 45605 45606 45607 var chevron_down_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M17.5 11.6L12 16l-5.5-4.4.9-1.2L12 14l4.5-3.6 1 1.2z" }) }); 45608 45609 45610 ;// ./node_modules/@wordpress/block-editor/build-module/components/grid/grid-item-movers.js 45611 45612 45613 45614 45615 45616 45617 45618 45619 45620 45621 function GridItemMovers({ 45622 layout, 45623 parentLayout, 45624 onChange, 45625 gridClientId, 45626 blockClientId 45627 }) { 45628 const { moveBlocksToPosition, __unstableMarkNextChangeAsNotPersistent } = (0,external_wp_data_namespaceObject.useDispatch)(store); 45629 const columnStart = layout?.columnStart ?? 1; 45630 const rowStart = layout?.rowStart ?? 1; 45631 const columnSpan = layout?.columnSpan ?? 1; 45632 const rowSpan = layout?.rowSpan ?? 1; 45633 const columnEnd = columnStart + columnSpan - 1; 45634 const rowEnd = rowStart + rowSpan - 1; 45635 const columnCount = parentLayout?.columnCount; 45636 const rowCount = parentLayout?.rowCount; 45637 const getNumberOfBlocksBeforeCell = useGetNumberOfBlocksBeforeCell( 45638 gridClientId, 45639 columnCount 45640 ); 45641 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(block_controls_default, { group: "parent", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.ToolbarGroup, { className: "block-editor-grid-item-mover__move-button-container", children: [ 45642 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-grid-item-mover__move-horizontal-button-container is-left", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 45643 GridItemMover, 45644 { 45645 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_right_default : chevron_left_default, 45646 label: (0,external_wp_i18n_namespaceObject.__)("Move left"), 45647 description: (0,external_wp_i18n_namespaceObject.__)("Move left"), 45648 isDisabled: columnStart <= 1, 45649 onClick: () => { 45650 onChange({ 45651 columnStart: columnStart - 1 45652 }); 45653 __unstableMarkNextChangeAsNotPersistent(); 45654 moveBlocksToPosition( 45655 [blockClientId], 45656 gridClientId, 45657 gridClientId, 45658 getNumberOfBlocksBeforeCell( 45659 columnStart - 1, 45660 rowStart 45661 ) 45662 ); 45663 } 45664 } 45665 ) }), 45666 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-editor-grid-item-mover__move-vertical-button-container", children: [ 45667 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 45668 GridItemMover, 45669 { 45670 className: "is-up-button", 45671 icon: chevron_up_default, 45672 label: (0,external_wp_i18n_namespaceObject.__)("Move up"), 45673 description: (0,external_wp_i18n_namespaceObject.__)("Move up"), 45674 isDisabled: rowStart <= 1, 45675 onClick: () => { 45676 onChange({ 45677 rowStart: rowStart - 1 45678 }); 45679 __unstableMarkNextChangeAsNotPersistent(); 45680 moveBlocksToPosition( 45681 [blockClientId], 45682 gridClientId, 45683 gridClientId, 45684 getNumberOfBlocksBeforeCell( 45685 columnStart, 45686 rowStart - 1 45687 ) 45688 ); 45689 } 45690 } 45691 ), 45692 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 45693 GridItemMover, 45694 { 45695 className: "is-down-button", 45696 icon: chevron_down_default, 45697 label: (0,external_wp_i18n_namespaceObject.__)("Move down"), 45698 description: (0,external_wp_i18n_namespaceObject.__)("Move down"), 45699 isDisabled: rowCount && rowEnd >= rowCount, 45700 onClick: () => { 45701 onChange({ 45702 rowStart: rowStart + 1 45703 }); 45704 __unstableMarkNextChangeAsNotPersistent(); 45705 moveBlocksToPosition( 45706 [blockClientId], 45707 gridClientId, 45708 gridClientId, 45709 getNumberOfBlocksBeforeCell( 45710 columnStart, 45711 rowStart + 1 45712 ) 45713 ); 45714 } 45715 } 45716 ) 45717 ] }), 45718 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-grid-item-mover__move-horizontal-button-container is-right", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 45719 GridItemMover, 45720 { 45721 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left_default : chevron_right_default, 45722 label: (0,external_wp_i18n_namespaceObject.__)("Move right"), 45723 description: (0,external_wp_i18n_namespaceObject.__)("Move right"), 45724 isDisabled: columnCount && columnEnd >= columnCount, 45725 onClick: () => { 45726 onChange({ 45727 columnStart: columnStart + 1 45728 }); 45729 __unstableMarkNextChangeAsNotPersistent(); 45730 moveBlocksToPosition( 45731 [blockClientId], 45732 gridClientId, 45733 gridClientId, 45734 getNumberOfBlocksBeforeCell( 45735 columnStart + 1, 45736 rowStart 45737 ) 45738 ); 45739 } 45740 } 45741 ) }) 45742 ] }) }); 45743 } 45744 function GridItemMover({ 45745 className, 45746 icon, 45747 label, 45748 isDisabled, 45749 onClick, 45750 description 45751 }) { 45752 const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(GridItemMover); 45753 const descriptionId = `block-editor-grid-item-mover-button__description-$instanceId}`; 45754 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 45755 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 45756 external_wp_components_namespaceObject.ToolbarButton, 45757 { 45758 className: dist_clsx( 45759 "block-editor-grid-item-mover-button", 45760 className 45761 ), 45762 icon, 45763 label, 45764 "aria-describedby": descriptionId, 45765 onClick: isDisabled ? null : onClick, 45766 disabled: isDisabled, 45767 accessibleWhenDisabled: true 45768 } 45769 ), 45770 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, { id: descriptionId, children: description }) 45771 ] }); 45772 } 45773 45774 45775 ;// ./node_modules/@wordpress/block-editor/build-module/hooks/layout-child.js 45776 45777 45778 45779 45780 45781 45782 45783 45784 const LAYOUT_CHILD_BLOCK_PROPS_REFERENCE = {}; 45785 function useBlockPropsChildLayoutStyles({ style }) { 45786 const shouldRenderChildLayoutStyles = (0,external_wp_data_namespaceObject.useSelect)((select) => { 45787 return !select(store).getSettings().disableLayoutStyles; 45788 }); 45789 const layout = style?.layout ?? {}; 45790 const { 45791 selfStretch, 45792 flexSize, 45793 columnStart, 45794 rowStart, 45795 columnSpan, 45796 rowSpan 45797 } = layout; 45798 const parentLayout = useLayout() || {}; 45799 const { columnCount, minimumColumnWidth } = parentLayout; 45800 const id = (0,external_wp_compose_namespaceObject.useInstanceId)(LAYOUT_CHILD_BLOCK_PROPS_REFERENCE); 45801 const selector = `.wp-container-content-$id}`; 45802 if (false) {} 45803 let css = ""; 45804 if (shouldRenderChildLayoutStyles) { 45805 if (selfStretch === "fixed" && flexSize) { 45806 css = `$selector} { 45807 flex-basis: $flexSize}; 45808 box-sizing: border-box; 45809 }`; 45810 } else if (selfStretch === "fill") { 45811 css = `$selector} { 45812 flex-grow: 1; 45813 }`; 45814 } else if (columnStart && columnSpan) { 45815 css = `$selector} { 45816 grid-column: $columnStart} / span $columnSpan}; 45817 }`; 45818 } else if (columnStart) { 45819 css = `$selector} { 45820 grid-column: $columnStart}; 45821 }`; 45822 } else if (columnSpan) { 45823 css = `$selector} { 45824 grid-column: span $columnSpan}; 45825 }`; 45826 } 45827 if (rowStart && rowSpan) { 45828 css += `$selector} { 45829 grid-row: $rowStart} / span $rowSpan}; 45830 }`; 45831 } else if (rowStart) { 45832 css += `$selector} { 45833 grid-row: $rowStart}; 45834 }`; 45835 } else if (rowSpan) { 45836 css += `$selector} { 45837 grid-row: span $rowSpan}; 45838 }`; 45839 } 45840 if ((columnSpan || columnStart) && (minimumColumnWidth || !columnCount)) { 45841 let parentColumnValue = parseFloat(minimumColumnWidth); 45842 if (isNaN(parentColumnValue)) { 45843 parentColumnValue = 12; 45844 } 45845 let parentColumnUnit = minimumColumnWidth?.replace( 45846 parentColumnValue, 45847 "" 45848 ); 45849 if (!["px", "rem", "em"].includes(parentColumnUnit)) { 45850 parentColumnUnit = "rem"; 45851 } 45852 let numColsToBreakAt = 2; 45853 if (columnSpan && columnStart) { 45854 numColsToBreakAt = columnSpan + columnStart - 1; 45855 } else if (columnSpan) { 45856 numColsToBreakAt = columnSpan; 45857 } else { 45858 numColsToBreakAt = columnStart; 45859 } 45860 const defaultGapValue = parentColumnUnit === "px" ? 24 : 1.5; 45861 const containerQueryValue = numColsToBreakAt * parentColumnValue + (numColsToBreakAt - 1) * defaultGapValue; 45862 const minimumContainerQueryValue = parentColumnValue * 2 + defaultGapValue - 1; 45863 const gridColumnValue = columnSpan && columnSpan > 1 ? "1/-1" : "auto"; 45864 css += `@container (max-width: $Math.max( 45865 containerQueryValue, 45866 minimumContainerQueryValue 45867 )}$parentColumnUnit}) { 45868 $selector} { 45869 grid-column: $gridColumnValue}; 45870 grid-row: auto; 45871 } 45872 }`; 45873 } 45874 } 45875 useStyleOverride({ css }); 45876 if (!css) { 45877 return; 45878 } 45879 return { className: `wp-container-content-$id}` }; 45880 } 45881 function ChildLayoutControlsPure({ clientId, style, setAttributes }) { 45882 const parentLayout = useLayout() || {}; 45883 const { 45884 type: parentLayoutType = "default", 45885 allowSizingOnChildren = false, 45886 isManualPlacement 45887 } = parentLayout; 45888 if (parentLayoutType !== "grid") { 45889 return null; 45890 } 45891 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 45892 GridTools, 45893 { 45894 clientId, 45895 style, 45896 setAttributes, 45897 allowSizingOnChildren, 45898 isManualPlacement, 45899 parentLayout 45900 } 45901 ); 45902 } 45903 function GridTools({ 45904 clientId, 45905 style, 45906 setAttributes, 45907 allowSizingOnChildren, 45908 isManualPlacement, 45909 parentLayout 45910 }) { 45911 const { rootClientId, isVisible } = (0,external_wp_data_namespaceObject.useSelect)( 45912 (select) => { 45913 const { 45914 getBlockRootClientId, 45915 getBlockEditingMode, 45916 getTemplateLock 45917 } = select(store); 45918 const _rootClientId = getBlockRootClientId(clientId); 45919 if (getTemplateLock(_rootClientId) || getBlockEditingMode(_rootClientId) !== "default") { 45920 return { 45921 rootClientId: _rootClientId, 45922 isVisible: false 45923 }; 45924 } 45925 return { 45926 rootClientId: _rootClientId, 45927 isVisible: true 45928 }; 45929 }, 45930 [clientId] 45931 ); 45932 const [resizerBounds, setResizerBounds] = (0,external_wp_element_namespaceObject.useState)(); 45933 if (!isVisible) { 45934 return null; 45935 } 45936 function updateLayout(layout) { 45937 setAttributes({ 45938 style: { 45939 ...style, 45940 layout: { 45941 ...style?.layout, 45942 ...layout 45943 } 45944 } 45945 }); 45946 } 45947 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 45948 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 45949 GridVisualizer, 45950 { 45951 clientId: rootClientId, 45952 contentRef: setResizerBounds, 45953 parentLayout 45954 } 45955 ), 45956 allowSizingOnChildren && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 45957 GridItemResizer, 45958 { 45959 clientId, 45960 bounds: resizerBounds, 45961 onChange: updateLayout, 45962 parentLayout 45963 } 45964 ), 45965 isManualPlacement && window.__experimentalEnableGridInteractivity && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 45966 GridItemMovers, 45967 { 45968 layout: style?.layout, 45969 parentLayout, 45970 onChange: updateLayout, 45971 gridClientId: rootClientId, 45972 blockClientId: clientId 45973 } 45974 ) 45975 ] }); 45976 } 45977 var layout_child_default = { 45978 useBlockProps: useBlockPropsChildLayoutStyles, 45979 edit: ChildLayoutControlsPure, 45980 attributeKeys: ["style"], 45981 hasSupport() { 45982 return true; 45983 } 45984 }; 45985 45986 45987 ;// ./node_modules/@wordpress/block-editor/build-module/hooks/content-lock-ui.js 45988 45989 45990 45991 45992 45993 45994 45995 45996 function ContentLockControlsPure({ clientId }) { 45997 const { templateLock, isLockedByParent, isEditingAsBlocks } = (0,external_wp_data_namespaceObject.useSelect)( 45998 (select) => { 45999 const { 46000 getContentLockingParent, 46001 getTemplateLock, 46002 getTemporarilyEditingAsBlocks 46003 } = unlock(select(store)); 46004 return { 46005 templateLock: getTemplateLock(clientId), 46006 isLockedByParent: !!getContentLockingParent(clientId), 46007 isEditingAsBlocks: getTemporarilyEditingAsBlocks() === clientId 46008 }; 46009 }, 46010 [clientId] 46011 ); 46012 const { stopEditingAsBlocks } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store)); 46013 const isContentLocked = !isLockedByParent && templateLock === "contentOnly"; 46014 const stopEditingAsBlockCallback = (0,external_wp_element_namespaceObject.useCallback)(() => { 46015 stopEditingAsBlocks(clientId); 46016 }, [clientId, stopEditingAsBlocks]); 46017 if (!isContentLocked && !isEditingAsBlocks) { 46018 return null; 46019 } 46020 const showStopEditingAsBlocks = isEditingAsBlocks && !isContentLocked; 46021 return showStopEditingAsBlocks && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(block_controls_default, { group: "other", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarButton, { onClick: stopEditingAsBlockCallback, children: (0,external_wp_i18n_namespaceObject.__)("Done") }) }); 46022 } 46023 var content_lock_ui_default = { 46024 edit: ContentLockControlsPure, 46025 hasSupport() { 46026 return true; 46027 } 46028 }; 46029 46030 46031 ;// ./node_modules/@wordpress/block-editor/build-module/hooks/metadata.js 46032 46033 46034 const META_ATTRIBUTE_NAME = "metadata"; 46035 function addMetaAttribute(blockTypeSettings) { 46036 if (blockTypeSettings?.attributes?.[META_ATTRIBUTE_NAME]?.type) { 46037 return blockTypeSettings; 46038 } 46039 blockTypeSettings.attributes = { 46040 ...blockTypeSettings.attributes, 46041 [META_ATTRIBUTE_NAME]: { 46042 type: "object" 46043 } 46044 }; 46045 return blockTypeSettings; 46046 } 46047 function metadata_addTransforms(result, source, index, results) { 46048 if (results.length === 1 && result.innerBlocks.length === source.length) { 46049 return result; 46050 } 46051 if (results.length === 1 && source.length > 1 || results.length > 1 && source.length === 1) { 46052 return result; 46053 } 46054 if (results.length > 1 && source.length > 1 && results.length !== source.length) { 46055 return result; 46056 } 46057 const sourceMetadata = source[index]?.attributes?.metadata; 46058 if (!sourceMetadata) { 46059 return result; 46060 } 46061 const preservedMetadata = {}; 46062 if (sourceMetadata.noteId && !result.attributes?.metadata?.noteId) { 46063 preservedMetadata.noteId = sourceMetadata.noteId; 46064 } 46065 if (sourceMetadata.name && !result.attributes?.metadata?.name && (0,external_wp_blocks_namespaceObject.hasBlockSupport)(result.name, "renaming", true)) { 46066 preservedMetadata.name = sourceMetadata.name; 46067 } 46068 if (sourceMetadata.blockVisibility !== void 0 && !result.attributes?.metadata?.blockVisibility && (0,external_wp_blocks_namespaceObject.hasBlockSupport)(result.name, "blockVisibility", true)) { 46069 preservedMetadata.blockVisibility = sourceMetadata.blockVisibility; 46070 } 46071 if (Object.keys(preservedMetadata).length > 0) { 46072 return { 46073 ...result, 46074 attributes: { 46075 ...result.attributes, 46076 metadata: { 46077 ...result.attributes.metadata, 46078 ...preservedMetadata 46079 } 46080 } 46081 }; 46082 } 46083 return result; 46084 } 46085 (0,external_wp_hooks_namespaceObject.addFilter)( 46086 "blocks.registerBlockType", 46087 "core/metadata/addMetaAttribute", 46088 addMetaAttribute 46089 ); 46090 (0,external_wp_hooks_namespaceObject.addFilter)( 46091 "blocks.switchToBlockType.transformedBlock", 46092 "core/metadata/addTransforms", 46093 metadata_addTransforms 46094 ); 46095 46096 46097 ;// ./node_modules/@wordpress/block-editor/build-module/hooks/block-hooks.js 46098 46099 46100 46101 46102 46103 46104 46105 46106 const block_hooks_EMPTY_OBJECT = {}; 46107 function BlockHooksControlPure({ 46108 name, 46109 clientId, 46110 metadata: { ignoredHookedBlocks = [] } = {} 46111 }) { 46112 const blockTypes = (0,external_wp_data_namespaceObject.useSelect)( 46113 (select) => select(external_wp_blocks_namespaceObject.store).getBlockTypes(), 46114 [] 46115 ); 46116 const hookedBlocksForCurrentBlock = (0,external_wp_element_namespaceObject.useMemo)( 46117 () => blockTypes?.filter( 46118 ({ name: blockName, blockHooks }) => blockHooks && name in blockHooks || ignoredHookedBlocks.includes(blockName) 46119 ), 46120 [blockTypes, name, ignoredHookedBlocks] 46121 ); 46122 const hookedBlockClientIds = (0,external_wp_data_namespaceObject.useSelect)( 46123 (select) => { 46124 const { getBlocks, getBlockRootClientId: getBlockRootClientId2, getGlobalBlockCount } = select(store); 46125 const rootClientId = getBlockRootClientId2(clientId); 46126 const _hookedBlockClientIds = hookedBlocksForCurrentBlock.reduce( 46127 (clientIds, block) => { 46128 if (getGlobalBlockCount(block.name) === 0) { 46129 return clientIds; 46130 } 46131 const relativePosition = block?.blockHooks?.[name]; 46132 let candidates; 46133 switch (relativePosition) { 46134 case "before": 46135 case "after": 46136 candidates = getBlocks(rootClientId); 46137 break; 46138 case "first_child": 46139 case "last_child": 46140 candidates = getBlocks(clientId); 46141 break; 46142 case void 0: 46143 candidates = [ 46144 ...getBlocks(rootClientId), 46145 ...getBlocks(clientId) 46146 ]; 46147 break; 46148 } 46149 const hookedBlock = candidates?.find( 46150 (candidate) => candidate.name === block.name 46151 ); 46152 if (hookedBlock) { 46153 return { 46154 ...clientIds, 46155 [block.name]: hookedBlock.clientId 46156 }; 46157 } 46158 return clientIds; 46159 }, 46160 {} 46161 ); 46162 if (Object.values(_hookedBlockClientIds).length > 0) { 46163 return _hookedBlockClientIds; 46164 } 46165 return block_hooks_EMPTY_OBJECT; 46166 }, 46167 [hookedBlocksForCurrentBlock, name, clientId] 46168 ); 46169 const { getBlockIndex, getBlockCount, getBlockRootClientId } = (0,external_wp_data_namespaceObject.useSelect)(store); 46170 const { insertBlock, removeBlock } = (0,external_wp_data_namespaceObject.useDispatch)(store); 46171 if (!hookedBlocksForCurrentBlock.length) { 46172 return null; 46173 } 46174 const groupedHookedBlocks = hookedBlocksForCurrentBlock.reduce( 46175 (groups, block) => { 46176 const [namespace] = block.name.split("/"); 46177 if (!groups[namespace]) { 46178 groups[namespace] = []; 46179 } 46180 groups[namespace].push(block); 46181 return groups; 46182 }, 46183 {} 46184 ); 46185 const insertBlockIntoDesignatedLocation = (block, relativePosition) => { 46186 const blockIndex = getBlockIndex(clientId); 46187 const innerBlocksLength = getBlockCount(clientId); 46188 const rootClientId = getBlockRootClientId(clientId); 46189 switch (relativePosition) { 46190 case "before": 46191 case "after": 46192 insertBlock( 46193 block, 46194 relativePosition === "after" ? blockIndex + 1 : blockIndex, 46195 rootClientId, 46196 // Insert as a child of the current block's parent 46197 false 46198 ); 46199 break; 46200 case "first_child": 46201 case "last_child": 46202 insertBlock( 46203 block, 46204 // TODO: It'd be great if insertBlock() would accept negative indices for insertion. 46205 relativePosition === "first_child" ? 0 : innerBlocksLength, 46206 clientId, 46207 // Insert as a child of the current block. 46208 false 46209 ); 46210 break; 46211 case void 0: 46212 insertBlock( 46213 block, 46214 blockIndex + 1, 46215 rootClientId, 46216 // Insert as a child of the current block's parent 46217 false 46218 ); 46219 break; 46220 } 46221 }; 46222 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls_default, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 46223 external_wp_components_namespaceObject.PanelBody, 46224 { 46225 className: "block-editor-hooks__block-hooks", 46226 title: (0,external_wp_i18n_namespaceObject.__)("Plugins"), 46227 initialOpen: true, 46228 children: [ 46229 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { className: "block-editor-hooks__block-hooks-helptext", children: (0,external_wp_i18n_namespaceObject.__)( 46230 "Manage the inclusion of blocks added automatically by plugins." 46231 ) }), 46232 Object.keys(groupedHookedBlocks).map((vendor) => { 46233 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_element_namespaceObject.Fragment, { children: [ 46234 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("h3", { children: vendor }), 46235 groupedHookedBlocks[vendor].map((block) => { 46236 const checked = block.name in hookedBlockClientIds; 46237 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 46238 external_wp_components_namespaceObject.ToggleControl, 46239 { 46240 __nextHasNoMarginBottom: true, 46241 checked, 46242 label: block.title, 46243 onChange: () => { 46244 if (!checked) { 46245 const relativePosition = block.blockHooks[name]; 46246 insertBlockIntoDesignatedLocation( 46247 (0,external_wp_blocks_namespaceObject.createBlock)(block.name), 46248 relativePosition 46249 ); 46250 return; 46251 } 46252 removeBlock( 46253 hookedBlockClientIds[block.name], 46254 false 46255 ); 46256 } 46257 }, 46258 block.title 46259 ); 46260 }) 46261 ] }, vendor); 46262 }) 46263 ] 46264 } 46265 ) }); 46266 } 46267 var block_hooks_default = { 46268 edit: BlockHooksControlPure, 46269 attributeKeys: ["metadata"], 46270 hasSupport() { 46271 return true; 46272 } 46273 }; 46274 46275 46276 ;// ./node_modules/@wordpress/block-editor/build-module/hooks/block-bindings.js 46277 46278 46279 46280 46281 46282 46283 46284 46285 46286 46287 46288 46289 46290 46291 const { Menu } = unlock(external_wp_components_namespaceObject.privateApis); 46292 const block_bindings_EMPTY_OBJECT = {}; 46293 const getAttributeType = (blockName, attribute) => { 46294 const _attributeType = (0,external_wp_blocks_namespaceObject.getBlockType)(blockName).attributes?.[attribute]?.type; 46295 return _attributeType === "rich-text" ? "string" : _attributeType; 46296 }; 46297 const block_bindings_useToolsPanelDropdownMenuProps = () => { 46298 const isMobile = (0,external_wp_compose_namespaceObject.useViewportMatch)("medium", "<"); 46299 return !isMobile ? { 46300 popoverProps: { 46301 placement: "left-start", 46302 // For non-mobile, inner sidebar width (248px) - button width (24px) - border (1px) + padding (16px) + spacing (20px) 46303 offset: 259 46304 } 46305 } : {}; 46306 }; 46307 function BlockBindingsPanelMenuContent({ attribute, binding, sources }) { 46308 const { clientId } = useBlockEditContext(); 46309 const { updateBlockBindings } = useBlockBindingsUtils(); 46310 const isMobile = (0,external_wp_compose_namespaceObject.useViewportMatch)("medium", "<"); 46311 const blockContext = (0,external_wp_element_namespaceObject.useContext)(block_context_default); 46312 const { attributeType, select } = (0,external_wp_data_namespaceObject.useSelect)( 46313 (_select) => { 46314 const { name: blockName } = _select(store).getBlock(clientId); 46315 return { 46316 attributeType: getAttributeType(blockName, attribute), 46317 select: _select 46318 }; 46319 }, 46320 [clientId, attribute] 46321 ); 46322 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Menu, { placement: isMobile ? "bottom-start" : "left-start", children: Object.entries(sources).map(([sourceKey, source]) => { 46323 const sourceDataItems = source.data?.filter( 46324 (item) => item?.type === attributeType 46325 ); 46326 const noItemsAvailable = !sourceDataItems || sourceDataItems.length === 0; 46327 if (noItemsAvailable) { 46328 return null; 46329 } 46330 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 46331 Menu, 46332 { 46333 placement: isMobile ? "bottom-start" : "left-start", 46334 children: [ 46335 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Menu.SubmenuTriggerItem, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Menu.ItemLabel, { children: source.label }) }), 46336 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Menu.Popover, { gutter: 8, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Menu.Group, { children: sourceDataItems.map((item) => { 46337 const itemBindings = { 46338 source: sourceKey, 46339 args: item?.args || { 46340 key: item.key 46341 } 46342 }; 46343 const values = source.getValues({ 46344 select, 46345 context: blockContext, 46346 bindings: { 46347 [attribute]: itemBindings 46348 } 46349 }); 46350 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 46351 Menu.CheckboxItem, 46352 { 46353 onChange: () => { 46354 const isCurrentlySelected = es6_default()( 46355 binding?.args, 46356 item.args 46357 ) ?? // Deprecate key dependency in 7.0. 46358 item.key === binding?.args?.key; 46359 if (isCurrentlySelected) { 46360 updateBlockBindings({ 46361 [attribute]: void 0 46362 }); 46363 } else { 46364 updateBlockBindings({ 46365 [attribute]: itemBindings 46366 }); 46367 } 46368 }, 46369 name: attribute + "-binding", 46370 value: values[attribute], 46371 checked: es6_default()( 46372 binding?.args, 46373 item.args 46374 ) ?? // Deprecate key dependency in 7.0. 46375 item.key === binding?.args?.key, 46376 children: [ 46377 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Menu.ItemLabel, { children: item?.label }), 46378 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Menu.ItemHelpText, { children: values[attribute] }) 46379 ] 46380 }, 46381 sourceKey + JSON.stringify( 46382 item.args 46383 ) || item.key 46384 ); 46385 }) }) }) 46386 ] 46387 }, 46388 sourceKey 46389 ); 46390 }) }); 46391 } 46392 function BlockBindingsAttribute({ attribute, binding, sources, blockName }) { 46393 const { source: sourceName, args } = binding || {}; 46394 const source = sources?.[sourceName]; 46395 let displayText; 46396 let isValid = true; 46397 const isNotBound = binding === void 0; 46398 if (isNotBound) { 46399 const attributeType = getAttributeType(blockName, attribute); 46400 const hasCompatibleSources = Object.values(sources).some( 46401 (src) => src.data?.some((item) => item?.type === attributeType) 46402 ); 46403 if (!hasCompatibleSources) { 46404 displayText = (0,external_wp_i18n_namespaceObject.__)("No sources available"); 46405 } else { 46406 displayText = (0,external_wp_i18n_namespaceObject.__)("Not connected"); 46407 } 46408 isValid = true; 46409 } else if (!source) { 46410 isValid = false; 46411 displayText = (0,external_wp_i18n_namespaceObject.__)("Source not registered"); 46412 if (Object.keys(sources).length === 0) { 46413 displayText = (0,external_wp_i18n_namespaceObject.__)("No sources available"); 46414 } 46415 } else { 46416 displayText = source.data?.find((item) => es6_default()(item.args, args))?.label || source.label || sourceName; 46417 } 46418 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { className: "block-editor-bindings__item", spacing: 0, children: [ 46419 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { truncate: true, children: attribute }), 46420 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 46421 external_wp_components_namespaceObject.__experimentalText, 46422 { 46423 truncate: true, 46424 variant: isValid ? "muted" : void 0, 46425 isDestructive: !isValid, 46426 children: displayText 46427 } 46428 ) 46429 ] }); 46430 } 46431 function ReadOnlyBlockBindingsPanelItem({ 46432 attribute, 46433 binding, 46434 sources, 46435 blockName 46436 }) { 46437 const isMobile = (0,external_wp_compose_namespaceObject.useViewportMatch)("medium", "<"); 46438 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, { hasValue: () => !!binding, label: attribute, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Menu, { placement: isMobile ? "bottom-start" : "left-start", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Menu.TriggerButton, { render: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItem, {}), disabled: true, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 46439 BlockBindingsAttribute, 46440 { 46441 attribute, 46442 binding, 46443 sources, 46444 blockName 46445 } 46446 ) }) }) }); 46447 } 46448 function EditableBlockBindingsPanelItem({ 46449 attribute, 46450 binding, 46451 sources, 46452 blockName 46453 }) { 46454 const { updateBlockBindings } = useBlockBindingsUtils(); 46455 const isMobile = (0,external_wp_compose_namespaceObject.useViewportMatch)("medium", "<"); 46456 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 46457 external_wp_components_namespaceObject.__experimentalToolsPanelItem, 46458 { 46459 hasValue: () => !!binding, 46460 label: attribute, 46461 onDeselect: () => { 46462 updateBlockBindings({ 46463 [attribute]: void 0 46464 }); 46465 }, 46466 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(Menu, { placement: isMobile ? "bottom-start" : "left-start", children: [ 46467 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Menu.TriggerButton, { render: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItem, {}), children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 46468 BlockBindingsAttribute, 46469 { 46470 attribute, 46471 binding, 46472 sources, 46473 blockName 46474 } 46475 ) }), 46476 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Menu.Popover, { gutter: isMobile ? 8 : 36, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 46477 BlockBindingsPanelMenuContent, 46478 { 46479 attribute, 46480 binding, 46481 sources 46482 } 46483 ) }) 46484 ] }) 46485 } 46486 ); 46487 } 46488 const BlockBindingsPanel = ({ name: blockName, metadata }) => { 46489 const blockContext = (0,external_wp_element_namespaceObject.useContext)(block_context_default); 46490 const { removeAllBlockBindings } = useBlockBindingsUtils(); 46491 const dropdownMenuProps = block_bindings_useToolsPanelDropdownMenuProps(); 46492 const _sources = {}; 46493 const { sources, canUpdateBlockBindings, bindableAttributes } = (0,external_wp_data_namespaceObject.useSelect)( 46494 (select) => { 46495 const { __experimentalBlockBindingsSupportedAttributes } = select(store).getSettings(); 46496 const _bindableAttributes = __experimentalBlockBindingsSupportedAttributes?.[blockName]; 46497 if (!_bindableAttributes || _bindableAttributes.length === 0) { 46498 return block_bindings_EMPTY_OBJECT; 46499 } 46500 const registeredSources = (0,external_wp_blocks_namespaceObject.getBlockBindingsSources)(); 46501 Object.entries(registeredSources).forEach( 46502 ([ 46503 sourceName, 46504 { getFieldsList, usesContext, label, getValues } 46505 ]) => { 46506 const context = {}; 46507 if (usesContext?.length) { 46508 for (const key of usesContext) { 46509 context[key] = blockContext[key]; 46510 } 46511 } 46512 if (getFieldsList) { 46513 const fieldsListResult = getFieldsList({ 46514 select, 46515 context 46516 }); 46517 _sources[sourceName] = { 46518 data: fieldsListResult || [], 46519 label, 46520 getValues 46521 }; 46522 } else { 46523 _sources[sourceName] = { 46524 data: [], 46525 label, 46526 getValues 46527 }; 46528 } 46529 } 46530 ); 46531 return { 46532 sources: Object.values(_sources).length > 0 ? _sources : block_bindings_EMPTY_OBJECT, 46533 canUpdateBlockBindings: select(store).getSettings().canUpdateBlockBindings, 46534 bindableAttributes: _bindableAttributes 46535 }; 46536 }, 46537 [blockContext, blockName] 46538 ); 46539 if (!bindableAttributes || bindableAttributes.length === 0) { 46540 return null; 46541 } 46542 const { bindings } = metadata || {}; 46543 const hasCompatibleData = Object.values(sources).some( 46544 (source) => source.data && source.data.length > 0 46545 ); 46546 const readOnly = !canUpdateBlockBindings || !hasCompatibleData; 46547 if (bindings === void 0 && !hasCompatibleData) { 46548 return null; 46549 } 46550 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls_default, { group: "bindings", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 46551 external_wp_components_namespaceObject.__experimentalToolsPanel, 46552 { 46553 label: (0,external_wp_i18n_namespaceObject.__)("Attributes"), 46554 resetAll: () => { 46555 removeAllBlockBindings(); 46556 }, 46557 dropdownMenuProps, 46558 className: "block-editor-bindings__panel", 46559 children: [ 46560 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItemGroup, { isBordered: true, isSeparated: true, children: bindableAttributes.map((attribute) => { 46561 const binding = bindings?.[attribute]; 46562 const attributeType = getAttributeType( 46563 blockName, 46564 attribute 46565 ); 46566 const hasCompatibleDataForAttribute = Object.values( 46567 sources 46568 ).some( 46569 (source) => source.data?.some( 46570 (item) => item?.type === attributeType 46571 ) 46572 ); 46573 const isAttributeReadOnly = readOnly || !hasCompatibleDataForAttribute; 46574 return isAttributeReadOnly ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 46575 ReadOnlyBlockBindingsPanelItem, 46576 { 46577 attribute, 46578 binding, 46579 sources, 46580 blockName 46581 }, 46582 attribute 46583 ) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 46584 EditableBlockBindingsPanelItem, 46585 { 46586 attribute, 46587 binding, 46588 sources, 46589 blockName 46590 }, 46591 attribute 46592 ); 46593 }) }), 46594 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { as: "div", variant: "muted", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { children: (0,external_wp_i18n_namespaceObject.__)( 46595 "Attributes connected to custom fields or other dynamic data." 46596 ) }) }) 46597 ] 46598 } 46599 ) }); 46600 }; 46601 var block_bindings_default = { 46602 edit: BlockBindingsPanel, 46603 attributeKeys: ["metadata"], 46604 hasSupport() { 46605 return true; 46606 } 46607 }; 46608 46609 46610 ;// ./node_modules/@wordpress/block-editor/build-module/hooks/block-renaming.js 46611 46612 46613 function addLabelCallback(settings) { 46614 if (settings.__experimentalLabel) { 46615 return settings; 46616 } 46617 const supportsBlockNaming = (0,external_wp_blocks_namespaceObject.hasBlockSupport)( 46618 settings, 46619 "renaming", 46620 true 46621 // default value 46622 ); 46623 if (supportsBlockNaming) { 46624 settings.__experimentalLabel = (attributes, { context }) => { 46625 const { metadata } = attributes; 46626 if (context === "list-view" && metadata?.name) { 46627 return metadata.name; 46628 } 46629 }; 46630 } 46631 return settings; 46632 } 46633 (0,external_wp_hooks_namespaceObject.addFilter)( 46634 "blocks.registerBlockType", 46635 "core/metadata/addLabelCallback", 46636 addLabelCallback 46637 ); 46638 46639 46640 ;// ./node_modules/@wordpress/block-editor/build-module/components/grid/use-grid-layout-sync.js 46641 46642 46643 46644 46645 46646 46647 function useGridLayoutSync({ clientId: gridClientId }) { 46648 const { gridLayout, blockOrder, selectedBlockLayout } = (0,external_wp_data_namespaceObject.useSelect)( 46649 (select) => { 46650 const { getBlockAttributes: getBlockAttributes2, getBlockOrder } = select(store); 46651 const selectedBlock = select(store).getSelectedBlock(); 46652 return { 46653 gridLayout: getBlockAttributes2(gridClientId).layout ?? {}, 46654 blockOrder: getBlockOrder(gridClientId), 46655 selectedBlockLayout: selectedBlock?.attributes.style?.layout 46656 }; 46657 }, 46658 [gridClientId] 46659 ); 46660 const { getBlockAttributes, getBlockRootClientId } = (0,external_wp_data_namespaceObject.useSelect)(store); 46661 const { updateBlockAttributes, __unstableMarkNextChangeAsNotPersistent } = (0,external_wp_data_namespaceObject.useDispatch)(store); 46662 const selectedBlockRect = (0,external_wp_element_namespaceObject.useMemo)( 46663 () => selectedBlockLayout ? new GridRect(selectedBlockLayout) : null, 46664 [selectedBlockLayout] 46665 ); 46666 const previouslySelectedBlockRect = (0,external_wp_compose_namespaceObject.usePrevious)(selectedBlockRect); 46667 const previousIsManualPlacement = (0,external_wp_compose_namespaceObject.usePrevious)( 46668 gridLayout.isManualPlacement 46669 ); 46670 const previousBlockOrder = (0,external_wp_compose_namespaceObject.usePrevious)(blockOrder); 46671 (0,external_wp_element_namespaceObject.useEffect)(() => { 46672 const updates = {}; 46673 if (gridLayout.isManualPlacement) { 46674 const occupiedRects = []; 46675 for (const clientId of blockOrder) { 46676 const { 46677 columnStart, 46678 rowStart, 46679 columnSpan = 1, 46680 rowSpan = 1 46681 } = getBlockAttributes(clientId).style?.layout ?? {}; 46682 if (!columnStart || !rowStart) { 46683 continue; 46684 } 46685 occupiedRects.push( 46686 new GridRect({ 46687 columnStart, 46688 rowStart, 46689 columnSpan, 46690 rowSpan 46691 }) 46692 ); 46693 } 46694 for (const clientId of blockOrder) { 46695 const attributes = getBlockAttributes(clientId); 46696 const { 46697 columnStart, 46698 rowStart, 46699 columnSpan = 1, 46700 rowSpan = 1 46701 } = attributes.style?.layout ?? {}; 46702 if (columnStart && rowStart) { 46703 continue; 46704 } 46705 const [newColumnStart, newRowStart] = placeBlock( 46706 occupiedRects, 46707 gridLayout.columnCount, 46708 columnSpan, 46709 rowSpan, 46710 previouslySelectedBlockRect?.columnEnd, 46711 previouslySelectedBlockRect?.rowEnd 46712 ); 46713 occupiedRects.push( 46714 new GridRect({ 46715 columnStart: newColumnStart, 46716 rowStart: newRowStart, 46717 columnSpan, 46718 rowSpan 46719 }) 46720 ); 46721 updates[clientId] = { 46722 style: { 46723 ...attributes.style, 46724 layout: { 46725 ...attributes.style?.layout, 46726 columnStart: newColumnStart, 46727 rowStart: newRowStart 46728 } 46729 } 46730 }; 46731 } 46732 const bottomMostRow = Math.max( 46733 ...occupiedRects.map((r) => r.rowEnd) 46734 ); 46735 if (!gridLayout.rowCount || gridLayout.rowCount < bottomMostRow) { 46736 updates[gridClientId] = { 46737 layout: { 46738 ...gridLayout, 46739 rowCount: bottomMostRow 46740 } 46741 }; 46742 } 46743 for (const clientId of previousBlockOrder ?? []) { 46744 if (!blockOrder.includes(clientId)) { 46745 const rootClientId = getBlockRootClientId(clientId); 46746 if (rootClientId === null) { 46747 continue; 46748 } 46749 const rootAttributes = getBlockAttributes(rootClientId); 46750 if (rootAttributes?.layout?.type === "grid") { 46751 continue; 46752 } 46753 const attributes = getBlockAttributes(clientId); 46754 const { 46755 columnStart, 46756 rowStart, 46757 columnSpan, 46758 rowSpan, 46759 ...layout 46760 } = attributes.style?.layout ?? {}; 46761 if (columnStart || rowStart || columnSpan || rowSpan) { 46762 const hasEmptyLayoutAttribute = Object.keys(layout).length === 0; 46763 updates[clientId] = setImmutably( 46764 attributes, 46765 ["style", "layout"], 46766 hasEmptyLayoutAttribute ? void 0 : layout 46767 ); 46768 } 46769 } 46770 } 46771 } else { 46772 if (previousIsManualPlacement === true) { 46773 for (const clientId of blockOrder) { 46774 const attributes = getBlockAttributes(clientId); 46775 const { columnStart, rowStart, ...layout } = attributes.style?.layout ?? {}; 46776 if (columnStart || rowStart) { 46777 const hasEmptyLayoutAttribute = Object.keys(layout).length === 0; 46778 updates[clientId] = setImmutably( 46779 attributes, 46780 ["style", "layout"], 46781 hasEmptyLayoutAttribute ? void 0 : layout 46782 ); 46783 } 46784 } 46785 } 46786 if (gridLayout.rowCount) { 46787 updates[gridClientId] = { 46788 layout: { 46789 ...gridLayout, 46790 rowCount: void 0 46791 } 46792 }; 46793 } 46794 } 46795 if (Object.keys(updates).length) { 46796 __unstableMarkNextChangeAsNotPersistent(); 46797 updateBlockAttributes( 46798 Object.keys(updates), 46799 updates, 46800 /* uniqueByBlock: */ 46801 true 46802 ); 46803 } 46804 }, [ 46805 // Actual deps to sync: 46806 gridClientId, 46807 gridLayout, 46808 previousBlockOrder, 46809 blockOrder, 46810 previouslySelectedBlockRect, 46811 previousIsManualPlacement, 46812 // These won't change, but the linter thinks they might: 46813 __unstableMarkNextChangeAsNotPersistent, 46814 getBlockAttributes, 46815 getBlockRootClientId, 46816 updateBlockAttributes 46817 ]); 46818 } 46819 function placeBlock(occupiedRects, gridColumnCount, blockColumnSpan, blockRowSpan, startColumn = 1, startRow = 1) { 46820 for (let row = startRow; ; row++) { 46821 for (let column = row === startRow ? startColumn : 1; column <= gridColumnCount; column++) { 46822 const candidateRect = new GridRect({ 46823 columnStart: column, 46824 rowStart: row, 46825 columnSpan: blockColumnSpan, 46826 rowSpan: blockRowSpan 46827 }); 46828 if (!occupiedRects.some( 46829 (r) => r.intersectsRect(candidateRect) 46830 )) { 46831 return [column, row]; 46832 } 46833 } 46834 } 46835 } 46836 46837 46838 ;// ./node_modules/@wordpress/block-editor/build-module/hooks/grid-visualizer.js 46839 46840 46841 46842 46843 46844 46845 function GridLayoutSync(props) { 46846 useGridLayoutSync(props); 46847 } 46848 function grid_visualizer_GridTools({ clientId, layout }) { 46849 const isVisible = (0,external_wp_data_namespaceObject.useSelect)( 46850 (select) => { 46851 const { 46852 isBlockSelected, 46853 isDraggingBlocks, 46854 getTemplateLock, 46855 getBlockEditingMode 46856 } = select(store); 46857 if (!isDraggingBlocks() && !isBlockSelected(clientId) || getTemplateLock(clientId) || getBlockEditingMode(clientId) !== "default") { 46858 return false; 46859 } 46860 return true; 46861 }, 46862 [clientId] 46863 ); 46864 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 46865 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(GridLayoutSync, { clientId }), 46866 isVisible && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(GridVisualizer, { clientId, parentLayout: layout }) 46867 ] }); 46868 } 46869 const addGridVisualizerToBlockEdit = (0,external_wp_compose_namespaceObject.createHigherOrderComponent)( 46870 (BlockEdit) => (props) => { 46871 if (props.attributes.layout?.type !== "grid") { 46872 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockEdit, { ...props }, "edit"); 46873 } 46874 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 46875 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 46876 grid_visualizer_GridTools, 46877 { 46878 clientId: props.clientId, 46879 layout: props.attributes.layout 46880 } 46881 ), 46882 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockEdit, { ...props }, "edit") 46883 ] }); 46884 }, 46885 "addGridVisualizerToBlockEdit" 46886 ); 46887 (0,external_wp_hooks_namespaceObject.addFilter)( 46888 "editor.BlockEdit", 46889 "core/editor/grid-visualizer", 46890 addGridVisualizerToBlockEdit 46891 ); 46892 46893 ;// ./node_modules/@wordpress/block-editor/build-module/hooks/use-border-props.js 46894 46895 46896 46897 function getBorderClassesAndStyles(attributes) { 46898 const border = attributes.style?.border || {}; 46899 const className = getBorderClasses(attributes); 46900 return { 46901 className: className || void 0, 46902 style: getInlineStyles({ border }) 46903 }; 46904 } 46905 function useBorderProps(attributes) { 46906 const { colors } = useMultipleOriginColorsAndGradients(); 46907 const borderProps = getBorderClassesAndStyles(attributes); 46908 const { borderColor } = attributes; 46909 if (borderColor) { 46910 const borderColorObject = getMultiOriginColor({ 46911 colors, 46912 namedColor: borderColor 46913 }); 46914 borderProps.style.borderColor = borderColorObject.color; 46915 } 46916 return borderProps; 46917 } 46918 46919 46920 ;// ./node_modules/@wordpress/block-editor/build-module/hooks/use-shadow-props.js 46921 46922 function getShadowClassesAndStyles(attributes) { 46923 const shadow = attributes.style?.shadow || ""; 46924 return { 46925 style: getInlineStyles({ shadow }) 46926 }; 46927 } 46928 46929 46930 ;// ./node_modules/@wordpress/block-editor/build-module/hooks/use-color-props.js 46931 46932 46933 46934 46935 46936 46937 function getColorClassesAndStyles(attributes) { 46938 const { backgroundColor, textColor, gradient, style } = attributes; 46939 const backgroundClass = getColorClassName( 46940 "background-color", 46941 backgroundColor 46942 ); 46943 const textClass = getColorClassName("color", textColor); 46944 const gradientClass = __experimentalGetGradientClass(gradient); 46945 const hasGradient = gradientClass || style?.color?.gradient; 46946 const className = dist_clsx(textClass, gradientClass, { 46947 // Don't apply the background class if there's a gradient. 46948 [backgroundClass]: !hasGradient && !!backgroundClass, 46949 "has-text-color": textColor || style?.color?.text, 46950 "has-background": backgroundColor || style?.color?.background || gradient || style?.color?.gradient, 46951 "has-link-color": style?.elements?.link?.color 46952 }); 46953 const colorStyles = style?.color || {}; 46954 const styleProp = getInlineStyles({ color: colorStyles }); 46955 return { 46956 className: className || void 0, 46957 style: styleProp 46958 }; 46959 } 46960 function useColorProps(attributes) { 46961 const { backgroundColor, textColor, gradient } = attributes; 46962 const [ 46963 userPalette, 46964 themePalette, 46965 defaultPalette, 46966 userGradients, 46967 themeGradients, 46968 defaultGradients 46969 ] = use_settings_useSettings( 46970 "color.palette.custom", 46971 "color.palette.theme", 46972 "color.palette.default", 46973 "color.gradients.custom", 46974 "color.gradients.theme", 46975 "color.gradients.default" 46976 ); 46977 const colors = (0,external_wp_element_namespaceObject.useMemo)( 46978 () => [ 46979 ...userPalette || [], 46980 ...themePalette || [], 46981 ...defaultPalette || [] 46982 ], 46983 [userPalette, themePalette, defaultPalette] 46984 ); 46985 const gradients = (0,external_wp_element_namespaceObject.useMemo)( 46986 () => [ 46987 ...userGradients || [], 46988 ...themeGradients || [], 46989 ...defaultGradients || [] 46990 ], 46991 [userGradients, themeGradients, defaultGradients] 46992 ); 46993 const colorProps = getColorClassesAndStyles(attributes); 46994 if (backgroundColor) { 46995 const backgroundColorObject = getColorObjectByAttributeValues( 46996 colors, 46997 backgroundColor 46998 ); 46999 colorProps.style.backgroundColor = backgroundColorObject.color; 47000 } 47001 if (gradient) { 47002 colorProps.style.background = getGradientValueBySlug( 47003 gradients, 47004 gradient 47005 ); 47006 } 47007 if (textColor) { 47008 const textColorObject = getColorObjectByAttributeValues( 47009 colors, 47010 textColor 47011 ); 47012 colorProps.style.color = textColorObject.color; 47013 } 47014 return colorProps; 47015 } 47016 47017 47018 ;// ./node_modules/@wordpress/block-editor/build-module/hooks/use-spacing-props.js 47019 47020 function getSpacingClassesAndStyles(attributes) { 47021 const { style } = attributes; 47022 const spacingStyles = style?.spacing || {}; 47023 const styleProp = getInlineStyles({ spacing: spacingStyles }); 47024 return { 47025 style: styleProp 47026 }; 47027 } 47028 47029 47030 ;// ./node_modules/@wordpress/block-editor/build-module/hooks/use-typography-props.js 47031 47032 47033 47034 47035 47036 47037 const { kebabCase: use_typography_props_kebabCase } = unlock(external_wp_components_namespaceObject.privateApis); 47038 function getTypographyClassesAndStyles(attributes, settings) { 47039 let typographyStyles = attributes?.style?.typography || {}; 47040 typographyStyles = { 47041 ...typographyStyles, 47042 fontSize: getTypographyFontSizeValue( 47043 { size: attributes?.style?.typography?.fontSize }, 47044 settings 47045 ) 47046 }; 47047 const style = getInlineStyles({ typography: typographyStyles }); 47048 const fontFamilyClassName = !!attributes?.fontFamily ? `has-$use_typography_props_kebabCase(attributes.fontFamily)}-font-family` : ""; 47049 const textAlignClassName = !!attributes?.style?.typography?.textAlign ? `has-text-align-$attributes?.style?.typography?.textAlign}` : ""; 47050 const className = dist_clsx( 47051 fontFamilyClassName, 47052 textAlignClassName, 47053 getFontSizeClass(attributes?.fontSize) 47054 ); 47055 return { 47056 className, 47057 style 47058 }; 47059 } 47060 47061 47062 ;// ./node_modules/@wordpress/block-editor/build-module/hooks/use-cached-truthy.js 47063 47064 function useCachedTruthy(value) { 47065 const [cachedValue, setCachedValue] = (0,external_wp_element_namespaceObject.useState)(value); 47066 (0,external_wp_element_namespaceObject.useEffect)(() => { 47067 if (value) { 47068 setCachedValue(value); 47069 } 47070 }, [value]); 47071 return cachedValue; 47072 } 47073 47074 47075 ;// ./node_modules/@wordpress/block-editor/build-module/hooks/index.js 47076 47077 47078 47079 47080 47081 47082 47083 47084 47085 47086 47087 47088 47089 47090 47091 47092 47093 47094 47095 47096 47097 47098 47099 47100 47101 47102 47103 47104 47105 47106 createBlockEditFilter( 47107 [ 47108 align_default, 47109 text_align_default, 47110 anchor_default, 47111 custom_class_name_default, 47112 style_default, 47113 duotone_default, 47114 fit_text_default, 47115 position_default, 47116 layout_default, 47117 content_lock_ui_default, 47118 block_hooks_default, 47119 block_bindings_default, 47120 layout_child_default, 47121 allowed_blocks_default 47122 ].filter(Boolean) 47123 ); 47124 createBlockListBlockFilter([ 47125 align_default, 47126 text_align_default, 47127 background_default, 47128 style_default, 47129 color_default, 47130 dimensions_default, 47131 duotone_default, 47132 font_family_default, 47133 font_size_default, 47134 fit_text_default, 47135 border_default, 47136 position_default, 47137 block_style_variation_default, 47138 layout_child_default 47139 ]); 47140 createBlockSaveFilter([ 47141 align_default, 47142 text_align_default, 47143 anchor_default, 47144 aria_label_default, 47145 custom_class_name_default, 47146 border_default, 47147 fit_text_default, 47148 color_default, 47149 style_default, 47150 font_family_default, 47151 font_size_default 47152 ]); 47153 47154 47155 47156 47157 47158 47159 47160 47161 47162 47163 47164 47165 47166 47167 47168 ;// ./node_modules/@wordpress/block-editor/build-module/components/colors/with-colors.js 47169 47170 47171 47172 47173 47174 47175 47176 const { kebabCase: with_colors_kebabCase } = unlock(external_wp_components_namespaceObject.privateApis); 47177 const upperFirst = ([firstLetter, ...rest]) => firstLetter.toUpperCase() + rest.join(""); 47178 const withCustomColorPalette = (colorsArray) => (0,external_wp_compose_namespaceObject.createHigherOrderComponent)( 47179 (WrappedComponent) => (props) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(WrappedComponent, { ...props, colors: colorsArray }), 47180 "withCustomColorPalette" 47181 ); 47182 const withEditorColorPalette = () => (0,external_wp_compose_namespaceObject.createHigherOrderComponent)( 47183 (WrappedComponent) => (props) => { 47184 const [userPalette, themePalette, defaultPalette] = use_settings_useSettings( 47185 "color.palette.custom", 47186 "color.palette.theme", 47187 "color.palette.default" 47188 ); 47189 const allColors = (0,external_wp_element_namespaceObject.useMemo)( 47190 () => [ 47191 ...userPalette || [], 47192 ...themePalette || [], 47193 ...defaultPalette || [] 47194 ], 47195 [userPalette, themePalette, defaultPalette] 47196 ); 47197 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(WrappedComponent, { ...props, colors: allColors }); 47198 }, 47199 "withEditorColorPalette" 47200 ); 47201 function createColorHOC(colorTypes, withColorPalette) { 47202 const colorMap = colorTypes.reduce((colorObject, colorType) => { 47203 return { 47204 ...colorObject, 47205 ...typeof colorType === "string" ? { [colorType]: with_colors_kebabCase(colorType) } : colorType 47206 }; 47207 }, {}); 47208 return (0,external_wp_compose_namespaceObject.compose)([ 47209 withColorPalette, 47210 (WrappedComponent) => { 47211 return class extends external_wp_element_namespaceObject.Component { 47212 constructor(props) { 47213 super(props); 47214 this.setters = this.createSetters(); 47215 this.colorUtils = { 47216 getMostReadableColor: this.getMostReadableColor.bind(this) 47217 }; 47218 this.state = {}; 47219 } 47220 getMostReadableColor(colorValue) { 47221 const { colors } = this.props; 47222 return getMostReadableColor(colors, colorValue); 47223 } 47224 createSetters() { 47225 return Object.keys(colorMap).reduce( 47226 (settersAccumulator, colorAttributeName) => { 47227 const upperFirstColorAttributeName = upperFirst(colorAttributeName); 47228 const customColorAttributeName = `custom$upperFirstColorAttributeName}`; 47229 settersAccumulator[`set$upperFirstColorAttributeName}`] = this.createSetColor( 47230 colorAttributeName, 47231 customColorAttributeName 47232 ); 47233 return settersAccumulator; 47234 }, 47235 {} 47236 ); 47237 } 47238 createSetColor(colorAttributeName, customColorAttributeName) { 47239 return (colorValue) => { 47240 const colorObject = getColorObjectByColorValue( 47241 this.props.colors, 47242 colorValue 47243 ); 47244 this.props.setAttributes({ 47245 [colorAttributeName]: colorObject && colorObject.slug ? colorObject.slug : void 0, 47246 [customColorAttributeName]: colorObject && colorObject.slug ? void 0 : colorValue 47247 }); 47248 }; 47249 } 47250 static getDerivedStateFromProps({ attributes, colors }, previousState) { 47251 return Object.entries(colorMap).reduce( 47252 (newState, [colorAttributeName, colorContext]) => { 47253 const colorObject = getColorObjectByAttributeValues( 47254 colors, 47255 attributes[colorAttributeName], 47256 attributes[`custom$upperFirst( 47257 colorAttributeName 47258 )}`] 47259 ); 47260 const previousColorObject = previousState[colorAttributeName]; 47261 const previousColor = previousColorObject?.color; 47262 if (previousColor === colorObject.color && previousColorObject) { 47263 newState[colorAttributeName] = previousColorObject; 47264 } else { 47265 newState[colorAttributeName] = { 47266 ...colorObject, 47267 class: getColorClassName( 47268 colorContext, 47269 colorObject.slug 47270 ) 47271 }; 47272 } 47273 return newState; 47274 }, 47275 {} 47276 ); 47277 } 47278 render() { 47279 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 47280 WrappedComponent, 47281 { 47282 ...{ 47283 ...this.props, 47284 colors: void 0, 47285 ...this.state, 47286 ...this.setters, 47287 colorUtils: this.colorUtils 47288 } 47289 } 47290 ); 47291 } 47292 }; 47293 } 47294 ]); 47295 } 47296 function createCustomColorsHOC(colorsArray) { 47297 return (...colorTypes) => { 47298 const withColorPalette = withCustomColorPalette(colorsArray); 47299 return (0,external_wp_compose_namespaceObject.createHigherOrderComponent)( 47300 createColorHOC(colorTypes, withColorPalette), 47301 "withCustomColors" 47302 ); 47303 }; 47304 } 47305 function withColors(...colorTypes) { 47306 const withColorPalette = withEditorColorPalette(); 47307 return (0,external_wp_compose_namespaceObject.createHigherOrderComponent)( 47308 createColorHOC(colorTypes, withColorPalette), 47309 "withColors" 47310 ); 47311 } 47312 47313 47314 ;// ./node_modules/@wordpress/block-editor/build-module/components/colors/index.js 47315 47316 47317 47318 47319 ;// ./node_modules/@wordpress/block-editor/build-module/components/gradients/index.js 47320 47321 47322 ;// ./node_modules/@wordpress/block-editor/build-module/components/font-sizes/font-size-picker.js 47323 47324 47325 47326 function font_size_picker_FontSizePicker(props) { 47327 const [fontSizes, customFontSize] = use_settings_useSettings( 47328 "typography.fontSizes", 47329 "typography.customFontSize" 47330 ); 47331 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 47332 external_wp_components_namespaceObject.FontSizePicker, 47333 { 47334 ...props, 47335 fontSizes, 47336 disableCustomFontSizes: !customFontSize 47337 } 47338 ); 47339 } 47340 var font_size_picker_default = font_size_picker_FontSizePicker; 47341 47342 47343 ;// ./node_modules/@wordpress/block-editor/build-module/components/font-sizes/with-font-sizes.js 47344 47345 47346 47347 47348 47349 const DEFAULT_FONT_SIZES = []; 47350 const with_font_sizes_upperFirst = ([firstLetter, ...rest]) => firstLetter.toUpperCase() + rest.join(""); 47351 var with_font_sizes_default = (...fontSizeNames) => { 47352 const fontSizeAttributeNames = fontSizeNames.reduce( 47353 (fontSizeAttributeNamesAccumulator, fontSizeAttributeName) => { 47354 fontSizeAttributeNamesAccumulator[fontSizeAttributeName] = `custom$with_font_sizes_upperFirst(fontSizeAttributeName)}`; 47355 return fontSizeAttributeNamesAccumulator; 47356 }, 47357 {} 47358 ); 47359 return (0,external_wp_compose_namespaceObject.createHigherOrderComponent)( 47360 (0,external_wp_compose_namespaceObject.compose)([ 47361 (0,external_wp_compose_namespaceObject.createHigherOrderComponent)( 47362 (WrappedComponent) => (props) => { 47363 const [fontSizes] = use_settings_useSettings("typography.fontSizes"); 47364 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 47365 WrappedComponent, 47366 { 47367 ...props, 47368 fontSizes: fontSizes || DEFAULT_FONT_SIZES 47369 } 47370 ); 47371 }, 47372 "withFontSizes" 47373 ), 47374 (WrappedComponent) => { 47375 return class extends external_wp_element_namespaceObject.Component { 47376 constructor(props) { 47377 super(props); 47378 this.setters = this.createSetters(); 47379 this.state = {}; 47380 } 47381 createSetters() { 47382 return Object.entries(fontSizeAttributeNames).reduce( 47383 (settersAccumulator, [ 47384 fontSizeAttributeName, 47385 customFontSizeAttributeName 47386 ]) => { 47387 const upperFirstFontSizeAttributeName = with_font_sizes_upperFirst(fontSizeAttributeName); 47388 settersAccumulator[`set$upperFirstFontSizeAttributeName}`] = this.createSetFontSize( 47389 fontSizeAttributeName, 47390 customFontSizeAttributeName 47391 ); 47392 return settersAccumulator; 47393 }, 47394 {} 47395 ); 47396 } 47397 createSetFontSize(fontSizeAttributeName, customFontSizeAttributeName) { 47398 return (fontSizeValue) => { 47399 const fontSizeObject = this.props.fontSizes?.find( 47400 ({ size }) => size === Number(fontSizeValue) 47401 ); 47402 this.props.setAttributes({ 47403 [fontSizeAttributeName]: fontSizeObject && fontSizeObject.slug ? fontSizeObject.slug : void 0, 47404 [customFontSizeAttributeName]: fontSizeObject && fontSizeObject.slug ? void 0 : fontSizeValue 47405 }); 47406 }; 47407 } 47408 static getDerivedStateFromProps({ attributes, fontSizes }, previousState) { 47409 const didAttributesChange = (customFontSizeAttributeName, fontSizeAttributeName) => { 47410 if (previousState[fontSizeAttributeName]) { 47411 if (attributes[fontSizeAttributeName]) { 47412 return attributes[fontSizeAttributeName] !== previousState[fontSizeAttributeName].slug; 47413 } 47414 return previousState[fontSizeAttributeName].size !== attributes[customFontSizeAttributeName]; 47415 } 47416 return true; 47417 }; 47418 if (!Object.values(fontSizeAttributeNames).some( 47419 didAttributesChange 47420 )) { 47421 return null; 47422 } 47423 const newState = Object.entries( 47424 fontSizeAttributeNames 47425 ).filter( 47426 ([key, value]) => didAttributesChange(value, key) 47427 ).reduce( 47428 (newStateAccumulator, [ 47429 fontSizeAttributeName, 47430 customFontSizeAttributeName 47431 ]) => { 47432 const fontSizeAttributeValue = attributes[fontSizeAttributeName]; 47433 const fontSizeObject = utils_getFontSize( 47434 fontSizes, 47435 fontSizeAttributeValue, 47436 attributes[customFontSizeAttributeName] 47437 ); 47438 newStateAccumulator[fontSizeAttributeName] = { 47439 ...fontSizeObject, 47440 class: getFontSizeClass( 47441 fontSizeAttributeValue 47442 ) 47443 }; 47444 return newStateAccumulator; 47445 }, 47446 {} 47447 ); 47448 return { 47449 ...previousState, 47450 ...newState 47451 }; 47452 } 47453 render() { 47454 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 47455 WrappedComponent, 47456 { 47457 ...{ 47458 ...this.props, 47459 fontSizes: void 0, 47460 ...this.state, 47461 ...this.setters 47462 } 47463 } 47464 ); 47465 } 47466 }; 47467 } 47468 ]), 47469 "withFontSizes" 47470 ); 47471 }; 47472 47473 47474 ;// ./node_modules/@wordpress/block-editor/build-module/components/font-sizes/index.js 47475 47476 47477 47478 47479 47480 47481 ;// ./node_modules/@wordpress/block-editor/build-module/autocompleters/block.js 47482 47483 47484 47485 47486 47487 47488 47489 47490 47491 47492 const block_noop = () => { 47493 }; 47494 const block_SHOWN_BLOCK_TYPES = 9; 47495 function createBlockCompleter() { 47496 return { 47497 name: "blocks", 47498 className: "block-editor-autocompleters__block", 47499 triggerPrefix: "/", 47500 useItems(filterValue) { 47501 const { rootClientId, selectedBlockId, prioritizedBlocks } = (0,external_wp_data_namespaceObject.useSelect)((select) => { 47502 const { 47503 getSelectedBlockClientId, 47504 getBlock, 47505 getBlockListSettings, 47506 getBlockRootClientId 47507 } = select(store); 47508 const { getActiveBlockVariation } = select(external_wp_blocks_namespaceObject.store); 47509 const selectedBlockClientId = getSelectedBlockClientId(); 47510 const { name: blockName, attributes } = getBlock( 47511 selectedBlockClientId 47512 ); 47513 const activeBlockVariation = getActiveBlockVariation( 47514 blockName, 47515 attributes 47516 ); 47517 const _rootClientId = getBlockRootClientId( 47518 selectedBlockClientId 47519 ); 47520 return { 47521 selectedBlockId: activeBlockVariation ? `$blockName}/$activeBlockVariation.name}` : blockName, 47522 rootClientId: _rootClientId, 47523 prioritizedBlocks: getBlockListSettings(_rootClientId)?.prioritizedInserterBlocks 47524 }; 47525 }, []); 47526 const [items, categories, collections] = use_block_types_state_default( 47527 rootClientId, 47528 block_noop, 47529 true 47530 ); 47531 const filteredItems = (0,external_wp_element_namespaceObject.useMemo)(() => { 47532 const initialFilteredItems = !!filterValue.trim() ? searchBlockItems( 47533 items, 47534 categories, 47535 collections, 47536 filterValue 47537 ) : orderInserterBlockItems( 47538 orderBy(items, "frecency", "desc"), 47539 prioritizedBlocks 47540 ); 47541 return initialFilteredItems.filter((item) => item.id !== selectedBlockId).slice(0, block_SHOWN_BLOCK_TYPES); 47542 }, [ 47543 filterValue, 47544 selectedBlockId, 47545 items, 47546 categories, 47547 collections, 47548 prioritizedBlocks 47549 ]); 47550 const options = (0,external_wp_element_namespaceObject.useMemo)( 47551 () => filteredItems.map((blockItem) => { 47552 const { title, icon, isDisabled } = blockItem; 47553 return { 47554 key: `block-$blockItem.id}`, 47555 value: blockItem, 47556 label: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 47557 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 47558 block_icon_default, 47559 { 47560 icon, 47561 showColors: true 47562 }, 47563 "icon" 47564 ), 47565 title 47566 ] }), 47567 isDisabled 47568 }; 47569 }), 47570 [filteredItems] 47571 ); 47572 return [options]; 47573 }, 47574 allowContext(before, after) { 47575 return !(/\S/.test(before) || /\S/.test(after)); 47576 }, 47577 getOptionCompletion(inserterItem) { 47578 const { name, initialAttributes, innerBlocks, syncStatus, blocks } = inserterItem; 47579 return { 47580 action: "replace", 47581 value: syncStatus === "unsynced" ? (blocks ?? []).map( 47582 (block) => (0,external_wp_blocks_namespaceObject.cloneBlock)(block) 47583 ) : (0,external_wp_blocks_namespaceObject.createBlock)( 47584 name, 47585 initialAttributes, 47586 (0,external_wp_blocks_namespaceObject.createBlocksFromInnerBlocksTemplate)( 47587 innerBlocks 47588 ) 47589 ) 47590 }; 47591 } 47592 }; 47593 } 47594 var block_block_default = createBlockCompleter(); 47595 47596 47597 ;// external ["wp","apiFetch"] 47598 const external_wp_apiFetch_namespaceObject = window["wp"]["apiFetch"]; 47599 var external_wp_apiFetch_default = /*#__PURE__*/__webpack_require__.n(external_wp_apiFetch_namespaceObject); 47600 ;// ./node_modules/@wordpress/icons/build-module/library/post.js 47601 47602 47603 var post_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 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" }) }); 47604 47605 47606 ;// ./node_modules/@wordpress/block-editor/build-module/autocompleters/link.js 47607 47608 47609 47610 47611 47612 const SHOWN_SUGGESTIONS = 10; 47613 function createLinkCompleter() { 47614 return { 47615 name: "links", 47616 className: "block-editor-autocompleters__link", 47617 triggerPrefix: "[[", 47618 options: async (letters) => { 47619 let options = await external_wp_apiFetch_default()({ 47620 path: (0,external_wp_url_namespaceObject.addQueryArgs)("/wp/v2/search", { 47621 per_page: SHOWN_SUGGESTIONS, 47622 search: letters, 47623 type: "post", 47624 order_by: "menu_order" 47625 }) 47626 }); 47627 options = options.filter((option) => option.title !== ""); 47628 return options; 47629 }, 47630 getOptionKeywords(item) { 47631 const expansionWords = item.title.split(/\s+/); 47632 return [...expansionWords]; 47633 }, 47634 getOptionLabel(item) { 47635 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 47636 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 47637 icon_default, 47638 { 47639 icon: item.subtype === "page" ? page_default : post_default 47640 }, 47641 "icon" 47642 ), 47643 (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(item.title) 47644 ] }); 47645 }, 47646 getOptionCompletion(item) { 47647 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("a", { href: item.url, children: item.title }); 47648 } 47649 }; 47650 } 47651 var link_link_default = createLinkCompleter(); 47652 47653 47654 ;// ./node_modules/@wordpress/block-editor/build-module/components/autocomplete/index.js 47655 47656 47657 47658 47659 47660 47661 47662 47663 const autocomplete_EMPTY_ARRAY = []; 47664 function useCompleters({ completers = autocomplete_EMPTY_ARRAY }) { 47665 const { name } = useBlockEditContext(); 47666 return (0,external_wp_element_namespaceObject.useMemo)(() => { 47667 let filteredCompleters = [...completers, link_link_default]; 47668 if (name === (0,external_wp_blocks_namespaceObject.getDefaultBlockName)() || (0,external_wp_blocks_namespaceObject.getBlockSupport)(name, "__experimentalSlashInserter", false)) { 47669 filteredCompleters = [...filteredCompleters, block_block_default]; 47670 } 47671 if ((0,external_wp_hooks_namespaceObject.hasFilter)("editor.Autocomplete.completers")) { 47672 if (filteredCompleters === completers) { 47673 filteredCompleters = filteredCompleters.map( 47674 (completer) => ({ ...completer }) 47675 ); 47676 } 47677 filteredCompleters = (0,external_wp_hooks_namespaceObject.applyFilters)( 47678 "editor.Autocomplete.completers", 47679 filteredCompleters, 47680 name 47681 ); 47682 } 47683 return filteredCompleters; 47684 }, [completers, name]); 47685 } 47686 function useBlockEditorAutocompleteProps(props) { 47687 return (0,external_wp_components_namespaceObject.__unstableUseAutocompleteProps)({ 47688 ...props, 47689 completers: useCompleters(props) 47690 }); 47691 } 47692 function BlockEditorAutocomplete(props) { 47693 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Autocomplete, { ...props, completers: useCompleters(props) }); 47694 } 47695 var autocomplete_default = BlockEditorAutocomplete; 47696 47697 47698 ;// ./node_modules/@wordpress/icons/build-module/library/fullscreen.js 47699 47700 47701 var fullscreen_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M6 4a2 2 0 0 0-2 2v3h1.5V6a.5.5 0 0 1 .5-.5h3V4H6Zm3 14.5H6a.5.5 0 0 1-.5-.5v-3H4v3a2 2 0 0 0 2 2h3v-1.5Zm6 1.5v-1.5h3a.5.5 0 0 0 .5-.5v-3H20v3a2 2 0 0 1-2 2h-3Zm3-16a2 2 0 0 1 2 2v3h-1.5V6a.5.5 0 0 0-.5-.5h-3V4h3Z" }) }); 47702 47703 47704 ;// ./node_modules/@wordpress/block-editor/build-module/components/block-full-height-alignment-control/index.js 47705 47706 47707 47708 47709 function BlockFullHeightAlignmentControl({ 47710 isActive, 47711 label = (0,external_wp_i18n_namespaceObject.__)("Full height"), 47712 onToggle, 47713 isDisabled 47714 }) { 47715 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 47716 external_wp_components_namespaceObject.ToolbarButton, 47717 { 47718 isActive, 47719 icon: fullscreen_default, 47720 label, 47721 onClick: () => onToggle(!isActive), 47722 disabled: isDisabled 47723 } 47724 ); 47725 } 47726 var block_full_height_alignment_control_default = BlockFullHeightAlignmentControl; 47727 47728 47729 ;// ./node_modules/@wordpress/block-editor/build-module/components/block-alignment-matrix-control/index.js 47730 47731 47732 47733 47734 const block_alignment_matrix_control_noop = () => { 47735 }; 47736 function BlockAlignmentMatrixControl(props) { 47737 const { 47738 label = (0,external_wp_i18n_namespaceObject.__)("Change matrix alignment"), 47739 onChange = block_alignment_matrix_control_noop, 47740 value = "center", 47741 isDisabled 47742 } = props; 47743 const icon = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.AlignmentMatrixControl.Icon, { value }); 47744 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 47745 external_wp_components_namespaceObject.Dropdown, 47746 { 47747 popoverProps: { placement: "bottom-start" }, 47748 renderToggle: ({ onToggle, isOpen }) => { 47749 const openOnArrowDown = (event) => { 47750 if (!isOpen && event.keyCode === external_wp_keycodes_namespaceObject.DOWN) { 47751 event.preventDefault(); 47752 onToggle(); 47753 } 47754 }; 47755 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 47756 external_wp_components_namespaceObject.ToolbarButton, 47757 { 47758 onClick: onToggle, 47759 "aria-haspopup": "true", 47760 "aria-expanded": isOpen, 47761 onKeyDown: openOnArrowDown, 47762 label, 47763 icon, 47764 showTooltip: true, 47765 disabled: isDisabled 47766 } 47767 ); 47768 }, 47769 renderContent: () => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 47770 external_wp_components_namespaceObject.AlignmentMatrixControl, 47771 { 47772 hasFocusBorder: false, 47773 onChange, 47774 value 47775 } 47776 ) 47777 } 47778 ); 47779 } 47780 var block_alignment_matrix_control_default = BlockAlignmentMatrixControl; 47781 47782 47783 ;// ./node_modules/@wordpress/block-editor/build-module/components/block-title/use-block-display-title.js 47784 47785 47786 47787 function useBlockDisplayTitle({ 47788 clientId, 47789 maximumLength, 47790 context 47791 }) { 47792 const blockTitle = (0,external_wp_data_namespaceObject.useSelect)( 47793 (select) => { 47794 if (!clientId) { 47795 return null; 47796 } 47797 const { getBlockName, getBlockAttributes } = select(store); 47798 const { getBlockType, getActiveBlockVariation } = select(external_wp_blocks_namespaceObject.store); 47799 const blockName = getBlockName(clientId); 47800 const blockType = getBlockType(blockName); 47801 if (!blockType) { 47802 return null; 47803 } 47804 const attributes = getBlockAttributes(clientId); 47805 const label = (0,external_wp_blocks_namespaceObject.__experimentalGetBlockLabel)(blockType, attributes, context); 47806 if (label !== blockType.title) { 47807 return label; 47808 } 47809 const match = getActiveBlockVariation(blockName, attributes); 47810 return match?.title || blockType.title; 47811 }, 47812 [clientId, context] 47813 ); 47814 if (!blockTitle) { 47815 return null; 47816 } 47817 if (maximumLength && maximumLength > 0 && blockTitle.length > maximumLength) { 47818 const omission = "..."; 47819 return blockTitle.slice(0, maximumLength - omission.length) + omission; 47820 } 47821 return blockTitle; 47822 } 47823 47824 47825 ;// ./node_modules/@wordpress/block-editor/build-module/components/block-title/index.js 47826 47827 function BlockTitle({ clientId, maximumLength, context }) { 47828 return useBlockDisplayTitle({ clientId, maximumLength, context }); 47829 } 47830 47831 47832 ;// ./node_modules/@wordpress/block-editor/build-module/utils/get-editor-region.js 47833 function getEditorRegion(editor) { 47834 if (!editor) { 47835 return null; 47836 } 47837 const editorCanvas = Array.from( 47838 document.querySelectorAll('iframe[name="editor-canvas"]').values() 47839 ).find((iframe) => { 47840 const iframeDocument = iframe.contentDocument || iframe.contentWindow.document; 47841 return iframeDocument === editor.ownerDocument; 47842 }) ?? editor; 47843 return editorCanvas?.closest('[role="region"]') ?? editorCanvas; 47844 } 47845 47846 47847 ;// ./node_modules/@wordpress/block-editor/build-module/components/block-breadcrumb/index.js 47848 47849 47850 47851 47852 47853 47854 47855 47856 47857 47858 47859 function BlockBreadcrumb({ rootLabelText }) { 47860 const { selectBlock, clearSelectedBlock } = (0,external_wp_data_namespaceObject.useDispatch)(store); 47861 const { clientId, parents, hasSelection } = (0,external_wp_data_namespaceObject.useSelect)((select) => { 47862 const { 47863 getSelectionStart, 47864 getSelectedBlockClientId, 47865 getEnabledBlockParents 47866 } = unlock(select(store)); 47867 const selectedBlockClientId = getSelectedBlockClientId(); 47868 return { 47869 parents: getEnabledBlockParents(selectedBlockClientId), 47870 clientId: selectedBlockClientId, 47871 hasSelection: !!getSelectionStart().clientId 47872 }; 47873 }, []); 47874 const rootLabel = rootLabelText || (0,external_wp_i18n_namespaceObject.__)("Document"); 47875 const blockRef = (0,external_wp_element_namespaceObject.useRef)(); 47876 useBlockElementRef(clientId, blockRef); 47877 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 47878 "ul", 47879 { 47880 className: "block-editor-block-breadcrumb", 47881 role: "list", 47882 "aria-label": (0,external_wp_i18n_namespaceObject.__)("Block breadcrumb"), 47883 children: [ 47884 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 47885 "li", 47886 { 47887 className: !hasSelection ? "block-editor-block-breadcrumb__current" : void 0, 47888 "aria-current": !hasSelection ? "true" : void 0, 47889 children: [ 47890 hasSelection && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 47891 external_wp_components_namespaceObject.Button, 47892 { 47893 size: "small", 47894 className: "block-editor-block-breadcrumb__button", 47895 onClick: () => { 47896 const blockEditor = blockRef.current?.closest( 47897 ".editor-styles-wrapper" 47898 ); 47899 clearSelectedBlock(); 47900 getEditorRegion(blockEditor)?.focus(); 47901 }, 47902 children: rootLabel 47903 } 47904 ), 47905 !hasSelection && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { children: rootLabel }), 47906 !!clientId && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 47907 icon_default, 47908 { 47909 icon: chevron_right_small_default, 47910 className: "block-editor-block-breadcrumb__separator" 47911 } 47912 ) 47913 ] 47914 } 47915 ), 47916 parents.map((parentClientId) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("li", { children: [ 47917 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 47918 external_wp_components_namespaceObject.Button, 47919 { 47920 size: "small", 47921 className: "block-editor-block-breadcrumb__button", 47922 onClick: () => selectBlock(parentClientId), 47923 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 47924 BlockTitle, 47925 { 47926 clientId: parentClientId, 47927 maximumLength: 35 47928 } 47929 ) 47930 } 47931 ), 47932 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 47933 icon_default, 47934 { 47935 icon: chevron_right_small_default, 47936 className: "block-editor-block-breadcrumb__separator" 47937 } 47938 ) 47939 ] }, parentClientId)), 47940 !!clientId && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 47941 "li", 47942 { 47943 className: "block-editor-block-breadcrumb__current", 47944 "aria-current": "true", 47945 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockTitle, { clientId, maximumLength: 35 }) 47946 } 47947 ) 47948 ] 47949 } 47950 ); 47951 } 47952 var block_breadcrumb_default = BlockBreadcrumb; 47953 47954 47955 ;// ./node_modules/@wordpress/block-editor/build-module/components/block-content-overlay/index.js 47956 47957 47958 function useBlockOverlayActive(clientId) { 47959 return (0,external_wp_data_namespaceObject.useSelect)( 47960 (select) => { 47961 const { __unstableHasActiveBlockOverlayActive } = select(store); 47962 return __unstableHasActiveBlockOverlayActive(clientId); 47963 }, 47964 [clientId] 47965 ); 47966 } 47967 47968 47969 ;// ./node_modules/@wordpress/block-editor/build-module/components/block-tools/use-block-toolbar-popover-props.js 47970 47971 47972 47973 47974 47975 47976 47977 47978 const COMMON_PROPS = { 47979 placement: "top-start" 47980 }; 47981 const DEFAULT_PROPS = { 47982 ...COMMON_PROPS, 47983 flip: false, 47984 shift: true 47985 }; 47986 const RESTRICTED_HEIGHT_PROPS = { 47987 ...COMMON_PROPS, 47988 flip: true, 47989 shift: false 47990 }; 47991 function getProps(contentElement, selectedBlockElement, scrollContainer, toolbarHeight, isSticky) { 47992 if (!contentElement || !selectedBlockElement) { 47993 return DEFAULT_PROPS; 47994 } 47995 const scrollTop = scrollContainer?.scrollTop || 0; 47996 const blockRect = getElementBounds(selectedBlockElement); 47997 const contentRect = contentElement.getBoundingClientRect(); 47998 const topOfContentElementInViewport = scrollTop + contentRect.top; 47999 const viewportHeight = contentElement.ownerDocument.documentElement.clientHeight; 48000 const restrictedTopArea = topOfContentElementInViewport + toolbarHeight; 48001 const hasSpaceForToolbarAbove = blockRect.top > restrictedTopArea; 48002 const isBlockTallerThanViewport = blockRect.height > viewportHeight - toolbarHeight; 48003 if (!isSticky && (hasSpaceForToolbarAbove || isBlockTallerThanViewport)) { 48004 return DEFAULT_PROPS; 48005 } 48006 return RESTRICTED_HEIGHT_PROPS; 48007 } 48008 function useBlockToolbarPopoverProps({ 48009 contentElement, 48010 clientId 48011 }) { 48012 const selectedBlockElement = useBlockElement(clientId); 48013 const [toolbarHeight, setToolbarHeight] = (0,external_wp_element_namespaceObject.useState)(0); 48014 const { blockIndex, isSticky } = (0,external_wp_data_namespaceObject.useSelect)( 48015 (select) => { 48016 const { getBlockIndex, getBlockAttributes } = select(store); 48017 return { 48018 blockIndex: getBlockIndex(clientId), 48019 isSticky: hasStickyOrFixedPositionValue( 48020 getBlockAttributes(clientId) 48021 ) 48022 }; 48023 }, 48024 [clientId] 48025 ); 48026 const scrollContainer = (0,external_wp_element_namespaceObject.useMemo)(() => { 48027 if (!contentElement) { 48028 return; 48029 } 48030 return (0,external_wp_dom_namespaceObject.getScrollContainer)(contentElement); 48031 }, [contentElement]); 48032 const [props, setProps] = (0,external_wp_element_namespaceObject.useState)( 48033 () => getProps( 48034 contentElement, 48035 selectedBlockElement, 48036 scrollContainer, 48037 toolbarHeight, 48038 isSticky 48039 ) 48040 ); 48041 const popoverRef = (0,external_wp_compose_namespaceObject.useRefEffect)((popoverNode) => { 48042 setToolbarHeight(popoverNode.offsetHeight); 48043 }, []); 48044 const updateProps = (0,external_wp_element_namespaceObject.useCallback)( 48045 () => setProps( 48046 getProps( 48047 contentElement, 48048 selectedBlockElement, 48049 scrollContainer, 48050 toolbarHeight, 48051 isSticky 48052 ) 48053 ), 48054 [contentElement, selectedBlockElement, scrollContainer, toolbarHeight] 48055 ); 48056 (0,external_wp_element_namespaceObject.useLayoutEffect)(updateProps, [blockIndex, updateProps]); 48057 (0,external_wp_element_namespaceObject.useLayoutEffect)(() => { 48058 if (!contentElement || !selectedBlockElement) { 48059 return; 48060 } 48061 const contentView = contentElement?.ownerDocument?.defaultView; 48062 contentView?.addEventHandler?.("resize", updateProps); 48063 let resizeObserver; 48064 const blockView = selectedBlockElement?.ownerDocument?.defaultView; 48065 if (blockView.ResizeObserver) { 48066 resizeObserver = new blockView.ResizeObserver(updateProps); 48067 resizeObserver.observe(selectedBlockElement); 48068 } 48069 return () => { 48070 contentView?.removeEventHandler?.("resize", updateProps); 48071 if (resizeObserver) { 48072 resizeObserver.disconnect(); 48073 } 48074 }; 48075 }, [updateProps, contentElement, selectedBlockElement]); 48076 return { 48077 ...props, 48078 ref: popoverRef 48079 }; 48080 } 48081 48082 48083 ;// ./node_modules/@wordpress/block-editor/build-module/components/block-tools/use-selected-block-tool-props.js 48084 48085 48086 function useSelectedBlockToolProps(clientId) { 48087 const selectedBlockProps = (0,external_wp_data_namespaceObject.useSelect)( 48088 (select) => { 48089 const { 48090 getBlockRootClientId, 48091 getBlockParents, 48092 __experimentalGetBlockListSettingsForBlocks, 48093 isBlockInsertionPointVisible, 48094 getBlockInsertionPoint, 48095 getBlockOrder, 48096 hasMultiSelection, 48097 getLastMultiSelectedBlockClientId 48098 } = select(store); 48099 const blockParentsClientIds = getBlockParents(clientId); 48100 const parentBlockListSettings = __experimentalGetBlockListSettingsForBlocks( 48101 blockParentsClientIds 48102 ); 48103 const capturingClientId = blockParentsClientIds.find( 48104 (parentClientId) => parentBlockListSettings[parentClientId]?.__experimentalCaptureToolbars 48105 ); 48106 let isInsertionPointVisible = false; 48107 if (isBlockInsertionPointVisible()) { 48108 const insertionPoint = getBlockInsertionPoint(); 48109 const order = getBlockOrder(insertionPoint.rootClientId); 48110 isInsertionPointVisible = order[insertionPoint.index] === clientId; 48111 } 48112 return { 48113 capturingClientId, 48114 isInsertionPointVisible, 48115 lastClientId: hasMultiSelection() ? getLastMultiSelectedBlockClientId() : null, 48116 rootClientId: getBlockRootClientId(clientId) 48117 }; 48118 }, 48119 [clientId] 48120 ); 48121 return selectedBlockProps; 48122 } 48123 48124 48125 ;// ./node_modules/@wordpress/block-editor/build-module/components/block-tools/empty-block-inserter.js 48126 48127 48128 48129 48130 48131 48132 function EmptyBlockInserter({ 48133 clientId, 48134 __unstableContentRef 48135 }) { 48136 const { 48137 capturingClientId, 48138 isInsertionPointVisible, 48139 lastClientId, 48140 rootClientId 48141 } = useSelectedBlockToolProps(clientId); 48142 const popoverProps = useBlockToolbarPopoverProps({ 48143 contentElement: __unstableContentRef?.current, 48144 clientId 48145 }); 48146 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 48147 cover_default, 48148 { 48149 clientId: capturingClientId || clientId, 48150 bottomClientId: lastClientId, 48151 className: dist_clsx( 48152 "block-editor-block-list__block-side-inserter-popover", 48153 { 48154 "is-insertion-point-visible": isInsertionPointVisible 48155 } 48156 ), 48157 __unstableContentRef, 48158 ...popoverProps, 48159 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-block-list__empty-block-inserter", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 48160 inserter_default, 48161 { 48162 position: "bottom right", 48163 rootClientId, 48164 clientId, 48165 __experimentalIsQuick: true 48166 } 48167 ) }) 48168 } 48169 ); 48170 } 48171 48172 48173 ;// ./node_modules/@wordpress/block-editor/build-module/components/block-draggable/use-scroll-when-dragging.js 48174 48175 48176 const SCROLL_INACTIVE_DISTANCE_PX = 50; 48177 const SCROLL_INTERVAL_MS = 25; 48178 const PIXELS_PER_SECOND_PER_PERCENTAGE = 1e3; 48179 const VELOCITY_MULTIPLIER = PIXELS_PER_SECOND_PER_PERCENTAGE * (SCROLL_INTERVAL_MS / 1e3); 48180 function useScrollWhenDragging() { 48181 const dragStartYRef = (0,external_wp_element_namespaceObject.useRef)(null); 48182 const velocityYRef = (0,external_wp_element_namespaceObject.useRef)(null); 48183 const scrollParentYRef = (0,external_wp_element_namespaceObject.useRef)(null); 48184 const scrollEditorIntervalRef = (0,external_wp_element_namespaceObject.useRef)(null); 48185 (0,external_wp_element_namespaceObject.useEffect)( 48186 () => () => { 48187 if (scrollEditorIntervalRef.current) { 48188 clearInterval(scrollEditorIntervalRef.current); 48189 scrollEditorIntervalRef.current = null; 48190 } 48191 }, 48192 [] 48193 ); 48194 const startScrolling = (0,external_wp_element_namespaceObject.useCallback)((event) => { 48195 dragStartYRef.current = event.clientY; 48196 scrollParentYRef.current = (0,external_wp_dom_namespaceObject.getScrollContainer)(event.target); 48197 scrollEditorIntervalRef.current = setInterval(() => { 48198 if (scrollParentYRef.current && velocityYRef.current) { 48199 const newTop = scrollParentYRef.current.scrollTop + velocityYRef.current; 48200 scrollParentYRef.current.scroll({ 48201 top: newTop 48202 }); 48203 } 48204 }, SCROLL_INTERVAL_MS); 48205 }, []); 48206 const scrollOnDragOver = (0,external_wp_element_namespaceObject.useCallback)((event) => { 48207 if (!scrollParentYRef.current) { 48208 return; 48209 } 48210 const scrollParentHeight = scrollParentYRef.current.offsetHeight; 48211 const offsetDragStartPosition = dragStartYRef.current - scrollParentYRef.current.offsetTop; 48212 const offsetDragPosition = event.clientY - scrollParentYRef.current.offsetTop; 48213 if (event.clientY > offsetDragStartPosition) { 48214 const moveableDistance = Math.max( 48215 scrollParentHeight - offsetDragStartPosition - SCROLL_INACTIVE_DISTANCE_PX, 48216 0 48217 ); 48218 const dragDistance = Math.max( 48219 offsetDragPosition - offsetDragStartPosition - SCROLL_INACTIVE_DISTANCE_PX, 48220 0 48221 ); 48222 const distancePercentage = moveableDistance === 0 || dragDistance === 0 ? 0 : dragDistance / moveableDistance; 48223 velocityYRef.current = VELOCITY_MULTIPLIER * distancePercentage; 48224 } else if (event.clientY < offsetDragStartPosition) { 48225 const moveableDistance = Math.max( 48226 offsetDragStartPosition - SCROLL_INACTIVE_DISTANCE_PX, 48227 0 48228 ); 48229 const dragDistance = Math.max( 48230 offsetDragStartPosition - offsetDragPosition - SCROLL_INACTIVE_DISTANCE_PX, 48231 0 48232 ); 48233 const distancePercentage = moveableDistance === 0 || dragDistance === 0 ? 0 : dragDistance / moveableDistance; 48234 velocityYRef.current = -VELOCITY_MULTIPLIER * distancePercentage; 48235 } else { 48236 velocityYRef.current = 0; 48237 } 48238 }, []); 48239 const stopScrolling = () => { 48240 dragStartYRef.current = null; 48241 scrollParentYRef.current = null; 48242 if (scrollEditorIntervalRef.current) { 48243 clearInterval(scrollEditorIntervalRef.current); 48244 scrollEditorIntervalRef.current = null; 48245 } 48246 }; 48247 return [startScrolling, scrollOnDragOver, stopScrolling]; 48248 } 48249 48250 48251 ;// ./node_modules/@wordpress/block-editor/build-module/components/block-draggable/index.js 48252 48253 48254 48255 48256 48257 48258 48259 48260 48261 48262 48263 const BlockDraggable = ({ 48264 appendToOwnerDocument, 48265 children, 48266 clientIds, 48267 cloneClassname, 48268 elementId, 48269 onDragStart, 48270 onDragEnd, 48271 fadeWhenDisabled = false, 48272 dragComponent 48273 }) => { 48274 const { 48275 srcRootClientId, 48276 isDraggable, 48277 icon, 48278 visibleInserter, 48279 getBlockType 48280 } = (0,external_wp_data_namespaceObject.useSelect)( 48281 (select) => { 48282 const { 48283 canMoveBlocks, 48284 getBlockRootClientId: getBlockRootClientId2, 48285 getBlockName, 48286 getBlockAttributes, 48287 isBlockInsertionPointVisible 48288 } = select(store); 48289 const { getBlockType: _getBlockType, getActiveBlockVariation } = select(external_wp_blocks_namespaceObject.store); 48290 const rootClientId = getBlockRootClientId2(clientIds[0]); 48291 const blockName = getBlockName(clientIds[0]); 48292 const variation = getActiveBlockVariation( 48293 blockName, 48294 getBlockAttributes(clientIds[0]) 48295 ); 48296 return { 48297 srcRootClientId: rootClientId, 48298 isDraggable: canMoveBlocks(clientIds), 48299 icon: variation?.icon || _getBlockType(blockName)?.icon, 48300 visibleInserter: isBlockInsertionPointVisible(), 48301 getBlockType: _getBlockType 48302 }; 48303 }, 48304 [clientIds] 48305 ); 48306 const isDraggingRef = (0,external_wp_element_namespaceObject.useRef)(false); 48307 const [startScrolling, scrollOnDragOver, stopScrolling] = useScrollWhenDragging(); 48308 const { getAllowedBlocks, getBlockNamesByClientId, getBlockRootClientId } = (0,external_wp_data_namespaceObject.useSelect)(store); 48309 const { startDraggingBlocks, stopDraggingBlocks } = (0,external_wp_data_namespaceObject.useDispatch)(store); 48310 (0,external_wp_element_namespaceObject.useEffect)(() => { 48311 return () => { 48312 if (isDraggingRef.current) { 48313 stopDraggingBlocks(); 48314 } 48315 }; 48316 }, []); 48317 const blockEl = useBlockElement(clientIds[0]); 48318 const editorRoot = blockEl?.closest("body"); 48319 (0,external_wp_element_namespaceObject.useEffect)(() => { 48320 if (!editorRoot || !fadeWhenDisabled) { 48321 return; 48322 } 48323 const onDragOver = (event) => { 48324 if (!event.target.closest("[data-block]")) { 48325 return; 48326 } 48327 const draggedBlockNames = getBlockNamesByClientId(clientIds); 48328 const targetClientId = event.target.closest("[data-block]").getAttribute("data-block"); 48329 const allowedBlocks = getAllowedBlocks(targetClientId); 48330 const targetBlockName = getBlockNamesByClientId([ 48331 targetClientId 48332 ])[0]; 48333 let dropTargetValid; 48334 if (allowedBlocks?.length === 0) { 48335 const targetRootClientId = getBlockRootClientId(targetClientId); 48336 const targetRootBlockName = getBlockNamesByClientId([ 48337 targetRootClientId 48338 ])[0]; 48339 const rootAllowedBlocks = getAllowedBlocks(targetRootClientId); 48340 dropTargetValid = isDropTargetValid( 48341 getBlockType, 48342 rootAllowedBlocks, 48343 draggedBlockNames, 48344 targetRootBlockName 48345 ); 48346 } else { 48347 dropTargetValid = isDropTargetValid( 48348 getBlockType, 48349 allowedBlocks, 48350 draggedBlockNames, 48351 targetBlockName 48352 ); 48353 } 48354 if (!dropTargetValid && !visibleInserter) { 48355 window?.document?.body?.classList?.add( 48356 "block-draggable-invalid-drag-token" 48357 ); 48358 } else { 48359 window?.document?.body?.classList?.remove( 48360 "block-draggable-invalid-drag-token" 48361 ); 48362 } 48363 }; 48364 const throttledOnDragOver = (0,external_wp_compose_namespaceObject.throttle)(onDragOver, 200); 48365 editorRoot.addEventListener("dragover", throttledOnDragOver); 48366 return () => { 48367 editorRoot.removeEventListener("dragover", throttledOnDragOver); 48368 }; 48369 }, [ 48370 clientIds, 48371 editorRoot, 48372 fadeWhenDisabled, 48373 getAllowedBlocks, 48374 getBlockNamesByClientId, 48375 getBlockRootClientId, 48376 getBlockType, 48377 visibleInserter 48378 ]); 48379 if (!isDraggable) { 48380 return children({ draggable: false }); 48381 } 48382 const transferData = { 48383 type: "block", 48384 srcClientIds: clientIds, 48385 srcRootClientId 48386 }; 48387 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 48388 external_wp_components_namespaceObject.Draggable, 48389 { 48390 appendToOwnerDocument, 48391 cloneClassname, 48392 __experimentalTransferDataType: "wp-blocks", 48393 transferData, 48394 onDragStart: (event) => { 48395 window.requestAnimationFrame(() => { 48396 startDraggingBlocks(clientIds); 48397 isDraggingRef.current = true; 48398 startScrolling(event); 48399 if (onDragStart) { 48400 onDragStart(); 48401 } 48402 }); 48403 }, 48404 onDragOver: scrollOnDragOver, 48405 onDragEnd: () => { 48406 stopDraggingBlocks(); 48407 isDraggingRef.current = false; 48408 stopScrolling(); 48409 if (onDragEnd) { 48410 onDragEnd(); 48411 } 48412 }, 48413 __experimentalDragComponent: ( 48414 // Check against `undefined` so that `null` can be used to disable 48415 // the default drag component. 48416 dragComponent !== void 0 ? dragComponent : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 48417 BlockDraggableChip, 48418 { 48419 count: clientIds.length, 48420 icon, 48421 fadeWhenDisabled: true 48422 } 48423 ) 48424 ), 48425 elementId, 48426 children: ({ onDraggableStart, onDraggableEnd }) => { 48427 return children({ 48428 draggable: true, 48429 onDragStart: onDraggableStart, 48430 onDragEnd: onDraggableEnd 48431 }); 48432 } 48433 } 48434 ); 48435 }; 48436 var block_draggable_default = BlockDraggable; 48437 48438 48439 ;// ./node_modules/@wordpress/block-editor/build-module/components/block-mover/mover-description.js 48440 48441 const getMovementDirection = (moveDirection, orientation) => { 48442 if (moveDirection === "up") { 48443 if (orientation === "horizontal") { 48444 return (0,external_wp_i18n_namespaceObject.isRTL)() ? "right" : "left"; 48445 } 48446 return "up"; 48447 } else if (moveDirection === "down") { 48448 if (orientation === "horizontal") { 48449 return (0,external_wp_i18n_namespaceObject.isRTL)() ? "left" : "right"; 48450 } 48451 return "down"; 48452 } 48453 return null; 48454 }; 48455 function getBlockMoverDescription(selectedCount, type, firstIndex, isFirst, isLast, dir, orientation) { 48456 const position = firstIndex + 1; 48457 if (selectedCount > 1) { 48458 return getMultiBlockMoverDescription( 48459 selectedCount, 48460 firstIndex, 48461 isFirst, 48462 isLast, 48463 dir, 48464 orientation 48465 ); 48466 } 48467 if (isFirst && isLast) { 48468 return (0,external_wp_i18n_namespaceObject.sprintf)( 48469 // translators: %s: Type of block (i.e. Text, Image etc) 48470 (0,external_wp_i18n_namespaceObject.__)("Block %s is the only block, and cannot be moved"), 48471 type 48472 ); 48473 } 48474 if (dir > 0 && !isLast) { 48475 const movementDirection = getMovementDirection("down", orientation); 48476 if (movementDirection === "down") { 48477 return (0,external_wp_i18n_namespaceObject.sprintf)( 48478 // translators: 1: Type of block (i.e. Text, Image etc), 2: Position of selected block, 3: New position 48479 (0,external_wp_i18n_namespaceObject.__)( 48480 "Move %1$s block from position %2$d down to position %3$d" 48481 ), 48482 type, 48483 position, 48484 position + 1 48485 ); 48486 } 48487 if (movementDirection === "left") { 48488 return (0,external_wp_i18n_namespaceObject.sprintf)( 48489 // translators: 1: Type of block (i.e. Text, Image etc), 2: Position of selected block, 3: New position 48490 (0,external_wp_i18n_namespaceObject.__)( 48491 "Move %1$s block from position %2$d left to position %3$d" 48492 ), 48493 type, 48494 position, 48495 position + 1 48496 ); 48497 } 48498 if (movementDirection === "right") { 48499 return (0,external_wp_i18n_namespaceObject.sprintf)( 48500 // translators: 1: Type of block (i.e. Text, Image etc), 2: Position of selected block, 3: New position 48501 (0,external_wp_i18n_namespaceObject.__)( 48502 "Move %1$s block from position %2$d right to position %3$d" 48503 ), 48504 type, 48505 position, 48506 position + 1 48507 ); 48508 } 48509 } 48510 if (dir > 0 && isLast) { 48511 const movementDirection = getMovementDirection("down", orientation); 48512 if (movementDirection === "down") { 48513 return (0,external_wp_i18n_namespaceObject.sprintf)( 48514 // translators: 1: Type of block (i.e. Text, Image etc) 48515 (0,external_wp_i18n_namespaceObject.__)( 48516 "Block %1$s is at the end of the content and can\u2019t be moved down" 48517 ), 48518 type 48519 ); 48520 } 48521 if (movementDirection === "left") { 48522 return (0,external_wp_i18n_namespaceObject.sprintf)( 48523 // translators: 1: Type of block (i.e. Text, Image etc) 48524 (0,external_wp_i18n_namespaceObject.__)( 48525 "Block %1$s is at the end of the content and can\u2019t be moved left" 48526 ), 48527 type 48528 ); 48529 } 48530 if (movementDirection === "right") { 48531 return (0,external_wp_i18n_namespaceObject.sprintf)( 48532 // translators: 1: Type of block (i.e. Text, Image etc) 48533 (0,external_wp_i18n_namespaceObject.__)( 48534 "Block %1$s is at the end of the content and can\u2019t be moved right" 48535 ), 48536 type 48537 ); 48538 } 48539 } 48540 if (dir < 0 && !isFirst) { 48541 const movementDirection = getMovementDirection("up", orientation); 48542 if (movementDirection === "up") { 48543 return (0,external_wp_i18n_namespaceObject.sprintf)( 48544 // translators: 1: Type of block (i.e. Text, Image etc), 2: Position of selected block, 3: New position 48545 (0,external_wp_i18n_namespaceObject.__)("Move %1$s block from position %2$d up to position %3$d"), 48546 type, 48547 position, 48548 position - 1 48549 ); 48550 } 48551 if (movementDirection === "left") { 48552 return (0,external_wp_i18n_namespaceObject.sprintf)( 48553 // translators: 1: Type of block (i.e. Text, Image etc), 2: Position of selected block, 3: New position 48554 (0,external_wp_i18n_namespaceObject.__)( 48555 "Move %1$s block from position %2$d left to position %3$d" 48556 ), 48557 type, 48558 position, 48559 position - 1 48560 ); 48561 } 48562 if (movementDirection === "right") { 48563 return (0,external_wp_i18n_namespaceObject.sprintf)( 48564 // translators: 1: Type of block (i.e. Text, Image etc), 2: Position of selected block, 3: New position 48565 (0,external_wp_i18n_namespaceObject.__)( 48566 "Move %1$s block from position %2$d right to position %3$d" 48567 ), 48568 type, 48569 position, 48570 position - 1 48571 ); 48572 } 48573 } 48574 if (dir < 0 && isFirst) { 48575 const movementDirection = getMovementDirection("up", orientation); 48576 if (movementDirection === "up") { 48577 return (0,external_wp_i18n_namespaceObject.sprintf)( 48578 // translators: 1: Type of block (i.e. Text, Image etc) 48579 (0,external_wp_i18n_namespaceObject.__)( 48580 "Block %1$s is at the beginning of the content and can\u2019t be moved up" 48581 ), 48582 type 48583 ); 48584 } 48585 if (movementDirection === "left") { 48586 return (0,external_wp_i18n_namespaceObject.sprintf)( 48587 // translators: 1: Type of block (i.e. Text, Image etc) 48588 (0,external_wp_i18n_namespaceObject.__)( 48589 "Block %1$s is at the beginning of the content and can\u2019t be moved left" 48590 ), 48591 type 48592 ); 48593 } 48594 if (movementDirection === "right") { 48595 return (0,external_wp_i18n_namespaceObject.sprintf)( 48596 // translators: 1: Type of block (i.e. Text, Image etc) 48597 (0,external_wp_i18n_namespaceObject.__)( 48598 "Block %1$s is at the beginning of the content and can\u2019t be moved right" 48599 ), 48600 type 48601 ); 48602 } 48603 } 48604 } 48605 function getMultiBlockMoverDescription(selectedCount, firstIndex, isFirst, isLast, dir, orientation) { 48606 const position = firstIndex + 1; 48607 if (isFirst && isLast) { 48608 return (0,external_wp_i18n_namespaceObject.__)("All blocks are selected, and cannot be moved"); 48609 } 48610 if (dir > 0 && !isLast) { 48611 const movementDirection = getMovementDirection("down", orientation); 48612 if (movementDirection === "down") { 48613 return (0,external_wp_i18n_namespaceObject.sprintf)( 48614 // translators: 1: Number of selected blocks, 2: Position of selected blocks 48615 (0,external_wp_i18n_namespaceObject.__)("Move %1$d blocks from position %2$d down by one place"), 48616 selectedCount, 48617 position 48618 ); 48619 } 48620 if (movementDirection === "left") { 48621 return (0,external_wp_i18n_namespaceObject.sprintf)( 48622 // translators: 1: Number of selected blocks, 2: Position of selected blocks 48623 (0,external_wp_i18n_namespaceObject.__)("Move %1$d blocks from position %2$d left by one place"), 48624 selectedCount, 48625 position 48626 ); 48627 } 48628 if (movementDirection === "right") { 48629 return (0,external_wp_i18n_namespaceObject.sprintf)( 48630 // translators: 1: Number of selected blocks, 2: Position of selected blocks 48631 (0,external_wp_i18n_namespaceObject.__)("Move %1$d blocks from position %2$d right by one place"), 48632 selectedCount, 48633 position 48634 ); 48635 } 48636 } 48637 if (dir > 0 && isLast) { 48638 const movementDirection = getMovementDirection("down", orientation); 48639 if (movementDirection === "down") { 48640 return (0,external_wp_i18n_namespaceObject.__)( 48641 "Blocks cannot be moved down as they are already at the bottom" 48642 ); 48643 } 48644 if (movementDirection === "left") { 48645 return (0,external_wp_i18n_namespaceObject.__)( 48646 "Blocks cannot be moved left as they are already are at the leftmost position" 48647 ); 48648 } 48649 if (movementDirection === "right") { 48650 return (0,external_wp_i18n_namespaceObject.__)( 48651 "Blocks cannot be moved right as they are already are at the rightmost position" 48652 ); 48653 } 48654 } 48655 if (dir < 0 && !isFirst) { 48656 const movementDirection = getMovementDirection("up", orientation); 48657 if (movementDirection === "up") { 48658 return (0,external_wp_i18n_namespaceObject.sprintf)( 48659 // translators: 1: Number of selected blocks, 2: Position of selected blocks 48660 (0,external_wp_i18n_namespaceObject.__)("Move %1$d blocks from position %2$d up by one place"), 48661 selectedCount, 48662 position 48663 ); 48664 } 48665 if (movementDirection === "left") { 48666 return (0,external_wp_i18n_namespaceObject.sprintf)( 48667 // translators: 1: Number of selected blocks, 2: Position of selected blocks 48668 (0,external_wp_i18n_namespaceObject.__)("Move %1$d blocks from position %2$d left by one place"), 48669 selectedCount, 48670 position 48671 ); 48672 } 48673 if (movementDirection === "right") { 48674 return (0,external_wp_i18n_namespaceObject.sprintf)( 48675 // translators: 1: Number of selected blocks, 2: Position of selected blocks 48676 (0,external_wp_i18n_namespaceObject.__)("Move %1$d blocks from position %2$d right by one place"), 48677 selectedCount, 48678 position 48679 ); 48680 } 48681 } 48682 if (dir < 0 && isFirst) { 48683 const movementDirection = getMovementDirection("up", orientation); 48684 if (movementDirection === "up") { 48685 return (0,external_wp_i18n_namespaceObject.__)( 48686 "Blocks cannot be moved up as they are already at the top" 48687 ); 48688 } 48689 if (movementDirection === "left") { 48690 return (0,external_wp_i18n_namespaceObject.__)( 48691 "Blocks cannot be moved left as they are already are at the leftmost position" 48692 ); 48693 } 48694 if (movementDirection === "right") { 48695 return (0,external_wp_i18n_namespaceObject.__)( 48696 "Blocks cannot be moved right as they are already are at the rightmost position" 48697 ); 48698 } 48699 } 48700 } 48701 48702 48703 ;// ./node_modules/@wordpress/block-editor/build-module/components/block-mover/button.js 48704 48705 48706 48707 48708 48709 48710 48711 48712 48713 48714 48715 const getArrowIcon = (direction, orientation) => { 48716 if (direction === "up") { 48717 if (orientation === "horizontal") { 48718 return (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_right_default : chevron_left_default; 48719 } 48720 return chevron_up_default; 48721 } else if (direction === "down") { 48722 if (orientation === "horizontal") { 48723 return (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left_default : chevron_right_default; 48724 } 48725 return chevron_down_default; 48726 } 48727 return null; 48728 }; 48729 const getMovementDirectionLabel = (moveDirection, orientation) => { 48730 if (moveDirection === "up") { 48731 if (orientation === "horizontal") { 48732 return (0,external_wp_i18n_namespaceObject.isRTL)() ? (0,external_wp_i18n_namespaceObject.__)("Move right") : (0,external_wp_i18n_namespaceObject.__)("Move left"); 48733 } 48734 return (0,external_wp_i18n_namespaceObject.__)("Move up"); 48735 } else if (moveDirection === "down") { 48736 if (orientation === "horizontal") { 48737 return (0,external_wp_i18n_namespaceObject.isRTL)() ? (0,external_wp_i18n_namespaceObject.__)("Move left") : (0,external_wp_i18n_namespaceObject.__)("Move right"); 48738 } 48739 return (0,external_wp_i18n_namespaceObject.__)("Move down"); 48740 } 48741 return null; 48742 }; 48743 const BlockMoverButton = (0,external_wp_element_namespaceObject.forwardRef)( 48744 ({ clientIds, direction, orientation: moverOrientation, ...props }, ref) => { 48745 const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(BlockMoverButton); 48746 const normalizedClientIds = Array.isArray(clientIds) ? clientIds : [clientIds]; 48747 const blocksCount = normalizedClientIds.length; 48748 const { disabled } = props; 48749 const { 48750 blockType, 48751 isDisabled, 48752 rootClientId, 48753 isFirst, 48754 isLast, 48755 firstIndex, 48756 orientation = "vertical" 48757 } = (0,external_wp_data_namespaceObject.useSelect)( 48758 (select) => { 48759 const { 48760 getBlockIndex, 48761 getBlockRootClientId, 48762 getBlockOrder, 48763 getBlock, 48764 getBlockListSettings 48765 } = select(store); 48766 const firstClientId = normalizedClientIds[0]; 48767 const blockRootClientId = getBlockRootClientId(firstClientId); 48768 const firstBlockIndex = getBlockIndex(firstClientId); 48769 const lastBlockIndex = getBlockIndex( 48770 normalizedClientIds[normalizedClientIds.length - 1] 48771 ); 48772 const blockOrder = getBlockOrder(blockRootClientId); 48773 const block = getBlock(firstClientId); 48774 const isFirstBlock = firstBlockIndex === 0; 48775 const isLastBlock = lastBlockIndex === blockOrder.length - 1; 48776 const { orientation: blockListOrientation } = getBlockListSettings(blockRootClientId) || {}; 48777 return { 48778 blockType: block ? (0,external_wp_blocks_namespaceObject.getBlockType)(block.name) : null, 48779 isDisabled: disabled || (direction === "up" ? isFirstBlock : isLastBlock), 48780 rootClientId: blockRootClientId, 48781 firstIndex: firstBlockIndex, 48782 isFirst: isFirstBlock, 48783 isLast: isLastBlock, 48784 orientation: moverOrientation || blockListOrientation 48785 }; 48786 }, 48787 [clientIds, direction] 48788 ); 48789 const { moveBlocksDown, moveBlocksUp } = (0,external_wp_data_namespaceObject.useDispatch)(store); 48790 const moverFunction = direction === "up" ? moveBlocksUp : moveBlocksDown; 48791 const onClick = (event) => { 48792 moverFunction(clientIds, rootClientId); 48793 if (props.onClick) { 48794 props.onClick(event); 48795 } 48796 }; 48797 const descriptionId = `block-editor-block-mover-button__description-$instanceId}`; 48798 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 48799 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 48800 external_wp_components_namespaceObject.Button, 48801 { 48802 __next40pxDefaultSize: true, 48803 ref, 48804 className: dist_clsx( 48805 "block-editor-block-mover-button", 48806 `is-$direction}-button` 48807 ), 48808 icon: getArrowIcon(direction, orientation), 48809 label: getMovementDirectionLabel( 48810 direction, 48811 orientation 48812 ), 48813 "aria-describedby": descriptionId, 48814 ...props, 48815 onClick: isDisabled ? null : onClick, 48816 disabled: isDisabled, 48817 accessibleWhenDisabled: true 48818 } 48819 ), 48820 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, { id: descriptionId, children: getBlockMoverDescription( 48821 blocksCount, 48822 blockType && blockType.title, 48823 firstIndex, 48824 isFirst, 48825 isLast, 48826 direction === "up" ? -1 : 1, 48827 orientation 48828 ) }) 48829 ] }); 48830 } 48831 ); 48832 const BlockMoverUpButton = (0,external_wp_element_namespaceObject.forwardRef)((props, ref) => { 48833 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockMoverButton, { direction: "up", ref, ...props }); 48834 }); 48835 const BlockMoverDownButton = (0,external_wp_element_namespaceObject.forwardRef)((props, ref) => { 48836 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockMoverButton, { direction: "down", ref, ...props }); 48837 }); 48838 48839 48840 ;// ./node_modules/@wordpress/block-editor/build-module/components/block-mover/index.js 48841 48842 48843 48844 48845 48846 48847 48848 48849 48850 function BlockMover({ 48851 clientIds, 48852 hideDragHandle, 48853 isBlockMoverUpButtonDisabled, 48854 isBlockMoverDownButtonDisabled 48855 }) { 48856 const { 48857 canMove, 48858 rootClientId, 48859 isFirst, 48860 isLast, 48861 orientation, 48862 isManualGrid 48863 } = (0,external_wp_data_namespaceObject.useSelect)( 48864 (select) => { 48865 const { 48866 getBlockIndex, 48867 getBlockListSettings, 48868 canMoveBlocks, 48869 getBlockOrder, 48870 getBlockRootClientId, 48871 getBlockAttributes 48872 } = select(store); 48873 const normalizedClientIds = Array.isArray(clientIds) ? clientIds : [clientIds]; 48874 const firstClientId = normalizedClientIds[0]; 48875 const _rootClientId = getBlockRootClientId(firstClientId); 48876 const firstIndex = getBlockIndex(firstClientId); 48877 const lastIndex = getBlockIndex( 48878 normalizedClientIds[normalizedClientIds.length - 1] 48879 ); 48880 const blockOrder = getBlockOrder(_rootClientId); 48881 const { layout = {} } = getBlockAttributes(_rootClientId) ?? {}; 48882 return { 48883 canMove: canMoveBlocks(clientIds), 48884 rootClientId: _rootClientId, 48885 isFirst: firstIndex === 0, 48886 isLast: lastIndex === blockOrder.length - 1, 48887 orientation: getBlockListSettings(_rootClientId)?.orientation, 48888 isManualGrid: layout.type === "grid" && layout.isManualPlacement && window.__experimentalEnableGridInteractivity 48889 }; 48890 }, 48891 [clientIds] 48892 ); 48893 if (!canMove || isFirst && isLast && !rootClientId || hideDragHandle && isManualGrid) { 48894 return null; 48895 } 48896 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 48897 external_wp_components_namespaceObject.ToolbarGroup, 48898 { 48899 className: dist_clsx("block-editor-block-mover", { 48900 "is-horizontal": orientation === "horizontal" 48901 }), 48902 children: [ 48903 !hideDragHandle && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(block_draggable_default, { clientIds, fadeWhenDisabled: true, children: (draggableProps) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 48904 external_wp_components_namespaceObject.Button, 48905 { 48906 __next40pxDefaultSize: true, 48907 icon: drag_handle_default, 48908 className: "block-editor-block-mover__drag-handle", 48909 label: (0,external_wp_i18n_namespaceObject.__)("Drag"), 48910 tabIndex: "-1", 48911 ...draggableProps 48912 } 48913 ) }), 48914 !isManualGrid && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-editor-block-mover__move-button-container", children: [ 48915 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarItem, { children: (itemProps) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 48916 BlockMoverUpButton, 48917 { 48918 disabled: isBlockMoverUpButtonDisabled, 48919 clientIds, 48920 ...itemProps 48921 } 48922 ) }), 48923 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarItem, { children: (itemProps) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 48924 BlockMoverDownButton, 48925 { 48926 disabled: isBlockMoverDownButtonDisabled, 48927 clientIds, 48928 ...itemProps 48929 } 48930 ) }) 48931 ] }) 48932 ] 48933 } 48934 ); 48935 } 48936 var block_mover_default = BlockMover; 48937 48938 48939 ;// ./node_modules/@wordpress/block-editor/build-module/components/block-toolbar/utils.js 48940 48941 48942 48943 const { clearTimeout: utils_clearTimeout, setTimeout: utils_setTimeout } = window; 48944 const DEBOUNCE_TIMEOUT = 200; 48945 function useDebouncedShowGestures({ 48946 ref, 48947 isFocused, 48948 highlightParent, 48949 debounceTimeout = DEBOUNCE_TIMEOUT 48950 }) { 48951 const { getSelectedBlockClientId, getBlockRootClientId } = (0,external_wp_data_namespaceObject.useSelect)(store); 48952 const { toggleBlockHighlight } = (0,external_wp_data_namespaceObject.useDispatch)(store); 48953 const timeoutRef = (0,external_wp_element_namespaceObject.useRef)(); 48954 const isDistractionFree = (0,external_wp_data_namespaceObject.useSelect)( 48955 (select) => select(store).getSettings().isDistractionFree, 48956 [] 48957 ); 48958 const handleOnChange = (nextIsFocused) => { 48959 if (nextIsFocused && isDistractionFree) { 48960 return; 48961 } 48962 const selectedBlockClientId = getSelectedBlockClientId(); 48963 const clientId = highlightParent ? getBlockRootClientId(selectedBlockClientId) : selectedBlockClientId; 48964 toggleBlockHighlight(clientId, nextIsFocused); 48965 }; 48966 const getIsHovered = () => { 48967 return ref?.current && ref.current.matches(":hover"); 48968 }; 48969 const shouldHideGestures = () => { 48970 const isHovered = getIsHovered(); 48971 return !isFocused && !isHovered; 48972 }; 48973 const clearTimeoutRef = () => { 48974 const timeout = timeoutRef.current; 48975 if (timeout && utils_clearTimeout) { 48976 utils_clearTimeout(timeout); 48977 } 48978 }; 48979 const debouncedShowGestures = (event) => { 48980 if (event) { 48981 event.stopPropagation(); 48982 } 48983 clearTimeoutRef(); 48984 handleOnChange(true); 48985 }; 48986 const debouncedHideGestures = (event) => { 48987 if (event) { 48988 event.stopPropagation(); 48989 } 48990 clearTimeoutRef(); 48991 timeoutRef.current = utils_setTimeout(() => { 48992 if (shouldHideGestures()) { 48993 handleOnChange(false); 48994 } 48995 }, debounceTimeout); 48996 }; 48997 (0,external_wp_element_namespaceObject.useEffect)( 48998 () => () => { 48999 handleOnChange(false); 49000 clearTimeoutRef(); 49001 }, 49002 [] 49003 ); 49004 return { 49005 debouncedShowGestures, 49006 debouncedHideGestures 49007 }; 49008 } 49009 function useShowHoveredOrFocusedGestures({ 49010 ref, 49011 highlightParent = false, 49012 debounceTimeout = DEBOUNCE_TIMEOUT 49013 }) { 49014 const [isFocused, setIsFocused] = (0,external_wp_element_namespaceObject.useState)(false); 49015 const { debouncedShowGestures, debouncedHideGestures } = useDebouncedShowGestures({ 49016 ref, 49017 debounceTimeout, 49018 isFocused, 49019 highlightParent 49020 }); 49021 const registerRef = (0,external_wp_element_namespaceObject.useRef)(false); 49022 const isFocusedWithin = () => { 49023 return ref?.current && ref.current.contains(ref.current.ownerDocument.activeElement); 49024 }; 49025 (0,external_wp_element_namespaceObject.useEffect)(() => { 49026 const node = ref.current; 49027 const handleOnFocus = () => { 49028 if (isFocusedWithin()) { 49029 setIsFocused(true); 49030 debouncedShowGestures(); 49031 } 49032 }; 49033 const handleOnBlur = () => { 49034 if (!isFocusedWithin()) { 49035 setIsFocused(false); 49036 debouncedHideGestures(); 49037 } 49038 }; 49039 if (node && !registerRef.current) { 49040 node.addEventListener("focus", handleOnFocus, true); 49041 node.addEventListener("blur", handleOnBlur, true); 49042 registerRef.current = true; 49043 } 49044 return () => { 49045 if (node) { 49046 node.removeEventListener("focus", handleOnFocus); 49047 node.removeEventListener("blur", handleOnBlur); 49048 } 49049 }; 49050 }, [ 49051 ref, 49052 registerRef, 49053 setIsFocused, 49054 debouncedShowGestures, 49055 debouncedHideGestures 49056 ]); 49057 return { 49058 onMouseMove: debouncedShowGestures, 49059 onMouseLeave: debouncedHideGestures 49060 }; 49061 } 49062 49063 49064 ;// ./node_modules/@wordpress/block-editor/build-module/components/block-parent-selector/index.js 49065 49066 49067 49068 49069 49070 49071 49072 49073 49074 49075 function BlockParentSelector() { 49076 const { selectBlock } = (0,external_wp_data_namespaceObject.useDispatch)(store); 49077 const { parentClientId } = (0,external_wp_data_namespaceObject.useSelect)((select) => { 49078 const { 49079 getBlockParents, 49080 getSelectedBlockClientId, 49081 getParentSectionBlock 49082 } = unlock(select(store)); 49083 const selectedBlockClientId = getSelectedBlockClientId(); 49084 const parentSection = getParentSectionBlock(selectedBlockClientId); 49085 const parents = getBlockParents(selectedBlockClientId); 49086 const _parentClientId = parentSection ?? parents[parents.length - 1]; 49087 return { 49088 parentClientId: _parentClientId 49089 }; 49090 }, []); 49091 const blockInformation = useBlockDisplayInformation(parentClientId); 49092 const nodeRef = (0,external_wp_element_namespaceObject.useRef)(); 49093 const showHoveredOrFocusedGestures = useShowHoveredOrFocusedGestures({ 49094 ref: nodeRef, 49095 highlightParent: true 49096 }); 49097 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 49098 "div", 49099 { 49100 className: "block-editor-block-parent-selector", 49101 ref: nodeRef, 49102 ...showHoveredOrFocusedGestures, 49103 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 49104 external_wp_components_namespaceObject.ToolbarButton, 49105 { 49106 className: "block-editor-block-parent-selector__button", 49107 onClick: () => selectBlock(parentClientId), 49108 label: (0,external_wp_i18n_namespaceObject.sprintf)( 49109 /* translators: %s: Name of the block's parent. */ 49110 (0,external_wp_i18n_namespaceObject.__)("Select parent block: %s"), 49111 blockInformation?.title 49112 ), 49113 showTooltip: true, 49114 icon: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(block_icon_default, { icon: blockInformation?.icon }) 49115 } 49116 ) 49117 }, 49118 parentClientId 49119 ); 49120 } 49121 49122 49123 ;// ./node_modules/@wordpress/icons/build-module/library/copy.js 49124 49125 49126 var copy_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 49127 external_wp_primitives_namespaceObject.Path, 49128 { 49129 fillRule: "evenodd", 49130 clipRule: "evenodd", 49131 d: "M5 4.5h11a.5.5 0 0 1 .5.5v11a.5.5 0 0 1-.5.5H5a.5.5 0 0 1-.5-.5V5a.5.5 0 0 1 .5-.5ZM3 5a2 2 0 0 1 2-2h11a2 2 0 0 1 2 2v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5Zm17 3v10.75c0 .69-.56 1.25-1.25 1.25H6v1.5h12.75a2.75 2.75 0 0 0 2.75-2.75V8H20Z" 49132 } 49133 ) }); 49134 49135 49136 ;// ./node_modules/@wordpress/block-editor/build-module/components/block-switcher/preview-block-popover.js 49137 49138 49139 49140 49141 49142 function PreviewBlockPopover({ blocks }) { 49143 const isMobile = (0,external_wp_compose_namespaceObject.useViewportMatch)("medium", "<"); 49144 if (isMobile) { 49145 return null; 49146 } 49147 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-block-switcher__popover-preview-container", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 49148 external_wp_components_namespaceObject.Popover, 49149 { 49150 className: "block-editor-block-switcher__popover-preview", 49151 placement: "right-start", 49152 focusOnMount: false, 49153 offset: 16, 49154 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-editor-block-switcher__preview", children: [ 49155 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-block-switcher__preview-title", children: (0,external_wp_i18n_namespaceObject.__)("Preview") }), 49156 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(block_preview_default, { viewportWidth: 601, blocks }) 49157 ] }) 49158 } 49159 ) }); 49160 } 49161 49162 49163 ;// ./node_modules/@wordpress/block-editor/build-module/components/block-switcher/block-variation-transformations.js 49164 49165 49166 49167 49168 49169 49170 49171 49172 const block_variation_transformations_EMPTY_OBJECT = {}; 49173 function useBlockVariationTransforms({ clientIds, blocks }) { 49174 const { activeBlockVariation, blockVariationTransformations } = (0,external_wp_data_namespaceObject.useSelect)( 49175 (select) => { 49176 const { getBlockAttributes, canRemoveBlocks } = select(store); 49177 const { getActiveBlockVariation, getBlockVariations } = select(external_wp_blocks_namespaceObject.store); 49178 const canRemove = canRemoveBlocks(clientIds); 49179 if (blocks.length !== 1 || !canRemove) { 49180 return block_variation_transformations_EMPTY_OBJECT; 49181 } 49182 const [firstBlock] = blocks; 49183 return { 49184 blockVariationTransformations: getBlockVariations( 49185 firstBlock.name, 49186 "transform" 49187 ), 49188 activeBlockVariation: getActiveBlockVariation( 49189 firstBlock.name, 49190 getBlockAttributes(firstBlock.clientId) 49191 ) 49192 }; 49193 }, 49194 [clientIds, blocks] 49195 ); 49196 const transformations = (0,external_wp_element_namespaceObject.useMemo)(() => { 49197 return blockVariationTransformations?.filter( 49198 ({ name }) => name !== activeBlockVariation?.name 49199 ); 49200 }, [blockVariationTransformations, activeBlockVariation]); 49201 return transformations; 49202 } 49203 const BlockVariationTransformations = ({ 49204 transformations, 49205 onSelect, 49206 blocks 49207 }) => { 49208 const [hoveredTransformItemName, setHoveredTransformItemName] = (0,external_wp_element_namespaceObject.useState)(); 49209 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 49210 hoveredTransformItemName && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 49211 PreviewBlockPopover, 49212 { 49213 blocks: (0,external_wp_blocks_namespaceObject.cloneBlock)( 49214 blocks[0], 49215 transformations.find( 49216 ({ name }) => name === hoveredTransformItemName 49217 ).attributes 49218 ) 49219 } 49220 ), 49221 transformations?.map((item) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 49222 BlockVariationTransformationItem, 49223 { 49224 item, 49225 onSelect, 49226 setHoveredTransformItemName 49227 }, 49228 item.name 49229 )) 49230 ] }); 49231 }; 49232 function BlockVariationTransformationItem({ 49233 item, 49234 onSelect, 49235 setHoveredTransformItemName 49236 }) { 49237 const { name, icon, title } = item; 49238 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 49239 external_wp_components_namespaceObject.MenuItem, 49240 { 49241 className: (0,external_wp_blocks_namespaceObject.getBlockMenuDefaultClassName)(name), 49242 onClick: (event) => { 49243 event.preventDefault(); 49244 onSelect(name); 49245 }, 49246 onMouseLeave: () => setHoveredTransformItemName(null), 49247 onMouseEnter: () => setHoveredTransformItemName(name), 49248 children: [ 49249 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(block_icon_default, { icon, showColors: true }), 49250 title 49251 ] 49252 } 49253 ); 49254 } 49255 var block_variation_transformations_default = BlockVariationTransformations; 49256 49257 49258 ;// ./node_modules/@wordpress/block-editor/build-module/components/block-switcher/block-transformations-menu.js 49259 49260 49261 49262 49263 49264 49265 49266 49267 function useGroupedTransforms(possibleBlockTransformations) { 49268 const priorityContentTransformationBlocks = { 49269 "core/paragraph": 1, 49270 "core/heading": 2, 49271 "core/list": 3, 49272 "core/quote": 4 49273 }; 49274 const transformations = (0,external_wp_element_namespaceObject.useMemo)(() => { 49275 const priorityTextTransformsNames = Object.keys( 49276 priorityContentTransformationBlocks 49277 ); 49278 const groupedPossibleTransforms = possibleBlockTransformations.reduce( 49279 (accumulator, item) => { 49280 const { name } = item; 49281 if (priorityTextTransformsNames.includes(name)) { 49282 accumulator.priorityTextTransformations.push(item); 49283 } else { 49284 accumulator.restTransformations.push(item); 49285 } 49286 return accumulator; 49287 }, 49288 { priorityTextTransformations: [], restTransformations: [] } 49289 ); 49290 if (groupedPossibleTransforms.priorityTextTransformations.length === 1 && groupedPossibleTransforms.priorityTextTransformations[0].name === "core/quote") { 49291 const singleQuote = groupedPossibleTransforms.priorityTextTransformations.pop(); 49292 groupedPossibleTransforms.restTransformations.push(singleQuote); 49293 } 49294 return groupedPossibleTransforms; 49295 }, [possibleBlockTransformations]); 49296 transformations.priorityTextTransformations.sort( 49297 ({ name: currentName }, { name: nextName }) => { 49298 return priorityContentTransformationBlocks[currentName] < priorityContentTransformationBlocks[nextName] ? -1 : 1; 49299 } 49300 ); 49301 return transformations; 49302 } 49303 const BlockTransformationsMenu = ({ 49304 className, 49305 possibleBlockTransformations, 49306 possibleBlockVariationTransformations, 49307 onSelect, 49308 onSelectVariation, 49309 blocks 49310 }) => { 49311 const [hoveredTransformItemName, setHoveredTransformItemName] = (0,external_wp_element_namespaceObject.useState)(); 49312 const { priorityTextTransformations, restTransformations } = useGroupedTransforms(possibleBlockTransformations); 49313 const hasBothContentTransformations = priorityTextTransformations.length && restTransformations.length; 49314 const restTransformItems = !!restTransformations.length && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 49315 RestTransformationItems, 49316 { 49317 restTransformations, 49318 onSelect, 49319 setHoveredTransformItemName 49320 } 49321 ); 49322 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 49323 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.MenuGroup, { label: (0,external_wp_i18n_namespaceObject.__)("Transform to"), className, children: [ 49324 hoveredTransformItemName && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 49325 PreviewBlockPopover, 49326 { 49327 blocks: (0,external_wp_blocks_namespaceObject.switchToBlockType)( 49328 blocks, 49329 hoveredTransformItemName 49330 ) 49331 } 49332 ), 49333 !!possibleBlockVariationTransformations?.length && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 49334 block_variation_transformations_default, 49335 { 49336 transformations: possibleBlockVariationTransformations, 49337 blocks, 49338 onSelect: onSelectVariation 49339 } 49340 ), 49341 priorityTextTransformations.map((item) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 49342 BlockTransformationItem, 49343 { 49344 item, 49345 onSelect, 49346 setHoveredTransformItemName 49347 }, 49348 item.name 49349 )), 49350 !hasBothContentTransformations && restTransformItems 49351 ] }), 49352 !!hasBothContentTransformations && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuGroup, { className, children: restTransformItems }) 49353 ] }); 49354 }; 49355 function RestTransformationItems({ 49356 restTransformations, 49357 onSelect, 49358 setHoveredTransformItemName 49359 }) { 49360 return restTransformations.map((item) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 49361 BlockTransformationItem, 49362 { 49363 item, 49364 onSelect, 49365 setHoveredTransformItemName 49366 }, 49367 item.name 49368 )); 49369 } 49370 function BlockTransformationItem({ 49371 item, 49372 onSelect, 49373 setHoveredTransformItemName 49374 }) { 49375 const { name, icon, title, isDisabled } = item; 49376 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 49377 external_wp_components_namespaceObject.MenuItem, 49378 { 49379 className: (0,external_wp_blocks_namespaceObject.getBlockMenuDefaultClassName)(name), 49380 onClick: (event) => { 49381 event.preventDefault(); 49382 onSelect(name); 49383 }, 49384 disabled: isDisabled, 49385 onMouseLeave: () => setHoveredTransformItemName(null), 49386 onMouseEnter: () => setHoveredTransformItemName(name), 49387 children: [ 49388 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(block_icon_default, { icon, showColors: true }), 49389 title 49390 ] 49391 } 49392 ); 49393 } 49394 var block_transformations_menu_default = BlockTransformationsMenu; 49395 49396 49397 ;// ./node_modules/@wordpress/block-editor/build-module/components/block-styles/utils.js 49398 49399 49400 function getActiveStyle(styles, className) { 49401 for (const style of new (external_wp_tokenList_default())(className).values()) { 49402 if (style.indexOf("is-style-") === -1) { 49403 continue; 49404 } 49405 const potentialStyleName = style.substring(9); 49406 const activeStyle = styles?.find( 49407 ({ name }) => name === potentialStyleName 49408 ); 49409 if (activeStyle) { 49410 return activeStyle; 49411 } 49412 } 49413 return getDefaultStyle(styles); 49414 } 49415 function replaceActiveStyle(className, activeStyle, newStyle) { 49416 const list = new (external_wp_tokenList_default())(className); 49417 if (activeStyle) { 49418 list.remove("is-style-" + activeStyle.name); 49419 } 49420 list.add("is-style-" + newStyle.name); 49421 return list.value; 49422 } 49423 function getRenderedStyles(styles) { 49424 if (!styles || styles.length === 0) { 49425 return []; 49426 } 49427 return getDefaultStyle(styles) ? styles : [ 49428 { 49429 name: "default", 49430 label: (0,external_wp_i18n_namespaceObject._x)("Default", "block style"), 49431 isDefault: true 49432 }, 49433 ...styles 49434 ]; 49435 } 49436 function getDefaultStyle(styles) { 49437 return styles?.find((style) => style.isDefault); 49438 } 49439 49440 49441 ;// ./node_modules/@wordpress/block-editor/build-module/components/block-styles/use-styles-for-block.js 49442 49443 49444 49445 49446 49447 function useGenericPreviewBlock(block, type) { 49448 return (0,external_wp_element_namespaceObject.useMemo)(() => { 49449 const example = type?.example; 49450 const blockName = type?.name; 49451 if (example && blockName) { 49452 return (0,external_wp_blocks_namespaceObject.getBlockFromExample)(blockName, { 49453 attributes: example.attributes, 49454 innerBlocks: example.innerBlocks 49455 }); 49456 } 49457 if (block) { 49458 return (0,external_wp_blocks_namespaceObject.cloneBlock)(block); 49459 } 49460 }, [type?.example ? block?.name : block, type]); 49461 } 49462 function useStylesForBlocks({ clientId, onSwitch }) { 49463 const selector = (select) => { 49464 const { getBlock } = select(store); 49465 const block2 = getBlock(clientId); 49466 if (!block2) { 49467 return {}; 49468 } 49469 const blockType2 = (0,external_wp_blocks_namespaceObject.getBlockType)(block2.name); 49470 const { getBlockStyles } = select(external_wp_blocks_namespaceObject.store); 49471 return { 49472 block: block2, 49473 blockType: blockType2, 49474 styles: getBlockStyles(block2.name), 49475 className: block2.attributes.className || "" 49476 }; 49477 }; 49478 const { styles, block, blockType, className } = (0,external_wp_data_namespaceObject.useSelect)(selector, [ 49479 clientId 49480 ]); 49481 const { updateBlockAttributes } = (0,external_wp_data_namespaceObject.useDispatch)(store); 49482 const stylesToRender = getRenderedStyles(styles); 49483 const activeStyle = getActiveStyle(stylesToRender, className); 49484 const genericPreviewBlock = useGenericPreviewBlock(block, blockType); 49485 const onSelect = (style) => { 49486 const styleClassName = replaceActiveStyle( 49487 className, 49488 activeStyle, 49489 style 49490 ); 49491 updateBlockAttributes(clientId, { 49492 className: styleClassName 49493 }); 49494 onSwitch(); 49495 }; 49496 return { 49497 onSelect, 49498 stylesToRender, 49499 activeStyle, 49500 genericPreviewBlock, 49501 className 49502 }; 49503 } 49504 49505 49506 ;// ./node_modules/@wordpress/block-editor/build-module/components/block-styles/menu-items.js 49507 49508 49509 49510 49511 const menu_items_noop = () => { 49512 }; 49513 function BlockStylesMenuItems({ clientId, onSwitch = menu_items_noop }) { 49514 const { onSelect, stylesToRender, activeStyle } = useStylesForBlocks({ 49515 clientId, 49516 onSwitch 49517 }); 49518 if (!stylesToRender || stylesToRender.length === 0) { 49519 return null; 49520 } 49521 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: stylesToRender.map((style) => { 49522 const menuItemText = style.label || style.name; 49523 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 49524 external_wp_components_namespaceObject.MenuItem, 49525 { 49526 icon: activeStyle.name === style.name ? check_check_default : null, 49527 onClick: () => onSelect(style), 49528 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 49529 external_wp_components_namespaceObject.__experimentalText, 49530 { 49531 as: "span", 49532 limit: 18, 49533 ellipsizeMode: "tail", 49534 truncate: true, 49535 children: menuItemText 49536 } 49537 ) 49538 }, 49539 style.name 49540 ); 49541 }) }); 49542 } 49543 49544 49545 ;// ./node_modules/@wordpress/block-editor/build-module/components/block-switcher/block-styles-menu.js 49546 49547 49548 49549 49550 function BlockStylesMenu({ hoveredBlock, onSwitch }) { 49551 const { clientId } = hoveredBlock; 49552 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 49553 external_wp_components_namespaceObject.MenuGroup, 49554 { 49555 label: (0,external_wp_i18n_namespaceObject.__)("Styles"), 49556 className: "block-editor-block-switcher__styles__menugroup", 49557 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockStylesMenuItems, { clientId, onSwitch }) 49558 } 49559 ); 49560 } 49561 49562 49563 ;// ./node_modules/@wordpress/block-editor/build-module/components/block-switcher/utils.js 49564 49565 const getMatchingBlockByName = (block, selectedBlockName, consumedBlocks = /* @__PURE__ */ new Set()) => { 49566 const { clientId, name, innerBlocks = [] } = block; 49567 if (consumedBlocks.has(clientId)) { 49568 return; 49569 } 49570 if (name === selectedBlockName) { 49571 return block; 49572 } 49573 for (const innerBlock of innerBlocks) { 49574 const match = getMatchingBlockByName( 49575 innerBlock, 49576 selectedBlockName, 49577 consumedBlocks 49578 ); 49579 if (match) { 49580 return match; 49581 } 49582 } 49583 }; 49584 const getRetainedBlockAttributes = (name, attributes) => { 49585 const contentAttributes = (0,external_wp_blocks_namespaceObject.getBlockAttributesNamesByRole)(name, "content"); 49586 if (!contentAttributes?.length) { 49587 return attributes; 49588 } 49589 return contentAttributes.reduce((_accumulator, attribute) => { 49590 if (attributes[attribute]) { 49591 _accumulator[attribute] = attributes[attribute]; 49592 } 49593 return _accumulator; 49594 }, {}); 49595 }; 49596 49597 49598 ;// ./node_modules/@wordpress/block-editor/build-module/components/block-switcher/use-transformed-patterns.js 49599 49600 49601 49602 const transformMatchingBlock = (match, selectedBlock) => { 49603 const retainedBlockAttributes = getRetainedBlockAttributes( 49604 selectedBlock.name, 49605 selectedBlock.attributes 49606 ); 49607 match.attributes = { 49608 ...match.attributes, 49609 ...retainedBlockAttributes 49610 }; 49611 }; 49612 const getPatternTransformedBlocks = (selectedBlocks, patternBlocks) => { 49613 const _patternBlocks = patternBlocks.map( 49614 (block) => (0,external_wp_blocks_namespaceObject.cloneBlock)(block) 49615 ); 49616 const consumedBlocks = /* @__PURE__ */ new Set(); 49617 for (const selectedBlock of selectedBlocks) { 49618 let isMatch = false; 49619 for (const patternBlock of _patternBlocks) { 49620 const match = getMatchingBlockByName( 49621 patternBlock, 49622 selectedBlock.name, 49623 consumedBlocks 49624 ); 49625 if (!match) { 49626 continue; 49627 } 49628 isMatch = true; 49629 consumedBlocks.add(match.clientId); 49630 transformMatchingBlock(match, selectedBlock); 49631 break; 49632 } 49633 if (!isMatch) { 49634 return; 49635 } 49636 } 49637 return _patternBlocks; 49638 }; 49639 const useTransformedPatterns = (patterns, selectedBlocks) => { 49640 return (0,external_wp_element_namespaceObject.useMemo)( 49641 () => patterns.reduce((accumulator, _pattern) => { 49642 const transformedBlocks = getPatternTransformedBlocks( 49643 selectedBlocks, 49644 _pattern.blocks 49645 ); 49646 if (transformedBlocks) { 49647 accumulator.push({ 49648 ..._pattern, 49649 transformedBlocks 49650 }); 49651 } 49652 return accumulator; 49653 }, []), 49654 [patterns, selectedBlocks] 49655 ); 49656 }; 49657 var use_transformed_patterns_default = useTransformedPatterns; 49658 49659 49660 ;// ./node_modules/@wordpress/block-editor/build-module/components/block-switcher/pattern-transformations-menu.js 49661 49662 49663 49664 49665 49666 49667 49668 49669 function PatternTransformationsMenu({ 49670 blocks, 49671 patterns: statePatterns, 49672 onSelect 49673 }) { 49674 const [showTransforms, setShowTransforms] = (0,external_wp_element_namespaceObject.useState)(false); 49675 const patterns = use_transformed_patterns_default(statePatterns, blocks); 49676 if (!patterns.length) { 49677 return null; 49678 } 49679 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.MenuGroup, { className: "block-editor-block-switcher__pattern__transforms__menugroup", children: [ 49680 showTransforms && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 49681 PreviewPatternsPopover, 49682 { 49683 patterns, 49684 onSelect 49685 } 49686 ), 49687 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 49688 external_wp_components_namespaceObject.MenuItem, 49689 { 49690 onClick: (event) => { 49691 event.preventDefault(); 49692 setShowTransforms(!showTransforms); 49693 }, 49694 icon: chevron_right_default, 49695 children: (0,external_wp_i18n_namespaceObject.__)("Patterns") 49696 } 49697 ) 49698 ] }); 49699 } 49700 function PreviewPatternsPopover({ patterns, onSelect }) { 49701 const isMobile = (0,external_wp_compose_namespaceObject.useViewportMatch)("medium", "<"); 49702 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-block-switcher__popover-preview-container", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 49703 external_wp_components_namespaceObject.Popover, 49704 { 49705 className: "block-editor-block-switcher__popover-preview", 49706 placement: isMobile ? "bottom" : "right-start", 49707 offset: 16, 49708 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-block-switcher__preview is-pattern-list-preview", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 49709 pattern_transformations_menu_BlockPatternsList, 49710 { 49711 patterns, 49712 onSelect 49713 } 49714 ) }) 49715 } 49716 ) }); 49717 } 49718 function pattern_transformations_menu_BlockPatternsList({ patterns, onSelect }) { 49719 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 49720 external_wp_components_namespaceObject.Composite, 49721 { 49722 role: "listbox", 49723 className: "block-editor-block-switcher__preview-patterns-container", 49724 "aria-label": (0,external_wp_i18n_namespaceObject.__)("Patterns list"), 49725 children: patterns.map((pattern) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 49726 pattern_transformations_menu_BlockPattern, 49727 { 49728 pattern, 49729 onSelect 49730 }, 49731 pattern.name 49732 )) 49733 } 49734 ); 49735 } 49736 function pattern_transformations_menu_BlockPattern({ pattern, onSelect }) { 49737 const baseClassName = "block-editor-block-switcher__preview-patterns-container"; 49738 const descriptionId = (0,external_wp_compose_namespaceObject.useInstanceId)( 49739 pattern_transformations_menu_BlockPattern, 49740 `$baseClassName}-list__item-description` 49741 ); 49742 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: `$baseClassName}-list__list-item`, children: [ 49743 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 49744 external_wp_components_namespaceObject.Composite.Item, 49745 { 49746 render: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 49747 "div", 49748 { 49749 role: "option", 49750 "aria-label": pattern.title, 49751 "aria-describedby": pattern.description ? descriptionId : void 0, 49752 className: `$baseClassName}-list__item` 49753 } 49754 ), 49755 onClick: () => onSelect(pattern.transformedBlocks), 49756 children: [ 49757 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 49758 block_preview_default, 49759 { 49760 blocks: pattern.transformedBlocks, 49761 viewportWidth: pattern.viewportWidth || 500 49762 } 49763 ), 49764 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: `$baseClassName}-list__item-title`, children: pattern.title }) 49765 ] 49766 } 49767 ), 49768 !!pattern.description && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, { id: descriptionId, children: pattern.description }) 49769 ] }); 49770 } 49771 var pattern_transformations_menu_default = PatternTransformationsMenu; 49772 49773 49774 ;// ./node_modules/@wordpress/block-editor/build-module/components/block-switcher/index.js 49775 49776 49777 49778 49779 49780 49781 49782 49783 49784 49785 49786 49787 49788 49789 49790 function BlockSwitcherDropdownMenuContents({ 49791 onClose, 49792 clientIds, 49793 hasBlockStyles, 49794 canRemove 49795 }) { 49796 const { replaceBlocks, multiSelect, updateBlockAttributes } = (0,external_wp_data_namespaceObject.useDispatch)(store); 49797 const { possibleBlockTransformations, patterns, blocks, isUsingBindings } = (0,external_wp_data_namespaceObject.useSelect)( 49798 (select) => { 49799 const { 49800 getBlockAttributes, 49801 getBlocksByClientId, 49802 getBlockRootClientId, 49803 getBlockTransformItems, 49804 __experimentalGetPatternTransformItems 49805 } = select(store); 49806 const rootClientId = getBlockRootClientId(clientIds[0]); 49807 const _blocks = getBlocksByClientId(clientIds); 49808 return { 49809 blocks: _blocks, 49810 possibleBlockTransformations: getBlockTransformItems( 49811 _blocks, 49812 rootClientId 49813 ), 49814 patterns: __experimentalGetPatternTransformItems( 49815 _blocks, 49816 rootClientId 49817 ), 49818 isUsingBindings: clientIds.every( 49819 (clientId) => !!getBlockAttributes(clientId)?.metadata?.bindings 49820 ) 49821 }; 49822 }, 49823 [clientIds] 49824 ); 49825 const blockVariationTransformations = useBlockVariationTransforms({ 49826 clientIds, 49827 blocks 49828 }); 49829 function selectForMultipleBlocks(insertedBlocks) { 49830 if (insertedBlocks.length > 1) { 49831 multiSelect( 49832 insertedBlocks[0].clientId, 49833 insertedBlocks[insertedBlocks.length - 1].clientId 49834 ); 49835 } 49836 } 49837 function onBlockTransform(name) { 49838 const newBlocks = (0,external_wp_blocks_namespaceObject.switchToBlockType)(blocks, name); 49839 replaceBlocks(clientIds, newBlocks); 49840 selectForMultipleBlocks(newBlocks); 49841 } 49842 function onBlockVariationTransform(name) { 49843 updateBlockAttributes(blocks[0].clientId, { 49844 ...blockVariationTransformations.find( 49845 ({ name: variationName }) => variationName === name 49846 ).attributes 49847 }); 49848 } 49849 function onPatternTransform(transformedBlocks) { 49850 replaceBlocks(clientIds, transformedBlocks); 49851 selectForMultipleBlocks(transformedBlocks); 49852 } 49853 const isSingleBlock = blocks.length === 1; 49854 const isSynced = isSingleBlock && ((0,external_wp_blocks_namespaceObject.isTemplatePart)(blocks[0]) || (0,external_wp_blocks_namespaceObject.isReusableBlock)(blocks[0])); 49855 const hasPossibleBlockTransformations = !!possibleBlockTransformations?.length && canRemove && !isSynced; 49856 const hasPossibleBlockVariationTransformations = !!blockVariationTransformations?.length; 49857 const hasPatternTransformation = !!patterns?.length && canRemove; 49858 const hasBlockOrBlockVariationTransforms = hasPossibleBlockTransformations || hasPossibleBlockVariationTransformations; 49859 const hasContents = hasBlockStyles || hasBlockOrBlockVariationTransforms || hasPatternTransformation; 49860 if (!hasContents) { 49861 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { className: "block-editor-block-switcher__no-transforms", children: (0,external_wp_i18n_namespaceObject.__)("No transforms.") }); 49862 } 49863 const connectedBlockDescription = isSingleBlock ? (0,external_wp_i18n_namespaceObject._x)( 49864 "This block is connected.", 49865 "block toolbar button label and description" 49866 ) : (0,external_wp_i18n_namespaceObject._x)( 49867 "These blocks are connected.", 49868 "block toolbar button label and description" 49869 ); 49870 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-editor-block-switcher__container", children: [ 49871 hasPatternTransformation && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 49872 pattern_transformations_menu_default, 49873 { 49874 blocks, 49875 patterns, 49876 onSelect: (transformedBlocks) => { 49877 onPatternTransform(transformedBlocks); 49878 onClose(); 49879 } 49880 } 49881 ), 49882 hasBlockOrBlockVariationTransforms && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 49883 block_transformations_menu_default, 49884 { 49885 className: "block-editor-block-switcher__transforms__menugroup", 49886 possibleBlockTransformations, 49887 possibleBlockVariationTransformations: blockVariationTransformations, 49888 blocks, 49889 onSelect: (name) => { 49890 onBlockTransform(name); 49891 onClose(); 49892 }, 49893 onSelectVariation: (name) => { 49894 onBlockVariationTransform(name); 49895 onClose(); 49896 } 49897 } 49898 ), 49899 hasBlockStyles && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 49900 BlockStylesMenu, 49901 { 49902 hoveredBlock: blocks[0], 49903 onSwitch: onClose 49904 } 49905 ), 49906 isUsingBindings && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuGroup, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { className: "block-editor-block-switcher__binding-indicator", children: connectedBlockDescription }) }) 49907 ] }); 49908 } 49909 const BlockSwitcher = ({ clientIds }) => { 49910 const { 49911 hasContentOnlyLocking, 49912 canRemove, 49913 hasBlockStyles, 49914 icon, 49915 invalidBlocks, 49916 isReusable, 49917 isTemplate, 49918 isDisabled, 49919 isSectionInSelection 49920 } = (0,external_wp_data_namespaceObject.useSelect)( 49921 (select) => { 49922 const { 49923 getTemplateLock, 49924 getBlocksByClientId, 49925 getBlockAttributes, 49926 canRemoveBlocks, 49927 getBlockEditingMode, 49928 isSectionBlock 49929 } = unlock(select(store)); 49930 const { getBlockStyles, getBlockType, getActiveBlockVariation } = select(external_wp_blocks_namespaceObject.store); 49931 const _blocks = getBlocksByClientId(clientIds); 49932 if (!_blocks.length || _blocks.some((block) => !block)) { 49933 return { invalidBlocks: true }; 49934 } 49935 const [{ name: firstBlockName }] = _blocks; 49936 const _isSingleBlockSelected = _blocks.length === 1; 49937 const blockType = getBlockType(firstBlockName); 49938 const editingMode = getBlockEditingMode(clientIds[0]); 49939 let _icon; 49940 let _hasTemplateLock; 49941 if (_isSingleBlockSelected) { 49942 const match = getActiveBlockVariation( 49943 firstBlockName, 49944 getBlockAttributes(clientIds[0]) 49945 ); 49946 _icon = match?.icon || blockType.icon; 49947 _hasTemplateLock = getTemplateLock(clientIds[0]) === "contentOnly"; 49948 } else { 49949 const isSelectionOfSameType = new Set(_blocks.map(({ name }) => name)).size === 1; 49950 _hasTemplateLock = clientIds.some( 49951 (id) => getTemplateLock(id) === "contentOnly" 49952 ); 49953 _icon = isSelectionOfSameType ? blockType.icon : copy_default; 49954 } 49955 const _isSectionInSelection = clientIds.some( 49956 (id) => isSectionBlock(id) 49957 ); 49958 return { 49959 canRemove: canRemoveBlocks(clientIds), 49960 hasBlockStyles: _isSingleBlockSelected && !!getBlockStyles(firstBlockName)?.length, 49961 icon: _icon, 49962 isReusable: _isSingleBlockSelected && (0,external_wp_blocks_namespaceObject.isReusableBlock)(_blocks[0]), 49963 isTemplate: _isSingleBlockSelected && (0,external_wp_blocks_namespaceObject.isTemplatePart)(_blocks[0]), 49964 hasContentOnlyLocking: _hasTemplateLock, 49965 isDisabled: editingMode !== "default", 49966 isSectionInSelection: _isSectionInSelection 49967 }; 49968 }, 49969 [clientIds] 49970 ); 49971 const blockTitle = useBlockDisplayTitle({ 49972 clientId: clientIds?.[0], 49973 maximumLength: 35 49974 }); 49975 const showIconLabels = (0,external_wp_data_namespaceObject.useSelect)( 49976 (select) => select(external_wp_preferences_namespaceObject.store).get("core", "showIconLabels"), 49977 [] 49978 ); 49979 if (invalidBlocks) { 49980 return null; 49981 } 49982 const isSingleBlock = clientIds.length === 1; 49983 const blockSwitcherLabel = isSingleBlock ? blockTitle : (0,external_wp_i18n_namespaceObject.__)("Multiple blocks selected"); 49984 const blockIndicatorText = (isReusable || isTemplate) && !showIconLabels && blockTitle ? blockTitle : void 0; 49985 const hideTransformsForSections = window?.__experimentalContentOnlyPatternInsertion && isSectionInSelection; 49986 const hideDropdown = hideTransformsForSections || isDisabled || !hasBlockStyles && !canRemove || hasContentOnlyLocking; 49987 if (hideDropdown) { 49988 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarGroup, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 49989 external_wp_components_namespaceObject.ToolbarButton, 49990 { 49991 disabled: true, 49992 className: "block-editor-block-switcher__no-switcher-icon", 49993 title: blockSwitcherLabel, 49994 icon: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 49995 block_icon_default, 49996 { 49997 className: "block-editor-block-switcher__toggle", 49998 icon, 49999 showColors: true 50000 } 50001 ), 50002 text: blockIndicatorText 50003 } 50004 ) }); 50005 } 50006 const blockSwitcherDescription = isSingleBlock ? (0,external_wp_i18n_namespaceObject.__)("Change block type or style") : (0,external_wp_i18n_namespaceObject.sprintf)( 50007 /* translators: %d: number of blocks. */ 50008 (0,external_wp_i18n_namespaceObject._n)( 50009 "Change type of %d block", 50010 "Change type of %d blocks", 50011 clientIds.length 50012 ), 50013 clientIds.length 50014 ); 50015 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarGroup, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarItem, { children: (toggleProps) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 50016 external_wp_components_namespaceObject.DropdownMenu, 50017 { 50018 className: "block-editor-block-switcher", 50019 label: blockSwitcherLabel, 50020 popoverProps: { 50021 placement: "bottom-start", 50022 className: "block-editor-block-switcher__popover" 50023 }, 50024 icon: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 50025 block_icon_default, 50026 { 50027 className: "block-editor-block-switcher__toggle", 50028 icon, 50029 showColors: true 50030 } 50031 ), 50032 text: blockIndicatorText, 50033 toggleProps: { 50034 description: blockSwitcherDescription, 50035 ...toggleProps 50036 }, 50037 menuProps: { orientation: "both" }, 50038 children: ({ onClose }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 50039 BlockSwitcherDropdownMenuContents, 50040 { 50041 onClose, 50042 clientIds, 50043 hasBlockStyles, 50044 canRemove 50045 } 50046 ) 50047 } 50048 ) }) }); 50049 }; 50050 var block_switcher_default = BlockSwitcher; 50051 50052 50053 ;// ./node_modules/@wordpress/block-editor/build-module/components/block-toolbar/block-toolbar-last-item.js 50054 50055 const { Fill: __unstableBlockToolbarLastItem, Slot: block_toolbar_last_item_Slot } = (0,external_wp_components_namespaceObject.createSlotFill)( 50056 "__unstableBlockToolbarLastItem" 50057 ); 50058 __unstableBlockToolbarLastItem.Slot = block_toolbar_last_item_Slot; 50059 var block_toolbar_last_item_default = __unstableBlockToolbarLastItem; 50060 50061 50062 ;// ./node_modules/@wordpress/block-editor/build-module/hooks/supports.js 50063 50064 50065 const ALIGN_SUPPORT_KEY = "align"; 50066 const ALIGN_WIDE_SUPPORT_KEY = "alignWide"; 50067 const supports_BORDER_SUPPORT_KEY = "__experimentalBorder"; 50068 const supports_COLOR_SUPPORT_KEY = "color"; 50069 const CUSTOM_CLASS_NAME_SUPPORT_KEY = "customClassName"; 50070 const supports_FONT_FAMILY_SUPPORT_KEY = "typography.__experimentalFontFamily"; 50071 const supports_FONT_SIZE_SUPPORT_KEY = "typography.fontSize"; 50072 const supports_LINE_HEIGHT_SUPPORT_KEY = "typography.lineHeight"; 50073 const supports_FONT_STYLE_SUPPORT_KEY = "typography.__experimentalFontStyle"; 50074 const supports_FONT_WEIGHT_SUPPORT_KEY = "typography.__experimentalFontWeight"; 50075 const supports_TEXT_ALIGN_SUPPORT_KEY = "typography.textAlign"; 50076 const supports_TEXT_COLUMNS_SUPPORT_KEY = "typography.textColumns"; 50077 const supports_TEXT_DECORATION_SUPPORT_KEY = "typography.__experimentalTextDecoration"; 50078 const supports_WRITING_MODE_SUPPORT_KEY = "typography.__experimentalWritingMode"; 50079 const supports_TEXT_TRANSFORM_SUPPORT_KEY = "typography.__experimentalTextTransform"; 50080 const supports_LETTER_SPACING_SUPPORT_KEY = "typography.__experimentalLetterSpacing"; 50081 const LAYOUT_SUPPORT_KEY = "layout"; 50082 const supports_TYPOGRAPHY_SUPPORT_KEYS = [ 50083 supports_LINE_HEIGHT_SUPPORT_KEY, 50084 supports_FONT_SIZE_SUPPORT_KEY, 50085 supports_FONT_STYLE_SUPPORT_KEY, 50086 supports_FONT_WEIGHT_SUPPORT_KEY, 50087 supports_FONT_FAMILY_SUPPORT_KEY, 50088 supports_TEXT_ALIGN_SUPPORT_KEY, 50089 supports_TEXT_COLUMNS_SUPPORT_KEY, 50090 supports_TEXT_DECORATION_SUPPORT_KEY, 50091 supports_TEXT_TRANSFORM_SUPPORT_KEY, 50092 supports_WRITING_MODE_SUPPORT_KEY, 50093 supports_LETTER_SPACING_SUPPORT_KEY 50094 ]; 50095 const EFFECTS_SUPPORT_KEYS = ["shadow"]; 50096 const supports_SPACING_SUPPORT_KEY = "spacing"; 50097 const supports_styleSupportKeys = [ 50098 ...EFFECTS_SUPPORT_KEYS, 50099 ...supports_TYPOGRAPHY_SUPPORT_KEYS, 50100 supports_BORDER_SUPPORT_KEY, 50101 supports_COLOR_SUPPORT_KEY, 50102 supports_SPACING_SUPPORT_KEY 50103 ]; 50104 const hasAlignSupport = (nameOrType) => (0,external_wp_blocks_namespaceObject.hasBlockSupport)(nameOrType, ALIGN_SUPPORT_KEY); 50105 const getAlignSupport = (nameOrType) => getBlockSupport(nameOrType, ALIGN_SUPPORT_KEY); 50106 const hasAlignWideSupport = (nameOrType) => hasBlockSupport(nameOrType, ALIGN_WIDE_SUPPORT_KEY); 50107 const getAlignWideSupport = (nameOrType) => getBlockSupport(nameOrType, ALIGN_WIDE_SUPPORT_KEY); 50108 function supports_hasBorderSupport(nameOrType, feature = "any") { 50109 if (external_wp_element_namespaceObject.Platform.OS !== "web") { 50110 return false; 50111 } 50112 const support = (0,external_wp_blocks_namespaceObject.getBlockSupport)(nameOrType, supports_BORDER_SUPPORT_KEY); 50113 if (support === true) { 50114 return true; 50115 } 50116 if (feature === "any") { 50117 return !!(support?.color || support?.radius || support?.width || support?.style); 50118 } 50119 return !!support?.[feature]; 50120 } 50121 const getBorderSupport = (nameOrType, feature) => getBlockSupport(nameOrType, [supports_BORDER_SUPPORT_KEY, feature]); 50122 const supports_hasColorSupport = (nameOrType) => { 50123 const colorSupport = getBlockSupport(nameOrType, supports_COLOR_SUPPORT_KEY); 50124 return colorSupport && (colorSupport.link === true || colorSupport.gradient === true || colorSupport.background !== false || colorSupport.text !== false); 50125 }; 50126 const supports_hasLinkColorSupport = (nameOrType) => { 50127 if (Platform.OS !== "web") { 50128 return false; 50129 } 50130 const colorSupport = getBlockSupport(nameOrType, supports_COLOR_SUPPORT_KEY); 50131 return colorSupport !== null && typeof colorSupport === "object" && !!colorSupport.link; 50132 }; 50133 const supports_hasGradientSupport = (nameOrType) => { 50134 const colorSupport = (0,external_wp_blocks_namespaceObject.getBlockSupport)(nameOrType, supports_COLOR_SUPPORT_KEY); 50135 return colorSupport !== null && typeof colorSupport === "object" && !!colorSupport.gradients; 50136 }; 50137 const supports_hasBackgroundColorSupport = (nameOrType) => { 50138 const colorSupport = (0,external_wp_blocks_namespaceObject.getBlockSupport)(nameOrType, supports_COLOR_SUPPORT_KEY); 50139 return colorSupport && colorSupport.background !== false; 50140 }; 50141 const hasTextAlignSupport = (nameOrType) => (0,external_wp_blocks_namespaceObject.hasBlockSupport)(nameOrType, supports_TEXT_ALIGN_SUPPORT_KEY); 50142 const getTextAlignSupport = (nameOrType) => getBlockSupport(nameOrType, supports_TEXT_ALIGN_SUPPORT_KEY); 50143 const supports_hasTextColorSupport = (nameOrType) => { 50144 const colorSupport = (0,external_wp_blocks_namespaceObject.getBlockSupport)(nameOrType, supports_COLOR_SUPPORT_KEY); 50145 return colorSupport && colorSupport.text !== false; 50146 }; 50147 const getColorSupport = (nameOrType, feature) => getBlockSupport(nameOrType, [supports_COLOR_SUPPORT_KEY, feature]); 50148 const hasCustomClassNameSupport = (nameOrType) => (0,external_wp_blocks_namespaceObject.hasBlockSupport)(nameOrType, CUSTOM_CLASS_NAME_SUPPORT_KEY, true); 50149 const getCustomClassNameSupport = (nameOrType) => getBlockSupport(nameOrType, CUSTOM_CLASS_NAME_SUPPORT_KEY, true); 50150 const hasFontFamilySupport = (nameOrType) => (0,external_wp_blocks_namespaceObject.hasBlockSupport)(nameOrType, supports_FONT_FAMILY_SUPPORT_KEY); 50151 const getFontFamilySupport = (nameOrType) => getBlockSupport(nameOrType, supports_FONT_FAMILY_SUPPORT_KEY); 50152 const hasFontSizeSupport = (nameOrType) => (0,external_wp_blocks_namespaceObject.hasBlockSupport)(nameOrType, supports_FONT_SIZE_SUPPORT_KEY); 50153 const getFontSizeSupport = (nameOrType) => getBlockSupport(nameOrType, supports_FONT_SIZE_SUPPORT_KEY); 50154 const hasLayoutSupport = (nameOrType) => (0,external_wp_blocks_namespaceObject.hasBlockSupport)(nameOrType, LAYOUT_SUPPORT_KEY); 50155 const getLayoutSupport = (nameOrType) => getBlockSupport(nameOrType, LAYOUT_SUPPORT_KEY); 50156 const supports_hasStyleSupport = (nameOrType) => supports_styleSupportKeys.some((key) => (0,external_wp_blocks_namespaceObject.hasBlockSupport)(nameOrType, key)); 50157 50158 50159 ;// ./node_modules/@wordpress/block-editor/build-module/components/use-paste-styles/index.js 50160 50161 50162 50163 50164 50165 50166 50167 function hasSerializedBlocks(text) { 50168 try { 50169 const blocks = (0,external_wp_blocks_namespaceObject.parse)(text, { 50170 __unstableSkipMigrationLogs: true, 50171 __unstableSkipAutop: true 50172 }); 50173 if (blocks.length === 1 && blocks[0].name === "core/freeform") { 50174 return false; 50175 } 50176 return true; 50177 } catch (err) { 50178 return false; 50179 } 50180 } 50181 const STYLE_ATTRIBUTES = { 50182 align: hasAlignSupport, 50183 borderColor: (nameOrType) => supports_hasBorderSupport(nameOrType, "color"), 50184 backgroundColor: supports_hasBackgroundColorSupport, 50185 textAlign: hasTextAlignSupport, 50186 textColor: supports_hasTextColorSupport, 50187 gradient: supports_hasGradientSupport, 50188 className: hasCustomClassNameSupport, 50189 fontFamily: hasFontFamilySupport, 50190 fontSize: hasFontSizeSupport, 50191 layout: hasLayoutSupport, 50192 style: supports_hasStyleSupport 50193 }; 50194 function getStyleAttributes(sourceBlock, targetBlock) { 50195 return Object.entries(STYLE_ATTRIBUTES).reduce( 50196 (attributes, [attributeKey, hasSupport]) => { 50197 if (hasSupport(sourceBlock.name) && hasSupport(targetBlock.name)) { 50198 attributes[attributeKey] = sourceBlock.attributes[attributeKey]; 50199 } 50200 return attributes; 50201 }, 50202 {} 50203 ); 50204 } 50205 function recursivelyUpdateBlockAttributes(targetBlocks, sourceBlocks, updateBlockAttributes) { 50206 for (let index = 0; index < Math.min(sourceBlocks.length, targetBlocks.length); index += 1) { 50207 updateBlockAttributes( 50208 targetBlocks[index].clientId, 50209 getStyleAttributes(sourceBlocks[index], targetBlocks[index]) 50210 ); 50211 recursivelyUpdateBlockAttributes( 50212 targetBlocks[index].innerBlocks, 50213 sourceBlocks[index].innerBlocks, 50214 updateBlockAttributes 50215 ); 50216 } 50217 } 50218 function usePasteStyles() { 50219 const registry = (0,external_wp_data_namespaceObject.useRegistry)(); 50220 const { updateBlockAttributes } = (0,external_wp_data_namespaceObject.useDispatch)(store); 50221 const { createSuccessNotice, createWarningNotice, createErrorNotice } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); 50222 return (0,external_wp_element_namespaceObject.useCallback)( 50223 async (targetBlocks) => { 50224 let html = ""; 50225 try { 50226 if (!window.navigator.clipboard) { 50227 createErrorNotice( 50228 (0,external_wp_i18n_namespaceObject.__)( 50229 "Unable to paste styles. This feature is only available on secure (https) sites in supporting browsers." 50230 ), 50231 { type: "snackbar" } 50232 ); 50233 return; 50234 } 50235 html = await window.navigator.clipboard.readText(); 50236 } catch (error) { 50237 createErrorNotice( 50238 (0,external_wp_i18n_namespaceObject.__)( 50239 "Unable to paste styles. Please allow browser clipboard permissions before continuing." 50240 ), 50241 { 50242 type: "snackbar" 50243 } 50244 ); 50245 return; 50246 } 50247 if (!html || !hasSerializedBlocks(html)) { 50248 createWarningNotice( 50249 (0,external_wp_i18n_namespaceObject.__)( 50250 "Unable to paste styles. Block styles couldn't be found within the copied content." 50251 ), 50252 { 50253 type: "snackbar" 50254 } 50255 ); 50256 return; 50257 } 50258 const copiedBlocks = (0,external_wp_blocks_namespaceObject.parse)(html); 50259 if (copiedBlocks.length === 1) { 50260 registry.batch(() => { 50261 recursivelyUpdateBlockAttributes( 50262 targetBlocks, 50263 targetBlocks.map(() => copiedBlocks[0]), 50264 updateBlockAttributes 50265 ); 50266 }); 50267 } else { 50268 registry.batch(() => { 50269 recursivelyUpdateBlockAttributes( 50270 targetBlocks, 50271 copiedBlocks, 50272 updateBlockAttributes 50273 ); 50274 }); 50275 } 50276 if (targetBlocks.length === 1) { 50277 const title = (0,external_wp_blocks_namespaceObject.getBlockType)(targetBlocks[0].name)?.title; 50278 createSuccessNotice( 50279 (0,external_wp_i18n_namespaceObject.sprintf)( 50280 // Translators: %s: Name of the block being pasted, e.g. "Paragraph". 50281 (0,external_wp_i18n_namespaceObject.__)("Pasted styles to %s."), 50282 title 50283 ), 50284 { type: "snackbar" } 50285 ); 50286 } else { 50287 createSuccessNotice( 50288 (0,external_wp_i18n_namespaceObject.sprintf)( 50289 // Translators: %d: The number of the blocks. 50290 (0,external_wp_i18n_namespaceObject.__)("Pasted styles to %d blocks."), 50291 targetBlocks.length 50292 ), 50293 { type: "snackbar" } 50294 ); 50295 } 50296 }, 50297 [ 50298 registry.batch, 50299 updateBlockAttributes, 50300 createSuccessNotice, 50301 createWarningNotice, 50302 createErrorNotice 50303 ] 50304 ); 50305 } 50306 50307 50308 ;// ./node_modules/@wordpress/block-editor/build-module/components/block-actions/index.js 50309 50310 50311 50312 50313 function BlockActions({ 50314 clientIds, 50315 children, 50316 __experimentalUpdateSelection: updateSelection 50317 }) { 50318 const { getDefaultBlockName, getGroupingBlockName } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blocks_namespaceObject.store); 50319 const selected = (0,external_wp_data_namespaceObject.useSelect)( 50320 (select) => { 50321 const { 50322 canInsertBlockType, 50323 getBlockRootClientId, 50324 getBlocksByClientId: getBlocksByClientId2, 50325 getDirectInsertBlock, 50326 canRemoveBlocks 50327 } = select(store); 50328 const blocks = getBlocksByClientId2(clientIds); 50329 const rootClientId = getBlockRootClientId(clientIds[0]); 50330 const canInsertDefaultBlock = canInsertBlockType( 50331 getDefaultBlockName(), 50332 rootClientId 50333 ); 50334 const directInsertBlock = rootClientId ? getDirectInsertBlock(rootClientId) : null; 50335 return { 50336 canRemove: canRemoveBlocks(clientIds), 50337 canInsertBlock: blocks.every((block) => { 50338 return (canInsertDefaultBlock || !!directInsertBlock) && canInsertBlockType(block.name, rootClientId); 50339 }), 50340 canCopyStyles: blocks.every((block) => { 50341 return !!block && ((0,external_wp_blocks_namespaceObject.hasBlockSupport)(block.name, "color") || (0,external_wp_blocks_namespaceObject.hasBlockSupport)(block.name, "typography")); 50342 }), 50343 canDuplicate: blocks.every((block) => { 50344 return !!block && (0,external_wp_blocks_namespaceObject.hasBlockSupport)(block.name, "multiple", true) && canInsertBlockType(block.name, rootClientId); 50345 }) 50346 }; 50347 }, 50348 [clientIds, getDefaultBlockName] 50349 ); 50350 const { getBlocksByClientId, getBlocks } = (0,external_wp_data_namespaceObject.useSelect)(store); 50351 const { canRemove, canInsertBlock, canCopyStyles, canDuplicate } = selected; 50352 const { 50353 removeBlocks, 50354 replaceBlocks, 50355 duplicateBlocks, 50356 insertAfterBlock, 50357 insertBeforeBlock, 50358 flashBlock 50359 } = (0,external_wp_data_namespaceObject.useDispatch)(store); 50360 const pasteStyles = usePasteStyles(); 50361 return children({ 50362 canCopyStyles, 50363 canDuplicate, 50364 canInsertBlock, 50365 canRemove, 50366 onDuplicate() { 50367 return duplicateBlocks(clientIds, updateSelection); 50368 }, 50369 onRemove() { 50370 return removeBlocks(clientIds, updateSelection); 50371 }, 50372 onInsertBefore() { 50373 insertBeforeBlock(clientIds[0]); 50374 }, 50375 onInsertAfter() { 50376 insertAfterBlock(clientIds[clientIds.length - 1]); 50377 }, 50378 onGroup() { 50379 if (!clientIds.length) { 50380 return; 50381 } 50382 const groupingBlockName = getGroupingBlockName(); 50383 const newBlocks = (0,external_wp_blocks_namespaceObject.switchToBlockType)( 50384 getBlocksByClientId(clientIds), 50385 groupingBlockName 50386 ); 50387 if (!newBlocks) { 50388 return; 50389 } 50390 replaceBlocks(clientIds, newBlocks); 50391 }, 50392 onUngroup() { 50393 if (!clientIds.length) { 50394 return; 50395 } 50396 const innerBlocks = getBlocks(clientIds[0]); 50397 if (!innerBlocks.length) { 50398 return; 50399 } 50400 replaceBlocks(clientIds, innerBlocks); 50401 }, 50402 onCopy() { 50403 if (clientIds.length === 1) { 50404 flashBlock(clientIds[0]); 50405 } 50406 }, 50407 async onPasteStyles() { 50408 await pasteStyles(getBlocksByClientId(clientIds)); 50409 } 50410 }); 50411 } 50412 50413 50414 ;// ./node_modules/@wordpress/block-editor/build-module/components/collab/block-comment-icon-slot.js 50415 50416 const CommentIconSlotFill = (0,external_wp_components_namespaceObject.createSlotFill)(Symbol("CommentIconSlotFill")); 50417 var block_comment_icon_slot_default = CommentIconSlotFill; 50418 50419 50420 ;// ./node_modules/@wordpress/block-editor/build-module/components/block-settings-menu/block-html-convert-button.js 50421 50422 50423 50424 50425 50426 50427 function BlockHTMLConvertButton({ clientId }) { 50428 const block = (0,external_wp_data_namespaceObject.useSelect)( 50429 (select) => select(store).getBlock(clientId), 50430 [clientId] 50431 ); 50432 const { replaceBlocks } = (0,external_wp_data_namespaceObject.useDispatch)(store); 50433 if (!block || block.name !== "core/html") { 50434 return null; 50435 } 50436 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 50437 external_wp_components_namespaceObject.MenuItem, 50438 { 50439 onClick: () => replaceBlocks( 50440 clientId, 50441 (0,external_wp_blocks_namespaceObject.rawHandler)({ HTML: (0,external_wp_blocks_namespaceObject.getBlockContent)(block) }) 50442 ), 50443 children: (0,external_wp_i18n_namespaceObject.__)("Convert to Blocks") 50444 } 50445 ); 50446 } 50447 var block_html_convert_button_default = BlockHTMLConvertButton; 50448 50449 50450 ;// ./node_modules/@wordpress/block-editor/build-module/components/block-settings-menu/block-settings-menu-first-item.js 50451 50452 const { Fill: __unstableBlockSettingsMenuFirstItem, Slot: block_settings_menu_first_item_Slot } = (0,external_wp_components_namespaceObject.createSlotFill)( 50453 "__unstableBlockSettingsMenuFirstItem" 50454 ); 50455 __unstableBlockSettingsMenuFirstItem.Slot = block_settings_menu_first_item_Slot; 50456 var block_settings_menu_first_item_default = __unstableBlockSettingsMenuFirstItem; 50457 50458 50459 ;// ./node_modules/@wordpress/block-editor/build-module/components/convert-to-group-buttons/use-convert-to-group-button-props.js 50460 50461 50462 50463 function useConvertToGroupButtonProps(selectedClientIds) { 50464 return (0,external_wp_data_namespaceObject.useSelect)( 50465 (select) => { 50466 const { 50467 getBlocksByClientId, 50468 getSelectedBlockClientIds, 50469 isUngroupable, 50470 isGroupable 50471 } = select(store); 50472 const { getGroupingBlockName, getBlockType } = select(external_wp_blocks_namespaceObject.store); 50473 const clientIds = selectedClientIds?.length ? selectedClientIds : getSelectedBlockClientIds(); 50474 const blocksSelection = getBlocksByClientId(clientIds); 50475 const [firstSelectedBlock] = blocksSelection; 50476 const _isUngroupable = clientIds.length === 1 && isUngroupable(clientIds[0]); 50477 return { 50478 clientIds, 50479 isGroupable: isGroupable(clientIds), 50480 isUngroupable: _isUngroupable, 50481 blocksSelection, 50482 groupingBlockName: getGroupingBlockName(), 50483 onUngroup: _isUngroupable && getBlockType(firstSelectedBlock.name)?.transforms?.ungroup 50484 }; 50485 }, 50486 [selectedClientIds] 50487 ); 50488 } 50489 50490 50491 ;// ./node_modules/@wordpress/block-editor/build-module/components/convert-to-group-buttons/index.js 50492 50493 50494 50495 50496 50497 50498 50499 50500 50501 function ConvertToGroupButton({ 50502 clientIds, 50503 isGroupable, 50504 isUngroupable, 50505 onUngroup, 50506 blocksSelection, 50507 groupingBlockName, 50508 onClose = () => { 50509 } 50510 }) { 50511 const { getSelectedBlockClientIds } = (0,external_wp_data_namespaceObject.useSelect)(store); 50512 const { replaceBlocks } = (0,external_wp_data_namespaceObject.useDispatch)(store); 50513 const onConvertToGroup = () => { 50514 const newBlocks = (0,external_wp_blocks_namespaceObject.switchToBlockType)( 50515 blocksSelection, 50516 groupingBlockName 50517 ); 50518 if (newBlocks) { 50519 replaceBlocks(clientIds, newBlocks); 50520 } 50521 }; 50522 const onConvertFromGroup = () => { 50523 let innerBlocks = blocksSelection[0].innerBlocks; 50524 if (!innerBlocks.length) { 50525 return; 50526 } 50527 if (onUngroup) { 50528 innerBlocks = onUngroup( 50529 blocksSelection[0].attributes, 50530 blocksSelection[0].innerBlocks 50531 ); 50532 } 50533 replaceBlocks(clientIds, innerBlocks); 50534 }; 50535 if (!isGroupable && !isUngroupable) { 50536 return null; 50537 } 50538 const selectedBlockClientIds = getSelectedBlockClientIds(); 50539 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 50540 isGroupable && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 50541 external_wp_components_namespaceObject.MenuItem, 50542 { 50543 shortcut: selectedBlockClientIds.length > 1 ? external_wp_keycodes_namespaceObject.displayShortcut.primary("g") : void 0, 50544 onClick: () => { 50545 onConvertToGroup(); 50546 onClose(); 50547 }, 50548 children: (0,external_wp_i18n_namespaceObject._x)("Group", "verb") 50549 } 50550 ), 50551 isUngroupable && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 50552 external_wp_components_namespaceObject.MenuItem, 50553 { 50554 onClick: () => { 50555 onConvertFromGroup(); 50556 onClose(); 50557 }, 50558 children: (0,external_wp_i18n_namespaceObject._x)( 50559 "Ungroup", 50560 "Ungrouping blocks from within a grouping block back into individual blocks within the Editor" 50561 ) 50562 } 50563 ) 50564 ] }); 50565 } 50566 50567 50568 ;// ./node_modules/@wordpress/block-editor/build-module/components/block-lock/use-block-lock.js 50569 50570 50571 function useBlockLock(clientId) { 50572 return (0,external_wp_data_namespaceObject.useSelect)( 50573 (select) => { 50574 const { 50575 canEditBlock, 50576 canMoveBlock, 50577 canRemoveBlock, 50578 canLockBlockType, 50579 getBlockName, 50580 getTemplateLock 50581 } = select(store); 50582 const canEdit = canEditBlock(clientId); 50583 const canMove = canMoveBlock(clientId); 50584 const canRemove = canRemoveBlock(clientId); 50585 return { 50586 canEdit, 50587 canMove, 50588 canRemove, 50589 canLock: canLockBlockType(getBlockName(clientId)), 50590 isContentLocked: getTemplateLock(clientId) === "contentOnly", 50591 isLocked: !canEdit || !canMove || !canRemove 50592 }; 50593 }, 50594 [clientId] 50595 ); 50596 } 50597 50598 50599 ;// ./node_modules/@wordpress/icons/build-module/library/unlock.js 50600 50601 50602 var unlock_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 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.8h1.5c0-1.2 1-2.2 2.2-2.2s2.2 1 2.2 2.2v3H7c-.6 0-1 .4-1 1v8c0 .6.4 1 1 1h10c.6 0 1-.4 1-1v-8c0-.6-.4-1-1-1z" }) }); 50603 50604 50605 ;// ./node_modules/@wordpress/icons/build-module/library/lock-outline.js 50606 50607 50608 var lock_outline_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 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-1zM9.8 7c0-1.2 1-2.2 2.2-2.2 1.2 0 2.2 1 2.2 2.2v3H9.8V7zm6.7 11.5h-9v-7h9v7z" }) }); 50609 50610 50611 ;// ./node_modules/@wordpress/icons/build-module/library/lock.js 50612 50613 50614 var lock_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 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" }) }); 50615 50616 50617 ;// ./node_modules/@wordpress/block-editor/build-module/components/block-lock/modal.js 50618 50619 50620 50621 50622 50623 50624 50625 50626 50627 50628 const ALLOWS_EDIT_LOCKING = ["core/navigation"]; 50629 function getTemplateLockValue(lock) { 50630 if (lock.remove && lock.move) { 50631 return "all"; 50632 } 50633 if (lock.remove && !lock.move) { 50634 return "insert"; 50635 } 50636 return false; 50637 } 50638 function BlockLockModal({ clientId, onClose }) { 50639 const [lock, setLock] = (0,external_wp_element_namespaceObject.useState)({ move: false, remove: false }); 50640 const { canEdit, canMove, canRemove } = useBlockLock(clientId); 50641 const { allowsEditLocking, templateLock, hasTemplateLock } = (0,external_wp_data_namespaceObject.useSelect)( 50642 (select) => { 50643 const { getBlockName, getBlockAttributes } = select(store); 50644 const blockName = getBlockName(clientId); 50645 const blockType = (0,external_wp_blocks_namespaceObject.getBlockType)(blockName); 50646 return { 50647 allowsEditLocking: ALLOWS_EDIT_LOCKING.includes(blockName), 50648 templateLock: getBlockAttributes(clientId)?.templateLock, 50649 hasTemplateLock: !!blockType?.attributes?.templateLock 50650 }; 50651 }, 50652 [clientId] 50653 ); 50654 const [applyTemplateLock, setApplyTemplateLock] = (0,external_wp_element_namespaceObject.useState)( 50655 !!templateLock 50656 ); 50657 const { updateBlockAttributes } = (0,external_wp_data_namespaceObject.useDispatch)(store); 50658 const blockInformation = useBlockDisplayInformation(clientId); 50659 (0,external_wp_element_namespaceObject.useEffect)(() => { 50660 setLock({ 50661 move: !canMove, 50662 remove: !canRemove, 50663 ...allowsEditLocking ? { edit: !canEdit } : {} 50664 }); 50665 }, [canEdit, canMove, canRemove, allowsEditLocking]); 50666 const isAllChecked = Object.values(lock).every(Boolean); 50667 const isMixed = Object.values(lock).some(Boolean) && !isAllChecked; 50668 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 50669 external_wp_components_namespaceObject.Modal, 50670 { 50671 title: (0,external_wp_i18n_namespaceObject.sprintf)( 50672 /* translators: %s: Name of the block. */ 50673 (0,external_wp_i18n_namespaceObject.__)("Lock %s"), 50674 blockInformation.title 50675 ), 50676 overlayClassName: "block-editor-block-lock-modal", 50677 onRequestClose: onClose, 50678 size: "small", 50679 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 50680 "form", 50681 { 50682 onSubmit: (event) => { 50683 event.preventDefault(); 50684 updateBlockAttributes([clientId], { 50685 lock, 50686 templateLock: applyTemplateLock ? getTemplateLockValue(lock) : void 0 50687 }); 50688 onClose(); 50689 }, 50690 children: [ 50691 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("fieldset", { className: "block-editor-block-lock-modal__options", children: [ 50692 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("legend", { children: (0,external_wp_i18n_namespaceObject.__)("Select the features you want to lock") }), 50693 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 50694 "ul", 50695 { 50696 role: "list", 50697 className: "block-editor-block-lock-modal__checklist", 50698 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("li", { children: [ 50699 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 50700 external_wp_components_namespaceObject.CheckboxControl, 50701 { 50702 __nextHasNoMarginBottom: true, 50703 className: "block-editor-block-lock-modal__options-all", 50704 label: (0,external_wp_i18n_namespaceObject.__)("Lock all"), 50705 checked: isAllChecked, 50706 indeterminate: isMixed, 50707 onChange: (newValue) => setLock({ 50708 move: newValue, 50709 remove: newValue, 50710 ...allowsEditLocking ? { edit: newValue } : {} 50711 }) 50712 } 50713 ), 50714 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 50715 "ul", 50716 { 50717 role: "list", 50718 className: "block-editor-block-lock-modal__checklist", 50719 children: [ 50720 allowsEditLocking && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("li", { className: "block-editor-block-lock-modal__checklist-item", children: [ 50721 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 50722 external_wp_components_namespaceObject.CheckboxControl, 50723 { 50724 __nextHasNoMarginBottom: true, 50725 label: (0,external_wp_i18n_namespaceObject.__)("Lock editing"), 50726 checked: !!lock.edit, 50727 onChange: (edit) => setLock((prevLock) => ({ 50728 ...prevLock, 50729 edit 50730 })) 50731 } 50732 ), 50733 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 50734 external_wp_components_namespaceObject.Icon, 50735 { 50736 className: "block-editor-block-lock-modal__lock-icon", 50737 icon: lock.edit ? lock_default : unlock_default 50738 } 50739 ) 50740 ] }), 50741 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("li", { className: "block-editor-block-lock-modal__checklist-item", children: [ 50742 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 50743 external_wp_components_namespaceObject.CheckboxControl, 50744 { 50745 __nextHasNoMarginBottom: true, 50746 label: (0,external_wp_i18n_namespaceObject.__)("Lock movement"), 50747 checked: lock.move, 50748 onChange: (move) => setLock((prevLock) => ({ 50749 ...prevLock, 50750 move 50751 })) 50752 } 50753 ), 50754 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 50755 external_wp_components_namespaceObject.Icon, 50756 { 50757 className: "block-editor-block-lock-modal__lock-icon", 50758 icon: lock.move ? lock_default : unlock_default 50759 } 50760 ) 50761 ] }), 50762 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("li", { className: "block-editor-block-lock-modal__checklist-item", children: [ 50763 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 50764 external_wp_components_namespaceObject.CheckboxControl, 50765 { 50766 __nextHasNoMarginBottom: true, 50767 label: (0,external_wp_i18n_namespaceObject.__)("Lock removal"), 50768 checked: lock.remove, 50769 onChange: (remove) => setLock((prevLock) => ({ 50770 ...prevLock, 50771 remove 50772 })) 50773 } 50774 ), 50775 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 50776 external_wp_components_namespaceObject.Icon, 50777 { 50778 className: "block-editor-block-lock-modal__lock-icon", 50779 icon: lock.remove ? lock_default : unlock_default 50780 } 50781 ) 50782 ] }) 50783 ] 50784 } 50785 ) 50786 ] }) 50787 } 50788 ), 50789 hasTemplateLock && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 50790 external_wp_components_namespaceObject.ToggleControl, 50791 { 50792 __nextHasNoMarginBottom: true, 50793 className: "block-editor-block-lock-modal__template-lock", 50794 label: (0,external_wp_i18n_namespaceObject.__)("Apply to all blocks inside"), 50795 checked: applyTemplateLock, 50796 disabled: lock.move && !lock.remove, 50797 onChange: () => setApplyTemplateLock(!applyTemplateLock) 50798 } 50799 ) 50800 ] }), 50801 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 50802 external_wp_components_namespaceObject.Flex, 50803 { 50804 className: "block-editor-block-lock-modal__actions", 50805 justify: "flex-end", 50806 expanded: false, 50807 children: [ 50808 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 50809 external_wp_components_namespaceObject.Button, 50810 { 50811 variant: "tertiary", 50812 onClick: onClose, 50813 __next40pxDefaultSize: true, 50814 children: (0,external_wp_i18n_namespaceObject.__)("Cancel") 50815 } 50816 ) }), 50817 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 50818 external_wp_components_namespaceObject.Button, 50819 { 50820 variant: "primary", 50821 type: "submit", 50822 __next40pxDefaultSize: true, 50823 children: (0,external_wp_i18n_namespaceObject.__)("Apply") 50824 } 50825 ) }) 50826 ] 50827 } 50828 ) 50829 ] 50830 } 50831 ) 50832 } 50833 ); 50834 } 50835 50836 50837 ;// ./node_modules/@wordpress/block-editor/build-module/components/block-lock/menu-item.js 50838 50839 50840 50841 50842 50843 50844 50845 function BlockLockMenuItem({ clientId }) { 50846 const { canLock, isLocked } = useBlockLock(clientId); 50847 const [isModalOpen, toggleModal] = (0,external_wp_element_namespaceObject.useReducer)( 50848 (isActive) => !isActive, 50849 false 50850 ); 50851 if (!canLock) { 50852 return null; 50853 } 50854 const label = isLocked ? (0,external_wp_i18n_namespaceObject.__)("Unlock") : (0,external_wp_i18n_namespaceObject.__)("Lock"); 50855 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 50856 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 50857 external_wp_components_namespaceObject.MenuItem, 50858 { 50859 icon: isLocked ? unlock_default : lock_outline_default, 50860 onClick: toggleModal, 50861 "aria-expanded": isModalOpen, 50862 "aria-haspopup": "dialog", 50863 children: label 50864 } 50865 ), 50866 isModalOpen && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockLockModal, { clientId, onClose: toggleModal }) 50867 ] }); 50868 } 50869 50870 50871 ;// ./node_modules/@wordpress/block-editor/build-module/components/block-settings-menu/block-mode-toggle.js 50872 50873 50874 50875 50876 50877 50878 const block_mode_toggle_noop = () => { 50879 }; 50880 function BlockModeToggle({ clientId, onToggle = block_mode_toggle_noop }) { 50881 const { blockType, mode, enabled } = (0,external_wp_data_namespaceObject.useSelect)( 50882 (select) => { 50883 const { getBlock, getBlockMode, getSettings } = select(store); 50884 const block = getBlock(clientId); 50885 return { 50886 mode: getBlockMode(clientId), 50887 blockType: block ? (0,external_wp_blocks_namespaceObject.getBlockType)(block.name) : null, 50888 enabled: getSettings().codeEditingEnabled && !!block?.isValid 50889 }; 50890 }, 50891 [clientId] 50892 ); 50893 const { toggleBlockMode } = (0,external_wp_data_namespaceObject.useDispatch)(store); 50894 if (!blockType || !(0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockType, "html", true) || !enabled) { 50895 return null; 50896 } 50897 const label = mode === "visual" ? (0,external_wp_i18n_namespaceObject.__)("Edit as HTML") : (0,external_wp_i18n_namespaceObject.__)("Edit visually"); 50898 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 50899 external_wp_components_namespaceObject.MenuItem, 50900 { 50901 onClick: () => { 50902 toggleBlockMode(clientId); 50903 onToggle(); 50904 }, 50905 children: label 50906 } 50907 ); 50908 } 50909 50910 50911 ;// ./node_modules/@wordpress/block-editor/build-module/components/content-lock/modify-content-lock-menu-item.js 50912 50913 50914 50915 50916 50917 50918 function ModifyContentLockMenuItem({ clientId, onClose }) { 50919 const { templateLock, isLockedByParent, isEditingAsBlocks } = (0,external_wp_data_namespaceObject.useSelect)( 50920 (select) => { 50921 const { 50922 getContentLockingParent, 50923 getTemplateLock, 50924 getTemporarilyEditingAsBlocks 50925 } = unlock(select(store)); 50926 return { 50927 templateLock: getTemplateLock(clientId), 50928 isLockedByParent: !!getContentLockingParent(clientId), 50929 isEditingAsBlocks: getTemporarilyEditingAsBlocks() === clientId 50930 }; 50931 }, 50932 [clientId] 50933 ); 50934 const blockEditorActions = (0,external_wp_data_namespaceObject.useDispatch)(store); 50935 const isContentLocked = !isLockedByParent && templateLock === "contentOnly"; 50936 if (!isContentLocked && !isEditingAsBlocks) { 50937 return null; 50938 } 50939 const { modifyContentLockBlock } = unlock(blockEditorActions); 50940 const showStartEditingAsBlocks = !isEditingAsBlocks && isContentLocked; 50941 return showStartEditingAsBlocks && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 50942 external_wp_components_namespaceObject.MenuItem, 50943 { 50944 onClick: () => { 50945 modifyContentLockBlock(clientId); 50946 onClose(); 50947 }, 50948 children: (0,external_wp_i18n_namespaceObject._x)("Modify", "Unlock content locked blocks") 50949 } 50950 ); 50951 } 50952 50953 50954 ;// ./node_modules/@wordpress/block-editor/build-module/components/block-rename/use-block-rename.js 50955 50956 function useBlockRename(name) { 50957 return { 50958 canRename: (0,external_wp_blocks_namespaceObject.getBlockSupport)(name, "renaming", true) 50959 }; 50960 } 50961 50962 50963 ;// ./node_modules/@wordpress/block-editor/build-module/components/block-rename/is-empty-string.js 50964 function isEmptyString(testString) { 50965 return testString?.trim()?.length === 0; 50966 } 50967 50968 50969 ;// ./node_modules/@wordpress/block-editor/build-module/components/block-rename/modal.js 50970 50971 50972 50973 50974 50975 50976 50977 50978 50979 50980 function BlockRenameModal({ clientId, onClose }) { 50981 const [editedBlockName, setEditedBlockName] = (0,external_wp_element_namespaceObject.useState)(); 50982 const blockInformation = useBlockDisplayInformation(clientId); 50983 const { metadata } = (0,external_wp_data_namespaceObject.useSelect)( 50984 (select) => { 50985 const { getBlockAttributes } = select(store); 50986 return { 50987 metadata: getBlockAttributes(clientId)?.metadata 50988 }; 50989 }, 50990 [clientId] 50991 ); 50992 const { updateBlockAttributes } = (0,external_wp_data_namespaceObject.useDispatch)(store); 50993 const blockName = metadata?.name || ""; 50994 const originalBlockName = blockInformation?.title; 50995 const hasOverridesWarning = !!blockName && !!metadata?.bindings && Object.values(metadata.bindings).some( 50996 (binding) => binding.source === "core/pattern-overrides" 50997 ); 50998 const nameHasChanged = editedBlockName !== void 0 && editedBlockName !== blockName; 50999 const nameIsOriginal = editedBlockName === originalBlockName; 51000 const nameIsEmpty = isEmptyString(editedBlockName); 51001 const isNameValid = nameHasChanged || nameIsOriginal; 51002 const autoSelectInputText = (event) => event.target.select(); 51003 const handleSubmit = () => { 51004 const newName = nameIsOriginal || nameIsEmpty ? void 0 : editedBlockName; 51005 const message = nameIsOriginal || nameIsEmpty ? (0,external_wp_i18n_namespaceObject.sprintf)( 51006 /* translators: %s: new name/label for the block */ 51007 (0,external_wp_i18n_namespaceObject.__)('Block name reset to: "%s".'), 51008 editedBlockName 51009 ) : (0,external_wp_i18n_namespaceObject.sprintf)( 51010 /* translators: %s: new name/label for the block */ 51011 (0,external_wp_i18n_namespaceObject.__)('Block name changed to: "%s".'), 51012 editedBlockName 51013 ); 51014 (0,external_wp_a11y_namespaceObject.speak)(message, "assertive"); 51015 updateBlockAttributes([clientId], { 51016 metadata: utils_cleanEmptyObject({ 51017 ...metadata, 51018 name: newName 51019 }) 51020 }); 51021 onClose(); 51022 }; 51023 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 51024 external_wp_components_namespaceObject.Modal, 51025 { 51026 title: (0,external_wp_i18n_namespaceObject.__)("Rename"), 51027 onRequestClose: onClose, 51028 overlayClassName: "block-editor-block-rename-modal", 51029 focusOnMount: "firstContentElement", 51030 size: "small", 51031 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 51032 "form", 51033 { 51034 onSubmit: (e) => { 51035 e.preventDefault(); 51036 if (!isNameValid) { 51037 return; 51038 } 51039 handleSubmit(); 51040 }, 51041 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: "3", children: [ 51042 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 51043 external_wp_components_namespaceObject.TextControl, 51044 { 51045 __nextHasNoMarginBottom: true, 51046 __next40pxDefaultSize: true, 51047 value: editedBlockName ?? blockName, 51048 label: (0,external_wp_i18n_namespaceObject.__)("Name"), 51049 help: hasOverridesWarning ? (0,external_wp_i18n_namespaceObject.__)( 51050 "This block allows overrides. Changing the name can cause problems with content entered into instances of this pattern." 51051 ) : void 0, 51052 placeholder: originalBlockName, 51053 onChange: setEditedBlockName, 51054 onFocus: autoSelectInputText 51055 } 51056 ), 51057 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "right", children: [ 51058 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 51059 external_wp_components_namespaceObject.Button, 51060 { 51061 __next40pxDefaultSize: true, 51062 variant: "tertiary", 51063 onClick: onClose, 51064 children: (0,external_wp_i18n_namespaceObject.__)("Cancel") 51065 } 51066 ), 51067 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 51068 external_wp_components_namespaceObject.Button, 51069 { 51070 __next40pxDefaultSize: true, 51071 accessibleWhenDisabled: true, 51072 disabled: !isNameValid, 51073 variant: "primary", 51074 type: "submit", 51075 children: (0,external_wp_i18n_namespaceObject.__)("Save") 51076 } 51077 ) 51078 ] }) 51079 ] }) 51080 } 51081 ) 51082 } 51083 ); 51084 } 51085 51086 51087 ;// ./node_modules/@wordpress/block-editor/build-module/components/block-rename/rename-control.js 51088 51089 51090 51091 51092 51093 function BlockRenameControl({ clientId }) { 51094 const [renamingBlock, setRenamingBlock] = (0,external_wp_element_namespaceObject.useState)(false); 51095 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 51096 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 51097 external_wp_components_namespaceObject.MenuItem, 51098 { 51099 onClick: () => { 51100 setRenamingBlock(true); 51101 }, 51102 "aria-expanded": renamingBlock, 51103 "aria-haspopup": "dialog", 51104 children: (0,external_wp_i18n_namespaceObject.__)("Rename") 51105 } 51106 ), 51107 renamingBlock && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 51108 BlockRenameModal, 51109 { 51110 clientId, 51111 onClose: () => setRenamingBlock(false) 51112 } 51113 ) 51114 ] }); 51115 } 51116 51117 51118 ;// ./node_modules/@wordpress/icons/build-module/library/seen.js 51119 51120 51121 var seen_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 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" }) }); 51122 51123 51124 ;// ./node_modules/@wordpress/icons/build-module/library/unseen.js 51125 51126 51127 var unseen_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 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" }) }); 51128 51129 51130 ;// ./node_modules/@wordpress/block-editor/build-module/components/block-visibility/menu-item.js 51131 51132 51133 51134 51135 51136 51137 51138 51139 51140 function BlockVisibilityMenuItem({ clientIds }) { 51141 const { updateBlockAttributes } = (0,external_wp_data_namespaceObject.useDispatch)(store); 51142 const { createSuccessNotice } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); 51143 const blocks = (0,external_wp_data_namespaceObject.useSelect)( 51144 (select) => { 51145 return select(store).getBlocksByClientId(clientIds); 51146 }, 51147 [clientIds] 51148 ); 51149 const listViewShortcut = (0,external_wp_data_namespaceObject.useSelect)((select) => { 51150 return select(external_wp_keyboardShortcuts_namespaceObject.store).getShortcutRepresentation( 51151 "core/editor/toggle-list-view" 51152 ); 51153 }, []); 51154 const hasHiddenBlock = blocks.some( 51155 (block) => block.attributes.metadata?.blockVisibility === false 51156 ); 51157 const toggleBlockVisibility = () => { 51158 const isHiding = !hasHiddenBlock; 51159 const attributesByClientId = Object.fromEntries( 51160 blocks?.map(({ clientId, attributes }) => [ 51161 clientId, 51162 { 51163 metadata: utils_cleanEmptyObject({ 51164 ...attributes?.metadata, 51165 blockVisibility: isHiding ? false : void 0 51166 }) 51167 } 51168 ]) 51169 ); 51170 updateBlockAttributes(clientIds, attributesByClientId, { 51171 uniqueByBlock: true 51172 }); 51173 if (isHiding) { 51174 if (blocks.length > 1) { 51175 createSuccessNotice( 51176 (0,external_wp_i18n_namespaceObject.sprintf)( 51177 // translators: %s: The shortcut key to access the List View. 51178 (0,external_wp_i18n_namespaceObject.__)( 51179 "Blocks hidden. You can access them via the List View (%s)." 51180 ), 51181 listViewShortcut 51182 ), 51183 { 51184 id: "block-visibility-hidden", 51185 type: "snackbar" 51186 } 51187 ); 51188 } else { 51189 createSuccessNotice( 51190 (0,external_wp_i18n_namespaceObject.sprintf)( 51191 // translators: %s: The shortcut key to access the List View. 51192 (0,external_wp_i18n_namespaceObject.__)( 51193 "Block hidden. You can access it via the List View (%s)." 51194 ), 51195 listViewShortcut 51196 ), 51197 { 51198 id: "block-visibility-hidden", 51199 type: "snackbar" 51200 } 51201 ); 51202 } 51203 } 51204 }; 51205 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 51206 external_wp_components_namespaceObject.MenuItem, 51207 { 51208 icon: hasHiddenBlock ? seen_default : unseen_default, 51209 onClick: toggleBlockVisibility, 51210 children: hasHiddenBlock ? (0,external_wp_i18n_namespaceObject.__)("Show") : (0,external_wp_i18n_namespaceObject.__)("Hide") 51211 } 51212 ); 51213 } 51214 51215 51216 ;// ./node_modules/@wordpress/block-editor/build-module/components/block-settings-menu-controls/index.js 51217 51218 51219 51220 51221 51222 51223 51224 51225 51226 51227 51228 const { Fill, Slot: block_settings_menu_controls_Slot } = (0,external_wp_components_namespaceObject.createSlotFill)("BlockSettingsMenuControls"); 51229 const BlockSettingsMenuControlsSlot = ({ fillProps, clientIds = null }) => { 51230 const { 51231 selectedBlocks, 51232 selectedClientIds, 51233 isContentOnly, 51234 canToggleSelectedBlocksVisibility 51235 } = (0,external_wp_data_namespaceObject.useSelect)( 51236 (select) => { 51237 const { 51238 getBlocksByClientId, 51239 getBlockNamesByClientId, 51240 getSelectedBlockClientIds, 51241 getBlockEditingMode 51242 } = select(store); 51243 const ids = clientIds !== null ? clientIds : getSelectedBlockClientIds(); 51244 return { 51245 selectedBlocks: getBlockNamesByClientId(ids), 51246 selectedClientIds: ids, 51247 isContentOnly: getBlockEditingMode(ids[0]) === "contentOnly", 51248 canToggleSelectedBlocksVisibility: getBlocksByClientId( 51249 ids 51250 ).every( 51251 (block) => (0,external_wp_blocks_namespaceObject.hasBlockSupport)(block.name, "blockVisibility", true) 51252 ) 51253 }; 51254 }, 51255 [clientIds] 51256 ); 51257 const { canLock } = useBlockLock(selectedClientIds[0]); 51258 const { canRename } = useBlockRename(selectedBlocks[0]); 51259 const showLockButton = selectedClientIds.length === 1 && canLock && !isContentOnly; 51260 const showRenameButton = selectedClientIds.length === 1 && canRename && !isContentOnly; 51261 const showVisibilityButton = canToggleSelectedBlocksVisibility && !isContentOnly; 51262 const convertToGroupButtonProps = useConvertToGroupButtonProps(selectedClientIds); 51263 const { isGroupable, isUngroupable } = convertToGroupButtonProps; 51264 const showConvertToGroupButton = (isGroupable || isUngroupable) && !isContentOnly; 51265 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 51266 block_settings_menu_controls_Slot, 51267 { 51268 fillProps: { 51269 ...fillProps, 51270 selectedBlocks, 51271 selectedClientIds 51272 }, 51273 children: (fills) => { 51274 if (!fills?.length > 0 && !showConvertToGroupButton && !showLockButton) { 51275 return null; 51276 } 51277 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.MenuGroup, { children: [ 51278 showConvertToGroupButton && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 51279 ConvertToGroupButton, 51280 { 51281 ...convertToGroupButtonProps, 51282 onClose: fillProps?.onClose 51283 } 51284 ), 51285 showLockButton && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 51286 BlockLockMenuItem, 51287 { 51288 clientId: selectedClientIds[0] 51289 } 51290 ), 51291 showRenameButton && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 51292 BlockRenameControl, 51293 { 51294 clientId: selectedClientIds[0] 51295 } 51296 ), 51297 showVisibilityButton && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 51298 BlockVisibilityMenuItem, 51299 { 51300 clientIds: selectedClientIds 51301 } 51302 ), 51303 fills, 51304 selectedClientIds.length === 1 && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 51305 ModifyContentLockMenuItem, 51306 { 51307 clientId: selectedClientIds[0], 51308 onClose: fillProps?.onClose 51309 } 51310 ), 51311 fillProps?.count === 1 && !isContentOnly && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 51312 BlockModeToggle, 51313 { 51314 clientId: fillProps?.firstBlockClientId, 51315 onToggle: fillProps?.onClose 51316 } 51317 ) 51318 ] }); 51319 } 51320 } 51321 ); 51322 }; 51323 function BlockSettingsMenuControls({ ...props }) { 51324 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalStyleProvider, { document, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Fill, { ...props }) }); 51325 } 51326 BlockSettingsMenuControls.Slot = BlockSettingsMenuControlsSlot; 51327 var block_settings_menu_controls_default = BlockSettingsMenuControls; 51328 51329 51330 ;// ./node_modules/@wordpress/block-editor/build-module/components/block-settings-menu/block-parent-selector-menu-item.js 51331 51332 51333 51334 51335 51336 51337 51338 51339 51340 function BlockParentSelectorMenuItem({ 51341 parentClientId, 51342 parentBlockType 51343 }) { 51344 const isSmallViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)("medium", "<"); 51345 const { selectBlock } = (0,external_wp_data_namespaceObject.useDispatch)(store); 51346 const menuItemRef = (0,external_wp_element_namespaceObject.useRef)(); 51347 const gesturesProps = useShowHoveredOrFocusedGestures({ 51348 ref: menuItemRef, 51349 highlightParent: true 51350 }); 51351 if (!isSmallViewport) { 51352 return null; 51353 } 51354 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 51355 external_wp_components_namespaceObject.MenuItem, 51356 { 51357 ...gesturesProps, 51358 ref: menuItemRef, 51359 icon: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(block_icon_default, { icon: parentBlockType.icon }), 51360 onClick: () => selectBlock(parentClientId), 51361 children: (0,external_wp_i18n_namespaceObject.sprintf)( 51362 /* translators: %s: Name of the block's parent. */ 51363 (0,external_wp_i18n_namespaceObject.__)("Select parent block (%s)"), 51364 parentBlockType.title 51365 ) 51366 } 51367 ); 51368 } 51369 51370 51371 ;// ./node_modules/@wordpress/block-editor/build-module/components/block-settings-menu/block-settings-dropdown.js 51372 51373 51374 51375 51376 51377 51378 51379 51380 51381 51382 51383 51384 51385 51386 51387 51388 51389 51390 const block_settings_dropdown_POPOVER_PROPS = { 51391 className: "block-editor-block-settings-menu__popover", 51392 placement: "bottom-start" 51393 }; 51394 function CopyMenuItem({ 51395 clientIds, 51396 onCopy, 51397 label, 51398 shortcut, 51399 eventType = "copy", 51400 __experimentalUpdateSelection: updateSelection = false 51401 }) { 51402 const { getBlocksByClientId } = (0,external_wp_data_namespaceObject.useSelect)(store); 51403 const { removeBlocks } = (0,external_wp_data_namespaceObject.useDispatch)(store); 51404 const notifyCopy = useNotifyCopy(); 51405 const ref = (0,external_wp_compose_namespaceObject.useCopyToClipboard)( 51406 () => (0,external_wp_blocks_namespaceObject.serialize)(getBlocksByClientId(clientIds)), 51407 () => { 51408 switch (eventType) { 51409 case "copy": 51410 case "copyStyles": 51411 onCopy(); 51412 notifyCopy(eventType, clientIds); 51413 break; 51414 case "cut": 51415 notifyCopy(eventType, clientIds); 51416 removeBlocks(clientIds, updateSelection); 51417 break; 51418 default: 51419 break; 51420 } 51421 } 51422 ); 51423 const copyMenuItemLabel = label ? label : (0,external_wp_i18n_namespaceObject.__)("Copy"); 51424 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { ref, shortcut, children: copyMenuItemLabel }); 51425 } 51426 function BlockSettingsDropdown({ 51427 block, 51428 clientIds, 51429 children, 51430 __experimentalSelectBlock, 51431 ...props 51432 }) { 51433 const currentClientId = block?.clientId; 51434 const count = clientIds.length; 51435 const firstBlockClientId = clientIds[0]; 51436 const { 51437 firstParentClientId, 51438 parentBlockType, 51439 previousBlockClientId, 51440 selectedBlockClientIds, 51441 openedBlockSettingsMenu, 51442 isContentOnly, 51443 isZoomOut 51444 } = (0,external_wp_data_namespaceObject.useSelect)( 51445 (select) => { 51446 const { 51447 getBlockName, 51448 getBlockRootClientId, 51449 getPreviousBlockClientId, 51450 getSelectedBlockClientIds: getSelectedBlockClientIds2, 51451 getBlockAttributes, 51452 getOpenedBlockSettingsMenu, 51453 getBlockEditingMode, 51454 isZoomOut: _isZoomOut 51455 } = unlock(select(store)); 51456 const { getActiveBlockVariation } = select(external_wp_blocks_namespaceObject.store); 51457 const _firstParentClientId = getBlockRootClientId(firstBlockClientId); 51458 const parentBlockName = _firstParentClientId && getBlockName(_firstParentClientId); 51459 return { 51460 firstParentClientId: _firstParentClientId, 51461 parentBlockType: _firstParentClientId && (getActiveBlockVariation( 51462 parentBlockName, 51463 getBlockAttributes(_firstParentClientId) 51464 ) || (0,external_wp_blocks_namespaceObject.getBlockType)(parentBlockName)), 51465 previousBlockClientId: getPreviousBlockClientId(firstBlockClientId), 51466 selectedBlockClientIds: getSelectedBlockClientIds2(), 51467 openedBlockSettingsMenu: getOpenedBlockSettingsMenu(), 51468 isContentOnly: getBlockEditingMode(firstBlockClientId) === "contentOnly", 51469 isZoomOut: _isZoomOut() 51470 }; 51471 }, 51472 [firstBlockClientId] 51473 ); 51474 const { getBlockOrder, getSelectedBlockClientIds } = (0,external_wp_data_namespaceObject.useSelect)(store); 51475 const { setOpenedBlockSettingsMenu } = unlock( 51476 (0,external_wp_data_namespaceObject.useDispatch)(store) 51477 ); 51478 const shortcuts = (0,external_wp_data_namespaceObject.useSelect)((select) => { 51479 const { getShortcutRepresentation } = select(external_wp_keyboardShortcuts_namespaceObject.store); 51480 return { 51481 copy: getShortcutRepresentation("core/block-editor/copy"), 51482 cut: getShortcutRepresentation("core/block-editor/cut"), 51483 duplicate: getShortcutRepresentation( 51484 "core/block-editor/duplicate" 51485 ), 51486 remove: getShortcutRepresentation("core/block-editor/remove"), 51487 insertAfter: getShortcutRepresentation( 51488 "core/block-editor/insert-after" 51489 ), 51490 insertBefore: getShortcutRepresentation( 51491 "core/block-editor/insert-before" 51492 ) 51493 }; 51494 }, []); 51495 const hasSelectedBlocks = selectedBlockClientIds.length > 0; 51496 async function updateSelectionAfterDuplicate(clientIdsPromise) { 51497 if (!__experimentalSelectBlock) { 51498 return; 51499 } 51500 const ids = await clientIdsPromise; 51501 if (ids && ids[0]) { 51502 __experimentalSelectBlock(ids[0], false); 51503 } 51504 } 51505 function updateSelectionAfterRemove() { 51506 if (!__experimentalSelectBlock) { 51507 return; 51508 } 51509 let blockToFocus = previousBlockClientId || firstParentClientId; 51510 if (!blockToFocus) { 51511 blockToFocus = getBlockOrder()[0]; 51512 } 51513 const shouldUpdateSelection = hasSelectedBlocks && getSelectedBlockClientIds().length === 0; 51514 __experimentalSelectBlock(blockToFocus, shouldUpdateSelection); 51515 } 51516 const parentBlockIsSelected = selectedBlockClientIds?.includes(firstParentClientId); 51517 const open = !currentClientId ? void 0 : openedBlockSettingsMenu === currentClientId || false; 51518 function onToggle(localOpen) { 51519 if (localOpen && openedBlockSettingsMenu !== currentClientId) { 51520 setOpenedBlockSettingsMenu(currentClientId); 51521 } else if (!localOpen && openedBlockSettingsMenu && openedBlockSettingsMenu === currentClientId) { 51522 setOpenedBlockSettingsMenu(void 0); 51523 } 51524 } 51525 const shouldShowBlockParentMenuItem = !parentBlockIsSelected && !!firstParentClientId; 51526 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 51527 BlockActions, 51528 { 51529 clientIds, 51530 __experimentalUpdateSelection: !__experimentalSelectBlock, 51531 children: ({ 51532 canCopyStyles, 51533 canDuplicate, 51534 canInsertBlock, 51535 canRemove, 51536 onDuplicate, 51537 onInsertAfter, 51538 onInsertBefore, 51539 onRemove, 51540 onCopy, 51541 onPasteStyles 51542 }) => { 51543 const isEmpty = !canRemove && !canDuplicate && !canInsertBlock && isContentOnly; 51544 if (isEmpty) { 51545 return null; 51546 } 51547 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 51548 external_wp_components_namespaceObject.DropdownMenu, 51549 { 51550 icon: more_vertical_default, 51551 label: (0,external_wp_i18n_namespaceObject.__)("Options"), 51552 className: "block-editor-block-settings-menu", 51553 popoverProps: block_settings_dropdown_POPOVER_PROPS, 51554 open, 51555 onToggle, 51556 noIcons: true, 51557 ...props, 51558 children: ({ onClose }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 51559 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.MenuGroup, { children: [ 51560 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 51561 block_settings_menu_first_item_default.Slot, 51562 { 51563 fillProps: { onClose } 51564 } 51565 ), 51566 shouldShowBlockParentMenuItem && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 51567 BlockParentSelectorMenuItem, 51568 { 51569 parentClientId: firstParentClientId, 51570 parentBlockType 51571 } 51572 ), 51573 count === 1 && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 51574 block_html_convert_button_default, 51575 { 51576 clientId: firstBlockClientId 51577 } 51578 ), 51579 !isContentOnly && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 51580 CopyMenuItem, 51581 { 51582 clientIds, 51583 onCopy, 51584 shortcut: shortcuts.copy 51585 } 51586 ), 51587 !isContentOnly && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 51588 CopyMenuItem, 51589 { 51590 clientIds, 51591 label: (0,external_wp_i18n_namespaceObject.__)("Cut"), 51592 eventType: "cut", 51593 shortcut: shortcuts.cut, 51594 __experimentalUpdateSelection: !__experimentalSelectBlock 51595 } 51596 ), 51597 canDuplicate && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 51598 external_wp_components_namespaceObject.MenuItem, 51599 { 51600 onClick: (0,external_wp_compose_namespaceObject.pipe)( 51601 onClose, 51602 onDuplicate, 51603 updateSelectionAfterDuplicate 51604 ), 51605 shortcut: shortcuts.duplicate, 51606 children: (0,external_wp_i18n_namespaceObject.__)("Duplicate") 51607 } 51608 ), 51609 canInsertBlock && !isZoomOut && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 51610 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 51611 external_wp_components_namespaceObject.MenuItem, 51612 { 51613 onClick: (0,external_wp_compose_namespaceObject.pipe)( 51614 onClose, 51615 onInsertBefore 51616 ), 51617 shortcut: shortcuts.insertBefore, 51618 children: (0,external_wp_i18n_namespaceObject.__)("Add before") 51619 } 51620 ), 51621 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 51622 external_wp_components_namespaceObject.MenuItem, 51623 { 51624 onClick: (0,external_wp_compose_namespaceObject.pipe)( 51625 onClose, 51626 onInsertAfter 51627 ), 51628 shortcut: shortcuts.insertAfter, 51629 children: (0,external_wp_i18n_namespaceObject.__)("Add after") 51630 } 51631 ) 51632 ] }), 51633 count === 1 && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 51634 block_comment_icon_slot_default.Slot, 51635 { 51636 fillProps: { onClose } 51637 } 51638 ) 51639 ] }), 51640 canCopyStyles && !isContentOnly && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.MenuGroup, { children: [ 51641 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 51642 CopyMenuItem, 51643 { 51644 clientIds, 51645 onCopy, 51646 label: (0,external_wp_i18n_namespaceObject.__)("Copy styles"), 51647 eventType: "copyStyles" 51648 } 51649 ), 51650 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { onClick: onPasteStyles, children: (0,external_wp_i18n_namespaceObject.__)("Paste styles") }) 51651 ] }), 51652 !isContentOnly && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 51653 block_settings_menu_controls_default.Slot, 51654 { 51655 fillProps: { 51656 onClose, 51657 count, 51658 firstBlockClientId 51659 }, 51660 clientIds 51661 } 51662 ), 51663 typeof children === "function" ? children({ onClose }) : external_wp_element_namespaceObject.Children.map( 51664 (child) => (0,external_wp_element_namespaceObject.cloneElement)(child, { onClose }) 51665 ), 51666 canRemove && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuGroup, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 51667 external_wp_components_namespaceObject.MenuItem, 51668 { 51669 onClick: (0,external_wp_compose_namespaceObject.pipe)( 51670 onClose, 51671 onRemove, 51672 updateSelectionAfterRemove 51673 ), 51674 shortcut: shortcuts.remove, 51675 children: (0,external_wp_i18n_namespaceObject.__)("Delete") 51676 } 51677 ) }) 51678 ] }) 51679 } 51680 ); 51681 } 51682 } 51683 ); 51684 } 51685 var block_settings_dropdown_default = BlockSettingsDropdown; 51686 51687 51688 ;// ./node_modules/@wordpress/block-editor/build-module/components/collab/block-comment-icon-toolbar-slot.js 51689 51690 const CommentIconToolbarSlotFill = (0,external_wp_components_namespaceObject.createSlotFill)( 51691 Symbol("CommentIconToolbarSlotFill") 51692 ); 51693 var block_comment_icon_toolbar_slot_default = CommentIconToolbarSlotFill; 51694 51695 51696 ;// ./node_modules/@wordpress/block-editor/build-module/components/block-settings-menu/index.js 51697 51698 51699 51700 51701 function BlockSettingsMenu({ clientIds, ...props }) { 51702 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.ToolbarGroup, { children: [ 51703 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(block_comment_icon_toolbar_slot_default.Slot, {}), 51704 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarItem, { children: (toggleProps) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 51705 block_settings_dropdown_default, 51706 { 51707 clientIds, 51708 toggleProps, 51709 ...props 51710 } 51711 ) }) 51712 ] }); 51713 } 51714 var block_settings_menu_default = BlockSettingsMenu; 51715 51716 51717 ;// ./node_modules/@wordpress/block-editor/build-module/components/block-lock/toolbar.js 51718 51719 51720 51721 51722 51723 51724 51725 function BlockLockToolbar({ clientId }) { 51726 const { canLock, isLocked } = useBlockLock(clientId); 51727 const [isModalOpen, toggleModal] = (0,external_wp_element_namespaceObject.useReducer)( 51728 (isActive) => !isActive, 51729 false 51730 ); 51731 const hasLockButtonShownRef = (0,external_wp_element_namespaceObject.useRef)(false); 51732 (0,external_wp_element_namespaceObject.useEffect)(() => { 51733 if (isLocked) { 51734 hasLockButtonShownRef.current = true; 51735 } 51736 }, [isLocked]); 51737 if (!isLocked && !hasLockButtonShownRef.current) { 51738 return null; 51739 } 51740 let label = isLocked ? (0,external_wp_i18n_namespaceObject.__)("Unlock") : (0,external_wp_i18n_namespaceObject.__)("Lock"); 51741 if (!canLock && isLocked) { 51742 label = (0,external_wp_i18n_namespaceObject.__)("Locked"); 51743 } 51744 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 51745 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarGroup, { className: "block-editor-block-lock-toolbar", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 51746 external_wp_components_namespaceObject.ToolbarButton, 51747 { 51748 disabled: !canLock, 51749 icon: isLocked ? lock_default : unlock_default, 51750 label, 51751 onClick: toggleModal, 51752 "aria-expanded": isModalOpen, 51753 "aria-haspopup": "dialog" 51754 } 51755 ) }), 51756 isModalOpen && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockLockModal, { clientId, onClose: toggleModal }) 51757 ] }); 51758 } 51759 51760 51761 ;// ./node_modules/@wordpress/block-editor/build-module/components/block-visibility/toolbar.js 51762 51763 51764 51765 51766 51767 51768 51769 51770 51771 function BlockVisibilityToolbar({ clientIds }) { 51772 const { blocks, canToggleBlockVisibility } = (0,external_wp_data_namespaceObject.useSelect)( 51773 (select) => { 51774 const { getBlockName, getBlocksByClientId } = select(store); 51775 const _blocks = getBlocksByClientId(clientIds); 51776 return { 51777 blocks: _blocks, 51778 canToggleBlockVisibility: _blocks.every( 51779 ({ clientId }) => (0,external_wp_blocks_namespaceObject.hasBlockSupport)( 51780 getBlockName(clientId), 51781 "blockVisibility", 51782 true 51783 ) 51784 ) 51785 }; 51786 }, 51787 [clientIds] 51788 ); 51789 const hasHiddenBlock = blocks.some( 51790 (block) => block.attributes.metadata?.blockVisibility === false 51791 ); 51792 const hasBlockVisibilityButtonShownRef = (0,external_wp_element_namespaceObject.useRef)(false); 51793 const { updateBlockAttributes } = (0,external_wp_data_namespaceObject.useDispatch)(store); 51794 (0,external_wp_element_namespaceObject.useEffect)(() => { 51795 if (hasHiddenBlock) { 51796 hasBlockVisibilityButtonShownRef.current = true; 51797 } 51798 }, [hasHiddenBlock]); 51799 if (!hasHiddenBlock && !hasBlockVisibilityButtonShownRef.current) { 51800 return null; 51801 } 51802 const toggleBlockVisibility = () => { 51803 const attributesByClientId = Object.fromEntries( 51804 blocks?.map(({ clientId, attributes }) => [ 51805 clientId, 51806 { 51807 metadata: utils_cleanEmptyObject({ 51808 ...attributes?.metadata, 51809 blockVisibility: hasHiddenBlock ? void 0 : false 51810 }) 51811 } 51812 ]) 51813 ); 51814 updateBlockAttributes(clientIds, attributesByClientId, { 51815 uniqueByBlock: true 51816 }); 51817 }; 51818 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarGroup, { className: "block-editor-block-lock-toolbar", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 51819 external_wp_components_namespaceObject.ToolbarButton, 51820 { 51821 disabled: !canToggleBlockVisibility, 51822 icon: hasHiddenBlock ? unseen_default : seen_default, 51823 label: hasHiddenBlock ? (0,external_wp_i18n_namespaceObject.__)("Hidden") : (0,external_wp_i18n_namespaceObject.__)("Visible"), 51824 onClick: toggleBlockVisibility 51825 } 51826 ) }) }); 51827 } 51828 51829 51830 ;// ./node_modules/@wordpress/icons/build-module/library/group.js 51831 51832 51833 var group_group_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M18 4h-7c-1.1 0-2 .9-2 2v3H6c-1.1 0-2 .9-2 2v7c0 1.1.9 2 2 2h7c1.1 0 2-.9 2-2v-3h3c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm-4.5 14c0 .3-.2.5-.5.5H6c-.3 0-.5-.2-.5-.5v-7c0-.3.2-.5.5-.5h3V13c0 1.1.9 2 2 2h2.5v3zm0-4.5H11c-.3 0-.5-.2-.5-.5v-2.5H13c.3 0 .5.2.5.5v2.5zm5-.5c0 .3-.2.5-.5.5h-3V11c0-1.1-.9-2-2-2h-2.5V6c0-.3.2-.5.5-.5h7c.3 0 .5.2.5.5v7z" }) }); 51834 51835 51836 ;// ./node_modules/@wordpress/icons/build-module/library/row.js 51837 51838 51839 var row_row_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M4 6.5h5a2 2 0 0 1 2 2v7a2 2 0 0 1-2 2H4V16h5a.5.5 0 0 0 .5-.5v-7A.5.5 0 0 0 9 8H4V6.5Zm16 0h-5a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h5V16h-5a.5.5 0 0 1-.5-.5v-7A.5.5 0 0 1 15 8h5V6.5Z" }) }); 51840 51841 51842 ;// ./node_modules/@wordpress/icons/build-module/library/stack.js 51843 51844 51845 var stack_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M17.5 4v5a2 2 0 0 1-2 2h-7a2 2 0 0 1-2-2V4H8v5a.5.5 0 0 0 .5.5h7A.5.5 0 0 0 16 9V4h1.5Zm0 16v-5a2 2 0 0 0-2-2h-7a2 2 0 0 0-2 2v5H8v-5a.5.5 0 0 1 .5-.5h7a.5.5 0 0 1 .5.5v5h1.5Z" }) }); 51846 51847 51848 ;// ./node_modules/@wordpress/icons/build-module/library/grid.js 51849 51850 51851 var grid_grid_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 51852 external_wp_primitives_namespaceObject.Path, 51853 { 51854 d: "m3 5c0-1.10457.89543-2 2-2h13.5c1.1046 0 2 .89543 2 2v13.5c0 1.1046-.8954 2-2 2h-13.5c-1.10457 0-2-.8954-2-2zm2-.5h6v6.5h-6.5v-6c0-.27614.22386-.5.5-.5zm-.5 8v6c0 .2761.22386.5.5.5h6v-6.5zm8 0v6.5h6c.2761 0 .5-.2239.5-.5v-6zm0-8v6.5h6.5v-6c0-.27614-.2239-.5-.5-.5z", 51855 fillRule: "evenodd", 51856 clipRule: "evenodd" 51857 } 51858 ) }); 51859 51860 51861 ;// ./node_modules/@wordpress/block-editor/build-module/components/convert-to-group-buttons/toolbar.js 51862 51863 51864 51865 51866 51867 51868 51869 51870 const layouts = { 51871 group: { type: "constrained" }, 51872 row: { type: "flex", flexWrap: "nowrap" }, 51873 stack: { type: "flex", orientation: "vertical" }, 51874 grid: { type: "grid" } 51875 }; 51876 function BlockGroupToolbar() { 51877 const { blocksSelection, clientIds, groupingBlockName, isGroupable } = useConvertToGroupButtonProps(); 51878 const { replaceBlocks } = (0,external_wp_data_namespaceObject.useDispatch)(store); 51879 const { canRemove, variations } = (0,external_wp_data_namespaceObject.useSelect)( 51880 (select) => { 51881 const { canRemoveBlocks } = select(store); 51882 const { getBlockVariations } = select(external_wp_blocks_namespaceObject.store); 51883 return { 51884 canRemove: canRemoveBlocks(clientIds), 51885 variations: getBlockVariations( 51886 groupingBlockName, 51887 "transform" 51888 ) 51889 }; 51890 }, 51891 [clientIds, groupingBlockName] 51892 ); 51893 const onConvertToGroup = (layout) => { 51894 const newBlocks = (0,external_wp_blocks_namespaceObject.switchToBlockType)( 51895 blocksSelection, 51896 groupingBlockName 51897 ); 51898 if (typeof layout !== "string") { 51899 layout = "group"; 51900 } 51901 if (newBlocks && newBlocks.length > 0) { 51902 newBlocks[0].attributes.layout = layouts[layout]; 51903 replaceBlocks(clientIds, newBlocks); 51904 } 51905 }; 51906 const onConvertToRow = () => onConvertToGroup("row"); 51907 const onConvertToStack = () => onConvertToGroup("stack"); 51908 const onConvertToGrid = () => onConvertToGroup("grid"); 51909 if (!isGroupable || !canRemove) { 51910 return null; 51911 } 51912 const canInsertRow = !!variations.find( 51913 ({ name }) => name === "group-row" 51914 ); 51915 const canInsertStack = !!variations.find( 51916 ({ name }) => name === "group-stack" 51917 ); 51918 const canInsertGrid = !!variations.find( 51919 ({ name }) => name === "group-grid" 51920 ); 51921 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.ToolbarGroup, { children: [ 51922 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 51923 external_wp_components_namespaceObject.ToolbarButton, 51924 { 51925 icon: group_group_default, 51926 label: (0,external_wp_i18n_namespaceObject._x)("Group", "action: convert blocks to group"), 51927 onClick: onConvertToGroup 51928 } 51929 ), 51930 canInsertRow && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 51931 external_wp_components_namespaceObject.ToolbarButton, 51932 { 51933 icon: row_row_default, 51934 label: (0,external_wp_i18n_namespaceObject._x)("Row", "action: convert blocks to row"), 51935 onClick: onConvertToRow 51936 } 51937 ), 51938 canInsertStack && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 51939 external_wp_components_namespaceObject.ToolbarButton, 51940 { 51941 icon: stack_default, 51942 label: (0,external_wp_i18n_namespaceObject._x)("Stack", "action: convert blocks to stack"), 51943 onClick: onConvertToStack 51944 } 51945 ), 51946 canInsertGrid && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 51947 external_wp_components_namespaceObject.ToolbarButton, 51948 { 51949 icon: grid_grid_default, 51950 label: (0,external_wp_i18n_namespaceObject._x)("Grid", "action: convert blocks to grid"), 51951 onClick: onConvertToGrid 51952 } 51953 ) 51954 ] }); 51955 } 51956 var toolbar_default = BlockGroupToolbar; 51957 51958 51959 ;// ./node_modules/@wordpress/block-editor/build-module/components/block-edit-visually-button/index.js 51960 51961 51962 51963 51964 51965 function BlockEditVisuallyButton({ clientIds }) { 51966 const clientId = clientIds.length === 1 ? clientIds[0] : void 0; 51967 const canEditVisually = (0,external_wp_data_namespaceObject.useSelect)( 51968 (select) => !!clientId && select(store).getBlockMode(clientId) === "html", 51969 [clientId] 51970 ); 51971 const { toggleBlockMode } = (0,external_wp_data_namespaceObject.useDispatch)(store); 51972 if (!canEditVisually) { 51973 return null; 51974 } 51975 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarGroup, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 51976 external_wp_components_namespaceObject.ToolbarButton, 51977 { 51978 onClick: () => { 51979 toggleBlockMode(clientId); 51980 }, 51981 children: (0,external_wp_i18n_namespaceObject.__)("Edit visually") 51982 } 51983 ) }); 51984 } 51985 51986 51987 ;// ./node_modules/@wordpress/block-editor/build-module/components/block-toolbar/block-name-context.js 51988 51989 const __unstableBlockNameContext = (0,external_wp_element_namespaceObject.createContext)(""); 51990 __unstableBlockNameContext.displayName = "__unstableBlockNameContext"; 51991 var block_name_context_default = __unstableBlockNameContext; 51992 51993 51994 ;// ./node_modules/@wordpress/block-editor/build-module/components/navigable-toolbar/index.js 51995 51996 51997 51998 51999 52000 52001 52002 52003 52004 52005 function hasOnlyToolbarItem(elements) { 52006 const dataProp = "toolbarItem"; 52007 return !elements.some((element) => !(dataProp in element.dataset)); 52008 } 52009 function getAllFocusableToolbarItemsIn(container) { 52010 return Array.from( 52011 container.querySelectorAll("[data-toolbar-item]:not([disabled])") 52012 ); 52013 } 52014 function hasFocusWithin(container) { 52015 return container.contains(container.ownerDocument.activeElement); 52016 } 52017 function focusFirstTabbableIn(container) { 52018 const [firstTabbable] = external_wp_dom_namespaceObject.focus.tabbable.find(container); 52019 if (firstTabbable) { 52020 firstTabbable.focus({ 52021 // When focusing newly mounted toolbars, 52022 // the position of the popover is often not right on the first render 52023 // This prevents the layout shifts when focusing the dialogs. 52024 preventScroll: true 52025 }); 52026 } 52027 } 52028 function useIsAccessibleToolbar(toolbarRef) { 52029 const initialAccessibleToolbarState = true; 52030 const [isAccessibleToolbar, setIsAccessibleToolbar] = (0,external_wp_element_namespaceObject.useState)( 52031 initialAccessibleToolbarState 52032 ); 52033 const determineIsAccessibleToolbar = (0,external_wp_element_namespaceObject.useCallback)(() => { 52034 const tabbables = external_wp_dom_namespaceObject.focus.tabbable.find(toolbarRef.current); 52035 const onlyToolbarItem = hasOnlyToolbarItem(tabbables); 52036 if (!onlyToolbarItem) { 52037 external_wp_deprecated_default()("Using custom components as toolbar controls", { 52038 since: "5.6", 52039 alternative: "ToolbarItem, ToolbarButton or ToolbarDropdownMenu components", 52040 link: "https://developer.wordpress.org/block-editor/components/toolbar-button/#inside-blockcontrols" 52041 }); 52042 } 52043 setIsAccessibleToolbar(onlyToolbarItem); 52044 }, [toolbarRef]); 52045 (0,external_wp_element_namespaceObject.useLayoutEffect)(() => { 52046 const observer = new window.MutationObserver( 52047 determineIsAccessibleToolbar 52048 ); 52049 observer.observe(toolbarRef.current, { 52050 childList: true, 52051 subtree: true 52052 }); 52053 return () => observer.disconnect(); 52054 }, [determineIsAccessibleToolbar, isAccessibleToolbar, toolbarRef]); 52055 return isAccessibleToolbar; 52056 } 52057 function useToolbarFocus({ 52058 toolbarRef, 52059 focusOnMount, 52060 isAccessibleToolbar, 52061 defaultIndex, 52062 onIndexChange, 52063 shouldUseKeyboardFocusShortcut, 52064 focusEditorOnEscape 52065 }) { 52066 const [initialFocusOnMount] = (0,external_wp_element_namespaceObject.useState)(focusOnMount); 52067 const [initialIndex] = (0,external_wp_element_namespaceObject.useState)(defaultIndex); 52068 const focusToolbar = (0,external_wp_element_namespaceObject.useCallback)(() => { 52069 focusFirstTabbableIn(toolbarRef.current); 52070 }, [toolbarRef]); 52071 const focusToolbarViaShortcut = () => { 52072 if (shouldUseKeyboardFocusShortcut) { 52073 focusToolbar(); 52074 } 52075 }; 52076 (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)("core/block-editor/focus-toolbar", focusToolbarViaShortcut); 52077 (0,external_wp_element_namespaceObject.useEffect)(() => { 52078 if (initialFocusOnMount) { 52079 focusToolbar(); 52080 } 52081 }, [isAccessibleToolbar, initialFocusOnMount, focusToolbar]); 52082 (0,external_wp_element_namespaceObject.useEffect)(() => { 52083 const navigableToolbarRef = toolbarRef.current; 52084 let raf = 0; 52085 if (!initialFocusOnMount && !hasFocusWithin(navigableToolbarRef)) { 52086 raf = window.requestAnimationFrame(() => { 52087 const items = getAllFocusableToolbarItemsIn(navigableToolbarRef); 52088 const index = initialIndex || 0; 52089 if (items[index] && hasFocusWithin(navigableToolbarRef)) { 52090 items[index].focus({ 52091 // When focusing newly mounted toolbars, 52092 // the position of the popover is often not right on the first render 52093 // This prevents the layout shifts when focusing the dialogs. 52094 preventScroll: true 52095 }); 52096 } 52097 }); 52098 } 52099 return () => { 52100 window.cancelAnimationFrame(raf); 52101 if (!onIndexChange || !navigableToolbarRef) { 52102 return; 52103 } 52104 const items = getAllFocusableToolbarItemsIn(navigableToolbarRef); 52105 const index = items.findIndex((item) => item.tabIndex === 0); 52106 onIndexChange(index); 52107 }; 52108 }, [initialIndex, initialFocusOnMount, onIndexChange, toolbarRef]); 52109 const { getLastFocus } = unlock((0,external_wp_data_namespaceObject.useSelect)(store)); 52110 (0,external_wp_element_namespaceObject.useEffect)(() => { 52111 const navigableToolbarRef = toolbarRef.current; 52112 if (focusEditorOnEscape) { 52113 const handleKeyDown = (event) => { 52114 const lastFocus = getLastFocus(); 52115 if (event.keyCode === external_wp_keycodes_namespaceObject.ESCAPE && lastFocus?.current) { 52116 event.preventDefault(); 52117 lastFocus.current.focus(); 52118 } 52119 }; 52120 navigableToolbarRef.addEventListener("keydown", handleKeyDown); 52121 return () => { 52122 navigableToolbarRef.removeEventListener( 52123 "keydown", 52124 handleKeyDown 52125 ); 52126 }; 52127 } 52128 }, [focusEditorOnEscape, getLastFocus, toolbarRef]); 52129 } 52130 function NavigableToolbar({ 52131 children, 52132 focusOnMount, 52133 focusEditorOnEscape = false, 52134 shouldUseKeyboardFocusShortcut = true, 52135 __experimentalInitialIndex: initialIndex, 52136 __experimentalOnIndexChange: onIndexChange, 52137 orientation = "horizontal", 52138 ...props 52139 }) { 52140 const toolbarRef = (0,external_wp_element_namespaceObject.useRef)(); 52141 const isAccessibleToolbar = useIsAccessibleToolbar(toolbarRef); 52142 useToolbarFocus({ 52143 toolbarRef, 52144 focusOnMount, 52145 defaultIndex: initialIndex, 52146 onIndexChange, 52147 isAccessibleToolbar, 52148 shouldUseKeyboardFocusShortcut, 52149 focusEditorOnEscape 52150 }); 52151 if (isAccessibleToolbar) { 52152 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 52153 external_wp_components_namespaceObject.Toolbar, 52154 { 52155 label: props["aria-label"], 52156 ref: toolbarRef, 52157 orientation, 52158 ...props, 52159 children 52160 } 52161 ); 52162 } 52163 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 52164 external_wp_components_namespaceObject.NavigableMenu, 52165 { 52166 orientation, 52167 role: "toolbar", 52168 ref: toolbarRef, 52169 ...props, 52170 children 52171 } 52172 ); 52173 } 52174 52175 52176 ;// ./node_modules/@wordpress/block-editor/build-module/components/block-toolbar/use-has-block-toolbar.js 52177 52178 52179 52180 function useHasBlockToolbar() { 52181 const enabled = (0,external_wp_data_namespaceObject.useSelect)((select) => { 52182 const { getBlockEditingMode, getBlockName, getBlockSelectionStart } = select(store); 52183 const selectedBlockClientId = getBlockSelectionStart(); 52184 const blockType = selectedBlockClientId && (0,external_wp_blocks_namespaceObject.getBlockType)(getBlockName(selectedBlockClientId)); 52185 return blockType && (0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockType, "__experimentalToolbar", true) && getBlockEditingMode(selectedBlockClientId) !== "disabled"; 52186 }, []); 52187 return enabled; 52188 } 52189 52190 52191 ;// ./node_modules/@wordpress/block-editor/build-module/components/block-toolbar/change-design.js 52192 52193 52194 52195 52196 52197 52198 52199 52200 const change_design_EMPTY_ARRAY = []; 52201 const MAX_PATTERNS_TO_SHOW = 6; 52202 const change_design_POPOVER_PROPS = { 52203 placement: "bottom-start" 52204 }; 52205 function ChangeDesign({ clientId }) { 52206 const { categories, currentPatternName, patterns } = (0,external_wp_data_namespaceObject.useSelect)( 52207 (select) => { 52208 const { 52209 getBlockAttributes, 52210 getBlockRootClientId, 52211 __experimentalGetAllowedPatterns 52212 } = select(store); 52213 const attributes = getBlockAttributes(clientId); 52214 const _categories = attributes?.metadata?.categories || change_design_EMPTY_ARRAY; 52215 const rootBlock = getBlockRootClientId(clientId); 52216 const _patterns = _categories.length > 0 ? __experimentalGetAllowedPatterns(rootBlock) : change_design_EMPTY_ARRAY; 52217 return { 52218 categories: _categories, 52219 currentPatternName: attributes?.metadata?.patternName, 52220 patterns: _patterns 52221 }; 52222 }, 52223 [clientId] 52224 ); 52225 const { replaceBlocks } = (0,external_wp_data_namespaceObject.useDispatch)(store); 52226 const sameCategoryPatternsWithSingleWrapper = (0,external_wp_element_namespaceObject.useMemo)(() => { 52227 if (categories.length === 0 || !patterns || patterns.length === 0) { 52228 return change_design_EMPTY_ARRAY; 52229 } 52230 return patterns.filter((pattern) => { 52231 const isCorePattern = pattern.source === "core" || pattern.source?.startsWith("pattern-directory") && pattern.source !== "pattern-directory/theme"; 52232 return ( 52233 // Check if the pattern has only one top level block, 52234 // otherwise we may switch to a pattern that doesn't have replacement suggestions. 52235 pattern.blocks.length === 1 && // We exclude the core patterns and pattern directory patterns that are not theme patterns. 52236 !isCorePattern && // Exclude current pattern. 52237 currentPatternName !== pattern.name && pattern.categories?.some((category) => { 52238 return categories.includes(category); 52239 }) && // Check if the pattern is not a synced pattern. 52240 (pattern.syncStatus === "unsynced" || !pattern.id) 52241 ); 52242 }).slice(0, MAX_PATTERNS_TO_SHOW); 52243 }, [categories, currentPatternName, patterns]); 52244 if (sameCategoryPatternsWithSingleWrapper.length < 2) { 52245 return null; 52246 } 52247 const onClickPattern = (pattern) => { 52248 const newBlocks = (pattern.blocks ?? []).map((block) => { 52249 return (0,external_wp_blocks_namespaceObject.cloneBlock)(block); 52250 }); 52251 newBlocks[0].attributes.metadata = { 52252 ...newBlocks[0].attributes.metadata, 52253 categories 52254 }; 52255 replaceBlocks(clientId, newBlocks); 52256 }; 52257 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 52258 external_wp_components_namespaceObject.Dropdown, 52259 { 52260 popoverProps: change_design_POPOVER_PROPS, 52261 renderToggle: ({ onToggle, isOpen }) => { 52262 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarGroup, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 52263 external_wp_components_namespaceObject.ToolbarButton, 52264 { 52265 onClick: () => onToggle(!isOpen), 52266 "aria-expanded": isOpen, 52267 children: (0,external_wp_i18n_namespaceObject.__)("Change design") 52268 } 52269 ) }); 52270 }, 52271 renderContent: () => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 52272 external_wp_components_namespaceObject.__experimentalDropdownContentWrapper, 52273 { 52274 className: "block-editor-block-toolbar-change-design-content-wrapper", 52275 paddingSize: "none", 52276 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 52277 block_patterns_list_default, 52278 { 52279 blockPatterns: sameCategoryPatternsWithSingleWrapper, 52280 onClickPattern, 52281 showTitlesAsTooltip: true 52282 } 52283 ) 52284 } 52285 ) 52286 } 52287 ); 52288 } 52289 52290 52291 ;// ./node_modules/@wordpress/block-editor/build-module/components/block-toolbar/switch-section-style.js 52292 52293 52294 52295 52296 52297 52298 52299 52300 52301 52302 52303 const styleIcon = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 52304 external_wp_components_namespaceObject.SVG, 52305 { 52306 viewBox: "0 0 24 24", 52307 xmlns: "http://www.w3.org/2000/svg", 52308 width: "24", 52309 height: "24", 52310 "aria-hidden": "true", 52311 focusable: "false", 52312 children: [ 52313 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Path, { 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-3z" }), 52314 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 52315 external_wp_components_namespaceObject.Path, 52316 { 52317 stroke: "currentColor", 52318 strokeWidth: "1.5", 52319 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-3z" 52320 } 52321 ) 52322 ] 52323 } 52324 ); 52325 function SwitchSectionStyle({ clientId }) { 52326 const { stylesToRender, activeStyle, className } = useStylesForBlocks({ 52327 clientId 52328 }); 52329 const { updateBlockAttributes } = (0,external_wp_data_namespaceObject.useDispatch)(store); 52330 const { merged: mergedConfig } = (0,external_wp_element_namespaceObject.useContext)(GlobalStylesContext); 52331 const { globalSettings, globalStyles, blockName } = (0,external_wp_data_namespaceObject.useSelect)( 52332 (select) => { 52333 const settings = select(store).getSettings(); 52334 return { 52335 globalSettings: settings.__experimentalFeatures, 52336 globalStyles: settings[globalStylesDataKey], 52337 blockName: select(store).getBlockName(clientId) 52338 }; 52339 }, 52340 [clientId] 52341 ); 52342 const activeStyleBackground = activeStyle?.name ? getVariationStylesWithRefValues( 52343 { 52344 settings: mergedConfig?.settings ?? globalSettings, 52345 styles: mergedConfig?.styles ?? globalStyles 52346 }, 52347 blockName, 52348 activeStyle.name 52349 )?.color?.background : void 0; 52350 if (!stylesToRender || stylesToRender.length === 0) { 52351 return null; 52352 } 52353 const handleStyleSwitch = () => { 52354 const currentIndex = stylesToRender.findIndex( 52355 (style) => style.name === activeStyle.name 52356 ); 52357 const nextIndex = (currentIndex + 1) % stylesToRender.length; 52358 const nextStyle = stylesToRender[nextIndex]; 52359 const styleClassName = replaceActiveStyle( 52360 className, 52361 activeStyle, 52362 nextStyle 52363 ); 52364 updateBlockAttributes(clientId, { 52365 className: styleClassName 52366 }); 52367 }; 52368 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarGroup, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 52369 external_wp_components_namespaceObject.ToolbarButton, 52370 { 52371 onClick: handleStyleSwitch, 52372 label: (0,external_wp_i18n_namespaceObject.__)("Shuffle styles"), 52373 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 52374 external_wp_components_namespaceObject.Icon, 52375 { 52376 icon: styleIcon, 52377 style: { 52378 fill: activeStyleBackground || "transparent" 52379 } 52380 } 52381 ) 52382 } 52383 ) }); 52384 } 52385 var switch_section_style_default = SwitchSectionStyle; 52386 52387 52388 ;// ./node_modules/@wordpress/block-editor/build-module/components/block-toolbar/index.js 52389 52390 52391 52392 52393 52394 52395 52396 52397 52398 52399 52400 52401 52402 52403 52404 52405 52406 52407 52408 52409 52410 52411 52412 52413 52414 52415 function PrivateBlockToolbar({ 52416 hideDragHandle, 52417 focusOnMount, 52418 __experimentalInitialIndex, 52419 __experimentalOnIndexChange, 52420 variant = "unstyled" 52421 }) { 52422 const { 52423 blockClientId, 52424 blockClientIds, 52425 isDefaultEditingMode, 52426 blockType, 52427 toolbarKey, 52428 shouldShowVisualToolbar, 52429 showParentSelector, 52430 isUsingBindings, 52431 hasParentPattern, 52432 hasContentOnlyLocking, 52433 showShuffleButton, 52434 showSlots, 52435 showGroupButtons, 52436 showLockButtons, 52437 showBlockVisibilityButton, 52438 showSwitchSectionStyleButton 52439 } = (0,external_wp_data_namespaceObject.useSelect)((select) => { 52440 const { 52441 getBlockName, 52442 getBlockMode, 52443 getBlockParents, 52444 getSelectedBlockClientIds, 52445 isBlockValid, 52446 getBlockEditingMode, 52447 getBlockAttributes, 52448 getBlockParentsByBlockName, 52449 getTemplateLock, 52450 getParentSectionBlock, 52451 isZoomOut, 52452 isSectionBlock 52453 } = unlock(select(store)); 52454 const selectedBlockClientIds = getSelectedBlockClientIds(); 52455 const selectedBlockClientId = selectedBlockClientIds[0]; 52456 const parents = getBlockParents(selectedBlockClientId); 52457 const parentSection = getParentSectionBlock(selectedBlockClientId); 52458 const parentClientId = parentSection ?? parents[parents.length - 1]; 52459 const parentBlockName = getBlockName(parentClientId); 52460 const parentBlockType = (0,external_wp_blocks_namespaceObject.getBlockType)(parentBlockName); 52461 const editingMode = getBlockEditingMode(selectedBlockClientId); 52462 const _isDefaultEditingMode = editingMode === "default"; 52463 const _blockName = getBlockName(selectedBlockClientId); 52464 const isValid = selectedBlockClientIds.every( 52465 (id) => isBlockValid(id) 52466 ); 52467 const isVisual = selectedBlockClientIds.every( 52468 (id) => getBlockMode(id) === "visual" 52469 ); 52470 const _isUsingBindings = selectedBlockClientIds.every( 52471 (clientId) => !!getBlockAttributes(clientId)?.metadata?.bindings 52472 ); 52473 const _hasParentPattern = selectedBlockClientIds.every( 52474 (clientId) => getBlockParentsByBlockName(clientId, "core/block", true).length > 0 52475 ); 52476 const _hasTemplateLock = selectedBlockClientIds.some( 52477 (id) => getTemplateLock(id) === "contentOnly" 52478 ); 52479 const _isZoomOut = isZoomOut(); 52480 const _showSwitchSectionStyleButton = window?.__experimentalContentOnlyPatternInsertion && (_isZoomOut || isSectionBlock(selectedBlockClientId)); 52481 return { 52482 blockClientId: selectedBlockClientId, 52483 blockClientIds: selectedBlockClientIds, 52484 isDefaultEditingMode: _isDefaultEditingMode, 52485 blockType: selectedBlockClientId && (0,external_wp_blocks_namespaceObject.getBlockType)(_blockName), 52486 shouldShowVisualToolbar: isValid && isVisual, 52487 toolbarKey: `$selectedBlockClientId}$parentClientId}`, 52488 showParentSelector: !_isZoomOut && parentBlockType && editingMode !== "contentOnly" && getBlockEditingMode(parentClientId) !== "disabled" && (0,external_wp_blocks_namespaceObject.hasBlockSupport)( 52489 parentBlockType, 52490 "__experimentalParentSelector", 52491 true 52492 ) && selectedBlockClientIds.length === 1, 52493 isUsingBindings: _isUsingBindings, 52494 hasParentPattern: _hasParentPattern, 52495 hasContentOnlyLocking: _hasTemplateLock, 52496 showShuffleButton: _isZoomOut, 52497 showSlots: !_isZoomOut, 52498 showGroupButtons: !_isZoomOut, 52499 showLockButtons: !_isZoomOut, 52500 showBlockVisibilityButton: !_isZoomOut, 52501 showSwitchSectionStyleButton: _showSwitchSectionStyleButton 52502 }; 52503 }, []); 52504 const toolbarWrapperRef = (0,external_wp_element_namespaceObject.useRef)(null); 52505 const nodeRef = (0,external_wp_element_namespaceObject.useRef)(); 52506 const showHoveredOrFocusedGestures = useShowHoveredOrFocusedGestures({ 52507 ref: nodeRef 52508 }); 52509 const isLargeViewport = !(0,external_wp_compose_namespaceObject.useViewportMatch)("medium", "<"); 52510 const hasBlockToolbar = useHasBlockToolbar(); 52511 if (!hasBlockToolbar) { 52512 return null; 52513 } 52514 const isMultiToolbar = blockClientIds.length > 1; 52515 const isSynced = (0,external_wp_blocks_namespaceObject.isReusableBlock)(blockType) || (0,external_wp_blocks_namespaceObject.isTemplatePart)(blockType); 52516 const classes = dist_clsx("block-editor-block-contextual-toolbar", { 52517 "has-parent": showParentSelector 52518 }); 52519 const innerClasses = dist_clsx("block-editor-block-toolbar", { 52520 "is-synced": isSynced, 52521 "is-connected": isUsingBindings 52522 }); 52523 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 52524 NavigableToolbar, 52525 { 52526 focusEditorOnEscape: true, 52527 className: classes, 52528 "aria-label": (0,external_wp_i18n_namespaceObject.__)("Block tools"), 52529 variant: variant === "toolbar" ? void 0 : variant, 52530 focusOnMount, 52531 __experimentalInitialIndex, 52532 __experimentalOnIndexChange, 52533 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { ref: toolbarWrapperRef, className: innerClasses, children: [ 52534 showParentSelector && !isMultiToolbar && isLargeViewport && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockParentSelector, {}), 52535 (shouldShowVisualToolbar || isMultiToolbar) && !hasParentPattern && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 52536 "div", 52537 { 52538 ref: nodeRef, 52539 ...showHoveredOrFocusedGestures, 52540 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.ToolbarGroup, { className: "block-editor-block-toolbar__block-controls", children: [ 52541 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(block_switcher_default, { clientIds: blockClientIds }), 52542 isDefaultEditingMode && showBlockVisibilityButton && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 52543 BlockVisibilityToolbar, 52544 { 52545 clientIds: blockClientIds 52546 } 52547 ), 52548 !isMultiToolbar && isDefaultEditingMode && showLockButtons && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 52549 BlockLockToolbar, 52550 { 52551 clientId: blockClientId 52552 } 52553 ), 52554 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 52555 block_mover_default, 52556 { 52557 clientIds: blockClientIds, 52558 hideDragHandle 52559 } 52560 ) 52561 ] }) 52562 } 52563 ), 52564 !hasContentOnlyLocking && shouldShowVisualToolbar && isMultiToolbar && showGroupButtons && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(toolbar_default, {}), 52565 showShuffleButton && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ChangeDesign, { clientId: blockClientIds[0] }), 52566 showSwitchSectionStyleButton && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(switch_section_style_default, { clientId: blockClientIds[0] }), 52567 shouldShowVisualToolbar && showSlots && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 52568 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 52569 block_controls_default.Slot, 52570 { 52571 group: "parent", 52572 className: "block-editor-block-toolbar__slot" 52573 } 52574 ), 52575 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 52576 block_controls_default.Slot, 52577 { 52578 group: "block", 52579 className: "block-editor-block-toolbar__slot" 52580 } 52581 ), 52582 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(block_controls_default.Slot, { className: "block-editor-block-toolbar__slot" }), 52583 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 52584 block_controls_default.Slot, 52585 { 52586 group: "inline", 52587 className: "block-editor-block-toolbar__slot" 52588 } 52589 ), 52590 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 52591 block_controls_default.Slot, 52592 { 52593 group: "other", 52594 className: "block-editor-block-toolbar__slot" 52595 } 52596 ), 52597 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 52598 block_name_context_default.Provider, 52599 { 52600 value: blockType?.name, 52601 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(block_toolbar_last_item_default.Slot, {}) 52602 } 52603 ) 52604 ] }), 52605 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockEditVisuallyButton, { clientIds: blockClientIds }), 52606 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(block_settings_menu_default, { clientIds: blockClientIds }) 52607 ] }) 52608 }, 52609 toolbarKey 52610 ); 52611 } 52612 function BlockToolbar({ hideDragHandle, variant }) { 52613 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 52614 PrivateBlockToolbar, 52615 { 52616 hideDragHandle, 52617 variant, 52618 focusOnMount: void 0, 52619 __experimentalInitialIndex: void 0, 52620 __experimentalOnIndexChange: void 0 52621 } 52622 ); 52623 } 52624 52625 52626 ;// ./node_modules/@wordpress/block-editor/build-module/components/block-tools/block-toolbar-popover.js 52627 52628 52629 52630 52631 52632 52633 52634 52635 52636 52637 function BlockToolbarPopover({ 52638 clientId, 52639 isTyping, 52640 __unstableContentRef 52641 }) { 52642 const { capturingClientId, isInsertionPointVisible, lastClientId } = useSelectedBlockToolProps(clientId); 52643 const initialToolbarItemIndexRef = (0,external_wp_element_namespaceObject.useRef)(); 52644 (0,external_wp_element_namespaceObject.useEffect)(() => { 52645 initialToolbarItemIndexRef.current = void 0; 52646 }, [clientId]); 52647 const { stopTyping } = (0,external_wp_data_namespaceObject.useDispatch)(store); 52648 const isToolbarForcedRef = (0,external_wp_element_namespaceObject.useRef)(false); 52649 (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)("core/block-editor/focus-toolbar", () => { 52650 isToolbarForcedRef.current = true; 52651 stopTyping(true); 52652 }); 52653 (0,external_wp_element_namespaceObject.useEffect)(() => { 52654 isToolbarForcedRef.current = false; 52655 }); 52656 const clientIdToPositionOver = capturingClientId || clientId; 52657 const popoverProps = useBlockToolbarPopoverProps({ 52658 contentElement: __unstableContentRef?.current, 52659 clientId: clientIdToPositionOver 52660 }); 52661 return !isTyping && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 52662 PrivateBlockPopover, 52663 { 52664 clientId: clientIdToPositionOver, 52665 bottomClientId: lastClientId, 52666 className: dist_clsx("block-editor-block-list__block-popover", { 52667 "is-insertion-point-visible": isInsertionPointVisible 52668 }), 52669 resize: false, 52670 ...popoverProps, 52671 __unstableContentRef, 52672 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 52673 PrivateBlockToolbar, 52674 { 52675 focusOnMount: isToolbarForcedRef.current, 52676 __experimentalInitialIndex: initialToolbarItemIndexRef.current, 52677 __experimentalOnIndexChange: (index) => { 52678 initialToolbarItemIndexRef.current = index; 52679 }, 52680 variant: "toolbar" 52681 } 52682 ) 52683 } 52684 ); 52685 } 52686 52687 52688 ;// ./node_modules/@wordpress/block-editor/build-module/components/block-tools/zoom-out-mode-inserter-button.js 52689 52690 52691 52692 52693 52694 function ZoomOutModeInserterButton({ onClick }) { 52695 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 52696 external_wp_components_namespaceObject.Button, 52697 { 52698 variant: "primary", 52699 icon: plus_default, 52700 size: "compact", 52701 className: dist_clsx( 52702 "block-editor-button-pattern-inserter__button", 52703 "block-editor-block-tools__zoom-out-mode-inserter-button" 52704 ), 52705 onClick, 52706 label: (0,external_wp_i18n_namespaceObject._x)( 52707 "Add pattern", 52708 "Generic label for pattern inserter button" 52709 ) 52710 } 52711 ); 52712 } 52713 var zoom_out_mode_inserter_button_default = ZoomOutModeInserterButton; 52714 52715 52716 ;// ./node_modules/@wordpress/block-editor/build-module/components/block-tools/zoom-out-mode-inserters.js 52717 52718 52719 52720 52721 52722 52723 52724 function ZoomOutModeInserters() { 52725 const [isReady, setIsReady] = (0,external_wp_element_namespaceObject.useState)(false); 52726 const { 52727 hasSelection, 52728 blockOrder, 52729 setInserterIsOpened, 52730 sectionRootClientId, 52731 selectedBlockClientId, 52732 blockInsertionPoint, 52733 insertionPointVisible 52734 } = (0,external_wp_data_namespaceObject.useSelect)((select) => { 52735 const { 52736 getSettings, 52737 getBlockOrder, 52738 getSelectionStart, 52739 getSelectedBlockClientId, 52740 getSectionRootClientId, 52741 getBlockInsertionPoint, 52742 isBlockInsertionPointVisible 52743 } = unlock(select(store)); 52744 const root = getSectionRootClientId(); 52745 return { 52746 hasSelection: !!getSelectionStart().clientId, 52747 blockOrder: getBlockOrder(root), 52748 sectionRootClientId: root, 52749 setInserterIsOpened: getSettings().__experimentalSetIsInserterOpened, 52750 selectedBlockClientId: getSelectedBlockClientId(), 52751 blockInsertionPoint: getBlockInsertionPoint(), 52752 insertionPointVisible: isBlockInsertionPointVisible() 52753 }; 52754 }, []); 52755 const { showInsertionPoint } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store)); 52756 (0,external_wp_element_namespaceObject.useEffect)(() => { 52757 const timeout = setTimeout(() => { 52758 setIsReady(true); 52759 }, 500); 52760 return () => { 52761 clearTimeout(timeout); 52762 }; 52763 }, []); 52764 if (!isReady || !hasSelection) { 52765 return null; 52766 } 52767 const previousClientId = selectedBlockClientId; 52768 const index = blockOrder.findIndex( 52769 (clientId) => selectedBlockClientId === clientId 52770 ); 52771 const insertionIndex = index + 1; 52772 const nextClientId = blockOrder[insertionIndex]; 52773 if (insertionPointVisible && blockInsertionPoint?.index === insertionIndex) { 52774 return null; 52775 } 52776 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 52777 inbetween_default, 52778 { 52779 previousClientId, 52780 nextClientId, 52781 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 52782 zoom_out_mode_inserter_button_default, 52783 { 52784 onClick: () => { 52785 setInserterIsOpened({ 52786 rootClientId: sectionRootClientId, 52787 insertionIndex, 52788 tab: "patterns", 52789 category: "all" 52790 }); 52791 showInsertionPoint(sectionRootClientId, insertionIndex, { 52792 operation: "insert" 52793 }); 52794 } 52795 } 52796 ) 52797 } 52798 ); 52799 } 52800 var zoom_out_mode_inserters_default = ZoomOutModeInserters; 52801 52802 52803 ;// ./node_modules/@wordpress/block-editor/build-module/components/block-tools/use-show-block-tools.js 52804 52805 52806 52807 52808 function useShowBlockTools() { 52809 return (0,external_wp_data_namespaceObject.useSelect)((select) => { 52810 const { 52811 getSelectedBlockClientId, 52812 getFirstMultiSelectedBlockClientId, 52813 getBlock, 52814 getBlockMode, 52815 getSettings, 52816 isTyping, 52817 isBlockInterfaceHidden 52818 } = unlock(select(store)); 52819 const clientId = getSelectedBlockClientId() || getFirstMultiSelectedBlockClientId(); 52820 const block = getBlock(clientId); 52821 const hasSelectedBlock = !!clientId && !!block; 52822 const isEmptyDefaultBlock = hasSelectedBlock && (0,external_wp_blocks_namespaceObject.isUnmodifiedDefaultBlock)(block, "content") && getBlockMode(clientId) !== "html"; 52823 const _showEmptyBlockSideInserter = clientId && !isTyping() && isEmptyDefaultBlock; 52824 const _showBlockToolbarPopover = !isBlockInterfaceHidden() && !getSettings().hasFixedToolbar && !_showEmptyBlockSideInserter && hasSelectedBlock && !isEmptyDefaultBlock; 52825 return { 52826 showEmptyBlockSideInserter: _showEmptyBlockSideInserter, 52827 showBlockToolbarPopover: _showBlockToolbarPopover 52828 }; 52829 }, []); 52830 } 52831 52832 52833 ;// ./node_modules/@wordpress/block-editor/build-module/components/block-tools/index.js 52834 52835 52836 52837 52838 52839 52840 52841 52842 52843 52844 52845 52846 52847 52848 52849 52850 52851 52852 52853 function block_tools_selector(select) { 52854 const { 52855 getSelectedBlockClientId, 52856 getFirstMultiSelectedBlockClientId, 52857 getSettings, 52858 isTyping, 52859 isDragging, 52860 isZoomOut 52861 } = unlock(select(store)); 52862 const clientId = getSelectedBlockClientId() || getFirstMultiSelectedBlockClientId(); 52863 return { 52864 clientId, 52865 hasFixedToolbar: getSettings().hasFixedToolbar, 52866 isTyping: isTyping(), 52867 isZoomOutMode: isZoomOut(), 52868 isDragging: isDragging() 52869 }; 52870 } 52871 function BlockTools({ 52872 children, 52873 __unstableContentRef, 52874 ...props 52875 }) { 52876 const { clientId, hasFixedToolbar, isTyping, isZoomOutMode, isDragging } = (0,external_wp_data_namespaceObject.useSelect)(block_tools_selector, []); 52877 const isMatch = (0,external_wp_keyboardShortcuts_namespaceObject.__unstableUseShortcutEventMatch)(); 52878 const { 52879 getBlocksByClientId, 52880 getSelectedBlockClientIds, 52881 getBlockRootClientId, 52882 isGroupable, 52883 getBlockName 52884 } = (0,external_wp_data_namespaceObject.useSelect)(store); 52885 const { getGroupingBlockName } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blocks_namespaceObject.store); 52886 const { showEmptyBlockSideInserter, showBlockToolbarPopover } = useShowBlockTools(); 52887 const pasteStyles = usePasteStyles(); 52888 const { 52889 duplicateBlocks, 52890 removeBlocks, 52891 replaceBlocks, 52892 insertAfterBlock, 52893 insertBeforeBlock, 52894 selectBlock, 52895 moveBlocksUp, 52896 moveBlocksDown, 52897 expandBlock, 52898 updateBlockAttributes 52899 } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store)); 52900 function onKeyDown(event) { 52901 if (event.defaultPrevented) { 52902 return; 52903 } 52904 if (isMatch("core/block-editor/move-up", event) || isMatch("core/block-editor/move-down", event)) { 52905 const clientIds = getSelectedBlockClientIds(); 52906 if (clientIds.length) { 52907 event.preventDefault(); 52908 const rootClientId = getBlockRootClientId(clientIds[0]); 52909 const direction = isMatch("core/block-editor/move-up", event) ? "up" : "down"; 52910 if (direction === "up") { 52911 moveBlocksUp(clientIds, rootClientId); 52912 } else { 52913 moveBlocksDown(clientIds, rootClientId); 52914 } 52915 const blockLength = Array.isArray(clientIds) ? clientIds.length : 1; 52916 const message = (0,external_wp_i18n_namespaceObject.sprintf)( 52917 // translators: %d: the name of the block that has been moved 52918 (0,external_wp_i18n_namespaceObject._n)( 52919 "%d block moved.", 52920 "%d blocks moved.", 52921 clientIds.length 52922 ), 52923 blockLength 52924 ); 52925 (0,external_wp_a11y_namespaceObject.speak)(message); 52926 } 52927 } else if (isMatch("core/block-editor/duplicate", event)) { 52928 const clientIds = getSelectedBlockClientIds(); 52929 if (clientIds.length) { 52930 event.preventDefault(); 52931 duplicateBlocks(clientIds); 52932 } 52933 } else if (isMatch("core/block-editor/remove", event)) { 52934 const clientIds = getSelectedBlockClientIds(); 52935 if (clientIds.length) { 52936 event.preventDefault(); 52937 removeBlocks(clientIds); 52938 } 52939 } else if (isMatch("core/block-editor/paste-styles", event)) { 52940 const clientIds = getSelectedBlockClientIds(); 52941 if (clientIds.length) { 52942 event.preventDefault(); 52943 const blocks = getBlocksByClientId(clientIds); 52944 pasteStyles(blocks); 52945 } 52946 } else if (isMatch("core/block-editor/insert-after", event)) { 52947 const clientIds = getSelectedBlockClientIds(); 52948 if (clientIds.length) { 52949 event.preventDefault(); 52950 insertAfterBlock(clientIds[clientIds.length - 1]); 52951 } 52952 } else if (isMatch("core/block-editor/insert-before", event)) { 52953 const clientIds = getSelectedBlockClientIds(); 52954 if (clientIds.length) { 52955 event.preventDefault(); 52956 insertBeforeBlock(clientIds[0]); 52957 } 52958 } else if (isMatch("core/block-editor/unselect", event)) { 52959 if (event.target.closest("[role=toolbar]")) { 52960 return; 52961 } 52962 const clientIds = getSelectedBlockClientIds(); 52963 if (clientIds.length > 1) { 52964 event.preventDefault(); 52965 selectBlock(clientIds[0]); 52966 } 52967 } else if (isMatch("core/block-editor/collapse-list-view", event)) { 52968 if ((0,external_wp_dom_namespaceObject.isTextField)(event.target) || (0,external_wp_dom_namespaceObject.isTextField)( 52969 event.target?.contentWindow?.document?.activeElement 52970 )) { 52971 return; 52972 } 52973 event.preventDefault(); 52974 expandBlock(clientId); 52975 } else if (isMatch("core/block-editor/group", event)) { 52976 const clientIds = getSelectedBlockClientIds(); 52977 if (clientIds.length > 1 && isGroupable(clientIds)) { 52978 event.preventDefault(); 52979 const blocks = getBlocksByClientId(clientIds); 52980 const groupingBlockName = getGroupingBlockName(); 52981 const newBlocks = (0,external_wp_blocks_namespaceObject.switchToBlockType)( 52982 blocks, 52983 groupingBlockName 52984 ); 52985 replaceBlocks(clientIds, newBlocks); 52986 (0,external_wp_a11y_namespaceObject.speak)((0,external_wp_i18n_namespaceObject.__)("Selected blocks are grouped.")); 52987 } 52988 } else if (isMatch("core/block-editor/toggle-block-visibility", event)) { 52989 const clientIds = getSelectedBlockClientIds(); 52990 if (clientIds.length) { 52991 event.preventDefault(); 52992 const blocks = getBlocksByClientId(clientIds); 52993 const canToggleBlockVisibility = blocks.every( 52994 (block) => (0,external_wp_blocks_namespaceObject.hasBlockSupport)( 52995 getBlockName(block.clientId), 52996 "blockVisibility", 52997 true 52998 ) 52999 ); 53000 if (!canToggleBlockVisibility) { 53001 return; 53002 } 53003 const hasHiddenBlock = blocks.some( 53004 (block) => block.attributes.metadata?.blockVisibility === false 53005 ); 53006 const attributesByClientId = Object.fromEntries( 53007 blocks.map(({ clientId: mapClientId, attributes }) => [ 53008 mapClientId, 53009 { 53010 metadata: utils_cleanEmptyObject({ 53011 ...attributes?.metadata, 53012 blockVisibility: hasHiddenBlock ? void 0 : false 53013 }) 53014 } 53015 ]) 53016 ); 53017 updateBlockAttributes(clientIds, attributesByClientId, { 53018 uniqueByBlock: true 53019 }); 53020 } 53021 } 53022 } 53023 const blockToolbarRef = use_popover_scroll_default(__unstableContentRef); 53024 const blockToolbarAfterRef = use_popover_scroll_default(__unstableContentRef); 53025 return ( 53026 // eslint-disable-next-line jsx-a11y/no-static-element-interactions 53027 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { ...props, onKeyDown, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(InsertionPointOpenRef.Provider, { value: (0,external_wp_element_namespaceObject.useRef)(false), children: [ 53028 !isTyping && !isZoomOutMode && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 53029 InsertionPoint, 53030 { 53031 __unstableContentRef 53032 } 53033 ), 53034 showEmptyBlockSideInserter && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 53035 EmptyBlockInserter, 53036 { 53037 __unstableContentRef, 53038 clientId 53039 } 53040 ), 53041 showBlockToolbarPopover && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 53042 BlockToolbarPopover, 53043 { 53044 __unstableContentRef, 53045 clientId, 53046 isTyping 53047 } 53048 ), 53049 !isZoomOutMode && !hasFixedToolbar && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 53050 external_wp_components_namespaceObject.Popover.Slot, 53051 { 53052 name: "block-toolbar", 53053 ref: blockToolbarRef 53054 } 53055 ), 53056 children, 53057 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 53058 external_wp_components_namespaceObject.Popover.Slot, 53059 { 53060 name: "__unstable-block-tools-after", 53061 ref: blockToolbarAfterRef 53062 } 53063 ), 53064 isZoomOutMode && !isDragging && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 53065 zoom_out_mode_inserters_default, 53066 { 53067 __unstableContentRef 53068 } 53069 ) 53070 ] }) }) 53071 ); 53072 } 53073 53074 53075 ;// external ["wp","commands"] 53076 const external_wp_commands_namespaceObject = window["wp"]["commands"]; 53077 ;// ./node_modules/@wordpress/icons/build-module/library/ungroup.js 53078 53079 53080 var ungroup_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M18 4h-7c-1.1 0-2 .9-2 2v7c0 1.1.9 2 2 2h7c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm.5 9c0 .3-.2.5-.5.5h-7c-.3 0-.5-.2-.5-.5V6c0-.3.2-.5.5-.5h7c.3 0 .5.2.5.5v7zm-5 5c0 .3-.2.5-.5.5H6c-.3 0-.5-.2-.5-.5v-7c0-.3.2-.5.5-.5h1V9H6c-1.1 0-2 .9-2 2v7c0 1.1.9 2 2 2h7c1.1 0 2-.9 2-2v-1h-1.5v1z" }) }); 53081 53082 53083 ;// ./node_modules/@wordpress/icons/build-module/library/trash.js 53084 53085 53086 var trash_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 53087 external_wp_primitives_namespaceObject.Path, 53088 { 53089 fillRule: "evenodd", 53090 clipRule: "evenodd", 53091 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" 53092 } 53093 ) }); 53094 53095 53096 ;// ./node_modules/@wordpress/block-editor/build-module/components/use-block-commands/index.js 53097 53098 53099 53100 53101 53102 53103 53104 53105 53106 const getTransformCommands = () => function useTransformCommands() { 53107 const { replaceBlocks, multiSelect } = (0,external_wp_data_namespaceObject.useDispatch)(store); 53108 const { 53109 blocks, 53110 clientIds, 53111 canRemove, 53112 possibleBlockTransformations, 53113 invalidSelection 53114 } = (0,external_wp_data_namespaceObject.useSelect)((select) => { 53115 const { 53116 getBlockRootClientId, 53117 getBlockTransformItems, 53118 getSelectedBlockClientIds, 53119 getBlocksByClientId, 53120 canRemoveBlocks 53121 } = select(store); 53122 const selectedBlockClientIds = getSelectedBlockClientIds(); 53123 const selectedBlocks = getBlocksByClientId( 53124 selectedBlockClientIds 53125 ); 53126 if (selectedBlocks.filter((block) => !block).length > 0) { 53127 return { 53128 invalidSelection: true 53129 }; 53130 } 53131 const rootClientId = getBlockRootClientId( 53132 selectedBlockClientIds[0] 53133 ); 53134 return { 53135 blocks: selectedBlocks, 53136 clientIds: selectedBlockClientIds, 53137 possibleBlockTransformations: getBlockTransformItems( 53138 selectedBlocks, 53139 rootClientId 53140 ), 53141 canRemove: canRemoveBlocks(selectedBlockClientIds), 53142 invalidSelection: false 53143 }; 53144 }, []); 53145 if (invalidSelection) { 53146 return { 53147 isLoading: false, 53148 commands: [] 53149 }; 53150 } 53151 const isTemplate = blocks.length === 1 && (0,external_wp_blocks_namespaceObject.isTemplatePart)(blocks[0]); 53152 function selectForMultipleBlocks(insertedBlocks) { 53153 if (insertedBlocks.length > 1) { 53154 multiSelect( 53155 insertedBlocks[0].clientId, 53156 insertedBlocks[insertedBlocks.length - 1].clientId 53157 ); 53158 } 53159 } 53160 function onBlockTransform(name) { 53161 const newBlocks = (0,external_wp_blocks_namespaceObject.switchToBlockType)(blocks, name); 53162 replaceBlocks(clientIds, newBlocks); 53163 selectForMultipleBlocks(newBlocks); 53164 } 53165 const hasPossibleBlockTransformations = !!possibleBlockTransformations.length && canRemove && !isTemplate; 53166 if (!clientIds || clientIds.length < 1 || !hasPossibleBlockTransformations) { 53167 return { isLoading: false, commands: [] }; 53168 } 53169 const commands = possibleBlockTransformations.map( 53170 (transformation) => { 53171 const { name, title, icon } = transformation; 53172 return { 53173 name: "core/block-editor/transform-to-" + name.replace("/", "-"), 53174 /* translators: %s: Block or block variation name. */ 53175 label: (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)("Transform to %s"), title), 53176 icon: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(block_icon_default, { icon }), 53177 callback: ({ close }) => { 53178 onBlockTransform(name); 53179 close(); 53180 } 53181 }; 53182 } 53183 ); 53184 return { isLoading: false, commands }; 53185 }; 53186 const getQuickActionsCommands = () => function useQuickActionsCommands() { 53187 const { clientIds, isUngroupable, isGroupable } = (0,external_wp_data_namespaceObject.useSelect)( 53188 (select) => { 53189 const { 53190 getSelectedBlockClientIds, 53191 isUngroupable: _isUngroupable, 53192 isGroupable: _isGroupable 53193 } = select(store); 53194 const selectedBlockClientIds = getSelectedBlockClientIds(); 53195 return { 53196 clientIds: selectedBlockClientIds, 53197 isUngroupable: _isUngroupable(), 53198 isGroupable: _isGroupable() 53199 }; 53200 }, 53201 [] 53202 ); 53203 const { 53204 canInsertBlockType, 53205 getBlockRootClientId, 53206 getBlocksByClientId, 53207 canRemoveBlocks, 53208 getBlockName 53209 } = (0,external_wp_data_namespaceObject.useSelect)(store); 53210 const { getDefaultBlockName, getGroupingBlockName } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blocks_namespaceObject.store); 53211 const blocks = getBlocksByClientId(clientIds); 53212 const { 53213 removeBlocks, 53214 replaceBlocks, 53215 duplicateBlocks, 53216 insertAfterBlock, 53217 insertBeforeBlock, 53218 updateBlockAttributes 53219 } = (0,external_wp_data_namespaceObject.useDispatch)(store); 53220 const onGroup = () => { 53221 if (!blocks.length) { 53222 return; 53223 } 53224 const groupingBlockName = getGroupingBlockName(); 53225 const newBlocks = (0,external_wp_blocks_namespaceObject.switchToBlockType)(blocks, groupingBlockName); 53226 if (!newBlocks) { 53227 return; 53228 } 53229 replaceBlocks(clientIds, newBlocks); 53230 }; 53231 const onUngroup = () => { 53232 if (!blocks.length) { 53233 return; 53234 } 53235 const innerBlocks = blocks[0].innerBlocks; 53236 if (!innerBlocks.length) { 53237 return; 53238 } 53239 replaceBlocks(clientIds, innerBlocks); 53240 }; 53241 if (!clientIds || clientIds.length < 1) { 53242 return { isLoading: false, commands: [] }; 53243 } 53244 const rootClientId = getBlockRootClientId(clientIds[0]); 53245 const canInsertDefaultBlock = canInsertBlockType( 53246 getDefaultBlockName(), 53247 rootClientId 53248 ); 53249 const canDuplicate = blocks.every((block) => { 53250 return !!block && (0,external_wp_blocks_namespaceObject.hasBlockSupport)(block.name, "multiple", true) && canInsertBlockType(block.name, rootClientId); 53251 }); 53252 const canRemove = canRemoveBlocks(clientIds); 53253 const canToggleBlockVisibility = blocks.every( 53254 ({ clientId }) => (0,external_wp_blocks_namespaceObject.hasBlockSupport)(getBlockName(clientId), "blockVisibility", true) 53255 ); 53256 const commands = []; 53257 if (canDuplicate) { 53258 commands.push({ 53259 name: "duplicate", 53260 label: (0,external_wp_i18n_namespaceObject.__)("Duplicate"), 53261 callback: () => duplicateBlocks(clientIds, true), 53262 icon: copy_default 53263 }); 53264 } 53265 if (canInsertDefaultBlock) { 53266 commands.push( 53267 { 53268 name: "add-before", 53269 label: (0,external_wp_i18n_namespaceObject.__)("Add before"), 53270 callback: () => { 53271 const clientId = Array.isArray(clientIds) ? clientIds[0] : clientId; 53272 insertBeforeBlock(clientId); 53273 }, 53274 icon: plus_default 53275 }, 53276 { 53277 name: "add-after", 53278 label: (0,external_wp_i18n_namespaceObject.__)("Add after"), 53279 callback: () => { 53280 const clientId = Array.isArray(clientIds) ? clientIds[clientIds.length - 1] : clientId; 53281 insertAfterBlock(clientId); 53282 }, 53283 icon: plus_default 53284 } 53285 ); 53286 } 53287 if (isGroupable) { 53288 commands.push({ 53289 name: "Group", 53290 label: (0,external_wp_i18n_namespaceObject.__)("Group"), 53291 callback: onGroup, 53292 icon: group_group_default 53293 }); 53294 } 53295 if (isUngroupable) { 53296 commands.push({ 53297 name: "ungroup", 53298 label: (0,external_wp_i18n_namespaceObject.__)("Ungroup"), 53299 callback: onUngroup, 53300 icon: ungroup_default 53301 }); 53302 } 53303 if (canRemove) { 53304 commands.push({ 53305 name: "remove", 53306 label: (0,external_wp_i18n_namespaceObject.__)("Delete"), 53307 callback: () => removeBlocks(clientIds, true), 53308 icon: trash_default 53309 }); 53310 } 53311 if (canToggleBlockVisibility) { 53312 const hasHiddenBlock = blocks.some( 53313 (block) => block.attributes.metadata?.blockVisibility === false 53314 ); 53315 commands.push({ 53316 name: "core/toggle-block-visibility", 53317 label: hasHiddenBlock ? (0,external_wp_i18n_namespaceObject.__)("Show") : (0,external_wp_i18n_namespaceObject.__)("Hide"), 53318 callback: () => { 53319 const attributesByClientId = Object.fromEntries( 53320 blocks?.map(({ clientId, attributes }) => [ 53321 clientId, 53322 { 53323 metadata: utils_cleanEmptyObject({ 53324 ...attributes?.metadata, 53325 blockVisibility: hasHiddenBlock ? void 0 : false 53326 }) 53327 } 53328 ]) 53329 ); 53330 updateBlockAttributes(clientIds, attributesByClientId, { 53331 uniqueByBlock: true 53332 }); 53333 }, 53334 icon: hasHiddenBlock ? seen_default : unseen_default 53335 }); 53336 } 53337 return { 53338 isLoading: false, 53339 commands: commands.map((command) => ({ 53340 ...command, 53341 name: "core/block-editor/action-" + command.name, 53342 callback: ({ close }) => { 53343 command.callback(); 53344 close(); 53345 } 53346 })) 53347 }; 53348 }; 53349 const useBlockCommands = () => { 53350 (0,external_wp_commands_namespaceObject.useCommandLoader)({ 53351 name: "core/block-editor/blockTransforms", 53352 hook: getTransformCommands() 53353 }); 53354 (0,external_wp_commands_namespaceObject.useCommandLoader)({ 53355 name: "core/block-editor/blockQuickActions", 53356 hook: getQuickActionsCommands(), 53357 context: "block-selection-edit" 53358 }); 53359 }; 53360 53361 53362 ;// ./node_modules/@wordpress/block-editor/build-module/components/block-canvas/index.js 53363 53364 53365 53366 53367 53368 53369 53370 53371 53372 53373 53374 53375 53376 53377 const EDITOR_STYLE_TRANSFORM_OPTIONS = { 53378 // Don't transform selectors that already specify `.editor-styles-wrapper`. 53379 ignoredSelectors: [/\.editor-styles-wrapper/gi] 53380 }; 53381 function ExperimentalBlockCanvas({ 53382 shouldIframe = true, 53383 height = "300px", 53384 children = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockList, {}), 53385 styles, 53386 contentRef: contentRefProp, 53387 iframeProps 53388 }) { 53389 useBlockCommands(); 53390 const isTabletViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)("medium", "<"); 53391 const resetTypingRef = useMouseMoveTypingReset(); 53392 const clearerRef = useBlockSelectionClearer(); 53393 const localRef = (0,external_wp_element_namespaceObject.useRef)(); 53394 const contentRef = (0,external_wp_compose_namespaceObject.useMergeRefs)([contentRefProp, clearerRef, localRef]); 53395 const zoomLevel = (0,external_wp_data_namespaceObject.useSelect)( 53396 (select) => unlock(select(store)).getZoomLevel(), 53397 [] 53398 ); 53399 const zoomOutIframeProps = zoomLevel !== 100 && !isTabletViewport ? { 53400 scale: zoomLevel, 53401 frameSize: "40px" 53402 } : {}; 53403 if (!shouldIframe) { 53404 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 53405 BlockTools, 53406 { 53407 __unstableContentRef: localRef, 53408 style: { height, display: "flex" }, 53409 children: [ 53410 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 53411 editor_styles_default, 53412 { 53413 styles, 53414 scope: ":where(.editor-styles-wrapper)", 53415 transformOptions: EDITOR_STYLE_TRANSFORM_OPTIONS 53416 } 53417 ), 53418 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 53419 writing_flow_default, 53420 { 53421 ref: contentRef, 53422 className: "editor-styles-wrapper", 53423 tabIndex: -1, 53424 style: { 53425 height: "100%", 53426 width: "100%" 53427 }, 53428 children 53429 } 53430 ) 53431 ] 53432 } 53433 ); 53434 } 53435 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 53436 BlockTools, 53437 { 53438 __unstableContentRef: localRef, 53439 style: { height, display: "flex" }, 53440 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 53441 iframe_default, 53442 { 53443 ...iframeProps, 53444 ...zoomOutIframeProps, 53445 ref: resetTypingRef, 53446 contentRef, 53447 style: { 53448 ...iframeProps?.style 53449 }, 53450 name: "editor-canvas", 53451 children: [ 53452 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(editor_styles_default, { styles }), 53453 children 53454 ] 53455 } 53456 ) 53457 } 53458 ); 53459 } 53460 function BlockCanvas({ children, height, styles }) { 53461 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ExperimentalBlockCanvas, { height, styles, children }); 53462 } 53463 var block_canvas_default = BlockCanvas; 53464 53465 53466 ;// ./node_modules/@wordpress/block-editor/build-module/components/color-style-selector/index.js 53467 53468 53469 53470 53471 53472 const ColorSelectorSVGIcon = () => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 20 20", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Path, { d: "M7.434 5l3.18 9.16H8.538l-.692-2.184H4.628l-.705 2.184H2L5.18 5h2.254zm-1.13 1.904h-.115l-1.148 3.593H7.44L6.304 6.904zM14.348 7.006c1.853 0 2.9.876 2.9 2.374v4.78h-1.79v-.914h-.114c-.362.64-1.123 1.022-2.031 1.022-1.346 0-2.292-.826-2.292-2.108 0-1.27.972-2.006 2.71-2.107l1.696-.102V9.38c0-.584-.42-.914-1.18-.914-.667 0-1.112.228-1.264.647h-1.701c.12-1.295 1.307-2.107 3.066-2.107zm1.079 4.1l-1.416.09c-.793.056-1.18.342-1.18.844 0 .52.45.837 1.091.837.857 0 1.505-.545 1.505-1.256v-.515z" }) }); 53473 const ColorSelectorIcon = ({ style, className }) => { 53474 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-library-colors-selector__icon-container", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 53475 "div", 53476 { 53477 className: `$className} block-library-colors-selector__state-selection`, 53478 style, 53479 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ColorSelectorSVGIcon, {}) 53480 } 53481 ) }); 53482 }; 53483 const renderToggleComponent = ({ TextColor, BackgroundColor }) => ({ onToggle, isOpen }) => { 53484 const openOnArrowDown = (event) => { 53485 if (!isOpen && event.keyCode === external_wp_keycodes_namespaceObject.DOWN) { 53486 event.preventDefault(); 53487 onToggle(); 53488 } 53489 }; 53490 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarGroup, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 53491 external_wp_components_namespaceObject.ToolbarButton, 53492 { 53493 className: "components-toolbar__control block-library-colors-selector__toggle", 53494 label: (0,external_wp_i18n_namespaceObject.__)("Open Colors Selector"), 53495 onClick: onToggle, 53496 onKeyDown: openOnArrowDown, 53497 icon: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(BackgroundColor, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(TextColor, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ColorSelectorIcon, {}) }) }) 53498 } 53499 ) }); 53500 }; 53501 const BlockColorsStyleSelector = ({ children, ...other }) => { 53502 external_wp_deprecated_default()(`wp.blockEditor.BlockColorsStyleSelector`, { 53503 alternative: "block supports API", 53504 since: "6.1", 53505 version: "6.3" 53506 }); 53507 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 53508 external_wp_components_namespaceObject.Dropdown, 53509 { 53510 popoverProps: { placement: "bottom-start" }, 53511 className: "block-library-colors-selector", 53512 contentClassName: "block-library-colors-selector__popover", 53513 renderToggle: renderToggleComponent(other), 53514 renderContent: () => children 53515 } 53516 ); 53517 }; 53518 var color_style_selector_default = BlockColorsStyleSelector; 53519 53520 53521 ;// ./node_modules/@wordpress/icons/build-module/library/list-view.js 53522 53523 53524 var list_view_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M3 6h11v1.5H3V6Zm3.5 5.5h11V13h-11v-1.5ZM21 17H10v1.5h11V17Z" }) }); 53525 53526 53527 ;// ./node_modules/@wordpress/block-editor/build-module/components/list-view/context.js 53528 53529 const ListViewContext = (0,external_wp_element_namespaceObject.createContext)({}); 53530 ListViewContext.displayName = "ListViewContext"; 53531 const useListViewContext = () => (0,external_wp_element_namespaceObject.useContext)(ListViewContext); 53532 53533 53534 ;// ./node_modules/@wordpress/block-editor/build-module/components/list-view/aria-referenced-text.js 53535 53536 53537 function AriaReferencedText({ children, ...props }) { 53538 const ref = (0,external_wp_element_namespaceObject.useRef)(); 53539 (0,external_wp_element_namespaceObject.useEffect)(() => { 53540 if (ref.current) { 53541 ref.current.textContent = ref.current.textContent; 53542 } 53543 }, [children]); 53544 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { hidden: true, ...props, ref, children }); 53545 } 53546 53547 53548 ;// ./node_modules/@wordpress/block-editor/build-module/components/list-view/appender.js 53549 53550 53551 53552 53553 53554 53555 53556 53557 53558 53559 53560 53561 const Appender = (0,external_wp_element_namespaceObject.forwardRef)( 53562 ({ nestingLevel, blockCount, clientId, ...props }, ref) => { 53563 const { insertedBlock, setInsertedBlock } = useListViewContext(); 53564 const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(Appender); 53565 const { directInsert, hideInserter } = (0,external_wp_data_namespaceObject.useSelect)( 53566 (select) => { 53567 const { getBlockListSettings, getTemplateLock, isZoomOut } = unlock(select(store)); 53568 const settings = getBlockListSettings(clientId); 53569 const directInsertValue = settings?.directInsert || false; 53570 const hideInserterValue = !!getTemplateLock(clientId) || isZoomOut(); 53571 return { 53572 directInsert: directInsertValue, 53573 hideInserter: hideInserterValue 53574 }; 53575 }, 53576 [clientId] 53577 ); 53578 const blockTitle = useBlockDisplayTitle({ 53579 clientId, 53580 context: "list-view" 53581 }); 53582 const insertedBlockTitle = useBlockDisplayTitle({ 53583 clientId: insertedBlock?.clientId, 53584 context: "list-view" 53585 }); 53586 (0,external_wp_element_namespaceObject.useEffect)(() => { 53587 if (!insertedBlockTitle?.length) { 53588 return; 53589 } 53590 (0,external_wp_a11y_namespaceObject.speak)( 53591 (0,external_wp_i18n_namespaceObject.sprintf)( 53592 // translators: %s: name of block being inserted (i.e. Paragraph, Image, Group etc) 53593 (0,external_wp_i18n_namespaceObject.__)("%s block inserted"), 53594 insertedBlockTitle 53595 ), 53596 "assertive" 53597 ); 53598 }, [insertedBlockTitle]); 53599 if (hideInserter) { 53600 return null; 53601 } 53602 const descriptionId = `list-view-appender__$instanceId}`; 53603 const description = (0,external_wp_i18n_namespaceObject.sprintf)( 53604 /* translators: 1: The name of the block. 2: The numerical position of the block. 3: The level of nesting for the block. */ 53605 (0,external_wp_i18n_namespaceObject.__)("Append to %1$s block at position %2$d, Level %3$d"), 53606 blockTitle, 53607 blockCount + 1, 53608 nestingLevel 53609 ); 53610 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "list-view-appender", children: [ 53611 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 53612 inserter_default, 53613 { 53614 ref, 53615 rootClientId: clientId, 53616 position: "bottom right", 53617 isAppender: true, 53618 selectBlockOnInsert: false, 53619 shouldDirectInsert: directInsert, 53620 __experimentalIsQuick: true, 53621 ...props, 53622 toggleProps: { "aria-describedby": descriptionId }, 53623 onSelectOrClose: (maybeInsertedBlock) => { 53624 if (maybeInsertedBlock?.clientId) { 53625 setInsertedBlock(maybeInsertedBlock); 53626 } 53627 } 53628 } 53629 ), 53630 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(AriaReferencedText, { id: descriptionId, children: description }) 53631 ] }); 53632 } 53633 ); 53634 53635 53636 ;// ./node_modules/@wordpress/block-editor/build-module/components/list-view/leaf.js 53637 53638 53639 53640 53641 53642 53643 53644 const AnimatedTreeGridRow = dist_esm_it(external_wp_components_namespaceObject.__experimentalTreeGridRow); 53645 const ListViewLeaf = (0,external_wp_element_namespaceObject.forwardRef)( 53646 ({ 53647 isDragged, 53648 isSelected, 53649 position, 53650 level, 53651 rowCount, 53652 children, 53653 className, 53654 path, 53655 ...props 53656 }, ref) => { 53657 const animationRef = use_moving_animation_default({ 53658 clientId: props["data-block"], 53659 enableAnimation: true, 53660 triggerAnimationOnChange: path 53661 }); 53662 const mergedRef = (0,external_wp_compose_namespaceObject.useMergeRefs)([ref, animationRef]); 53663 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 53664 AnimatedTreeGridRow, 53665 { 53666 ref: mergedRef, 53667 className: dist_clsx("block-editor-list-view-leaf", className), 53668 level, 53669 positionInSet: position, 53670 setSize: rowCount, 53671 isExpanded: void 0, 53672 ...props, 53673 children 53674 } 53675 ); 53676 } 53677 ); 53678 var leaf_default = ListViewLeaf; 53679 53680 53681 ;// ./node_modules/@wordpress/block-editor/build-module/components/list-view/use-list-view-scroll-into-view.js 53682 53683 53684 function useListViewScrollIntoView({ 53685 isSelected, 53686 selectedClientIds, 53687 rowItemRef 53688 }) { 53689 const isSingleSelection = selectedClientIds.length === 1; 53690 (0,external_wp_element_namespaceObject.useLayoutEffect)(() => { 53691 if (!isSelected || !isSingleSelection || !rowItemRef.current) { 53692 return; 53693 } 53694 const scrollContainer = (0,external_wp_dom_namespaceObject.getScrollContainer)(rowItemRef.current); 53695 const { ownerDocument } = rowItemRef.current; 53696 const windowScroll = scrollContainer === ownerDocument.body || scrollContainer === ownerDocument.documentElement; 53697 if (windowScroll || !scrollContainer) { 53698 return; 53699 } 53700 const rowRect = rowItemRef.current.getBoundingClientRect(); 53701 const scrollContainerRect = scrollContainer.getBoundingClientRect(); 53702 if (rowRect.top < scrollContainerRect.top || rowRect.bottom > scrollContainerRect.bottom) { 53703 rowItemRef.current.scrollIntoView(); 53704 } 53705 }, [isSelected, isSingleSelection, rowItemRef]); 53706 } 53707 53708 53709 ;// ./node_modules/@wordpress/icons/build-module/library/pin-small.js 53710 53711 53712 var pin_small_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M10.97 10.159a3.382 3.382 0 0 0-2.857.955l1.724 1.723-2.836 2.913L7 17h1.25l2.913-2.837 1.723 1.723a3.38 3.38 0 0 0 .606-.825c.33-.63.446-1.343.35-2.032L17 10.695 13.305 7l-2.334 3.159Z" }) }); 53713 53714 53715 ;// ./node_modules/@wordpress/icons/build-module/library/lock-small.js 53716 53717 53718 var lock_small_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 53719 external_wp_primitives_namespaceObject.Path, 53720 { 53721 fillRule: "evenodd", 53722 clipRule: "evenodd", 53723 d: "M15 11h-.2V9c0-1.5-1.2-2.8-2.8-2.8S9.2 7.5 9.2 9v2H9c-.6 0-1 .4-1 1v4c0 .6.4 1 1 1h6c.6 0 1-.4 1-1v-4c0-.6-.4-1-1-1zm-1.8 0h-2.5V9c0-.7.6-1.2 1.2-1.2s1.2.6 1.2 1.2v2z" 53724 } 53725 ) }); 53726 53727 53728 ;// ./node_modules/@wordpress/block-editor/build-module/components/list-view/expander.js 53729 53730 53731 53732 function ListViewExpander({ onClick }) { 53733 return ( 53734 // Keyboard events are handled by TreeGrid see: components/src/tree-grid/index.js 53735 // 53736 // The expander component is implemented as a pseudo element in the w3 example 53737 // https://www.w3.org/TR/wai-aria-practices/examples/treegrid/treegrid-1.html 53738 // 53739 // We've mimicked this by adding an icon with aria-hidden set to true to hide this from the accessibility tree. 53740 // For the current tree grid implementation, please do not try to make this a button. 53741 // 53742 // eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions 53743 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 53744 "span", 53745 { 53746 className: "block-editor-list-view__expander", 53747 onClick: (event) => onClick(event, { forceToggle: true }), 53748 "aria-hidden": "true", 53749 "data-testid": "list-view-expander", 53750 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(icon_default, { icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left_small_default : chevron_right_small_default }) 53751 } 53752 ) 53753 ); 53754 } 53755 53756 53757 ;// ./node_modules/@wordpress/block-editor/build-module/components/list-view/use-list-view-images.js 53758 53759 53760 53761 const MAX_IMAGES = 3; 53762 const IMAGE_GETTERS = { 53763 "core/image": ({ clientId, attributes }) => { 53764 if (attributes.url) { 53765 return { 53766 url: attributes.url, 53767 alt: attributes.alt || "", 53768 clientId 53769 }; 53770 } 53771 }, 53772 "core/cover": ({ clientId, attributes }) => { 53773 if (attributes.backgroundType === "image" && attributes.url) { 53774 return { 53775 url: attributes.url, 53776 alt: attributes.alt || "", 53777 clientId 53778 }; 53779 } 53780 }, 53781 "core/media-text": ({ clientId, attributes }) => { 53782 if (attributes.mediaType === "image" && attributes.mediaUrl) { 53783 return { 53784 url: attributes.mediaUrl, 53785 alt: attributes.mediaAlt || "", 53786 clientId 53787 }; 53788 } 53789 }, 53790 "core/gallery": ({ innerBlocks }) => { 53791 const images = []; 53792 const getValues = !!innerBlocks?.length ? IMAGE_GETTERS[innerBlocks[0].name] : void 0; 53793 if (!getValues) { 53794 return images; 53795 } 53796 for (const innerBlock of innerBlocks) { 53797 const img = getValues(innerBlock); 53798 if (img) { 53799 images.push(img); 53800 } 53801 if (images.length >= MAX_IMAGES) { 53802 return images; 53803 } 53804 } 53805 return images; 53806 } 53807 }; 53808 function getImagesFromBlock(block, isExpanded) { 53809 const getImages = IMAGE_GETTERS[block.name]; 53810 const images = !!getImages ? getImages(block) : void 0; 53811 if (!images) { 53812 return []; 53813 } 53814 if (!Array.isArray(images)) { 53815 return [images]; 53816 } 53817 return isExpanded ? [] : images; 53818 } 53819 function useListViewImages({ clientId, isExpanded }) { 53820 const { block } = (0,external_wp_data_namespaceObject.useSelect)( 53821 (select) => { 53822 return { block: select(store).getBlock(clientId) }; 53823 }, 53824 [clientId] 53825 ); 53826 const images = (0,external_wp_element_namespaceObject.useMemo)(() => { 53827 return getImagesFromBlock(block, isExpanded); 53828 }, [block, isExpanded]); 53829 return images; 53830 } 53831 53832 53833 ;// ./node_modules/@wordpress/block-editor/build-module/components/list-view/block-select-button.js 53834 53835 53836 53837 53838 53839 53840 53841 53842 53843 53844 53845 53846 53847 53848 53849 53850 const { Badge: block_select_button_Badge } = unlock(external_wp_components_namespaceObject.privateApis); 53851 function ListViewBlockSelectButton({ 53852 className, 53853 block: { clientId }, 53854 onClick, 53855 onContextMenu, 53856 onMouseDown, 53857 onToggleExpanded, 53858 tabIndex, 53859 onFocus, 53860 onDragStart, 53861 onDragEnd, 53862 draggable, 53863 isExpanded, 53864 ariaDescribedBy 53865 }, ref) { 53866 const blockInformation = useBlockDisplayInformation(clientId); 53867 const blockTitle = useBlockDisplayTitle({ 53868 clientId, 53869 context: "list-view" 53870 }); 53871 const { isLocked } = useBlockLock(clientId); 53872 const { canToggleBlockVisibility, isBlockHidden, isContentOnly } = (0,external_wp_data_namespaceObject.useSelect)( 53873 (select) => { 53874 const { getBlockName } = select(store); 53875 const { isBlockHidden: _isBlockHidden } = unlock( 53876 select(store) 53877 ); 53878 return { 53879 canToggleBlockVisibility: (0,external_wp_blocks_namespaceObject.hasBlockSupport)( 53880 getBlockName(clientId), 53881 "blockVisibility", 53882 true 53883 ), 53884 isBlockHidden: _isBlockHidden(clientId), 53885 isContentOnly: select(store).getBlockEditingMode( 53886 clientId 53887 ) === "contentOnly" 53888 }; 53889 }, 53890 [clientId] 53891 ); 53892 const shouldShowLockIcon = isLocked && !isContentOnly; 53893 const shouldShowBlockVisibilityIcon = canToggleBlockVisibility && isBlockHidden; 53894 const isSticky = blockInformation?.positionType === "sticky"; 53895 const images = useListViewImages({ clientId, isExpanded }); 53896 const onDragStartHandler = (event) => { 53897 event.dataTransfer.clearData(); 53898 onDragStart?.(event); 53899 }; 53900 function onKeyDown(event) { 53901 if (event.keyCode === external_wp_keycodes_namespaceObject.ENTER || event.keyCode === external_wp_keycodes_namespaceObject.SPACE) { 53902 onClick(event); 53903 } 53904 } 53905 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 53906 "a", 53907 { 53908 className: dist_clsx( 53909 "block-editor-list-view-block-select-button", 53910 className 53911 ), 53912 onClick, 53913 onContextMenu, 53914 onKeyDown, 53915 onMouseDown, 53916 ref, 53917 tabIndex, 53918 onFocus, 53919 onDragStart: onDragStartHandler, 53920 onDragEnd, 53921 draggable, 53922 href: `#block-$clientId}`, 53923 "aria-describedby": ariaDescribedBy, 53924 "aria-expanded": isExpanded, 53925 children: [ 53926 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ListViewExpander, { onClick: onToggleExpanded }), 53927 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 53928 block_icon_default, 53929 { 53930 icon: blockInformation?.icon, 53931 showColors: true, 53932 context: "list-view" 53933 } 53934 ), 53935 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 53936 external_wp_components_namespaceObject.__experimentalHStack, 53937 { 53938 alignment: "center", 53939 className: "block-editor-list-view-block-select-button__label-wrapper", 53940 justify: "flex-start", 53941 spacing: 1, 53942 children: [ 53943 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "block-editor-list-view-block-select-button__title", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalTruncate, { ellipsizeMode: "auto", children: blockTitle }) }), 53944 blockInformation?.anchor && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "block-editor-list-view-block-select-button__anchor-wrapper", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(block_select_button_Badge, { className: "block-editor-list-view-block-select-button__anchor", children: blockInformation.anchor }) }), 53945 isSticky && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "block-editor-list-view-block-select-button__sticky", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(icon_default, { icon: pin_small_default }) }), 53946 images.length ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 53947 "span", 53948 { 53949 className: "block-editor-list-view-block-select-button__images", 53950 "aria-hidden": true, 53951 children: images.map((image, index) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 53952 "span", 53953 { 53954 className: "block-editor-list-view-block-select-button__image", 53955 style: { 53956 backgroundImage: `url($image.url})`, 53957 zIndex: images.length - index 53958 // Ensure the first image is on top, and subsequent images are behind. 53959 } 53960 }, 53961 image.clientId 53962 )) 53963 } 53964 ) : null, 53965 shouldShowBlockVisibilityIcon && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "block-editor-list-view-block-select-button__block-visibility", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(icon_default, { icon: unseen_default }) }), 53966 shouldShowLockIcon && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "block-editor-list-view-block-select-button__lock", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(icon_default, { icon: lock_small_default }) }) 53967 ] 53968 } 53969 ) 53970 ] 53971 } 53972 ); 53973 } 53974 var block_select_button_default = (0,external_wp_element_namespaceObject.forwardRef)(ListViewBlockSelectButton); 53975 53976 53977 ;// ./node_modules/@wordpress/block-editor/build-module/components/list-view/block-contents.js 53978 53979 53980 53981 53982 53983 const ListViewBlockContents = (0,external_wp_element_namespaceObject.forwardRef)( 53984 ({ 53985 onClick, 53986 onToggleExpanded, 53987 block, 53988 isSelected, 53989 position, 53990 siblingBlockCount, 53991 level, 53992 isExpanded, 53993 selectedClientIds, 53994 ...props 53995 }, ref) => { 53996 const { clientId } = block; 53997 const { AdditionalBlockContent, insertedBlock, setInsertedBlock } = useListViewContext(); 53998 const draggableClientIds = selectedClientIds.includes(clientId) ? selectedClientIds : [clientId]; 53999 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 54000 AdditionalBlockContent && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 54001 AdditionalBlockContent, 54002 { 54003 block, 54004 insertedBlock, 54005 setInsertedBlock 54006 } 54007 ), 54008 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 54009 block_draggable_default, 54010 { 54011 appendToOwnerDocument: true, 54012 clientIds: draggableClientIds, 54013 cloneClassname: "block-editor-list-view-draggable-chip", 54014 children: ({ draggable, onDragStart, onDragEnd }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 54015 block_select_button_default, 54016 { 54017 ref, 54018 className: "block-editor-list-view-block-contents", 54019 block, 54020 onClick, 54021 onToggleExpanded, 54022 isSelected, 54023 position, 54024 siblingBlockCount, 54025 level, 54026 draggable, 54027 onDragStart, 54028 onDragEnd, 54029 isExpanded, 54030 ...props 54031 } 54032 ) 54033 } 54034 ) 54035 ] }); 54036 } 54037 ); 54038 var block_contents_default = ListViewBlockContents; 54039 54040 54041 ;// ./node_modules/@wordpress/block-editor/build-module/components/list-view/utils.js 54042 54043 54044 const getBlockPositionDescription = (position, siblingCount, level) => (0,external_wp_i18n_namespaceObject.sprintf)( 54045 /* translators: 1: The numerical position of the block. 2: The total number of blocks. 3. The level of nesting for the block. */ 54046 (0,external_wp_i18n_namespaceObject.__)("Block %1$d of %2$d, Level %3$d."), 54047 position, 54048 siblingCount, 54049 level 54050 ); 54051 const getBlockPropertiesDescription = (blockInformation, isLocked) => [ 54052 blockInformation?.positionLabel ? `${(0,external_wp_i18n_namespaceObject.sprintf)( 54053 // translators: %s: Position of selected block, e.g. "Sticky" or "Fixed". 54054 (0,external_wp_i18n_namespaceObject.__)("Position: %s"), 54055 blockInformation.positionLabel 54056 )}.` : void 0, 54057 isLocked ? (0,external_wp_i18n_namespaceObject.__)("This block is locked.") : void 0 54058 ].filter(Boolean).join(" "); 54059 const isClientIdSelected = (clientId, selectedBlockClientIds) => Array.isArray(selectedBlockClientIds) && selectedBlockClientIds.length ? selectedBlockClientIds.indexOf(clientId) !== -1 : selectedBlockClientIds === clientId; 54060 function getCommonDepthClientIds(startId, endId, startParents, endParents) { 54061 const startPath = [...startParents, startId]; 54062 const endPath = [...endParents, endId]; 54063 const depth = Math.min(startPath.length, endPath.length) - 1; 54064 const start = startPath[depth]; 54065 const end = endPath[depth]; 54066 return { 54067 start, 54068 end 54069 }; 54070 } 54071 function focusListItem(focusClientId, treeGridElement) { 54072 const getFocusElement = () => { 54073 const row = treeGridElement?.querySelector( 54074 `[role=row][data-block="$focusClientId}"]` 54075 ); 54076 if (!row) { 54077 return null; 54078 } 54079 return external_wp_dom_namespaceObject.focus.focusable.find(row)[0]; 54080 }; 54081 let focusElement = getFocusElement(); 54082 if (focusElement) { 54083 focusElement.focus(); 54084 } else { 54085 window.requestAnimationFrame(() => { 54086 focusElement = getFocusElement(); 54087 if (focusElement) { 54088 focusElement.focus(); 54089 } 54090 }); 54091 } 54092 } 54093 function getDragDisplacementValues({ 54094 blockIndexes, 54095 blockDropTargetIndex, 54096 blockDropPosition, 54097 clientId, 54098 firstDraggedBlockIndex, 54099 isDragged 54100 }) { 54101 let displacement; 54102 let isNesting; 54103 let isAfterDraggedBlocks; 54104 if (!isDragged) { 54105 isNesting = false; 54106 const thisBlockIndex = blockIndexes[clientId]; 54107 isAfterDraggedBlocks = thisBlockIndex > firstDraggedBlockIndex; 54108 if (blockDropTargetIndex !== void 0 && blockDropTargetIndex !== null && firstDraggedBlockIndex !== void 0) { 54109 if (thisBlockIndex !== void 0) { 54110 if (thisBlockIndex >= firstDraggedBlockIndex && thisBlockIndex < blockDropTargetIndex) { 54111 displacement = "up"; 54112 } else if (thisBlockIndex < firstDraggedBlockIndex && thisBlockIndex >= blockDropTargetIndex) { 54113 displacement = "down"; 54114 } else { 54115 displacement = "normal"; 54116 } 54117 isNesting = typeof blockDropTargetIndex === "number" && blockDropTargetIndex - 1 === thisBlockIndex && blockDropPosition === "inside"; 54118 } 54119 } else if (blockDropTargetIndex === null && firstDraggedBlockIndex !== void 0) { 54120 if (thisBlockIndex !== void 0 && thisBlockIndex >= firstDraggedBlockIndex) { 54121 displacement = "up"; 54122 } else { 54123 displacement = "normal"; 54124 } 54125 } else if (blockDropTargetIndex !== void 0 && blockDropTargetIndex !== null && firstDraggedBlockIndex === void 0) { 54126 if (thisBlockIndex !== void 0) { 54127 if (thisBlockIndex < blockDropTargetIndex) { 54128 displacement = "normal"; 54129 } else { 54130 displacement = "down"; 54131 } 54132 } 54133 } else if (blockDropTargetIndex === null) { 54134 displacement = "normal"; 54135 } 54136 } 54137 return { 54138 displacement, 54139 isNesting, 54140 isAfterDraggedBlocks 54141 }; 54142 } 54143 54144 54145 ;// ./node_modules/@wordpress/block-editor/build-module/components/list-view/block.js 54146 54147 54148 54149 54150 54151 54152 54153 54154 54155 54156 54157 54158 54159 54160 54161 54162 54163 54164 54165 54166 54167 54168 54169 54170 54171 54172 function ListViewBlock({ 54173 block: { clientId }, 54174 displacement, 54175 isAfterDraggedBlocks, 54176 isDragged, 54177 isNesting, 54178 isSelected, 54179 isBranchSelected, 54180 selectBlock, 54181 position, 54182 level, 54183 rowCount, 54184 siblingBlockCount, 54185 showBlockMovers, 54186 path, 54187 isExpanded, 54188 selectedClientIds, 54189 isSyncedBranch 54190 }) { 54191 const cellRef = (0,external_wp_element_namespaceObject.useRef)(null); 54192 const rowRef = (0,external_wp_element_namespaceObject.useRef)(null); 54193 const settingsRef = (0,external_wp_element_namespaceObject.useRef)(null); 54194 const [isHovered, setIsHovered] = (0,external_wp_element_namespaceObject.useState)(false); 54195 const [settingsAnchorRect, setSettingsAnchorRect] = (0,external_wp_element_namespaceObject.useState)(); 54196 const { isLocked, canEdit, canMove } = useBlockLock(clientId); 54197 const isFirstSelectedBlock = isSelected && selectedClientIds[0] === clientId; 54198 const isLastSelectedBlock = isSelected && selectedClientIds[selectedClientIds.length - 1] === clientId; 54199 const { 54200 toggleBlockHighlight, 54201 duplicateBlocks, 54202 multiSelect, 54203 replaceBlocks, 54204 removeBlocks, 54205 insertAfterBlock, 54206 insertBeforeBlock, 54207 setOpenedBlockSettingsMenu, 54208 updateBlockAttributes 54209 } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store)); 54210 const debouncedToggleBlockHighlight = (0,external_wp_compose_namespaceObject.useDebounce)( 54211 toggleBlockHighlight, 54212 50 54213 ); 54214 const { 54215 canInsertBlockType, 54216 getSelectedBlockClientIds, 54217 getPreviousBlockClientId, 54218 getBlockRootClientId, 54219 getBlockOrder, 54220 getBlockParents, 54221 getBlocksByClientId, 54222 canRemoveBlocks, 54223 isGroupable 54224 } = (0,external_wp_data_namespaceObject.useSelect)(store); 54225 const { getGroupingBlockName } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blocks_namespaceObject.store); 54226 const blockInformation = useBlockDisplayInformation(clientId); 54227 const pasteStyles = usePasteStyles(); 54228 const { block, blockName, allowRightClickOverrides, isBlockHidden } = (0,external_wp_data_namespaceObject.useSelect)( 54229 (select) => { 54230 const { getBlock, getBlockName, getSettings } = select(store); 54231 const { isBlockHidden: _isBlockHidden } = unlock( 54232 select(store) 54233 ); 54234 return { 54235 block: getBlock(clientId), 54236 blockName: getBlockName(clientId), 54237 allowRightClickOverrides: getSettings().allowRightClickOverrides, 54238 isBlockHidden: _isBlockHidden(clientId) 54239 }; 54240 }, 54241 [clientId] 54242 ); 54243 const showBlockActions = ( 54244 // When a block hides its toolbar it also hides the block settings menu, 54245 // since that menu is part of the toolbar in the editor canvas. 54246 // List View respects this by also hiding the block settings menu. 54247 (0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockName, "__experimentalToolbar", true) 54248 ); 54249 const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(ListViewBlock); 54250 const descriptionId = `list-view-block-select-button__description-$instanceId}`; 54251 const { 54252 expand, 54253 collapse, 54254 collapseAll, 54255 BlockSettingsMenu, 54256 listViewInstanceId, 54257 expandedState, 54258 setInsertedBlock, 54259 treeGridElementRef, 54260 rootClientId 54261 } = useListViewContext(); 54262 const isMatch = (0,external_wp_keyboardShortcuts_namespaceObject.__unstableUseShortcutEventMatch)(); 54263 function getBlocksToUpdate() { 54264 const selectedBlockClientIds = getSelectedBlockClientIds(); 54265 const isUpdatingSelectedBlocks = selectedBlockClientIds.includes(clientId); 54266 const firstBlockClientId = isUpdatingSelectedBlocks ? selectedBlockClientIds[0] : clientId; 54267 const firstBlockRootClientId = getBlockRootClientId(firstBlockClientId); 54268 const blocksToUpdate = isUpdatingSelectedBlocks ? selectedBlockClientIds : [clientId]; 54269 return { 54270 blocksToUpdate, 54271 firstBlockClientId, 54272 firstBlockRootClientId, 54273 selectedBlockClientIds 54274 }; 54275 } 54276 async function onKeyDown(event) { 54277 if (event.defaultPrevented) { 54278 return; 54279 } 54280 if (event.target.closest("[role=dialog]")) { 54281 return; 54282 } 54283 const isDeleteKey = [external_wp_keycodes_namespaceObject.BACKSPACE, external_wp_keycodes_namespaceObject.DELETE].includes(event.keyCode); 54284 if (isMatch("core/block-editor/unselect", event) && selectedClientIds.length > 0) { 54285 event.stopPropagation(); 54286 event.preventDefault(); 54287 selectBlock(event, void 0); 54288 } else if (isDeleteKey || isMatch("core/block-editor/remove", event)) { 54289 const { 54290 blocksToUpdate: blocksToDelete, 54291 firstBlockClientId, 54292 firstBlockRootClientId, 54293 selectedBlockClientIds 54294 } = getBlocksToUpdate(); 54295 if (!canRemoveBlocks(blocksToDelete)) { 54296 return; 54297 } 54298 let blockToFocus = getPreviousBlockClientId(firstBlockClientId) ?? // If the previous block is not found (when the first block is deleted), 54299 // fallback to focus the parent block. 54300 firstBlockRootClientId; 54301 removeBlocks(blocksToDelete, false); 54302 const shouldUpdateSelection = selectedBlockClientIds.length > 0 && getSelectedBlockClientIds().length === 0; 54303 if (!blockToFocus) { 54304 blockToFocus = getBlockOrder()[0]; 54305 } 54306 updateFocusAndSelection(blockToFocus, shouldUpdateSelection); 54307 } else if (isMatch("core/block-editor/paste-styles", event)) { 54308 event.preventDefault(); 54309 const { blocksToUpdate } = getBlocksToUpdate(); 54310 const blocks = getBlocksByClientId(blocksToUpdate); 54311 pasteStyles(blocks); 54312 } else if (isMatch("core/block-editor/duplicate", event)) { 54313 event.preventDefault(); 54314 const { blocksToUpdate, firstBlockRootClientId } = getBlocksToUpdate(); 54315 const canDuplicate = getBlocksByClientId(blocksToUpdate).every( 54316 (blockToUpdate) => { 54317 return !!blockToUpdate && (0,external_wp_blocks_namespaceObject.hasBlockSupport)( 54318 blockToUpdate.name, 54319 "multiple", 54320 true 54321 ) && canInsertBlockType( 54322 blockToUpdate.name, 54323 firstBlockRootClientId 54324 ); 54325 } 54326 ); 54327 if (canDuplicate) { 54328 const updatedBlocks = await duplicateBlocks( 54329 blocksToUpdate, 54330 false 54331 ); 54332 if (updatedBlocks?.length) { 54333 updateFocusAndSelection(updatedBlocks[0], false); 54334 } 54335 } 54336 } else if (isMatch("core/block-editor/insert-before", event)) { 54337 event.preventDefault(); 54338 const { blocksToUpdate } = getBlocksToUpdate(); 54339 await insertBeforeBlock(blocksToUpdate[0]); 54340 const newlySelectedBlocks = getSelectedBlockClientIds(); 54341 setOpenedBlockSettingsMenu(void 0); 54342 updateFocusAndSelection(newlySelectedBlocks[0], false); 54343 } else if (isMatch("core/block-editor/insert-after", event)) { 54344 event.preventDefault(); 54345 const { blocksToUpdate } = getBlocksToUpdate(); 54346 await insertAfterBlock(blocksToUpdate.at(-1)); 54347 const newlySelectedBlocks = getSelectedBlockClientIds(); 54348 setOpenedBlockSettingsMenu(void 0); 54349 updateFocusAndSelection(newlySelectedBlocks[0], false); 54350 } else if (isMatch("core/block-editor/select-all", event)) { 54351 event.preventDefault(); 54352 const { firstBlockRootClientId, selectedBlockClientIds } = getBlocksToUpdate(); 54353 const blockClientIds = getBlockOrder(firstBlockRootClientId); 54354 if (!blockClientIds.length) { 54355 return; 54356 } 54357 if (external_wp_isShallowEqual_default()(selectedBlockClientIds, blockClientIds)) { 54358 if (firstBlockRootClientId && firstBlockRootClientId !== rootClientId) { 54359 updateFocusAndSelection(firstBlockRootClientId, true); 54360 return; 54361 } 54362 } 54363 multiSelect( 54364 blockClientIds[0], 54365 blockClientIds[blockClientIds.length - 1], 54366 null 54367 ); 54368 } else if (isMatch("core/block-editor/collapse-list-view", event)) { 54369 event.preventDefault(); 54370 const { firstBlockClientId } = getBlocksToUpdate(); 54371 const blockParents = getBlockParents(firstBlockClientId, false); 54372 collapseAll(); 54373 expand(blockParents); 54374 } else if (isMatch("core/block-editor/group", event)) { 54375 const { blocksToUpdate } = getBlocksToUpdate(); 54376 if (blocksToUpdate.length > 1 && isGroupable(blocksToUpdate)) { 54377 event.preventDefault(); 54378 const blocks = getBlocksByClientId(blocksToUpdate); 54379 const groupingBlockName = getGroupingBlockName(); 54380 const newBlocks = (0,external_wp_blocks_namespaceObject.switchToBlockType)( 54381 blocks, 54382 groupingBlockName 54383 ); 54384 replaceBlocks(blocksToUpdate, newBlocks); 54385 (0,external_wp_a11y_namespaceObject.speak)((0,external_wp_i18n_namespaceObject.__)("Selected blocks are grouped.")); 54386 const newlySelectedBlocks = getSelectedBlockClientIds(); 54387 setOpenedBlockSettingsMenu(void 0); 54388 updateFocusAndSelection(newlySelectedBlocks[0], false); 54389 } 54390 } else if (isMatch("core/block-editor/toggle-block-visibility", event)) { 54391 event.preventDefault(); 54392 const { blocksToUpdate } = getBlocksToUpdate(); 54393 const blocks = getBlocksByClientId(blocksToUpdate); 54394 const canToggleBlockVisibility = blocks.every( 54395 (blockToUpdate) => (0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockToUpdate.name, "blockVisibility", true) 54396 ); 54397 if (!canToggleBlockVisibility) { 54398 return; 54399 } 54400 const hasHiddenBlock = blocks.some( 54401 (blockToUpdate) => blockToUpdate.attributes.metadata?.blockVisibility === false 54402 ); 54403 const attributesByClientId = Object.fromEntries( 54404 blocks.map(({ clientId: mapClientId, attributes }) => [ 54405 mapClientId, 54406 { 54407 metadata: utils_cleanEmptyObject({ 54408 ...attributes?.metadata, 54409 blockVisibility: hasHiddenBlock ? void 0 : false 54410 }) 54411 } 54412 ]) 54413 ); 54414 updateBlockAttributes(blocksToUpdate, attributesByClientId, { 54415 uniqueByBlock: true 54416 }); 54417 } 54418 } 54419 const onMouseEnter = (0,external_wp_element_namespaceObject.useCallback)(() => { 54420 setIsHovered(true); 54421 debouncedToggleBlockHighlight(clientId, true); 54422 }, [clientId, setIsHovered, debouncedToggleBlockHighlight]); 54423 const onMouseLeave = (0,external_wp_element_namespaceObject.useCallback)(() => { 54424 setIsHovered(false); 54425 debouncedToggleBlockHighlight(clientId, false); 54426 }, [clientId, setIsHovered, debouncedToggleBlockHighlight]); 54427 const selectEditorBlock = (0,external_wp_element_namespaceObject.useCallback)( 54428 (event) => { 54429 selectBlock(event, clientId); 54430 event.preventDefault(); 54431 }, 54432 [clientId, selectBlock] 54433 ); 54434 const updateFocusAndSelection = (0,external_wp_element_namespaceObject.useCallback)( 54435 (focusClientId, shouldSelectBlock) => { 54436 if (shouldSelectBlock) { 54437 selectBlock(void 0, focusClientId, null, null); 54438 } 54439 focusListItem(focusClientId, treeGridElementRef?.current); 54440 }, 54441 [selectBlock, treeGridElementRef] 54442 ); 54443 const toggleExpanded = (0,external_wp_element_namespaceObject.useCallback)( 54444 (event) => { 54445 event.preventDefault(); 54446 event.stopPropagation(); 54447 if (isExpanded === true) { 54448 collapse(clientId); 54449 } else if (isExpanded === false) { 54450 expand(clientId); 54451 } 54452 }, 54453 [clientId, expand, collapse, isExpanded] 54454 ); 54455 const onContextMenu = (0,external_wp_element_namespaceObject.useCallback)( 54456 (event) => { 54457 if (showBlockActions && allowRightClickOverrides) { 54458 settingsRef.current?.click(); 54459 setSettingsAnchorRect( 54460 new window.DOMRect(event.clientX, event.clientY, 0, 0) 54461 ); 54462 event.preventDefault(); 54463 } 54464 }, 54465 [allowRightClickOverrides, settingsRef, showBlockActions] 54466 ); 54467 const onMouseDown = (0,external_wp_element_namespaceObject.useCallback)( 54468 (event) => { 54469 if (allowRightClickOverrides && event.button === 2) { 54470 event.preventDefault(); 54471 } 54472 }, 54473 [allowRightClickOverrides] 54474 ); 54475 const settingsPopoverAnchor = (0,external_wp_element_namespaceObject.useMemo)(() => { 54476 const { ownerDocument } = rowRef?.current || {}; 54477 if (!settingsAnchorRect || !ownerDocument) { 54478 return void 0; 54479 } 54480 return { 54481 ownerDocument, 54482 getBoundingClientRect() { 54483 return settingsAnchorRect; 54484 } 54485 }; 54486 }, [settingsAnchorRect]); 54487 const clearSettingsAnchorRect = (0,external_wp_element_namespaceObject.useCallback)(() => { 54488 setSettingsAnchorRect(void 0); 54489 }, [setSettingsAnchorRect]); 54490 useListViewScrollIntoView({ 54491 isSelected, 54492 rowItemRef: rowRef, 54493 selectedClientIds 54494 }); 54495 if (!block) { 54496 return null; 54497 } 54498 const blockPositionDescription = getBlockPositionDescription( 54499 position, 54500 siblingBlockCount, 54501 level 54502 ); 54503 const blockPropertiesDescription = getBlockPropertiesDescription( 54504 blockInformation, 54505 isLocked 54506 ); 54507 const blockVisibilityDescription = isBlockHidden ? (0,external_wp_i18n_namespaceObject.__)("Block is hidden.") : null; 54508 const hasSiblings = siblingBlockCount > 0; 54509 const hasRenderedMovers = showBlockMovers && hasSiblings; 54510 const moverCellClassName = dist_clsx( 54511 "block-editor-list-view-block__mover-cell", 54512 { "is-visible": isHovered || isSelected } 54513 ); 54514 const listViewBlockSettingsClassName = dist_clsx( 54515 "block-editor-list-view-block__menu-cell", 54516 { "is-visible": isHovered || isFirstSelectedBlock } 54517 ); 54518 let colSpan; 54519 if (hasRenderedMovers) { 54520 colSpan = 2; 54521 } else if (!showBlockActions) { 54522 colSpan = 3; 54523 } 54524 const classes = dist_clsx({ 54525 "is-selected": isSelected, 54526 "is-first-selected": isFirstSelectedBlock, 54527 "is-last-selected": isLastSelectedBlock, 54528 "is-branch-selected": isBranchSelected, 54529 "is-synced-branch": isSyncedBranch, 54530 "is-dragging": isDragged, 54531 "has-single-cell": !showBlockActions, 54532 "is-synced": blockInformation?.isSynced, 54533 "is-draggable": canMove, 54534 "is-displacement-normal": displacement === "normal", 54535 "is-displacement-up": displacement === "up", 54536 "is-displacement-down": displacement === "down", 54537 "is-after-dragged-blocks": isAfterDraggedBlocks, 54538 "is-nesting": isNesting 54539 }); 54540 const dropdownClientIds = selectedClientIds.includes(clientId) ? selectedClientIds : [clientId]; 54541 const currentlyEditingBlockInCanvas = isSelected && selectedClientIds.length === 1; 54542 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 54543 leaf_default, 54544 { 54545 className: classes, 54546 isDragged, 54547 onKeyDown, 54548 onMouseEnter, 54549 onMouseLeave, 54550 onFocus: onMouseEnter, 54551 onBlur: onMouseLeave, 54552 level, 54553 position, 54554 rowCount, 54555 path, 54556 id: `list-view-$listViewInstanceId}-block-$clientId}`, 54557 "data-block": clientId, 54558 "data-expanded": canEdit ? isExpanded : void 0, 54559 ref: rowRef, 54560 children: [ 54561 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 54562 external_wp_components_namespaceObject.__experimentalTreeGridCell, 54563 { 54564 className: "block-editor-list-view-block__contents-cell", 54565 colSpan, 54566 ref: cellRef, 54567 "aria-selected": !!isSelected, 54568 children: ({ ref, tabIndex, onFocus }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-editor-list-view-block__contents-container", children: [ 54569 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 54570 block_contents_default, 54571 { 54572 block, 54573 onClick: selectEditorBlock, 54574 onContextMenu, 54575 onMouseDown, 54576 onToggleExpanded: toggleExpanded, 54577 isSelected, 54578 position, 54579 siblingBlockCount, 54580 level, 54581 ref, 54582 tabIndex: currentlyEditingBlockInCanvas ? 0 : tabIndex, 54583 onFocus, 54584 isExpanded: canEdit ? isExpanded : void 0, 54585 selectedClientIds, 54586 ariaDescribedBy: descriptionId 54587 } 54588 ), 54589 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(AriaReferencedText, { id: descriptionId, children: [ 54590 blockPositionDescription, 54591 blockPropertiesDescription, 54592 blockVisibilityDescription 54593 ].filter(Boolean).join(" ") }) 54594 ] }) 54595 } 54596 ), 54597 hasRenderedMovers && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 54598 external_wp_components_namespaceObject.__experimentalTreeGridCell, 54599 { 54600 className: moverCellClassName, 54601 withoutGridItem: true, 54602 children: [ 54603 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalTreeGridItem, { children: ({ ref, tabIndex, onFocus }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 54604 BlockMoverUpButton, 54605 { 54606 orientation: "vertical", 54607 clientIds: [clientId], 54608 ref, 54609 tabIndex, 54610 onFocus 54611 } 54612 ) }), 54613 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalTreeGridItem, { children: ({ ref, tabIndex, onFocus }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 54614 BlockMoverDownButton, 54615 { 54616 orientation: "vertical", 54617 clientIds: [clientId], 54618 ref, 54619 tabIndex, 54620 onFocus 54621 } 54622 ) }) 54623 ] 54624 } 54625 ) }), 54626 showBlockActions && BlockSettingsMenu && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 54627 external_wp_components_namespaceObject.__experimentalTreeGridCell, 54628 { 54629 className: listViewBlockSettingsClassName, 54630 "aria-selected": !!isSelected, 54631 ref: settingsRef, 54632 children: ({ ref, tabIndex, onFocus }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 54633 BlockSettingsMenu, 54634 { 54635 clientIds: dropdownClientIds, 54636 block, 54637 icon: more_vertical_default, 54638 label: (0,external_wp_i18n_namespaceObject.__)("Options"), 54639 popoverProps: { 54640 anchor: settingsPopoverAnchor 54641 // Used to position the settings at the cursor on right-click. 54642 }, 54643 toggleProps: { 54644 ref, 54645 className: "block-editor-list-view-block__menu", 54646 tabIndex, 54647 onClick: clearSettingsAnchorRect, 54648 onFocus, 54649 size: "small" 54650 }, 54651 disableOpenOnArrowDown: true, 54652 expand, 54653 expandedState, 54654 setInsertedBlock, 54655 __experimentalSelectBlock: updateFocusAndSelection 54656 } 54657 ) 54658 } 54659 ) 54660 ] 54661 } 54662 ); 54663 } 54664 var list_view_block_block_default = (0,external_wp_element_namespaceObject.memo)(ListViewBlock); 54665 54666 54667 ;// ./node_modules/@wordpress/block-editor/build-module/components/list-view/branch.js 54668 54669 54670 54671 54672 54673 54674 54675 54676 54677 54678 function countBlocks(block, expandedState, draggedClientIds, isExpandedByDefault) { 54679 const isDragged = draggedClientIds?.includes(block.clientId); 54680 if (isDragged) { 54681 return 0; 54682 } 54683 const isExpanded = expandedState[block.clientId] ?? isExpandedByDefault; 54684 if (isExpanded) { 54685 return 1 + block.innerBlocks.reduce( 54686 countReducer( 54687 expandedState, 54688 draggedClientIds, 54689 isExpandedByDefault 54690 ), 54691 0 54692 ); 54693 } 54694 return 1; 54695 } 54696 const countReducer = (expandedState, draggedClientIds, isExpandedByDefault) => (count, block) => { 54697 const isDragged = draggedClientIds?.includes(block.clientId); 54698 if (isDragged) { 54699 return count; 54700 } 54701 const isExpanded = expandedState[block.clientId] ?? isExpandedByDefault; 54702 if (isExpanded && block.innerBlocks.length > 0) { 54703 return count + countBlocks( 54704 block, 54705 expandedState, 54706 draggedClientIds, 54707 isExpandedByDefault 54708 ); 54709 } 54710 return count + 1; 54711 }; 54712 const branch_noop = () => { 54713 }; 54714 function ListViewBranch(props) { 54715 const { 54716 blocks, 54717 selectBlock = branch_noop, 54718 showBlockMovers, 54719 selectedClientIds, 54720 level = 1, 54721 path = "", 54722 isBranchSelected = false, 54723 listPosition = 0, 54724 fixedListWindow, 54725 isExpanded, 54726 parentId, 54727 shouldShowInnerBlocks = true, 54728 isSyncedBranch = false, 54729 showAppender: showAppenderProp = true 54730 } = props; 54731 const parentBlockInformation = useBlockDisplayInformation(parentId); 54732 const syncedBranch = isSyncedBranch || !!parentBlockInformation?.isSynced; 54733 const canParentExpand = (0,external_wp_data_namespaceObject.useSelect)( 54734 (select) => { 54735 if (!parentId) { 54736 return true; 54737 } 54738 return select(store).canEditBlock(parentId); 54739 }, 54740 [parentId] 54741 ); 54742 const { 54743 blockDropPosition, 54744 blockDropTargetIndex, 54745 firstDraggedBlockIndex, 54746 blockIndexes, 54747 expandedState, 54748 draggedClientIds 54749 } = useListViewContext(); 54750 const nextPositionRef = (0,external_wp_element_namespaceObject.useRef)(); 54751 if (!canParentExpand) { 54752 return null; 54753 } 54754 const showAppender = showAppenderProp && level === 1; 54755 const filteredBlocks = blocks.filter(Boolean); 54756 const blockCount = filteredBlocks.length; 54757 const rowCount = showAppender ? blockCount + 1 : blockCount; 54758 nextPositionRef.current = listPosition; 54759 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 54760 filteredBlocks.map((block, index) => { 54761 const { clientId, innerBlocks } = block; 54762 if (index > 0) { 54763 nextPositionRef.current += countBlocks( 54764 filteredBlocks[index - 1], 54765 expandedState, 54766 draggedClientIds, 54767 isExpanded 54768 ); 54769 } 54770 const isDragged = !!draggedClientIds?.includes(clientId); 54771 const { displacement, isAfterDraggedBlocks, isNesting } = getDragDisplacementValues({ 54772 blockIndexes, 54773 blockDropTargetIndex, 54774 blockDropPosition, 54775 clientId, 54776 firstDraggedBlockIndex, 54777 isDragged 54778 }); 54779 const { itemInView } = fixedListWindow; 54780 const blockInView = itemInView(nextPositionRef.current); 54781 const position = index + 1; 54782 const updatedPath = path.length > 0 ? `$path}_$position}` : `$position}`; 54783 const hasNestedBlocks = !!innerBlocks?.length; 54784 const shouldExpand = hasNestedBlocks && shouldShowInnerBlocks ? expandedState[clientId] ?? isExpanded : void 0; 54785 const isSelected = isClientIdSelected( 54786 clientId, 54787 selectedClientIds 54788 ); 54789 const isSelectedBranch = isBranchSelected || isSelected && hasNestedBlocks; 54790 const showBlock = isDragged || blockInView || isSelected && clientId === selectedClientIds[0] || index === 0 || index === blockCount - 1; 54791 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_data_namespaceObject.AsyncModeProvider, { value: !isSelected, children: [ 54792 showBlock && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 54793 list_view_block_block_default, 54794 { 54795 block, 54796 selectBlock, 54797 isSelected, 54798 isBranchSelected: isSelectedBranch, 54799 isDragged, 54800 level, 54801 position, 54802 rowCount, 54803 siblingBlockCount: blockCount, 54804 showBlockMovers, 54805 path: updatedPath, 54806 isExpanded: isDragged ? false : shouldExpand, 54807 listPosition: nextPositionRef.current, 54808 selectedClientIds, 54809 isSyncedBranch: syncedBranch, 54810 displacement, 54811 isAfterDraggedBlocks, 54812 isNesting 54813 } 54814 ), 54815 !showBlock && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("tr", { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("td", { className: "block-editor-list-view-placeholder" }) }), 54816 hasNestedBlocks && shouldExpand && !isDragged && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 54817 ListViewBranch, 54818 { 54819 parentId: clientId, 54820 blocks: innerBlocks, 54821 selectBlock, 54822 showBlockMovers, 54823 level: level + 1, 54824 path: updatedPath, 54825 listPosition: nextPositionRef.current + 1, 54826 fixedListWindow, 54827 isBranchSelected: isSelectedBranch, 54828 selectedClientIds, 54829 isExpanded, 54830 isSyncedBranch: syncedBranch 54831 } 54832 ) 54833 ] }, clientId); 54834 }), 54835 showAppender && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 54836 external_wp_components_namespaceObject.__experimentalTreeGridRow, 54837 { 54838 level, 54839 setSize: rowCount, 54840 positionInSet: rowCount, 54841 isExpanded: true, 54842 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalTreeGridCell, { children: (treeGridCellProps) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 54843 Appender, 54844 { 54845 clientId: parentId, 54846 nestingLevel: level, 54847 blockCount, 54848 ...treeGridCellProps 54849 } 54850 ) }) 54851 } 54852 ) 54853 ] }); 54854 } 54855 var branch_default = (0,external_wp_element_namespaceObject.memo)(ListViewBranch); 54856 54857 54858 ;// ./node_modules/@wordpress/block-editor/build-module/components/list-view/drop-indicator.js 54859 54860 54861 54862 54863 54864 54865 54866 54867 54868 54869 function ListViewDropIndicatorPreview({ 54870 draggedBlockClientId, 54871 listViewRef, 54872 blockDropTarget 54873 }) { 54874 const blockInformation = useBlockDisplayInformation(draggedBlockClientId); 54875 const blockTitle = useBlockDisplayTitle({ 54876 clientId: draggedBlockClientId, 54877 context: "list-view" 54878 }); 54879 const { rootClientId, clientId, dropPosition } = blockDropTarget || {}; 54880 const [rootBlockElement, blockElement] = (0,external_wp_element_namespaceObject.useMemo)(() => { 54881 if (!listViewRef.current) { 54882 return []; 54883 } 54884 const _rootBlockElement = rootClientId ? listViewRef.current.querySelector( 54885 `[data-block="$rootClientId}"]` 54886 ) : void 0; 54887 const _blockElement = clientId ? listViewRef.current.querySelector( 54888 `[data-block="$clientId}"]` 54889 ) : void 0; 54890 return [_rootBlockElement, _blockElement]; 54891 }, [listViewRef, rootClientId, clientId]); 54892 const targetElement = blockElement || rootBlockElement; 54893 const rtl = (0,external_wp_i18n_namespaceObject.isRTL)(); 54894 const getDropIndicatorWidth = (0,external_wp_element_namespaceObject.useCallback)( 54895 (targetElementRect, indent) => { 54896 if (!targetElement) { 54897 return 0; 54898 } 54899 let width = targetElement.offsetWidth; 54900 const scrollContainer = (0,external_wp_dom_namespaceObject.getScrollContainer)( 54901 targetElement, 54902 "horizontal" 54903 ); 54904 const ownerDocument = targetElement.ownerDocument; 54905 const windowScroll = scrollContainer === ownerDocument.body || scrollContainer === ownerDocument.documentElement; 54906 if (scrollContainer && !windowScroll) { 54907 const scrollContainerRect = scrollContainer.getBoundingClientRect(); 54908 const distanceBetweenContainerAndTarget = (0,external_wp_i18n_namespaceObject.isRTL)() ? scrollContainerRect.right - targetElementRect.right : targetElementRect.left - scrollContainerRect.left; 54909 const scrollContainerWidth = scrollContainer.clientWidth; 54910 if (scrollContainerWidth < width + distanceBetweenContainerAndTarget) { 54911 width = scrollContainerWidth - distanceBetweenContainerAndTarget; 54912 } 54913 if (!rtl && targetElementRect.left + indent < scrollContainerRect.left) { 54914 width -= scrollContainerRect.left - targetElementRect.left; 54915 return width; 54916 } 54917 if (rtl && targetElementRect.right - indent > scrollContainerRect.right) { 54918 width -= targetElementRect.right - scrollContainerRect.right; 54919 return width; 54920 } 54921 } 54922 return width - indent; 54923 }, 54924 [rtl, targetElement] 54925 ); 54926 const style = (0,external_wp_element_namespaceObject.useMemo)(() => { 54927 if (!targetElement) { 54928 return {}; 54929 } 54930 const targetElementRect = targetElement.getBoundingClientRect(); 54931 return { 54932 width: getDropIndicatorWidth(targetElementRect, 0) 54933 }; 54934 }, [getDropIndicatorWidth, targetElement]); 54935 const horizontalScrollOffsetStyle = (0,external_wp_element_namespaceObject.useMemo)(() => { 54936 if (!targetElement) { 54937 return {}; 54938 } 54939 const scrollContainer = (0,external_wp_dom_namespaceObject.getScrollContainer)(targetElement); 54940 const ownerDocument = targetElement.ownerDocument; 54941 const windowScroll = scrollContainer === ownerDocument.body || scrollContainer === ownerDocument.documentElement; 54942 if (scrollContainer && !windowScroll) { 54943 const scrollContainerRect = scrollContainer.getBoundingClientRect(); 54944 const targetElementRect = targetElement.getBoundingClientRect(); 54945 const distanceBetweenContainerAndTarget = rtl ? scrollContainerRect.right - targetElementRect.right : targetElementRect.left - scrollContainerRect.left; 54946 if (!rtl && scrollContainerRect.left > targetElementRect.left) { 54947 return { 54948 transform: `translateX( $distanceBetweenContainerAndTarget}px )` 54949 }; 54950 } 54951 if (rtl && scrollContainerRect.right < targetElementRect.right) { 54952 return { 54953 transform: `translateX( $distanceBetweenContainerAndTarget * -1}px )` 54954 }; 54955 } 54956 } 54957 return {}; 54958 }, [rtl, targetElement]); 54959 const ariaLevel = (0,external_wp_element_namespaceObject.useMemo)(() => { 54960 if (!rootBlockElement) { 54961 return 1; 54962 } 54963 const _ariaLevel = parseInt( 54964 rootBlockElement.getAttribute("aria-level"), 54965 10 54966 ); 54967 return _ariaLevel ? _ariaLevel + 1 : 1; 54968 }, [rootBlockElement]); 54969 const hasAdjacentSelectedBranch = (0,external_wp_element_namespaceObject.useMemo)(() => { 54970 if (!targetElement) { 54971 return false; 54972 } 54973 return targetElement.classList.contains("is-branch-selected"); 54974 }, [targetElement]); 54975 const popoverAnchor = (0,external_wp_element_namespaceObject.useMemo)(() => { 54976 const isValidDropPosition = dropPosition === "top" || dropPosition === "bottom" || dropPosition === "inside"; 54977 if (!targetElement || !isValidDropPosition) { 54978 return void 0; 54979 } 54980 return { 54981 contextElement: targetElement, 54982 getBoundingClientRect() { 54983 const rect = targetElement.getBoundingClientRect(); 54984 let left = rect.left; 54985 let top = 0; 54986 const scrollContainer = (0,external_wp_dom_namespaceObject.getScrollContainer)( 54987 targetElement, 54988 "horizontal" 54989 ); 54990 const doc = targetElement.ownerDocument; 54991 const windowScroll = scrollContainer === doc.body || scrollContainer === doc.documentElement; 54992 if (scrollContainer && !windowScroll) { 54993 const scrollContainerRect = scrollContainer.getBoundingClientRect(); 54994 const scrollbarWidth = rtl ? scrollContainer.offsetWidth - scrollContainer.clientWidth : 0; 54995 if (left < scrollContainerRect.left + scrollbarWidth) { 54996 left = scrollContainerRect.left + scrollbarWidth; 54997 } 54998 } 54999 if (dropPosition === "top") { 55000 top = rect.top - rect.height * 2; 55001 } else { 55002 top = rect.top; 55003 } 55004 const width = getDropIndicatorWidth(rect, 0); 55005 const height = rect.height; 55006 return new window.DOMRect(left, top, width, height); 55007 } 55008 }; 55009 }, [targetElement, dropPosition, getDropIndicatorWidth, rtl]); 55010 if (!targetElement) { 55011 return null; 55012 } 55013 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 55014 external_wp_components_namespaceObject.Popover, 55015 { 55016 animate: false, 55017 anchor: popoverAnchor, 55018 focusOnMount: false, 55019 className: "block-editor-list-view-drop-indicator--preview", 55020 variant: "unstyled", 55021 flip: false, 55022 resize: true, 55023 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 55024 "div", 55025 { 55026 style, 55027 className: dist_clsx( 55028 "block-editor-list-view-drop-indicator__line", 55029 { 55030 "block-editor-list-view-drop-indicator__line--darker": hasAdjacentSelectedBranch 55031 } 55032 ), 55033 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 55034 "div", 55035 { 55036 className: "block-editor-list-view-leaf", 55037 "aria-level": ariaLevel, 55038 children: [ 55039 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 55040 "div", 55041 { 55042 className: dist_clsx( 55043 "block-editor-list-view-block-select-button", 55044 "block-editor-list-view-block-contents" 55045 ), 55046 style: horizontalScrollOffsetStyle, 55047 children: [ 55048 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ListViewExpander, { onClick: () => { 55049 } }), 55050 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 55051 block_icon_default, 55052 { 55053 icon: blockInformation?.icon, 55054 showColors: true, 55055 context: "list-view" 55056 } 55057 ), 55058 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 55059 external_wp_components_namespaceObject.__experimentalHStack, 55060 { 55061 alignment: "center", 55062 className: "block-editor-list-view-block-select-button__label-wrapper", 55063 justify: "flex-start", 55064 spacing: 1, 55065 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "block-editor-list-view-block-select-button__title", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalTruncate, { ellipsizeMode: "auto", children: blockTitle }) }) 55066 } 55067 ) 55068 ] 55069 } 55070 ), 55071 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-list-view-block__menu-cell" }) 55072 ] 55073 } 55074 ) 55075 } 55076 ) 55077 } 55078 ); 55079 } 55080 55081 55082 ;// ./node_modules/@wordpress/block-editor/build-module/components/list-view/use-block-selection.js 55083 55084 55085 55086 55087 55088 55089 55090 55091 function useBlockSelection() { 55092 const { clearSelectedBlock, multiSelect, selectBlock } = (0,external_wp_data_namespaceObject.useDispatch)(store); 55093 const { 55094 getBlockName, 55095 getBlockParents, 55096 getBlockSelectionStart, 55097 getSelectedBlockClientIds, 55098 hasMultiSelection, 55099 hasSelectedBlock 55100 } = (0,external_wp_data_namespaceObject.useSelect)(store); 55101 const { getBlockType } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blocks_namespaceObject.store); 55102 const updateBlockSelection = (0,external_wp_element_namespaceObject.useCallback)( 55103 async (event, clientId, destinationClientId, focusPosition) => { 55104 if (!event?.shiftKey && event?.keyCode !== external_wp_keycodes_namespaceObject.ESCAPE) { 55105 selectBlock(clientId, focusPosition); 55106 return; 55107 } 55108 event.preventDefault(); 55109 const isOnlyDeselection = event.type === "keydown" && event.keyCode === external_wp_keycodes_namespaceObject.ESCAPE; 55110 const isKeyPress = event.type === "keydown" && (event.keyCode === external_wp_keycodes_namespaceObject.UP || event.keyCode === external_wp_keycodes_namespaceObject.DOWN || event.keyCode === external_wp_keycodes_namespaceObject.HOME || event.keyCode === external_wp_keycodes_namespaceObject.END); 55111 if (!isKeyPress && !hasSelectedBlock() && !hasMultiSelection()) { 55112 selectBlock(clientId, null); 55113 return; 55114 } 55115 const selectedBlocks = getSelectedBlockClientIds(); 55116 const clientIdWithParents = [ 55117 ...getBlockParents(clientId), 55118 clientId 55119 ]; 55120 if (isOnlyDeselection || isKeyPress && !selectedBlocks.some( 55121 (blockId) => clientIdWithParents.includes(blockId) 55122 )) { 55123 await clearSelectedBlock(); 55124 } 55125 if (!isOnlyDeselection) { 55126 let startTarget = getBlockSelectionStart(); 55127 let endTarget = clientId; 55128 if (isKeyPress) { 55129 if (!hasSelectedBlock() && !hasMultiSelection()) { 55130 startTarget = clientId; 55131 } 55132 if (destinationClientId) { 55133 endTarget = destinationClientId; 55134 } 55135 } 55136 const startParents = getBlockParents(startTarget); 55137 const endParents = getBlockParents(endTarget); 55138 const { start, end } = getCommonDepthClientIds( 55139 startTarget, 55140 endTarget, 55141 startParents, 55142 endParents 55143 ); 55144 await multiSelect(start, end, null); 55145 } 55146 const updatedSelectedBlocks = getSelectedBlockClientIds(); 55147 if ((event.keyCode === external_wp_keycodes_namespaceObject.HOME || event.keyCode === external_wp_keycodes_namespaceObject.END) && updatedSelectedBlocks.length > 1) { 55148 return; 55149 } 55150 const selectionDiff = selectedBlocks.filter( 55151 (blockId) => !updatedSelectedBlocks.includes(blockId) 55152 ); 55153 let label; 55154 if (selectionDiff.length === 1) { 55155 const title = getBlockType( 55156 getBlockName(selectionDiff[0]) 55157 )?.title; 55158 if (title) { 55159 label = (0,external_wp_i18n_namespaceObject.sprintf)( 55160 /* translators: %s: block name */ 55161 (0,external_wp_i18n_namespaceObject.__)("%s deselected."), 55162 title 55163 ); 55164 } 55165 } else if (selectionDiff.length > 1) { 55166 label = (0,external_wp_i18n_namespaceObject.sprintf)( 55167 /* translators: %s: number of deselected blocks */ 55168 (0,external_wp_i18n_namespaceObject.__)("%s blocks deselected."), 55169 selectionDiff.length 55170 ); 55171 } 55172 if (label) { 55173 (0,external_wp_a11y_namespaceObject.speak)(label, "assertive"); 55174 } 55175 }, 55176 [ 55177 clearSelectedBlock, 55178 getBlockName, 55179 getBlockType, 55180 getBlockParents, 55181 getBlockSelectionStart, 55182 getSelectedBlockClientIds, 55183 hasMultiSelection, 55184 hasSelectedBlock, 55185 multiSelect, 55186 selectBlock 55187 ] 55188 ); 55189 return { 55190 updateBlockSelection 55191 }; 55192 } 55193 55194 55195 ;// ./node_modules/@wordpress/block-editor/build-module/components/list-view/use-list-view-block-indexes.js 55196 55197 function useListViewBlockIndexes(blocks) { 55198 const blockIndexes = (0,external_wp_element_namespaceObject.useMemo)(() => { 55199 const indexes = {}; 55200 let currentGlobalIndex = 0; 55201 const traverseBlocks = (blockList) => { 55202 blockList.forEach((block) => { 55203 indexes[block.clientId] = currentGlobalIndex; 55204 currentGlobalIndex++; 55205 if (block.innerBlocks.length > 0) { 55206 traverseBlocks(block.innerBlocks); 55207 } 55208 }); 55209 }; 55210 traverseBlocks(blocks); 55211 return indexes; 55212 }, [blocks]); 55213 return blockIndexes; 55214 } 55215 55216 55217 ;// ./node_modules/@wordpress/block-editor/build-module/components/list-view/use-list-view-client-ids.js 55218 55219 55220 55221 function useListViewClientIds({ blocks, rootClientId }) { 55222 return (0,external_wp_data_namespaceObject.useSelect)( 55223 (select) => { 55224 const { 55225 getDraggedBlockClientIds, 55226 getSelectedBlockClientIds, 55227 getEnabledClientIdsTree 55228 } = unlock(select(store)); 55229 return { 55230 selectedClientIds: getSelectedBlockClientIds(), 55231 draggedClientIds: getDraggedBlockClientIds(), 55232 clientIdsTree: blocks ?? getEnabledClientIdsTree(rootClientId) 55233 }; 55234 }, 55235 [blocks, rootClientId] 55236 ); 55237 } 55238 55239 55240 ;// ./node_modules/@wordpress/block-editor/build-module/components/list-view/use-list-view-collapse-items.js 55241 55242 55243 55244 55245 function useListViewCollapseItems({ collapseAll, expand }) { 55246 const { expandedBlock, getBlockParents } = (0,external_wp_data_namespaceObject.useSelect)((select) => { 55247 const { getBlockParents: _getBlockParents, getExpandedBlock } = unlock( 55248 select(store) 55249 ); 55250 return { 55251 expandedBlock: getExpandedBlock(), 55252 getBlockParents: _getBlockParents 55253 }; 55254 }, []); 55255 (0,external_wp_element_namespaceObject.useEffect)(() => { 55256 if (expandedBlock) { 55257 const blockParents = getBlockParents(expandedBlock, false); 55258 collapseAll(); 55259 expand(blockParents); 55260 } 55261 }, [collapseAll, expand, expandedBlock, getBlockParents]); 55262 } 55263 55264 55265 ;// ./node_modules/@wordpress/block-editor/build-module/components/list-view/use-list-view-drop-zone.js 55266 55267 55268 55269 55270 55271 55272 55273 const NESTING_LEVEL_INDENTATION = 24; 55274 function isUpGesture(point, rect, nestingLevel = 1, rtl = false) { 55275 const blockIndentPosition = rtl ? rect.right - nestingLevel * NESTING_LEVEL_INDENTATION : rect.left + nestingLevel * NESTING_LEVEL_INDENTATION; 55276 return rtl ? point.x > blockIndentPosition : point.x < blockIndentPosition; 55277 } 55278 function getDesiredRelativeParentLevel(point, rect, nestingLevel = 1, rtl = false) { 55279 const blockIndentPosition = rtl ? rect.right - nestingLevel * NESTING_LEVEL_INDENTATION : rect.left + nestingLevel * NESTING_LEVEL_INDENTATION; 55280 const distanceBetweenPointAndBlockIndentPosition = rtl ? blockIndentPosition - point.x : point.x - blockIndentPosition; 55281 const desiredParentLevel = Math.round( 55282 distanceBetweenPointAndBlockIndentPosition / NESTING_LEVEL_INDENTATION 55283 ); 55284 return Math.abs(desiredParentLevel); 55285 } 55286 function getCandidateBlockParents(candidateBlockData, blocksData) { 55287 const candidateBlockParents = []; 55288 let currentBlockData = candidateBlockData; 55289 while (currentBlockData) { 55290 candidateBlockParents.push({ ...currentBlockData }); 55291 currentBlockData = blocksData.find( 55292 (blockData) => blockData.clientId === currentBlockData.rootClientId 55293 ); 55294 } 55295 return candidateBlockParents; 55296 } 55297 function getNextNonDraggedBlock(blocksData, index) { 55298 const nextBlockData = blocksData[index + 1]; 55299 if (nextBlockData && nextBlockData.isDraggedBlock) { 55300 return getNextNonDraggedBlock(blocksData, index + 1); 55301 } 55302 return nextBlockData; 55303 } 55304 function isNestingGesture(point, rect, nestingLevel = 1, rtl = false) { 55305 const blockIndentPosition = rtl ? rect.right - nestingLevel * NESTING_LEVEL_INDENTATION : rect.left + nestingLevel * NESTING_LEVEL_INDENTATION; 55306 const isNestingHorizontalGesture = rtl ? point.x < blockIndentPosition - NESTING_LEVEL_INDENTATION : point.x > blockIndentPosition + NESTING_LEVEL_INDENTATION; 55307 return isNestingHorizontalGesture && point.y < rect.bottom; 55308 } 55309 const ALLOWED_DROP_EDGES = ["top", "bottom"]; 55310 function getListViewDropTarget(blocksData, position, rtl = false) { 55311 let candidateEdge; 55312 let candidateBlockData; 55313 let candidateDistance; 55314 let candidateRect; 55315 let candidateBlockIndex; 55316 for (let i = 0; i < blocksData.length; i++) { 55317 const blockData = blocksData[i]; 55318 if (blockData.isDraggedBlock) { 55319 continue; 55320 } 55321 const rect = blockData.element.getBoundingClientRect(); 55322 const [distance, edge] = getDistanceToNearestEdge( 55323 position, 55324 rect, 55325 ALLOWED_DROP_EDGES 55326 ); 55327 const isCursorWithinBlock = isPointContainedByRect(position, rect); 55328 if (candidateDistance === void 0 || distance < candidateDistance || isCursorWithinBlock) { 55329 candidateDistance = distance; 55330 const index = blocksData.indexOf(blockData); 55331 const previousBlockData = blocksData[index - 1]; 55332 if (edge === "top" && previousBlockData && previousBlockData.rootClientId === blockData.rootClientId && !previousBlockData.isDraggedBlock) { 55333 candidateBlockData = previousBlockData; 55334 candidateEdge = "bottom"; 55335 candidateRect = previousBlockData.element.getBoundingClientRect(); 55336 candidateBlockIndex = index - 1; 55337 } else { 55338 candidateBlockData = blockData; 55339 candidateEdge = edge; 55340 candidateRect = rect; 55341 candidateBlockIndex = index; 55342 } 55343 if (isCursorWithinBlock) { 55344 break; 55345 } 55346 } 55347 } 55348 if (!candidateBlockData) { 55349 return; 55350 } 55351 const candidateBlockParents = getCandidateBlockParents( 55352 candidateBlockData, 55353 blocksData 55354 ); 55355 const isDraggingBelow = candidateEdge === "bottom"; 55356 if (isDraggingBelow && candidateBlockData.canInsertDraggedBlocksAsChild && (candidateBlockData.innerBlockCount > 0 && candidateBlockData.isExpanded || isNestingGesture( 55357 position, 55358 candidateRect, 55359 candidateBlockParents.length, 55360 rtl 55361 ))) { 55362 const newBlockIndex = candidateBlockData.isExpanded ? 0 : candidateBlockData.innerBlockCount || 0; 55363 return { 55364 rootClientId: candidateBlockData.clientId, 55365 clientId: candidateBlockData.clientId, 55366 blockIndex: newBlockIndex, 55367 dropPosition: "inside" 55368 }; 55369 } 55370 if (isDraggingBelow && candidateBlockData.rootClientId && isUpGesture( 55371 position, 55372 candidateRect, 55373 candidateBlockParents.length, 55374 rtl 55375 )) { 55376 const nextBlock = getNextNonDraggedBlock( 55377 blocksData, 55378 candidateBlockIndex 55379 ); 55380 const currentLevel = candidateBlockData.nestingLevel; 55381 const nextLevel = nextBlock ? nextBlock.nestingLevel : 1; 55382 if (currentLevel && nextLevel) { 55383 const desiredRelativeLevel = getDesiredRelativeParentLevel( 55384 position, 55385 candidateRect, 55386 candidateBlockParents.length, 55387 rtl 55388 ); 55389 const targetParentIndex = Math.max( 55390 Math.min(desiredRelativeLevel, currentLevel - nextLevel), 55391 0 55392 ); 55393 if (candidateBlockParents[targetParentIndex]) { 55394 let newBlockIndex = candidateBlockData.blockIndex; 55395 if (candidateBlockParents[targetParentIndex].nestingLevel === nextBlock?.nestingLevel) { 55396 newBlockIndex = nextBlock?.blockIndex; 55397 } else { 55398 for (let i = candidateBlockIndex; i >= 0; i--) { 55399 const blockData = blocksData[i]; 55400 if (blockData.rootClientId === candidateBlockParents[targetParentIndex].rootClientId) { 55401 newBlockIndex = blockData.blockIndex + 1; 55402 break; 55403 } 55404 } 55405 } 55406 return { 55407 rootClientId: candidateBlockParents[targetParentIndex].rootClientId, 55408 clientId: candidateBlockData.clientId, 55409 blockIndex: newBlockIndex, 55410 dropPosition: candidateEdge 55411 }; 55412 } 55413 } 55414 } 55415 if (!candidateBlockData.canInsertDraggedBlocksAsSibling) { 55416 return; 55417 } 55418 const offset = isDraggingBelow ? 1 : 0; 55419 return { 55420 rootClientId: candidateBlockData.rootClientId, 55421 clientId: candidateBlockData.clientId, 55422 blockIndex: candidateBlockData.blockIndex + offset, 55423 dropPosition: candidateEdge 55424 }; 55425 } 55426 const EXPAND_THROTTLE_OPTIONS = { 55427 leading: false, 55428 // Don't call the function immediately on the first call. 55429 trailing: true 55430 // Do call the function on the last call. 55431 }; 55432 function useListViewDropZone({ 55433 dropZoneElement, 55434 expandedState, 55435 setExpandedState 55436 }) { 55437 const { 55438 getBlockRootClientId, 55439 getBlockIndex, 55440 getBlockCount, 55441 getDraggedBlockClientIds, 55442 canInsertBlocks 55443 } = (0,external_wp_data_namespaceObject.useSelect)(store); 55444 const [target, setTarget] = (0,external_wp_element_namespaceObject.useState)(); 55445 const { rootClientId: targetRootClientId, blockIndex: targetBlockIndex } = target || {}; 55446 const onBlockDrop = useOnBlockDrop(targetRootClientId, targetBlockIndex); 55447 const rtl = (0,external_wp_i18n_namespaceObject.isRTL)(); 55448 const previousRootClientId = (0,external_wp_compose_namespaceObject.usePrevious)(targetRootClientId); 55449 const maybeExpandBlock = (0,external_wp_element_namespaceObject.useCallback)( 55450 (_expandedState, _target) => { 55451 const { rootClientId } = _target || {}; 55452 if (!rootClientId) { 55453 return; 55454 } 55455 if (_target?.dropPosition === "inside" && !_expandedState[rootClientId]) { 55456 setExpandedState({ 55457 type: "expand", 55458 clientIds: [rootClientId] 55459 }); 55460 } 55461 }, 55462 [setExpandedState] 55463 ); 55464 const throttledMaybeExpandBlock = (0,external_wp_compose_namespaceObject.useThrottle)( 55465 maybeExpandBlock, 55466 500, 55467 EXPAND_THROTTLE_OPTIONS 55468 ); 55469 (0,external_wp_element_namespaceObject.useEffect)(() => { 55470 if (target?.dropPosition !== "inside" || previousRootClientId !== target?.rootClientId) { 55471 throttledMaybeExpandBlock.cancel(); 55472 return; 55473 } 55474 throttledMaybeExpandBlock(expandedState, target); 55475 }, [ 55476 expandedState, 55477 previousRootClientId, 55478 target, 55479 throttledMaybeExpandBlock 55480 ]); 55481 const draggedBlockClientIds = getDraggedBlockClientIds(); 55482 const throttled = (0,external_wp_compose_namespaceObject.useThrottle)( 55483 (0,external_wp_element_namespaceObject.useCallback)( 55484 (event, currentTarget) => { 55485 const position = { x: event.clientX, y: event.clientY }; 55486 const isBlockDrag = !!draggedBlockClientIds?.length; 55487 const blockElements = Array.from( 55488 currentTarget.querySelectorAll("[data-block]") 55489 ); 55490 const blocksData = blockElements.map((blockElement) => { 55491 const clientId = blockElement.dataset.block; 55492 const isExpanded = blockElement.dataset.expanded === "true"; 55493 const isDraggedBlock = blockElement.classList.contains("is-dragging"); 55494 const nestingLevel = parseInt( 55495 blockElement.getAttribute("aria-level"), 55496 10 55497 ); 55498 const rootClientId = getBlockRootClientId(clientId); 55499 return { 55500 clientId, 55501 isExpanded, 55502 rootClientId, 55503 blockIndex: getBlockIndex(clientId), 55504 element: blockElement, 55505 nestingLevel: nestingLevel || void 0, 55506 isDraggedBlock: isBlockDrag ? isDraggedBlock : false, 55507 innerBlockCount: getBlockCount(clientId), 55508 canInsertDraggedBlocksAsSibling: isBlockDrag ? canInsertBlocks( 55509 draggedBlockClientIds, 55510 rootClientId 55511 ) : true, 55512 canInsertDraggedBlocksAsChild: isBlockDrag ? canInsertBlocks(draggedBlockClientIds, clientId) : true 55513 }; 55514 }); 55515 const newTarget = getListViewDropTarget( 55516 blocksData, 55517 position, 55518 rtl 55519 ); 55520 if (newTarget) { 55521 setTarget(newTarget); 55522 } 55523 }, 55524 [ 55525 canInsertBlocks, 55526 draggedBlockClientIds, 55527 getBlockCount, 55528 getBlockIndex, 55529 getBlockRootClientId, 55530 rtl 55531 ] 55532 ), 55533 50 55534 ); 55535 const ref = (0,external_wp_compose_namespaceObject.__experimentalUseDropZone)({ 55536 dropZoneElement, 55537 onDrop(event) { 55538 throttled.cancel(); 55539 if (target) { 55540 onBlockDrop(event); 55541 } 55542 setTarget(void 0); 55543 }, 55544 onDragLeave() { 55545 throttled.cancel(); 55546 setTarget(null); 55547 }, 55548 onDragOver(event) { 55549 throttled(event, event.currentTarget); 55550 }, 55551 onDragEnd() { 55552 throttled.cancel(); 55553 setTarget(void 0); 55554 } 55555 }); 55556 return { ref, target }; 55557 } 55558 55559 55560 ;// ./node_modules/@wordpress/block-editor/build-module/components/list-view/use-list-view-expand-selected-item.js 55561 55562 55563 55564 function useListViewExpandSelectedItem({ 55565 firstSelectedBlockClientId, 55566 setExpandedState 55567 }) { 55568 const [selectedTreeId, setSelectedTreeId] = (0,external_wp_element_namespaceObject.useState)(null); 55569 const { selectedBlockParentClientIds } = (0,external_wp_data_namespaceObject.useSelect)( 55570 (select) => { 55571 const { getBlockParents } = select(store); 55572 return { 55573 selectedBlockParentClientIds: getBlockParents( 55574 firstSelectedBlockClientId, 55575 false 55576 ) 55577 }; 55578 }, 55579 [firstSelectedBlockClientId] 55580 ); 55581 (0,external_wp_element_namespaceObject.useEffect)(() => { 55582 if (selectedTreeId === firstSelectedBlockClientId) { 55583 return; 55584 } 55585 if (selectedBlockParentClientIds?.length) { 55586 setExpandedState({ 55587 type: "expand", 55588 clientIds: selectedBlockParentClientIds 55589 }); 55590 } 55591 }, [ 55592 firstSelectedBlockClientId, 55593 selectedBlockParentClientIds, 55594 selectedTreeId, 55595 setExpandedState 55596 ]); 55597 return { 55598 setSelectedTreeId 55599 }; 55600 } 55601 55602 55603 ;// ./node_modules/@wordpress/block-editor/build-module/components/list-view/use-clipboard-handler.js 55604 55605 55606 55607 55608 55609 55610 function use_clipboard_handler_useClipboardHandler({ selectBlock }) { 55611 const registry = (0,external_wp_data_namespaceObject.useRegistry)(); 55612 const { 55613 getBlockOrder, 55614 getBlockRootClientId, 55615 getBlocksByClientId, 55616 getPreviousBlockClientId, 55617 getSelectedBlockClientIds, 55618 getSettings, 55619 canInsertBlockType, 55620 canRemoveBlocks 55621 } = (0,external_wp_data_namespaceObject.useSelect)(store); 55622 const { flashBlock, removeBlocks, replaceBlocks, insertBlocks } = (0,external_wp_data_namespaceObject.useDispatch)(store); 55623 const notifyCopy = useNotifyCopy(); 55624 return (0,external_wp_compose_namespaceObject.useRefEffect)((node) => { 55625 function updateFocusAndSelection(focusClientId, shouldSelectBlock) { 55626 if (shouldSelectBlock) { 55627 selectBlock(void 0, focusClientId, null, null); 55628 } 55629 focusListItem(focusClientId, node); 55630 } 55631 function getBlocksToUpdate(clientId) { 55632 const selectedBlockClientIds = getSelectedBlockClientIds(); 55633 const isUpdatingSelectedBlocks = selectedBlockClientIds.includes(clientId); 55634 const firstBlockClientId = isUpdatingSelectedBlocks ? selectedBlockClientIds[0] : clientId; 55635 const firstBlockRootClientId = getBlockRootClientId(firstBlockClientId); 55636 const blocksToUpdate = isUpdatingSelectedBlocks ? selectedBlockClientIds : [clientId]; 55637 return { 55638 blocksToUpdate, 55639 firstBlockClientId, 55640 firstBlockRootClientId, 55641 originallySelectedBlockClientIds: selectedBlockClientIds 55642 }; 55643 } 55644 function handler(event) { 55645 if (event.defaultPrevented) { 55646 return; 55647 } 55648 if (!node.contains(event.target.ownerDocument.activeElement)) { 55649 return; 55650 } 55651 const listViewRow = event.target.ownerDocument.activeElement?.closest( 55652 "[role=row]" 55653 ); 55654 const clientId = listViewRow?.dataset?.block; 55655 if (!clientId) { 55656 return; 55657 } 55658 const { 55659 blocksToUpdate: selectedBlockClientIds, 55660 firstBlockClientId, 55661 firstBlockRootClientId, 55662 originallySelectedBlockClientIds 55663 } = getBlocksToUpdate(clientId); 55664 if (selectedBlockClientIds.length === 0) { 55665 return; 55666 } 55667 event.preventDefault(); 55668 if (event.type === "copy" || event.type === "cut") { 55669 if (selectedBlockClientIds.length === 1) { 55670 flashBlock(selectedBlockClientIds[0]); 55671 } 55672 notifyCopy(event.type, selectedBlockClientIds); 55673 const blocks = getBlocksByClientId(selectedBlockClientIds); 55674 setClipboardBlocks(event, blocks, registry); 55675 } 55676 if (event.type === "cut") { 55677 if (!canRemoveBlocks(selectedBlockClientIds)) { 55678 return; 55679 } 55680 let blockToFocus = getPreviousBlockClientId(firstBlockClientId) ?? // If the previous block is not found (when the first block is deleted), 55681 // fallback to focus the parent block. 55682 firstBlockRootClientId; 55683 removeBlocks(selectedBlockClientIds, false); 55684 const shouldUpdateSelection = originallySelectedBlockClientIds.length > 0 && getSelectedBlockClientIds().length === 0; 55685 if (!blockToFocus) { 55686 blockToFocus = getBlockOrder()[0]; 55687 } 55688 updateFocusAndSelection(blockToFocus, shouldUpdateSelection); 55689 } else if (event.type === "paste") { 55690 const { 55691 __experimentalCanUserUseUnfilteredHTML: canUserUseUnfilteredHTML 55692 } = getSettings(); 55693 const blocks = getPasteBlocks( 55694 event, 55695 canUserUseUnfilteredHTML 55696 ); 55697 if (selectedBlockClientIds.length === 1) { 55698 const [selectedBlockClientId] = selectedBlockClientIds; 55699 if (blocks.every( 55700 (block) => canInsertBlockType( 55701 block.name, 55702 selectedBlockClientId 55703 ) 55704 )) { 55705 insertBlocks( 55706 blocks, 55707 void 0, 55708 selectedBlockClientId 55709 ); 55710 updateFocusAndSelection(blocks[0]?.clientId, false); 55711 return; 55712 } 55713 } 55714 replaceBlocks( 55715 selectedBlockClientIds, 55716 blocks, 55717 blocks.length - 1, 55718 -1 55719 ); 55720 updateFocusAndSelection(blocks[0]?.clientId, false); 55721 } 55722 } 55723 node.ownerDocument.addEventListener("copy", handler); 55724 node.ownerDocument.addEventListener("cut", handler); 55725 node.ownerDocument.addEventListener("paste", handler); 55726 return () => { 55727 node.ownerDocument.removeEventListener("copy", handler); 55728 node.ownerDocument.removeEventListener("cut", handler); 55729 node.ownerDocument.removeEventListener("paste", handler); 55730 }; 55731 }, []); 55732 } 55733 55734 55735 ;// ./node_modules/@wordpress/block-editor/build-module/components/list-view/index.js 55736 55737 55738 55739 55740 55741 55742 55743 55744 55745 55746 55747 55748 55749 55750 55751 55752 55753 55754 55755 55756 55757 const expanded = (state, action) => { 55758 if (action.type === "clear") { 55759 return {}; 55760 } 55761 if (Array.isArray(action.clientIds)) { 55762 return { 55763 ...state, 55764 ...action.clientIds.reduce( 55765 (newState, id) => ({ 55766 ...newState, 55767 [id]: action.type === "expand" 55768 }), 55769 {} 55770 ) 55771 }; 55772 } 55773 return state; 55774 }; 55775 const BLOCK_LIST_ITEM_HEIGHT = 32; 55776 function ListViewComponent({ 55777 id, 55778 blocks, 55779 dropZoneElement, 55780 showBlockMovers = false, 55781 isExpanded = false, 55782 showAppender = false, 55783 blockSettingsMenu: BlockSettingsMenu = BlockSettingsDropdown, 55784 rootClientId, 55785 description, 55786 onSelect, 55787 additionalBlockContent: AdditionalBlockContent 55788 }, ref) { 55789 if (blocks) { 55790 external_wp_deprecated_default()( 55791 "`blocks` property in `wp.blockEditor.__experimentalListView`", 55792 { 55793 since: "6.3", 55794 alternative: "`rootClientId` property" 55795 } 55796 ); 55797 } 55798 const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(ListViewComponent); 55799 const { clientIdsTree, draggedClientIds, selectedClientIds } = useListViewClientIds({ blocks, rootClientId }); 55800 const blockIndexes = useListViewBlockIndexes(clientIdsTree); 55801 const { getBlock } = (0,external_wp_data_namespaceObject.useSelect)(store); 55802 const { visibleBlockCount } = (0,external_wp_data_namespaceObject.useSelect)( 55803 (select) => { 55804 const { getGlobalBlockCount, getClientIdsOfDescendants } = select(store); 55805 const draggedBlockCount = draggedClientIds?.length > 0 ? getClientIdsOfDescendants(draggedClientIds).length + 1 : 0; 55806 return { 55807 visibleBlockCount: getGlobalBlockCount() - draggedBlockCount 55808 }; 55809 }, 55810 [draggedClientIds] 55811 ); 55812 const { updateBlockSelection } = useBlockSelection(); 55813 const [expandedState, setExpandedState] = (0,external_wp_element_namespaceObject.useReducer)(expanded, {}); 55814 const [insertedBlock, setInsertedBlock] = (0,external_wp_element_namespaceObject.useState)(null); 55815 const { setSelectedTreeId } = useListViewExpandSelectedItem({ 55816 firstSelectedBlockClientId: selectedClientIds[0], 55817 setExpandedState 55818 }); 55819 const selectEditorBlock = (0,external_wp_element_namespaceObject.useCallback)( 55820 /** 55821 * @param {MouseEvent | KeyboardEvent | undefined} event 55822 * @param {string} blockClientId 55823 * @param {null | undefined | -1 | 1} focusPosition 55824 */ 55825 (event, blockClientId, focusPosition) => { 55826 updateBlockSelection(event, blockClientId, null, focusPosition); 55827 setSelectedTreeId(blockClientId); 55828 if (onSelect) { 55829 onSelect(getBlock(blockClientId)); 55830 } 55831 }, 55832 [setSelectedTreeId, updateBlockSelection, onSelect, getBlock] 55833 ); 55834 const { ref: dropZoneRef, target: blockDropTarget } = useListViewDropZone({ 55835 dropZoneElement, 55836 expandedState, 55837 setExpandedState 55838 }); 55839 const elementRef = (0,external_wp_element_namespaceObject.useRef)(); 55840 const clipBoardRef = use_clipboard_handler_useClipboardHandler({ 55841 selectBlock: selectEditorBlock 55842 }); 55843 const treeGridRef = (0,external_wp_compose_namespaceObject.useMergeRefs)([ 55844 clipBoardRef, 55845 elementRef, 55846 dropZoneRef, 55847 ref 55848 ]); 55849 (0,external_wp_element_namespaceObject.useEffect)(() => { 55850 if (selectedClientIds?.length) { 55851 focusListItem(selectedClientIds[0], elementRef?.current); 55852 } 55853 }, []); 55854 const expand = (0,external_wp_element_namespaceObject.useCallback)( 55855 (clientId) => { 55856 if (!clientId) { 55857 return; 55858 } 55859 const clientIds = Array.isArray(clientId) ? clientId : [clientId]; 55860 setExpandedState({ type: "expand", clientIds }); 55861 }, 55862 [setExpandedState] 55863 ); 55864 const collapse = (0,external_wp_element_namespaceObject.useCallback)( 55865 (clientId) => { 55866 if (!clientId) { 55867 return; 55868 } 55869 setExpandedState({ type: "collapse", clientIds: [clientId] }); 55870 }, 55871 [setExpandedState] 55872 ); 55873 const collapseAll = (0,external_wp_element_namespaceObject.useCallback)(() => { 55874 setExpandedState({ type: "clear" }); 55875 }, [setExpandedState]); 55876 const expandRow = (0,external_wp_element_namespaceObject.useCallback)( 55877 (row) => { 55878 expand(row?.dataset?.block); 55879 }, 55880 [expand] 55881 ); 55882 const collapseRow = (0,external_wp_element_namespaceObject.useCallback)( 55883 (row) => { 55884 collapse(row?.dataset?.block); 55885 }, 55886 [collapse] 55887 ); 55888 const focusRow = (0,external_wp_element_namespaceObject.useCallback)( 55889 (event, startRow, endRow) => { 55890 if (event.shiftKey) { 55891 updateBlockSelection( 55892 event, 55893 startRow?.dataset?.block, 55894 endRow?.dataset?.block 55895 ); 55896 } 55897 }, 55898 [updateBlockSelection] 55899 ); 55900 useListViewCollapseItems({ 55901 collapseAll, 55902 expand 55903 }); 55904 const firstDraggedBlockClientId = draggedClientIds?.[0]; 55905 const { blockDropTargetIndex, blockDropPosition, firstDraggedBlockIndex } = (0,external_wp_element_namespaceObject.useMemo)(() => { 55906 let _blockDropTargetIndex, _firstDraggedBlockIndex; 55907 if (blockDropTarget?.clientId) { 55908 const foundBlockIndex = blockIndexes[blockDropTarget.clientId]; 55909 _blockDropTargetIndex = foundBlockIndex === void 0 || blockDropTarget?.dropPosition === "top" ? foundBlockIndex : foundBlockIndex + 1; 55910 } else if (blockDropTarget === null) { 55911 _blockDropTargetIndex = null; 55912 } 55913 if (firstDraggedBlockClientId) { 55914 const foundBlockIndex = blockIndexes[firstDraggedBlockClientId]; 55915 _firstDraggedBlockIndex = foundBlockIndex === void 0 || blockDropTarget?.dropPosition === "top" ? foundBlockIndex : foundBlockIndex + 1; 55916 } 55917 return { 55918 blockDropTargetIndex: _blockDropTargetIndex, 55919 blockDropPosition: blockDropTarget?.dropPosition, 55920 firstDraggedBlockIndex: _firstDraggedBlockIndex 55921 }; 55922 }, [blockDropTarget, blockIndexes, firstDraggedBlockClientId]); 55923 const contextValue = (0,external_wp_element_namespaceObject.useMemo)( 55924 () => ({ 55925 blockDropPosition, 55926 blockDropTargetIndex, 55927 blockIndexes, 55928 draggedClientIds, 55929 expandedState, 55930 expand, 55931 firstDraggedBlockIndex, 55932 collapse, 55933 collapseAll, 55934 BlockSettingsMenu, 55935 listViewInstanceId: instanceId, 55936 AdditionalBlockContent, 55937 insertedBlock, 55938 setInsertedBlock, 55939 treeGridElementRef: elementRef, 55940 rootClientId 55941 }), 55942 [ 55943 blockDropPosition, 55944 blockDropTargetIndex, 55945 blockIndexes, 55946 draggedClientIds, 55947 expandedState, 55948 expand, 55949 firstDraggedBlockIndex, 55950 collapse, 55951 collapseAll, 55952 BlockSettingsMenu, 55953 instanceId, 55954 AdditionalBlockContent, 55955 insertedBlock, 55956 setInsertedBlock, 55957 rootClientId 55958 ] 55959 ); 55960 const [fixedListWindow] = (0,external_wp_compose_namespaceObject.__experimentalUseFixedWindowList)( 55961 elementRef, 55962 BLOCK_LIST_ITEM_HEIGHT, 55963 visibleBlockCount, 55964 { 55965 // Ensure that the windowing logic is recalculated when the expanded state changes. 55966 // This is necessary because expanding a collapsed block in a short list view can 55967 // switch the list view to a tall list view with a scrollbar, and vice versa. 55968 // When this happens, the windowing logic needs to be recalculated to ensure that 55969 // the correct number of blocks are rendered, by rechecking for a scroll container. 55970 expandedState, 55971 useWindowing: true, 55972 windowOverscan: 40 55973 } 55974 ); 55975 if (!clientIdsTree.length && !showAppender) { 55976 return null; 55977 } 55978 const describedById = description && `block-editor-list-view-description-$instanceId}`; 55979 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_data_namespaceObject.AsyncModeProvider, { value: true, children: [ 55980 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 55981 ListViewDropIndicatorPreview, 55982 { 55983 draggedBlockClientId: firstDraggedBlockClientId, 55984 listViewRef: elementRef, 55985 blockDropTarget 55986 } 55987 ), 55988 description && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, { id: describedById, children: description }), 55989 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 55990 external_wp_components_namespaceObject.__experimentalTreeGrid, 55991 { 55992 id, 55993 className: dist_clsx("block-editor-list-view-tree", { 55994 "is-dragging": draggedClientIds?.length > 0 && blockDropTargetIndex !== void 0 55995 }), 55996 "aria-label": (0,external_wp_i18n_namespaceObject.__)("Block navigation structure"), 55997 ref: treeGridRef, 55998 onCollapseRow: collapseRow, 55999 onExpandRow: expandRow, 56000 onFocusRow: focusRow, 56001 applicationAriaLabel: (0,external_wp_i18n_namespaceObject.__)("Block navigation structure"), 56002 "aria-describedby": describedById, 56003 style: { 56004 "--wp-admin--list-view-dragged-items-height": draggedClientIds?.length ? `$BLOCK_LIST_ITEM_HEIGHT * (draggedClientIds.length - 1)}px` : null 56005 }, 56006 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ListViewContext.Provider, { value: contextValue, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 56007 branch_default, 56008 { 56009 blocks: clientIdsTree, 56010 parentId: rootClientId, 56011 selectBlock: selectEditorBlock, 56012 showBlockMovers, 56013 fixedListWindow, 56014 selectedClientIds, 56015 isExpanded, 56016 showAppender 56017 } 56018 ) }) 56019 } 56020 ) 56021 ] }); 56022 } 56023 const PrivateListView = (0,external_wp_element_namespaceObject.forwardRef)(ListViewComponent); 56024 var list_view_list_view_default = (0,external_wp_element_namespaceObject.forwardRef)((props, ref) => { 56025 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 56026 PrivateListView, 56027 { 56028 ref, 56029 ...props, 56030 showAppender: false, 56031 rootClientId: null, 56032 onSelect: null, 56033 additionalBlockContent: null, 56034 blockSettingsMenu: void 0 56035 } 56036 ); 56037 }); 56038 56039 56040 ;// ./node_modules/@wordpress/block-editor/build-module/components/block-navigation/dropdown.js 56041 56042 56043 56044 56045 56046 56047 56048 56049 56050 function BlockNavigationDropdownToggle({ 56051 isEnabled, 56052 onToggle, 56053 isOpen, 56054 innerRef, 56055 ...props 56056 }) { 56057 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 56058 external_wp_components_namespaceObject.Button, 56059 { 56060 __next40pxDefaultSize: true, 56061 ...props, 56062 ref: innerRef, 56063 icon: list_view_default, 56064 "aria-expanded": isOpen, 56065 "aria-haspopup": "true", 56066 onClick: isEnabled ? onToggle : void 0, 56067 label: (0,external_wp_i18n_namespaceObject.__)("List view"), 56068 className: "block-editor-block-navigation", 56069 "aria-disabled": !isEnabled 56070 } 56071 ); 56072 } 56073 function BlockNavigationDropdown({ isDisabled, ...props }, ref) { 56074 external_wp_deprecated_default()("wp.blockEditor.BlockNavigationDropdown", { 56075 since: "6.1", 56076 alternative: "wp.components.Dropdown and wp.blockEditor.ListView" 56077 }); 56078 const hasBlocks = (0,external_wp_data_namespaceObject.useSelect)( 56079 (select) => !!select(store).getBlockCount(), 56080 [] 56081 ); 56082 const isEnabled = hasBlocks && !isDisabled; 56083 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 56084 external_wp_components_namespaceObject.Dropdown, 56085 { 56086 contentClassName: "block-editor-block-navigation__popover", 56087 popoverProps: { placement: "bottom-start" }, 56088 renderToggle: ({ isOpen, onToggle }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 56089 BlockNavigationDropdownToggle, 56090 { 56091 ...props, 56092 innerRef: ref, 56093 isOpen, 56094 onToggle, 56095 isEnabled 56096 } 56097 ), 56098 renderContent: () => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-editor-block-navigation__container", children: [ 56099 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { className: "block-editor-block-navigation__label", children: (0,external_wp_i18n_namespaceObject.__)("List view") }), 56100 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(list_view_list_view_default, {}) 56101 ] }) 56102 } 56103 ); 56104 } 56105 var dropdown_default = (0,external_wp_element_namespaceObject.forwardRef)(BlockNavigationDropdown); 56106 56107 56108 ;// ./node_modules/@wordpress/block-editor/build-module/components/block-styles/preview-panel.js 56109 56110 56111 56112 56113 56114 function BlockStylesPreviewPanel({ 56115 genericPreviewBlock, 56116 style, 56117 className, 56118 activeStyle 56119 }) { 56120 const example = (0,external_wp_blocks_namespaceObject.getBlockType)(genericPreviewBlock.name)?.example; 56121 const styleClassName = replaceActiveStyle(className, activeStyle, style); 56122 const previewBlocks = (0,external_wp_element_namespaceObject.useMemo)(() => { 56123 return { 56124 ...genericPreviewBlock, 56125 title: style.label || style.name, 56126 description: style.description, 56127 initialAttributes: { 56128 ...genericPreviewBlock.attributes, 56129 className: styleClassName + " block-editor-block-styles__block-preview-container" 56130 }, 56131 example 56132 }; 56133 }, [genericPreviewBlock, styleClassName]); 56134 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(preview_panel_default, { item: previewBlocks }); 56135 } 56136 56137 56138 ;// ./node_modules/@wordpress/block-editor/build-module/components/block-styles/index.js 56139 56140 56141 56142 56143 56144 56145 56146 const block_styles_noop = () => { 56147 }; 56148 function BlockStyles({ clientId, onSwitch = block_styles_noop, onHoverClassName = block_styles_noop }) { 56149 const { 56150 onSelect, 56151 stylesToRender, 56152 activeStyle, 56153 genericPreviewBlock, 56154 className: previewClassName 56155 } = useStylesForBlocks({ 56156 clientId, 56157 onSwitch 56158 }); 56159 const [hoveredStyle, setHoveredStyle] = (0,external_wp_element_namespaceObject.useState)(null); 56160 const isMobileViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)("medium", "<"); 56161 if (!stylesToRender || stylesToRender.length === 0) { 56162 return null; 56163 } 56164 const debouncedSetHoveredStyle = (0,external_wp_compose_namespaceObject.debounce)(setHoveredStyle, 250); 56165 const onSelectStylePreview = (style) => { 56166 onSelect(style); 56167 onHoverClassName(null); 56168 setHoveredStyle(null); 56169 debouncedSetHoveredStyle.cancel(); 56170 }; 56171 const styleItemHandler = (item) => { 56172 if (hoveredStyle === item) { 56173 debouncedSetHoveredStyle.cancel(); 56174 return; 56175 } 56176 debouncedSetHoveredStyle(item); 56177 onHoverClassName(item?.name ?? null); 56178 }; 56179 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-editor-block-styles", children: [ 56180 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-block-styles__variants", children: stylesToRender.map((style) => { 56181 const buttonText = style.label || style.name; 56182 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 56183 external_wp_components_namespaceObject.Button, 56184 { 56185 __next40pxDefaultSize: true, 56186 className: dist_clsx( 56187 "block-editor-block-styles__item", 56188 { 56189 "is-active": activeStyle.name === style.name 56190 } 56191 ), 56192 variant: "secondary", 56193 label: buttonText, 56194 onMouseEnter: () => styleItemHandler(style), 56195 onFocus: () => styleItemHandler(style), 56196 onMouseLeave: () => styleItemHandler(null), 56197 onBlur: () => styleItemHandler(null), 56198 onClick: () => onSelectStylePreview(style), 56199 "aria-current": activeStyle.name === style.name, 56200 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 56201 external_wp_components_namespaceObject.__experimentalTruncate, 56202 { 56203 numberOfLines: 1, 56204 className: "block-editor-block-styles__item-text", 56205 children: buttonText 56206 } 56207 ) 56208 }, 56209 style.name 56210 ); 56211 }) }), 56212 hoveredStyle && !isMobileViewport && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 56213 external_wp_components_namespaceObject.Popover, 56214 { 56215 placement: "left-start", 56216 offset: 34, 56217 focusOnMount: false, 56218 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 56219 "div", 56220 { 56221 className: "block-editor-block-styles__preview-panel", 56222 onMouseLeave: () => styleItemHandler(null), 56223 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 56224 BlockStylesPreviewPanel, 56225 { 56226 activeStyle, 56227 className: previewClassName, 56228 genericPreviewBlock, 56229 style: hoveredStyle 56230 } 56231 ) 56232 } 56233 ) 56234 } 56235 ) 56236 ] }); 56237 } 56238 var block_styles_default = BlockStyles; 56239 56240 56241 ;// ./node_modules/@wordpress/icons/build-module/library/paragraph.js 56242 56243 56244 var paragraph_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "m9.99609 14v-.2251l.00391.0001v6.225h1.5v-14.5h2.5v14.5h1.5v-14.5h3v-1.5h-8.50391c-2.76142 0-5 2.23858-5 5 0 2.7614 2.23858 5 5 5z" }) }); 56245 56246 56247 ;// ./node_modules/@wordpress/icons/build-module/library/heading-level-1.js 56248 56249 56250 var heading_level_1_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M17.6 7c-.6.9-1.5 1.7-2.6 2v1h2v7h2V7h-1.4zM11 11H7V7H5v10h2v-4h4v4h2V7h-2v4z" }) }); 56251 56252 56253 ;// ./node_modules/@wordpress/icons/build-module/library/heading-level-2.js 56254 56255 56256 var heading_level_2_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M9 11.1H5v-4H3v10h2v-4h4v4h2v-10H9v4zm8 4c.5-.4.6-.6 1.1-1.1.4-.4.8-.8 1.2-1.3.3-.4.6-.8.9-1.3.2-.4.3-.8.3-1.3 0-.4-.1-.9-.3-1.3-.2-.4-.4-.7-.8-1-.3-.3-.7-.5-1.2-.6-.5-.2-1-.2-1.5-.2-.4 0-.7 0-1.1.1-.3.1-.7.2-1 .3-.3.1-.6.3-.9.5-.3.2-.6.4-.8.7l1.2 1.2c.3-.3.6-.5 1-.7.4-.2.7-.3 1.2-.3s.9.1 1.3.4c.3.3.5.7.5 1.1 0 .4-.1.8-.4 1.1-.3.5-.6.9-1 1.2-.4.4-1 .9-1.6 1.4-.6.5-1.4 1.1-2.2 1.6v1.5h8v-2H17z" }) }); 56257 56258 56259 ;// ./node_modules/@wordpress/icons/build-module/library/heading-level-3.js 56260 56261 56262 var heading_level_3_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M9 11H5V7H3v10h2v-4h4v4h2V7H9v4zm11.3 1.7c-.4-.4-1-.7-1.6-.8v-.1c.6-.2 1.1-.5 1.5-.9.3-.4.5-.8.5-1.3 0-.4-.1-.8-.3-1.1-.2-.3-.5-.6-.8-.8-.4-.2-.8-.4-1.2-.5-.6-.1-1.1-.2-1.6-.2-.6 0-1.3.1-1.8.3s-1.1.5-1.6.9l1.2 1.4c.4-.2.7-.4 1.1-.6.3-.2.7-.3 1.1-.3.4 0 .8.1 1.1.3.3.2.4.5.4.8 0 .4-.2.7-.6.9-.7.3-1.5.5-2.2.4v1.6c.5 0 1 0 1.5.1.3.1.7.2 1 .3.2.1.4.2.5.4s.1.4.1.6c0 .3-.2.7-.5.8-.4.2-.9.3-1.4.3s-1-.1-1.4-.3c-.4-.2-.8-.4-1.2-.7L13 15.6c.5.4 1 .8 1.6 1 .7.3 1.5.4 2.3.4.6 0 1.1-.1 1.6-.2.4-.1.9-.2 1.3-.5.4-.2.7-.5.9-.9.2-.4.3-.8.3-1.2 0-.6-.3-1.1-.7-1.5z" }) }); 56263 56264 56265 ;// ./node_modules/@wordpress/icons/build-module/library/heading-level-4.js 56266 56267 56268 var heading_level_4_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M20 13V7h-3l-4 6v2h5v2h2v-2h1v-2h-1zm-2 0h-2.8L18 9v4zm-9-2H5V7H3v10h2v-4h4v4h2V7H9v4z" }) }); 56269 56270 56271 ;// ./node_modules/@wordpress/icons/build-module/library/heading-level-5.js 56272 56273 56274 var heading_level_5_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M9 11H5V7H3v10h2v-4h4v4h2V7H9v4zm11.7 1.2c-.2-.3-.5-.7-.8-.9-.3-.3-.7-.5-1.1-.6-.5-.1-.9-.2-1.4-.2-.2 0-.5.1-.7.1-.2.1-.5.1-.7.2l.1-1.9h4.3V7H14l-.3 5 1 .6.5-.2.4-.1c.1-.1.3-.1.4-.1h.5c.5 0 1 .1 1.4.4.4.2.6.7.6 1.1 0 .4-.2.8-.6 1.1-.4.3-.9.4-1.4.4-.4 0-.9-.1-1.3-.3-.4-.2-.7-.4-1.1-.7 0 0-1.1 1.4-1 1.5.5.4 1 .8 1.6 1 .7.3 1.5.4 2.3.4.5 0 1-.1 1.5-.3s.9-.4 1.3-.7c.4-.3.7-.7.9-1.1s.3-.9.3-1.4-.1-1-.3-1.4z" }) }); 56275 56276 56277 ;// ./node_modules/@wordpress/icons/build-module/library/heading-level-6.js 56278 56279 56280 var heading_level_6_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M20.7 12.4c-.2-.3-.4-.6-.7-.9s-.6-.5-1-.6c-.4-.2-.8-.2-1.2-.2-.5 0-.9.1-1.3.3s-.8.5-1.2.8c0-.5 0-.9.2-1.4l.6-.9c.2-.2.5-.4.8-.5.6-.2 1.3-.2 1.9 0 .3.1.6.3.8.5 0 0 1.3-1.3 1.3-1.4-.4-.3-.9-.6-1.4-.8-.6-.2-1.3-.3-2-.3-.6 0-1.1.1-1.7.4-.5.2-1 .5-1.4.9-.4.4-.8 1-1 1.6-.3.7-.4 1.5-.4 2.3s.1 1.5.3 2.1c.2.6.6 1.1 1 1.5.4.4.9.7 1.4.9 1 .3 2 .3 3 0 .4-.1.8-.3 1.2-.6.3-.3.6-.6.8-1 .2-.5.3-.9.3-1.4s-.1-.9-.3-1.3zm-2 2.1c-.1.2-.3.4-.4.5-.1.1-.3.2-.5.2-.2.1-.4.1-.6.1-.2.1-.5 0-.7-.1-.2 0-.3-.2-.5-.3-.1-.2-.3-.4-.4-.6-.2-.3-.3-.7-.3-1 .3-.3.6-.5 1-.7.3-.1.7-.2 1-.2.4 0 .8.1 1.1.3.3.3.4.7.4 1.1 0 .2 0 .5-.1.7zM9 11H5V7H3v10h2v-4h4v4h2V7H9v4z" }) }); 56281 56282 56283 ;// ./node_modules/@wordpress/block-editor/build-module/components/block-heading-level-dropdown/heading-level-icon.js 56284 56285 56286 56287 const LEVEL_TO_PATH = { 56288 0: paragraph_default, 56289 1: heading_level_1_default, 56290 2: heading_level_2_default, 56291 3: heading_level_3_default, 56292 4: heading_level_4_default, 56293 5: heading_level_5_default, 56294 6: heading_level_6_default 56295 }; 56296 function HeadingLevelIcon({ level }) { 56297 if (LEVEL_TO_PATH[level]) { 56298 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { icon: LEVEL_TO_PATH[level] }); 56299 } 56300 return null; 56301 } 56302 56303 56304 ;// ./node_modules/@wordpress/block-editor/build-module/components/block-heading-level-dropdown/index.js 56305 56306 56307 56308 56309 const HEADING_LEVELS = [1, 2, 3, 4, 5, 6]; 56310 const block_heading_level_dropdown_POPOVER_PROPS = { 56311 className: "block-library-heading-level-dropdown" 56312 }; 56313 function HeadingLevelDropdown({ 56314 options = HEADING_LEVELS, 56315 value, 56316 onChange 56317 }) { 56318 const validOptions = options.filter( 56319 (option) => option === 0 || HEADING_LEVELS.includes(option) 56320 ).sort((a, b) => a - b); 56321 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 56322 external_wp_components_namespaceObject.ToolbarDropdownMenu, 56323 { 56324 popoverProps: block_heading_level_dropdown_POPOVER_PROPS, 56325 icon: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(HeadingLevelIcon, { level: value }), 56326 label: (0,external_wp_i18n_namespaceObject.__)("Change level"), 56327 controls: validOptions.map((targetLevel) => { 56328 const isActive = targetLevel === value; 56329 return { 56330 icon: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(HeadingLevelIcon, { level: targetLevel }), 56331 title: targetLevel === 0 ? (0,external_wp_i18n_namespaceObject.__)("Paragraph") : (0,external_wp_i18n_namespaceObject.sprintf)( 56332 // translators: %d: heading level e.g: "1", "2", "3" 56333 (0,external_wp_i18n_namespaceObject.__)("Heading %d"), 56334 targetLevel 56335 ), 56336 isActive, 56337 onClick() { 56338 onChange(targetLevel); 56339 }, 56340 role: "menuitemradio" 56341 }; 56342 }) 56343 } 56344 ); 56345 } 56346 56347 56348 ;// ./node_modules/@wordpress/icons/build-module/library/layout.js 56349 56350 56351 var layout_layout_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 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" }) }); 56352 56353 56354 ;// ./node_modules/@wordpress/block-editor/build-module/components/block-variation-picker/index.js 56355 56356 56357 56358 56359 56360 function BlockVariationPicker({ 56361 icon = layout_layout_default, 56362 label = (0,external_wp_i18n_namespaceObject.__)("Choose variation"), 56363 instructions = (0,external_wp_i18n_namespaceObject.__)("Select a variation to start with:"), 56364 variations, 56365 onSelect, 56366 allowSkip 56367 }) { 56368 const classes = dist_clsx("block-editor-block-variation-picker", { 56369 "has-many-variations": variations.length > 4 56370 }); 56371 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 56372 external_wp_components_namespaceObject.Placeholder, 56373 { 56374 icon, 56375 label, 56376 instructions, 56377 className: classes, 56378 children: [ 56379 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 56380 "ul", 56381 { 56382 className: "block-editor-block-variation-picker__variations", 56383 role: "list", 56384 "aria-label": (0,external_wp_i18n_namespaceObject.__)("Block variations"), 56385 children: variations.map((variation) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("li", { children: [ 56386 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 56387 external_wp_components_namespaceObject.Button, 56388 { 56389 __next40pxDefaultSize: true, 56390 variant: "tertiary", 56391 icon: variation.icon && variation.icon.src ? variation.icon.src : variation.icon, 56392 iconSize: 48, 56393 onClick: () => onSelect(variation), 56394 className: "block-editor-block-variation-picker__variation", 56395 label: variation.description || variation.title 56396 } 56397 ), 56398 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "block-editor-block-variation-picker__variation-label", children: variation.title }) 56399 ] }, variation.name)) 56400 } 56401 ), 56402 allowSkip && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-block-variation-picker__skip", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 56403 external_wp_components_namespaceObject.Button, 56404 { 56405 __next40pxDefaultSize: true, 56406 variant: "link", 56407 onClick: () => onSelect(), 56408 children: (0,external_wp_i18n_namespaceObject.__)("Skip") 56409 } 56410 ) }) 56411 ] 56412 } 56413 ); 56414 } 56415 var block_variation_picker_default = BlockVariationPicker; 56416 56417 56418 ;// ./node_modules/@wordpress/block-editor/build-module/components/block-pattern-setup/constants.js 56419 const VIEWMODES = { 56420 carousel: "carousel", 56421 grid: "grid" 56422 }; 56423 56424 56425 ;// ./node_modules/@wordpress/block-editor/build-module/components/block-pattern-setup/setup-toolbar.js 56426 56427 56428 56429 56430 56431 const Actions = ({ onBlockPatternSelect }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-block-pattern-setup__actions", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 56432 external_wp_components_namespaceObject.Button, 56433 { 56434 __next40pxDefaultSize: true, 56435 variant: "primary", 56436 onClick: onBlockPatternSelect, 56437 children: (0,external_wp_i18n_namespaceObject.__)("Choose") 56438 } 56439 ) }); 56440 const CarouselNavigation = ({ 56441 handlePrevious, 56442 handleNext, 56443 activeSlide, 56444 totalSlides 56445 }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-editor-block-pattern-setup__navigation", children: [ 56446 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 56447 external_wp_components_namespaceObject.Button, 56448 { 56449 size: "compact", 56450 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_right_default : chevron_left_default, 56451 label: (0,external_wp_i18n_namespaceObject.__)("Previous pattern"), 56452 onClick: handlePrevious, 56453 disabled: activeSlide === 0, 56454 accessibleWhenDisabled: true 56455 } 56456 ), 56457 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 56458 external_wp_components_namespaceObject.Button, 56459 { 56460 size: "compact", 56461 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left_default : chevron_right_default, 56462 label: (0,external_wp_i18n_namespaceObject.__)("Next pattern"), 56463 onClick: handleNext, 56464 disabled: activeSlide === totalSlides - 1, 56465 accessibleWhenDisabled: true 56466 } 56467 ) 56468 ] }); 56469 const SetupToolbar = ({ 56470 viewMode, 56471 setViewMode, 56472 handlePrevious, 56473 handleNext, 56474 activeSlide, 56475 totalSlides, 56476 onBlockPatternSelect 56477 }) => { 56478 const isCarouselView = viewMode === VIEWMODES.carousel; 56479 const displayControls = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-editor-block-pattern-setup__display-controls", children: [ 56480 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 56481 external_wp_components_namespaceObject.Button, 56482 { 56483 size: "compact", 56484 icon: stretch_full_width_default, 56485 label: (0,external_wp_i18n_namespaceObject.__)("Carousel view"), 56486 onClick: () => setViewMode(VIEWMODES.carousel), 56487 isPressed: isCarouselView 56488 } 56489 ), 56490 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 56491 external_wp_components_namespaceObject.Button, 56492 { 56493 size: "compact", 56494 icon: grid_grid_default, 56495 label: (0,external_wp_i18n_namespaceObject.__)("Grid view"), 56496 onClick: () => setViewMode(VIEWMODES.grid), 56497 isPressed: viewMode === VIEWMODES.grid 56498 } 56499 ) 56500 ] }); 56501 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-editor-block-pattern-setup__toolbar", children: [ 56502 isCarouselView && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 56503 CarouselNavigation, 56504 { 56505 handlePrevious, 56506 handleNext, 56507 activeSlide, 56508 totalSlides 56509 } 56510 ), 56511 displayControls, 56512 isCarouselView && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Actions, { onBlockPatternSelect }) 56513 ] }); 56514 }; 56515 var setup_toolbar_default = SetupToolbar; 56516 56517 56518 ;// ./node_modules/@wordpress/block-editor/build-module/components/block-pattern-setup/use-patterns-setup.js 56519 56520 56521 function usePatternsSetup(clientId, blockName, filterPatternsFn) { 56522 return (0,external_wp_data_namespaceObject.useSelect)( 56523 (select) => { 56524 const { 56525 getBlockRootClientId, 56526 getPatternsByBlockTypes, 56527 __experimentalGetAllowedPatterns 56528 } = select(store); 56529 const rootClientId = getBlockRootClientId(clientId); 56530 if (filterPatternsFn) { 56531 return __experimentalGetAllowedPatterns(rootClientId).filter( 56532 filterPatternsFn 56533 ); 56534 } 56535 return getPatternsByBlockTypes(blockName, rootClientId); 56536 }, 56537 [clientId, blockName, filterPatternsFn] 56538 ); 56539 } 56540 var use_patterns_setup_default = usePatternsSetup; 56541 56542 56543 ;// ./node_modules/@wordpress/block-editor/build-module/components/block-pattern-setup/index.js 56544 56545 56546 56547 56548 56549 56550 56551 56552 56553 56554 56555 56556 const SetupContent = ({ 56557 viewMode, 56558 activeSlide, 56559 patterns, 56560 onBlockPatternSelect, 56561 showTitles 56562 }) => { 56563 const containerClass = "block-editor-block-pattern-setup__container"; 56564 if (viewMode === VIEWMODES.carousel) { 56565 const slideClass = /* @__PURE__ */ new Map([ 56566 [activeSlide, "active-slide"], 56567 [activeSlide - 1, "previous-slide"], 56568 [activeSlide + 1, "next-slide"] 56569 ]); 56570 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-block-pattern-setup__carousel", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: containerClass, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "carousel-container", children: patterns.map((pattern, index) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 56571 BlockPatternSlide, 56572 { 56573 active: index === activeSlide, 56574 className: slideClass.get(index) || "", 56575 pattern 56576 }, 56577 pattern.name 56578 )) }) }) }); 56579 } 56580 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-block-pattern-setup__grid", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 56581 external_wp_components_namespaceObject.Composite, 56582 { 56583 role: "listbox", 56584 className: containerClass, 56585 "aria-label": (0,external_wp_i18n_namespaceObject.__)("Patterns list"), 56586 children: patterns.map((pattern) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 56587 block_pattern_setup_BlockPattern, 56588 { 56589 pattern, 56590 onSelect: onBlockPatternSelect, 56591 showTitles 56592 }, 56593 pattern.name 56594 )) 56595 } 56596 ) }); 56597 }; 56598 function block_pattern_setup_BlockPattern({ pattern, onSelect, showTitles }) { 56599 const baseClassName = "block-editor-block-pattern-setup-list"; 56600 const { blocks, description, viewportWidth = 700 } = pattern; 56601 const descriptionId = (0,external_wp_compose_namespaceObject.useInstanceId)( 56602 block_pattern_setup_BlockPattern, 56603 `$baseClassName}__item-description` 56604 ); 56605 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: `$baseClassName}__list-item`, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 56606 external_wp_components_namespaceObject.Composite.Item, 56607 { 56608 render: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 56609 "div", 56610 { 56611 "aria-describedby": description ? descriptionId : void 0, 56612 "aria-label": pattern.title, 56613 className: `$baseClassName}__item` 56614 } 56615 ), 56616 id: `$baseClassName}__pattern__$pattern.name}`, 56617 role: "option", 56618 onClick: () => onSelect(blocks), 56619 children: [ 56620 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 56621 block_preview_default, 56622 { 56623 blocks, 56624 viewportWidth 56625 } 56626 ), 56627 showTitles && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: `$baseClassName}__item-title`, children: pattern.title }), 56628 !!description && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, { id: descriptionId, children: description }) 56629 ] 56630 } 56631 ) }); 56632 } 56633 function BlockPatternSlide({ active, className, pattern, minHeight }) { 56634 const { blocks, title, description } = pattern; 56635 const descriptionId = (0,external_wp_compose_namespaceObject.useInstanceId)( 56636 BlockPatternSlide, 56637 "block-editor-block-pattern-setup-list__item-description" 56638 ); 56639 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 56640 "div", 56641 { 56642 "aria-hidden": !active, 56643 role: "img", 56644 className: `pattern-slide $className}`, 56645 "aria-label": title, 56646 "aria-describedby": description ? descriptionId : void 0, 56647 children: [ 56648 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(block_preview_default, { blocks, minHeight }), 56649 !!description && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, { id: descriptionId, children: description }) 56650 ] 56651 } 56652 ); 56653 } 56654 const BlockPatternSetup = ({ 56655 clientId, 56656 blockName, 56657 filterPatternsFn, 56658 onBlockPatternSelect, 56659 initialViewMode = VIEWMODES.carousel, 56660 showTitles = false 56661 }) => { 56662 const [viewMode, setViewMode] = (0,external_wp_element_namespaceObject.useState)(initialViewMode); 56663 const [activeSlide, setActiveSlide] = (0,external_wp_element_namespaceObject.useState)(0); 56664 const { replaceBlock } = (0,external_wp_data_namespaceObject.useDispatch)(store); 56665 const patterns = use_patterns_setup_default(clientId, blockName, filterPatternsFn); 56666 if (!patterns?.length) { 56667 return null; 56668 } 56669 const onBlockPatternSelectDefault = (blocks) => { 56670 const clonedBlocks = blocks.map((block) => (0,external_wp_blocks_namespaceObject.cloneBlock)(block)); 56671 replaceBlock(clientId, clonedBlocks); 56672 }; 56673 const onPatternSelectCallback = onBlockPatternSelect || onBlockPatternSelectDefault; 56674 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 56675 "div", 56676 { 56677 className: `block-editor-block-pattern-setup view-mode-$viewMode}`, 56678 children: [ 56679 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 56680 SetupContent, 56681 { 56682 viewMode, 56683 activeSlide, 56684 patterns, 56685 onBlockPatternSelect: onPatternSelectCallback, 56686 showTitles 56687 } 56688 ), 56689 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 56690 setup_toolbar_default, 56691 { 56692 viewMode, 56693 setViewMode, 56694 activeSlide, 56695 totalSlides: patterns.length, 56696 handleNext: () => { 56697 setActiveSlide( 56698 (active) => Math.min(active + 1, patterns.length - 1) 56699 ); 56700 }, 56701 handlePrevious: () => { 56702 setActiveSlide( 56703 (active) => Math.max(active - 1, 0) 56704 ); 56705 }, 56706 onBlockPatternSelect: () => { 56707 onPatternSelectCallback( 56708 patterns[activeSlide].blocks 56709 ); 56710 } 56711 } 56712 ) 56713 ] 56714 } 56715 ) }); 56716 }; 56717 var block_pattern_setup_default = BlockPatternSetup; 56718 56719 56720 ;// ./node_modules/@wordpress/block-editor/build-module/components/block-variation-transforms/index.js 56721 56722 56723 56724 56725 56726 56727 56728 56729 56730 56731 function VariationsButtons({ 56732 className, 56733 onSelectVariation, 56734 selectedValue, 56735 variations 56736 }) { 56737 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("fieldset", { className, children: [ 56738 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, { as: "legend", children: (0,external_wp_i18n_namespaceObject.__)("Transform to variation") }), 56739 variations.map((variation) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 56740 external_wp_components_namespaceObject.Button, 56741 { 56742 __next40pxDefaultSize: true, 56743 size: "compact", 56744 icon: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(block_icon_default, { icon: variation.icon, showColors: true }), 56745 isPressed: selectedValue === variation.name, 56746 label: selectedValue === variation.name ? variation.title : (0,external_wp_i18n_namespaceObject.sprintf)( 56747 /* translators: %s: Block or block variation name. */ 56748 (0,external_wp_i18n_namespaceObject.__)("Transform to %s"), 56749 variation.title 56750 ), 56751 onClick: () => onSelectVariation(variation.name), 56752 "aria-label": variation.title, 56753 showTooltip: true 56754 }, 56755 variation.name 56756 )) 56757 ] }); 56758 } 56759 function VariationsDropdown({ 56760 className, 56761 onSelectVariation, 56762 selectedValue, 56763 variations 56764 }) { 56765 const selectOptions = variations.map( 56766 ({ name, title, description }) => ({ 56767 value: name, 56768 label: title, 56769 info: description 56770 }) 56771 ); 56772 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 56773 external_wp_components_namespaceObject.DropdownMenu, 56774 { 56775 className, 56776 label: (0,external_wp_i18n_namespaceObject.__)("Transform to variation"), 56777 text: (0,external_wp_i18n_namespaceObject.__)("Transform to variation"), 56778 popoverProps: { 56779 position: "bottom center", 56780 className: `$className}__popover` 56781 }, 56782 icon: chevron_down_default, 56783 toggleProps: { iconPosition: "right" }, 56784 children: () => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuGroup, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 56785 external_wp_components_namespaceObject.MenuItemsChoice, 56786 { 56787 choices: selectOptions, 56788 value: selectedValue, 56789 onSelect: onSelectVariation 56790 } 56791 ) }) 56792 } 56793 ); 56794 } 56795 function VariationsToggleGroupControl({ 56796 className, 56797 onSelectVariation, 56798 selectedValue, 56799 variations 56800 }) { 56801 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 56802 external_wp_components_namespaceObject.__experimentalToggleGroupControl, 56803 { 56804 label: (0,external_wp_i18n_namespaceObject.__)("Transform to variation"), 56805 value: selectedValue, 56806 hideLabelFromVision: true, 56807 onChange: onSelectVariation, 56808 __next40pxDefaultSize: true, 56809 __nextHasNoMarginBottom: true, 56810 children: variations.map((variation) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 56811 external_wp_components_namespaceObject.__experimentalToggleGroupControlOptionIcon, 56812 { 56813 icon: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(block_icon_default, { icon: variation.icon, showColors: true }), 56814 value: variation.name, 56815 label: selectedValue === variation.name ? variation.title : (0,external_wp_i18n_namespaceObject.sprintf)( 56816 /* translators: %s: Block or block variation name. */ 56817 (0,external_wp_i18n_namespaceObject.__)("Transform to %s"), 56818 variation.title 56819 ) 56820 }, 56821 variation.name 56822 )) 56823 } 56824 ) }); 56825 } 56826 function __experimentalBlockVariationTransforms({ blockClientId }) { 56827 const { updateBlockAttributes } = (0,external_wp_data_namespaceObject.useDispatch)(store); 56828 const { activeBlockVariation, variations, isContentOnly, isSection } = (0,external_wp_data_namespaceObject.useSelect)( 56829 (select) => { 56830 const { getActiveBlockVariation, getBlockVariations } = select(external_wp_blocks_namespaceObject.store); 56831 const { 56832 getBlockName, 56833 getBlockAttributes, 56834 getBlockEditingMode, 56835 isSectionBlock 56836 } = unlock(select(store)); 56837 const name = blockClientId && getBlockName(blockClientId); 56838 const { hasContentRoleAttribute } = unlock( 56839 select(external_wp_blocks_namespaceObject.store) 56840 ); 56841 const isContentBlock = hasContentRoleAttribute(name); 56842 return { 56843 activeBlockVariation: getActiveBlockVariation( 56844 name, 56845 getBlockAttributes(blockClientId), 56846 "transform" 56847 ), 56848 variations: name && getBlockVariations(name, "transform"), 56849 isContentOnly: getBlockEditingMode(blockClientId) === "contentOnly" && !isContentBlock, 56850 isSection: isSectionBlock(blockClientId) 56851 }; 56852 }, 56853 [blockClientId] 56854 ); 56855 const selectedValue = activeBlockVariation?.name; 56856 const hasUniqueIcons = (0,external_wp_element_namespaceObject.useMemo)(() => { 56857 const variationIcons = /* @__PURE__ */ new Set(); 56858 if (!variations) { 56859 return false; 56860 } 56861 variations.forEach((variation) => { 56862 if (variation.icon) { 56863 variationIcons.add(variation.icon?.src || variation.icon); 56864 } 56865 }); 56866 return variationIcons.size === variations.length; 56867 }, [variations]); 56868 const onSelectVariation = (variationName) => { 56869 updateBlockAttributes(blockClientId, { 56870 ...variations.find(({ name }) => name === variationName).attributes 56871 }); 56872 }; 56873 const hideVariationsForSections = window?.__experimentalContentOnlyPatternInsertion && isSection; 56874 if (!variations?.length || isContentOnly || hideVariationsForSections) { 56875 return null; 56876 } 56877 const baseClass = "block-editor-block-variation-transforms"; 56878 const showButtons = variations.length > 5; 56879 const ButtonComponent = showButtons ? VariationsButtons : VariationsToggleGroupControl; 56880 const Component = hasUniqueIcons ? ButtonComponent : VariationsDropdown; 56881 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 56882 Component, 56883 { 56884 className: baseClass, 56885 onSelectVariation, 56886 selectedValue, 56887 variations 56888 } 56889 ); 56890 } 56891 var block_variation_transforms_default = __experimentalBlockVariationTransforms; 56892 56893 56894 ;// ./node_modules/@wordpress/block-editor/build-module/components/color-palette/with-color-context.js 56895 56896 56897 56898 var with_color_context_default = (0,external_wp_compose_namespaceObject.createHigherOrderComponent)((WrappedComponent) => { 56899 return (props) => { 56900 const [ 56901 defaultColors, 56902 themeColors, 56903 customColors, 56904 enableCustomColors, 56905 enableDefaultColors 56906 ] = use_settings_useSettings( 56907 "color.palette.default", 56908 "color.palette.theme", 56909 "color.palette.custom", 56910 "color.custom", 56911 "color.defaultPalette" 56912 ); 56913 const _colors = enableDefaultColors ? [ 56914 ...themeColors || [], 56915 ...defaultColors || [], 56916 ...customColors || [] 56917 ] : [...themeColors || [], ...customColors || []]; 56918 const { colors = _colors, disableCustomColors = !enableCustomColors } = props; 56919 const hasColorsToChoose = colors && colors.length > 0 || !disableCustomColors; 56920 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 56921 WrappedComponent, 56922 { 56923 ...{ 56924 ...props, 56925 colors, 56926 disableCustomColors, 56927 hasColorsToChoose 56928 } 56929 } 56930 ); 56931 }; 56932 }, "withColorContext"); 56933 56934 56935 ;// ./node_modules/@wordpress/block-editor/build-module/components/color-palette/index.js 56936 56937 56938 var color_palette_default = with_color_context_default(external_wp_components_namespaceObject.ColorPalette); 56939 56940 56941 ;// ./node_modules/@wordpress/block-editor/build-module/components/color-palette/control.js 56942 56943 56944 function ColorPaletteControl({ 56945 onChange, 56946 value, 56947 ...otherProps 56948 }) { 56949 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 56950 control_default, 56951 { 56952 ...otherProps, 56953 onColorChange: onChange, 56954 colorValue: value, 56955 gradients: [], 56956 disableCustomGradients: true 56957 } 56958 ); 56959 } 56960 56961 56962 ;// external ["wp","date"] 56963 const external_wp_date_namespaceObject = window["wp"]["date"]; 56964 ;// ./node_modules/@wordpress/block-editor/build-module/components/date-format-picker/index.js 56965 56966 56967 56968 56969 56970 const exampleDate = /* @__PURE__ */ new Date(); 56971 exampleDate.setDate(20); 56972 exampleDate.setMonth(exampleDate.getMonth() - 3); 56973 if (exampleDate.getMonth() === 4) { 56974 exampleDate.setMonth(3); 56975 } 56976 function DateFormatPicker({ 56977 format, 56978 defaultFormat, 56979 onChange 56980 }) { 56981 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 56982 external_wp_components_namespaceObject.__experimentalVStack, 56983 { 56984 as: "fieldset", 56985 spacing: 4, 56986 className: "block-editor-date-format-picker", 56987 children: [ 56988 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, { as: "legend", children: (0,external_wp_i18n_namespaceObject.__)("Date format") }), 56989 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 56990 external_wp_components_namespaceObject.ToggleControl, 56991 { 56992 __nextHasNoMarginBottom: true, 56993 label: (0,external_wp_i18n_namespaceObject.__)("Default format"), 56994 help: `${(0,external_wp_i18n_namespaceObject.__)("Example:")} ${(0,external_wp_date_namespaceObject.dateI18n)( 56995 defaultFormat, 56996 exampleDate 56997 )}`, 56998 checked: !format, 56999 onChange: (checked) => onChange(checked ? null : defaultFormat) 57000 } 57001 ), 57002 format && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(NonDefaultControls, { format, onChange }) 57003 ] 57004 } 57005 ); 57006 } 57007 function NonDefaultControls({ format, onChange }) { 57008 const suggestedFormats = [ 57009 .../* @__PURE__ */ new Set([ 57010 /* translators: See https://www.php.net/manual/datetime.format.php */ 57011 "Y-m-d", 57012 /* translators: See https://www.php.net/manual/datetime.format.php */ 57013 (0,external_wp_i18n_namespaceObject._x)("n/j/Y", "short date format"), 57014 /* translators: See https://www.php.net/manual/datetime.format.php */ 57015 (0,external_wp_i18n_namespaceObject._x)("n/j/Y g:i A", "short date format with time"), 57016 /* translators: See https://www.php.net/manual/datetime.format.php */ 57017 (0,external_wp_i18n_namespaceObject._x)("M j, Y", "medium date format"), 57018 /* translators: See https://www.php.net/manual/datetime.format.php */ 57019 (0,external_wp_i18n_namespaceObject._x)("M j, Y g:i A", "medium date format with time"), 57020 /* translators: See https://www.php.net/manual/datetime.format.php */ 57021 (0,external_wp_i18n_namespaceObject._x)("F j, Y", "long date format"), 57022 /* translators: See https://www.php.net/manual/datetime.format.php */ 57023 (0,external_wp_i18n_namespaceObject._x)("M j", "short date format without the year") 57024 ]) 57025 ]; 57026 const suggestedOptions = [ 57027 ...suggestedFormats.map((suggestedFormat, index) => ({ 57028 key: `suggested-$index}`, 57029 name: (0,external_wp_date_namespaceObject.dateI18n)(suggestedFormat, exampleDate), 57030 format: suggestedFormat 57031 })), 57032 { 57033 key: "human-diff", 57034 name: (0,external_wp_date_namespaceObject.humanTimeDiff)(exampleDate), 57035 format: "human-diff" 57036 } 57037 ]; 57038 const customOption = { 57039 key: "custom", 57040 name: (0,external_wp_i18n_namespaceObject.__)("Custom"), 57041 className: "block-editor-date-format-picker__custom-format-select-control__custom-option", 57042 hint: (0,external_wp_i18n_namespaceObject.__)("Enter your own date format") 57043 }; 57044 const [isCustom, setIsCustom] = (0,external_wp_element_namespaceObject.useState)( 57045 () => !!format && !suggestedOptions.some((option) => option.format === format) 57046 ); 57047 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { children: [ 57048 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 57049 external_wp_components_namespaceObject.CustomSelectControl, 57050 { 57051 __next40pxDefaultSize: true, 57052 label: (0,external_wp_i18n_namespaceObject.__)("Choose a format"), 57053 options: [...suggestedOptions, customOption], 57054 value: isCustom ? customOption : suggestedOptions.find( 57055 (option) => option.format === format 57056 ) ?? customOption, 57057 onChange: ({ selectedItem }) => { 57058 if (selectedItem === customOption) { 57059 setIsCustom(true); 57060 } else { 57061 setIsCustom(false); 57062 onChange(selectedItem.format); 57063 } 57064 } 57065 } 57066 ), 57067 isCustom && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 57068 external_wp_components_namespaceObject.TextControl, 57069 { 57070 __next40pxDefaultSize: true, 57071 __nextHasNoMarginBottom: true, 57072 label: (0,external_wp_i18n_namespaceObject.__)("Custom format"), 57073 hideLabelFromVision: true, 57074 help: (0,external_wp_element_namespaceObject.createInterpolateElement)( 57075 (0,external_wp_i18n_namespaceObject.__)( 57076 "Enter a date or time <Link>format string</Link>." 57077 ), 57078 { 57079 Link: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 57080 external_wp_components_namespaceObject.ExternalLink, 57081 { 57082 href: (0,external_wp_i18n_namespaceObject.__)( 57083 "https://wordpress.org/documentation/article/customize-date-and-time-format/" 57084 ) 57085 } 57086 ) 57087 } 57088 ), 57089 value: format, 57090 onChange: (value) => onChange(value) 57091 } 57092 ) 57093 ] }); 57094 } 57095 57096 57097 ;// ./node_modules/@wordpress/block-editor/build-module/components/colors-gradients/dropdown.js 57098 57099 57100 57101 57102 57103 57104 57105 const WithToolsPanelItem = ({ setting, children, panelId, ...props }) => { 57106 const clearValue = () => { 57107 if (setting.colorValue) { 57108 setting.onColorChange(); 57109 } else if (setting.gradientValue) { 57110 setting.onGradientChange(); 57111 } 57112 }; 57113 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 57114 external_wp_components_namespaceObject.__experimentalToolsPanelItem, 57115 { 57116 hasValue: () => { 57117 return !!setting.colorValue || !!setting.gradientValue; 57118 }, 57119 label: setting.label, 57120 onDeselect: clearValue, 57121 isShownByDefault: setting.isShownByDefault !== void 0 ? setting.isShownByDefault : true, 57122 ...props, 57123 className: "block-editor-tools-panel-color-gradient-settings__item", 57124 panelId, 57125 resetAllFilter: setting.resetAllFilter, 57126 children 57127 } 57128 ); 57129 }; 57130 const dropdown_LabeledColorIndicator = ({ colorValue, label }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "flex-start", children: [ 57131 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 57132 external_wp_components_namespaceObject.ColorIndicator, 57133 { 57134 className: "block-editor-panel-color-gradient-settings__color-indicator", 57135 colorValue 57136 } 57137 ), 57138 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 57139 external_wp_components_namespaceObject.FlexItem, 57140 { 57141 className: "block-editor-panel-color-gradient-settings__color-name", 57142 title: label, 57143 children: label 57144 } 57145 ) 57146 ] }); 57147 const dropdown_renderToggle = (settings) => ({ onToggle, isOpen }) => { 57148 const { 57149 clearable, 57150 colorValue, 57151 gradientValue, 57152 onColorChange, 57153 onGradientChange, 57154 label 57155 } = settings; 57156 const colorButtonRef = (0,external_wp_element_namespaceObject.useRef)(void 0); 57157 const toggleProps = { 57158 onClick: onToggle, 57159 className: dist_clsx( 57160 "block-editor-panel-color-gradient-settings__dropdown", 57161 { "is-open": isOpen } 57162 ), 57163 "aria-expanded": isOpen, 57164 ref: colorButtonRef 57165 }; 57166 const clearValue = () => { 57167 if (colorValue) { 57168 onColorChange(); 57169 } else if (gradientValue) { 57170 onGradientChange(); 57171 } 57172 }; 57173 const value = colorValue ?? gradientValue; 57174 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 57175 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, ...toggleProps, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 57176 dropdown_LabeledColorIndicator, 57177 { 57178 colorValue: value, 57179 label 57180 } 57181 ) }), 57182 clearable && value && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 57183 external_wp_components_namespaceObject.Button, 57184 { 57185 __next40pxDefaultSize: true, 57186 label: (0,external_wp_i18n_namespaceObject.__)("Reset"), 57187 className: "block-editor-panel-color-gradient-settings__reset", 57188 size: "small", 57189 icon: reset_default, 57190 onClick: () => { 57191 clearValue(); 57192 if (isOpen) { 57193 onToggle(); 57194 } 57195 colorButtonRef.current?.focus(); 57196 } 57197 } 57198 ) 57199 ] }); 57200 }; 57201 function ColorGradientSettingsDropdown({ 57202 colors, 57203 disableCustomColors, 57204 disableCustomGradients, 57205 enableAlpha, 57206 gradients, 57207 settings, 57208 __experimentalIsRenderedInSidebar, 57209 ...props 57210 }) { 57211 let popoverProps; 57212 if (__experimentalIsRenderedInSidebar) { 57213 popoverProps = { 57214 placement: "left-start", 57215 offset: 36, 57216 shift: true 57217 }; 57218 } 57219 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: settings.map((setting, index) => { 57220 const controlProps = { 57221 clearable: false, 57222 colorValue: setting.colorValue, 57223 colors, 57224 disableCustomColors, 57225 disableCustomGradients, 57226 enableAlpha, 57227 gradientValue: setting.gradientValue, 57228 gradients, 57229 label: setting.label, 57230 onColorChange: setting.onColorChange, 57231 onGradientChange: setting.onGradientChange, 57232 showTitle: false, 57233 __experimentalIsRenderedInSidebar, 57234 ...setting 57235 }; 57236 const toggleSettings = { 57237 clearable: setting.clearable, 57238 label: setting.label, 57239 colorValue: setting.colorValue, 57240 gradientValue: setting.gradientValue, 57241 onColorChange: setting.onColorChange, 57242 onGradientChange: setting.onGradientChange 57243 }; 57244 return setting && // If not in an `ItemGroup` wrap the dropdown in a 57245 // `ToolsPanelItem` 57246 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 57247 WithToolsPanelItem, 57248 { 57249 setting, 57250 ...props, 57251 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 57252 external_wp_components_namespaceObject.Dropdown, 57253 { 57254 popoverProps, 57255 className: "block-editor-tools-panel-color-gradient-settings__dropdown", 57256 renderToggle: dropdown_renderToggle(toggleSettings), 57257 renderContent: () => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalDropdownContentWrapper, { paddingSize: "none", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-panel-color-gradient-settings__dropdown-content", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 57258 control_default, 57259 { 57260 ...controlProps 57261 } 57262 ) }) }) 57263 } 57264 ) 57265 }, 57266 index 57267 ); 57268 }) }); 57269 } 57270 57271 57272 ;// ./node_modules/@wordpress/block-editor/build-module/components/colors-gradients/panel-color-gradient-settings.js 57273 57274 57275 57276 57277 57278 57279 57280 const panel_color_gradient_settings_colorsAndGradientKeys = [ 57281 "colors", 57282 "disableCustomColors", 57283 "gradients", 57284 "disableCustomGradients" 57285 ]; 57286 const PanelColorGradientSettingsInner = ({ 57287 className, 57288 colors, 57289 gradients, 57290 disableCustomColors, 57291 disableCustomGradients, 57292 children, 57293 settings, 57294 title, 57295 showTitle = true, 57296 __experimentalIsRenderedInSidebar, 57297 enableAlpha 57298 }) => { 57299 const panelId = (0,external_wp_compose_namespaceObject.useInstanceId)(PanelColorGradientSettingsInner); 57300 const { batch } = (0,external_wp_data_namespaceObject.useRegistry)(); 57301 if ((!colors || colors.length === 0) && (!gradients || gradients.length === 0) && disableCustomColors && disableCustomGradients && settings?.every( 57302 (setting) => (!setting.colors || setting.colors.length === 0) && (!setting.gradients || setting.gradients.length === 0) && (setting.disableCustomColors === void 0 || setting.disableCustomColors) && (setting.disableCustomGradients === void 0 || setting.disableCustomGradients) 57303 )) { 57304 return null; 57305 } 57306 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 57307 external_wp_components_namespaceObject.__experimentalToolsPanel, 57308 { 57309 className: dist_clsx( 57310 "block-editor-panel-color-gradient-settings", 57311 className 57312 ), 57313 label: showTitle ? title : void 0, 57314 resetAll: () => { 57315 batch(() => { 57316 settings.forEach( 57317 ({ 57318 colorValue, 57319 gradientValue, 57320 onColorChange, 57321 onGradientChange 57322 }) => { 57323 if (colorValue) { 57324 onColorChange(); 57325 } else if (gradientValue) { 57326 onGradientChange(); 57327 } 57328 } 57329 ); 57330 }); 57331 }, 57332 panelId, 57333 __experimentalFirstVisibleItemClass: "first", 57334 __experimentalLastVisibleItemClass: "last", 57335 children: [ 57336 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 57337 ColorGradientSettingsDropdown, 57338 { 57339 settings, 57340 panelId, 57341 ...{ 57342 colors, 57343 gradients, 57344 disableCustomColors, 57345 disableCustomGradients, 57346 __experimentalIsRenderedInSidebar, 57347 enableAlpha 57348 } 57349 } 57350 ), 57351 !!children && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 57352 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { marginY: 4 }), 57353 " ", 57354 children 57355 ] }) 57356 ] 57357 } 57358 ); 57359 }; 57360 const PanelColorGradientSettingsSelect = (props) => { 57361 const colorGradientSettings = useMultipleOriginColorsAndGradients(); 57362 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 57363 PanelColorGradientSettingsInner, 57364 { 57365 ...{ ...colorGradientSettings, ...props } 57366 } 57367 ); 57368 }; 57369 const PanelColorGradientSettings = (props) => { 57370 if (panel_color_gradient_settings_colorsAndGradientKeys.every((key) => props.hasOwnProperty(key))) { 57371 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PanelColorGradientSettingsInner, { ...props }); 57372 } 57373 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PanelColorGradientSettingsSelect, { ...props }); 57374 }; 57375 var panel_color_gradient_settings_default = PanelColorGradientSettings; 57376 57377 57378 ;// ./node_modules/@wordpress/icons/build-module/library/aspect-ratio.js 57379 57380 57381 var aspect_ratio_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M18.5 5.5h-13c-1.1 0-2 .9-2 2v9c0 1.1.9 2 2 2h13c1.1 0 2-.9 2-2v-9c0-1.1-.9-2-2-2zm.5 11c0 .3-.2.5-.5.5h-13c-.3 0-.5-.2-.5-.5v-9c0-.3.2-.5.5-.5h13c.3 0 .5.2.5.5v9zM6.5 12H8v-2h2V8.5H6.5V12zm9.5 2h-2v1.5h3.5V12H16v2z" }) }); 57382 57383 57384 ;// ./node_modules/@wordpress/block-editor/build-module/components/image-editor/constants.js 57385 const MIN_ZOOM = 100; 57386 const MAX_ZOOM = 300; 57387 const constants_POPOVER_PROPS = { 57388 placement: "bottom-start" 57389 }; 57390 57391 57392 ;// ./node_modules/@wordpress/block-editor/build-module/components/image-editor/use-save-image.js 57393 57394 57395 57396 57397 57398 57399 57400 const messages = { 57401 crop: (0,external_wp_i18n_namespaceObject.__)("Image cropped."), 57402 rotate: (0,external_wp_i18n_namespaceObject.__)("Image rotated."), 57403 cropAndRotate: (0,external_wp_i18n_namespaceObject.__)("Image cropped and rotated.") 57404 }; 57405 function useSaveImage({ 57406 crop, 57407 rotation, 57408 url, 57409 id, 57410 onSaveImage, 57411 onFinishEditing 57412 }) { 57413 const { createErrorNotice, createSuccessNotice } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); 57414 const [isInProgress, setIsInProgress] = (0,external_wp_element_namespaceObject.useState)(false); 57415 const { editMediaEntity } = (0,external_wp_data_namespaceObject.useSelect)((select) => { 57416 const settings = select(store).getSettings(); 57417 return { 57418 editMediaEntity: settings?.[mediaEditKey] 57419 }; 57420 }, []); 57421 const cancel = (0,external_wp_element_namespaceObject.useCallback)(() => { 57422 setIsInProgress(false); 57423 onFinishEditing(); 57424 }, [onFinishEditing]); 57425 const apply = (0,external_wp_element_namespaceObject.useCallback)(async () => { 57426 if (!editMediaEntity) { 57427 onFinishEditing(); 57428 createErrorNotice( 57429 (0,external_wp_i18n_namespaceObject.__)("Sorry, you are not allowed to edit images on this site."), 57430 { 57431 id: "image-editing-error", 57432 type: "snackbar" 57433 } 57434 ); 57435 return; 57436 } 57437 setIsInProgress(true); 57438 const modifiers = []; 57439 if (rotation > 0) { 57440 modifiers.push({ 57441 type: "rotate", 57442 args: { 57443 angle: rotation 57444 } 57445 }); 57446 } 57447 if (crop.width < 99.9 || crop.height < 99.9) { 57448 modifiers.push({ 57449 type: "crop", 57450 args: { 57451 left: crop.x, 57452 top: crop.y, 57453 width: crop.width, 57454 height: crop.height 57455 } 57456 }); 57457 } 57458 if (modifiers.length === 0) { 57459 setIsInProgress(false); 57460 onFinishEditing(); 57461 return; 57462 } 57463 const modifierType = modifiers.length === 1 ? modifiers[0].type : "cropAndRotate"; 57464 try { 57465 const savedImage = await editMediaEntity( 57466 id, 57467 { 57468 src: url, 57469 modifiers 57470 }, 57471 { throwOnError: true } 57472 ); 57473 if (savedImage) { 57474 onSaveImage({ 57475 id: savedImage.id, 57476 url: savedImage.source_url 57477 }); 57478 createSuccessNotice(messages[modifierType], { 57479 type: "snackbar", 57480 actions: [ 57481 { 57482 label: (0,external_wp_i18n_namespaceObject.__)("Undo"), 57483 onClick: () => { 57484 onSaveImage({ 57485 id, 57486 url 57487 }); 57488 } 57489 } 57490 ] 57491 }); 57492 } 57493 } catch (error) { 57494 createErrorNotice( 57495 (0,external_wp_i18n_namespaceObject.sprintf)( 57496 /* translators: %s: Error message. */ 57497 (0,external_wp_i18n_namespaceObject.__)("Could not edit image. %s"), 57498 (0,external_wp_dom_namespaceObject.__unstableStripHTML)(error.message) 57499 ), 57500 { 57501 id: "image-editing-error", 57502 type: "snackbar" 57503 } 57504 ); 57505 } finally { 57506 setIsInProgress(false); 57507 onFinishEditing(); 57508 } 57509 }, [ 57510 crop, 57511 rotation, 57512 id, 57513 url, 57514 onSaveImage, 57515 createErrorNotice, 57516 createSuccessNotice, 57517 onFinishEditing, 57518 editMediaEntity 57519 ]); 57520 return (0,external_wp_element_namespaceObject.useMemo)( 57521 () => ({ 57522 isInProgress, 57523 apply, 57524 cancel 57525 }), 57526 [isInProgress, apply, cancel] 57527 ); 57528 } 57529 57530 57531 ;// ./node_modules/@wordpress/block-editor/build-module/components/image-editor/use-transform-image.js 57532 57533 57534 function useTransformImage({ 57535 url, 57536 naturalWidth, 57537 naturalHeight 57538 }) { 57539 const [editedUrl, setEditedUrl] = (0,external_wp_element_namespaceObject.useState)(); 57540 const [crop, setCrop] = (0,external_wp_element_namespaceObject.useState)(); 57541 const [position, setPosition] = (0,external_wp_element_namespaceObject.useState)({ x: 0, y: 0 }); 57542 const [zoom, setZoom] = (0,external_wp_element_namespaceObject.useState)(100); 57543 const [rotation, setRotation] = (0,external_wp_element_namespaceObject.useState)(0); 57544 const defaultAspect = naturalWidth / naturalHeight; 57545 const [aspect, setAspect] = (0,external_wp_element_namespaceObject.useState)(defaultAspect); 57546 const rotateClockwise = (0,external_wp_element_namespaceObject.useCallback)(() => { 57547 const angle = (rotation + 90) % 360; 57548 let naturalAspectRatio = defaultAspect; 57549 if (rotation % 180 === 90) { 57550 naturalAspectRatio = 1 / defaultAspect; 57551 } 57552 if (angle === 0) { 57553 setEditedUrl(); 57554 setRotation(angle); 57555 setAspect(defaultAspect); 57556 setPosition((prevPosition) => ({ 57557 x: -(prevPosition.y * naturalAspectRatio), 57558 y: prevPosition.x * naturalAspectRatio 57559 })); 57560 return; 57561 } 57562 function editImage(event) { 57563 const canvas = document.createElement("canvas"); 57564 let translateX = 0; 57565 let translateY = 0; 57566 if (angle % 180) { 57567 canvas.width = event.target.height; 57568 canvas.height = event.target.width; 57569 } else { 57570 canvas.width = event.target.width; 57571 canvas.height = event.target.height; 57572 } 57573 if (angle === 90 || angle === 180) { 57574 translateX = canvas.width; 57575 } 57576 if (angle === 270 || angle === 180) { 57577 translateY = canvas.height; 57578 } 57579 const context = canvas.getContext("2d"); 57580 context.translate(translateX, translateY); 57581 context.rotate(angle * Math.PI / 180); 57582 context.drawImage(event.target, 0, 0); 57583 canvas.toBlob((blob) => { 57584 setEditedUrl(URL.createObjectURL(blob)); 57585 setRotation(angle); 57586 setAspect(canvas.width / canvas.height); 57587 setPosition((prevPosition) => ({ 57588 x: -(prevPosition.y * naturalAspectRatio), 57589 y: prevPosition.x * naturalAspectRatio 57590 })); 57591 }); 57592 } 57593 const el = new window.Image(); 57594 el.src = url; 57595 el.onload = editImage; 57596 const imgCrossOrigin = (0,external_wp_hooks_namespaceObject.applyFilters)( 57597 "media.crossOrigin", 57598 void 0, 57599 url 57600 ); 57601 if (typeof imgCrossOrigin === "string") { 57602 el.crossOrigin = imgCrossOrigin; 57603 } 57604 }, [rotation, defaultAspect, url]); 57605 return (0,external_wp_element_namespaceObject.useMemo)( 57606 () => ({ 57607 editedUrl, 57608 setEditedUrl, 57609 crop, 57610 setCrop, 57611 position, 57612 setPosition, 57613 zoom, 57614 setZoom, 57615 rotation, 57616 setRotation, 57617 rotateClockwise, 57618 aspect, 57619 setAspect, 57620 defaultAspect 57621 }), 57622 [ 57623 editedUrl, 57624 crop, 57625 position, 57626 zoom, 57627 rotation, 57628 rotateClockwise, 57629 aspect, 57630 defaultAspect 57631 ] 57632 ); 57633 } 57634 57635 57636 ;// ./node_modules/@wordpress/block-editor/build-module/components/image-editor/context.js 57637 57638 57639 57640 57641 const ImageEditingContext = (0,external_wp_element_namespaceObject.createContext)({}); 57642 ImageEditingContext.displayName = "ImageEditingContext"; 57643 const useImageEditingContext = () => (0,external_wp_element_namespaceObject.useContext)(ImageEditingContext); 57644 function ImageEditingProvider({ 57645 id, 57646 url, 57647 naturalWidth, 57648 naturalHeight, 57649 onFinishEditing, 57650 onSaveImage, 57651 children 57652 }) { 57653 const transformImage = useTransformImage({ 57654 url, 57655 naturalWidth, 57656 naturalHeight 57657 }); 57658 const saveImage = useSaveImage({ 57659 id, 57660 url, 57661 onSaveImage, 57662 onFinishEditing, 57663 ...transformImage 57664 }); 57665 const providerValue = (0,external_wp_element_namespaceObject.useMemo)( 57666 () => ({ 57667 ...transformImage, 57668 ...saveImage 57669 }), 57670 [transformImage, saveImage] 57671 ); 57672 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ImageEditingContext.Provider, { value: providerValue, children }); 57673 } 57674 57675 57676 ;// ./node_modules/@wordpress/block-editor/build-module/components/image-editor/aspect-ratio-dropdown.js 57677 57678 57679 57680 57681 57682 57683 57684 function AspectRatioGroup({ 57685 aspectRatios, 57686 isDisabled, 57687 label, 57688 onClick, 57689 value 57690 }) { 57691 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuGroup, { label, children: aspectRatios.map(({ name, slug, ratio }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 57692 external_wp_components_namespaceObject.MenuItem, 57693 { 57694 disabled: isDisabled, 57695 onClick: () => { 57696 onClick(ratio); 57697 }, 57698 role: "menuitemradio", 57699 isSelected: ratio === value, 57700 icon: ratio === value ? check_check_default : void 0, 57701 children: name 57702 }, 57703 slug 57704 )) }); 57705 } 57706 function ratioToNumber(str) { 57707 const [a, b, ...rest] = str.split("/").map(Number); 57708 if (a <= 0 || b <= 0 || Number.isNaN(a) || Number.isNaN(b) || rest.length) { 57709 return NaN; 57710 } 57711 return b ? a / b : a; 57712 } 57713 function presetRatioAsNumber({ ratio, ...rest }) { 57714 return { 57715 ratio: ratioToNumber(ratio), 57716 ...rest 57717 }; 57718 } 57719 function AspectRatioDropdown({ toggleProps }) { 57720 const { isInProgress, aspect, setAspect, defaultAspect } = useImageEditingContext(); 57721 const [defaultRatios, themeRatios, showDefaultRatios] = use_settings_useSettings( 57722 "dimensions.aspectRatios.default", 57723 "dimensions.aspectRatios.theme", 57724 "dimensions.defaultAspectRatios" 57725 ); 57726 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 57727 external_wp_components_namespaceObject.DropdownMenu, 57728 { 57729 icon: aspect_ratio_default, 57730 label: (0,external_wp_i18n_namespaceObject.__)("Aspect Ratio"), 57731 popoverProps: constants_POPOVER_PROPS, 57732 toggleProps, 57733 children: ({ onClose }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 57734 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 57735 AspectRatioGroup, 57736 { 57737 isDisabled: isInProgress, 57738 onClick: (newAspect) => { 57739 setAspect(newAspect); 57740 onClose(); 57741 }, 57742 value: aspect, 57743 aspectRatios: [ 57744 // All ratios should be mirrored in AspectRatioTool in @wordpress/block-editor. 57745 { 57746 slug: "original", 57747 name: (0,external_wp_i18n_namespaceObject.__)("Original"), 57748 ratio: defaultAspect 57749 }, 57750 ...showDefaultRatios ? defaultRatios.map(presetRatioAsNumber).filter(({ ratio }) => ratio === 1) : [] 57751 ] 57752 } 57753 ), 57754 themeRatios?.length > 0 && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 57755 AspectRatioGroup, 57756 { 57757 label: (0,external_wp_i18n_namespaceObject.__)("Theme"), 57758 isDisabled: isInProgress, 57759 onClick: (newAspect) => { 57760 setAspect(newAspect); 57761 onClose(); 57762 }, 57763 value: aspect, 57764 aspectRatios: themeRatios 57765 } 57766 ), 57767 showDefaultRatios && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 57768 AspectRatioGroup, 57769 { 57770 label: (0,external_wp_i18n_namespaceObject.__)("Landscape"), 57771 isDisabled: isInProgress, 57772 onClick: (newAspect) => { 57773 setAspect(newAspect); 57774 onClose(); 57775 }, 57776 value: aspect, 57777 aspectRatios: defaultRatios.map(presetRatioAsNumber).filter(({ ratio }) => ratio > 1) 57778 } 57779 ), 57780 showDefaultRatios && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 57781 AspectRatioGroup, 57782 { 57783 label: (0,external_wp_i18n_namespaceObject.__)("Portrait"), 57784 isDisabled: isInProgress, 57785 onClick: (newAspect) => { 57786 setAspect(newAspect); 57787 onClose(); 57788 }, 57789 value: aspect, 57790 aspectRatios: defaultRatios.map(presetRatioAsNumber).filter(({ ratio }) => ratio < 1) 57791 } 57792 ) 57793 ] }) 57794 } 57795 ); 57796 } 57797 57798 57799 ;// ./node_modules/tslib/tslib.es6.mjs 57800 /****************************************************************************** 57801 Copyright (c) Microsoft Corporation. 57802 57803 Permission to use, copy, modify, and/or distribute this software for any 57804 purpose with or without fee is hereby granted. 57805 57806 THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH 57807 REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 57808 AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, 57809 INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 57810 LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR 57811 OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 57812 PERFORMANCE OF THIS SOFTWARE. 57813 ***************************************************************************** */ 57814 /* global Reflect, Promise, SuppressedError, Symbol, Iterator */ 57815 57816 var extendStatics = function(d, b) { 57817 extendStatics = Object.setPrototypeOf || 57818 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || 57819 function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; 57820 return extendStatics(d, b); 57821 }; 57822 57823 function __extends(d, b) { 57824 if (typeof b !== "function" && b !== null) 57825 throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); 57826 extendStatics(d, b); 57827 function __() { this.constructor = d; } 57828 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 57829 } 57830 57831 var __assign = function() { 57832 __assign = Object.assign || function __assign(t) { 57833 for (var s, i = 1, n = arguments.length; i < n; i++) { 57834 s = arguments[i]; 57835 for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; 57836 } 57837 return t; 57838 } 57839 return __assign.apply(this, arguments); 57840 } 57841 57842 function __rest(s, e) { 57843 var t = {}; 57844 for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) 57845 t[p] = s[p]; 57846 if (s != null && typeof Object.getOwnPropertySymbols === "function") 57847 for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { 57848 if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) 57849 t[p[i]] = s[p[i]]; 57850 } 57851 return t; 57852 } 57853 57854 function __decorate(decorators, target, key, desc) { 57855 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; 57856 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); 57857 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; 57858 return c > 3 && r && Object.defineProperty(target, key, r), r; 57859 } 57860 57861 function __param(paramIndex, decorator) { 57862 return function (target, key) { decorator(target, key, paramIndex); } 57863 } 57864 57865 function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) { 57866 function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; } 57867 var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value"; 57868 var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null; 57869 var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {}); 57870 var _, done = false; 57871 for (var i = decorators.length - 1; i >= 0; i--) { 57872 var context = {}; 57873 for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p]; 57874 for (var p in contextIn.access) context.access[p] = contextIn.access[p]; 57875 context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); }; 57876 var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context); 57877 if (kind === "accessor") { 57878 if (result === void 0) continue; 57879 if (result === null || typeof result !== "object") throw new TypeError("Object expected"); 57880 if (_ = accept(result.get)) descriptor.get = _; 57881 if (_ = accept(result.set)) descriptor.set = _; 57882 if (_ = accept(result.init)) initializers.unshift(_); 57883 } 57884 else if (_ = accept(result)) { 57885 if (kind === "field") initializers.unshift(_); 57886 else descriptor[key] = _; 57887 } 57888 } 57889 if (target) Object.defineProperty(target, contextIn.name, descriptor); 57890 done = true; 57891 }; 57892 57893 function __runInitializers(thisArg, initializers, value) { 57894 var useValue = arguments.length > 2; 57895 for (var i = 0; i < initializers.length; i++) { 57896 value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg); 57897 } 57898 return useValue ? value : void 0; 57899 }; 57900 57901 function __propKey(x) { 57902 return typeof x === "symbol" ? x : "".concat(x); 57903 }; 57904 57905 function __setFunctionName(f, name, prefix) { 57906 if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : ""; 57907 return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name }); 57908 }; 57909 57910 function __metadata(metadataKey, metadataValue) { 57911 if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); 57912 } 57913 57914 function __awaiter(thisArg, _arguments, P, generator) { 57915 function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } 57916 return new (P || (P = Promise))(function (resolve, reject) { 57917 function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } 57918 function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } 57919 function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } 57920 step((generator = generator.apply(thisArg, _arguments || [])).next()); 57921 }); 57922 } 57923 57924 function __generator(thisArg, body) { 57925 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); 57926 return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; 57927 function verb(n) { return function (v) { return step([n, v]); }; } 57928 function step(op) { 57929 if (f) throw new TypeError("Generator is already executing."); 57930 while (g && (g = 0, op[0] && (_ = 0)), _) try { 57931 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; 57932 if (y = 0, t) op = [op[0] & 2, t.value]; 57933 switch (op[0]) { 57934 case 0: case 1: t = op; break; 57935 case 4: _.label++; return { value: op[1], done: false }; 57936 case 5: _.label++; y = op[1]; op = [0]; continue; 57937 case 7: op = _.ops.pop(); _.trys.pop(); continue; 57938 default: 57939 if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } 57940 if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } 57941 if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } 57942 if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } 57943 if (t[2]) _.ops.pop(); 57944 _.trys.pop(); continue; 57945 } 57946 op = body.call(thisArg, _); 57947 } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } 57948 if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; 57949 } 57950 } 57951 57952 var __createBinding = Object.create ? (function(o, m, k, k2) { 57953 if (k2 === undefined) k2 = k; 57954 var desc = Object.getOwnPropertyDescriptor(m, k); 57955 if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { 57956 desc = { enumerable: true, get: function() { return m[k]; } }; 57957 } 57958 Object.defineProperty(o, k2, desc); 57959 }) : (function(o, m, k, k2) { 57960 if (k2 === undefined) k2 = k; 57961 o[k2] = m[k]; 57962 }); 57963 57964 function __exportStar(m, o) { 57965 for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p); 57966 } 57967 57968 function __values(o) { 57969 var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; 57970 if (m) return m.call(o); 57971 if (o && typeof o.length === "number") return { 57972 next: function () { 57973 if (o && i >= o.length) o = void 0; 57974 return { value: o && o[i++], done: !o }; 57975 } 57976 }; 57977 throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); 57978 } 57979 57980 function __read(o, n) { 57981 var m = typeof Symbol === "function" && o[Symbol.iterator]; 57982 if (!m) return o; 57983 var i = m.call(o), r, ar = [], e; 57984 try { 57985 while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); 57986 } 57987 catch (error) { e = { error: error }; } 57988 finally { 57989 try { 57990 if (r && !r.done && (m = i["return"])) m.call(i); 57991 } 57992 finally { if (e) throw e.error; } 57993 } 57994 return ar; 57995 } 57996 57997 /** @deprecated */ 57998 function __spread() { 57999 for (var ar = [], i = 0; i < arguments.length; i++) 58000 ar = ar.concat(__read(arguments[i])); 58001 return ar; 58002 } 58003 58004 /** @deprecated */ 58005 function __spreadArrays() { 58006 for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; 58007 for (var r = Array(s), k = 0, i = 0; i < il; i++) 58008 for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) 58009 r[k] = a[j]; 58010 return r; 58011 } 58012 58013 function __spreadArray(to, from, pack) { 58014 if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { 58015 if (ar || !(i in from)) { 58016 if (!ar) ar = Array.prototype.slice.call(from, 0, i); 58017 ar[i] = from[i]; 58018 } 58019 } 58020 return to.concat(ar || Array.prototype.slice.call(from)); 58021 } 58022 58023 function __await(v) { 58024 return this instanceof __await ? (this.v = v, this) : new __await(v); 58025 } 58026 58027 function __asyncGenerator(thisArg, _arguments, generator) { 58028 if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); 58029 var g = generator.apply(thisArg, _arguments || []), i, q = []; 58030 return i = Object.create((typeof AsyncIterator === "function" ? AsyncIterator : Object).prototype), verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i; 58031 function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; } 58032 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]); } } 58033 function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } 58034 function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } 58035 function fulfill(value) { resume("next", value); } 58036 function reject(value) { resume("throw", value); } 58037 function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } 58038 } 58039 58040 function __asyncDelegator(o) { 58041 var i, p; 58042 return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i; 58043 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; } 58044 } 58045 58046 function __asyncValues(o) { 58047 if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); 58048 var m = o[Symbol.asyncIterator], i; 58049 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); 58050 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); }); }; } 58051 function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } 58052 } 58053 58054 function __makeTemplateObject(cooked, raw) { 58055 if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } 58056 return cooked; 58057 }; 58058 58059 var __setModuleDefault = Object.create ? (function(o, v) { 58060 Object.defineProperty(o, "default", { enumerable: true, value: v }); 58061 }) : function(o, v) { 58062 o["default"] = v; 58063 }; 58064 58065 var ownKeys = function(o) { 58066 ownKeys = Object.getOwnPropertyNames || function (o) { 58067 var ar = []; 58068 for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; 58069 return ar; 58070 }; 58071 return ownKeys(o); 58072 }; 58073 58074 function __importStar(mod) { 58075 if (mod && mod.__esModule) return mod; 58076 var result = {}; 58077 if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); 58078 __setModuleDefault(result, mod); 58079 return result; 58080 } 58081 58082 function __importDefault(mod) { 58083 return (mod && mod.__esModule) ? mod : { default: mod }; 58084 } 58085 58086 function __classPrivateFieldGet(receiver, state, kind, f) { 58087 if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); 58088 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"); 58089 return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); 58090 } 58091 58092 function __classPrivateFieldSet(receiver, state, value, kind, f) { 58093 if (kind === "m") throw new TypeError("Private method is not writable"); 58094 if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); 58095 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"); 58096 return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; 58097 } 58098 58099 function __classPrivateFieldIn(state, receiver) { 58100 if (receiver === null || (typeof receiver !== "object" && typeof receiver !== "function")) throw new TypeError("Cannot use 'in' operator on non-object"); 58101 return typeof state === "function" ? receiver === state : state.has(receiver); 58102 } 58103 58104 function __addDisposableResource(env, value, async) { 58105 if (value !== null && value !== void 0) { 58106 if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected."); 58107 var dispose, inner; 58108 if (async) { 58109 if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined."); 58110 dispose = value[Symbol.asyncDispose]; 58111 } 58112 if (dispose === void 0) { 58113 if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined."); 58114 dispose = value[Symbol.dispose]; 58115 if (async) inner = dispose; 58116 } 58117 if (typeof dispose !== "function") throw new TypeError("Object not disposable."); 58118 if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } }; 58119 env.stack.push({ value: value, dispose: dispose, async: async }); 58120 } 58121 else if (async) { 58122 env.stack.push({ async: true }); 58123 } 58124 return value; 58125 } 58126 58127 var _SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) { 58128 var e = new Error(message); 58129 return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e; 58130 }; 58131 58132 function __disposeResources(env) { 58133 function fail(e) { 58134 env.error = env.hasError ? new _SuppressedError(e, env.error, "An error was suppressed during disposal.") : e; 58135 env.hasError = true; 58136 } 58137 var r, s = 0; 58138 function next() { 58139 while (r = env.stack.pop()) { 58140 try { 58141 if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next); 58142 if (r.dispose) { 58143 var result = r.dispose.call(r.value); 58144 if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); }); 58145 } 58146 else s |= 1; 58147 } 58148 catch (e) { 58149 fail(e); 58150 } 58151 } 58152 if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve(); 58153 if (env.hasError) throw env.error; 58154 } 58155 return next(); 58156 } 58157 58158 function __rewriteRelativeImportExtension(path, preserveJsx) { 58159 if (typeof path === "string" && /^\.\.?\//.test(path)) { 58160 return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) { 58161 return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : (d + ext + "." + cm.toLowerCase() + "js"); 58162 }); 58163 } 58164 return path; 58165 } 58166 58167 /* harmony default export */ const tslib_es6 = ({ 58168 __extends, 58169 __assign, 58170 __rest, 58171 __decorate, 58172 __param, 58173 __esDecorate, 58174 __runInitializers, 58175 __propKey, 58176 __setFunctionName, 58177 __metadata, 58178 __awaiter, 58179 __generator, 58180 __createBinding, 58181 __exportStar, 58182 __values, 58183 __read, 58184 __spread, 58185 __spreadArrays, 58186 __spreadArray, 58187 __await, 58188 __asyncGenerator, 58189 __asyncDelegator, 58190 __asyncValues, 58191 __makeTemplateObject, 58192 __importStar, 58193 __importDefault, 58194 __classPrivateFieldGet, 58195 __classPrivateFieldSet, 58196 __classPrivateFieldIn, 58197 __addDisposableResource, 58198 __disposeResources, 58199 __rewriteRelativeImportExtension, 58200 }); 58201 58202 // EXTERNAL MODULE: ./node_modules/normalize-wheel/index.js 58203 var normalize_wheel = __webpack_require__(7520); 58204 var normalize_wheel_default = /*#__PURE__*/__webpack_require__.n(normalize_wheel); 58205 ;// ./node_modules/react-easy-crop/index.module.js 58206 58207 58208 58209 58210 /** 58211 * Compute the dimension of the crop area based on media size, 58212 * aspect ratio and optionally rotation 58213 */ 58214 function getCropSize(mediaWidth, mediaHeight, containerWidth, containerHeight, aspect, rotation) { 58215 if (rotation === void 0) { 58216 rotation = 0; 58217 } 58218 var _a = rotateSize(mediaWidth, mediaHeight, rotation), 58219 width = _a.width, 58220 height = _a.height; 58221 var fittingWidth = Math.min(width, containerWidth); 58222 var fittingHeight = Math.min(height, containerHeight); 58223 if (fittingWidth > fittingHeight * aspect) { 58224 return { 58225 width: fittingHeight * aspect, 58226 height: fittingHeight 58227 }; 58228 } 58229 return { 58230 width: fittingWidth, 58231 height: fittingWidth / aspect 58232 }; 58233 } 58234 /** 58235 * Compute media zoom. 58236 * We fit the media into the container with "max-width: 100%; max-height: 100%;" 58237 */ 58238 function getMediaZoom(mediaSize) { 58239 // Take the axis with more pixels to improve accuracy 58240 return mediaSize.width > mediaSize.height ? mediaSize.width / mediaSize.naturalWidth : mediaSize.height / mediaSize.naturalHeight; 58241 } 58242 /** 58243 * Ensure a new media position stays in the crop area. 58244 */ 58245 function restrictPosition(position, mediaSize, cropSize, zoom, rotation) { 58246 if (rotation === void 0) { 58247 rotation = 0; 58248 } 58249 var _a = rotateSize(mediaSize.width, mediaSize.height, rotation), 58250 width = _a.width, 58251 height = _a.height; 58252 return { 58253 x: restrictPositionCoord(position.x, width, cropSize.width, zoom), 58254 y: restrictPositionCoord(position.y, height, cropSize.height, zoom) 58255 }; 58256 } 58257 function restrictPositionCoord(position, mediaSize, cropSize, zoom) { 58258 var maxPosition = mediaSize * zoom / 2 - cropSize / 2; 58259 return clamp(position, -maxPosition, maxPosition); 58260 } 58261 function getDistanceBetweenPoints(pointA, pointB) { 58262 return Math.sqrt(Math.pow(pointA.y - pointB.y, 2) + Math.pow(pointA.x - pointB.x, 2)); 58263 } 58264 function getRotationBetweenPoints(pointA, pointB) { 58265 return Math.atan2(pointB.y - pointA.y, pointB.x - pointA.x) * 180 / Math.PI; 58266 } 58267 /** 58268 * Compute the output cropped area of the media in percentages and pixels. 58269 * x/y are the top-left coordinates on the src media 58270 */ 58271 function computeCroppedArea(crop, mediaSize, cropSize, aspect, zoom, rotation, restrictPosition) { 58272 if (rotation === void 0) { 58273 rotation = 0; 58274 } 58275 if (restrictPosition === void 0) { 58276 restrictPosition = true; 58277 } 58278 // if the media is rotated by the user, we cannot limit the position anymore 58279 // as it might need to be negative. 58280 var limitAreaFn = restrictPosition ? limitArea : noOp; 58281 var mediaBBoxSize = rotateSize(mediaSize.width, mediaSize.height, rotation); 58282 var mediaNaturalBBoxSize = rotateSize(mediaSize.naturalWidth, mediaSize.naturalHeight, rotation); 58283 // calculate the crop area in percentages 58284 // in the rotated space 58285 var croppedAreaPercentages = { 58286 x: limitAreaFn(100, ((mediaBBoxSize.width - cropSize.width / zoom) / 2 - crop.x / zoom) / mediaBBoxSize.width * 100), 58287 y: limitAreaFn(100, ((mediaBBoxSize.height - cropSize.height / zoom) / 2 - crop.y / zoom) / mediaBBoxSize.height * 100), 58288 width: limitAreaFn(100, cropSize.width / mediaBBoxSize.width * 100 / zoom), 58289 height: limitAreaFn(100, cropSize.height / mediaBBoxSize.height * 100 / zoom) 58290 }; 58291 // we compute the pixels size naively 58292 var widthInPixels = Math.round(limitAreaFn(mediaNaturalBBoxSize.width, croppedAreaPercentages.width * mediaNaturalBBoxSize.width / 100)); 58293 var heightInPixels = Math.round(limitAreaFn(mediaNaturalBBoxSize.height, croppedAreaPercentages.height * mediaNaturalBBoxSize.height / 100)); 58294 var isImgWiderThanHigh = mediaNaturalBBoxSize.width >= mediaNaturalBBoxSize.height * aspect; 58295 // then we ensure the width and height exactly match the aspect (to avoid rounding approximations) 58296 // if the media is wider than high, when zoom is 0, the crop height will be equals to image height 58297 // thus we want to compute the width from the height and aspect for accuracy. 58298 // Otherwise, we compute the height from width and aspect. 58299 var sizePixels = isImgWiderThanHigh ? { 58300 width: Math.round(heightInPixels * aspect), 58301 height: heightInPixels 58302 } : { 58303 width: widthInPixels, 58304 height: Math.round(widthInPixels / aspect) 58305 }; 58306 var croppedAreaPixels = __assign(__assign({}, sizePixels), { 58307 x: Math.round(limitAreaFn(mediaNaturalBBoxSize.width - sizePixels.width, croppedAreaPercentages.x * mediaNaturalBBoxSize.width / 100)), 58308 y: Math.round(limitAreaFn(mediaNaturalBBoxSize.height - sizePixels.height, croppedAreaPercentages.y * mediaNaturalBBoxSize.height / 100)) 58309 }); 58310 return { 58311 croppedAreaPercentages: croppedAreaPercentages, 58312 croppedAreaPixels: croppedAreaPixels 58313 }; 58314 } 58315 /** 58316 * Ensure the returned value is between 0 and max 58317 */ 58318 function limitArea(max, value) { 58319 return Math.min(max, Math.max(0, value)); 58320 } 58321 function noOp(_max, value) { 58322 return value; 58323 } 58324 /** 58325 * Compute crop and zoom from the croppedAreaPercentages. 58326 */ 58327 function getInitialCropFromCroppedAreaPercentages(croppedAreaPercentages, mediaSize, rotation, cropSize, minZoom, maxZoom) { 58328 var mediaBBoxSize = rotateSize(mediaSize.width, mediaSize.height, rotation); 58329 // This is the inverse process of computeCroppedArea 58330 var zoom = clamp(cropSize.width / mediaBBoxSize.width * (100 / croppedAreaPercentages.width), minZoom, maxZoom); 58331 var crop = { 58332 x: zoom * mediaBBoxSize.width / 2 - cropSize.width / 2 - mediaBBoxSize.width * zoom * (croppedAreaPercentages.x / 100), 58333 y: zoom * mediaBBoxSize.height / 2 - cropSize.height / 2 - mediaBBoxSize.height * zoom * (croppedAreaPercentages.y / 100) 58334 }; 58335 return { 58336 crop: crop, 58337 zoom: zoom 58338 }; 58339 } 58340 /** 58341 * Compute zoom from the croppedAreaPixels 58342 */ 58343 function getZoomFromCroppedAreaPixels(croppedAreaPixels, mediaSize, cropSize) { 58344 var mediaZoom = getMediaZoom(mediaSize); 58345 return cropSize.height > cropSize.width ? cropSize.height / (croppedAreaPixels.height * mediaZoom) : cropSize.width / (croppedAreaPixels.width * mediaZoom); 58346 } 58347 /** 58348 * Compute crop and zoom from the croppedAreaPixels 58349 */ 58350 function getInitialCropFromCroppedAreaPixels(croppedAreaPixels, mediaSize, rotation, cropSize, minZoom, maxZoom) { 58351 if (rotation === void 0) { 58352 rotation = 0; 58353 } 58354 var mediaNaturalBBoxSize = rotateSize(mediaSize.naturalWidth, mediaSize.naturalHeight, rotation); 58355 var zoom = clamp(getZoomFromCroppedAreaPixels(croppedAreaPixels, mediaSize, cropSize), minZoom, maxZoom); 58356 var cropZoom = cropSize.height > cropSize.width ? cropSize.height / croppedAreaPixels.height : cropSize.width / croppedAreaPixels.width; 58357 var crop = { 58358 x: ((mediaNaturalBBoxSize.width - croppedAreaPixels.width) / 2 - croppedAreaPixels.x) * cropZoom, 58359 y: ((mediaNaturalBBoxSize.height - croppedAreaPixels.height) / 2 - croppedAreaPixels.y) * cropZoom 58360 }; 58361 return { 58362 crop: crop, 58363 zoom: zoom 58364 }; 58365 } 58366 /** 58367 * Return the point that is the center of point a and b 58368 */ 58369 function getCenter(a, b) { 58370 return { 58371 x: (b.x + a.x) / 2, 58372 y: (b.y + a.y) / 2 58373 }; 58374 } 58375 function getRadianAngle(degreeValue) { 58376 return degreeValue * Math.PI / 180; 58377 } 58378 /** 58379 * Returns the new bounding area of a rotated rectangle. 58380 */ 58381 function rotateSize(width, height, rotation) { 58382 var rotRad = getRadianAngle(rotation); 58383 return { 58384 width: Math.abs(Math.cos(rotRad) * width) + Math.abs(Math.sin(rotRad) * height), 58385 height: Math.abs(Math.sin(rotRad) * width) + Math.abs(Math.cos(rotRad) * height) 58386 }; 58387 } 58388 /** 58389 * Clamp value between min and max 58390 */ 58391 function clamp(value, min, max) { 58392 return Math.min(Math.max(value, min), max); 58393 } 58394 /** 58395 * Combine multiple class names into a single string. 58396 */ 58397 function classNames() { 58398 var args = []; 58399 for (var _i = 0; _i < arguments.length; _i++) { 58400 args[_i] = arguments[_i]; 58401 } 58402 return args.filter(function (value) { 58403 if (typeof value === 'string' && value.length > 0) { 58404 return true; 58405 } 58406 return false; 58407 }).join(' ').trim(); 58408 } 58409 58410 var css_248z = ".reactEasyCrop_Container {\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n overflow: hidden;\n user-select: none;\n touch-action: none;\n cursor: move;\n display: flex;\n justify-content: center;\n align-items: center;\n}\n\n.reactEasyCrop_Image,\n.reactEasyCrop_Video {\n will-change: transform; /* this improves performances and prevent painting issues on iOS Chrome */\n}\n\n.reactEasyCrop_Contain {\n max-width: 100%;\n max-height: 100%;\n margin: auto;\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n}\n.reactEasyCrop_Cover_Horizontal {\n width: 100%;\n height: auto;\n}\n.reactEasyCrop_Cover_Vertical {\n width: auto;\n height: 100%;\n}\n\n.reactEasyCrop_CropArea {\n position: absolute;\n left: 50%;\n top: 50%;\n transform: translate(-50%, -50%);\n border: 1px solid rgba(255, 255, 255, 0.5);\n box-sizing: border-box;\n box-shadow: 0 0 0 9999em;\n color: rgba(0, 0, 0, 0.5);\n overflow: hidden;\n}\n\n.reactEasyCrop_CropAreaRound {\n border-radius: 50%;\n}\n\n.reactEasyCrop_CropAreaGrid::before {\n content: ' ';\n box-sizing: border-box;\n position: absolute;\n border: 1px solid rgba(255, 255, 255, 0.5);\n top: 0;\n bottom: 0;\n left: 33.33%;\n right: 33.33%;\n border-top: 0;\n border-bottom: 0;\n}\n\n.reactEasyCrop_CropAreaGrid::after {\n content: ' ';\n box-sizing: border-box;\n position: absolute;\n border: 1px solid rgba(255, 255, 255, 0.5);\n top: 33.33%;\n bottom: 33.33%;\n left: 0;\n right: 0;\n border-left: 0;\n border-right: 0;\n}\n"; 58411 58412 var index_module_MIN_ZOOM = 1; 58413 var index_module_MAX_ZOOM = 3; 58414 var Cropper = /** @class */function (_super) { 58415 __extends(Cropper, _super); 58416 function Cropper() { 58417 var _this = _super !== null && _super.apply(this, arguments) || this; 58418 _this.imageRef = external_React_.createRef(); 58419 _this.videoRef = external_React_.createRef(); 58420 _this.containerPosition = { 58421 x: 0, 58422 y: 0 58423 }; 58424 _this.containerRef = null; 58425 _this.styleRef = null; 58426 _this.containerRect = null; 58427 _this.mediaSize = { 58428 width: 0, 58429 height: 0, 58430 naturalWidth: 0, 58431 naturalHeight: 0 58432 }; 58433 _this.dragStartPosition = { 58434 x: 0, 58435 y: 0 58436 }; 58437 _this.dragStartCrop = { 58438 x: 0, 58439 y: 0 58440 }; 58441 _this.gestureZoomStart = 0; 58442 _this.gestureRotationStart = 0; 58443 _this.isTouching = false; 58444 _this.lastPinchDistance = 0; 58445 _this.lastPinchRotation = 0; 58446 _this.rafDragTimeout = null; 58447 _this.rafPinchTimeout = null; 58448 _this.wheelTimer = null; 58449 _this.currentDoc = typeof document !== 'undefined' ? document : null; 58450 _this.currentWindow = typeof window !== 'undefined' ? window : null; 58451 _this.resizeObserver = null; 58452 _this.state = { 58453 cropSize: null, 58454 hasWheelJustStarted: false, 58455 mediaObjectFit: undefined 58456 }; 58457 _this.initResizeObserver = function () { 58458 if (typeof window.ResizeObserver === 'undefined' || !_this.containerRef) { 58459 return; 58460 } 58461 var isFirstResize = true; 58462 _this.resizeObserver = new window.ResizeObserver(function (entries) { 58463 if (isFirstResize) { 58464 isFirstResize = false; // observe() is called on mount, we don't want to trigger a recompute on mount 58465 return; 58466 } 58467 _this.computeSizes(); 58468 }); 58469 _this.resizeObserver.observe(_this.containerRef); 58470 }; 58471 // this is to prevent Safari on iOS >= 10 to zoom the page 58472 _this.preventZoomSafari = function (e) { 58473 return e.preventDefault(); 58474 }; 58475 _this.cleanEvents = function () { 58476 if (!_this.currentDoc) return; 58477 _this.currentDoc.removeEventListener('mousemove', _this.onMouseMove); 58478 _this.currentDoc.removeEventListener('mouseup', _this.onDragStopped); 58479 _this.currentDoc.removeEventListener('touchmove', _this.onTouchMove); 58480 _this.currentDoc.removeEventListener('touchend', _this.onDragStopped); 58481 _this.currentDoc.removeEventListener('gesturemove', _this.onGestureMove); 58482 _this.currentDoc.removeEventListener('gestureend', _this.onGestureEnd); 58483 _this.currentDoc.removeEventListener('scroll', _this.onScroll); 58484 }; 58485 _this.clearScrollEvent = function () { 58486 if (_this.containerRef) _this.containerRef.removeEventListener('wheel', _this.onWheel); 58487 if (_this.wheelTimer) { 58488 clearTimeout(_this.wheelTimer); 58489 } 58490 }; 58491 _this.onMediaLoad = function () { 58492 var cropSize = _this.computeSizes(); 58493 if (cropSize) { 58494 _this.emitCropData(); 58495 _this.setInitialCrop(cropSize); 58496 } 58497 if (_this.props.onMediaLoaded) { 58498 _this.props.onMediaLoaded(_this.mediaSize); 58499 } 58500 }; 58501 _this.setInitialCrop = function (cropSize) { 58502 if (_this.props.initialCroppedAreaPercentages) { 58503 var _a = getInitialCropFromCroppedAreaPercentages(_this.props.initialCroppedAreaPercentages, _this.mediaSize, _this.props.rotation, cropSize, _this.props.minZoom, _this.props.maxZoom), 58504 crop = _a.crop, 58505 zoom = _a.zoom; 58506 _this.props.onCropChange(crop); 58507 _this.props.onZoomChange && _this.props.onZoomChange(zoom); 58508 } else if (_this.props.initialCroppedAreaPixels) { 58509 var _b = getInitialCropFromCroppedAreaPixels(_this.props.initialCroppedAreaPixels, _this.mediaSize, _this.props.rotation, cropSize, _this.props.minZoom, _this.props.maxZoom), 58510 crop = _b.crop, 58511 zoom = _b.zoom; 58512 _this.props.onCropChange(crop); 58513 _this.props.onZoomChange && _this.props.onZoomChange(zoom); 58514 } 58515 }; 58516 _this.computeSizes = function () { 58517 var _a, _b, _c, _d, _e, _f; 58518 var mediaRef = _this.imageRef.current || _this.videoRef.current; 58519 if (mediaRef && _this.containerRef) { 58520 _this.containerRect = _this.containerRef.getBoundingClientRect(); 58521 _this.saveContainerPosition(); 58522 var containerAspect = _this.containerRect.width / _this.containerRect.height; 58523 var naturalWidth = ((_a = _this.imageRef.current) === null || _a === void 0 ? void 0 : _a.naturalWidth) || ((_b = _this.videoRef.current) === null || _b === void 0 ? void 0 : _b.videoWidth) || 0; 58524 var naturalHeight = ((_c = _this.imageRef.current) === null || _c === void 0 ? void 0 : _c.naturalHeight) || ((_d = _this.videoRef.current) === null || _d === void 0 ? void 0 : _d.videoHeight) || 0; 58525 var isMediaScaledDown = mediaRef.offsetWidth < naturalWidth || mediaRef.offsetHeight < naturalHeight; 58526 var mediaAspect = naturalWidth / naturalHeight; 58527 // We do not rely on the offsetWidth/offsetHeight if the media is scaled down 58528 // as the values they report are rounded. That will result in precision losses 58529 // when calculating zoom. We use the fact that the media is positionned relative 58530 // to the container. That allows us to use the container's dimensions 58531 // and natural aspect ratio of the media to calculate accurate media size. 58532 // However, for this to work, the container should not be rotated 58533 var renderedMediaSize = void 0; 58534 if (isMediaScaledDown) { 58535 switch (_this.state.mediaObjectFit) { 58536 default: 58537 case 'contain': 58538 renderedMediaSize = containerAspect > mediaAspect ? { 58539 width: _this.containerRect.height * mediaAspect, 58540 height: _this.containerRect.height 58541 } : { 58542 width: _this.containerRect.width, 58543 height: _this.containerRect.width / mediaAspect 58544 }; 58545 break; 58546 case 'horizontal-cover': 58547 renderedMediaSize = { 58548 width: _this.containerRect.width, 58549 height: _this.containerRect.width / mediaAspect 58550 }; 58551 break; 58552 case 'vertical-cover': 58553 renderedMediaSize = { 58554 width: _this.containerRect.height * mediaAspect, 58555 height: _this.containerRect.height 58556 }; 58557 break; 58558 } 58559 } else { 58560 renderedMediaSize = { 58561 width: mediaRef.offsetWidth, 58562 height: mediaRef.offsetHeight 58563 }; 58564 } 58565 _this.mediaSize = __assign(__assign({}, renderedMediaSize), { 58566 naturalWidth: naturalWidth, 58567 naturalHeight: naturalHeight 58568 }); 58569 // set media size in the parent 58570 if (_this.props.setMediaSize) { 58571 _this.props.setMediaSize(_this.mediaSize); 58572 } 58573 var cropSize = _this.props.cropSize ? _this.props.cropSize : getCropSize(_this.mediaSize.width, _this.mediaSize.height, _this.containerRect.width, _this.containerRect.height, _this.props.aspect, _this.props.rotation); 58574 if (((_e = _this.state.cropSize) === null || _e === void 0 ? void 0 : _e.height) !== cropSize.height || ((_f = _this.state.cropSize) === null || _f === void 0 ? void 0 : _f.width) !== cropSize.width) { 58575 _this.props.onCropSizeChange && _this.props.onCropSizeChange(cropSize); 58576 } 58577 _this.setState({ 58578 cropSize: cropSize 58579 }, _this.recomputeCropPosition); 58580 // pass crop size to parent 58581 if (_this.props.setCropSize) { 58582 _this.props.setCropSize(cropSize); 58583 } 58584 return cropSize; 58585 } 58586 }; 58587 _this.saveContainerPosition = function () { 58588 if (_this.containerRef) { 58589 var bounds = _this.containerRef.getBoundingClientRect(); 58590 _this.containerPosition = { 58591 x: bounds.left, 58592 y: bounds.top 58593 }; 58594 } 58595 }; 58596 _this.onMouseDown = function (e) { 58597 if (!_this.currentDoc) return; 58598 e.preventDefault(); 58599 _this.currentDoc.addEventListener('mousemove', _this.onMouseMove); 58600 _this.currentDoc.addEventListener('mouseup', _this.onDragStopped); 58601 _this.saveContainerPosition(); 58602 _this.onDragStart(Cropper.getMousePoint(e)); 58603 }; 58604 _this.onMouseMove = function (e) { 58605 return _this.onDrag(Cropper.getMousePoint(e)); 58606 }; 58607 _this.onScroll = function (e) { 58608 if (!_this.currentDoc) return; 58609 e.preventDefault(); 58610 _this.saveContainerPosition(); 58611 }; 58612 _this.onTouchStart = function (e) { 58613 if (!_this.currentDoc) return; 58614 _this.isTouching = true; 58615 if (_this.props.onTouchRequest && !_this.props.onTouchRequest(e)) { 58616 return; 58617 } 58618 _this.currentDoc.addEventListener('touchmove', _this.onTouchMove, { 58619 passive: false 58620 }); // iOS 11 now defaults to passive: true 58621 _this.currentDoc.addEventListener('touchend', _this.onDragStopped); 58622 _this.saveContainerPosition(); 58623 if (e.touches.length === 2) { 58624 _this.onPinchStart(e); 58625 } else if (e.touches.length === 1) { 58626 _this.onDragStart(Cropper.getTouchPoint(e.touches[0])); 58627 } 58628 }; 58629 _this.onTouchMove = function (e) { 58630 // Prevent whole page from scrolling on iOS. 58631 e.preventDefault(); 58632 if (e.touches.length === 2) { 58633 _this.onPinchMove(e); 58634 } else if (e.touches.length === 1) { 58635 _this.onDrag(Cropper.getTouchPoint(e.touches[0])); 58636 } 58637 }; 58638 _this.onGestureStart = function (e) { 58639 if (!_this.currentDoc) return; 58640 e.preventDefault(); 58641 _this.currentDoc.addEventListener('gesturechange', _this.onGestureMove); 58642 _this.currentDoc.addEventListener('gestureend', _this.onGestureEnd); 58643 _this.gestureZoomStart = _this.props.zoom; 58644 _this.gestureRotationStart = _this.props.rotation; 58645 }; 58646 _this.onGestureMove = function (e) { 58647 e.preventDefault(); 58648 if (_this.isTouching) { 58649 // this is to avoid conflict between gesture and touch events 58650 return; 58651 } 58652 var point = Cropper.getMousePoint(e); 58653 var newZoom = _this.gestureZoomStart - 1 + e.scale; 58654 _this.setNewZoom(newZoom, point, { 58655 shouldUpdatePosition: true 58656 }); 58657 if (_this.props.onRotationChange) { 58658 var newRotation = _this.gestureRotationStart + e.rotation; 58659 _this.props.onRotationChange(newRotation); 58660 } 58661 }; 58662 _this.onGestureEnd = function (e) { 58663 _this.cleanEvents(); 58664 }; 58665 _this.onDragStart = function (_a) { 58666 var _b, _c; 58667 var x = _a.x, 58668 y = _a.y; 58669 _this.dragStartPosition = { 58670 x: x, 58671 y: y 58672 }; 58673 _this.dragStartCrop = __assign({}, _this.props.crop); 58674 (_c = (_b = _this.props).onInteractionStart) === null || _c === void 0 ? void 0 : _c.call(_b); 58675 }; 58676 _this.onDrag = function (_a) { 58677 var x = _a.x, 58678 y = _a.y; 58679 if (!_this.currentWindow) return; 58680 if (_this.rafDragTimeout) _this.currentWindow.cancelAnimationFrame(_this.rafDragTimeout); 58681 _this.rafDragTimeout = _this.currentWindow.requestAnimationFrame(function () { 58682 if (!_this.state.cropSize) return; 58683 if (x === undefined || y === undefined) return; 58684 var offsetX = x - _this.dragStartPosition.x; 58685 var offsetY = y - _this.dragStartPosition.y; 58686 var requestedPosition = { 58687 x: _this.dragStartCrop.x + offsetX, 58688 y: _this.dragStartCrop.y + offsetY 58689 }; 58690 var newPosition = _this.props.restrictPosition ? restrictPosition(requestedPosition, _this.mediaSize, _this.state.cropSize, _this.props.zoom, _this.props.rotation) : requestedPosition; 58691 _this.props.onCropChange(newPosition); 58692 }); 58693 }; 58694 _this.onDragStopped = function () { 58695 var _a, _b; 58696 _this.isTouching = false; 58697 _this.cleanEvents(); 58698 _this.emitCropData(); 58699 (_b = (_a = _this.props).onInteractionEnd) === null || _b === void 0 ? void 0 : _b.call(_a); 58700 }; 58701 _this.onWheel = function (e) { 58702 if (!_this.currentWindow) return; 58703 if (_this.props.onWheelRequest && !_this.props.onWheelRequest(e)) { 58704 return; 58705 } 58706 e.preventDefault(); 58707 var point = Cropper.getMousePoint(e); 58708 var pixelY = normalize_wheel_default()(e).pixelY; 58709 var newZoom = _this.props.zoom - pixelY * _this.props.zoomSpeed / 200; 58710 _this.setNewZoom(newZoom, point, { 58711 shouldUpdatePosition: true 58712 }); 58713 if (!_this.state.hasWheelJustStarted) { 58714 _this.setState({ 58715 hasWheelJustStarted: true 58716 }, function () { 58717 var _a, _b; 58718 return (_b = (_a = _this.props).onInteractionStart) === null || _b === void 0 ? void 0 : _b.call(_a); 58719 }); 58720 } 58721 if (_this.wheelTimer) { 58722 clearTimeout(_this.wheelTimer); 58723 } 58724 _this.wheelTimer = _this.currentWindow.setTimeout(function () { 58725 return _this.setState({ 58726 hasWheelJustStarted: false 58727 }, function () { 58728 var _a, _b; 58729 return (_b = (_a = _this.props).onInteractionEnd) === null || _b === void 0 ? void 0 : _b.call(_a); 58730 }); 58731 }, 250); 58732 }; 58733 _this.getPointOnContainer = function (_a, containerTopLeft) { 58734 var x = _a.x, 58735 y = _a.y; 58736 if (!_this.containerRect) { 58737 throw new Error('The Cropper is not mounted'); 58738 } 58739 return { 58740 x: _this.containerRect.width / 2 - (x - containerTopLeft.x), 58741 y: _this.containerRect.height / 2 - (y - containerTopLeft.y) 58742 }; 58743 }; 58744 _this.getPointOnMedia = function (_a) { 58745 var x = _a.x, 58746 y = _a.y; 58747 var _b = _this.props, 58748 crop = _b.crop, 58749 zoom = _b.zoom; 58750 return { 58751 x: (x + crop.x) / zoom, 58752 y: (y + crop.y) / zoom 58753 }; 58754 }; 58755 _this.setNewZoom = function (zoom, point, _a) { 58756 var _b = _a === void 0 ? {} : _a, 58757 _c = _b.shouldUpdatePosition, 58758 shouldUpdatePosition = _c === void 0 ? true : _c; 58759 if (!_this.state.cropSize || !_this.props.onZoomChange) return; 58760 var newZoom = clamp(zoom, _this.props.minZoom, _this.props.maxZoom); 58761 if (shouldUpdatePosition) { 58762 var zoomPoint = _this.getPointOnContainer(point, _this.containerPosition); 58763 var zoomTarget = _this.getPointOnMedia(zoomPoint); 58764 var requestedPosition = { 58765 x: zoomTarget.x * newZoom - zoomPoint.x, 58766 y: zoomTarget.y * newZoom - zoomPoint.y 58767 }; 58768 var newPosition = _this.props.restrictPosition ? restrictPosition(requestedPosition, _this.mediaSize, _this.state.cropSize, newZoom, _this.props.rotation) : requestedPosition; 58769 _this.props.onCropChange(newPosition); 58770 } 58771 _this.props.onZoomChange(newZoom); 58772 }; 58773 _this.getCropData = function () { 58774 if (!_this.state.cropSize) { 58775 return null; 58776 } 58777 // this is to ensure the crop is correctly restricted after a zoom back (https://github.com/ValentinH/react-easy-crop/issues/6) 58778 var restrictedPosition = _this.props.restrictPosition ? restrictPosition(_this.props.crop, _this.mediaSize, _this.state.cropSize, _this.props.zoom, _this.props.rotation) : _this.props.crop; 58779 return computeCroppedArea(restrictedPosition, _this.mediaSize, _this.state.cropSize, _this.getAspect(), _this.props.zoom, _this.props.rotation, _this.props.restrictPosition); 58780 }; 58781 _this.emitCropData = function () { 58782 var cropData = _this.getCropData(); 58783 if (!cropData) return; 58784 var croppedAreaPercentages = cropData.croppedAreaPercentages, 58785 croppedAreaPixels = cropData.croppedAreaPixels; 58786 if (_this.props.onCropComplete) { 58787 _this.props.onCropComplete(croppedAreaPercentages, croppedAreaPixels); 58788 } 58789 if (_this.props.onCropAreaChange) { 58790 _this.props.onCropAreaChange(croppedAreaPercentages, croppedAreaPixels); 58791 } 58792 }; 58793 _this.emitCropAreaChange = function () { 58794 var cropData = _this.getCropData(); 58795 if (!cropData) return; 58796 var croppedAreaPercentages = cropData.croppedAreaPercentages, 58797 croppedAreaPixels = cropData.croppedAreaPixels; 58798 if (_this.props.onCropAreaChange) { 58799 _this.props.onCropAreaChange(croppedAreaPercentages, croppedAreaPixels); 58800 } 58801 }; 58802 _this.recomputeCropPosition = function () { 58803 if (!_this.state.cropSize) return; 58804 var newPosition = _this.props.restrictPosition ? restrictPosition(_this.props.crop, _this.mediaSize, _this.state.cropSize, _this.props.zoom, _this.props.rotation) : _this.props.crop; 58805 _this.props.onCropChange(newPosition); 58806 _this.emitCropData(); 58807 }; 58808 return _this; 58809 } 58810 Cropper.prototype.componentDidMount = function () { 58811 if (!this.currentDoc || !this.currentWindow) return; 58812 if (this.containerRef) { 58813 if (this.containerRef.ownerDocument) { 58814 this.currentDoc = this.containerRef.ownerDocument; 58815 } 58816 if (this.currentDoc.defaultView) { 58817 this.currentWindow = this.currentDoc.defaultView; 58818 } 58819 this.initResizeObserver(); 58820 // only add window resize listener if ResizeObserver is not supported. Otherwise, it would be redundant 58821 if (typeof window.ResizeObserver === 'undefined') { 58822 this.currentWindow.addEventListener('resize', this.computeSizes); 58823 } 58824 this.props.zoomWithScroll && this.containerRef.addEventListener('wheel', this.onWheel, { 58825 passive: false 58826 }); 58827 this.containerRef.addEventListener('gesturestart', this.onGestureStart); 58828 } 58829 this.currentDoc.addEventListener('scroll', this.onScroll); 58830 if (!this.props.disableAutomaticStylesInjection) { 58831 this.styleRef = this.currentDoc.createElement('style'); 58832 this.styleRef.setAttribute('type', 'text/css'); 58833 if (this.props.nonce) { 58834 this.styleRef.setAttribute('nonce', this.props.nonce); 58835 } 58836 this.styleRef.innerHTML = css_248z; 58837 this.currentDoc.head.appendChild(this.styleRef); 58838 } 58839 // when rendered via SSR, the image can already be loaded and its onLoad callback will never be called 58840 if (this.imageRef.current && this.imageRef.current.complete) { 58841 this.onMediaLoad(); 58842 } 58843 // set image and video refs in the parent if the callbacks exist 58844 if (this.props.setImageRef) { 58845 this.props.setImageRef(this.imageRef); 58846 } 58847 if (this.props.setVideoRef) { 58848 this.props.setVideoRef(this.videoRef); 58849 } 58850 }; 58851 Cropper.prototype.componentWillUnmount = function () { 58852 var _a, _b; 58853 if (!this.currentDoc || !this.currentWindow) return; 58854 if (typeof window.ResizeObserver === 'undefined') { 58855 this.currentWindow.removeEventListener('resize', this.computeSizes); 58856 } 58857 (_a = this.resizeObserver) === null || _a === void 0 ? void 0 : _a.disconnect(); 58858 if (this.containerRef) { 58859 this.containerRef.removeEventListener('gesturestart', this.preventZoomSafari); 58860 } 58861 if (this.styleRef) { 58862 (_b = this.styleRef.parentNode) === null || _b === void 0 ? void 0 : _b.removeChild(this.styleRef); 58863 } 58864 this.cleanEvents(); 58865 this.props.zoomWithScroll && this.clearScrollEvent(); 58866 }; 58867 Cropper.prototype.componentDidUpdate = function (prevProps) { 58868 var _a, _b, _c, _d, _e, _f, _g, _h, _j; 58869 if (prevProps.rotation !== this.props.rotation) { 58870 this.computeSizes(); 58871 this.recomputeCropPosition(); 58872 } else if (prevProps.aspect !== this.props.aspect) { 58873 this.computeSizes(); 58874 } else if (prevProps.objectFit !== this.props.objectFit) { 58875 this.computeSizes(); 58876 } else if (prevProps.zoom !== this.props.zoom) { 58877 this.recomputeCropPosition(); 58878 } else if (((_a = prevProps.cropSize) === null || _a === void 0 ? void 0 : _a.height) !== ((_b = this.props.cropSize) === null || _b === void 0 ? void 0 : _b.height) || ((_c = prevProps.cropSize) === null || _c === void 0 ? void 0 : _c.width) !== ((_d = this.props.cropSize) === null || _d === void 0 ? void 0 : _d.width)) { 58879 this.computeSizes(); 58880 } else if (((_e = prevProps.crop) === null || _e === void 0 ? void 0 : _e.x) !== ((_f = this.props.crop) === null || _f === void 0 ? void 0 : _f.x) || ((_g = prevProps.crop) === null || _g === void 0 ? void 0 : _g.y) !== ((_h = this.props.crop) === null || _h === void 0 ? void 0 : _h.y)) { 58881 this.emitCropAreaChange(); 58882 } 58883 if (prevProps.zoomWithScroll !== this.props.zoomWithScroll && this.containerRef) { 58884 this.props.zoomWithScroll ? this.containerRef.addEventListener('wheel', this.onWheel, { 58885 passive: false 58886 }) : this.clearScrollEvent(); 58887 } 58888 if (prevProps.video !== this.props.video) { 58889 (_j = this.videoRef.current) === null || _j === void 0 ? void 0 : _j.load(); 58890 } 58891 var objectFit = this.getObjectFit(); 58892 if (objectFit !== this.state.mediaObjectFit) { 58893 this.setState({ 58894 mediaObjectFit: objectFit 58895 }, this.computeSizes); 58896 } 58897 }; 58898 Cropper.prototype.getAspect = function () { 58899 var _a = this.props, 58900 cropSize = _a.cropSize, 58901 aspect = _a.aspect; 58902 if (cropSize) { 58903 return cropSize.width / cropSize.height; 58904 } 58905 return aspect; 58906 }; 58907 Cropper.prototype.getObjectFit = function () { 58908 var _a, _b, _c, _d; 58909 if (this.props.objectFit === 'cover') { 58910 var mediaRef = this.imageRef.current || this.videoRef.current; 58911 if (mediaRef && this.containerRef) { 58912 this.containerRect = this.containerRef.getBoundingClientRect(); 58913 var containerAspect = this.containerRect.width / this.containerRect.height; 58914 var naturalWidth = ((_a = this.imageRef.current) === null || _a === void 0 ? void 0 : _a.naturalWidth) || ((_b = this.videoRef.current) === null || _b === void 0 ? void 0 : _b.videoWidth) || 0; 58915 var naturalHeight = ((_c = this.imageRef.current) === null || _c === void 0 ? void 0 : _c.naturalHeight) || ((_d = this.videoRef.current) === null || _d === void 0 ? void 0 : _d.videoHeight) || 0; 58916 var mediaAspect = naturalWidth / naturalHeight; 58917 return mediaAspect < containerAspect ? 'horizontal-cover' : 'vertical-cover'; 58918 } 58919 return 'horizontal-cover'; 58920 } 58921 return this.props.objectFit; 58922 }; 58923 Cropper.prototype.onPinchStart = function (e) { 58924 var pointA = Cropper.getTouchPoint(e.touches[0]); 58925 var pointB = Cropper.getTouchPoint(e.touches[1]); 58926 this.lastPinchDistance = getDistanceBetweenPoints(pointA, pointB); 58927 this.lastPinchRotation = getRotationBetweenPoints(pointA, pointB); 58928 this.onDragStart(getCenter(pointA, pointB)); 58929 }; 58930 Cropper.prototype.onPinchMove = function (e) { 58931 var _this = this; 58932 if (!this.currentDoc || !this.currentWindow) return; 58933 var pointA = Cropper.getTouchPoint(e.touches[0]); 58934 var pointB = Cropper.getTouchPoint(e.touches[1]); 58935 var center = getCenter(pointA, pointB); 58936 this.onDrag(center); 58937 if (this.rafPinchTimeout) this.currentWindow.cancelAnimationFrame(this.rafPinchTimeout); 58938 this.rafPinchTimeout = this.currentWindow.requestAnimationFrame(function () { 58939 var distance = getDistanceBetweenPoints(pointA, pointB); 58940 var newZoom = _this.props.zoom * (distance / _this.lastPinchDistance); 58941 _this.setNewZoom(newZoom, center, { 58942 shouldUpdatePosition: false 58943 }); 58944 _this.lastPinchDistance = distance; 58945 var rotation = getRotationBetweenPoints(pointA, pointB); 58946 var newRotation = _this.props.rotation + (rotation - _this.lastPinchRotation); 58947 _this.props.onRotationChange && _this.props.onRotationChange(newRotation); 58948 _this.lastPinchRotation = rotation; 58949 }); 58950 }; 58951 Cropper.prototype.render = function () { 58952 var _this = this; 58953 var _a = this.props, 58954 image = _a.image, 58955 video = _a.video, 58956 mediaProps = _a.mediaProps, 58957 transform = _a.transform, 58958 _b = _a.crop, 58959 x = _b.x, 58960 y = _b.y, 58961 rotation = _a.rotation, 58962 zoom = _a.zoom, 58963 cropShape = _a.cropShape, 58964 showGrid = _a.showGrid, 58965 _c = _a.style, 58966 containerStyle = _c.containerStyle, 58967 cropAreaStyle = _c.cropAreaStyle, 58968 mediaStyle = _c.mediaStyle, 58969 _d = _a.classes, 58970 containerClassName = _d.containerClassName, 58971 cropAreaClassName = _d.cropAreaClassName, 58972 mediaClassName = _d.mediaClassName; 58973 var objectFit = this.state.mediaObjectFit; 58974 return external_React_.createElement("div", { 58975 onMouseDown: this.onMouseDown, 58976 onTouchStart: this.onTouchStart, 58977 ref: function ref(el) { 58978 return _this.containerRef = el; 58979 }, 58980 "data-testid": "container", 58981 style: containerStyle, 58982 className: classNames('reactEasyCrop_Container', containerClassName) 58983 }, image ? external_React_.createElement("img", __assign({ 58984 alt: "", 58985 className: classNames('reactEasyCrop_Image', objectFit === 'contain' && 'reactEasyCrop_Contain', objectFit === 'horizontal-cover' && 'reactEasyCrop_Cover_Horizontal', objectFit === 'vertical-cover' && 'reactEasyCrop_Cover_Vertical', mediaClassName) 58986 }, mediaProps, { 58987 src: image, 58988 ref: this.imageRef, 58989 style: __assign(__assign({}, mediaStyle), { 58990 transform: transform || "translate(".concat(x, "px, ").concat(y, "px) rotate(").concat(rotation, "deg) scale(").concat(zoom, ")") 58991 }), 58992 onLoad: this.onMediaLoad 58993 })) : video && external_React_.createElement("video", __assign({ 58994 autoPlay: true, 58995 loop: true, 58996 muted: true, 58997 className: classNames('reactEasyCrop_Video', objectFit === 'contain' && 'reactEasyCrop_Contain', objectFit === 'horizontal-cover' && 'reactEasyCrop_Cover_Horizontal', objectFit === 'vertical-cover' && 'reactEasyCrop_Cover_Vertical', mediaClassName) 58998 }, mediaProps, { 58999 ref: this.videoRef, 59000 onLoadedMetadata: this.onMediaLoad, 59001 style: __assign(__assign({}, mediaStyle), { 59002 transform: transform || "translate(".concat(x, "px, ").concat(y, "px) rotate(").concat(rotation, "deg) scale(").concat(zoom, ")") 59003 }), 59004 controls: false 59005 }), (Array.isArray(video) ? video : [{ 59006 src: video 59007 }]).map(function (item) { 59008 return external_React_.createElement("source", __assign({ 59009 key: item.src 59010 }, item)); 59011 })), this.state.cropSize && external_React_.createElement("div", { 59012 style: __assign(__assign({}, cropAreaStyle), { 59013 width: this.state.cropSize.width, 59014 height: this.state.cropSize.height 59015 }), 59016 "data-testid": "cropper", 59017 className: classNames('reactEasyCrop_CropArea', cropShape === 'round' && 'reactEasyCrop_CropAreaRound', showGrid && 'reactEasyCrop_CropAreaGrid', cropAreaClassName) 59018 })); 59019 }; 59020 Cropper.defaultProps = { 59021 zoom: 1, 59022 rotation: 0, 59023 aspect: 4 / 3, 59024 maxZoom: index_module_MAX_ZOOM, 59025 minZoom: index_module_MIN_ZOOM, 59026 cropShape: 'rect', 59027 objectFit: 'contain', 59028 showGrid: true, 59029 style: {}, 59030 classes: {}, 59031 mediaProps: {}, 59032 zoomSpeed: 1, 59033 restrictPosition: true, 59034 zoomWithScroll: true 59035 }; 59036 Cropper.getMousePoint = function (e) { 59037 return { 59038 x: Number(e.clientX), 59039 y: Number(e.clientY) 59040 }; 59041 }; 59042 Cropper.getTouchPoint = function (touch) { 59043 return { 59044 x: Number(touch.clientX), 59045 y: Number(touch.clientY) 59046 }; 59047 }; 59048 return Cropper; 59049 }(external_React_.Component); 59050 59051 59052 59053 ;// ./node_modules/@wordpress/block-editor/build-module/components/image-editor/cropper.js 59054 59055 59056 59057 59058 59059 59060 59061 function ImageCropper({ 59062 url, 59063 width, 59064 height, 59065 naturalHeight, 59066 naturalWidth, 59067 borderProps 59068 }) { 59069 const { 59070 isInProgress, 59071 editedUrl, 59072 position, 59073 zoom, 59074 aspect, 59075 setPosition, 59076 setCrop, 59077 setZoom, 59078 rotation 59079 } = useImageEditingContext(); 59080 const [contentResizeListener, { width: clientWidth }] = (0,external_wp_compose_namespaceObject.useResizeObserver)(); 59081 let editedHeight = height || clientWidth * naturalHeight / naturalWidth; 59082 if (rotation % 180 === 90) { 59083 editedHeight = clientWidth * naturalWidth / naturalHeight; 59084 } 59085 const area = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 59086 "div", 59087 { 59088 className: dist_clsx( 59089 "wp-block-image__crop-area", 59090 borderProps?.className, 59091 { 59092 "is-applying": isInProgress 59093 } 59094 ), 59095 style: { 59096 ...borderProps?.style, 59097 width: width || clientWidth, 59098 height: editedHeight 59099 }, 59100 children: [ 59101 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 59102 Cropper, 59103 { 59104 image: editedUrl || url, 59105 disabled: isInProgress, 59106 minZoom: MIN_ZOOM / 100, 59107 maxZoom: MAX_ZOOM / 100, 59108 crop: position, 59109 zoom: zoom / 100, 59110 aspect, 59111 onCropChange: (pos) => { 59112 setPosition(pos); 59113 }, 59114 onCropComplete: (newCropPercent) => { 59115 setCrop(newCropPercent); 59116 }, 59117 onZoomChange: (newZoom) => { 59118 setZoom(newZoom * 100); 59119 } 59120 } 59121 ), 59122 isInProgress && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {}) 59123 ] 59124 } 59125 ); 59126 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 59127 contentResizeListener, 59128 area 59129 ] }); 59130 } 59131 59132 59133 ;// ./node_modules/@wordpress/icons/build-module/library/search.js 59134 59135 59136 var search_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 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" }) }); 59137 59138 59139 ;// ./node_modules/@wordpress/block-editor/build-module/components/image-editor/zoom-dropdown.js 59140 59141 59142 59143 59144 59145 59146 function ZoomDropdown() { 59147 const { isInProgress, zoom, setZoom } = useImageEditingContext(); 59148 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 59149 external_wp_components_namespaceObject.Dropdown, 59150 { 59151 contentClassName: "wp-block-image__zoom", 59152 popoverProps: constants_POPOVER_PROPS, 59153 renderToggle: ({ isOpen, onToggle }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 59154 external_wp_components_namespaceObject.ToolbarButton, 59155 { 59156 icon: search_default, 59157 label: (0,external_wp_i18n_namespaceObject.__)("Zoom"), 59158 onClick: onToggle, 59159 "aria-expanded": isOpen, 59160 disabled: isInProgress 59161 } 59162 ), 59163 renderContent: () => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalDropdownContentWrapper, { paddingSize: "medium", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 59164 external_wp_components_namespaceObject.RangeControl, 59165 { 59166 __next40pxDefaultSize: true, 59167 __nextHasNoMarginBottom: true, 59168 label: (0,external_wp_i18n_namespaceObject.__)("Zoom"), 59169 min: MIN_ZOOM, 59170 max: MAX_ZOOM, 59171 value: Math.round(zoom), 59172 onChange: setZoom 59173 } 59174 ) }) 59175 } 59176 ); 59177 } 59178 59179 59180 ;// ./node_modules/@wordpress/icons/build-module/library/rotate-right.js 59181 59182 59183 var rotate_right_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 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" }) }); 59184 59185 59186 ;// ./node_modules/@wordpress/block-editor/build-module/components/image-editor/rotation-button.js 59187 59188 59189 59190 59191 59192 function RotationButton() { 59193 const { isInProgress, rotateClockwise } = useImageEditingContext(); 59194 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 59195 external_wp_components_namespaceObject.ToolbarButton, 59196 { 59197 icon: rotate_right_default, 59198 label: (0,external_wp_i18n_namespaceObject.__)("Rotate"), 59199 onClick: rotateClockwise, 59200 disabled: isInProgress 59201 } 59202 ); 59203 } 59204 59205 59206 ;// ./node_modules/@wordpress/block-editor/build-module/components/image-editor/form-controls.js 59207 59208 59209 59210 59211 function FormControls() { 59212 const { isInProgress, apply, cancel } = useImageEditingContext(); 59213 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 59214 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarButton, { onClick: apply, disabled: isInProgress, children: (0,external_wp_i18n_namespaceObject.__)("Apply") }), 59215 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarButton, { onClick: cancel, children: (0,external_wp_i18n_namespaceObject.__)("Cancel") }) 59216 ] }); 59217 } 59218 59219 59220 ;// ./node_modules/@wordpress/block-editor/build-module/components/image-editor/index.js 59221 59222 59223 59224 59225 59226 59227 59228 59229 59230 function ImageEditor({ 59231 id, 59232 url, 59233 width, 59234 height, 59235 naturalHeight, 59236 naturalWidth, 59237 onSaveImage, 59238 onFinishEditing, 59239 borderProps 59240 }) { 59241 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 59242 ImageEditingProvider, 59243 { 59244 id, 59245 url, 59246 naturalWidth, 59247 naturalHeight, 59248 onSaveImage, 59249 onFinishEditing, 59250 children: [ 59251 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 59252 ImageCropper, 59253 { 59254 borderProps, 59255 url, 59256 width, 59257 height, 59258 naturalHeight, 59259 naturalWidth 59260 } 59261 ), 59262 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(block_controls_default, { children: [ 59263 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.ToolbarGroup, { children: [ 59264 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ZoomDropdown, {}), 59265 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarItem, { children: (toggleProps) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(AspectRatioDropdown, { toggleProps }) }), 59266 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(RotationButton, {}) 59267 ] }), 59268 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarGroup, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(FormControls, {}) }) 59269 ] }) 59270 ] 59271 } 59272 ); 59273 } 59274 59275 59276 ;// ./node_modules/@wordpress/block-editor/build-module/components/image-size-control/use-dimension-handler.js 59277 59278 function useDimensionHandler(customHeight, customWidth, defaultHeight, defaultWidth, onChange) { 59279 const [currentWidth, setCurrentWidth] = (0,external_wp_element_namespaceObject.useState)( 59280 customWidth ?? defaultWidth ?? "" 59281 ); 59282 const [currentHeight, setCurrentHeight] = (0,external_wp_element_namespaceObject.useState)( 59283 customHeight ?? defaultHeight ?? "" 59284 ); 59285 (0,external_wp_element_namespaceObject.useEffect)(() => { 59286 if (customWidth === void 0 && defaultWidth !== void 0) { 59287 setCurrentWidth(defaultWidth); 59288 } 59289 if (customHeight === void 0 && defaultHeight !== void 0) { 59290 setCurrentHeight(defaultHeight); 59291 } 59292 }, [defaultWidth, defaultHeight]); 59293 (0,external_wp_element_namespaceObject.useEffect)(() => { 59294 if (customWidth !== void 0 && Number.parseInt(customWidth) !== Number.parseInt(currentWidth)) { 59295 setCurrentWidth(customWidth); 59296 } 59297 if (customHeight !== void 0 && Number.parseInt(customHeight) !== Number.parseInt(currentHeight)) { 59298 setCurrentHeight(customHeight); 59299 } 59300 }, [customWidth, customHeight]); 59301 const updateDimension = (dimension, value) => { 59302 const parsedValue = value === "" ? void 0 : parseInt(value, 10); 59303 if (dimension === "width") { 59304 setCurrentWidth(parsedValue); 59305 } else { 59306 setCurrentHeight(parsedValue); 59307 } 59308 onChange({ 59309 [dimension]: parsedValue 59310 }); 59311 }; 59312 const updateDimensions = (nextHeight, nextWidth) => { 59313 setCurrentHeight(nextHeight ?? defaultHeight); 59314 setCurrentWidth(nextWidth ?? defaultWidth); 59315 onChange({ height: nextHeight, width: nextWidth }); 59316 }; 59317 return { 59318 currentHeight, 59319 currentWidth, 59320 updateDimension, 59321 updateDimensions 59322 }; 59323 } 59324 59325 59326 ;// ./node_modules/@wordpress/block-editor/build-module/components/image-size-control/index.js 59327 59328 59329 59330 59331 const IMAGE_SIZE_PRESETS = [25, 50, 75, 100]; 59332 const image_size_control_noop = () => { 59333 }; 59334 function getScaledWidthAndHeight(scale, imageWidth, imageHeight) { 59335 const scaledWidth = Math.round(imageWidth * (scale / 100)); 59336 const scaledHeight = Math.round(imageHeight * (scale / 100)); 59337 return { 59338 scaledWidth, 59339 scaledHeight 59340 }; 59341 } 59342 function ImageSizeControl({ 59343 imageSizeHelp, 59344 imageWidth, 59345 imageHeight, 59346 imageSizeOptions = [], 59347 isResizable = true, 59348 slug, 59349 width, 59350 height, 59351 onChange, 59352 onChangeImage = image_size_control_noop 59353 }) { 59354 const { currentHeight, currentWidth, updateDimension, updateDimensions } = useDimensionHandler(height, width, imageHeight, imageWidth, onChange); 59355 const handleUpdateDimensions = (scale) => { 59356 if (void 0 === scale) { 59357 updateDimensions(); 59358 return; 59359 } 59360 const { scaledWidth, scaledHeight } = getScaledWidthAndHeight( 59361 scale, 59362 imageWidth, 59363 imageHeight 59364 ); 59365 updateDimensions(scaledHeight, scaledWidth); 59366 }; 59367 const selectedValue = IMAGE_SIZE_PRESETS.find((scale) => { 59368 const { scaledWidth, scaledHeight } = getScaledWidthAndHeight( 59369 scale, 59370 imageWidth, 59371 imageHeight 59372 ); 59373 return currentWidth === scaledWidth && currentHeight === scaledHeight; 59374 }); 59375 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { className: "block-editor-image-size-control", spacing: "4", children: [ 59376 imageSizeOptions && imageSizeOptions.length > 0 && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 59377 external_wp_components_namespaceObject.SelectControl, 59378 { 59379 __nextHasNoMarginBottom: true, 59380 label: (0,external_wp_i18n_namespaceObject.__)("Resolution"), 59381 value: slug, 59382 options: imageSizeOptions, 59383 onChange: onChangeImage, 59384 help: imageSizeHelp, 59385 size: "__unstable-large" 59386 } 59387 ), 59388 isResizable && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 59389 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { align: "baseline", spacing: "4", children: [ 59390 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 59391 external_wp_components_namespaceObject.__experimentalNumberControl, 59392 { 59393 label: (0,external_wp_i18n_namespaceObject.__)("Width"), 59394 value: currentWidth, 59395 min: 1, 59396 onChange: (value) => updateDimension("width", value), 59397 size: "__unstable-large" 59398 } 59399 ), 59400 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 59401 external_wp_components_namespaceObject.__experimentalNumberControl, 59402 { 59403 label: (0,external_wp_i18n_namespaceObject.__)("Height"), 59404 value: currentHeight, 59405 min: 1, 59406 onChange: (value) => updateDimension("height", value), 59407 size: "__unstable-large" 59408 } 59409 ) 59410 ] }), 59411 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 59412 external_wp_components_namespaceObject.__experimentalToggleGroupControl, 59413 { 59414 label: (0,external_wp_i18n_namespaceObject.__)("Image size presets"), 59415 hideLabelFromVision: true, 59416 onChange: handleUpdateDimensions, 59417 value: selectedValue, 59418 isBlock: true, 59419 __next40pxDefaultSize: true, 59420 __nextHasNoMarginBottom: true, 59421 children: IMAGE_SIZE_PRESETS.map((scale) => { 59422 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 59423 external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, 59424 { 59425 value: scale, 59426 label: (0,external_wp_i18n_namespaceObject.sprintf)( 59427 /* translators: %d: Percentage value. */ 59428 (0,external_wp_i18n_namespaceObject.__)("%d%%"), 59429 scale 59430 ) 59431 }, 59432 scale 59433 ); 59434 }) 59435 } 59436 ) 59437 ] }) 59438 ] }); 59439 } 59440 59441 59442 ;// ./node_modules/@wordpress/block-editor/build-module/components/url-popover/link-viewer-url.js 59443 59444 59445 59446 59447 function LinkViewerURL({ url, urlLabel, className }) { 59448 const linkClassName = dist_clsx( 59449 className, 59450 "block-editor-url-popover__link-viewer-url" 59451 ); 59452 if (!url) { 59453 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: linkClassName }); 59454 } 59455 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ExternalLink, { className: linkClassName, href: url, children: urlLabel || (0,external_wp_url_namespaceObject.filterURLForDisplay)((0,external_wp_url_namespaceObject.safeDecodeURI)(url)) }); 59456 } 59457 59458 59459 ;// ./node_modules/@wordpress/block-editor/build-module/components/url-popover/link-viewer.js 59460 59461 59462 59463 59464 59465 59466 function LinkViewer({ 59467 className, 59468 linkClassName, 59469 onEditLinkClick, 59470 url, 59471 urlLabel, 59472 ...props 59473 }) { 59474 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 59475 "div", 59476 { 59477 className: dist_clsx( 59478 "block-editor-url-popover__link-viewer", 59479 className 59480 ), 59481 ...props, 59482 children: [ 59483 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 59484 LinkViewerURL, 59485 { 59486 url, 59487 urlLabel, 59488 className: linkClassName 59489 } 59490 ), 59491 onEditLinkClick && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 59492 external_wp_components_namespaceObject.Button, 59493 { 59494 icon: pencil_default, 59495 label: (0,external_wp_i18n_namespaceObject.__)("Edit"), 59496 onClick: onEditLinkClick, 59497 size: "compact" 59498 } 59499 ) 59500 ] 59501 } 59502 ); 59503 } 59504 59505 59506 ;// ./node_modules/@wordpress/block-editor/build-module/components/url-popover/link-editor.js 59507 59508 59509 59510 59511 59512 59513 function LinkEditor({ 59514 autocompleteRef, 59515 className, 59516 onChangeInputValue, 59517 value, 59518 ...props 59519 }) { 59520 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 59521 "form", 59522 { 59523 className: dist_clsx( 59524 "block-editor-url-popover__link-editor", 59525 className 59526 ), 59527 ...props, 59528 children: [ 59529 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 59530 url_input_default, 59531 { 59532 value, 59533 onChange: onChangeInputValue, 59534 autocompleteRef 59535 } 59536 ), 59537 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 59538 external_wp_components_namespaceObject.Button, 59539 { 59540 icon: keyboard_return_default, 59541 label: (0,external_wp_i18n_namespaceObject.__)("Apply"), 59542 type: "submit", 59543 size: "compact" 59544 } 59545 ) 59546 ] 59547 } 59548 ); 59549 } 59550 59551 59552 ;// ./node_modules/@wordpress/block-editor/build-module/components/url-popover/index.js 59553 59554 59555 59556 59557 59558 59559 59560 59561 59562 const { __experimentalPopoverLegacyPositionToPlacement } = unlock( 59563 external_wp_components_namespaceObject.privateApis 59564 ); 59565 const DEFAULT_PLACEMENT = "bottom"; 59566 const URLPopover = (0,external_wp_element_namespaceObject.forwardRef)( 59567 ({ 59568 additionalControls, 59569 children, 59570 renderSettings, 59571 // The DEFAULT_PLACEMENT value is assigned inside the function's body 59572 placement, 59573 focusOnMount = "firstElement", 59574 // Deprecated 59575 position, 59576 // Rest 59577 ...popoverProps 59578 }, ref) => { 59579 if (position !== void 0) { 59580 external_wp_deprecated_default()("`position` prop in wp.blockEditor.URLPopover", { 59581 since: "6.2", 59582 alternative: "`placement` prop" 59583 }); 59584 } 59585 let computedPlacement; 59586 if (placement !== void 0) { 59587 computedPlacement = placement; 59588 } else if (position !== void 0) { 59589 computedPlacement = __experimentalPopoverLegacyPositionToPlacement(position); 59590 } 59591 computedPlacement = computedPlacement || DEFAULT_PLACEMENT; 59592 const [isSettingsExpanded, setIsSettingsExpanded] = (0,external_wp_element_namespaceObject.useState)(false); 59593 const showSettings = !!renderSettings && isSettingsExpanded; 59594 const toggleSettingsVisibility = () => { 59595 setIsSettingsExpanded(!isSettingsExpanded); 59596 }; 59597 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 59598 external_wp_components_namespaceObject.Popover, 59599 { 59600 ref, 59601 role: "dialog", 59602 "aria-modal": "true", 59603 "aria-label": (0,external_wp_i18n_namespaceObject.__)("Edit URL"), 59604 className: "block-editor-url-popover", 59605 focusOnMount, 59606 placement: computedPlacement, 59607 shift: true, 59608 variant: "toolbar", 59609 ...popoverProps, 59610 children: [ 59611 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-url-popover__input-container", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-editor-url-popover__row", children: [ 59612 children, 59613 !!renderSettings && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 59614 external_wp_components_namespaceObject.Button, 59615 { 59616 className: "block-editor-url-popover__settings-toggle", 59617 icon: chevron_down_default, 59618 label: (0,external_wp_i18n_namespaceObject.__)("Link settings"), 59619 onClick: toggleSettingsVisibility, 59620 "aria-expanded": isSettingsExpanded, 59621 size: "compact" 59622 } 59623 ) 59624 ] }) }), 59625 showSettings && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-url-popover__settings", children: renderSettings() }), 59626 additionalControls && !showSettings && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-url-popover__additional-controls", children: additionalControls }) 59627 ] 59628 } 59629 ); 59630 } 59631 ); 59632 URLPopover.LinkEditor = LinkEditor; 59633 URLPopover.LinkViewer = LinkViewer; 59634 var url_popover_default = URLPopover; 59635 59636 59637 ;// ./node_modules/@wordpress/block-editor/build-module/components/media-placeholder/index.js 59638 59639 59640 59641 59642 59643 59644 59645 59646 59647 59648 59649 59650 59651 const media_placeholder_noop = () => { 59652 }; 59653 const InsertFromURLPopover = ({ 59654 src, 59655 onChange, 59656 onSubmit, 59657 onClose, 59658 popoverAnchor 59659 }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(url_popover_default, { anchor: popoverAnchor, onClose, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 59660 "form", 59661 { 59662 className: "block-editor-media-placeholder__url-input-form", 59663 onSubmit, 59664 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 59665 external_wp_components_namespaceObject.__experimentalInputControl, 59666 { 59667 __next40pxDefaultSize: true, 59668 label: (0,external_wp_i18n_namespaceObject.__)("URL"), 59669 type: "text", 59670 hideLabelFromVision: true, 59671 placeholder: (0,external_wp_i18n_namespaceObject.__)("Paste or type URL"), 59672 onChange, 59673 value: src, 59674 suffix: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalInputControlSuffixWrapper, { variant: "control", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 59675 external_wp_components_namespaceObject.Button, 59676 { 59677 size: "small", 59678 icon: keyboard_return_default, 59679 label: (0,external_wp_i18n_namespaceObject.__)("Apply"), 59680 type: "submit" 59681 } 59682 ) }) 59683 } 59684 ) 59685 } 59686 ) }); 59687 const URLSelectionUI = ({ src, onChangeSrc, onSelectURL }) => { 59688 const [popoverAnchor, setPopoverAnchor] = (0,external_wp_element_namespaceObject.useState)(null); 59689 const [isURLInputVisible, setIsURLInputVisible] = (0,external_wp_element_namespaceObject.useState)(false); 59690 const openURLInput = () => { 59691 setIsURLInputVisible(true); 59692 }; 59693 const closeURLInput = () => { 59694 setIsURLInputVisible(false); 59695 popoverAnchor?.focus(); 59696 }; 59697 const onSubmitSrc = (event) => { 59698 event.preventDefault(); 59699 if (src && onSelectURL) { 59700 onSelectURL(src); 59701 closeURLInput(); 59702 } 59703 }; 59704 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-editor-media-placeholder__url-input-container", children: [ 59705 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 59706 external_wp_components_namespaceObject.Button, 59707 { 59708 __next40pxDefaultSize: true, 59709 className: "block-editor-media-placeholder__button", 59710 onClick: openURLInput, 59711 isPressed: isURLInputVisible, 59712 variant: "secondary", 59713 "aria-haspopup": "dialog", 59714 ref: setPopoverAnchor, 59715 children: (0,external_wp_i18n_namespaceObject.__)("Insert from URL") 59716 } 59717 ), 59718 isURLInputVisible && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 59719 InsertFromURLPopover, 59720 { 59721 src, 59722 onChange: onChangeSrc, 59723 onSubmit: onSubmitSrc, 59724 onClose: closeURLInput, 59725 popoverAnchor 59726 } 59727 ) 59728 ] }); 59729 }; 59730 function MediaPlaceholder({ 59731 value = {}, 59732 allowedTypes, 59733 className, 59734 icon, 59735 labels = {}, 59736 mediaPreview, 59737 notices, 59738 isAppender, 59739 accept, 59740 addToGallery, 59741 multiple = false, 59742 handleUpload = true, 59743 disableDropZone, 59744 disableMediaButtons, 59745 onError, 59746 onSelect, 59747 onCancel, 59748 onSelectURL, 59749 onToggleFeaturedImage, 59750 onDoubleClick, 59751 onFilesPreUpload = media_placeholder_noop, 59752 onHTMLDrop: deprecatedOnHTMLDrop, 59753 children, 59754 mediaLibraryButton, 59755 placeholder, 59756 style 59757 }) { 59758 if (deprecatedOnHTMLDrop) { 59759 external_wp_deprecated_default()("wp.blockEditor.MediaPlaceholder onHTMLDrop prop", { 59760 since: "6.2", 59761 version: "6.4" 59762 }); 59763 } 59764 const mediaUpload = (0,external_wp_data_namespaceObject.useSelect)((select) => { 59765 const { getSettings } = select(store); 59766 return getSettings().mediaUpload; 59767 }, []); 59768 const [src, setSrc] = (0,external_wp_element_namespaceObject.useState)(""); 59769 (0,external_wp_element_namespaceObject.useEffect)(() => { 59770 setSrc(value?.src ?? ""); 59771 }, [value?.src]); 59772 const onlyAllowsImages = () => { 59773 if (!allowedTypes || allowedTypes.length === 0) { 59774 return false; 59775 } 59776 return allowedTypes.every( 59777 (allowedType) => allowedType === "image" || allowedType.startsWith("image/") 59778 ); 59779 }; 59780 const onFilesUpload = (files) => { 59781 if (!handleUpload || typeof handleUpload === "function" && !handleUpload(files)) { 59782 return onSelect(files); 59783 } 59784 onFilesPreUpload(files); 59785 let setMedia; 59786 if (multiple) { 59787 if (addToGallery) { 59788 let lastMediaPassed = []; 59789 setMedia = (newMedia) => { 59790 const filteredMedia = (value ?? []).filter((item) => { 59791 if (item.id) { 59792 return !lastMediaPassed.some( 59793 // Be sure to convert to number for comparison. 59794 ({ id }) => Number(id) === Number(item.id) 59795 ); 59796 } 59797 return !lastMediaPassed.some( 59798 ({ urlSlug }) => item.url.includes(urlSlug) 59799 ); 59800 }); 59801 onSelect(filteredMedia.concat(newMedia)); 59802 lastMediaPassed = newMedia.map((media) => { 59803 const cutOffIndex = media.url.lastIndexOf("."); 59804 const urlSlug = media.url.slice(0, cutOffIndex); 59805 return { id: media.id, urlSlug }; 59806 }); 59807 }; 59808 } else { 59809 setMedia = onSelect; 59810 } 59811 } else { 59812 setMedia = ([media]) => onSelect(media); 59813 } 59814 mediaUpload({ 59815 allowedTypes, 59816 filesList: files, 59817 onFileChange: setMedia, 59818 onError, 59819 multiple 59820 }); 59821 }; 59822 async function handleBlocksDrop(event) { 59823 const { blocks } = parseDropEvent(event); 59824 if (!blocks?.length) { 59825 return; 59826 } 59827 const uploadedMediaList = await Promise.all( 59828 blocks.map((block) => { 59829 const blockType = block.name.split("/")[1]; 59830 if (block.attributes.id) { 59831 block.attributes.type = blockType; 59832 return block.attributes; 59833 } 59834 return new Promise((resolve, reject) => { 59835 window.fetch(block.attributes.url).then((response) => response.blob()).then( 59836 (blob) => mediaUpload({ 59837 filesList: [blob], 59838 additionalData: { 59839 title: block.attributes.title, 59840 alt_text: block.attributes.alt, 59841 caption: block.attributes.caption, 59842 type: blockType 59843 }, 59844 onFileChange: ([media]) => { 59845 if (media.id) { 59846 resolve(media); 59847 } 59848 }, 59849 allowedTypes, 59850 onError: reject 59851 }) 59852 ).catch(() => resolve(block.attributes.url)); 59853 }); 59854 }) 59855 ).catch((err) => onError(err)); 59856 if (!uploadedMediaList?.length) { 59857 return; 59858 } 59859 onSelect(multiple ? uploadedMediaList : uploadedMediaList[0]); 59860 } 59861 const onUpload = (event) => { 59862 onFilesUpload(event.target.files); 59863 }; 59864 const defaultRenderPlaceholder = (content) => { 59865 let { instructions, title } = labels; 59866 if (!mediaUpload && !onSelectURL) { 59867 instructions = (0,external_wp_i18n_namespaceObject.__)( 59868 "To edit this block, you need permission to upload media." 59869 ); 59870 } 59871 if (instructions === void 0 || title === void 0) { 59872 const typesAllowed = allowedTypes ?? []; 59873 const [firstAllowedType] = typesAllowed; 59874 const isOneType = 1 === typesAllowed.length; 59875 const isAudio = isOneType && "audio" === firstAllowedType; 59876 const isImage = isOneType && "image" === firstAllowedType; 59877 const isVideo = isOneType && "video" === firstAllowedType; 59878 if (instructions === void 0 && mediaUpload) { 59879 instructions = (0,external_wp_i18n_namespaceObject.__)( 59880 "Drag and drop an image or video, upload, or choose from your library." 59881 ); 59882 if (isAudio) { 59883 instructions = (0,external_wp_i18n_namespaceObject.__)( 59884 "Drag and drop an audio file, upload, or choose from your library." 59885 ); 59886 } else if (isImage) { 59887 instructions = (0,external_wp_i18n_namespaceObject.__)( 59888 "Drag and drop an image, upload, or choose from your library." 59889 ); 59890 } else if (isVideo) { 59891 instructions = (0,external_wp_i18n_namespaceObject.__)( 59892 "Drag and drop a video, upload, or choose from your library." 59893 ); 59894 } 59895 } 59896 if (title === void 0) { 59897 title = (0,external_wp_i18n_namespaceObject.__)("Media"); 59898 if (isAudio) { 59899 title = (0,external_wp_i18n_namespaceObject.__)("Audio"); 59900 } else if (isImage) { 59901 title = (0,external_wp_i18n_namespaceObject.__)("Image"); 59902 } else if (isVideo) { 59903 title = (0,external_wp_i18n_namespaceObject.__)("Video"); 59904 } 59905 } 59906 } 59907 const placeholderClassName = dist_clsx( 59908 "block-editor-media-placeholder", 59909 className, 59910 { 59911 "is-appender": isAppender 59912 } 59913 ); 59914 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 59915 external_wp_components_namespaceObject.Placeholder, 59916 { 59917 icon, 59918 label: title, 59919 instructions, 59920 className: placeholderClassName, 59921 notices, 59922 onDoubleClick, 59923 preview: mediaPreview, 59924 style, 59925 children: [ 59926 content, 59927 children 59928 ] 59929 } 59930 ); 59931 }; 59932 const renderPlaceholder = placeholder ?? defaultRenderPlaceholder; 59933 const renderDropZone = () => { 59934 if (disableDropZone) { 59935 return null; 59936 } 59937 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 59938 external_wp_components_namespaceObject.DropZone, 59939 { 59940 onFilesDrop: onFilesUpload, 59941 onDrop: handleBlocksDrop, 59942 isEligible: (dataTransfer) => { 59943 const prefix = "wp-block:core/"; 59944 const types = []; 59945 for (const type of dataTransfer.types) { 59946 if (type.startsWith(prefix)) { 59947 types.push(type.slice(prefix.length)); 59948 } 59949 } 59950 return types.every( 59951 (type) => allowedTypes.includes(type) 59952 ) && (multiple ? true : types.length === 1); 59953 } 59954 } 59955 ); 59956 }; 59957 const renderCancelLink = () => { 59958 return onCancel && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 59959 external_wp_components_namespaceObject.Button, 59960 { 59961 __next40pxDefaultSize: true, 59962 className: "block-editor-media-placeholder__cancel-button", 59963 title: (0,external_wp_i18n_namespaceObject.__)("Cancel"), 59964 variant: "link", 59965 onClick: onCancel, 59966 children: (0,external_wp_i18n_namespaceObject.__)("Cancel") 59967 } 59968 ); 59969 }; 59970 const renderUrlSelectionUI = () => { 59971 return onSelectURL && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 59972 URLSelectionUI, 59973 { 59974 src, 59975 onChangeSrc: setSrc, 59976 onSelectURL 59977 } 59978 ); 59979 }; 59980 const renderFeaturedImageToggle = () => { 59981 return onToggleFeaturedImage && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-media-placeholder__url-input-container", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 59982 external_wp_components_namespaceObject.Button, 59983 { 59984 __next40pxDefaultSize: true, 59985 className: "block-editor-media-placeholder__button", 59986 onClick: onToggleFeaturedImage, 59987 variant: "secondary", 59988 children: (0,external_wp_i18n_namespaceObject.__)("Use featured image") 59989 } 59990 ) }); 59991 }; 59992 const renderMediaUploadChecked = () => { 59993 const defaultButton = ({ open }) => { 59994 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 59995 external_wp_components_namespaceObject.Button, 59996 { 59997 __next40pxDefaultSize: true, 59998 variant: "secondary", 59999 onClick: () => { 60000 open(); 60001 }, 60002 children: (0,external_wp_i18n_namespaceObject.__)("Media Library") 60003 } 60004 ); 60005 }; 60006 const libraryButton = mediaLibraryButton ?? defaultButton; 60007 const uploadMediaLibraryButton = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 60008 media_upload_default, 60009 { 60010 addToGallery, 60011 gallery: multiple && onlyAllowsImages(), 60012 multiple, 60013 onSelect, 60014 allowedTypes, 60015 mode: "browse", 60016 value: Array.isArray(value) ? value.map(({ id }) => id) : value.id, 60017 render: libraryButton 60018 } 60019 ); 60020 if (mediaUpload && isAppender) { 60021 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 60022 renderDropZone(), 60023 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 60024 external_wp_components_namespaceObject.FormFileUpload, 60025 { 60026 onChange: onUpload, 60027 accept, 60028 multiple: !!multiple, 60029 render: ({ openFileDialog }) => { 60030 const content = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 60031 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 60032 external_wp_components_namespaceObject.Button, 60033 { 60034 __next40pxDefaultSize: true, 60035 variant: "primary", 60036 className: dist_clsx( 60037 "block-editor-media-placeholder__button", 60038 "block-editor-media-placeholder__upload-button" 60039 ), 60040 onClick: openFileDialog, 60041 children: (0,external_wp_i18n_namespaceObject._x)("Upload", "verb") 60042 } 60043 ), 60044 uploadMediaLibraryButton, 60045 renderUrlSelectionUI(), 60046 renderFeaturedImageToggle(), 60047 renderCancelLink() 60048 ] }); 60049 return renderPlaceholder(content); 60050 } 60051 } 60052 ) 60053 ] }); 60054 } 60055 if (mediaUpload) { 60056 const content = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 60057 renderDropZone(), 60058 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 60059 external_wp_components_namespaceObject.FormFileUpload, 60060 { 60061 render: ({ openFileDialog }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 60062 external_wp_components_namespaceObject.Button, 60063 { 60064 __next40pxDefaultSize: true, 60065 onClick: openFileDialog, 60066 variant: "primary", 60067 className: dist_clsx( 60068 "block-editor-media-placeholder__button", 60069 "block-editor-media-placeholder__upload-button" 60070 ), 60071 children: (0,external_wp_i18n_namespaceObject._x)("Upload", "verb") 60072 } 60073 ), 60074 onChange: onUpload, 60075 accept, 60076 multiple: !!multiple 60077 } 60078 ), 60079 uploadMediaLibraryButton, 60080 renderUrlSelectionUI(), 60081 renderFeaturedImageToggle(), 60082 renderCancelLink() 60083 ] }); 60084 return renderPlaceholder(content); 60085 } 60086 return renderPlaceholder(uploadMediaLibraryButton); 60087 }; 60088 if (disableMediaButtons) { 60089 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(check_default, { children: renderDropZone() }); 60090 } 60091 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 60092 check_default, 60093 { 60094 fallback: renderPlaceholder(renderUrlSelectionUI()), 60095 children: renderMediaUploadChecked() 60096 } 60097 ); 60098 } 60099 var media_placeholder_default = (0,external_wp_components_namespaceObject.withFilters)("editor.MediaPlaceholder")(MediaPlaceholder); 60100 60101 60102 ;// ./node_modules/@wordpress/block-editor/build-module/components/panel-color-settings/index.js 60103 60104 60105 const PanelColorSettings = ({ colorSettings, ...props }) => { 60106 const settings = colorSettings.map((setting) => { 60107 if (!setting) { 60108 return setting; 60109 } 60110 const { value, onChange, ...otherSettings } = setting; 60111 return { 60112 ...otherSettings, 60113 colorValue: value, 60114 onColorChange: onChange 60115 }; 60116 }); 60117 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 60118 panel_color_gradient_settings_default, 60119 { 60120 settings, 60121 gradients: [], 60122 disableCustomGradients: true, 60123 ...props 60124 } 60125 ); 60126 }; 60127 var panel_color_settings_default = PanelColorSettings; 60128 60129 60130 ;// ./node_modules/@wordpress/block-editor/build-module/components/rich-text/format-toolbar/index.js 60131 60132 60133 60134 60135 60136 60137 const format_toolbar_POPOVER_PROPS = { 60138 placement: "bottom-start" 60139 }; 60140 const FormatToolbar = () => { 60141 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 60142 ["bold", "italic", "link", "unknown"].map((format) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 60143 external_wp_components_namespaceObject.Slot, 60144 { 60145 name: `RichText.ToolbarControls.$format}` 60146 }, 60147 format 60148 )), 60149 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Slot, { name: "RichText.ToolbarControls", children: (fills) => { 60150 if (!fills.length) { 60151 return null; 60152 } 60153 const allProps = fills.map(([{ props }]) => props); 60154 const hasActive = allProps.some( 60155 ({ isActive }) => isActive 60156 ); 60157 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarItem, { children: (toggleProps) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 60158 external_wp_components_namespaceObject.DropdownMenu, 60159 { 60160 icon: chevron_down_default, 60161 label: (0,external_wp_i18n_namespaceObject.__)("More"), 60162 toggleProps: { 60163 ...toggleProps, 60164 className: dist_clsx( 60165 toggleProps.className, 60166 { "is-pressed": hasActive } 60167 ), 60168 description: (0,external_wp_i18n_namespaceObject.__)( 60169 "Displays more block tools" 60170 ) 60171 }, 60172 controls: orderBy( 60173 fills.map(([{ props }]) => props), 60174 "title" 60175 ), 60176 popoverProps: format_toolbar_POPOVER_PROPS 60177 } 60178 ) }); 60179 } }) 60180 ] }); 60181 }; 60182 var format_toolbar_default = FormatToolbar; 60183 60184 60185 ;// ./node_modules/@wordpress/block-editor/build-module/components/rich-text/format-toolbar-container.js 60186 60187 60188 60189 60190 60191 60192 function InlineToolbar({ popoverAnchor }) { 60193 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 60194 external_wp_components_namespaceObject.Popover, 60195 { 60196 placement: "top", 60197 focusOnMount: false, 60198 anchor: popoverAnchor, 60199 className: "block-editor-rich-text__inline-format-toolbar", 60200 __unstableSlotName: "block-toolbar", 60201 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 60202 NavigableToolbar, 60203 { 60204 className: "block-editor-rich-text__inline-format-toolbar-group", 60205 "aria-label": (0,external_wp_i18n_namespaceObject.__)("Format tools"), 60206 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarGroup, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(format_toolbar_default, {}) }) 60207 } 60208 ) 60209 } 60210 ); 60211 } 60212 const FormatToolbarContainer = ({ inline, editableContentElement }) => { 60213 if (inline) { 60214 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(InlineToolbar, { popoverAnchor: editableContentElement }); 60215 } 60216 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(block_controls_default, { group: "inline", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(format_toolbar_default, {}) }); 60217 }; 60218 var format_toolbar_container_default = FormatToolbarContainer; 60219 60220 60221 ;// ./node_modules/@wordpress/block-editor/build-module/components/rich-text/use-mark-persistent.js 60222 60223 60224 60225 function useMarkPersistent({ html, value }) { 60226 const previousTextRef = (0,external_wp_element_namespaceObject.useRef)(); 60227 const hasActiveFormats = !!value.activeFormats?.length; 60228 const { __unstableMarkLastChangeAsPersistent } = (0,external_wp_data_namespaceObject.useDispatch)(store); 60229 (0,external_wp_element_namespaceObject.useLayoutEffect)(() => { 60230 if (!previousTextRef.current) { 60231 previousTextRef.current = value.text; 60232 return; 60233 } 60234 if (previousTextRef.current !== value.text) { 60235 const timeout = window.setTimeout(() => { 60236 __unstableMarkLastChangeAsPersistent(); 60237 }, 1e3); 60238 previousTextRef.current = value.text; 60239 return () => { 60240 window.clearTimeout(timeout); 60241 }; 60242 } 60243 __unstableMarkLastChangeAsPersistent(); 60244 }, [html, hasActiveFormats]); 60245 } 60246 60247 60248 ;// ./node_modules/@wordpress/block-editor/build-module/components/rich-text/use-format-types.js 60249 60250 60251 60252 60253 function formatTypesSelector(select) { 60254 return select(external_wp_richText_namespaceObject.store).getFormatTypes(); 60255 } 60256 const interactiveContentTags = /* @__PURE__ */ new Set([ 60257 "a", 60258 "audio", 60259 "button", 60260 "details", 60261 "embed", 60262 "iframe", 60263 "input", 60264 "label", 60265 "select", 60266 "textarea", 60267 "video" 60268 ]); 60269 function prefixSelectKeys(selected, prefix) { 60270 if (typeof selected !== "object") { 60271 return { [prefix]: selected }; 60272 } 60273 return Object.fromEntries( 60274 Object.entries(selected).map(([key, value]) => [ 60275 `$prefix}.$key}`, 60276 value 60277 ]) 60278 ); 60279 } 60280 function getPrefixedSelectKeys(selected, prefix) { 60281 if (selected[prefix]) { 60282 return selected[prefix]; 60283 } 60284 return Object.keys(selected).filter((key) => key.startsWith(prefix + ".")).reduce((accumulator, key) => { 60285 accumulator[key.slice(prefix.length + 1)] = selected[key]; 60286 return accumulator; 60287 }, {}); 60288 } 60289 function useFormatTypes({ 60290 clientId, 60291 identifier, 60292 allowedFormats, 60293 withoutInteractiveFormatting, 60294 disableNoneEssentialFormatting = false 60295 }) { 60296 const allFormatTypes = (0,external_wp_data_namespaceObject.useSelect)(formatTypesSelector, []); 60297 const formatTypes = (0,external_wp_element_namespaceObject.useMemo)(() => { 60298 return allFormatTypes.filter( 60299 ({ 60300 name, 60301 interactive, 60302 tagName, 60303 [essentialFormatKey]: isEssential 60304 }) => { 60305 if (allowedFormats && !allowedFormats.includes(name)) { 60306 return false; 60307 } 60308 if (disableNoneEssentialFormatting && !isEssential) { 60309 return false; 60310 } 60311 if (withoutInteractiveFormatting && (interactive || interactiveContentTags.has(tagName))) { 60312 return false; 60313 } 60314 return true; 60315 } 60316 ); 60317 }, [ 60318 allFormatTypes, 60319 allowedFormats, 60320 disableNoneEssentialFormatting, 60321 withoutInteractiveFormatting 60322 ]); 60323 const keyedSelected = (0,external_wp_data_namespaceObject.useSelect)( 60324 (select) => formatTypes.reduce((accumulator, type) => { 60325 if (!type.__experimentalGetPropsForEditableTreePreparation) { 60326 return accumulator; 60327 } 60328 return { 60329 ...accumulator, 60330 ...prefixSelectKeys( 60331 type.__experimentalGetPropsForEditableTreePreparation( 60332 select, 60333 { 60334 richTextIdentifier: identifier, 60335 blockClientId: clientId 60336 } 60337 ), 60338 type.name 60339 ) 60340 }; 60341 }, {}), 60342 [formatTypes, clientId, identifier] 60343 ); 60344 const dispatch = (0,external_wp_data_namespaceObject.useDispatch)(); 60345 const prepareHandlers = []; 60346 const valueHandlers = []; 60347 const changeHandlers = []; 60348 const dependencies = []; 60349 for (const key in keyedSelected) { 60350 dependencies.push(keyedSelected[key]); 60351 } 60352 formatTypes.forEach((type) => { 60353 if (type.__experimentalCreatePrepareEditableTree) { 60354 const handler = type.__experimentalCreatePrepareEditableTree( 60355 getPrefixedSelectKeys(keyedSelected, type.name), 60356 { 60357 richTextIdentifier: identifier, 60358 blockClientId: clientId 60359 } 60360 ); 60361 if (type.__experimentalCreateOnChangeEditableValue) { 60362 valueHandlers.push(handler); 60363 } else { 60364 prepareHandlers.push(handler); 60365 } 60366 } 60367 if (type.__experimentalCreateOnChangeEditableValue) { 60368 let dispatchers = {}; 60369 if (type.__experimentalGetPropsForEditableTreeChangeHandler) { 60370 dispatchers = type.__experimentalGetPropsForEditableTreeChangeHandler( 60371 dispatch, 60372 { 60373 richTextIdentifier: identifier, 60374 blockClientId: clientId 60375 } 60376 ); 60377 } 60378 const selected = getPrefixedSelectKeys(keyedSelected, type.name); 60379 changeHandlers.push( 60380 type.__experimentalCreateOnChangeEditableValue( 60381 { 60382 ...typeof selected === "object" ? selected : {}, 60383 ...dispatchers 60384 }, 60385 { 60386 richTextIdentifier: identifier, 60387 blockClientId: clientId 60388 } 60389 ) 60390 ); 60391 } 60392 }); 60393 return { 60394 formatTypes, 60395 prepareHandlers, 60396 valueHandlers, 60397 changeHandlers, 60398 dependencies 60399 }; 60400 } 60401 60402 60403 ;// ./node_modules/@wordpress/block-editor/build-module/components/rich-text/event-listeners/before-input-rules.js 60404 60405 60406 60407 const wrapSelectionSettings = ["`", '"', "'", "\u201C\u201D", "\u2018\u2019"]; 60408 var before_input_rules_default = (props) => (element) => { 60409 function onInput(event) { 60410 const { inputType, data } = event; 60411 const { value, onChange, registry } = props.current; 60412 if (inputType !== "insertText") { 60413 return; 60414 } 60415 if ((0,external_wp_richText_namespaceObject.isCollapsed)(value)) { 60416 return; 60417 } 60418 const pair = (0,external_wp_hooks_namespaceObject.applyFilters)( 60419 "blockEditor.wrapSelectionSettings", 60420 wrapSelectionSettings 60421 ).find( 60422 ([startChar2, endChar2]) => startChar2 === data || endChar2 === data 60423 ); 60424 if (!pair) { 60425 return; 60426 } 60427 const [startChar, endChar = startChar] = pair; 60428 const start = value.start; 60429 const end = value.end + startChar.length; 60430 let newValue = (0,external_wp_richText_namespaceObject.insert)(value, startChar, start, start); 60431 newValue = (0,external_wp_richText_namespaceObject.insert)(newValue, endChar, end, end); 60432 const { 60433 __unstableMarkLastChangeAsPersistent, 60434 __unstableMarkAutomaticChange 60435 } = registry.dispatch(store); 60436 __unstableMarkLastChangeAsPersistent(); 60437 onChange(newValue); 60438 __unstableMarkAutomaticChange(); 60439 const init = {}; 60440 for (const key in event) { 60441 init[key] = event[key]; 60442 } 60443 init.data = endChar; 60444 const { ownerDocument } = element; 60445 const { defaultView } = ownerDocument; 60446 const newEvent = new defaultView.InputEvent("input", init); 60447 window.queueMicrotask(() => { 60448 event.target.dispatchEvent(newEvent); 60449 }); 60450 event.preventDefault(); 60451 } 60452 element.addEventListener("beforeinput", onInput); 60453 return () => { 60454 element.removeEventListener("beforeinput", onInput); 60455 }; 60456 }; 60457 60458 60459 ;// ./node_modules/@wordpress/block-editor/build-module/components/rich-text/prevent-event-discovery.js 60460 60461 function preventEventDiscovery(value) { 60462 const searchText = "tales of gutenberg"; 60463 const addText = " \u{1F421}\u{1F422}\u{1F980}\u{1F424}\u{1F98B}\u{1F418}\u{1F427}\u{1F439}\u{1F981}\u{1F984}\u{1F98D}\u{1F43C}\u{1F43F}\u{1F383}\u{1F434}\u{1F41D}\u{1F406}\u{1F995}\u{1F994}\u{1F331}\u{1F347}\u03C0\u{1F34C}\u{1F409}\u{1F4A7}\u{1F968}\u{1F30C}\u{1F342}\u{1F360}\u{1F966}\u{1F95A}\u{1F95D}\u{1F39F}\u{1F965}\u{1F952}\u{1F6F5}\u{1F956}\u{1F352}\u{1F36F}\u{1F3BE}\u{1F3B2}\u{1F43A}\u{1F41A}\u{1F42E}\u231B\uFE0F"; 60464 const { start, text } = value; 60465 if (start < searchText.length) { 60466 return value; 60467 } 60468 const charactersBefore = text.slice(start - searchText.length, start); 60469 if (charactersBefore.toLowerCase() !== searchText) { 60470 return value; 60471 } 60472 return (0,external_wp_richText_namespaceObject.insert)(value, addText); 60473 } 60474 60475 60476 ;// ./node_modules/@wordpress/block-editor/build-module/components/rich-text/event-listeners/input-rules.js 60477 60478 60479 60480 60481 60482 function findSelection(blocks) { 60483 let i = blocks.length; 60484 while (i--) { 60485 const attributeKey = retrieveSelectedAttribute( 60486 blocks[i].attributes 60487 ); 60488 if (attributeKey) { 60489 blocks[i].attributes[attributeKey] = blocks[i].attributes[attributeKey].toString().replace(START_OF_SELECTED_AREA, ""); 60490 return [blocks[i].clientId, attributeKey, 0, 0]; 60491 } 60492 const nestedSelection = findSelection(blocks[i].innerBlocks); 60493 if (nestedSelection) { 60494 return nestedSelection; 60495 } 60496 } 60497 return []; 60498 } 60499 var input_rules_default = (props) => (element) => { 60500 function inputRule() { 60501 const { getValue, onReplace, selectionChange, registry } = props.current; 60502 if (!onReplace) { 60503 return; 60504 } 60505 const value = getValue(); 60506 const { start, text } = value; 60507 const characterBefore = text.slice(start - 1, start); 60508 if (characterBefore !== " ") { 60509 return; 60510 } 60511 const trimmedTextBefore = text.slice(0, start).trim(); 60512 const prefixTransforms = (0,external_wp_blocks_namespaceObject.getBlockTransforms)("from").filter( 60513 ({ type }) => type === "prefix" 60514 ); 60515 const transformation = (0,external_wp_blocks_namespaceObject.findTransform)( 60516 prefixTransforms, 60517 ({ prefix }) => { 60518 return trimmedTextBefore === prefix; 60519 } 60520 ); 60521 if (!transformation) { 60522 return; 60523 } 60524 const content = (0,external_wp_richText_namespaceObject.toHTMLString)({ 60525 value: (0,external_wp_richText_namespaceObject.insert)(value, START_OF_SELECTED_AREA, 0, start) 60526 }); 60527 const block = transformation.transform(content); 60528 selectionChange(...findSelection([block])); 60529 onReplace([block]); 60530 registry.dispatch(store).__unstableMarkAutomaticChange(); 60531 return true; 60532 } 60533 function onInput(event) { 60534 const { inputType, type } = event; 60535 const { 60536 getValue, 60537 onChange, 60538 __unstableAllowPrefixTransformations, 60539 formatTypes, 60540 registry 60541 } = props.current; 60542 if (inputType !== "insertText" && type !== "compositionend") { 60543 return; 60544 } 60545 if (__unstableAllowPrefixTransformations && inputRule()) { 60546 return; 60547 } 60548 const value = getValue(); 60549 const transformed = formatTypes.reduce( 60550 (accumulator, { __unstableInputRule }) => { 60551 if (__unstableInputRule) { 60552 accumulator = __unstableInputRule(accumulator); 60553 } 60554 return accumulator; 60555 }, 60556 preventEventDiscovery(value) 60557 ); 60558 const { 60559 __unstableMarkLastChangeAsPersistent, 60560 __unstableMarkAutomaticChange 60561 } = registry.dispatch(store); 60562 if (transformed !== value) { 60563 __unstableMarkLastChangeAsPersistent(); 60564 onChange({ 60565 ...transformed, 60566 activeFormats: value.activeFormats 60567 }); 60568 __unstableMarkAutomaticChange(); 60569 } 60570 } 60571 element.addEventListener("input", onInput); 60572 element.addEventListener("compositionend", onInput); 60573 return () => { 60574 element.removeEventListener("input", onInput); 60575 element.removeEventListener("compositionend", onInput); 60576 }; 60577 }; 60578 60579 60580 ;// ./node_modules/@wordpress/block-editor/build-module/components/rich-text/event-listeners/insert-replacement-text.js 60581 60582 var insert_replacement_text_default = (props) => (element) => { 60583 function onInput(event) { 60584 if (event.inputType !== "insertReplacementText") { 60585 return; 60586 } 60587 const { registry } = props.current; 60588 registry.dispatch(store).__unstableMarkLastChangeAsPersistent(); 60589 } 60590 element.addEventListener("beforeinput", onInput); 60591 return () => { 60592 element.removeEventListener("beforeinput", onInput); 60593 }; 60594 }; 60595 60596 60597 ;// ./node_modules/@wordpress/block-editor/build-module/components/rich-text/event-listeners/remove-browser-shortcuts.js 60598 60599 var remove_browser_shortcuts_default = () => (node) => { 60600 function onKeydown(event) { 60601 if (external_wp_keycodes_namespaceObject.isKeyboardEvent.primary(event, "z") || external_wp_keycodes_namespaceObject.isKeyboardEvent.primary(event, "y") || external_wp_keycodes_namespaceObject.isKeyboardEvent.primaryShift(event, "z")) { 60602 event.preventDefault(); 60603 } 60604 } 60605 node.addEventListener("keydown", onKeydown); 60606 return () => { 60607 node.removeEventListener("keydown", onKeydown); 60608 }; 60609 }; 60610 60611 60612 ;// ./node_modules/@wordpress/block-editor/build-module/components/rich-text/event-listeners/shortcuts.js 60613 var shortcuts_default = (props) => (element) => { 60614 const { keyboardShortcuts } = props.current; 60615 function onKeyDown(event) { 60616 for (const keyboardShortcut of keyboardShortcuts.current) { 60617 keyboardShortcut(event); 60618 } 60619 } 60620 element.addEventListener("keydown", onKeyDown); 60621 return () => { 60622 element.removeEventListener("keydown", onKeyDown); 60623 }; 60624 }; 60625 60626 60627 ;// ./node_modules/@wordpress/block-editor/build-module/components/rich-text/event-listeners/input-events.js 60628 var input_events_default = (props) => (element) => { 60629 const { inputEvents } = props.current; 60630 function onInput(event) { 60631 for (const keyboardShortcut of inputEvents.current) { 60632 keyboardShortcut(event); 60633 } 60634 } 60635 element.addEventListener("input", onInput); 60636 return () => { 60637 element.removeEventListener("input", onInput); 60638 }; 60639 }; 60640 60641 60642 ;// ./node_modules/@wordpress/block-editor/build-module/components/rich-text/event-listeners/undo-automatic-change.js 60643 60644 60645 var undo_automatic_change_default = (props) => (element) => { 60646 function onKeyDown(event) { 60647 const { keyCode } = event; 60648 if (event.defaultPrevented) { 60649 return; 60650 } 60651 if (keyCode !== external_wp_keycodes_namespaceObject.BACKSPACE && keyCode !== external_wp_keycodes_namespaceObject.ESCAPE) { 60652 return; 60653 } 60654 const { registry } = props.current; 60655 const { didAutomaticChange, getSettings } = registry.select(store); 60656 const { __experimentalUndo } = getSettings(); 60657 if (!__experimentalUndo) { 60658 return; 60659 } 60660 if (!didAutomaticChange()) { 60661 return; 60662 } 60663 event.preventDefault(); 60664 __experimentalUndo(); 60665 } 60666 element.addEventListener("keydown", onKeyDown); 60667 return () => { 60668 element.removeEventListener("keydown", onKeyDown); 60669 }; 60670 }; 60671 60672 60673 ;// ./node_modules/@wordpress/block-editor/build-module/components/rich-text/utils.js 60674 60675 60676 60677 function addActiveFormats(value, activeFormats) { 60678 if (activeFormats?.length) { 60679 let index = value.formats.length; 60680 while (index--) { 60681 value.formats[index] = [ 60682 ...activeFormats, 60683 ...value.formats[index] || [] 60684 ]; 60685 } 60686 } 60687 } 60688 function getMultilineTag(multiline) { 60689 if (multiline !== true && multiline !== "p" && multiline !== "li") { 60690 return; 60691 } 60692 return multiline === true ? "p" : multiline; 60693 } 60694 function getAllowedFormats({ allowedFormats, disableFormats }) { 60695 if (disableFormats) { 60696 return getAllowedFormats.EMPTY_ARRAY; 60697 } 60698 return allowedFormats; 60699 } 60700 getAllowedFormats.EMPTY_ARRAY = []; 60701 function createLinkInParagraph(url, onReplace) { 60702 const link = /* @__PURE__ */ jsx("a", { href: url, children: url }); 60703 onReplace( 60704 createBlock("core/paragraph", { content: renderToString(link) }) 60705 ); 60706 } 60707 60708 60709 ;// ./node_modules/@wordpress/block-editor/build-module/components/rich-text/event-listeners/paste-handler.js 60710 60711 60712 60713 60714 60715 var paste_handler_default = (props) => (element) => { 60716 function _onPaste(event) { 60717 const { 60718 disableFormats, 60719 onChange, 60720 value, 60721 formatTypes, 60722 tagName, 60723 onReplace, 60724 __unstableEmbedURLOnPaste, 60725 preserveWhiteSpace, 60726 pastePlainText 60727 } = props.current; 60728 if (!element.contains(event.target)) { 60729 return; 60730 } 60731 if (event.defaultPrevented) { 60732 return; 60733 } 60734 const { plainText, html } = getPasteEventData(event); 60735 event.preventDefault(); 60736 window.console.log("Received HTML:\n\n", html); 60737 window.console.log("Received plain text:\n\n", plainText); 60738 if (disableFormats) { 60739 onChange((0,external_wp_richText_namespaceObject.insert)(value, plainText)); 60740 return; 60741 } 60742 const isInternal = event.clipboardData.getData("rich-text") === "true"; 60743 function pasteInline(content2) { 60744 const transformed = formatTypes.reduce( 60745 (accumulator, { __unstablePasteRule }) => { 60746 if (__unstablePasteRule && accumulator === value) { 60747 accumulator = __unstablePasteRule(value, { 60748 html, 60749 plainText 60750 }); 60751 } 60752 return accumulator; 60753 }, 60754 value 60755 ); 60756 if (transformed !== value) { 60757 onChange(transformed); 60758 } else { 60759 const valueToInsert = (0,external_wp_richText_namespaceObject.create)({ html: content2 }); 60760 addActiveFormats(valueToInsert, value.activeFormats); 60761 onChange((0,external_wp_richText_namespaceObject.insert)(value, valueToInsert)); 60762 } 60763 } 60764 if (isInternal) { 60765 pasteInline(html); 60766 return; 60767 } 60768 if (pastePlainText) { 60769 onChange((0,external_wp_richText_namespaceObject.insert)(value, (0,external_wp_richText_namespaceObject.create)({ text: plainText }))); 60770 return; 60771 } 60772 let mode = "INLINE"; 60773 const trimmedPlainText = plainText.trim(); 60774 if (__unstableEmbedURLOnPaste && (0,external_wp_richText_namespaceObject.isEmpty)(value) && (0,external_wp_url_namespaceObject.isURL)(trimmedPlainText) && // For the link pasting feature, allow only http(s) protocols. 60775 /^https?:/.test(trimmedPlainText)) { 60776 mode = "BLOCKS"; 60777 } 60778 const content = (0,external_wp_blocks_namespaceObject.pasteHandler)({ 60779 HTML: html, 60780 plainText, 60781 mode, 60782 tagName, 60783 preserveWhiteSpace 60784 }); 60785 if (typeof content === "string") { 60786 pasteInline(content); 60787 } else if (content.length > 0) { 60788 if (onReplace && (0,external_wp_richText_namespaceObject.isEmpty)(value)) { 60789 onReplace(content, content.length - 1, -1); 60790 } 60791 } 60792 } 60793 const { defaultView } = element.ownerDocument; 60794 defaultView.addEventListener("paste", _onPaste); 60795 return () => { 60796 defaultView.removeEventListener("paste", _onPaste); 60797 }; 60798 }; 60799 60800 60801 ;// ./node_modules/@wordpress/block-editor/build-module/components/rich-text/event-listeners/delete.js 60802 60803 60804 var delete_default = (props) => (element) => { 60805 function onKeyDown(event) { 60806 const { keyCode } = event; 60807 if (event.defaultPrevented) { 60808 return; 60809 } 60810 const { value, onMerge, onRemove } = props.current; 60811 if (keyCode === external_wp_keycodes_namespaceObject.DELETE || keyCode === external_wp_keycodes_namespaceObject.BACKSPACE) { 60812 const { start, end, text } = value; 60813 const isReverse = keyCode === external_wp_keycodes_namespaceObject.BACKSPACE; 60814 const hasActiveFormats = value.activeFormats && !!value.activeFormats.length; 60815 if (!(0,external_wp_richText_namespaceObject.isCollapsed)(value) || hasActiveFormats || isReverse && start !== 0 || !isReverse && end !== text.length) { 60816 return; 60817 } 60818 if (onMerge) { 60819 onMerge(!isReverse); 60820 } else if (onRemove && (0,external_wp_richText_namespaceObject.isEmpty)(value) && isReverse) { 60821 onRemove(!isReverse); 60822 } 60823 event.preventDefault(); 60824 } 60825 } 60826 element.addEventListener("keydown", onKeyDown); 60827 return () => { 60828 element.removeEventListener("keydown", onKeyDown); 60829 }; 60830 }; 60831 60832 60833 ;// ./node_modules/@wordpress/block-editor/build-module/components/rich-text/event-listeners/enter.js 60834 60835 60836 var enter_default = (props) => (element) => { 60837 function onKeyDownDeprecated(event) { 60838 if (event.keyCode !== external_wp_keycodes_namespaceObject.ENTER) { 60839 return; 60840 } 60841 const { onReplace, onSplit } = props.current; 60842 if (onReplace && onSplit) { 60843 event.__deprecatedOnSplit = true; 60844 } 60845 } 60846 function onKeyDown(event) { 60847 if (event.defaultPrevented) { 60848 return; 60849 } 60850 if (event.target !== element) { 60851 return; 60852 } 60853 if (event.keyCode !== external_wp_keycodes_namespaceObject.ENTER) { 60854 return; 60855 } 60856 const { 60857 value, 60858 onChange, 60859 disableLineBreaks, 60860 onSplitAtEnd, 60861 onSplitAtDoubleLineEnd, 60862 registry 60863 } = props.current; 60864 event.preventDefault(); 60865 const { text, start, end } = value; 60866 if (event.shiftKey) { 60867 if (!disableLineBreaks) { 60868 onChange((0,external_wp_richText_namespaceObject.insert)(value, "\n")); 60869 } 60870 } else if (onSplitAtEnd && start === end && end === text.length) { 60871 onSplitAtEnd(); 60872 } else if ( 60873 // For some blocks it's desirable to split at the end of the 60874 // block when there are two line breaks at the end of the 60875 // block, so triple Enter exits the block. 60876 onSplitAtDoubleLineEnd && start === end && end === text.length && text.slice(-2) === "\n\n" 60877 ) { 60878 registry.batch(() => { 60879 const _value = { ...value }; 60880 _value.start = _value.end - 2; 60881 onChange((0,external_wp_richText_namespaceObject.remove)(_value)); 60882 onSplitAtDoubleLineEnd(); 60883 }); 60884 } else if (!disableLineBreaks) { 60885 onChange((0,external_wp_richText_namespaceObject.insert)(value, "\n")); 60886 } 60887 } 60888 const { defaultView } = element.ownerDocument; 60889 defaultView.addEventListener("keydown", onKeyDown); 60890 element.addEventListener("keydown", onKeyDownDeprecated); 60891 return () => { 60892 defaultView.removeEventListener("keydown", onKeyDown); 60893 element.removeEventListener("keydown", onKeyDownDeprecated); 60894 }; 60895 }; 60896 60897 60898 ;// ./node_modules/@wordpress/block-editor/build-module/components/rich-text/event-listeners/firefox-compat.js 60899 60900 var firefox_compat_default = (props) => (element) => { 60901 function onFocus() { 60902 const { registry } = props.current; 60903 if (!registry.select(store).isMultiSelecting()) { 60904 return; 60905 } 60906 const parentEditable = element.parentElement.closest( 60907 '[contenteditable="true"]' 60908 ); 60909 if (parentEditable) { 60910 parentEditable.focus(); 60911 } 60912 } 60913 element.addEventListener("focus", onFocus); 60914 return () => { 60915 element.removeEventListener("focus", onFocus); 60916 }; 60917 }; 60918 60919 60920 ;// ./node_modules/@wordpress/block-editor/build-module/components/rich-text/event-listeners/index.js 60921 60922 60923 60924 60925 60926 60927 60928 60929 60930 60931 60932 60933 60934 const allEventListeners = [ 60935 before_input_rules_default, 60936 input_rules_default, 60937 insert_replacement_text_default, 60938 remove_browser_shortcuts_default, 60939 shortcuts_default, 60940 input_events_default, 60941 undo_automatic_change_default, 60942 paste_handler_default, 60943 delete_default, 60944 enter_default, 60945 firefox_compat_default 60946 ]; 60947 function useEventListeners(props) { 60948 const propsRef = (0,external_wp_element_namespaceObject.useRef)(props); 60949 (0,external_wp_element_namespaceObject.useInsertionEffect)(() => { 60950 propsRef.current = props; 60951 }); 60952 const refEffects = (0,external_wp_element_namespaceObject.useMemo)( 60953 () => allEventListeners.map((refEffect) => refEffect(propsRef)), 60954 [propsRef] 60955 ); 60956 return (0,external_wp_compose_namespaceObject.useRefEffect)( 60957 (element) => { 60958 if (!props.isSelected) { 60959 return; 60960 } 60961 const cleanups = refEffects.map((effect) => effect(element)); 60962 return () => { 60963 cleanups.forEach((cleanup) => cleanup()); 60964 }; 60965 }, 60966 [refEffects, props.isSelected] 60967 ); 60968 } 60969 60970 60971 ;// ./node_modules/@wordpress/block-editor/build-module/components/rich-text/format-edit.js 60972 60973 60974 60975 60976 60977 const format_edit_DEFAULT_BLOCK_CONTEXT = {}; 60978 const usesContextKey = Symbol("usesContext"); 60979 function format_edit_Edit({ onChange, onFocus, value, forwardedRef, settings }) { 60980 const { 60981 name, 60982 edit: EditFunction, 60983 [usesContextKey]: usesContext 60984 } = settings; 60985 const blockContext = (0,external_wp_element_namespaceObject.useContext)(block_context_default); 60986 const context = (0,external_wp_element_namespaceObject.useMemo)(() => { 60987 return usesContext ? Object.fromEntries( 60988 Object.entries(blockContext).filter( 60989 ([key]) => usesContext.includes(key) 60990 ) 60991 ) : format_edit_DEFAULT_BLOCK_CONTEXT; 60992 }, [usesContext, blockContext]); 60993 if (!EditFunction) { 60994 return null; 60995 } 60996 const activeFormat = (0,external_wp_richText_namespaceObject.getActiveFormat)(value, name); 60997 const isActive = activeFormat !== void 0; 60998 const activeObject = (0,external_wp_richText_namespaceObject.getActiveObject)(value); 60999 const isObjectActive = activeObject !== void 0 && activeObject.type === name; 61000 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 61001 EditFunction, 61002 { 61003 isActive, 61004 activeAttributes: isActive ? activeFormat.attributes || {} : {}, 61005 isObjectActive, 61006 activeObjectAttributes: isObjectActive ? activeObject.attributes || {} : {}, 61007 value, 61008 onChange, 61009 onFocus, 61010 contentRef: forwardedRef, 61011 context 61012 }, 61013 name 61014 ); 61015 } 61016 function FormatEdit({ formatTypes, ...props }) { 61017 return formatTypes.map((settings) => /* @__PURE__ */ (0,external_React_.createElement)(format_edit_Edit, { settings, ...props, key: settings.name })); 61018 } 61019 61020 61021 ;// ./node_modules/@wordpress/block-editor/build-module/components/rich-text/content.js 61022 61023 61024 61025 61026 61027 61028 function valueToHTMLString(value, multiline) { 61029 if (rich_text_default.isEmpty(value)) { 61030 const multilineTag = getMultilineTag(multiline); 61031 return multilineTag ? `<$multilineTag}></$multilineTag}>` : ""; 61032 } 61033 if (Array.isArray(value)) { 61034 external_wp_deprecated_default()("wp.blockEditor.RichText value prop as children type", { 61035 since: "6.1", 61036 version: "6.3", 61037 alternative: "value prop as string", 61038 link: "https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/introducing-attributes-and-editable-fields/" 61039 }); 61040 return external_wp_blocks_namespaceObject.children.toHTML(value); 61041 } 61042 if (typeof value === "string") { 61043 return value; 61044 } 61045 return value.toHTMLString(); 61046 } 61047 function Content({ 61048 value, 61049 tagName: Tag, 61050 multiline, 61051 format, 61052 ...props 61053 }) { 61054 value = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_element_namespaceObject.RawHTML, { children: valueToHTMLString(value, multiline) }); 61055 return Tag ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Tag, { ...props, children: value }) : value; 61056 } 61057 61058 61059 ;// ./node_modules/@wordpress/block-editor/build-module/components/rich-text/multiline.js 61060 61061 61062 61063 61064 61065 61066 61067 61068 61069 61070 function RichTextMultiline({ 61071 children, 61072 identifier, 61073 tagName: TagName = "div", 61074 value = "", 61075 onChange, 61076 multiline, 61077 ...props 61078 }, forwardedRef) { 61079 external_wp_deprecated_default()("wp.blockEditor.RichText multiline prop", { 61080 since: "6.1", 61081 version: "6.3", 61082 alternative: "nested blocks (InnerBlocks)", 61083 link: "https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/nested-blocks-inner-blocks/" 61084 }); 61085 const { clientId } = useBlockEditContext(); 61086 const { getSelectionStart, getSelectionEnd } = (0,external_wp_data_namespaceObject.useSelect)(store); 61087 const { selectionChange } = (0,external_wp_data_namespaceObject.useDispatch)(store); 61088 const multilineTagName = getMultilineTag(multiline); 61089 value = value || `<$multilineTagName}></$multilineTagName}>`; 61090 const padded = `</$multilineTagName}>$value}<$multilineTagName}>`; 61091 const values = padded.split( 61092 `</$multilineTagName}><$multilineTagName}>` 61093 ); 61094 values.shift(); 61095 values.pop(); 61096 function _onChange(newValues) { 61097 onChange( 61098 `<$multilineTagName}>$newValues.join( 61099 `</$multilineTagName}><$multilineTagName}>` 61100 )}</$multilineTagName}>` 61101 ); 61102 } 61103 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(TagName, { ref: forwardedRef, children: values.map((_value, index) => { 61104 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 61105 RichTextWrapper, 61106 { 61107 identifier: `$identifier}-$index}`, 61108 tagName: multilineTagName, 61109 value: _value, 61110 onChange: (newValue) => { 61111 const newValues = values.slice(); 61112 newValues[index] = newValue; 61113 _onChange(newValues); 61114 }, 61115 isSelected: void 0, 61116 onKeyDown: (event) => { 61117 if (event.keyCode !== external_wp_keycodes_namespaceObject.ENTER) { 61118 return; 61119 } 61120 event.preventDefault(); 61121 const { offset: start } = getSelectionStart(); 61122 const { offset: end } = getSelectionEnd(); 61123 if (typeof start !== "number" || typeof end !== "number") { 61124 return; 61125 } 61126 const richTextValue = (0,external_wp_richText_namespaceObject.create)({ html: _value }); 61127 richTextValue.start = start; 61128 richTextValue.end = end; 61129 const array = (0,external_wp_richText_namespaceObject.split)(richTextValue).map( 61130 (v) => (0,external_wp_richText_namespaceObject.toHTMLString)({ value: v }) 61131 ); 61132 const newValues = values.slice(); 61133 newValues.splice(index, 1, ...array); 61134 _onChange(newValues); 61135 selectionChange( 61136 clientId, 61137 `$identifier}-$index + 1}`, 61138 0, 61139 0 61140 ); 61141 }, 61142 onMerge: (forward) => { 61143 const newValues = values.slice(); 61144 let offset = 0; 61145 if (forward) { 61146 if (!newValues[index + 1]) { 61147 return; 61148 } 61149 newValues.splice( 61150 index, 61151 2, 61152 newValues[index] + newValues[index + 1] 61153 ); 61154 offset = newValues[index].length - 1; 61155 } else { 61156 if (!newValues[index - 1]) { 61157 return; 61158 } 61159 newValues.splice( 61160 index - 1, 61161 2, 61162 newValues[index - 1] + newValues[index] 61163 ); 61164 offset = newValues[index - 1].length - 1; 61165 } 61166 _onChange(newValues); 61167 selectionChange( 61168 clientId, 61169 `$identifier}-$index - (forward ? 0 : 1)}`, 61170 offset, 61171 offset 61172 ); 61173 }, 61174 ...props 61175 }, 61176 index 61177 ); 61178 }) }); 61179 } 61180 var multiline_default = (0,external_wp_element_namespaceObject.forwardRef)(RichTextMultiline); 61181 61182 61183 ;// ./node_modules/@wordpress/block-editor/build-module/components/rich-text/with-deprecations.js 61184 61185 61186 61187 61188 61189 61190 function withDeprecations(Component) { 61191 return (0,external_wp_element_namespaceObject.forwardRef)((props, ref) => { 61192 let value = props.value; 61193 let onChange = props.onChange; 61194 if (Array.isArray(value)) { 61195 external_wp_deprecated_default()("wp.blockEditor.RichText value prop as children type", { 61196 since: "6.1", 61197 version: "6.3", 61198 alternative: "value prop as string", 61199 link: "https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/introducing-attributes-and-editable-fields/" 61200 }); 61201 value = external_wp_blocks_namespaceObject.children.toHTML(props.value); 61202 onChange = (newValue) => props.onChange( 61203 external_wp_blocks_namespaceObject.children.fromDOM( 61204 (0,external_wp_richText_namespaceObject.__unstableCreateElement)(document, newValue).childNodes 61205 ) 61206 ); 61207 } 61208 const NewComponent = props.multiline ? multiline_default : Component; 61209 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 61210 NewComponent, 61211 { 61212 ...props, 61213 value, 61214 onChange, 61215 ref 61216 } 61217 ); 61218 }); 61219 } 61220 61221 61222 ;// ./node_modules/@wordpress/block-editor/build-module/components/rich-text/index.js 61223 61224 61225 61226 61227 61228 61229 61230 61231 61232 61233 61234 61235 61236 61237 61238 61239 61240 61241 61242 61243 61244 61245 61246 61247 61248 const keyboardShortcutContext = (0,external_wp_element_namespaceObject.createContext)(); 61249 keyboardShortcutContext.displayName = "keyboardShortcutContext"; 61250 const inputEventContext = (0,external_wp_element_namespaceObject.createContext)(); 61251 inputEventContext.displayName = "inputEventContext"; 61252 const instanceIdKey = Symbol("instanceId"); 61253 function removeNativeProps(props) { 61254 const { 61255 __unstableMobileNoFocusOnMount, 61256 deleteEnter, 61257 placeholderTextColor, 61258 textAlign, 61259 selectionColor, 61260 tagsToEliminate, 61261 disableEditingMenu, 61262 fontSize, 61263 fontFamily, 61264 fontWeight, 61265 fontStyle, 61266 minWidth, 61267 maxWidth, 61268 disableSuggestions, 61269 disableAutocorrection, 61270 ...restProps 61271 } = props; 61272 return restProps; 61273 } 61274 function RichTextWrapper({ 61275 children, 61276 tagName = "div", 61277 value: adjustedValue = "", 61278 onChange: adjustedOnChange, 61279 isSelected: originalIsSelected, 61280 multiline, 61281 inlineToolbar, 61282 wrapperClassName, 61283 autocompleters, 61284 onReplace, 61285 placeholder, 61286 allowedFormats, 61287 withoutInteractiveFormatting, 61288 onRemove, 61289 onMerge, 61290 onSplit, 61291 __unstableOnSplitAtEnd: onSplitAtEnd, 61292 __unstableOnSplitAtDoubleLineEnd: onSplitAtDoubleLineEnd, 61293 identifier, 61294 preserveWhiteSpace, 61295 __unstablePastePlainText: pastePlainText, 61296 __unstableEmbedURLOnPaste, 61297 __unstableDisableFormats: disableFormats, 61298 disableLineBreaks, 61299 __unstableAllowPrefixTransformations, 61300 readOnly, 61301 ...props 61302 }, forwardedRef) { 61303 props = removeNativeProps(props); 61304 if (onSplit) { 61305 external_wp_deprecated_default()("wp.blockEditor.RichText onSplit prop", { 61306 since: "6.4", 61307 alternative: 'block.json support key: "splitting"' 61308 }); 61309 } 61310 const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(RichTextWrapper); 61311 const anchorRef = (0,external_wp_element_namespaceObject.useRef)(); 61312 const context = useBlockEditContext(); 61313 const { clientId, isSelected: isBlockSelected } = context; 61314 const blockBindings = context[blockBindingsKey]; 61315 const blockContext = (0,external_wp_element_namespaceObject.useContext)(block_context_default); 61316 const { bindableAttributes } = (0,external_wp_element_namespaceObject.useContext)(PrivateBlockContext); 61317 const registry = (0,external_wp_data_namespaceObject.useRegistry)(); 61318 const selector = (select) => { 61319 if (!isBlockSelected) { 61320 return { isSelected: false }; 61321 } 61322 const { getSelectionStart: getSelectionStart2, getSelectionEnd: getSelectionEnd2, getBlockEditingMode } = select(store); 61323 const selectionStart2 = getSelectionStart2(); 61324 const selectionEnd2 = getSelectionEnd2(); 61325 let isSelected2; 61326 if (originalIsSelected === void 0) { 61327 isSelected2 = selectionStart2.clientId === clientId && selectionEnd2.clientId === clientId && (identifier ? selectionStart2.attributeKey === identifier : selectionStart2[instanceIdKey] === instanceId); 61328 } else if (originalIsSelected) { 61329 isSelected2 = selectionStart2.clientId === clientId; 61330 } 61331 return { 61332 selectionStart: isSelected2 ? selectionStart2.offset : void 0, 61333 selectionEnd: isSelected2 ? selectionEnd2.offset : void 0, 61334 isSelected: isSelected2, 61335 isContentOnly: getBlockEditingMode(clientId) === "contentOnly" 61336 }; 61337 }; 61338 const { selectionStart, selectionEnd, isSelected, isContentOnly } = (0,external_wp_data_namespaceObject.useSelect)(selector, [ 61339 clientId, 61340 identifier, 61341 instanceId, 61342 originalIsSelected, 61343 isBlockSelected 61344 ]); 61345 const { disableBoundBlock, bindingsPlaceholder, bindingsLabel } = (0,external_wp_data_namespaceObject.useSelect)( 61346 (select) => { 61347 if (!blockBindings?.[identifier] || !bindableAttributes) { 61348 return {}; 61349 } 61350 const relatedBinding = blockBindings[identifier]; 61351 const blockBindingsSource = (0,external_wp_blocks_namespaceObject.getBlockBindingsSource)( 61352 relatedBinding.source 61353 ); 61354 const blockBindingsContext = {}; 61355 if (blockBindingsSource?.usesContext?.length) { 61356 for (const key of blockBindingsSource.usesContext) { 61357 blockBindingsContext[key] = blockContext[key]; 61358 } 61359 } 61360 const _disableBoundBlock = !blockBindingsSource?.canUserEditValue?.({ 61361 select, 61362 context: blockBindingsContext, 61363 args: relatedBinding.args 61364 }); 61365 if (adjustedValue.length > 0) { 61366 return { 61367 disableBoundBlock: _disableBoundBlock, 61368 // Null values will make them fall back to the default behavior. 61369 bindingsPlaceholder: null, 61370 bindingsLabel: null 61371 }; 61372 } 61373 const { getBlockAttributes } = select(store); 61374 const blockAttributes = getBlockAttributes(clientId); 61375 let clientSideFieldLabel = null; 61376 if (blockBindingsSource?.getFieldsList) { 61377 const fieldsItems = blockBindingsSource.getFieldsList({ 61378 select, 61379 context: blockBindingsContext 61380 }); 61381 clientSideFieldLabel = fieldsItems?.find( 61382 (item) => es6_default()(item.args, relatedBinding?.args) 61383 )?.label; 61384 } 61385 const bindingKey = clientSideFieldLabel ?? blockBindingsSource?.label; 61386 const _bindingsPlaceholder = _disableBoundBlock ? bindingKey : (0,external_wp_i18n_namespaceObject.sprintf)( 61387 /* translators: %s: connected field label or source label */ 61388 (0,external_wp_i18n_namespaceObject.__)("Add %s"), 61389 bindingKey 61390 ); 61391 const _bindingsLabel = _disableBoundBlock ? relatedBinding?.args?.key || blockBindingsSource?.label : (0,external_wp_i18n_namespaceObject.sprintf)( 61392 /* translators: %s: source label or key */ 61393 (0,external_wp_i18n_namespaceObject.__)("Empty %s; start writing to edit its value"), 61394 relatedBinding?.args?.key || blockBindingsSource?.label 61395 ); 61396 return { 61397 disableBoundBlock: _disableBoundBlock, 61398 bindingsPlaceholder: blockAttributes?.placeholder || _bindingsPlaceholder, 61399 bindingsLabel: _bindingsLabel 61400 }; 61401 }, 61402 [ 61403 blockBindings, 61404 identifier, 61405 bindableAttributes, 61406 adjustedValue, 61407 clientId, 61408 blockContext 61409 ] 61410 ); 61411 const isInsidePatternOverrides = !!blockContext?.["pattern/overrides"]; 61412 const hasOverrideEnabled = blockBindings?.__default?.source === "core/pattern-overrides"; 61413 const shouldDisableForPattern = isInsidePatternOverrides && !hasOverrideEnabled; 61414 const shouldDisableEditing = readOnly || disableBoundBlock || shouldDisableForPattern; 61415 const { getSelectionStart, getSelectionEnd, getBlockRootClientId } = (0,external_wp_data_namespaceObject.useSelect)(store); 61416 const { selectionChange } = (0,external_wp_data_namespaceObject.useDispatch)(store); 61417 const adjustedAllowedFormats = getAllowedFormats({ 61418 allowedFormats, 61419 disableFormats 61420 }); 61421 const hasFormats = !adjustedAllowedFormats || adjustedAllowedFormats.length > 0; 61422 const onSelectionChange = (0,external_wp_element_namespaceObject.useCallback)( 61423 (start, end) => { 61424 const selection = {}; 61425 const unset = start === void 0 && end === void 0; 61426 const baseSelection = { 61427 clientId, 61428 [identifier ? "attributeKey" : instanceIdKey]: identifier ? identifier : instanceId 61429 }; 61430 if (typeof start === "number" || unset) { 61431 if (end === void 0 && getBlockRootClientId(clientId) !== getBlockRootClientId(getSelectionEnd().clientId)) { 61432 return; 61433 } 61434 selection.start = { 61435 ...baseSelection, 61436 offset: start 61437 }; 61438 } 61439 if (typeof end === "number" || unset) { 61440 if (start === void 0 && getBlockRootClientId(clientId) !== getBlockRootClientId(getSelectionStart().clientId)) { 61441 return; 61442 } 61443 selection.end = { 61444 ...baseSelection, 61445 offset: end 61446 }; 61447 } 61448 selectionChange(selection); 61449 }, 61450 [ 61451 clientId, 61452 getBlockRootClientId, 61453 getSelectionEnd, 61454 getSelectionStart, 61455 identifier, 61456 instanceId, 61457 selectionChange 61458 ] 61459 ); 61460 const { 61461 formatTypes, 61462 prepareHandlers, 61463 valueHandlers, 61464 changeHandlers, 61465 dependencies 61466 } = useFormatTypes({ 61467 clientId, 61468 identifier, 61469 allowedFormats: adjustedAllowedFormats, 61470 withoutInteractiveFormatting, 61471 disableNoneEssentialFormatting: isContentOnly 61472 }); 61473 function addEditorOnlyFormats(value2) { 61474 return valueHandlers.reduce( 61475 (accumulator, fn) => fn(accumulator, value2.text), 61476 value2.formats 61477 ); 61478 } 61479 function removeEditorOnlyFormats(value2) { 61480 formatTypes.forEach((formatType) => { 61481 if (formatType.__experimentalCreatePrepareEditableTree) { 61482 value2 = (0,external_wp_richText_namespaceObject.removeFormat)( 61483 value2, 61484 formatType.name, 61485 0, 61486 value2.text.length 61487 ); 61488 } 61489 }); 61490 return value2.formats; 61491 } 61492 function addInvisibleFormats(value2) { 61493 return prepareHandlers.reduce( 61494 (accumulator, fn) => fn(accumulator, value2.text), 61495 value2.formats 61496 ); 61497 } 61498 const { 61499 value, 61500 getValue, 61501 onChange, 61502 ref: richTextRef 61503 } = (0,external_wp_richText_namespaceObject.__unstableUseRichText)({ 61504 value: adjustedValue, 61505 onChange(html, { __unstableFormats, __unstableText }) { 61506 adjustedOnChange(html); 61507 Object.values(changeHandlers).forEach((changeHandler) => { 61508 changeHandler(__unstableFormats, __unstableText); 61509 }); 61510 }, 61511 selectionStart, 61512 selectionEnd, 61513 onSelectionChange, 61514 placeholder: bindingsPlaceholder || placeholder, 61515 __unstableIsSelected: isSelected, 61516 __unstableDisableFormats: disableFormats, 61517 preserveWhiteSpace, 61518 __unstableDependencies: [...dependencies, tagName], 61519 __unstableAfterParse: addEditorOnlyFormats, 61520 __unstableBeforeSerialize: removeEditorOnlyFormats, 61521 __unstableAddInvisibleFormats: addInvisibleFormats 61522 }); 61523 const autocompleteProps = useBlockEditorAutocompleteProps({ 61524 onReplace, 61525 completers: autocompleters, 61526 record: value, 61527 onChange 61528 }); 61529 useMarkPersistent({ html: adjustedValue, value }); 61530 const keyboardShortcuts = (0,external_wp_element_namespaceObject.useRef)(/* @__PURE__ */ new Set()); 61531 const inputEvents = (0,external_wp_element_namespaceObject.useRef)(/* @__PURE__ */ new Set()); 61532 function onFocus() { 61533 anchorRef.current?.focus(); 61534 } 61535 const TagName = tagName; 61536 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 61537 isSelected && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(keyboardShortcutContext.Provider, { value: keyboardShortcuts, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(inputEventContext.Provider, { value: inputEvents, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Popover.__unstableSlotNameProvider, { value: "__unstable-block-tools-after", children: [ 61538 children && children({ value, onChange, onFocus }), 61539 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 61540 FormatEdit, 61541 { 61542 value, 61543 onChange, 61544 onFocus, 61545 formatTypes, 61546 forwardedRef: anchorRef 61547 } 61548 ) 61549 ] }) }) }), 61550 isSelected && hasFormats && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 61551 format_toolbar_container_default, 61552 { 61553 inline: inlineToolbar, 61554 editableContentElement: anchorRef.current 61555 } 61556 ), 61557 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 61558 TagName, 61559 { 61560 role: "textbox", 61561 "aria-multiline": !disableLineBreaks, 61562 "aria-readonly": shouldDisableEditing, 61563 ...props, 61564 draggable: void 0, 61565 "aria-label": bindingsLabel || props["aria-label"] || placeholder, 61566 ...autocompleteProps, 61567 ref: (0,external_wp_compose_namespaceObject.useMergeRefs)([ 61568 // Rich text ref must be first because its focus listener 61569 // must be set up before any other ref calls .focus() on 61570 // mount. 61571 richTextRef, 61572 forwardedRef, 61573 autocompleteProps.ref, 61574 props.ref, 61575 useEventListeners({ 61576 registry, 61577 getValue, 61578 onChange, 61579 __unstableAllowPrefixTransformations, 61580 formatTypes, 61581 onReplace, 61582 selectionChange, 61583 isSelected, 61584 disableFormats, 61585 value, 61586 tagName, 61587 onSplit, 61588 __unstableEmbedURLOnPaste, 61589 pastePlainText, 61590 onMerge, 61591 onRemove, 61592 removeEditorOnlyFormats, 61593 disableLineBreaks, 61594 onSplitAtEnd, 61595 onSplitAtDoubleLineEnd, 61596 keyboardShortcuts, 61597 inputEvents 61598 }), 61599 anchorRef 61600 ]), 61601 contentEditable: !shouldDisableEditing, 61602 suppressContentEditableWarning: true, 61603 className: dist_clsx( 61604 "block-editor-rich-text__editable", 61605 props.className, 61606 "rich-text" 61607 ), 61608 tabIndex: props.tabIndex === 0 && !shouldDisableEditing ? null : props.tabIndex, 61609 "data-wp-block-attribute-key": identifier 61610 } 61611 ) 61612 ] }); 61613 } 61614 const PrivateRichText = withDeprecations( 61615 (0,external_wp_element_namespaceObject.forwardRef)(RichTextWrapper) 61616 ); 61617 PrivateRichText.Content = Content; 61618 PrivateRichText.isEmpty = (value) => { 61619 return !value || value.length === 0; 61620 }; 61621 const PublicForwardedRichTextContainer = (0,external_wp_element_namespaceObject.forwardRef)((props, ref) => { 61622 const context = useBlockEditContext(); 61623 const isPreviewMode = context[isPreviewModeKey]; 61624 if (isPreviewMode) { 61625 const { 61626 children, 61627 tagName: Tag = "div", 61628 value, 61629 onChange, 61630 isSelected, 61631 multiline, 61632 inlineToolbar, 61633 wrapperClassName, 61634 autocompleters, 61635 onReplace, 61636 placeholder, 61637 allowedFormats, 61638 withoutInteractiveFormatting, 61639 onRemove, 61640 onMerge, 61641 onSplit, 61642 __unstableOnSplitAtEnd, 61643 __unstableOnSplitAtDoubleLineEnd, 61644 identifier, 61645 preserveWhiteSpace, 61646 __unstablePastePlainText, 61647 __unstableEmbedURLOnPaste, 61648 __unstableDisableFormats, 61649 disableLineBreaks, 61650 __unstableAllowPrefixTransformations, 61651 readOnly, 61652 ...contentProps 61653 } = removeNativeProps(props); 61654 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 61655 Tag, 61656 { 61657 ...contentProps, 61658 dangerouslySetInnerHTML: { 61659 __html: valueToHTMLString(value, multiline) 61660 } 61661 } 61662 ); 61663 } 61664 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PrivateRichText, { ref, ...props, readOnly: false }); 61665 }); 61666 PublicForwardedRichTextContainer.Content = Content; 61667 PublicForwardedRichTextContainer.isEmpty = (value) => { 61668 return !value || value.length === 0; 61669 }; 61670 var rich_text_default = PublicForwardedRichTextContainer; 61671 61672 61673 61674 61675 61676 ;// ./node_modules/@wordpress/block-editor/build-module/components/editable-text/index.js 61677 61678 61679 61680 const EditableText = (0,external_wp_element_namespaceObject.forwardRef)((props, ref) => { 61681 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(rich_text_default, { ref, ...props, __unstableDisableFormats: true }); 61682 }); 61683 EditableText.Content = ({ value = "", tagName: Tag = "div", ...props }) => { 61684 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Tag, { ...props, children: value }); 61685 }; 61686 var editable_text_default = EditableText; 61687 61688 61689 ;// ./node_modules/@wordpress/block-editor/build-module/components/plain-text/index.js 61690 61691 61692 61693 61694 61695 const PlainText = (0,external_wp_element_namespaceObject.forwardRef)(({ __experimentalVersion, ...props }, ref) => { 61696 if (__experimentalVersion === 2) { 61697 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(editable_text_default, { ref, ...props }); 61698 } 61699 const { className, onChange, ...remainingProps } = props; 61700 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 61701 lib/* default */.A, 61702 { 61703 ref, 61704 className: dist_clsx("block-editor-plain-text", className), 61705 onChange: (event) => onChange(event.target.value), 61706 ...remainingProps 61707 } 61708 ); 61709 }); 61710 var plain_text_default = PlainText; 61711 61712 61713 ;// ./node_modules/@wordpress/block-editor/build-module/components/responsive-block-control/label.js 61714 61715 61716 61717 61718 function ResponsiveBlockControlLabel({ 61719 property, 61720 viewport, 61721 desc 61722 }) { 61723 const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(ResponsiveBlockControlLabel); 61724 const accessibleLabel = desc || (0,external_wp_i18n_namespaceObject.sprintf)( 61725 /* translators: 1: property name. 2: viewport name. */ 61726 (0,external_wp_i18n_namespaceObject._x)( 61727 "Controls the %1$s property for %2$s viewports.", 61728 "Text labelling a interface as controlling a given layout property (eg: margin) for a given screen size." 61729 ), 61730 property, 61731 viewport.label 61732 ); 61733 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 61734 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { "aria-describedby": `rbc-desc-$instanceId}`, children: viewport.label }), 61735 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, { as: "span", id: `rbc-desc-$instanceId}`, children: accessibleLabel }) 61736 ] }); 61737 } 61738 61739 61740 ;// ./node_modules/@wordpress/block-editor/build-module/components/responsive-block-control/index.js 61741 61742 61743 61744 61745 61746 61747 function ResponsiveBlockControl(props) { 61748 const { 61749 title, 61750 property, 61751 toggleLabel, 61752 onIsResponsiveChange, 61753 renderDefaultControl, 61754 renderResponsiveControls, 61755 isResponsive = false, 61756 defaultLabel = { 61757 id: "all", 61758 label: (0,external_wp_i18n_namespaceObject._x)("All", "screen sizes") 61759 }, 61760 viewports = [ 61761 { 61762 id: "small", 61763 label: (0,external_wp_i18n_namespaceObject.__)("Small screens") 61764 }, 61765 { 61766 id: "medium", 61767 label: (0,external_wp_i18n_namespaceObject.__)("Medium screens") 61768 }, 61769 { 61770 id: "large", 61771 label: (0,external_wp_i18n_namespaceObject.__)("Large screens") 61772 } 61773 ] 61774 } = props; 61775 if (!title || !property || !renderDefaultControl) { 61776 return null; 61777 } 61778 const toggleControlLabel = toggleLabel || (0,external_wp_i18n_namespaceObject.sprintf)( 61779 /* translators: %s: Property value for the control (eg: margin, padding, etc.). */ 61780 (0,external_wp_i18n_namespaceObject.__)("Use the same %s on all screen sizes."), 61781 property 61782 ); 61783 const toggleHelpText = (0,external_wp_i18n_namespaceObject.__)( 61784 "Choose whether to use the same value for all screen sizes or a unique value for each screen size." 61785 ); 61786 const defaultControl = renderDefaultControl( 61787 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 61788 ResponsiveBlockControlLabel, 61789 { 61790 property, 61791 viewport: defaultLabel 61792 } 61793 ), 61794 defaultLabel 61795 ); 61796 const defaultResponsiveControls = () => { 61797 return viewports.map((viewport) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_element_namespaceObject.Fragment, { children: renderDefaultControl( 61798 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 61799 ResponsiveBlockControlLabel, 61800 { 61801 property, 61802 viewport 61803 } 61804 ), 61805 viewport 61806 ) }, viewport.id)); 61807 }; 61808 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("fieldset", { className: "block-editor-responsive-block-control", children: [ 61809 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("legend", { className: "block-editor-responsive-block-control__title", children: title }), 61810 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-editor-responsive-block-control__inner", children: [ 61811 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 61812 external_wp_components_namespaceObject.ToggleControl, 61813 { 61814 __nextHasNoMarginBottom: true, 61815 className: "block-editor-responsive-block-control__toggle", 61816 label: toggleControlLabel, 61817 checked: !isResponsive, 61818 onChange: onIsResponsiveChange, 61819 help: toggleHelpText 61820 } 61821 ), 61822 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 61823 "div", 61824 { 61825 className: dist_clsx( 61826 "block-editor-responsive-block-control__group", 61827 { 61828 "is-responsive": isResponsive 61829 } 61830 ), 61831 children: [ 61832 !isResponsive && defaultControl, 61833 isResponsive && (renderResponsiveControls ? renderResponsiveControls(viewports) : defaultResponsiveControls()) 61834 ] 61835 } 61836 ) 61837 ] }) 61838 ] }); 61839 } 61840 var responsive_block_control_default = ResponsiveBlockControl; 61841 61842 61843 ;// ./node_modules/@wordpress/block-editor/build-module/components/rich-text/shortcut.js 61844 61845 61846 61847 function RichTextShortcut({ character, type, onUse }) { 61848 const keyboardShortcuts = (0,external_wp_element_namespaceObject.useContext)(keyboardShortcutContext); 61849 const onUseRef = (0,external_wp_element_namespaceObject.useRef)(); 61850 onUseRef.current = onUse; 61851 (0,external_wp_element_namespaceObject.useEffect)(() => { 61852 function callback(event) { 61853 if (external_wp_keycodes_namespaceObject.isKeyboardEvent[type](event, character)) { 61854 onUseRef.current(); 61855 event.preventDefault(); 61856 } 61857 } 61858 keyboardShortcuts.current.add(callback); 61859 return () => { 61860 keyboardShortcuts.current.delete(callback); 61861 }; 61862 }, [character, type]); 61863 return null; 61864 } 61865 61866 61867 ;// ./node_modules/@wordpress/block-editor/build-module/components/rich-text/toolbar-button.js 61868 61869 61870 61871 function RichTextToolbarButton({ 61872 name, 61873 shortcutType, 61874 shortcutCharacter, 61875 ...props 61876 }) { 61877 let shortcut; 61878 let fillName = "RichText.ToolbarControls"; 61879 if (name) { 61880 fillName += `.$name}`; 61881 } 61882 if (shortcutType && shortcutCharacter) { 61883 shortcut = external_wp_keycodes_namespaceObject.displayShortcut[shortcutType](shortcutCharacter); 61884 } 61885 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Fill, { name: fillName, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarButton, { ...props, shortcut }) }); 61886 } 61887 61888 61889 ;// ./node_modules/@wordpress/block-editor/build-module/components/rich-text/input-event.js 61890 61891 61892 function __unstableRichTextInputEvent({ inputType, onInput }) { 61893 const callbacks = (0,external_wp_element_namespaceObject.useContext)(inputEventContext); 61894 const onInputRef = (0,external_wp_element_namespaceObject.useRef)(); 61895 onInputRef.current = onInput; 61896 (0,external_wp_element_namespaceObject.useEffect)(() => { 61897 function callback(event) { 61898 if (event.inputType === inputType) { 61899 onInputRef.current(); 61900 event.preventDefault(); 61901 } 61902 } 61903 callbacks.current.add(callback); 61904 return () => { 61905 callbacks.current.delete(callback); 61906 }; 61907 }, [inputType]); 61908 return null; 61909 } 61910 61911 61912 ;// ./node_modules/@wordpress/block-editor/build-module/components/unit-control/index.js 61913 61914 61915 61916 function UnitControl({ units: unitsProp, ...props }) { 61917 const [availableUnits] = use_settings_useSettings("spacing.units"); 61918 const units = (0,external_wp_components_namespaceObject.__experimentalUseCustomUnits)({ 61919 availableUnits: availableUnits || ["%", "px", "em", "rem", "vw"], 61920 units: unitsProp 61921 }); 61922 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalUnitControl, { units, ...props }); 61923 } 61924 61925 61926 ;// ./node_modules/@wordpress/icons/build-module/library/arrow-left.js 61927 61928 61929 var arrow_left_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M20 11.2H6.8l3.7-3.7-1-1L3.9 12l5.6 5.5 1-1-3.7-3.7H20z" }) }); 61930 61931 61932 ;// ./node_modules/@wordpress/block-editor/build-module/components/url-input/button.js 61933 61934 61935 61936 61937 61938 61939 function URLInputButton({ url, onChange }) { 61940 const [expanded, toggleExpanded] = (0,external_wp_element_namespaceObject.useReducer)( 61941 (isExpanded) => !isExpanded, 61942 false 61943 ); 61944 const submitLink = (event) => { 61945 event.preventDefault(); 61946 toggleExpanded(); 61947 }; 61948 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-editor-url-input__button", children: [ 61949 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 61950 external_wp_components_namespaceObject.Button, 61951 { 61952 size: "compact", 61953 icon: link_default, 61954 label: url ? (0,external_wp_i18n_namespaceObject.__)("Edit link") : (0,external_wp_i18n_namespaceObject.__)("Insert link"), 61955 onClick: toggleExpanded, 61956 className: "components-toolbar__control", 61957 isPressed: !!url 61958 } 61959 ), 61960 expanded && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 61961 "form", 61962 { 61963 className: "block-editor-url-input__button-modal", 61964 onSubmit: submitLink, 61965 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-editor-url-input__button-modal-line", children: [ 61966 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 61967 external_wp_components_namespaceObject.Button, 61968 { 61969 __next40pxDefaultSize: true, 61970 className: "block-editor-url-input__back", 61971 icon: arrow_left_default, 61972 label: (0,external_wp_i18n_namespaceObject.__)("Close"), 61973 onClick: toggleExpanded 61974 } 61975 ), 61976 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 61977 url_input_default, 61978 { 61979 value: url || "", 61980 onChange, 61981 suffix: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalInputControlSuffixWrapper, { variant: "control", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 61982 external_wp_components_namespaceObject.Button, 61983 { 61984 size: "small", 61985 icon: keyboard_return_default, 61986 label: (0,external_wp_i18n_namespaceObject.__)("Submit"), 61987 type: "submit" 61988 } 61989 ) }) 61990 } 61991 ) 61992 ] }) 61993 } 61994 ) 61995 ] }); 61996 } 61997 var button_default = URLInputButton; 61998 61999 62000 ;// ./node_modules/@wordpress/icons/build-module/library/image.js 62001 62002 62003 var image_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 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.5v8.4l-3-2.9c-.3-.3-.8-.3-1 0L11.9 14 9 12c-.3-.2-.6-.2-.8 0l-3.6 2.6V5c-.1-.3.1-.5.4-.5zm14 15H5c-.3 0-.5-.2-.5-.5v-2.4l4.1-3 3 1.9c.3.2.7.2.9-.1L16 12l3.5 3.4V19c0 .3-.2.5-.5.5z" }) }); 62004 62005 62006 ;// ./node_modules/@wordpress/block-editor/build-module/components/url-popover/image-url-input-ui.js 62007 62008 62009 62010 62011 62012 62013 62014 62015 const LINK_DESTINATION_NONE = "none"; 62016 const LINK_DESTINATION_CUSTOM = "custom"; 62017 const LINK_DESTINATION_MEDIA = "media"; 62018 const LINK_DESTINATION_ATTACHMENT = "attachment"; 62019 const NEW_TAB_REL = ["noreferrer", "noopener"]; 62020 const ImageURLInputUI = ({ 62021 linkDestination, 62022 onChangeUrl, 62023 url, 62024 mediaType = "image", 62025 mediaUrl, 62026 mediaLink, 62027 linkTarget, 62028 linkClass, 62029 rel, 62030 showLightboxSetting, 62031 lightboxEnabled, 62032 onSetLightbox, 62033 resetLightbox 62034 }) => { 62035 const [isOpen, setIsOpen] = (0,external_wp_element_namespaceObject.useState)(false); 62036 const [popoverAnchor, setPopoverAnchor] = (0,external_wp_element_namespaceObject.useState)(null); 62037 const openLinkUI = () => { 62038 setIsOpen(true); 62039 }; 62040 const [isEditingLink, setIsEditingLink] = (0,external_wp_element_namespaceObject.useState)(false); 62041 const [urlInput, setUrlInput] = (0,external_wp_element_namespaceObject.useState)(null); 62042 const autocompleteRef = (0,external_wp_element_namespaceObject.useRef)(null); 62043 const wrapperRef = (0,external_wp_element_namespaceObject.useRef)(); 62044 (0,external_wp_element_namespaceObject.useEffect)(() => { 62045 if (!wrapperRef.current) { 62046 return; 62047 } 62048 const nextFocusTarget = external_wp_dom_namespaceObject.focus.focusable.find(wrapperRef.current)[0] || wrapperRef.current; 62049 nextFocusTarget.focus(); 62050 }, [isEditingLink, url, lightboxEnabled]); 62051 const startEditLink = () => { 62052 if (linkDestination === LINK_DESTINATION_MEDIA || linkDestination === LINK_DESTINATION_ATTACHMENT) { 62053 setUrlInput(""); 62054 } 62055 setIsEditingLink(true); 62056 }; 62057 const stopEditLink = () => { 62058 setIsEditingLink(false); 62059 }; 62060 const closeLinkUI = () => { 62061 setUrlInput(null); 62062 stopEditLink(); 62063 setIsOpen(false); 62064 }; 62065 const getUpdatedLinkTargetSettings = (value) => { 62066 const newLinkTarget = value ? "_blank" : void 0; 62067 let updatedRel; 62068 if (newLinkTarget) { 62069 const rels = (rel ?? "").split(" "); 62070 NEW_TAB_REL.forEach((relVal) => { 62071 if (!rels.includes(relVal)) { 62072 rels.push(relVal); 62073 } 62074 }); 62075 updatedRel = rels.join(" "); 62076 } else { 62077 const rels = (rel ?? "").split(" ").filter( 62078 (relVal) => NEW_TAB_REL.includes(relVal) === false 62079 ); 62080 updatedRel = rels.length ? rels.join(" ") : void 0; 62081 } 62082 return { 62083 linkTarget: newLinkTarget, 62084 rel: updatedRel 62085 }; 62086 }; 62087 const onFocusOutside = () => { 62088 return (event) => { 62089 const autocompleteElement = autocompleteRef.current; 62090 if (autocompleteElement && autocompleteElement.contains(event.target)) { 62091 return; 62092 } 62093 setIsOpen(false); 62094 setUrlInput(null); 62095 stopEditLink(); 62096 }; 62097 }; 62098 const onSubmitLinkChange = () => { 62099 return (event) => { 62100 if (urlInput) { 62101 const selectedDestination = getLinkDestinations().find( 62102 (destination) => destination.url === urlInput 62103 )?.linkDestination || LINK_DESTINATION_CUSTOM; 62104 onChangeUrl({ 62105 href: (0,external_wp_url_namespaceObject.prependHTTP)(urlInput), 62106 linkDestination: selectedDestination, 62107 lightbox: { enabled: false } 62108 }); 62109 } 62110 stopEditLink(); 62111 setUrlInput(null); 62112 event.preventDefault(); 62113 }; 62114 }; 62115 const onLinkRemove = () => { 62116 onChangeUrl({ 62117 linkDestination: LINK_DESTINATION_NONE, 62118 href: "" 62119 }); 62120 }; 62121 const getLinkDestinations = () => { 62122 const linkDestinations = [ 62123 { 62124 linkDestination: LINK_DESTINATION_MEDIA, 62125 title: (0,external_wp_i18n_namespaceObject.__)("Link to image file"), 62126 url: mediaType === "image" ? mediaUrl : void 0, 62127 icon: image_default 62128 } 62129 ]; 62130 if (mediaType === "image" && mediaLink) { 62131 linkDestinations.push({ 62132 linkDestination: LINK_DESTINATION_ATTACHMENT, 62133 title: (0,external_wp_i18n_namespaceObject.__)("Link to attachment page"), 62134 url: mediaType === "image" ? mediaLink : void 0, 62135 icon: page_default 62136 }); 62137 } 62138 return linkDestinations; 62139 }; 62140 const onSetHref = (value) => { 62141 const linkDestinations = getLinkDestinations(); 62142 let linkDestinationInput; 62143 if (!value) { 62144 linkDestinationInput = LINK_DESTINATION_NONE; 62145 } else { 62146 linkDestinationInput = (linkDestinations.find((destination) => { 62147 return destination.url === value; 62148 }) || { linkDestination: LINK_DESTINATION_CUSTOM }).linkDestination; 62149 } 62150 onChangeUrl({ 62151 linkDestination: linkDestinationInput, 62152 href: value 62153 }); 62154 }; 62155 const onSetNewTab = (value) => { 62156 const updatedLinkTarget = getUpdatedLinkTargetSettings(value); 62157 onChangeUrl(updatedLinkTarget); 62158 }; 62159 const onSetLinkRel = (value) => { 62160 onChangeUrl({ rel: value }); 62161 }; 62162 const onSetLinkClass = (value) => { 62163 onChangeUrl({ linkClass: value }); 62164 }; 62165 const advancedOptions = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: "3", children: [ 62166 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 62167 external_wp_components_namespaceObject.ToggleControl, 62168 { 62169 __nextHasNoMarginBottom: true, 62170 label: (0,external_wp_i18n_namespaceObject.__)("Open in new tab"), 62171 onChange: onSetNewTab, 62172 checked: linkTarget === "_blank" 62173 } 62174 ), 62175 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 62176 external_wp_components_namespaceObject.TextControl, 62177 { 62178 __next40pxDefaultSize: true, 62179 __nextHasNoMarginBottom: true, 62180 label: (0,external_wp_i18n_namespaceObject.__)("Link relation"), 62181 value: rel ?? "", 62182 onChange: onSetLinkRel, 62183 help: (0,external_wp_element_namespaceObject.createInterpolateElement)( 62184 (0,external_wp_i18n_namespaceObject.__)( 62185 "The <a>Link Relation</a> attribute defines the relationship between a linked resource and the current document." 62186 ), 62187 { 62188 a: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ExternalLink, { href: "https://developer.mozilla.org/docs/Web/HTML/Attributes/rel" }) 62189 } 62190 ) 62191 } 62192 ), 62193 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 62194 external_wp_components_namespaceObject.TextControl, 62195 { 62196 __next40pxDefaultSize: true, 62197 __nextHasNoMarginBottom: true, 62198 label: (0,external_wp_i18n_namespaceObject.__)("Link CSS class"), 62199 value: linkClass || "", 62200 onChange: onSetLinkClass 62201 } 62202 ) 62203 ] }); 62204 const linkEditorValue = urlInput !== null ? urlInput : url; 62205 const hideLightboxPanel = !lightboxEnabled || lightboxEnabled && !showLightboxSetting; 62206 const showLinkEditor = !linkEditorValue && hideLightboxPanel; 62207 const urlLabel = (getLinkDestinations().find( 62208 (destination) => destination.linkDestination === linkDestination 62209 ) || {}).title; 62210 const PopoverChildren = () => { 62211 if (lightboxEnabled && showLightboxSetting && !url && !isEditingLink) { 62212 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-editor-url-popover__expand-on-click", children: [ 62213 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(icon_default, { icon: fullscreen_default }), 62214 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "text", children: [ 62215 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { children: (0,external_wp_i18n_namespaceObject.__)("Enlarge on click") }), 62216 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { className: "description", children: (0,external_wp_i18n_namespaceObject.__)("Scales the image with a lightbox effect") }) 62217 ] }), 62218 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 62219 external_wp_components_namespaceObject.Button, 62220 { 62221 icon: link_off_default, 62222 label: (0,external_wp_i18n_namespaceObject.__)("Disable enlarge on click"), 62223 onClick: () => { 62224 onSetLightbox?.(false); 62225 }, 62226 size: "compact" 62227 } 62228 ) 62229 ] }); 62230 } else if (!url || isEditingLink) { 62231 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 62232 url_popover_default.LinkEditor, 62233 { 62234 className: "block-editor-format-toolbar__link-container-content", 62235 value: linkEditorValue, 62236 onChangeInputValue: setUrlInput, 62237 onSubmit: onSubmitLinkChange(), 62238 autocompleteRef 62239 } 62240 ); 62241 } else if (url && !isEditingLink) { 62242 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 62243 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 62244 url_popover_default.LinkViewer, 62245 { 62246 className: "block-editor-format-toolbar__link-container-content", 62247 url, 62248 onEditLinkClick: startEditLink, 62249 urlLabel 62250 } 62251 ), 62252 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 62253 external_wp_components_namespaceObject.Button, 62254 { 62255 icon: link_off_default, 62256 label: (0,external_wp_i18n_namespaceObject.__)("Remove link"), 62257 onClick: () => { 62258 onLinkRemove(); 62259 resetLightbox?.(); 62260 }, 62261 size: "compact" 62262 } 62263 ) 62264 ] }); 62265 } 62266 }; 62267 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 62268 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 62269 external_wp_components_namespaceObject.ToolbarButton, 62270 { 62271 icon: link_default, 62272 className: "components-toolbar__control", 62273 label: (0,external_wp_i18n_namespaceObject.__)("Link"), 62274 "aria-expanded": isOpen, 62275 onClick: openLinkUI, 62276 ref: setPopoverAnchor, 62277 isActive: !!url || lightboxEnabled && showLightboxSetting 62278 } 62279 ), 62280 isOpen && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 62281 url_popover_default, 62282 { 62283 ref: wrapperRef, 62284 anchor: popoverAnchor, 62285 onFocusOutside: onFocusOutside(), 62286 onClose: closeLinkUI, 62287 renderSettings: hideLightboxPanel ? () => advancedOptions : null, 62288 additionalControls: showLinkEditor && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.NavigableMenu, { children: [ 62289 getLinkDestinations().map((link) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 62290 external_wp_components_namespaceObject.MenuItem, 62291 { 62292 icon: link.icon, 62293 iconPosition: "left", 62294 onClick: () => { 62295 setUrlInput(null); 62296 onSetHref(link.url); 62297 stopEditLink(); 62298 }, 62299 children: link.title 62300 }, 62301 link.linkDestination 62302 )), 62303 showLightboxSetting && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 62304 external_wp_components_namespaceObject.MenuItem, 62305 { 62306 className: "block-editor-url-popover__expand-on-click", 62307 icon: fullscreen_default, 62308 info: (0,external_wp_i18n_namespaceObject.__)( 62309 "Scale the image with a lightbox effect." 62310 ), 62311 iconPosition: "left", 62312 onClick: () => { 62313 setUrlInput(null); 62314 onChangeUrl({ 62315 linkDestination: LINK_DESTINATION_NONE, 62316 href: "" 62317 }); 62318 onSetLightbox?.(true); 62319 stopEditLink(); 62320 }, 62321 children: (0,external_wp_i18n_namespaceObject.__)("Enlarge on click") 62322 }, 62323 "expand-on-click" 62324 ) 62325 ] }), 62326 offset: 13, 62327 children: PopoverChildren() 62328 } 62329 ) 62330 ] }); 62331 }; 62332 62333 62334 ;// ./node_modules/@wordpress/block-editor/build-module/components/preview-options/index.js 62335 62336 function PreviewOptions() { 62337 external_wp_deprecated_default()("wp.blockEditor.PreviewOptions", { 62338 version: "6.5" 62339 }); 62340 return null; 62341 } 62342 62343 62344 ;// ./node_modules/@wordpress/block-editor/build-module/components/use-resize-canvas/index.js 62345 62346 function useResizeCanvas(deviceType) { 62347 const [actualWidth, updateActualWidth] = (0,external_wp_element_namespaceObject.useState)(window.innerWidth); 62348 (0,external_wp_element_namespaceObject.useEffect)(() => { 62349 if (deviceType === "Desktop") { 62350 return; 62351 } 62352 const resizeListener = () => updateActualWidth(window.innerWidth); 62353 window.addEventListener("resize", resizeListener); 62354 return () => { 62355 window.removeEventListener("resize", resizeListener); 62356 }; 62357 }, [deviceType]); 62358 const getCanvasWidth = (device) => { 62359 let deviceWidth; 62360 switch (device) { 62361 case "Tablet": 62362 deviceWidth = 780; 62363 break; 62364 case "Mobile": 62365 deviceWidth = 360; 62366 break; 62367 default: 62368 return null; 62369 } 62370 return deviceWidth < actualWidth ? deviceWidth : actualWidth; 62371 }; 62372 const contentInlineStyles = (device) => { 62373 const height = device === "Mobile" ? "768px" : "1024px"; 62374 const marginVertical = "40px"; 62375 const marginHorizontal = "auto"; 62376 switch (device) { 62377 case "Tablet": 62378 case "Mobile": 62379 return { 62380 width: getCanvasWidth(device), 62381 // Keeping margin styles separate to avoid warnings 62382 // when those props get overridden in the iframe component 62383 marginTop: marginVertical, 62384 marginBottom: marginVertical, 62385 marginLeft: marginHorizontal, 62386 marginRight: marginHorizontal, 62387 height, 62388 overflowY: "auto" 62389 }; 62390 default: 62391 return { 62392 marginLeft: marginHorizontal, 62393 marginRight: marginHorizontal 62394 }; 62395 } 62396 }; 62397 return contentInlineStyles(deviceType); 62398 } 62399 62400 62401 ;// ./node_modules/@wordpress/block-editor/build-module/components/block-inspector/edit-contents-button.js 62402 62403 62404 62405 62406 62407 function EditContentsButton({ clientId }) { 62408 const { updateBlockAttributes } = (0,external_wp_data_namespaceObject.useDispatch)(store); 62409 const { attributes } = (0,external_wp_data_namespaceObject.useSelect)( 62410 (select) => { 62411 return { 62412 attributes: select(store).getBlockAttributes(clientId) 62413 }; 62414 }, 62415 [clientId] 62416 ); 62417 if (!attributes?.metadata?.patternName) { 62418 return null; 62419 } 62420 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 62421 external_wp_components_namespaceObject.Button, 62422 { 62423 className: "block-editor-block-inspector-edit-contents-button", 62424 __next40pxDefaultSize: true, 62425 variant: "secondary", 62426 onClick: () => { 62427 const { patternName, ...metadataWithoutPatternName } = attributes?.metadata ?? {}; 62428 updateBlockAttributes(clientId, { 62429 ...attributes, 62430 metadata: metadataWithoutPatternName 62431 }); 62432 }, 62433 children: (0,external_wp_i18n_namespaceObject.__)("Edit contents") 62434 } 62435 ); 62436 } 62437 62438 62439 ;// ./node_modules/@wordpress/block-editor/build-module/components/skip-to-selected-block/index.js 62440 62441 62442 62443 62444 62445 62446 62447 function SkipToSelectedBlock() { 62448 const selectedBlockClientId = (0,external_wp_data_namespaceObject.useSelect)( 62449 (select) => select(store).getBlockSelectionStart(), 62450 [] 62451 ); 62452 const ref = (0,external_wp_element_namespaceObject.useRef)(); 62453 useBlockElementRef(selectedBlockClientId, ref); 62454 const onClick = () => { 62455 ref.current?.focus(); 62456 }; 62457 return selectedBlockClientId ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 62458 external_wp_components_namespaceObject.Button, 62459 { 62460 __next40pxDefaultSize: true, 62461 variant: "secondary", 62462 className: "block-editor-skip-to-selected-block", 62463 onClick, 62464 children: (0,external_wp_i18n_namespaceObject.__)("Skip to the selected block") 62465 } 62466 ) : null; 62467 } 62468 62469 62470 ;// ./node_modules/@wordpress/block-editor/build-module/components/multi-selection-inspector/index.js 62471 62472 62473 62474 62475 62476 62477 62478 function MultiSelectionInspector() { 62479 const selectedBlockCount = (0,external_wp_data_namespaceObject.useSelect)( 62480 (select) => select(store).getSelectedBlockCount(), 62481 [] 62482 ); 62483 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 62484 external_wp_components_namespaceObject.__experimentalHStack, 62485 { 62486 justify: "flex-start", 62487 spacing: 2, 62488 className: "block-editor-multi-selection-inspector__card", 62489 children: [ 62490 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(block_icon_default, { icon: copy_default, showColors: true }), 62491 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-multi-selection-inspector__card-title", children: (0,external_wp_i18n_namespaceObject.sprintf)( 62492 /* translators: %d: number of blocks */ 62493 (0,external_wp_i18n_namespaceObject._n)("%d Block", "%d Blocks", selectedBlockCount), 62494 selectedBlockCount 62495 ) }) 62496 ] 62497 } 62498 ); 62499 } 62500 62501 62502 ;// ./node_modules/@wordpress/icons/build-module/library/cog.js 62503 62504 62505 var cog_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 62506 external_wp_primitives_namespaceObject.Path, 62507 { 62508 fillRule: "evenodd", 62509 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", 62510 clipRule: "evenodd" 62511 } 62512 ) }); 62513 62514 62515 ;// ./node_modules/@wordpress/icons/build-module/library/styles.js 62516 62517 62518 var styles_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 62519 external_wp_primitives_namespaceObject.Path, 62520 { 62521 fillRule: "evenodd", 62522 clipRule: "evenodd", 62523 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" 62524 } 62525 ) }); 62526 62527 62528 ;// ./node_modules/@wordpress/block-editor/build-module/components/inspector-controls-tabs/utils.js 62529 62530 62531 const TAB_SETTINGS = { 62532 name: "settings", 62533 title: (0,external_wp_i18n_namespaceObject.__)("Settings"), 62534 value: "settings", 62535 icon: cog_default 62536 }; 62537 const TAB_STYLES = { 62538 name: "styles", 62539 title: (0,external_wp_i18n_namespaceObject.__)("Styles"), 62540 value: "styles", 62541 icon: styles_default 62542 }; 62543 const TAB_CONTENT = { 62544 name: "content", 62545 title: (0,external_wp_i18n_namespaceObject.__)("Content"), 62546 value: "content", 62547 icon: page_default 62548 }; 62549 const TAB_LIST_VIEW = { 62550 name: "list", 62551 title: (0,external_wp_i18n_namespaceObject.__)("List View"), 62552 value: "list-view", 62553 icon: list_view_default 62554 }; 62555 62556 62557 ;// ./node_modules/@wordpress/block-editor/build-module/components/inspector-controls-tabs/advanced-controls-panel.js 62558 62559 62560 62561 62562 62563 const AdvancedControls = () => { 62564 const fills = (0,external_wp_components_namespaceObject.__experimentalUseSlotFills)(InspectorAdvancedControls.slotName); 62565 const privateFills = (0,external_wp_components_namespaceObject.__experimentalUseSlotFills)( 62566 PrivateInspectorControlsAllowedBlocks.name 62567 ); 62568 const hasFills = Boolean(fills && fills.length); 62569 const hasPrivateFills = Boolean(privateFills && privateFills.length); 62570 if (!hasFills && !hasPrivateFills) { 62571 return null; 62572 } 62573 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 62574 external_wp_components_namespaceObject.PanelBody, 62575 { 62576 className: "block-editor-block-inspector__advanced", 62577 title: (0,external_wp_i18n_namespaceObject.__)("Advanced"), 62578 initialOpen: false, 62579 children: [ 62580 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls_default.Slot, { group: "advanced" }), 62581 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PrivateInspectorControlsAllowedBlocks.Slot, {}) 62582 ] 62583 } 62584 ); 62585 }; 62586 var advanced_controls_panel_default = AdvancedControls; 62587 62588 62589 ;// ./node_modules/@wordpress/block-editor/build-module/components/inspector-controls-tabs/position-controls-panel.js 62590 62591 62592 62593 62594 62595 62596 62597 62598 62599 const PositionControlsPanel = () => { 62600 const { selectedClientIds, selectedBlocks, hasPositionAttribute } = (0,external_wp_data_namespaceObject.useSelect)((select) => { 62601 const { getBlocksByClientId, getSelectedBlockClientIds } = select(store); 62602 const selectedBlockClientIds = getSelectedBlockClientIds(); 62603 const _selectedBlocks = getBlocksByClientId( 62604 selectedBlockClientIds 62605 ); 62606 return { 62607 selectedClientIds: selectedBlockClientIds, 62608 selectedBlocks: _selectedBlocks, 62609 hasPositionAttribute: _selectedBlocks?.some( 62610 ({ attributes }) => !!attributes?.style?.position?.type 62611 ) 62612 }; 62613 }, []); 62614 const { updateBlockAttributes } = (0,external_wp_data_namespaceObject.useDispatch)(store); 62615 const dropdownMenuProps = useToolsPanelDropdownMenuProps(); 62616 function resetPosition() { 62617 if (!selectedClientIds?.length || !selectedBlocks?.length) { 62618 return; 62619 } 62620 const attributesByClientId = Object.fromEntries( 62621 selectedBlocks?.map(({ clientId, attributes }) => [ 62622 clientId, 62623 { 62624 style: utils_cleanEmptyObject({ 62625 ...attributes?.style, 62626 position: { 62627 ...attributes?.style?.position, 62628 type: void 0, 62629 top: void 0, 62630 right: void 0, 62631 bottom: void 0, 62632 left: void 0 62633 } 62634 }) 62635 } 62636 ]) 62637 ); 62638 updateBlockAttributes(selectedClientIds, attributesByClientId, true); 62639 } 62640 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 62641 external_wp_components_namespaceObject.__experimentalToolsPanel, 62642 { 62643 className: "block-editor-block-inspector__position", 62644 label: (0,external_wp_i18n_namespaceObject.__)("Position"), 62645 resetAll: resetPosition, 62646 dropdownMenuProps, 62647 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 62648 external_wp_components_namespaceObject.__experimentalToolsPanelItem, 62649 { 62650 isShownByDefault: hasPositionAttribute, 62651 label: (0,external_wp_i18n_namespaceObject.__)("Position"), 62652 hasValue: () => hasPositionAttribute, 62653 onDeselect: resetPosition, 62654 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls_default.Slot, { group: "position" }) 62655 } 62656 ) 62657 } 62658 ); 62659 }; 62660 const PositionControls = () => { 62661 const fills = (0,external_wp_components_namespaceObject.__experimentalUseSlotFills)(groups_groups_default.position.name); 62662 const hasFills = Boolean(fills && fills.length); 62663 if (!hasFills) { 62664 return null; 62665 } 62666 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PositionControlsPanel, {}); 62667 }; 62668 var position_controls_panel_default = PositionControls; 62669 62670 62671 ;// ./node_modules/@wordpress/block-editor/build-module/components/inspector-controls-tabs/settings-tab.js 62672 62673 62674 62675 62676 const SettingsTab = ({ showAdvancedControls = false }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 62677 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls_default.Slot, {}), 62678 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(position_controls_panel_default, {}), 62679 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls_default.Slot, { group: "bindings" }), 62680 showAdvancedControls && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(advanced_controls_panel_default, {}) }) 62681 ] }); 62682 var settings_tab_default = SettingsTab; 62683 62684 62685 ;// ./node_modules/@wordpress/block-editor/build-module/components/inspector-controls-tabs/styles-tab.js 62686 62687 62688 62689 62690 62691 62692 const StylesTab = ({ 62693 blockName, 62694 clientId, 62695 hasBlockStyles, 62696 isSectionBlock 62697 }) => { 62698 const borderPanelLabel = useBorderPanelLabel({ blockName }); 62699 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 62700 hasBlockStyles && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.PanelBody, { title: (0,external_wp_i18n_namespaceObject.__)("Styles"), children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(block_styles_default, { clientId }) }) }), 62701 !isSectionBlock && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 62702 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 62703 inspector_controls_default.Slot, 62704 { 62705 group: "color", 62706 label: (0,external_wp_i18n_namespaceObject.__)("Color"), 62707 className: "color-block-support-panel__inner-wrapper" 62708 } 62709 ), 62710 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 62711 inspector_controls_default.Slot, 62712 { 62713 group: "background", 62714 label: (0,external_wp_i18n_namespaceObject.__)("Background image") 62715 } 62716 ), 62717 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls_default.Slot, { group: "filter" }), 62718 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 62719 inspector_controls_default.Slot, 62720 { 62721 group: "typography", 62722 label: (0,external_wp_i18n_namespaceObject.__)("Typography") 62723 } 62724 ), 62725 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 62726 inspector_controls_default.Slot, 62727 { 62728 group: "dimensions", 62729 label: (0,external_wp_i18n_namespaceObject.__)("Dimensions") 62730 } 62731 ), 62732 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 62733 inspector_controls_default.Slot, 62734 { 62735 group: "border", 62736 label: borderPanelLabel 62737 } 62738 ), 62739 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls_default.Slot, { group: "styles" }) 62740 ] }) 62741 ] }); 62742 }; 62743 var styles_tab_default = StylesTab; 62744 62745 62746 ;// ./node_modules/@wordpress/block-editor/build-module/components/block-quick-navigation/index.js 62747 62748 62749 62750 62751 62752 62753 62754 function BlockQuickNavigation({ clientIds, onSelect }) { 62755 if (!clientIds.length) { 62756 return null; 62757 } 62758 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 1, children: clientIds.map((clientId) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 62759 BlockQuickNavigationItem, 62760 { 62761 onSelect, 62762 clientId 62763 }, 62764 clientId 62765 )) }); 62766 } 62767 function BlockQuickNavigationItem({ clientId, onSelect }) { 62768 const blockInformation = useBlockDisplayInformation(clientId); 62769 const blockTitle = useBlockDisplayTitle({ 62770 clientId, 62771 context: "list-view" 62772 }); 62773 const { isSelected } = (0,external_wp_data_namespaceObject.useSelect)( 62774 (select) => { 62775 const { isBlockSelected, hasSelectedInnerBlock } = select(store); 62776 return { 62777 isSelected: isBlockSelected(clientId) || hasSelectedInnerBlock( 62778 clientId, 62779 /* deep: */ 62780 true 62781 ) 62782 }; 62783 }, 62784 [clientId] 62785 ); 62786 const { selectBlock } = (0,external_wp_data_namespaceObject.useDispatch)(store); 62787 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 62788 external_wp_components_namespaceObject.Button, 62789 { 62790 __next40pxDefaultSize: true, 62791 isPressed: isSelected, 62792 onClick: async () => { 62793 await selectBlock(clientId); 62794 if (onSelect) { 62795 onSelect(clientId); 62796 } 62797 }, 62798 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, { children: [ 62799 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(block_icon_default, { icon: blockInformation?.icon }) }), 62800 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexBlock, { style: { textAlign: "left" }, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalTruncate, { children: blockTitle }) }) 62801 ] }) 62802 } 62803 ); 62804 } 62805 62806 62807 ;// ./node_modules/@wordpress/block-editor/build-module/components/inspector-controls-tabs/content-tab.js 62808 62809 62810 62811 62812 const ContentTab = ({ contentClientIds }) => { 62813 if (!contentClientIds || contentClientIds.length === 0) { 62814 return null; 62815 } 62816 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.PanelBody, { title: (0,external_wp_i18n_namespaceObject.__)("Content"), children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockQuickNavigation, { clientIds: contentClientIds }) }); 62817 }; 62818 var content_tab_default = ContentTab; 62819 62820 62821 ;// ./node_modules/@wordpress/block-editor/build-module/components/inspector-controls-tabs/use-is-list-view-tab-disabled.js 62822 const allowlist = ["core/navigation"]; 62823 const useIsListViewTabDisabled = (blockName) => { 62824 return !allowlist.includes(blockName); 62825 }; 62826 var use_is_list_view_tab_disabled_default = useIsListViewTabDisabled; 62827 62828 62829 ;// ./node_modules/@wordpress/block-editor/build-module/components/inspector-controls-tabs/index.js 62830 62831 62832 62833 62834 62835 62836 62837 62838 62839 62840 62841 62842 const { Tabs: inspector_controls_tabs_Tabs } = unlock(external_wp_components_namespaceObject.privateApis); 62843 function InspectorControlsTabs({ 62844 blockName, 62845 clientId, 62846 hasBlockStyles, 62847 tabs, 62848 isSectionBlock, 62849 contentClientIds 62850 }) { 62851 const showIconLabels = (0,external_wp_data_namespaceObject.useSelect)((select) => { 62852 return select(external_wp_preferences_namespaceObject.store).get("core", "showIconLabels"); 62853 }, []); 62854 const initialTabName = !use_is_list_view_tab_disabled_default(blockName) ? TAB_LIST_VIEW.name : void 0; 62855 const [selectedTabId, setSelectedTabId] = (0,external_wp_element_namespaceObject.useState)( 62856 initialTabName ?? tabs[0]?.name 62857 ); 62858 (0,external_wp_element_namespaceObject.useEffect)(() => { 62859 if (initialTabName) { 62860 return; 62861 } 62862 if (tabs?.length && selectedTabId) { 62863 const activeTab = tabs.find( 62864 (tab) => tab.name === selectedTabId 62865 ); 62866 if (!activeTab) { 62867 setSelectedTabId(tabs[0].name); 62868 } 62869 } 62870 }, [tabs, selectedTabId, initialTabName]); 62871 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-block-inspector__tabs", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 62872 inspector_controls_tabs_Tabs, 62873 { 62874 defaultTabId: initialTabName, 62875 selectedTabId, 62876 onSelect: setSelectedTabId, 62877 children: [ 62878 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls_tabs_Tabs.TabList, { children: tabs.map( 62879 (tab) => showIconLabels ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls_tabs_Tabs.Tab, { tabId: tab.name, children: tab.title }, tab.name) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Tooltip, { text: tab.title, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 62880 inspector_controls_tabs_Tabs.Tab, 62881 { 62882 tabId: tab.name, 62883 "aria-label": tab.title, 62884 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { icon: tab.icon }) 62885 } 62886 ) }, tab.name) 62887 ) }), 62888 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls_tabs_Tabs.TabPanel, { tabId: TAB_SETTINGS.name, focusable: false, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(settings_tab_default, { showAdvancedControls: !!blockName }) }), 62889 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls_tabs_Tabs.TabPanel, { tabId: TAB_STYLES.name, focusable: false, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 62890 styles_tab_default, 62891 { 62892 blockName, 62893 clientId, 62894 hasBlockStyles, 62895 isSectionBlock 62896 } 62897 ) }), 62898 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls_tabs_Tabs.TabPanel, { tabId: TAB_CONTENT.name, focusable: false, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(content_tab_default, { contentClientIds }) }), 62899 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls_tabs_Tabs.TabPanel, { tabId: TAB_LIST_VIEW.name, focusable: false, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls_default.Slot, { group: "list" }) }) 62900 ] 62901 }, 62902 clientId 62903 ) }); 62904 } 62905 62906 62907 ;// ./node_modules/@wordpress/block-editor/build-module/components/inspector-controls-tabs/use-inspector-controls-tabs.js 62908 62909 62910 62911 62912 62913 62914 62915 const use_inspector_controls_tabs_EMPTY_ARRAY = []; 62916 function getShowTabs(blockName, tabSettings = {}) { 62917 if (tabSettings[blockName] !== void 0) { 62918 return tabSettings[blockName]; 62919 } 62920 if (tabSettings.default !== void 0) { 62921 return tabSettings.default; 62922 } 62923 return true; 62924 } 62925 function useInspectorControlsTabs(blockName, contentClientIds, isSectionBlock, hasBlockStyles) { 62926 const tabs = []; 62927 const { 62928 bindings: bindingsGroup, 62929 border: borderGroup, 62930 color: colorGroup, 62931 default: defaultGroup, 62932 dimensions: dimensionsGroup, 62933 list: listGroup, 62934 position: positionGroup, 62935 styles: stylesGroup, 62936 typography: typographyGroup, 62937 effects: effectsGroup 62938 } = groups_groups_default; 62939 const listViewDisabled = use_is_list_view_tab_disabled_default(blockName); 62940 const listFills = (0,external_wp_components_namespaceObject.__experimentalUseSlotFills)(listGroup.name); 62941 const hasListFills = !listViewDisabled && !!listFills && listFills.length; 62942 const styleFills = [ 62943 ...(0,external_wp_components_namespaceObject.__experimentalUseSlotFills)(borderGroup.name) || [], 62944 ...(0,external_wp_components_namespaceObject.__experimentalUseSlotFills)(colorGroup.name) || [], 62945 ...(0,external_wp_components_namespaceObject.__experimentalUseSlotFills)(dimensionsGroup.name) || [], 62946 ...(0,external_wp_components_namespaceObject.__experimentalUseSlotFills)(stylesGroup.name) || [], 62947 ...(0,external_wp_components_namespaceObject.__experimentalUseSlotFills)(typographyGroup.name) || [], 62948 ...(0,external_wp_components_namespaceObject.__experimentalUseSlotFills)(effectsGroup.name) || [] 62949 ]; 62950 const hasStyleFills = styleFills.length; 62951 const advancedFills = [ 62952 ...(0,external_wp_components_namespaceObject.__experimentalUseSlotFills)(InspectorAdvancedControls.slotName) || [], 62953 ...(0,external_wp_components_namespaceObject.__experimentalUseSlotFills)(bindingsGroup.name) || [] 62954 ]; 62955 const settingsFills = [ 62956 ...(0,external_wp_components_namespaceObject.__experimentalUseSlotFills)(defaultGroup.name) || [], 62957 ...(0,external_wp_components_namespaceObject.__experimentalUseSlotFills)(positionGroup.name) || [], 62958 ...hasListFills && hasStyleFills > 1 ? advancedFills : [] 62959 ]; 62960 const hasContentTab = !!(contentClientIds && contentClientIds.length > 0); 62961 if (hasListFills && !isSectionBlock) { 62962 tabs.push(TAB_LIST_VIEW); 62963 } 62964 if (hasContentTab) { 62965 tabs.push(TAB_CONTENT); 62966 } 62967 if (settingsFills.length && !isSectionBlock) { 62968 tabs.push(TAB_SETTINGS); 62969 } 62970 if (isSectionBlock ? hasBlockStyles : hasStyleFills) { 62971 tabs.push(TAB_STYLES); 62972 } 62973 const tabSettings = (0,external_wp_data_namespaceObject.useSelect)((select) => { 62974 return select(store).getSettings().blockInspectorTabs; 62975 }, []); 62976 const showTabs = getShowTabs(blockName, tabSettings); 62977 return showTabs ? tabs : use_inspector_controls_tabs_EMPTY_ARRAY; 62978 } 62979 62980 62981 ;// ./node_modules/@wordpress/block-editor/build-module/components/block-inspector/useBlockInspectorAnimationSettings.js 62982 62983 62984 function useBlockInspectorAnimationSettings(blockType) { 62985 return (0,external_wp_data_namespaceObject.useSelect)( 62986 (select) => { 62987 if (blockType) { 62988 const globalBlockInspectorAnimationSettings = select(store).getSettings().blockInspectorAnimation; 62989 const animationParent = globalBlockInspectorAnimationSettings?.animationParent; 62990 const { getSelectedBlockClientId, getBlockParentsByBlockName } = select(store); 62991 const _selectedBlockClientId = getSelectedBlockClientId(); 62992 const animationParentBlockClientId = getBlockParentsByBlockName( 62993 _selectedBlockClientId, 62994 animationParent, 62995 true 62996 )[0]; 62997 if (!animationParentBlockClientId && blockType.name !== animationParent) { 62998 return null; 62999 } 63000 return globalBlockInspectorAnimationSettings?.[blockType.name]; 63001 } 63002 return null; 63003 }, 63004 [blockType] 63005 ); 63006 } 63007 63008 63009 ;// ./node_modules/@wordpress/block-editor/build-module/components/block-inspector/index.js 63010 63011 63012 63013 63014 63015 63016 63017 63018 63019 63020 63021 63022 63023 63024 63025 63026 63027 63028 63029 63030 63031 63032 function BlockStylesPanel({ clientId }) { 63033 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.PanelBody, { title: (0,external_wp_i18n_namespaceObject.__)("Styles"), children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(block_styles_default, { clientId }) }); 63034 } 63035 function StyleInspectorSlots({ 63036 blockName, 63037 showAdvancedControls = true, 63038 showPositionControls = true, 63039 showListControls = false, 63040 showBindingsControls = true 63041 }) { 63042 const borderPanelLabel = useBorderPanelLabel({ blockName }); 63043 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 63044 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls_default.Slot, {}), 63045 showListControls && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls_default.Slot, { group: "list" }), 63046 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 63047 inspector_controls_default.Slot, 63048 { 63049 group: "color", 63050 label: (0,external_wp_i18n_namespaceObject.__)("Color"), 63051 className: "color-block-support-panel__inner-wrapper" 63052 } 63053 ), 63054 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 63055 inspector_controls_default.Slot, 63056 { 63057 group: "background", 63058 label: (0,external_wp_i18n_namespaceObject.__)("Background image") 63059 } 63060 ), 63061 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 63062 inspector_controls_default.Slot, 63063 { 63064 group: "typography", 63065 label: (0,external_wp_i18n_namespaceObject.__)("Typography") 63066 } 63067 ), 63068 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 63069 inspector_controls_default.Slot, 63070 { 63071 group: "dimensions", 63072 label: (0,external_wp_i18n_namespaceObject.__)("Dimensions") 63073 } 63074 ), 63075 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls_default.Slot, { group: "border", label: borderPanelLabel }), 63076 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls_default.Slot, { group: "styles" }), 63077 showPositionControls && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(position_controls_panel_default, {}), 63078 showBindingsControls && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls_default.Slot, { group: "bindings" }), 63079 showAdvancedControls && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(advanced_controls_panel_default, {}) }) 63080 ] }); 63081 } 63082 function BlockInspector() { 63083 const { 63084 selectedBlockCount, 63085 selectedBlockName, 63086 selectedBlockClientId, 63087 blockType, 63088 isSectionBlock, 63089 isSectionBlockInSelection, 63090 hasBlockStyles 63091 } = (0,external_wp_data_namespaceObject.useSelect)((select) => { 63092 const { 63093 getSelectedBlockClientId, 63094 getSelectedBlockClientIds, 63095 getSelectedBlockCount, 63096 getBlockName, 63097 getParentSectionBlock, 63098 isSectionBlock: _isSectionBlock 63099 } = unlock(select(store)); 63100 const { getBlockStyles } = select(external_wp_blocks_namespaceObject.store); 63101 const _selectedBlockClientId = getSelectedBlockClientId(); 63102 const renderedBlockClientId = getParentSectionBlock(_selectedBlockClientId) || _selectedBlockClientId; 63103 const _selectedBlockName = renderedBlockClientId && getBlockName(renderedBlockClientId); 63104 const _blockType = _selectedBlockName && (0,external_wp_blocks_namespaceObject.getBlockType)(_selectedBlockName); 63105 const selectedBlockClientIds = getSelectedBlockClientIds(); 63106 const _isSectionBlockInSelection = selectedBlockClientIds.some( 63107 (id) => _isSectionBlock(id) 63108 ); 63109 const blockStyles = _selectedBlockName && getBlockStyles(_selectedBlockName); 63110 const _hasBlockStyles = blockStyles && blockStyles.length > 0; 63111 return { 63112 selectedBlockCount: getSelectedBlockCount(), 63113 selectedBlockClientId: renderedBlockClientId, 63114 selectedBlockName: _selectedBlockName, 63115 blockType: _blockType, 63116 isSectionBlockInSelection: _isSectionBlockInSelection, 63117 isSectionBlock: _isSectionBlock(renderedBlockClientId), 63118 hasBlockStyles: _hasBlockStyles 63119 }; 63120 }, []); 63121 const contentClientIds = (0,external_wp_data_namespaceObject.useSelect)( 63122 (select) => { 63123 if (!isSectionBlock || !selectedBlockClientId) { 63124 return []; 63125 } 63126 const { 63127 getClientIdsOfDescendants, 63128 getBlockName, 63129 getBlockEditingMode 63130 } = unlock(select(store)); 63131 const descendants = getClientIdsOfDescendants( 63132 selectedBlockClientId 63133 ); 63134 const navigationDescendants = /* @__PURE__ */ new Set(); 63135 descendants.forEach((clientId) => { 63136 if (getBlockName(clientId) === "core/navigation") { 63137 const navChildren = getClientIdsOfDescendants(clientId); 63138 navChildren.forEach( 63139 (childId) => navigationDescendants.add(childId) 63140 ); 63141 } 63142 }); 63143 return descendants.filter((current) => { 63144 if (navigationDescendants.has(current)) { 63145 return false; 63146 } 63147 return getBlockName(current) !== "core/list-item" && getBlockEditingMode(current) === "contentOnly"; 63148 }); 63149 }, 63150 [isSectionBlock, selectedBlockClientId] 63151 ); 63152 const availableTabs = useInspectorControlsTabs( 63153 blockType?.name, 63154 contentClientIds, 63155 isSectionBlock, 63156 hasBlockStyles 63157 ); 63158 const hasMultipleTabs = availableTabs?.length > 1; 63159 const blockInspectorAnimationSettings = useBlockInspectorAnimationSettings(blockType); 63160 const hasSelectedBlocks = selectedBlockCount > 1; 63161 if (hasSelectedBlocks && !isSectionBlockInSelection) { 63162 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-editor-block-inspector", children: [ 63163 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(MultiSelectionInspector, {}), 63164 hasMultipleTabs ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(InspectorControlsTabs, { tabs: availableTabs }) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 63165 StyleInspectorSlots, 63166 { 63167 blockName: selectedBlockName, 63168 showAdvancedControls: false, 63169 showPositionControls: false, 63170 showBindingsControls: false 63171 } 63172 ) 63173 ] }); 63174 } 63175 if (hasSelectedBlocks && isSectionBlockInSelection) { 63176 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-block-inspector", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(MultiSelectionInspector, {}) }); 63177 } 63178 const isSelectedBlockUnregistered = selectedBlockName === (0,external_wp_blocks_namespaceObject.getUnregisteredTypeHandlerName)(); 63179 const shouldShowWarning = !blockType || !selectedBlockClientId || isSelectedBlockUnregistered; 63180 if (shouldShowWarning) { 63181 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "block-editor-block-inspector__no-blocks", children: (0,external_wp_i18n_namespaceObject.__)("No block selected.") }); 63182 } 63183 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 63184 BlockInspectorSingleBlockWrapper, 63185 { 63186 animate: blockInspectorAnimationSettings, 63187 wrapper: (children) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 63188 AnimatedContainer, 63189 { 63190 blockInspectorAnimationSettings, 63191 selectedBlockClientId, 63192 children 63193 } 63194 ), 63195 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 63196 BlockInspectorSingleBlock, 63197 { 63198 clientId: selectedBlockClientId, 63199 blockName: blockType.name, 63200 isSectionBlock, 63201 availableTabs, 63202 contentClientIds, 63203 hasBlockStyles 63204 } 63205 ) 63206 } 63207 ); 63208 } 63209 const BlockInspectorSingleBlockWrapper = ({ animate, wrapper, children }) => { 63210 return animate ? wrapper(children) : children; 63211 }; 63212 const AnimatedContainer = ({ 63213 blockInspectorAnimationSettings, 63214 selectedBlockClientId, 63215 children 63216 }) => { 63217 const animationOrigin = blockInspectorAnimationSettings && blockInspectorAnimationSettings.enterDirection === "leftToRight" ? -50 : 50; 63218 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 63219 external_wp_components_namespaceObject.__unstableMotion.div, 63220 { 63221 animate: { 63222 x: 0, 63223 opacity: 1, 63224 transition: { 63225 ease: "easeInOut", 63226 duration: 0.14 63227 } 63228 }, 63229 initial: { 63230 x: animationOrigin, 63231 opacity: 0 63232 }, 63233 children 63234 }, 63235 selectedBlockClientId 63236 ); 63237 }; 63238 const BlockInspectorSingleBlock = ({ 63239 clientId, 63240 blockName, 63241 isSectionBlock, 63242 availableTabs, 63243 contentClientIds, 63244 hasBlockStyles 63245 }) => { 63246 const hasMultipleTabs = availableTabs?.length > 1; 63247 const blockInformation = useBlockDisplayInformation(clientId); 63248 const isBlockSynced = blockInformation.isSynced; 63249 const shouldShowTabs = !isBlockSynced && hasMultipleTabs; 63250 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-editor-block-inspector", children: [ 63251 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 63252 block_card_default, 63253 { 63254 ...blockInformation, 63255 className: isBlockSynced && "is-synced", 63256 allowParentNavigation: true, 63257 children: window?.__experimentalContentOnlyPatternInsertion && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(EditContentsButton, { clientId }) 63258 } 63259 ), 63260 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(block_variation_transforms_default, { blockClientId: clientId }), 63261 shouldShowTabs && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 63262 InspectorControlsTabs, 63263 { 63264 hasBlockStyles, 63265 clientId, 63266 blockName, 63267 tabs: availableTabs, 63268 isSectionBlock, 63269 contentClientIds 63270 } 63271 ), 63272 !shouldShowTabs && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 63273 hasBlockStyles && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockStylesPanel, { clientId }), 63274 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(content_tab_default, { contentClientIds }), 63275 !isSectionBlock && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 63276 StyleInspectorSlots, 63277 { 63278 blockName, 63279 showListControls: true 63280 } 63281 ) 63282 ] }), 63283 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SkipToSelectedBlock, {}, "back") 63284 ] }); 63285 }; 63286 var block_inspector_default = BlockInspector; 63287 63288 63289 ;// ./node_modules/@wordpress/block-editor/build-module/components/copy-handler/index.js 63290 63291 63292 63293 const __unstableUseClipboardHandler = () => { 63294 external_wp_deprecated_default()("__unstableUseClipboardHandler", { 63295 alternative: "BlockCanvas or WritingFlow", 63296 since: "6.4", 63297 version: "6.7" 63298 }); 63299 return useClipboardHandler(); 63300 }; 63301 function CopyHandler(props) { 63302 external_wp_deprecated_default()("CopyHandler", { 63303 alternative: "BlockCanvas or WritingFlow", 63304 since: "6.4", 63305 version: "6.7" 63306 }); 63307 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { ...props, ref: useClipboardHandler() }); 63308 } 63309 63310 63311 ;// ./node_modules/@wordpress/block-editor/build-module/components/inserter/library.js 63312 63313 63314 63315 63316 63317 const library_noop = () => { 63318 }; 63319 function InserterLibrary({ 63320 rootClientId, 63321 clientId, 63322 isAppender, 63323 showInserterHelpPanel, 63324 showMostUsedBlocks = false, 63325 __experimentalInsertionIndex, 63326 __experimentalInitialTab, 63327 __experimentalInitialCategory, 63328 __experimentalFilterValue, 63329 onPatternCategorySelection, 63330 onSelect = library_noop, 63331 shouldFocusBlock = false, 63332 onClose 63333 }, ref) { 63334 const { destinationRootClientId } = (0,external_wp_data_namespaceObject.useSelect)( 63335 (select) => { 63336 const { getBlockRootClientId } = select(store); 63337 const _rootClientId = rootClientId || getBlockRootClientId(clientId) || void 0; 63338 return { 63339 destinationRootClientId: _rootClientId 63340 }; 63341 }, 63342 [clientId, rootClientId] 63343 ); 63344 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 63345 PrivateInserterMenu, 63346 { 63347 onSelect, 63348 rootClientId: destinationRootClientId, 63349 clientId, 63350 isAppender, 63351 showInserterHelpPanel, 63352 showMostUsedBlocks, 63353 __experimentalInsertionIndex, 63354 __experimentalFilterValue, 63355 onPatternCategorySelection, 63356 __experimentalInitialTab, 63357 __experimentalInitialCategory, 63358 shouldFocusBlock, 63359 ref, 63360 onClose 63361 } 63362 ); 63363 } 63364 const PrivateInserterLibrary = (0,external_wp_element_namespaceObject.forwardRef)(InserterLibrary); 63365 function PublicInserterLibrary(props, ref) { 63366 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 63367 PrivateInserterLibrary, 63368 { 63369 ...props, 63370 onPatternCategorySelection: void 0, 63371 ref 63372 } 63373 ); 63374 } 63375 var library_default = (0,external_wp_element_namespaceObject.forwardRef)(PublicInserterLibrary); 63376 63377 63378 ;// ./node_modules/@wordpress/block-editor/build-module/components/selection-scroll-into-view/index.js 63379 63380 function MultiSelectScrollIntoView() { 63381 external_wp_deprecated_default()("wp.blockEditor.MultiSelectScrollIntoView", { 63382 hint: "This behaviour is now built-in.", 63383 since: "5.8" 63384 }); 63385 return null; 63386 } 63387 63388 63389 ;// ./node_modules/@wordpress/block-editor/build-module/components/typewriter/index.js 63390 63391 63392 63393 63394 63395 63396 const isIE = window.navigator.userAgent.indexOf("Trident") !== -1; 63397 const arrowKeyCodes = /* @__PURE__ */ new Set([external_wp_keycodes_namespaceObject.UP, external_wp_keycodes_namespaceObject.DOWN, external_wp_keycodes_namespaceObject.LEFT, external_wp_keycodes_namespaceObject.RIGHT]); 63398 const initialTriggerPercentage = 0.75; 63399 function useTypewriter() { 63400 const hasSelectedBlock = (0,external_wp_data_namespaceObject.useSelect)( 63401 (select) => select(store).hasSelectedBlock(), 63402 [] 63403 ); 63404 return (0,external_wp_compose_namespaceObject.useRefEffect)( 63405 (node) => { 63406 if (!hasSelectedBlock) { 63407 return; 63408 } 63409 const { ownerDocument } = node; 63410 const { defaultView } = ownerDocument; 63411 let scrollResizeRafId; 63412 let onKeyDownRafId; 63413 let caretRect; 63414 function onScrollResize() { 63415 if (scrollResizeRafId) { 63416 return; 63417 } 63418 scrollResizeRafId = defaultView.requestAnimationFrame(() => { 63419 computeCaretRectangle(); 63420 scrollResizeRafId = null; 63421 }); 63422 } 63423 function onKeyDown(event) { 63424 if (onKeyDownRafId) { 63425 defaultView.cancelAnimationFrame(onKeyDownRafId); 63426 } 63427 onKeyDownRafId = defaultView.requestAnimationFrame(() => { 63428 maintainCaretPosition(event); 63429 onKeyDownRafId = null; 63430 }); 63431 } 63432 function maintainCaretPosition({ keyCode }) { 63433 if (!isSelectionEligibleForScroll()) { 63434 return; 63435 } 63436 const currentCaretRect = (0,external_wp_dom_namespaceObject.computeCaretRect)(defaultView); 63437 if (!currentCaretRect) { 63438 return; 63439 } 63440 if (!caretRect) { 63441 caretRect = currentCaretRect; 63442 return; 63443 } 63444 if (arrowKeyCodes.has(keyCode)) { 63445 caretRect = currentCaretRect; 63446 return; 63447 } 63448 const diff = currentCaretRect.top - caretRect.top; 63449 if (diff === 0) { 63450 return; 63451 } 63452 const scrollContainer = (0,external_wp_dom_namespaceObject.getScrollContainer)(node); 63453 if (!scrollContainer) { 63454 return; 63455 } 63456 const windowScroll = scrollContainer === ownerDocument.body || scrollContainer === ownerDocument.documentElement; 63457 const scrollY = windowScroll ? defaultView.scrollY : scrollContainer.scrollTop; 63458 const scrollContainerY = windowScroll ? 0 : scrollContainer.getBoundingClientRect().top; 63459 const relativeScrollPosition = windowScroll ? caretRect.top / defaultView.innerHeight : (caretRect.top - scrollContainerY) / (defaultView.innerHeight - scrollContainerY); 63460 if (scrollY === 0 && relativeScrollPosition < initialTriggerPercentage && isLastEditableNode()) { 63461 caretRect = currentCaretRect; 63462 return; 63463 } 63464 const scrollContainerHeight = windowScroll ? defaultView.innerHeight : scrollContainer.clientHeight; 63465 if ( 63466 // The caret is under the lower fold. 63467 caretRect.top + caretRect.height > scrollContainerY + scrollContainerHeight || // The caret is above the upper fold. 63468 caretRect.top < scrollContainerY 63469 ) { 63470 caretRect = currentCaretRect; 63471 return; 63472 } 63473 if (windowScroll) { 63474 defaultView.scrollBy(0, diff); 63475 } else { 63476 scrollContainer.scrollTop += diff; 63477 } 63478 } 63479 function addSelectionChangeListener() { 63480 ownerDocument.addEventListener( 63481 "selectionchange", 63482 computeCaretRectOnSelectionChange 63483 ); 63484 } 63485 function computeCaretRectOnSelectionChange() { 63486 ownerDocument.removeEventListener( 63487 "selectionchange", 63488 computeCaretRectOnSelectionChange 63489 ); 63490 computeCaretRectangle(); 63491 } 63492 function computeCaretRectangle() { 63493 if (isSelectionEligibleForScroll()) { 63494 caretRect = (0,external_wp_dom_namespaceObject.computeCaretRect)(defaultView); 63495 } 63496 } 63497 function isSelectionEligibleForScroll() { 63498 return node.contains(ownerDocument.activeElement) && ownerDocument.activeElement.isContentEditable; 63499 } 63500 function isLastEditableNode() { 63501 const editableNodes = node.querySelectorAll( 63502 '[contenteditable="true"]' 63503 ); 63504 const lastEditableNode = editableNodes[editableNodes.length - 1]; 63505 return lastEditableNode === ownerDocument.activeElement; 63506 } 63507 defaultView.addEventListener("scroll", onScrollResize, true); 63508 defaultView.addEventListener("resize", onScrollResize, true); 63509 node.addEventListener("keydown", onKeyDown); 63510 node.addEventListener("keyup", maintainCaretPosition); 63511 node.addEventListener("mousedown", addSelectionChangeListener); 63512 node.addEventListener("touchstart", addSelectionChangeListener); 63513 return () => { 63514 defaultView.removeEventListener( 63515 "scroll", 63516 onScrollResize, 63517 true 63518 ); 63519 defaultView.removeEventListener( 63520 "resize", 63521 onScrollResize, 63522 true 63523 ); 63524 node.removeEventListener("keydown", onKeyDown); 63525 node.removeEventListener("keyup", maintainCaretPosition); 63526 node.removeEventListener( 63527 "mousedown", 63528 addSelectionChangeListener 63529 ); 63530 node.removeEventListener( 63531 "touchstart", 63532 addSelectionChangeListener 63533 ); 63534 ownerDocument.removeEventListener( 63535 "selectionchange", 63536 computeCaretRectOnSelectionChange 63537 ); 63538 defaultView.cancelAnimationFrame(scrollResizeRafId); 63539 defaultView.cancelAnimationFrame(onKeyDownRafId); 63540 }; 63541 }, 63542 [hasSelectedBlock] 63543 ); 63544 } 63545 function Typewriter({ children }) { 63546 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { ref: useTypewriter(), className: "block-editor__typewriter", children }); 63547 } 63548 const TypewriterOrIEBypass = isIE ? (props) => props.children : Typewriter; 63549 var typewriter_default = TypewriterOrIEBypass; 63550 63551 63552 ;// ./node_modules/@wordpress/block-editor/build-module/components/recursion-provider/index.js 63553 63554 63555 63556 63557 const RenderedRefsContext = (0,external_wp_element_namespaceObject.createContext)({}); 63558 RenderedRefsContext.displayName = "RenderedRefsContext"; 63559 function addToBlockType(renderedBlocks, blockName, uniqueId) { 63560 const result = { 63561 ...renderedBlocks, 63562 [blockName]: renderedBlocks[blockName] ? new Set(renderedBlocks[blockName]) : /* @__PURE__ */ new Set() 63563 }; 63564 result[blockName].add(uniqueId); 63565 return result; 63566 } 63567 function RecursionProvider({ children, uniqueId, blockName = "" }) { 63568 const previouslyRenderedBlocks = (0,external_wp_element_namespaceObject.useContext)(RenderedRefsContext); 63569 const { name } = useBlockEditContext(); 63570 blockName = blockName || name; 63571 const newRenderedBlocks = (0,external_wp_element_namespaceObject.useMemo)( 63572 () => addToBlockType(previouslyRenderedBlocks, blockName, uniqueId), 63573 [previouslyRenderedBlocks, blockName, uniqueId] 63574 ); 63575 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(RenderedRefsContext.Provider, { value: newRenderedBlocks, children }); 63576 } 63577 function useHasRecursion(uniqueId, blockName = "") { 63578 const previouslyRenderedBlocks = (0,external_wp_element_namespaceObject.useContext)(RenderedRefsContext); 63579 const { name } = useBlockEditContext(); 63580 blockName = blockName || name; 63581 return Boolean(previouslyRenderedBlocks[blockName]?.has(uniqueId)); 63582 } 63583 const DeprecatedExperimentalRecursionProvider = (props) => { 63584 external_wp_deprecated_default()("wp.blockEditor.__experimentalRecursionProvider", { 63585 since: "6.5", 63586 alternative: "wp.blockEditor.RecursionProvider" 63587 }); 63588 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(RecursionProvider, { ...props }); 63589 }; 63590 const DeprecatedExperimentalUseHasRecursion = (...args) => { 63591 external_wp_deprecated_default()("wp.blockEditor.__experimentalUseHasRecursion", { 63592 since: "6.5", 63593 alternative: "wp.blockEditor.useHasRecursion" 63594 }); 63595 return useHasRecursion(...args); 63596 }; 63597 63598 63599 ;// ./node_modules/@wordpress/block-editor/build-module/components/inspector-popover-header/index.js 63600 63601 63602 63603 63604 function InspectorPopoverHeader({ 63605 title, 63606 help, 63607 actions = [], 63608 onClose 63609 }) { 63610 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { className: "block-editor-inspector-popover-header", spacing: 4, children: [ 63611 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { alignment: "center", children: [ 63612 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 63613 external_wp_components_namespaceObject.__experimentalHeading, 63614 { 63615 className: "block-editor-inspector-popover-header__heading", 63616 level: 2, 63617 size: 13, 63618 children: title 63619 } 63620 ), 63621 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, {}), 63622 actions.map(({ label, icon, onClick }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 63623 external_wp_components_namespaceObject.Button, 63624 { 63625 size: "small", 63626 className: "block-editor-inspector-popover-header__action", 63627 label, 63628 icon, 63629 variant: !icon && "tertiary", 63630 onClick, 63631 children: !icon && label 63632 }, 63633 label 63634 )), 63635 onClose && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 63636 external_wp_components_namespaceObject.Button, 63637 { 63638 size: "small", 63639 className: "block-editor-inspector-popover-header__action", 63640 label: (0,external_wp_i18n_namespaceObject.__)("Close"), 63641 icon: close_small_default, 63642 onClick: onClose 63643 } 63644 ) 63645 ] }), 63646 help && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { children: help }) 63647 ] }); 63648 } 63649 63650 63651 ;// ./node_modules/@wordpress/block-editor/build-module/components/publish-date-time-picker/index.js 63652 63653 63654 63655 63656 63657 63658 function PublishDateTimePicker({ 63659 onClose, 63660 onChange, 63661 showPopoverHeaderActions, 63662 isCompact, 63663 currentDate, 63664 title, 63665 ...additionalProps 63666 }, ref) { 63667 const datePickerProps = { 63668 startOfWeek: (0,external_wp_date_namespaceObject.getSettings)().l10n.startOfWeek, 63669 onChange, 63670 currentDate: isCompact ? void 0 : currentDate, 63671 currentTime: isCompact ? currentDate : void 0, 63672 ...additionalProps 63673 }; 63674 const DatePickerComponent = isCompact ? external_wp_components_namespaceObject.TimePicker : external_wp_components_namespaceObject.DateTimePicker; 63675 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { ref, className: "block-editor-publish-date-time-picker", children: [ 63676 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 63677 InspectorPopoverHeader, 63678 { 63679 title: title || (0,external_wp_i18n_namespaceObject.__)("Publish"), 63680 actions: showPopoverHeaderActions ? [ 63681 { 63682 label: (0,external_wp_i18n_namespaceObject.__)("Now"), 63683 onClick: () => onChange?.(null) 63684 } 63685 ] : void 0, 63686 onClose 63687 } 63688 ), 63689 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(DatePickerComponent, { ...datePickerProps }) 63690 ] }); 63691 } 63692 const PrivatePublishDateTimePicker = (0,external_wp_element_namespaceObject.forwardRef)(PublishDateTimePicker); 63693 function PublicPublishDateTimePicker(props, ref) { 63694 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 63695 PrivatePublishDateTimePicker, 63696 { 63697 ...props, 63698 showPopoverHeaderActions: true, 63699 isCompact: false, 63700 ref 63701 } 63702 ); 63703 } 63704 var publish_date_time_picker_default = (0,external_wp_element_namespaceObject.forwardRef)(PublicPublishDateTimePicker); 63705 63706 63707 ;// ./node_modules/@wordpress/block-editor/build-module/components/index.js 63708 63709 63710 63711 63712 63713 63714 63715 63716 63717 63718 63719 63720 63721 63722 63723 63724 63725 63726 63727 63728 63729 63730 63731 63732 63733 63734 63735 63736 63737 63738 63739 63740 63741 63742 63743 63744 63745 63746 63747 63748 63749 63750 63751 63752 63753 63754 63755 63756 63757 63758 63759 63760 63761 63762 63763 63764 63765 63766 63767 63768 63769 63770 63771 63772 63773 63774 63775 63776 63777 63778 63779 63780 63781 63782 63783 63784 63785 63786 63787 63788 63789 63790 63791 63792 63793 63794 63795 63796 63797 63798 63799 63800 63801 63802 63803 63804 63805 63806 63807 63808 63809 63810 63811 63812 63813 63814 63815 63816 63817 63818 63819 ;// ./node_modules/@wordpress/block-editor/build-module/elements/index.js 63820 const elements_ELEMENT_CLASS_NAMES = { 63821 button: "wp-element-button", 63822 caption: "wp-element-caption" 63823 }; 63824 const __experimentalGetElementClassName = (element) => { 63825 return elements_ELEMENT_CLASS_NAMES[element] ? elements_ELEMENT_CLASS_NAMES[element] : ""; 63826 }; 63827 63828 63829 ;// ./node_modules/@wordpress/block-editor/build-module/utils/get-px-from-css-unit.js 63830 var get_px_from_css_unit_default = () => ""; 63831 63832 63833 ;// ./node_modules/@wordpress/block-editor/build-module/utils/index.js 63834 63835 63836 63837 63838 63839 ;// ./node_modules/@wordpress/block-editor/build-module/components/global-styles/image-settings-panel.js 63840 63841 63842 63843 63844 function useHasImageSettingsPanel(name, value, inheritedValue) { 63845 return name === "core/image" && inheritedValue?.lightbox?.allowEditing || !!value?.lightbox; 63846 } 63847 function ImageSettingsPanel({ 63848 onChange, 63849 value, 63850 inheritedValue, 63851 panelId 63852 }) { 63853 const dropdownMenuProps = useToolsPanelDropdownMenuProps(); 63854 const resetLightbox = () => { 63855 onChange(void 0); 63856 }; 63857 const onChangeLightbox = (newSetting) => { 63858 onChange({ 63859 enabled: newSetting 63860 }); 63861 }; 63862 let lightboxChecked = false; 63863 if (inheritedValue?.lightbox?.enabled) { 63864 lightboxChecked = inheritedValue.lightbox.enabled; 63865 } 63866 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 63867 external_wp_components_namespaceObject.__experimentalToolsPanel, 63868 { 63869 label: (0,external_wp_i18n_namespaceObject._x)("Settings", "Image settings"), 63870 resetAll: resetLightbox, 63871 panelId, 63872 dropdownMenuProps, 63873 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 63874 external_wp_components_namespaceObject.__experimentalToolsPanelItem, 63875 { 63876 hasValue: () => !!value?.lightbox, 63877 label: (0,external_wp_i18n_namespaceObject.__)("Enlarge on click"), 63878 onDeselect: resetLightbox, 63879 isShownByDefault: true, 63880 panelId, 63881 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 63882 external_wp_components_namespaceObject.ToggleControl, 63883 { 63884 __nextHasNoMarginBottom: true, 63885 label: (0,external_wp_i18n_namespaceObject.__)("Enlarge on click"), 63886 checked: lightboxChecked, 63887 onChange: onChangeLightbox 63888 } 63889 ) 63890 } 63891 ) 63892 } 63893 ) }); 63894 } 63895 63896 63897 ;// ./node_modules/@wordpress/block-editor/build-module/components/global-styles/advanced-panel.js 63898 63899 63900 63901 63902 63903 function AdvancedPanel({ 63904 value, 63905 onChange, 63906 inheritedValue = value 63907 }) { 63908 const [cssError, setCSSError] = (0,external_wp_element_namespaceObject.useState)(null); 63909 const customCSS = inheritedValue?.css; 63910 function handleOnChange(newValue) { 63911 onChange({ 63912 ...value, 63913 css: newValue 63914 }); 63915 if (cssError) { 63916 const [transformed] = transform_styles_default( 63917 [{ css: newValue }], 63918 ".for-validation-only" 63919 ); 63920 if (transformed) { 63921 setCSSError(null); 63922 } 63923 } 63924 } 63925 function handleOnBlur(event) { 63926 if (!event?.target?.value) { 63927 setCSSError(null); 63928 return; 63929 } 63930 const [transformed] = transform_styles_default( 63931 [{ css: event.target.value }], 63932 ".for-validation-only" 63933 ); 63934 setCSSError( 63935 transformed === null ? (0,external_wp_i18n_namespaceObject.__)("There is an error with your CSS structure.") : null 63936 ); 63937 } 63938 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 3, children: [ 63939 cssError && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Notice, { status: "error", onRemove: () => setCSSError(null), children: cssError }), 63940 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 63941 external_wp_components_namespaceObject.TextareaControl, 63942 { 63943 label: (0,external_wp_i18n_namespaceObject.__)("Additional CSS"), 63944 __nextHasNoMarginBottom: true, 63945 value: customCSS, 63946 onChange: (newValue) => handleOnChange(newValue), 63947 onBlur: handleOnBlur, 63948 className: "block-editor-global-styles-advanced-panel__custom-css-input", 63949 spellCheck: false 63950 } 63951 ) 63952 ] }); 63953 } 63954 63955 63956 ;// ./node_modules/memize/dist/index.js 63957 /** 63958 * Memize options object. 63959 * 63960 * @typedef MemizeOptions 63961 * 63962 * @property {number} [maxSize] Maximum size of the cache. 63963 */ 63964 63965 /** 63966 * Internal cache entry. 63967 * 63968 * @typedef MemizeCacheNode 63969 * 63970 * @property {?MemizeCacheNode|undefined} [prev] Previous node. 63971 * @property {?MemizeCacheNode|undefined} [next] Next node. 63972 * @property {Array<*>} args Function arguments for cache 63973 * entry. 63974 * @property {*} val Function result. 63975 */ 63976 63977 /** 63978 * Properties of the enhanced function for controlling cache. 63979 * 63980 * @typedef MemizeMemoizedFunction 63981 * 63982 * @property {()=>void} clear Clear the cache. 63983 */ 63984 63985 /** 63986 * Accepts a function to be memoized, and returns a new memoized function, with 63987 * optional options. 63988 * 63989 * @template {(...args: any[]) => any} F 63990 * 63991 * @param {F} fn Function to memoize. 63992 * @param {MemizeOptions} [options] Options object. 63993 * 63994 * @return {((...args: Parameters<F>) => ReturnType<F>) & MemizeMemoizedFunction} Memoized function. 63995 */ 63996 function memize(fn, options) { 63997 var size = 0; 63998 63999 /** @type {?MemizeCacheNode|undefined} */ 64000 var head; 64001 64002 /** @type {?MemizeCacheNode|undefined} */ 64003 var tail; 64004 64005 options = options || {}; 64006 64007 function memoized(/* ...args */) { 64008 var node = head, 64009 len = arguments.length, 64010 args, 64011 i; 64012 64013 searchCache: while (node) { 64014 // Perform a shallow equality test to confirm that whether the node 64015 // under test is a candidate for the arguments passed. Two arrays 64016 // are shallowly equal if their length matches and each entry is 64017 // strictly equal between the two sets. Avoid abstracting to a 64018 // function which could incur an arguments leaking deoptimization. 64019 64020 // Check whether node arguments match arguments length 64021 if (node.args.length !== arguments.length) { 64022 node = node.next; 64023 continue; 64024 } 64025 64026 // Check whether node arguments match arguments values 64027 for (i = 0; i < len; i++) { 64028 if (node.args[i] !== arguments[i]) { 64029 node = node.next; 64030 continue searchCache; 64031 } 64032 } 64033 64034 // At this point we can assume we've found a match 64035 64036 // Surface matched node to head if not already 64037 if (node !== head) { 64038 // As tail, shift to previous. Must only shift if not also 64039 // head, since if both head and tail, there is no previous. 64040 if (node === tail) { 64041 tail = node.prev; 64042 } 64043 64044 // Adjust siblings to point to each other. If node was tail, 64045 // this also handles new tail's empty `next` assignment. 64046 /** @type {MemizeCacheNode} */ (node.prev).next = node.next; 64047 if (node.next) { 64048 node.next.prev = node.prev; 64049 } 64050 64051 node.next = head; 64052 node.prev = null; 64053 /** @type {MemizeCacheNode} */ (head).prev = node; 64054 head = node; 64055 } 64056 64057 // Return immediately 64058 return node.val; 64059 } 64060 64061 // No cached value found. Continue to insertion phase: 64062 64063 // Create a copy of arguments (avoid leaking deoptimization) 64064 args = new Array(len); 64065 for (i = 0; i < len; i++) { 64066 args[i] = arguments[i]; 64067 } 64068 64069 node = { 64070 args: args, 64071 64072 // Generate the result from original function 64073 val: fn.apply(null, args), 64074 }; 64075 64076 // Don't need to check whether node is already head, since it would 64077 // have been returned above already if it was 64078 64079 // Shift existing head down list 64080 if (head) { 64081 head.prev = node; 64082 node.next = head; 64083 } else { 64084 // If no head, follows that there's no tail (at initial or reset) 64085 tail = node; 64086 } 64087 64088 // Trim tail if we're reached max size and are pending cache insertion 64089 if (size === /** @type {MemizeOptions} */ (options).maxSize) { 64090 tail = /** @type {MemizeCacheNode} */ (tail).prev; 64091 /** @type {MemizeCacheNode} */ (tail).next = null; 64092 } else { 64093 size++; 64094 } 64095 64096 head = node; 64097 64098 return node.val; 64099 } 64100 64101 memoized.clear = function () { 64102 head = null; 64103 tail = null; 64104 size = 0; 64105 }; 64106 64107 // Ignore reason: There's not a clear solution to create an intersection of 64108 // the function with additional properties, where the goal is to retain the 64109 // function signature of the incoming argument and add control properties 64110 // on the return value. 64111 64112 // @ts-ignore 64113 return memoized; 64114 } 64115 64116 64117 64118 ;// ./node_modules/@wordpress/block-editor/build-module/components/global-styles/get-global-styles-changes.js 64119 64120 64121 64122 const globalStylesChangesCache = /* @__PURE__ */ new Map(); 64123 const get_global_styles_changes_EMPTY_ARRAY = []; 64124 const translationMap = { 64125 caption: (0,external_wp_i18n_namespaceObject.__)("Caption"), 64126 link: (0,external_wp_i18n_namespaceObject.__)("Link"), 64127 button: (0,external_wp_i18n_namespaceObject.__)("Button"), 64128 heading: (0,external_wp_i18n_namespaceObject.__)("Heading"), 64129 h1: (0,external_wp_i18n_namespaceObject.__)("H1"), 64130 h2: (0,external_wp_i18n_namespaceObject.__)("H2"), 64131 h3: (0,external_wp_i18n_namespaceObject.__)("H3"), 64132 h4: (0,external_wp_i18n_namespaceObject.__)("H4"), 64133 h5: (0,external_wp_i18n_namespaceObject.__)("H5"), 64134 h6: (0,external_wp_i18n_namespaceObject.__)("H6"), 64135 "settings.color": (0,external_wp_i18n_namespaceObject.__)("Color"), 64136 "settings.typography": (0,external_wp_i18n_namespaceObject.__)("Typography"), 64137 "settings.shadow": (0,external_wp_i18n_namespaceObject.__)("Shadow"), 64138 "settings.layout": (0,external_wp_i18n_namespaceObject.__)("Layout"), 64139 "styles.color": (0,external_wp_i18n_namespaceObject.__)("Colors"), 64140 "styles.spacing": (0,external_wp_i18n_namespaceObject.__)("Spacing"), 64141 "styles.background": (0,external_wp_i18n_namespaceObject.__)("Background"), 64142 "styles.typography": (0,external_wp_i18n_namespaceObject.__)("Typography") 64143 }; 64144 const getBlockNames = memize( 64145 () => (0,external_wp_blocks_namespaceObject.getBlockTypes)().reduce((accumulator, { name, title }) => { 64146 accumulator[name] = title; 64147 return accumulator; 64148 }, {}) 64149 ); 64150 const isObject = (obj) => obj !== null && typeof obj === "object"; 64151 function getTranslation(key) { 64152 if (translationMap[key]) { 64153 return translationMap[key]; 64154 } 64155 const keyArray = key.split("."); 64156 if (keyArray?.[0] === "blocks") { 64157 const blockName = getBlockNames()?.[keyArray[1]]; 64158 return blockName || keyArray[1]; 64159 } 64160 if (keyArray?.[0] === "elements") { 64161 return translationMap[keyArray[1]] || keyArray[1]; 64162 } 64163 return void 0; 64164 } 64165 function deepCompare(changedObject, originalObject, parentPath = "") { 64166 if (!isObject(changedObject) && !isObject(originalObject)) { 64167 return changedObject !== originalObject ? parentPath.split(".").slice(0, 2).join(".") : void 0; 64168 } 64169 changedObject = isObject(changedObject) ? changedObject : {}; 64170 originalObject = isObject(originalObject) ? originalObject : {}; 64171 const allKeys = /* @__PURE__ */ new Set([ 64172 ...Object.keys(changedObject), 64173 ...Object.keys(originalObject) 64174 ]); 64175 let diffs = []; 64176 for (const key of allKeys) { 64177 const path = parentPath ? parentPath + "." + key : key; 64178 const changedPath = deepCompare( 64179 changedObject[key], 64180 originalObject[key], 64181 path 64182 ); 64183 if (changedPath) { 64184 diffs = diffs.concat(changedPath); 64185 } 64186 } 64187 return diffs; 64188 } 64189 function getGlobalStylesChangelist(next, previous) { 64190 const cacheKey = JSON.stringify({ next, previous }); 64191 if (globalStylesChangesCache.has(cacheKey)) { 64192 return globalStylesChangesCache.get(cacheKey); 64193 } 64194 const changedValueTree = deepCompare( 64195 { 64196 styles: { 64197 background: next?.styles?.background, 64198 color: next?.styles?.color, 64199 typography: next?.styles?.typography, 64200 spacing: next?.styles?.spacing 64201 }, 64202 blocks: next?.styles?.blocks, 64203 elements: next?.styles?.elements, 64204 settings: next?.settings 64205 }, 64206 { 64207 styles: { 64208 background: previous?.styles?.background, 64209 color: previous?.styles?.color, 64210 typography: previous?.styles?.typography, 64211 spacing: previous?.styles?.spacing 64212 }, 64213 blocks: previous?.styles?.blocks, 64214 elements: previous?.styles?.elements, 64215 settings: previous?.settings 64216 } 64217 ); 64218 if (!changedValueTree.length) { 64219 globalStylesChangesCache.set(cacheKey, get_global_styles_changes_EMPTY_ARRAY); 64220 return get_global_styles_changes_EMPTY_ARRAY; 64221 } 64222 const result = [...new Set(changedValueTree)].reduce((acc, curr) => { 64223 const translation = getTranslation(curr); 64224 if (translation) { 64225 acc.push([curr.split(".")[0], translation]); 64226 } 64227 return acc; 64228 }, []); 64229 globalStylesChangesCache.set(cacheKey, result); 64230 return result; 64231 } 64232 function getGlobalStylesChanges(next, previous, options = {}) { 64233 let changeList = getGlobalStylesChangelist(next, previous); 64234 const changesLength = changeList.length; 64235 const { maxResults } = options; 64236 if (changesLength) { 64237 if (!!maxResults && changesLength > maxResults) { 64238 changeList = changeList.slice(0, maxResults); 64239 } 64240 return Object.entries( 64241 changeList.reduce((acc, curr) => { 64242 const group = acc[curr[0]] || []; 64243 if (!group.includes(curr[1])) { 64244 acc[curr[0]] = [...group, curr[1]]; 64245 } 64246 return acc; 64247 }, {}) 64248 ).map(([key, changeValues]) => { 64249 const changeValuesLength = changeValues.length; 64250 const joinedChangesValue = changeValues.join( 64251 /* translators: Used between list items, there is a space after the comma. */ 64252 (0,external_wp_i18n_namespaceObject.__)(", ") 64253 // eslint-disable-line @wordpress/i18n-no-flanking-whitespace 64254 ); 64255 switch (key) { 64256 case "blocks": { 64257 return (0,external_wp_i18n_namespaceObject.sprintf)( 64258 // translators: %s: a list of block names separated by a comma. 64259 (0,external_wp_i18n_namespaceObject._n)("%s block.", "%s blocks.", changeValuesLength), 64260 joinedChangesValue 64261 ); 64262 } 64263 case "elements": { 64264 return (0,external_wp_i18n_namespaceObject.sprintf)( 64265 // translators: %s: a list of element names separated by a comma. 64266 (0,external_wp_i18n_namespaceObject._n)("%s element.", "%s elements.", changeValuesLength), 64267 joinedChangesValue 64268 ); 64269 } 64270 case "settings": { 64271 return (0,external_wp_i18n_namespaceObject.sprintf)( 64272 // translators: %s: a list of theme.json setting labels separated by a comma. 64273 (0,external_wp_i18n_namespaceObject.__)("%s settings."), 64274 joinedChangesValue 64275 ); 64276 } 64277 case "styles": { 64278 return (0,external_wp_i18n_namespaceObject.sprintf)( 64279 // translators: %s: a list of theme.json top-level styles labels separated by a comma. 64280 (0,external_wp_i18n_namespaceObject.__)("%s styles."), 64281 joinedChangesValue 64282 ); 64283 } 64284 default: { 64285 return (0,external_wp_i18n_namespaceObject.sprintf)( 64286 // translators: %s: a list of global styles changes separated by a comma. 64287 (0,external_wp_i18n_namespaceObject.__)("%s."), 64288 joinedChangesValue 64289 ); 64290 } 64291 } 64292 }); 64293 } 64294 return get_global_styles_changes_EMPTY_ARRAY; 64295 } 64296 64297 64298 ;// ./node_modules/@wordpress/block-editor/build-module/components/global-styles/index.js 64299 64300 64301 64302 64303 64304 64305 64306 64307 64308 64309 64310 64311 64312 64313 64314 64315 ;// ./node_modules/@wordpress/block-editor/build-module/components/rich-text/get-rich-text-values.js 64316 64317 64318 64319 64320 64321 64322 function addValuesForElement(element, values, innerBlocks) { 64323 if (null === element || void 0 === element || false === element) { 64324 return; 64325 } 64326 if (Array.isArray(element)) { 64327 return addValuesForElements(element, values, innerBlocks); 64328 } 64329 switch (typeof element) { 64330 case "string": 64331 case "number": 64332 return; 64333 } 64334 const { type, props } = element; 64335 switch (type) { 64336 case external_wp_element_namespaceObject.StrictMode: 64337 case external_wp_element_namespaceObject.Fragment: 64338 return addValuesForElements(props.children, values, innerBlocks); 64339 case external_wp_element_namespaceObject.RawHTML: 64340 return; 64341 case inner_blocks_default.Content: 64342 return addValuesForBlocks(values, innerBlocks); 64343 case Content: 64344 values.push(props.value); 64345 return; 64346 } 64347 switch (typeof type) { 64348 case "string": 64349 if (typeof props.children !== "undefined") { 64350 return addValuesForElements( 64351 props.children, 64352 values, 64353 innerBlocks 64354 ); 64355 } 64356 return; 64357 case "function": 64358 const el = type.prototype && typeof type.prototype.render === "function" ? new type(props).render() : type(props); 64359 return addValuesForElement(el, values, innerBlocks); 64360 } 64361 } 64362 function addValuesForElements(children, ...args) { 64363 children = Array.isArray(children) ? children : [children]; 64364 for (let i = 0; i < children.length; i++) { 64365 addValuesForElement(children[i], ...args); 64366 } 64367 } 64368 function addValuesForBlocks(values, blocks) { 64369 for (let i = 0; i < blocks.length; i++) { 64370 const { name, attributes, innerBlocks } = blocks[i]; 64371 const saveElement = (0,external_wp_blocks_namespaceObject.getSaveElement)( 64372 name, 64373 attributes, 64374 // Instead of letting save elements use `useInnerBlocksProps.save`, 64375 // force them to use InnerBlocks.Content instead so we can intercept 64376 // a single component. 64377 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(inner_blocks_default.Content, {}) 64378 ); 64379 addValuesForElement(saveElement, values, innerBlocks); 64380 } 64381 } 64382 function getRichTextValues(blocks = []) { 64383 external_wp_blocks_namespaceObject.__unstableGetBlockProps.skipFilters = true; 64384 const values = []; 64385 addValuesForBlocks(values, blocks); 64386 external_wp_blocks_namespaceObject.__unstableGetBlockProps.skipFilters = false; 64387 return values.map( 64388 (value) => value instanceof external_wp_richText_namespaceObject.RichTextData ? value : external_wp_richText_namespaceObject.RichTextData.fromHTMLString(value) 64389 ); 64390 } 64391 64392 64393 ;// ./node_modules/@wordpress/block-editor/build-module/components/resizable-box-popover/index.js 64394 64395 64396 64397 function ResizableBoxPopover({ 64398 clientId, 64399 resizableBoxProps, 64400 ...props 64401 }) { 64402 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 64403 cover_default, 64404 { 64405 clientId, 64406 __unstablePopoverSlot: "block-toolbar", 64407 ...props, 64408 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ResizableBox, { ...resizableBoxProps }) 64409 } 64410 ); 64411 } 64412 64413 64414 ;// ./node_modules/@wordpress/block-editor/build-module/components/block-removal-warning-modal/index.js 64415 64416 64417 64418 64419 64420 64421 64422 function BlockRemovalWarningModal({ rules }) { 64423 const { clientIds, selectPrevious, message } = (0,external_wp_data_namespaceObject.useSelect)( 64424 (select) => unlock(select(store)).getRemovalPromptData() 64425 ); 64426 const { 64427 clearBlockRemovalPrompt, 64428 setBlockRemovalRules, 64429 privateRemoveBlocks 64430 } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store)); 64431 (0,external_wp_element_namespaceObject.useEffect)(() => { 64432 setBlockRemovalRules(rules); 64433 return () => { 64434 setBlockRemovalRules(); 64435 }; 64436 }, [rules, setBlockRemovalRules]); 64437 if (!message) { 64438 return; 64439 } 64440 const onConfirmRemoval = () => { 64441 privateRemoveBlocks( 64442 clientIds, 64443 selectPrevious, 64444 /* force */ 64445 true 64446 ); 64447 clearBlockRemovalPrompt(); 64448 }; 64449 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 64450 external_wp_components_namespaceObject.Modal, 64451 { 64452 title: (0,external_wp_i18n_namespaceObject.__)("Be careful!"), 64453 onRequestClose: clearBlockRemovalPrompt, 64454 size: "medium", 64455 children: [ 64456 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { children: message }), 64457 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "right", children: [ 64458 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 64459 external_wp_components_namespaceObject.Button, 64460 { 64461 variant: "tertiary", 64462 onClick: clearBlockRemovalPrompt, 64463 __next40pxDefaultSize: true, 64464 children: (0,external_wp_i18n_namespaceObject.__)("Cancel") 64465 } 64466 ), 64467 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 64468 external_wp_components_namespaceObject.Button, 64469 { 64470 variant: "primary", 64471 onClick: onConfirmRemoval, 64472 __next40pxDefaultSize: true, 64473 children: (0,external_wp_i18n_namespaceObject.__)("Delete") 64474 } 64475 ) 64476 ] }) 64477 ] 64478 } 64479 ); 64480 } 64481 64482 64483 ;// ./node_modules/@wordpress/block-editor/build-module/components/dimensions-tool/scale-tool.js 64484 64485 64486 64487 64488 const DEFAULT_SCALE_OPTIONS = [ 64489 { 64490 value: "fill", 64491 label: (0,external_wp_i18n_namespaceObject._x)("Fill", "Scale option for dimensions control"), 64492 help: (0,external_wp_i18n_namespaceObject.__)("Fill the space by stretching the content.") 64493 }, 64494 { 64495 value: "contain", 64496 label: (0,external_wp_i18n_namespaceObject._x)("Contain", "Scale option for dimensions control"), 64497 help: (0,external_wp_i18n_namespaceObject.__)("Fit the content to the space without clipping.") 64498 }, 64499 { 64500 value: "cover", 64501 label: (0,external_wp_i18n_namespaceObject._x)("Cover", "Scale option for dimensions control"), 64502 help: (0,external_wp_i18n_namespaceObject.__)("Fill the space by clipping what doesn't fit.") 64503 }, 64504 { 64505 value: "none", 64506 label: (0,external_wp_i18n_namespaceObject._x)("None", "Scale option for dimensions control"), 64507 help: (0,external_wp_i18n_namespaceObject.__)( 64508 "Do not adjust the sizing of the content. Content that is too large will be clipped, and content that is too small will have additional padding." 64509 ) 64510 }, 64511 { 64512 value: "scale-down", 64513 label: (0,external_wp_i18n_namespaceObject._x)("Scale down", "Scale option for dimensions control"), 64514 help: (0,external_wp_i18n_namespaceObject.__)( 64515 "Scale down the content to fit the space if it is too big. Content that is too small will have additional padding." 64516 ) 64517 } 64518 ]; 64519 function ScaleTool({ 64520 panelId, 64521 value, 64522 onChange, 64523 options = DEFAULT_SCALE_OPTIONS, 64524 defaultValue = DEFAULT_SCALE_OPTIONS[0].value, 64525 isShownByDefault = true 64526 }) { 64527 const displayValue = value ?? "fill"; 64528 const scaleHelp = (0,external_wp_element_namespaceObject.useMemo)(() => { 64529 return options.reduce((acc, option) => { 64530 acc[option.value] = option.help; 64531 return acc; 64532 }, {}); 64533 }, [options]); 64534 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 64535 external_wp_components_namespaceObject.__experimentalToolsPanelItem, 64536 { 64537 label: (0,external_wp_i18n_namespaceObject.__)("Scale"), 64538 isShownByDefault, 64539 hasValue: () => displayValue !== defaultValue, 64540 onDeselect: () => onChange(defaultValue), 64541 panelId, 64542 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 64543 external_wp_components_namespaceObject.__experimentalToggleGroupControl, 64544 { 64545 __nextHasNoMarginBottom: true, 64546 label: (0,external_wp_i18n_namespaceObject.__)("Scale"), 64547 isBlock: true, 64548 help: scaleHelp[displayValue], 64549 value: displayValue, 64550 onChange, 64551 size: "__unstable-large", 64552 children: options.map((option) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 64553 external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, 64554 { 64555 ...option 64556 }, 64557 option.value 64558 )) 64559 } 64560 ) 64561 } 64562 ); 64563 } 64564 64565 64566 ;// ./node_modules/@babel/runtime/helpers/esm/extends.js 64567 function extends_extends() { 64568 return extends_extends = Object.assign ? Object.assign.bind() : function (n) { 64569 for (var e = 1; e < arguments.length; e++) { 64570 var t = arguments[e]; 64571 for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); 64572 } 64573 return n; 64574 }, extends_extends.apply(null, arguments); 64575 } 64576 64577 ;// ./node_modules/@emotion/memoize/dist/emotion-memoize.esm.js 64578 function memoize(fn) { 64579 var cache = Object.create(null); 64580 return function (arg) { 64581 if (cache[arg] === undefined) cache[arg] = fn(arg); 64582 return cache[arg]; 64583 }; 64584 } 64585 64586 64587 64588 ;// ./node_modules/@emotion/styled/node_modules/@emotion/is-prop-valid/dist/emotion-is-prop-valid.esm.js 64589 64590 64591 var reactPropsRegex = /^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|abbr|accept|acceptCharset|accessKey|action|allow|allowUserMedia|allowPaymentRequest|allowFullScreen|allowTransparency|alt|async|autoComplete|autoPlay|capture|cellPadding|cellSpacing|challenge|charSet|checked|cite|classID|className|cols|colSpan|content|contentEditable|contextMenu|controls|controlsList|coords|crossOrigin|data|dateTime|decoding|default|defer|dir|disabled|disablePictureInPicture|download|draggable|encType|enterKeyHint|form|formAction|formEncType|formMethod|formNoValidate|formTarget|frameBorder|headers|height|hidden|high|href|hrefLang|htmlFor|httpEquiv|id|inputMode|integrity|is|keyParams|keyType|kind|label|lang|list|loading|loop|low|marginHeight|marginWidth|max|maxLength|media|mediaGroup|method|min|minLength|multiple|muted|name|nonce|noValidate|open|optimum|pattern|placeholder|playsInline|poster|preload|profile|radioGroup|readOnly|referrerPolicy|rel|required|reversed|role|rows|rowSpan|sandbox|scope|scoped|scrolling|seamless|selected|shape|size|sizes|slot|span|spellCheck|src|srcDoc|srcLang|srcSet|start|step|style|summary|tabIndex|target|title|translate|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|incremental|fallback|inert|itemProp|itemScope|itemType|itemID|itemRef|on|option|results|security|unselectable|accentHeight|accumulate|additive|alignmentBaseline|allowReorder|alphabetic|amplitude|arabicForm|ascent|attributeName|attributeType|autoReverse|azimuth|baseFrequency|baselineShift|baseProfile|bbox|begin|bias|by|calcMode|capHeight|clip|clipPathUnits|clipPath|clipRule|colorInterpolation|colorInterpolationFilters|colorProfile|colorRendering|contentScriptType|contentStyleType|cursor|cx|cy|d|decelerate|descent|diffuseConstant|direction|display|divisor|dominantBaseline|dur|dx|dy|edgeMode|elevation|enableBackground|end|exponent|externalResourcesRequired|fill|fillOpacity|fillRule|filter|filterRes|filterUnits|floodColor|floodOpacity|focusable|fontFamily|fontSize|fontSizeAdjust|fontStretch|fontStyle|fontVariant|fontWeight|format|from|fr|fx|fy|g1|g2|glyphName|glyphOrientationHorizontal|glyphOrientationVertical|glyphRef|gradientTransform|gradientUnits|hanging|horizAdvX|horizOriginX|ideographic|imageRendering|in|in2|intercept|k|k1|k2|k3|k4|kernelMatrix|kernelUnitLength|kerning|keyPoints|keySplines|keyTimes|lengthAdjust|letterSpacing|lightingColor|limitingConeAngle|local|markerEnd|markerMid|markerStart|markerHeight|markerUnits|markerWidth|mask|maskContentUnits|maskUnits|mathematical|mode|numOctaves|offset|opacity|operator|order|orient|orientation|origin|overflow|overlinePosition|overlineThickness|panose1|paintOrder|pathLength|patternContentUnits|patternTransform|patternUnits|pointerEvents|points|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|r|radius|refX|refY|renderingIntent|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|result|rotate|rx|ry|scale|seed|shapeRendering|slope|spacing|specularConstant|specularExponent|speed|spreadMethod|startOffset|stdDeviation|stemh|stemv|stitchTiles|stopColor|stopOpacity|strikethroughPosition|strikethroughThickness|string|stroke|strokeDasharray|strokeDashoffset|strokeLinecap|strokeLinejoin|strokeMiterlimit|strokeOpacity|strokeWidth|surfaceScale|systemLanguage|tableValues|targetX|targetY|textAnchor|textDecoration|textRendering|textLength|to|transform|u1|u2|underlinePosition|underlineThickness|unicode|unicodeBidi|unicodeRange|unitsPerEm|vAlphabetic|vHanging|vIdeographic|vMathematical|values|vectorEffect|version|vertAdvY|vertOriginX|vertOriginY|viewBox|viewTarget|visibility|widths|wordSpacing|writingMode|x|xHeight|x1|x2|xChannelSelector|xlinkActuate|xlinkArcrole|xlinkHref|xlinkRole|xlinkShow|xlinkTitle|xlinkType|xmlBase|xmlns|xmlnsXlink|xmlLang|xmlSpace|y|y1|y2|yChannelSelector|z|zoomAndPan|for|class|autofocus)|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$/; // https://esbench.com/bench/5bfee68a4cd7e6009ef61d23 64592 64593 var isPropValid = /* #__PURE__ */memoize(function (prop) { 64594 return reactPropsRegex.test(prop) || prop.charCodeAt(0) === 111 64595 /* o */ 64596 && prop.charCodeAt(1) === 110 64597 /* n */ 64598 && prop.charCodeAt(2) < 91; 64599 } 64600 /* Z+1 */ 64601 ); 64602 64603 64604 64605 ;// ./node_modules/@emotion/sheet/dist/emotion-sheet.browser.esm.js 64606 /* 64607 64608 Based off glamor's StyleSheet, thanks Sunil ❤️ 64609 64610 high performance StyleSheet for css-in-js systems 64611 64612 - uses multiple style tags behind the scenes for millions of rules 64613 - uses `insertRule` for appending in production for *much* faster performance 64614 64615 // usage 64616 64617 import { StyleSheet } from '@emotion/sheet' 64618 64619 let styleSheet = new StyleSheet({ key: '', container: document.head }) 64620 64621 styleSheet.insert('#box { border: 1px solid red; }') 64622 - appends a css rule into the stylesheet 64623 64624 styleSheet.flush() 64625 - empties the stylesheet of all its contents 64626 64627 */ 64628 // $FlowFixMe 64629 function sheetForTag(tag) { 64630 if (tag.sheet) { 64631 // $FlowFixMe 64632 return tag.sheet; 64633 } // this weirdness brought to you by firefox 64634 64635 /* istanbul ignore next */ 64636 64637 64638 for (var i = 0; i < document.styleSheets.length; i++) { 64639 if (document.styleSheets[i].ownerNode === tag) { 64640 // $FlowFixMe 64641 return document.styleSheets[i]; 64642 } 64643 } 64644 } 64645 64646 function createStyleElement(options) { 64647 var tag = document.createElement('style'); 64648 tag.setAttribute('data-emotion', options.key); 64649 64650 if (options.nonce !== undefined) { 64651 tag.setAttribute('nonce', options.nonce); 64652 } 64653 64654 tag.appendChild(document.createTextNode('')); 64655 tag.setAttribute('data-s', ''); 64656 return tag; 64657 } 64658 64659 var StyleSheet = /*#__PURE__*/function () { 64660 // Using Node instead of HTMLElement since container may be a ShadowRoot 64661 function StyleSheet(options) { 64662 var _this = this; 64663 64664 this._insertTag = function (tag) { 64665 var before; 64666 64667 if (_this.tags.length === 0) { 64668 if (_this.insertionPoint) { 64669 before = _this.insertionPoint.nextSibling; 64670 } else if (_this.prepend) { 64671 before = _this.container.firstChild; 64672 } else { 64673 before = _this.before; 64674 } 64675 } else { 64676 before = _this.tags[_this.tags.length - 1].nextSibling; 64677 } 64678 64679 _this.container.insertBefore(tag, before); 64680 64681 _this.tags.push(tag); 64682 }; 64683 64684 this.isSpeedy = options.speedy === undefined ? "production" === 'production' : options.speedy; 64685 this.tags = []; 64686 this.ctr = 0; 64687 this.nonce = options.nonce; // key is the value of the data-emotion attribute, it's used to identify different sheets 64688 64689 this.key = options.key; 64690 this.container = options.container; 64691 this.prepend = options.prepend; 64692 this.insertionPoint = options.insertionPoint; 64693 this.before = null; 64694 } 64695 64696 var _proto = StyleSheet.prototype; 64697 64698 _proto.hydrate = function hydrate(nodes) { 64699 nodes.forEach(this._insertTag); 64700 }; 64701 64702 _proto.insert = function insert(rule) { 64703 // the max length is how many rules we have per style tag, it's 65000 in speedy mode 64704 // it's 1 in dev because we insert source maps that map a single rule to a location 64705 // and you can only have one source map per style tag 64706 if (this.ctr % (this.isSpeedy ? 65000 : 1) === 0) { 64707 this._insertTag(createStyleElement(this)); 64708 } 64709 64710 var tag = this.tags[this.tags.length - 1]; 64711 64712 if (false) { var isImportRule; } 64713 64714 if (this.isSpeedy) { 64715 var sheet = sheetForTag(tag); 64716 64717 try { 64718 // this is the ultrafast version, works across browsers 64719 // the big drawback is that the css won't be editable in devtools 64720 sheet.insertRule(rule, sheet.cssRules.length); 64721 } catch (e) { 64722 if (false) {} 64723 } 64724 } else { 64725 tag.appendChild(document.createTextNode(rule)); 64726 } 64727 64728 this.ctr++; 64729 }; 64730 64731 _proto.flush = function flush() { 64732 // $FlowFixMe 64733 this.tags.forEach(function (tag) { 64734 return tag.parentNode && tag.parentNode.removeChild(tag); 64735 }); 64736 this.tags = []; 64737 this.ctr = 0; 64738 64739 if (false) {} 64740 }; 64741 64742 return StyleSheet; 64743 }(); 64744 64745 64746 64747 ;// ./node_modules/stylis/src/Utility.js 64748 /** 64749 * @param {number} 64750 * @return {number} 64751 */ 64752 var abs = Math.abs 64753 64754 /** 64755 * @param {number} 64756 * @return {string} 64757 */ 64758 var Utility_from = String.fromCharCode 64759 64760 /** 64761 * @param {object} 64762 * @return {object} 64763 */ 64764 var Utility_assign = Object.assign 64765 64766 /** 64767 * @param {string} value 64768 * @param {number} length 64769 * @return {number} 64770 */ 64771 function hash (value, length) { 64772 return Utility_charat(value, 0) ^ 45 ? (((((((length << 2) ^ Utility_charat(value, 0)) << 2) ^ Utility_charat(value, 1)) << 2) ^ Utility_charat(value, 2)) << 2) ^ Utility_charat(value, 3) : 0 64773 } 64774 64775 /** 64776 * @param {string} value 64777 * @return {string} 64778 */ 64779 function trim (value) { 64780 return value.trim() 64781 } 64782 64783 /** 64784 * @param {string} value 64785 * @param {RegExp} pattern 64786 * @return {string?} 64787 */ 64788 function Utility_match (value, pattern) { 64789 return (value = pattern.exec(value)) ? value[0] : value 64790 } 64791 64792 /** 64793 * @param {string} value 64794 * @param {(string|RegExp)} pattern 64795 * @param {string} replacement 64796 * @return {string} 64797 */ 64798 function Utility_replace (value, pattern, replacement) { 64799 return value.replace(pattern, replacement) 64800 } 64801 64802 /** 64803 * @param {string} value 64804 * @param {string} search 64805 * @return {number} 64806 */ 64807 function indexof (value, search) { 64808 return value.indexOf(search) 64809 } 64810 64811 /** 64812 * @param {string} value 64813 * @param {number} index 64814 * @return {number} 64815 */ 64816 function Utility_charat (value, index) { 64817 return value.charCodeAt(index) | 0 64818 } 64819 64820 /** 64821 * @param {string} value 64822 * @param {number} begin 64823 * @param {number} end 64824 * @return {string} 64825 */ 64826 function Utility_substr (value, begin, end) { 64827 return value.slice(begin, end) 64828 } 64829 64830 /** 64831 * @param {string} value 64832 * @return {number} 64833 */ 64834 function Utility_strlen (value) { 64835 return value.length 64836 } 64837 64838 /** 64839 * @param {any[]} value 64840 * @return {number} 64841 */ 64842 function Utility_sizeof (value) { 64843 return value.length 64844 } 64845 64846 /** 64847 * @param {any} value 64848 * @param {any[]} array 64849 * @return {any} 64850 */ 64851 function Utility_append (value, array) { 64852 return array.push(value), value 64853 } 64854 64855 /** 64856 * @param {string[]} array 64857 * @param {function} callback 64858 * @return {string} 64859 */ 64860 function Utility_combine (array, callback) { 64861 return array.map(callback).join('') 64862 } 64863 64864 ;// ./node_modules/stylis/src/Tokenizer.js 64865 64866 64867 var line = 1 64868 var column = 1 64869 var Tokenizer_length = 0 64870 var position = 0 64871 var Tokenizer_character = 0 64872 var characters = '' 64873 64874 /** 64875 * @param {string} value 64876 * @param {object | null} root 64877 * @param {object | null} parent 64878 * @param {string} type 64879 * @param {string[] | string} props 64880 * @param {object[] | string} children 64881 * @param {number} length 64882 */ 64883 function node (value, root, parent, type, props, children, length) { 64884 return {value: value, root: root, parent: parent, type: type, props: props, children: children, line: line, column: column, length: length, return: ''} 64885 } 64886 64887 /** 64888 * @param {object} root 64889 * @param {object} props 64890 * @return {object} 64891 */ 64892 function Tokenizer_copy (root, props) { 64893 return Utility_assign(node('', null, null, '', null, null, 0), root, {length: -root.length}, props) 64894 } 64895 64896 /** 64897 * @return {number} 64898 */ 64899 function Tokenizer_char () { 64900 return Tokenizer_character 64901 } 64902 64903 /** 64904 * @return {number} 64905 */ 64906 function prev () { 64907 Tokenizer_character = position > 0 ? Utility_charat(characters, --position) : 0 64908 64909 if (column--, Tokenizer_character === 10) 64910 column = 1, line-- 64911 64912 return Tokenizer_character 64913 } 64914 64915 /** 64916 * @return {number} 64917 */ 64918 function next () { 64919 Tokenizer_character = position < Tokenizer_length ? Utility_charat(characters, position++) : 0 64920 64921 if (column++, Tokenizer_character === 10) 64922 column = 1, line++ 64923 64924 return Tokenizer_character 64925 } 64926 64927 /** 64928 * @return {number} 64929 */ 64930 function peek () { 64931 return Utility_charat(characters, position) 64932 } 64933 64934 /** 64935 * @return {number} 64936 */ 64937 function caret () { 64938 return position 64939 } 64940 64941 /** 64942 * @param {number} begin 64943 * @param {number} end 64944 * @return {string} 64945 */ 64946 function slice (begin, end) { 64947 return Utility_substr(characters, begin, end) 64948 } 64949 64950 /** 64951 * @param {number} type 64952 * @return {number} 64953 */ 64954 function token (type) { 64955 switch (type) { 64956 // \0 \t \n \r \s whitespace token 64957 case 0: case 9: case 10: case 13: case 32: 64958 return 5 64959 // ! + , / > @ ~ isolate token 64960 case 33: case 43: case 44: case 47: case 62: case 64: case 126: 64961 // ; { } breakpoint token 64962 case 59: case 123: case 125: 64963 return 4 64964 // : accompanied token 64965 case 58: 64966 return 3 64967 // " ' ( [ opening delimit token 64968 case 34: case 39: case 40: case 91: 64969 return 2 64970 // ) ] closing delimit token 64971 case 41: case 93: 64972 return 1 64973 } 64974 64975 return 0 64976 } 64977 64978 /** 64979 * @param {string} value 64980 * @return {any[]} 64981 */ 64982 function alloc (value) { 64983 return line = column = 1, Tokenizer_length = Utility_strlen(characters = value), position = 0, [] 64984 } 64985 64986 /** 64987 * @param {any} value 64988 * @return {any} 64989 */ 64990 function dealloc (value) { 64991 return characters = '', value 64992 } 64993 64994 /** 64995 * @param {number} type 64996 * @return {string} 64997 */ 64998 function delimit (type) { 64999 return trim(slice(position - 1, delimiter(type === 91 ? type + 2 : type === 40 ? type + 1 : type))) 65000 } 65001 65002 /** 65003 * @param {string} value 65004 * @return {string[]} 65005 */ 65006 function Tokenizer_tokenize (value) { 65007 return dealloc(tokenizer(alloc(value))) 65008 } 65009 65010 /** 65011 * @param {number} type 65012 * @return {string} 65013 */ 65014 function whitespace (type) { 65015 while (Tokenizer_character = peek()) 65016 if (Tokenizer_character < 33) 65017 next() 65018 else 65019 break 65020 65021 return token(type) > 2 || token(Tokenizer_character) > 3 ? '' : ' ' 65022 } 65023 65024 /** 65025 * @param {string[]} children 65026 * @return {string[]} 65027 */ 65028 function tokenizer (children) { 65029 while (next()) 65030 switch (token(Tokenizer_character)) { 65031 case 0: append(identifier(position - 1), children) 65032 break 65033 case 2: append(delimit(Tokenizer_character), children) 65034 break 65035 default: append(from(Tokenizer_character), children) 65036 } 65037 65038 return children 65039 } 65040 65041 /** 65042 * @param {number} index 65043 * @param {number} count 65044 * @return {string} 65045 */ 65046 function escaping (index, count) { 65047 while (--count && next()) 65048 // not 0-9 A-F a-f 65049 if (Tokenizer_character < 48 || Tokenizer_character > 102 || (Tokenizer_character > 57 && Tokenizer_character < 65) || (Tokenizer_character > 70 && Tokenizer_character < 97)) 65050 break 65051 65052 return slice(index, caret() + (count < 6 && peek() == 32 && next() == 32)) 65053 } 65054 65055 /** 65056 * @param {number} type 65057 * @return {number} 65058 */ 65059 function delimiter (type) { 65060 while (next()) 65061 switch (Tokenizer_character) { 65062 // ] ) " ' 65063 case type: 65064 return position 65065 // " ' 65066 case 34: case 39: 65067 if (type !== 34 && type !== 39) 65068 delimiter(Tokenizer_character) 65069 break 65070 // ( 65071 case 40: 65072 if (type === 41) 65073 delimiter(type) 65074 break 65075 // \ 65076 case 92: 65077 next() 65078 break 65079 } 65080 65081 return position 65082 } 65083 65084 /** 65085 * @param {number} type 65086 * @param {number} index 65087 * @return {number} 65088 */ 65089 function commenter (type, index) { 65090 while (next()) 65091 // // 65092 if (type + Tokenizer_character === 47 + 10) 65093 break 65094 // /* 65095 else if (type + Tokenizer_character === 42 + 42 && peek() === 47) 65096 break 65097 65098 return '/*' + slice(index, position - 1) + '*' + Utility_from(type === 47 ? type : next()) 65099 } 65100 65101 /** 65102 * @param {number} index 65103 * @return {string} 65104 */ 65105 function identifier (index) { 65106 while (!token(peek())) 65107 next() 65108 65109 return slice(index, position) 65110 } 65111 65112 ;// ./node_modules/stylis/src/Enum.js 65113 var Enum_MS = '-ms-' 65114 var Enum_MOZ = '-moz-' 65115 var Enum_WEBKIT = '-webkit-' 65116 65117 var COMMENT = 'comm' 65118 var Enum_RULESET = 'rule' 65119 var Enum_DECLARATION = 'decl' 65120 65121 var PAGE = '@page' 65122 var MEDIA = '@media' 65123 var IMPORT = '@import' 65124 var CHARSET = '@charset' 65125 var VIEWPORT = '@viewport' 65126 var SUPPORTS = '@supports' 65127 var DOCUMENT = '@document' 65128 var NAMESPACE = '@namespace' 65129 var Enum_KEYFRAMES = '@keyframes' 65130 var FONT_FACE = '@font-face' 65131 var COUNTER_STYLE = '@counter-style' 65132 var FONT_FEATURE_VALUES = '@font-feature-values' 65133 65134 ;// ./node_modules/stylis/src/Serializer.js 65135 65136 65137 65138 /** 65139 * @param {object[]} children 65140 * @param {function} callback 65141 * @return {string} 65142 */ 65143 function Serializer_serialize (children, callback) { 65144 var output = '' 65145 var length = Utility_sizeof(children) 65146 65147 for (var i = 0; i < length; i++) 65148 output += callback(children[i], i, children, callback) || '' 65149 65150 return output 65151 } 65152 65153 /** 65154 * @param {object} element 65155 * @param {number} index 65156 * @param {object[]} children 65157 * @param {function} callback 65158 * @return {string} 65159 */ 65160 function Serializer_stringify (element, index, children, callback) { 65161 switch (element.type) { 65162 case IMPORT: case Enum_DECLARATION: return element.return = element.return || element.value 65163 case COMMENT: return '' 65164 case Enum_KEYFRAMES: return element.return = element.value + '{' + Serializer_serialize(element.children, callback) + '}' 65165 case Enum_RULESET: element.value = element.props.join(',') 65166 } 65167 65168 return Utility_strlen(children = Serializer_serialize(element.children, callback)) ? element.return = element.value + '{' + children + '}' : '' 65169 } 65170 65171 ;// ./node_modules/stylis/src/Middleware.js 65172 65173 65174 65175 65176 65177 65178 /** 65179 * @param {function[]} collection 65180 * @return {function} 65181 */ 65182 function middleware (collection) { 65183 var length = Utility_sizeof(collection) 65184 65185 return function (element, index, children, callback) { 65186 var output = '' 65187 65188 for (var i = 0; i < length; i++) 65189 output += collection[i](element, index, children, callback) || '' 65190 65191 return output 65192 } 65193 } 65194 65195 /** 65196 * @param {function} callback 65197 * @return {function} 65198 */ 65199 function rulesheet (callback) { 65200 return function (element) { 65201 if (!element.root) 65202 if (element = element.return) 65203 callback(element) 65204 } 65205 } 65206 65207 /** 65208 * @param {object} element 65209 * @param {number} index 65210 * @param {object[]} children 65211 * @param {function} callback 65212 */ 65213 function prefixer (element, index, children, callback) { 65214 if (element.length > -1) 65215 if (!element.return) 65216 switch (element.type) { 65217 case DECLARATION: element.return = prefix(element.value, element.length, children) 65218 return 65219 case KEYFRAMES: 65220 return serialize([copy(element, {value: replace(element.value, '@', '@' + WEBKIT)})], callback) 65221 case RULESET: 65222 if (element.length) 65223 return combine(element.props, function (value) { 65224 switch (match(value, /(::plac\w+|:read-\w+)/)) { 65225 // :read-(only|write) 65226 case ':read-only': case ':read-write': 65227 return serialize([copy(element, {props: [replace(value, /:(read-\w+)/, ':' + MOZ + '$1')]})], callback) 65228 // :placeholder 65229 case '::placeholder': 65230 return serialize([ 65231 copy(element, {props: [replace(value, /:(plac\w+)/, ':' + WEBKIT + 'input-$1')]}), 65232 copy(element, {props: [replace(value, /:(plac\w+)/, ':' + MOZ + '$1')]}), 65233 copy(element, {props: [replace(value, /:(plac\w+)/, MS + 'input-$1')]}) 65234 ], callback) 65235 } 65236 65237 return '' 65238 }) 65239 } 65240 } 65241 65242 /** 65243 * @param {object} element 65244 * @param {number} index 65245 * @param {object[]} children 65246 */ 65247 function namespace (element) { 65248 switch (element.type) { 65249 case RULESET: 65250 element.props = element.props.map(function (value) { 65251 return combine(tokenize(value), function (value, index, children) { 65252 switch (charat(value, 0)) { 65253 // \f 65254 case 12: 65255 return substr(value, 1, strlen(value)) 65256 // \0 ( + > ~ 65257 case 0: case 40: case 43: case 62: case 126: 65258 return value 65259 // : 65260 case 58: 65261 if (children[++index] === 'global') 65262 children[index] = '', children[++index] = '\f' + substr(children[index], index = 1, -1) 65263 // \s 65264 case 32: 65265 return index === 1 ? '' : value 65266 default: 65267 switch (index) { 65268 case 0: element = value 65269 return sizeof(children) > 1 ? '' : value 65270 case index = sizeof(children) - 1: case 2: 65271 return index === 2 ? value + element + element : value + element 65272 default: 65273 return value 65274 } 65275 } 65276 }) 65277 }) 65278 } 65279 } 65280 65281 ;// ./node_modules/stylis/src/Parser.js 65282 65283 65284 65285 65286 /** 65287 * @param {string} value 65288 * @return {object[]} 65289 */ 65290 function compile (value) { 65291 return dealloc(Parser_parse('', null, null, null, [''], value = alloc(value), 0, [0], value)) 65292 } 65293 65294 /** 65295 * @param {string} value 65296 * @param {object} root 65297 * @param {object?} parent 65298 * @param {string[]} rule 65299 * @param {string[]} rules 65300 * @param {string[]} rulesets 65301 * @param {number[]} pseudo 65302 * @param {number[]} points 65303 * @param {string[]} declarations 65304 * @return {object} 65305 */ 65306 function Parser_parse (value, root, parent, rule, rules, rulesets, pseudo, points, declarations) { 65307 var index = 0 65308 var offset = 0 65309 var length = pseudo 65310 var atrule = 0 65311 var property = 0 65312 var previous = 0 65313 var variable = 1 65314 var scanning = 1 65315 var ampersand = 1 65316 var character = 0 65317 var type = '' 65318 var props = rules 65319 var children = rulesets 65320 var reference = rule 65321 var characters = type 65322 65323 while (scanning) 65324 switch (previous = character, character = next()) { 65325 // ( 65326 case 40: 65327 if (previous != 108 && Utility_charat(characters, length - 1) == 58) { 65328 if (indexof(characters += Utility_replace(delimit(character), '&', '&\f'), '&\f') != -1) 65329 ampersand = -1 65330 break 65331 } 65332 // " ' [ 65333 case 34: case 39: case 91: 65334 characters += delimit(character) 65335 break 65336 // \t \n \r \s 65337 case 9: case 10: case 13: case 32: 65338 characters += whitespace(previous) 65339 break 65340 // \ 65341 case 92: 65342 characters += escaping(caret() - 1, 7) 65343 continue 65344 // / 65345 case 47: 65346 switch (peek()) { 65347 case 42: case 47: 65348 Utility_append(comment(commenter(next(), caret()), root, parent), declarations) 65349 break 65350 default: 65351 characters += '/' 65352 } 65353 break 65354 // { 65355 case 123 * variable: 65356 points[index++] = Utility_strlen(characters) * ampersand 65357 // } ; \0 65358 case 125 * variable: case 59: case 0: 65359 switch (character) { 65360 // \0 } 65361 case 0: case 125: scanning = 0 65362 // ; 65363 case 59 + offset: 65364 if (property > 0 && (Utility_strlen(characters) - length)) 65365 Utility_append(property > 32 ? declaration(characters + ';', rule, parent, length - 1) : declaration(Utility_replace(characters, ' ', '') + ';', rule, parent, length - 2), declarations) 65366 break 65367 // @ ; 65368 case 59: characters += ';' 65369 // { rule/at-rule 65370 default: 65371 Utility_append(reference = ruleset(characters, root, parent, index, offset, rules, points, type, props = [], children = [], length), rulesets) 65372 65373 if (character === 123) 65374 if (offset === 0) 65375 Parser_parse(characters, root, reference, reference, props, rulesets, length, points, children) 65376 else 65377 switch (atrule === 99 && Utility_charat(characters, 3) === 110 ? 100 : atrule) { 65378 // d m s 65379 case 100: case 109: case 115: 65380 Parser_parse(value, reference, reference, rule && Utility_append(ruleset(value, reference, reference, 0, 0, rules, points, type, rules, props = [], length), children), rules, children, length, points, rule ? props : children) 65381 break 65382 default: 65383 Parser_parse(characters, reference, reference, reference, [''], children, 0, points, children) 65384 } 65385 } 65386 65387 index = offset = property = 0, variable = ampersand = 1, type = characters = '', length = pseudo 65388 break 65389 // : 65390 case 58: 65391 length = 1 + Utility_strlen(characters), property = previous 65392 default: 65393 if (variable < 1) 65394 if (character == 123) 65395 --variable 65396 else if (character == 125 && variable++ == 0 && prev() == 125) 65397 continue 65398 65399 switch (characters += Utility_from(character), character * variable) { 65400 // & 65401 case 38: 65402 ampersand = offset > 0 ? 1 : (characters += '\f', -1) 65403 break 65404 // , 65405 case 44: 65406 points[index++] = (Utility_strlen(characters) - 1) * ampersand, ampersand = 1 65407 break 65408 // @ 65409 case 64: 65410 // - 65411 if (peek() === 45) 65412 characters += delimit(next()) 65413 65414 atrule = peek(), offset = length = Utility_strlen(type = characters += identifier(caret())), character++ 65415 break 65416 // - 65417 case 45: 65418 if (previous === 45 && Utility_strlen(characters) == 2) 65419 variable = 0 65420 } 65421 } 65422 65423 return rulesets 65424 } 65425 65426 /** 65427 * @param {string} value 65428 * @param {object} root 65429 * @param {object?} parent 65430 * @param {number} index 65431 * @param {number} offset 65432 * @param {string[]} rules 65433 * @param {number[]} points 65434 * @param {string} type 65435 * @param {string[]} props 65436 * @param {string[]} children 65437 * @param {number} length 65438 * @return {object} 65439 */ 65440 function ruleset (value, root, parent, index, offset, rules, points, type, props, children, length) { 65441 var post = offset - 1 65442 var rule = offset === 0 ? rules : [''] 65443 var size = Utility_sizeof(rule) 65444 65445 for (var i = 0, j = 0, k = 0; i < index; ++i) 65446 for (var x = 0, y = Utility_substr(value, post + 1, post = abs(j = points[i])), z = value; x < size; ++x) 65447 if (z = trim(j > 0 ? rule[x] + ' ' + y : Utility_replace(y, /&\f/g, rule[x]))) 65448 props[k++] = z 65449 65450 return node(value, root, parent, offset === 0 ? Enum_RULESET : type, props, children, length) 65451 } 65452 65453 /** 65454 * @param {number} value 65455 * @param {object} root 65456 * @param {object?} parent 65457 * @return {object} 65458 */ 65459 function comment (value, root, parent) { 65460 return node(value, root, parent, COMMENT, Utility_from(Tokenizer_char()), Utility_substr(value, 2, -2), 0) 65461 } 65462 65463 /** 65464 * @param {string} value 65465 * @param {object} root 65466 * @param {object?} parent 65467 * @param {number} length 65468 * @return {object} 65469 */ 65470 function declaration (value, root, parent, length) { 65471 return node(value, root, parent, Enum_DECLARATION, Utility_substr(value, 0, length), Utility_substr(value, length + 1, -1), length) 65472 } 65473 65474 ;// ./node_modules/@emotion/cache/dist/emotion-cache.browser.esm.js 65475 65476 65477 65478 65479 65480 var identifierWithPointTracking = function identifierWithPointTracking(begin, points, index) { 65481 var previous = 0; 65482 var character = 0; 65483 65484 while (true) { 65485 previous = character; 65486 character = peek(); // &\f 65487 65488 if (previous === 38 && character === 12) { 65489 points[index] = 1; 65490 } 65491 65492 if (token(character)) { 65493 break; 65494 } 65495 65496 next(); 65497 } 65498 65499 return slice(begin, position); 65500 }; 65501 65502 var toRules = function toRules(parsed, points) { 65503 // pretend we've started with a comma 65504 var index = -1; 65505 var character = 44; 65506 65507 do { 65508 switch (token(character)) { 65509 case 0: 65510 // &\f 65511 if (character === 38 && peek() === 12) { 65512 // this is not 100% correct, we don't account for literal sequences here - like for example quoted strings 65513 // stylis inserts \f after & to know when & where it should replace this sequence with the context selector 65514 // and when it should just concatenate the outer and inner selectors 65515 // it's very unlikely for this sequence to actually appear in a different context, so we just leverage this fact here 65516 points[index] = 1; 65517 } 65518 65519 parsed[index] += identifierWithPointTracking(position - 1, points, index); 65520 break; 65521 65522 case 2: 65523 parsed[index] += delimit(character); 65524 break; 65525 65526 case 4: 65527 // comma 65528 if (character === 44) { 65529 // colon 65530 parsed[++index] = peek() === 58 ? '&\f' : ''; 65531 points[index] = parsed[index].length; 65532 break; 65533 } 65534 65535 // fallthrough 65536 65537 default: 65538 parsed[index] += Utility_from(character); 65539 } 65540 } while (character = next()); 65541 65542 return parsed; 65543 }; 65544 65545 var getRules = function getRules(value, points) { 65546 return dealloc(toRules(alloc(value), points)); 65547 }; // WeakSet would be more appropriate, but only WeakMap is supported in IE11 65548 65549 65550 var fixedElements = /* #__PURE__ */new WeakMap(); 65551 var compat = function compat(element) { 65552 if (element.type !== 'rule' || !element.parent || // positive .length indicates that this rule contains pseudo 65553 // negative .length indicates that this rule has been already prefixed 65554 element.length < 1) { 65555 return; 65556 } 65557 65558 var value = element.value, 65559 parent = element.parent; 65560 var isImplicitRule = element.column === parent.column && element.line === parent.line; 65561 65562 while (parent.type !== 'rule') { 65563 parent = parent.parent; 65564 if (!parent) return; 65565 } // short-circuit for the simplest case 65566 65567 65568 if (element.props.length === 1 && value.charCodeAt(0) !== 58 65569 /* colon */ 65570 && !fixedElements.get(parent)) { 65571 return; 65572 } // if this is an implicitly inserted rule (the one eagerly inserted at the each new nested level) 65573 // then the props has already been manipulated beforehand as they that array is shared between it and its "rule parent" 65574 65575 65576 if (isImplicitRule) { 65577 return; 65578 } 65579 65580 fixedElements.set(element, true); 65581 var points = []; 65582 var rules = getRules(value, points); 65583 var parentRules = parent.props; 65584 65585 for (var i = 0, k = 0; i < rules.length; i++) { 65586 for (var j = 0; j < parentRules.length; j++, k++) { 65587 element.props[k] = points[i] ? rules[i].replace(/&\f/g, parentRules[j]) : parentRules[j] + " " + rules[i]; 65588 } 65589 } 65590 }; 65591 var removeLabel = function removeLabel(element) { 65592 if (element.type === 'decl') { 65593 var value = element.value; 65594 65595 if ( // charcode for l 65596 value.charCodeAt(0) === 108 && // charcode for b 65597 value.charCodeAt(2) === 98) { 65598 // this ignores label 65599 element["return"] = ''; 65600 element.value = ''; 65601 } 65602 } 65603 }; 65604 var ignoreFlag = 'emotion-disable-server-rendering-unsafe-selector-warning-please-do-not-use-this-the-warning-exists-for-a-reason'; 65605 65606 var isIgnoringComment = function isIgnoringComment(element) { 65607 return element.type === 'comm' && element.children.indexOf(ignoreFlag) > -1; 65608 }; 65609 65610 var createUnsafeSelectorsAlarm = function createUnsafeSelectorsAlarm(cache) { 65611 return function (element, index, children) { 65612 if (element.type !== 'rule' || cache.compat) return; 65613 var unsafePseudoClasses = element.value.match(/(:first|:nth|:nth-last)-child/g); 65614 65615 if (unsafePseudoClasses) { 65616 var isNested = element.parent === children[0]; // in nested rules comments become children of the "auto-inserted" rule 65617 // 65618 // considering this input: 65619 // .a { 65620 // .b /* comm */ {} 65621 // color: hotpink; 65622 // } 65623 // we get output corresponding to this: 65624 // .a { 65625 // & { 65626 // /* comm */ 65627 // color: hotpink; 65628 // } 65629 // .b {} 65630 // } 65631 65632 var commentContainer = isNested ? children[0].children : // global rule at the root level 65633 children; 65634 65635 for (var i = commentContainer.length - 1; i >= 0; i--) { 65636 var node = commentContainer[i]; 65637 65638 if (node.line < element.line) { 65639 break; 65640 } // it is quite weird but comments are *usually* put at `column: element.column - 1` 65641 // so we seek *from the end* for the node that is earlier than the rule's `element` and check that 65642 // this will also match inputs like this: 65643 // .a { 65644 // /* comm */ 65645 // .b {} 65646 // } 65647 // 65648 // but that is fine 65649 // 65650 // it would be the easiest to change the placement of the comment to be the first child of the rule: 65651 // .a { 65652 // .b { /* comm */ } 65653 // } 65654 // with such inputs we wouldn't have to search for the comment at all 65655 // TODO: consider changing this comment placement in the next major version 65656 65657 65658 if (node.column < element.column) { 65659 if (isIgnoringComment(node)) { 65660 return; 65661 } 65662 65663 break; 65664 } 65665 } 65666 65667 unsafePseudoClasses.forEach(function (unsafePseudoClass) { 65668 console.error("The pseudo class \"" + unsafePseudoClass + "\" is potentially unsafe when doing server-side rendering. Try changing it to \"" + unsafePseudoClass.split('-child')[0] + "-of-type\"."); 65669 }); 65670 } 65671 }; 65672 }; 65673 65674 var isImportRule = function isImportRule(element) { 65675 return element.type.charCodeAt(1) === 105 && element.type.charCodeAt(0) === 64; 65676 }; 65677 65678 var isPrependedWithRegularRules = function isPrependedWithRegularRules(index, children) { 65679 for (var i = index - 1; i >= 0; i--) { 65680 if (!isImportRule(children[i])) { 65681 return true; 65682 } 65683 } 65684 65685 return false; 65686 }; // use this to remove incorrect elements from further processing 65687 // so they don't get handed to the `sheet` (or anything else) 65688 // as that could potentially lead to additional logs which in turn could be overhelming to the user 65689 65690 65691 var nullifyElement = function nullifyElement(element) { 65692 element.type = ''; 65693 element.value = ''; 65694 element["return"] = ''; 65695 element.children = ''; 65696 element.props = ''; 65697 }; 65698 65699 var incorrectImportAlarm = function incorrectImportAlarm(element, index, children) { 65700 if (!isImportRule(element)) { 65701 return; 65702 } 65703 65704 if (element.parent) { 65705 console.error("`@import` rules can't be nested inside other rules. Please move it to the top level and put it before regular rules. Keep in mind that they can only be used within global styles."); 65706 nullifyElement(element); 65707 } else if (isPrependedWithRegularRules(index, children)) { 65708 console.error("`@import` rules can't be after other rules. Please put your `@import` rules before your other rules."); 65709 nullifyElement(element); 65710 } 65711 }; 65712 65713 /* eslint-disable no-fallthrough */ 65714 65715 function emotion_cache_browser_esm_prefix(value, length) { 65716 switch (hash(value, length)) { 65717 // color-adjust 65718 case 5103: 65719 return Enum_WEBKIT + 'print-' + value + value; 65720 // animation, animation-(delay|direction|duration|fill-mode|iteration-count|name|play-state|timing-function) 65721 65722 case 5737: 65723 case 4201: 65724 case 3177: 65725 case 3433: 65726 case 1641: 65727 case 4457: 65728 case 2921: // text-decoration, filter, clip-path, backface-visibility, column, box-decoration-break 65729 65730 case 5572: 65731 case 6356: 65732 case 5844: 65733 case 3191: 65734 case 6645: 65735 case 3005: // mask, mask-image, mask-(mode|clip|size), mask-(repeat|origin), mask-position, mask-composite, 65736 65737 case 6391: 65738 case 5879: 65739 case 5623: 65740 case 6135: 65741 case 4599: 65742 case 4855: // background-clip, columns, column-(count|fill|gap|rule|rule-color|rule-style|rule-width|span|width) 65743 65744 case 4215: 65745 case 6389: 65746 case 5109: 65747 case 5365: 65748 case 5621: 65749 case 3829: 65750 return Enum_WEBKIT + value + value; 65751 // appearance, user-select, transform, hyphens, text-size-adjust 65752 65753 case 5349: 65754 case 4246: 65755 case 4810: 65756 case 6968: 65757 case 2756: 65758 return Enum_WEBKIT + value + Enum_MOZ + value + Enum_MS + value + value; 65759 // flex, flex-direction 65760 65761 case 6828: 65762 case 4268: 65763 return Enum_WEBKIT + value + Enum_MS + value + value; 65764 // order 65765 65766 case 6165: 65767 return Enum_WEBKIT + value + Enum_MS + 'flex-' + value + value; 65768 // align-items 65769 65770 case 5187: 65771 return Enum_WEBKIT + value + Utility_replace(value, /(\w+).+(:[^]+)/, Enum_WEBKIT + 'box-$1$2' + Enum_MS + 'flex-$1$2') + value; 65772 // align-self 65773 65774 case 5443: 65775 return Enum_WEBKIT + value + Enum_MS + 'flex-item-' + Utility_replace(value, /flex-|-self/, '') + value; 65776 // align-content 65777 65778 case 4675: 65779 return Enum_WEBKIT + value + Enum_MS + 'flex-line-pack' + Utility_replace(value, /align-content|flex-|-self/, '') + value; 65780 // flex-shrink 65781 65782 case 5548: 65783 return Enum_WEBKIT + value + Enum_MS + Utility_replace(value, 'shrink', 'negative') + value; 65784 // flex-basis 65785 65786 case 5292: 65787 return Enum_WEBKIT + value + Enum_MS + Utility_replace(value, 'basis', 'preferred-size') + value; 65788 // flex-grow 65789 65790 case 6060: 65791 return Enum_WEBKIT + 'box-' + Utility_replace(value, '-grow', '') + Enum_WEBKIT + value + Enum_MS + Utility_replace(value, 'grow', 'positive') + value; 65792 // transition 65793 65794 case 4554: 65795 return Enum_WEBKIT + Utility_replace(value, /([^-])(transform)/g, '$1' + Enum_WEBKIT + '$2') + value; 65796 // cursor 65797 65798 case 6187: 65799 return Utility_replace(Utility_replace(Utility_replace(value, /(zoom-|grab)/, Enum_WEBKIT + '$1'), /(image-set)/, Enum_WEBKIT + '$1'), value, '') + value; 65800 // background, background-image 65801 65802 case 5495: 65803 case 3959: 65804 return Utility_replace(value, /(image-set\([^]*)/, Enum_WEBKIT + '$1' + '$`$1'); 65805 // justify-content 65806 65807 case 4968: 65808 return Utility_replace(Utility_replace(value, /(.+:)(flex-)?(.*)/, Enum_WEBKIT + 'box-pack:$3' + Enum_MS + 'flex-pack:$3'), /s.+-b[^;]+/, 'justify') + Enum_WEBKIT + value + value; 65809 // (margin|padding)-inline-(start|end) 65810 65811 case 4095: 65812 case 3583: 65813 case 4068: 65814 case 2532: 65815 return Utility_replace(value, /(.+)-inline(.+)/, Enum_WEBKIT + '$1$2') + value; 65816 // (min|max)?(width|height|inline-size|block-size) 65817 65818 case 8116: 65819 case 7059: 65820 case 5753: 65821 case 5535: 65822 case 5445: 65823 case 5701: 65824 case 4933: 65825 case 4677: 65826 case 5533: 65827 case 5789: 65828 case 5021: 65829 case 4765: 65830 // stretch, max-content, min-content, fill-available 65831 if (Utility_strlen(value) - 1 - length > 6) switch (Utility_charat(value, length + 1)) { 65832 // (m)ax-content, (m)in-content 65833 case 109: 65834 // - 65835 if (Utility_charat(value, length + 4) !== 45) break; 65836 // (f)ill-available, (f)it-content 65837 65838 case 102: 65839 return Utility_replace(value, /(.+:)(.+)-([^]+)/, '$1' + Enum_WEBKIT + '$2-$3' + '$1' + Enum_MOZ + (Utility_charat(value, length + 3) == 108 ? '$3' : '$2-$3')) + value; 65840 // (s)tretch 65841 65842 case 115: 65843 return ~indexof(value, 'stretch') ? emotion_cache_browser_esm_prefix(Utility_replace(value, 'stretch', 'fill-available'), length) + value : value; 65844 } 65845 break; 65846 // position: sticky 65847 65848 case 4949: 65849 // (s)ticky? 65850 if (Utility_charat(value, length + 1) !== 115) break; 65851 // display: (flex|inline-flex) 65852 65853 case 6444: 65854 switch (Utility_charat(value, Utility_strlen(value) - 3 - (~indexof(value, '!important') && 10))) { 65855 // stic(k)y 65856 case 107: 65857 return Utility_replace(value, ':', ':' + Enum_WEBKIT) + value; 65858 // (inline-)?fl(e)x 65859 65860 case 101: 65861 return Utility_replace(value, /(.+:)([^;!]+)(;|!.+)?/, '$1' + Enum_WEBKIT + (Utility_charat(value, 14) === 45 ? 'inline-' : '') + 'box$3' + '$1' + Enum_WEBKIT + '$2$3' + '$1' + Enum_MS + '$2box$3') + value; 65862 } 65863 65864 break; 65865 // writing-mode 65866 65867 case 5936: 65868 switch (Utility_charat(value, length + 11)) { 65869 // vertical-l(r) 65870 case 114: 65871 return Enum_WEBKIT + value + Enum_MS + Utility_replace(value, /[svh]\w+-[tblr]{2}/, 'tb') + value; 65872 // vertical-r(l) 65873 65874 case 108: 65875 return Enum_WEBKIT + value + Enum_MS + Utility_replace(value, /[svh]\w+-[tblr]{2}/, 'tb-rl') + value; 65876 // horizontal(-)tb 65877 65878 case 45: 65879 return Enum_WEBKIT + value + Enum_MS + Utility_replace(value, /[svh]\w+-[tblr]{2}/, 'lr') + value; 65880 } 65881 65882 return Enum_WEBKIT + value + Enum_MS + value + value; 65883 } 65884 65885 return value; 65886 } 65887 65888 var emotion_cache_browser_esm_prefixer = function prefixer(element, index, children, callback) { 65889 if (element.length > -1) if (!element["return"]) switch (element.type) { 65890 case Enum_DECLARATION: 65891 element["return"] = emotion_cache_browser_esm_prefix(element.value, element.length); 65892 break; 65893 65894 case Enum_KEYFRAMES: 65895 return Serializer_serialize([Tokenizer_copy(element, { 65896 value: Utility_replace(element.value, '@', '@' + Enum_WEBKIT) 65897 })], callback); 65898 65899 case Enum_RULESET: 65900 if (element.length) return Utility_combine(element.props, function (value) { 65901 switch (Utility_match(value, /(::plac\w+|:read-\w+)/)) { 65902 // :read-(only|write) 65903 case ':read-only': 65904 case ':read-write': 65905 return Serializer_serialize([Tokenizer_copy(element, { 65906 props: [Utility_replace(value, /:(read-\w+)/, ':' + Enum_MOZ + '$1')] 65907 })], callback); 65908 // :placeholder 65909 65910 case '::placeholder': 65911 return Serializer_serialize([Tokenizer_copy(element, { 65912 props: [Utility_replace(value, /:(plac\w+)/, ':' + Enum_WEBKIT + 'input-$1')] 65913 }), Tokenizer_copy(element, { 65914 props: [Utility_replace(value, /:(plac\w+)/, ':' + Enum_MOZ + '$1')] 65915 }), Tokenizer_copy(element, { 65916 props: [Utility_replace(value, /:(plac\w+)/, Enum_MS + 'input-$1')] 65917 })], callback); 65918 } 65919 65920 return ''; 65921 }); 65922 } 65923 }; 65924 65925 var defaultStylisPlugins = [emotion_cache_browser_esm_prefixer]; 65926 65927 var createCache = function createCache(options) { 65928 var key = options.key; 65929 65930 if (false) {} 65931 65932 if ( key === 'css') { 65933 var ssrStyles = document.querySelectorAll("style[data-emotion]:not([data-s])"); // get SSRed styles out of the way of React's hydration 65934 // document.head is a safe place to move them to(though note document.head is not necessarily the last place they will be) 65935 // note this very very intentionally targets all style elements regardless of the key to ensure 65936 // that creating a cache works inside of render of a React component 65937 65938 Array.prototype.forEach.call(ssrStyles, function (node) { 65939 // we want to only move elements which have a space in the data-emotion attribute value 65940 // because that indicates that it is an Emotion 11 server-side rendered style elements 65941 // while we will already ignore Emotion 11 client-side inserted styles because of the :not([data-s]) part in the selector 65942 // Emotion 10 client-side inserted styles did not have data-s (but importantly did not have a space in their data-emotion attributes) 65943 // so checking for the space ensures that loading Emotion 11 after Emotion 10 has inserted some styles 65944 // will not result in the Emotion 10 styles being destroyed 65945 var dataEmotionAttribute = node.getAttribute('data-emotion'); 65946 65947 if (dataEmotionAttribute.indexOf(' ') === -1) { 65948 return; 65949 } 65950 document.head.appendChild(node); 65951 node.setAttribute('data-s', ''); 65952 }); 65953 } 65954 65955 var stylisPlugins = options.stylisPlugins || defaultStylisPlugins; 65956 65957 if (false) {} 65958 65959 var inserted = {}; 65960 var container; 65961 var nodesToHydrate = []; 65962 65963 { 65964 container = options.container || document.head; 65965 Array.prototype.forEach.call( // this means we will ignore elements which don't have a space in them which 65966 // means that the style elements we're looking at are only Emotion 11 server-rendered style elements 65967 document.querySelectorAll("style[data-emotion^=\"" + key + " \"]"), function (node) { 65968 var attrib = node.getAttribute("data-emotion").split(' '); // $FlowFixMe 65969 65970 for (var i = 1; i < attrib.length; i++) { 65971 inserted[attrib[i]] = true; 65972 } 65973 65974 nodesToHydrate.push(node); 65975 }); 65976 } 65977 65978 var _insert; 65979 65980 var omnipresentPlugins = [compat, removeLabel]; 65981 65982 if (false) {} 65983 65984 { 65985 var currentSheet; 65986 var finalizingPlugins = [Serializer_stringify, false ? 0 : rulesheet(function (rule) { 65987 currentSheet.insert(rule); 65988 })]; 65989 var serializer = middleware(omnipresentPlugins.concat(stylisPlugins, finalizingPlugins)); 65990 65991 var stylis = function stylis(styles) { 65992 return Serializer_serialize(compile(styles), serializer); 65993 }; 65994 65995 _insert = function insert(selector, serialized, sheet, shouldCache) { 65996 currentSheet = sheet; 65997 65998 if (false) {} 65999 66000 stylis(selector ? selector + "{" + serialized.styles + "}" : serialized.styles); 66001 66002 if (shouldCache) { 66003 cache.inserted[serialized.name] = true; 66004 } 66005 }; 66006 } 66007 66008 var cache = { 66009 key: key, 66010 sheet: new StyleSheet({ 66011 key: key, 66012 container: container, 66013 nonce: options.nonce, 66014 speedy: options.speedy, 66015 prepend: options.prepend, 66016 insertionPoint: options.insertionPoint 66017 }), 66018 nonce: options.nonce, 66019 inserted: inserted, 66020 registered: {}, 66021 insert: _insert 66022 }; 66023 cache.sheet.hydrate(nodesToHydrate); 66024 return cache; 66025 }; 66026 66027 /* harmony default export */ const emotion_cache_browser_esm = (createCache); 66028 66029 ;// ./node_modules/@emotion/hash/dist/emotion-hash.esm.js 66030 /* eslint-disable */ 66031 // Inspired by https://github.com/garycourt/murmurhash-js 66032 // Ported from https://github.com/aappleby/smhasher/blob/61a0530f28277f2e850bfc39600ce61d02b518de/src/MurmurHash2.cpp#L37-L86 66033 function murmur2(str) { 66034 // 'm' and 'r' are mixing constants generated offline. 66035 // They're not really 'magic', they just happen to work well. 66036 // const m = 0x5bd1e995; 66037 // const r = 24; 66038 // Initialize the hash 66039 var h = 0; // Mix 4 bytes at a time into the hash 66040 66041 var k, 66042 i = 0, 66043 len = str.length; 66044 66045 for (; len >= 4; ++i, len -= 4) { 66046 k = str.charCodeAt(i) & 0xff | (str.charCodeAt(++i) & 0xff) << 8 | (str.charCodeAt(++i) & 0xff) << 16 | (str.charCodeAt(++i) & 0xff) << 24; 66047 k = 66048 /* Math.imul(k, m): */ 66049 (k & 0xffff) * 0x5bd1e995 + ((k >>> 16) * 0xe995 << 16); 66050 k ^= 66051 /* k >>> r: */ 66052 k >>> 24; 66053 h = 66054 /* Math.imul(k, m): */ 66055 (k & 0xffff) * 0x5bd1e995 + ((k >>> 16) * 0xe995 << 16) ^ 66056 /* Math.imul(h, m): */ 66057 (h & 0xffff) * 0x5bd1e995 + ((h >>> 16) * 0xe995 << 16); 66058 } // Handle the last few bytes of the input array 66059 66060 66061 switch (len) { 66062 case 3: 66063 h ^= (str.charCodeAt(i + 2) & 0xff) << 16; 66064 66065 case 2: 66066 h ^= (str.charCodeAt(i + 1) & 0xff) << 8; 66067 66068 case 1: 66069 h ^= str.charCodeAt(i) & 0xff; 66070 h = 66071 /* Math.imul(h, m): */ 66072 (h & 0xffff) * 0x5bd1e995 + ((h >>> 16) * 0xe995 << 16); 66073 } // Do a few final mixes of the hash to ensure the last few 66074 // bytes are well-incorporated. 66075 66076 66077 h ^= h >>> 13; 66078 h = 66079 /* Math.imul(h, m): */ 66080 (h & 0xffff) * 0x5bd1e995 + ((h >>> 16) * 0xe995 << 16); 66081 return ((h ^ h >>> 15) >>> 0).toString(36); 66082 } 66083 66084 /* harmony default export */ const emotion_hash_esm = (murmur2); 66085 66086 ;// ./node_modules/@emotion/unitless/dist/emotion-unitless.esm.js 66087 var unitlessKeys = { 66088 animationIterationCount: 1, 66089 borderImageOutset: 1, 66090 borderImageSlice: 1, 66091 borderImageWidth: 1, 66092 boxFlex: 1, 66093 boxFlexGroup: 1, 66094 boxOrdinalGroup: 1, 66095 columnCount: 1, 66096 columns: 1, 66097 flex: 1, 66098 flexGrow: 1, 66099 flexPositive: 1, 66100 flexShrink: 1, 66101 flexNegative: 1, 66102 flexOrder: 1, 66103 gridRow: 1, 66104 gridRowEnd: 1, 66105 gridRowSpan: 1, 66106 gridRowStart: 1, 66107 gridColumn: 1, 66108 gridColumnEnd: 1, 66109 gridColumnSpan: 1, 66110 gridColumnStart: 1, 66111 msGridRow: 1, 66112 msGridRowSpan: 1, 66113 msGridColumn: 1, 66114 msGridColumnSpan: 1, 66115 fontWeight: 1, 66116 lineHeight: 1, 66117 opacity: 1, 66118 order: 1, 66119 orphans: 1, 66120 tabSize: 1, 66121 widows: 1, 66122 zIndex: 1, 66123 zoom: 1, 66124 WebkitLineClamp: 1, 66125 // SVG-related properties 66126 fillOpacity: 1, 66127 floodOpacity: 1, 66128 stopOpacity: 1, 66129 strokeDasharray: 1, 66130 strokeDashoffset: 1, 66131 strokeMiterlimit: 1, 66132 strokeOpacity: 1, 66133 strokeWidth: 1 66134 }; 66135 66136 /* harmony default export */ const emotion_unitless_esm = (unitlessKeys); 66137 66138 ;// ./node_modules/@emotion/serialize/dist/emotion-serialize.browser.esm.js 66139 66140 66141 66142 66143 var ILLEGAL_ESCAPE_SEQUENCE_ERROR = "You have illegal escape sequence in your template literal, most likely inside content's property value.\nBecause you write your CSS inside a JavaScript string you actually have to do double escaping, so for example \"content: '\\00d7';\" should become \"content: '\\\\00d7';\".\nYou can read more about this here:\nhttps://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals#ES2018_revision_of_illegal_escape_sequences"; 66144 var UNDEFINED_AS_OBJECT_KEY_ERROR = "You have passed in falsy value as style object's key (can happen when in example you pass unexported component as computed key)."; 66145 var hyphenateRegex = /[A-Z]|^ms/g; 66146 var animationRegex = /_EMO_([^_]+?)_([^]*?)_EMO_/g; 66147 66148 var isCustomProperty = function isCustomProperty(property) { 66149 return property.charCodeAt(1) === 45; 66150 }; 66151 66152 var isProcessableValue = function isProcessableValue(value) { 66153 return value != null && typeof value !== 'boolean'; 66154 }; 66155 66156 var processStyleName = /* #__PURE__ */memoize(function (styleName) { 66157 return isCustomProperty(styleName) ? styleName : styleName.replace(hyphenateRegex, '-$&').toLowerCase(); 66158 }); 66159 66160 var processStyleValue = function processStyleValue(key, value) { 66161 switch (key) { 66162 case 'animation': 66163 case 'animationName': 66164 { 66165 if (typeof value === 'string') { 66166 return value.replace(animationRegex, function (match, p1, p2) { 66167 cursor = { 66168 name: p1, 66169 styles: p2, 66170 next: cursor 66171 }; 66172 return p1; 66173 }); 66174 } 66175 } 66176 } 66177 66178 if (emotion_unitless_esm[key] !== 1 && !isCustomProperty(key) && typeof value === 'number' && value !== 0) { 66179 return value + 'px'; 66180 } 66181 66182 return value; 66183 }; 66184 66185 if (false) { var hyphenatedCache, hyphenPattern, msPattern, oldProcessStyleValue, contentValues, contentValuePattern; } 66186 66187 var noComponentSelectorMessage = (/* unused pure expression or super */ null && ('Component selectors can only be used in conjunction with ' + '@emotion/babel-plugin, the swc Emotion plugin, or another Emotion-aware ' + 'compiler transform.')); 66188 66189 function handleInterpolation(mergedProps, registered, interpolation) { 66190 if (interpolation == null) { 66191 return ''; 66192 } 66193 66194 if (interpolation.__emotion_styles !== undefined) { 66195 if (false) {} 66196 66197 return interpolation; 66198 } 66199 66200 switch (typeof interpolation) { 66201 case 'boolean': 66202 { 66203 return ''; 66204 } 66205 66206 case 'object': 66207 { 66208 if (interpolation.anim === 1) { 66209 cursor = { 66210 name: interpolation.name, 66211 styles: interpolation.styles, 66212 next: cursor 66213 }; 66214 return interpolation.name; 66215 } 66216 66217 if (interpolation.styles !== undefined) { 66218 var next = interpolation.next; 66219 66220 if (next !== undefined) { 66221 // not the most efficient thing ever but this is a pretty rare case 66222 // and there will be very few iterations of this generally 66223 while (next !== undefined) { 66224 cursor = { 66225 name: next.name, 66226 styles: next.styles, 66227 next: cursor 66228 }; 66229 next = next.next; 66230 } 66231 } 66232 66233 var styles = interpolation.styles + ";"; 66234 66235 if (false) {} 66236 66237 return styles; 66238 } 66239 66240 return createStringFromObject(mergedProps, registered, interpolation); 66241 } 66242 66243 case 'function': 66244 { 66245 if (mergedProps !== undefined) { 66246 var previousCursor = cursor; 66247 var result = interpolation(mergedProps); 66248 cursor = previousCursor; 66249 return handleInterpolation(mergedProps, registered, result); 66250 } else if (false) {} 66251 66252 break; 66253 } 66254 66255 case 'string': 66256 if (false) { var replaced, matched; } 66257 66258 break; 66259 } // finalize string values (regular strings and functions interpolated into css calls) 66260 66261 66262 if (registered == null) { 66263 return interpolation; 66264 } 66265 66266 var cached = registered[interpolation]; 66267 return cached !== undefined ? cached : interpolation; 66268 } 66269 66270 function createStringFromObject(mergedProps, registered, obj) { 66271 var string = ''; 66272 66273 if (Array.isArray(obj)) { 66274 for (var i = 0; i < obj.length; i++) { 66275 string += handleInterpolation(mergedProps, registered, obj[i]) + ";"; 66276 } 66277 } else { 66278 for (var _key in obj) { 66279 var value = obj[_key]; 66280 66281 if (typeof value !== 'object') { 66282 if (registered != null && registered[value] !== undefined) { 66283 string += _key + "{" + registered[value] + "}"; 66284 } else if (isProcessableValue(value)) { 66285 string += processStyleName(_key) + ":" + processStyleValue(_key, value) + ";"; 66286 } 66287 } else { 66288 if (_key === 'NO_COMPONENT_SELECTOR' && "production" !== 'production') {} 66289 66290 if (Array.isArray(value) && typeof value[0] === 'string' && (registered == null || registered[value[0]] === undefined)) { 66291 for (var _i = 0; _i < value.length; _i++) { 66292 if (isProcessableValue(value[_i])) { 66293 string += processStyleName(_key) + ":" + processStyleValue(_key, value[_i]) + ";"; 66294 } 66295 } 66296 } else { 66297 var interpolated = handleInterpolation(mergedProps, registered, value); 66298 66299 switch (_key) { 66300 case 'animation': 66301 case 'animationName': 66302 { 66303 string += processStyleName(_key) + ":" + interpolated + ";"; 66304 break; 66305 } 66306 66307 default: 66308 { 66309 if (false) {} 66310 66311 string += _key + "{" + interpolated + "}"; 66312 } 66313 } 66314 } 66315 } 66316 } 66317 } 66318 66319 return string; 66320 } 66321 66322 var labelPattern = /label:\s*([^\s;\n{]+)\s*(;|$)/g; 66323 var sourceMapPattern; 66324 66325 if (false) {} // this is the cursor for keyframes 66326 // keyframes are stored on the SerializedStyles object as a linked list 66327 66328 66329 var cursor; 66330 var emotion_serialize_browser_esm_serializeStyles = function serializeStyles(args, registered, mergedProps) { 66331 if (args.length === 1 && typeof args[0] === 'object' && args[0] !== null && args[0].styles !== undefined) { 66332 return args[0]; 66333 } 66334 66335 var stringMode = true; 66336 var styles = ''; 66337 cursor = undefined; 66338 var strings = args[0]; 66339 66340 if (strings == null || strings.raw === undefined) { 66341 stringMode = false; 66342 styles += handleInterpolation(mergedProps, registered, strings); 66343 } else { 66344 if (false) {} 66345 66346 styles += strings[0]; 66347 } // we start at 1 since we've already handled the first arg 66348 66349 66350 for (var i = 1; i < args.length; i++) { 66351 styles += handleInterpolation(mergedProps, registered, args[i]); 66352 66353 if (stringMode) { 66354 if (false) {} 66355 66356 styles += strings[i]; 66357 } 66358 } 66359 66360 var sourceMap; 66361 66362 if (false) {} // using a global regex with .exec is stateful so lastIndex has to be reset each time 66363 66364 66365 labelPattern.lastIndex = 0; 66366 var identifierName = ''; 66367 var match; // https://esbench.com/bench/5b809c2cf2949800a0f61fb5 66368 66369 while ((match = labelPattern.exec(styles)) !== null) { 66370 identifierName += '-' + // $FlowFixMe we know it's not null 66371 match[1]; 66372 } 66373 66374 var name = emotion_hash_esm(styles) + identifierName; 66375 66376 if (false) {} 66377 66378 return { 66379 name: name, 66380 styles: styles, 66381 next: cursor 66382 }; 66383 }; 66384 66385 66386 66387 ;// ./node_modules/@emotion/use-insertion-effect-with-fallbacks/dist/emotion-use-insertion-effect-with-fallbacks.browser.esm.js 66388 66389 66390 66391 var syncFallback = function syncFallback(create) { 66392 return create(); 66393 }; 66394 66395 var useInsertionEffect = external_React_['useInsertion' + 'Effect'] ? external_React_['useInsertion' + 'Effect'] : false; 66396 var emotion_use_insertion_effect_with_fallbacks_browser_esm_useInsertionEffectAlwaysWithSyncFallback = useInsertionEffect || syncFallback; 66397 var useInsertionEffectWithLayoutFallback = (/* unused pure expression or super */ null && (useInsertionEffect || useLayoutEffect)); 66398 66399 66400 66401 ;// ./node_modules/@emotion/react/dist/emotion-element-6a883da9.browser.esm.js 66402 66403 66404 66405 66406 66407 66408 66409 66410 66411 var emotion_element_6a883da9_browser_esm_hasOwnProperty = {}.hasOwnProperty; 66412 66413 var EmotionCacheContext = /* #__PURE__ */(0,external_React_.createContext)( // we're doing this to avoid preconstruct's dead code elimination in this one case 66414 // because this module is primarily intended for the browser and node 66415 // but it's also required in react native and similar environments sometimes 66416 // and we could have a special build just for that 66417 // but this is much easier and the native packages 66418 // might use a different theme context in the future anyway 66419 typeof HTMLElement !== 'undefined' ? /* #__PURE__ */emotion_cache_browser_esm({ 66420 key: 'css' 66421 }) : null); 66422 66423 if (false) {} 66424 66425 var CacheProvider = EmotionCacheContext.Provider; 66426 var __unsafe_useEmotionCache = function useEmotionCache() { 66427 return useContext(EmotionCacheContext); 66428 }; 66429 66430 var withEmotionCache = function withEmotionCache(func) { 66431 // $FlowFixMe 66432 return /*#__PURE__*/(0,external_React_.forwardRef)(function (props, ref) { 66433 // the cache will never be null in the browser 66434 var cache = (0,external_React_.useContext)(EmotionCacheContext); 66435 return func(props, cache, ref); 66436 }); 66437 }; 66438 66439 var ThemeContext = /* #__PURE__ */(0,external_React_.createContext)({}); 66440 66441 if (false) {} 66442 66443 var useTheme = function useTheme() { 66444 return useContext(ThemeContext); 66445 }; 66446 66447 var getTheme = function getTheme(outerTheme, theme) { 66448 if (typeof theme === 'function') { 66449 var mergedTheme = theme(outerTheme); 66450 66451 if (false) {} 66452 66453 return mergedTheme; 66454 } 66455 66456 if (false) {} 66457 66458 return _extends({}, outerTheme, theme); 66459 }; 66460 66461 var createCacheWithTheme = /* #__PURE__ */(/* unused pure expression or super */ null && (weakMemoize(function (outerTheme) { 66462 return weakMemoize(function (theme) { 66463 return getTheme(outerTheme, theme); 66464 }); 66465 }))); 66466 var ThemeProvider = function ThemeProvider(props) { 66467 var theme = useContext(ThemeContext); 66468 66469 if (props.theme !== theme) { 66470 theme = createCacheWithTheme(theme)(props.theme); 66471 } 66472 66473 return /*#__PURE__*/createElement(ThemeContext.Provider, { 66474 value: theme 66475 }, props.children); 66476 }; 66477 function withTheme(Component) { 66478 var componentName = Component.displayName || Component.name || 'Component'; 66479 66480 var render = function render(props, ref) { 66481 var theme = useContext(ThemeContext); 66482 return /*#__PURE__*/createElement(Component, _extends({ 66483 theme: theme, 66484 ref: ref 66485 }, props)); 66486 }; // $FlowFixMe 66487 66488 66489 var WithTheme = /*#__PURE__*/forwardRef(render); 66490 WithTheme.displayName = "WithTheme(" + componentName + ")"; 66491 return hoistNonReactStatics(WithTheme, Component); 66492 } 66493 66494 var getLastPart = function getLastPart(functionName) { 66495 // The match may be something like 'Object.createEmotionProps' or 66496 // 'Loader.prototype.render' 66497 var parts = functionName.split('.'); 66498 return parts[parts.length - 1]; 66499 }; 66500 66501 var getFunctionNameFromStackTraceLine = function getFunctionNameFromStackTraceLine(line) { 66502 // V8 66503 var match = /^\s+at\s+([A-Za-z0-9$.]+)\s/.exec(line); 66504 if (match) return getLastPart(match[1]); // Safari / Firefox 66505 66506 match = /^([A-Za-z0-9$.]+)@/.exec(line); 66507 if (match) return getLastPart(match[1]); 66508 return undefined; 66509 }; 66510 66511 var internalReactFunctionNames = /* #__PURE__ */new Set(['renderWithHooks', 'processChild', 'finishClassComponent', 'renderToString']); // These identifiers come from error stacks, so they have to be valid JS 66512 // identifiers, thus we only need to replace what is a valid character for JS, 66513 // but not for CSS. 66514 66515 var sanitizeIdentifier = function sanitizeIdentifier(identifier) { 66516 return identifier.replace(/\$/g, '-'); 66517 }; 66518 66519 var getLabelFromStackTrace = function getLabelFromStackTrace(stackTrace) { 66520 if (!stackTrace) return undefined; 66521 var lines = stackTrace.split('\n'); 66522 66523 for (var i = 0; i < lines.length; i++) { 66524 var functionName = getFunctionNameFromStackTraceLine(lines[i]); // The first line of V8 stack traces is just "Error" 66525 66526 if (!functionName) continue; // If we reach one of these, we have gone too far and should quit 66527 66528 if (internalReactFunctionNames.has(functionName)) break; // The component name is the first function in the stack that starts with an 66529 // uppercase letter 66530 66531 if (/^[A-Z]/.test(functionName)) return sanitizeIdentifier(functionName); 66532 } 66533 66534 return undefined; 66535 }; 66536 66537 var typePropName = '__EMOTION_TYPE_PLEASE_DO_NOT_USE__'; 66538 var labelPropName = '__EMOTION_LABEL_PLEASE_DO_NOT_USE__'; 66539 var createEmotionProps = function createEmotionProps(type, props) { 66540 if (false) {} 66541 66542 var newProps = {}; 66543 66544 for (var key in props) { 66545 if (emotion_element_6a883da9_browser_esm_hasOwnProperty.call(props, key)) { 66546 newProps[key] = props[key]; 66547 } 66548 } 66549 66550 newProps[typePropName] = type; // For performance, only call getLabelFromStackTrace in development and when 66551 // the label hasn't already been computed 66552 66553 if (false) { var label; } 66554 66555 return newProps; 66556 }; 66557 66558 var Insertion = function Insertion(_ref) { 66559 var cache = _ref.cache, 66560 serialized = _ref.serialized, 66561 isStringTag = _ref.isStringTag; 66562 registerStyles(cache, serialized, isStringTag); 66563 var rules = useInsertionEffectAlwaysWithSyncFallback(function () { 66564 return insertStyles(cache, serialized, isStringTag); 66565 }); 66566 66567 return null; 66568 }; 66569 66570 var Emotion = /* #__PURE__ */(/* unused pure expression or super */ null && (withEmotionCache(function (props, cache, ref) { 66571 var cssProp = props.css; // so that using `css` from `emotion` and passing the result to the css prop works 66572 // not passing the registered cache to serializeStyles because it would 66573 // make certain babel optimisations not possible 66574 66575 if (typeof cssProp === 'string' && cache.registered[cssProp] !== undefined) { 66576 cssProp = cache.registered[cssProp]; 66577 } 66578 66579 var WrappedComponent = props[typePropName]; 66580 var registeredStyles = [cssProp]; 66581 var className = ''; 66582 66583 if (typeof props.className === 'string') { 66584 className = getRegisteredStyles(cache.registered, registeredStyles, props.className); 66585 } else if (props.className != null) { 66586 className = props.className + " "; 66587 } 66588 66589 var serialized = serializeStyles(registeredStyles, undefined, useContext(ThemeContext)); 66590 66591 if (false) { var labelFromStack; } 66592 66593 className += cache.key + "-" + serialized.name; 66594 var newProps = {}; 66595 66596 for (var key in props) { 66597 if (emotion_element_6a883da9_browser_esm_hasOwnProperty.call(props, key) && key !== 'css' && key !== typePropName && ( true || 0)) { 66598 newProps[key] = props[key]; 66599 } 66600 } 66601 66602 newProps.ref = ref; 66603 newProps.className = className; 66604 return /*#__PURE__*/createElement(Fragment, null, /*#__PURE__*/createElement(Insertion, { 66605 cache: cache, 66606 serialized: serialized, 66607 isStringTag: typeof WrappedComponent === 'string' 66608 }), /*#__PURE__*/createElement(WrappedComponent, newProps)); 66609 }))); 66610 66611 if (false) {} 66612 66613 66614 66615 ;// ./node_modules/@emotion/utils/dist/emotion-utils.browser.esm.js 66616 var isBrowser = "object" !== 'undefined'; 66617 function emotion_utils_browser_esm_getRegisteredStyles(registered, registeredStyles, classNames) { 66618 var rawClassName = ''; 66619 classNames.split(' ').forEach(function (className) { 66620 if (registered[className] !== undefined) { 66621 registeredStyles.push(registered[className] + ";"); 66622 } else { 66623 rawClassName += className + " "; 66624 } 66625 }); 66626 return rawClassName; 66627 } 66628 var emotion_utils_browser_esm_registerStyles = function registerStyles(cache, serialized, isStringTag) { 66629 var className = cache.key + "-" + serialized.name; 66630 66631 if ( // we only need to add the styles to the registered cache if the 66632 // class name could be used further down 66633 // the tree but if it's a string tag, we know it won't 66634 // so we don't have to add it to registered cache. 66635 // this improves memory usage since we can avoid storing the whole style string 66636 (isStringTag === false || // we need to always store it if we're in compat mode and 66637 // in node since emotion-server relies on whether a style is in 66638 // the registered cache to know whether a style is global or not 66639 // also, note that this check will be dead code eliminated in the browser 66640 isBrowser === false ) && cache.registered[className] === undefined) { 66641 cache.registered[className] = serialized.styles; 66642 } 66643 }; 66644 var emotion_utils_browser_esm_insertStyles = function insertStyles(cache, serialized, isStringTag) { 66645 emotion_utils_browser_esm_registerStyles(cache, serialized, isStringTag); 66646 var className = cache.key + "-" + serialized.name; 66647 66648 if (cache.inserted[serialized.name] === undefined) { 66649 var current = serialized; 66650 66651 do { 66652 var maybeStyles = cache.insert(serialized === current ? "." + className : '', current, cache.sheet, true); 66653 66654 current = current.next; 66655 } while (current !== undefined); 66656 } 66657 }; 66658 66659 66660 66661 ;// ./node_modules/@emotion/styled/base/dist/emotion-styled-base.browser.esm.js 66662 66663 66664 66665 66666 66667 66668 66669 66670 var testOmitPropsOnStringTag = isPropValid; 66671 66672 var testOmitPropsOnComponent = function testOmitPropsOnComponent(key) { 66673 return key !== 'theme'; 66674 }; 66675 66676 var getDefaultShouldForwardProp = function getDefaultShouldForwardProp(tag) { 66677 return typeof tag === 'string' && // 96 is one less than the char code 66678 // for "a" so this is checking that 66679 // it's a lowercase character 66680 tag.charCodeAt(0) > 96 ? testOmitPropsOnStringTag : testOmitPropsOnComponent; 66681 }; 66682 var composeShouldForwardProps = function composeShouldForwardProps(tag, options, isReal) { 66683 var shouldForwardProp; 66684 66685 if (options) { 66686 var optionsShouldForwardProp = options.shouldForwardProp; 66687 shouldForwardProp = tag.__emotion_forwardProp && optionsShouldForwardProp ? function (propName) { 66688 return tag.__emotion_forwardProp(propName) && optionsShouldForwardProp(propName); 66689 } : optionsShouldForwardProp; 66690 } 66691 66692 if (typeof shouldForwardProp !== 'function' && isReal) { 66693 shouldForwardProp = tag.__emotion_forwardProp; 66694 } 66695 66696 return shouldForwardProp; 66697 }; 66698 66699 var emotion_styled_base_browser_esm_ILLEGAL_ESCAPE_SEQUENCE_ERROR = "You have illegal escape sequence in your template literal, most likely inside content's property value.\nBecause you write your CSS inside a JavaScript string you actually have to do double escaping, so for example \"content: '\\00d7';\" should become \"content: '\\\\00d7';\".\nYou can read more about this here:\nhttps://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals#ES2018_revision_of_illegal_escape_sequences"; 66700 66701 var emotion_styled_base_browser_esm_Insertion = function Insertion(_ref) { 66702 var cache = _ref.cache, 66703 serialized = _ref.serialized, 66704 isStringTag = _ref.isStringTag; 66705 emotion_utils_browser_esm_registerStyles(cache, serialized, isStringTag); 66706 var rules = emotion_use_insertion_effect_with_fallbacks_browser_esm_useInsertionEffectAlwaysWithSyncFallback(function () { 66707 return emotion_utils_browser_esm_insertStyles(cache, serialized, isStringTag); 66708 }); 66709 66710 return null; 66711 }; 66712 66713 var createStyled = function createStyled(tag, options) { 66714 if (false) {} 66715 66716 var isReal = tag.__emotion_real === tag; 66717 var baseTag = isReal && tag.__emotion_base || tag; 66718 var identifierName; 66719 var targetClassName; 66720 66721 if (options !== undefined) { 66722 identifierName = options.label; 66723 targetClassName = options.target; 66724 } 66725 66726 var shouldForwardProp = composeShouldForwardProps(tag, options, isReal); 66727 var defaultShouldForwardProp = shouldForwardProp || getDefaultShouldForwardProp(baseTag); 66728 var shouldUseAs = !defaultShouldForwardProp('as'); 66729 return function () { 66730 var args = arguments; 66731 var styles = isReal && tag.__emotion_styles !== undefined ? tag.__emotion_styles.slice(0) : []; 66732 66733 if (identifierName !== undefined) { 66734 styles.push("label:" + identifierName + ";"); 66735 } 66736 66737 if (args[0] == null || args[0].raw === undefined) { 66738 styles.push.apply(styles, args); 66739 } else { 66740 if (false) {} 66741 66742 styles.push(args[0][0]); 66743 var len = args.length; 66744 var i = 1; 66745 66746 for (; i < len; i++) { 66747 if (false) {} 66748 66749 styles.push(args[i], args[0][i]); 66750 } 66751 } // $FlowFixMe: we need to cast StatelessFunctionalComponent to our PrivateStyledComponent class 66752 66753 66754 var Styled = withEmotionCache(function (props, cache, ref) { 66755 var FinalTag = shouldUseAs && props.as || baseTag; 66756 var className = ''; 66757 var classInterpolations = []; 66758 var mergedProps = props; 66759 66760 if (props.theme == null) { 66761 mergedProps = {}; 66762 66763 for (var key in props) { 66764 mergedProps[key] = props[key]; 66765 } 66766 66767 mergedProps.theme = (0,external_React_.useContext)(ThemeContext); 66768 } 66769 66770 if (typeof props.className === 'string') { 66771 className = emotion_utils_browser_esm_getRegisteredStyles(cache.registered, classInterpolations, props.className); 66772 } else if (props.className != null) { 66773 className = props.className + " "; 66774 } 66775 66776 var serialized = emotion_serialize_browser_esm_serializeStyles(styles.concat(classInterpolations), cache.registered, mergedProps); 66777 className += cache.key + "-" + serialized.name; 66778 66779 if (targetClassName !== undefined) { 66780 className += " " + targetClassName; 66781 } 66782 66783 var finalShouldForwardProp = shouldUseAs && shouldForwardProp === undefined ? getDefaultShouldForwardProp(FinalTag) : defaultShouldForwardProp; 66784 var newProps = {}; 66785 66786 for (var _key in props) { 66787 if (shouldUseAs && _key === 'as') continue; 66788 66789 if ( // $FlowFixMe 66790 finalShouldForwardProp(_key)) { 66791 newProps[_key] = props[_key]; 66792 } 66793 } 66794 66795 newProps.className = className; 66796 newProps.ref = ref; 66797 return /*#__PURE__*/(0,external_React_.createElement)(external_React_.Fragment, null, /*#__PURE__*/(0,external_React_.createElement)(emotion_styled_base_browser_esm_Insertion, { 66798 cache: cache, 66799 serialized: serialized, 66800 isStringTag: typeof FinalTag === 'string' 66801 }), /*#__PURE__*/(0,external_React_.createElement)(FinalTag, newProps)); 66802 }); 66803 Styled.displayName = identifierName !== undefined ? identifierName : "Styled(" + (typeof baseTag === 'string' ? baseTag : baseTag.displayName || baseTag.name || 'Component') + ")"; 66804 Styled.defaultProps = tag.defaultProps; 66805 Styled.__emotion_real = Styled; 66806 Styled.__emotion_base = baseTag; 66807 Styled.__emotion_styles = styles; 66808 Styled.__emotion_forwardProp = shouldForwardProp; 66809 Object.defineProperty(Styled, 'toString', { 66810 value: function value() { 66811 if (targetClassName === undefined && "production" !== 'production') {} // $FlowFixMe: coerce undefined to string 66812 66813 66814 return "." + targetClassName; 66815 } 66816 }); 66817 66818 Styled.withComponent = function (nextTag, nextOptions) { 66819 return createStyled(nextTag, extends_extends({}, options, nextOptions, { 66820 shouldForwardProp: composeShouldForwardProps(Styled, nextOptions, true) 66821 })).apply(void 0, styles); 66822 }; 66823 66824 return Styled; 66825 }; 66826 }; 66827 66828 /* harmony default export */ const emotion_styled_base_browser_esm = (createStyled); 66829 66830 ;// ./node_modules/@emotion/styled/dist/emotion-styled.browser.esm.js 66831 66832 66833 66834 66835 66836 66837 66838 66839 66840 var tags = ['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', 'marquee', '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', // SVG 66841 'circle', 'clipPath', 'defs', 'ellipse', 'foreignObject', 'g', 'image', 'line', 'linearGradient', 'mask', 'path', 'pattern', 'polygon', 'polyline', 'radialGradient', 'rect', 'stop', 'svg', 'text', 'tspan']; 66842 66843 var newStyled = emotion_styled_base_browser_esm.bind(); 66844 tags.forEach(function (tagName) { 66845 // $FlowFixMe: we can ignore this because its exposed type is defined by the CreateStyled type 66846 newStyled[tagName] = newStyled(tagName); 66847 }); 66848 66849 /* harmony default export */ const emotion_styled_browser_esm = (newStyled); 66850 66851 ;// ./node_modules/@wordpress/block-editor/build-module/components/dimensions-tool/width-height-tool.js 66852 66853 66854 66855 66856 const SingleColumnToolsPanelItem = emotion_styled_browser_esm((0,external_wp_components_namespaceObject.__experimentalToolsPanelItem))` 66857 grid-column: span 1; 66858 `; 66859 function WidthHeightTool({ 66860 panelId, 66861 value = {}, 66862 onChange = () => { 66863 }, 66864 units, 66865 isShownByDefault = true 66866 }) { 66867 const width = value.width === "auto" ? "" : value.width ?? ""; 66868 const height = value.height === "auto" ? "" : value.height ?? ""; 66869 const onDimensionChange = (dimension) => (nextDimension) => { 66870 const nextValue = { ...value }; 66871 if (!nextDimension) { 66872 delete nextValue[dimension]; 66873 } else { 66874 nextValue[dimension] = nextDimension; 66875 } 66876 onChange(nextValue); 66877 }; 66878 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 66879 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 66880 SingleColumnToolsPanelItem, 66881 { 66882 label: (0,external_wp_i18n_namespaceObject.__)("Width"), 66883 isShownByDefault, 66884 hasValue: () => width !== "", 66885 onDeselect: onDimensionChange("width"), 66886 panelId, 66887 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 66888 external_wp_components_namespaceObject.__experimentalUnitControl, 66889 { 66890 label: (0,external_wp_i18n_namespaceObject.__)("Width"), 66891 placeholder: (0,external_wp_i18n_namespaceObject.__)("Auto"), 66892 labelPosition: "top", 66893 units, 66894 min: 0, 66895 value: width, 66896 onChange: onDimensionChange("width"), 66897 size: "__unstable-large" 66898 } 66899 ) 66900 } 66901 ), 66902 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 66903 SingleColumnToolsPanelItem, 66904 { 66905 label: (0,external_wp_i18n_namespaceObject.__)("Height"), 66906 isShownByDefault, 66907 hasValue: () => height !== "", 66908 onDeselect: onDimensionChange("height"), 66909 panelId, 66910 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 66911 external_wp_components_namespaceObject.__experimentalUnitControl, 66912 { 66913 label: (0,external_wp_i18n_namespaceObject.__)("Height"), 66914 placeholder: (0,external_wp_i18n_namespaceObject.__)("Auto"), 66915 labelPosition: "top", 66916 units, 66917 min: 0, 66918 value: height, 66919 onChange: onDimensionChange("height"), 66920 size: "__unstable-large" 66921 } 66922 ) 66923 } 66924 ) 66925 ] }); 66926 } 66927 66928 66929 ;// ./node_modules/@wordpress/block-editor/build-module/components/dimensions-tool/index.js 66930 66931 66932 66933 66934 66935 function DimensionsTool({ 66936 panelId, 66937 value = {}, 66938 onChange = () => { 66939 }, 66940 aspectRatioOptions, 66941 // Default options handled by AspectRatioTool. 66942 defaultAspectRatio = "auto", 66943 // Match CSS default value for aspect-ratio. 66944 scaleOptions, 66945 // Default options handled by ScaleTool. 66946 defaultScale = "fill", 66947 // Match CSS default value for object-fit. 66948 unitsOptions, 66949 // Default options handled by UnitControl. 66950 tools = ["aspectRatio", "widthHeight", "scale"] 66951 }) { 66952 const width = value.width === void 0 || value.width === "auto" ? null : value.width; 66953 const height = value.height === void 0 || value.height === "auto" ? null : value.height; 66954 const aspectRatio = value.aspectRatio === void 0 || value.aspectRatio === "auto" ? null : value.aspectRatio; 66955 const scale = value.scale === void 0 || value.scale === "fill" ? null : value.scale; 66956 const [lastScale, setLastScale] = (0,external_wp_element_namespaceObject.useState)(scale); 66957 const [lastAspectRatio, setLastAspectRatio] = (0,external_wp_element_namespaceObject.useState)(aspectRatio); 66958 const aspectRatioValue = width && height ? "custom" : lastAspectRatio; 66959 const showScaleControl = aspectRatio || width && height; 66960 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 66961 tools.includes("aspectRatio") && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 66962 AspectRatioTool, 66963 { 66964 panelId, 66965 options: aspectRatioOptions, 66966 defaultValue: defaultAspectRatio, 66967 value: aspectRatioValue, 66968 onChange: (nextAspectRatio) => { 66969 const nextValue = { ...value }; 66970 nextAspectRatio = nextAspectRatio === "auto" ? null : nextAspectRatio; 66971 setLastAspectRatio(nextAspectRatio); 66972 if (!nextAspectRatio) { 66973 delete nextValue.aspectRatio; 66974 } else { 66975 nextValue.aspectRatio = nextAspectRatio; 66976 } 66977 if (!nextAspectRatio) { 66978 delete nextValue.scale; 66979 } else if (lastScale) { 66980 nextValue.scale = lastScale; 66981 } else { 66982 nextValue.scale = defaultScale; 66983 setLastScale(defaultScale); 66984 } 66985 if ("custom" !== nextAspectRatio && width && height) { 66986 delete nextValue.height; 66987 } 66988 onChange(nextValue); 66989 } 66990 } 66991 ), 66992 tools.includes("widthHeight") && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 66993 WidthHeightTool, 66994 { 66995 panelId, 66996 units: unitsOptions, 66997 value: { width, height }, 66998 onChange: ({ width: nextWidth, height: nextHeight }) => { 66999 const nextValue = { ...value }; 67000 nextWidth = nextWidth === "auto" ? null : nextWidth; 67001 nextHeight = nextHeight === "auto" ? null : nextHeight; 67002 if (!nextWidth) { 67003 delete nextValue.width; 67004 } else { 67005 nextValue.width = nextWidth; 67006 } 67007 if (!nextHeight) { 67008 delete nextValue.height; 67009 } else { 67010 nextValue.height = nextHeight; 67011 } 67012 if (nextWidth && nextHeight) { 67013 delete nextValue.aspectRatio; 67014 } else if (lastAspectRatio) { 67015 nextValue.aspectRatio = lastAspectRatio; 67016 } else { 67017 } 67018 if (!lastAspectRatio && !!nextWidth !== !!nextHeight) { 67019 delete nextValue.scale; 67020 } else if (lastScale) { 67021 nextValue.scale = lastScale; 67022 } else { 67023 nextValue.scale = defaultScale; 67024 setLastScale(defaultScale); 67025 } 67026 onChange(nextValue); 67027 } 67028 } 67029 ), 67030 tools.includes("scale") && showScaleControl && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 67031 ScaleTool, 67032 { 67033 panelId, 67034 options: scaleOptions, 67035 defaultValue: defaultScale, 67036 value: lastScale, 67037 onChange: (nextScale) => { 67038 const nextValue = { ...value }; 67039 nextScale = nextScale === "fill" ? null : nextScale; 67040 setLastScale(nextScale); 67041 if (!nextScale) { 67042 delete nextValue.scale; 67043 } else { 67044 nextValue.scale = nextScale; 67045 } 67046 onChange(nextValue); 67047 } 67048 } 67049 ) 67050 ] }); 67051 } 67052 var dimensions_tool_default = DimensionsTool; 67053 67054 67055 ;// ./node_modules/@wordpress/block-editor/build-module/components/resolution-tool/index.js 67056 67057 67058 67059 const DEFAULT_SIZE_OPTIONS = [ 67060 { 67061 label: (0,external_wp_i18n_namespaceObject._x)("Thumbnail", "Image size option for resolution control"), 67062 value: "thumbnail" 67063 }, 67064 { 67065 label: (0,external_wp_i18n_namespaceObject._x)("Medium", "Image size option for resolution control"), 67066 value: "medium" 67067 }, 67068 { 67069 label: (0,external_wp_i18n_namespaceObject._x)("Large", "Image size option for resolution control"), 67070 value: "large" 67071 }, 67072 { 67073 label: (0,external_wp_i18n_namespaceObject._x)("Full Size", "Image size option for resolution control"), 67074 value: "full" 67075 } 67076 ]; 67077 function ResolutionTool({ 67078 panelId, 67079 value, 67080 onChange, 67081 options = DEFAULT_SIZE_OPTIONS, 67082 defaultValue = DEFAULT_SIZE_OPTIONS[0].value, 67083 isShownByDefault = true, 67084 resetAllFilter 67085 }) { 67086 const displayValue = value ?? defaultValue; 67087 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 67088 external_wp_components_namespaceObject.__experimentalToolsPanelItem, 67089 { 67090 hasValue: () => displayValue !== defaultValue, 67091 label: (0,external_wp_i18n_namespaceObject.__)("Resolution"), 67092 onDeselect: () => onChange(defaultValue), 67093 isShownByDefault, 67094 panelId, 67095 resetAllFilter, 67096 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 67097 external_wp_components_namespaceObject.SelectControl, 67098 { 67099 __nextHasNoMarginBottom: true, 67100 label: (0,external_wp_i18n_namespaceObject.__)("Resolution"), 67101 value: displayValue, 67102 options, 67103 onChange, 67104 help: (0,external_wp_i18n_namespaceObject.__)("Select the size of the source image."), 67105 size: "__unstable-large" 67106 } 67107 ) 67108 } 67109 ); 67110 } 67111 67112 67113 ;// ./node_modules/@wordpress/block-editor/build-module/components/html-element-control/messages.js 67114 67115 const htmlElementMessages = { 67116 a: (0,external_wp_i18n_namespaceObject.__)( 67117 "The <a> element should be used for links that navigate to a different page or to a different section within the same page." 67118 ), 67119 article: (0,external_wp_i18n_namespaceObject.__)( 67120 "The <article> element should represent a self-contained, syndicatable portion of the document." 67121 ), 67122 aside: (0,external_wp_i18n_namespaceObject.__)( 67123 "The <aside> element should represent a portion of a document whose content is only indirectly related to the document's main content." 67124 ), 67125 button: (0,external_wp_i18n_namespaceObject.__)( 67126 "The <button> element should be used for interactive controls that perform an action on the current page, such as opening a modal or toggling content visibility." 67127 ), 67128 div: (0,external_wp_i18n_namespaceObject.__)( 67129 "The <div> element should only be used if the block is a design element with no semantic meaning." 67130 ), 67131 footer: (0,external_wp_i18n_namespaceObject.__)( 67132 "The <footer> element should represent a footer for its nearest sectioning element (e.g.: <section>, <article>, <main> etc.)." 67133 ), 67134 header: (0,external_wp_i18n_namespaceObject.__)( 67135 "The <header> element should represent introductory content, typically a group of introductory or navigational aids." 67136 ), 67137 main: (0,external_wp_i18n_namespaceObject.__)( 67138 "The <main> element should be used for the primary content of your document only." 67139 ), 67140 nav: (0,external_wp_i18n_namespaceObject.__)( 67141 "The <nav> element should be used to identify groups of links that are intended to be used for website or page content navigation." 67142 ), 67143 section: (0,external_wp_i18n_namespaceObject.__)( 67144 "The <section> element should represent a standalone portion of the document that can't be better represented by another element." 67145 ) 67146 }; 67147 67148 67149 ;// ./node_modules/@wordpress/block-editor/build-module/components/html-element-control/index.js 67150 67151 67152 67153 67154 67155 67156 function HTMLElementControl({ 67157 tagName, 67158 onChange, 67159 clientId, 67160 options = [ 67161 { label: (0,external_wp_i18n_namespaceObject.__)("Default (<div>)"), value: "div" }, 67162 { label: "<header>", value: "header" }, 67163 { label: "<main>", value: "main" }, 67164 { label: "<section>", value: "section" }, 67165 { label: "<article>", value: "article" }, 67166 { label: "<aside>", value: "aside" }, 67167 { label: "<footer>", value: "footer" } 67168 ] 67169 }) { 67170 const checkForMainTag = !!clientId && options.some((option) => option.value === "main"); 67171 const hasMainElementElsewhere = (0,external_wp_data_namespaceObject.useSelect)( 67172 (select) => { 67173 if (!checkForMainTag) { 67174 return false; 67175 } 67176 const { getClientIdsWithDescendants, getBlockAttributes } = select(store); 67177 return getClientIdsWithDescendants().some((id) => { 67178 if (id === clientId) { 67179 return false; 67180 } 67181 return getBlockAttributes(id)?.tagName === "main"; 67182 }); 67183 }, 67184 [clientId, checkForMainTag] 67185 ); 67186 const modifiedOptions = options.map((option) => { 67187 if (option.value === "main" && hasMainElementElsewhere && tagName !== "main") { 67188 return { 67189 ...option, 67190 disabled: true, 67191 label: (0,external_wp_i18n_namespaceObject.sprintf)( 67192 /* translators: %s: HTML element name */ 67193 (0,external_wp_i18n_namespaceObject.__)("%s (Already in use)"), 67194 option.label 67195 ) 67196 }; 67197 } 67198 return option; 67199 }); 67200 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 2, className: "block-editor-html-element-control", children: [ 67201 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 67202 external_wp_components_namespaceObject.SelectControl, 67203 { 67204 __nextHasNoMarginBottom: true, 67205 __next40pxDefaultSize: true, 67206 label: (0,external_wp_i18n_namespaceObject.__)("HTML element"), 67207 options: modifiedOptions, 67208 value: tagName, 67209 onChange, 67210 help: htmlElementMessages[tagName] 67211 } 67212 ), 67213 tagName === "main" && hasMainElementElsewhere && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Notice, { status: "warning", isDismissible: false, children: (0,external_wp_i18n_namespaceObject.__)( 67214 "Multiple <main> elements detected. The duplicate may be in your content or template. This is not valid HTML and may cause accessibility issues. Please change this HTML element." 67215 ) }) 67216 ] }); 67217 } 67218 67219 67220 ;// ./node_modules/@wordpress/block-editor/build-module/private-apis.js 67221 67222 67223 67224 67225 67226 67227 67228 67229 67230 67231 67232 67233 67234 67235 67236 67237 67238 67239 67240 67241 67242 67243 67244 67245 67246 67247 67248 67249 67250 67251 67252 67253 67254 67255 67256 const privateApis = {}; 67257 lock(privateApis, { 67258 ...global_styles_namespaceObject, 67259 ExperimentalBlockCanvas: ExperimentalBlockCanvas, 67260 ExperimentalBlockEditorProvider: ExperimentalBlockEditorProvider, 67261 getDuotoneFilter: getDuotoneFilter, 67262 getRichTextValues: getRichTextValues, 67263 PrivateQuickInserter: QuickInserter, 67264 extractWords: extractWords, 67265 getNormalizedSearchTerms: getNormalizedSearchTerms, 67266 normalizeString: normalizeString, 67267 PrivateListView: PrivateListView, 67268 ResizableBoxPopover: ResizableBoxPopover, 67269 useHasBlockToolbar: useHasBlockToolbar, 67270 cleanEmptyObject: utils_cleanEmptyObject, 67271 BlockQuickNavigation: BlockQuickNavigation, 67272 LayoutStyle: LayoutStyle, 67273 BlockManager: BlockManager, 67274 BlockRemovalWarningModal: BlockRemovalWarningModal, 67275 useLayoutClasses: useLayoutClasses, 67276 useLayoutStyles: useLayoutStyles, 67277 DimensionsTool: dimensions_tool_default, 67278 ResolutionTool: ResolutionTool, 67279 TabbedSidebar: tabbed_sidebar_default, 67280 TextAlignmentControl: TextAlignmentControl, 67281 usesContextKey: usesContextKey, 67282 useFlashEditableBlocks: useFlashEditableBlocks, 67283 HTMLElementControl: HTMLElementControl, 67284 useZoomOut: useZoomOut, 67285 globalStylesDataKey: globalStylesDataKey, 67286 globalStylesLinksDataKey: globalStylesLinksDataKey, 67287 selectBlockPatternsKey: selectBlockPatternsKey, 67288 requiresWrapperOnCopy: requiresWrapperOnCopy, 67289 PrivateRichText: PrivateRichText, 67290 PrivateInserterLibrary: PrivateInserterLibrary, 67291 reusableBlocksSelectKey: reusableBlocksSelectKey, 67292 PrivateBlockPopover: PrivateBlockPopover, 67293 PrivatePublishDateTimePicker: PrivatePublishDateTimePicker, 67294 useSpacingSizes: useSpacingSizes, 67295 useBlockDisplayTitle: useBlockDisplayTitle, 67296 __unstableBlockStyleVariationOverridesWithConfig: __unstableBlockStyleVariationOverridesWithConfig, 67297 setBackgroundStyleDefaults: setBackgroundStyleDefaults, 67298 sectionRootClientIdKey: sectionRootClientIdKey, 67299 CommentIconSlotFill: block_comment_icon_slot_default, 67300 CommentIconToolbarSlotFill: block_comment_icon_toolbar_slot_default, 67301 mediaEditKey: mediaEditKey, 67302 essentialFormatKey: essentialFormatKey, 67303 useBlockElement: useBlockElement, 67304 useBlockElementRef: useBlockElementRef 67305 }); 67306 67307 67308 ;// ./node_modules/@wordpress/block-editor/build-module/index.js 67309 67310 67311 67312 67313 67314 67315 67316 67317 67318 67319 })(); 67320 67321 (window.wp = window.wp || {}).blockEditor = __webpack_exports__; 67322 /******/ })() 67323 ;
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated : Thu Oct 30 08:20:06 2025 | Cross-referenced by PHPXref |