9
|
1 |
this["wp"] = this["wp"] || {}; this["wp"]["annotations"] = |
|
2 |
/******/ (function(modules) { // webpackBootstrap |
|
3 |
/******/ // The module cache |
|
4 |
/******/ var installedModules = {}; |
|
5 |
/******/ |
|
6 |
/******/ // The require function |
|
7 |
/******/ function __webpack_require__(moduleId) { |
|
8 |
/******/ |
|
9 |
/******/ // Check if module is in cache |
|
10 |
/******/ if(installedModules[moduleId]) { |
|
11 |
/******/ return installedModules[moduleId].exports; |
|
12 |
/******/ } |
|
13 |
/******/ // Create a new module (and put it into the cache) |
|
14 |
/******/ var module = installedModules[moduleId] = { |
|
15 |
/******/ i: moduleId, |
|
16 |
/******/ l: false, |
|
17 |
/******/ exports: {} |
|
18 |
/******/ }; |
|
19 |
/******/ |
|
20 |
/******/ // Execute the module function |
|
21 |
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); |
|
22 |
/******/ |
|
23 |
/******/ // Flag the module as loaded |
|
24 |
/******/ module.l = true; |
|
25 |
/******/ |
|
26 |
/******/ // Return the exports of the module |
|
27 |
/******/ return module.exports; |
|
28 |
/******/ } |
|
29 |
/******/ |
|
30 |
/******/ |
|
31 |
/******/ // expose the modules object (__webpack_modules__) |
|
32 |
/******/ __webpack_require__.m = modules; |
|
33 |
/******/ |
|
34 |
/******/ // expose the module cache |
|
35 |
/******/ __webpack_require__.c = installedModules; |
|
36 |
/******/ |
|
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 |
16
|
85 |
/******/ return __webpack_require__(__webpack_require__.s = 448); |
9
|
86 |
/******/ }) |
|
87 |
/************************************************************************/ |
|
88 |
/******/ ({ |
|
89 |
|
|
90 |
/***/ 1: |
|
91 |
/***/ (function(module, exports) { |
|
92 |
|
|
93 |
(function() { module.exports = this["wp"]["i18n"]; }()); |
|
94 |
|
|
95 |
/***/ }), |
|
96 |
|
|
97 |
/***/ 15: |
|
98 |
/***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
99 |
|
|
100 |
"use strict"; |
|
101 |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _objectWithoutProperties; }); |
16
|
102 |
/* harmony import */ var _objectWithoutPropertiesLoose__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(41); |
9
|
103 |
|
|
104 |
function _objectWithoutProperties(source, excluded) { |
|
105 |
if (source == null) return {}; |
16
|
106 |
var target = Object(_objectWithoutPropertiesLoose__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(source, excluded); |
9
|
107 |
var key, i; |
|
108 |
|
|
109 |
if (Object.getOwnPropertySymbols) { |
|
110 |
var sourceSymbolKeys = Object.getOwnPropertySymbols(source); |
|
111 |
|
|
112 |
for (i = 0; i < sourceSymbolKeys.length; i++) { |
|
113 |
key = sourceSymbolKeys[i]; |
|
114 |
if (excluded.indexOf(key) >= 0) continue; |
|
115 |
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; |
|
116 |
target[key] = source[key]; |
|
117 |
} |
|
118 |
} |
|
119 |
|
|
120 |
return target; |
|
121 |
} |
|
122 |
|
|
123 |
/***/ }), |
|
124 |
|
16
|
125 |
/***/ 18: |
|
126 |
/***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
127 |
|
|
128 |
"use strict"; |
|
129 |
|
|
130 |
// EXPORTS |
|
131 |
__webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ _toConsumableArray; }); |
|
132 |
|
|
133 |
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js |
|
134 |
var arrayLikeToArray = __webpack_require__(26); |
|
135 |
|
|
136 |
// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js |
|
137 |
|
|
138 |
function _arrayWithoutHoles(arr) { |
|
139 |
if (Array.isArray(arr)) return Object(arrayLikeToArray["a" /* default */])(arr); |
|
140 |
} |
|
141 |
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/iterableToArray.js |
|
142 |
var iterableToArray = __webpack_require__(35); |
|
143 |
|
|
144 |
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js |
|
145 |
var unsupportedIterableToArray = __webpack_require__(29); |
|
146 |
|
|
147 |
// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js |
|
148 |
function _nonIterableSpread() { |
|
149 |
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); |
|
150 |
} |
|
151 |
// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js |
|
152 |
|
|
153 |
|
|
154 |
|
|
155 |
|
|
156 |
function _toConsumableArray(arr) { |
|
157 |
return _arrayWithoutHoles(arr) || Object(iterableToArray["a" /* default */])(arr) || Object(unsupportedIterableToArray["a" /* default */])(arr) || _nonIterableSpread(); |
|
158 |
} |
|
159 |
|
|
160 |
/***/ }), |
|
161 |
|
|
162 |
/***/ 2: |
|
163 |
/***/ (function(module, exports) { |
|
164 |
|
|
165 |
(function() { module.exports = this["lodash"]; }()); |
|
166 |
|
|
167 |
/***/ }), |
|
168 |
|
|
169 |
/***/ 25: |
|
170 |
/***/ (function(module, exports) { |
|
171 |
|
|
172 |
(function() { module.exports = this["wp"]["richText"]; }()); |
|
173 |
|
|
174 |
/***/ }), |
|
175 |
|
9
|
176 |
/***/ 26: |
16
|
177 |
/***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
178 |
|
|
179 |
"use strict"; |
|
180 |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _arrayLikeToArray; }); |
|
181 |
function _arrayLikeToArray(arr, len) { |
|
182 |
if (len == null || len > arr.length) len = arr.length; |
|
183 |
|
|
184 |
for (var i = 0, arr2 = new Array(len); i < len; i++) { |
|
185 |
arr2[i] = arr[i]; |
|
186 |
} |
|
187 |
|
|
188 |
return arr2; |
|
189 |
} |
|
190 |
|
|
191 |
/***/ }), |
|
192 |
|
|
193 |
/***/ 29: |
|
194 |
/***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
195 |
|
|
196 |
"use strict"; |
|
197 |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _unsupportedIterableToArray; }); |
|
198 |
/* harmony import */ var _arrayLikeToArray__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(26); |
|
199 |
|
|
200 |
function _unsupportedIterableToArray(o, minLen) { |
|
201 |
if (!o) return; |
|
202 |
if (typeof o === "string") return Object(_arrayLikeToArray__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(o, minLen); |
|
203 |
var n = Object.prototype.toString.call(o).slice(8, -1); |
|
204 |
if (n === "Object" && o.constructor) n = o.constructor.name; |
|
205 |
if (n === "Map" || n === "Set") return Array.from(o); |
|
206 |
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return Object(_arrayLikeToArray__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(o, minLen); |
|
207 |
} |
|
208 |
|
|
209 |
/***/ }), |
|
210 |
|
|
211 |
/***/ 32: |
9
|
212 |
/***/ (function(module, exports) { |
|
213 |
|
|
214 |
(function() { module.exports = this["wp"]["hooks"]; }()); |
|
215 |
|
|
216 |
/***/ }), |
|
217 |
|
16
|
218 |
/***/ 35: |
|
219 |
/***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
220 |
|
|
221 |
"use strict"; |
|
222 |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _iterableToArray; }); |
|
223 |
function _iterableToArray(iter) { |
|
224 |
if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); |
|
225 |
} |
|
226 |
|
|
227 |
/***/ }), |
|
228 |
|
|
229 |
/***/ 4: |
|
230 |
/***/ (function(module, exports) { |
|
231 |
|
|
232 |
(function() { module.exports = this["wp"]["data"]; }()); |
|
233 |
|
|
234 |
/***/ }), |
|
235 |
|
|
236 |
/***/ 41: |
|
237 |
/***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
238 |
|
|
239 |
"use strict"; |
|
240 |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _objectWithoutPropertiesLoose; }); |
|
241 |
function _objectWithoutPropertiesLoose(source, excluded) { |
|
242 |
if (source == null) return {}; |
|
243 |
var target = {}; |
|
244 |
var sourceKeys = Object.keys(source); |
|
245 |
var key, i; |
|
246 |
|
|
247 |
for (i = 0; i < sourceKeys.length; i++) { |
|
248 |
key = sourceKeys[i]; |
|
249 |
if (excluded.indexOf(key) >= 0) continue; |
|
250 |
target[key] = source[key]; |
|
251 |
} |
|
252 |
|
|
253 |
return target; |
|
254 |
} |
|
255 |
|
|
256 |
/***/ }), |
|
257 |
|
|
258 |
/***/ 42: |
9
|
259 |
/***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
260 |
|
|
261 |
"use strict"; |
|
262 |
|
|
263 |
|
|
264 |
var LEAF_KEY, hasWeakMap; |
|
265 |
|
|
266 |
/** |
|
267 |
* Arbitrary value used as key for referencing cache object in WeakMap tree. |
|
268 |
* |
|
269 |
* @type {Object} |
|
270 |
*/ |
|
271 |
LEAF_KEY = {}; |
|
272 |
|
|
273 |
/** |
|
274 |
* Whether environment supports WeakMap. |
|
275 |
* |
|
276 |
* @type {boolean} |
|
277 |
*/ |
|
278 |
hasWeakMap = typeof WeakMap !== 'undefined'; |
|
279 |
|
|
280 |
/** |
|
281 |
* Returns the first argument as the sole entry in an array. |
|
282 |
* |
|
283 |
* @param {*} value Value to return. |
|
284 |
* |
|
285 |
* @return {Array} Value returned as entry in array. |
|
286 |
*/ |
|
287 |
function arrayOf( value ) { |
|
288 |
return [ value ]; |
|
289 |
} |
|
290 |
|
|
291 |
/** |
|
292 |
* Returns true if the value passed is object-like, or false otherwise. A value |
|
293 |
* is object-like if it can support property assignment, e.g. object or array. |
|
294 |
* |
|
295 |
* @param {*} value Value to test. |
|
296 |
* |
|
297 |
* @return {boolean} Whether value is object-like. |
|
298 |
*/ |
|
299 |
function isObjectLike( value ) { |
|
300 |
return !! value && 'object' === typeof value; |
|
301 |
} |
|
302 |
|
|
303 |
/** |
|
304 |
* Creates and returns a new cache object. |
|
305 |
* |
|
306 |
* @return {Object} Cache object. |
|
307 |
*/ |
|
308 |
function createCache() { |
|
309 |
var cache = { |
|
310 |
clear: function() { |
|
311 |
cache.head = null; |
|
312 |
}, |
|
313 |
}; |
|
314 |
|
|
315 |
return cache; |
|
316 |
} |
|
317 |
|
|
318 |
/** |
|
319 |
* Returns true if entries within the two arrays are strictly equal by |
|
320 |
* reference from a starting index. |
|
321 |
* |
|
322 |
* @param {Array} a First array. |
|
323 |
* @param {Array} b Second array. |
|
324 |
* @param {number} fromIndex Index from which to start comparison. |
|
325 |
* |
|
326 |
* @return {boolean} Whether arrays are shallowly equal. |
|
327 |
*/ |
|
328 |
function isShallowEqual( a, b, fromIndex ) { |
|
329 |
var i; |
|
330 |
|
|
331 |
if ( a.length !== b.length ) { |
|
332 |
return false; |
|
333 |
} |
|
334 |
|
|
335 |
for ( i = fromIndex; i < a.length; i++ ) { |
|
336 |
if ( a[ i ] !== b[ i ] ) { |
|
337 |
return false; |
|
338 |
} |
|
339 |
} |
|
340 |
|
|
341 |
return true; |
|
342 |
} |
|
343 |
|
|
344 |
/** |
|
345 |
* Returns a memoized selector function. The getDependants function argument is |
|
346 |
* called before the memoized selector and is expected to return an immutable |
|
347 |
* reference or array of references on which the selector depends for computing |
|
348 |
* its own return value. The memoize cache is preserved only as long as those |
|
349 |
* dependant references remain the same. If getDependants returns a different |
|
350 |
* reference(s), the cache is cleared and the selector value regenerated. |
|
351 |
* |
|
352 |
* @param {Function} selector Selector function. |
|
353 |
* @param {Function} getDependants Dependant getter returning an immutable |
|
354 |
* reference or array of reference used in |
|
355 |
* cache bust consideration. |
|
356 |
* |
|
357 |
* @return {Function} Memoized selector. |
|
358 |
*/ |
|
359 |
/* harmony default export */ __webpack_exports__["a"] = (function( selector, getDependants ) { |
|
360 |
var rootCache, getCache; |
|
361 |
|
|
362 |
// Use object source as dependant if getter not provided |
|
363 |
if ( ! getDependants ) { |
|
364 |
getDependants = arrayOf; |
|
365 |
} |
|
366 |
|
|
367 |
/** |
|
368 |
* Returns the root cache. If WeakMap is supported, this is assigned to the |
|
369 |
* root WeakMap cache set, otherwise it is a shared instance of the default |
|
370 |
* cache object. |
|
371 |
* |
|
372 |
* @return {(WeakMap|Object)} Root cache object. |
|
373 |
*/ |
|
374 |
function getRootCache() { |
|
375 |
return rootCache; |
|
376 |
} |
|
377 |
|
|
378 |
/** |
|
379 |
* Returns the cache for a given dependants array. When possible, a WeakMap |
|
380 |
* will be used to create a unique cache for each set of dependants. This |
|
381 |
* is feasible due to the nature of WeakMap in allowing garbage collection |
|
382 |
* to occur on entries where the key object is no longer referenced. Since |
|
383 |
* WeakMap requires the key to be an object, this is only possible when the |
|
384 |
* dependant is object-like. The root cache is created as a hierarchy where |
|
385 |
* each top-level key is the first entry in a dependants set, the value a |
|
386 |
* WeakMap where each key is the next dependant, and so on. This continues |
|
387 |
* so long as the dependants are object-like. If no dependants are object- |
|
388 |
* like, then the cache is shared across all invocations. |
|
389 |
* |
|
390 |
* @see isObjectLike |
|
391 |
* |
|
392 |
* @param {Array} dependants Selector dependants. |
|
393 |
* |
|
394 |
* @return {Object} Cache object. |
|
395 |
*/ |
|
396 |
function getWeakMapCache( dependants ) { |
|
397 |
var caches = rootCache, |
|
398 |
isUniqueByDependants = true, |
|
399 |
i, dependant, map, cache; |
|
400 |
|
|
401 |
for ( i = 0; i < dependants.length; i++ ) { |
|
402 |
dependant = dependants[ i ]; |
|
403 |
|
|
404 |
// Can only compose WeakMap from object-like key. |
|
405 |
if ( ! isObjectLike( dependant ) ) { |
|
406 |
isUniqueByDependants = false; |
|
407 |
break; |
|
408 |
} |
|
409 |
|
|
410 |
// Does current segment of cache already have a WeakMap? |
|
411 |
if ( caches.has( dependant ) ) { |
|
412 |
// Traverse into nested WeakMap. |
|
413 |
caches = caches.get( dependant ); |
|
414 |
} else { |
|
415 |
// Create, set, and traverse into a new one. |
|
416 |
map = new WeakMap(); |
|
417 |
caches.set( dependant, map ); |
|
418 |
caches = map; |
|
419 |
} |
|
420 |
} |
|
421 |
|
|
422 |
// We use an arbitrary (but consistent) object as key for the last item |
|
423 |
// in the WeakMap to serve as our running cache. |
|
424 |
if ( ! caches.has( LEAF_KEY ) ) { |
|
425 |
cache = createCache(); |
|
426 |
cache.isUniqueByDependants = isUniqueByDependants; |
|
427 |
caches.set( LEAF_KEY, cache ); |
|
428 |
} |
|
429 |
|
|
430 |
return caches.get( LEAF_KEY ); |
|
431 |
} |
|
432 |
|
|
433 |
// Assign cache handler by availability of WeakMap |
|
434 |
getCache = hasWeakMap ? getWeakMapCache : getRootCache; |
|
435 |
|
|
436 |
/** |
|
437 |
* Resets root memoization cache. |
|
438 |
*/ |
|
439 |
function clear() { |
|
440 |
rootCache = hasWeakMap ? new WeakMap() : createCache(); |
|
441 |
} |
|
442 |
|
|
443 |
// eslint-disable-next-line jsdoc/check-param-names |
|
444 |
/** |
|
445 |
* The augmented selector call, considering first whether dependants have |
|
446 |
* changed before passing it to underlying memoize function. |
|
447 |
* |
|
448 |
* @param {Object} source Source object for derivation. |
|
449 |
* @param {...*} extraArgs Additional arguments to pass to selector. |
|
450 |
* |
|
451 |
* @return {*} Selector result. |
|
452 |
*/ |
|
453 |
function callSelector( /* source, ...extraArgs */ ) { |
|
454 |
var len = arguments.length, |
|
455 |
cache, node, i, args, dependants; |
|
456 |
|
|
457 |
// Create copy of arguments (avoid leaking deoptimization). |
|
458 |
args = new Array( len ); |
|
459 |
for ( i = 0; i < len; i++ ) { |
|
460 |
args[ i ] = arguments[ i ]; |
|
461 |
} |
|
462 |
|
|
463 |
dependants = getDependants.apply( null, args ); |
|
464 |
cache = getCache( dependants ); |
|
465 |
|
|
466 |
// If not guaranteed uniqueness by dependants (primitive type or lack |
|
467 |
// of WeakMap support), shallow compare against last dependants and, if |
|
468 |
// references have changed, destroy cache to recalculate result. |
|
469 |
if ( ! cache.isUniqueByDependants ) { |
|
470 |
if ( cache.lastDependants && ! isShallowEqual( dependants, cache.lastDependants, 0 ) ) { |
|
471 |
cache.clear(); |
|
472 |
} |
|
473 |
|
|
474 |
cache.lastDependants = dependants; |
|
475 |
} |
|
476 |
|
|
477 |
node = cache.head; |
|
478 |
while ( node ) { |
|
479 |
// Check whether node arguments match arguments |
|
480 |
if ( ! isShallowEqual( node.args, args, 1 ) ) { |
|
481 |
node = node.next; |
|
482 |
continue; |
|
483 |
} |
|
484 |
|
|
485 |
// At this point we can assume we've found a match |
|
486 |
|
|
487 |
// Surface matched node to head if not already |
|
488 |
if ( node !== cache.head ) { |
|
489 |
// Adjust siblings to point to each other. |
|
490 |
node.prev.next = node.next; |
|
491 |
if ( node.next ) { |
|
492 |
node.next.prev = node.prev; |
|
493 |
} |
|
494 |
|
|
495 |
node.next = cache.head; |
|
496 |
node.prev = null; |
|
497 |
cache.head.prev = node; |
|
498 |
cache.head = node; |
|
499 |
} |
|
500 |
|
|
501 |
// Return immediately |
|
502 |
return node.val; |
|
503 |
} |
|
504 |
|
|
505 |
// No cached value found. Continue to insertion phase: |
|
506 |
|
|
507 |
node = { |
|
508 |
// Generate the result from original function |
|
509 |
val: selector.apply( null, args ), |
|
510 |
}; |
|
511 |
|
|
512 |
// Avoid including the source object in the cache. |
|
513 |
args[ 0 ] = null; |
|
514 |
node.args = args; |
|
515 |
|
|
516 |
// Don't need to check whether node is already head, since it would |
|
517 |
// have been returned above already if it was |
|
518 |
|
|
519 |
// Shift existing head down list |
|
520 |
if ( cache.head ) { |
|
521 |
cache.head.prev = node; |
|
522 |
node.next = cache.head; |
|
523 |
} |
|
524 |
|
|
525 |
cache.head = node; |
|
526 |
|
|
527 |
return node.val; |
|
528 |
} |
|
529 |
|
|
530 |
callSelector.getDependants = getDependants; |
|
531 |
callSelector.clear = clear; |
|
532 |
clear(); |
|
533 |
|
|
534 |
return callSelector; |
|
535 |
}); |
|
536 |
|
|
537 |
|
|
538 |
/***/ }), |
|
539 |
|
16
|
540 |
/***/ 448: |
9
|
541 |
/***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
542 |
|
|
543 |
"use strict"; |
16
|
544 |
// ESM COMPAT FLAG |
|
545 |
__webpack_require__.r(__webpack_exports__); |
9
|
546 |
|
16
|
547 |
// NAMESPACE OBJECT: ./node_modules/@wordpress/annotations/build-module/store/selectors.js |
9
|
548 |
var selectors_namespaceObject = {}; |
|
549 |
__webpack_require__.r(selectors_namespaceObject); |
|
550 |
__webpack_require__.d(selectors_namespaceObject, "__experimentalGetAnnotationsForBlock", function() { return __experimentalGetAnnotationsForBlock; }); |
16
|
551 |
__webpack_require__.d(selectors_namespaceObject, "__experimentalGetAllAnnotationsForBlock", function() { return __experimentalGetAllAnnotationsForBlock; }); |
9
|
552 |
__webpack_require__.d(selectors_namespaceObject, "__experimentalGetAnnotationsForRichText", function() { return __experimentalGetAnnotationsForRichText; }); |
|
553 |
__webpack_require__.d(selectors_namespaceObject, "__experimentalGetAnnotations", function() { return __experimentalGetAnnotations; }); |
16
|
554 |
|
|
555 |
// NAMESPACE OBJECT: ./node_modules/@wordpress/annotations/build-module/store/actions.js |
9
|
556 |
var actions_namespaceObject = {}; |
|
557 |
__webpack_require__.r(actions_namespaceObject); |
|
558 |
__webpack_require__.d(actions_namespaceObject, "__experimentalAddAnnotation", function() { return __experimentalAddAnnotation; }); |
|
559 |
__webpack_require__.d(actions_namespaceObject, "__experimentalRemoveAnnotation", function() { return __experimentalRemoveAnnotation; }); |
|
560 |
__webpack_require__.d(actions_namespaceObject, "__experimentalUpdateAnnotationRange", function() { return __experimentalUpdateAnnotationRange; }); |
|
561 |
__webpack_require__.d(actions_namespaceObject, "__experimentalRemoveAnnotationsBySource", function() { return __experimentalRemoveAnnotationsBySource; }); |
|
562 |
|
|
563 |
// EXTERNAL MODULE: external {"this":["wp","data"]} |
16
|
564 |
var external_this_wp_data_ = __webpack_require__(4); |
9
|
565 |
|
|
566 |
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js + 2 modules |
16
|
567 |
var toConsumableArray = __webpack_require__(18); |
9
|
568 |
|
16
|
569 |
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/defineProperty.js |
|
570 |
var defineProperty = __webpack_require__(5); |
9
|
571 |
|
16
|
572 |
// EXTERNAL MODULE: external {"this":"lodash"} |
|
573 |
var external_this_lodash_ = __webpack_require__(2); |
9
|
574 |
|
|
575 |
// CONCATENATED MODULE: ./node_modules/@wordpress/annotations/build-module/store/reducer.js |
|
576 |
|
|
577 |
|
|
578 |
|
16
|
579 |
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } |
|
580 |
|
|
581 |
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { Object(defineProperty["a" /* default */])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } |
9
|
582 |
|
|
583 |
/** |
|
584 |
* External dependencies |
|
585 |
*/ |
|
586 |
|
|
587 |
/** |
|
588 |
* Filters an array based on the predicate, but keeps the reference the same if |
|
589 |
* the array hasn't changed. |
|
590 |
* |
|
591 |
* @param {Array} collection The collection to filter. |
|
592 |
* @param {Function} predicate Function that determines if the item should stay |
|
593 |
* in the array. |
|
594 |
* @return {Array} Filtered array. |
|
595 |
*/ |
|
596 |
|
|
597 |
function filterWithReference(collection, predicate) { |
|
598 |
var filteredCollection = collection.filter(predicate); |
|
599 |
return collection.length === filteredCollection.length ? collection : filteredCollection; |
|
600 |
} |
|
601 |
/** |
|
602 |
* Verifies whether the given annotations is a valid annotation. |
|
603 |
* |
|
604 |
* @param {Object} annotation The annotation to verify. |
|
605 |
* @return {boolean} Whether the given annotation is valid. |
|
606 |
*/ |
|
607 |
|
|
608 |
|
|
609 |
function isValidAnnotationRange(annotation) { |
16
|
610 |
return Object(external_this_lodash_["isNumber"])(annotation.start) && Object(external_this_lodash_["isNumber"])(annotation.end) && annotation.start <= annotation.end; |
9
|
611 |
} |
|
612 |
/** |
|
613 |
* Reducer managing annotations. |
|
614 |
* |
16
|
615 |
* @param {Object} state The annotations currently shown in the editor. |
9
|
616 |
* @param {Object} action Dispatched action. |
|
617 |
* |
|
618 |
* @return {Array} Updated state. |
|
619 |
*/ |
|
620 |
|
|
621 |
|
|
622 |
function reducer_annotations() { |
16
|
623 |
var _state$blockClientId; |
|
624 |
|
9
|
625 |
var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; |
|
626 |
var action = arguments.length > 1 ? arguments[1] : undefined; |
|
627 |
|
|
628 |
switch (action.type) { |
|
629 |
case 'ANNOTATION_ADD': |
|
630 |
var blockClientId = action.blockClientId; |
|
631 |
var newAnnotation = { |
|
632 |
id: action.id, |
|
633 |
blockClientId: blockClientId, |
|
634 |
richTextIdentifier: action.richTextIdentifier, |
|
635 |
source: action.source, |
|
636 |
selector: action.selector, |
|
637 |
range: action.range |
|
638 |
}; |
|
639 |
|
|
640 |
if (newAnnotation.selector === 'range' && !isValidAnnotationRange(newAnnotation.range)) { |
|
641 |
return state; |
|
642 |
} |
|
643 |
|
16
|
644 |
var previousAnnotationsForBlock = (_state$blockClientId = state === null || state === void 0 ? void 0 : state[blockClientId]) !== null && _state$blockClientId !== void 0 ? _state$blockClientId : []; |
|
645 |
return _objectSpread({}, state, Object(defineProperty["a" /* default */])({}, blockClientId, [].concat(Object(toConsumableArray["a" /* default */])(previousAnnotationsForBlock), [newAnnotation]))); |
9
|
646 |
|
|
647 |
case 'ANNOTATION_REMOVE': |
16
|
648 |
return Object(external_this_lodash_["mapValues"])(state, function (annotationsForBlock) { |
9
|
649 |
return filterWithReference(annotationsForBlock, function (annotation) { |
|
650 |
return annotation.id !== action.annotationId; |
|
651 |
}); |
|
652 |
}); |
|
653 |
|
|
654 |
case 'ANNOTATION_UPDATE_RANGE': |
16
|
655 |
return Object(external_this_lodash_["mapValues"])(state, function (annotationsForBlock) { |
9
|
656 |
var hasChangedRange = false; |
|
657 |
var newAnnotations = annotationsForBlock.map(function (annotation) { |
|
658 |
if (annotation.id === action.annotationId) { |
|
659 |
hasChangedRange = true; |
16
|
660 |
return _objectSpread({}, annotation, { |
9
|
661 |
range: { |
|
662 |
start: action.start, |
|
663 |
end: action.end |
|
664 |
} |
|
665 |
}); |
|
666 |
} |
|
667 |
|
|
668 |
return annotation; |
|
669 |
}); |
|
670 |
return hasChangedRange ? newAnnotations : annotationsForBlock; |
|
671 |
}); |
|
672 |
|
|
673 |
case 'ANNOTATION_REMOVE_SOURCE': |
16
|
674 |
return Object(external_this_lodash_["mapValues"])(state, function (annotationsForBlock) { |
9
|
675 |
return filterWithReference(annotationsForBlock, function (annotation) { |
|
676 |
return annotation.source !== action.source; |
|
677 |
}); |
|
678 |
}); |
|
679 |
} |
|
680 |
|
|
681 |
return state; |
|
682 |
} |
|
683 |
/* harmony default export */ var reducer = (reducer_annotations); |
|
684 |
|
16
|
685 |
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js |
|
686 |
var objectWithoutProperties = __webpack_require__(15); |
9
|
687 |
|
|
688 |
// EXTERNAL MODULE: ./node_modules/rememo/es/rememo.js |
16
|
689 |
var rememo = __webpack_require__(42); |
9
|
690 |
|
|
691 |
// CONCATENATED MODULE: ./node_modules/@wordpress/annotations/build-module/store/selectors.js |
|
692 |
|
|
693 |
|
|
694 |
|
16
|
695 |
function selectors_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } |
|
696 |
|
|
697 |
function selectors_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { selectors_ownKeys(Object(source), true).forEach(function (key) { Object(defineProperty["a" /* default */])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { selectors_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } |
|
698 |
|
9
|
699 |
/** |
|
700 |
* External dependencies |
|
701 |
*/ |
|
702 |
|
|
703 |
|
|
704 |
/** |
|
705 |
* Shared reference to an empty array for cases where it is important to avoid |
|
706 |
* returning a new array reference on every invocation, as in a connected or |
|
707 |
* other pure component which performs `shouldComponentUpdate` check on props. |
|
708 |
* This should be used as a last resort, since the normalized data should be |
|
709 |
* maintained by the reducer result in state. |
|
710 |
* |
|
711 |
* @type {Array} |
|
712 |
*/ |
|
713 |
|
|
714 |
var EMPTY_ARRAY = []; |
|
715 |
/** |
|
716 |
* Returns the annotations for a specific client ID. |
|
717 |
* |
|
718 |
* @param {Object} state Editor state. |
|
719 |
* @param {string} clientId The ID of the block to get the annotations for. |
|
720 |
* |
|
721 |
* @return {Array} The annotations applicable to this block. |
|
722 |
*/ |
|
723 |
|
|
724 |
var __experimentalGetAnnotationsForBlock = Object(rememo["a" /* default */])(function (state, blockClientId) { |
16
|
725 |
var _state$blockClientId; |
|
726 |
|
|
727 |
return ((_state$blockClientId = state === null || state === void 0 ? void 0 : state[blockClientId]) !== null && _state$blockClientId !== void 0 ? _state$blockClientId : []).filter(function (annotation) { |
9
|
728 |
return annotation.selector === 'block'; |
|
729 |
}); |
|
730 |
}, function (state, blockClientId) { |
16
|
731 |
var _state$blockClientId2; |
|
732 |
|
|
733 |
return [(_state$blockClientId2 = state === null || state === void 0 ? void 0 : state[blockClientId]) !== null && _state$blockClientId2 !== void 0 ? _state$blockClientId2 : EMPTY_ARRAY]; |
9
|
734 |
}); |
16
|
735 |
function __experimentalGetAllAnnotationsForBlock(state, blockClientId) { |
|
736 |
var _state$blockClientId3; |
|
737 |
|
|
738 |
return (_state$blockClientId3 = state === null || state === void 0 ? void 0 : state[blockClientId]) !== null && _state$blockClientId3 !== void 0 ? _state$blockClientId3 : EMPTY_ARRAY; |
|
739 |
} |
9
|
740 |
/** |
|
741 |
* Returns the annotations that apply to the given RichText instance. |
|
742 |
* |
|
743 |
* Both a blockClientId and a richTextIdentifier are required. This is because |
|
744 |
* a block might have multiple `RichText` components. This does mean that every |
|
745 |
* block needs to implement annotations itself. |
|
746 |
* |
|
747 |
* @param {Object} state Editor state. |
|
748 |
* @param {string} blockClientId The client ID for the block. |
|
749 |
* @param {string} richTextIdentifier Unique identifier that identifies the given RichText. |
|
750 |
* @return {Array} All the annotations relevant for the `RichText`. |
|
751 |
*/ |
|
752 |
|
|
753 |
var __experimentalGetAnnotationsForRichText = Object(rememo["a" /* default */])(function (state, blockClientId, richTextIdentifier) { |
16
|
754 |
var _state$blockClientId4; |
|
755 |
|
|
756 |
return ((_state$blockClientId4 = state === null || state === void 0 ? void 0 : state[blockClientId]) !== null && _state$blockClientId4 !== void 0 ? _state$blockClientId4 : []).filter(function (annotation) { |
9
|
757 |
return annotation.selector === 'range' && richTextIdentifier === annotation.richTextIdentifier; |
|
758 |
}).map(function (annotation) { |
|
759 |
var range = annotation.range, |
|
760 |
other = Object(objectWithoutProperties["a" /* default */])(annotation, ["range"]); |
|
761 |
|
16
|
762 |
return selectors_objectSpread({}, range, {}, other); |
9
|
763 |
}); |
|
764 |
}, function (state, blockClientId) { |
16
|
765 |
var _state$blockClientId5; |
|
766 |
|
|
767 |
return [(_state$blockClientId5 = state === null || state === void 0 ? void 0 : state[blockClientId]) !== null && _state$blockClientId5 !== void 0 ? _state$blockClientId5 : EMPTY_ARRAY]; |
9
|
768 |
}); |
|
769 |
/** |
|
770 |
* Returns all annotations in the editor state. |
|
771 |
* |
|
772 |
* @param {Object} state Editor state. |
|
773 |
* @return {Array} All annotations currently applied. |
|
774 |
*/ |
|
775 |
|
|
776 |
function __experimentalGetAnnotations(state) { |
16
|
777 |
return Object(external_this_lodash_["flatMap"])(state, function (annotations) { |
9
|
778 |
return annotations; |
|
779 |
}); |
|
780 |
} |
|
781 |
|
16
|
782 |
// CONCATENATED MODULE: ./node_modules/@wordpress/annotations/node_modules/uuid/dist/esm-browser/rng.js |
|
783 |
// Unique ID creation requires a high quality random # generator. In the browser we therefore |
|
784 |
// require the crypto API and do not support built-in fallback to lower quality random number |
|
785 |
// generators (like Math.random()). |
|
786 |
// getRandomValues needs to be invoked in a context where "this" is a Crypto implementation. Also, |
|
787 |
// find the complete implementation of crypto (msCrypto) on IE11. |
|
788 |
var getRandomValues = typeof crypto != 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto) || typeof msCrypto != 'undefined' && typeof msCrypto.getRandomValues == 'function' && msCrypto.getRandomValues.bind(msCrypto); |
|
789 |
var rnds8 = new Uint8Array(16); // eslint-disable-line no-undef |
|
790 |
|
|
791 |
function rng() { |
|
792 |
if (!getRandomValues) { |
|
793 |
throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported'); |
|
794 |
} |
|
795 |
|
|
796 |
return getRandomValues(rnds8); |
|
797 |
} |
|
798 |
// CONCATENATED MODULE: ./node_modules/@wordpress/annotations/node_modules/uuid/dist/esm-browser/bytesToUuid.js |
|
799 |
/** |
|
800 |
* Convert array of 16 byte values to UUID string format of the form: |
|
801 |
* XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX |
|
802 |
*/ |
|
803 |
var byteToHex = []; |
|
804 |
|
|
805 |
for (var bytesToUuid_i = 0; bytesToUuid_i < 256; ++bytesToUuid_i) { |
|
806 |
byteToHex[bytesToUuid_i] = (bytesToUuid_i + 0x100).toString(16).substr(1); |
|
807 |
} |
|
808 |
|
|
809 |
function bytesToUuid(buf, offset) { |
|
810 |
var i = offset || 0; |
|
811 |
var bth = byteToHex; // join used to fix memory issue caused by concatenation: https://bugs.chromium.org/p/v8/issues/detail?id=3175#c4 |
9
|
812 |
|
16
|
813 |
return [bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], '-', bth[buf[i++]], bth[buf[i++]], '-', bth[buf[i++]], bth[buf[i++]], '-', bth[buf[i++]], bth[buf[i++]], '-', bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], bth[buf[i++]]].join(''); |
|
814 |
} |
|
815 |
|
|
816 |
/* harmony default export */ var esm_browser_bytesToUuid = (bytesToUuid); |
|
817 |
// CONCATENATED MODULE: ./node_modules/@wordpress/annotations/node_modules/uuid/dist/esm-browser/v4.js |
|
818 |
|
|
819 |
|
|
820 |
|
|
821 |
function v4(options, buf, offset) { |
|
822 |
var i = buf && offset || 0; |
|
823 |
|
|
824 |
if (typeof options == 'string') { |
|
825 |
buf = options === 'binary' ? new Array(16) : null; |
|
826 |
options = null; |
|
827 |
} |
|
828 |
|
|
829 |
options = options || {}; |
|
830 |
var rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved` |
|
831 |
|
|
832 |
rnds[6] = rnds[6] & 0x0f | 0x40; |
|
833 |
rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided |
|
834 |
|
|
835 |
if (buf) { |
|
836 |
for (var ii = 0; ii < 16; ++ii) { |
|
837 |
buf[i + ii] = rnds[ii]; |
|
838 |
} |
|
839 |
} |
|
840 |
|
|
841 |
return buf || esm_browser_bytesToUuid(rnds); |
|
842 |
} |
|
843 |
|
|
844 |
/* harmony default export */ var esm_browser_v4 = (v4); |
9
|
845 |
// CONCATENATED MODULE: ./node_modules/@wordpress/annotations/build-module/store/actions.js |
|
846 |
/** |
|
847 |
* External dependencies |
|
848 |
*/ |
|
849 |
|
|
850 |
/** |
16
|
851 |
* @typedef WPAnnotationRange |
|
852 |
* |
|
853 |
* @property {number} start The offset where the annotation should start. |
|
854 |
* @property {number} end The offset where the annotation should end. |
|
855 |
*/ |
|
856 |
|
|
857 |
/** |
9
|
858 |
* Adds an annotation to a block. |
|
859 |
* |
|
860 |
* The `block` attribute refers to a block ID that needs to be annotated. |
|
861 |
* `isBlockAnnotation` controls whether or not the annotation is a block |
|
862 |
* annotation. The `source` is the source of the annotation, this will be used |
|
863 |
* to identity groups of annotations. |
|
864 |
* |
|
865 |
* The `range` property is only relevant if the selector is 'range'. |
|
866 |
* |
16
|
867 |
* @param {Object} annotation The annotation to add. |
|
868 |
* @param {string} annotation.blockClientId The blockClientId to add the annotation to. |
|
869 |
* @param {string} annotation.richTextIdentifier Identifier for the RichText instance the annotation applies to. |
|
870 |
* @param {WPAnnotationRange} annotation.range The range at which to apply this annotation. |
|
871 |
* @param {string} [annotation.selector="range"] The way to apply this annotation. |
|
872 |
* @param {string} [annotation.source="default"] The source that added the annotation. |
|
873 |
* @param {string} [annotation.id] The ID the annotation should have. Generates a UUID by default. |
9
|
874 |
* |
|
875 |
* @return {Object} Action object. |
|
876 |
*/ |
|
877 |
|
|
878 |
function __experimentalAddAnnotation(_ref) { |
|
879 |
var blockClientId = _ref.blockClientId, |
|
880 |
_ref$richTextIdentifi = _ref.richTextIdentifier, |
|
881 |
richTextIdentifier = _ref$richTextIdentifi === void 0 ? null : _ref$richTextIdentifi, |
|
882 |
_ref$range = _ref.range, |
|
883 |
range = _ref$range === void 0 ? null : _ref$range, |
|
884 |
_ref$selector = _ref.selector, |
|
885 |
selector = _ref$selector === void 0 ? 'range' : _ref$selector, |
|
886 |
_ref$source = _ref.source, |
|
887 |
source = _ref$source === void 0 ? 'default' : _ref$source, |
|
888 |
_ref$id = _ref.id, |
16
|
889 |
id = _ref$id === void 0 ? esm_browser_v4() : _ref$id; |
9
|
890 |
var action = { |
|
891 |
type: 'ANNOTATION_ADD', |
|
892 |
id: id, |
|
893 |
blockClientId: blockClientId, |
|
894 |
richTextIdentifier: richTextIdentifier, |
|
895 |
source: source, |
|
896 |
selector: selector |
|
897 |
}; |
|
898 |
|
|
899 |
if (selector === 'range') { |
|
900 |
action.range = range; |
|
901 |
} |
|
902 |
|
|
903 |
return action; |
|
904 |
} |
|
905 |
/** |
|
906 |
* Removes an annotation with a specific ID. |
|
907 |
* |
|
908 |
* @param {string} annotationId The annotation to remove. |
|
909 |
* |
|
910 |
* @return {Object} Action object. |
|
911 |
*/ |
|
912 |
|
|
913 |
function __experimentalRemoveAnnotation(annotationId) { |
|
914 |
return { |
|
915 |
type: 'ANNOTATION_REMOVE', |
|
916 |
annotationId: annotationId |
|
917 |
}; |
|
918 |
} |
|
919 |
/** |
|
920 |
* Updates the range of an annotation. |
|
921 |
* |
|
922 |
* @param {string} annotationId ID of the annotation to update. |
|
923 |
* @param {number} start The start of the new range. |
|
924 |
* @param {number} end The end of the new range. |
|
925 |
* |
|
926 |
* @return {Object} Action object. |
|
927 |
*/ |
|
928 |
|
|
929 |
function __experimentalUpdateAnnotationRange(annotationId, start, end) { |
|
930 |
return { |
|
931 |
type: 'ANNOTATION_UPDATE_RANGE', |
|
932 |
annotationId: annotationId, |
|
933 |
start: start, |
|
934 |
end: end |
|
935 |
}; |
|
936 |
} |
|
937 |
/** |
|
938 |
* Removes all annotations of a specific source. |
|
939 |
* |
|
940 |
* @param {string} source The source to remove. |
|
941 |
* |
|
942 |
* @return {Object} Action object. |
|
943 |
*/ |
|
944 |
|
|
945 |
function __experimentalRemoveAnnotationsBySource(source) { |
|
946 |
return { |
|
947 |
type: 'ANNOTATION_REMOVE_SOURCE', |
|
948 |
source: source |
|
949 |
}; |
|
950 |
} |
|
951 |
|
|
952 |
// CONCATENATED MODULE: ./node_modules/@wordpress/annotations/build-module/store/index.js |
|
953 |
/** |
|
954 |
* WordPress dependencies |
|
955 |
*/ |
|
956 |
|
|
957 |
/** |
|
958 |
* Internal dependencies |
|
959 |
*/ |
|
960 |
|
|
961 |
|
|
962 |
|
|
963 |
|
|
964 |
/** |
|
965 |
* Module Constants |
|
966 |
*/ |
|
967 |
|
|
968 |
var MODULE_KEY = 'core/annotations'; |
|
969 |
var store = Object(external_this_wp_data_["registerStore"])(MODULE_KEY, { |
|
970 |
reducer: reducer, |
|
971 |
selectors: selectors_namespaceObject, |
|
972 |
actions: actions_namespaceObject |
|
973 |
}); |
|
974 |
/* harmony default export */ var build_module_store = (store); |
|
975 |
|
|
976 |
// EXTERNAL MODULE: external {"this":["wp","richText"]} |
16
|
977 |
var external_this_wp_richText_ = __webpack_require__(25); |
9
|
978 |
|
|
979 |
// EXTERNAL MODULE: external {"this":["wp","i18n"]} |
|
980 |
var external_this_wp_i18n_ = __webpack_require__(1); |
|
981 |
|
|
982 |
// CONCATENATED MODULE: ./node_modules/@wordpress/annotations/build-module/format/annotation.js |
|
983 |
/** |
|
984 |
* WordPress dependencies |
|
985 |
*/ |
|
986 |
|
|
987 |
|
|
988 |
var FORMAT_NAME = 'core/annotation'; |
|
989 |
var ANNOTATION_ATTRIBUTE_PREFIX = 'annotation-text-'; |
|
990 |
var STORE_KEY = 'core/annotations'; |
|
991 |
/** |
|
992 |
* Applies given annotations to the given record. |
|
993 |
* |
|
994 |
* @param {Object} record The record to apply annotations to. |
|
995 |
* @param {Array} annotations The annotation to apply. |
|
996 |
* @return {Object} A record with the annotations applied. |
|
997 |
*/ |
|
998 |
|
|
999 |
function applyAnnotations(record) { |
|
1000 |
var annotations = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : []; |
|
1001 |
annotations.forEach(function (annotation) { |
|
1002 |
var start = annotation.start, |
|
1003 |
end = annotation.end; |
|
1004 |
|
|
1005 |
if (start > record.text.length) { |
|
1006 |
start = record.text.length; |
|
1007 |
} |
|
1008 |
|
|
1009 |
if (end > record.text.length) { |
|
1010 |
end = record.text.length; |
|
1011 |
} |
|
1012 |
|
|
1013 |
var className = ANNOTATION_ATTRIBUTE_PREFIX + annotation.source; |
|
1014 |
var id = ANNOTATION_ATTRIBUTE_PREFIX + annotation.id; |
|
1015 |
record = Object(external_this_wp_richText_["applyFormat"])(record, { |
|
1016 |
type: FORMAT_NAME, |
|
1017 |
attributes: { |
|
1018 |
className: className, |
|
1019 |
id: id |
|
1020 |
} |
|
1021 |
}, start, end); |
|
1022 |
}); |
|
1023 |
return record; |
|
1024 |
} |
|
1025 |
/** |
|
1026 |
* Removes annotations from the given record. |
|
1027 |
* |
|
1028 |
* @param {Object} record Record to remove annotations from. |
|
1029 |
* @return {Object} The cleaned record. |
|
1030 |
*/ |
|
1031 |
|
|
1032 |
function removeAnnotations(record) { |
|
1033 |
return Object(external_this_wp_richText_["removeFormat"])(record, 'core/annotation', 0, record.text.length); |
|
1034 |
} |
|
1035 |
/** |
|
1036 |
* Retrieves the positions of annotations inside an array of formats. |
|
1037 |
* |
|
1038 |
* @param {Array} formats Formats with annotations in there. |
|
1039 |
* @return {Object} ID keyed positions of annotations. |
|
1040 |
*/ |
|
1041 |
|
|
1042 |
function retrieveAnnotationPositions(formats) { |
|
1043 |
var positions = {}; |
|
1044 |
formats.forEach(function (characterFormats, i) { |
|
1045 |
characterFormats = characterFormats || []; |
|
1046 |
characterFormats = characterFormats.filter(function (format) { |
|
1047 |
return format.type === FORMAT_NAME; |
|
1048 |
}); |
|
1049 |
characterFormats.forEach(function (format) { |
|
1050 |
var id = format.attributes.id; |
|
1051 |
id = id.replace(ANNOTATION_ATTRIBUTE_PREFIX, ''); |
|
1052 |
|
|
1053 |
if (!positions.hasOwnProperty(id)) { |
|
1054 |
positions[id] = { |
|
1055 |
start: i |
|
1056 |
}; |
|
1057 |
} // Annotations refer to positions between characters. |
|
1058 |
// Formats refer to the character themselves. |
|
1059 |
// So we need to adjust for that here. |
|
1060 |
|
|
1061 |
|
|
1062 |
positions[id].end = i + 1; |
|
1063 |
}); |
|
1064 |
}); |
|
1065 |
return positions; |
|
1066 |
} |
|
1067 |
/** |
|
1068 |
* Updates annotations in the state based on positions retrieved from RichText. |
|
1069 |
* |
16
|
1070 |
* @param {Array} annotations The annotations that are currently applied. |
|
1071 |
* @param {Array} positions The current positions of the given annotations. |
|
1072 |
* @param {Object} actions |
|
1073 |
* @param {Function} actions.removeAnnotation Function to remove an annotation from the state. |
|
1074 |
* @param {Function} actions.updateAnnotationRange Function to update an annotation range in the state. |
9
|
1075 |
*/ |
|
1076 |
|
|
1077 |
|
|
1078 |
function updateAnnotationsWithPositions(annotations, positions, _ref) { |
|
1079 |
var removeAnnotation = _ref.removeAnnotation, |
|
1080 |
updateAnnotationRange = _ref.updateAnnotationRange; |
|
1081 |
annotations.forEach(function (currentAnnotation) { |
|
1082 |
var position = positions[currentAnnotation.id]; // If we cannot find an annotation, delete it. |
|
1083 |
|
|
1084 |
if (!position) { |
|
1085 |
// Apparently the annotation has been removed, so remove it from the state: |
|
1086 |
// Remove... |
|
1087 |
removeAnnotation(currentAnnotation.id); |
|
1088 |
return; |
|
1089 |
} |
|
1090 |
|
|
1091 |
var start = currentAnnotation.start, |
|
1092 |
end = currentAnnotation.end; |
|
1093 |
|
|
1094 |
if (start !== position.start || end !== position.end) { |
|
1095 |
updateAnnotationRange(currentAnnotation.id, position.start, position.end); |
|
1096 |
} |
|
1097 |
}); |
|
1098 |
} |
|
1099 |
|
|
1100 |
var annotation_annotation = { |
|
1101 |
name: FORMAT_NAME, |
|
1102 |
title: Object(external_this_wp_i18n_["__"])('Annotation'), |
|
1103 |
tagName: 'mark', |
|
1104 |
className: 'annotation-text', |
|
1105 |
attributes: { |
|
1106 |
className: 'class', |
|
1107 |
id: 'id' |
|
1108 |
}, |
|
1109 |
edit: function edit() { |
|
1110 |
return null; |
|
1111 |
}, |
|
1112 |
__experimentalGetPropsForEditableTreePreparation: function __experimentalGetPropsForEditableTreePreparation(select, _ref2) { |
|
1113 |
var richTextIdentifier = _ref2.richTextIdentifier, |
|
1114 |
blockClientId = _ref2.blockClientId; |
16
|
1115 |
return { |
|
1116 |
annotations: select(STORE_KEY).__experimentalGetAnnotationsForRichText(blockClientId, richTextIdentifier) |
|
1117 |
}; |
9
|
1118 |
}, |
16
|
1119 |
__experimentalCreatePrepareEditableTree: function __experimentalCreatePrepareEditableTree(_ref3) { |
|
1120 |
var annotations = _ref3.annotations; |
|
1121 |
return function (formats, text) { |
|
1122 |
if (annotations.length === 0) { |
|
1123 |
return formats; |
|
1124 |
} |
|
1125 |
|
|
1126 |
var record = { |
|
1127 |
formats: formats, |
|
1128 |
text: text |
|
1129 |
}; |
|
1130 |
record = applyAnnotations(record, annotations); |
|
1131 |
return record.formats; |
|
1132 |
}; |
|
1133 |
}, |
9
|
1134 |
__experimentalGetPropsForEditableTreeChangeHandler: function __experimentalGetPropsForEditableTreeChangeHandler(dispatch) { |
|
1135 |
return { |
|
1136 |
removeAnnotation: dispatch(STORE_KEY).__experimentalRemoveAnnotation, |
|
1137 |
updateAnnotationRange: dispatch(STORE_KEY).__experimentalUpdateAnnotationRange |
|
1138 |
}; |
|
1139 |
}, |
|
1140 |
__experimentalCreateOnChangeEditableValue: function __experimentalCreateOnChangeEditableValue(props) { |
|
1141 |
return function (formats) { |
|
1142 |
var positions = retrieveAnnotationPositions(formats); |
|
1143 |
var removeAnnotation = props.removeAnnotation, |
|
1144 |
updateAnnotationRange = props.updateAnnotationRange, |
|
1145 |
annotations = props.annotations; |
|
1146 |
updateAnnotationsWithPositions(annotations, positions, { |
|
1147 |
removeAnnotation: removeAnnotation, |
|
1148 |
updateAnnotationRange: updateAnnotationRange |
|
1149 |
}); |
|
1150 |
}; |
|
1151 |
} |
|
1152 |
}; |
|
1153 |
|
|
1154 |
// CONCATENATED MODULE: ./node_modules/@wordpress/annotations/build-module/format/index.js |
|
1155 |
|
|
1156 |
|
|
1157 |
/** |
|
1158 |
* WordPress dependencies |
|
1159 |
*/ |
|
1160 |
|
|
1161 |
/** |
|
1162 |
* Internal dependencies |
|
1163 |
*/ |
|
1164 |
|
|
1165 |
|
|
1166 |
|
|
1167 |
var format_name = annotation_annotation.name, |
|
1168 |
settings = Object(objectWithoutProperties["a" /* default */])(annotation_annotation, ["name"]); |
|
1169 |
|
|
1170 |
Object(external_this_wp_richText_["registerFormatType"])(format_name, settings); |
|
1171 |
|
|
1172 |
// EXTERNAL MODULE: external {"this":["wp","hooks"]} |
16
|
1173 |
var external_this_wp_hooks_ = __webpack_require__(32); |
9
|
1174 |
|
|
1175 |
// CONCATENATED MODULE: ./node_modules/@wordpress/annotations/build-module/block/index.js |
|
1176 |
/** |
|
1177 |
* WordPress dependencies |
|
1178 |
*/ |
|
1179 |
|
|
1180 |
|
|
1181 |
/** |
|
1182 |
* Adds annotation className to the block-list-block component. |
|
1183 |
* |
|
1184 |
* @param {Object} OriginalComponent The original BlockListBlock component. |
|
1185 |
* @return {Object} The enhanced component. |
|
1186 |
*/ |
|
1187 |
|
|
1188 |
var block_addAnnotationClassName = function addAnnotationClassName(OriginalComponent) { |
|
1189 |
return Object(external_this_wp_data_["withSelect"])(function (select, _ref) { |
16
|
1190 |
var clientId = _ref.clientId, |
|
1191 |
className = _ref.className; |
9
|
1192 |
|
|
1193 |
var annotations = select('core/annotations').__experimentalGetAnnotationsForBlock(clientId); |
|
1194 |
|
|
1195 |
return { |
|
1196 |
className: annotations.map(function (annotation) { |
|
1197 |
return 'is-annotated-by-' + annotation.source; |
16
|
1198 |
}).concat(className).filter(Boolean).join(' ') |
9
|
1199 |
}; |
|
1200 |
})(OriginalComponent); |
|
1201 |
}; |
|
1202 |
|
|
1203 |
Object(external_this_wp_hooks_["addFilter"])('editor.BlockListBlock', 'core/annotations', block_addAnnotationClassName); |
|
1204 |
|
|
1205 |
// CONCATENATED MODULE: ./node_modules/@wordpress/annotations/build-module/index.js |
|
1206 |
/** |
|
1207 |
* Internal dependencies |
|
1208 |
*/ |
|
1209 |
|
|
1210 |
|
|
1211 |
|
|
1212 |
|
|
1213 |
|
|
1214 |
/***/ }), |
|
1215 |
|
|
1216 |
/***/ 5: |
|
1217 |
/***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
1218 |
|
|
1219 |
"use strict"; |
16
|
1220 |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _defineProperty; }); |
|
1221 |
function _defineProperty(obj, key, value) { |
|
1222 |
if (key in obj) { |
|
1223 |
Object.defineProperty(obj, key, { |
|
1224 |
value: value, |
|
1225 |
enumerable: true, |
|
1226 |
configurable: true, |
|
1227 |
writable: true |
9
|
1228 |
}); |
16
|
1229 |
} else { |
|
1230 |
obj[key] = value; |
9
|
1231 |
} |
|
1232 |
|
16
|
1233 |
return obj; |
9
|
1234 |
} |
|
1235 |
|
|
1236 |
/***/ }) |
|
1237 |
|
|
1238 |
/******/ }); |