1 this["wp"] = this["wp"] || {}; this["wp"]["annotations"] = |
1 /******/ (function() { // webpackBootstrap |
2 /******/ (function(modules) { // webpackBootstrap |
2 /******/ "use strict"; |
3 /******/ // The module cache |
3 /******/ // The require scope |
4 /******/ var installedModules = {}; |
4 /******/ var __webpack_require__ = {}; |
5 /******/ |
5 /******/ |
6 /******/ // The require function |
6 /************************************************************************/ |
7 /******/ function __webpack_require__(moduleId) { |
7 /******/ /* webpack/runtime/define property getters */ |
8 /******/ |
8 /******/ !function() { |
9 /******/ // Check if module is in cache |
9 /******/ // define getter functions for harmony exports |
10 /******/ if(installedModules[moduleId]) { |
10 /******/ __webpack_require__.d = function(exports, definition) { |
11 /******/ return installedModules[moduleId].exports; |
11 /******/ for(var key in definition) { |
12 /******/ } |
12 /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { |
13 /******/ // Create a new module (and put it into the cache) |
13 /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); |
14 /******/ var module = installedModules[moduleId] = { |
14 /******/ } |
15 /******/ i: moduleId, |
15 /******/ } |
16 /******/ l: false, |
|
17 /******/ exports: {} |
|
18 /******/ }; |
16 /******/ }; |
19 /******/ |
17 /******/ }(); |
20 /******/ // Execute the module function |
18 /******/ |
21 /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); |
19 /******/ /* webpack/runtime/hasOwnProperty shorthand */ |
22 /******/ |
20 /******/ !function() { |
23 /******/ // Flag the module as loaded |
21 /******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); } |
24 /******/ module.l = true; |
22 /******/ }(); |
25 /******/ |
23 /******/ |
26 /******/ // Return the exports of the module |
24 /******/ /* webpack/runtime/make namespace object */ |
27 /******/ return module.exports; |
25 /******/ !function() { |
28 /******/ } |
26 /******/ // define __esModule on exports |
29 /******/ |
27 /******/ __webpack_require__.r = function(exports) { |
30 /******/ |
28 /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { |
31 /******/ // expose the modules object (__webpack_modules__) |
29 /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); |
32 /******/ __webpack_require__.m = modules; |
30 /******/ } |
33 /******/ |
31 /******/ Object.defineProperty(exports, '__esModule', { value: true }); |
34 /******/ // expose the module cache |
32 /******/ }; |
35 /******/ __webpack_require__.c = installedModules; |
33 /******/ }(); |
36 /******/ |
34 /******/ |
37 /******/ // define getter function for harmony exports |
|
38 /******/ __webpack_require__.d = function(exports, name, getter) { |
|
39 /******/ if(!__webpack_require__.o(exports, name)) { |
|
40 /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); |
|
41 /******/ } |
|
42 /******/ }; |
|
43 /******/ |
|
44 /******/ // define __esModule on exports |
|
45 /******/ __webpack_require__.r = function(exports) { |
|
46 /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { |
|
47 /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); |
|
48 /******/ } |
|
49 /******/ Object.defineProperty(exports, '__esModule', { value: true }); |
|
50 /******/ }; |
|
51 /******/ |
|
52 /******/ // create a fake namespace object |
|
53 /******/ // mode & 1: value is a module id, require it |
|
54 /******/ // mode & 2: merge all properties of value into the ns |
|
55 /******/ // mode & 4: return value when already ns object |
|
56 /******/ // mode & 8|1: behave like require |
|
57 /******/ __webpack_require__.t = function(value, mode) { |
|
58 /******/ if(mode & 1) value = __webpack_require__(value); |
|
59 /******/ if(mode & 8) return value; |
|
60 /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; |
|
61 /******/ var ns = Object.create(null); |
|
62 /******/ __webpack_require__.r(ns); |
|
63 /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); |
|
64 /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); |
|
65 /******/ return ns; |
|
66 /******/ }; |
|
67 /******/ |
|
68 /******/ // getDefaultExport function for compatibility with non-harmony modules |
|
69 /******/ __webpack_require__.n = function(module) { |
|
70 /******/ var getter = module && module.__esModule ? |
|
71 /******/ function getDefault() { return module['default']; } : |
|
72 /******/ function getModuleExports() { return module; }; |
|
73 /******/ __webpack_require__.d(getter, 'a', getter); |
|
74 /******/ return getter; |
|
75 /******/ }; |
|
76 /******/ |
|
77 /******/ // Object.prototype.hasOwnProperty.call |
|
78 /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; |
|
79 /******/ |
|
80 /******/ // __webpack_public_path__ |
|
81 /******/ __webpack_require__.p = ""; |
|
82 /******/ |
|
83 /******/ |
|
84 /******/ // Load entry module and return exports |
|
85 /******/ return __webpack_require__(__webpack_require__.s = "23Y4"); |
|
86 /******/ }) |
|
87 /************************************************************************/ |
35 /************************************************************************/ |
88 /******/ ({ |
36 var __webpack_exports__ = {}; |
89 |
|
90 /***/ "1ZqX": |
|
91 /***/ (function(module, exports) { |
|
92 |
|
93 (function() { module.exports = window["wp"]["data"]; }()); |
|
94 |
|
95 /***/ }), |
|
96 |
|
97 /***/ "23Y4": |
|
98 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
99 |
|
100 "use strict"; |
|
101 // ESM COMPAT FLAG |
37 // ESM COMPAT FLAG |
102 __webpack_require__.r(__webpack_exports__); |
38 __webpack_require__.r(__webpack_exports__); |
103 |
39 |
104 // EXPORTS |
40 // EXPORTS |
105 __webpack_require__.d(__webpack_exports__, "store", function() { return /* reexport */ store; }); |
41 __webpack_require__.d(__webpack_exports__, { |
|
42 "store": function() { return /* reexport */ store; } |
|
43 }); |
106 |
44 |
107 // NAMESPACE OBJECT: ./node_modules/@wordpress/annotations/build-module/store/selectors.js |
45 // NAMESPACE OBJECT: ./node_modules/@wordpress/annotations/build-module/store/selectors.js |
108 var selectors_namespaceObject = {}; |
46 var selectors_namespaceObject = {}; |
109 __webpack_require__.r(selectors_namespaceObject); |
47 __webpack_require__.r(selectors_namespaceObject); |
110 __webpack_require__.d(selectors_namespaceObject, "__experimentalGetAnnotationsForBlock", function() { return __experimentalGetAnnotationsForBlock; }); |
48 __webpack_require__.d(selectors_namespaceObject, { |
111 __webpack_require__.d(selectors_namespaceObject, "__experimentalGetAllAnnotationsForBlock", function() { return __experimentalGetAllAnnotationsForBlock; }); |
49 "__experimentalGetAllAnnotationsForBlock": function() { return __experimentalGetAllAnnotationsForBlock; }, |
112 __webpack_require__.d(selectors_namespaceObject, "__experimentalGetAnnotationsForRichText", function() { return __experimentalGetAnnotationsForRichText; }); |
50 "__experimentalGetAnnotations": function() { return __experimentalGetAnnotations; }, |
113 __webpack_require__.d(selectors_namespaceObject, "__experimentalGetAnnotations", function() { return __experimentalGetAnnotations; }); |
51 "__experimentalGetAnnotationsForBlock": function() { return __experimentalGetAnnotationsForBlock; }, |
|
52 "__experimentalGetAnnotationsForRichText": function() { return __experimentalGetAnnotationsForRichText; } |
|
53 }); |
114 |
54 |
115 // NAMESPACE OBJECT: ./node_modules/@wordpress/annotations/build-module/store/actions.js |
55 // NAMESPACE OBJECT: ./node_modules/@wordpress/annotations/build-module/store/actions.js |
116 var actions_namespaceObject = {}; |
56 var actions_namespaceObject = {}; |
117 __webpack_require__.r(actions_namespaceObject); |
57 __webpack_require__.r(actions_namespaceObject); |
118 __webpack_require__.d(actions_namespaceObject, "__experimentalAddAnnotation", function() { return __experimentalAddAnnotation; }); |
58 __webpack_require__.d(actions_namespaceObject, { |
119 __webpack_require__.d(actions_namespaceObject, "__experimentalRemoveAnnotation", function() { return __experimentalRemoveAnnotation; }); |
59 "__experimentalAddAnnotation": function() { return __experimentalAddAnnotation; }, |
120 __webpack_require__.d(actions_namespaceObject, "__experimentalUpdateAnnotationRange", function() { return __experimentalUpdateAnnotationRange; }); |
60 "__experimentalRemoveAnnotation": function() { return __experimentalRemoveAnnotation; }, |
121 __webpack_require__.d(actions_namespaceObject, "__experimentalRemoveAnnotationsBySource", function() { return __experimentalRemoveAnnotationsBySource; }); |
61 "__experimentalRemoveAnnotationsBySource": function() { return __experimentalRemoveAnnotationsBySource; }, |
122 |
62 "__experimentalUpdateAnnotationRange": function() { return __experimentalUpdateAnnotationRange; } |
123 // EXTERNAL MODULE: external ["wp","richText"] |
63 }); |
124 var external_wp_richText_ = __webpack_require__("qRz9"); |
64 |
125 |
65 ;// CONCATENATED MODULE: external ["wp","richText"] |
126 // EXTERNAL MODULE: external ["wp","i18n"] |
66 var external_wp_richText_namespaceObject = window["wp"]["richText"]; |
127 var external_wp_i18n_ = __webpack_require__("l3Sj"); |
67 ;// CONCATENATED MODULE: external ["wp","i18n"] |
128 |
68 var external_wp_i18n_namespaceObject = window["wp"]["i18n"]; |
129 // CONCATENATED MODULE: ./node_modules/@wordpress/annotations/build-module/store/constants.js |
69 ;// CONCATENATED MODULE: ./node_modules/@wordpress/annotations/build-module/store/constants.js |
130 /** |
70 /** |
131 * The identifier for the data store. |
71 * The identifier for the data store. |
132 * |
72 * |
133 * @type {string} |
73 * @type {string} |
134 */ |
74 */ |
135 const STORE_NAME = 'core/annotations'; |
75 const STORE_NAME = 'core/annotations'; |
136 |
76 |
137 // CONCATENATED MODULE: ./node_modules/@wordpress/annotations/build-module/format/annotation.js |
77 ;// CONCATENATED MODULE: ./node_modules/@wordpress/annotations/build-module/format/annotation.js |
138 /** |
78 /** |
139 * WordPress dependencies |
79 * WordPress dependencies |
140 */ |
80 */ |
141 |
81 |
142 |
82 |
473 }); |
419 }); |
474 return hasChangedRange ? newAnnotations : annotationsForBlock; |
420 return hasChangedRange ? newAnnotations : annotationsForBlock; |
475 }); |
421 }); |
476 |
422 |
477 case 'ANNOTATION_REMOVE_SOURCE': |
423 case 'ANNOTATION_REMOVE_SOURCE': |
478 return Object(external_lodash_["mapValues"])(state, annotationsForBlock => { |
424 return (0,external_lodash_namespaceObject.mapValues)(state, annotationsForBlock => { |
479 return filterWithReference(annotationsForBlock, annotation => { |
425 return filterWithReference(annotationsForBlock, annotation => { |
480 return annotation.source !== action.source; |
426 return annotation.source !== action.source; |
481 }); |
427 }); |
482 }); |
428 }); |
483 } |
429 } |
484 |
430 |
485 return state; |
431 return state; |
486 } |
432 } |
487 /* harmony default export */ var reducer = (reducer_annotations); |
433 /* harmony default export */ var reducer = (annotations); |
488 |
434 |
489 // EXTERNAL MODULE: ./node_modules/rememo/es/rememo.js |
435 ;// CONCATENATED MODULE: ./node_modules/rememo/es/rememo.js |
490 var rememo = __webpack_require__("pPDe"); |
|
491 |
|
492 // CONCATENATED MODULE: ./node_modules/@wordpress/annotations/build-module/store/selectors.js |
|
493 /** |
|
494 * External dependencies |
|
495 */ |
|
496 |
|
497 |
|
498 /** |
|
499 * Shared reference to an empty array for cases where it is important to avoid |
|
500 * returning a new array reference on every invocation, as in a connected or |
|
501 * other pure component which performs `shouldComponentUpdate` check on props. |
|
502 * This should be used as a last resort, since the normalized data should be |
|
503 * maintained by the reducer result in state. |
|
504 * |
|
505 * @type {Array} |
|
506 */ |
|
507 |
|
508 const EMPTY_ARRAY = []; |
|
509 /** |
|
510 * Returns the annotations for a specific client ID. |
|
511 * |
|
512 * @param {Object} state Editor state. |
|
513 * @param {string} clientId The ID of the block to get the annotations for. |
|
514 * |
|
515 * @return {Array} The annotations applicable to this block. |
|
516 */ |
|
517 |
|
518 const __experimentalGetAnnotationsForBlock = Object(rememo["a" /* default */])((state, blockClientId) => { |
|
519 var _state$blockClientId; |
|
520 |
|
521 return ((_state$blockClientId = state === null || state === void 0 ? void 0 : state[blockClientId]) !== null && _state$blockClientId !== void 0 ? _state$blockClientId : []).filter(annotation => { |
|
522 return annotation.selector === 'block'; |
|
523 }); |
|
524 }, (state, blockClientId) => { |
|
525 var _state$blockClientId2; |
|
526 |
|
527 return [(_state$blockClientId2 = state === null || state === void 0 ? void 0 : state[blockClientId]) !== null && _state$blockClientId2 !== void 0 ? _state$blockClientId2 : EMPTY_ARRAY]; |
|
528 }); |
|
529 function __experimentalGetAllAnnotationsForBlock(state, blockClientId) { |
|
530 var _state$blockClientId3; |
|
531 |
|
532 return (_state$blockClientId3 = state === null || state === void 0 ? void 0 : state[blockClientId]) !== null && _state$blockClientId3 !== void 0 ? _state$blockClientId3 : EMPTY_ARRAY; |
|
533 } |
|
534 /** |
|
535 * Returns the annotations that apply to the given RichText instance. |
|
536 * |
|
537 * Both a blockClientId and a richTextIdentifier are required. This is because |
|
538 * a block might have multiple `RichText` components. This does mean that every |
|
539 * block needs to implement annotations itself. |
|
540 * |
|
541 * @param {Object} state Editor state. |
|
542 * @param {string} blockClientId The client ID for the block. |
|
543 * @param {string} richTextIdentifier Unique identifier that identifies the given RichText. |
|
544 * @return {Array} All the annotations relevant for the `RichText`. |
|
545 */ |
|
546 |
|
547 const __experimentalGetAnnotationsForRichText = Object(rememo["a" /* default */])((state, blockClientId, richTextIdentifier) => { |
|
548 var _state$blockClientId4; |
|
549 |
|
550 return ((_state$blockClientId4 = state === null || state === void 0 ? void 0 : state[blockClientId]) !== null && _state$blockClientId4 !== void 0 ? _state$blockClientId4 : []).filter(annotation => { |
|
551 return annotation.selector === 'range' && richTextIdentifier === annotation.richTextIdentifier; |
|
552 }).map(annotation => { |
|
553 const { |
|
554 range, |
|
555 ...other |
|
556 } = annotation; |
|
557 return { ...range, |
|
558 ...other |
|
559 }; |
|
560 }); |
|
561 }, (state, blockClientId) => { |
|
562 var _state$blockClientId5; |
|
563 |
|
564 return [(_state$blockClientId5 = state === null || state === void 0 ? void 0 : state[blockClientId]) !== null && _state$blockClientId5 !== void 0 ? _state$blockClientId5 : EMPTY_ARRAY]; |
|
565 }); |
|
566 /** |
|
567 * Returns all annotations in the editor state. |
|
568 * |
|
569 * @param {Object} state Editor state. |
|
570 * @return {Array} All annotations currently applied. |
|
571 */ |
|
572 |
|
573 function __experimentalGetAnnotations(state) { |
|
574 return Object(external_lodash_["flatMap"])(state, annotations => { |
|
575 return annotations; |
|
576 }); |
|
577 } |
|
578 |
|
579 // EXTERNAL MODULE: ./node_modules/uuid/dist/esm-browser/v4.js + 4 modules |
|
580 var v4 = __webpack_require__("7Cbv"); |
|
581 |
|
582 // CONCATENATED MODULE: ./node_modules/@wordpress/annotations/build-module/store/actions.js |
|
583 /** |
|
584 * External dependencies |
|
585 */ |
|
586 |
|
587 /** |
|
588 * @typedef WPAnnotationRange |
|
589 * |
|
590 * @property {number} start The offset where the annotation should start. |
|
591 * @property {number} end The offset where the annotation should end. |
|
592 */ |
|
593 |
|
594 /** |
|
595 * Adds an annotation to a block. |
|
596 * |
|
597 * The `block` attribute refers to a block ID that needs to be annotated. |
|
598 * `isBlockAnnotation` controls whether or not the annotation is a block |
|
599 * annotation. The `source` is the source of the annotation, this will be used |
|
600 * to identity groups of annotations. |
|
601 * |
|
602 * The `range` property is only relevant if the selector is 'range'. |
|
603 * |
|
604 * @param {Object} annotation The annotation to add. |
|
605 * @param {string} annotation.blockClientId The blockClientId to add the annotation to. |
|
606 * @param {string} annotation.richTextIdentifier Identifier for the RichText instance the annotation applies to. |
|
607 * @param {WPAnnotationRange} annotation.range The range at which to apply this annotation. |
|
608 * @param {string} [annotation.selector="range"] The way to apply this annotation. |
|
609 * @param {string} [annotation.source="default"] The source that added the annotation. |
|
610 * @param {string} [annotation.id] The ID the annotation should have. Generates a UUID by default. |
|
611 * |
|
612 * @return {Object} Action object. |
|
613 */ |
|
614 |
|
615 function __experimentalAddAnnotation({ |
|
616 blockClientId, |
|
617 richTextIdentifier = null, |
|
618 range = null, |
|
619 selector = 'range', |
|
620 source = 'default', |
|
621 id = Object(v4["a" /* default */])() |
|
622 }) { |
|
623 const action = { |
|
624 type: 'ANNOTATION_ADD', |
|
625 id, |
|
626 blockClientId, |
|
627 richTextIdentifier, |
|
628 source, |
|
629 selector |
|
630 }; |
|
631 |
|
632 if (selector === 'range') { |
|
633 action.range = range; |
|
634 } |
|
635 |
|
636 return action; |
|
637 } |
|
638 /** |
|
639 * Removes an annotation with a specific ID. |
|
640 * |
|
641 * @param {string} annotationId The annotation to remove. |
|
642 * |
|
643 * @return {Object} Action object. |
|
644 */ |
|
645 |
|
646 function __experimentalRemoveAnnotation(annotationId) { |
|
647 return { |
|
648 type: 'ANNOTATION_REMOVE', |
|
649 annotationId |
|
650 }; |
|
651 } |
|
652 /** |
|
653 * Updates the range of an annotation. |
|
654 * |
|
655 * @param {string} annotationId ID of the annotation to update. |
|
656 * @param {number} start The start of the new range. |
|
657 * @param {number} end The end of the new range. |
|
658 * |
|
659 * @return {Object} Action object. |
|
660 */ |
|
661 |
|
662 function __experimentalUpdateAnnotationRange(annotationId, start, end) { |
|
663 return { |
|
664 type: 'ANNOTATION_UPDATE_RANGE', |
|
665 annotationId, |
|
666 start, |
|
667 end |
|
668 }; |
|
669 } |
|
670 /** |
|
671 * Removes all annotations of a specific source. |
|
672 * |
|
673 * @param {string} source The source to remove. |
|
674 * |
|
675 * @return {Object} Action object. |
|
676 */ |
|
677 |
|
678 function __experimentalRemoveAnnotationsBySource(source) { |
|
679 return { |
|
680 type: 'ANNOTATION_REMOVE_SOURCE', |
|
681 source |
|
682 }; |
|
683 } |
|
684 |
|
685 // CONCATENATED MODULE: ./node_modules/@wordpress/annotations/build-module/store/index.js |
|
686 /** |
|
687 * WordPress dependencies |
|
688 */ |
|
689 |
|
690 /** |
|
691 * Internal dependencies |
|
692 */ |
|
693 |
|
694 |
|
695 |
|
696 |
|
697 /** |
|
698 * Module Constants |
|
699 */ |
|
700 |
|
701 |
|
702 /** |
|
703 * Store definition for the annotations namespace. |
|
704 * |
|
705 * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore |
|
706 * |
|
707 * @type {Object} |
|
708 */ |
|
709 |
|
710 const store = Object(external_wp_data_["createReduxStore"])(STORE_NAME, { |
|
711 reducer: reducer, |
|
712 selectors: selectors_namespaceObject, |
|
713 actions: actions_namespaceObject |
|
714 }); |
|
715 Object(external_wp_data_["register"])(store); |
|
716 |
|
717 // CONCATENATED MODULE: ./node_modules/@wordpress/annotations/build-module/index.js |
|
718 /** |
|
719 * Internal dependencies |
|
720 */ |
|
721 |
|
722 |
|
723 |
|
724 |
|
725 |
|
726 /***/ }), |
|
727 |
|
728 /***/ "7Cbv": |
|
729 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
730 |
|
731 "use strict"; |
|
732 |
|
733 // CONCATENATED MODULE: ./node_modules/uuid/dist/esm-browser/rng.js |
|
734 // Unique ID creation requires a high quality random # generator. In the browser we therefore |
|
735 // require the crypto API and do not support built-in fallback to lower quality random number |
|
736 // generators (like Math.random()). |
|
737 var getRandomValues; |
|
738 var rnds8 = new Uint8Array(16); |
|
739 function rng() { |
|
740 // lazy load so that environments that need to polyfill have a chance to do so |
|
741 if (!getRandomValues) { |
|
742 // getRandomValues needs to be invoked in a context where "this" is a Crypto implementation. Also, |
|
743 // find the complete implementation of crypto (msCrypto) on IE11. |
|
744 getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto) || typeof msCrypto !== 'undefined' && typeof msCrypto.getRandomValues === 'function' && msCrypto.getRandomValues.bind(msCrypto); |
|
745 |
|
746 if (!getRandomValues) { |
|
747 throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported'); |
|
748 } |
|
749 } |
|
750 |
|
751 return getRandomValues(rnds8); |
|
752 } |
|
753 // CONCATENATED MODULE: ./node_modules/uuid/dist/esm-browser/regex.js |
|
754 /* harmony default export */ var regex = (/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i); |
|
755 // CONCATENATED MODULE: ./node_modules/uuid/dist/esm-browser/validate.js |
|
756 |
|
757 |
|
758 function validate(uuid) { |
|
759 return typeof uuid === 'string' && regex.test(uuid); |
|
760 } |
|
761 |
|
762 /* harmony default export */ var esm_browser_validate = (validate); |
|
763 // CONCATENATED MODULE: ./node_modules/uuid/dist/esm-browser/stringify.js |
|
764 |
|
765 /** |
|
766 * Convert array of 16 byte values to UUID string format of the form: |
|
767 * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX |
|
768 */ |
|
769 |
|
770 var byteToHex = []; |
|
771 |
|
772 for (var stringify_i = 0; stringify_i < 256; ++stringify_i) { |
|
773 byteToHex.push((stringify_i + 0x100).toString(16).substr(1)); |
|
774 } |
|
775 |
|
776 function stringify(arr) { |
|
777 var offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; |
|
778 // Note: Be careful editing this code! It's been tuned for performance |
|
779 // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434 |
|
780 var uuid = (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]]).toLowerCase(); // Consistency check for valid UUID. If this throws, it's likely due to one |
|
781 // of the following: |
|
782 // - One or more input array values don't map to a hex octet (leading to |
|
783 // "undefined" in the uuid) |
|
784 // - Invalid input values for the RFC `version` or `variant` fields |
|
785 |
|
786 if (!esm_browser_validate(uuid)) { |
|
787 throw TypeError('Stringified UUID is invalid'); |
|
788 } |
|
789 |
|
790 return uuid; |
|
791 } |
|
792 |
|
793 /* harmony default export */ var esm_browser_stringify = (stringify); |
|
794 // CONCATENATED MODULE: ./node_modules/uuid/dist/esm-browser/v4.js |
|
795 |
|
796 |
|
797 |
|
798 function v4(options, buf, offset) { |
|
799 options = options || {}; |
|
800 var rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved` |
|
801 |
|
802 rnds[6] = rnds[6] & 0x0f | 0x40; |
|
803 rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided |
|
804 |
|
805 if (buf) { |
|
806 offset = offset || 0; |
|
807 |
|
808 for (var i = 0; i < 16; ++i) { |
|
809 buf[offset + i] = rnds[i]; |
|
810 } |
|
811 |
|
812 return buf; |
|
813 } |
|
814 |
|
815 return esm_browser_stringify(rnds); |
|
816 } |
|
817 |
|
818 /* harmony default export */ var esm_browser_v4 = __webpack_exports__["a"] = (v4); |
|
819 |
|
820 /***/ }), |
|
821 |
|
822 /***/ "YLtl": |
|
823 /***/ (function(module, exports) { |
|
824 |
|
825 (function() { module.exports = window["lodash"]; }()); |
|
826 |
|
827 /***/ }), |
|
828 |
|
829 /***/ "g56x": |
|
830 /***/ (function(module, exports) { |
|
831 |
|
832 (function() { module.exports = window["wp"]["hooks"]; }()); |
|
833 |
|
834 /***/ }), |
|
835 |
|
836 /***/ "l3Sj": |
|
837 /***/ (function(module, exports) { |
|
838 |
|
839 (function() { module.exports = window["wp"]["i18n"]; }()); |
|
840 |
|
841 /***/ }), |
|
842 |
|
843 /***/ "pPDe": |
|
844 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
845 |
|
846 "use strict"; |
|
847 |
436 |
848 |
437 |
849 var LEAF_KEY, hasWeakMap; |
438 var LEAF_KEY, hasWeakMap; |
850 |
439 |
851 /** |
440 /** |
1115 callSelector.getDependants = getDependants; |
704 callSelector.getDependants = getDependants; |
1116 callSelector.clear = clear; |
705 callSelector.clear = clear; |
1117 clear(); |
706 clear(); |
1118 |
707 |
1119 return callSelector; |
708 return callSelector; |
|
709 } |
|
710 |
|
711 ;// CONCATENATED MODULE: ./node_modules/@wordpress/annotations/build-module/store/selectors.js |
|
712 /** |
|
713 * External dependencies |
|
714 */ |
|
715 |
|
716 |
|
717 /** |
|
718 * Shared reference to an empty array for cases where it is important to avoid |
|
719 * returning a new array reference on every invocation, as in a connected or |
|
720 * other pure component which performs `shouldComponentUpdate` check on props. |
|
721 * This should be used as a last resort, since the normalized data should be |
|
722 * maintained by the reducer result in state. |
|
723 * |
|
724 * @type {Array} |
|
725 */ |
|
726 |
|
727 const EMPTY_ARRAY = []; |
|
728 /** |
|
729 * Returns the annotations for a specific client ID. |
|
730 * |
|
731 * @param {Object} state Editor state. |
|
732 * @param {string} clientId The ID of the block to get the annotations for. |
|
733 * |
|
734 * @return {Array} The annotations applicable to this block. |
|
735 */ |
|
736 |
|
737 const __experimentalGetAnnotationsForBlock = rememo((state, blockClientId) => { |
|
738 var _state$blockClientId; |
|
739 |
|
740 return ((_state$blockClientId = state === null || state === void 0 ? void 0 : state[blockClientId]) !== null && _state$blockClientId !== void 0 ? _state$blockClientId : []).filter(annotation => { |
|
741 return annotation.selector === 'block'; |
|
742 }); |
|
743 }, (state, blockClientId) => { |
|
744 var _state$blockClientId2; |
|
745 |
|
746 return [(_state$blockClientId2 = state === null || state === void 0 ? void 0 : state[blockClientId]) !== null && _state$blockClientId2 !== void 0 ? _state$blockClientId2 : EMPTY_ARRAY]; |
1120 }); |
747 }); |
1121 |
748 function __experimentalGetAllAnnotationsForBlock(state, blockClientId) { |
1122 |
749 var _state$blockClientId3; |
1123 /***/ }), |
750 |
1124 |
751 return (_state$blockClientId3 = state === null || state === void 0 ? void 0 : state[blockClientId]) !== null && _state$blockClientId3 !== void 0 ? _state$blockClientId3 : EMPTY_ARRAY; |
1125 /***/ "qRz9": |
752 } |
1126 /***/ (function(module, exports) { |
753 /** |
1127 |
754 * Returns the annotations that apply to the given RichText instance. |
1128 (function() { module.exports = window["wp"]["richText"]; }()); |
755 * |
1129 |
756 * Both a blockClientId and a richTextIdentifier are required. This is because |
1130 /***/ }) |
757 * a block might have multiple `RichText` components. This does mean that every |
1131 |
758 * block needs to implement annotations itself. |
1132 /******/ }); |
759 * |
|
760 * @param {Object} state Editor state. |
|
761 * @param {string} blockClientId The client ID for the block. |
|
762 * @param {string} richTextIdentifier Unique identifier that identifies the given RichText. |
|
763 * @return {Array} All the annotations relevant for the `RichText`. |
|
764 */ |
|
765 |
|
766 const __experimentalGetAnnotationsForRichText = rememo((state, blockClientId, richTextIdentifier) => { |
|
767 var _state$blockClientId4; |
|
768 |
|
769 return ((_state$blockClientId4 = state === null || state === void 0 ? void 0 : state[blockClientId]) !== null && _state$blockClientId4 !== void 0 ? _state$blockClientId4 : []).filter(annotation => { |
|
770 return annotation.selector === 'range' && richTextIdentifier === annotation.richTextIdentifier; |
|
771 }).map(annotation => { |
|
772 const { |
|
773 range, |
|
774 ...other |
|
775 } = annotation; |
|
776 return { ...range, |
|
777 ...other |
|
778 }; |
|
779 }); |
|
780 }, (state, blockClientId) => { |
|
781 var _state$blockClientId5; |
|
782 |
|
783 return [(_state$blockClientId5 = state === null || state === void 0 ? void 0 : state[blockClientId]) !== null && _state$blockClientId5 !== void 0 ? _state$blockClientId5 : EMPTY_ARRAY]; |
|
784 }); |
|
785 /** |
|
786 * Returns all annotations in the editor state. |
|
787 * |
|
788 * @param {Object} state Editor state. |
|
789 * @return {Array} All annotations currently applied. |
|
790 */ |
|
791 |
|
792 function __experimentalGetAnnotations(state) { |
|
793 return (0,external_lodash_namespaceObject.flatMap)(state, annotations => { |
|
794 return annotations; |
|
795 }); |
|
796 } |
|
797 |
|
798 ;// CONCATENATED MODULE: ./node_modules/uuid/dist/esm-browser/rng.js |
|
799 // Unique ID creation requires a high quality random # generator. In the browser we therefore |
|
800 // require the crypto API and do not support built-in fallback to lower quality random number |
|
801 // generators (like Math.random()). |
|
802 var getRandomValues; |
|
803 var rnds8 = new Uint8Array(16); |
|
804 function rng() { |
|
805 // lazy load so that environments that need to polyfill have a chance to do so |
|
806 if (!getRandomValues) { |
|
807 // getRandomValues needs to be invoked in a context where "this" is a Crypto implementation. Also, |
|
808 // find the complete implementation of crypto (msCrypto) on IE11. |
|
809 getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto) || typeof msCrypto !== 'undefined' && typeof msCrypto.getRandomValues === 'function' && msCrypto.getRandomValues.bind(msCrypto); |
|
810 |
|
811 if (!getRandomValues) { |
|
812 throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported'); |
|
813 } |
|
814 } |
|
815 |
|
816 return getRandomValues(rnds8); |
|
817 } |
|
818 ;// CONCATENATED MODULE: ./node_modules/uuid/dist/esm-browser/regex.js |
|
819 /* harmony default export */ var regex = (/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i); |
|
820 ;// CONCATENATED MODULE: ./node_modules/uuid/dist/esm-browser/validate.js |
|
821 |
|
822 |
|
823 function validate(uuid) { |
|
824 return typeof uuid === 'string' && regex.test(uuid); |
|
825 } |
|
826 |
|
827 /* harmony default export */ var esm_browser_validate = (validate); |
|
828 ;// CONCATENATED MODULE: ./node_modules/uuid/dist/esm-browser/stringify.js |
|
829 |
|
830 /** |
|
831 * Convert array of 16 byte values to UUID string format of the form: |
|
832 * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX |
|
833 */ |
|
834 |
|
835 var byteToHex = []; |
|
836 |
|
837 for (var i = 0; i < 256; ++i) { |
|
838 byteToHex.push((i + 0x100).toString(16).substr(1)); |
|
839 } |
|
840 |
|
841 function stringify(arr) { |
|
842 var offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; |
|
843 // Note: Be careful editing this code! It's been tuned for performance |
|
844 // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434 |
|
845 var uuid = (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]]).toLowerCase(); // Consistency check for valid UUID. If this throws, it's likely due to one |
|
846 // of the following: |
|
847 // - One or more input array values don't map to a hex octet (leading to |
|
848 // "undefined" in the uuid) |
|
849 // - Invalid input values for the RFC `version` or `variant` fields |
|
850 |
|
851 if (!esm_browser_validate(uuid)) { |
|
852 throw TypeError('Stringified UUID is invalid'); |
|
853 } |
|
854 |
|
855 return uuid; |
|
856 } |
|
857 |
|
858 /* harmony default export */ var esm_browser_stringify = (stringify); |
|
859 ;// CONCATENATED MODULE: ./node_modules/uuid/dist/esm-browser/v4.js |
|
860 |
|
861 |
|
862 |
|
863 function v4(options, buf, offset) { |
|
864 options = options || {}; |
|
865 var rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved` |
|
866 |
|
867 rnds[6] = rnds[6] & 0x0f | 0x40; |
|
868 rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided |
|
869 |
|
870 if (buf) { |
|
871 offset = offset || 0; |
|
872 |
|
873 for (var i = 0; i < 16; ++i) { |
|
874 buf[offset + i] = rnds[i]; |
|
875 } |
|
876 |
|
877 return buf; |
|
878 } |
|
879 |
|
880 return esm_browser_stringify(rnds); |
|
881 } |
|
882 |
|
883 /* harmony default export */ var esm_browser_v4 = (v4); |
|
884 ;// CONCATENATED MODULE: ./node_modules/@wordpress/annotations/build-module/store/actions.js |
|
885 /** |
|
886 * External dependencies |
|
887 */ |
|
888 |
|
889 /** |
|
890 * @typedef WPAnnotationRange |
|
891 * |
|
892 * @property {number} start The offset where the annotation should start. |
|
893 * @property {number} end The offset where the annotation should end. |
|
894 */ |
|
895 |
|
896 /** |
|
897 * Adds an annotation to a block. |
|
898 * |
|
899 * The `block` attribute refers to a block ID that needs to be annotated. |
|
900 * `isBlockAnnotation` controls whether or not the annotation is a block |
|
901 * annotation. The `source` is the source of the annotation, this will be used |
|
902 * to identity groups of annotations. |
|
903 * |
|
904 * The `range` property is only relevant if the selector is 'range'. |
|
905 * |
|
906 * @param {Object} annotation The annotation to add. |
|
907 * @param {string} annotation.blockClientId The blockClientId to add the annotation to. |
|
908 * @param {string} annotation.richTextIdentifier Identifier for the RichText instance the annotation applies to. |
|
909 * @param {WPAnnotationRange} annotation.range The range at which to apply this annotation. |
|
910 * @param {string} [annotation.selector="range"] The way to apply this annotation. |
|
911 * @param {string} [annotation.source="default"] The source that added the annotation. |
|
912 * @param {string} [annotation.id] The ID the annotation should have. Generates a UUID by default. |
|
913 * |
|
914 * @return {Object} Action object. |
|
915 */ |
|
916 |
|
917 function __experimentalAddAnnotation(_ref) { |
|
918 let { |
|
919 blockClientId, |
|
920 richTextIdentifier = null, |
|
921 range = null, |
|
922 selector = 'range', |
|
923 source = 'default', |
|
924 id = esm_browser_v4() |
|
925 } = _ref; |
|
926 const action = { |
|
927 type: 'ANNOTATION_ADD', |
|
928 id, |
|
929 blockClientId, |
|
930 richTextIdentifier, |
|
931 source, |
|
932 selector |
|
933 }; |
|
934 |
|
935 if (selector === 'range') { |
|
936 action.range = range; |
|
937 } |
|
938 |
|
939 return action; |
|
940 } |
|
941 /** |
|
942 * Removes an annotation with a specific ID. |
|
943 * |
|
944 * @param {string} annotationId The annotation to remove. |
|
945 * |
|
946 * @return {Object} Action object. |
|
947 */ |
|
948 |
|
949 function __experimentalRemoveAnnotation(annotationId) { |
|
950 return { |
|
951 type: 'ANNOTATION_REMOVE', |
|
952 annotationId |
|
953 }; |
|
954 } |
|
955 /** |
|
956 * Updates the range of an annotation. |
|
957 * |
|
958 * @param {string} annotationId ID of the annotation to update. |
|
959 * @param {number} start The start of the new range. |
|
960 * @param {number} end The end of the new range. |
|
961 * |
|
962 * @return {Object} Action object. |
|
963 */ |
|
964 |
|
965 function __experimentalUpdateAnnotationRange(annotationId, start, end) { |
|
966 return { |
|
967 type: 'ANNOTATION_UPDATE_RANGE', |
|
968 annotationId, |
|
969 start, |
|
970 end |
|
971 }; |
|
972 } |
|
973 /** |
|
974 * Removes all annotations of a specific source. |
|
975 * |
|
976 * @param {string} source The source to remove. |
|
977 * |
|
978 * @return {Object} Action object. |
|
979 */ |
|
980 |
|
981 function __experimentalRemoveAnnotationsBySource(source) { |
|
982 return { |
|
983 type: 'ANNOTATION_REMOVE_SOURCE', |
|
984 source |
|
985 }; |
|
986 } |
|
987 |
|
988 ;// CONCATENATED MODULE: ./node_modules/@wordpress/annotations/build-module/store/index.js |
|
989 /** |
|
990 * WordPress dependencies |
|
991 */ |
|
992 |
|
993 /** |
|
994 * Internal dependencies |
|
995 */ |
|
996 |
|
997 |
|
998 |
|
999 |
|
1000 /** |
|
1001 * Module Constants |
|
1002 */ |
|
1003 |
|
1004 |
|
1005 /** |
|
1006 * Store definition for the annotations namespace. |
|
1007 * |
|
1008 * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore |
|
1009 * |
|
1010 * @type {Object} |
|
1011 */ |
|
1012 |
|
1013 const store = (0,external_wp_data_namespaceObject.createReduxStore)(STORE_NAME, { |
|
1014 reducer: reducer, |
|
1015 selectors: selectors_namespaceObject, |
|
1016 actions: actions_namespaceObject |
|
1017 }); |
|
1018 (0,external_wp_data_namespaceObject.register)(store); |
|
1019 |
|
1020 ;// CONCATENATED MODULE: ./node_modules/@wordpress/annotations/build-module/index.js |
|
1021 /** |
|
1022 * Internal dependencies |
|
1023 */ |
|
1024 |
|
1025 |
|
1026 |
|
1027 |
|
1028 (window.wp = window.wp || {}).annotations = __webpack_exports__; |
|
1029 /******/ })() |
|
1030 ; |