wp/wp-includes/js/dist/blocks.js
author ymh <ymh.work@gmail.com>
Fri, 05 Sep 2025 18:40:08 +0200
changeset 21 48c4eec2b7e6
parent 19 3d72ae0968f4
child 22 8c2e4d02f4ef
permissions -rw-r--r--
Add CLAUDE.md documentation and sync WordPress core files - Add comprehensive CLAUDE.md documentation file with project architecture, development setup, database operations, WordPress CLI usage, file sync procedures, and Mercurial commands - Update WordPress core files from wordpress/ to wp/ directory - Sync latest WordPress admin interface, includes, and core functionality - Update plugins: portfolio plugin with latest BWS framework and fancybox integration - Maintain custom configuration and theme files 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
     1
/******/ (() => { // webpackBootstrap
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
     2
/******/ 	var __webpack_modules__ = ({
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
     3
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
     4
/***/ 7734:
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
     5
/***/ ((module) => {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
     6
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
     7
"use strict";
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
     8
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
     9
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
    10
// do not edit .js files directly - edit src/index.jst
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
    11
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
    12
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
    13
  var envHasBigInt64Array = typeof BigInt64Array !== 'undefined';
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
    14
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
    15
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
    16
module.exports = function equal(a, b) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
    17
  if (a === b) return true;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
    18
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
    19
  if (a && b && typeof a == 'object' && typeof b == 'object') {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
    20
    if (a.constructor !== b.constructor) return false;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
    21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
    22
    var length, i, keys;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
    23
    if (Array.isArray(a)) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
    24
      length = a.length;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
    25
      if (length != b.length) return false;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
    26
      for (i = length; i-- !== 0;)
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
    27
        if (!equal(a[i], b[i])) return false;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
    28
      return true;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
    29
    }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
    30
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
    31
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
    32
    if ((a instanceof Map) && (b instanceof Map)) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
    33
      if (a.size !== b.size) return false;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
    34
      for (i of a.entries())
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
    35
        if (!b.has(i[0])) return false;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
    36
      for (i of a.entries())
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
    37
        if (!equal(i[1], b.get(i[0]))) return false;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
    38
      return true;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
    39
    }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
    40
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
    41
    if ((a instanceof Set) && (b instanceof Set)) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
    42
      if (a.size !== b.size) return false;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
    43
      for (i of a.entries())
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
    44
        if (!b.has(i[0])) return false;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
    45
      return true;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
    46
    }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
    47
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
    48
    if (ArrayBuffer.isView(a) && ArrayBuffer.isView(b)) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
    49
      length = a.length;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
    50
      if (length != b.length) return false;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
    51
      for (i = length; i-- !== 0;)
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
    52
        if (a[i] !== b[i]) return false;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
    53
      return true;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
    54
    }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
    55
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
    56
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
    57
    if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
    58
    if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf();
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
    59
    if (a.toString !== Object.prototype.toString) return a.toString() === b.toString();
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
    60
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
    61
    keys = Object.keys(a);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
    62
    length = keys.length;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
    63
    if (length !== Object.keys(b).length) return false;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
    64
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
    65
    for (i = length; i-- !== 0;)
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
    66
      if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
    67
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
    68
    for (i = length; i-- !== 0;) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
    69
      var key = keys[i];
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
    70
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
    71
      if (!equal(a[key], b[key])) return false;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
    72
    }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
    73
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
    74
    return true;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
    75
  }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
    76
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
    77
  // true if both NaN, false otherwise
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
    78
  return a!==a && b!==b;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
    79
};
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
    80
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
    81
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
    82
/***/ }),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
    83
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
    84
/***/ 5373:
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
    85
/***/ ((__unused_webpack_module, exports) => {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
    86
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
    87
"use strict";
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
    88
var __webpack_unused_export__;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
    89
/**
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
    90
 * @license React
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
    91
 * react-is.production.min.js
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
    92
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
    93
 * Copyright (c) Facebook, Inc. and its affiliates.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
    94
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
    95
 * This source code is licensed under the MIT license found in the
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
    96
 * LICENSE file in the root directory of this source tree.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
    97
 */
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
    98
var b=Symbol.for("react.element"),c=Symbol.for("react.portal"),d=Symbol.for("react.fragment"),e=Symbol.for("react.strict_mode"),f=Symbol.for("react.profiler"),g=Symbol.for("react.provider"),h=Symbol.for("react.context"),k=Symbol.for("react.server_context"),l=Symbol.for("react.forward_ref"),m=Symbol.for("react.suspense"),n=Symbol.for("react.suspense_list"),p=Symbol.for("react.memo"),q=Symbol.for("react.lazy"),t=Symbol.for("react.offscreen"),u;u=Symbol.for("react.module.reference");
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
    99
function v(a){if("object"===typeof a&&null!==a){var r=a.$$typeof;switch(r){case b:switch(a=a.type,a){case d:case f:case e:case m:case n:return a;default:switch(a=a&&a.$$typeof,a){case k:case h:case l:case q:case p:case g:return a;default:return r}}case c:return r}}}__webpack_unused_export__=h;__webpack_unused_export__=g;__webpack_unused_export__=b;__webpack_unused_export__=l;__webpack_unused_export__=d;__webpack_unused_export__=q;__webpack_unused_export__=p;__webpack_unused_export__=c;__webpack_unused_export__=f;__webpack_unused_export__=e;__webpack_unused_export__=m;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   100
__webpack_unused_export__=n;__webpack_unused_export__=function(){return!1};__webpack_unused_export__=function(){return!1};__webpack_unused_export__=function(a){return v(a)===h};__webpack_unused_export__=function(a){return v(a)===g};__webpack_unused_export__=function(a){return"object"===typeof a&&null!==a&&a.$$typeof===b};__webpack_unused_export__=function(a){return v(a)===l};__webpack_unused_export__=function(a){return v(a)===d};__webpack_unused_export__=function(a){return v(a)===q};__webpack_unused_export__=function(a){return v(a)===p};
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   101
__webpack_unused_export__=function(a){return v(a)===c};__webpack_unused_export__=function(a){return v(a)===f};__webpack_unused_export__=function(a){return v(a)===e};__webpack_unused_export__=function(a){return v(a)===m};__webpack_unused_export__=function(a){return v(a)===n};
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   102
exports.isValidElementType=function(a){return"string"===typeof a||"function"===typeof a||a===d||a===f||a===e||a===m||a===n||a===t||"object"===typeof a&&null!==a&&(a.$$typeof===q||a.$$typeof===p||a.$$typeof===g||a.$$typeof===h||a.$$typeof===l||a.$$typeof===u||void 0!==a.getModuleId)?!0:!1};__webpack_unused_export__=v;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   103
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   104
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   105
/***/ }),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   106
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   107
/***/ 8529:
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   108
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   109
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   110
"use strict";
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   111
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   112
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   113
if (true) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   114
  module.exports = __webpack_require__(5373);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   115
} else {}
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   116
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   117
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   118
/***/ }),
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   119
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   120
/***/ 9681:
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   121
/***/ ((module) => {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   122
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   123
var characterMap = {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   124
	"À": "A",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   125
	"Á": "A",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   126
	"Â": "A",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   127
	"Ã": "A",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   128
	"Ä": "A",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   129
	"Å": "A",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   130
	"Ấ": "A",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   131
	"Ắ": "A",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   132
	"Ẳ": "A",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   133
	"Ẵ": "A",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   134
	"Ặ": "A",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   135
	"Æ": "AE",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   136
	"Ầ": "A",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   137
	"Ằ": "A",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   138
	"Ȃ": "A",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   139
	"Ả": "A",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   140
	"Ạ": "A",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   141
	"Ẩ": "A",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   142
	"Ẫ": "A",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   143
	"Ậ": "A",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   144
	"Ç": "C",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   145
	"Ḉ": "C",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   146
	"È": "E",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   147
	"É": "E",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   148
	"Ê": "E",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   149
	"Ë": "E",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   150
	"Ế": "E",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   151
	"Ḗ": "E",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   152
	"Ề": "E",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   153
	"Ḕ": "E",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   154
	"Ḝ": "E",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   155
	"Ȇ": "E",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   156
	"Ẻ": "E",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   157
	"Ẽ": "E",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   158
	"Ẹ": "E",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   159
	"Ể": "E",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   160
	"Ễ": "E",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   161
	"Ệ": "E",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   162
	"Ì": "I",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   163
	"Í": "I",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   164
	"Î": "I",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   165
	"Ï": "I",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   166
	"Ḯ": "I",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   167
	"Ȋ": "I",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   168
	"Ỉ": "I",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   169
	"Ị": "I",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   170
	"Ð": "D",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   171
	"Ñ": "N",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   172
	"Ò": "O",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   173
	"Ó": "O",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   174
	"Ô": "O",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   175
	"Õ": "O",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   176
	"Ö": "O",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   177
	"Ø": "O",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   178
	"Ố": "O",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   179
	"Ṍ": "O",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   180
	"Ṓ": "O",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   181
	"Ȏ": "O",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   182
	"Ỏ": "O",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   183
	"Ọ": "O",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   184
	"Ổ": "O",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   185
	"Ỗ": "O",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   186
	"Ộ": "O",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   187
	"Ờ": "O",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   188
	"Ở": "O",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   189
	"Ỡ": "O",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   190
	"Ớ": "O",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   191
	"Ợ": "O",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   192
	"Ù": "U",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   193
	"Ú": "U",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   194
	"Û": "U",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   195
	"Ü": "U",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   196
	"Ủ": "U",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   197
	"Ụ": "U",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   198
	"Ử": "U",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   199
	"Ữ": "U",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   200
	"Ự": "U",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   201
	"Ý": "Y",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   202
	"à": "a",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   203
	"á": "a",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   204
	"â": "a",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   205
	"ã": "a",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   206
	"ä": "a",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   207
	"å": "a",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   208
	"ấ": "a",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   209
	"ắ": "a",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   210
	"ẳ": "a",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   211
	"ẵ": "a",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   212
	"ặ": "a",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   213
	"æ": "ae",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   214
	"ầ": "a",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   215
	"ằ": "a",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   216
	"ȃ": "a",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   217
	"ả": "a",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   218
	"ạ": "a",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   219
	"ẩ": "a",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   220
	"ẫ": "a",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   221
	"ậ": "a",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   222
	"ç": "c",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   223
	"ḉ": "c",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   224
	"è": "e",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   225
	"é": "e",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   226
	"ê": "e",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   227
	"ë": "e",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   228
	"ế": "e",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   229
	"ḗ": "e",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   230
	"ề": "e",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   231
	"ḕ": "e",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   232
	"ḝ": "e",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   233
	"ȇ": "e",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   234
	"ẻ": "e",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   235
	"ẽ": "e",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   236
	"ẹ": "e",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   237
	"ể": "e",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   238
	"ễ": "e",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   239
	"ệ": "e",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   240
	"ì": "i",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   241
	"í": "i",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   242
	"î": "i",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   243
	"ï": "i",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   244
	"ḯ": "i",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   245
	"ȋ": "i",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   246
	"ỉ": "i",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   247
	"ị": "i",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   248
	"ð": "d",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   249
	"ñ": "n",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   250
	"ò": "o",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   251
	"ó": "o",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   252
	"ô": "o",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   253
	"õ": "o",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   254
	"ö": "o",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   255
	"ø": "o",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   256
	"ố": "o",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   257
	"ṍ": "o",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   258
	"ṓ": "o",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   259
	"ȏ": "o",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   260
	"ỏ": "o",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   261
	"ọ": "o",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   262
	"ổ": "o",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   263
	"ỗ": "o",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   264
	"ộ": "o",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   265
	"ờ": "o",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   266
	"ở": "o",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   267
	"ỡ": "o",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   268
	"ớ": "o",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   269
	"ợ": "o",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   270
	"ù": "u",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   271
	"ú": "u",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   272
	"û": "u",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   273
	"ü": "u",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   274
	"ủ": "u",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   275
	"ụ": "u",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   276
	"ử": "u",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   277
	"ữ": "u",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   278
	"ự": "u",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   279
	"ý": "y",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   280
	"ÿ": "y",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   281
	"Ā": "A",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   282
	"ā": "a",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   283
	"Ă": "A",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   284
	"ă": "a",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   285
	"Ą": "A",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   286
	"ą": "a",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   287
	"Ć": "C",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   288
	"ć": "c",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   289
	"Ĉ": "C",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   290
	"ĉ": "c",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   291
	"Ċ": "C",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   292
	"ċ": "c",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   293
	"Č": "C",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   294
	"č": "c",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   295
	"C̆": "C",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   296
	"c̆": "c",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   297
	"Ď": "D",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   298
	"ď": "d",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   299
	"Đ": "D",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   300
	"đ": "d",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   301
	"Ē": "E",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   302
	"ē": "e",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   303
	"Ĕ": "E",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   304
	"ĕ": "e",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   305
	"Ė": "E",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   306
	"ė": "e",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   307
	"Ę": "E",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   308
	"ę": "e",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   309
	"Ě": "E",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   310
	"ě": "e",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   311
	"Ĝ": "G",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   312
	"Ǵ": "G",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   313
	"ĝ": "g",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   314
	"ǵ": "g",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   315
	"Ğ": "G",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   316
	"ğ": "g",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   317
	"Ġ": "G",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   318
	"ġ": "g",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   319
	"Ģ": "G",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   320
	"ģ": "g",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   321
	"Ĥ": "H",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   322
	"ĥ": "h",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   323
	"Ħ": "H",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   324
	"ħ": "h",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   325
	"Ḫ": "H",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   326
	"ḫ": "h",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   327
	"Ĩ": "I",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   328
	"ĩ": "i",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   329
	"Ī": "I",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   330
	"ī": "i",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   331
	"Ĭ": "I",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   332
	"ĭ": "i",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   333
	"Į": "I",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   334
	"į": "i",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   335
	"İ": "I",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   336
	"ı": "i",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   337
	"IJ": "IJ",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   338
	"ij": "ij",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   339
	"Ĵ": "J",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   340
	"ĵ": "j",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   341
	"Ķ": "K",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   342
	"ķ": "k",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   343
	"Ḱ": "K",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   344
	"ḱ": "k",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   345
	"K̆": "K",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   346
	"k̆": "k",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   347
	"Ĺ": "L",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   348
	"ĺ": "l",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   349
	"Ļ": "L",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   350
	"ļ": "l",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   351
	"Ľ": "L",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   352
	"ľ": "l",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   353
	"Ŀ": "L",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   354
	"ŀ": "l",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   355
	"Ł": "l",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   356
	"ł": "l",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   357
	"Ḿ": "M",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   358
	"ḿ": "m",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   359
	"M̆": "M",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   360
	"m̆": "m",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   361
	"Ń": "N",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   362
	"ń": "n",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   363
	"Ņ": "N",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   364
	"ņ": "n",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   365
	"Ň": "N",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   366
	"ň": "n",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   367
	"ʼn": "n",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   368
	"N̆": "N",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   369
	"n̆": "n",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   370
	"Ō": "O",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   371
	"ō": "o",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   372
	"Ŏ": "O",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   373
	"ŏ": "o",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   374
	"Ő": "O",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   375
	"ő": "o",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   376
	"Œ": "OE",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   377
	"œ": "oe",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   378
	"P̆": "P",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   379
	"p̆": "p",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   380
	"Ŕ": "R",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   381
	"ŕ": "r",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   382
	"Ŗ": "R",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   383
	"ŗ": "r",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   384
	"Ř": "R",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   385
	"ř": "r",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   386
	"R̆": "R",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   387
	"r̆": "r",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   388
	"Ȓ": "R",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   389
	"ȓ": "r",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   390
	"Ś": "S",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   391
	"ś": "s",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   392
	"Ŝ": "S",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   393
	"ŝ": "s",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   394
	"Ş": "S",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   395
	"Ș": "S",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   396
	"ș": "s",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   397
	"ş": "s",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   398
	"Š": "S",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   399
	"š": "s",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   400
	"Ţ": "T",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   401
	"ţ": "t",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   402
	"ț": "t",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   403
	"Ț": "T",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   404
	"Ť": "T",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   405
	"ť": "t",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   406
	"Ŧ": "T",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   407
	"ŧ": "t",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   408
	"T̆": "T",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   409
	"t̆": "t",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   410
	"Ũ": "U",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   411
	"ũ": "u",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   412
	"Ū": "U",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   413
	"ū": "u",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   414
	"Ŭ": "U",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   415
	"ŭ": "u",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   416
	"Ů": "U",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   417
	"ů": "u",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   418
	"Ű": "U",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   419
	"ű": "u",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   420
	"Ų": "U",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   421
	"ų": "u",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   422
	"Ȗ": "U",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   423
	"ȗ": "u",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   424
	"V̆": "V",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   425
	"v̆": "v",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   426
	"Ŵ": "W",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   427
	"ŵ": "w",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   428
	"Ẃ": "W",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   429
	"ẃ": "w",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   430
	"X̆": "X",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   431
	"x̆": "x",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   432
	"Ŷ": "Y",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   433
	"ŷ": "y",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   434
	"Ÿ": "Y",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   435
	"Y̆": "Y",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   436
	"y̆": "y",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   437
	"Ź": "Z",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   438
	"ź": "z",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   439
	"Ż": "Z",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   440
	"ż": "z",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   441
	"Ž": "Z",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   442
	"ž": "z",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   443
	"ſ": "s",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   444
	"ƒ": "f",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   445
	"Ơ": "O",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   446
	"ơ": "o",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   447
	"Ư": "U",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   448
	"ư": "u",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   449
	"Ǎ": "A",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   450
	"ǎ": "a",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   451
	"Ǐ": "I",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   452
	"ǐ": "i",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   453
	"Ǒ": "O",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   454
	"ǒ": "o",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   455
	"Ǔ": "U",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   456
	"ǔ": "u",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   457
	"Ǖ": "U",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   458
	"ǖ": "u",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   459
	"Ǘ": "U",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   460
	"ǘ": "u",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   461
	"Ǚ": "U",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   462
	"ǚ": "u",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   463
	"Ǜ": "U",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   464
	"ǜ": "u",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   465
	"Ứ": "U",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   466
	"ứ": "u",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   467
	"Ṹ": "U",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   468
	"ṹ": "u",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   469
	"Ǻ": "A",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   470
	"ǻ": "a",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   471
	"Ǽ": "AE",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   472
	"ǽ": "ae",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   473
	"Ǿ": "O",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   474
	"ǿ": "o",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   475
	"Þ": "TH",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   476
	"þ": "th",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   477
	"Ṕ": "P",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   478
	"ṕ": "p",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   479
	"Ṥ": "S",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   480
	"ṥ": "s",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   481
	"X́": "X",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   482
	"x́": "x",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   483
	"Ѓ": "Г",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   484
	"ѓ": "г",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   485
	"Ќ": "К",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   486
	"ќ": "к",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   487
	"A̋": "A",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   488
	"a̋": "a",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   489
	"E̋": "E",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   490
	"e̋": "e",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   491
	"I̋": "I",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   492
	"i̋": "i",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   493
	"Ǹ": "N",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   494
	"ǹ": "n",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   495
	"Ồ": "O",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   496
	"ồ": "o",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   497
	"Ṑ": "O",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   498
	"ṑ": "o",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   499
	"Ừ": "U",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   500
	"ừ": "u",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   501
	"Ẁ": "W",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   502
	"ẁ": "w",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   503
	"Ỳ": "Y",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   504
	"ỳ": "y",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   505
	"Ȁ": "A",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   506
	"ȁ": "a",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   507
	"Ȅ": "E",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   508
	"ȅ": "e",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   509
	"Ȉ": "I",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   510
	"ȉ": "i",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   511
	"Ȍ": "O",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   512
	"ȍ": "o",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   513
	"Ȑ": "R",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   514
	"ȑ": "r",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   515
	"Ȕ": "U",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   516
	"ȕ": "u",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   517
	"B̌": "B",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   518
	"b̌": "b",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   519
	"Č̣": "C",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   520
	"č̣": "c",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   521
	"Ê̌": "E",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   522
	"ê̌": "e",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   523
	"F̌": "F",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   524
	"f̌": "f",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   525
	"Ǧ": "G",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   526
	"ǧ": "g",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   527
	"Ȟ": "H",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   528
	"ȟ": "h",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   529
	"J̌": "J",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   530
	"ǰ": "j",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   531
	"Ǩ": "K",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   532
	"ǩ": "k",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   533
	"M̌": "M",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   534
	"m̌": "m",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   535
	"P̌": "P",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   536
	"p̌": "p",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   537
	"Q̌": "Q",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   538
	"q̌": "q",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   539
	"Ř̩": "R",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   540
	"ř̩": "r",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   541
	"Ṧ": "S",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   542
	"ṧ": "s",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   543
	"V̌": "V",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   544
	"v̌": "v",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   545
	"W̌": "W",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   546
	"w̌": "w",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   547
	"X̌": "X",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   548
	"x̌": "x",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   549
	"Y̌": "Y",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   550
	"y̌": "y",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   551
	"A̧": "A",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   552
	"a̧": "a",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   553
	"B̧": "B",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   554
	"b̧": "b",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   555
	"Ḑ": "D",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   556
	"ḑ": "d",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   557
	"Ȩ": "E",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   558
	"ȩ": "e",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   559
	"Ɛ̧": "E",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   560
	"ɛ̧": "e",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   561
	"Ḩ": "H",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   562
	"ḩ": "h",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   563
	"I̧": "I",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   564
	"i̧": "i",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   565
	"Ɨ̧": "I",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   566
	"ɨ̧": "i",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   567
	"M̧": "M",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   568
	"m̧": "m",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   569
	"O̧": "O",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   570
	"o̧": "o",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   571
	"Q̧": "Q",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   572
	"q̧": "q",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   573
	"U̧": "U",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   574
	"u̧": "u",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   575
	"X̧": "X",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   576
	"x̧": "x",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   577
	"Z̧": "Z",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   578
	"z̧": "z",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   579
	"й":"и",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   580
	"Й":"И",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   581
	"ё":"е",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   582
	"Ё":"Е",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   583
};
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   584
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   585
var chars = Object.keys(characterMap).join('|');
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   586
var allAccents = new RegExp(chars, 'g');
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   587
var firstAccent = new RegExp(chars, '');
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   588
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   589
function matcher(match) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   590
	return characterMap[match];
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   591
}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   592
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   593
var removeAccents = function(string) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   594
	return string.replace(allAccents, matcher);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   595
};
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   596
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   597
var hasAccents = function(string) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   598
	return !!string.match(firstAccent);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   599
};
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   600
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   601
module.exports = removeAccents;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   602
module.exports.has = hasAccents;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   603
module.exports.remove = removeAccents;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   604
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   605
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   606
/***/ }),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   607
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   608
/***/ 1030:
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   609
/***/ (function(module, exports, __webpack_require__) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   610
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   611
var __WEBPACK_AMD_DEFINE_RESULT__;;/*! showdown v 1.9.1 - 02-11-2019 */
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   612
(function(){
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   613
/**
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   614
 * Created by Tivie on 13-07-2015.
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   615
 */
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   616
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   617
function getDefaultOpts (simple) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   618
  'use strict';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   619
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   620
  var defaultOptions = {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   621
    omitExtraWLInCodeBlocks: {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   622
      defaultValue: false,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   623
      describe: 'Omit the default extra whiteline added to code blocks',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   624
      type: 'boolean'
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   625
    },
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   626
    noHeaderId: {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   627
      defaultValue: false,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   628
      describe: 'Turn on/off generated header id',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   629
      type: 'boolean'
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   630
    },
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   631
    prefixHeaderId: {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   632
      defaultValue: false,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   633
      describe: 'Add a prefix to the generated header ids. Passing a string will prefix that string to the header id. Setting to true will add a generic \'section-\' prefix',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   634
      type: 'string'
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   635
    },
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   636
    rawPrefixHeaderId: {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   637
      defaultValue: false,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   638
      describe: 'Setting this option to true will prevent showdown from modifying the prefix. This might result in malformed IDs (if, for instance, the " char is used in the prefix)',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   639
      type: 'boolean'
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   640
    },
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   641
    ghCompatibleHeaderId: {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   642
      defaultValue: false,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   643
      describe: 'Generate header ids compatible with github style (spaces are replaced with dashes, a bunch of non alphanumeric chars are removed)',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   644
      type: 'boolean'
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   645
    },
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   646
    rawHeaderId: {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   647
      defaultValue: false,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   648
      describe: 'Remove only spaces, \' and " from generated header ids (including prefixes), replacing them with dashes (-). WARNING: This might result in malformed ids',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   649
      type: 'boolean'
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   650
    },
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   651
    headerLevelStart: {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   652
      defaultValue: false,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   653
      describe: 'The header blocks level start',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   654
      type: 'integer'
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   655
    },
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   656
    parseImgDimensions: {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   657
      defaultValue: false,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   658
      describe: 'Turn on/off image dimension parsing',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   659
      type: 'boolean'
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   660
    },
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   661
    simplifiedAutoLink: {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   662
      defaultValue: false,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   663
      describe: 'Turn on/off GFM autolink style',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   664
      type: 'boolean'
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   665
    },
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   666
    excludeTrailingPunctuationFromURLs: {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   667
      defaultValue: false,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   668
      describe: 'Excludes trailing punctuation from links generated with autoLinking',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   669
      type: 'boolean'
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   670
    },
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   671
    literalMidWordUnderscores: {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   672
      defaultValue: false,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   673
      describe: 'Parse midword underscores as literal underscores',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   674
      type: 'boolean'
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   675
    },
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   676
    literalMidWordAsterisks: {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   677
      defaultValue: false,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   678
      describe: 'Parse midword asterisks as literal asterisks',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   679
      type: 'boolean'
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   680
    },
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   681
    strikethrough: {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   682
      defaultValue: false,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   683
      describe: 'Turn on/off strikethrough support',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   684
      type: 'boolean'
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   685
    },
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   686
    tables: {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   687
      defaultValue: false,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   688
      describe: 'Turn on/off tables support',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   689
      type: 'boolean'
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   690
    },
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   691
    tablesHeaderId: {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   692
      defaultValue: false,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   693
      describe: 'Add an id to table headers',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   694
      type: 'boolean'
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   695
    },
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   696
    ghCodeBlocks: {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   697
      defaultValue: true,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   698
      describe: 'Turn on/off GFM fenced code blocks support',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   699
      type: 'boolean'
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   700
    },
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   701
    tasklists: {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   702
      defaultValue: false,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   703
      describe: 'Turn on/off GFM tasklist support',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   704
      type: 'boolean'
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   705
    },
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   706
    smoothLivePreview: {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   707
      defaultValue: false,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   708
      describe: 'Prevents weird effects in live previews due to incomplete input',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   709
      type: 'boolean'
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   710
    },
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   711
    smartIndentationFix: {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   712
      defaultValue: false,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   713
      description: 'Tries to smartly fix indentation in es6 strings',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   714
      type: 'boolean'
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   715
    },
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   716
    disableForced4SpacesIndentedSublists: {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   717
      defaultValue: false,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   718
      description: 'Disables the requirement of indenting nested sublists by 4 spaces',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   719
      type: 'boolean'
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   720
    },
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   721
    simpleLineBreaks: {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   722
      defaultValue: false,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   723
      description: 'Parses simple line breaks as <br> (GFM Style)',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   724
      type: 'boolean'
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   725
    },
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   726
    requireSpaceBeforeHeadingText: {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   727
      defaultValue: false,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   728
      description: 'Makes adding a space between `#` and the header text mandatory (GFM Style)',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   729
      type: 'boolean'
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   730
    },
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   731
    ghMentions: {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   732
      defaultValue: false,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   733
      description: 'Enables github @mentions',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   734
      type: 'boolean'
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   735
    },
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   736
    ghMentionsLink: {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   737
      defaultValue: 'https://github.com/{u}',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   738
      description: 'Changes the link generated by @mentions. Only applies if ghMentions option is enabled.',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   739
      type: 'string'
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   740
    },
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   741
    encodeEmails: {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   742
      defaultValue: true,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   743
      description: 'Encode e-mail addresses through the use of Character Entities, transforming ASCII e-mail addresses into its equivalent decimal entities',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   744
      type: 'boolean'
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   745
    },
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   746
    openLinksInNewWindow: {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   747
      defaultValue: false,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   748
      description: 'Open all links in new windows',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   749
      type: 'boolean'
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   750
    },
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   751
    backslashEscapesHTMLTags: {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   752
      defaultValue: false,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   753
      description: 'Support for HTML Tag escaping. ex: \<div>foo\</div>',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   754
      type: 'boolean'
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   755
    },
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   756
    emoji: {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   757
      defaultValue: false,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   758
      description: 'Enable emoji support. Ex: `this is a :smile: emoji`',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   759
      type: 'boolean'
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   760
    },
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   761
    underline: {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   762
      defaultValue: false,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   763
      description: 'Enable support for underline. Syntax is double or triple underscores: `__underline word__`. With this option enabled, underscores no longer parses into `<em>` and `<strong>`',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   764
      type: 'boolean'
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   765
    },
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   766
    completeHTMLDocument: {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   767
      defaultValue: false,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   768
      description: 'Outputs a complete html document, including `<html>`, `<head>` and `<body>` tags',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   769
      type: 'boolean'
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   770
    },
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   771
    metadata: {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   772
      defaultValue: false,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   773
      description: 'Enable support for document metadata (defined at the top of the document between `«««` and `»»»` or between `---` and `---`).',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   774
      type: 'boolean'
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   775
    },
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   776
    splitAdjacentBlockquotes: {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   777
      defaultValue: false,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   778
      description: 'Split adjacent blockquote blocks',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   779
      type: 'boolean'
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   780
    }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   781
  };
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   782
  if (simple === false) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   783
    return JSON.parse(JSON.stringify(defaultOptions));
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   784
  }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   785
  var ret = {};
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   786
  for (var opt in defaultOptions) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   787
    if (defaultOptions.hasOwnProperty(opt)) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   788
      ret[opt] = defaultOptions[opt].defaultValue;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   789
    }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   790
  }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   791
  return ret;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   792
}
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   793
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   794
function allOptionsOn () {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   795
  'use strict';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   796
  var options = getDefaultOpts(true),
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   797
      ret = {};
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   798
  for (var opt in options) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   799
    if (options.hasOwnProperty(opt)) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   800
      ret[opt] = true;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   801
    }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   802
  }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   803
  return ret;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   804
}
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   805
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   806
/**
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   807
 * Created by Tivie on 06-01-2015.
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   808
 */
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   809
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   810
// Private properties
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   811
var showdown = {},
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   812
    parsers = {},
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   813
    extensions = {},
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   814
    globalOptions = getDefaultOpts(true),
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   815
    setFlavor = 'vanilla',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   816
    flavor = {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   817
      github: {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   818
        omitExtraWLInCodeBlocks:              true,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   819
        simplifiedAutoLink:                   true,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   820
        excludeTrailingPunctuationFromURLs:   true,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   821
        literalMidWordUnderscores:            true,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   822
        strikethrough:                        true,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   823
        tables:                               true,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   824
        tablesHeaderId:                       true,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   825
        ghCodeBlocks:                         true,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   826
        tasklists:                            true,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   827
        disableForced4SpacesIndentedSublists: true,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   828
        simpleLineBreaks:                     true,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   829
        requireSpaceBeforeHeadingText:        true,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   830
        ghCompatibleHeaderId:                 true,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   831
        ghMentions:                           true,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   832
        backslashEscapesHTMLTags:             true,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   833
        emoji:                                true,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   834
        splitAdjacentBlockquotes:             true
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   835
      },
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   836
      original: {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   837
        noHeaderId:                           true,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   838
        ghCodeBlocks:                         false
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   839
      },
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   840
      ghost: {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   841
        omitExtraWLInCodeBlocks:              true,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   842
        parseImgDimensions:                   true,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   843
        simplifiedAutoLink:                   true,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   844
        excludeTrailingPunctuationFromURLs:   true,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   845
        literalMidWordUnderscores:            true,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   846
        strikethrough:                        true,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   847
        tables:                               true,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   848
        tablesHeaderId:                       true,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   849
        ghCodeBlocks:                         true,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   850
        tasklists:                            true,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   851
        smoothLivePreview:                    true,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   852
        simpleLineBreaks:                     true,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   853
        requireSpaceBeforeHeadingText:        true,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   854
        ghMentions:                           false,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   855
        encodeEmails:                         true
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   856
      },
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   857
      vanilla: getDefaultOpts(true),
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   858
      allOn: allOptionsOn()
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   859
    };
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   860
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   861
/**
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   862
 * helper namespace
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   863
 * @type {{}}
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   864
 */
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   865
showdown.helper = {};
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   866
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   867
/**
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   868
 * TODO LEGACY SUPPORT CODE
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   869
 * @type {{}}
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   870
 */
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   871
showdown.extensions = {};
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   872
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   873
/**
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   874
 * Set a global option
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   875
 * @static
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   876
 * @param {string} key
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   877
 * @param {*} value
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   878
 * @returns {showdown}
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   879
 */
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   880
showdown.setOption = function (key, value) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   881
  'use strict';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   882
  globalOptions[key] = value;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   883
  return this;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   884
};
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   885
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   886
/**
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   887
 * Get a global option
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   888
 * @static
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   889
 * @param {string} key
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   890
 * @returns {*}
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   891
 */
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   892
showdown.getOption = function (key) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   893
  'use strict';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   894
  return globalOptions[key];
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   895
};
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   896
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   897
/**
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   898
 * Get the global options
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   899
 * @static
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   900
 * @returns {{}}
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   901
 */
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   902
showdown.getOptions = function () {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   903
  'use strict';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   904
  return globalOptions;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   905
};
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   906
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   907
/**
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   908
 * Reset global options to the default values
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   909
 * @static
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   910
 */
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   911
showdown.resetOptions = function () {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   912
  'use strict';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   913
  globalOptions = getDefaultOpts(true);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   914
};
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   915
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   916
/**
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   917
 * Set the flavor showdown should use as default
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   918
 * @param {string} name
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   919
 */
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   920
showdown.setFlavor = function (name) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   921
  'use strict';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   922
  if (!flavor.hasOwnProperty(name)) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   923
    throw Error(name + ' flavor was not found');
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   924
  }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   925
  showdown.resetOptions();
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   926
  var preset = flavor[name];
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   927
  setFlavor = name;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   928
  for (var option in preset) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   929
    if (preset.hasOwnProperty(option)) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   930
      globalOptions[option] = preset[option];
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   931
    }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   932
  }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   933
};
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   934
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   935
/**
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   936
 * Get the currently set flavor
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   937
 * @returns {string}
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   938
 */
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   939
showdown.getFlavor = function () {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   940
  'use strict';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   941
  return setFlavor;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   942
};
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   943
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   944
/**
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   945
 * Get the options of a specified flavor. Returns undefined if the flavor was not found
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   946
 * @param {string} name Name of the flavor
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   947
 * @returns {{}|undefined}
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   948
 */
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   949
showdown.getFlavorOptions = function (name) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   950
  'use strict';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   951
  if (flavor.hasOwnProperty(name)) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   952
    return flavor[name];
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   953
  }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   954
};
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   955
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   956
/**
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   957
 * Get the default options
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   958
 * @static
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   959
 * @param {boolean} [simple=true]
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   960
 * @returns {{}}
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   961
 */
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   962
showdown.getDefaultOptions = function (simple) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   963
  'use strict';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   964
  return getDefaultOpts(simple);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   965
};
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   966
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   967
/**
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   968
 * Get or set a subParser
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   969
 *
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   970
 * subParser(name)       - Get a registered subParser
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   971
 * subParser(name, func) - Register a subParser
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   972
 * @static
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   973
 * @param {string} name
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   974
 * @param {function} [func]
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   975
 * @returns {*}
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   976
 */
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   977
showdown.subParser = function (name, func) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   978
  'use strict';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   979
  if (showdown.helper.isString(name)) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   980
    if (typeof func !== 'undefined') {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   981
      parsers[name] = func;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   982
    } else {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   983
      if (parsers.hasOwnProperty(name)) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   984
        return parsers[name];
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   985
      } else {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   986
        throw Error('SubParser named ' + name + ' not registered!');
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   987
      }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   988
    }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   989
  }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   990
};
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   991
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   992
/**
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   993
 * Gets or registers an extension
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   994
 * @static
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   995
 * @param {string} name
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   996
 * @param {object|function=} ext
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   997
 * @returns {*}
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   998
 */
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
   999
showdown.extension = function (name, ext) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1000
  'use strict';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1001
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1002
  if (!showdown.helper.isString(name)) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1003
    throw Error('Extension \'name\' must be a string');
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1004
  }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1005
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1006
  name = showdown.helper.stdExtName(name);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1007
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1008
  // Getter
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1009
  if (showdown.helper.isUndefined(ext)) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1010
    if (!extensions.hasOwnProperty(name)) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1011
      throw Error('Extension named ' + name + ' is not registered!');
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1012
    }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1013
    return extensions[name];
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1014
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1015
    // Setter
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1016
  } else {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1017
    // Expand extension if it's wrapped in a function
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1018
    if (typeof ext === 'function') {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1019
      ext = ext();
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1020
    }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1021
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1022
    // Ensure extension is an array
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1023
    if (!showdown.helper.isArray(ext)) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1024
      ext = [ext];
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1025
    }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1026
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1027
    var validExtension = validate(ext, name);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1028
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1029
    if (validExtension.valid) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1030
      extensions[name] = ext;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1031
    } else {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1032
      throw Error(validExtension.error);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1033
    }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1034
  }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1035
};
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1036
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1037
/**
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1038
 * Gets all extensions registered
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1039
 * @returns {{}}
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1040
 */
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1041
showdown.getAllExtensions = function () {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1042
  'use strict';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1043
  return extensions;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1044
};
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1045
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1046
/**
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1047
 * Remove an extension
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1048
 * @param {string} name
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1049
 */
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1050
showdown.removeExtension = function (name) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1051
  'use strict';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1052
  delete extensions[name];
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1053
};
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1054
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1055
/**
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1056
 * Removes all extensions
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1057
 */
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1058
showdown.resetExtensions = function () {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1059
  'use strict';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1060
  extensions = {};
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1061
};
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1062
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1063
/**
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1064
 * Validate extension
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1065
 * @param {array} extension
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1066
 * @param {string} name
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1067
 * @returns {{valid: boolean, error: string}}
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1068
 */
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1069
function validate (extension, name) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1070
  'use strict';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1071
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1072
  var errMsg = (name) ? 'Error in ' + name + ' extension->' : 'Error in unnamed extension',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1073
      ret = {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1074
        valid: true,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1075
        error: ''
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1076
      };
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1077
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1078
  if (!showdown.helper.isArray(extension)) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1079
    extension = [extension];
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1080
  }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1081
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1082
  for (var i = 0; i < extension.length; ++i) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1083
    var baseMsg = errMsg + ' sub-extension ' + i + ': ',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1084
        ext = extension[i];
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1085
    if (typeof ext !== 'object') {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1086
      ret.valid = false;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1087
      ret.error = baseMsg + 'must be an object, but ' + typeof ext + ' given';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1088
      return ret;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1089
    }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1090
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1091
    if (!showdown.helper.isString(ext.type)) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1092
      ret.valid = false;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1093
      ret.error = baseMsg + 'property "type" must be a string, but ' + typeof ext.type + ' given';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1094
      return ret;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1095
    }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1096
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1097
    var type = ext.type = ext.type.toLowerCase();
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1098
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1099
    // normalize extension type
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1100
    if (type === 'language') {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1101
      type = ext.type = 'lang';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1102
    }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1103
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1104
    if (type === 'html') {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1105
      type = ext.type = 'output';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1106
    }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1107
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1108
    if (type !== 'lang' && type !== 'output' && type !== 'listener') {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1109
      ret.valid = false;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1110
      ret.error = baseMsg + 'type ' + type + ' is not recognized. Valid values: "lang/language", "output/html" or "listener"';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1111
      return ret;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1112
    }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1113
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1114
    if (type === 'listener') {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1115
      if (showdown.helper.isUndefined(ext.listeners)) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1116
        ret.valid = false;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1117
        ret.error = baseMsg + '. Extensions of type "listener" must have a property called "listeners"';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1118
        return ret;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1119
      }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1120
    } else {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1121
      if (showdown.helper.isUndefined(ext.filter) && showdown.helper.isUndefined(ext.regex)) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1122
        ret.valid = false;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1123
        ret.error = baseMsg + type + ' extensions must define either a "regex" property or a "filter" method';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1124
        return ret;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1125
      }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1126
    }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1127
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1128
    if (ext.listeners) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1129
      if (typeof ext.listeners !== 'object') {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1130
        ret.valid = false;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1131
        ret.error = baseMsg + '"listeners" property must be an object but ' + typeof ext.listeners + ' given';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1132
        return ret;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1133
      }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1134
      for (var ln in ext.listeners) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1135
        if (ext.listeners.hasOwnProperty(ln)) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1136
          if (typeof ext.listeners[ln] !== 'function') {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1137
            ret.valid = false;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1138
            ret.error = baseMsg + '"listeners" property must be an hash of [event name]: [callback]. listeners.' + ln +
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1139
              ' must be a function but ' + typeof ext.listeners[ln] + ' given';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1140
            return ret;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1141
          }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1142
        }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1143
      }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1144
    }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1145
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1146
    if (ext.filter) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1147
      if (typeof ext.filter !== 'function') {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1148
        ret.valid = false;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1149
        ret.error = baseMsg + '"filter" must be a function, but ' + typeof ext.filter + ' given';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1150
        return ret;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1151
      }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1152
    } else if (ext.regex) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1153
      if (showdown.helper.isString(ext.regex)) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1154
        ext.regex = new RegExp(ext.regex, 'g');
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1155
      }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1156
      if (!(ext.regex instanceof RegExp)) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1157
        ret.valid = false;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1158
        ret.error = baseMsg + '"regex" property must either be a string or a RegExp object, but ' + typeof ext.regex + ' given';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1159
        return ret;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1160
      }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1161
      if (showdown.helper.isUndefined(ext.replace)) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1162
        ret.valid = false;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1163
        ret.error = baseMsg + '"regex" extensions must implement a replace string or function';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1164
        return ret;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1165
      }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1166
    }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1167
  }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1168
  return ret;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1169
}
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1170
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1171
/**
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1172
 * Validate extension
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1173
 * @param {object} ext
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1174
 * @returns {boolean}
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1175
 */
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1176
showdown.validateExtension = function (ext) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1177
  'use strict';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1178
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1179
  var validateExtension = validate(ext, null);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1180
  if (!validateExtension.valid) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1181
    console.warn(validateExtension.error);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1182
    return false;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1183
  }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1184
  return true;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1185
};
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1186
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1187
/**
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1188
 * showdownjs helper functions
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1189
 */
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1190
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1191
if (!showdown.hasOwnProperty('helper')) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1192
  showdown.helper = {};
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1193
}
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1194
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1195
/**
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1196
 * Check if var is string
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1197
 * @static
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1198
 * @param {string} a
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1199
 * @returns {boolean}
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1200
 */
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1201
showdown.helper.isString = function (a) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1202
  'use strict';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1203
  return (typeof a === 'string' || a instanceof String);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1204
};
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1205
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1206
/**
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1207
 * Check if var is a function
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1208
 * @static
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1209
 * @param {*} a
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1210
 * @returns {boolean}
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1211
 */
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1212
showdown.helper.isFunction = function (a) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1213
  'use strict';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1214
  var getType = {};
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1215
  return a && getType.toString.call(a) === '[object Function]';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1216
};
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1217
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1218
/**
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1219
 * isArray helper function
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1220
 * @static
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1221
 * @param {*} a
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1222
 * @returns {boolean}
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1223
 */
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1224
showdown.helper.isArray = function (a) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1225
  'use strict';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1226
  return Array.isArray(a);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1227
};
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1228
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1229
/**
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1230
 * Check if value is undefined
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1231
 * @static
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1232
 * @param {*} value The value to check.
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1233
 * @returns {boolean} Returns `true` if `value` is `undefined`, else `false`.
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1234
 */
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1235
showdown.helper.isUndefined = function (value) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1236
  'use strict';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1237
  return typeof value === 'undefined';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1238
};
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1239
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1240
/**
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1241
 * ForEach helper function
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1242
 * Iterates over Arrays and Objects (own properties only)
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1243
 * @static
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1244
 * @param {*} obj
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1245
 * @param {function} callback Accepts 3 params: 1. value, 2. key, 3. the original array/object
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1246
 */
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1247
showdown.helper.forEach = function (obj, callback) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1248
  'use strict';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1249
  // check if obj is defined
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1250
  if (showdown.helper.isUndefined(obj)) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1251
    throw new Error('obj param is required');
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1252
  }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1253
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1254
  if (showdown.helper.isUndefined(callback)) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1255
    throw new Error('callback param is required');
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1256
  }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1257
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1258
  if (!showdown.helper.isFunction(callback)) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1259
    throw new Error('callback param must be a function/closure');
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1260
  }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1261
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1262
  if (typeof obj.forEach === 'function') {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1263
    obj.forEach(callback);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1264
  } else if (showdown.helper.isArray(obj)) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1265
    for (var i = 0; i < obj.length; i++) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1266
      callback(obj[i], i, obj);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1267
    }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1268
  } else if (typeof (obj) === 'object') {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1269
    for (var prop in obj) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1270
      if (obj.hasOwnProperty(prop)) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1271
        callback(obj[prop], prop, obj);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1272
      }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1273
    }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1274
  } else {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1275
    throw new Error('obj does not seem to be an array or an iterable object');
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1276
  }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1277
};
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1278
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1279
/**
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1280
 * Standardidize extension name
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1281
 * @static
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1282
 * @param {string} s extension name
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1283
 * @returns {string}
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1284
 */
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1285
showdown.helper.stdExtName = function (s) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1286
  'use strict';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1287
  return s.replace(/[_?*+\/\\.^-]/g, '').replace(/\s/g, '').toLowerCase();
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1288
};
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1289
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1290
function escapeCharactersCallback (wholeMatch, m1) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1291
  'use strict';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1292
  var charCodeToEscape = m1.charCodeAt(0);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1293
  return '¨E' + charCodeToEscape + 'E';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1294
}
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1295
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1296
/**
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1297
 * Callback used to escape characters when passing through String.replace
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1298
 * @static
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1299
 * @param {string} wholeMatch
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1300
 * @param {string} m1
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1301
 * @returns {string}
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1302
 */
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1303
showdown.helper.escapeCharactersCallback = escapeCharactersCallback;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1304
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1305
/**
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1306
 * Escape characters in a string
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1307
 * @static
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1308
 * @param {string} text
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1309
 * @param {string} charsToEscape
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1310
 * @param {boolean} afterBackslash
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1311
 * @returns {XML|string|void|*}
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1312
 */
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1313
showdown.helper.escapeCharacters = function (text, charsToEscape, afterBackslash) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1314
  'use strict';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1315
  // First we have to escape the escape characters so that
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1316
  // we can build a character class out of them
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1317
  var regexString = '([' + charsToEscape.replace(/([\[\]\\])/g, '\\$1') + '])';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1318
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1319
  if (afterBackslash) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1320
    regexString = '\\\\' + regexString;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1321
  }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1322
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1323
  var regex = new RegExp(regexString, 'g');
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1324
  text = text.replace(regex, escapeCharactersCallback);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1325
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1326
  return text;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1327
};
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1328
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1329
/**
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1330
 * Unescape HTML entities
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1331
 * @param txt
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1332
 * @returns {string}
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1333
 */
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1334
showdown.helper.unescapeHTMLEntities = function (txt) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1335
  'use strict';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1336
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1337
  return txt
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1338
    .replace(/&quot;/g, '"')
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1339
    .replace(/&lt;/g, '<')
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1340
    .replace(/&gt;/g, '>')
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1341
    .replace(/&amp;/g, '&');
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1342
};
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1343
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1344
var rgxFindMatchPos = function (str, left, right, flags) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1345
  'use strict';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1346
  var f = flags || '',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1347
      g = f.indexOf('g') > -1,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1348
      x = new RegExp(left + '|' + right, 'g' + f.replace(/g/g, '')),
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1349
      l = new RegExp(left, f.replace(/g/g, '')),
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1350
      pos = [],
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1351
      t, s, m, start, end;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1352
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1353
  do {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1354
    t = 0;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1355
    while ((m = x.exec(str))) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1356
      if (l.test(m[0])) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1357
        if (!(t++)) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1358
          s = x.lastIndex;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1359
          start = s - m[0].length;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1360
        }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1361
      } else if (t) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1362
        if (!--t) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1363
          end = m.index + m[0].length;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1364
          var obj = {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1365
            left: {start: start, end: s},
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1366
            match: {start: s, end: m.index},
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1367
            right: {start: m.index, end: end},
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1368
            wholeMatch: {start: start, end: end}
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1369
          };
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1370
          pos.push(obj);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1371
          if (!g) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1372
            return pos;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1373
          }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1374
        }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1375
      }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1376
    }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1377
  } while (t && (x.lastIndex = s));
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1378
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1379
  return pos;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1380
};
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1381
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1382
/**
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1383
 * matchRecursiveRegExp
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1384
 *
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1385
 * (c) 2007 Steven Levithan <stevenlevithan.com>
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1386
 * MIT License
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1387
 *
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1388
 * Accepts a string to search, a left and right format delimiter
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1389
 * as regex patterns, and optional regex flags. Returns an array
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1390
 * of matches, allowing nested instances of left/right delimiters.
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1391
 * Use the "g" flag to return all matches, otherwise only the
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1392
 * first is returned. Be careful to ensure that the left and
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1393
 * right format delimiters produce mutually exclusive matches.
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1394
 * Backreferences are not supported within the right delimiter
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1395
 * due to how it is internally combined with the left delimiter.
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1396
 * When matching strings whose format delimiters are unbalanced
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1397
 * to the left or right, the output is intentionally as a
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1398
 * conventional regex library with recursion support would
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1399
 * produce, e.g. "<<x>" and "<x>>" both produce ["x"] when using
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1400
 * "<" and ">" as the delimiters (both strings contain a single,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1401
 * balanced instance of "<x>").
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1402
 *
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1403
 * examples:
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1404
 * matchRecursiveRegExp("test", "\\(", "\\)")
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1405
 * returns: []
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1406
 * matchRecursiveRegExp("<t<<e>><s>>t<>", "<", ">", "g")
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1407
 * returns: ["t<<e>><s>", ""]
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1408
 * matchRecursiveRegExp("<div id=\"x\">test</div>", "<div\\b[^>]*>", "</div>", "gi")
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1409
 * returns: ["test"]
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1410
 */
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1411
showdown.helper.matchRecursiveRegExp = function (str, left, right, flags) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1412
  'use strict';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1413
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1414
  var matchPos = rgxFindMatchPos (str, left, right, flags),
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1415
      results = [];
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1416
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1417
  for (var i = 0; i < matchPos.length; ++i) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1418
    results.push([
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1419
      str.slice(matchPos[i].wholeMatch.start, matchPos[i].wholeMatch.end),
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1420
      str.slice(matchPos[i].match.start, matchPos[i].match.end),
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1421
      str.slice(matchPos[i].left.start, matchPos[i].left.end),
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1422
      str.slice(matchPos[i].right.start, matchPos[i].right.end)
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1423
    ]);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1424
  }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1425
  return results;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1426
};
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1427
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1428
/**
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1429
 *
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1430
 * @param {string} str
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1431
 * @param {string|function} replacement
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1432
 * @param {string} left
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1433
 * @param {string} right
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1434
 * @param {string} flags
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1435
 * @returns {string}
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1436
 */
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1437
showdown.helper.replaceRecursiveRegExp = function (str, replacement, left, right, flags) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1438
  'use strict';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1439
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1440
  if (!showdown.helper.isFunction(replacement)) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1441
    var repStr = replacement;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1442
    replacement = function () {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1443
      return repStr;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1444
    };
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1445
  }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1446
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1447
  var matchPos = rgxFindMatchPos(str, left, right, flags),
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1448
      finalStr = str,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1449
      lng = matchPos.length;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1450
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1451
  if (lng > 0) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1452
    var bits = [];
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1453
    if (matchPos[0].wholeMatch.start !== 0) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1454
      bits.push(str.slice(0, matchPos[0].wholeMatch.start));
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1455
    }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1456
    for (var i = 0; i < lng; ++i) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1457
      bits.push(
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1458
        replacement(
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1459
          str.slice(matchPos[i].wholeMatch.start, matchPos[i].wholeMatch.end),
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1460
          str.slice(matchPos[i].match.start, matchPos[i].match.end),
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1461
          str.slice(matchPos[i].left.start, matchPos[i].left.end),
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1462
          str.slice(matchPos[i].right.start, matchPos[i].right.end)
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1463
        )
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1464
      );
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1465
      if (i < lng - 1) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1466
        bits.push(str.slice(matchPos[i].wholeMatch.end, matchPos[i + 1].wholeMatch.start));
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1467
      }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1468
    }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1469
    if (matchPos[lng - 1].wholeMatch.end < str.length) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1470
      bits.push(str.slice(matchPos[lng - 1].wholeMatch.end));
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1471
    }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1472
    finalStr = bits.join('');
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1473
  }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1474
  return finalStr;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1475
};
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1476
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1477
/**
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1478
 * Returns the index within the passed String object of the first occurrence of the specified regex,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1479
 * starting the search at fromIndex. Returns -1 if the value is not found.
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1480
 *
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1481
 * @param {string} str string to search
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1482
 * @param {RegExp} regex Regular expression to search
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1483
 * @param {int} [fromIndex = 0] Index to start the search
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1484
 * @returns {Number}
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1485
 * @throws InvalidArgumentError
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1486
 */
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1487
showdown.helper.regexIndexOf = function (str, regex, fromIndex) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1488
  'use strict';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1489
  if (!showdown.helper.isString(str)) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1490
    throw 'InvalidArgumentError: first parameter of showdown.helper.regexIndexOf function must be a string';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1491
  }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1492
  if (regex instanceof RegExp === false) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1493
    throw 'InvalidArgumentError: second parameter of showdown.helper.regexIndexOf function must be an instance of RegExp';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1494
  }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1495
  var indexOf = str.substring(fromIndex || 0).search(regex);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1496
  return (indexOf >= 0) ? (indexOf + (fromIndex || 0)) : indexOf;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1497
};
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1498
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1499
/**
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1500
 * Splits the passed string object at the defined index, and returns an array composed of the two substrings
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1501
 * @param {string} str string to split
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1502
 * @param {int} index index to split string at
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1503
 * @returns {[string,string]}
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1504
 * @throws InvalidArgumentError
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1505
 */
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1506
showdown.helper.splitAtIndex = function (str, index) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1507
  'use strict';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1508
  if (!showdown.helper.isString(str)) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1509
    throw 'InvalidArgumentError: first parameter of showdown.helper.regexIndexOf function must be a string';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1510
  }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1511
  return [str.substring(0, index), str.substring(index)];
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1512
};
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1513
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1514
/**
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1515
 * Obfuscate an e-mail address through the use of Character Entities,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1516
 * transforming ASCII characters into their equivalent decimal or hex entities.
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1517
 *
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1518
 * Since it has a random component, subsequent calls to this function produce different results
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1519
 *
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1520
 * @param {string} mail
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1521
 * @returns {string}
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1522
 */
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1523
showdown.helper.encodeEmailAddress = function (mail) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1524
  'use strict';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1525
  var encode = [
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1526
    function (ch) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1527
      return '&#' + ch.charCodeAt(0) + ';';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1528
    },
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1529
    function (ch) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1530
      return '&#x' + ch.charCodeAt(0).toString(16) + ';';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1531
    },
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1532
    function (ch) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1533
      return ch;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1534
    }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1535
  ];
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1536
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1537
  mail = mail.replace(/./g, function (ch) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1538
    if (ch === '@') {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1539
      // this *must* be encoded. I insist.
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1540
      ch = encode[Math.floor(Math.random() * 2)](ch);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1541
    } else {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1542
      var r = Math.random();
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1543
      // roughly 10% raw, 45% hex, 45% dec
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1544
      ch = (
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1545
        r > 0.9 ? encode[2](ch) : r > 0.45 ? encode[1](ch) : encode[0](ch)
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1546
      );
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1547
    }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1548
    return ch;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1549
  });
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1550
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1551
  return mail;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1552
};
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1553
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1554
/**
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1555
 *
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1556
 * @param str
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1557
 * @param targetLength
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1558
 * @param padString
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1559
 * @returns {string}
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1560
 */
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1561
showdown.helper.padEnd = function padEnd (str, targetLength, padString) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1562
  'use strict';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1563
  /*jshint bitwise: false*/
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1564
  // eslint-disable-next-line space-infix-ops
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1565
  targetLength = targetLength>>0; //floor if number or convert non-number to 0;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1566
  /*jshint bitwise: true*/
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1567
  padString = String(padString || ' ');
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1568
  if (str.length > targetLength) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1569
    return String(str);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1570
  } else {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1571
    targetLength = targetLength - str.length;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1572
    if (targetLength > padString.length) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1573
      padString += padString.repeat(targetLength / padString.length); //append to original to ensure we are longer than needed
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1574
    }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1575
    return String(str) + padString.slice(0,targetLength);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1576
  }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1577
};
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1578
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1579
/**
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1580
 * POLYFILLS
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1581
 */
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1582
// use this instead of builtin is undefined for IE8 compatibility
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
  1583
if (typeof console === 'undefined') {
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1584
  console = {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1585
    warn: function (msg) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1586
      'use strict';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1587
      alert(msg);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1588
    },
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1589
    log: function (msg) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1590
      'use strict';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1591
      alert(msg);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1592
    },
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1593
    error: function (msg) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1594
      'use strict';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1595
      throw msg;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1596
    }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1597
  };
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1598
}
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1599
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1600
/**
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1601
 * Common regexes.
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1602
 * We declare some common regexes to improve performance
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1603
 */
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1604
showdown.helper.regexes = {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1605
  asteriskDashAndColon: /([*_:~])/g
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1606
};
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1607
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1608
/**
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1609
 * EMOJIS LIST
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1610
 */
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1611
showdown.helper.emojis = {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1612
  '+1':'\ud83d\udc4d',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1613
  '-1':'\ud83d\udc4e',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1614
  '100':'\ud83d\udcaf',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1615
  '1234':'\ud83d\udd22',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1616
  '1st_place_medal':'\ud83e\udd47',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1617
  '2nd_place_medal':'\ud83e\udd48',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1618
  '3rd_place_medal':'\ud83e\udd49',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1619
  '8ball':'\ud83c\udfb1',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1620
  'a':'\ud83c\udd70\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1621
  'ab':'\ud83c\udd8e',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1622
  'abc':'\ud83d\udd24',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1623
  'abcd':'\ud83d\udd21',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1624
  'accept':'\ud83c\ude51',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1625
  'aerial_tramway':'\ud83d\udea1',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1626
  'airplane':'\u2708\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1627
  'alarm_clock':'\u23f0',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1628
  'alembic':'\u2697\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1629
  'alien':'\ud83d\udc7d',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1630
  'ambulance':'\ud83d\ude91',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1631
  'amphora':'\ud83c\udffa',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1632
  'anchor':'\u2693\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1633
  'angel':'\ud83d\udc7c',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1634
  'anger':'\ud83d\udca2',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1635
  'angry':'\ud83d\ude20',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1636
  'anguished':'\ud83d\ude27',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1637
  'ant':'\ud83d\udc1c',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1638
  'apple':'\ud83c\udf4e',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1639
  'aquarius':'\u2652\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1640
  'aries':'\u2648\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1641
  'arrow_backward':'\u25c0\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1642
  'arrow_double_down':'\u23ec',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1643
  'arrow_double_up':'\u23eb',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1644
  'arrow_down':'\u2b07\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1645
  'arrow_down_small':'\ud83d\udd3d',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1646
  'arrow_forward':'\u25b6\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1647
  'arrow_heading_down':'\u2935\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1648
  'arrow_heading_up':'\u2934\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1649
  'arrow_left':'\u2b05\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1650
  'arrow_lower_left':'\u2199\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1651
  'arrow_lower_right':'\u2198\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1652
  'arrow_right':'\u27a1\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1653
  'arrow_right_hook':'\u21aa\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1654
  'arrow_up':'\u2b06\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1655
  'arrow_up_down':'\u2195\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1656
  'arrow_up_small':'\ud83d\udd3c',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1657
  'arrow_upper_left':'\u2196\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1658
  'arrow_upper_right':'\u2197\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1659
  'arrows_clockwise':'\ud83d\udd03',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1660
  'arrows_counterclockwise':'\ud83d\udd04',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1661
  'art':'\ud83c\udfa8',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1662
  'articulated_lorry':'\ud83d\ude9b',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1663
  'artificial_satellite':'\ud83d\udef0',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1664
  'astonished':'\ud83d\ude32',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1665
  'athletic_shoe':'\ud83d\udc5f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1666
  'atm':'\ud83c\udfe7',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1667
  'atom_symbol':'\u269b\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1668
  'avocado':'\ud83e\udd51',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1669
  'b':'\ud83c\udd71\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1670
  'baby':'\ud83d\udc76',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1671
  'baby_bottle':'\ud83c\udf7c',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1672
  'baby_chick':'\ud83d\udc24',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1673
  'baby_symbol':'\ud83d\udebc',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1674
  'back':'\ud83d\udd19',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1675
  'bacon':'\ud83e\udd53',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1676
  'badminton':'\ud83c\udff8',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1677
  'baggage_claim':'\ud83d\udec4',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1678
  'baguette_bread':'\ud83e\udd56',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1679
  'balance_scale':'\u2696\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1680
  'balloon':'\ud83c\udf88',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1681
  'ballot_box':'\ud83d\uddf3',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1682
  'ballot_box_with_check':'\u2611\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1683
  'bamboo':'\ud83c\udf8d',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1684
  'banana':'\ud83c\udf4c',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1685
  'bangbang':'\u203c\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1686
  'bank':'\ud83c\udfe6',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1687
  'bar_chart':'\ud83d\udcca',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1688
  'barber':'\ud83d\udc88',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1689
  'baseball':'\u26be\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1690
  'basketball':'\ud83c\udfc0',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1691
  'basketball_man':'\u26f9\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1692
  'basketball_woman':'\u26f9\ufe0f&zwj;\u2640\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1693
  'bat':'\ud83e\udd87',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1694
  'bath':'\ud83d\udec0',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1695
  'bathtub':'\ud83d\udec1',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1696
  'battery':'\ud83d\udd0b',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1697
  'beach_umbrella':'\ud83c\udfd6',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1698
  'bear':'\ud83d\udc3b',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1699
  'bed':'\ud83d\udecf',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1700
  'bee':'\ud83d\udc1d',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1701
  'beer':'\ud83c\udf7a',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1702
  'beers':'\ud83c\udf7b',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1703
  'beetle':'\ud83d\udc1e',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1704
  'beginner':'\ud83d\udd30',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1705
  'bell':'\ud83d\udd14',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1706
  'bellhop_bell':'\ud83d\udece',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1707
  'bento':'\ud83c\udf71',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1708
  'biking_man':'\ud83d\udeb4',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1709
  'bike':'\ud83d\udeb2',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1710
  'biking_woman':'\ud83d\udeb4&zwj;\u2640\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1711
  'bikini':'\ud83d\udc59',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1712
  'biohazard':'\u2623\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1713
  'bird':'\ud83d\udc26',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1714
  'birthday':'\ud83c\udf82',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1715
  'black_circle':'\u26ab\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1716
  'black_flag':'\ud83c\udff4',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1717
  'black_heart':'\ud83d\udda4',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1718
  'black_joker':'\ud83c\udccf',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1719
  'black_large_square':'\u2b1b\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1720
  'black_medium_small_square':'\u25fe\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1721
  'black_medium_square':'\u25fc\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1722
  'black_nib':'\u2712\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1723
  'black_small_square':'\u25aa\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1724
  'black_square_button':'\ud83d\udd32',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1725
  'blonde_man':'\ud83d\udc71',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1726
  'blonde_woman':'\ud83d\udc71&zwj;\u2640\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1727
  'blossom':'\ud83c\udf3c',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1728
  'blowfish':'\ud83d\udc21',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1729
  'blue_book':'\ud83d\udcd8',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1730
  'blue_car':'\ud83d\ude99',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1731
  'blue_heart':'\ud83d\udc99',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1732
  'blush':'\ud83d\ude0a',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1733
  'boar':'\ud83d\udc17',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1734
  'boat':'\u26f5\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1735
  'bomb':'\ud83d\udca3',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1736
  'book':'\ud83d\udcd6',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1737
  'bookmark':'\ud83d\udd16',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1738
  'bookmark_tabs':'\ud83d\udcd1',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1739
  'books':'\ud83d\udcda',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1740
  'boom':'\ud83d\udca5',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1741
  'boot':'\ud83d\udc62',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1742
  'bouquet':'\ud83d\udc90',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1743
  'bowing_man':'\ud83d\ude47',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1744
  'bow_and_arrow':'\ud83c\udff9',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1745
  'bowing_woman':'\ud83d\ude47&zwj;\u2640\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1746
  'bowling':'\ud83c\udfb3',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1747
  'boxing_glove':'\ud83e\udd4a',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1748
  'boy':'\ud83d\udc66',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1749
  'bread':'\ud83c\udf5e',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1750
  'bride_with_veil':'\ud83d\udc70',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1751
  'bridge_at_night':'\ud83c\udf09',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1752
  'briefcase':'\ud83d\udcbc',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1753
  'broken_heart':'\ud83d\udc94',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1754
  'bug':'\ud83d\udc1b',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1755
  'building_construction':'\ud83c\udfd7',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1756
  'bulb':'\ud83d\udca1',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1757
  'bullettrain_front':'\ud83d\ude85',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1758
  'bullettrain_side':'\ud83d\ude84',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1759
  'burrito':'\ud83c\udf2f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1760
  'bus':'\ud83d\ude8c',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1761
  'business_suit_levitating':'\ud83d\udd74',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1762
  'busstop':'\ud83d\ude8f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1763
  'bust_in_silhouette':'\ud83d\udc64',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1764
  'busts_in_silhouette':'\ud83d\udc65',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1765
  'butterfly':'\ud83e\udd8b',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1766
  'cactus':'\ud83c\udf35',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1767
  'cake':'\ud83c\udf70',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1768
  'calendar':'\ud83d\udcc6',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1769
  'call_me_hand':'\ud83e\udd19',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1770
  'calling':'\ud83d\udcf2',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1771
  'camel':'\ud83d\udc2b',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1772
  'camera':'\ud83d\udcf7',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1773
  'camera_flash':'\ud83d\udcf8',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1774
  'camping':'\ud83c\udfd5',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1775
  'cancer':'\u264b\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1776
  'candle':'\ud83d\udd6f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1777
  'candy':'\ud83c\udf6c',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1778
  'canoe':'\ud83d\udef6',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1779
  'capital_abcd':'\ud83d\udd20',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1780
  'capricorn':'\u2651\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1781
  'car':'\ud83d\ude97',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1782
  'card_file_box':'\ud83d\uddc3',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1783
  'card_index':'\ud83d\udcc7',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1784
  'card_index_dividers':'\ud83d\uddc2',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1785
  'carousel_horse':'\ud83c\udfa0',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1786
  'carrot':'\ud83e\udd55',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1787
  'cat':'\ud83d\udc31',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1788
  'cat2':'\ud83d\udc08',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1789
  'cd':'\ud83d\udcbf',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1790
  'chains':'\u26d3',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1791
  'champagne':'\ud83c\udf7e',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1792
  'chart':'\ud83d\udcb9',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1793
  'chart_with_downwards_trend':'\ud83d\udcc9',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1794
  'chart_with_upwards_trend':'\ud83d\udcc8',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1795
  'checkered_flag':'\ud83c\udfc1',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1796
  'cheese':'\ud83e\uddc0',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1797
  'cherries':'\ud83c\udf52',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1798
  'cherry_blossom':'\ud83c\udf38',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1799
  'chestnut':'\ud83c\udf30',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1800
  'chicken':'\ud83d\udc14',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1801
  'children_crossing':'\ud83d\udeb8',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1802
  'chipmunk':'\ud83d\udc3f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1803
  'chocolate_bar':'\ud83c\udf6b',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1804
  'christmas_tree':'\ud83c\udf84',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1805
  'church':'\u26ea\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1806
  'cinema':'\ud83c\udfa6',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1807
  'circus_tent':'\ud83c\udfaa',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1808
  'city_sunrise':'\ud83c\udf07',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1809
  'city_sunset':'\ud83c\udf06',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1810
  'cityscape':'\ud83c\udfd9',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1811
  'cl':'\ud83c\udd91',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1812
  'clamp':'\ud83d\udddc',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1813
  'clap':'\ud83d\udc4f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1814
  'clapper':'\ud83c\udfac',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1815
  'classical_building':'\ud83c\udfdb',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1816
  'clinking_glasses':'\ud83e\udd42',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1817
  'clipboard':'\ud83d\udccb',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1818
  'clock1':'\ud83d\udd50',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1819
  'clock10':'\ud83d\udd59',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1820
  'clock1030':'\ud83d\udd65',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1821
  'clock11':'\ud83d\udd5a',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1822
  'clock1130':'\ud83d\udd66',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1823
  'clock12':'\ud83d\udd5b',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1824
  'clock1230':'\ud83d\udd67',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1825
  'clock130':'\ud83d\udd5c',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1826
  'clock2':'\ud83d\udd51',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1827
  'clock230':'\ud83d\udd5d',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1828
  'clock3':'\ud83d\udd52',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1829
  'clock330':'\ud83d\udd5e',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1830
  'clock4':'\ud83d\udd53',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1831
  'clock430':'\ud83d\udd5f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1832
  'clock5':'\ud83d\udd54',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1833
  'clock530':'\ud83d\udd60',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1834
  'clock6':'\ud83d\udd55',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1835
  'clock630':'\ud83d\udd61',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1836
  'clock7':'\ud83d\udd56',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1837
  'clock730':'\ud83d\udd62',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1838
  'clock8':'\ud83d\udd57',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1839
  'clock830':'\ud83d\udd63',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1840
  'clock9':'\ud83d\udd58',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1841
  'clock930':'\ud83d\udd64',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1842
  'closed_book':'\ud83d\udcd5',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1843
  'closed_lock_with_key':'\ud83d\udd10',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1844
  'closed_umbrella':'\ud83c\udf02',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1845
  'cloud':'\u2601\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1846
  'cloud_with_lightning':'\ud83c\udf29',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1847
  'cloud_with_lightning_and_rain':'\u26c8',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1848
  'cloud_with_rain':'\ud83c\udf27',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1849
  'cloud_with_snow':'\ud83c\udf28',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1850
  'clown_face':'\ud83e\udd21',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1851
  'clubs':'\u2663\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1852
  'cocktail':'\ud83c\udf78',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1853
  'coffee':'\u2615\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1854
  'coffin':'\u26b0\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1855
  'cold_sweat':'\ud83d\ude30',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1856
  'comet':'\u2604\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1857
  'computer':'\ud83d\udcbb',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1858
  'computer_mouse':'\ud83d\uddb1',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1859
  'confetti_ball':'\ud83c\udf8a',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1860
  'confounded':'\ud83d\ude16',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1861
  'confused':'\ud83d\ude15',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1862
  'congratulations':'\u3297\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1863
  'construction':'\ud83d\udea7',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1864
  'construction_worker_man':'\ud83d\udc77',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1865
  'construction_worker_woman':'\ud83d\udc77&zwj;\u2640\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1866
  'control_knobs':'\ud83c\udf9b',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1867
  'convenience_store':'\ud83c\udfea',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1868
  'cookie':'\ud83c\udf6a',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1869
  'cool':'\ud83c\udd92',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1870
  'policeman':'\ud83d\udc6e',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1871
  'copyright':'\u00a9\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1872
  'corn':'\ud83c\udf3d',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1873
  'couch_and_lamp':'\ud83d\udecb',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1874
  'couple':'\ud83d\udc6b',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1875
  'couple_with_heart_woman_man':'\ud83d\udc91',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1876
  'couple_with_heart_man_man':'\ud83d\udc68&zwj;\u2764\ufe0f&zwj;\ud83d\udc68',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1877
  'couple_with_heart_woman_woman':'\ud83d\udc69&zwj;\u2764\ufe0f&zwj;\ud83d\udc69',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1878
  'couplekiss_man_man':'\ud83d\udc68&zwj;\u2764\ufe0f&zwj;\ud83d\udc8b&zwj;\ud83d\udc68',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1879
  'couplekiss_man_woman':'\ud83d\udc8f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1880
  'couplekiss_woman_woman':'\ud83d\udc69&zwj;\u2764\ufe0f&zwj;\ud83d\udc8b&zwj;\ud83d\udc69',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1881
  'cow':'\ud83d\udc2e',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1882
  'cow2':'\ud83d\udc04',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1883
  'cowboy_hat_face':'\ud83e\udd20',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1884
  'crab':'\ud83e\udd80',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1885
  'crayon':'\ud83d\udd8d',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1886
  'credit_card':'\ud83d\udcb3',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1887
  'crescent_moon':'\ud83c\udf19',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1888
  'cricket':'\ud83c\udfcf',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1889
  'crocodile':'\ud83d\udc0a',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1890
  'croissant':'\ud83e\udd50',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1891
  'crossed_fingers':'\ud83e\udd1e',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1892
  'crossed_flags':'\ud83c\udf8c',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1893
  'crossed_swords':'\u2694\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1894
  'crown':'\ud83d\udc51',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1895
  'cry':'\ud83d\ude22',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1896
  'crying_cat_face':'\ud83d\ude3f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1897
  'crystal_ball':'\ud83d\udd2e',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1898
  'cucumber':'\ud83e\udd52',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1899
  'cupid':'\ud83d\udc98',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1900
  'curly_loop':'\u27b0',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1901
  'currency_exchange':'\ud83d\udcb1',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1902
  'curry':'\ud83c\udf5b',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1903
  'custard':'\ud83c\udf6e',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1904
  'customs':'\ud83d\udec3',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1905
  'cyclone':'\ud83c\udf00',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1906
  'dagger':'\ud83d\udde1',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1907
  'dancer':'\ud83d\udc83',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1908
  'dancing_women':'\ud83d\udc6f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1909
  'dancing_men':'\ud83d\udc6f&zwj;\u2642\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1910
  'dango':'\ud83c\udf61',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1911
  'dark_sunglasses':'\ud83d\udd76',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1912
  'dart':'\ud83c\udfaf',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1913
  'dash':'\ud83d\udca8',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1914
  'date':'\ud83d\udcc5',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1915
  'deciduous_tree':'\ud83c\udf33',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1916
  'deer':'\ud83e\udd8c',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1917
  'department_store':'\ud83c\udfec',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1918
  'derelict_house':'\ud83c\udfda',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1919
  'desert':'\ud83c\udfdc',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1920
  'desert_island':'\ud83c\udfdd',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1921
  'desktop_computer':'\ud83d\udda5',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1922
  'male_detective':'\ud83d\udd75\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1923
  'diamond_shape_with_a_dot_inside':'\ud83d\udca0',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1924
  'diamonds':'\u2666\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1925
  'disappointed':'\ud83d\ude1e',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1926
  'disappointed_relieved':'\ud83d\ude25',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1927
  'dizzy':'\ud83d\udcab',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1928
  'dizzy_face':'\ud83d\ude35',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1929
  'do_not_litter':'\ud83d\udeaf',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1930
  'dog':'\ud83d\udc36',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1931
  'dog2':'\ud83d\udc15',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1932
  'dollar':'\ud83d\udcb5',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1933
  'dolls':'\ud83c\udf8e',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1934
  'dolphin':'\ud83d\udc2c',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1935
  'door':'\ud83d\udeaa',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1936
  'doughnut':'\ud83c\udf69',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1937
  'dove':'\ud83d\udd4a',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1938
  'dragon':'\ud83d\udc09',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1939
  'dragon_face':'\ud83d\udc32',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1940
  'dress':'\ud83d\udc57',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1941
  'dromedary_camel':'\ud83d\udc2a',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1942
  'drooling_face':'\ud83e\udd24',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1943
  'droplet':'\ud83d\udca7',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1944
  'drum':'\ud83e\udd41',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1945
  'duck':'\ud83e\udd86',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1946
  'dvd':'\ud83d\udcc0',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1947
  'e-mail':'\ud83d\udce7',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1948
  'eagle':'\ud83e\udd85',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1949
  'ear':'\ud83d\udc42',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1950
  'ear_of_rice':'\ud83c\udf3e',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1951
  'earth_africa':'\ud83c\udf0d',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1952
  'earth_americas':'\ud83c\udf0e',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1953
  'earth_asia':'\ud83c\udf0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1954
  'egg':'\ud83e\udd5a',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1955
  'eggplant':'\ud83c\udf46',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1956
  'eight_pointed_black_star':'\u2734\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1957
  'eight_spoked_asterisk':'\u2733\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1958
  'electric_plug':'\ud83d\udd0c',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1959
  'elephant':'\ud83d\udc18',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1960
  'email':'\u2709\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1961
  'end':'\ud83d\udd1a',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1962
  'envelope_with_arrow':'\ud83d\udce9',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1963
  'euro':'\ud83d\udcb6',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1964
  'european_castle':'\ud83c\udff0',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1965
  'european_post_office':'\ud83c\udfe4',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1966
  'evergreen_tree':'\ud83c\udf32',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1967
  'exclamation':'\u2757\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1968
  'expressionless':'\ud83d\ude11',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1969
  'eye':'\ud83d\udc41',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1970
  'eye_speech_bubble':'\ud83d\udc41&zwj;\ud83d\udde8',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1971
  'eyeglasses':'\ud83d\udc53',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1972
  'eyes':'\ud83d\udc40',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1973
  'face_with_head_bandage':'\ud83e\udd15',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1974
  'face_with_thermometer':'\ud83e\udd12',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1975
  'fist_oncoming':'\ud83d\udc4a',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1976
  'factory':'\ud83c\udfed',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1977
  'fallen_leaf':'\ud83c\udf42',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1978
  'family_man_woman_boy':'\ud83d\udc6a',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1979
  'family_man_boy':'\ud83d\udc68&zwj;\ud83d\udc66',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1980
  'family_man_boy_boy':'\ud83d\udc68&zwj;\ud83d\udc66&zwj;\ud83d\udc66',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1981
  'family_man_girl':'\ud83d\udc68&zwj;\ud83d\udc67',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1982
  'family_man_girl_boy':'\ud83d\udc68&zwj;\ud83d\udc67&zwj;\ud83d\udc66',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1983
  'family_man_girl_girl':'\ud83d\udc68&zwj;\ud83d\udc67&zwj;\ud83d\udc67',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1984
  'family_man_man_boy':'\ud83d\udc68&zwj;\ud83d\udc68&zwj;\ud83d\udc66',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1985
  'family_man_man_boy_boy':'\ud83d\udc68&zwj;\ud83d\udc68&zwj;\ud83d\udc66&zwj;\ud83d\udc66',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1986
  'family_man_man_girl':'\ud83d\udc68&zwj;\ud83d\udc68&zwj;\ud83d\udc67',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1987
  'family_man_man_girl_boy':'\ud83d\udc68&zwj;\ud83d\udc68&zwj;\ud83d\udc67&zwj;\ud83d\udc66',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1988
  'family_man_man_girl_girl':'\ud83d\udc68&zwj;\ud83d\udc68&zwj;\ud83d\udc67&zwj;\ud83d\udc67',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1989
  'family_man_woman_boy_boy':'\ud83d\udc68&zwj;\ud83d\udc69&zwj;\ud83d\udc66&zwj;\ud83d\udc66',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1990
  'family_man_woman_girl':'\ud83d\udc68&zwj;\ud83d\udc69&zwj;\ud83d\udc67',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1991
  'family_man_woman_girl_boy':'\ud83d\udc68&zwj;\ud83d\udc69&zwj;\ud83d\udc67&zwj;\ud83d\udc66',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1992
  'family_man_woman_girl_girl':'\ud83d\udc68&zwj;\ud83d\udc69&zwj;\ud83d\udc67&zwj;\ud83d\udc67',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1993
  'family_woman_boy':'\ud83d\udc69&zwj;\ud83d\udc66',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1994
  'family_woman_boy_boy':'\ud83d\udc69&zwj;\ud83d\udc66&zwj;\ud83d\udc66',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1995
  'family_woman_girl':'\ud83d\udc69&zwj;\ud83d\udc67',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1996
  'family_woman_girl_boy':'\ud83d\udc69&zwj;\ud83d\udc67&zwj;\ud83d\udc66',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1997
  'family_woman_girl_girl':'\ud83d\udc69&zwj;\ud83d\udc67&zwj;\ud83d\udc67',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1998
  'family_woman_woman_boy':'\ud83d\udc69&zwj;\ud83d\udc69&zwj;\ud83d\udc66',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1999
  'family_woman_woman_boy_boy':'\ud83d\udc69&zwj;\ud83d\udc69&zwj;\ud83d\udc66&zwj;\ud83d\udc66',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2000
  'family_woman_woman_girl':'\ud83d\udc69&zwj;\ud83d\udc69&zwj;\ud83d\udc67',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2001
  'family_woman_woman_girl_boy':'\ud83d\udc69&zwj;\ud83d\udc69&zwj;\ud83d\udc67&zwj;\ud83d\udc66',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2002
  'family_woman_woman_girl_girl':'\ud83d\udc69&zwj;\ud83d\udc69&zwj;\ud83d\udc67&zwj;\ud83d\udc67',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2003
  'fast_forward':'\u23e9',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2004
  'fax':'\ud83d\udce0',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2005
  'fearful':'\ud83d\ude28',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2006
  'feet':'\ud83d\udc3e',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2007
  'female_detective':'\ud83d\udd75\ufe0f&zwj;\u2640\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2008
  'ferris_wheel':'\ud83c\udfa1',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2009
  'ferry':'\u26f4',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2010
  'field_hockey':'\ud83c\udfd1',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2011
  'file_cabinet':'\ud83d\uddc4',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2012
  'file_folder':'\ud83d\udcc1',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2013
  'film_projector':'\ud83d\udcfd',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2014
  'film_strip':'\ud83c\udf9e',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2015
  'fire':'\ud83d\udd25',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2016
  'fire_engine':'\ud83d\ude92',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2017
  'fireworks':'\ud83c\udf86',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2018
  'first_quarter_moon':'\ud83c\udf13',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2019
  'first_quarter_moon_with_face':'\ud83c\udf1b',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2020
  'fish':'\ud83d\udc1f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2021
  'fish_cake':'\ud83c\udf65',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2022
  'fishing_pole_and_fish':'\ud83c\udfa3',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2023
  'fist_raised':'\u270a',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2024
  'fist_left':'\ud83e\udd1b',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2025
  'fist_right':'\ud83e\udd1c',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2026
  'flags':'\ud83c\udf8f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2027
  'flashlight':'\ud83d\udd26',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2028
  'fleur_de_lis':'\u269c\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2029
  'flight_arrival':'\ud83d\udeec',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2030
  'flight_departure':'\ud83d\udeeb',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2031
  'floppy_disk':'\ud83d\udcbe',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2032
  'flower_playing_cards':'\ud83c\udfb4',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2033
  'flushed':'\ud83d\ude33',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2034
  'fog':'\ud83c\udf2b',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2035
  'foggy':'\ud83c\udf01',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2036
  'football':'\ud83c\udfc8',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2037
  'footprints':'\ud83d\udc63',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2038
  'fork_and_knife':'\ud83c\udf74',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2039
  'fountain':'\u26f2\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2040
  'fountain_pen':'\ud83d\udd8b',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2041
  'four_leaf_clover':'\ud83c\udf40',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2042
  'fox_face':'\ud83e\udd8a',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2043
  'framed_picture':'\ud83d\uddbc',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2044
  'free':'\ud83c\udd93',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2045
  'fried_egg':'\ud83c\udf73',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2046
  'fried_shrimp':'\ud83c\udf64',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2047
  'fries':'\ud83c\udf5f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2048
  'frog':'\ud83d\udc38',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2049
  'frowning':'\ud83d\ude26',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2050
  'frowning_face':'\u2639\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2051
  'frowning_man':'\ud83d\ude4d&zwj;\u2642\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2052
  'frowning_woman':'\ud83d\ude4d',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2053
  'middle_finger':'\ud83d\udd95',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2054
  'fuelpump':'\u26fd\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2055
  'full_moon':'\ud83c\udf15',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2056
  'full_moon_with_face':'\ud83c\udf1d',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2057
  'funeral_urn':'\u26b1\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2058
  'game_die':'\ud83c\udfb2',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2059
  'gear':'\u2699\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2060
  'gem':'\ud83d\udc8e',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2061
  'gemini':'\u264a\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2062
  'ghost':'\ud83d\udc7b',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2063
  'gift':'\ud83c\udf81',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2064
  'gift_heart':'\ud83d\udc9d',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2065
  'girl':'\ud83d\udc67',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2066
  'globe_with_meridians':'\ud83c\udf10',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2067
  'goal_net':'\ud83e\udd45',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2068
  'goat':'\ud83d\udc10',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2069
  'golf':'\u26f3\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2070
  'golfing_man':'\ud83c\udfcc\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2071
  'golfing_woman':'\ud83c\udfcc\ufe0f&zwj;\u2640\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2072
  'gorilla':'\ud83e\udd8d',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2073
  'grapes':'\ud83c\udf47',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2074
  'green_apple':'\ud83c\udf4f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2075
  'green_book':'\ud83d\udcd7',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2076
  'green_heart':'\ud83d\udc9a',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2077
  'green_salad':'\ud83e\udd57',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2078
  'grey_exclamation':'\u2755',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2079
  'grey_question':'\u2754',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2080
  'grimacing':'\ud83d\ude2c',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2081
  'grin':'\ud83d\ude01',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2082
  'grinning':'\ud83d\ude00',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2083
  'guardsman':'\ud83d\udc82',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2084
  'guardswoman':'\ud83d\udc82&zwj;\u2640\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2085
  'guitar':'\ud83c\udfb8',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2086
  'gun':'\ud83d\udd2b',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2087
  'haircut_woman':'\ud83d\udc87',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2088
  'haircut_man':'\ud83d\udc87&zwj;\u2642\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2089
  'hamburger':'\ud83c\udf54',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2090
  'hammer':'\ud83d\udd28',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2091
  'hammer_and_pick':'\u2692',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2092
  'hammer_and_wrench':'\ud83d\udee0',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2093
  'hamster':'\ud83d\udc39',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2094
  'hand':'\u270b',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2095
  'handbag':'\ud83d\udc5c',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2096
  'handshake':'\ud83e\udd1d',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2097
  'hankey':'\ud83d\udca9',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2098
  'hatched_chick':'\ud83d\udc25',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2099
  'hatching_chick':'\ud83d\udc23',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2100
  'headphones':'\ud83c\udfa7',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2101
  'hear_no_evil':'\ud83d\ude49',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2102
  'heart':'\u2764\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2103
  'heart_decoration':'\ud83d\udc9f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2104
  'heart_eyes':'\ud83d\ude0d',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2105
  'heart_eyes_cat':'\ud83d\ude3b',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2106
  'heartbeat':'\ud83d\udc93',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2107
  'heartpulse':'\ud83d\udc97',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2108
  'hearts':'\u2665\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2109
  'heavy_check_mark':'\u2714\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2110
  'heavy_division_sign':'\u2797',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2111
  'heavy_dollar_sign':'\ud83d\udcb2',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2112
  'heavy_heart_exclamation':'\u2763\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2113
  'heavy_minus_sign':'\u2796',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2114
  'heavy_multiplication_x':'\u2716\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2115
  'heavy_plus_sign':'\u2795',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2116
  'helicopter':'\ud83d\ude81',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2117
  'herb':'\ud83c\udf3f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2118
  'hibiscus':'\ud83c\udf3a',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2119
  'high_brightness':'\ud83d\udd06',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2120
  'high_heel':'\ud83d\udc60',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2121
  'hocho':'\ud83d\udd2a',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2122
  'hole':'\ud83d\udd73',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2123
  'honey_pot':'\ud83c\udf6f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2124
  'horse':'\ud83d\udc34',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2125
  'horse_racing':'\ud83c\udfc7',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2126
  'hospital':'\ud83c\udfe5',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2127
  'hot_pepper':'\ud83c\udf36',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2128
  'hotdog':'\ud83c\udf2d',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2129
  'hotel':'\ud83c\udfe8',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2130
  'hotsprings':'\u2668\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2131
  'hourglass':'\u231b\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2132
  'hourglass_flowing_sand':'\u23f3',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2133
  'house':'\ud83c\udfe0',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2134
  'house_with_garden':'\ud83c\udfe1',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2135
  'houses':'\ud83c\udfd8',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2136
  'hugs':'\ud83e\udd17',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2137
  'hushed':'\ud83d\ude2f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2138
  'ice_cream':'\ud83c\udf68',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2139
  'ice_hockey':'\ud83c\udfd2',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2140
  'ice_skate':'\u26f8',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2141
  'icecream':'\ud83c\udf66',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2142
  'id':'\ud83c\udd94',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2143
  'ideograph_advantage':'\ud83c\ude50',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2144
  'imp':'\ud83d\udc7f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2145
  'inbox_tray':'\ud83d\udce5',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2146
  'incoming_envelope':'\ud83d\udce8',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2147
  'tipping_hand_woman':'\ud83d\udc81',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2148
  'information_source':'\u2139\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2149
  'innocent':'\ud83d\ude07',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2150
  'interrobang':'\u2049\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2151
  'iphone':'\ud83d\udcf1',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2152
  'izakaya_lantern':'\ud83c\udfee',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2153
  'jack_o_lantern':'\ud83c\udf83',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2154
  'japan':'\ud83d\uddfe',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2155
  'japanese_castle':'\ud83c\udfef',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2156
  'japanese_goblin':'\ud83d\udc7a',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2157
  'japanese_ogre':'\ud83d\udc79',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2158
  'jeans':'\ud83d\udc56',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2159
  'joy':'\ud83d\ude02',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2160
  'joy_cat':'\ud83d\ude39',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2161
  'joystick':'\ud83d\udd79',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2162
  'kaaba':'\ud83d\udd4b',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2163
  'key':'\ud83d\udd11',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2164
  'keyboard':'\u2328\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2165
  'keycap_ten':'\ud83d\udd1f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2166
  'kick_scooter':'\ud83d\udef4',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2167
  'kimono':'\ud83d\udc58',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2168
  'kiss':'\ud83d\udc8b',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2169
  'kissing':'\ud83d\ude17',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2170
  'kissing_cat':'\ud83d\ude3d',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2171
  'kissing_closed_eyes':'\ud83d\ude1a',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2172
  'kissing_heart':'\ud83d\ude18',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2173
  'kissing_smiling_eyes':'\ud83d\ude19',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2174
  'kiwi_fruit':'\ud83e\udd5d',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2175
  'koala':'\ud83d\udc28',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2176
  'koko':'\ud83c\ude01',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2177
  'label':'\ud83c\udff7',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2178
  'large_blue_circle':'\ud83d\udd35',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2179
  'large_blue_diamond':'\ud83d\udd37',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2180
  'large_orange_diamond':'\ud83d\udd36',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2181
  'last_quarter_moon':'\ud83c\udf17',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2182
  'last_quarter_moon_with_face':'\ud83c\udf1c',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2183
  'latin_cross':'\u271d\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2184
  'laughing':'\ud83d\ude06',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2185
  'leaves':'\ud83c\udf43',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2186
  'ledger':'\ud83d\udcd2',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2187
  'left_luggage':'\ud83d\udec5',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2188
  'left_right_arrow':'\u2194\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2189
  'leftwards_arrow_with_hook':'\u21a9\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2190
  'lemon':'\ud83c\udf4b',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2191
  'leo':'\u264c\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2192
  'leopard':'\ud83d\udc06',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2193
  'level_slider':'\ud83c\udf9a',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2194
  'libra':'\u264e\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2195
  'light_rail':'\ud83d\ude88',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2196
  'link':'\ud83d\udd17',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2197
  'lion':'\ud83e\udd81',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2198
  'lips':'\ud83d\udc44',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2199
  'lipstick':'\ud83d\udc84',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2200
  'lizard':'\ud83e\udd8e',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2201
  'lock':'\ud83d\udd12',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2202
  'lock_with_ink_pen':'\ud83d\udd0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2203
  'lollipop':'\ud83c\udf6d',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2204
  'loop':'\u27bf',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2205
  'loud_sound':'\ud83d\udd0a',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2206
  'loudspeaker':'\ud83d\udce2',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2207
  'love_hotel':'\ud83c\udfe9',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2208
  'love_letter':'\ud83d\udc8c',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2209
  'low_brightness':'\ud83d\udd05',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2210
  'lying_face':'\ud83e\udd25',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2211
  'm':'\u24c2\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2212
  'mag':'\ud83d\udd0d',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2213
  'mag_right':'\ud83d\udd0e',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2214
  'mahjong':'\ud83c\udc04\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2215
  'mailbox':'\ud83d\udceb',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2216
  'mailbox_closed':'\ud83d\udcea',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2217
  'mailbox_with_mail':'\ud83d\udcec',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2218
  'mailbox_with_no_mail':'\ud83d\udced',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2219
  'man':'\ud83d\udc68',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2220
  'man_artist':'\ud83d\udc68&zwj;\ud83c\udfa8',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2221
  'man_astronaut':'\ud83d\udc68&zwj;\ud83d\ude80',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2222
  'man_cartwheeling':'\ud83e\udd38&zwj;\u2642\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2223
  'man_cook':'\ud83d\udc68&zwj;\ud83c\udf73',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2224
  'man_dancing':'\ud83d\udd7a',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2225
  'man_facepalming':'\ud83e\udd26&zwj;\u2642\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2226
  'man_factory_worker':'\ud83d\udc68&zwj;\ud83c\udfed',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2227
  'man_farmer':'\ud83d\udc68&zwj;\ud83c\udf3e',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2228
  'man_firefighter':'\ud83d\udc68&zwj;\ud83d\ude92',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2229
  'man_health_worker':'\ud83d\udc68&zwj;\u2695\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2230
  'man_in_tuxedo':'\ud83e\udd35',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2231
  'man_judge':'\ud83d\udc68&zwj;\u2696\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2232
  'man_juggling':'\ud83e\udd39&zwj;\u2642\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2233
  'man_mechanic':'\ud83d\udc68&zwj;\ud83d\udd27',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2234
  'man_office_worker':'\ud83d\udc68&zwj;\ud83d\udcbc',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2235
  'man_pilot':'\ud83d\udc68&zwj;\u2708\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2236
  'man_playing_handball':'\ud83e\udd3e&zwj;\u2642\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2237
  'man_playing_water_polo':'\ud83e\udd3d&zwj;\u2642\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2238
  'man_scientist':'\ud83d\udc68&zwj;\ud83d\udd2c',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2239
  'man_shrugging':'\ud83e\udd37&zwj;\u2642\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2240
  'man_singer':'\ud83d\udc68&zwj;\ud83c\udfa4',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2241
  'man_student':'\ud83d\udc68&zwj;\ud83c\udf93',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2242
  'man_teacher':'\ud83d\udc68&zwj;\ud83c\udfeb',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2243
  'man_technologist':'\ud83d\udc68&zwj;\ud83d\udcbb',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2244
  'man_with_gua_pi_mao':'\ud83d\udc72',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2245
  'man_with_turban':'\ud83d\udc73',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2246
  'tangerine':'\ud83c\udf4a',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2247
  'mans_shoe':'\ud83d\udc5e',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2248
  'mantelpiece_clock':'\ud83d\udd70',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2249
  'maple_leaf':'\ud83c\udf41',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2250
  'martial_arts_uniform':'\ud83e\udd4b',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2251
  'mask':'\ud83d\ude37',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2252
  'massage_woman':'\ud83d\udc86',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2253
  'massage_man':'\ud83d\udc86&zwj;\u2642\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2254
  'meat_on_bone':'\ud83c\udf56',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2255
  'medal_military':'\ud83c\udf96',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2256
  'medal_sports':'\ud83c\udfc5',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2257
  'mega':'\ud83d\udce3',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2258
  'melon':'\ud83c\udf48',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2259
  'memo':'\ud83d\udcdd',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2260
  'men_wrestling':'\ud83e\udd3c&zwj;\u2642\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2261
  'menorah':'\ud83d\udd4e',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2262
  'mens':'\ud83d\udeb9',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2263
  'metal':'\ud83e\udd18',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2264
  'metro':'\ud83d\ude87',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2265
  'microphone':'\ud83c\udfa4',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2266
  'microscope':'\ud83d\udd2c',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2267
  'milk_glass':'\ud83e\udd5b',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2268
  'milky_way':'\ud83c\udf0c',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2269
  'minibus':'\ud83d\ude90',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2270
  'minidisc':'\ud83d\udcbd',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2271
  'mobile_phone_off':'\ud83d\udcf4',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2272
  'money_mouth_face':'\ud83e\udd11',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2273
  'money_with_wings':'\ud83d\udcb8',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2274
  'moneybag':'\ud83d\udcb0',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2275
  'monkey':'\ud83d\udc12',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2276
  'monkey_face':'\ud83d\udc35',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2277
  'monorail':'\ud83d\ude9d',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2278
  'moon':'\ud83c\udf14',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2279
  'mortar_board':'\ud83c\udf93',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2280
  'mosque':'\ud83d\udd4c',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2281
  'motor_boat':'\ud83d\udee5',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2282
  'motor_scooter':'\ud83d\udef5',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2283
  'motorcycle':'\ud83c\udfcd',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2284
  'motorway':'\ud83d\udee3',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2285
  'mount_fuji':'\ud83d\uddfb',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2286
  'mountain':'\u26f0',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2287
  'mountain_biking_man':'\ud83d\udeb5',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2288
  'mountain_biking_woman':'\ud83d\udeb5&zwj;\u2640\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2289
  'mountain_cableway':'\ud83d\udea0',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2290
  'mountain_railway':'\ud83d\ude9e',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2291
  'mountain_snow':'\ud83c\udfd4',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2292
  'mouse':'\ud83d\udc2d',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2293
  'mouse2':'\ud83d\udc01',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2294
  'movie_camera':'\ud83c\udfa5',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2295
  'moyai':'\ud83d\uddff',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2296
  'mrs_claus':'\ud83e\udd36',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2297
  'muscle':'\ud83d\udcaa',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2298
  'mushroom':'\ud83c\udf44',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2299
  'musical_keyboard':'\ud83c\udfb9',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2300
  'musical_note':'\ud83c\udfb5',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2301
  'musical_score':'\ud83c\udfbc',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2302
  'mute':'\ud83d\udd07',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2303
  'nail_care':'\ud83d\udc85',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2304
  'name_badge':'\ud83d\udcdb',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2305
  'national_park':'\ud83c\udfde',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2306
  'nauseated_face':'\ud83e\udd22',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2307
  'necktie':'\ud83d\udc54',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2308
  'negative_squared_cross_mark':'\u274e',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2309
  'nerd_face':'\ud83e\udd13',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2310
  'neutral_face':'\ud83d\ude10',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2311
  'new':'\ud83c\udd95',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2312
  'new_moon':'\ud83c\udf11',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2313
  'new_moon_with_face':'\ud83c\udf1a',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2314
  'newspaper':'\ud83d\udcf0',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2315
  'newspaper_roll':'\ud83d\uddde',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2316
  'next_track_button':'\u23ed',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2317
  'ng':'\ud83c\udd96',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2318
  'no_good_man':'\ud83d\ude45&zwj;\u2642\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2319
  'no_good_woman':'\ud83d\ude45',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2320
  'night_with_stars':'\ud83c\udf03',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2321
  'no_bell':'\ud83d\udd15',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2322
  'no_bicycles':'\ud83d\udeb3',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2323
  'no_entry':'\u26d4\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2324
  'no_entry_sign':'\ud83d\udeab',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2325
  'no_mobile_phones':'\ud83d\udcf5',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2326
  'no_mouth':'\ud83d\ude36',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2327
  'no_pedestrians':'\ud83d\udeb7',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2328
  'no_smoking':'\ud83d\udead',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2329
  'non-potable_water':'\ud83d\udeb1',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2330
  'nose':'\ud83d\udc43',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2331
  'notebook':'\ud83d\udcd3',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2332
  'notebook_with_decorative_cover':'\ud83d\udcd4',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2333
  'notes':'\ud83c\udfb6',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2334
  'nut_and_bolt':'\ud83d\udd29',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2335
  'o':'\u2b55\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2336
  'o2':'\ud83c\udd7e\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2337
  'ocean':'\ud83c\udf0a',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2338
  'octopus':'\ud83d\udc19',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2339
  'oden':'\ud83c\udf62',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2340
  'office':'\ud83c\udfe2',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2341
  'oil_drum':'\ud83d\udee2',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2342
  'ok':'\ud83c\udd97',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2343
  'ok_hand':'\ud83d\udc4c',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2344
  'ok_man':'\ud83d\ude46&zwj;\u2642\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2345
  'ok_woman':'\ud83d\ude46',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2346
  'old_key':'\ud83d\udddd',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2347
  'older_man':'\ud83d\udc74',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2348
  'older_woman':'\ud83d\udc75',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2349
  'om':'\ud83d\udd49',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2350
  'on':'\ud83d\udd1b',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2351
  'oncoming_automobile':'\ud83d\ude98',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2352
  'oncoming_bus':'\ud83d\ude8d',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2353
  'oncoming_police_car':'\ud83d\ude94',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2354
  'oncoming_taxi':'\ud83d\ude96',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2355
  'open_file_folder':'\ud83d\udcc2',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2356
  'open_hands':'\ud83d\udc50',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2357
  'open_mouth':'\ud83d\ude2e',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2358
  'open_umbrella':'\u2602\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2359
  'ophiuchus':'\u26ce',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2360
  'orange_book':'\ud83d\udcd9',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2361
  'orthodox_cross':'\u2626\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2362
  'outbox_tray':'\ud83d\udce4',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2363
  'owl':'\ud83e\udd89',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2364
  'ox':'\ud83d\udc02',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2365
  'package':'\ud83d\udce6',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2366
  'page_facing_up':'\ud83d\udcc4',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2367
  'page_with_curl':'\ud83d\udcc3',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2368
  'pager':'\ud83d\udcdf',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2369
  'paintbrush':'\ud83d\udd8c',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2370
  'palm_tree':'\ud83c\udf34',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2371
  'pancakes':'\ud83e\udd5e',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2372
  'panda_face':'\ud83d\udc3c',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2373
  'paperclip':'\ud83d\udcce',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2374
  'paperclips':'\ud83d\udd87',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2375
  'parasol_on_ground':'\u26f1',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2376
  'parking':'\ud83c\udd7f\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2377
  'part_alternation_mark':'\u303d\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2378
  'partly_sunny':'\u26c5\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2379
  'passenger_ship':'\ud83d\udef3',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2380
  'passport_control':'\ud83d\udec2',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2381
  'pause_button':'\u23f8',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2382
  'peace_symbol':'\u262e\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2383
  'peach':'\ud83c\udf51',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2384
  'peanuts':'\ud83e\udd5c',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2385
  'pear':'\ud83c\udf50',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2386
  'pen':'\ud83d\udd8a',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2387
  'pencil2':'\u270f\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2388
  'penguin':'\ud83d\udc27',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2389
  'pensive':'\ud83d\ude14',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2390
  'performing_arts':'\ud83c\udfad',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2391
  'persevere':'\ud83d\ude23',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2392
  'person_fencing':'\ud83e\udd3a',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2393
  'pouting_woman':'\ud83d\ude4e',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2394
  'phone':'\u260e\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2395
  'pick':'\u26cf',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2396
  'pig':'\ud83d\udc37',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2397
  'pig2':'\ud83d\udc16',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2398
  'pig_nose':'\ud83d\udc3d',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2399
  'pill':'\ud83d\udc8a',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2400
  'pineapple':'\ud83c\udf4d',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2401
  'ping_pong':'\ud83c\udfd3',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2402
  'pisces':'\u2653\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2403
  'pizza':'\ud83c\udf55',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2404
  'place_of_worship':'\ud83d\uded0',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2405
  'plate_with_cutlery':'\ud83c\udf7d',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2406
  'play_or_pause_button':'\u23ef',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2407
  'point_down':'\ud83d\udc47',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2408
  'point_left':'\ud83d\udc48',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2409
  'point_right':'\ud83d\udc49',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2410
  'point_up':'\u261d\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2411
  'point_up_2':'\ud83d\udc46',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2412
  'police_car':'\ud83d\ude93',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2413
  'policewoman':'\ud83d\udc6e&zwj;\u2640\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2414
  'poodle':'\ud83d\udc29',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2415
  'popcorn':'\ud83c\udf7f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2416
  'post_office':'\ud83c\udfe3',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2417
  'postal_horn':'\ud83d\udcef',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2418
  'postbox':'\ud83d\udcee',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2419
  'potable_water':'\ud83d\udeb0',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2420
  'potato':'\ud83e\udd54',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2421
  'pouch':'\ud83d\udc5d',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2422
  'poultry_leg':'\ud83c\udf57',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2423
  'pound':'\ud83d\udcb7',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2424
  'rage':'\ud83d\ude21',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2425
  'pouting_cat':'\ud83d\ude3e',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2426
  'pouting_man':'\ud83d\ude4e&zwj;\u2642\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2427
  'pray':'\ud83d\ude4f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2428
  'prayer_beads':'\ud83d\udcff',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2429
  'pregnant_woman':'\ud83e\udd30',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2430
  'previous_track_button':'\u23ee',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2431
  'prince':'\ud83e\udd34',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2432
  'princess':'\ud83d\udc78',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2433
  'printer':'\ud83d\udda8',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2434
  'purple_heart':'\ud83d\udc9c',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2435
  'purse':'\ud83d\udc5b',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2436
  'pushpin':'\ud83d\udccc',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2437
  'put_litter_in_its_place':'\ud83d\udeae',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2438
  'question':'\u2753',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2439
  'rabbit':'\ud83d\udc30',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2440
  'rabbit2':'\ud83d\udc07',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2441
  'racehorse':'\ud83d\udc0e',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2442
  'racing_car':'\ud83c\udfce',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2443
  'radio':'\ud83d\udcfb',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2444
  'radio_button':'\ud83d\udd18',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2445
  'radioactive':'\u2622\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2446
  'railway_car':'\ud83d\ude83',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2447
  'railway_track':'\ud83d\udee4',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2448
  'rainbow':'\ud83c\udf08',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2449
  'rainbow_flag':'\ud83c\udff3\ufe0f&zwj;\ud83c\udf08',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2450
  'raised_back_of_hand':'\ud83e\udd1a',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2451
  'raised_hand_with_fingers_splayed':'\ud83d\udd90',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2452
  'raised_hands':'\ud83d\ude4c',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2453
  'raising_hand_woman':'\ud83d\ude4b',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2454
  'raising_hand_man':'\ud83d\ude4b&zwj;\u2642\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2455
  'ram':'\ud83d\udc0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2456
  'ramen':'\ud83c\udf5c',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2457
  'rat':'\ud83d\udc00',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2458
  'record_button':'\u23fa',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2459
  'recycle':'\u267b\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2460
  'red_circle':'\ud83d\udd34',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2461
  'registered':'\u00ae\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2462
  'relaxed':'\u263a\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2463
  'relieved':'\ud83d\ude0c',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2464
  'reminder_ribbon':'\ud83c\udf97',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2465
  'repeat':'\ud83d\udd01',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2466
  'repeat_one':'\ud83d\udd02',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2467
  'rescue_worker_helmet':'\u26d1',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2468
  'restroom':'\ud83d\udebb',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2469
  'revolving_hearts':'\ud83d\udc9e',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2470
  'rewind':'\u23ea',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2471
  'rhinoceros':'\ud83e\udd8f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2472
  'ribbon':'\ud83c\udf80',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2473
  'rice':'\ud83c\udf5a',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2474
  'rice_ball':'\ud83c\udf59',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2475
  'rice_cracker':'\ud83c\udf58',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2476
  'rice_scene':'\ud83c\udf91',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2477
  'right_anger_bubble':'\ud83d\uddef',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2478
  'ring':'\ud83d\udc8d',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2479
  'robot':'\ud83e\udd16',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2480
  'rocket':'\ud83d\ude80',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2481
  'rofl':'\ud83e\udd23',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2482
  'roll_eyes':'\ud83d\ude44',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2483
  'roller_coaster':'\ud83c\udfa2',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2484
  'rooster':'\ud83d\udc13',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2485
  'rose':'\ud83c\udf39',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2486
  'rosette':'\ud83c\udff5',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2487
  'rotating_light':'\ud83d\udea8',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2488
  'round_pushpin':'\ud83d\udccd',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2489
  'rowing_man':'\ud83d\udea3',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2490
  'rowing_woman':'\ud83d\udea3&zwj;\u2640\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2491
  'rugby_football':'\ud83c\udfc9',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2492
  'running_man':'\ud83c\udfc3',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2493
  'running_shirt_with_sash':'\ud83c\udfbd',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2494
  'running_woman':'\ud83c\udfc3&zwj;\u2640\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2495
  'sa':'\ud83c\ude02\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2496
  'sagittarius':'\u2650\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2497
  'sake':'\ud83c\udf76',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2498
  'sandal':'\ud83d\udc61',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2499
  'santa':'\ud83c\udf85',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2500
  'satellite':'\ud83d\udce1',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2501
  'saxophone':'\ud83c\udfb7',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2502
  'school':'\ud83c\udfeb',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2503
  'school_satchel':'\ud83c\udf92',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2504
  'scissors':'\u2702\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2505
  'scorpion':'\ud83e\udd82',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2506
  'scorpius':'\u264f\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2507
  'scream':'\ud83d\ude31',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2508
  'scream_cat':'\ud83d\ude40',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2509
  'scroll':'\ud83d\udcdc',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2510
  'seat':'\ud83d\udcba',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2511
  'secret':'\u3299\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2512
  'see_no_evil':'\ud83d\ude48',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2513
  'seedling':'\ud83c\udf31',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2514
  'selfie':'\ud83e\udd33',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2515
  'shallow_pan_of_food':'\ud83e\udd58',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2516
  'shamrock':'\u2618\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2517
  'shark':'\ud83e\udd88',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2518
  'shaved_ice':'\ud83c\udf67',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2519
  'sheep':'\ud83d\udc11',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2520
  'shell':'\ud83d\udc1a',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2521
  'shield':'\ud83d\udee1',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2522
  'shinto_shrine':'\u26e9',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2523
  'ship':'\ud83d\udea2',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2524
  'shirt':'\ud83d\udc55',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2525
  'shopping':'\ud83d\udecd',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2526
  'shopping_cart':'\ud83d\uded2',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2527
  'shower':'\ud83d\udebf',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2528
  'shrimp':'\ud83e\udd90',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2529
  'signal_strength':'\ud83d\udcf6',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2530
  'six_pointed_star':'\ud83d\udd2f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2531
  'ski':'\ud83c\udfbf',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2532
  'skier':'\u26f7',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2533
  'skull':'\ud83d\udc80',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2534
  'skull_and_crossbones':'\u2620\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2535
  'sleeping':'\ud83d\ude34',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2536
  'sleeping_bed':'\ud83d\udecc',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2537
  'sleepy':'\ud83d\ude2a',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2538
  'slightly_frowning_face':'\ud83d\ude41',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2539
  'slightly_smiling_face':'\ud83d\ude42',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2540
  'slot_machine':'\ud83c\udfb0',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2541
  'small_airplane':'\ud83d\udee9',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2542
  'small_blue_diamond':'\ud83d\udd39',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2543
  'small_orange_diamond':'\ud83d\udd38',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2544
  'small_red_triangle':'\ud83d\udd3a',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2545
  'small_red_triangle_down':'\ud83d\udd3b',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2546
  'smile':'\ud83d\ude04',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2547
  'smile_cat':'\ud83d\ude38',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2548
  'smiley':'\ud83d\ude03',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2549
  'smiley_cat':'\ud83d\ude3a',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2550
  'smiling_imp':'\ud83d\ude08',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2551
  'smirk':'\ud83d\ude0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2552
  'smirk_cat':'\ud83d\ude3c',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2553
  'smoking':'\ud83d\udeac',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2554
  'snail':'\ud83d\udc0c',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2555
  'snake':'\ud83d\udc0d',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2556
  'sneezing_face':'\ud83e\udd27',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2557
  'snowboarder':'\ud83c\udfc2',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2558
  'snowflake':'\u2744\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2559
  'snowman':'\u26c4\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2560
  'snowman_with_snow':'\u2603\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2561
  'sob':'\ud83d\ude2d',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2562
  'soccer':'\u26bd\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2563
  'soon':'\ud83d\udd1c',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2564
  'sos':'\ud83c\udd98',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2565
  'sound':'\ud83d\udd09',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2566
  'space_invader':'\ud83d\udc7e',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2567
  'spades':'\u2660\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2568
  'spaghetti':'\ud83c\udf5d',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2569
  'sparkle':'\u2747\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2570
  'sparkler':'\ud83c\udf87',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2571
  'sparkles':'\u2728',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2572
  'sparkling_heart':'\ud83d\udc96',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2573
  'speak_no_evil':'\ud83d\ude4a',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2574
  'speaker':'\ud83d\udd08',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2575
  'speaking_head':'\ud83d\udde3',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2576
  'speech_balloon':'\ud83d\udcac',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2577
  'speedboat':'\ud83d\udea4',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2578
  'spider':'\ud83d\udd77',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2579
  'spider_web':'\ud83d\udd78',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2580
  'spiral_calendar':'\ud83d\uddd3',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2581
  'spiral_notepad':'\ud83d\uddd2',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2582
  'spoon':'\ud83e\udd44',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2583
  'squid':'\ud83e\udd91',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2584
  'stadium':'\ud83c\udfdf',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2585
  'star':'\u2b50\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2586
  'star2':'\ud83c\udf1f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2587
  'star_and_crescent':'\u262a\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2588
  'star_of_david':'\u2721\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2589
  'stars':'\ud83c\udf20',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2590
  'station':'\ud83d\ude89',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2591
  'statue_of_liberty':'\ud83d\uddfd',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2592
  'steam_locomotive':'\ud83d\ude82',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2593
  'stew':'\ud83c\udf72',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2594
  'stop_button':'\u23f9',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2595
  'stop_sign':'\ud83d\uded1',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2596
  'stopwatch':'\u23f1',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2597
  'straight_ruler':'\ud83d\udccf',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2598
  'strawberry':'\ud83c\udf53',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2599
  'stuck_out_tongue':'\ud83d\ude1b',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2600
  'stuck_out_tongue_closed_eyes':'\ud83d\ude1d',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2601
  'stuck_out_tongue_winking_eye':'\ud83d\ude1c',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2602
  'studio_microphone':'\ud83c\udf99',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2603
  'stuffed_flatbread':'\ud83e\udd59',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2604
  'sun_behind_large_cloud':'\ud83c\udf25',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2605
  'sun_behind_rain_cloud':'\ud83c\udf26',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2606
  'sun_behind_small_cloud':'\ud83c\udf24',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2607
  'sun_with_face':'\ud83c\udf1e',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2608
  'sunflower':'\ud83c\udf3b',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2609
  'sunglasses':'\ud83d\ude0e',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2610
  'sunny':'\u2600\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2611
  'sunrise':'\ud83c\udf05',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2612
  'sunrise_over_mountains':'\ud83c\udf04',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2613
  'surfing_man':'\ud83c\udfc4',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2614
  'surfing_woman':'\ud83c\udfc4&zwj;\u2640\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2615
  'sushi':'\ud83c\udf63',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2616
  'suspension_railway':'\ud83d\ude9f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2617
  'sweat':'\ud83d\ude13',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2618
  'sweat_drops':'\ud83d\udca6',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2619
  'sweat_smile':'\ud83d\ude05',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2620
  'sweet_potato':'\ud83c\udf60',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2621
  'swimming_man':'\ud83c\udfca',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2622
  'swimming_woman':'\ud83c\udfca&zwj;\u2640\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2623
  'symbols':'\ud83d\udd23',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2624
  'synagogue':'\ud83d\udd4d',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2625
  'syringe':'\ud83d\udc89',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2626
  'taco':'\ud83c\udf2e',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2627
  'tada':'\ud83c\udf89',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2628
  'tanabata_tree':'\ud83c\udf8b',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2629
  'taurus':'\u2649\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2630
  'taxi':'\ud83d\ude95',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2631
  'tea':'\ud83c\udf75',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2632
  'telephone_receiver':'\ud83d\udcde',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2633
  'telescope':'\ud83d\udd2d',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2634
  'tennis':'\ud83c\udfbe',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2635
  'tent':'\u26fa\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2636
  'thermometer':'\ud83c\udf21',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2637
  'thinking':'\ud83e\udd14',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2638
  'thought_balloon':'\ud83d\udcad',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2639
  'ticket':'\ud83c\udfab',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2640
  'tickets':'\ud83c\udf9f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2641
  'tiger':'\ud83d\udc2f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2642
  'tiger2':'\ud83d\udc05',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2643
  'timer_clock':'\u23f2',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2644
  'tipping_hand_man':'\ud83d\udc81&zwj;\u2642\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2645
  'tired_face':'\ud83d\ude2b',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2646
  'tm':'\u2122\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2647
  'toilet':'\ud83d\udebd',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2648
  'tokyo_tower':'\ud83d\uddfc',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2649
  'tomato':'\ud83c\udf45',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2650
  'tongue':'\ud83d\udc45',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2651
  'top':'\ud83d\udd1d',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2652
  'tophat':'\ud83c\udfa9',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2653
  'tornado':'\ud83c\udf2a',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2654
  'trackball':'\ud83d\uddb2',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2655
  'tractor':'\ud83d\ude9c',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2656
  'traffic_light':'\ud83d\udea5',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2657
  'train':'\ud83d\ude8b',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2658
  'train2':'\ud83d\ude86',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2659
  'tram':'\ud83d\ude8a',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2660
  'triangular_flag_on_post':'\ud83d\udea9',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2661
  'triangular_ruler':'\ud83d\udcd0',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2662
  'trident':'\ud83d\udd31',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2663
  'triumph':'\ud83d\ude24',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2664
  'trolleybus':'\ud83d\ude8e',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2665
  'trophy':'\ud83c\udfc6',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2666
  'tropical_drink':'\ud83c\udf79',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2667
  'tropical_fish':'\ud83d\udc20',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2668
  'truck':'\ud83d\ude9a',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2669
  'trumpet':'\ud83c\udfba',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2670
  'tulip':'\ud83c\udf37',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2671
  'tumbler_glass':'\ud83e\udd43',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2672
  'turkey':'\ud83e\udd83',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2673
  'turtle':'\ud83d\udc22',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2674
  'tv':'\ud83d\udcfa',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2675
  'twisted_rightwards_arrows':'\ud83d\udd00',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2676
  'two_hearts':'\ud83d\udc95',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2677
  'two_men_holding_hands':'\ud83d\udc6c',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2678
  'two_women_holding_hands':'\ud83d\udc6d',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2679
  'u5272':'\ud83c\ude39',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2680
  'u5408':'\ud83c\ude34',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2681
  'u55b6':'\ud83c\ude3a',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2682
  'u6307':'\ud83c\ude2f\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2683
  'u6708':'\ud83c\ude37\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2684
  'u6709':'\ud83c\ude36',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2685
  'u6e80':'\ud83c\ude35',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2686
  'u7121':'\ud83c\ude1a\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2687
  'u7533':'\ud83c\ude38',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2688
  'u7981':'\ud83c\ude32',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2689
  'u7a7a':'\ud83c\ude33',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2690
  'umbrella':'\u2614\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2691
  'unamused':'\ud83d\ude12',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2692
  'underage':'\ud83d\udd1e',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2693
  'unicorn':'\ud83e\udd84',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2694
  'unlock':'\ud83d\udd13',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2695
  'up':'\ud83c\udd99',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2696
  'upside_down_face':'\ud83d\ude43',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2697
  'v':'\u270c\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2698
  'vertical_traffic_light':'\ud83d\udea6',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2699
  'vhs':'\ud83d\udcfc',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2700
  'vibration_mode':'\ud83d\udcf3',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2701
  'video_camera':'\ud83d\udcf9',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2702
  'video_game':'\ud83c\udfae',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2703
  'violin':'\ud83c\udfbb',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2704
  'virgo':'\u264d\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2705
  'volcano':'\ud83c\udf0b',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2706
  'volleyball':'\ud83c\udfd0',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2707
  'vs':'\ud83c\udd9a',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2708
  'vulcan_salute':'\ud83d\udd96',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2709
  'walking_man':'\ud83d\udeb6',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2710
  'walking_woman':'\ud83d\udeb6&zwj;\u2640\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2711
  'waning_crescent_moon':'\ud83c\udf18',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2712
  'waning_gibbous_moon':'\ud83c\udf16',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2713
  'warning':'\u26a0\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2714
  'wastebasket':'\ud83d\uddd1',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2715
  'watch':'\u231a\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2716
  'water_buffalo':'\ud83d\udc03',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2717
  'watermelon':'\ud83c\udf49',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2718
  'wave':'\ud83d\udc4b',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2719
  'wavy_dash':'\u3030\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2720
  'waxing_crescent_moon':'\ud83c\udf12',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2721
  'wc':'\ud83d\udebe',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2722
  'weary':'\ud83d\ude29',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2723
  'wedding':'\ud83d\udc92',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2724
  'weight_lifting_man':'\ud83c\udfcb\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2725
  'weight_lifting_woman':'\ud83c\udfcb\ufe0f&zwj;\u2640\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2726
  'whale':'\ud83d\udc33',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2727
  'whale2':'\ud83d\udc0b',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2728
  'wheel_of_dharma':'\u2638\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2729
  'wheelchair':'\u267f\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2730
  'white_check_mark':'\u2705',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2731
  'white_circle':'\u26aa\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2732
  'white_flag':'\ud83c\udff3\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2733
  'white_flower':'\ud83d\udcae',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2734
  'white_large_square':'\u2b1c\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2735
  'white_medium_small_square':'\u25fd\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2736
  'white_medium_square':'\u25fb\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2737
  'white_small_square':'\u25ab\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2738
  'white_square_button':'\ud83d\udd33',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2739
  'wilted_flower':'\ud83e\udd40',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2740
  'wind_chime':'\ud83c\udf90',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2741
  'wind_face':'\ud83c\udf2c',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2742
  'wine_glass':'\ud83c\udf77',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2743
  'wink':'\ud83d\ude09',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2744
  'wolf':'\ud83d\udc3a',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2745
  'woman':'\ud83d\udc69',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2746
  'woman_artist':'\ud83d\udc69&zwj;\ud83c\udfa8',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2747
  'woman_astronaut':'\ud83d\udc69&zwj;\ud83d\ude80',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2748
  'woman_cartwheeling':'\ud83e\udd38&zwj;\u2640\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2749
  'woman_cook':'\ud83d\udc69&zwj;\ud83c\udf73',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2750
  'woman_facepalming':'\ud83e\udd26&zwj;\u2640\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2751
  'woman_factory_worker':'\ud83d\udc69&zwj;\ud83c\udfed',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2752
  'woman_farmer':'\ud83d\udc69&zwj;\ud83c\udf3e',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2753
  'woman_firefighter':'\ud83d\udc69&zwj;\ud83d\ude92',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2754
  'woman_health_worker':'\ud83d\udc69&zwj;\u2695\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2755
  'woman_judge':'\ud83d\udc69&zwj;\u2696\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2756
  'woman_juggling':'\ud83e\udd39&zwj;\u2640\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2757
  'woman_mechanic':'\ud83d\udc69&zwj;\ud83d\udd27',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2758
  'woman_office_worker':'\ud83d\udc69&zwj;\ud83d\udcbc',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2759
  'woman_pilot':'\ud83d\udc69&zwj;\u2708\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2760
  'woman_playing_handball':'\ud83e\udd3e&zwj;\u2640\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2761
  'woman_playing_water_polo':'\ud83e\udd3d&zwj;\u2640\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2762
  'woman_scientist':'\ud83d\udc69&zwj;\ud83d\udd2c',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2763
  'woman_shrugging':'\ud83e\udd37&zwj;\u2640\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2764
  'woman_singer':'\ud83d\udc69&zwj;\ud83c\udfa4',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2765
  'woman_student':'\ud83d\udc69&zwj;\ud83c\udf93',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2766
  'woman_teacher':'\ud83d\udc69&zwj;\ud83c\udfeb',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2767
  'woman_technologist':'\ud83d\udc69&zwj;\ud83d\udcbb',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2768
  'woman_with_turban':'\ud83d\udc73&zwj;\u2640\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2769
  'womans_clothes':'\ud83d\udc5a',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2770
  'womans_hat':'\ud83d\udc52',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2771
  'women_wrestling':'\ud83e\udd3c&zwj;\u2640\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2772
  'womens':'\ud83d\udeba',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2773
  'world_map':'\ud83d\uddfa',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2774
  'worried':'\ud83d\ude1f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2775
  'wrench':'\ud83d\udd27',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2776
  'writing_hand':'\u270d\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2777
  'x':'\u274c',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2778
  'yellow_heart':'\ud83d\udc9b',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2779
  'yen':'\ud83d\udcb4',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2780
  'yin_yang':'\u262f\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2781
  'yum':'\ud83d\ude0b',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2782
  'zap':'\u26a1\ufe0f',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2783
  'zipper_mouth_face':'\ud83e\udd10',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2784
  'zzz':'\ud83d\udca4',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2785
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2786
  /* special emojis :P */
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2787
  'octocat':  '<img alt=":octocat:" height="20" width="20" align="absmiddle" src="https://assets-cdn.github.com/images/icons/emoji/octocat.png">',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2788
  'showdown': '<span style="font-family: \'Anonymous Pro\', monospace; text-decoration: underline; text-decoration-style: dashed; text-decoration-color: #3e8b8a;text-underline-position: under;">S</span>'
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2789
};
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2790
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2791
/**
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2792
 * Created by Estevao on 31-05-2015.
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2793
 */
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2794
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2795
/**
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2796
 * Showdown Converter class
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2797
 * @class
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2798
 * @param {object} [converterOptions]
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2799
 * @returns {Converter}
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2800
 */
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2801
showdown.Converter = function (converterOptions) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2802
  'use strict';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2803
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2804
  var
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2805
      /**
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2806
       * Options used by this converter
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2807
       * @private
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2808
       * @type {{}}
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2809
       */
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2810
      options = {},
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2811
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2812
      /**
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2813
       * Language extensions used by this converter
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2814
       * @private
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2815
       * @type {Array}
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2816
       */
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2817
      langExtensions = [],
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2818
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2819
      /**
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2820
       * Output modifiers extensions used by this converter
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2821
       * @private
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2822
       * @type {Array}
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2823
       */
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2824
      outputModifiers = [],
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2825
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2826
      /**
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2827
       * Event listeners
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2828
       * @private
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2829
       * @type {{}}
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2830
       */
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2831
      listeners = {},
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2832
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2833
      /**
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2834
       * The flavor set in this converter
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2835
       */
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2836
      setConvFlavor = setFlavor,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2837
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
  2838
      /**
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
  2839
       * Metadata of the document
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
  2840
       * @type {{parsed: {}, raw: string, format: string}}
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
  2841
       */
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2842
      metadata = {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2843
        parsed: {},
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2844
        raw: '',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2845
        format: ''
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2846
      };
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2847
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2848
  _constructor();
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2849
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2850
  /**
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2851
   * Converter constructor
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2852
   * @private
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2853
   */
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2854
  function _constructor () {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2855
    converterOptions = converterOptions || {};
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2856
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2857
    for (var gOpt in globalOptions) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2858
      if (globalOptions.hasOwnProperty(gOpt)) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2859
        options[gOpt] = globalOptions[gOpt];
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2860
      }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2861
    }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2862
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2863
    // Merge options
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2864
    if (typeof converterOptions === 'object') {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2865
      for (var opt in converterOptions) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2866
        if (converterOptions.hasOwnProperty(opt)) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2867
          options[opt] = converterOptions[opt];
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2868
        }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2869
      }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2870
    } else {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2871
      throw Error('Converter expects the passed parameter to be an object, but ' + typeof converterOptions +
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2872
      ' was passed instead.');
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2873
    }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2874
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2875
    if (options.extensions) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2876
      showdown.helper.forEach(options.extensions, _parseExtension);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2877
    }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2878
  }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2879
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2880
  /**
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2881
   * Parse extension
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2882
   * @param {*} ext
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2883
   * @param {string} [name='']
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2884
   * @private
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2885
   */
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2886
  function _parseExtension (ext, name) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2887
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2888
    name = name || null;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2889
    // If it's a string, the extension was previously loaded
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2890
    if (showdown.helper.isString(ext)) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2891
      ext = showdown.helper.stdExtName(ext);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2892
      name = ext;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2893
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2894
      // LEGACY_SUPPORT CODE
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2895
      if (showdown.extensions[ext]) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2896
        console.warn('DEPRECATION WARNING: ' + ext + ' is an old extension that uses a deprecated loading method.' +
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2897
          'Please inform the developer that the extension should be updated!');
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2898
        legacyExtensionLoading(showdown.extensions[ext], ext);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2899
        return;
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
  2900
        // END LEGACY SUPPORT CODE
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2901
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2902
      } else if (!showdown.helper.isUndefined(extensions[ext])) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2903
        ext = extensions[ext];
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2904
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2905
      } else {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2906
        throw Error('Extension "' + ext + '" could not be loaded. It was either not found or is not a valid extension.');
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2907
      }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2908
    }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2909
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2910
    if (typeof ext === 'function') {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2911
      ext = ext();
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2912
    }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2913
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2914
    if (!showdown.helper.isArray(ext)) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2915
      ext = [ext];
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2916
    }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2917
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2918
    var validExt = validate(ext, name);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2919
    if (!validExt.valid) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2920
      throw Error(validExt.error);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2921
    }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2922
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2923
    for (var i = 0; i < ext.length; ++i) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2924
      switch (ext[i].type) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2925
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2926
        case 'lang':
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2927
          langExtensions.push(ext[i]);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2928
          break;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2929
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2930
        case 'output':
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2931
          outputModifiers.push(ext[i]);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2932
          break;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2933
      }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2934
      if (ext[i].hasOwnProperty('listeners')) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2935
        for (var ln in ext[i].listeners) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2936
          if (ext[i].listeners.hasOwnProperty(ln)) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2937
            listen(ln, ext[i].listeners[ln]);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2938
          }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2939
        }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2940
      }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2941
    }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2942
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2943
  }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2944
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2945
  /**
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2946
   * LEGACY_SUPPORT
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2947
   * @param {*} ext
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2948
   * @param {string} name
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2949
   */
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2950
  function legacyExtensionLoading (ext, name) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2951
    if (typeof ext === 'function') {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2952
      ext = ext(new showdown.Converter());
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2953
    }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2954
    if (!showdown.helper.isArray(ext)) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2955
      ext = [ext];
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2956
    }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2957
    var valid = validate(ext, name);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2958
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2959
    if (!valid.valid) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2960
      throw Error(valid.error);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2961
    }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2962
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2963
    for (var i = 0; i < ext.length; ++i) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2964
      switch (ext[i].type) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2965
        case 'lang':
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2966
          langExtensions.push(ext[i]);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2967
          break;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2968
        case 'output':
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2969
          outputModifiers.push(ext[i]);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2970
          break;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2971
        default:// should never reach here
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2972
          throw Error('Extension loader error: Type unrecognized!!!');
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2973
      }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2974
    }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2975
  }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2976
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2977
  /**
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2978
   * Listen to an event
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2979
   * @param {string} name
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2980
   * @param {function} callback
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2981
   */
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2982
  function listen (name, callback) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2983
    if (!showdown.helper.isString(name)) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2984
      throw Error('Invalid argument in converter.listen() method: name must be a string, but ' + typeof name + ' given');
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2985
    }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2986
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2987
    if (typeof callback !== 'function') {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2988
      throw Error('Invalid argument in converter.listen() method: callback must be a function, but ' + typeof callback + ' given');
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2989
    }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2990
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2991
    if (!listeners.hasOwnProperty(name)) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2992
      listeners[name] = [];
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2993
    }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2994
    listeners[name].push(callback);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2995
  }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2996
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2997
  function rTrimInputText (text) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2998
    var rsp = text.match(/^\s*/)[0].length,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2999
        rgx = new RegExp('^\\s{0,' + rsp + '}', 'gm');
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3000
    return text.replace(rgx, '');
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3001
  }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3002
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3003
  /**
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3004
   * Dispatch an event
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3005
   * @private
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3006
   * @param {string} evtName Event name
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3007
   * @param {string} text Text
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3008
   * @param {{}} options Converter Options
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3009
   * @param {{}} globals
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3010
   * @returns {string}
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3011
   */
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3012
  this._dispatch = function dispatch (evtName, text, options, globals) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3013
    if (listeners.hasOwnProperty(evtName)) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3014
      for (var ei = 0; ei < listeners[evtName].length; ++ei) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3015
        var nText = listeners[evtName][ei](evtName, text, this, options, globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3016
        if (nText && typeof nText !== 'undefined') {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3017
          text = nText;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3018
        }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3019
      }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3020
    }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3021
    return text;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3022
  };
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3023
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3024
  /**
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3025
   * Listen to an event
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3026
   * @param {string} name
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3027
   * @param {function} callback
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3028
   * @returns {showdown.Converter}
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3029
   */
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3030
  this.listen = function (name, callback) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3031
    listen(name, callback);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3032
    return this;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3033
  };
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3034
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3035
  /**
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3036
   * Converts a markdown string into HTML
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3037
   * @param {string} text
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3038
   * @returns {*}
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3039
   */
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3040
  this.makeHtml = function (text) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3041
    //check if text is not falsy
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3042
    if (!text) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3043
      return text;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3044
    }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3045
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3046
    var globals = {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3047
      gHtmlBlocks:     [],
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3048
      gHtmlMdBlocks:   [],
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3049
      gHtmlSpans:      [],
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3050
      gUrls:           {},
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3051
      gTitles:         {},
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3052
      gDimensions:     {},
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3053
      gListLevel:      0,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3054
      hashLinkCounts:  {},
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3055
      langExtensions:  langExtensions,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3056
      outputModifiers: outputModifiers,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3057
      converter:       this,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3058
      ghCodeBlocks:    [],
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3059
      metadata: {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3060
        parsed: {},
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3061
        raw: '',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3062
        format: ''
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3063
      }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3064
    };
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3065
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3066
    // This lets us use ¨ trema as an escape char to avoid md5 hashes
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3067
    // The choice of character is arbitrary; anything that isn't
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3068
    // magic in Markdown will work.
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3069
    text = text.replace(/¨/g, '¨T');
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3070
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3071
    // Replace $ with ¨D
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3072
    // RegExp interprets $ as a special character
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3073
    // when it's in a replacement string
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3074
    text = text.replace(/\$/g, '¨D');
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3075
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3076
    // Standardize line endings
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3077
    text = text.replace(/\r\n/g, '\n'); // DOS to Unix
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3078
    text = text.replace(/\r/g, '\n'); // Mac to Unix
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3079
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3080
    // Stardardize line spaces
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3081
    text = text.replace(/\u00A0/g, '&nbsp;');
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3082
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3083
    if (options.smartIndentationFix) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3084
      text = rTrimInputText(text);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3085
    }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3086
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3087
    // Make sure text begins and ends with a couple of newlines:
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3088
    text = '\n\n' + text + '\n\n';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3089
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3090
    // detab
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3091
    text = showdown.subParser('detab')(text, options, globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3092
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3093
    /**
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3094
     * Strip any lines consisting only of spaces and tabs.
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3095
     * This makes subsequent regexs easier to write, because we can
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3096
     * match consecutive blank lines with /\n+/ instead of something
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3097
     * contorted like /[ \t]*\n+/
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3098
     */
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3099
    text = text.replace(/^[ \t]+$/mg, '');
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3100
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3101
    //run languageExtensions
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3102
    showdown.helper.forEach(langExtensions, function (ext) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3103
      text = showdown.subParser('runExtension')(ext, text, options, globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3104
    });
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3105
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3106
    // run the sub parsers
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3107
    text = showdown.subParser('metadata')(text, options, globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3108
    text = showdown.subParser('hashPreCodeTags')(text, options, globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3109
    text = showdown.subParser('githubCodeBlocks')(text, options, globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3110
    text = showdown.subParser('hashHTMLBlocks')(text, options, globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3111
    text = showdown.subParser('hashCodeTags')(text, options, globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3112
    text = showdown.subParser('stripLinkDefinitions')(text, options, globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3113
    text = showdown.subParser('blockGamut')(text, options, globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3114
    text = showdown.subParser('unhashHTMLSpans')(text, options, globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3115
    text = showdown.subParser('unescapeSpecialChars')(text, options, globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3116
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3117
    // attacklab: Restore dollar signs
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3118
    text = text.replace(/¨D/g, '$$');
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3119
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3120
    // attacklab: Restore tremas
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3121
    text = text.replace(/¨T/g, '¨');
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3122
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3123
    // render a complete html document instead of a partial if the option is enabled
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3124
    text = showdown.subParser('completeHTMLDocument')(text, options, globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3125
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3126
    // Run output modifiers
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3127
    showdown.helper.forEach(outputModifiers, function (ext) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3128
      text = showdown.subParser('runExtension')(ext, text, options, globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3129
    });
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3130
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3131
    // update metadata
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3132
    metadata = globals.metadata;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3133
    return text;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3134
  };
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3135
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3136
  /**
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3137
   * Converts an HTML string into a markdown string
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3138
   * @param src
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3139
   * @param [HTMLParser] A WHATWG DOM and HTML parser, such as JSDOM. If none is supplied, window.document will be used.
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3140
   * @returns {string}
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3141
   */
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3142
  this.makeMarkdown = this.makeMd = function (src, HTMLParser) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3143
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3144
    // replace \r\n with \n
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3145
    src = src.replace(/\r\n/g, '\n');
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3146
    src = src.replace(/\r/g, '\n'); // old macs
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3147
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3148
    // due to an edge case, we need to find this: > <
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3149
    // to prevent removing of non silent white spaces
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3150
    // ex: <em>this is</em> <strong>sparta</strong>
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3151
    src = src.replace(/>[ \t]+</, '>¨NBSP;<');
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3152
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3153
    if (!HTMLParser) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3154
      if (window && window.document) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3155
        HTMLParser = window.document;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3156
      } else {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3157
        throw new Error('HTMLParser is undefined. If in a webworker or nodejs environment, you need to provide a WHATWG DOM and HTML such as JSDOM');
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3158
      }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3159
    }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3160
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3161
    var doc = HTMLParser.createElement('div');
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3162
    doc.innerHTML = src;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3163
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3164
    var globals = {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3165
      preList: substitutePreCodeTags(doc)
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3166
    };
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3167
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3168
    // remove all newlines and collapse spaces
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3169
    clean(doc);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3170
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3171
    // some stuff, like accidental reference links must now be escaped
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3172
    // TODO
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3173
    // doc.innerHTML = doc.innerHTML.replace(/\[[\S\t ]]/);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3174
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3175
    var nodes = doc.childNodes,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3176
        mdDoc = '';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3177
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3178
    for (var i = 0; i < nodes.length; i++) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3179
      mdDoc += showdown.subParser('makeMarkdown.node')(nodes[i], globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3180
    }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3181
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3182
    function clean (node) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3183
      for (var n = 0; n < node.childNodes.length; ++n) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3184
        var child = node.childNodes[n];
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3185
        if (child.nodeType === 3) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3186
          if (!/\S/.test(child.nodeValue)) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3187
            node.removeChild(child);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3188
            --n;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3189
          } else {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3190
            child.nodeValue = child.nodeValue.split('\n').join(' ');
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3191
            child.nodeValue = child.nodeValue.replace(/(\s)+/g, '$1');
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3192
          }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3193
        } else if (child.nodeType === 1) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3194
          clean(child);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3195
        }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3196
      }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3197
    }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3198
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3199
    // find all pre tags and replace contents with placeholder
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3200
    // we need this so that we can remove all indentation from html
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3201
    // to ease up parsing
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3202
    function substitutePreCodeTags (doc) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3203
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3204
      var pres = doc.querySelectorAll('pre'),
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3205
          presPH = [];
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3206
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3207
      for (var i = 0; i < pres.length; ++i) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3208
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3209
        if (pres[i].childElementCount === 1 && pres[i].firstChild.tagName.toLowerCase() === 'code') {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3210
          var content = pres[i].firstChild.innerHTML.trim(),
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3211
              language = pres[i].firstChild.getAttribute('data-language') || '';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3212
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3213
          // if data-language attribute is not defined, then we look for class language-*
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3214
          if (language === '') {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3215
            var classes = pres[i].firstChild.className.split(' ');
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3216
            for (var c = 0; c < classes.length; ++c) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3217
              var matches = classes[c].match(/^language-(.+)$/);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3218
              if (matches !== null) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3219
                language = matches[1];
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3220
                break;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3221
              }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3222
            }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3223
          }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3224
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3225
          // unescape html entities in content
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3226
          content = showdown.helper.unescapeHTMLEntities(content);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3227
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3228
          presPH.push(content);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3229
          pres[i].outerHTML = '<precode language="' + language + '" precodenum="' + i.toString() + '"></precode>';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3230
        } else {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3231
          presPH.push(pres[i].innerHTML);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3232
          pres[i].innerHTML = '';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3233
          pres[i].setAttribute('prenum', i.toString());
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3234
        }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3235
      }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3236
      return presPH;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3237
    }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3238
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3239
    return mdDoc;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3240
  };
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3241
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3242
  /**
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3243
   * Set an option of this Converter instance
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3244
   * @param {string} key
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3245
   * @param {*} value
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3246
   */
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3247
  this.setOption = function (key, value) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3248
    options[key] = value;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3249
  };
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3250
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3251
  /**
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3252
   * Get the option of this Converter instance
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3253
   * @param {string} key
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3254
   * @returns {*}
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3255
   */
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3256
  this.getOption = function (key) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3257
    return options[key];
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3258
  };
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3259
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3260
  /**
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3261
   * Get the options of this Converter instance
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3262
   * @returns {{}}
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3263
   */
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3264
  this.getOptions = function () {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3265
    return options;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3266
  };
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3267
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3268
  /**
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3269
   * Add extension to THIS converter
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3270
   * @param {{}} extension
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3271
   * @param {string} [name=null]
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3272
   */
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3273
  this.addExtension = function (extension, name) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3274
    name = name || null;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3275
    _parseExtension(extension, name);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3276
  };
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3277
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3278
  /**
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3279
   * Use a global registered extension with THIS converter
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3280
   * @param {string} extensionName Name of the previously registered extension
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3281
   */
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3282
  this.useExtension = function (extensionName) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3283
    _parseExtension(extensionName);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3284
  };
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3285
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3286
  /**
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3287
   * Set the flavor THIS converter should use
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3288
   * @param {string} name
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3289
   */
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3290
  this.setFlavor = function (name) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3291
    if (!flavor.hasOwnProperty(name)) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3292
      throw Error(name + ' flavor was not found');
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3293
    }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3294
    var preset = flavor[name];
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3295
    setConvFlavor = name;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3296
    for (var option in preset) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3297
      if (preset.hasOwnProperty(option)) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3298
        options[option] = preset[option];
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3299
      }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3300
    }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3301
  };
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3302
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3303
  /**
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3304
   * Get the currently set flavor of this converter
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3305
   * @returns {string}
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3306
   */
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3307
  this.getFlavor = function () {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3308
    return setConvFlavor;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3309
  };
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3310
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3311
  /**
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3312
   * Remove an extension from THIS converter.
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3313
   * Note: This is a costly operation. It's better to initialize a new converter
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3314
   * and specify the extensions you wish to use
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3315
   * @param {Array} extension
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3316
   */
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3317
  this.removeExtension = function (extension) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3318
    if (!showdown.helper.isArray(extension)) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3319
      extension = [extension];
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3320
    }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3321
    for (var a = 0; a < extension.length; ++a) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3322
      var ext = extension[a];
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3323
      for (var i = 0; i < langExtensions.length; ++i) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3324
        if (langExtensions[i] === ext) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3325
          langExtensions[i].splice(i, 1);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3326
        }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3327
      }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3328
      for (var ii = 0; ii < outputModifiers.length; ++i) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3329
        if (outputModifiers[ii] === ext) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3330
          outputModifiers[ii].splice(i, 1);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3331
        }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3332
      }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3333
    }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3334
  };
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3335
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3336
  /**
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3337
   * Get all extension of THIS converter
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3338
   * @returns {{language: Array, output: Array}}
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3339
   */
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3340
  this.getAllExtensions = function () {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3341
    return {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3342
      language: langExtensions,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3343
      output: outputModifiers
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3344
    };
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3345
  };
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3346
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3347
  /**
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3348
   * Get the metadata of the previously parsed document
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3349
   * @param raw
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3350
   * @returns {string|{}}
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3351
   */
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3352
  this.getMetadata = function (raw) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3353
    if (raw) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3354
      return metadata.raw;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3355
    } else {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3356
      return metadata.parsed;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3357
    }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3358
  };
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3359
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3360
  /**
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3361
   * Get the metadata format of the previously parsed document
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3362
   * @returns {string}
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3363
   */
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3364
  this.getMetadataFormat = function () {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3365
    return metadata.format;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3366
  };
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3367
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3368
  /**
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3369
   * Private: set a single key, value metadata pair
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3370
   * @param {string} key
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3371
   * @param {string} value
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3372
   */
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3373
  this._setMetadataPair = function (key, value) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3374
    metadata.parsed[key] = value;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3375
  };
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3376
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3377
  /**
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3378
   * Private: set metadata format
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3379
   * @param {string} format
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3380
   */
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3381
  this._setMetadataFormat = function (format) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3382
    metadata.format = format;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3383
  };
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3384
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3385
  /**
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3386
   * Private: set metadata raw text
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3387
   * @param {string} raw
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3388
   */
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3389
  this._setMetadataRaw = function (raw) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3390
    metadata.raw = raw;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3391
  };
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3392
};
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3393
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3394
/**
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3395
 * Turn Markdown link shortcuts into XHTML <a> tags.
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3396
 */
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3397
showdown.subParser('anchors', function (text, options, globals) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3398
  'use strict';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3399
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3400
  text = globals.converter._dispatch('anchors.before', text, options, globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3401
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3402
  var writeAnchorTag = function (wholeMatch, linkText, linkId, url, m5, m6, title) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3403
    if (showdown.helper.isUndefined(title)) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3404
      title = '';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3405
    }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3406
    linkId = linkId.toLowerCase();
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3407
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3408
    // Special case for explicit empty url
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3409
    if (wholeMatch.search(/\(<?\s*>? ?(['"].*['"])?\)$/m) > -1) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3410
      url = '';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3411
    } else if (!url) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3412
      if (!linkId) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3413
        // lower-case and turn embedded newlines into spaces
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3414
        linkId = linkText.toLowerCase().replace(/ ?\n/g, ' ');
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3415
      }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3416
      url = '#' + linkId;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3417
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3418
      if (!showdown.helper.isUndefined(globals.gUrls[linkId])) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3419
        url = globals.gUrls[linkId];
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3420
        if (!showdown.helper.isUndefined(globals.gTitles[linkId])) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3421
          title = globals.gTitles[linkId];
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3422
        }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3423
      } else {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3424
        return wholeMatch;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3425
      }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3426
    }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3427
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3428
    //url = showdown.helper.escapeCharacters(url, '*_', false); // replaced line to improve performance
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3429
    url = url.replace(showdown.helper.regexes.asteriskDashAndColon, showdown.helper.escapeCharactersCallback);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3430
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3431
    var result = '<a href="' + url + '"';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3432
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3433
    if (title !== '' && title !== null) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3434
      title = title.replace(/"/g, '&quot;');
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3435
      //title = showdown.helper.escapeCharacters(title, '*_', false); // replaced line to improve performance
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3436
      title = title.replace(showdown.helper.regexes.asteriskDashAndColon, showdown.helper.escapeCharactersCallback);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3437
      result += ' title="' + title + '"';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3438
    }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3439
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3440
    // optionLinksInNewWindow only applies
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3441
    // to external links. Hash links (#) open in same page
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3442
    if (options.openLinksInNewWindow && !/^#/.test(url)) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3443
      // escaped _
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
  3444
      result += ' rel="noopener noreferrer" target="¨E95Eblank"';
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3445
    }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3446
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3447
    result += '>' + linkText + '</a>';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3448
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3449
    return result;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3450
  };
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3451
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3452
  // First, handle reference-style links: [link text] [id]
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3453
  text = text.replace(/\[((?:\[[^\]]*]|[^\[\]])*)] ?(?:\n *)?\[(.*?)]()()()()/g, writeAnchorTag);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3454
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3455
  // Next, inline-style links: [link text](url "optional title")
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3456
  // cases with crazy urls like ./image/cat1).png
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3457
  text = text.replace(/\[((?:\[[^\]]*]|[^\[\]])*)]()[ \t]*\([ \t]?<([^>]*)>(?:[ \t]*((["'])([^"]*?)\5))?[ \t]?\)/g,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3458
    writeAnchorTag);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3459
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3460
  // normal cases
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3461
  text = text.replace(/\[((?:\[[^\]]*]|[^\[\]])*)]()[ \t]*\([ \t]?<?([\S]+?(?:\([\S]*?\)[\S]*?)?)>?(?:[ \t]*((["'])([^"]*?)\5))?[ \t]?\)/g,
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
  3462
    writeAnchorTag);
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3463
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3464
  // handle reference-style shortcuts: [link text]
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3465
  // These must come last in case you've also got [link test][1]
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3466
  // or [link test](/foo)
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3467
  text = text.replace(/\[([^\[\]]+)]()()()()()/g, writeAnchorTag);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3468
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3469
  // Lastly handle GithubMentions if option is enabled
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3470
  if (options.ghMentions) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3471
    text = text.replace(/(^|\s)(\\)?(@([a-z\d]+(?:[a-z\d.-]+?[a-z\d]+)*))/gmi, function (wm, st, escape, mentions, username) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3472
      if (escape === '\\') {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3473
        return st + mentions;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3474
      }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3475
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3476
      //check if options.ghMentionsLink is a string
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3477
      if (!showdown.helper.isString(options.ghMentionsLink)) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3478
        throw new Error('ghMentionsLink option must be a string');
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3479
      }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3480
      var lnk = options.ghMentionsLink.replace(/\{u}/g, username),
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3481
          target = '';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3482
      if (options.openLinksInNewWindow) {
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
  3483
        target = ' rel="noopener noreferrer" target="¨E95Eblank"';
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3484
      }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3485
      return st + '<a href="' + lnk + '"' + target + '>' + mentions + '</a>';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3486
    });
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3487
  }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3488
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3489
  text = globals.converter._dispatch('anchors.after', text, options, globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3490
  return text;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3491
});
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3492
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3493
// url allowed chars [a-z\d_.~:/?#[]@!$&'()*+,;=-]
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3494
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3495
var simpleURLRegex  = /([*~_]+|\b)(((https?|ftp|dict):\/\/|www\.)[^'">\s]+?\.[^'">\s]+?)()(\1)?(?=\s|$)(?!["<>])/gi,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3496
    simpleURLRegex2 = /([*~_]+|\b)(((https?|ftp|dict):\/\/|www\.)[^'">\s]+\.[^'">\s]+?)([.!?,()\[\]])?(\1)?(?=\s|$)(?!["<>])/gi,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3497
    delimUrlRegex   = /()<(((https?|ftp|dict):\/\/|www\.)[^'">\s]+)()>()/gi,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3498
    simpleMailRegex = /(^|\s)(?:mailto:)?([A-Za-z0-9!#$%&'*+-/=?^_`{|}~.]+@[-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+)(?=$|\s)/gmi,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3499
    delimMailRegex  = /<()(?:mailto:)?([-.\w]+@[-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+)>/gi,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3500
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3501
    replaceLink = function (options) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3502
      'use strict';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3503
      return function (wm, leadingMagicChars, link, m2, m3, trailingPunctuation, trailingMagicChars) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3504
        link = link.replace(showdown.helper.regexes.asteriskDashAndColon, showdown.helper.escapeCharactersCallback);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3505
        var lnkTxt = link,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3506
            append = '',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3507
            target = '',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3508
            lmc    = leadingMagicChars || '',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3509
            tmc    = trailingMagicChars || '';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3510
        if (/^www\./i.test(link)) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3511
          link = link.replace(/^www\./i, 'http://www.');
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3512
        }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3513
        if (options.excludeTrailingPunctuationFromURLs && trailingPunctuation) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3514
          append = trailingPunctuation;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3515
        }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3516
        if (options.openLinksInNewWindow) {
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
  3517
          target = ' rel="noopener noreferrer" target="¨E95Eblank"';
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3518
        }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3519
        return lmc + '<a href="' + link + '"' + target + '>' + lnkTxt + '</a>' + append + tmc;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3520
      };
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3521
    },
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3522
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3523
    replaceMail = function (options, globals) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3524
      'use strict';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3525
      return function (wholeMatch, b, mail) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3526
        var href = 'mailto:';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3527
        b = b || '';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3528
        mail = showdown.subParser('unescapeSpecialChars')(mail, options, globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3529
        if (options.encodeEmails) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3530
          href = showdown.helper.encodeEmailAddress(href + mail);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3531
          mail = showdown.helper.encodeEmailAddress(mail);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3532
        } else {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3533
          href = href + mail;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3534
        }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3535
        return b + '<a href="' + href + '">' + mail + '</a>';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3536
      };
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3537
    };
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3538
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3539
showdown.subParser('autoLinks', function (text, options, globals) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3540
  'use strict';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3541
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3542
  text = globals.converter._dispatch('autoLinks.before', text, options, globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3543
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3544
  text = text.replace(delimUrlRegex, replaceLink(options));
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3545
  text = text.replace(delimMailRegex, replaceMail(options, globals));
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3546
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3547
  text = globals.converter._dispatch('autoLinks.after', text, options, globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3548
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3549
  return text;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3550
});
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3551
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3552
showdown.subParser('simplifiedAutoLinks', function (text, options, globals) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3553
  'use strict';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3554
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3555
  if (!options.simplifiedAutoLink) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3556
    return text;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3557
  }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3558
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3559
  text = globals.converter._dispatch('simplifiedAutoLinks.before', text, options, globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3560
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3561
  if (options.excludeTrailingPunctuationFromURLs) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3562
    text = text.replace(simpleURLRegex2, replaceLink(options));
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3563
  } else {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3564
    text = text.replace(simpleURLRegex, replaceLink(options));
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3565
  }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3566
  text = text.replace(simpleMailRegex, replaceMail(options, globals));
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3567
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3568
  text = globals.converter._dispatch('simplifiedAutoLinks.after', text, options, globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3569
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3570
  return text;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3571
});
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3572
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3573
/**
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3574
 * These are all the transformations that form block-level
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3575
 * tags like paragraphs, headers, and list items.
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3576
 */
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3577
showdown.subParser('blockGamut', function (text, options, globals) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3578
  'use strict';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3579
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3580
  text = globals.converter._dispatch('blockGamut.before', text, options, globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3581
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3582
  // we parse blockquotes first so that we can have headings and hrs
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3583
  // inside blockquotes
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3584
  text = showdown.subParser('blockQuotes')(text, options, globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3585
  text = showdown.subParser('headers')(text, options, globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3586
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3587
  // Do Horizontal Rules:
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3588
  text = showdown.subParser('horizontalRule')(text, options, globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3589
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3590
  text = showdown.subParser('lists')(text, options, globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3591
  text = showdown.subParser('codeBlocks')(text, options, globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3592
  text = showdown.subParser('tables')(text, options, globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3593
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3594
  // We already ran _HashHTMLBlocks() before, in Markdown(), but that
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3595
  // was to escape raw HTML in the original Markdown source. This time,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3596
  // we're escaping the markup we've just created, so that we don't wrap
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3597
  // <p> tags around block-level tags.
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3598
  text = showdown.subParser('hashHTMLBlocks')(text, options, globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3599
  text = showdown.subParser('paragraphs')(text, options, globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3600
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3601
  text = globals.converter._dispatch('blockGamut.after', text, options, globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3602
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3603
  return text;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3604
});
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3605
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3606
showdown.subParser('blockQuotes', function (text, options, globals) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3607
  'use strict';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3608
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3609
  text = globals.converter._dispatch('blockQuotes.before', text, options, globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3610
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3611
  // add a couple extra lines after the text and endtext mark
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3612
  text = text + '\n\n';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3613
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3614
  var rgx = /(^ {0,3}>[ \t]?.+\n(.+\n)*\n*)+/gm;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3615
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3616
  if (options.splitAdjacentBlockquotes) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3617
    rgx = /^ {0,3}>[\s\S]*?(?:\n\n)/gm;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3618
  }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3619
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3620
  text = text.replace(rgx, function (bq) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3621
    // attacklab: hack around Konqueror 3.5.4 bug:
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3622
    // "----------bug".replace(/^-/g,"") == "bug"
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3623
    bq = bq.replace(/^[ \t]*>[ \t]?/gm, ''); // trim one level of quoting
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3624
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3625
    // attacklab: clean up hack
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3626
    bq = bq.replace(/¨0/g, '');
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3627
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3628
    bq = bq.replace(/^[ \t]+$/gm, ''); // trim whitespace-only lines
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3629
    bq = showdown.subParser('githubCodeBlocks')(bq, options, globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3630
    bq = showdown.subParser('blockGamut')(bq, options, globals); // recurse
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3631
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3632
    bq = bq.replace(/(^|\n)/g, '$1  ');
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3633
    // These leading spaces screw with <pre> content, so we need to fix that:
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3634
    bq = bq.replace(/(\s*<pre>[^\r]+?<\/pre>)/gm, function (wholeMatch, m1) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3635
      var pre = m1;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3636
      // attacklab: hack around Konqueror 3.5.4 bug:
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3637
      pre = pre.replace(/^  /mg, '¨0');
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3638
      pre = pre.replace(/¨0/g, '');
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3639
      return pre;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3640
    });
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3641
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3642
    return showdown.subParser('hashBlock')('<blockquote>\n' + bq + '\n</blockquote>', options, globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3643
  });
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3644
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3645
  text = globals.converter._dispatch('blockQuotes.after', text, options, globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3646
  return text;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3647
});
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3648
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3649
/**
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3650
 * Process Markdown `<pre><code>` blocks.
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3651
 */
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3652
showdown.subParser('codeBlocks', function (text, options, globals) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3653
  'use strict';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3654
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3655
  text = globals.converter._dispatch('codeBlocks.before', text, options, globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3656
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3657
  // sentinel workarounds for lack of \A and \Z, safari\khtml bug
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3658
  text += '¨0';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3659
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3660
  var pattern = /(?:\n\n|^)((?:(?:[ ]{4}|\t).*\n+)+)(\n*[ ]{0,3}[^ \t\n]|(?=¨0))/g;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3661
  text = text.replace(pattern, function (wholeMatch, m1, m2) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3662
    var codeblock = m1,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3663
        nextChar = m2,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3664
        end = '\n';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3665
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3666
    codeblock = showdown.subParser('outdent')(codeblock, options, globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3667
    codeblock = showdown.subParser('encodeCode')(codeblock, options, globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3668
    codeblock = showdown.subParser('detab')(codeblock, options, globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3669
    codeblock = codeblock.replace(/^\n+/g, ''); // trim leading newlines
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3670
    codeblock = codeblock.replace(/\n+$/g, ''); // trim trailing newlines
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3671
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3672
    if (options.omitExtraWLInCodeBlocks) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3673
      end = '';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3674
    }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3675
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3676
    codeblock = '<pre><code>' + codeblock + end + '</code></pre>';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3677
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3678
    return showdown.subParser('hashBlock')(codeblock, options, globals) + nextChar;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3679
  });
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3680
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3681
  // strip sentinel
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3682
  text = text.replace(/¨0/, '');
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3683
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3684
  text = globals.converter._dispatch('codeBlocks.after', text, options, globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3685
  return text;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3686
});
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3687
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3688
/**
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3689
 *
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3690
 *   *  Backtick quotes are used for <code></code> spans.
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3691
 *
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3692
 *   *  You can use multiple backticks as the delimiters if you want to
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3693
 *     include literal backticks in the code span. So, this input:
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3694
 *
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3695
 *         Just type ``foo `bar` baz`` at the prompt.
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3696
 *
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3697
 *       Will translate to:
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3698
 *
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3699
 *         <p>Just type <code>foo `bar` baz</code> at the prompt.</p>
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3700
 *
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3701
 *    There's no arbitrary limit to the number of backticks you
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3702
 *    can use as delimters. If you need three consecutive backticks
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3703
 *    in your code, use four for delimiters, etc.
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3704
 *
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3705
 *  *  You can use spaces to get literal backticks at the edges:
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3706
 *
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3707
 *         ... type `` `bar` `` ...
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3708
 *
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3709
 *       Turns to:
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3710
 *
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3711
 *         ... type <code>`bar`</code> ...
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3712
 */
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3713
showdown.subParser('codeSpans', function (text, options, globals) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3714
  'use strict';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3715
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3716
  text = globals.converter._dispatch('codeSpans.before', text, options, globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3717
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
  3718
  if (typeof text === 'undefined') {
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3719
    text = '';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3720
  }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3721
  text = text.replace(/(^|[^\\])(`+)([^\r]*?[^`])\2(?!`)/gm,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3722
    function (wholeMatch, m1, m2, m3) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3723
      var c = m3;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3724
      c = c.replace(/^([ \t]*)/g, '');	// leading whitespace
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3725
      c = c.replace(/[ \t]*$/g, '');	// trailing whitespace
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3726
      c = showdown.subParser('encodeCode')(c, options, globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3727
      c = m1 + '<code>' + c + '</code>';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3728
      c = showdown.subParser('hashHTMLSpans')(c, options, globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3729
      return c;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3730
    }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3731
  );
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3732
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3733
  text = globals.converter._dispatch('codeSpans.after', text, options, globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3734
  return text;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3735
});
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3736
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3737
/**
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3738
 * Create a full HTML document from the processed markdown
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3739
 */
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3740
showdown.subParser('completeHTMLDocument', function (text, options, globals) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3741
  'use strict';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3742
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3743
  if (!options.completeHTMLDocument) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3744
    return text;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3745
  }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3746
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3747
  text = globals.converter._dispatch('completeHTMLDocument.before', text, options, globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3748
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3749
  var doctype = 'html',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3750
      doctypeParsed = '<!DOCTYPE HTML>\n',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3751
      title = '',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3752
      charset = '<meta charset="utf-8">\n',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3753
      lang = '',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3754
      metadata = '';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3755
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3756
  if (typeof globals.metadata.parsed.doctype !== 'undefined') {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3757
    doctypeParsed = '<!DOCTYPE ' +  globals.metadata.parsed.doctype + '>\n';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3758
    doctype = globals.metadata.parsed.doctype.toString().toLowerCase();
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3759
    if (doctype === 'html' || doctype === 'html5') {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3760
      charset = '<meta charset="utf-8">';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3761
    }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3762
  }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3763
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3764
  for (var meta in globals.metadata.parsed) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3765
    if (globals.metadata.parsed.hasOwnProperty(meta)) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3766
      switch (meta.toLowerCase()) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3767
        case 'doctype':
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3768
          break;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3769
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3770
        case 'title':
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3771
          title = '<title>' +  globals.metadata.parsed.title + '</title>\n';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3772
          break;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3773
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3774
        case 'charset':
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3775
          if (doctype === 'html' || doctype === 'html5') {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3776
            charset = '<meta charset="' + globals.metadata.parsed.charset + '">\n';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3777
          } else {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3778
            charset = '<meta name="charset" content="' + globals.metadata.parsed.charset + '">\n';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3779
          }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3780
          break;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3781
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3782
        case 'language':
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3783
        case 'lang':
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3784
          lang = ' lang="' + globals.metadata.parsed[meta] + '"';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3785
          metadata += '<meta name="' + meta + '" content="' + globals.metadata.parsed[meta] + '">\n';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3786
          break;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3787
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3788
        default:
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3789
          metadata += '<meta name="' + meta + '" content="' + globals.metadata.parsed[meta] + '">\n';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3790
      }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3791
    }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3792
  }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3793
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3794
  text = doctypeParsed + '<html' + lang + '>\n<head>\n' + title + charset + metadata + '</head>\n<body>\n' + text.trim() + '\n</body>\n</html>';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3795
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3796
  text = globals.converter._dispatch('completeHTMLDocument.after', text, options, globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3797
  return text;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3798
});
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3799
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3800
/**
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3801
 * Convert all tabs to spaces
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3802
 */
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3803
showdown.subParser('detab', function (text, options, globals) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3804
  'use strict';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3805
  text = globals.converter._dispatch('detab.before', text, options, globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3806
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3807
  // expand first n-1 tabs
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3808
  text = text.replace(/\t(?=\t)/g, '    '); // g_tab_width
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3809
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3810
  // replace the nth with two sentinels
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3811
  text = text.replace(/\t/g, '¨A¨B');
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3812
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3813
  // use the sentinel to anchor our regex so it doesn't explode
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3814
  text = text.replace(/¨B(.+?)¨A/g, function (wholeMatch, m1) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3815
    var leadingText = m1,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3816
        numSpaces = 4 - leadingText.length % 4;  // g_tab_width
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3817
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3818
    // there *must* be a better way to do this:
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3819
    for (var i = 0; i < numSpaces; i++) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3820
      leadingText += ' ';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3821
    }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3822
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3823
    return leadingText;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3824
  });
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3825
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3826
  // clean up sentinels
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3827
  text = text.replace(/¨A/g, '    ');  // g_tab_width
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3828
  text = text.replace(/¨B/g, '');
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3829
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3830
  text = globals.converter._dispatch('detab.after', text, options, globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3831
  return text;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3832
});
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3833
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3834
showdown.subParser('ellipsis', function (text, options, globals) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3835
  'use strict';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3836
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3837
  text = globals.converter._dispatch('ellipsis.before', text, options, globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3838
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3839
  text = text.replace(/\.\.\./g, '…');
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3840
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3841
  text = globals.converter._dispatch('ellipsis.after', text, options, globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3842
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3843
  return text;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3844
});
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3845
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3846
/**
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3847
 * Turn emoji codes into emojis
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3848
 *
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3849
 * List of supported emojis: https://github.com/showdownjs/showdown/wiki/Emojis
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3850
 */
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3851
showdown.subParser('emoji', function (text, options, globals) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3852
  'use strict';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3853
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3854
  if (!options.emoji) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3855
    return text;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3856
  }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3857
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3858
  text = globals.converter._dispatch('emoji.before', text, options, globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3859
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3860
  var emojiRgx = /:([\S]+?):/g;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3861
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3862
  text = text.replace(emojiRgx, function (wm, emojiCode) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3863
    if (showdown.helper.emojis.hasOwnProperty(emojiCode)) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3864
      return showdown.helper.emojis[emojiCode];
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3865
    }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3866
    return wm;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3867
  });
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3868
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3869
  text = globals.converter._dispatch('emoji.after', text, options, globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3870
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3871
  return text;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3872
});
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3873
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3874
/**
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3875
 * Smart processing for ampersands and angle brackets that need to be encoded.
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3876
 */
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3877
showdown.subParser('encodeAmpsAndAngles', function (text, options, globals) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3878
  'use strict';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3879
  text = globals.converter._dispatch('encodeAmpsAndAngles.before', text, options, globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3880
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3881
  // Ampersand-encoding based entirely on Nat Irons's Amputator MT plugin:
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3882
  // http://bumppo.net/projects/amputator/
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3883
  text = text.replace(/&(?!#?[xX]?(?:[0-9a-fA-F]+|\w+);)/g, '&amp;');
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3884
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3885
  // Encode naked <'s
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3886
  text = text.replace(/<(?![a-z\/?$!])/gi, '&lt;');
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3887
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3888
  // Encode <
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3889
  text = text.replace(/</g, '&lt;');
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3890
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3891
  // Encode >
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3892
  text = text.replace(/>/g, '&gt;');
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3893
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3894
  text = globals.converter._dispatch('encodeAmpsAndAngles.after', text, options, globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3895
  return text;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3896
});
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3897
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3898
/**
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3899
 * Returns the string, with after processing the following backslash escape sequences.
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3900
 *
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3901
 * attacklab: The polite way to do this is with the new escapeCharacters() function:
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3902
 *
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3903
 *    text = escapeCharacters(text,"\\",true);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3904
 *    text = escapeCharacters(text,"`*_{}[]()>#+-.!",true);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3905
 *
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3906
 * ...but we're sidestepping its use of the (slow) RegExp constructor
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3907
 * as an optimization for Firefox.  This function gets called a LOT.
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3908
 */
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3909
showdown.subParser('encodeBackslashEscapes', function (text, options, globals) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3910
  'use strict';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3911
  text = globals.converter._dispatch('encodeBackslashEscapes.before', text, options, globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3912
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3913
  text = text.replace(/\\(\\)/g, showdown.helper.escapeCharactersCallback);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3914
  text = text.replace(/\\([`*_{}\[\]()>#+.!~=|-])/g, showdown.helper.escapeCharactersCallback);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3915
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3916
  text = globals.converter._dispatch('encodeBackslashEscapes.after', text, options, globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3917
  return text;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3918
});
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3919
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3920
/**
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3921
 * Encode/escape certain characters inside Markdown code runs.
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3922
 * The point is that in code, these characters are literals,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3923
 * and lose their special Markdown meanings.
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3924
 */
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3925
showdown.subParser('encodeCode', function (text, options, globals) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3926
  'use strict';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3927
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3928
  text = globals.converter._dispatch('encodeCode.before', text, options, globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3929
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3930
  // Encode all ampersands; HTML entities are not
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3931
  // entities within a Markdown code span.
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3932
  text = text
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3933
    .replace(/&/g, '&amp;')
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3934
  // Do the angle bracket song and dance:
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3935
    .replace(/</g, '&lt;')
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3936
    .replace(/>/g, '&gt;')
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3937
  // Now, escape characters that are magic in Markdown:
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3938
    .replace(/([*_{}\[\]\\=~-])/g, showdown.helper.escapeCharactersCallback);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3939
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3940
  text = globals.converter._dispatch('encodeCode.after', text, options, globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3941
  return text;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3942
});
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3943
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3944
/**
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3945
 * Within tags -- meaning between < and > -- encode [\ ` * _ ~ =] so they
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3946
 * don't conflict with their use in Markdown for code, italics and strong.
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3947
 */
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3948
showdown.subParser('escapeSpecialCharsWithinTagAttributes', function (text, options, globals) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3949
  'use strict';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3950
  text = globals.converter._dispatch('escapeSpecialCharsWithinTagAttributes.before', text, options, globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3951
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3952
  // Build a regex to find HTML tags.
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3953
  var tags     = /<\/?[a-z\d_:-]+(?:[\s]+[\s\S]+?)?>/gi,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3954
      comments = /<!(--(?:(?:[^>-]|-[^>])(?:[^-]|-[^-])*)--)>/gi;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3955
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3956
  text = text.replace(tags, function (wholeMatch) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3957
    return wholeMatch
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3958
      .replace(/(.)<\/?code>(?=.)/g, '$1`')
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3959
      .replace(/([\\`*_~=|])/g, showdown.helper.escapeCharactersCallback);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3960
  });
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3961
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3962
  text = text.replace(comments, function (wholeMatch) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3963
    return wholeMatch
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3964
      .replace(/([\\`*_~=|])/g, showdown.helper.escapeCharactersCallback);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3965
  });
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3966
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3967
  text = globals.converter._dispatch('escapeSpecialCharsWithinTagAttributes.after', text, options, globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3968
  return text;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3969
});
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3970
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3971
/**
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3972
 * Handle github codeblocks prior to running HashHTML so that
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3973
 * HTML contained within the codeblock gets escaped properly
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3974
 * Example:
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3975
 * ```ruby
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3976
 *     def hello_world(x)
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3977
 *       puts "Hello, #{x}"
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3978
 *     end
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3979
 * ```
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3980
 */
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3981
showdown.subParser('githubCodeBlocks', function (text, options, globals) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3982
  'use strict';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3983
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3984
  // early exit if option is not enabled
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3985
  if (!options.ghCodeBlocks) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3986
    return text;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3987
  }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3988
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3989
  text = globals.converter._dispatch('githubCodeBlocks.before', text, options, globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3990
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3991
  text += '¨0';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3992
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3993
  text = text.replace(/(?:^|\n)(?: {0,3})(```+|~~~+)(?: *)([^\s`~]*)\n([\s\S]*?)\n(?: {0,3})\1/g, function (wholeMatch, delim, language, codeblock) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3994
    var end = (options.omitExtraWLInCodeBlocks) ? '' : '\n';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3995
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3996
    // First parse the github code block
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3997
    codeblock = showdown.subParser('encodeCode')(codeblock, options, globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3998
    codeblock = showdown.subParser('detab')(codeblock, options, globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  3999
    codeblock = codeblock.replace(/^\n+/g, ''); // trim leading newlines
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4000
    codeblock = codeblock.replace(/\n+$/g, ''); // trim trailing whitespace
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4001
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4002
    codeblock = '<pre><code' + (language ? ' class="' + language + ' language-' + language + '"' : '') + '>' + codeblock + end + '</code></pre>';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4003
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4004
    codeblock = showdown.subParser('hashBlock')(codeblock, options, globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4005
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4006
    // Since GHCodeblocks can be false positives, we need to
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4007
    // store the primitive text and the parsed text in a global var,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4008
    // and then return a token
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4009
    return '\n\n¨G' + (globals.ghCodeBlocks.push({text: wholeMatch, codeblock: codeblock}) - 1) + 'G\n\n';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4010
  });
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4011
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4012
  // attacklab: strip sentinel
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4013
  text = text.replace(/¨0/, '');
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4014
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4015
  return globals.converter._dispatch('githubCodeBlocks.after', text, options, globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4016
});
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4017
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4018
showdown.subParser('hashBlock', function (text, options, globals) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4019
  'use strict';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4020
  text = globals.converter._dispatch('hashBlock.before', text, options, globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4021
  text = text.replace(/(^\n+|\n+$)/g, '');
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4022
  text = '\n\n¨K' + (globals.gHtmlBlocks.push(text) - 1) + 'K\n\n';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4023
  text = globals.converter._dispatch('hashBlock.after', text, options, globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4024
  return text;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4025
});
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4026
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4027
/**
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4028
 * Hash and escape <code> elements that should not be parsed as markdown
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4029
 */
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4030
showdown.subParser('hashCodeTags', function (text, options, globals) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4031
  'use strict';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4032
  text = globals.converter._dispatch('hashCodeTags.before', text, options, globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4033
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4034
  var repFunc = function (wholeMatch, match, left, right) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4035
    var codeblock = left + showdown.subParser('encodeCode')(match, options, globals) + right;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4036
    return '¨C' + (globals.gHtmlSpans.push(codeblock) - 1) + 'C';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4037
  };
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4038
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4039
  // Hash naked <code>
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4040
  text = showdown.helper.replaceRecursiveRegExp(text, repFunc, '<code\\b[^>]*>', '</code>', 'gim');
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4041
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4042
  text = globals.converter._dispatch('hashCodeTags.after', text, options, globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4043
  return text;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4044
});
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4045
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4046
showdown.subParser('hashElement', function (text, options, globals) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4047
  'use strict';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4048
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4049
  return function (wholeMatch, m1) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4050
    var blockText = m1;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4051
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4052
    // Undo double lines
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4053
    blockText = blockText.replace(/\n\n/g, '\n');
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4054
    blockText = blockText.replace(/^\n/, '');
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4055
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4056
    // strip trailing blank lines
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4057
    blockText = blockText.replace(/\n+$/g, '');
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4058
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4059
    // Replace the element text with a marker ("¨KxK" where x is its key)
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4060
    blockText = '\n\n¨K' + (globals.gHtmlBlocks.push(blockText) - 1) + 'K\n\n';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4061
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4062
    return blockText;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4063
  };
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4064
});
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4065
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4066
showdown.subParser('hashHTMLBlocks', function (text, options, globals) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4067
  'use strict';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4068
  text = globals.converter._dispatch('hashHTMLBlocks.before', text, options, globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4069
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4070
  var blockTags = [
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4071
        'pre',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4072
        'div',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4073
        'h1',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4074
        'h2',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4075
        'h3',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4076
        'h4',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4077
        'h5',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4078
        'h6',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4079
        'blockquote',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4080
        'table',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4081
        'dl',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4082
        'ol',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4083
        'ul',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4084
        'script',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4085
        'noscript',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4086
        'form',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4087
        'fieldset',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4088
        'iframe',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4089
        'math',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4090
        'style',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4091
        'section',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4092
        'header',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4093
        'footer',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4094
        'nav',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4095
        'article',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4096
        'aside',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4097
        'address',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4098
        'audio',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4099
        'canvas',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4100
        'figure',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4101
        'hgroup',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4102
        'output',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4103
        'video',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4104
        'p'
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4105
      ],
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4106
      repFunc = function (wholeMatch, match, left, right) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4107
        var txt = wholeMatch;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4108
        // check if this html element is marked as markdown
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4109
        // if so, it's contents should be parsed as markdown
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4110
        if (left.search(/\bmarkdown\b/) !== -1) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4111
          txt = left + globals.converter.makeHtml(match) + right;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4112
        }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4113
        return '\n\n¨K' + (globals.gHtmlBlocks.push(txt) - 1) + 'K\n\n';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4114
      };
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4115
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4116
  if (options.backslashEscapesHTMLTags) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4117
    // encode backslash escaped HTML tags
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4118
    text = text.replace(/\\<(\/?[^>]+?)>/g, function (wm, inside) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4119
      return '&lt;' + inside + '&gt;';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4120
    });
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4121
  }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4122
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4123
  // hash HTML Blocks
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4124
  for (var i = 0; i < blockTags.length; ++i) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4125
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4126
    var opTagPos,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4127
        rgx1     = new RegExp('^ {0,3}(<' + blockTags[i] + '\\b[^>]*>)', 'im'),
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4128
        patLeft  = '<' + blockTags[i] + '\\b[^>]*>',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4129
        patRight = '</' + blockTags[i] + '>';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4130
    // 1. Look for the first position of the first opening HTML tag in the text
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4131
    while ((opTagPos = showdown.helper.regexIndexOf(text, rgx1)) !== -1) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4132
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4133
      // if the HTML tag is \ escaped, we need to escape it and break
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4134
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4135
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4136
      //2. Split the text in that position
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4137
      var subTexts = showdown.helper.splitAtIndex(text, opTagPos),
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
  4138
          //3. Match recursively
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4139
          newSubText1 = showdown.helper.replaceRecursiveRegExp(subTexts[1], repFunc, patLeft, patRight, 'im');
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4140
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4141
      // prevent an infinite loop
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4142
      if (newSubText1 === subTexts[1]) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4143
        break;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4144
      }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4145
      text = subTexts[0].concat(newSubText1);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4146
    }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4147
  }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4148
  // HR SPECIAL CASE
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4149
  text = text.replace(/(\n {0,3}(<(hr)\b([^<>])*?\/?>)[ \t]*(?=\n{2,}))/g,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4150
    showdown.subParser('hashElement')(text, options, globals));
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4151
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4152
  // Special case for standalone HTML comments
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4153
  text = showdown.helper.replaceRecursiveRegExp(text, function (txt) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4154
    return '\n\n¨K' + (globals.gHtmlBlocks.push(txt) - 1) + 'K\n\n';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4155
  }, '^ {0,3}<!--', '-->', 'gm');
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4156
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4157
  // PHP and ASP-style processor instructions (<?...?> and <%...%>)
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4158
  text = text.replace(/(?:\n\n)( {0,3}(?:<([?%])[^\r]*?\2>)[ \t]*(?=\n{2,}))/g,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4159
    showdown.subParser('hashElement')(text, options, globals));
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4160
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4161
  text = globals.converter._dispatch('hashHTMLBlocks.after', text, options, globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4162
  return text;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4163
});
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4164
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4165
/**
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4166
 * Hash span elements that should not be parsed as markdown
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4167
 */
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4168
showdown.subParser('hashHTMLSpans', function (text, options, globals) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4169
  'use strict';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4170
  text = globals.converter._dispatch('hashHTMLSpans.before', text, options, globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4171
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4172
  function hashHTMLSpan (html) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4173
    return '¨C' + (globals.gHtmlSpans.push(html) - 1) + 'C';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4174
  }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4175
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4176
  // Hash Self Closing tags
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4177
  text = text.replace(/<[^>]+?\/>/gi, function (wm) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4178
    return hashHTMLSpan(wm);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4179
  });
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4180
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4181
  // Hash tags without properties
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4182
  text = text.replace(/<([^>]+?)>[\s\S]*?<\/\1>/g, function (wm) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4183
    return hashHTMLSpan(wm);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4184
  });
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4185
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4186
  // Hash tags with properties
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4187
  text = text.replace(/<([^>]+?)\s[^>]+?>[\s\S]*?<\/\1>/g, function (wm) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4188
    return hashHTMLSpan(wm);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4189
  });
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4190
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4191
  // Hash self closing tags without />
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4192
  text = text.replace(/<[^>]+?>/gi, function (wm) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4193
    return hashHTMLSpan(wm);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4194
  });
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4195
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4196
  /*showdown.helper.matchRecursiveRegExp(text, '<code\\b[^>]*>', '</code>', 'gi');*/
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4197
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4198
  text = globals.converter._dispatch('hashHTMLSpans.after', text, options, globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4199
  return text;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4200
});
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4201
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4202
/**
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4203
 * Unhash HTML spans
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4204
 */
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4205
showdown.subParser('unhashHTMLSpans', function (text, options, globals) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4206
  'use strict';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4207
  text = globals.converter._dispatch('unhashHTMLSpans.before', text, options, globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4208
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4209
  for (var i = 0; i < globals.gHtmlSpans.length; ++i) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4210
    var repText = globals.gHtmlSpans[i],
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4211
        // limiter to prevent infinite loop (assume 10 as limit for recurse)
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4212
        limit = 0;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4213
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4214
    while (/¨C(\d+)C/.test(repText)) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4215
      var num = RegExp.$1;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4216
      repText = repText.replace('¨C' + num + 'C', globals.gHtmlSpans[num]);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4217
      if (limit === 10) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4218
        console.error('maximum nesting of 10 spans reached!!!');
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4219
        break;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4220
      }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4221
      ++limit;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4222
    }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4223
    text = text.replace('¨C' + i + 'C', repText);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4224
  }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4225
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4226
  text = globals.converter._dispatch('unhashHTMLSpans.after', text, options, globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4227
  return text;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4228
});
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4229
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4230
/**
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4231
 * Hash and escape <pre><code> elements that should not be parsed as markdown
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4232
 */
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4233
showdown.subParser('hashPreCodeTags', function (text, options, globals) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4234
  'use strict';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4235
  text = globals.converter._dispatch('hashPreCodeTags.before', text, options, globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4236
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4237
  var repFunc = function (wholeMatch, match, left, right) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4238
    // encode html entities
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4239
    var codeblock = left + showdown.subParser('encodeCode')(match, options, globals) + right;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4240
    return '\n\n¨G' + (globals.ghCodeBlocks.push({text: wholeMatch, codeblock: codeblock}) - 1) + 'G\n\n';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4241
  };
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4242
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4243
  // Hash <pre><code>
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4244
  text = showdown.helper.replaceRecursiveRegExp(text, repFunc, '^ {0,3}<pre\\b[^>]*>\\s*<code\\b[^>]*>', '^ {0,3}</code>\\s*</pre>', 'gim');
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4245
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4246
  text = globals.converter._dispatch('hashPreCodeTags.after', text, options, globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4247
  return text;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4248
});
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4249
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4250
showdown.subParser('headers', function (text, options, globals) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4251
  'use strict';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4252
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4253
  text = globals.converter._dispatch('headers.before', text, options, globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4254
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4255
  var headerLevelStart = (isNaN(parseInt(options.headerLevelStart))) ? 1 : parseInt(options.headerLevelStart),
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4256
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
  4257
      // Set text-style headers:
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
  4258
      //	Header 1
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
  4259
      //	========
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
  4260
      //
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
  4261
      //	Header 2
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
  4262
      //	--------
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
  4263
      //
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4264
      setextRegexH1 = (options.smoothLivePreview) ? /^(.+)[ \t]*\n={2,}[ \t]*\n+/gm : /^(.+)[ \t]*\n=+[ \t]*\n+/gm,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4265
      setextRegexH2 = (options.smoothLivePreview) ? /^(.+)[ \t]*\n-{2,}[ \t]*\n+/gm : /^(.+)[ \t]*\n-+[ \t]*\n+/gm;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4266
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4267
  text = text.replace(setextRegexH1, function (wholeMatch, m1) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4268
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4269
    var spanGamut = showdown.subParser('spanGamut')(m1, options, globals),
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4270
        hID = (options.noHeaderId) ? '' : ' id="' + headerId(m1) + '"',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4271
        hLevel = headerLevelStart,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4272
        hashBlock = '<h' + hLevel + hID + '>' + spanGamut + '</h' + hLevel + '>';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4273
    return showdown.subParser('hashBlock')(hashBlock, options, globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4274
  });
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4275
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4276
  text = text.replace(setextRegexH2, function (matchFound, m1) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4277
    var spanGamut = showdown.subParser('spanGamut')(m1, options, globals),
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4278
        hID = (options.noHeaderId) ? '' : ' id="' + headerId(m1) + '"',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4279
        hLevel = headerLevelStart + 1,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4280
        hashBlock = '<h' + hLevel + hID + '>' + spanGamut + '</h' + hLevel + '>';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4281
    return showdown.subParser('hashBlock')(hashBlock, options, globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4282
  });
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4283
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4284
  // atx-style headers:
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4285
  //  # Header 1
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4286
  //  ## Header 2
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4287
  //  ## Header 2 with closing hashes ##
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4288
  //  ...
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4289
  //  ###### Header 6
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4290
  //
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4291
  var atxStyle = (options.requireSpaceBeforeHeadingText) ? /^(#{1,6})[ \t]+(.+?)[ \t]*#*\n+/gm : /^(#{1,6})[ \t]*(.+?)[ \t]*#*\n+/gm;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4292
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4293
  text = text.replace(atxStyle, function (wholeMatch, m1, m2) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4294
    var hText = m2;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4295
    if (options.customizedHeaderId) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4296
      hText = m2.replace(/\s?\{([^{]+?)}\s*$/, '');
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4297
    }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4298
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4299
    var span = showdown.subParser('spanGamut')(hText, options, globals),
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4300
        hID = (options.noHeaderId) ? '' : ' id="' + headerId(m2) + '"',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4301
        hLevel = headerLevelStart - 1 + m1.length,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4302
        header = '<h' + hLevel + hID + '>' + span + '</h' + hLevel + '>';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4303
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4304
    return showdown.subParser('hashBlock')(header, options, globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4305
  });
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4306
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4307
  function headerId (m) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4308
    var title,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4309
        prefix;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4310
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4311
    // It is separate from other options to allow combining prefix and customized
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4312
    if (options.customizedHeaderId) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4313
      var match = m.match(/\{([^{]+?)}\s*$/);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4314
      if (match && match[1]) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4315
        m = match[1];
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4316
      }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4317
    }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4318
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4319
    title = m;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4320
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4321
    // Prefix id to prevent causing inadvertent pre-existing style matches.
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4322
    if (showdown.helper.isString(options.prefixHeaderId)) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4323
      prefix = options.prefixHeaderId;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4324
    } else if (options.prefixHeaderId === true) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4325
      prefix = 'section-';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4326
    } else {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4327
      prefix = '';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4328
    }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4329
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4330
    if (!options.rawPrefixHeaderId) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4331
      title = prefix + title;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4332
    }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4333
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4334
    if (options.ghCompatibleHeaderId) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4335
      title = title
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4336
        .replace(/ /g, '-')
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4337
        // replace previously escaped chars (&, ¨ and $)
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4338
        .replace(/&amp;/g, '')
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4339
        .replace(/¨T/g, '')
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4340
        .replace(/¨D/g, '')
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4341
        // replace rest of the chars (&~$ are repeated as they might have been escaped)
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4342
        // borrowed from github's redcarpet (some they should produce similar results)
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4343
        .replace(/[&+$,\/:;=?@"#{}|^¨~\[\]`\\*)(%.!'<>]/g, '')
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4344
        .toLowerCase();
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4345
    } else if (options.rawHeaderId) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4346
      title = title
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4347
        .replace(/ /g, '-')
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4348
        // replace previously escaped chars (&, ¨ and $)
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4349
        .replace(/&amp;/g, '&')
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4350
        .replace(/¨T/g, '¨')
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4351
        .replace(/¨D/g, '$')
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4352
        // replace " and '
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4353
        .replace(/["']/g, '-')
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4354
        .toLowerCase();
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4355
    } else {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4356
      title = title
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4357
        .replace(/[^\w]/g, '')
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4358
        .toLowerCase();
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4359
    }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4360
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4361
    if (options.rawPrefixHeaderId) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4362
      title = prefix + title;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4363
    }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4364
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4365
    if (globals.hashLinkCounts[title]) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4366
      title = title + '-' + (globals.hashLinkCounts[title]++);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4367
    } else {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4368
      globals.hashLinkCounts[title] = 1;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4369
    }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4370
    return title;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4371
  }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4372
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4373
  text = globals.converter._dispatch('headers.after', text, options, globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4374
  return text;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4375
});
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4376
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4377
/**
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4378
 * Turn Markdown link shortcuts into XHTML <a> tags.
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4379
 */
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4380
showdown.subParser('horizontalRule', function (text, options, globals) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4381
  'use strict';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4382
  text = globals.converter._dispatch('horizontalRule.before', text, options, globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4383
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4384
  var key = showdown.subParser('hashBlock')('<hr />', options, globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4385
  text = text.replace(/^ {0,2}( ?-){3,}[ \t]*$/gm, key);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4386
  text = text.replace(/^ {0,2}( ?\*){3,}[ \t]*$/gm, key);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4387
  text = text.replace(/^ {0,2}( ?_){3,}[ \t]*$/gm, key);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4388
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4389
  text = globals.converter._dispatch('horizontalRule.after', text, options, globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4390
  return text;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4391
});
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4392
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4393
/**
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4394
 * Turn Markdown image shortcuts into <img> tags.
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4395
 */
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4396
showdown.subParser('images', function (text, options, globals) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4397
  'use strict';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4398
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4399
  text = globals.converter._dispatch('images.before', text, options, globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4400
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4401
  var inlineRegExp      = /!\[([^\]]*?)][ \t]*()\([ \t]?<?([\S]+?(?:\([\S]*?\)[\S]*?)?)>?(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*(?:(["'])([^"]*?)\6)?[ \t]?\)/g,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4402
      crazyRegExp       = /!\[([^\]]*?)][ \t]*()\([ \t]?<([^>]*)>(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*(?:(?:(["'])([^"]*?)\6))?[ \t]?\)/g,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4403
      base64RegExp      = /!\[([^\]]*?)][ \t]*()\([ \t]?<?(data:.+?\/.+?;base64,[A-Za-z0-9+/=\n]+?)>?(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*(?:(["'])([^"]*?)\6)?[ \t]?\)/g,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4404
      referenceRegExp   = /!\[([^\]]*?)] ?(?:\n *)?\[([\s\S]*?)]()()()()()/g,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4405
      refShortcutRegExp = /!\[([^\[\]]+)]()()()()()/g;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4406
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4407
  function writeImageTagBase64 (wholeMatch, altText, linkId, url, width, height, m5, title) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4408
    url = url.replace(/\s/g, '');
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4409
    return writeImageTag (wholeMatch, altText, linkId, url, width, height, m5, title);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4410
  }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4411
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4412
  function writeImageTag (wholeMatch, altText, linkId, url, width, height, m5, title) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4413
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4414
    var gUrls   = globals.gUrls,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4415
        gTitles = globals.gTitles,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4416
        gDims   = globals.gDimensions;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4417
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4418
    linkId = linkId.toLowerCase();
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4419
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4420
    if (!title) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4421
      title = '';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4422
    }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4423
    // Special case for explicit empty url
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4424
    if (wholeMatch.search(/\(<?\s*>? ?(['"].*['"])?\)$/m) > -1) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4425
      url = '';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4426
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4427
    } else if (url === '' || url === null) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4428
      if (linkId === '' || linkId === null) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4429
        // lower-case and turn embedded newlines into spaces
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4430
        linkId = altText.toLowerCase().replace(/ ?\n/g, ' ');
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4431
      }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4432
      url = '#' + linkId;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4433
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4434
      if (!showdown.helper.isUndefined(gUrls[linkId])) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4435
        url = gUrls[linkId];
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4436
        if (!showdown.helper.isUndefined(gTitles[linkId])) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4437
          title = gTitles[linkId];
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4438
        }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4439
        if (!showdown.helper.isUndefined(gDims[linkId])) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4440
          width = gDims[linkId].width;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4441
          height = gDims[linkId].height;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4442
        }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4443
      } else {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4444
        return wholeMatch;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4445
      }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4446
    }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4447
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4448
    altText = altText
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4449
      .replace(/"/g, '&quot;')
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4450
    //altText = showdown.helper.escapeCharacters(altText, '*_', false);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4451
      .replace(showdown.helper.regexes.asteriskDashAndColon, showdown.helper.escapeCharactersCallback);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4452
    //url = showdown.helper.escapeCharacters(url, '*_', false);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4453
    url = url.replace(showdown.helper.regexes.asteriskDashAndColon, showdown.helper.escapeCharactersCallback);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4454
    var result = '<img src="' + url + '" alt="' + altText + '"';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4455
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4456
    if (title && showdown.helper.isString(title)) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4457
      title = title
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4458
        .replace(/"/g, '&quot;')
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4459
      //title = showdown.helper.escapeCharacters(title, '*_', false);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4460
        .replace(showdown.helper.regexes.asteriskDashAndColon, showdown.helper.escapeCharactersCallback);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4461
      result += ' title="' + title + '"';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4462
    }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4463
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4464
    if (width && height) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4465
      width  = (width === '*') ? 'auto' : width;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4466
      height = (height === '*') ? 'auto' : height;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4467
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4468
      result += ' width="' + width + '"';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4469
      result += ' height="' + height + '"';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4470
    }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4471
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4472
    result += ' />';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4473
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4474
    return result;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4475
  }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4476
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4477
  // First, handle reference-style labeled images: ![alt text][id]
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4478
  text = text.replace(referenceRegExp, writeImageTag);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4479
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4480
  // Next, handle inline images:  ![alt text](url =<width>x<height> "optional title")
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4481
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4482
  // base64 encoded images
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4483
  text = text.replace(base64RegExp, writeImageTagBase64);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4484
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4485
  // cases with crazy urls like ./image/cat1).png
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4486
  text = text.replace(crazyRegExp, writeImageTag);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4487
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4488
  // normal cases
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4489
  text = text.replace(inlineRegExp, writeImageTag);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4490
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4491
  // handle reference-style shortcuts: ![img text]
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4492
  text = text.replace(refShortcutRegExp, writeImageTag);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4493
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4494
  text = globals.converter._dispatch('images.after', text, options, globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4495
  return text;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4496
});
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4497
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4498
showdown.subParser('italicsAndBold', function (text, options, globals) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4499
  'use strict';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4500
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4501
  text = globals.converter._dispatch('italicsAndBold.before', text, options, globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4502
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4503
  // it's faster to have 3 separate regexes for each case than have just one
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4504
  // because of backtracing, in some cases, it could lead to an exponential effect
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4505
  // called "catastrophic backtrace". Ominous!
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4506
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4507
  function parseInside (txt, left, right) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4508
    /*
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4509
    if (options.simplifiedAutoLink) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4510
      txt = showdown.subParser('simplifiedAutoLinks')(txt, options, globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4511
    }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4512
    */
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4513
    return left + txt + right;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4514
  }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4515
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4516
  // Parse underscores
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4517
  if (options.literalMidWordUnderscores) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4518
    text = text.replace(/\b___(\S[\s\S]*?)___\b/g, function (wm, txt) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4519
      return parseInside (txt, '<strong><em>', '</em></strong>');
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4520
    });
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4521
    text = text.replace(/\b__(\S[\s\S]*?)__\b/g, function (wm, txt) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4522
      return parseInside (txt, '<strong>', '</strong>');
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4523
    });
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4524
    text = text.replace(/\b_(\S[\s\S]*?)_\b/g, function (wm, txt) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4525
      return parseInside (txt, '<em>', '</em>');
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4526
    });
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4527
  } else {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4528
    text = text.replace(/___(\S[\s\S]*?)___/g, function (wm, m) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4529
      return (/\S$/.test(m)) ? parseInside (m, '<strong><em>', '</em></strong>') : wm;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4530
    });
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4531
    text = text.replace(/__(\S[\s\S]*?)__/g, function (wm, m) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4532
      return (/\S$/.test(m)) ? parseInside (m, '<strong>', '</strong>') : wm;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4533
    });
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4534
    text = text.replace(/_([^\s_][\s\S]*?)_/g, function (wm, m) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4535
      // !/^_[^_]/.test(m) - test if it doesn't start with __ (since it seems redundant, we removed it)
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4536
      return (/\S$/.test(m)) ? parseInside (m, '<em>', '</em>') : wm;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4537
    });
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4538
  }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4539
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4540
  // Now parse asterisks
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4541
  if (options.literalMidWordAsterisks) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4542
    text = text.replace(/([^*]|^)\B\*\*\*(\S[\s\S]*?)\*\*\*\B(?!\*)/g, function (wm, lead, txt) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4543
      return parseInside (txt, lead + '<strong><em>', '</em></strong>');
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4544
    });
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4545
    text = text.replace(/([^*]|^)\B\*\*(\S[\s\S]*?)\*\*\B(?!\*)/g, function (wm, lead, txt) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4546
      return parseInside (txt, lead + '<strong>', '</strong>');
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4547
    });
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4548
    text = text.replace(/([^*]|^)\B\*(\S[\s\S]*?)\*\B(?!\*)/g, function (wm, lead, txt) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4549
      return parseInside (txt, lead + '<em>', '</em>');
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4550
    });
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4551
  } else {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4552
    text = text.replace(/\*\*\*(\S[\s\S]*?)\*\*\*/g, function (wm, m) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4553
      return (/\S$/.test(m)) ? parseInside (m, '<strong><em>', '</em></strong>') : wm;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4554
    });
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4555
    text = text.replace(/\*\*(\S[\s\S]*?)\*\*/g, function (wm, m) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4556
      return (/\S$/.test(m)) ? parseInside (m, '<strong>', '</strong>') : wm;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4557
    });
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4558
    text = text.replace(/\*([^\s*][\s\S]*?)\*/g, function (wm, m) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4559
      // !/^\*[^*]/.test(m) - test if it doesn't start with ** (since it seems redundant, we removed it)
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4560
      return (/\S$/.test(m)) ? parseInside (m, '<em>', '</em>') : wm;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4561
    });
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4562
  }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4563
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4564
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4565
  text = globals.converter._dispatch('italicsAndBold.after', text, options, globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4566
  return text;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4567
});
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4568
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4569
/**
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4570
 * Form HTML ordered (numbered) and unordered (bulleted) lists.
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4571
 */
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4572
showdown.subParser('lists', function (text, options, globals) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4573
  'use strict';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4574
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4575
  /**
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4576
   * Process the contents of a single ordered or unordered list, splitting it
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4577
   * into individual list items.
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4578
   * @param {string} listStr
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4579
   * @param {boolean} trimTrailing
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4580
   * @returns {string}
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4581
   */
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4582
  function processListItems (listStr, trimTrailing) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4583
    // The $g_list_level global keeps track of when we're inside a list.
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4584
    // Each time we enter a list, we increment it; when we leave a list,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4585
    // we decrement. If it's zero, we're not in a list anymore.
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4586
    //
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4587
    // We do this because when we're not inside a list, we want to treat
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4588
    // something like this:
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4589
    //
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4590
    //    I recommend upgrading to version
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4591
    //    8. Oops, now this line is treated
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4592
    //    as a sub-list.
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4593
    //
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4594
    // As a single paragraph, despite the fact that the second line starts
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4595
    // with a digit-period-space sequence.
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4596
    //
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4597
    // Whereas when we're inside a list (or sub-list), that line will be
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4598
    // treated as the start of a sub-list. What a kludge, huh? This is
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4599
    // an aspect of Markdown's syntax that's hard to parse perfectly
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4600
    // without resorting to mind-reading. Perhaps the solution is to
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4601
    // change the syntax rules such that sub-lists must start with a
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4602
    // starting cardinal number; e.g. "1." or "a.".
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4603
    globals.gListLevel++;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4604
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4605
    // trim trailing blank lines:
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4606
    listStr = listStr.replace(/\n{2,}$/, '\n');
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4607
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4608
    // attacklab: add sentinel to emulate \z
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4609
    listStr += '¨0';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4610
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4611
    var rgx = /(\n)?(^ {0,3})([*+-]|\d+[.])[ \t]+((\[(x|X| )?])?[ \t]*[^\r]+?(\n{1,2}))(?=\n*(¨0| {0,3}([*+-]|\d+[.])[ \t]+))/gm,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4612
        isParagraphed = (/\n[ \t]*\n(?!¨0)/.test(listStr));
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4613
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4614
    // Since version 1.5, nesting sublists requires 4 spaces (or 1 tab) indentation,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4615
    // which is a syntax breaking change
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4616
    // activating this option reverts to old behavior
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4617
    if (options.disableForced4SpacesIndentedSublists) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4618
      rgx = /(\n)?(^ {0,3})([*+-]|\d+[.])[ \t]+((\[(x|X| )?])?[ \t]*[^\r]+?(\n{1,2}))(?=\n*(¨0|\2([*+-]|\d+[.])[ \t]+))/gm;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4619
    }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4620
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4621
    listStr = listStr.replace(rgx, function (wholeMatch, m1, m2, m3, m4, taskbtn, checked) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4622
      checked = (checked && checked.trim() !== '');
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4623
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4624
      var item = showdown.subParser('outdent')(m4, options, globals),
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4625
          bulletStyle = '';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4626
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4627
      // Support for github tasklists
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4628
      if (taskbtn && options.tasklists) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4629
        bulletStyle = ' class="task-list-item" style="list-style-type: none;"';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4630
        item = item.replace(/^[ \t]*\[(x|X| )?]/m, function () {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4631
          var otp = '<input type="checkbox" disabled style="margin: 0px 0.35em 0.25em -1.6em; vertical-align: middle;"';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4632
          if (checked) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4633
            otp += ' checked';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4634
          }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4635
          otp += '>';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4636
          return otp;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4637
        });
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4638
      }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4639
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4640
      // ISSUE #312
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4641
      // This input: - - - a
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4642
      // causes trouble to the parser, since it interprets it as:
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4643
      // <ul><li><li><li>a</li></li></li></ul>
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4644
      // instead of:
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4645
      // <ul><li>- - a</li></ul>
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4646
      // So, to prevent it, we will put a marker (¨A)in the beginning of the line
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4647
      // Kind of hackish/monkey patching, but seems more effective than overcomplicating the list parser
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4648
      item = item.replace(/^([-*+]|\d\.)[ \t]+[\S\n ]*/g, function (wm2) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4649
        return '¨A' + wm2;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4650
      });
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4651
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4652
      // m1 - Leading line or
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4653
      // Has a double return (multi paragraph) or
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4654
      // Has sublist
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4655
      if (m1 || (item.search(/\n{2,}/) > -1)) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4656
        item = showdown.subParser('githubCodeBlocks')(item, options, globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4657
        item = showdown.subParser('blockGamut')(item, options, globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4658
      } else {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4659
        // Recursion for sub-lists:
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4660
        item = showdown.subParser('lists')(item, options, globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4661
        item = item.replace(/\n$/, ''); // chomp(item)
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4662
        item = showdown.subParser('hashHTMLBlocks')(item, options, globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4663
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4664
        // Colapse double linebreaks
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4665
        item = item.replace(/\n\n+/g, '\n\n');
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4666
        if (isParagraphed) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4667
          item = showdown.subParser('paragraphs')(item, options, globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4668
        } else {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4669
          item = showdown.subParser('spanGamut')(item, options, globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4670
        }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4671
      }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4672
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4673
      // now we need to remove the marker (¨A)
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4674
      item = item.replace('¨A', '');
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4675
      // we can finally wrap the line in list item tags
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4676
      item =  '<li' + bulletStyle + '>' + item + '</li>\n';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4677
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4678
      return item;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4679
    });
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4680
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4681
    // attacklab: strip sentinel
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4682
    listStr = listStr.replace(/¨0/g, '');
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4683
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4684
    globals.gListLevel--;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4685
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4686
    if (trimTrailing) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4687
      listStr = listStr.replace(/\s+$/, '');
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4688
    }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4689
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4690
    return listStr;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4691
  }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4692
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4693
  function styleStartNumber (list, listType) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4694
    // check if ol and starts by a number different than 1
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4695
    if (listType === 'ol') {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4696
      var res = list.match(/^ *(\d+)\./);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4697
      if (res && res[1] !== '1') {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4698
        return ' start="' + res[1] + '"';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4699
      }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4700
    }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4701
    return '';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4702
  }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4703
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4704
  /**
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4705
   * Check and parse consecutive lists (better fix for issue #142)
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4706
   * @param {string} list
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4707
   * @param {string} listType
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4708
   * @param {boolean} trimTrailing
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4709
   * @returns {string}
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4710
   */
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4711
  function parseConsecutiveLists (list, listType, trimTrailing) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4712
    // check if we caught 2 or more consecutive lists by mistake
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4713
    // we use the counterRgx, meaning if listType is UL we look for OL and vice versa
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4714
    var olRgx = (options.disableForced4SpacesIndentedSublists) ? /^ ?\d+\.[ \t]/gm : /^ {0,3}\d+\.[ \t]/gm,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4715
        ulRgx = (options.disableForced4SpacesIndentedSublists) ? /^ ?[*+-][ \t]/gm : /^ {0,3}[*+-][ \t]/gm,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4716
        counterRxg = (listType === 'ul') ? olRgx : ulRgx,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4717
        result = '';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4718
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4719
    if (list.search(counterRxg) !== -1) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4720
      (function parseCL (txt) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4721
        var pos = txt.search(counterRxg),
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4722
            style = styleStartNumber(list, listType);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4723
        if (pos !== -1) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4724
          // slice
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4725
          result += '\n\n<' + listType + style + '>\n' + processListItems(txt.slice(0, pos), !!trimTrailing) + '</' + listType + '>\n';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4726
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4727
          // invert counterType and listType
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4728
          listType = (listType === 'ul') ? 'ol' : 'ul';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4729
          counterRxg = (listType === 'ul') ? olRgx : ulRgx;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4730
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4731
          //recurse
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4732
          parseCL(txt.slice(pos));
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4733
        } else {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4734
          result += '\n\n<' + listType + style + '>\n' + processListItems(txt, !!trimTrailing) + '</' + listType + '>\n';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4735
        }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4736
      })(list);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4737
    } else {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4738
      var style = styleStartNumber(list, listType);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4739
      result = '\n\n<' + listType + style + '>\n' + processListItems(list, !!trimTrailing) + '</' + listType + '>\n';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4740
    }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4741
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4742
    return result;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4743
  }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4744
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4745
  /** Start of list parsing **/
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4746
  text = globals.converter._dispatch('lists.before', text, options, globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4747
  // add sentinel to hack around khtml/safari bug:
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4748
  // http://bugs.webkit.org/show_bug.cgi?id=11231
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4749
  text += '¨0';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4750
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4751
  if (globals.gListLevel) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4752
    text = text.replace(/^(( {0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(¨0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/gm,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4753
      function (wholeMatch, list, m2) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4754
        var listType = (m2.search(/[*+-]/g) > -1) ? 'ul' : 'ol';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4755
        return parseConsecutiveLists(list, listType, true);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4756
      }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4757
    );
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4758
  } else {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4759
    text = text.replace(/(\n\n|^\n?)(( {0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(¨0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/gm,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4760
      function (wholeMatch, m1, list, m3) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4761
        var listType = (m3.search(/[*+-]/g) > -1) ? 'ul' : 'ol';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4762
        return parseConsecutiveLists(list, listType, false);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4763
      }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4764
    );
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4765
  }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4766
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4767
  // strip sentinel
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4768
  text = text.replace(/¨0/, '');
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4769
  text = globals.converter._dispatch('lists.after', text, options, globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4770
  return text;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4771
});
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4772
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4773
/**
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4774
 * Parse metadata at the top of the document
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4775
 */
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4776
showdown.subParser('metadata', function (text, options, globals) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4777
  'use strict';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4778
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4779
  if (!options.metadata) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4780
    return text;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4781
  }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4782
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4783
  text = globals.converter._dispatch('metadata.before', text, options, globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4784
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4785
  function parseMetadataContents (content) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4786
    // raw is raw so it's not changed in any way
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4787
    globals.metadata.raw = content;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4788
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4789
    // escape chars forbidden in html attributes
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4790
    // double quotes
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4791
    content = content
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4792
      // ampersand first
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4793
      .replace(/&/g, '&amp;')
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4794
      // double quotes
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4795
      .replace(/"/g, '&quot;');
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4796
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4797
    content = content.replace(/\n {4}/g, ' ');
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4798
    content.replace(/^([\S ]+): +([\s\S]+?)$/gm, function (wm, key, value) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4799
      globals.metadata.parsed[key] = value;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4800
      return '';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4801
    });
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4802
  }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4803
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4804
  text = text.replace(/^\s*«««+(\S*?)\n([\s\S]+?)\n»»»+\n/, function (wholematch, format, content) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4805
    parseMetadataContents(content);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4806
    return '¨M';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4807
  });
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4808
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4809
  text = text.replace(/^\s*---+(\S*?)\n([\s\S]+?)\n---+\n/, function (wholematch, format, content) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4810
    if (format) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4811
      globals.metadata.format = format;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4812
    }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4813
    parseMetadataContents(content);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4814
    return '¨M';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4815
  });
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4816
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4817
  text = text.replace(/¨M/g, '');
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4818
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4819
  text = globals.converter._dispatch('metadata.after', text, options, globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4820
  return text;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4821
});
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4822
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4823
/**
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4824
 * Remove one level of line-leading tabs or spaces
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4825
 */
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4826
showdown.subParser('outdent', function (text, options, globals) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4827
  'use strict';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4828
  text = globals.converter._dispatch('outdent.before', text, options, globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4829
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4830
  // attacklab: hack around Konqueror 3.5.4 bug:
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4831
  // "----------bug".replace(/^-/g,"") == "bug"
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4832
  text = text.replace(/^(\t|[ ]{1,4})/gm, '¨0'); // attacklab: g_tab_width
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4833
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4834
  // attacklab: clean up hack
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4835
  text = text.replace(/¨0/g, '');
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4836
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4837
  text = globals.converter._dispatch('outdent.after', text, options, globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4838
  return text;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4839
});
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4840
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4841
/**
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4842
 *
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4843
 */
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4844
showdown.subParser('paragraphs', function (text, options, globals) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4845
  'use strict';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4846
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4847
  text = globals.converter._dispatch('paragraphs.before', text, options, globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4848
  // Strip leading and trailing lines:
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4849
  text = text.replace(/^\n+/g, '');
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4850
  text = text.replace(/\n+$/g, '');
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4851
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4852
  var grafs = text.split(/\n{2,}/g),
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4853
      grafsOut = [],
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4854
      end = grafs.length; // Wrap <p> tags
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4855
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4856
  for (var i = 0; i < end; i++) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4857
    var str = grafs[i];
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4858
    // if this is an HTML marker, copy it
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4859
    if (str.search(/¨(K|G)(\d+)\1/g) >= 0) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4860
      grafsOut.push(str);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4861
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4862
    // test for presence of characters to prevent empty lines being parsed
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4863
    // as paragraphs (resulting in undesired extra empty paragraphs)
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4864
    } else if (str.search(/\S/) >= 0) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4865
      str = showdown.subParser('spanGamut')(str, options, globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4866
      str = str.replace(/^([ \t]*)/g, '<p>');
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4867
      str += '</p>';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4868
      grafsOut.push(str);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4869
    }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4870
  }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4871
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4872
  /** Unhashify HTML blocks */
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4873
  end = grafsOut.length;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4874
  for (i = 0; i < end; i++) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4875
    var blockText = '',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4876
        grafsOutIt = grafsOut[i],
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4877
        codeFlag = false;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4878
    // if this is a marker for an html block...
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4879
    // use RegExp.test instead of string.search because of QML bug
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4880
    while (/¨(K|G)(\d+)\1/.test(grafsOutIt)) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4881
      var delim = RegExp.$1,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4882
          num   = RegExp.$2;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4883
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4884
      if (delim === 'K') {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4885
        blockText = globals.gHtmlBlocks[num];
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4886
      } else {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4887
        // we need to check if ghBlock is a false positive
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4888
        if (codeFlag) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4889
          // use encoded version of all text
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4890
          blockText = showdown.subParser('encodeCode')(globals.ghCodeBlocks[num].text, options, globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4891
        } else {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4892
          blockText = globals.ghCodeBlocks[num].codeblock;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4893
        }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4894
      }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4895
      blockText = blockText.replace(/\$/g, '$$$$'); // Escape any dollar signs
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4896
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4897
      grafsOutIt = grafsOutIt.replace(/(\n\n)?¨(K|G)\d+\2(\n\n)?/, blockText);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4898
      // Check if grafsOutIt is a pre->code
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4899
      if (/^<pre\b[^>]*>\s*<code\b[^>]*>/.test(grafsOutIt)) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4900
        codeFlag = true;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4901
      }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4902
    }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4903
    grafsOut[i] = grafsOutIt;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4904
  }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4905
  text = grafsOut.join('\n');
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4906
  // Strip leading and trailing lines:
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4907
  text = text.replace(/^\n+/g, '');
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4908
  text = text.replace(/\n+$/g, '');
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4909
  return globals.converter._dispatch('paragraphs.after', text, options, globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4910
});
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4911
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4912
/**
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4913
 * Run extension
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4914
 */
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4915
showdown.subParser('runExtension', function (ext, text, options, globals) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4916
  'use strict';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4917
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4918
  if (ext.filter) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4919
    text = ext.filter(text, globals.converter, options);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4920
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4921
  } else if (ext.regex) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4922
    // TODO remove this when old extension loading mechanism is deprecated
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4923
    var re = ext.regex;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4924
    if (!(re instanceof RegExp)) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4925
      re = new RegExp(re, 'g');
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4926
    }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4927
    text = text.replace(re, ext.replace);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4928
  }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4929
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4930
  return text;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4931
});
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4932
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4933
/**
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4934
 * These are all the transformations that occur *within* block-level
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4935
 * tags like paragraphs, headers, and list items.
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4936
 */
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4937
showdown.subParser('spanGamut', function (text, options, globals) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4938
  'use strict';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4939
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4940
  text = globals.converter._dispatch('spanGamut.before', text, options, globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4941
  text = showdown.subParser('codeSpans')(text, options, globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4942
  text = showdown.subParser('escapeSpecialCharsWithinTagAttributes')(text, options, globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4943
  text = showdown.subParser('encodeBackslashEscapes')(text, options, globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4944
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4945
  // Process anchor and image tags. Images must come first,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4946
  // because ![foo][f] looks like an anchor.
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4947
  text = showdown.subParser('images')(text, options, globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4948
  text = showdown.subParser('anchors')(text, options, globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4949
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4950
  // Make links out of things like `<http://example.com/>`
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4951
  // Must come after anchors, because you can use < and >
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4952
  // delimiters in inline links like [this](<url>).
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4953
  text = showdown.subParser('autoLinks')(text, options, globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4954
  text = showdown.subParser('simplifiedAutoLinks')(text, options, globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4955
  text = showdown.subParser('emoji')(text, options, globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4956
  text = showdown.subParser('underline')(text, options, globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4957
  text = showdown.subParser('italicsAndBold')(text, options, globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4958
  text = showdown.subParser('strikethrough')(text, options, globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4959
  text = showdown.subParser('ellipsis')(text, options, globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4960
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4961
  // we need to hash HTML tags inside spans
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4962
  text = showdown.subParser('hashHTMLSpans')(text, options, globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4963
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4964
  // now we encode amps and angles
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4965
  text = showdown.subParser('encodeAmpsAndAngles')(text, options, globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4966
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4967
  // Do hard breaks
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4968
  if (options.simpleLineBreaks) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4969
    // GFM style hard breaks
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4970
    // only add line breaks if the text does not contain a block (special case for lists)
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4971
    if (!/\n\n¨K/.test(text)) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4972
      text = text.replace(/\n+/g, '<br />\n');
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4973
    }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4974
  } else {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4975
    // Vanilla hard breaks
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4976
    text = text.replace(/  +\n/g, '<br />\n');
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4977
  }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4978
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4979
  text = globals.converter._dispatch('spanGamut.after', text, options, globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4980
  return text;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4981
});
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4982
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4983
showdown.subParser('strikethrough', function (text, options, globals) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4984
  'use strict';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4985
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4986
  function parseInside (txt) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4987
    if (options.simplifiedAutoLink) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4988
      txt = showdown.subParser('simplifiedAutoLinks')(txt, options, globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4989
    }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4990
    return '<del>' + txt + '</del>';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4991
  }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4992
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4993
  if (options.strikethrough) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4994
    text = globals.converter._dispatch('strikethrough.before', text, options, globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4995
    text = text.replace(/(?:~){2}([\s\S]+?)(?:~){2}/g, function (wm, txt) { return parseInside(txt); });
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4996
    text = globals.converter._dispatch('strikethrough.after', text, options, globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4997
  }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4998
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  4999
  return text;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5000
});
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5001
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5002
/**
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5003
 * Strips link definitions from text, stores the URLs and titles in
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5004
 * hash references.
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5005
 * Link defs are in the form: ^[id]: url "optional title"
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5006
 */
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5007
showdown.subParser('stripLinkDefinitions', function (text, options, globals) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5008
  'use strict';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5009
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5010
  var regex       = /^ {0,3}\[(.+)]:[ \t]*\n?[ \t]*<?([^>\s]+)>?(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*\n?[ \t]*(?:(\n*)["|'(](.+?)["|')][ \t]*)?(?:\n+|(?=¨0))/gm,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5011
      base64Regex = /^ {0,3}\[(.+)]:[ \t]*\n?[ \t]*<?(data:.+?\/.+?;base64,[A-Za-z0-9+/=\n]+?)>?(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*\n?[ \t]*(?:(\n*)["|'(](.+?)["|')][ \t]*)?(?:\n\n|(?=¨0)|(?=\n\[))/gm;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5012
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5013
  // attacklab: sentinel workarounds for lack of \A and \Z, safari\khtml bug
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5014
  text += '¨0';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5015
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5016
  var replaceFunc = function (wholeMatch, linkId, url, width, height, blankLines, title) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5017
    linkId = linkId.toLowerCase();
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5018
    if (url.match(/^data:.+?\/.+?;base64,/)) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5019
      // remove newlines
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5020
      globals.gUrls[linkId] = url.replace(/\s/g, '');
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5021
    } else {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5022
      globals.gUrls[linkId] = showdown.subParser('encodeAmpsAndAngles')(url, options, globals);  // Link IDs are case-insensitive
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5023
    }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5024
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5025
    if (blankLines) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5026
      // Oops, found blank lines, so it's not a title.
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5027
      // Put back the parenthetical statement we stole.
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5028
      return blankLines + title;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5029
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5030
    } else {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5031
      if (title) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5032
        globals.gTitles[linkId] = title.replace(/"|'/g, '&quot;');
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5033
      }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5034
      if (options.parseImgDimensions && width && height) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5035
        globals.gDimensions[linkId] = {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5036
          width:  width,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5037
          height: height
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5038
        };
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5039
      }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5040
    }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5041
    // Completely remove the definition from the text
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5042
    return '';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5043
  };
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5044
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5045
  // first we try to find base64 link references
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5046
  text = text.replace(base64Regex, replaceFunc);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5047
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5048
  text = text.replace(regex, replaceFunc);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5049
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5050
  // attacklab: strip sentinel
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5051
  text = text.replace(/¨0/, '');
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5052
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5053
  return text;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5054
});
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5055
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5056
showdown.subParser('tables', function (text, options, globals) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5057
  'use strict';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5058
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5059
  if (!options.tables) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5060
    return text;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5061
  }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5062
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5063
  var tableRgx       = /^ {0,3}\|?.+\|.+\n {0,3}\|?[ \t]*:?[ \t]*(?:[-=]){2,}[ \t]*:?[ \t]*\|[ \t]*:?[ \t]*(?:[-=]){2,}[\s\S]+?(?:\n\n|¨0)/gm,
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
  5064
      //singeColTblRgx = /^ {0,3}\|.+\|\n {0,3}\|[ \t]*:?[ \t]*(?:[-=]){2,}[ \t]*:?[ \t]*\|[ \t]*\n(?: {0,3}\|.+\|\n)+(?:\n\n|¨0)/gm;
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5065
      singeColTblRgx = /^ {0,3}\|.+\|[ \t]*\n {0,3}\|[ \t]*:?[ \t]*(?:[-=]){2,}[ \t]*:?[ \t]*\|[ \t]*\n( {0,3}\|.+\|[ \t]*\n)*(?:\n|¨0)/gm;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5066
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5067
  function parseStyles (sLine) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5068
    if (/^:[ \t]*--*$/.test(sLine)) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5069
      return ' style="text-align:left;"';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5070
    } else if (/^--*[ \t]*:[ \t]*$/.test(sLine)) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5071
      return ' style="text-align:right;"';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5072
    } else if (/^:[ \t]*--*[ \t]*:$/.test(sLine)) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5073
      return ' style="text-align:center;"';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5074
    } else {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5075
      return '';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5076
    }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5077
  }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5078
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5079
  function parseHeaders (header, style) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5080
    var id = '';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5081
    header = header.trim();
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5082
    // support both tablesHeaderId and tableHeaderId due to error in documentation so we don't break backwards compatibility
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5083
    if (options.tablesHeaderId || options.tableHeaderId) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5084
      id = ' id="' + header.replace(/ /g, '_').toLowerCase() + '"';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5085
    }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5086
    header = showdown.subParser('spanGamut')(header, options, globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5087
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5088
    return '<th' + id + style + '>' + header + '</th>\n';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5089
  }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5090
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5091
  function parseCells (cell, style) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5092
    var subText = showdown.subParser('spanGamut')(cell, options, globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5093
    return '<td' + style + '>' + subText + '</td>\n';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5094
  }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5095
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5096
  function buildTable (headers, cells) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5097
    var tb = '<table>\n<thead>\n<tr>\n',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5098
        tblLgn = headers.length;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5099
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5100
    for (var i = 0; i < tblLgn; ++i) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5101
      tb += headers[i];
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5102
    }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5103
    tb += '</tr>\n</thead>\n<tbody>\n';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5104
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5105
    for (i = 0; i < cells.length; ++i) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5106
      tb += '<tr>\n';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5107
      for (var ii = 0; ii < tblLgn; ++ii) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5108
        tb += cells[i][ii];
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5109
      }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5110
      tb += '</tr>\n';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5111
    }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5112
    tb += '</tbody>\n</table>\n';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5113
    return tb;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5114
  }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5115
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5116
  function parseTable (rawTable) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5117
    var i, tableLines = rawTable.split('\n');
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5118
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5119
    for (i = 0; i < tableLines.length; ++i) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5120
      // strip wrong first and last column if wrapped tables are used
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5121
      if (/^ {0,3}\|/.test(tableLines[i])) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5122
        tableLines[i] = tableLines[i].replace(/^ {0,3}\|/, '');
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5123
      }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5124
      if (/\|[ \t]*$/.test(tableLines[i])) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5125
        tableLines[i] = tableLines[i].replace(/\|[ \t]*$/, '');
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5126
      }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5127
      // parse code spans first, but we only support one line code spans
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5128
      tableLines[i] = showdown.subParser('codeSpans')(tableLines[i], options, globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5129
    }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5130
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5131
    var rawHeaders = tableLines[0].split('|').map(function (s) { return s.trim();}),
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5132
        rawStyles = tableLines[1].split('|').map(function (s) { return s.trim();}),
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5133
        rawCells = [],
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5134
        headers = [],
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5135
        styles = [],
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5136
        cells = [];
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5137
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5138
    tableLines.shift();
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5139
    tableLines.shift();
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5140
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5141
    for (i = 0; i < tableLines.length; ++i) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5142
      if (tableLines[i].trim() === '') {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5143
        continue;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5144
      }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5145
      rawCells.push(
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5146
        tableLines[i]
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5147
          .split('|')
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5148
          .map(function (s) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5149
            return s.trim();
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5150
          })
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5151
      );
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5152
    }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5153
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5154
    if (rawHeaders.length < rawStyles.length) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5155
      return rawTable;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5156
    }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5157
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5158
    for (i = 0; i < rawStyles.length; ++i) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5159
      styles.push(parseStyles(rawStyles[i]));
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5160
    }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5161
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5162
    for (i = 0; i < rawHeaders.length; ++i) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5163
      if (showdown.helper.isUndefined(styles[i])) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5164
        styles[i] = '';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5165
      }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5166
      headers.push(parseHeaders(rawHeaders[i], styles[i]));
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5167
    }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5168
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5169
    for (i = 0; i < rawCells.length; ++i) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5170
      var row = [];
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5171
      for (var ii = 0; ii < headers.length; ++ii) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5172
        if (showdown.helper.isUndefined(rawCells[i][ii])) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5173
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5174
        }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5175
        row.push(parseCells(rawCells[i][ii], styles[ii]));
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5176
      }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5177
      cells.push(row);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5178
    }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5179
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5180
    return buildTable(headers, cells);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5181
  }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5182
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5183
  text = globals.converter._dispatch('tables.before', text, options, globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5184
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5185
  // find escaped pipe characters
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5186
  text = text.replace(/\\(\|)/g, showdown.helper.escapeCharactersCallback);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5187
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5188
  // parse multi column tables
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5189
  text = text.replace(tableRgx, parseTable);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5190
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5191
  // parse one column tables
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5192
  text = text.replace(singeColTblRgx, parseTable);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5193
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5194
  text = globals.converter._dispatch('tables.after', text, options, globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5195
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5196
  return text;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5197
});
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5198
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5199
showdown.subParser('underline', function (text, options, globals) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5200
  'use strict';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5201
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5202
  if (!options.underline) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5203
    return text;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5204
  }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5205
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5206
  text = globals.converter._dispatch('underline.before', text, options, globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5207
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5208
  if (options.literalMidWordUnderscores) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5209
    text = text.replace(/\b___(\S[\s\S]*?)___\b/g, function (wm, txt) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5210
      return '<u>' + txt + '</u>';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5211
    });
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5212
    text = text.replace(/\b__(\S[\s\S]*?)__\b/g, function (wm, txt) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5213
      return '<u>' + txt + '</u>';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5214
    });
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5215
  } else {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5216
    text = text.replace(/___(\S[\s\S]*?)___/g, function (wm, m) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5217
      return (/\S$/.test(m)) ? '<u>' + m + '</u>' : wm;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5218
    });
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5219
    text = text.replace(/__(\S[\s\S]*?)__/g, function (wm, m) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5220
      return (/\S$/.test(m)) ? '<u>' + m + '</u>' : wm;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5221
    });
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5222
  }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5223
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5224
  // escape remaining underscores to prevent them being parsed by italic and bold
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5225
  text = text.replace(/(_)/g, showdown.helper.escapeCharactersCallback);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5226
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5227
  text = globals.converter._dispatch('underline.after', text, options, globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5228
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5229
  return text;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5230
});
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5231
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5232
/**
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5233
 * Swap back in all the special characters we've hidden.
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5234
 */
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5235
showdown.subParser('unescapeSpecialChars', function (text, options, globals) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5236
  'use strict';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5237
  text = globals.converter._dispatch('unescapeSpecialChars.before', text, options, globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5238
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5239
  text = text.replace(/¨E(\d+)E/g, function (wholeMatch, m1) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5240
    var charCodeToReplace = parseInt(m1);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5241
    return String.fromCharCode(charCodeToReplace);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5242
  });
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5243
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5244
  text = globals.converter._dispatch('unescapeSpecialChars.after', text, options, globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5245
  return text;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5246
});
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5247
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5248
showdown.subParser('makeMarkdown.blockquote', function (node, globals) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5249
  'use strict';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5250
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5251
  var txt = '';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5252
  if (node.hasChildNodes()) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5253
    var children = node.childNodes,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5254
        childrenLength = children.length;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5255
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5256
    for (var i = 0; i < childrenLength; ++i) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5257
      var innerTxt = showdown.subParser('makeMarkdown.node')(children[i], globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5258
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5259
      if (innerTxt === '') {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5260
        continue;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5261
      }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5262
      txt += innerTxt;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5263
    }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5264
  }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5265
  // cleanup
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5266
  txt = txt.trim();
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5267
  txt = '> ' + txt.split('\n').join('\n> ');
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5268
  return txt;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5269
});
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5270
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5271
showdown.subParser('makeMarkdown.codeBlock', function (node, globals) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5272
  'use strict';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5273
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5274
  var lang = node.getAttribute('language'),
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5275
      num  = node.getAttribute('precodenum');
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5276
  return '```' + lang + '\n' + globals.preList[num] + '\n```';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5277
});
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5278
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5279
showdown.subParser('makeMarkdown.codeSpan', function (node) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5280
  'use strict';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5281
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5282
  return '`' + node.innerHTML + '`';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5283
});
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5284
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5285
showdown.subParser('makeMarkdown.emphasis', function (node, globals) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5286
  'use strict';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5287
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5288
  var txt = '';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5289
  if (node.hasChildNodes()) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5290
    txt += '*';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5291
    var children = node.childNodes,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5292
        childrenLength = children.length;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5293
    for (var i = 0; i < childrenLength; ++i) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5294
      txt += showdown.subParser('makeMarkdown.node')(children[i], globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5295
    }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5296
    txt += '*';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5297
  }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5298
  return txt;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5299
});
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5300
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5301
showdown.subParser('makeMarkdown.header', function (node, globals, headerLevel) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5302
  'use strict';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5303
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5304
  var headerMark = new Array(headerLevel + 1).join('#'),
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5305
      txt = '';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5306
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5307
  if (node.hasChildNodes()) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5308
    txt = headerMark + ' ';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5309
    var children = node.childNodes,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5310
        childrenLength = children.length;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5311
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5312
    for (var i = 0; i < childrenLength; ++i) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5313
      txt += showdown.subParser('makeMarkdown.node')(children[i], globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5314
    }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5315
  }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5316
  return txt;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5317
});
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5318
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5319
showdown.subParser('makeMarkdown.hr', function () {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5320
  'use strict';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5321
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5322
  return '---';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5323
});
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5324
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5325
showdown.subParser('makeMarkdown.image', function (node) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5326
  'use strict';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5327
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5328
  var txt = '';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5329
  if (node.hasAttribute('src')) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5330
    txt += '![' + node.getAttribute('alt') + '](';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5331
    txt += '<' + node.getAttribute('src') + '>';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5332
    if (node.hasAttribute('width') && node.hasAttribute('height')) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5333
      txt += ' =' + node.getAttribute('width') + 'x' + node.getAttribute('height');
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5334
    }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5335
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5336
    if (node.hasAttribute('title')) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5337
      txt += ' "' + node.getAttribute('title') + '"';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5338
    }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5339
    txt += ')';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5340
  }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5341
  return txt;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5342
});
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5343
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5344
showdown.subParser('makeMarkdown.links', function (node, globals) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5345
  'use strict';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5346
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5347
  var txt = '';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5348
  if (node.hasChildNodes() && node.hasAttribute('href')) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5349
    var children = node.childNodes,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5350
        childrenLength = children.length;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5351
    txt = '[';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5352
    for (var i = 0; i < childrenLength; ++i) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5353
      txt += showdown.subParser('makeMarkdown.node')(children[i], globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5354
    }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5355
    txt += '](';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5356
    txt += '<' + node.getAttribute('href') + '>';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5357
    if (node.hasAttribute('title')) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5358
      txt += ' "' + node.getAttribute('title') + '"';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5359
    }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5360
    txt += ')';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5361
  }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5362
  return txt;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5363
});
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5364
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5365
showdown.subParser('makeMarkdown.list', function (node, globals, type) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5366
  'use strict';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5367
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5368
  var txt = '';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5369
  if (!node.hasChildNodes()) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5370
    return '';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5371
  }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5372
  var listItems       = node.childNodes,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5373
      listItemsLenght = listItems.length,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5374
      listNum = node.getAttribute('start') || 1;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5375
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5376
  for (var i = 0; i < listItemsLenght; ++i) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5377
    if (typeof listItems[i].tagName === 'undefined' || listItems[i].tagName.toLowerCase() !== 'li') {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5378
      continue;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5379
    }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5380
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5381
    // define the bullet to use in list
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5382
    var bullet = '';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5383
    if (type === 'ol') {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5384
      bullet = listNum.toString() + '. ';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5385
    } else {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5386
      bullet = '- ';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5387
    }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5388
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5389
    // parse list item
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5390
    txt += bullet + showdown.subParser('makeMarkdown.listItem')(listItems[i], globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5391
    ++listNum;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5392
  }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5393
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5394
  // add comment at the end to prevent consecutive lists to be parsed as one
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5395
  txt += '\n<!-- -->\n';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5396
  return txt.trim();
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5397
});
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5398
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5399
showdown.subParser('makeMarkdown.listItem', function (node, globals) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5400
  'use strict';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5401
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5402
  var listItemTxt = '';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5403
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5404
  var children = node.childNodes,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5405
      childrenLenght = children.length;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5406
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5407
  for (var i = 0; i < childrenLenght; ++i) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5408
    listItemTxt += showdown.subParser('makeMarkdown.node')(children[i], globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5409
  }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5410
  // if it's only one liner, we need to add a newline at the end
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5411
  if (!/\n$/.test(listItemTxt)) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5412
    listItemTxt += '\n';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5413
  } else {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5414
    // it's multiparagraph, so we need to indent
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5415
    listItemTxt = listItemTxt
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5416
      .split('\n')
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5417
      .join('\n    ')
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5418
      .replace(/^ {4}$/gm, '')
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5419
      .replace(/\n\n+/g, '\n\n');
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5420
  }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5421
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5422
  return listItemTxt;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5423
});
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5424
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5425
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5426
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5427
showdown.subParser('makeMarkdown.node', function (node, globals, spansOnly) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5428
  'use strict';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5429
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5430
  spansOnly = spansOnly || false;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5431
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5432
  var txt = '';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5433
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5434
  // edge case of text without wrapper paragraph
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5435
  if (node.nodeType === 3) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5436
    return showdown.subParser('makeMarkdown.txt')(node, globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5437
  }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5438
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5439
  // HTML comment
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5440
  if (node.nodeType === 8) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5441
    return '<!--' + node.data + '-->\n\n';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5442
  }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5443
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5444
  // process only node elements
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5445
  if (node.nodeType !== 1) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5446
    return '';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5447
  }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5448
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5449
  var tagName = node.tagName.toLowerCase();
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5450
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5451
  switch (tagName) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5452
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5453
    //
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5454
    // BLOCKS
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5455
    //
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5456
    case 'h1':
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5457
      if (!spansOnly) { txt = showdown.subParser('makeMarkdown.header')(node, globals, 1) + '\n\n'; }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5458
      break;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5459
    case 'h2':
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5460
      if (!spansOnly) { txt = showdown.subParser('makeMarkdown.header')(node, globals, 2) + '\n\n'; }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5461
      break;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5462
    case 'h3':
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5463
      if (!spansOnly) { txt = showdown.subParser('makeMarkdown.header')(node, globals, 3) + '\n\n'; }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5464
      break;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5465
    case 'h4':
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5466
      if (!spansOnly) { txt = showdown.subParser('makeMarkdown.header')(node, globals, 4) + '\n\n'; }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5467
      break;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5468
    case 'h5':
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5469
      if (!spansOnly) { txt = showdown.subParser('makeMarkdown.header')(node, globals, 5) + '\n\n'; }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5470
      break;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5471
    case 'h6':
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5472
      if (!spansOnly) { txt = showdown.subParser('makeMarkdown.header')(node, globals, 6) + '\n\n'; }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5473
      break;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5474
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5475
    case 'p':
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5476
      if (!spansOnly) { txt = showdown.subParser('makeMarkdown.paragraph')(node, globals) + '\n\n'; }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5477
      break;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5478
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5479
    case 'blockquote':
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5480
      if (!spansOnly) { txt = showdown.subParser('makeMarkdown.blockquote')(node, globals) + '\n\n'; }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5481
      break;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5482
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5483
    case 'hr':
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5484
      if (!spansOnly) { txt = showdown.subParser('makeMarkdown.hr')(node, globals) + '\n\n'; }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5485
      break;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5486
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5487
    case 'ol':
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5488
      if (!spansOnly) { txt = showdown.subParser('makeMarkdown.list')(node, globals, 'ol') + '\n\n'; }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5489
      break;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5490
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5491
    case 'ul':
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5492
      if (!spansOnly) { txt = showdown.subParser('makeMarkdown.list')(node, globals, 'ul') + '\n\n'; }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5493
      break;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5494
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5495
    case 'precode':
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5496
      if (!spansOnly) { txt = showdown.subParser('makeMarkdown.codeBlock')(node, globals) + '\n\n'; }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5497
      break;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5498
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5499
    case 'pre':
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5500
      if (!spansOnly) { txt = showdown.subParser('makeMarkdown.pre')(node, globals) + '\n\n'; }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5501
      break;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5502
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5503
    case 'table':
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5504
      if (!spansOnly) { txt = showdown.subParser('makeMarkdown.table')(node, globals) + '\n\n'; }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5505
      break;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5506
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5507
    //
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5508
    // SPANS
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5509
    //
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5510
    case 'code':
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5511
      txt = showdown.subParser('makeMarkdown.codeSpan')(node, globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5512
      break;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5513
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5514
    case 'em':
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5515
    case 'i':
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5516
      txt = showdown.subParser('makeMarkdown.emphasis')(node, globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5517
      break;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5518
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5519
    case 'strong':
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5520
    case 'b':
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5521
      txt = showdown.subParser('makeMarkdown.strong')(node, globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5522
      break;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5523
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5524
    case 'del':
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5525
      txt = showdown.subParser('makeMarkdown.strikethrough')(node, globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5526
      break;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5527
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5528
    case 'a':
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5529
      txt = showdown.subParser('makeMarkdown.links')(node, globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5530
      break;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5531
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5532
    case 'img':
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5533
      txt = showdown.subParser('makeMarkdown.image')(node, globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5534
      break;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5535
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5536
    default:
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5537
      txt = node.outerHTML + '\n\n';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5538
  }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5539
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5540
  // common normalization
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5541
  // TODO eventually
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5542
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5543
  return txt;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5544
});
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5545
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5546
showdown.subParser('makeMarkdown.paragraph', function (node, globals) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5547
  'use strict';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5548
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5549
  var txt = '';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5550
  if (node.hasChildNodes()) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5551
    var children = node.childNodes,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5552
        childrenLength = children.length;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5553
    for (var i = 0; i < childrenLength; ++i) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5554
      txt += showdown.subParser('makeMarkdown.node')(children[i], globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5555
    }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5556
  }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5557
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5558
  // some text normalization
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5559
  txt = txt.trim();
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5560
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5561
  return txt;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5562
});
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5563
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5564
showdown.subParser('makeMarkdown.pre', function (node, globals) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5565
  'use strict';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5566
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5567
  var num  = node.getAttribute('prenum');
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5568
  return '<pre>' + globals.preList[num] + '</pre>';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5569
});
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5570
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5571
showdown.subParser('makeMarkdown.strikethrough', function (node, globals) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5572
  'use strict';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5573
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5574
  var txt = '';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5575
  if (node.hasChildNodes()) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5576
    txt += '~~';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5577
    var children = node.childNodes,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5578
        childrenLength = children.length;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5579
    for (var i = 0; i < childrenLength; ++i) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5580
      txt += showdown.subParser('makeMarkdown.node')(children[i], globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5581
    }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5582
    txt += '~~';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5583
  }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5584
  return txt;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5585
});
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5586
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5587
showdown.subParser('makeMarkdown.strong', function (node, globals) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5588
  'use strict';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5589
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5590
  var txt = '';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5591
  if (node.hasChildNodes()) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5592
    txt += '**';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5593
    var children = node.childNodes,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5594
        childrenLength = children.length;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5595
    for (var i = 0; i < childrenLength; ++i) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5596
      txt += showdown.subParser('makeMarkdown.node')(children[i], globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5597
    }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5598
    txt += '**';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5599
  }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5600
  return txt;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5601
});
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5602
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5603
showdown.subParser('makeMarkdown.table', function (node, globals) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5604
  'use strict';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5605
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5606
  var txt = '',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5607
      tableArray = [[], []],
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5608
      headings   = node.querySelectorAll('thead>tr>th'),
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5609
      rows       = node.querySelectorAll('tbody>tr'),
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5610
      i, ii;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5611
  for (i = 0; i < headings.length; ++i) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5612
    var headContent = showdown.subParser('makeMarkdown.tableCell')(headings[i], globals),
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5613
        allign = '---';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5614
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5615
    if (headings[i].hasAttribute('style')) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5616
      var style = headings[i].getAttribute('style').toLowerCase().replace(/\s/g, '');
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5617
      switch (style) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5618
        case 'text-align:left;':
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5619
          allign = ':---';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5620
          break;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5621
        case 'text-align:right;':
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5622
          allign = '---:';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5623
          break;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5624
        case 'text-align:center;':
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5625
          allign = ':---:';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5626
          break;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5627
      }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5628
    }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5629
    tableArray[0][i] = headContent.trim();
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5630
    tableArray[1][i] = allign;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5631
  }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5632
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5633
  for (i = 0; i < rows.length; ++i) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5634
    var r = tableArray.push([]) - 1,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5635
        cols = rows[i].getElementsByTagName('td');
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5636
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5637
    for (ii = 0; ii < headings.length; ++ii) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5638
      var cellContent = ' ';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5639
      if (typeof cols[ii] !== 'undefined') {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5640
        cellContent = showdown.subParser('makeMarkdown.tableCell')(cols[ii], globals);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5641
      }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5642
      tableArray[r].push(cellContent);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5643
    }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5644
  }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5645
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5646
  var cellSpacesCount = 3;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5647
  for (i = 0; i < tableArray.length; ++i) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5648
    for (ii = 0; ii < tableArray[i].length; ++ii) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5649
      var strLen = tableArray[i][ii].length;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5650
      if (strLen > cellSpacesCount) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5651
        cellSpacesCount = strLen;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5652
      }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5653
    }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5654
  }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5655
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5656
  for (i = 0; i < tableArray.length; ++i) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5657
    for (ii = 0; ii < tableArray[i].length; ++ii) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5658
      if (i === 1) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5659
        if (tableArray[i][ii].slice(-1) === ':') {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5660
          tableArray[i][ii] = showdown.helper.padEnd(tableArray[i][ii].slice(-1), cellSpacesCount - 1, '-') + ':';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5661
        } else {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5662
          tableArray[i][ii] = showdown.helper.padEnd(tableArray[i][ii], cellSpacesCount, '-');
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5663
        }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5664
      } else {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5665
        tableArray[i][ii] = showdown.helper.padEnd(tableArray[i][ii], cellSpacesCount);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5666
      }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5667
    }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5668
    txt += '| ' + tableArray[i].join(' | ') + ' |\n';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5669
  }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5670
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5671
  return txt.trim();
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5672
});
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5673
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5674
showdown.subParser('makeMarkdown.tableCell', function (node, globals) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5675
  'use strict';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5676
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5677
  var txt = '';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5678
  if (!node.hasChildNodes()) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5679
    return '';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5680
  }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5681
  var children = node.childNodes,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5682
      childrenLength = children.length;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5683
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5684
  for (var i = 0; i < childrenLength; ++i) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5685
    txt += showdown.subParser('makeMarkdown.node')(children[i], globals, true);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5686
  }
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5687
  return txt.trim();
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5688
});
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5689
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5690
showdown.subParser('makeMarkdown.txt', function (node) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5691
  'use strict';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5692
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5693
  var txt = node.nodeValue;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5694
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5695
  // multiple spaces are collapsed
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5696
  txt = txt.replace(/ +/g, ' ');
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5697
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5698
  // replace the custom ¨NBSP; with a space
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5699
  txt = txt.replace(/¨NBSP;/g, ' ');
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5700
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5701
  // ", <, > and & should replace escaped html entities
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5702
  txt = showdown.helper.unescapeHTMLEntities(txt);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5703
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5704
  // escape markdown magic characters
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5705
  // emphasis, strong and strikethrough - can appear everywhere
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5706
  // we also escape pipe (|) because of tables
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5707
  // and escape ` because of code blocks and spans
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5708
  txt = txt.replace(/([*_~|`])/g, '\\$1');
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5709
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5710
  // escape > because of blockquotes
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5711
  txt = txt.replace(/^(\s*)>/g, '\\$1>');
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5712
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5713
  // hash character, only troublesome at the beginning of a line because of headers
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5714
  txt = txt.replace(/^#/gm, '\\#');
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5715
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5716
  // horizontal rules
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5717
  txt = txt.replace(/^(\s*)([-=]{3,})(\s*)$/, '$1\\$2$3');
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5718
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5719
  // dot, because of ordered lists, only troublesome at the beginning of a line when preceded by an integer
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5720
  txt = txt.replace(/^( {0,3}\d+)\./gm, '$1\\.');
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5721
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5722
  // +, * and -, at the beginning of a line becomes a list, so we need to escape them also (asterisk was already escaped)
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5723
  txt = txt.replace(/^( {0,3})([+-])/gm, '$1\\$2');
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5724
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5725
  // images and links, ] followed by ( is problematic, so we escape it
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5726
  txt = txt.replace(/]([\s]*)\(/g, '\\]$1\\(');
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5727
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5728
  // reference URIs must also be escaped
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5729
  txt = txt.replace(/^ {0,3}\[([\S \t]*?)]:/gm, '\\[$1]:');
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5730
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5731
  return txt;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5732
});
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5733
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5734
var root = this;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5735
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5736
// AMD Loader
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5737
if (true) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5738
  !(__WEBPACK_AMD_DEFINE_RESULT__ = (function () {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5739
    'use strict';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5740
    return showdown;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5741
  }).call(exports, __webpack_require__, exports, module),
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  5742
		__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5743
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5744
// CommonJS/nodeJS Loader
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5745
} else {}
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5746
}).call(this);
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5747
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5748
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents:
diff changeset
  5749
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
  5750
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  5751
/***/ })
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  5752
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  5753
/******/ 	});
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  5754
/************************************************************************/
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  5755
/******/ 	// The module cache
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  5756
/******/ 	var __webpack_module_cache__ = {};
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  5757
/******/ 	
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  5758
/******/ 	// The require function
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  5759
/******/ 	function __webpack_require__(moduleId) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  5760
/******/ 		// Check if module is in cache
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  5761
/******/ 		var cachedModule = __webpack_module_cache__[moduleId];
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  5762
/******/ 		if (cachedModule !== undefined) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  5763
/******/ 			return cachedModule.exports;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  5764
/******/ 		}
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  5765
/******/ 		// Create a new module (and put it into the cache)
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  5766
/******/ 		var module = __webpack_module_cache__[moduleId] = {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  5767
/******/ 			// no module.id needed
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  5768
/******/ 			// no module.loaded needed
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  5769
/******/ 			exports: {}
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  5770
/******/ 		};
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  5771
/******/ 	
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  5772
/******/ 		// Execute the module function
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  5773
/******/ 		__webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  5774
/******/ 	
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  5775
/******/ 		// Return the exports of the module
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  5776
/******/ 		return module.exports;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  5777
/******/ 	}
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  5778
/******/ 	
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  5779
/************************************************************************/
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  5780
/******/ 	/* webpack/runtime/compat get default export */
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5781
/******/ 	(() => {
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  5782
/******/ 		// getDefaultExport function for compatibility with non-harmony modules
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5783
/******/ 		__webpack_require__.n = (module) => {
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  5784
/******/ 			var getter = module && module.__esModule ?
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5785
/******/ 				() => (module['default']) :
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5786
/******/ 				() => (module);
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  5787
/******/ 			__webpack_require__.d(getter, { a: getter });
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  5788
/******/ 			return getter;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  5789
/******/ 		};
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5790
/******/ 	})();
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  5791
/******/ 	
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  5792
/******/ 	/* webpack/runtime/define property getters */
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5793
/******/ 	(() => {
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  5794
/******/ 		// define getter functions for harmony exports
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5795
/******/ 		__webpack_require__.d = (exports, definition) => {
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  5796
/******/ 			for(var key in definition) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  5797
/******/ 				if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  5798
/******/ 					Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  5799
/******/ 				}
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  5800
/******/ 			}
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  5801
/******/ 		};
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5802
/******/ 	})();
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  5803
/******/ 	
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  5804
/******/ 	/* webpack/runtime/hasOwnProperty shorthand */
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5805
/******/ 	(() => {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5806
/******/ 		__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5807
/******/ 	})();
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  5808
/******/ 	
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  5809
/******/ 	/* webpack/runtime/make namespace object */
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5810
/******/ 	(() => {
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  5811
/******/ 		// define __esModule on exports
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5812
/******/ 		__webpack_require__.r = (exports) => {
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  5813
/******/ 			if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  5814
/******/ 				Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  5815
/******/ 			}
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  5816
/******/ 			Object.defineProperty(exports, '__esModule', { value: true });
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  5817
/******/ 		};
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5818
/******/ 	})();
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  5819
/******/ 	
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  5820
/************************************************************************/
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  5821
var __webpack_exports__ = {};
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  5822
// This entry need to be wrapped in an IIFE because it need to be in strict mode.
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5823
(() => {
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  5824
"use strict";
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  5825
// ESM COMPAT FLAG
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  5826
__webpack_require__.r(__webpack_exports__);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  5827
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  5828
// EXPORTS
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  5829
__webpack_require__.d(__webpack_exports__, {
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5830
  __EXPERIMENTAL_ELEMENTS: () => (/* reexport */ __EXPERIMENTAL_ELEMENTS),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5831
  __EXPERIMENTAL_PATHS_WITH_OVERRIDE: () => (/* reexport */ __EXPERIMENTAL_PATHS_WITH_OVERRIDE),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5832
  __EXPERIMENTAL_STYLE_PROPERTY: () => (/* reexport */ __EXPERIMENTAL_STYLE_PROPERTY),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5833
  __experimentalCloneSanitizedBlock: () => (/* reexport */ __experimentalCloneSanitizedBlock),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5834
  __experimentalGetAccessibleBlockLabel: () => (/* reexport */ getAccessibleBlockLabel),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5835
  __experimentalGetBlockAttributesNamesByRole: () => (/* reexport */ __experimentalGetBlockAttributesNamesByRole),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5836
  __experimentalGetBlockLabel: () => (/* reexport */ getBlockLabel),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5837
  __experimentalSanitizeBlockAttributes: () => (/* reexport */ __experimentalSanitizeBlockAttributes),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5838
  __unstableGetBlockProps: () => (/* reexport */ getBlockProps),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5839
  __unstableGetInnerBlocksProps: () => (/* reexport */ getInnerBlocksProps),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5840
  __unstableSerializeAndClean: () => (/* reexport */ __unstableSerializeAndClean),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5841
  children: () => (/* reexport */ children),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5842
  cloneBlock: () => (/* reexport */ cloneBlock),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5843
  createBlock: () => (/* reexport */ createBlock),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5844
  createBlocksFromInnerBlocksTemplate: () => (/* reexport */ createBlocksFromInnerBlocksTemplate),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5845
  doBlocksMatchTemplate: () => (/* reexport */ doBlocksMatchTemplate),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5846
  findTransform: () => (/* reexport */ findTransform),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5847
  getBlockAttributes: () => (/* reexport */ getBlockAttributes),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5848
  getBlockContent: () => (/* reexport */ getBlockInnerHTML),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5849
  getBlockDefaultClassName: () => (/* reexport */ getBlockDefaultClassName),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5850
  getBlockFromExample: () => (/* reexport */ getBlockFromExample),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5851
  getBlockMenuDefaultClassName: () => (/* reexport */ getBlockMenuDefaultClassName),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5852
  getBlockSupport: () => (/* reexport */ getBlockSupport),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5853
  getBlockTransforms: () => (/* reexport */ getBlockTransforms),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5854
  getBlockType: () => (/* reexport */ getBlockType),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5855
  getBlockTypes: () => (/* reexport */ getBlockTypes),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5856
  getBlockVariations: () => (/* reexport */ getBlockVariations),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5857
  getCategories: () => (/* reexport */ categories_getCategories),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5858
  getChildBlockNames: () => (/* reexport */ getChildBlockNames),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5859
  getDefaultBlockName: () => (/* reexport */ getDefaultBlockName),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5860
  getFreeformContentHandlerName: () => (/* reexport */ getFreeformContentHandlerName),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5861
  getGroupingBlockName: () => (/* reexport */ getGroupingBlockName),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5862
  getPhrasingContentSchema: () => (/* reexport */ deprecatedGetPhrasingContentSchema),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5863
  getPossibleBlockTransformations: () => (/* reexport */ getPossibleBlockTransformations),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5864
  getSaveContent: () => (/* reexport */ getSaveContent),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5865
  getSaveElement: () => (/* reexport */ getSaveElement),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5866
  getUnregisteredTypeHandlerName: () => (/* reexport */ getUnregisteredTypeHandlerName),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5867
  hasBlockSupport: () => (/* reexport */ hasBlockSupport),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5868
  hasChildBlocks: () => (/* reexport */ hasChildBlocks),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5869
  hasChildBlocksWithInserterSupport: () => (/* reexport */ hasChildBlocksWithInserterSupport),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5870
  isReusableBlock: () => (/* reexport */ isReusableBlock),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5871
  isTemplatePart: () => (/* reexport */ isTemplatePart),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5872
  isUnmodifiedBlock: () => (/* reexport */ isUnmodifiedBlock),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5873
  isUnmodifiedDefaultBlock: () => (/* reexport */ isUnmodifiedDefaultBlock),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5874
  isValidBlockContent: () => (/* reexport */ isValidBlockContent),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5875
  isValidIcon: () => (/* reexport */ isValidIcon),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5876
  node: () => (/* reexport */ node),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5877
  normalizeIconObject: () => (/* reexport */ normalizeIconObject),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5878
  parse: () => (/* reexport */ parser_parse),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5879
  parseWithAttributeSchema: () => (/* reexport */ parseWithAttributeSchema),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5880
  pasteHandler: () => (/* reexport */ pasteHandler),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5881
  rawHandler: () => (/* reexport */ rawHandler),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5882
  registerBlockCollection: () => (/* reexport */ registerBlockCollection),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5883
  registerBlockStyle: () => (/* reexport */ registerBlockStyle),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5884
  registerBlockType: () => (/* reexport */ registerBlockType),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5885
  registerBlockVariation: () => (/* reexport */ registerBlockVariation),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5886
  serialize: () => (/* reexport */ serialize),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5887
  serializeRawBlock: () => (/* reexport */ serializeRawBlock),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5888
  setCategories: () => (/* reexport */ categories_setCategories),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5889
  setDefaultBlockName: () => (/* reexport */ setDefaultBlockName),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5890
  setFreeformContentHandlerName: () => (/* reexport */ setFreeformContentHandlerName),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5891
  setGroupingBlockName: () => (/* reexport */ setGroupingBlockName),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5892
  setUnregisteredTypeHandlerName: () => (/* reexport */ setUnregisteredTypeHandlerName),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5893
  store: () => (/* reexport */ store),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5894
  switchToBlockType: () => (/* reexport */ switchToBlockType),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5895
  synchronizeBlocksWithTemplate: () => (/* reexport */ synchronizeBlocksWithTemplate),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5896
  unregisterBlockStyle: () => (/* reexport */ unregisterBlockStyle),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5897
  unregisterBlockType: () => (/* reexport */ unregisterBlockType),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5898
  unregisterBlockVariation: () => (/* reexport */ unregisterBlockVariation),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5899
  unstable__bootstrapServerSideBlockDefinitions: () => (/* reexport */ unstable__bootstrapServerSideBlockDefinitions),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5900
  updateCategory: () => (/* reexport */ categories_updateCategory),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5901
  validateBlock: () => (/* reexport */ validateBlock),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5902
  withBlockContentContext: () => (/* reexport */ withBlockContentContext)
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  5903
});
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  5904
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  5905
// NAMESPACE OBJECT: ./node_modules/@wordpress/blocks/build-module/store/selectors.js
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  5906
var selectors_namespaceObject = {};
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  5907
__webpack_require__.r(selectors_namespaceObject);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  5908
__webpack_require__.d(selectors_namespaceObject, {
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5909
  __experimentalHasContentRoleAttribute: () => (__experimentalHasContentRoleAttribute),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5910
  getActiveBlockVariation: () => (getActiveBlockVariation),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5911
  getBlockStyles: () => (getBlockStyles),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5912
  getBlockSupport: () => (selectors_getBlockSupport),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5913
  getBlockType: () => (selectors_getBlockType),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5914
  getBlockTypes: () => (selectors_getBlockTypes),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5915
  getBlockVariations: () => (selectors_getBlockVariations),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5916
  getCategories: () => (getCategories),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5917
  getChildBlockNames: () => (selectors_getChildBlockNames),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5918
  getCollections: () => (getCollections),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5919
  getDefaultBlockName: () => (selectors_getDefaultBlockName),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5920
  getDefaultBlockVariation: () => (getDefaultBlockVariation),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5921
  getFreeformFallbackBlockName: () => (getFreeformFallbackBlockName),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5922
  getGroupingBlockName: () => (selectors_getGroupingBlockName),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5923
  getUnregisteredFallbackBlockName: () => (getUnregisteredFallbackBlockName),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5924
  hasBlockSupport: () => (selectors_hasBlockSupport),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5925
  hasChildBlocks: () => (selectors_hasChildBlocks),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5926
  hasChildBlocksWithInserterSupport: () => (selectors_hasChildBlocksWithInserterSupport),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5927
  isMatchingSearchTerm: () => (isMatchingSearchTerm)
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5928
});
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5929
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5930
// NAMESPACE OBJECT: ./node_modules/@wordpress/blocks/build-module/store/private-selectors.js
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5931
var private_selectors_namespaceObject = {};
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5932
__webpack_require__.r(private_selectors_namespaceObject);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5933
__webpack_require__.d(private_selectors_namespaceObject, {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5934
  getAllBlockBindingsSources: () => (getAllBlockBindingsSources),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5935
  getBlockBindingsSource: () => (getBlockBindingsSource),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5936
  getBootstrappedBlockType: () => (getBootstrappedBlockType),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5937
  getSupportedStyles: () => (getSupportedStyles),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5938
  getUnprocessedBlockTypes: () => (getUnprocessedBlockTypes)
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  5939
});
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  5940
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  5941
// NAMESPACE OBJECT: ./node_modules/@wordpress/blocks/build-module/store/actions.js
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  5942
var actions_namespaceObject = {};
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  5943
__webpack_require__.r(actions_namespaceObject);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  5944
__webpack_require__.d(actions_namespaceObject, {
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5945
  __experimentalReapplyBlockFilters: () => (__experimentalReapplyBlockFilters),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5946
  addBlockCollection: () => (addBlockCollection),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5947
  addBlockStyles: () => (addBlockStyles),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5948
  addBlockTypes: () => (addBlockTypes),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5949
  addBlockVariations: () => (addBlockVariations),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5950
  reapplyBlockTypeFilters: () => (reapplyBlockTypeFilters),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5951
  removeBlockCollection: () => (removeBlockCollection),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5952
  removeBlockStyles: () => (removeBlockStyles),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5953
  removeBlockTypes: () => (removeBlockTypes),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5954
  removeBlockVariations: () => (removeBlockVariations),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5955
  setCategories: () => (setCategories),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5956
  setDefaultBlockName: () => (actions_setDefaultBlockName),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5957
  setFreeformFallbackBlockName: () => (setFreeformFallbackBlockName),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5958
  setGroupingBlockName: () => (actions_setGroupingBlockName),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5959
  setUnregisteredFallbackBlockName: () => (setUnregisteredFallbackBlockName),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5960
  updateCategory: () => (updateCategory)
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5961
});
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5962
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5963
// NAMESPACE OBJECT: ./node_modules/@wordpress/blocks/build-module/store/private-actions.js
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5964
var private_actions_namespaceObject = {};
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5965
__webpack_require__.r(private_actions_namespaceObject);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5966
__webpack_require__.d(private_actions_namespaceObject, {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5967
  addBootstrappedBlockType: () => (addBootstrappedBlockType),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5968
  addUnprocessedBlockType: () => (addUnprocessedBlockType),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5969
  registerBlockBindingsSource: () => (registerBlockBindingsSource)
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  5970
});
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  5971
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  5972
;// CONCATENATED MODULE: external ["wp","data"]
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5973
const external_wp_data_namespaceObject = window["wp"]["data"];
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5974
;// CONCATENATED MODULE: ./node_modules/tslib/tslib.es6.mjs
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5975
/******************************************************************************
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5976
Copyright (c) Microsoft Corporation.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5977
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5978
Permission to use, copy, modify, and/or distribute this software for any
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5979
purpose with or without fee is hereby granted.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5980
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5981
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5982
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5983
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5984
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5985
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5986
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5987
PERFORMANCE OF THIS SOFTWARE.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5988
***************************************************************************** */
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5989
/* global Reflect, Promise, SuppressedError, Symbol */
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5990
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5991
var extendStatics = function(d, b) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5992
  extendStatics = Object.setPrototypeOf ||
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5993
      ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5994
      function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5995
  return extendStatics(d, b);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5996
};
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5997
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5998
function __extends(d, b) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  5999
  if (typeof b !== "function" && b !== null)
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6000
      throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6001
  extendStatics(d, b);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6002
  function __() { this.constructor = d; }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6003
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6004
}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6005
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6006
var __assign = function() {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6007
  __assign = Object.assign || function __assign(t) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6008
      for (var s, i = 1, n = arguments.length; i < n; i++) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6009
          s = arguments[i];
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6010
          for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6011
      }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6012
      return t;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6013
  }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6014
  return __assign.apply(this, arguments);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6015
}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6016
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6017
function __rest(s, e) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6018
  var t = {};
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6019
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6020
      t[p] = s[p];
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6021
  if (s != null && typeof Object.getOwnPropertySymbols === "function")
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6022
      for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6023
          if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6024
              t[p[i]] = s[p[i]];
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6025
      }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6026
  return t;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6027
}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6028
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6029
function __decorate(decorators, target, key, desc) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6030
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6031
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6032
  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;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6033
  return c > 3 && r && Object.defineProperty(target, key, r), r;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6034
}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6035
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6036
function __param(paramIndex, decorator) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6037
  return function (target, key) { decorator(target, key, paramIndex); }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6038
}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6039
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6040
function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6041
  function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6042
  var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6043
  var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6044
  var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6045
  var _, done = false;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6046
  for (var i = decorators.length - 1; i >= 0; i--) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6047
      var context = {};
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6048
      for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6049
      for (var p in contextIn.access) context.access[p] = contextIn.access[p];
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6050
      context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6051
      var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6052
      if (kind === "accessor") {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6053
          if (result === void 0) continue;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6054
          if (result === null || typeof result !== "object") throw new TypeError("Object expected");
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6055
          if (_ = accept(result.get)) descriptor.get = _;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6056
          if (_ = accept(result.set)) descriptor.set = _;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6057
          if (_ = accept(result.init)) initializers.unshift(_);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6058
      }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6059
      else if (_ = accept(result)) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6060
          if (kind === "field") initializers.unshift(_);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6061
          else descriptor[key] = _;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6062
      }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6063
  }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6064
  if (target) Object.defineProperty(target, contextIn.name, descriptor);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6065
  done = true;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6066
};
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6067
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6068
function __runInitializers(thisArg, initializers, value) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6069
  var useValue = arguments.length > 2;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6070
  for (var i = 0; i < initializers.length; i++) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6071
      value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6072
  }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6073
  return useValue ? value : void 0;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6074
};
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6075
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6076
function __propKey(x) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6077
  return typeof x === "symbol" ? x : "".concat(x);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6078
};
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6079
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6080
function __setFunctionName(f, name, prefix) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6081
  if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : "";
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6082
  return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6083
};
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6084
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6085
function __metadata(metadataKey, metadataValue) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6086
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6087
}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6088
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6089
function __awaiter(thisArg, _arguments, P, generator) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6090
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6091
  return new (P || (P = Promise))(function (resolve, reject) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6092
      function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6093
      function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6094
      function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6095
      step((generator = generator.apply(thisArg, _arguments || [])).next());
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6096
  });
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6097
}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6098
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6099
function __generator(thisArg, body) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6100
  var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6101
  return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6102
  function verb(n) { return function (v) { return step([n, v]); }; }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6103
  function step(op) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6104
      if (f) throw new TypeError("Generator is already executing.");
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6105
      while (g && (g = 0, op[0] && (_ = 0)), _) try {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6106
          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;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6107
          if (y = 0, t) op = [op[0] & 2, t.value];
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6108
          switch (op[0]) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6109
              case 0: case 1: t = op; break;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6110
              case 4: _.label++; return { value: op[1], done: false };
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6111
              case 5: _.label++; y = op[1]; op = [0]; continue;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6112
              case 7: op = _.ops.pop(); _.trys.pop(); continue;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6113
              default:
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6114
                  if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6115
                  if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6116
                  if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6117
                  if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6118
                  if (t[2]) _.ops.pop();
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6119
                  _.trys.pop(); continue;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6120
          }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6121
          op = body.call(thisArg, _);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6122
      } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6123
      if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6124
  }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6125
}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6126
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6127
var __createBinding = Object.create ? (function(o, m, k, k2) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6128
  if (k2 === undefined) k2 = k;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6129
  var desc = Object.getOwnPropertyDescriptor(m, k);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6130
  if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6131
      desc = { enumerable: true, get: function() { return m[k]; } };
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6132
  }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6133
  Object.defineProperty(o, k2, desc);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6134
}) : (function(o, m, k, k2) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6135
  if (k2 === undefined) k2 = k;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6136
  o[k2] = m[k];
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6137
});
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6138
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6139
function __exportStar(m, o) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6140
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6141
}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6142
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6143
function __values(o) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6144
  var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6145
  if (m) return m.call(o);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6146
  if (o && typeof o.length === "number") return {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6147
      next: function () {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6148
          if (o && i >= o.length) o = void 0;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6149
          return { value: o && o[i++], done: !o };
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6150
      }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6151
  };
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6152
  throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6153
}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6154
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6155
function __read(o, n) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6156
  var m = typeof Symbol === "function" && o[Symbol.iterator];
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6157
  if (!m) return o;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6158
  var i = m.call(o), r, ar = [], e;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6159
  try {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6160
      while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6161
  }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6162
  catch (error) { e = { error: error }; }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6163
  finally {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6164
      try {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6165
          if (r && !r.done && (m = i["return"])) m.call(i);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6166
      }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6167
      finally { if (e) throw e.error; }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6168
  }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6169
  return ar;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6170
}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6171
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6172
/** @deprecated */
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6173
function __spread() {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6174
  for (var ar = [], i = 0; i < arguments.length; i++)
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6175
      ar = ar.concat(__read(arguments[i]));
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6176
  return ar;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6177
}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6178
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6179
/** @deprecated */
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6180
function __spreadArrays() {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6181
  for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6182
  for (var r = Array(s), k = 0, i = 0; i < il; i++)
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6183
      for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6184
          r[k] = a[j];
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6185
  return r;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6186
}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6187
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6188
function __spreadArray(to, from, pack) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6189
  if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6190
      if (ar || !(i in from)) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6191
          if (!ar) ar = Array.prototype.slice.call(from, 0, i);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6192
          ar[i] = from[i];
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6193
      }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6194
  }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6195
  return to.concat(ar || Array.prototype.slice.call(from));
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6196
}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6197
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6198
function __await(v) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6199
  return this instanceof __await ? (this.v = v, this) : new __await(v);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6200
}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6201
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6202
function __asyncGenerator(thisArg, _arguments, generator) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6203
  if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6204
  var g = generator.apply(thisArg, _arguments || []), i, q = [];
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6205
  return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6206
  function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6207
  function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6208
  function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6209
  function fulfill(value) { resume("next", value); }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6210
  function reject(value) { resume("throw", value); }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6211
  function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6212
}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6213
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6214
function __asyncDelegator(o) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6215
  var i, p;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6216
  return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6217
  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; }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6218
}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6219
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6220
function __asyncValues(o) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6221
  if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6222
  var m = o[Symbol.asyncIterator], i;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6223
  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);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6224
  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); }); }; }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6225
  function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6226
}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6227
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6228
function __makeTemplateObject(cooked, raw) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6229
  if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6230
  return cooked;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6231
};
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6232
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6233
var __setModuleDefault = Object.create ? (function(o, v) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6234
  Object.defineProperty(o, "default", { enumerable: true, value: v });
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6235
}) : function(o, v) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6236
  o["default"] = v;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6237
};
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6238
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6239
function __importStar(mod) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6240
  if (mod && mod.__esModule) return mod;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6241
  var result = {};
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6242
  if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6243
  __setModuleDefault(result, mod);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6244
  return result;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6245
}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6246
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6247
function __importDefault(mod) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6248
  return (mod && mod.__esModule) ? mod : { default: mod };
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6249
}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6250
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6251
function __classPrivateFieldGet(receiver, state, kind, f) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6252
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6253
  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");
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6254
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6255
}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6256
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6257
function __classPrivateFieldSet(receiver, state, value, kind, f) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6258
  if (kind === "m") throw new TypeError("Private method is not writable");
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6259
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6260
  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");
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6261
  return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6262
}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6263
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6264
function __classPrivateFieldIn(state, receiver) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6265
  if (receiver === null || (typeof receiver !== "object" && typeof receiver !== "function")) throw new TypeError("Cannot use 'in' operator on non-object");
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6266
  return typeof state === "function" ? receiver === state : state.has(receiver);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6267
}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6268
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6269
function __addDisposableResource(env, value, async) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6270
  if (value !== null && value !== void 0) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6271
    if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6272
    var dispose;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6273
    if (async) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6274
        if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined.");
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6275
        dispose = value[Symbol.asyncDispose];
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6276
    }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6277
    if (dispose === void 0) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6278
        if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined.");
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6279
        dispose = value[Symbol.dispose];
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6280
    }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6281
    if (typeof dispose !== "function") throw new TypeError("Object not disposable.");
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6282
    env.stack.push({ value: value, dispose: dispose, async: async });
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6283
  }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6284
  else if (async) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6285
    env.stack.push({ async: true });
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6286
  }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6287
  return value;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6288
}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6289
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6290
var _SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6291
  var e = new Error(message);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6292
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6293
};
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6294
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6295
function __disposeResources(env) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6296
  function fail(e) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6297
    env.error = env.hasError ? new _SuppressedError(e, env.error, "An error was suppressed during disposal.") : e;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6298
    env.hasError = true;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6299
  }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6300
  function next() {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6301
    while (env.stack.length) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6302
      var rec = env.stack.pop();
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6303
      try {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6304
        var result = rec.dispose && rec.dispose.call(rec.value);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6305
        if (rec.async) return Promise.resolve(result).then(next, function(e) { fail(e); return next(); });
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6306
      }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6307
      catch (e) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6308
          fail(e);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6309
      }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6310
    }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6311
    if (env.hasError) throw env.error;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6312
  }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6313
  return next();
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6314
}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6315
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6316
/* harmony default export */ const tslib_es6 = ({
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6317
  __extends,
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6318
  __assign,
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6319
  __rest,
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6320
  __decorate,
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6321
  __param,
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6322
  __metadata,
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6323
  __awaiter,
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6324
  __generator,
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6325
  __createBinding,
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6326
  __exportStar,
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6327
  __values,
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6328
  __read,
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6329
  __spread,
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6330
  __spreadArrays,
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6331
  __spreadArray,
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6332
  __await,
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6333
  __asyncGenerator,
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6334
  __asyncDelegator,
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6335
  __asyncValues,
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6336
  __makeTemplateObject,
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6337
  __importStar,
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6338
  __importDefault,
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6339
  __classPrivateFieldGet,
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6340
  __classPrivateFieldSet,
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6341
  __classPrivateFieldIn,
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6342
  __addDisposableResource,
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6343
  __disposeResources,
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6344
});
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6345
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6346
;// CONCATENATED MODULE: ./node_modules/lower-case/dist.es2015/index.js
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6347
/**
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6348
 * Source: ftp://ftp.unicode.org/Public/UCD/latest/ucd/SpecialCasing.txt
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6349
 */
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6350
var SUPPORTED_LOCALE = {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6351
    tr: {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6352
        regexp: /\u0130|\u0049|\u0049\u0307/g,
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6353
        map: {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6354
            İ: "\u0069",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6355
            I: "\u0131",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6356
            İ: "\u0069",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6357
        },
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6358
    },
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6359
    az: {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6360
        regexp: /\u0130/g,
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6361
        map: {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6362
            İ: "\u0069",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6363
            I: "\u0131",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6364
            İ: "\u0069",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6365
        },
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6366
    },
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6367
    lt: {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6368
        regexp: /\u0049|\u004A|\u012E|\u00CC|\u00CD|\u0128/g,
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6369
        map: {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6370
            I: "\u0069\u0307",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6371
            J: "\u006A\u0307",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6372
            Į: "\u012F\u0307",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6373
            Ì: "\u0069\u0307\u0300",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6374
            Í: "\u0069\u0307\u0301",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6375
            Ĩ: "\u0069\u0307\u0303",
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6376
        },
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6377
    },
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6378
};
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6379
/**
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6380
 * Localized lower case.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6381
 */
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6382
function localeLowerCase(str, locale) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6383
    var lang = SUPPORTED_LOCALE[locale.toLowerCase()];
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6384
    if (lang)
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6385
        return lowerCase(str.replace(lang.regexp, function (m) { return lang.map[m]; }));
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6386
    return lowerCase(str);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6387
}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6388
/**
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6389
 * Lower case as a function.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6390
 */
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6391
function lowerCase(str) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6392
    return str.toLowerCase();
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6393
}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6394
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6395
;// CONCATENATED MODULE: ./node_modules/no-case/dist.es2015/index.js
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6396
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6397
// Support camel case ("camelCase" -> "camel Case" and "CAMELCase" -> "CAMEL Case").
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6398
var DEFAULT_SPLIT_REGEXP = [/([a-z0-9])([A-Z])/g, /([A-Z])([A-Z][a-z])/g];
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6399
// Remove all non-word characters.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6400
var DEFAULT_STRIP_REGEXP = /[^A-Z0-9]+/gi;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6401
/**
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6402
 * Normalize the string into something other libraries can manipulate easier.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6403
 */
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6404
function noCase(input, options) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6405
    if (options === void 0) { options = {}; }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6406
    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;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6407
    var result = replace(replace(input, splitRegexp, "$1\0$2"), stripRegexp, "\0");
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6408
    var start = 0;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6409
    var end = result.length;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6410
    // Trim the delimiter from around the output string.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6411
    while (result.charAt(start) === "\0")
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6412
        start++;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6413
    while (result.charAt(end - 1) === "\0")
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6414
        end--;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6415
    // Transform each token independently.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6416
    return result.slice(start, end).split("\0").map(transform).join(delimiter);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6417
}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6418
/**
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6419
 * Replace `re` in the input string with the replacement value.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6420
 */
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6421
function replace(input, re, value) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6422
    if (re instanceof RegExp)
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6423
        return input.replace(re, value);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6424
    return re.reduce(function (input, re) { return input.replace(re, value); }, input);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6425
}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6426
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6427
;// CONCATENATED MODULE: ./node_modules/pascal-case/dist.es2015/index.js
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6428
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6429
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6430
function pascalCaseTransform(input, index) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6431
    var firstChar = input.charAt(0);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6432
    var lowerChars = input.substr(1).toLowerCase();
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6433
    if (index > 0 && firstChar >= "0" && firstChar <= "9") {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6434
        return "_" + firstChar + lowerChars;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6435
    }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6436
    return "" + firstChar.toUpperCase() + lowerChars;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6437
}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6438
function dist_es2015_pascalCaseTransformMerge(input) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6439
    return input.charAt(0).toUpperCase() + input.slice(1).toLowerCase();
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6440
}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6441
function pascalCase(input, options) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6442
    if (options === void 0) { options = {}; }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6443
    return noCase(input, __assign({ delimiter: "", transform: pascalCaseTransform }, options));
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6444
}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6445
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6446
;// CONCATENATED MODULE: ./node_modules/camel-case/dist.es2015/index.js
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6447
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6448
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6449
function camelCaseTransform(input, index) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6450
    if (index === 0)
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6451
        return input.toLowerCase();
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6452
    return pascalCaseTransform(input, index);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6453
}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6454
function camelCaseTransformMerge(input, index) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6455
    if (index === 0)
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6456
        return input.toLowerCase();
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6457
    return pascalCaseTransformMerge(input);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6458
}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6459
function camelCase(input, options) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6460
    if (options === void 0) { options = {}; }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6461
    return pascalCase(input, __assign({ transform: camelCaseTransform }, options));
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6462
}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6463
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6464
;// CONCATENATED MODULE: external ["wp","i18n"]
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6465
const external_wp_i18n_namespaceObject = window["wp"]["i18n"];
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6466
;// CONCATENATED MODULE: ./node_modules/colord/index.mjs
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6467
var r={grad:.9,turn:360,rad:360/(2*Math.PI)},t=function(r){return"string"==typeof r?r.length>0:"number"==typeof r},n=function(r,t,n){return void 0===t&&(t=0),void 0===n&&(n=Math.pow(10,t)),Math.round(n*r)/n+0},e=function(r,t,n){return void 0===t&&(t=0),void 0===n&&(n=1),r>n?n:r>t?r:t},u=function(r){return(r=isFinite(r)?r%360:0)>0?r:r+360},a=function(r){return{r:e(r.r,0,255),g:e(r.g,0,255),b:e(r.b,0,255),a:e(r.a)}},o=function(r){return{r:n(r.r),g:n(r.g),b:n(r.b),a:n(r.a,3)}},i=/^#([0-9a-f]{3,8})$/i,s=function(r){var t=r.toString(16);return t.length<2?"0"+t:t},h=function(r){var t=r.r,n=r.g,e=r.b,u=r.a,a=Math.max(t,n,e),o=a-Math.min(t,n,e),i=o?a===t?(n-e)/o:a===n?2+(e-t)/o:4+(t-n)/o:0;return{h:60*(i<0?i+6:i),s:a?o/a*100:0,v:a/255*100,a:u}},b=function(r){var t=r.h,n=r.s,e=r.v,u=r.a;t=t/360*6,n/=100,e/=100;var a=Math.floor(t),o=e*(1-n),i=e*(1-(t-a)*n),s=e*(1-(1-t+a)*n),h=a%6;return{r:255*[e,i,o,o,s,e][h],g:255*[s,e,e,i,o,o][h],b:255*[o,o,s,e,e,i][h],a:u}},g=function(r){return{h:u(r.h),s:e(r.s,0,100),l:e(r.l,0,100),a:e(r.a)}},d=function(r){return{h:n(r.h),s:n(r.s),l:n(r.l),a:n(r.a,3)}},f=function(r){return b((n=(t=r).s,{h:t.h,s:(n*=((e=t.l)<50?e:100-e)/100)>0?2*n/(e+n)*100:0,v:e+n,a:t.a}));var t,n,e},c=function(r){return{h:(t=h(r)).h,s:(u=(200-(n=t.s))*(e=t.v)/100)>0&&u<200?n*e/100/(u<=100?u:200-u)*100:0,l:u/2,a:t.a};var t,n,e,u},l=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,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)*(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}},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 j?r:new j(r)},S=[],k=function(r){r.forEach(function(r){S.indexOf(r)<0&&(r(j,y),S.push(r))})},E=function(){return new j({r:255*Math.random(),g:255*Math.random(),b:255*Math.random()})};
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6468
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6469
;// CONCATENATED MODULE: ./node_modules/colord/plugins/names.mjs
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6470
/* 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"])}
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6471
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6472
;// CONCATENATED MODULE: ./node_modules/colord/plugins/a11y.mjs
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6473
var a11y_o=function(o){var t=o/255;return t<.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)},a11y_t=function(t){return.2126*a11y_o(t.r)+.7152*a11y_o(t.g)+.0722*a11y_o(t.b)};/* harmony default export */ function a11y(o){o.prototype.luminance=function(){return o=a11y_t(this.rgba),void 0===(r=2)&&(r=0),void 0===n&&(n=Math.pow(10,r)),Math.round(n*o)/n+0;var o,r,n},o.prototype.contrast=function(r){void 0===r&&(r="#FFF");var n,a,i,e,v,u,d,c=r instanceof o?r:new o(r);return e=this.rgba,v=c.toRgb(),u=a11y_t(e),d=a11y_t(v),n=u>d?(u+.05)/(d+.05):(d+.05)/(u+.05),void 0===(a=2)&&(a=0),void 0===i&&(i=Math.pow(10,a)),Math.floor(i*n)/i+0},o.prototype.isReadable=function(o,t){return void 0===o&&(o="#FFF"),void 0===t&&(t={}),this.contrast(o)>=(e=void 0===(i=(r=t).size)?"normal":i,"AAA"===(a=void 0===(n=r.level)?"AA":n)&&"normal"===e?7:"AA"===a&&"large"===e?3:4.5);var r,n,a,i,e}}
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6474
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6475
;// CONCATENATED MODULE: external ["wp","element"]
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6476
const external_wp_element_namespaceObject = window["wp"]["element"];
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6477
;// CONCATENATED MODULE: external ["wp","dom"]
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6478
const external_wp_dom_namespaceObject = window["wp"]["dom"];
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6479
;// CONCATENATED MODULE: external ["wp","richText"]
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6480
const external_wp_richText_namespaceObject = window["wp"]["richText"];
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6481
;// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/constants.js
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6482
const BLOCK_ICON_DEFAULT = 'block-default';
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6483
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6484
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6485
 * Array of valid keys in a block type settings deprecation object.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6486
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6487
 * @type {string[]}
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6488
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6489
const DEPRECATED_ENTRY_KEYS = ['attributes', 'supports', 'save', 'migrate', 'isEligible', 'apiVersion'];
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6490
const __EXPERIMENTAL_STYLE_PROPERTY = {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6491
  // Kept for back-compatibility purposes.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6492
  '--wp--style--color--link': {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6493
    value: ['color', 'link'],
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6494
    support: ['color', 'link']
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6495
  },
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6496
  aspectRatio: {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6497
    value: ['dimensions', 'aspectRatio'],
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6498
    support: ['dimensions', 'aspectRatio'],
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6499
    useEngine: true
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6500
  },
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6501
  background: {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6502
    value: ['color', 'gradient'],
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6503
    support: ['color', 'gradients'],
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6504
    useEngine: true
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6505
  },
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6506
  backgroundColor: {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6507
    value: ['color', 'background'],
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6508
    support: ['color', 'background'],
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6509
    requiresOptOut: true,
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6510
    useEngine: true
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6511
  },
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6512
  backgroundImage: {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6513
    value: ['background', 'backgroundImage'],
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6514
    support: ['background', 'backgroundImage'],
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6515
    useEngine: true
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6516
  },
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6517
  backgroundRepeat: {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6518
    value: ['background', 'backgroundRepeat'],
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6519
    support: ['background', 'backgroundRepeat'],
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6520
    useEngine: true
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6521
  },
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6522
  backgroundSize: {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6523
    value: ['background', 'backgroundSize'],
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6524
    support: ['background', 'backgroundSize'],
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6525
    useEngine: true
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6526
  },
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6527
  backgroundPosition: {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6528
    value: ['background', 'backgroundPosition'],
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6529
    support: ['background', 'backgroundPosition'],
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6530
    useEngine: true
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6531
  },
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6532
  borderColor: {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6533
    value: ['border', 'color'],
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6534
    support: ['__experimentalBorder', 'color'],
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6535
    useEngine: true
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6536
  },
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6537
  borderRadius: {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6538
    value: ['border', 'radius'],
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6539
    support: ['__experimentalBorder', 'radius'],
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6540
    properties: {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6541
      borderTopLeftRadius: 'topLeft',
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6542
      borderTopRightRadius: 'topRight',
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6543
      borderBottomLeftRadius: 'bottomLeft',
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6544
      borderBottomRightRadius: 'bottomRight'
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6545
    },
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6546
    useEngine: true
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6547
  },
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6548
  borderStyle: {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6549
    value: ['border', 'style'],
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6550
    support: ['__experimentalBorder', 'style'],
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6551
    useEngine: true
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6552
  },
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6553
  borderWidth: {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6554
    value: ['border', 'width'],
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6555
    support: ['__experimentalBorder', 'width'],
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6556
    useEngine: true
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6557
  },
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6558
  borderTopColor: {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6559
    value: ['border', 'top', 'color'],
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6560
    support: ['__experimentalBorder', 'color'],
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6561
    useEngine: true
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6562
  },
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6563
  borderTopStyle: {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6564
    value: ['border', 'top', 'style'],
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6565
    support: ['__experimentalBorder', 'style'],
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6566
    useEngine: true
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6567
  },
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6568
  borderTopWidth: {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6569
    value: ['border', 'top', 'width'],
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6570
    support: ['__experimentalBorder', 'width'],
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6571
    useEngine: true
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6572
  },
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6573
  borderRightColor: {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6574
    value: ['border', 'right', 'color'],
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6575
    support: ['__experimentalBorder', 'color'],
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6576
    useEngine: true
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6577
  },
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6578
  borderRightStyle: {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6579
    value: ['border', 'right', 'style'],
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6580
    support: ['__experimentalBorder', 'style'],
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6581
    useEngine: true
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6582
  },
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6583
  borderRightWidth: {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6584
    value: ['border', 'right', 'width'],
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6585
    support: ['__experimentalBorder', 'width'],
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6586
    useEngine: true
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6587
  },
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6588
  borderBottomColor: {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6589
    value: ['border', 'bottom', 'color'],
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6590
    support: ['__experimentalBorder', 'color'],
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6591
    useEngine: true
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6592
  },
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6593
  borderBottomStyle: {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6594
    value: ['border', 'bottom', 'style'],
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6595
    support: ['__experimentalBorder', 'style'],
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6596
    useEngine: true
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6597
  },
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6598
  borderBottomWidth: {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6599
    value: ['border', 'bottom', 'width'],
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6600
    support: ['__experimentalBorder', 'width'],
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6601
    useEngine: true
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6602
  },
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6603
  borderLeftColor: {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6604
    value: ['border', 'left', 'color'],
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6605
    support: ['__experimentalBorder', 'color'],
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6606
    useEngine: true
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6607
  },
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6608
  borderLeftStyle: {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6609
    value: ['border', 'left', 'style'],
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6610
    support: ['__experimentalBorder', 'style'],
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6611
    useEngine: true
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6612
  },
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6613
  borderLeftWidth: {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6614
    value: ['border', 'left', 'width'],
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6615
    support: ['__experimentalBorder', 'width'],
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6616
    useEngine: true
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6617
  },
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6618
  color: {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6619
    value: ['color', 'text'],
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6620
    support: ['color', 'text'],
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6621
    requiresOptOut: true,
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6622
    useEngine: true
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6623
  },
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6624
  columnCount: {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6625
    value: ['typography', 'textColumns'],
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6626
    support: ['typography', 'textColumns'],
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6627
    useEngine: true
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6628
  },
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6629
  filter: {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6630
    value: ['filter', 'duotone'],
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6631
    support: ['filter', 'duotone']
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6632
  },
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6633
  linkColor: {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6634
    value: ['elements', 'link', 'color', 'text'],
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6635
    support: ['color', 'link']
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6636
  },
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6637
  captionColor: {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6638
    value: ['elements', 'caption', 'color', 'text'],
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6639
    support: ['color', 'caption']
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6640
  },
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6641
  buttonColor: {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6642
    value: ['elements', 'button', 'color', 'text'],
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6643
    support: ['color', 'button']
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6644
  },
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6645
  buttonBackgroundColor: {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6646
    value: ['elements', 'button', 'color', 'background'],
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6647
    support: ['color', 'button']
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6648
  },
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6649
  headingColor: {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6650
    value: ['elements', 'heading', 'color', 'text'],
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6651
    support: ['color', 'heading']
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6652
  },
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6653
  headingBackgroundColor: {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6654
    value: ['elements', 'heading', 'color', 'background'],
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6655
    support: ['color', 'heading']
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6656
  },
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6657
  fontFamily: {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6658
    value: ['typography', 'fontFamily'],
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6659
    support: ['typography', '__experimentalFontFamily'],
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6660
    useEngine: true
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6661
  },
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6662
  fontSize: {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6663
    value: ['typography', 'fontSize'],
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6664
    support: ['typography', 'fontSize'],
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6665
    useEngine: true
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6666
  },
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6667
  fontStyle: {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6668
    value: ['typography', 'fontStyle'],
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6669
    support: ['typography', '__experimentalFontStyle'],
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6670
    useEngine: true
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6671
  },
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6672
  fontWeight: {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6673
    value: ['typography', 'fontWeight'],
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6674
    support: ['typography', '__experimentalFontWeight'],
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6675
    useEngine: true
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6676
  },
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6677
  lineHeight: {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6678
    value: ['typography', 'lineHeight'],
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6679
    support: ['typography', 'lineHeight'],
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6680
    useEngine: true
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6681
  },
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6682
  margin: {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6683
    value: ['spacing', 'margin'],
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6684
    support: ['spacing', 'margin'],
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6685
    properties: {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6686
      marginTop: 'top',
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6687
      marginRight: 'right',
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6688
      marginBottom: 'bottom',
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6689
      marginLeft: 'left'
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6690
    },
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6691
    useEngine: true
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6692
  },
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6693
  minHeight: {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6694
    value: ['dimensions', 'minHeight'],
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6695
    support: ['dimensions', 'minHeight'],
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6696
    useEngine: true
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6697
  },
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6698
  padding: {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6699
    value: ['spacing', 'padding'],
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6700
    support: ['spacing', 'padding'],
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6701
    properties: {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6702
      paddingTop: 'top',
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6703
      paddingRight: 'right',
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6704
      paddingBottom: 'bottom',
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6705
      paddingLeft: 'left'
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6706
    },
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6707
    useEngine: true
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6708
  },
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6709
  textAlign: {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6710
    value: ['typography', 'textAlign'],
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6711
    support: ['typography', 'textAlign'],
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6712
    useEngine: false
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6713
  },
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6714
  textDecoration: {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6715
    value: ['typography', 'textDecoration'],
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6716
    support: ['typography', '__experimentalTextDecoration'],
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6717
    useEngine: true
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6718
  },
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6719
  textTransform: {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6720
    value: ['typography', 'textTransform'],
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6721
    support: ['typography', '__experimentalTextTransform'],
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6722
    useEngine: true
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6723
  },
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6724
  letterSpacing: {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6725
    value: ['typography', 'letterSpacing'],
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6726
    support: ['typography', '__experimentalLetterSpacing'],
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6727
    useEngine: true
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6728
  },
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6729
  writingMode: {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6730
    value: ['typography', 'writingMode'],
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6731
    support: ['typography', '__experimentalWritingMode'],
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6732
    useEngine: true
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6733
  },
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6734
  '--wp--style--root--padding': {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6735
    value: ['spacing', 'padding'],
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6736
    support: ['spacing', 'padding'],
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6737
    properties: {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6738
      '--wp--style--root--padding-top': 'top',
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6739
      '--wp--style--root--padding-right': 'right',
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6740
      '--wp--style--root--padding-bottom': 'bottom',
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6741
      '--wp--style--root--padding-left': 'left'
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6742
    },
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6743
    rootOnly: true
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6744
  }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6745
};
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6746
const __EXPERIMENTAL_ELEMENTS = {
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6747
  link: 'a:where(:not(.wp-element-button))',
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6748
  heading: 'h1, h2, h3, h4, h5, h6',
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6749
  h1: 'h1',
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6750
  h2: 'h2',
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6751
  h3: 'h3',
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6752
  h4: 'h4',
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6753
  h5: 'h5',
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6754
  h6: 'h6',
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6755
  button: '.wp-element-button, .wp-block-button__link',
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6756
  caption: '.wp-element-caption, .wp-block-audio figcaption, .wp-block-embed figcaption, .wp-block-gallery figcaption, .wp-block-image figcaption, .wp-block-table figcaption, .wp-block-video figcaption',
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6757
  cite: 'cite'
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6758
};
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6759
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6760
// These paths may have three origins, custom, theme, and default,
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6761
// and are expected to override other origins with custom, theme,
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6762
// and default priority.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6763
const __EXPERIMENTAL_PATHS_WITH_OVERRIDE = {
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6764
  'color.duotone': true,
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6765
  'color.gradients': true,
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6766
  'color.palette': true,
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6767
  'dimensions.aspectRatios': true,
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6768
  'typography.fontSizes': true,
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6769
  'spacing.spacingSizes': true
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6770
};
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6771
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6772
;// CONCATENATED MODULE: external ["wp","privateApis"]
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6773
const external_wp_privateApis_namespaceObject = window["wp"]["privateApis"];
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6774
;// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/lock-unlock.js
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6775
/**
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6776
 * WordPress dependencies
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6777
 */
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6778
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6779
const {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6780
  lock,
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6781
  unlock
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6782
} = (0,external_wp_privateApis_namespaceObject.__dangerousOptInToUnstableAPIsOnlyForCoreModules)('I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.', '@wordpress/blocks');
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6783
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6784
;// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/registration.js
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6785
/* eslint no-console: [ 'error', { allow: [ 'error', 'warn' ] } ] */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6786
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6787
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6788
 * WordPress dependencies
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6789
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6790
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6791
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6792
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6793
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6794
 * Internal dependencies
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6795
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6796
const i18nBlockSchema = {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6797
  title: "block title",
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6798
  description: "block description",
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6799
  keywords: ["block keyword"],
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6800
  styles: [{
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6801
    label: "block style label"
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6802
  }],
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6803
  variations: [{
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6804
    title: "block variation title",
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6805
    description: "block variation description",
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6806
    keywords: ["block variation keyword"]
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6807
  }]
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6808
};
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6809
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6810
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6811
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6812
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6813
 * An icon type definition. One of a Dashicon slug, an element,
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6814
 * or a component.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6815
 *
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6816
 * @typedef {(string|Element|Component)} WPIcon
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6817
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6818
 * @see https://developer.wordpress.org/resource/dashicons/
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6819
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6820
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6821
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6822
 * Render behavior of a block type icon; one of a Dashicon slug, an element,
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6823
 * or a component.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6824
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6825
 * @typedef {WPIcon} WPBlockTypeIconRender
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6826
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6827
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6828
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6829
 * An object describing a normalized block type icon.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6830
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6831
 * @typedef {Object} WPBlockTypeIconDescriptor
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6832
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6833
 * @property {WPBlockTypeIconRender} src         Render behavior of the icon,
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6834
 *                                               one of a Dashicon slug, an
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6835
 *                                               element, or a component.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6836
 * @property {string}                background  Optimal background hex string
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6837
 *                                               color when displaying icon.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6838
 * @property {string}                foreground  Optimal foreground hex string
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6839
 *                                               color when displaying icon.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6840
 * @property {string}                shadowColor Optimal shadow hex string
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6841
 *                                               color when displaying icon.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6842
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6843
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6844
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6845
 * Value to use to render the icon for a block type in an editor interface,
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6846
 * either a Dashicon slug, an element, a component, or an object describing
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6847
 * the icon.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6848
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6849
 * @typedef {(WPBlockTypeIconDescriptor|WPBlockTypeIconRender)} WPBlockTypeIcon
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6850
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6851
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6852
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6853
 * Named block variation scopes.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6854
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6855
 * @typedef {'block'|'inserter'|'transform'} WPBlockVariationScope
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6856
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6857
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6858
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6859
 * An object describing a variation defined for the block type.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6860
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6861
 * @typedef {Object} WPBlockVariation
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6862
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6863
 * @property {string}                  name          The unique and machine-readable name.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6864
 * @property {string}                  title         A human-readable variation title.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6865
 * @property {string}                  [description] A detailed variation description.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6866
 * @property {string}                  [category]    Block type category classification,
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6867
 *                                                   used in search interfaces to arrange
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6868
 *                                                   block types by category.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6869
 * @property {WPIcon}                  [icon]        An icon helping to visualize the variation.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6870
 * @property {boolean}                 [isDefault]   Indicates whether the current variation is
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6871
 *                                                   the default one. Defaults to `false`.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6872
 * @property {Object}                  [attributes]  Values which override block attributes.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6873
 * @property {Array[]}                 [innerBlocks] Initial configuration of nested blocks.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6874
 * @property {Object}                  [example]     Example provides structured data for
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6875
 *                                                   the block preview. You can set to
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6876
 *                                                   `undefined` to disable the preview shown
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6877
 *                                                   for the block type.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6878
 * @property {WPBlockVariationScope[]} [scope]       The list of scopes where the variation
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6879
 *                                                   is applicable. When not provided, it
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6880
 *                                                   assumes all available scopes.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6881
 * @property {string[]}                [keywords]    An array of terms (which can be translated)
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6882
 *                                                   that help users discover the variation
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6883
 *                                                   while searching.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6884
 * @property {Function|string[]}       [isActive]    This can be a function or an array of block attributes.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6885
 *                                                   Function that accepts a block's attributes and the
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6886
 *                                                   variation's attributes and determines if a variation is active.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6887
 *                                                   This function doesn't try to find a match dynamically based
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6888
 *                                                   on all block's attributes, as in many cases some attributes are irrelevant.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6889
 *                                                   An example would be for `embed` block where we only care
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6890
 *                                                   about `providerNameSlug` attribute's value.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6891
 *                                                   We can also use a `string[]` to tell which attributes
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6892
 *                                                   should be compared as a shorthand. Each attributes will
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6893
 *                                                   be matched and the variation will be active if all of them are matching.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6894
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6895
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6896
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6897
 * Defined behavior of a block type.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6898
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6899
 * @typedef {Object} WPBlockType
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6900
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6901
 * @property {string}             name          Block type's namespaced name.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6902
 * @property {string}             title         Human-readable block type label.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6903
 * @property {string}             [description] A detailed block type description.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6904
 * @property {string}             [category]    Block type category classification,
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6905
 *                                              used in search interfaces to arrange
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6906
 *                                              block types by category.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6907
 * @property {WPBlockTypeIcon}    [icon]        Block type icon.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6908
 * @property {string[]}           [keywords]    Additional keywords to produce block
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6909
 *                                              type as result in search interfaces.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6910
 * @property {Object}             [attributes]  Block type attributes.
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6911
 * @property {Component}          [save]        Optional component describing
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6912
 *                                              serialized markup structure of a
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6913
 *                                              block type.
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6914
 * @property {Component}          edit          Component rendering an element to
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6915
 *                                              manipulate the attributes of a block
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6916
 *                                              in the context of an editor.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6917
 * @property {WPBlockVariation[]} [variations]  The list of block variations.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6918
 * @property {Object}             [example]     Example provides structured data for
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6919
 *                                              the block preview. When not defined
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6920
 *                                              then no preview is shown.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6921
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6922
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6923
function isObject(object) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6924
  return object !== null && typeof object === 'object';
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6925
}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6926
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6927
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6928
 * Sets the server side block definition of blocks.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6929
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6930
 * @param {Object} definitions Server-side block definitions
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6931
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6932
// eslint-disable-next-line camelcase
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6933
function unstable__bootstrapServerSideBlockDefinitions(definitions) {
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6934
  const {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6935
    addBootstrappedBlockType
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6936
  } = unlock((0,external_wp_data_namespaceObject.dispatch)(store));
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6937
  for (const [name, blockType] of Object.entries(definitions)) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6938
    addBootstrappedBlockType(name, blockType);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6939
  }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6940
}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6941
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6942
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6943
 * Gets block settings from metadata loaded from `block.json` file.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6944
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6945
 * @param {Object} metadata            Block metadata loaded from `block.json`.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6946
 * @param {string} metadata.textdomain Textdomain to use with translations.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6947
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6948
 * @return {Object} Block settings.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6949
 */
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6950
function getBlockSettingsFromMetadata({
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6951
  textdomain,
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6952
  ...metadata
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6953
}) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6954
  const allowedFields = ['apiVersion', 'title', 'category', 'parent', 'ancestor', 'icon', 'description', 'keywords', 'attributes', 'providesContext', 'usesContext', 'selectors', 'supports', 'styles', 'example', 'variations', 'blockHooks', 'allowedBlocks'];
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6955
  const settings = Object.fromEntries(Object.entries(metadata).filter(([key]) => allowedFields.includes(key)));
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6956
  if (textdomain) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6957
    Object.keys(i18nBlockSchema).forEach(key => {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6958
      if (!settings[key]) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6959
        return;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6960
      }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6961
      settings[key] = translateBlockSettingUsingI18nSchema(i18nBlockSchema[key], settings[key], textdomain);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6962
    });
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6963
  }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6964
  return settings;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6965
}
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6966
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6967
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6968
 * Registers a new block provided a unique name and an object defining its
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6969
 * behavior. Once registered, the block is made available as an option to any
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6970
 * editor interface where blocks are implemented.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6971
 *
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6972
 * For more in-depth information on registering a custom block see the
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6973
 * [Create a block tutorial](https://developer.wordpress.org/block-editor/getting-started/create-block/).
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6974
 *
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6975
 * @param {string|Object} blockNameOrMetadata Block type name or its metadata.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6976
 * @param {Object}        settings            Block settings.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6977
 *
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6978
 * @example
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6979
 * ```js
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6980
 * import { __ } from '@wordpress/i18n';
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6981
 * import { registerBlockType } from '@wordpress/blocks'
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6982
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6983
 * registerBlockType( 'namespace/block-name', {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6984
 *     title: __( 'My First Block' ),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6985
 *     edit: () => <div>{ __( 'Hello from the editor!' ) }</div>,
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6986
 *     save: () => <div>Hello from the saved content!</div>,
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6987
 * } );
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6988
 * ```
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6989
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6990
 * @return {WPBlockType | undefined} The block, if it has been successfully registered;
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6991
 *                    otherwise `undefined`.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6992
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6993
function registerBlockType(blockNameOrMetadata, settings) {
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  6994
  const name = isObject(blockNameOrMetadata) ? blockNameOrMetadata.name : blockNameOrMetadata;
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6995
  if (typeof name !== 'string') {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6996
    console.error('Block names must be strings.');
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6997
    return;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6998
  }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  6999
  if (!/^[a-z][a-z0-9-]*\/[a-z][a-z0-9-]*$/.test(name)) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7000
    console.error('Block names must contain a namespace prefix, include only lowercase alphanumeric characters or dashes, and start with a letter. Example: my-plugin/my-custom-block');
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7001
    return;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7002
  }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7003
  if ((0,external_wp_data_namespaceObject.select)(store).getBlockType(name)) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7004
    console.error('Block "' + name + '" is already registered.');
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7005
    return;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7006
  }
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7007
  const {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7008
    addBootstrappedBlockType,
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7009
    addUnprocessedBlockType
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7010
  } = unlock((0,external_wp_data_namespaceObject.dispatch)(store));
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7011
  if (isObject(blockNameOrMetadata)) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7012
    const metadata = getBlockSettingsFromMetadata(blockNameOrMetadata);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7013
    addBootstrappedBlockType(name, metadata);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7014
  }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7015
  addUnprocessedBlockType(name, settings);
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7016
  return (0,external_wp_data_namespaceObject.select)(store).getBlockType(name);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7017
}
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7018
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7019
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7020
 * Translates block settings provided with metadata using the i18n schema.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7021
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7022
 * @param {string|string[]|Object[]} i18nSchema   I18n schema for the block setting.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7023
 * @param {string|string[]|Object[]} settingValue Value for the block setting.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7024
 * @param {string}                   textdomain   Textdomain to use with translations.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7025
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7026
 * @return {string|string[]|Object[]} Translated setting.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7027
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7028
function translateBlockSettingUsingI18nSchema(i18nSchema, settingValue, textdomain) {
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7029
  if (typeof i18nSchema === 'string' && typeof settingValue === 'string') {
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7030
    // eslint-disable-next-line @wordpress/i18n-no-variables, @wordpress/i18n-text-domain
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7031
    return (0,external_wp_i18n_namespaceObject._x)(settingValue, i18nSchema, textdomain);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7032
  }
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7033
  if (Array.isArray(i18nSchema) && i18nSchema.length && Array.isArray(settingValue)) {
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7034
    return settingValue.map(value => translateBlockSettingUsingI18nSchema(i18nSchema[0], value, textdomain));
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7035
  }
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7036
  if (isObject(i18nSchema) && Object.entries(i18nSchema).length && isObject(settingValue)) {
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7037
    return Object.keys(settingValue).reduce((accumulator, key) => {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7038
      if (!i18nSchema[key]) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7039
        accumulator[key] = settingValue[key];
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7040
        return accumulator;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7041
      }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7042
      accumulator[key] = translateBlockSettingUsingI18nSchema(i18nSchema[key], settingValue[key], textdomain);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7043
      return accumulator;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7044
    }, {});
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7045
  }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7046
  return settingValue;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7047
}
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7048
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7049
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7050
 * Registers a new block collection to group blocks in the same namespace in the inserter.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7051
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7052
 * @param {string} namespace       The namespace to group blocks by in the inserter; corresponds to the block namespace.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7053
 * @param {Object} settings        The block collection settings.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7054
 * @param {string} settings.title  The title to display in the block inserter.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7055
 * @param {Object} [settings.icon] The icon to display in the block inserter.
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7056
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7057
 * @example
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7058
 * ```js
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7059
 * import { __ } from '@wordpress/i18n';
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7060
 * import { registerBlockCollection, registerBlockType } from '@wordpress/blocks';
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7061
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7062
 * // Register the collection.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7063
 * registerBlockCollection( 'my-collection', {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7064
 *     title: __( 'Custom Collection' ),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7065
 * } );
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7066
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7067
 * // Register a block in the same namespace to add it to the collection.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7068
 * registerBlockType( 'my-collection/block-name', {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7069
 *     title: __( 'My First Block' ),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7070
 *     edit: () => <div>{ __( 'Hello from the editor!' ) }</div>,
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7071
 *     save: () => <div>'Hello from the saved content!</div>,
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7072
 * } );
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7073
 * ```
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7074
 */
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7075
function registerBlockCollection(namespace, {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7076
  title,
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7077
  icon
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7078
}) {
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7079
  (0,external_wp_data_namespaceObject.dispatch)(store).addBlockCollection(namespace, title, icon);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7080
}
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7081
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7082
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7083
 * Unregisters a block collection
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7084
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7085
 * @param {string} namespace The namespace to group blocks by in the inserter; corresponds to the block namespace
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7086
 *
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7087
 * @example
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7088
 * ```js
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7089
 * import { unregisterBlockCollection } from '@wordpress/blocks';
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7090
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7091
 * unregisterBlockCollection( 'my-collection' );
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7092
 * ```
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7093
 */
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7094
function unregisterBlockCollection(namespace) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7095
  dispatch(blocksStore).removeBlockCollection(namespace);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7096
}
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7097
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7098
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7099
 * Unregisters a block.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7100
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7101
 * @param {string} name Block name.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7102
 *
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7103
 * @example
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7104
 * ```js
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7105
 * import { __ } from '@wordpress/i18n';
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7106
 * import { unregisterBlockType } from '@wordpress/blocks';
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7107
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7108
 * const ExampleComponent = () => {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7109
 *     return (
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7110
 *         <Button
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7111
 *             onClick={ () =>
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7112
 *                 unregisterBlockType( 'my-collection/block-name' )
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7113
 *             }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7114
 *         >
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7115
 *             { __( 'Unregister my custom block.' ) }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7116
 *         </Button>
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7117
 *     );
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7118
 * };
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7119
 * ```
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7120
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7121
 * @return {WPBlockType | undefined} The previous block value, if it has been successfully
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7122
 *                    unregistered; otherwise `undefined`.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7123
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7124
function unregisterBlockType(name) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7125
  const oldBlock = (0,external_wp_data_namespaceObject.select)(store).getBlockType(name);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7126
  if (!oldBlock) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7127
    console.error('Block "' + name + '" is not registered.');
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7128
    return;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7129
  }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7130
  (0,external_wp_data_namespaceObject.dispatch)(store).removeBlockTypes(name);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7131
  return oldBlock;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7132
}
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7133
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7134
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7135
 * Assigns name of block for handling non-block content.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7136
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7137
 * @param {string} blockName Block name.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7138
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7139
function setFreeformContentHandlerName(blockName) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7140
  (0,external_wp_data_namespaceObject.dispatch)(store).setFreeformFallbackBlockName(blockName);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7141
}
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7142
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7143
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7144
 * Retrieves name of block handling non-block content, or undefined if no
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7145
 * handler has been defined.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7146
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7147
 * @return {?string} Block name.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7148
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7149
function getFreeformContentHandlerName() {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7150
  return (0,external_wp_data_namespaceObject.select)(store).getFreeformFallbackBlockName();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7151
}
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7152
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7153
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7154
 * Retrieves name of block used for handling grouping interactions.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7155
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7156
 * @return {?string} Block name.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7157
 */
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7158
function getGroupingBlockName() {
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7159
  return (0,external_wp_data_namespaceObject.select)(store).getGroupingBlockName();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7160
}
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7161
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7162
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7163
 * Assigns name of block handling unregistered block types.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7164
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7165
 * @param {string} blockName Block name.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7166
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7167
function setUnregisteredTypeHandlerName(blockName) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7168
  (0,external_wp_data_namespaceObject.dispatch)(store).setUnregisteredFallbackBlockName(blockName);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7169
}
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7170
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7171
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7172
 * Retrieves name of block handling unregistered block types, or undefined if no
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7173
 * handler has been defined.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7174
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7175
 * @return {?string} Block name.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7176
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7177
function getUnregisteredTypeHandlerName() {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7178
  return (0,external_wp_data_namespaceObject.select)(store).getUnregisteredFallbackBlockName();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7179
}
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7180
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7181
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7182
 * Assigns the default block name.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7183
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7184
 * @param {string} name Block name.
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7185
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7186
 * @example
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7187
 * ```js
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7188
 * import { setDefaultBlockName } from '@wordpress/blocks';
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7189
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7190
 * const ExampleComponent = () => {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7191
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7192
 *     return (
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7193
 *         <Button onClick={ () => setDefaultBlockName( 'core/heading' ) }>
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7194
 *             { __( 'Set the default block to Heading' ) }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7195
 *         </Button>
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7196
 *     );
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7197
 * };
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7198
 * ```
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7199
 */
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7200
function setDefaultBlockName(name) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7201
  (0,external_wp_data_namespaceObject.dispatch)(store).setDefaultBlockName(name);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7202
}
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7203
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7204
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7205
 * Assigns name of block for handling block grouping interactions.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7206
 *
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7207
 * This function lets you select a different block to group other blocks in instead of the
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7208
 * default `core/group` block. This function must be used in a component or when the DOM is fully
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7209
 * loaded. See https://developer.wordpress.org/block-editor/reference-guides/packages/packages-dom-ready/
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7210
 *
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7211
 * @param {string} name Block name.
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7212
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7213
 * @example
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7214
 * ```js
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7215
 * import { setGroupingBlockName } from '@wordpress/blocks';
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7216
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7217
 * const ExampleComponent = () => {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7218
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7219
 *     return (
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7220
 *         <Button onClick={ () => setGroupingBlockName( 'core/columns' ) }>
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7221
 *             { __( 'Wrap in columns' ) }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7222
 *         </Button>
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7223
 *     );
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7224
 * };
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7225
 * ```
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7226
 */
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7227
function setGroupingBlockName(name) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7228
  (0,external_wp_data_namespaceObject.dispatch)(store).setGroupingBlockName(name);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7229
}
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7230
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7231
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7232
 * Retrieves the default block name.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7233
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7234
 * @return {?string} Block name.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7235
 */
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7236
function getDefaultBlockName() {
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7237
  return (0,external_wp_data_namespaceObject.select)(store).getDefaultBlockName();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7238
}
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7239
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7240
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7241
 * Returns a registered block type.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7242
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7243
 * @param {string} name Block name.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7244
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7245
 * @return {?Object} Block type.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7246
 */
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7247
function getBlockType(name) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7248
  return (0,external_wp_data_namespaceObject.select)(store)?.getBlockType(name);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7249
}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7250
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7251
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7252
 * Returns all registered blocks.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7253
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7254
 * @return {Array} Block settings.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7255
 */
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7256
function getBlockTypes() {
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7257
  return (0,external_wp_data_namespaceObject.select)(store).getBlockTypes();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7258
}
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7259
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7260
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7261
 * Returns the block support value for a feature, if defined.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7262
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7263
 * @param {(string|Object)} nameOrType      Block name or type object
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7264
 * @param {string}          feature         Feature to retrieve
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7265
 * @param {*}               defaultSupports Default value to return if not
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7266
 *                                          explicitly defined
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7267
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7268
 * @return {?*} Block support value
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7269
 */
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7270
function getBlockSupport(nameOrType, feature, defaultSupports) {
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7271
  return (0,external_wp_data_namespaceObject.select)(store).getBlockSupport(nameOrType, feature, defaultSupports);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7272
}
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7273
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7274
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7275
 * Returns true if the block defines support for a feature, or false otherwise.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7276
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7277
 * @param {(string|Object)} nameOrType      Block name or type object.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7278
 * @param {string}          feature         Feature to test.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7279
 * @param {boolean}         defaultSupports Whether feature is supported by
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7280
 *                                          default if not explicitly defined.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7281
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7282
 * @return {boolean} Whether block supports feature.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7283
 */
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7284
function hasBlockSupport(nameOrType, feature, defaultSupports) {
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7285
  return (0,external_wp_data_namespaceObject.select)(store).hasBlockSupport(nameOrType, feature, defaultSupports);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7286
}
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7287
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7288
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7289
 * Determines whether or not the given block is a reusable block. This is a
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7290
 * special block type that is used to point to a global block stored via the
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7291
 * API.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7292
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7293
 * @param {Object} blockOrType Block or Block Type to test.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7294
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7295
 * @return {boolean} Whether the given block is a reusable block.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7296
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7297
function isReusableBlock(blockOrType) {
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7298
  return blockOrType?.name === 'core/block';
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7299
}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7300
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7301
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7302
 * Determines whether or not the given block is a template part. This is a
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7303
 * special block type that allows composing a page template out of reusable
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7304
 * design elements.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7305
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7306
 * @param {Object} blockOrType Block or Block Type to test.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7307
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7308
 * @return {boolean} Whether the given block is a template part.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7309
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7310
function isTemplatePart(blockOrType) {
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7311
  return blockOrType?.name === 'core/template-part';
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7312
}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7313
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7314
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7315
 * Returns an array with the child blocks of a given block.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7316
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7317
 * @param {string} blockName Name of block (example: “latest-posts”).
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7318
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7319
 * @return {Array} Array of child block names.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7320
 */
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7321
const getChildBlockNames = blockName => {
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7322
  return (0,external_wp_data_namespaceObject.select)(store).getChildBlockNames(blockName);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7323
};
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7324
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7325
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7326
 * Returns a boolean indicating if a block has child blocks or not.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7327
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7328
 * @param {string} blockName Name of block (example: “latest-posts”).
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7329
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7330
 * @return {boolean} True if a block contains child blocks and false otherwise.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7331
 */
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7332
const hasChildBlocks = blockName => {
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7333
  return (0,external_wp_data_namespaceObject.select)(store).hasChildBlocks(blockName);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7334
};
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7335
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7336
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7337
 * Returns a boolean indicating if a block has at least one child block with inserter support.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7338
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7339
 * @param {string} blockName Block type name.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7340
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7341
 * @return {boolean} True if a block contains at least one child blocks with inserter support
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7342
 *                   and false otherwise.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7343
 */
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7344
const hasChildBlocksWithInserterSupport = blockName => {
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7345
  return (0,external_wp_data_namespaceObject.select)(store).hasChildBlocksWithInserterSupport(blockName);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7346
};
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7347
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7348
/**
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7349
 * Registers a new block style for the given block types.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7350
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7351
 * For more information on connecting the styles with CSS
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7352
 * [the official documentation](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-styles/#styles).
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7353
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7354
 * @param {string|Array} blockNames     Name of blocks e.g. “core/latest-posts” or `["core/group", "core/columns"]`.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7355
 * @param {Object}       styleVariation Object containing `name` which is the class name applied to the block and `label` which identifies the variation to the user.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7356
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7357
 * @example
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7358
 * ```js
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7359
 * import { __ } from '@wordpress/i18n';
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7360
 * import { registerBlockStyle } from '@wordpress/blocks';
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7361
 * import { Button } from '@wordpress/components';
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7362
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7363
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7364
 * const ExampleComponent = () => {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7365
 *     return (
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7366
 *         <Button
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7367
 *             onClick={ () => {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7368
 *                 registerBlockStyle( 'core/quote', {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7369
 *                     name: 'fancy-quote',
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7370
 *                     label: __( 'Fancy Quote' ),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7371
 *                 } );
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7372
 *             } }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7373
 *         >
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7374
 *             { __( 'Add a new block style for core/quote' ) }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7375
 *         </Button>
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7376
 *     );
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7377
 * };
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7378
 * ```
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7379
 */
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7380
const registerBlockStyle = (blockNames, styleVariation) => {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7381
  (0,external_wp_data_namespaceObject.dispatch)(store).addBlockStyles(blockNames, styleVariation);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7382
};
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7383
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7384
/**
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7385
 * Unregisters a block style for the given block.
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7386
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7387
 * @param {string} blockName          Name of block (example: “core/latest-posts”).
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7388
 * @param {string} styleVariationName Name of class applied to the block.
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7389
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7390
 * @example
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7391
 * ```js
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7392
 * import { __ } from '@wordpress/i18n';
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7393
 * import { unregisterBlockStyle } from '@wordpress/blocks';
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7394
 * import { Button } from '@wordpress/components';
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7395
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7396
 * const ExampleComponent = () => {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7397
 *     return (
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7398
 *     <Button
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7399
 *         onClick={ () => {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7400
 *             unregisterBlockStyle( 'core/quote', 'plain' );
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7401
 *         } }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7402
 *     >
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7403
 *         { __( 'Remove the "Plain" block style for core/quote' ) }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7404
 *     </Button>
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7405
 *     );
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7406
 * };
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7407
 * ```
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7408
 */
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7409
const unregisterBlockStyle = (blockName, styleVariationName) => {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7410
  (0,external_wp_data_namespaceObject.dispatch)(store).removeBlockStyles(blockName, styleVariationName);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7411
};
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7412
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7413
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7414
 * Returns an array with the variations of a given block type.
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7415
 * Ignored from documentation as the recommended usage is via useSelect from @wordpress/data.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7416
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7417
 * @ignore
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7418
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7419
 * @param {string}                blockName Name of block (example: “core/columns”).
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7420
 * @param {WPBlockVariationScope} [scope]   Block variation scope name.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7421
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7422
 * @return {(WPBlockVariation[]|void)} Block variations.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7423
 */
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7424
const getBlockVariations = (blockName, scope) => {
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7425
  return (0,external_wp_data_namespaceObject.select)(store).getBlockVariations(blockName, scope);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7426
};
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7427
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7428
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7429
 * Registers a new block variation for the given block type.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7430
 *
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7431
 * For more information on block variations see
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7432
 * [the official documentation ](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-variations/).
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7433
 *
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7434
 * @param {string}           blockName Name of the block (example: “core/columns”).
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7435
 * @param {WPBlockVariation} variation Object describing a block variation.
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7436
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7437
 * @example
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7438
 * ```js
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7439
 * import { __ } from '@wordpress/i18n';
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7440
 * import { registerBlockVariation } from '@wordpress/blocks';
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7441
 * import { Button } from '@wordpress/components';
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7442
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7443
 * const ExampleComponent = () => {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7444
 *     return (
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7445
 *         <Button
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7446
 *             onClick={ () => {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7447
 *                 registerBlockVariation( 'core/embed', {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7448
 *                     name: 'custom',
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7449
 *                     title: __( 'My Custom Embed' ),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7450
 *                     attributes: { providerNameSlug: 'custom' },
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7451
 *                 } );
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7452
 *             } }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7453
 *          >
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7454
 *              __( 'Add a custom variation for core/embed' ) }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7455
 *         </Button>
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7456
 *     );
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7457
 * };
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7458
 * ```
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7459
 */
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7460
const registerBlockVariation = (blockName, variation) => {
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7461
  if (typeof variation.name !== 'string') {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7462
    console.warn('Variation names must be unique strings.');
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7463
  }
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7464
  (0,external_wp_data_namespaceObject.dispatch)(store).addBlockVariations(blockName, variation);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7465
};
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7466
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7467
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7468
 * Unregisters a block variation defined for the given block type.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7469
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7470
 * @param {string} blockName     Name of the block (example: “core/columns”).
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7471
 * @param {string} variationName Name of the variation defined for the block.
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7472
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7473
 * @example
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7474
 * ```js
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7475
 * import { __ } from '@wordpress/i18n';
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7476
 * import { unregisterBlockVariation } from '@wordpress/blocks';
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7477
 * import { Button } from '@wordpress/components';
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7478
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7479
 * const ExampleComponent = () => {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7480
 *     return (
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7481
 *         <Button
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7482
 *             onClick={ () => {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7483
 *                 unregisterBlockVariation( 'core/embed', 'youtube' );
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7484
 *             } }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7485
 *         >
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7486
 *             { __( 'Remove the YouTube variation from core/embed' ) }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7487
 *         </Button>
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7488
 *     );
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7489
 * };
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7490
 * ```
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7491
 */
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7492
const unregisterBlockVariation = (blockName, variationName) => {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7493
  (0,external_wp_data_namespaceObject.dispatch)(store).removeBlockVariations(blockName, variationName);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7494
};
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  7495
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7496
;// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/utils.js
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7497
/**
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7498
 * External dependencies
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7499
 */
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7500
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7501
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7502
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7503
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7504
/**
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7505
 * WordPress dependencies
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7506
 */
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7507
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7508
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7509
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7510
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7511
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7512
/**
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7513
 * Internal dependencies
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7514
 */
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7515
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7516
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7517
k([names, a11y]);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7518
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7519
/**
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7520
 * Array of icon colors containing a color to be used if the icon color
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7521
 * was not explicitly set but the icon background color was.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7522
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7523
 * @type {Object}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7524
 */
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7525
const ICON_COLORS = ['#191e23', '#f8f9f9'];
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7526
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7527
/**
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7528
 * Determines whether the block's attributes are equal to the default attributes
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7529
 * which means the block is unmodified.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7530
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7531
 * @param {WPBlock} block Block Object
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7532
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7533
 * @return {boolean} Whether the block is an unmodified block.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7534
 */
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7535
function isUnmodifiedBlock(block) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7536
  var _getBlockType$attribu;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7537
  return Object.entries((_getBlockType$attribu = getBlockType(block.name)?.attributes) !== null && _getBlockType$attribu !== void 0 ? _getBlockType$attribu : {}).every(([key, definition]) => {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7538
    const value = block.attributes[key];
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7539
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7540
    // Every attribute that has a default must match the default.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7541
    if (definition.hasOwnProperty('default')) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7542
      return value === definition.default;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7543
    }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7544
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7545
    // The rich text type is a bit different from the rest because it
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7546
    // has an implicit default value of an empty RichTextData instance,
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7547
    // so check the length of the value.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7548
    if (definition.type === 'rich-text') {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7549
      return !value?.length;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7550
    }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7551
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7552
    // Every attribute that doesn't have a default should be undefined.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7553
    return value === undefined;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7554
  });
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7555
}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7556
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7557
/**
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7558
 * Determines whether the block is a default block and its attributes are equal
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7559
 * to the default attributes which means the block is unmodified.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7560
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7561
 * @param {WPBlock} block Block Object
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7562
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7563
 * @return {boolean} Whether the block is an unmodified default block.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7564
 */
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7565
function isUnmodifiedDefaultBlock(block) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7566
  return block.name === getDefaultBlockName() && isUnmodifiedBlock(block);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7567
}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7568
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7569
/**
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7570
 * Function that checks if the parameter is a valid icon.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7571
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7572
 * @param {*} icon Parameter to be checked.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7573
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7574
 * @return {boolean} True if the parameter is a valid icon and false otherwise.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7575
 */
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7576
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7577
function isValidIcon(icon) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7578
  return !!icon && (typeof icon === 'string' || (0,external_wp_element_namespaceObject.isValidElement)(icon) || typeof icon === 'function' || icon instanceof external_wp_element_namespaceObject.Component);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7579
}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7580
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7581
/**
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7582
 * Function that receives an icon as set by the blocks during the registration
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7583
 * and returns a new icon object that is normalized so we can rely on just on possible icon structure
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7584
 * in the codebase.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7585
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7586
 * @param {WPBlockTypeIconRender} icon Render behavior of a block type icon;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7587
 *                                     one of a Dashicon slug, an element, or a
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7588
 *                                     component.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7589
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7590
 * @return {WPBlockTypeIconDescriptor} Object describing the icon.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7591
 */
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7592
function normalizeIconObject(icon) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7593
  icon = icon || BLOCK_ICON_DEFAULT;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7594
  if (isValidIcon(icon)) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7595
    return {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7596
      src: icon
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7597
    };
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7598
  }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7599
  if ('background' in icon) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7600
    const colordBgColor = w(icon.background);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7601
    const getColorContrast = iconColor => colordBgColor.contrast(iconColor);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7602
    const maxContrast = Math.max(...ICON_COLORS.map(getColorContrast));
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7603
    return {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7604
      ...icon,
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7605
      foreground: icon.foreground ? icon.foreground : ICON_COLORS.find(iconColor => getColorContrast(iconColor) === maxContrast),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7606
      shadowColor: colordBgColor.alpha(0.3).toRgbString()
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7607
    };
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7608
  }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7609
  return icon;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7610
}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7611
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7612
/**
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7613
 * Normalizes block type passed as param. When string is passed then
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7614
 * it converts it to the matching block type object.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7615
 * It passes the original object otherwise.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7616
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7617
 * @param {string|Object} blockTypeOrName Block type or name.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7618
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7619
 * @return {?Object} Block type.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7620
 */
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7621
function normalizeBlockType(blockTypeOrName) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7622
  if (typeof blockTypeOrName === 'string') {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7623
    return getBlockType(blockTypeOrName);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7624
  }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7625
  return blockTypeOrName;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7626
}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7627
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7628
/**
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7629
 * Get the label for the block, usually this is either the block title,
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7630
 * or the value of the block's `label` function when that's specified.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7631
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7632
 * @param {Object} blockType  The block type.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7633
 * @param {Object} attributes The values of the block's attributes.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7634
 * @param {Object} context    The intended use for the label.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7635
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7636
 * @return {string} The block label.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7637
 */
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7638
function getBlockLabel(blockType, attributes, context = 'visual') {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7639
  const {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7640
    __experimentalLabel: getLabel,
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7641
    title
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7642
  } = blockType;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7643
  const label = getLabel && getLabel(attributes, {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7644
    context
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7645
  });
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7646
  if (!label) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7647
    return title;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7648
  }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7649
  if (label.toPlainText) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7650
    return label.toPlainText();
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7651
  }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7652
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7653
  // Strip any HTML (i.e. RichText formatting) before returning.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7654
  return (0,external_wp_dom_namespaceObject.__unstableStripHTML)(label);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7655
}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7656
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7657
/**
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7658
 * Get a label for the block for use by screenreaders, this is more descriptive
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7659
 * than the visual label and includes the block title and the value of the
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7660
 * `getLabel` function if it's specified.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7661
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7662
 * @param {?Object} blockType              The block type.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7663
 * @param {Object}  attributes             The values of the block's attributes.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7664
 * @param {?number} position               The position of the block in the block list.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7665
 * @param {string}  [direction='vertical'] The direction of the block layout.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7666
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7667
 * @return {string} The block label.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7668
 */
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7669
function getAccessibleBlockLabel(blockType, attributes, position, direction = 'vertical') {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7670
  // `title` is already localized, `label` is a user-supplied value.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7671
  const title = blockType?.title;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7672
  const label = blockType ? getBlockLabel(blockType, attributes, 'accessibility') : '';
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7673
  const hasPosition = position !== undefined;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7674
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7675
  // getBlockLabel returns the block title as a fallback when there's no label,
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7676
  // if it did return the title, this function needs to avoid adding the
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7677
  // title twice within the accessible label. Use this `hasLabel` boolean to
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7678
  // handle that.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7679
  const hasLabel = label && label !== title;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7680
  if (hasPosition && direction === 'vertical') {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7681
    if (hasLabel) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7682
      return (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: accessibility text. 1: The block title. 2: The block row number. 3: The block label.. */
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7683
      (0,external_wp_i18n_namespaceObject.__)('%1$s Block. Row %2$d. %3$s'), title, position, label);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7684
    }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7685
    return (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: accessibility text. 1: The block title. 2: The block row number. */
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7686
    (0,external_wp_i18n_namespaceObject.__)('%1$s Block. Row %2$d'), title, position);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7687
  } else if (hasPosition && direction === 'horizontal') {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7688
    if (hasLabel) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7689
      return (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: accessibility text. 1: The block title. 2: The block column number. 3: The block label.. */
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7690
      (0,external_wp_i18n_namespaceObject.__)('%1$s Block. Column %2$d. %3$s'), title, position, label);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7691
    }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7692
    return (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: accessibility text. 1: The block title. 2: The block column number. */
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7693
    (0,external_wp_i18n_namespaceObject.__)('%1$s Block. Column %2$d'), title, position);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7694
  }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7695
  if (hasLabel) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7696
    return (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: accessibility text. %1: The block title. %2: The block label. */
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7697
    (0,external_wp_i18n_namespaceObject.__)('%1$s Block. %2$s'), title, label);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7698
  }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7699
  return (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: accessibility text. %s: The block title. */
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7700
  (0,external_wp_i18n_namespaceObject.__)('%s Block'), title);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7701
}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7702
function getDefault(attributeSchema) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7703
  if (attributeSchema.default !== undefined) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7704
    return attributeSchema.default;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7705
  }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7706
  if (attributeSchema.type === 'rich-text') {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7707
    return new external_wp_richText_namespaceObject.RichTextData();
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7708
  }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7709
}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7710
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7711
/**
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7712
 * Ensure attributes contains only values defined by block type, and merge
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7713
 * default values for missing attributes.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7714
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7715
 * @param {string} name       The block's name.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7716
 * @param {Object} attributes The block's attributes.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7717
 * @return {Object} The sanitized attributes.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7718
 */
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7719
function __experimentalSanitizeBlockAttributes(name, attributes) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7720
  // Get the type definition associated with a registered block.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7721
  const blockType = getBlockType(name);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7722
  if (undefined === blockType) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7723
    throw new Error(`Block type '${name}' is not registered.`);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7724
  }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7725
  return Object.entries(blockType.attributes).reduce((accumulator, [key, schema]) => {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7726
    const value = attributes[key];
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7727
    if (undefined !== value) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7728
      if (schema.type === 'rich-text') {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7729
        if (value instanceof external_wp_richText_namespaceObject.RichTextData) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7730
          accumulator[key] = value;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7731
        } else if (typeof value === 'string') {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7732
          accumulator[key] = external_wp_richText_namespaceObject.RichTextData.fromHTMLString(value);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7733
        }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7734
      } else if (schema.type === 'string' && value instanceof external_wp_richText_namespaceObject.RichTextData) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7735
        accumulator[key] = value.toHTMLString();
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7736
      } else {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7737
        accumulator[key] = value;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7738
      }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7739
    } else {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7740
      const _default = getDefault(schema);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7741
      if (undefined !== _default) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7742
        accumulator[key] = _default;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7743
      }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7744
    }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7745
    if (['node', 'children'].indexOf(schema.source) !== -1) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7746
      // Ensure value passed is always an array, which we're expecting in
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7747
      // the RichText component to handle the deprecated value.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7748
      if (typeof accumulator[key] === 'string') {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7749
        accumulator[key] = [accumulator[key]];
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7750
      } else if (!Array.isArray(accumulator[key])) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7751
        accumulator[key] = [];
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7752
      }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7753
    }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7754
    return accumulator;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7755
  }, {});
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7756
}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7757
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7758
/**
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7759
 * Filter block attributes by `role` and return their names.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7760
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7761
 * @param {string} name Block attribute's name.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7762
 * @param {string} role The role of a block attribute.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7763
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7764
 * @return {string[]} The attribute names that have the provided role.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7765
 */
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7766
function __experimentalGetBlockAttributesNamesByRole(name, role) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7767
  const attributes = getBlockType(name)?.attributes;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7768
  if (!attributes) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7769
    return [];
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7770
  }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7771
  const attributesNames = Object.keys(attributes);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7772
  if (!role) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7773
    return attributesNames;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7774
  }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7775
  return attributesNames.filter(attributeName => attributes[attributeName]?.__experimentalRole === role);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7776
}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7777
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7778
/**
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7779
 * Return a new object with the specified keys omitted.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7780
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7781
 * @param {Object} object Original object.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7782
 * @param {Array}  keys   Keys to be omitted.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7783
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7784
 * @return {Object} Object with omitted keys.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7785
 */
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7786
function omit(object, keys) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7787
  return Object.fromEntries(Object.entries(object).filter(([key]) => !keys.includes(key)));
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7788
}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7789
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7790
;// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/store/reducer.js
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7791
/**
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7792
 * External dependencies
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7793
 */
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7794
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7795
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7796
/**
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7797
 * WordPress dependencies
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7798
 */
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7799
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7800
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7801
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7802
/**
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7803
 * Internal dependencies
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7804
 */
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7805
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7806
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7807
/**
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7808
 * @typedef {Object} WPBlockCategory
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7809
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7810
 * @property {string} slug  Unique category slug.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7811
 * @property {string} title Category label, for display in user interface.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7812
 */
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7813
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7814
/**
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7815
 * Default set of categories.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7816
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7817
 * @type {WPBlockCategory[]}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7818
 */
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7819
const DEFAULT_CATEGORIES = [{
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7820
  slug: 'text',
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7821
  title: (0,external_wp_i18n_namespaceObject.__)('Text')
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7822
}, {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7823
  slug: 'media',
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7824
  title: (0,external_wp_i18n_namespaceObject.__)('Media')
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7825
}, {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7826
  slug: 'design',
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7827
  title: (0,external_wp_i18n_namespaceObject.__)('Design')
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7828
}, {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7829
  slug: 'widgets',
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7830
  title: (0,external_wp_i18n_namespaceObject.__)('Widgets')
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7831
}, {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7832
  slug: 'theme',
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7833
  title: (0,external_wp_i18n_namespaceObject.__)('Theme')
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7834
}, {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7835
  slug: 'embed',
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7836
  title: (0,external_wp_i18n_namespaceObject.__)('Embeds')
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7837
}, {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7838
  slug: 'reusable',
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7839
  title: (0,external_wp_i18n_namespaceObject.__)('Reusable blocks')
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7840
}];
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7841
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7842
// Key block types by their name.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7843
function keyBlockTypesByName(types) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7844
  return types.reduce((newBlockTypes, block) => ({
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7845
    ...newBlockTypes,
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7846
    [block.name]: block
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7847
  }), {});
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7848
}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7849
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7850
// Filter items to ensure they're unique by their name.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7851
function getUniqueItemsByName(items) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7852
  return items.reduce((acc, currentItem) => {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7853
    if (!acc.some(item => item.name === currentItem.name)) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7854
      acc.push(currentItem);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7855
    }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7856
    return acc;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7857
  }, []);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7858
}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7859
function bootstrappedBlockTypes(state = {}, action) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7860
  switch (action.type) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7861
    case 'ADD_BOOTSTRAPPED_BLOCK_TYPE':
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7862
      const {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7863
        name,
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7864
        blockType
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7865
      } = action;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7866
      const serverDefinition = state[name];
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7867
      let newDefinition;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7868
      // Don't overwrite if already set. It covers the case when metadata
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7869
      // was initialized from the server.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7870
      if (serverDefinition) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7871
        // The `blockHooks` prop is not yet included in the server provided
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7872
        // definitions and needs to be polyfilled. This can be removed when the
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7873
        // minimum supported WordPress is >= 6.4.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7874
        if (serverDefinition.blockHooks === undefined && blockType.blockHooks) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7875
          newDefinition = {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7876
            ...serverDefinition,
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7877
            ...newDefinition,
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7878
            blockHooks: blockType.blockHooks
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7879
          };
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7880
        }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7881
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7882
        // The `allowedBlocks` prop is not yet included in the server provided
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7883
        // definitions and needs to be polyfilled. This can be removed when the
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7884
        // minimum supported WordPress is >= 6.5.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7885
        if (serverDefinition.allowedBlocks === undefined && blockType.allowedBlocks) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7886
          newDefinition = {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7887
            ...serverDefinition,
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7888
            ...newDefinition,
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7889
            allowedBlocks: blockType.allowedBlocks
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7890
          };
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7891
        }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7892
      } else {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7893
        newDefinition = Object.fromEntries(Object.entries(blockType).filter(([, value]) => value !== null && value !== undefined).map(([key, value]) => [camelCase(key), value]));
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7894
        newDefinition.name = name;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7895
      }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7896
      if (newDefinition) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7897
        return {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7898
          ...state,
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7899
          [name]: newDefinition
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7900
        };
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7901
      }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7902
      return state;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7903
    case 'REMOVE_BLOCK_TYPES':
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7904
      return omit(state, action.names);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7905
  }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7906
  return state;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7907
}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7908
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7909
/**
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7910
 * Reducer managing the unprocessed block types in a form passed when registering the by block.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7911
 * It's for internal use only. It allows recomputing the processed block types on-demand after block type filters
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7912
 * get added or removed.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7913
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7914
 * @param {Object} state  Current state.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7915
 * @param {Object} action Dispatched action.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7916
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7917
 * @return {Object} Updated state.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7918
 */
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7919
function unprocessedBlockTypes(state = {}, action) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7920
  switch (action.type) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7921
    case 'ADD_UNPROCESSED_BLOCK_TYPE':
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7922
      return {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7923
        ...state,
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7924
        [action.name]: action.blockType
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7925
      };
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7926
    case 'REMOVE_BLOCK_TYPES':
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7927
      return omit(state, action.names);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7928
  }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7929
  return state;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7930
}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7931
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7932
/**
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7933
 * Reducer managing the processed block types with all filters applied.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7934
 * The state is derived from the `unprocessedBlockTypes` reducer.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7935
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7936
 * @param {Object} state  Current state.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7937
 * @param {Object} action Dispatched action.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7938
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7939
 * @return {Object} Updated state.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7940
 */
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7941
function blockTypes(state = {}, action) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7942
  switch (action.type) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7943
    case 'ADD_BLOCK_TYPES':
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7944
      return {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7945
        ...state,
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7946
        ...keyBlockTypesByName(action.blockTypes)
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7947
      };
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7948
    case 'REMOVE_BLOCK_TYPES':
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7949
      return omit(state, action.names);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7950
  }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7951
  return state;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7952
}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7953
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7954
/**
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7955
 * Reducer managing the block styles.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7956
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7957
 * @param {Object} state  Current state.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7958
 * @param {Object} action Dispatched action.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7959
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7960
 * @return {Object} Updated state.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7961
 */
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7962
function blockStyles(state = {}, action) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7963
  var _state$action$blockNa;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7964
  switch (action.type) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7965
    case 'ADD_BLOCK_TYPES':
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7966
      return {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7967
        ...state,
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7968
        ...Object.fromEntries(Object.entries(keyBlockTypesByName(action.blockTypes)).map(([name, blockType]) => {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7969
          var _blockType$styles, _state$blockType$name;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7970
          return [name, getUniqueItemsByName([...((_blockType$styles = blockType.styles) !== null && _blockType$styles !== void 0 ? _blockType$styles : []).map(style => ({
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7971
            ...style,
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7972
            source: 'block'
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7973
          })), ...((_state$blockType$name = state[blockType.name]) !== null && _state$blockType$name !== void 0 ? _state$blockType$name : []).filter(({
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7974
            source
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7975
          }) => 'block' !== source)])];
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7976
        }))
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7977
      };
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7978
    case 'ADD_BLOCK_STYLES':
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7979
      const updatedStyles = {};
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7980
      action.blockNames.forEach(blockName => {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7981
        var _state$blockName;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7982
        updatedStyles[blockName] = getUniqueItemsByName([...((_state$blockName = state[blockName]) !== null && _state$blockName !== void 0 ? _state$blockName : []), ...action.styles]);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7983
      });
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7984
      return {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7985
        ...state,
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7986
        ...updatedStyles
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7987
      };
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7988
    case 'REMOVE_BLOCK_STYLES':
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7989
      return {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7990
        ...state,
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7991
        [action.blockName]: ((_state$action$blockNa = state[action.blockName]) !== null && _state$action$blockNa !== void 0 ? _state$action$blockNa : []).filter(style => action.styleNames.indexOf(style.name) === -1)
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7992
      };
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7993
  }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7994
  return state;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7995
}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7996
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7997
/**
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7998
 * Reducer managing the block variations.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  7999
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8000
 * @param {Object} state  Current state.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8001
 * @param {Object} action Dispatched action.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8002
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8003
 * @return {Object} Updated state.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8004
 */
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8005
function blockVariations(state = {}, action) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8006
  var _state$action$blockNa2, _state$action$blockNa3;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8007
  switch (action.type) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8008
    case 'ADD_BLOCK_TYPES':
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8009
      return {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8010
        ...state,
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8011
        ...Object.fromEntries(Object.entries(keyBlockTypesByName(action.blockTypes)).map(([name, blockType]) => {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8012
          var _blockType$variations, _state$blockType$name2;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8013
          return [name, getUniqueItemsByName([...((_blockType$variations = blockType.variations) !== null && _blockType$variations !== void 0 ? _blockType$variations : []).map(variation => ({
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8014
            ...variation,
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8015
            source: 'block'
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8016
          })), ...((_state$blockType$name2 = state[blockType.name]) !== null && _state$blockType$name2 !== void 0 ? _state$blockType$name2 : []).filter(({
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8017
            source
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8018
          }) => 'block' !== source)])];
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8019
        }))
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8020
      };
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8021
    case 'ADD_BLOCK_VARIATIONS':
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8022
      return {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8023
        ...state,
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8024
        [action.blockName]: getUniqueItemsByName([...((_state$action$blockNa2 = state[action.blockName]) !== null && _state$action$blockNa2 !== void 0 ? _state$action$blockNa2 : []), ...action.variations])
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8025
      };
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8026
    case 'REMOVE_BLOCK_VARIATIONS':
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8027
      return {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8028
        ...state,
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8029
        [action.blockName]: ((_state$action$blockNa3 = state[action.blockName]) !== null && _state$action$blockNa3 !== void 0 ? _state$action$blockNa3 : []).filter(variation => action.variationNames.indexOf(variation.name) === -1)
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8030
      };
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8031
  }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8032
  return state;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8033
}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8034
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8035
/**
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8036
 * Higher-order Reducer creating a reducer keeping track of given block name.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8037
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8038
 * @param {string} setActionType Action type.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8039
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8040
 * @return {Function} Reducer.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8041
 */
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8042
function createBlockNameSetterReducer(setActionType) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8043
  return (state = null, action) => {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8044
    switch (action.type) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8045
      case 'REMOVE_BLOCK_TYPES':
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8046
        if (action.names.indexOf(state) !== -1) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8047
          return null;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8048
        }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8049
        return state;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8050
      case setActionType:
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8051
        return action.name || null;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8052
    }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8053
    return state;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8054
  };
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8055
}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8056
const defaultBlockName = createBlockNameSetterReducer('SET_DEFAULT_BLOCK_NAME');
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8057
const freeformFallbackBlockName = createBlockNameSetterReducer('SET_FREEFORM_FALLBACK_BLOCK_NAME');
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8058
const unregisteredFallbackBlockName = createBlockNameSetterReducer('SET_UNREGISTERED_FALLBACK_BLOCK_NAME');
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8059
const groupingBlockName = createBlockNameSetterReducer('SET_GROUPING_BLOCK_NAME');
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8060
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8061
/**
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8062
 * Reducer managing the categories
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8063
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8064
 * @param {WPBlockCategory[]} state  Current state.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8065
 * @param {Object}            action Dispatched action.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8066
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8067
 * @return {WPBlockCategory[]} Updated state.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8068
 */
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8069
function categories(state = DEFAULT_CATEGORIES, action) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8070
  switch (action.type) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8071
    case 'SET_CATEGORIES':
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8072
      return action.categories || [];
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8073
    case 'UPDATE_CATEGORY':
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8074
      {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8075
        if (!action.category || !Object.keys(action.category).length) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8076
          return state;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8077
        }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8078
        const categoryToChange = state.find(({
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8079
          slug
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8080
        }) => slug === action.slug);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8081
        if (categoryToChange) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8082
          return state.map(category => {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8083
            if (category.slug === action.slug) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8084
              return {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8085
                ...category,
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8086
                ...action.category
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8087
              };
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8088
            }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8089
            return category;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8090
          });
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8091
        }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8092
      }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8093
  }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8094
  return state;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8095
}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8096
function collections(state = {}, action) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8097
  switch (action.type) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8098
    case 'ADD_BLOCK_COLLECTION':
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8099
      return {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8100
        ...state,
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8101
        [action.namespace]: {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8102
          title: action.title,
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8103
          icon: action.icon
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8104
        }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8105
      };
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8106
    case 'REMOVE_BLOCK_COLLECTION':
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8107
      return omit(state, action.namespace);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8108
  }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8109
  return state;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8110
}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8111
function blockBindingsSources(state = {}, action) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8112
  if (action.type === 'REGISTER_BLOCK_BINDINGS_SOURCE') {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8113
    return {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8114
      ...state,
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8115
      [action.sourceName]: {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8116
        label: action.sourceLabel,
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8117
        getValue: action.getValue,
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8118
        setValue: action.setValue,
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8119
        setValues: action.setValues,
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8120
        getPlaceholder: action.getPlaceholder,
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8121
        canUserEditValue: action.canUserEditValue || (() => false)
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8122
      }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8123
    };
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8124
  }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8125
  return state;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8126
}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8127
/* harmony default export */ const reducer = ((0,external_wp_data_namespaceObject.combineReducers)({
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8128
  bootstrappedBlockTypes,
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8129
  unprocessedBlockTypes,
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8130
  blockTypes,
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8131
  blockStyles,
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8132
  blockVariations,
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8133
  defaultBlockName,
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8134
  freeformFallbackBlockName,
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8135
  unregisteredFallbackBlockName,
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8136
  groupingBlockName,
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8137
  categories,
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8138
  collections,
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8139
  blockBindingsSources
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8140
}));
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8141
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8142
// EXTERNAL MODULE: ./node_modules/remove-accents/index.js
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8143
var remove_accents = __webpack_require__(9681);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8144
var remove_accents_default = /*#__PURE__*/__webpack_require__.n(remove_accents);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8145
;// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/store/utils.js
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8146
/**
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8147
 * Helper util to return a value from a certain path of the object.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8148
 * Path is specified as either:
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8149
 * - a string of properties, separated by dots, for example: "x.y".
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8150
 * - an array of properties, for example `[ 'x', 'y' ]`.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8151
 * You can also specify a default value in case the result is nullish.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8152
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8153
 * @param {Object}       object       Input object.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8154
 * @param {string|Array} path         Path to the object property.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8155
 * @param {*}            defaultValue Default value if the value at the specified path is nullish.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8156
 * @return {*} Value of the object property at the specified path.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8157
 */
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8158
const getValueFromObjectPath = (object, path, defaultValue) => {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8159
  var _value;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8160
  const normalizedPath = Array.isArray(path) ? path : path.split('.');
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8161
  let value = object;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8162
  normalizedPath.forEach(fieldName => {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8163
    value = value?.[fieldName];
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8164
  });
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8165
  return (_value = value) !== null && _value !== void 0 ? _value : defaultValue;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8166
};
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8167
function utils_isObject(candidate) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8168
  return typeof candidate === 'object' && candidate.constructor === Object && candidate !== null;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8169
}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8170
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8171
/**
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8172
 * Determine whether a set of object properties matches a given object.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8173
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8174
 * Given an object of block attributes and an object of variation attributes,
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8175
 * this function checks recursively whether all the variation attributes are
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8176
 * present in the block attributes object.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8177
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8178
 * @param {Object} blockAttributes     The object to inspect.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8179
 * @param {Object} variationAttributes The object of property values to match.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8180
 * @return {boolean} Whether the block attributes match the variation attributes.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8181
 */
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8182
function matchesAttributes(blockAttributes, variationAttributes) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8183
  if (utils_isObject(blockAttributes) && utils_isObject(variationAttributes)) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8184
    return Object.entries(variationAttributes).every(([key, value]) => matchesAttributes(blockAttributes?.[key], value));
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8185
  }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8186
  return blockAttributes === variationAttributes;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8187
}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8188
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8189
;// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/store/selectors.js
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8190
/**
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8191
 * External dependencies
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8192
 */
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8193
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8194
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8195
/**
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8196
 * WordPress dependencies
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8197
 */
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8198
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8199
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8200
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8201
/**
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8202
 * Internal dependencies
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8203
 */
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8204
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8205
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8206
/** @typedef {import('../api/registration').WPBlockVariation} WPBlockVariation */
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8207
/** @typedef {import('../api/registration').WPBlockVariationScope} WPBlockVariationScope */
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8208
/** @typedef {import('./reducer').WPBlockCategory} WPBlockCategory */
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8209
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8210
/**
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8211
 * Given a block name or block type object, returns the corresponding
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8212
 * normalized block type object.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8213
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8214
 * @param {Object}          state      Blocks state.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8215
 * @param {(string|Object)} nameOrType Block name or type object
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8216
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8217
 * @return {Object} Block type object.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8218
 */
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8219
const getNormalizedBlockType = (state, nameOrType) => 'string' === typeof nameOrType ? selectors_getBlockType(state, nameOrType) : nameOrType;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8220
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8221
/**
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8222
 * Returns all the available block types.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8223
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8224
 * @param {Object} state Data state.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8225
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8226
 * @example
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8227
 * ```js
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8228
 * import { store as blocksStore } from '@wordpress/blocks';
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8229
 * import { useSelect } from '@wordpress/data';
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8230
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8231
 * const ExampleComponent = () => {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8232
 *     const blockTypes = useSelect(
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8233
 *         ( select ) => select( blocksStore ).getBlockTypes(),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8234
 *         []
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8235
 *     );
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8236
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8237
 *     return (
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8238
 *         <ul>
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8239
 *             { blockTypes.map( ( block ) => (
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8240
 *                 <li key={ block.name }>{ block.title }</li>
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8241
 *             ) ) }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8242
 *         </ul>
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8243
 *     );
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8244
 * };
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8245
 * ```
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8246
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8247
 * @return {Array} Block Types.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8248
 */
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8249
const selectors_getBlockTypes = (0,external_wp_data_namespaceObject.createSelector)(state => Object.values(state.blockTypes), state => [state.blockTypes]);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8250
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8251
/**
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8252
 * Returns a block type by name.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8253
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8254
 * @param {Object} state Data state.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8255
 * @param {string} name  Block type name.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8256
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8257
 * @example
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8258
 * ```js
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8259
 * import { store as blocksStore } from '@wordpress/blocks';
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8260
 * import { useSelect } from '@wordpress/data';
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8261
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8262
 * const ExampleComponent = () => {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8263
 *     const paragraphBlock = useSelect( ( select ) =>
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8264
 *         ( select ) => select( blocksStore ).getBlockType( 'core/paragraph' ),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8265
 *         []
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8266
 *     );
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8267
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8268
 *     return (
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8269
 *         <ul>
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8270
 *             { paragraphBlock &&
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8271
 *                 Object.entries( paragraphBlock.supports ).map(
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8272
 *                     ( blockSupportsEntry ) => {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8273
 *                         const [ propertyName, value ] = blockSupportsEntry;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8274
 *                         return (
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8275
 *                             <li
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8276
 *                                 key={ propertyName }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8277
 *                             >{ `${ propertyName } : ${ value }` }</li>
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8278
 *                         );
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8279
 *                     }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8280
 *                 ) }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8281
 *         </ul>
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8282
 *     );
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8283
 * };
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8284
 * ```
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8285
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8286
 * @return {Object?} Block Type.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8287
 */
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8288
function selectors_getBlockType(state, name) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8289
  return state.blockTypes[name];
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8290
}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8291
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8292
/**
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8293
 * Returns block styles by block name.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8294
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8295
 * @param {Object} state Data state.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8296
 * @param {string} name  Block type name.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8297
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8298
 * @example
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8299
 * ```js
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8300
 * import { store as blocksStore } from '@wordpress/blocks';
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8301
 * import { useSelect } from '@wordpress/data';
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8302
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8303
 * const ExampleComponent = () => {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8304
 *     const buttonBlockStyles = useSelect( ( select ) =>
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8305
 *         select( blocksStore ).getBlockStyles( 'core/button' ),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8306
 *         []
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8307
 *     );
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8308
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8309
 *     return (
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8310
 *         <ul>
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8311
 *             { buttonBlockStyles &&
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8312
 *                 buttonBlockStyles.map( ( style ) => (
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8313
 *                     <li key={ style.name }>{ style.label }</li>
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8314
 *                 ) ) }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8315
 *         </ul>
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8316
 *     );
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8317
 * };
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8318
 * ```
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8319
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8320
 * @return {Array?} Block Styles.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8321
 */
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8322
function getBlockStyles(state, name) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8323
  return state.blockStyles[name];
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8324
}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8325
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8326
/**
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8327
 * Returns block variations by block name.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8328
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8329
 * @param {Object}                state     Data state.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8330
 * @param {string}                blockName Block type name.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8331
 * @param {WPBlockVariationScope} [scope]   Block variation scope name.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8332
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8333
 * @example
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8334
 * ```js
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8335
 * import { store as blocksStore } from '@wordpress/blocks';
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8336
 * import { useSelect } from '@wordpress/data';
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8337
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8338
 * const ExampleComponent = () => {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8339
 *     const socialLinkVariations = useSelect( ( select ) =>
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8340
 *         select( blocksStore ).getBlockVariations( 'core/social-link' ),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8341
 *         []
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8342
 *     );
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8343
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8344
 *     return (
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8345
 *         <ul>
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8346
 *             { socialLinkVariations &&
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8347
 *                 socialLinkVariations.map( ( variation ) => (
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8348
 *                     <li key={ variation.name }>{ variation.title }</li>
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8349
 *             ) ) }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8350
 *     </ul>
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8351
 *     );
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8352
 * };
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8353
 * ```
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8354
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8355
 * @return {(WPBlockVariation[]|void)} Block variations.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8356
 */
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8357
const selectors_getBlockVariations = (0,external_wp_data_namespaceObject.createSelector)((state, blockName, scope) => {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8358
  const variations = state.blockVariations[blockName];
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8359
  if (!variations || !scope) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8360
    return variations;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8361
  }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8362
  return variations.filter(variation => {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8363
    // For backward compatibility reasons, variation's scope defaults to
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8364
    // `block` and `inserter` when not set.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8365
    return (variation.scope || ['block', 'inserter']).includes(scope);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8366
  });
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8367
}, (state, blockName) => [state.blockVariations[blockName]]);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8368
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8369
/**
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8370
 * Returns the active block variation for a given block based on its attributes.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8371
 * Variations are determined by their `isActive` property.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8372
 * Which is either an array of block attribute keys or a function.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8373
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8374
 * In case of an array of block attribute keys, the `attributes` are compared
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8375
 * to the variation's attributes using strict equality check.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8376
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8377
 * In case of function type, the function should accept a block's attributes
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8378
 * and the variation's attributes and determines if a variation is active.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8379
 * A function that accepts a block's attributes and the variation's attributes and determines if a variation is active.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8380
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8381
 * @param {Object}                state      Data state.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8382
 * @param {string}                blockName  Name of block (example: “core/columns”).
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8383
 * @param {Object}                attributes Block attributes used to determine active variation.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8384
 * @param {WPBlockVariationScope} [scope]    Block variation scope name.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8385
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8386
 * @example
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8387
 * ```js
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8388
 * import { __ } from '@wordpress/i18n';
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8389
 * import { store as blocksStore } from '@wordpress/blocks';
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8390
 * import { store as blockEditorStore } from '@wordpress/block-editor';
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8391
 * import { useSelect } from '@wordpress/data';
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8392
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8393
 * const ExampleComponent = () => {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8394
 *     // This example assumes that a core/embed block is the first block in the Block Editor.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8395
 *     const activeBlockVariation = useSelect( ( select ) => {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8396
 *         // Retrieve the list of blocks.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8397
 *         const [ firstBlock ] = select( blockEditorStore ).getBlocks()
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8398
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8399
 *         // Return the active block variation for the first block.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8400
 *         return select( blocksStore ).getActiveBlockVariation(
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8401
 *             firstBlock.name,
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8402
 *             firstBlock.attributes
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8403
 *         );
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8404
 *     }, [] );
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8405
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8406
 *     return activeBlockVariation && activeBlockVariation.name === 'spotify' ? (
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8407
 *         <p>{ __( 'Spotify variation' ) }</p>
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8408
 *         ) : (
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8409
 *         <p>{ __( 'Other variation' ) }</p>
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8410
 *     );
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8411
 * };
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8412
 * ```
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8413
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8414
 * @return {(WPBlockVariation|undefined)} Active block variation.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8415
 */
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8416
function getActiveBlockVariation(state, blockName, attributes, scope) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8417
  const variations = selectors_getBlockVariations(state, blockName, scope);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8418
  if (!variations) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8419
    return variations;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8420
  }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8421
  const blockType = selectors_getBlockType(state, blockName);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8422
  const attributeKeys = Object.keys(blockType?.attributes || {});
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8423
  let match;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8424
  let maxMatchedAttributes = 0;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8425
  for (const variation of variations) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8426
    if (Array.isArray(variation.isActive)) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8427
      const definedAttributes = variation.isActive.filter(attribute => {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8428
        // We support nested attribute paths, e.g. `layout.type`.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8429
        // In this case, we need to check if the part before the
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8430
        // first dot is a known attribute.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8431
        const topLevelAttribute = attribute.split('.')[0];
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8432
        return attributeKeys.includes(topLevelAttribute);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8433
      });
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8434
      const definedAttributesLength = definedAttributes.length;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8435
      if (definedAttributesLength === 0) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8436
        continue;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8437
      }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8438
      const isMatch = definedAttributes.every(attribute => {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8439
        const variationAttributeValue = getValueFromObjectPath(variation.attributes, attribute);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8440
        if (variationAttributeValue === undefined) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8441
          return false;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8442
        }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8443
        let blockAttributeValue = getValueFromObjectPath(attributes, attribute);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8444
        if (blockAttributeValue instanceof external_wp_richText_namespaceObject.RichTextData) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8445
          blockAttributeValue = blockAttributeValue.toHTMLString();
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8446
        }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8447
        return matchesAttributes(blockAttributeValue, variationAttributeValue);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8448
      });
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8449
      if (isMatch && definedAttributesLength > maxMatchedAttributes) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8450
        match = variation;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8451
        maxMatchedAttributes = definedAttributesLength;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8452
      }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8453
    } else if (variation.isActive?.(attributes, variation.attributes)) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8454
      // If isActive is a function, we cannot know how many attributes it matches.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8455
      // This means that we cannot compare the specificity of our matches,
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8456
      // and simply return the best match we have found.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8457
      return match || variation;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8458
    }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8459
  }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8460
  return match;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8461
}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8462
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8463
/**
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8464
 * Returns the default block variation for the given block type.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8465
 * When there are multiple variations annotated as the default one,
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8466
 * the last added item is picked. This simplifies registering overrides.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8467
 * When there is no default variation set, it returns the first item.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8468
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8469
 * @param {Object}                state     Data state.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8470
 * @param {string}                blockName Block type name.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8471
 * @param {WPBlockVariationScope} [scope]   Block variation scope name.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8472
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8473
 * @example
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8474
 * ```js
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8475
 * import { __, sprintf } from '@wordpress/i18n';
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8476
 * import { store as blocksStore } from '@wordpress/blocks';
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8477
 * import { useSelect } from '@wordpress/data';
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8478
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8479
 * const ExampleComponent = () => {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8480
 *     const defaultEmbedBlockVariation = useSelect( ( select ) =>
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8481
 *         select( blocksStore ).getDefaultBlockVariation( 'core/embed' ),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8482
 *         []
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8483
 *     );
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8484
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8485
 *     return (
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8486
 *         defaultEmbedBlockVariation && (
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8487
 *             <p>
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8488
 *                 { sprintf(
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8489
 *                     __( 'core/embed default variation: %s' ),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8490
 *                     defaultEmbedBlockVariation.title
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8491
 *                 ) }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8492
 *             </p>
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8493
 *         )
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8494
 *     );
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8495
 * };
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8496
 * ```
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8497
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8498
 * @return {?WPBlockVariation} The default block variation.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8499
 */
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8500
function getDefaultBlockVariation(state, blockName, scope) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8501
  const variations = selectors_getBlockVariations(state, blockName, scope);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8502
  const defaultVariation = [...variations].reverse().find(({
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8503
    isDefault
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8504
  }) => !!isDefault);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8505
  return defaultVariation || variations[0];
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8506
}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8507
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8508
/**
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8509
 * Returns all the available block categories.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8510
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8511
 * @param {Object} state Data state.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8512
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8513
 * @example
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8514
 * ```js
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8515
 * import { store as blocksStore } from '@wordpress/blocks';
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8516
 * import { useSelect, } from '@wordpress/data';
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8517
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8518
 * const ExampleComponent = () => {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8519
 *     const blockCategories = useSelect( ( select ) =>
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8520
 *         select( blocksStore ).getCategories(),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8521
 *         []
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8522
 *     );
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8523
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8524
 *     return (
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8525
 *         <ul>
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8526
 *             { blockCategories.map( ( category ) => (
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8527
 *                 <li key={ category.slug }>{ category.title }</li>
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8528
 *             ) ) }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8529
 *         </ul>
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8530
 *     );
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8531
 * };
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8532
 * ```
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8533
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8534
 * @return {WPBlockCategory[]} Categories list.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8535
 */
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8536
function getCategories(state) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8537
  return state.categories;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8538
}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8539
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8540
/**
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8541
 * Returns all the available collections.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8542
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8543
 * @param {Object} state Data state.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8544
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8545
 * @example
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8546
 * ```js
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8547
 * import { store as blocksStore } from '@wordpress/blocks';
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8548
 * import { useSelect } from '@wordpress/data';
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8549
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8550
 * const ExampleComponent = () => {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8551
 *     const blockCollections = useSelect( ( select ) =>
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8552
 *         select( blocksStore ).getCollections(),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8553
 *         []
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8554
 *     );
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8555
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8556
 *     return (
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8557
 *         <ul>
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8558
 *             { Object.values( blockCollections ).length > 0 &&
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8559
 *                 Object.values( blockCollections ).map( ( collection ) => (
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8560
 *                     <li key={ collection.title }>{ collection.title }</li>
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8561
 *             ) ) }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8562
 *         </ul>
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8563
 *     );
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8564
 * };
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8565
 * ```
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8566
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8567
 * @return {Object} Collections list.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8568
 */
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8569
function getCollections(state) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8570
  return state.collections;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8571
}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8572
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8573
/**
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8574
 * Returns the name of the default block name.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8575
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8576
 * @param {Object} state Data state.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8577
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8578
 * @example
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8579
 * ```js
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8580
 * import { __, sprintf } from '@wordpress/i18n';
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8581
 * import { store as blocksStore } from '@wordpress/blocks';
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8582
 * import { useSelect } from '@wordpress/data';
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8583
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8584
 * const ExampleComponent = () => {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8585
 *     const defaultBlockName = useSelect( ( select ) =>
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8586
 *         select( blocksStore ).getDefaultBlockName(),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8587
 *         []
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8588
 *     );
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8589
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8590
 *     return (
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8591
 *         defaultBlockName && (
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8592
 *             <p>
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8593
 *                 { sprintf( __( 'Default block name: %s' ), defaultBlockName ) }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8594
 *             </p>
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8595
 *         )
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8596
 *     );
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8597
 * };
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8598
 * ```
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8599
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8600
 * @return {string?} Default block name.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8601
 */
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8602
function selectors_getDefaultBlockName(state) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8603
  return state.defaultBlockName;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8604
}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8605
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8606
/**
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8607
 * Returns the name of the block for handling non-block content.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8608
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8609
 * @param {Object} state Data state.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8610
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8611
 * @example
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8612
 * ```js
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8613
 * import { __, sprintf } from '@wordpress/i18n';
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8614
 * import { store as blocksStore } from '@wordpress/blocks';
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8615
 * import { useSelect } from '@wordpress/data';
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8616
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8617
 * const ExampleComponent = () => {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8618
 *     const freeformFallbackBlockName = useSelect( ( select ) =>
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8619
 *         select( blocksStore ).getFreeformFallbackBlockName(),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8620
 *         []
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8621
 *     );
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8622
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8623
 *     return (
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8624
 *         freeformFallbackBlockName && (
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8625
 *             <p>
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8626
 *                 { sprintf( __(
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8627
 *                     'Freeform fallback block name: %s' ),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8628
 *                     freeformFallbackBlockName
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8629
 *                 ) }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8630
 *             </p>
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8631
 *         )
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8632
 *     );
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8633
 * };
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8634
 * ```
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8635
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8636
 * @return {string?} Name of the block for handling non-block content.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8637
 */
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8638
function getFreeformFallbackBlockName(state) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8639
  return state.freeformFallbackBlockName;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8640
}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8641
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8642
/**
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8643
 * Returns the name of the block for handling unregistered blocks.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8644
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8645
 * @param {Object} state Data state.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8646
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8647
 * @example
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8648
 * ```js
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8649
 * import { __, sprintf } from '@wordpress/i18n';
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8650
 * import { store as blocksStore } from '@wordpress/blocks';
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8651
 * import { useSelect } from '@wordpress/data';
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8652
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8653
 * const ExampleComponent = () => {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8654
 *     const unregisteredFallbackBlockName = useSelect( ( select ) =>
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8655
 *         select( blocksStore ).getUnregisteredFallbackBlockName(),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8656
 *         []
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8657
 *     );
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8658
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8659
 *     return (
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8660
 *         unregisteredFallbackBlockName && (
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8661
 *             <p>
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8662
 *                 { sprintf( __(
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8663
 *                     'Unregistered fallback block name: %s' ),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8664
 *                     unregisteredFallbackBlockName
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8665
 *                 ) }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8666
 *             </p>
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8667
 *         )
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8668
 *     );
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8669
 * };
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8670
 * ```
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8671
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8672
 * @return {string?} Name of the block for handling unregistered blocks.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8673
 */
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8674
function getUnregisteredFallbackBlockName(state) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8675
  return state.unregisteredFallbackBlockName;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8676
}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8677
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8678
/**
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8679
 * Returns the name of the block for handling the grouping of blocks.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8680
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8681
 * @param {Object} state Data state.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8682
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8683
 * @example
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8684
 * ```js
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8685
 * import { __, sprintf } from '@wordpress/i18n';
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8686
 * import { store as blocksStore } from '@wordpress/blocks';
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8687
 * import { useSelect } from '@wordpress/data';
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8688
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8689
 * const ExampleComponent = () => {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8690
 *     const groupingBlockName = useSelect( ( select ) =>
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8691
 *         select( blocksStore ).getGroupingBlockName(),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8692
 *         []
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8693
 *     );
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8694
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8695
 *     return (
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8696
 *         groupingBlockName && (
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8697
 *             <p>
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8698
 *                 { sprintf(
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8699
 *                     __( 'Default grouping block name: %s' ),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8700
 *                     groupingBlockName
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8701
 *                 ) }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8702
 *             </p>
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8703
 *         )
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8704
 *     );
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8705
 * };
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8706
 * ```
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8707
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8708
 * @return {string?} Name of the block for handling the grouping of blocks.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8709
 */
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8710
function selectors_getGroupingBlockName(state) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8711
  return state.groupingBlockName;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8712
}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8713
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8714
/**
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8715
 * Returns an array with the child blocks of a given block.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8716
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8717
 * @param {Object} state     Data state.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8718
 * @param {string} blockName Block type name.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8719
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8720
 * @example
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8721
 * ```js
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8722
 * import { store as blocksStore } from '@wordpress/blocks';
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8723
 * import { useSelect } from '@wordpress/data';
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8724
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8725
 * const ExampleComponent = () => {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8726
 *     const childBlockNames = useSelect( ( select ) =>
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8727
 *         select( blocksStore ).getChildBlockNames( 'core/navigation' ),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8728
 *         []
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8729
 *     );
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8730
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8731
 *     return (
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8732
 *         <ul>
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8733
 *             { childBlockNames &&
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8734
 *                 childBlockNames.map( ( child ) => (
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8735
 *                     <li key={ child }>{ child }</li>
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8736
 *             ) ) }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8737
 *         </ul>
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8738
 *     );
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8739
 * };
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8740
 * ```
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8741
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8742
 * @return {Array} Array of child block names.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8743
 */
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8744
const selectors_getChildBlockNames = (0,external_wp_data_namespaceObject.createSelector)((state, blockName) => {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8745
  return selectors_getBlockTypes(state).filter(blockType => {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8746
    return blockType.parent?.includes(blockName);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8747
  }).map(({
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8748
    name
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8749
  }) => name);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8750
}, state => [state.blockTypes]);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8751
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8752
/**
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8753
 * Returns the block support value for a feature, if defined.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8754
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8755
 * @param {Object}          state           Data state.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8756
 * @param {(string|Object)} nameOrType      Block name or type object
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8757
 * @param {Array|string}    feature         Feature to retrieve
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8758
 * @param {*}               defaultSupports Default value to return if not
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8759
 *                                          explicitly defined
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8760
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8761
 * @example
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8762
 * ```js
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8763
 * import { __, sprintf } from '@wordpress/i18n';
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8764
 * import { store as blocksStore } from '@wordpress/blocks';
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8765
 * import { useSelect } from '@wordpress/data';
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8766
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8767
 * const ExampleComponent = () => {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8768
 *     const paragraphBlockSupportValue = useSelect( ( select ) =>
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8769
 *         select( blocksStore ).getBlockSupport( 'core/paragraph', 'anchor' ),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8770
 *         []
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8771
 *     );
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8772
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8773
 *     return (
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8774
 *         <p>
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8775
 *             { sprintf(
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8776
 *                 __( 'core/paragraph supports.anchor value: %s' ),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8777
 *                 paragraphBlockSupportValue
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8778
 *             ) }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8779
 *         </p>
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8780
 *     );
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8781
 * };
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8782
 * ```
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8783
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8784
 * @return {?*} Block support value
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8785
 */
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8786
const selectors_getBlockSupport = (state, nameOrType, feature, defaultSupports) => {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8787
  const blockType = getNormalizedBlockType(state, nameOrType);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8788
  if (!blockType?.supports) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8789
    return defaultSupports;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8790
  }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8791
  return getValueFromObjectPath(blockType.supports, feature, defaultSupports);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8792
};
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8793
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8794
/**
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8795
 * Returns true if the block defines support for a feature, or false otherwise.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8796
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8797
 * @param {Object}          state           Data state.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8798
 * @param {(string|Object)} nameOrType      Block name or type object.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8799
 * @param {string}          feature         Feature to test.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8800
 * @param {boolean}         defaultSupports Whether feature is supported by
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8801
 *                                          default if not explicitly defined.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8802
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8803
 * @example
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8804
 * ```js
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8805
 * import { __, sprintf } from '@wordpress/i18n';
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8806
 * import { store as blocksStore } from '@wordpress/blocks';
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8807
 * import { useSelect } from '@wordpress/data';
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8808
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8809
 * const ExampleComponent = () => {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8810
 *     const paragraphBlockSupportClassName = useSelect( ( select ) =>
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8811
 *         select( blocksStore ).hasBlockSupport( 'core/paragraph', 'className' ),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8812
 *         []
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8813
 *     );
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8814
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8815
 *     return (
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8816
 *         <p>
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8817
 *             { sprintf(
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8818
 *                 __( 'core/paragraph supports custom class name?: %s' ),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8819
 *                 paragraphBlockSupportClassName
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8820
 *             ) }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8821
 *         /p>
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8822
 *     );
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8823
 * };
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8824
 * ```
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8825
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8826
 * @return {boolean} Whether block supports feature.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8827
 */
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8828
function selectors_hasBlockSupport(state, nameOrType, feature, defaultSupports) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8829
  return !!selectors_getBlockSupport(state, nameOrType, feature, defaultSupports);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8830
}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8831
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8832
/**
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8833
 * Normalizes a search term string: removes accents, converts to lowercase, removes extra whitespace.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8834
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8835
 * @param {string|null|undefined} term Search term to normalize.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8836
 * @return {string} Normalized search term.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8837
 */
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8838
function getNormalizedSearchTerm(term) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8839
  return remove_accents_default()(term !== null && term !== void 0 ? term : '').toLowerCase().trim();
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8840
}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8841
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8842
/**
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8843
 * Returns true if the block type by the given name or object value matches a
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8844
 * search term, or false otherwise.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8845
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8846
 * @param {Object}          state      Blocks state.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8847
 * @param {(string|Object)} nameOrType Block name or type object.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8848
 * @param {string}          searchTerm Search term by which to filter.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8849
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8850
 * @example
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8851
 * ```js
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8852
 * import { __, sprintf } from '@wordpress/i18n';
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8853
 * import { store as blocksStore } from '@wordpress/blocks';
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8854
 * import { useSelect } from '@wordpress/data';
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8855
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8856
 * const ExampleComponent = () => {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8857
 *     const termFound = useSelect(
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8858
 *         ( select ) =>
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8859
 *             select( blocksStore ).isMatchingSearchTerm(
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8860
 *                 'core/navigation',
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8861
 *                 'theme'
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8862
 *             ),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8863
 *             []
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8864
 *         );
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8865
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8866
 *     return (
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8867
 *         <p>
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8868
 *             { sprintf(
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8869
 *                 __(
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8870
 *                     'Search term was found in the title, keywords, category or description in block.json: %s'
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8871
 *                 ),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8872
 *                 termFound
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8873
 *             ) }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8874
 *         </p>
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8875
 *     );
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8876
 * };
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8877
 * ```
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8878
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8879
 * @return {Object[]} Whether block type matches search term.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8880
 */
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8881
function isMatchingSearchTerm(state, nameOrType, searchTerm = '') {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8882
  const blockType = getNormalizedBlockType(state, nameOrType);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8883
  const normalizedSearchTerm = getNormalizedSearchTerm(searchTerm);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8884
  const isSearchMatch = candidate => getNormalizedSearchTerm(candidate).includes(normalizedSearchTerm);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8885
  return isSearchMatch(blockType.title) || blockType.keywords?.some(isSearchMatch) || isSearchMatch(blockType.category) || typeof blockType.description === 'string' && isSearchMatch(blockType.description);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8886
}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8887
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8888
/**
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8889
 * Returns a boolean indicating if a block has child blocks or not.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8890
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8891
 * @param {Object} state     Data state.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8892
 * @param {string} blockName Block type name.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8893
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8894
 * @example
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8895
 * ```js
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8896
 * import { __, sprintf } from '@wordpress/i18n';
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8897
 * import { store as blocksStore } from '@wordpress/blocks';
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8898
 * import { useSelect } from '@wordpress/data';
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8899
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8900
 * const ExampleComponent = () => {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8901
 *     const navigationBlockHasChildBlocks = useSelect( ( select ) =>
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8902
 *         select( blocksStore ).hasChildBlocks( 'core/navigation' ),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8903
 *         []
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8904
 *     );
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8905
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8906
 *     return (
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8907
 *         <p>
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8908
 *             { sprintf(
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8909
 *                 __( 'core/navigation has child blocks: %s' ),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8910
 *                 navigationBlockHasChildBlocks
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8911
 *             ) }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8912
 *         </p>
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8913
 *     );
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8914
 * };
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8915
 * ```
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8916
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8917
 * @return {boolean} True if a block contains child blocks and false otherwise.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8918
 */
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8919
const selectors_hasChildBlocks = (state, blockName) => {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8920
  return selectors_getChildBlockNames(state, blockName).length > 0;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8921
};
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8922
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8923
/**
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8924
 * Returns a boolean indicating if a block has at least one child block with inserter support.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8925
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8926
 * @param {Object} state     Data state.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8927
 * @param {string} blockName Block type name.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8928
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8929
 * @example
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8930
 * ```js
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8931
 * import { __, sprintf } from '@wordpress/i18n';
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8932
 * import { store as blocksStore } from '@wordpress/blocks';
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8933
 * import { useSelect } from '@wordpress/data';
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8934
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8935
 * const ExampleComponent = () => {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8936
 *     const navigationBlockHasChildBlocksWithInserterSupport = useSelect( ( select ) =>
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8937
 *         select( blocksStore ).hasChildBlocksWithInserterSupport(
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8938
 *             'core/navigation'
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8939
 *         ),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8940
 *         []
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8941
 *     );
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8942
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8943
 *     return (
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8944
 *         <p>
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8945
 *             { sprintf(
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8946
 *                 __( 'core/navigation has child blocks with inserter support: %s' ),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8947
 *                 navigationBlockHasChildBlocksWithInserterSupport
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8948
 *             ) }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8949
 *         </p>
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8950
 *     );
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8951
 * };
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8952
 * ```
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8953
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8954
 * @return {boolean} True if a block contains at least one child blocks with inserter support
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8955
 *                   and false otherwise.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8956
 */
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8957
const selectors_hasChildBlocksWithInserterSupport = (state, blockName) => {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8958
  return selectors_getChildBlockNames(state, blockName).some(childBlockName => {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8959
    return selectors_hasBlockSupport(state, childBlockName, 'inserter', true);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8960
  });
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8961
};
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8962
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8963
/**
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8964
 * DO-NOT-USE in production.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8965
 * This selector is created for internal/experimental only usage and may be
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8966
 * removed anytime without any warning, causing breakage on any plugin or theme invoking it.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8967
 */
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8968
const __experimentalHasContentRoleAttribute = (0,external_wp_data_namespaceObject.createSelector)((state, blockTypeName) => {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8969
  const blockType = selectors_getBlockType(state, blockTypeName);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8970
  if (!blockType) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8971
    return false;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8972
  }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8973
  return Object.entries(blockType.attributes).some(([, {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8974
    __experimentalRole
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8975
  }]) => __experimentalRole === 'content');
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8976
}, (state, blockTypeName) => [state.blockTypes[blockTypeName]?.attributes]);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8977
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8978
;// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/store/private-selectors.js
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8979
/**
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8980
 * WordPress dependencies
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8981
 */
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8982
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8983
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8984
/**
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8985
 * Internal dependencies
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8986
 */
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8987
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8988
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8989
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8990
const ROOT_BLOCK_SUPPORTS = ['background', 'backgroundColor', 'color', 'linkColor', 'captionColor', 'buttonColor', 'headingColor', 'fontFamily', 'fontSize', 'fontStyle', 'fontWeight', 'lineHeight', 'padding', 'contentSize', 'wideSize', 'blockGap', 'textDecoration', 'textTransform', 'letterSpacing'];
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8991
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8992
/**
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8993
 * Filters the list of supported styles for a given element.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8994
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8995
 * @param {string[]}         blockSupports list of supported styles.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8996
 * @param {string|undefined} name          block name.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8997
 * @param {string|undefined} element       element name.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8998
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  8999
 * @return {string[]} filtered list of supported styles.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9000
 */
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9001
function filterElementBlockSupports(blockSupports, name, element) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9002
  return blockSupports.filter(support => {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9003
    if (support === 'fontSize' && element === 'heading') {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9004
      return false;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9005
    }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9006
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9007
    // This is only available for links
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9008
    if (support === 'textDecoration' && !name && element !== 'link') {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9009
      return false;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9010
    }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9011
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9012
    // This is only available for heading, button, caption and text
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9013
    if (support === 'textTransform' && !name && !(['heading', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6'].includes(element) || element === 'button' || element === 'caption' || element === 'text')) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9014
      return false;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9015
    }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9016
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9017
    // This is only available for heading, button, caption and text
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9018
    if (support === 'letterSpacing' && !name && !(['heading', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6'].includes(element) || element === 'button' || element === 'caption' || element === 'text')) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9019
      return false;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9020
    }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9021
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9022
    // Text columns is only available for blocks.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9023
    if (support === 'textColumns' && !name) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9024
      return false;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9025
    }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9026
    return true;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9027
  });
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9028
}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9029
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9030
/**
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9031
 * Returns the list of supported styles for a given block name and element.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9032
 */
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9033
const getSupportedStyles = (0,external_wp_data_namespaceObject.createSelector)((state, name, element) => {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9034
  if (!name) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9035
    return filterElementBlockSupports(ROOT_BLOCK_SUPPORTS, name, element);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9036
  }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9037
  const blockType = selectors_getBlockType(state, name);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9038
  if (!blockType) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9039
    return [];
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9040
  }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9041
  const supportKeys = [];
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9042
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9043
  // Check for blockGap support.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9044
  // Block spacing support doesn't map directly to a single style property, so needs to be handled separately.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9045
  if (blockType?.supports?.spacing?.blockGap) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9046
    supportKeys.push('blockGap');
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9047
  }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9048
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9049
  // check for shadow support
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9050
  if (blockType?.supports?.shadow) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9051
    supportKeys.push('shadow');
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9052
  }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9053
  Object.keys(__EXPERIMENTAL_STYLE_PROPERTY).forEach(styleName => {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9054
    if (!__EXPERIMENTAL_STYLE_PROPERTY[styleName].support) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9055
      return;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9056
    }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9057
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9058
    // Opting out means that, for certain support keys like background color,
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9059
    // blocks have to explicitly set the support value false. If the key is
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9060
    // unset, we still enable it.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9061
    if (__EXPERIMENTAL_STYLE_PROPERTY[styleName].requiresOptOut) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9062
      if (__EXPERIMENTAL_STYLE_PROPERTY[styleName].support[0] in blockType.supports && getValueFromObjectPath(blockType.supports, __EXPERIMENTAL_STYLE_PROPERTY[styleName].support) !== false) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9063
        supportKeys.push(styleName);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9064
        return;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9065
      }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9066
    }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9067
    if (getValueFromObjectPath(blockType.supports, __EXPERIMENTAL_STYLE_PROPERTY[styleName].support, false)) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9068
      supportKeys.push(styleName);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9069
    }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9070
  });
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9071
  return filterElementBlockSupports(supportKeys, name, element);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9072
}, (state, name) => [state.blockTypes[name]]);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9073
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9074
/**
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9075
 * Returns the bootstrapped block type metadata for a give block name.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9076
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9077
 * @param {Object} state Data state.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9078
 * @param {string} name  Block name.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9079
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9080
 * @return {Object} Bootstrapped block type metadata for a block.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9081
 */
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9082
function getBootstrappedBlockType(state, name) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9083
  return state.bootstrappedBlockTypes[name];
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9084
}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9085
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9086
/**
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9087
 * Returns all the unprocessed (before applying the `registerBlockType` filter)
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9088
 * block type settings as passed during block registration.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9089
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9090
 * @param {Object} state Data state.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9091
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9092
 * @return {Array} Unprocessed block type settings for all blocks.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9093
 */
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9094
function getUnprocessedBlockTypes(state) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9095
  return state.unprocessedBlockTypes;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9096
}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9097
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9098
/**
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9099
 * Returns all the block bindings sources registered.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9100
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9101
 * @param {Object} state Data state.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9102
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9103
 * @return {Object} All the registered sources and their properties.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9104
 */
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9105
function getAllBlockBindingsSources(state) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9106
  return state.blockBindingsSources;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9107
}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9108
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9109
/**
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9110
 * Returns a specific block bindings source.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9111
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9112
 * @param {Object} state      Data state.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9113
 * @param {string} sourceName Name of the source to get.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9114
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9115
 * @return {Object} The specific block binding source and its properties.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9116
 */
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9117
function getBlockBindingsSource(state, sourceName) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9118
  return state.blockBindingsSources[sourceName];
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9119
}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9120
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9121
;// CONCATENATED MODULE: external ["wp","deprecated"]
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9122
const external_wp_deprecated_namespaceObject = window["wp"]["deprecated"];
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9123
var external_wp_deprecated_default = /*#__PURE__*/__webpack_require__.n(external_wp_deprecated_namespaceObject);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9124
;// CONCATENATED MODULE: ./node_modules/is-plain-object/dist/is-plain-object.mjs
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9125
/*!
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9126
 * is-plain-object <https://github.com/jonschlinkert/is-plain-object>
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9127
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9128
 * Copyright (c) 2014-2017, Jon Schlinkert.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9129
 * Released under the MIT License.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9130
 */
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9131
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9132
function is_plain_object_isObject(o) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9133
  return Object.prototype.toString.call(o) === '[object Object]';
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9134
}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9135
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9136
function isPlainObject(o) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9137
  var ctor,prot;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9138
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9139
  if (is_plain_object_isObject(o) === false) return false;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9140
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9141
  // If has modified constructor
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9142
  ctor = o.constructor;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9143
  if (ctor === undefined) return true;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9144
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9145
  // If has modified prototype
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9146
  prot = ctor.prototype;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9147
  if (is_plain_object_isObject(prot) === false) return false;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9148
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9149
  // If constructor does not have an Object-specific method
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9150
  if (prot.hasOwnProperty('isPrototypeOf') === false) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9151
    return false;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9152
  }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9153
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9154
  // Most likely a plain Object
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9155
  return true;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9156
}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9157
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9158
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9159
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9160
// EXTERNAL MODULE: ./node_modules/react-is/index.js
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9161
var react_is = __webpack_require__(8529);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9162
;// CONCATENATED MODULE: external ["wp","hooks"]
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9163
const external_wp_hooks_namespaceObject = window["wp"]["hooks"];
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9164
;// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/store/process-block-type.js
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9165
/**
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9166
 * External dependencies
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9167
 */
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9168
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9169
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9170
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9171
/**
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9172
 * WordPress dependencies
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9173
 */
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9174
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9175
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9176
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9177
/**
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9178
 * Internal dependencies
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9179
 */
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9180
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9181
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9182
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9183
/** @typedef {import('../api/registration').WPBlockType} WPBlockType */
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9184
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9185
const error = (...args) => window?.console?.error?.(...args);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9186
const warn = (...args) => window?.console?.warn?.(...args);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9187
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9188
/**
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9189
 * Mapping of legacy category slugs to their latest normal values, used to
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9190
 * accommodate updates of the default set of block categories.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9191
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9192
 * @type {Record<string,string>}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9193
 */
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9194
const LEGACY_CATEGORY_MAPPING = {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9195
  common: 'text',
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9196
  formatting: 'text',
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9197
  layout: 'design'
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9198
};
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9199
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9200
/**
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9201
 * Merge block variations bootstrapped from the server and client.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9202
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9203
 * When a variation is registered in both places, its properties are merged.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9204
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9205
 * @param {Array} bootstrappedVariations - A block type variations from the server.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9206
 * @param {Array} clientVariations       - A block type variations from the client.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9207
 * @return {Array} The merged array of block variations.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9208
 */
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9209
function mergeBlockVariations(bootstrappedVariations = [], clientVariations = []) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9210
  const result = [...bootstrappedVariations];
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9211
  clientVariations.forEach(clientVariation => {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9212
    const index = result.findIndex(bootstrappedVariation => bootstrappedVariation.name === clientVariation.name);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9213
    if (index !== -1) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9214
      result[index] = {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9215
        ...result[index],
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9216
        ...clientVariation
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9217
      };
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9218
    } else {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9219
      result.push(clientVariation);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9220
    }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9221
  });
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9222
  return result;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9223
}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9224
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9225
/**
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9226
 * Takes the unprocessed block type settings, merges them with block type metadata
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9227
 * and applies all the existing filters for the registered block type.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9228
 * Next, it validates all the settings and performs additional processing to the block type definition.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9229
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9230
 * @param {string}      name          Block name.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9231
 * @param {WPBlockType} blockSettings Unprocessed block type settings.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9232
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9233
 * @return {WPBlockType | undefined} The block, if it has been processed and can be registered; otherwise `undefined`.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9234
 */
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9235
const processBlockType = (name, blockSettings) => ({
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9236
  select
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9237
}) => {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9238
  const bootstrappedBlockType = select.getBootstrappedBlockType(name);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9239
  const blockType = {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9240
    name,
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9241
    icon: BLOCK_ICON_DEFAULT,
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9242
    keywords: [],
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9243
    attributes: {},
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9244
    providesContext: {},
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9245
    usesContext: [],
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9246
    selectors: {},
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9247
    supports: {},
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9248
    styles: [],
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9249
    blockHooks: {},
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9250
    save: () => null,
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9251
    ...bootstrappedBlockType,
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9252
    ...blockSettings,
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9253
    variations: mergeBlockVariations(bootstrappedBlockType?.variations, blockSettings?.variations)
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9254
  };
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9255
  const settings = (0,external_wp_hooks_namespaceObject.applyFilters)('blocks.registerBlockType', blockType, name, null);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9256
  if (settings.description && typeof settings.description !== 'string') {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9257
    external_wp_deprecated_default()('Declaring non-string block descriptions', {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9258
      since: '6.2'
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9259
    });
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9260
  }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9261
  if (settings.deprecated) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9262
    settings.deprecated = settings.deprecated.map(deprecation => Object.fromEntries(Object.entries(
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9263
    // Only keep valid deprecation keys.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9264
    (0,external_wp_hooks_namespaceObject.applyFilters)('blocks.registerBlockType',
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9265
    // Merge deprecation keys with pre-filter settings
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9266
    // so that filters that depend on specific keys being
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9267
    // present don't fail.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9268
    {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9269
      // Omit deprecation keys here so that deprecations
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9270
      // can opt out of specific keys like "supports".
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9271
      ...omit(blockType, DEPRECATED_ENTRY_KEYS),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9272
      ...deprecation
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9273
    }, blockType.name, deprecation)).filter(([key]) => DEPRECATED_ENTRY_KEYS.includes(key))));
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9274
  }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9275
  if (!isPlainObject(settings)) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9276
    error('Block settings must be a valid object.');
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9277
    return;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9278
  }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9279
  if (typeof settings.save !== 'function') {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9280
    error('The "save" property must be a valid function.');
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9281
    return;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9282
  }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9283
  if ('edit' in settings && !(0,react_is.isValidElementType)(settings.edit)) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9284
    error('The "edit" property must be a valid component.');
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9285
    return;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9286
  }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9287
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9288
  // Canonicalize legacy categories to equivalent fallback.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9289
  if (LEGACY_CATEGORY_MAPPING.hasOwnProperty(settings.category)) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9290
    settings.category = LEGACY_CATEGORY_MAPPING[settings.category];
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9291
  }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9292
  if ('category' in settings && !select.getCategories().some(({
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9293
    slug
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9294
  }) => slug === settings.category)) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9295
    warn('The block "' + name + '" is registered with an invalid category "' + settings.category + '".');
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9296
    delete settings.category;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9297
  }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9298
  if (!('title' in settings) || settings.title === '') {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9299
    error('The block "' + name + '" must have a title.');
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9300
    return;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9301
  }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9302
  if (typeof settings.title !== 'string') {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9303
    error('Block titles must be strings.');
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9304
    return;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9305
  }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9306
  settings.icon = normalizeIconObject(settings.icon);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9307
  if (!isValidIcon(settings.icon.src)) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9308
    error('The icon passed is invalid. ' + 'The icon should be a string, an element, a function, or an object following the specifications documented in https://developer.wordpress.org/block-editor/developers/block-api/block-registration/#icon-optional');
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9309
    return;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9310
  }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9311
  return settings;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9312
};
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9313
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9314
;// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/store/actions.js
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9315
/**
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9316
 * WordPress dependencies
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9317
 */
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9318
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9319
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9320
/**
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9321
 * Internal dependencies
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9322
 */
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9323
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9324
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9325
/** @typedef {import('../api/registration').WPBlockVariation} WPBlockVariation */
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9326
/** @typedef {import('../api/registration').WPBlockType} WPBlockType */
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9327
/** @typedef {import('./reducer').WPBlockCategory} WPBlockCategory */
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9328
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9329
/**
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9330
 * Returns an action object used in signalling that block types have been added.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9331
 * Ignored from documentation as the recommended usage for this action through registerBlockType from @wordpress/blocks.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9332
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9333
 * @ignore
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9334
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9335
 * @param {WPBlockType|WPBlockType[]} blockTypes Object or array of objects representing blocks to added.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9336
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9337
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9338
 * @return {Object} Action object.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9339
 */
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9340
function addBlockTypes(blockTypes) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9341
  return {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9342
    type: 'ADD_BLOCK_TYPES',
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9343
    blockTypes: Array.isArray(blockTypes) ? blockTypes : [blockTypes]
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9344
  };
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9345
}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9346
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9347
/**
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9348
 * Signals that all block types should be computed again.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9349
 * It uses stored unprocessed block types and all the most recent list of registered filters.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9350
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9351
 * It addresses the issue where third party block filters get registered after third party blocks. A sample sequence:
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9352
 *   1. Filter A.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9353
 *   2. Block B.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9354
 *   3. Block C.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9355
 *   4. Filter D.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9356
 *   5. Filter E.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9357
 *   6. Block F.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9358
 *   7. Filter G.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9359
 * In this scenario some filters would not get applied for all blocks because they are registered too late.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9360
 */
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9361
function reapplyBlockTypeFilters() {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9362
  return ({
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9363
    dispatch,
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9364
    select
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9365
  }) => {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9366
    const processedBlockTypes = [];
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9367
    for (const [name, settings] of Object.entries(select.getUnprocessedBlockTypes())) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9368
      const result = dispatch(processBlockType(name, settings));
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9369
      if (result) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9370
        processedBlockTypes.push(result);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9371
      }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9372
    }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9373
    if (!processedBlockTypes.length) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9374
      return;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9375
    }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9376
    dispatch.addBlockTypes(processedBlockTypes);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9377
  };
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9378
}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9379
function __experimentalReapplyBlockFilters() {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9380
  external_wp_deprecated_default()('wp.data.dispatch( "core/blocks" ).__experimentalReapplyBlockFilters', {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9381
    since: '6.4',
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9382
    alternative: 'reapplyBlockFilters'
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9383
  });
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9384
  return reapplyBlockTypeFilters();
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9385
}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9386
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9387
/**
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9388
 * Returns an action object used to remove a registered block type.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9389
 * Ignored from documentation as the recommended usage for this action through unregisterBlockType from @wordpress/blocks.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9390
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9391
 * @ignore
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9392
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9393
 * @param {string|string[]} names Block name or array of block names to be removed.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9394
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9395
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9396
 * @return {Object} Action object.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9397
 */
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9398
function removeBlockTypes(names) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9399
  return {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9400
    type: 'REMOVE_BLOCK_TYPES',
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9401
    names: Array.isArray(names) ? names : [names]
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9402
  };
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9403
}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9404
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9405
/**
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9406
 * Returns an action object used in signalling that new block styles have been added.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9407
 * Ignored from documentation as the recommended usage for this action through registerBlockStyle from @wordpress/blocks.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9408
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9409
 * @param {string|Array} blockNames Block names to register new styles for.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9410
 * @param {Array|Object} styles     Block style object or array of block style objects.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9411
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9412
 * @ignore
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9413
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9414
 * @return {Object} Action object.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9415
 */
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9416
function addBlockStyles(blockNames, styles) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9417
  return {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9418
    type: 'ADD_BLOCK_STYLES',
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9419
    styles: Array.isArray(styles) ? styles : [styles],
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9420
    blockNames: Array.isArray(blockNames) ? blockNames : [blockNames]
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9421
  };
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9422
}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9423
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9424
/**
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9425
 * Returns an action object used in signalling that block styles have been removed.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9426
 * Ignored from documentation as the recommended usage for this action through unregisterBlockStyle from @wordpress/blocks.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9427
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9428
 * @ignore
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9429
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9430
 * @param {string}       blockName  Block name.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9431
 * @param {Array|string} styleNames Block style names or array of block style names.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9432
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9433
 * @return {Object} Action object.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9434
 */
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9435
function removeBlockStyles(blockName, styleNames) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9436
  return {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9437
    type: 'REMOVE_BLOCK_STYLES',
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9438
    styleNames: Array.isArray(styleNames) ? styleNames : [styleNames],
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9439
    blockName
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9440
  };
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9441
}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9442
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9443
/**
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9444
 * Returns an action object used in signalling that new block variations have been added.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9445
 * Ignored from documentation as the recommended usage for this action through registerBlockVariation from @wordpress/blocks.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9446
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9447
 * @ignore
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9448
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9449
 * @param {string}                              blockName  Block name.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9450
 * @param {WPBlockVariation|WPBlockVariation[]} variations Block variations.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9451
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9452
 * @return {Object} Action object.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9453
 */
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9454
function addBlockVariations(blockName, variations) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9455
  return {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9456
    type: 'ADD_BLOCK_VARIATIONS',
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9457
    variations: Array.isArray(variations) ? variations : [variations],
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9458
    blockName
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9459
  };
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9460
}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9461
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9462
/**
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9463
 * Returns an action object used in signalling that block variations have been removed.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9464
 * Ignored from documentation as the recommended usage for this action through unregisterBlockVariation from @wordpress/blocks.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9465
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9466
 * @ignore
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9467
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9468
 * @param {string}          blockName      Block name.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9469
 * @param {string|string[]} variationNames Block variation names.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9470
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9471
 * @return {Object} Action object.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9472
 */
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9473
function removeBlockVariations(blockName, variationNames) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9474
  return {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9475
    type: 'REMOVE_BLOCK_VARIATIONS',
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9476
    variationNames: Array.isArray(variationNames) ? variationNames : [variationNames],
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9477
    blockName
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9478
  };
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9479
}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9480
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9481
/**
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9482
 * Returns an action object used to set the default block name.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9483
 * Ignored from documentation as the recommended usage for this action through setDefaultBlockName from @wordpress/blocks.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9484
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9485
 * @ignore
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9486
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9487
 * @param {string} name Block name.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9488
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9489
 * @return {Object} Action object.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9490
 */
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9491
function actions_setDefaultBlockName(name) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9492
  return {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9493
    type: 'SET_DEFAULT_BLOCK_NAME',
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9494
    name
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9495
  };
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9496
}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9497
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9498
/**
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9499
 * Returns an action object used to set the name of the block used as a fallback
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9500
 * for non-block content.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9501
 * Ignored from documentation as the recommended usage for this action through setFreeformContentHandlerName from @wordpress/blocks.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9502
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9503
 * @ignore
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9504
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9505
 * @param {string} name Block name.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9506
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9507
 * @return {Object} Action object.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9508
 */
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9509
function setFreeformFallbackBlockName(name) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9510
  return {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9511
    type: 'SET_FREEFORM_FALLBACK_BLOCK_NAME',
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9512
    name
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9513
  };
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9514
}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9515
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9516
/**
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9517
 * Returns an action object used to set the name of the block used as a fallback
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9518
 * for unregistered blocks.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9519
 * Ignored from documentation as the recommended usage for this action through setUnregisteredTypeHandlerName from @wordpress/blocks.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9520
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9521
 * @ignore
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9522
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9523
 * @param {string} name Block name.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9524
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9525
 * @return {Object} Action object.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9526
 */
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9527
function setUnregisteredFallbackBlockName(name) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9528
  return {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9529
    type: 'SET_UNREGISTERED_FALLBACK_BLOCK_NAME',
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9530
    name
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9531
  };
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9532
}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9533
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9534
/**
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9535
 * Returns an action object used to set the name of the block used
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9536
 * when grouping other blocks
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9537
 * eg: in "Group/Ungroup" interactions
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9538
 * Ignored from documentation as the recommended usage for this action through setGroupingBlockName from @wordpress/blocks.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9539
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9540
 * @ignore
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9541
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9542
 * @param {string} name Block name.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9543
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9544
 * @return {Object} Action object.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9545
 */
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9546
function actions_setGroupingBlockName(name) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9547
  return {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9548
    type: 'SET_GROUPING_BLOCK_NAME',
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9549
    name
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9550
  };
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9551
}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9552
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9553
/**
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9554
 * Returns an action object used to set block categories.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9555
 * Ignored from documentation as the recommended usage for this action through setCategories from @wordpress/blocks.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9556
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9557
 * @ignore
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9558
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9559
 * @param {WPBlockCategory[]} categories Block categories.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9560
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9561
 * @return {Object} Action object.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9562
 */
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9563
function setCategories(categories) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9564
  return {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9565
    type: 'SET_CATEGORIES',
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9566
    categories
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9567
  };
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9568
}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9569
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9570
/**
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9571
 * Returns an action object used to update a category.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9572
 * Ignored from documentation as the recommended usage for this action through updateCategory from @wordpress/blocks.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9573
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9574
 * @ignore
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9575
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9576
 * @param {string} slug     Block category slug.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9577
 * @param {Object} category Object containing the category properties that should be updated.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9578
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9579
 * @return {Object} Action object.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9580
 */
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9581
function updateCategory(slug, category) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9582
  return {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9583
    type: 'UPDATE_CATEGORY',
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9584
    slug,
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9585
    category
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9586
  };
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9587
}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9588
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9589
/**
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9590
 * Returns an action object used to add block collections
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9591
 * Ignored from documentation as the recommended usage for this action through registerBlockCollection from @wordpress/blocks.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9592
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9593
 * @ignore
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9594
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9595
 * @param {string} namespace The namespace of the blocks to put in the collection
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9596
 * @param {string} title     The title to display in the block inserter
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9597
 * @param {Object} icon      (optional) The icon to display in the block inserter
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9598
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9599
 * @return {Object} Action object.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9600
 */
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9601
function addBlockCollection(namespace, title, icon) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9602
  return {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9603
    type: 'ADD_BLOCK_COLLECTION',
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9604
    namespace,
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9605
    title,
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9606
    icon
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9607
  };
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9608
}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9609
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9610
/**
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9611
 * Returns an action object used to remove block collections
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9612
 * Ignored from documentation as the recommended usage for this action through unregisterBlockCollection from @wordpress/blocks.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9613
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9614
 * @ignore
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9615
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9616
 * @param {string} namespace The namespace of the blocks to put in the collection
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9617
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9618
 * @return {Object} Action object.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9619
 */
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9620
function removeBlockCollection(namespace) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9621
  return {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9622
    type: 'REMOVE_BLOCK_COLLECTION',
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9623
    namespace
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9624
  };
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9625
}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9626
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9627
;// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/store/private-actions.js
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9628
/**
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9629
 * Internal dependencies
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9630
 */
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9631
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9632
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9633
/** @typedef {import('../api/registration').WPBlockType} WPBlockType */
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9634
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9635
/**
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9636
 * Add bootstrapped block type metadata to the store. These metadata usually come from
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9637
 * the `block.json` file and are either statically boostrapped from the server, or
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9638
 * passed as the `metadata` parameter to the `registerBlockType` function.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9639
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9640
 * @param {string}      name      Block name.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9641
 * @param {WPBlockType} blockType Block type metadata.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9642
 */
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9643
function addBootstrappedBlockType(name, blockType) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9644
  return {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9645
    type: 'ADD_BOOTSTRAPPED_BLOCK_TYPE',
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9646
    name,
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9647
    blockType
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9648
  };
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9649
}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9650
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9651
/**
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9652
 * Add unprocessed block type settings to the store. These data are passed as the
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9653
 * `settings` parameter to the client-side `registerBlockType` function.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9654
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9655
 * @param {string}      name      Block name.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9656
 * @param {WPBlockType} blockType Unprocessed block type settings.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9657
 */
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9658
function addUnprocessedBlockType(name, blockType) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9659
  return ({
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9660
    dispatch
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9661
  }) => {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9662
    dispatch({
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9663
      type: 'ADD_UNPROCESSED_BLOCK_TYPE',
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9664
      name,
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9665
      blockType
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9666
    });
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9667
    const processedBlockType = dispatch(processBlockType(name, blockType));
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9668
    if (!processedBlockType) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9669
      return;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9670
    }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9671
    dispatch.addBlockTypes(processedBlockType);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9672
  };
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9673
}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9674
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9675
/**
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9676
 * Register new block bindings source.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9677
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9678
 * @param {string} source Name of the source to register.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9679
 */
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9680
function registerBlockBindingsSource(source) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9681
  return {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9682
    type: 'REGISTER_BLOCK_BINDINGS_SOURCE',
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9683
    sourceName: source.name,
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9684
    sourceLabel: source.label,
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9685
    getValue: source.getValue,
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9686
    setValue: source.setValue,
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9687
    setValues: source.setValues,
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9688
    getPlaceholder: source.getPlaceholder,
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9689
    canUserEditValue: source.canUserEditValue
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9690
  };
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9691
}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9692
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9693
;// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/store/constants.js
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9694
const STORE_NAME = 'core/blocks';
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9695
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9696
;// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/store/index.js
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9697
/**
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9698
 * WordPress dependencies
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9699
 */
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9700
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9701
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9702
/**
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9703
 * Internal dependencies
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9704
 */
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9705
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9706
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9707
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9708
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9709
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9710
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9711
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9712
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9713
/**
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9714
 * Store definition for the blocks namespace.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9715
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9716
 * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9717
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9718
 * @type {Object}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9719
 */
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9720
const store = (0,external_wp_data_namespaceObject.createReduxStore)(STORE_NAME, {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9721
  reducer: reducer,
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9722
  selectors: selectors_namespaceObject,
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9723
  actions: actions_namespaceObject
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9724
});
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9725
(0,external_wp_data_namespaceObject.register)(store);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9726
unlock(store).registerPrivateSelectors(private_selectors_namespaceObject);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9727
unlock(store).registerPrivateActions(private_actions_namespaceObject);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9728
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9729
;// CONCATENATED MODULE: ./node_modules/uuid/dist/esm-browser/native.js
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9730
const randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9731
/* harmony default export */ const esm_browser_native = ({
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9732
  randomUUID
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9733
});
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9734
;// CONCATENATED MODULE: ./node_modules/uuid/dist/esm-browser/rng.js
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9735
// Unique ID creation requires a high quality random # generator. In the browser we therefore
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9736
// require the crypto API and do not support built-in fallback to lower quality random number
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9737
// generators (like Math.random()).
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9738
let getRandomValues;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9739
const rnds8 = new Uint8Array(16);
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9740
function rng() {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9741
  // lazy load so that environments that need to polyfill have a chance to do so
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9742
  if (!getRandomValues) {
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9743
    // getRandomValues needs to be invoked in a context where "this" is a Crypto implementation.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9744
    getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto);
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9745
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9746
    if (!getRandomValues) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9747
      throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9748
    }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9749
  }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9750
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9751
  return getRandomValues(rnds8);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9752
}
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9753
;// CONCATENATED MODULE: ./node_modules/uuid/dist/esm-browser/stringify.js
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9754
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9755
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9756
 * Convert array of 16 byte values to UUID string format of the form:
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9757
 * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9758
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9759
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9760
const byteToHex = [];
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9761
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9762
for (let i = 0; i < 256; ++i) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9763
  byteToHex.push((i + 0x100).toString(16).slice(1));
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9764
}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9765
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9766
function unsafeStringify(arr, offset = 0) {
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9767
  // Note: Be careful editing this code!  It's been tuned for performance
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9768
  // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9769
  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]];
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9770
}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9771
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9772
function stringify(arr, offset = 0) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9773
  const uuid = unsafeStringify(arr, offset); // Consistency check for valid UUID.  If this throws, it's likely due to one
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9774
  // of the following:
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9775
  // - One or more input array values don't map to a hex octet (leading to
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9776
  // "undefined" in the uuid)
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9777
  // - Invalid input values for the RFC `version` or `variant` fields
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9778
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9779
  if (!validate(uuid)) {
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9780
    throw TypeError('Stringified UUID is invalid');
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9781
  }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9782
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9783
  return uuid;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9784
}
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9785
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9786
/* harmony default export */ const esm_browser_stringify = ((/* unused pure expression or super */ null && (stringify)));
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9787
;// CONCATENATED MODULE: ./node_modules/uuid/dist/esm-browser/v4.js
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9788
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9789
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9790
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9791
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9792
function v4(options, buf, offset) {
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9793
  if (esm_browser_native.randomUUID && !buf && !options) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9794
    return esm_browser_native.randomUUID();
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9795
  }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9796
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9797
  options = options || {};
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9798
  const rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9799
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9800
  rnds[6] = rnds[6] & 0x0f | 0x40;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9801
  rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9802
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9803
  if (buf) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9804
    offset = offset || 0;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9805
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9806
    for (let i = 0; i < 16; ++i) {
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9807
      buf[offset + i] = rnds[i];
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9808
    }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9809
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9810
    return buf;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9811
  }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9812
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9813
  return unsafeStringify(rnds);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9814
}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9815
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9816
/* harmony default export */ const esm_browser_v4 = (v4);
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9817
;// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/factory.js
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9818
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9819
 * External dependencies
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9820
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9821
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9822
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9823
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9824
 * WordPress dependencies
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9825
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9826
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9827
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9828
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9829
 * Internal dependencies
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9830
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9831
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9832
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9833
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9834
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9835
 * Returns a block object given its type and attributes.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9836
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9837
 * @param {string} name        Block name.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9838
 * @param {Object} attributes  Block attributes.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9839
 * @param {?Array} innerBlocks Nested blocks.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9840
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9841
 * @return {Object} Block object.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9842
 */
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9843
function createBlock(name, attributes = {}, innerBlocks = []) {
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9844
  const sanitizedAttributes = __experimentalSanitizeBlockAttributes(name, attributes);
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9845
  const clientId = esm_browser_v4();
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9846
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9847
  // Blocks are stored with a unique ID, the assigned type name, the block
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9848
  // attributes, and their inner blocks.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9849
  return {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9850
    clientId,
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9851
    name,
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9852
    isValid: true,
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9853
    attributes: sanitizedAttributes,
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9854
    innerBlocks
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9855
  };
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9856
}
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9857
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9858
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9859
 * Given an array of InnerBlocks templates or Block Objects,
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9860
 * returns an array of created Blocks from them.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9861
 * It handles the case of having InnerBlocks as Blocks by
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9862
 * converting them to the proper format to continue recursively.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9863
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9864
 * @param {Array} innerBlocksOrTemplate Nested blocks or InnerBlocks templates.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9865
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9866
 * @return {Object[]} Array of Block objects.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9867
 */
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9868
function createBlocksFromInnerBlocksTemplate(innerBlocksOrTemplate = []) {
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9869
  return innerBlocksOrTemplate.map(innerBlock => {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9870
    const innerBlockTemplate = Array.isArray(innerBlock) ? innerBlock : [innerBlock.name, innerBlock.attributes, innerBlock.innerBlocks];
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9871
    const [name, attributes, innerBlocks = []] = innerBlockTemplate;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9872
    return createBlock(name, attributes, createBlocksFromInnerBlocksTemplate(innerBlocks));
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9873
  });
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9874
}
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9875
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9876
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9877
 * Given a block object, returns a copy of the block object while sanitizing its attributes,
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9878
 * optionally merging new attributes and/or replacing its inner blocks.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9879
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9880
 * @param {Object} block           Block instance.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9881
 * @param {Object} mergeAttributes Block attributes.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9882
 * @param {?Array} newInnerBlocks  Nested blocks.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9883
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9884
 * @return {Object} A cloned block.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9885
 */
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9886
function __experimentalCloneSanitizedBlock(block, mergeAttributes = {}, newInnerBlocks) {
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9887
  const clientId = esm_browser_v4();
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9888
  const sanitizedAttributes = __experimentalSanitizeBlockAttributes(block.name, {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9889
    ...block.attributes,
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9890
    ...mergeAttributes
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9891
  });
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9892
  return {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9893
    ...block,
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9894
    clientId,
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9895
    attributes: sanitizedAttributes,
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9896
    innerBlocks: newInnerBlocks || block.innerBlocks.map(innerBlock => __experimentalCloneSanitizedBlock(innerBlock))
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9897
  };
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9898
}
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9899
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9900
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9901
 * Given a block object, returns a copy of the block object,
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9902
 * optionally merging new attributes and/or replacing its inner blocks.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9903
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9904
 * @param {Object} block           Block instance.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9905
 * @param {Object} mergeAttributes Block attributes.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9906
 * @param {?Array} newInnerBlocks  Nested blocks.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9907
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9908
 * @return {Object} A cloned block.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9909
 */
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9910
function cloneBlock(block, mergeAttributes = {}, newInnerBlocks) {
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9911
  const clientId = esm_browser_v4();
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9912
  return {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9913
    ...block,
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9914
    clientId,
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9915
    attributes: {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9916
      ...block.attributes,
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9917
      ...mergeAttributes
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9918
    },
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9919
    innerBlocks: newInnerBlocks || block.innerBlocks.map(innerBlock => cloneBlock(innerBlock))
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9920
  };
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9921
}
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9922
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9923
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9924
 * Returns a boolean indicating whether a transform is possible based on
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9925
 * various bits of context.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9926
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9927
 * @param {Object} transform The transform object to validate.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9928
 * @param {string} direction Is this a 'from' or 'to' transform.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9929
 * @param {Array}  blocks    The blocks to transform from.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9930
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9931
 * @return {boolean} Is the transform possible?
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9932
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9933
const isPossibleTransformForSource = (transform, direction, blocks) => {
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9934
  if (!blocks.length) {
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9935
    return false;
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9936
  }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9937
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9938
  // If multiple blocks are selected, only multi block transforms
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9939
  // or wildcard transforms are allowed.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9940
  const isMultiBlock = blocks.length > 1;
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9941
  const firstBlockName = blocks[0].name;
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9942
  const isValidForMultiBlocks = isWildcardBlockTransform(transform) || !isMultiBlock || transform.isMultiBlock;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9943
  if (!isValidForMultiBlocks) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9944
    return false;
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9945
  }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9946
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9947
  // Check non-wildcard transforms to ensure that transform is valid
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9948
  // for a block selection of multiple blocks of different types.
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9949
  if (!isWildcardBlockTransform(transform) && !blocks.every(block => block.name === firstBlockName)) {
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9950
    return false;
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9951
  }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9952
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9953
  // Only consider 'block' type transforms as valid.
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9954
  const isBlockType = transform.type === 'block';
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9955
  if (!isBlockType) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9956
    return false;
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9957
  }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9958
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9959
  // Check if the transform's block name matches the source block (or is a wildcard)
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9960
  // only if this is a transform 'from'.
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9961
  const sourceBlock = blocks[0];
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9962
  const hasMatchingName = direction !== 'from' || transform.blocks.indexOf(sourceBlock.name) !== -1 || isWildcardBlockTransform(transform);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9963
  if (!hasMatchingName) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9964
    return false;
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9965
  }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9966
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9967
  // Don't allow single Grouping blocks to be transformed into
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9968
  // a Grouping block.
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9969
  if (!isMultiBlock && direction === 'from' && isContainerGroupBlock(sourceBlock.name) && isContainerGroupBlock(transform.blockName)) {
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9970
    return false;
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9971
  }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9972
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9973
  // If the transform has a `isMatch` function specified, check that it returns true.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9974
  if (!maybeCheckTransformIsMatch(transform, blocks)) {
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9975
    return false;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9976
  }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9977
  return true;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9978
};
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9979
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9980
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9981
 * Returns block types that the 'blocks' can be transformed into, based on
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9982
 * 'from' transforms on other blocks.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9983
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9984
 * @param {Array} blocks The blocks to transform from.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9985
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9986
 * @return {Array} Block types that the blocks can be transformed into.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9987
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9988
const getBlockTypesForPossibleFromTransforms = blocks => {
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9989
  if (!blocks.length) {
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9990
    return [];
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9991
  }
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9992
  const allBlockTypes = getBlockTypes();
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9993
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9994
  // filter all blocks to find those with a 'from' transform.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
  9995
  const blockTypesWithPossibleFromTransforms = allBlockTypes.filter(blockType => {
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9996
    const fromTransforms = getBlockTransforms('from', blockType.name);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9997
    return !!findTransform(fromTransforms, transform => {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9998
      return isPossibleTransformForSource(transform, 'from', blocks);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  9999
    });
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10000
  });
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10001
  return blockTypesWithPossibleFromTransforms;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10002
};
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10003
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10004
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10005
 * Returns block types that the 'blocks' can be transformed into, based on
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10006
 * the source block's own 'to' transforms.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10007
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10008
 * @param {Array} blocks The blocks to transform from.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10009
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10010
 * @return {Array} Block types that the source can be transformed into.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10011
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10012
const getBlockTypesForPossibleToTransforms = blocks => {
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10013
  if (!blocks.length) {
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10014
    return [];
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10015
  }
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10016
  const sourceBlock = blocks[0];
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10017
  const blockType = getBlockType(sourceBlock.name);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10018
  const transformsTo = blockType ? getBlockTransforms('to', blockType.name) : [];
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10019
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10020
  // filter all 'to' transforms to find those that are possible.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10021
  const possibleTransforms = transformsTo.filter(transform => {
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10022
    return transform && isPossibleTransformForSource(transform, 'to', blocks);
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10023
  });
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10024
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10025
  // Build a list of block names using the possible 'to' transforms.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10026
  const blockNames = possibleTransforms.map(transformation => transformation.blocks).flat();
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10027
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10028
  // Map block names to block types.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10029
  return blockNames.map(getBlockType);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10030
};
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10031
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10032
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10033
 * Determines whether transform is a "block" type
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10034
 * and if so whether it is a "wildcard" transform
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10035
 * ie: targets "any" block type
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10036
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10037
 * @param {Object} t the Block transform object
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10038
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10039
 * @return {boolean} whether transform is a wildcard transform
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10040
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10041
const isWildcardBlockTransform = t => t && t.type === 'block' && Array.isArray(t.blocks) && t.blocks.includes('*');
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10042
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10043
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10044
 * Determines whether the given Block is the core Block which
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10045
 * acts as a container Block for other Blocks as part of the
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10046
 * Grouping mechanics
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10047
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10048
 * @param {string} name the name of the Block to test against
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10049
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10050
 * @return {boolean} whether or not the Block is the container Block type
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10051
 */
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10052
const isContainerGroupBlock = name => name === getGroupingBlockName();
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10053
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10054
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10055
 * Returns an array of block types that the set of blocks received as argument
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10056
 * can be transformed into.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10057
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10058
 * @param {Array} blocks Blocks array.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10059
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10060
 * @return {Array} Block types that the blocks argument can be transformed to.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10061
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10062
function getPossibleBlockTransformations(blocks) {
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10063
  if (!blocks.length) {
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10064
    return [];
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10065
  }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10066
  const blockTypesForFromTransforms = getBlockTypesForPossibleFromTransforms(blocks);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10067
  const blockTypesForToTransforms = getBlockTypesForPossibleToTransforms(blocks);
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10068
  return [...new Set([...blockTypesForFromTransforms, ...blockTypesForToTransforms])];
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10069
}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10070
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10071
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10072
 * Given an array of transforms, returns the highest-priority transform where
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10073
 * the predicate function returns a truthy value. A higher-priority transform
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10074
 * is one with a lower priority value (i.e. first in priority order). Returns
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10075
 * null if the transforms set is empty or the predicate function returns a
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10076
 * falsey value for all entries.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10077
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10078
 * @param {Object[]} transforms Transforms to search.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10079
 * @param {Function} predicate  Function returning true on matching transform.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10080
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10081
 * @return {?Object} Highest-priority transform candidate.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10082
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10083
function findTransform(transforms, predicate) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10084
  // The hooks library already has built-in mechanisms for managing priority
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10085
  // queue, so leverage via locally-defined instance.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10086
  const hooks = (0,external_wp_hooks_namespaceObject.createHooks)();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10087
  for (let i = 0; i < transforms.length; i++) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10088
    const candidate = transforms[i];
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10089
    if (predicate(candidate)) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10090
      hooks.addFilter('transform', 'transform/' + i.toString(), result => result ? result : candidate, candidate.priority);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10091
    }
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10092
  }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10093
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10094
  // Filter name is arbitrarily chosen but consistent with above aggregation.
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10095
  return hooks.applyFilters('transform', null);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10096
}
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10097
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10098
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10099
 * Returns normal block transforms for a given transform direction, optionally
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10100
 * for a specific block by name, or an empty array if there are no transforms.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10101
 * If no block name is provided, returns transforms for all blocks. A normal
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10102
 * transform object includes `blockName` as a property.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10103
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10104
 * @param {string}        direction       Transform direction ("to", "from").
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10105
 * @param {string|Object} blockTypeOrName Block type or name.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10106
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10107
 * @return {Array} Block transforms for direction.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10108
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10109
function getBlockTransforms(direction, blockTypeOrName) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10110
  // When retrieving transforms for all block types, recurse into self.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10111
  if (blockTypeOrName === undefined) {
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10112
    return getBlockTypes().map(({
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10113
      name
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10114
    }) => getBlockTransforms(direction, name)).flat();
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10115
  }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10116
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10117
  // Validate that block type exists and has array of direction.
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10118
  const blockType = normalizeBlockType(blockTypeOrName);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10119
  const {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10120
    name: blockName,
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10121
    transforms
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10122
  } = blockType || {};
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10123
  if (!transforms || !Array.isArray(transforms[direction])) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10124
    return [];
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10125
  }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10126
  const usingMobileTransformations = transforms.supportedMobileTransforms && Array.isArray(transforms.supportedMobileTransforms);
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10127
  const filteredTransforms = usingMobileTransformations ? transforms[direction].filter(t => {
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10128
    if (t.type === 'raw') {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10129
      return true;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10130
    }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10131
    if (!t.blocks || !t.blocks.length) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10132
      return false;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10133
    }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10134
    if (isWildcardBlockTransform(t)) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10135
      return true;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10136
    }
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10137
    return t.blocks.every(transformBlockName => transforms.supportedMobileTransforms.includes(transformBlockName));
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10138
  }) : transforms[direction];
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10139
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10140
  // Map transforms to normal form.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10141
  return filteredTransforms.map(transform => ({
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10142
    ...transform,
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10143
    blockName,
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10144
    usingMobileTransformations
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10145
  }));
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10146
}
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10147
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10148
/**
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10149
 * Checks that a given transforms isMatch method passes for given source blocks.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10150
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10151
 * @param {Object} transform A transform object.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10152
 * @param {Array}  blocks    Blocks array.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10153
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10154
 * @return {boolean} True if given blocks are a match for the transform.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10155
 */
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10156
function maybeCheckTransformIsMatch(transform, blocks) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10157
  if (typeof transform.isMatch !== 'function') {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10158
    return true;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10159
  }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10160
  const sourceBlock = blocks[0];
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10161
  const attributes = transform.isMultiBlock ? blocks.map(block => block.attributes) : sourceBlock.attributes;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10162
  const block = transform.isMultiBlock ? blocks : sourceBlock;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10163
  return transform.isMatch(attributes, block);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10164
}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10165
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10166
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10167
 * Switch one or more blocks into one or more blocks of the new block type.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10168
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10169
 * @param {Array|Object} blocks Blocks array or block object.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10170
 * @param {string}       name   Block name.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10171
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10172
 * @return {?Array} Array of blocks or null.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10173
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10174
function switchToBlockType(blocks, name) {
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10175
  const blocksArray = Array.isArray(blocks) ? blocks : [blocks];
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10176
  const isMultiBlock = blocksArray.length > 1;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10177
  const firstBlock = blocksArray[0];
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10178
  const sourceName = firstBlock.name;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10179
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10180
  // Find the right transformation by giving priority to the "to"
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10181
  // transformation.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10182
  const transformationsFrom = getBlockTransforms('from', name);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10183
  const transformationsTo = getBlockTransforms('to', sourceName);
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10184
  const transformation = findTransform(transformationsTo, t => t.type === 'block' && (isWildcardBlockTransform(t) || t.blocks.indexOf(name) !== -1) && (!isMultiBlock || t.isMultiBlock) && maybeCheckTransformIsMatch(t, blocksArray)) || findTransform(transformationsFrom, t => t.type === 'block' && (isWildcardBlockTransform(t) || t.blocks.indexOf(sourceName) !== -1) && (!isMultiBlock || t.isMultiBlock) && maybeCheckTransformIsMatch(t, blocksArray));
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10185
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10186
  // Stop if there is no valid transformation.
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10187
  if (!transformation) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10188
    return null;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10189
  }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10190
  let transformationResults;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10191
  if (transformation.isMultiBlock) {
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10192
    if ('__experimentalConvert' in transformation) {
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10193
      transformationResults = transformation.__experimentalConvert(blocksArray);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10194
    } else {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10195
      transformationResults = transformation.transform(blocksArray.map(currentBlock => currentBlock.attributes), blocksArray.map(currentBlock => currentBlock.innerBlocks));
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10196
    }
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10197
  } else if ('__experimentalConvert' in transformation) {
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10198
    transformationResults = transformation.__experimentalConvert(firstBlock);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10199
  } else {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10200
    transformationResults = transformation.transform(firstBlock.attributes, firstBlock.innerBlocks);
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10201
  }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10202
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10203
  // Ensure that the transformation function returned an object or an array
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10204
  // of objects.
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10205
  if (transformationResults === null || typeof transformationResults !== 'object') {
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10206
    return null;
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10207
  }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10208
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10209
  // If the transformation function returned a single object, we want to work
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10210
  // with an array instead.
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10211
  transformationResults = Array.isArray(transformationResults) ? transformationResults : [transformationResults];
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10212
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10213
  // Ensure that every block object returned by the transformation has a
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10214
  // valid block type.
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10215
  if (transformationResults.some(result => !getBlockType(result.name))) {
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10216
    return null;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10217
  }
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10218
  const hasSwitchedBlock = transformationResults.some(result => result.name === name);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10219
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10220
  // Ensure that at least one block object returned by the transformation has
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10221
  // the expected "destination" block type.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10222
  if (!hasSwitchedBlock) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10223
    return null;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10224
  }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10225
  const ret = transformationResults.map((result, index, results) => {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10226
    /**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10227
     * Filters an individual transform result from block transformation.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10228
     * All of the original blocks are passed, since transformations are
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10229
     * many-to-many, not one-to-one.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10230
     *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10231
     * @param {Object}   transformedBlock The transformed block.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10232
     * @param {Object[]} blocks           Original blocks transformed.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10233
     * @param {Object[]} index            Index of the transformed block on the array of results.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10234
     * @param {Object[]} results          An array all the blocks that resulted from the transformation.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10235
     */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10236
    return (0,external_wp_hooks_namespaceObject.applyFilters)('blocks.switchToBlockType.transformedBlock', result, blocks, index, results);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10237
  });
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10238
  return ret;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10239
}
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10240
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10241
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10242
 * Create a block object from the example API.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10243
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10244
 * @param {string} name
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10245
 * @param {Object} example
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10246
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10247
 * @return {Object} block.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10248
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10249
const getBlockFromExample = (name, example) => {
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10250
  try {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10251
    var _example$innerBlocks;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10252
    return createBlock(name, example.attributes, ((_example$innerBlocks = example.innerBlocks) !== null && _example$innerBlocks !== void 0 ? _example$innerBlocks : []).map(innerBlock => getBlockFromExample(innerBlock.name, innerBlock)));
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10253
  } catch {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10254
    return createBlock('core/missing', {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10255
      originalName: name,
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10256
      originalContent: '',
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10257
      originalUndelimitedContent: ''
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10258
    });
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10259
  }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10260
};
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10261
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10262
;// CONCATENATED MODULE: external ["wp","blockSerializationDefaultParser"]
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10263
const external_wp_blockSerializationDefaultParser_namespaceObject = window["wp"]["blockSerializationDefaultParser"];
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10264
;// CONCATENATED MODULE: external ["wp","autop"]
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10265
const external_wp_autop_namespaceObject = window["wp"]["autop"];
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10266
;// CONCATENATED MODULE: external ["wp","isShallowEqual"]
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10267
const external_wp_isShallowEqual_namespaceObject = window["wp"]["isShallowEqual"];
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10268
var external_wp_isShallowEqual_default = /*#__PURE__*/__webpack_require__.n(external_wp_isShallowEqual_namespaceObject);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10269
;// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/parser/serialize-raw-block.js
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10270
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10271
 * Internal dependencies
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10272
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10273
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10274
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10275
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10276
 * @typedef {Object}   Options                   Serialization options.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10277
 * @property {boolean} [isCommentDelimited=true] Whether to output HTML comments around blocks.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10278
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10279
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10280
/** @typedef {import("./").WPRawBlock} WPRawBlock */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10281
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10282
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10283
 * Serializes a block node into the native HTML-comment-powered block format.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10284
 * CAVEAT: This function is intended for re-serializing blocks as parsed by
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10285
 * valid parsers and skips any validation steps. This is NOT a generic
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10286
 * serialization function for in-memory blocks. For most purposes, see the
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10287
 * following functions available in the `@wordpress/blocks` package:
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10288
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10289
 * @see serializeBlock
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10290
 * @see serialize
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10291
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10292
 * For more on the format of block nodes as returned by valid parsers:
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10293
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10294
 * @see `@wordpress/block-serialization-default-parser` package
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10295
 * @see `@wordpress/block-serialization-spec-parser` package
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10296
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10297
 * @param {WPRawBlock} rawBlock     A block node as returned by a valid parser.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10298
 * @param {Options}    [options={}] Serialization options.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10299
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10300
 * @return {string} An HTML string representing a block.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10301
 */
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10302
function serializeRawBlock(rawBlock, options = {}) {
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10303
  const {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10304
    isCommentDelimited = true
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10305
  } = options;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10306
  const {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10307
    blockName,
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10308
    attrs = {},
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10309
    innerBlocks = [],
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10310
    innerContent = []
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10311
  } = rawBlock;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10312
  let childIndex = 0;
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10313
  const content = innerContent.map(item =>
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10314
  // `null` denotes a nested block, otherwise we have an HTML fragment.
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10315
  item !== null ? item : serializeRawBlock(innerBlocks[childIndex++], options)).join('\n').replace(/\n+/g, '\n').trim();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10316
  return isCommentDelimited ? getCommentDelimitedContent(blockName, attrs, content) : content;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10317
}
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10318
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10319
;// CONCATENATED MODULE: external "ReactJSXRuntime"
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10320
const external_ReactJSXRuntime_namespaceObject = window["ReactJSXRuntime"];
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10321
;// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/serializer.js
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10322
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10323
 * WordPress dependencies
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10324
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10325
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10326
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10327
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10328
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10329
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10330
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10331
 * Internal dependencies
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10332
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10333
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10334
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10335
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10336
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10337
/** @typedef {import('./parser').WPBlock} WPBlock */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10338
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10339
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10340
 * @typedef {Object} WPBlockSerializationOptions Serialization Options.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10341
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10342
 * @property {boolean} isInnerBlocks Whether we are serializing inner blocks.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10343
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10344
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10345
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10346
 * Returns the block's default classname from its name.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10347
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10348
 * @param {string} blockName The block name.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10349
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10350
 * @return {string} The block's default class.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10351
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10352
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10353
function getBlockDefaultClassName(blockName) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10354
  // Generated HTML classes for blocks follow the `wp-block-{name}` nomenclature.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10355
  // Blocks provided by WordPress drop the prefixes 'core/' or 'core-' (historically used in 'core-embed/').
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10356
  const className = 'wp-block-' + blockName.replace(/\//, '-').replace(/^core-/, '');
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10357
  return (0,external_wp_hooks_namespaceObject.applyFilters)('blocks.getBlockDefaultClassName', className, blockName);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10358
}
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10359
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10360
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10361
 * Returns the block's default menu item classname from its name.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10362
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10363
 * @param {string} blockName The block name.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10364
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10365
 * @return {string} The block's default menu item class.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10366
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10367
function getBlockMenuDefaultClassName(blockName) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10368
  // Generated HTML classes for blocks follow the `editor-block-list-item-{name}` nomenclature.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10369
  // Blocks provided by WordPress drop the prefixes 'core/' or 'core-' (historically used in 'core-embed/').
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10370
  const className = 'editor-block-list-item-' + blockName.replace(/\//, '-').replace(/^core-/, '');
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10371
  return (0,external_wp_hooks_namespaceObject.applyFilters)('blocks.getBlockMenuDefaultClassName', className, blockName);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10372
}
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10373
const blockPropsProvider = {};
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10374
const innerBlocksPropsProvider = {};
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10375
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10376
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10377
 * Call within a save function to get the props for the block wrapper.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10378
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10379
 * @param {Object} props Optional. Props to pass to the element.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10380
 */
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10381
function getBlockProps(props = {}) {
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10382
  const {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10383
    blockType,
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10384
    attributes
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10385
  } = blockPropsProvider;
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10386
  return getBlockProps.skipFilters ? props : (0,external_wp_hooks_namespaceObject.applyFilters)('blocks.getSaveContent.extraProps', {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10387
    ...props
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10388
  }, blockType, attributes);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10389
}
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10390
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10391
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10392
 * Call within a save function to get the props for the inner blocks wrapper.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10393
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10394
 * @param {Object} props Optional. Props to pass to the element.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10395
 */
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10396
function getInnerBlocksProps(props = {}) {
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10397
  const {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10398
    innerBlocks
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10399
  } = innerBlocksPropsProvider;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10400
  // Allow a different component to be passed to getSaveElement to handle
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10401
  // inner blocks, bypassing the default serialisation.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10402
  if (!Array.isArray(innerBlocks)) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10403
    return {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10404
      ...props,
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10405
      children: innerBlocks
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10406
    };
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10407
  }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10408
  // Value is an array of blocks, so defer to block serializer.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10409
  const html = serialize(innerBlocks, {
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10410
    isInnerBlocks: true
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10411
  });
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10412
  // Use special-cased raw HTML tag to avoid default escaping.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10413
  const children = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_element_namespaceObject.RawHTML, {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10414
    children: html
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10415
  });
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10416
  return {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10417
    ...props,
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10418
    children
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10419
  };
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10420
}
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10421
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10422
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10423
 * Given a block type containing a save render implementation and attributes, returns the
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10424
 * enhanced element to be saved or string when raw HTML expected.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10425
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10426
 * @param {string|Object} blockTypeOrName Block type or name.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10427
 * @param {Object}        attributes      Block attributes.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10428
 * @param {?Array}        innerBlocks     Nested blocks.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10429
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10430
 * @return {Object|string} Save element or raw HTML string.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10431
 */
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10432
function getSaveElement(blockTypeOrName, attributes, innerBlocks = []) {
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10433
  const blockType = normalizeBlockType(blockTypeOrName);
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10434
  if (!blockType?.save) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10435
    return null;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10436
  }
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10437
  let {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10438
    save
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10439
  } = blockType;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10440
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10441
  // Component classes are unsupported for save since serialization must
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10442
  // occur synchronously. For improved interoperability with higher-order
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10443
  // components which often return component class, emulate basic support.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10444
  if (save.prototype instanceof external_wp_element_namespaceObject.Component) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10445
    const instance = new save({
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10446
      attributes
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10447
    });
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10448
    save = instance.render.bind(instance);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10449
  }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10450
  blockPropsProvider.blockType = blockType;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10451
  blockPropsProvider.attributes = attributes;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10452
  innerBlocksPropsProvider.innerBlocks = innerBlocks;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10453
  let element = save({
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10454
    attributes,
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10455
    innerBlocks
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10456
  });
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10457
  if (element !== null && typeof element === 'object' && (0,external_wp_hooks_namespaceObject.hasFilter)('blocks.getSaveContent.extraProps') && !(blockType.apiVersion > 1)) {
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10458
    /**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10459
     * Filters the props applied to the block save result element.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10460
     *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10461
     * @param {Object}  props      Props applied to save element.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10462
     * @param {WPBlock} blockType  Block type definition.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10463
     * @param {Object}  attributes Block attributes.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10464
     */
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10465
    const props = (0,external_wp_hooks_namespaceObject.applyFilters)('blocks.getSaveContent.extraProps', {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10466
      ...element.props
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10467
    }, blockType, attributes);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10468
    if (!external_wp_isShallowEqual_default()(props, element.props)) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10469
      element = (0,external_wp_element_namespaceObject.cloneElement)(element, props);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10470
    }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10471
  }
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10472
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10473
  /**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10474
   * Filters the save result of a block during serialization.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10475
   *
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10476
   * @param {Element} element    Block save result.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10477
   * @param {WPBlock} blockType  Block type definition.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10478
   * @param {Object}  attributes Block attributes.
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10479
   */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10480
  return (0,external_wp_hooks_namespaceObject.applyFilters)('blocks.getSaveElement', element, blockType, attributes);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10481
}
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10482
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10483
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10484
 * Given a block type containing a save render implementation and attributes, returns the
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10485
 * static markup to be saved.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10486
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10487
 * @param {string|Object} blockTypeOrName Block type or name.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10488
 * @param {Object}        attributes      Block attributes.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10489
 * @param {?Array}        innerBlocks     Nested blocks.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10490
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10491
 * @return {string} Save content.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10492
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10493
function getSaveContent(blockTypeOrName, attributes, innerBlocks) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10494
  const blockType = normalizeBlockType(blockTypeOrName);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10495
  return (0,external_wp_element_namespaceObject.renderToString)(getSaveElement(blockType, attributes, innerBlocks));
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10496
}
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10497
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10498
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10499
 * Returns attributes which are to be saved and serialized into the block
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10500
 * comment delimiter.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10501
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10502
 * When a block exists in memory it contains as its attributes both those
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10503
 * parsed the block comment delimiter _and_ those which matched from the
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10504
 * contents of the block.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10505
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10506
 * This function returns only those attributes which are needed to persist and
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10507
 * which cannot be matched from the block content.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10508
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10509
 * @param {Object<string,*>} blockType  Block type.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10510
 * @param {Object<string,*>} attributes Attributes from in-memory block data.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10511
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10512
 * @return {Object<string,*>} Subset of attributes for comment serialization.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10513
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10514
function getCommentAttributes(blockType, attributes) {
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10515
  var _blockType$attributes;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10516
  return Object.entries((_blockType$attributes = blockType.attributes) !== null && _blockType$attributes !== void 0 ? _blockType$attributes : {}).reduce((accumulator, [key, attributeSchema]) => {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10517
    const value = attributes[key];
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10518
    // Ignore undefined values.
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10519
    if (undefined === value) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10520
      return accumulator;
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10521
    }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10522
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10523
    // Ignore all attributes but the ones with an "undefined" source
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10524
    // "undefined" source refers to attributes saved in the block comment.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10525
    if (attributeSchema.source !== undefined) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10526
      return accumulator;
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10527
    }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10528
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10529
    // Ignore default value.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10530
    if ('default' in attributeSchema && JSON.stringify(attributeSchema.default) === JSON.stringify(value)) {
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10531
      return accumulator;
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10532
    }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10533
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10534
    // Otherwise, include in comment set.
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10535
    accumulator[key] = value;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10536
    return accumulator;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10537
  }, {});
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10538
}
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10539
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10540
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10541
 * Given an attributes object, returns a string in the serialized attributes
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10542
 * format prepared for post content.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10543
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10544
 * @param {Object} attributes Attributes object.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10545
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10546
 * @return {string} Serialized attributes.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10547
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10548
function serializeAttributes(attributes) {
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10549
  return JSON.stringify(attributes)
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10550
  // Don't break HTML comments.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10551
  .replace(/--/g, '\\u002d\\u002d')
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10552
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10553
  // Don't break non-standard-compliant tools.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10554
  .replace(/</g, '\\u003c').replace(/>/g, '\\u003e').replace(/&/g, '\\u0026')
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10555
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10556
  // Bypass server stripslashes behavior which would unescape stringify's
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10557
  // escaping of quotation mark.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10558
  //
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10559
  // See: https://developer.wordpress.org/reference/functions/wp_kses_stripslashes/
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10560
  .replace(/\\"/g, '\\u0022');
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10561
}
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10562
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10563
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10564
 * Given a block object, returns the Block's Inner HTML markup.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10565
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10566
 * @param {Object} block Block instance.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10567
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10568
 * @return {string} HTML.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10569
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10570
function getBlockInnerHTML(block) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10571
  // If block was parsed as invalid or encounters an error while generating
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10572
  // save content, use original content instead to avoid content loss. If a
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10573
  // block contains nested content, exempt it from this condition because we
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10574
  // otherwise have no access to its original content and content loss would
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10575
  // still occur.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10576
  let saveContent = block.originalContent;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10577
  if (block.isValid || block.innerBlocks.length) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10578
    try {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10579
      saveContent = getSaveContent(block.name, block.attributes, block.innerBlocks);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10580
    } catch (error) {}
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10581
  }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10582
  return saveContent;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10583
}
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10584
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10585
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10586
 * Returns the content of a block, including comment delimiters.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10587
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10588
 * @param {string} rawBlockName Block name.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10589
 * @param {Object} attributes   Block attributes.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10590
 * @param {string} content      Block save content.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10591
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10592
 * @return {string} Comment-delimited block content.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10593
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10594
function getCommentDelimitedContent(rawBlockName, attributes, content) {
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10595
  const serializedAttributes = attributes && Object.entries(attributes).length ? serializeAttributes(attributes) + ' ' : '';
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10596
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10597
  // Strip core blocks of their namespace prefix.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10598
  const blockName = rawBlockName?.startsWith('core/') ? rawBlockName.slice(5) : rawBlockName;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10599
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10600
  // @todo make the `wp:` prefix potentially configurable.
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10601
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10602
  if (!content) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10603
    return `<!-- wp:${blockName} ${serializedAttributes}/-->`;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10604
  }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10605
  return `<!-- wp:${blockName} ${serializedAttributes}-->\n` + content + `\n<!-- /wp:${blockName} -->`;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10606
}
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10607
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10608
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10609
 * Returns the content of a block, including comment delimiters, determining
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10610
 * serialized attributes and content form from the current state of the block.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10611
 *
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10612
 * @param {WPBlock}                     block   Block instance.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10613
 * @param {WPBlockSerializationOptions} options Serialization options.
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10614
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10615
 * @return {string} Serialized block.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10616
 */
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10617
function serializeBlock(block, {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10618
  isInnerBlocks = false
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10619
} = {}) {
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10620
  if (!block.isValid && block.__unstableBlockSource) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10621
    return serializeRawBlock(block.__unstableBlockSource);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10622
  }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10623
  const blockName = block.name;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10624
  const saveContent = getBlockInnerHTML(block);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10625
  if (blockName === getUnregisteredTypeHandlerName() || !isInnerBlocks && blockName === getFreeformContentHandlerName()) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10626
    return saveContent;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10627
  }
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10628
  const blockType = getBlockType(blockName);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10629
  if (!blockType) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10630
    return saveContent;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10631
  }
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10632
  const saveAttributes = getCommentAttributes(blockType, block.attributes);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10633
  return getCommentDelimitedContent(blockName, saveAttributes, saveContent);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10634
}
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10635
function __unstableSerializeAndClean(blocks) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10636
  // A single unmodified default block is assumed to
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10637
  // be equivalent to an empty post.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10638
  if (blocks.length === 1 && isUnmodifiedDefaultBlock(blocks[0])) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10639
    blocks = [];
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10640
  }
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10641
  let content = serialize(blocks);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10642
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10643
  // For compatibility, treat a post consisting of a
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10644
  // single freeform block as legacy content and apply
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10645
  // pre-block-editor removep'd content formatting.
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10646
  if (blocks.length === 1 && blocks[0].name === getFreeformContentHandlerName() && blocks[0].name === 'core/freeform') {
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10647
    content = (0,external_wp_autop_namespaceObject.removep)(content);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10648
  }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10649
  return content;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10650
}
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10651
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10652
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10653
 * Takes a block or set of blocks and returns the serialized post content.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10654
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10655
 * @param {Array}                       blocks  Block(s) to serialize.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10656
 * @param {WPBlockSerializationOptions} options Serialization options.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10657
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10658
 * @return {string} The post content.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10659
 */
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10660
function serialize(blocks, options) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10661
  const blocksArray = Array.isArray(blocks) ? blocks : [blocks];
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 10662
  return blocksArray.map(block => serializeBlock(block, options)).join('\n\n');
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10663
}
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10664
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10665
;// CONCATENATED MODULE: ./node_modules/simple-html-tokenizer/dist/es6/index.js
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10666
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10667
 * generated from https://raw.githubusercontent.com/w3c/html/26b5126f96f736f796b9e29718138919dd513744/entities.json
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10668
 * do not edit
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10669
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10670
var namedCharRefs = {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10671
    Aacute: "Á", aacute: "á", Abreve: "Ă", abreve: "ă", ac: "∾", acd: "∿", acE: "∾̳", Acirc: "Â", acirc: "â", acute: "´", Acy: "А", acy: "а", AElig: "Æ", aelig: "æ", af: "\u2061", Afr: "𝔄", afr: "𝔞", Agrave: "À", agrave: "à", alefsym: "ℵ", aleph: "ℵ", Alpha: "Α", alpha: "α", Amacr: "Ā", amacr: "ā", amalg: "⨿", amp: "&", AMP: "&", andand: "⩕", And: "⩓", and: "∧", andd: "⩜", andslope: "⩘", andv: "⩚", ang: "∠", ange: "⦤", angle: "∠", angmsdaa: "⦨", angmsdab: "⦩", angmsdac: "⦪", angmsdad: "⦫", angmsdae: "⦬", angmsdaf: "⦭", angmsdag: "⦮", angmsdah: "⦯", angmsd: "∡", angrt: "∟", angrtvb: "⊾", angrtvbd: "⦝", angsph: "∢", angst: "Å", angzarr: "⍼", Aogon: "Ą", aogon: "ą", Aopf: "𝔸", aopf: "𝕒", apacir: "⩯", ap: "≈", apE: "⩰", ape: "≊", apid: "≋", apos: "'", ApplyFunction: "\u2061", approx: "≈", approxeq: "≊", Aring: "Å", aring: "å", Ascr: "𝒜", ascr: "𝒶", Assign: "≔", ast: "*", asymp: "≈", asympeq: "≍", Atilde: "Ã", atilde: "ã", Auml: "Ä", auml: "ä", awconint: "∳", awint: "⨑", backcong: "≌", backepsilon: "϶", backprime: "‵", backsim: "∽", backsimeq: "⋍", Backslash: "∖", Barv: "⫧", barvee: "⊽", barwed: "⌅", Barwed: "⌆", barwedge: "⌅", bbrk: "⎵", bbrktbrk: "⎶", bcong: "≌", Bcy: "Б", bcy: "б", bdquo: "„", becaus: "∵", because: "∵", Because: "∵", bemptyv: "⦰", bepsi: "϶", bernou: "ℬ", Bernoullis: "ℬ", Beta: "Β", beta: "β", beth: "ℶ", between: "≬", Bfr: "𝔅", bfr: "𝔟", bigcap: "⋂", bigcirc: "◯", bigcup: "⋃", bigodot: "⨀", bigoplus: "⨁", bigotimes: "⨂", bigsqcup: "⨆", bigstar: "★", bigtriangledown: "▽", bigtriangleup: "△", biguplus: "⨄", bigvee: "⋁", bigwedge: "⋀", bkarow: "⤍", blacklozenge: "⧫", blacksquare: "▪", blacktriangle: "▴", blacktriangledown: "▾", blacktriangleleft: "◂", blacktriangleright: "▸", blank: "␣", blk12: "▒", blk14: "░", blk34: "▓", block: "█", bne: "=⃥", bnequiv: "≡⃥", bNot: "⫭", bnot: "⌐", Bopf: "𝔹", bopf: "𝕓", bot: "⊥", bottom: "⊥", bowtie: "⋈", boxbox: "⧉", boxdl: "┐", boxdL: "╕", boxDl: "╖", boxDL: "╗", boxdr: "┌", boxdR: "╒", boxDr: "╓", boxDR: "╔", boxh: "─", boxH: "═", boxhd: "┬", boxHd: "╤", boxhD: "╥", boxHD: "╦", boxhu: "┴", boxHu: "╧", boxhU: "╨", boxHU: "╩", boxminus: "⊟", boxplus: "⊞", boxtimes: "⊠", boxul: "┘", boxuL: "╛", boxUl: "╜", boxUL: "╝", boxur: "└", boxuR: "╘", boxUr: "╙", boxUR: "╚", boxv: "│", boxV: "║", boxvh: "┼", boxvH: "╪", boxVh: "╫", boxVH: "╬", boxvl: "┤", boxvL: "╡", boxVl: "╢", boxVL: "╣", boxvr: "├", boxvR: "╞", boxVr: "╟", boxVR: "╠", bprime: "‵", breve: "˘", Breve: "˘", brvbar: "¦", bscr: "𝒷", Bscr: "ℬ", bsemi: "⁏", bsim: "∽", bsime: "⋍", bsolb: "⧅", bsol: "\\", bsolhsub: "⟈", bull: "•", bullet: "•", bump: "≎", bumpE: "⪮", bumpe: "≏", Bumpeq: "≎", bumpeq: "≏", Cacute: "Ć", cacute: "ć", capand: "⩄", capbrcup: "⩉", capcap: "⩋", cap: "∩", Cap: "⋒", capcup: "⩇", capdot: "⩀", CapitalDifferentialD: "ⅅ", caps: "∩︀", caret: "⁁", caron: "ˇ", Cayleys: "ℭ", ccaps: "⩍", Ccaron: "Č", ccaron: "č", Ccedil: "Ç", ccedil: "ç", Ccirc: "Ĉ", ccirc: "ĉ", Cconint: "∰", ccups: "⩌", ccupssm: "⩐", Cdot: "Ċ", cdot: "ċ", cedil: "¸", Cedilla: "¸", cemptyv: "⦲", cent: "¢", centerdot: "·", CenterDot: "·", cfr: "𝔠", Cfr: "ℭ", CHcy: "Ч", chcy: "ч", check: "✓", checkmark: "✓", Chi: "Χ", chi: "χ", circ: "ˆ", circeq: "≗", circlearrowleft: "↺", circlearrowright: "↻", circledast: "⊛", circledcirc: "⊚", circleddash: "⊝", CircleDot: "⊙", circledR: "®", circledS: "Ⓢ", CircleMinus: "⊖", CirclePlus: "⊕", CircleTimes: "⊗", cir: "○", cirE: "⧃", cire: "≗", cirfnint: "⨐", cirmid: "⫯", cirscir: "⧂", ClockwiseContourIntegral: "∲", CloseCurlyDoubleQuote: "”", CloseCurlyQuote: "’", clubs: "♣", clubsuit: "♣", colon: ":", Colon: "∷", Colone: "⩴", colone: "≔", coloneq: "≔", comma: ",", commat: "@", comp: "∁", compfn: "∘", complement: "∁", complexes: "ℂ", cong: "≅", congdot: "⩭", Congruent: "≡", conint: "∮", Conint: "∯", ContourIntegral: "∮", copf: "𝕔", Copf: "ℂ", coprod: "∐", Coproduct: "∐", copy: "©", COPY: "©", copysr: "℗", CounterClockwiseContourIntegral: "∳", crarr: "↵", cross: "✗", Cross: "⨯", Cscr: "𝒞", cscr: "𝒸", csub: "⫏", csube: "⫑", csup: "⫐", csupe: "⫒", ctdot: "⋯", cudarrl: "⤸", cudarrr: "⤵", cuepr: "⋞", cuesc: "⋟", cularr: "↶", cularrp: "⤽", cupbrcap: "⩈", cupcap: "⩆", CupCap: "≍", cup: "∪", Cup: "⋓", cupcup: "⩊", cupdot: "⊍", cupor: "⩅", cups: "∪︀", curarr: "↷", curarrm: "⤼", curlyeqprec: "⋞", curlyeqsucc: "⋟", curlyvee: "⋎", curlywedge: "⋏", curren: "¤", curvearrowleft: "↶", curvearrowright: "↷", cuvee: "⋎", cuwed: "⋏", cwconint: "∲", cwint: "∱", cylcty: "⌭", dagger: "†", Dagger: "‡", daleth: "ℸ", darr: "↓", Darr: "↡", dArr: "⇓", dash: "‐", Dashv: "⫤", dashv: "⊣", dbkarow: "⤏", dblac: "˝", Dcaron: "Ď", dcaron: "ď", Dcy: "Д", dcy: "д", ddagger: "‡", ddarr: "⇊", DD: "ⅅ", dd: "ⅆ", DDotrahd: "⤑", ddotseq: "⩷", deg: "°", Del: "∇", Delta: "Δ", delta: "δ", demptyv: "⦱", dfisht: "⥿", Dfr: "𝔇", dfr: "𝔡", dHar: "⥥", dharl: "⇃", dharr: "⇂", DiacriticalAcute: "´", DiacriticalDot: "˙", DiacriticalDoubleAcute: "˝", DiacriticalGrave: "`", DiacriticalTilde: "˜", diam: "⋄", diamond: "⋄", Diamond: "⋄", diamondsuit: "♦", diams: "♦", die: "¨", DifferentialD: "ⅆ", digamma: "ϝ", disin: "⋲", div: "÷", divide: "÷", divideontimes: "⋇", divonx: "⋇", DJcy: "Ђ", djcy: "ђ", dlcorn: "⌞", dlcrop: "⌍", dollar: "$", Dopf: "𝔻", dopf: "𝕕", Dot: "¨", dot: "˙", DotDot: "⃜", doteq: "≐", doteqdot: "≑", DotEqual: "≐", dotminus: "∸", dotplus: "∔", dotsquare: "⊡", doublebarwedge: "⌆", DoubleContourIntegral: "∯", DoubleDot: "¨", DoubleDownArrow: "⇓", DoubleLeftArrow: "⇐", DoubleLeftRightArrow: "⇔", DoubleLeftTee: "⫤", DoubleLongLeftArrow: "⟸", DoubleLongLeftRightArrow: "⟺", DoubleLongRightArrow: "⟹", DoubleRightArrow: "⇒", DoubleRightTee: "⊨", DoubleUpArrow: "⇑", DoubleUpDownArrow: "⇕", DoubleVerticalBar: "∥", DownArrowBar: "⤓", downarrow: "↓", DownArrow: "↓", Downarrow: "⇓", DownArrowUpArrow: "⇵", DownBreve: "̑", downdownarrows: "⇊", downharpoonleft: "⇃", downharpoonright: "⇂", DownLeftRightVector: "⥐", DownLeftTeeVector: "⥞", DownLeftVectorBar: "⥖", DownLeftVector: "↽", DownRightTeeVector: "⥟", DownRightVectorBar: "⥗", DownRightVector: "⇁", DownTeeArrow: "↧", DownTee: "⊤", drbkarow: "⤐", drcorn: "⌟", drcrop: "⌌", Dscr: "𝒟", dscr: "𝒹", DScy: "Ѕ", dscy: "ѕ", dsol: "⧶", Dstrok: "Đ", dstrok: "đ", dtdot: "⋱", dtri: "▿", dtrif: "▾", duarr: "⇵", duhar: "⥯", dwangle: "⦦", DZcy: "Џ", dzcy: "џ", dzigrarr: "⟿", Eacute: "É", eacute: "é", easter: "⩮", Ecaron: "Ě", ecaron: "ě", Ecirc: "Ê", ecirc: "ê", ecir: "≖", ecolon: "≕", Ecy: "Э", ecy: "э", eDDot: "⩷", Edot: "Ė", edot: "ė", eDot: "≑", ee: "ⅇ", efDot: "≒", Efr: "𝔈", efr: "𝔢", eg: "⪚", Egrave: "È", egrave: "è", egs: "⪖", egsdot: "⪘", el: "⪙", Element: "∈", elinters: "⏧", ell: "ℓ", els: "⪕", elsdot: "⪗", Emacr: "Ē", emacr: "ē", empty: "∅", emptyset: "∅", EmptySmallSquare: "◻", emptyv: "∅", EmptyVerySmallSquare: "▫", emsp13: " ", emsp14: " ", emsp: " ", ENG: "Ŋ", eng: "ŋ", ensp: " ", Eogon: "Ę", eogon: "ę", Eopf: "𝔼", eopf: "𝕖", epar: "⋕", eparsl: "⧣", eplus: "⩱", epsi: "ε", Epsilon: "Ε", epsilon: "ε", epsiv: "ϵ", eqcirc: "≖", eqcolon: "≕", eqsim: "≂", eqslantgtr: "⪖", eqslantless: "⪕", Equal: "⩵", equals: "=", EqualTilde: "≂", equest: "≟", Equilibrium: "⇌", equiv: "≡", equivDD: "⩸", eqvparsl: "⧥", erarr: "⥱", erDot: "≓", escr: "ℯ", Escr: "ℰ", esdot: "≐", Esim: "⩳", esim: "≂", Eta: "Η", eta: "η", ETH: "Ð", eth: "ð", Euml: "Ë", euml: "ë", euro: "€", excl: "!", exist: "∃", Exists: "∃", expectation: "ℰ", exponentiale: "ⅇ", ExponentialE: "ⅇ", fallingdotseq: "≒", Fcy: "Ф", fcy: "ф", female: "♀", ffilig: "ffi", fflig: "ff", ffllig: "ffl", Ffr: "𝔉", ffr: "𝔣", filig: "fi", FilledSmallSquare: "◼", FilledVerySmallSquare: "▪", fjlig: "fj", flat: "♭", fllig: "fl", fltns: "▱", fnof: "ƒ", Fopf: "𝔽", fopf: "𝕗", forall: "∀", ForAll: "∀", fork: "⋔", forkv: "⫙", Fouriertrf: "ℱ", fpartint: "⨍", frac12: "½", frac13: "⅓", frac14: "¼", frac15: "⅕", frac16: "⅙", frac18: "⅛", frac23: "⅔", frac25: "⅖", frac34: "¾", frac35: "⅗", frac38: "⅜", frac45: "⅘", frac56: "⅚", frac58: "⅝", frac78: "⅞", frasl: "⁄", frown: "⌢", fscr: "𝒻", Fscr: "ℱ", gacute: "ǵ", Gamma: "Γ", gamma: "γ", Gammad: "Ϝ", gammad: "ϝ", gap: "⪆", Gbreve: "Ğ", gbreve: "ğ", Gcedil: "Ģ", Gcirc: "Ĝ", gcirc: "ĝ", Gcy: "Г", gcy: "г", Gdot: "Ġ", gdot: "ġ", ge: "≥", gE: "≧", gEl: "⪌", gel: "⋛", geq: "≥", geqq: "≧", geqslant: "⩾", gescc: "⪩", ges: "⩾", gesdot: "⪀", gesdoto: "⪂", gesdotol: "⪄", gesl: "⋛︀", gesles: "⪔", Gfr: "𝔊", gfr: "𝔤", gg: "≫", Gg: "⋙", ggg: "⋙", gimel: "ℷ", GJcy: "Ѓ", gjcy: "ѓ", gla: "⪥", gl: "≷", glE: "⪒", glj: "⪤", gnap: "⪊", gnapprox: "⪊", gne: "⪈", gnE: "≩", gneq: "⪈", gneqq: "≩", gnsim: "⋧", Gopf: "𝔾", gopf: "𝕘", grave: "`", GreaterEqual: "≥", GreaterEqualLess: "⋛", GreaterFullEqual: "≧", GreaterGreater: "⪢", GreaterLess: "≷", GreaterSlantEqual: "⩾", GreaterTilde: "≳", Gscr: "𝒢", gscr: "ℊ", gsim: "≳", gsime: "⪎", gsiml: "⪐", gtcc: "⪧", gtcir: "⩺", gt: ">", GT: ">", Gt: "≫", gtdot: "⋗", gtlPar: "⦕", gtquest: "⩼", gtrapprox: "⪆", gtrarr: "⥸", gtrdot: "⋗", gtreqless: "⋛", gtreqqless: "⪌", gtrless: "≷", gtrsim: "≳", gvertneqq: "≩︀", gvnE: "≩︀", Hacek: "ˇ", hairsp: " ", half: "½", hamilt: "ℋ", HARDcy: "Ъ", hardcy: "ъ", harrcir: "⥈", harr: "↔", hArr: "⇔", harrw: "↭", Hat: "^", hbar: "ℏ", Hcirc: "Ĥ", hcirc: "ĥ", hearts: "♥", heartsuit: "♥", hellip: "…", hercon: "⊹", hfr: "𝔥", Hfr: "ℌ", HilbertSpace: "ℋ", hksearow: "⤥", hkswarow: "⤦", hoarr: "⇿", homtht: "∻", hookleftarrow: "↩", hookrightarrow: "↪", hopf: "𝕙", Hopf: "ℍ", horbar: "―", HorizontalLine: "─", hscr: "𝒽", Hscr: "ℋ", hslash: "ℏ", Hstrok: "Ħ", hstrok: "ħ", HumpDownHump: "≎", HumpEqual: "≏", hybull: "⁃", hyphen: "‐", Iacute: "Í", iacute: "í", ic: "\u2063", Icirc: "Î", icirc: "î", Icy: "И", icy: "и", Idot: "İ", IEcy: "Е", iecy: "е", iexcl: "¡", iff: "⇔", ifr: "𝔦", Ifr: "ℑ", Igrave: "Ì", igrave: "ì", ii: "ⅈ", iiiint: "⨌", iiint: "∭", iinfin: "⧜", iiota: "℩", IJlig: "IJ", ijlig: "ij", Imacr: "Ī", imacr: "ī", image: "ℑ", ImaginaryI: "ⅈ", imagline: "ℐ", imagpart: "ℑ", imath: "ı", Im: "ℑ", imof: "⊷", imped: "Ƶ", Implies: "⇒", incare: "℅", in: "∈", infin: "∞", infintie: "⧝", inodot: "ı", intcal: "⊺", int: "∫", Int: "∬", integers: "ℤ", Integral: "∫", intercal: "⊺", Intersection: "⋂", intlarhk: "⨗", intprod: "⨼", InvisibleComma: "\u2063", InvisibleTimes: "\u2062", IOcy: "Ё", iocy: "ё", Iogon: "Į", iogon: "į", Iopf: "𝕀", iopf: "𝕚", Iota: "Ι", iota: "ι", iprod: "⨼", iquest: "¿", iscr: "𝒾", Iscr: "ℐ", isin: "∈", isindot: "⋵", isinE: "⋹", isins: "⋴", isinsv: "⋳", isinv: "∈", it: "\u2062", Itilde: "Ĩ", itilde: "ĩ", Iukcy: "І", iukcy: "і", Iuml: "Ï", iuml: "ï", Jcirc: "Ĵ", jcirc: "ĵ", Jcy: "Й", jcy: "й", Jfr: "𝔍", jfr: "𝔧", jmath: "ȷ", Jopf: "𝕁", jopf: "𝕛", Jscr: "𝒥", jscr: "𝒿", Jsercy: "Ј", jsercy: "ј", Jukcy: "Є", jukcy: "є", Kappa: "Κ", kappa: "κ", kappav: "ϰ", Kcedil: "Ķ", kcedil: "ķ", Kcy: "К", kcy: "к", Kfr: "𝔎", kfr: "𝔨", kgreen: "ĸ", KHcy: "Х", khcy: "х", KJcy: "Ќ", kjcy: "ќ", Kopf: "𝕂", kopf: "𝕜", Kscr: "𝒦", kscr: "𝓀", lAarr: "⇚", Lacute: "Ĺ", lacute: "ĺ", laemptyv: "⦴", lagran: "ℒ", Lambda: "Λ", lambda: "λ", lang: "⟨", Lang: "⟪", langd: "⦑", langle: "⟨", lap: "⪅", Laplacetrf: "ℒ", laquo: "«", larrb: "⇤", larrbfs: "⤟", larr: "←", Larr: "↞", lArr: "⇐", larrfs: "⤝", larrhk: "↩", larrlp: "↫", larrpl: "⤹", larrsim: "⥳", larrtl: "↢", latail: "⤙", lAtail: "⤛", lat: "⪫", late: "⪭", lates: "⪭︀", lbarr: "⤌", lBarr: "⤎", lbbrk: "❲", lbrace: "{", lbrack: "[", lbrke: "⦋", lbrksld: "⦏", lbrkslu: "⦍", Lcaron: "Ľ", lcaron: "ľ", Lcedil: "Ļ", lcedil: "ļ", lceil: "⌈", lcub: "{", Lcy: "Л", lcy: "л", ldca: "⤶", ldquo: "“", ldquor: "„", ldrdhar: "⥧", ldrushar: "⥋", ldsh: "↲", le: "≤", lE: "≦", LeftAngleBracket: "⟨", LeftArrowBar: "⇤", leftarrow: "←", LeftArrow: "←", Leftarrow: "⇐", LeftArrowRightArrow: "⇆", leftarrowtail: "↢", LeftCeiling: "⌈", LeftDoubleBracket: "⟦", LeftDownTeeVector: "⥡", LeftDownVectorBar: "⥙", LeftDownVector: "⇃", LeftFloor: "⌊", leftharpoondown: "↽", leftharpoonup: "↼", leftleftarrows: "⇇", leftrightarrow: "↔", LeftRightArrow: "↔", Leftrightarrow: "⇔", leftrightarrows: "⇆", leftrightharpoons: "⇋", leftrightsquigarrow: "↭", LeftRightVector: "⥎", LeftTeeArrow: "↤", LeftTee: "⊣", LeftTeeVector: "⥚", leftthreetimes: "⋋", LeftTriangleBar: "⧏", LeftTriangle: "⊲", LeftTriangleEqual: "⊴", LeftUpDownVector: "⥑", LeftUpTeeVector: "⥠", LeftUpVectorBar: "⥘", LeftUpVector: "↿", LeftVectorBar: "⥒", LeftVector: "↼", lEg: "⪋", leg: "⋚", leq: "≤", leqq: "≦", leqslant: "⩽", lescc: "⪨", les: "⩽", lesdot: "⩿", lesdoto: "⪁", lesdotor: "⪃", lesg: "⋚︀", lesges: "⪓", lessapprox: "⪅", lessdot: "⋖", lesseqgtr: "⋚", lesseqqgtr: "⪋", LessEqualGreater: "⋚", LessFullEqual: "≦", LessGreater: "≶", lessgtr: "≶", LessLess: "⪡", lesssim: "≲", LessSlantEqual: "⩽", LessTilde: "≲", lfisht: "⥼", lfloor: "⌊", Lfr: "𝔏", lfr: "𝔩", lg: "≶", lgE: "⪑", lHar: "⥢", lhard: "↽", lharu: "↼", lharul: "⥪", lhblk: "▄", LJcy: "Љ", ljcy: "љ", llarr: "⇇", ll: "≪", Ll: "⋘", llcorner: "⌞", Lleftarrow: "⇚", llhard: "⥫", lltri: "◺", Lmidot: "Ŀ", lmidot: "ŀ", lmoustache: "⎰", lmoust: "⎰", lnap: "⪉", lnapprox: "⪉", lne: "⪇", lnE: "≨", lneq: "⪇", lneqq: "≨", lnsim: "⋦", loang: "⟬", loarr: "⇽", lobrk: "⟦", longleftarrow: "⟵", LongLeftArrow: "⟵", Longleftarrow: "⟸", longleftrightarrow: "⟷", LongLeftRightArrow: "⟷", Longleftrightarrow: "⟺", longmapsto: "⟼", longrightarrow: "⟶", LongRightArrow: "⟶", Longrightarrow: "⟹", looparrowleft: "↫", looparrowright: "↬", lopar: "⦅", Lopf: "𝕃", lopf: "𝕝", loplus: "⨭", lotimes: "⨴", lowast: "∗", lowbar: "_", LowerLeftArrow: "↙", LowerRightArrow: "↘", loz: "◊", lozenge: "◊", lozf: "⧫", lpar: "(", lparlt: "⦓", lrarr: "⇆", lrcorner: "⌟", lrhar: "⇋", lrhard: "⥭", lrm: "\u200e", lrtri: "⊿", lsaquo: "‹", lscr: "𝓁", Lscr: "ℒ", lsh: "↰", Lsh: "↰", lsim: "≲", lsime: "⪍", lsimg: "⪏", lsqb: "[", lsquo: "‘", lsquor: "‚", Lstrok: "Ł", lstrok: "ł", ltcc: "⪦", ltcir: "⩹", lt: "<", LT: "<", Lt: "≪", ltdot: "⋖", lthree: "⋋", ltimes: "⋉", ltlarr: "⥶", ltquest: "⩻", ltri: "◃", ltrie: "⊴", ltrif: "◂", ltrPar: "⦖", lurdshar: "⥊", luruhar: "⥦", lvertneqq: "≨︀", lvnE: "≨︀", macr: "¯", male: "♂", malt: "✠", maltese: "✠", Map: "⤅", map: "↦", mapsto: "↦", mapstodown: "↧", mapstoleft: "↤", mapstoup: "↥", marker: "▮", mcomma: "⨩", Mcy: "М", mcy: "м", mdash: "—", mDDot: "∺", measuredangle: "∡", MediumSpace: " ", Mellintrf: "ℳ", Mfr: "𝔐", mfr: "𝔪", mho: "℧", micro: "µ", midast: "*", midcir: "⫰", mid: "∣", middot: "·", minusb: "⊟", minus: "−", minusd: "∸", minusdu: "⨪", MinusPlus: "∓", mlcp: "⫛", mldr: "…", mnplus: "∓", models: "⊧", Mopf: "𝕄", mopf: "𝕞", mp: "∓", mscr: "𝓂", Mscr: "ℳ", mstpos: "∾", Mu: "Μ", mu: "μ", multimap: "⊸", mumap: "⊸", nabla: "∇", Nacute: "Ń", nacute: "ń", nang: "∠⃒", nap: "≉", napE: "⩰̸", napid: "≋̸", napos: "ʼn", napprox: "≉", natural: "♮", naturals: "ℕ", natur: "♮", nbsp: " ", nbump: "≎̸", nbumpe: "≏̸", ncap: "⩃", Ncaron: "Ň", ncaron: "ň", Ncedil: "Ņ", ncedil: "ņ", ncong: "≇", ncongdot: "⩭̸", ncup: "⩂", Ncy: "Н", ncy: "н", ndash: "–", nearhk: "⤤", nearr: "↗", neArr: "⇗", nearrow: "↗", ne: "≠", nedot: "≐̸", NegativeMediumSpace: "​", NegativeThickSpace: "​", NegativeThinSpace: "​", NegativeVeryThinSpace: "​", nequiv: "≢", nesear: "⤨", nesim: "≂̸", NestedGreaterGreater: "≫", NestedLessLess: "≪", NewLine: "\u000a", nexist: "∄", nexists: "∄", Nfr: "𝔑", nfr: "𝔫", ngE: "≧̸", nge: "≱", ngeq: "≱", ngeqq: "≧̸", ngeqslant: "⩾̸", nges: "⩾̸", nGg: "⋙̸", ngsim: "≵", nGt: "≫⃒", ngt: "≯", ngtr: "≯", nGtv: "≫̸", nharr: "↮", nhArr: "⇎", nhpar: "⫲", ni: "∋", nis: "⋼", nisd: "⋺", niv: "∋", NJcy: "Њ", njcy: "њ", nlarr: "↚", nlArr: "⇍", nldr: "‥", nlE: "≦̸", nle: "≰", nleftarrow: "↚", nLeftarrow: "⇍", nleftrightarrow: "↮", nLeftrightarrow: "⇎", nleq: "≰", nleqq: "≦̸", nleqslant: "⩽̸", nles: "⩽̸", nless: "≮", nLl: "⋘̸", nlsim: "≴", nLt: "≪⃒", nlt: "≮", nltri: "⋪", nltrie: "⋬", nLtv: "≪̸", nmid: "∤", NoBreak: "\u2060", NonBreakingSpace: " ", nopf: "𝕟", Nopf: "ℕ", Not: "⫬", not: "¬", NotCongruent: "≢", NotCupCap: "≭", NotDoubleVerticalBar: "∦", NotElement: "∉", NotEqual: "≠", NotEqualTilde: "≂̸", NotExists: "∄", NotGreater: "≯", NotGreaterEqual: "≱", NotGreaterFullEqual: "≧̸", NotGreaterGreater: "≫̸", NotGreaterLess: "≹", NotGreaterSlantEqual: "⩾̸", NotGreaterTilde: "≵", NotHumpDownHump: "≎̸", NotHumpEqual: "≏̸", notin: "∉", notindot: "⋵̸", notinE: "⋹̸", notinva: "∉", notinvb: "⋷", notinvc: "⋶", NotLeftTriangleBar: "⧏̸", NotLeftTriangle: "⋪", NotLeftTriangleEqual: "⋬", NotLess: "≮", NotLessEqual: "≰", NotLessGreater: "≸", NotLessLess: "≪̸", NotLessSlantEqual: "⩽̸", NotLessTilde: "≴", NotNestedGreaterGreater: "⪢̸", NotNestedLessLess: "⪡̸", notni: "∌", notniva: "∌", notnivb: "⋾", notnivc: "⋽", NotPrecedes: "⊀", NotPrecedesEqual: "⪯̸", NotPrecedesSlantEqual: "⋠", NotReverseElement: "∌", NotRightTriangleBar: "⧐̸", NotRightTriangle: "⋫", NotRightTriangleEqual: "⋭", NotSquareSubset: "⊏̸", NotSquareSubsetEqual: "⋢", NotSquareSuperset: "⊐̸", NotSquareSupersetEqual: "⋣", NotSubset: "⊂⃒", NotSubsetEqual: "⊈", NotSucceeds: "⊁", NotSucceedsEqual: "⪰̸", NotSucceedsSlantEqual: "⋡", NotSucceedsTilde: "≿̸", NotSuperset: "⊃⃒", NotSupersetEqual: "⊉", NotTilde: "≁", NotTildeEqual: "≄", NotTildeFullEqual: "≇", NotTildeTilde: "≉", NotVerticalBar: "∤", nparallel: "∦", npar: "∦", nparsl: "⫽⃥", npart: "∂̸", npolint: "⨔", npr: "⊀", nprcue: "⋠", nprec: "⊀", npreceq: "⪯̸", npre: "⪯̸", nrarrc: "⤳̸", nrarr: "↛", nrArr: "⇏", nrarrw: "↝̸", nrightarrow: "↛", nRightarrow: "⇏", nrtri: "⋫", nrtrie: "⋭", nsc: "⊁", nsccue: "⋡", nsce: "⪰̸", Nscr: "𝒩", nscr: "𝓃", nshortmid: "∤", nshortparallel: "∦", nsim: "≁", nsime: "≄", nsimeq: "≄", nsmid: "∤", nspar: "∦", nsqsube: "⋢", nsqsupe: "⋣", nsub: "⊄", nsubE: "⫅̸", nsube: "⊈", nsubset: "⊂⃒", nsubseteq: "⊈", nsubseteqq: "⫅̸", nsucc: "⊁", nsucceq: "⪰̸", nsup: "⊅", nsupE: "⫆̸", nsupe: "⊉", nsupset: "⊃⃒", nsupseteq: "⊉", nsupseteqq: "⫆̸", ntgl: "≹", Ntilde: "Ñ", ntilde: "ñ", ntlg: "≸", ntriangleleft: "⋪", ntrianglelefteq: "⋬", ntriangleright: "⋫", ntrianglerighteq: "⋭", Nu: "Ν", nu: "ν", num: "#", numero: "№", numsp: " ", nvap: "≍⃒", nvdash: "⊬", nvDash: "⊭", nVdash: "⊮", nVDash: "⊯", nvge: "≥⃒", nvgt: ">⃒", nvHarr: "⤄", nvinfin: "⧞", nvlArr: "⤂", nvle: "≤⃒", nvlt: "<⃒", nvltrie: "⊴⃒", nvrArr: "⤃", nvrtrie: "⊵⃒", nvsim: "∼⃒", nwarhk: "⤣", nwarr: "↖", nwArr: "⇖", nwarrow: "↖", nwnear: "⤧", Oacute: "Ó", oacute: "ó", oast: "⊛", Ocirc: "Ô", ocirc: "ô", ocir: "⊚", Ocy: "О", ocy: "о", odash: "⊝", Odblac: "Ő", odblac: "ő", odiv: "⨸", odot: "⊙", odsold: "⦼", OElig: "Œ", oelig: "œ", ofcir: "⦿", Ofr: "𝔒", ofr: "𝔬", ogon: "˛", Ograve: "Ò", ograve: "ò", ogt: "⧁", ohbar: "⦵", ohm: "Ω", oint: "∮", olarr: "↺", olcir: "⦾", olcross: "⦻", oline: "‾", olt: "⧀", Omacr: "Ō", omacr: "ō", Omega: "Ω", omega: "ω", Omicron: "Ο", omicron: "ο", omid: "⦶", ominus: "⊖", Oopf: "𝕆", oopf: "𝕠", opar: "⦷", OpenCurlyDoubleQuote: "“", OpenCurlyQuote: "‘", operp: "⦹", oplus: "⊕", orarr: "↻", Or: "⩔", or: "∨", ord: "⩝", order: "ℴ", orderof: "ℴ", ordf: "ª", ordm: "º", origof: "⊶", oror: "⩖", orslope: "⩗", orv: "⩛", oS: "Ⓢ", Oscr: "𝒪", oscr: "ℴ", Oslash: "Ø", oslash: "ø", osol: "⊘", Otilde: "Õ", otilde: "õ", otimesas: "⨶", Otimes: "⨷", otimes: "⊗", Ouml: "Ö", ouml: "ö", ovbar: "⌽", OverBar: "‾", OverBrace: "⏞", OverBracket: "⎴", OverParenthesis: "⏜", para: "¶", parallel: "∥", par: "∥", parsim: "⫳", parsl: "⫽", part: "∂", PartialD: "∂", Pcy: "П", pcy: "п", percnt: "%", period: ".", permil: "‰", perp: "⊥", pertenk: "‱", Pfr: "𝔓", pfr: "𝔭", Phi: "Φ", phi: "φ", phiv: "ϕ", phmmat: "ℳ", phone: "☎", Pi: "Π", pi: "π", pitchfork: "⋔", piv: "ϖ", planck: "ℏ", planckh: "ℎ", plankv: "ℏ", plusacir: "⨣", plusb: "⊞", pluscir: "⨢", plus: "+", plusdo: "∔", plusdu: "⨥", pluse: "⩲", PlusMinus: "±", plusmn: "±", plussim: "⨦", plustwo: "⨧", pm: "±", Poincareplane: "ℌ", pointint: "⨕", popf: "𝕡", Popf: "ℙ", pound: "£", prap: "⪷", Pr: "⪻", pr: "≺", prcue: "≼", precapprox: "⪷", prec: "≺", preccurlyeq: "≼", Precedes: "≺", PrecedesEqual: "⪯", PrecedesSlantEqual: "≼", PrecedesTilde: "≾", preceq: "⪯", precnapprox: "⪹", precneqq: "⪵", precnsim: "⋨", pre: "⪯", prE: "⪳", precsim: "≾", prime: "′", Prime: "″", primes: "ℙ", prnap: "⪹", prnE: "⪵", prnsim: "⋨", prod: "∏", Product: "∏", profalar: "⌮", profline: "⌒", profsurf: "⌓", prop: "∝", Proportional: "∝", Proportion: "∷", propto: "∝", prsim: "≾", prurel: "⊰", Pscr: "𝒫", pscr: "𝓅", Psi: "Ψ", psi: "ψ", puncsp: " ", Qfr: "𝔔", qfr: "𝔮", qint: "⨌", qopf: "𝕢", Qopf: "ℚ", qprime: "⁗", Qscr: "𝒬", qscr: "𝓆", quaternions: "ℍ", quatint: "⨖", quest: "?", questeq: "≟", quot: "\"", QUOT: "\"", rAarr: "⇛", race: "∽̱", Racute: "Ŕ", racute: "ŕ", radic: "√", raemptyv: "⦳", rang: "⟩", Rang: "⟫", rangd: "⦒", range: "⦥", rangle: "⟩", raquo: "»", rarrap: "⥵", rarrb: "⇥", rarrbfs: "⤠", rarrc: "⤳", rarr: "→", Rarr: "↠", rArr: "⇒", rarrfs: "⤞", rarrhk: "↪", rarrlp: "↬", rarrpl: "⥅", rarrsim: "⥴", Rarrtl: "⤖", rarrtl: "↣", rarrw: "↝", ratail: "⤚", rAtail: "⤜", ratio: "∶", rationals: "ℚ", rbarr: "⤍", rBarr: "⤏", RBarr: "⤐", rbbrk: "❳", rbrace: "}", rbrack: "]", rbrke: "⦌", rbrksld: "⦎", rbrkslu: "⦐", Rcaron: "Ř", rcaron: "ř", Rcedil: "Ŗ", rcedil: "ŗ", rceil: "⌉", rcub: "}", Rcy: "Р", rcy: "р", rdca: "⤷", rdldhar: "⥩", rdquo: "”", rdquor: "”", rdsh: "↳", real: "ℜ", realine: "ℛ", realpart: "ℜ", reals: "ℝ", Re: "ℜ", rect: "▭", reg: "®", REG: "®", ReverseElement: "∋", ReverseEquilibrium: "⇋", ReverseUpEquilibrium: "⥯", rfisht: "⥽", rfloor: "⌋", rfr: "𝔯", Rfr: "ℜ", rHar: "⥤", rhard: "⇁", rharu: "⇀", rharul: "⥬", Rho: "Ρ", rho: "ρ", rhov: "ϱ", RightAngleBracket: "⟩", RightArrowBar: "⇥", rightarrow: "→", RightArrow: "→", Rightarrow: "⇒", RightArrowLeftArrow: "⇄", rightarrowtail: "↣", RightCeiling: "⌉", RightDoubleBracket: "⟧", RightDownTeeVector: "⥝", RightDownVectorBar: "⥕", RightDownVector: "⇂", RightFloor: "⌋", rightharpoondown: "⇁", rightharpoonup: "⇀", rightleftarrows: "⇄", rightleftharpoons: "⇌", rightrightarrows: "⇉", rightsquigarrow: "↝", RightTeeArrow: "↦", RightTee: "⊢", RightTeeVector: "⥛", rightthreetimes: "⋌", RightTriangleBar: "⧐", RightTriangle: "⊳", RightTriangleEqual: "⊵", RightUpDownVector: "⥏", RightUpTeeVector: "⥜", RightUpVectorBar: "⥔", RightUpVector: "↾", RightVectorBar: "⥓", RightVector: "⇀", ring: "˚", risingdotseq: "≓", rlarr: "⇄", rlhar: "⇌", rlm: "\u200f", rmoustache: "⎱", rmoust: "⎱", rnmid: "⫮", roang: "⟭", roarr: "⇾", robrk: "⟧", ropar: "⦆", ropf: "𝕣", Ropf: "ℝ", roplus: "⨮", rotimes: "⨵", RoundImplies: "⥰", rpar: ")", rpargt: "⦔", rppolint: "⨒", rrarr: "⇉", Rrightarrow: "⇛", rsaquo: "›", rscr: "𝓇", Rscr: "ℛ", rsh: "↱", Rsh: "↱", rsqb: "]", rsquo: "’", rsquor: "’", rthree: "⋌", rtimes: "⋊", rtri: "▹", rtrie: "⊵", rtrif: "▸", rtriltri: "⧎", RuleDelayed: "⧴", ruluhar: "⥨", rx: "℞", Sacute: "Ś", sacute: "ś", sbquo: "‚", scap: "⪸", Scaron: "Š", scaron: "š", Sc: "⪼", sc: "≻", sccue: "≽", sce: "⪰", scE: "⪴", Scedil: "Ş", scedil: "ş", Scirc: "Ŝ", scirc: "ŝ", scnap: "⪺", scnE: "⪶", scnsim: "⋩", scpolint: "⨓", scsim: "≿", Scy: "С", scy: "с", sdotb: "⊡", sdot: "⋅", sdote: "⩦", searhk: "⤥", searr: "↘", seArr: "⇘", searrow: "↘", sect: "§", semi: ";", seswar: "⤩", setminus: "∖", setmn: "∖", sext: "✶", Sfr: "𝔖", sfr: "𝔰", sfrown: "⌢", sharp: "♯", SHCHcy: "Щ", shchcy: "щ", SHcy: "Ш", shcy: "ш", ShortDownArrow: "↓", ShortLeftArrow: "←", shortmid: "∣", shortparallel: "∥", ShortRightArrow: "→", ShortUpArrow: "↑", shy: "\u00ad", Sigma: "Σ", sigma: "σ", sigmaf: "ς", sigmav: "ς", sim: "∼", simdot: "⩪", sime: "≃", simeq: "≃", simg: "⪞", simgE: "⪠", siml: "⪝", simlE: "⪟", simne: "≆", simplus: "⨤", simrarr: "⥲", slarr: "←", SmallCircle: "∘", smallsetminus: "∖", smashp: "⨳", smeparsl: "⧤", smid: "∣", smile: "⌣", smt: "⪪", smte: "⪬", smtes: "⪬︀", SOFTcy: "Ь", softcy: "ь", solbar: "⌿", solb: "⧄", sol: "/", Sopf: "𝕊", sopf: "𝕤", spades: "♠", spadesuit: "♠", spar: "∥", sqcap: "⊓", sqcaps: "⊓︀", sqcup: "⊔", sqcups: "⊔︀", Sqrt: "√", sqsub: "⊏", sqsube: "⊑", sqsubset: "⊏", sqsubseteq: "⊑", sqsup: "⊐", sqsupe: "⊒", sqsupset: "⊐", sqsupseteq: "⊒", square: "□", Square: "□", SquareIntersection: "⊓", SquareSubset: "⊏", SquareSubsetEqual: "⊑", SquareSuperset: "⊐", SquareSupersetEqual: "⊒", SquareUnion: "⊔", squarf: "▪", squ: "□", squf: "▪", srarr: "→", Sscr: "𝒮", sscr: "𝓈", ssetmn: "∖", ssmile: "⌣", sstarf: "⋆", Star: "⋆", star: "☆", starf: "★", straightepsilon: "ϵ", straightphi: "ϕ", strns: "¯", sub: "⊂", Sub: "⋐", subdot: "⪽", subE: "⫅", sube: "⊆", subedot: "⫃", submult: "⫁", subnE: "⫋", subne: "⊊", subplus: "⪿", subrarr: "⥹", subset: "⊂", Subset: "⋐", subseteq: "⊆", subseteqq: "⫅", SubsetEqual: "⊆", subsetneq: "⊊", subsetneqq: "⫋", subsim: "⫇", subsub: "⫕", subsup: "⫓", succapprox: "⪸", succ: "≻", succcurlyeq: "≽", Succeeds: "≻", SucceedsEqual: "⪰", SucceedsSlantEqual: "≽", SucceedsTilde: "≿", succeq: "⪰", succnapprox: "⪺", succneqq: "⪶", succnsim: "⋩", succsim: "≿", SuchThat: "∋", sum: "∑", Sum: "∑", sung: "♪", sup1: "¹", sup2: "²", sup3: "³", sup: "⊃", Sup: "⋑", supdot: "⪾", supdsub: "⫘", supE: "⫆", supe: "⊇", supedot: "⫄", Superset: "⊃", SupersetEqual: "⊇", suphsol: "⟉", suphsub: "⫗", suplarr: "⥻", supmult: "⫂", supnE: "⫌", supne: "⊋", supplus: "⫀", supset: "⊃", Supset: "⋑", supseteq: "⊇", supseteqq: "⫆", supsetneq: "⊋", supsetneqq: "⫌", supsim: "⫈", supsub: "⫔", supsup: "⫖", swarhk: "⤦", swarr: "↙", swArr: "⇙", swarrow: "↙", swnwar: "⤪", szlig: "ß", Tab: "\u0009", target: "⌖", Tau: "Τ", tau: "τ", tbrk: "⎴", Tcaron: "Ť", tcaron: "ť", Tcedil: "Ţ", tcedil: "ţ", Tcy: "Т", tcy: "т", tdot: "⃛", telrec: "⌕", Tfr: "𝔗", tfr: "𝔱", there4: "∴", therefore: "∴", Therefore: "∴", Theta: "Θ", theta: "θ", thetasym: "ϑ", thetav: "ϑ", thickapprox: "≈", thicksim: "∼", ThickSpace: "  ", ThinSpace: " ", thinsp: " ", thkap: "≈", thksim: "∼", THORN: "Þ", thorn: "þ", tilde: "˜", Tilde: "∼", TildeEqual: "≃", TildeFullEqual: "≅", TildeTilde: "≈", timesbar: "⨱", timesb: "⊠", times: "×", timesd: "⨰", tint: "∭", toea: "⤨", topbot: "⌶", topcir: "⫱", top: "⊤", Topf: "𝕋", topf: "𝕥", topfork: "⫚", tosa: "⤩", tprime: "‴", trade: "™", TRADE: "™", triangle: "▵", triangledown: "▿", triangleleft: "◃", trianglelefteq: "⊴", triangleq: "≜", triangleright: "▹", trianglerighteq: "⊵", tridot: "◬", trie: "≜", triminus: "⨺", TripleDot: "⃛", triplus: "⨹", trisb: "⧍", tritime: "⨻", trpezium: "⏢", Tscr: "𝒯", tscr: "𝓉", TScy: "Ц", tscy: "ц", TSHcy: "Ћ", tshcy: "ћ", Tstrok: "Ŧ", tstrok: "ŧ", twixt: "≬", twoheadleftarrow: "↞", twoheadrightarrow: "↠", Uacute: "Ú", uacute: "ú", uarr: "↑", Uarr: "↟", uArr: "⇑", Uarrocir: "⥉", Ubrcy: "Ў", ubrcy: "ў", Ubreve: "Ŭ", ubreve: "ŭ", Ucirc: "Û", ucirc: "û", Ucy: "У", ucy: "у", udarr: "⇅", Udblac: "Ű", udblac: "ű", udhar: "⥮", ufisht: "⥾", Ufr: "𝔘", ufr: "𝔲", Ugrave: "Ù", ugrave: "ù", uHar: "⥣", uharl: "↿", uharr: "↾", uhblk: "▀", ulcorn: "⌜", ulcorner: "⌜", ulcrop: "⌏", ultri: "◸", Umacr: "Ū", umacr: "ū", uml: "¨", UnderBar: "_", UnderBrace: "⏟", UnderBracket: "⎵", UnderParenthesis: "⏝", Union: "⋃", UnionPlus: "⊎", Uogon: "Ų", uogon: "ų", Uopf: "𝕌", uopf: "𝕦", UpArrowBar: "⤒", uparrow: "↑", UpArrow: "↑", Uparrow: "⇑", UpArrowDownArrow: "⇅", updownarrow: "↕", UpDownArrow: "↕", Updownarrow: "⇕", UpEquilibrium: "⥮", upharpoonleft: "↿", upharpoonright: "↾", uplus: "⊎", UpperLeftArrow: "↖", UpperRightArrow: "↗", upsi: "υ", Upsi: "ϒ", upsih: "ϒ", Upsilon: "Υ", upsilon: "υ", UpTeeArrow: "↥", UpTee: "⊥", upuparrows: "⇈", urcorn: "⌝", urcorner: "⌝", urcrop: "⌎", Uring: "Ů", uring: "ů", urtri: "◹", Uscr: "𝒰", uscr: "𝓊", utdot: "⋰", Utilde: "Ũ", utilde: "ũ", utri: "▵", utrif: "▴", uuarr: "⇈", Uuml: "Ü", uuml: "ü", uwangle: "⦧", vangrt: "⦜", varepsilon: "ϵ", varkappa: "ϰ", varnothing: "∅", varphi: "ϕ", varpi: "ϖ", varpropto: "∝", varr: "↕", vArr: "⇕", varrho: "ϱ", varsigma: "ς", varsubsetneq: "⊊︀", varsubsetneqq: "⫋︀", varsupsetneq: "⊋︀", varsupsetneqq: "⫌︀", vartheta: "ϑ", vartriangleleft: "⊲", vartriangleright: "⊳", vBar: "⫨", Vbar: "⫫", vBarv: "⫩", Vcy: "В", vcy: "в", vdash: "⊢", vDash: "⊨", Vdash: "⊩", VDash: "⊫", Vdashl: "⫦", veebar: "⊻", vee: "∨", Vee: "⋁", veeeq: "≚", vellip: "⋮", verbar: "|", Verbar: "‖", vert: "|", Vert: "‖", VerticalBar: "∣", VerticalLine: "|", VerticalSeparator: "❘", VerticalTilde: "≀", VeryThinSpace: " ", Vfr: "𝔙", vfr: "𝔳", vltri: "⊲", vnsub: "⊂⃒", vnsup: "⊃⃒", Vopf: "𝕍", vopf: "𝕧", vprop: "∝", vrtri: "⊳", Vscr: "𝒱", vscr: "𝓋", vsubnE: "⫋︀", vsubne: "⊊︀", vsupnE: "⫌︀", vsupne: "⊋︀", Vvdash: "⊪", vzigzag: "⦚", Wcirc: "Ŵ", wcirc: "ŵ", wedbar: "⩟", wedge: "∧", Wedge: "⋀", wedgeq: "≙", weierp: "℘", Wfr: "𝔚", wfr: "𝔴", Wopf: "𝕎", wopf: "𝕨", wp: "℘", wr: "≀", wreath: "≀", Wscr: "𝒲", wscr: "𝓌", xcap: "⋂", xcirc: "◯", xcup: "⋃", xdtri: "▽", Xfr: "𝔛", xfr: "𝔵", xharr: "⟷", xhArr: "⟺", Xi: "Ξ", xi: "ξ", xlarr: "⟵", xlArr: "⟸", xmap: "⟼", xnis: "⋻", xodot: "⨀", Xopf: "𝕏", xopf: "𝕩", xoplus: "⨁", xotime: "⨂", xrarr: "⟶", xrArr: "⟹", Xscr: "𝒳", xscr: "𝓍", xsqcup: "⨆", xuplus: "⨄", xutri: "△", xvee: "⋁", xwedge: "⋀", Yacute: "Ý", yacute: "ý", YAcy: "Я", yacy: "я", Ycirc: "Ŷ", ycirc: "ŷ", Ycy: "Ы", ycy: "ы", yen: "¥", Yfr: "𝔜", yfr: "𝔶", YIcy: "Ї", yicy: "ї", Yopf: "𝕐", yopf: "𝕪", Yscr: "𝒴", yscr: "𝓎", YUcy: "Ю", yucy: "ю", yuml: "ÿ", Yuml: "Ÿ", Zacute: "Ź", zacute: "ź", Zcaron: "Ž", zcaron: "ž", Zcy: "З", zcy: "з", Zdot: "Ż", zdot: "ż", zeetrf: "ℨ", ZeroWidthSpace: "​", Zeta: "Ζ", zeta: "ζ", zfr: "𝔷", Zfr: "ℨ", ZHcy: "Ж", zhcy: "ж", zigrarr: "⇝", zopf: "𝕫", Zopf: "ℤ", Zscr: "𝒵", zscr: "𝓏", zwj: "\u200d", zwnj: "\u200c"
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10672
};
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10673
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10674
var HEXCHARCODE = /^#[xX]([A-Fa-f0-9]+)$/;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10675
var CHARCODE = /^#([0-9]+)$/;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10676
var NAMED = /^([A-Za-z0-9]+)$/;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10677
var EntityParser = /** @class */ (function () {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10678
    function EntityParser(named) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10679
        this.named = named;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10680
    }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10681
    EntityParser.prototype.parse = function (entity) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10682
        if (!entity) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10683
            return;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10684
        }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10685
        var matches = entity.match(HEXCHARCODE);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10686
        if (matches) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10687
            return String.fromCharCode(parseInt(matches[1], 16));
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10688
        }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10689
        matches = entity.match(CHARCODE);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10690
        if (matches) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10691
            return String.fromCharCode(parseInt(matches[1], 10));
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10692
        }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10693
        matches = entity.match(NAMED);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10694
        if (matches) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10695
            return this.named[matches[1]];
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10696
        }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10697
    };
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10698
    return EntityParser;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10699
}());
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10700
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10701
var WSP = /[\t\n\f ]/;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10702
var ALPHA = /[A-Za-z]/;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10703
var CRLF = /\r\n?/g;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10704
function isSpace(char) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10705
    return WSP.test(char);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10706
}
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10707
function isAlpha(char) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10708
    return ALPHA.test(char);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10709
}
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10710
function preprocessInput(input) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10711
    return input.replace(CRLF, '\n');
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10712
}
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10713
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10714
var EventedTokenizer = /** @class */ (function () {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10715
    function EventedTokenizer(delegate, entityParser, mode) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10716
        if (mode === void 0) { mode = 'precompile'; }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10717
        this.delegate = delegate;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10718
        this.entityParser = entityParser;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10719
        this.mode = mode;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10720
        this.state = "beforeData" /* beforeData */;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10721
        this.line = -1;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10722
        this.column = -1;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10723
        this.input = '';
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10724
        this.index = -1;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10725
        this.tagNameBuffer = '';
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10726
        this.states = {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10727
            beforeData: function () {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10728
                var char = this.peek();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10729
                if (char === '<' && !this.isIgnoredEndTag()) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10730
                    this.transitionTo("tagOpen" /* tagOpen */);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10731
                    this.markTagStart();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10732
                    this.consume();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10733
                }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10734
                else {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10735
                    if (this.mode === 'precompile' && char === '\n') {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10736
                        var tag = this.tagNameBuffer.toLowerCase();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10737
                        if (tag === 'pre' || tag === 'textarea') {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10738
                            this.consume();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10739
                        }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10740
                    }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10741
                    this.transitionTo("data" /* data */);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10742
                    this.delegate.beginData();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10743
                }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10744
            },
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10745
            data: function () {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10746
                var char = this.peek();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10747
                var tag = this.tagNameBuffer;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10748
                if (char === '<' && !this.isIgnoredEndTag()) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10749
                    this.delegate.finishData();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10750
                    this.transitionTo("tagOpen" /* tagOpen */);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10751
                    this.markTagStart();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10752
                    this.consume();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10753
                }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10754
                else if (char === '&' && tag !== 'script' && tag !== 'style') {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10755
                    this.consume();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10756
                    this.delegate.appendToData(this.consumeCharRef() || '&');
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10757
                }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10758
                else {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10759
                    this.consume();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10760
                    this.delegate.appendToData(char);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10761
                }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10762
            },
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10763
            tagOpen: function () {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10764
                var char = this.consume();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10765
                if (char === '!') {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10766
                    this.transitionTo("markupDeclarationOpen" /* markupDeclarationOpen */);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10767
                }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10768
                else if (char === '/') {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10769
                    this.transitionTo("endTagOpen" /* endTagOpen */);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10770
                }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10771
                else if (char === '@' || char === ':' || isAlpha(char)) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10772
                    this.transitionTo("tagName" /* tagName */);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10773
                    this.tagNameBuffer = '';
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10774
                    this.delegate.beginStartTag();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10775
                    this.appendToTagName(char);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10776
                }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10777
            },
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10778
            markupDeclarationOpen: function () {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10779
                var char = this.consume();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10780
                if (char === '-' && this.peek() === '-') {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10781
                    this.consume();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10782
                    this.transitionTo("commentStart" /* commentStart */);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10783
                    this.delegate.beginComment();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10784
                }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10785
                else {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10786
                    var maybeDoctype = char.toUpperCase() + this.input.substring(this.index, this.index + 6).toUpperCase();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10787
                    if (maybeDoctype === 'DOCTYPE') {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10788
                        this.consume();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10789
                        this.consume();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10790
                        this.consume();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10791
                        this.consume();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10792
                        this.consume();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10793
                        this.consume();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10794
                        this.transitionTo("doctype" /* doctype */);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10795
                        if (this.delegate.beginDoctype)
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10796
                            this.delegate.beginDoctype();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10797
                    }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10798
                }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10799
            },
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10800
            doctype: function () {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10801
                var char = this.consume();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10802
                if (isSpace(char)) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10803
                    this.transitionTo("beforeDoctypeName" /* beforeDoctypeName */);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10804
                }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10805
            },
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10806
            beforeDoctypeName: function () {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10807
                var char = this.consume();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10808
                if (isSpace(char)) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10809
                    return;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10810
                }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10811
                else {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10812
                    this.transitionTo("doctypeName" /* doctypeName */);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10813
                    if (this.delegate.appendToDoctypeName)
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10814
                        this.delegate.appendToDoctypeName(char.toLowerCase());
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10815
                }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10816
            },
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10817
            doctypeName: function () {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10818
                var char = this.consume();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10819
                if (isSpace(char)) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10820
                    this.transitionTo("afterDoctypeName" /* afterDoctypeName */);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10821
                }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10822
                else if (char === '>') {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10823
                    if (this.delegate.endDoctype)
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10824
                        this.delegate.endDoctype();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10825
                    this.transitionTo("beforeData" /* beforeData */);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10826
                }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10827
                else {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10828
                    if (this.delegate.appendToDoctypeName)
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10829
                        this.delegate.appendToDoctypeName(char.toLowerCase());
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10830
                }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10831
            },
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10832
            afterDoctypeName: function () {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10833
                var char = this.consume();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10834
                if (isSpace(char)) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10835
                    return;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10836
                }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10837
                else if (char === '>') {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10838
                    if (this.delegate.endDoctype)
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10839
                        this.delegate.endDoctype();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10840
                    this.transitionTo("beforeData" /* beforeData */);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10841
                }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10842
                else {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10843
                    var nextSixChars = char.toUpperCase() + this.input.substring(this.index, this.index + 5).toUpperCase();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10844
                    var isPublic = nextSixChars.toUpperCase() === 'PUBLIC';
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10845
                    var isSystem = nextSixChars.toUpperCase() === 'SYSTEM';
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10846
                    if (isPublic || isSystem) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10847
                        this.consume();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10848
                        this.consume();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10849
                        this.consume();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10850
                        this.consume();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10851
                        this.consume();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10852
                        this.consume();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10853
                    }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10854
                    if (isPublic) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10855
                        this.transitionTo("afterDoctypePublicKeyword" /* afterDoctypePublicKeyword */);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10856
                    }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10857
                    else if (isSystem) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10858
                        this.transitionTo("afterDoctypeSystemKeyword" /* afterDoctypeSystemKeyword */);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10859
                    }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10860
                }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10861
            },
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10862
            afterDoctypePublicKeyword: function () {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10863
                var char = this.peek();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10864
                if (isSpace(char)) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10865
                    this.transitionTo("beforeDoctypePublicIdentifier" /* beforeDoctypePublicIdentifier */);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10866
                    this.consume();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10867
                }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10868
                else if (char === '"') {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10869
                    this.transitionTo("doctypePublicIdentifierDoubleQuoted" /* doctypePublicIdentifierDoubleQuoted */);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10870
                    this.consume();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10871
                }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10872
                else if (char === "'") {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10873
                    this.transitionTo("doctypePublicIdentifierSingleQuoted" /* doctypePublicIdentifierSingleQuoted */);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10874
                    this.consume();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10875
                }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10876
                else if (char === '>') {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10877
                    this.consume();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10878
                    if (this.delegate.endDoctype)
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10879
                        this.delegate.endDoctype();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10880
                    this.transitionTo("beforeData" /* beforeData */);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10881
                }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10882
            },
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10883
            doctypePublicIdentifierDoubleQuoted: function () {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10884
                var char = this.consume();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10885
                if (char === '"') {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10886
                    this.transitionTo("afterDoctypePublicIdentifier" /* afterDoctypePublicIdentifier */);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10887
                }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10888
                else if (char === '>') {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10889
                    if (this.delegate.endDoctype)
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10890
                        this.delegate.endDoctype();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10891
                    this.transitionTo("beforeData" /* beforeData */);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10892
                }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10893
                else {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10894
                    if (this.delegate.appendToDoctypePublicIdentifier)
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10895
                        this.delegate.appendToDoctypePublicIdentifier(char);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10896
                }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10897
            },
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10898
            doctypePublicIdentifierSingleQuoted: function () {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10899
                var char = this.consume();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10900
                if (char === "'") {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10901
                    this.transitionTo("afterDoctypePublicIdentifier" /* afterDoctypePublicIdentifier */);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10902
                }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10903
                else if (char === '>') {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10904
                    if (this.delegate.endDoctype)
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10905
                        this.delegate.endDoctype();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10906
                    this.transitionTo("beforeData" /* beforeData */);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10907
                }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10908
                else {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10909
                    if (this.delegate.appendToDoctypePublicIdentifier)
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10910
                        this.delegate.appendToDoctypePublicIdentifier(char);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10911
                }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10912
            },
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10913
            afterDoctypePublicIdentifier: function () {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10914
                var char = this.consume();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10915
                if (isSpace(char)) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10916
                    this.transitionTo("betweenDoctypePublicAndSystemIdentifiers" /* betweenDoctypePublicAndSystemIdentifiers */);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10917
                }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10918
                else if (char === '>') {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10919
                    if (this.delegate.endDoctype)
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10920
                        this.delegate.endDoctype();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10921
                    this.transitionTo("beforeData" /* beforeData */);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10922
                }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10923
                else if (char === '"') {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10924
                    this.transitionTo("doctypeSystemIdentifierDoubleQuoted" /* doctypeSystemIdentifierDoubleQuoted */);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10925
                }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10926
                else if (char === "'") {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10927
                    this.transitionTo("doctypeSystemIdentifierSingleQuoted" /* doctypeSystemIdentifierSingleQuoted */);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10928
                }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10929
            },
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10930
            betweenDoctypePublicAndSystemIdentifiers: function () {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10931
                var char = this.consume();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10932
                if (isSpace(char)) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10933
                    return;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10934
                }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10935
                else if (char === '>') {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10936
                    if (this.delegate.endDoctype)
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10937
                        this.delegate.endDoctype();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10938
                    this.transitionTo("beforeData" /* beforeData */);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10939
                }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10940
                else if (char === '"') {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10941
                    this.transitionTo("doctypeSystemIdentifierDoubleQuoted" /* doctypeSystemIdentifierDoubleQuoted */);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10942
                }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10943
                else if (char === "'") {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10944
                    this.transitionTo("doctypeSystemIdentifierSingleQuoted" /* doctypeSystemIdentifierSingleQuoted */);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10945
                }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10946
            },
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10947
            doctypeSystemIdentifierDoubleQuoted: function () {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10948
                var char = this.consume();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10949
                if (char === '"') {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10950
                    this.transitionTo("afterDoctypeSystemIdentifier" /* afterDoctypeSystemIdentifier */);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10951
                }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10952
                else if (char === '>') {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10953
                    if (this.delegate.endDoctype)
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10954
                        this.delegate.endDoctype();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10955
                    this.transitionTo("beforeData" /* beforeData */);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10956
                }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10957
                else {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10958
                    if (this.delegate.appendToDoctypeSystemIdentifier)
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10959
                        this.delegate.appendToDoctypeSystemIdentifier(char);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10960
                }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10961
            },
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10962
            doctypeSystemIdentifierSingleQuoted: function () {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10963
                var char = this.consume();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10964
                if (char === "'") {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10965
                    this.transitionTo("afterDoctypeSystemIdentifier" /* afterDoctypeSystemIdentifier */);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10966
                }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10967
                else if (char === '>') {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10968
                    if (this.delegate.endDoctype)
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10969
                        this.delegate.endDoctype();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10970
                    this.transitionTo("beforeData" /* beforeData */);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10971
                }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10972
                else {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10973
                    if (this.delegate.appendToDoctypeSystemIdentifier)
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10974
                        this.delegate.appendToDoctypeSystemIdentifier(char);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10975
                }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10976
            },
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10977
            afterDoctypeSystemIdentifier: function () {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10978
                var char = this.consume();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10979
                if (isSpace(char)) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10980
                    return;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10981
                }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10982
                else if (char === '>') {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10983
                    if (this.delegate.endDoctype)
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10984
                        this.delegate.endDoctype();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10985
                    this.transitionTo("beforeData" /* beforeData */);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10986
                }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10987
            },
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10988
            commentStart: function () {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10989
                var char = this.consume();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10990
                if (char === '-') {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10991
                    this.transitionTo("commentStartDash" /* commentStartDash */);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10992
                }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10993
                else if (char === '>') {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10994
                    this.delegate.finishComment();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10995
                    this.transitionTo("beforeData" /* beforeData */);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10996
                }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10997
                else {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10998
                    this.delegate.appendToCommentData(char);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 10999
                    this.transitionTo("comment" /* comment */);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11000
                }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11001
            },
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11002
            commentStartDash: function () {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11003
                var char = this.consume();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11004
                if (char === '-') {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11005
                    this.transitionTo("commentEnd" /* commentEnd */);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11006
                }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11007
                else if (char === '>') {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11008
                    this.delegate.finishComment();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11009
                    this.transitionTo("beforeData" /* beforeData */);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11010
                }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11011
                else {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11012
                    this.delegate.appendToCommentData('-');
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11013
                    this.transitionTo("comment" /* comment */);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11014
                }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11015
            },
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11016
            comment: function () {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11017
                var char = this.consume();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11018
                if (char === '-') {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11019
                    this.transitionTo("commentEndDash" /* commentEndDash */);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11020
                }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11021
                else {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11022
                    this.delegate.appendToCommentData(char);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11023
                }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11024
            },
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11025
            commentEndDash: function () {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11026
                var char = this.consume();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11027
                if (char === '-') {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11028
                    this.transitionTo("commentEnd" /* commentEnd */);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11029
                }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11030
                else {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11031
                    this.delegate.appendToCommentData('-' + char);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11032
                    this.transitionTo("comment" /* comment */);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11033
                }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11034
            },
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11035
            commentEnd: function () {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11036
                var char = this.consume();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11037
                if (char === '>') {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11038
                    this.delegate.finishComment();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11039
                    this.transitionTo("beforeData" /* beforeData */);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11040
                }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11041
                else {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11042
                    this.delegate.appendToCommentData('--' + char);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11043
                    this.transitionTo("comment" /* comment */);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11044
                }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11045
            },
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11046
            tagName: function () {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11047
                var char = this.consume();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11048
                if (isSpace(char)) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11049
                    this.transitionTo("beforeAttributeName" /* beforeAttributeName */);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11050
                }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11051
                else if (char === '/') {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11052
                    this.transitionTo("selfClosingStartTag" /* selfClosingStartTag */);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11053
                }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11054
                else if (char === '>') {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11055
                    this.delegate.finishTag();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11056
                    this.transitionTo("beforeData" /* beforeData */);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11057
                }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11058
                else {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11059
                    this.appendToTagName(char);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11060
                }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11061
            },
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11062
            endTagName: function () {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11063
                var char = this.consume();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11064
                if (isSpace(char)) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11065
                    this.transitionTo("beforeAttributeName" /* beforeAttributeName */);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11066
                    this.tagNameBuffer = '';
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11067
                }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11068
                else if (char === '/') {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11069
                    this.transitionTo("selfClosingStartTag" /* selfClosingStartTag */);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11070
                    this.tagNameBuffer = '';
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11071
                }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11072
                else if (char === '>') {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11073
                    this.delegate.finishTag();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11074
                    this.transitionTo("beforeData" /* beforeData */);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11075
                    this.tagNameBuffer = '';
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11076
                }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11077
                else {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11078
                    this.appendToTagName(char);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11079
                }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11080
            },
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11081
            beforeAttributeName: function () {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11082
                var char = this.peek();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11083
                if (isSpace(char)) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11084
                    this.consume();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11085
                    return;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11086
                }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11087
                else if (char === '/') {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11088
                    this.transitionTo("selfClosingStartTag" /* selfClosingStartTag */);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11089
                    this.consume();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11090
                }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11091
                else if (char === '>') {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11092
                    this.consume();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11093
                    this.delegate.finishTag();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11094
                    this.transitionTo("beforeData" /* beforeData */);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11095
                }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11096
                else if (char === '=') {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11097
                    this.delegate.reportSyntaxError('attribute name cannot start with equals sign');
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11098
                    this.transitionTo("attributeName" /* attributeName */);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11099
                    this.delegate.beginAttribute();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11100
                    this.consume();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11101
                    this.delegate.appendToAttributeName(char);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11102
                }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11103
                else {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11104
                    this.transitionTo("attributeName" /* attributeName */);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11105
                    this.delegate.beginAttribute();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11106
                }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11107
            },
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11108
            attributeName: function () {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11109
                var char = this.peek();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11110
                if (isSpace(char)) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11111
                    this.transitionTo("afterAttributeName" /* afterAttributeName */);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11112
                    this.consume();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11113
                }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11114
                else if (char === '/') {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11115
                    this.delegate.beginAttributeValue(false);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11116
                    this.delegate.finishAttributeValue();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11117
                    this.consume();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11118
                    this.transitionTo("selfClosingStartTag" /* selfClosingStartTag */);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11119
                }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11120
                else if (char === '=') {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11121
                    this.transitionTo("beforeAttributeValue" /* beforeAttributeValue */);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11122
                    this.consume();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11123
                }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11124
                else if (char === '>') {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11125
                    this.delegate.beginAttributeValue(false);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11126
                    this.delegate.finishAttributeValue();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11127
                    this.consume();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11128
                    this.delegate.finishTag();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11129
                    this.transitionTo("beforeData" /* beforeData */);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11130
                }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11131
                else if (char === '"' || char === "'" || char === '<') {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11132
                    this.delegate.reportSyntaxError(char + ' is not a valid character within attribute names');
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11133
                    this.consume();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11134
                    this.delegate.appendToAttributeName(char);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11135
                }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11136
                else {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11137
                    this.consume();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11138
                    this.delegate.appendToAttributeName(char);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11139
                }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11140
            },
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11141
            afterAttributeName: function () {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11142
                var char = this.peek();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11143
                if (isSpace(char)) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11144
                    this.consume();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11145
                    return;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11146
                }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11147
                else if (char === '/') {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11148
                    this.delegate.beginAttributeValue(false);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11149
                    this.delegate.finishAttributeValue();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11150
                    this.consume();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11151
                    this.transitionTo("selfClosingStartTag" /* selfClosingStartTag */);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11152
                }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11153
                else if (char === '=') {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11154
                    this.consume();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11155
                    this.transitionTo("beforeAttributeValue" /* beforeAttributeValue */);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11156
                }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11157
                else if (char === '>') {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11158
                    this.delegate.beginAttributeValue(false);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11159
                    this.delegate.finishAttributeValue();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11160
                    this.consume();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11161
                    this.delegate.finishTag();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11162
                    this.transitionTo("beforeData" /* beforeData */);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11163
                }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11164
                else {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11165
                    this.delegate.beginAttributeValue(false);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11166
                    this.delegate.finishAttributeValue();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11167
                    this.transitionTo("attributeName" /* attributeName */);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11168
                    this.delegate.beginAttribute();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11169
                    this.consume();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11170
                    this.delegate.appendToAttributeName(char);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11171
                }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11172
            },
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11173
            beforeAttributeValue: function () {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11174
                var char = this.peek();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11175
                if (isSpace(char)) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11176
                    this.consume();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11177
                }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11178
                else if (char === '"') {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11179
                    this.transitionTo("attributeValueDoubleQuoted" /* attributeValueDoubleQuoted */);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11180
                    this.delegate.beginAttributeValue(true);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11181
                    this.consume();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11182
                }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11183
                else if (char === "'") {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11184
                    this.transitionTo("attributeValueSingleQuoted" /* attributeValueSingleQuoted */);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11185
                    this.delegate.beginAttributeValue(true);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11186
                    this.consume();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11187
                }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11188
                else if (char === '>') {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11189
                    this.delegate.beginAttributeValue(false);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11190
                    this.delegate.finishAttributeValue();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11191
                    this.consume();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11192
                    this.delegate.finishTag();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11193
                    this.transitionTo("beforeData" /* beforeData */);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11194
                }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11195
                else {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11196
                    this.transitionTo("attributeValueUnquoted" /* attributeValueUnquoted */);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11197
                    this.delegate.beginAttributeValue(false);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11198
                    this.consume();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11199
                    this.delegate.appendToAttributeValue(char);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11200
                }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11201
            },
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11202
            attributeValueDoubleQuoted: function () {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11203
                var char = this.consume();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11204
                if (char === '"') {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11205
                    this.delegate.finishAttributeValue();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11206
                    this.transitionTo("afterAttributeValueQuoted" /* afterAttributeValueQuoted */);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11207
                }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11208
                else if (char === '&') {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11209
                    this.delegate.appendToAttributeValue(this.consumeCharRef() || '&');
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11210
                }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11211
                else {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11212
                    this.delegate.appendToAttributeValue(char);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11213
                }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11214
            },
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11215
            attributeValueSingleQuoted: function () {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11216
                var char = this.consume();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11217
                if (char === "'") {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11218
                    this.delegate.finishAttributeValue();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11219
                    this.transitionTo("afterAttributeValueQuoted" /* afterAttributeValueQuoted */);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11220
                }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11221
                else if (char === '&') {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11222
                    this.delegate.appendToAttributeValue(this.consumeCharRef() || '&');
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11223
                }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11224
                else {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11225
                    this.delegate.appendToAttributeValue(char);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11226
                }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11227
            },
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11228
            attributeValueUnquoted: function () {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11229
                var char = this.peek();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11230
                if (isSpace(char)) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11231
                    this.delegate.finishAttributeValue();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11232
                    this.consume();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11233
                    this.transitionTo("beforeAttributeName" /* beforeAttributeName */);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11234
                }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11235
                else if (char === '/') {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11236
                    this.delegate.finishAttributeValue();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11237
                    this.consume();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11238
                    this.transitionTo("selfClosingStartTag" /* selfClosingStartTag */);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11239
                }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11240
                else if (char === '&') {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11241
                    this.consume();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11242
                    this.delegate.appendToAttributeValue(this.consumeCharRef() || '&');
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11243
                }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11244
                else if (char === '>') {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11245
                    this.delegate.finishAttributeValue();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11246
                    this.consume();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11247
                    this.delegate.finishTag();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11248
                    this.transitionTo("beforeData" /* beforeData */);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11249
                }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11250
                else {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11251
                    this.consume();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11252
                    this.delegate.appendToAttributeValue(char);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11253
                }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11254
            },
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11255
            afterAttributeValueQuoted: function () {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11256
                var char = this.peek();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11257
                if (isSpace(char)) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11258
                    this.consume();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11259
                    this.transitionTo("beforeAttributeName" /* beforeAttributeName */);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11260
                }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11261
                else if (char === '/') {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11262
                    this.consume();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11263
                    this.transitionTo("selfClosingStartTag" /* selfClosingStartTag */);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11264
                }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11265
                else if (char === '>') {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11266
                    this.consume();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11267
                    this.delegate.finishTag();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11268
                    this.transitionTo("beforeData" /* beforeData */);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11269
                }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11270
                else {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11271
                    this.transitionTo("beforeAttributeName" /* beforeAttributeName */);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11272
                }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11273
            },
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11274
            selfClosingStartTag: function () {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11275
                var char = this.peek();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11276
                if (char === '>') {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11277
                    this.consume();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11278
                    this.delegate.markTagAsSelfClosing();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11279
                    this.delegate.finishTag();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11280
                    this.transitionTo("beforeData" /* beforeData */);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11281
                }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11282
                else {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11283
                    this.transitionTo("beforeAttributeName" /* beforeAttributeName */);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11284
                }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11285
            },
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11286
            endTagOpen: function () {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11287
                var char = this.consume();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11288
                if (char === '@' || char === ':' || isAlpha(char)) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11289
                    this.transitionTo("endTagName" /* endTagName */);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11290
                    this.tagNameBuffer = '';
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11291
                    this.delegate.beginEndTag();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11292
                    this.appendToTagName(char);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11293
                }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11294
            }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11295
        };
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11296
        this.reset();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11297
    }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11298
    EventedTokenizer.prototype.reset = function () {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11299
        this.transitionTo("beforeData" /* beforeData */);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11300
        this.input = '';
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11301
        this.tagNameBuffer = '';
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11302
        this.index = 0;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11303
        this.line = 1;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11304
        this.column = 0;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11305
        this.delegate.reset();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11306
    };
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11307
    EventedTokenizer.prototype.transitionTo = function (state) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11308
        this.state = state;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11309
    };
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11310
    EventedTokenizer.prototype.tokenize = function (input) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11311
        this.reset();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11312
        this.tokenizePart(input);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11313
        this.tokenizeEOF();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11314
    };
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11315
    EventedTokenizer.prototype.tokenizePart = function (input) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11316
        this.input += preprocessInput(input);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11317
        while (this.index < this.input.length) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11318
            var handler = this.states[this.state];
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11319
            if (handler !== undefined) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11320
                handler.call(this);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11321
            }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11322
            else {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11323
                throw new Error("unhandled state " + this.state);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11324
            }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11325
        }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11326
    };
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11327
    EventedTokenizer.prototype.tokenizeEOF = function () {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11328
        this.flushData();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11329
    };
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11330
    EventedTokenizer.prototype.flushData = function () {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11331
        if (this.state === 'data') {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11332
            this.delegate.finishData();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11333
            this.transitionTo("beforeData" /* beforeData */);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11334
        }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11335
    };
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11336
    EventedTokenizer.prototype.peek = function () {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11337
        return this.input.charAt(this.index);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11338
    };
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11339
    EventedTokenizer.prototype.consume = function () {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11340
        var char = this.peek();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11341
        this.index++;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11342
        if (char === '\n') {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11343
            this.line++;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11344
            this.column = 0;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11345
        }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11346
        else {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11347
            this.column++;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11348
        }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11349
        return char;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11350
    };
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11351
    EventedTokenizer.prototype.consumeCharRef = function () {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11352
        var endIndex = this.input.indexOf(';', this.index);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11353
        if (endIndex === -1) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11354
            return;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11355
        }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11356
        var entity = this.input.slice(this.index, endIndex);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11357
        var chars = this.entityParser.parse(entity);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11358
        if (chars) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11359
            var count = entity.length;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11360
            // consume the entity chars
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11361
            while (count) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11362
                this.consume();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11363
                count--;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11364
            }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11365
            // consume the `;`
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11366
            this.consume();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11367
            return chars;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11368
        }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11369
    };
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11370
    EventedTokenizer.prototype.markTagStart = function () {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11371
        this.delegate.tagOpen();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11372
    };
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11373
    EventedTokenizer.prototype.appendToTagName = function (char) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11374
        this.tagNameBuffer += char;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11375
        this.delegate.appendToTagName(char);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11376
    };
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11377
    EventedTokenizer.prototype.isIgnoredEndTag = function () {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11378
        var tag = this.tagNameBuffer;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11379
        return (tag === 'title' && this.input.substring(this.index, this.index + 8) !== '</title>') ||
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11380
            (tag === 'style' && this.input.substring(this.index, this.index + 8) !== '</style>') ||
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11381
            (tag === 'script' && this.input.substring(this.index, this.index + 9) !== '</script>');
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11382
    };
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11383
    return EventedTokenizer;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11384
}());
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11385
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11386
var Tokenizer = /** @class */ (function () {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11387
    function Tokenizer(entityParser, options) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11388
        if (options === void 0) { options = {}; }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11389
        this.options = options;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11390
        this.token = null;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11391
        this.startLine = 1;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11392
        this.startColumn = 0;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11393
        this.tokens = [];
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11394
        this.tokenizer = new EventedTokenizer(this, entityParser, options.mode);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11395
        this._currentAttribute = undefined;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11396
    }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11397
    Tokenizer.prototype.tokenize = function (input) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11398
        this.tokens = [];
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11399
        this.tokenizer.tokenize(input);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11400
        return this.tokens;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11401
    };
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11402
    Tokenizer.prototype.tokenizePart = function (input) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11403
        this.tokens = [];
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11404
        this.tokenizer.tokenizePart(input);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11405
        return this.tokens;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11406
    };
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11407
    Tokenizer.prototype.tokenizeEOF = function () {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11408
        this.tokens = [];
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11409
        this.tokenizer.tokenizeEOF();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11410
        return this.tokens[0];
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11411
    };
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11412
    Tokenizer.prototype.reset = function () {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11413
        this.token = null;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11414
        this.startLine = 1;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11415
        this.startColumn = 0;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11416
    };
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11417
    Tokenizer.prototype.current = function () {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11418
        var token = this.token;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11419
        if (token === null) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11420
            throw new Error('token was unexpectedly null');
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11421
        }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11422
        if (arguments.length === 0) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11423
            return token;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11424
        }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11425
        for (var i = 0; i < arguments.length; i++) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11426
            if (token.type === arguments[i]) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11427
                return token;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11428
            }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11429
        }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11430
        throw new Error("token type was unexpectedly " + token.type);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11431
    };
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11432
    Tokenizer.prototype.push = function (token) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11433
        this.token = token;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11434
        this.tokens.push(token);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11435
    };
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11436
    Tokenizer.prototype.currentAttribute = function () {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11437
        return this._currentAttribute;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11438
    };
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11439
    Tokenizer.prototype.addLocInfo = function () {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11440
        if (this.options.loc) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11441
            this.current().loc = {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11442
                start: {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11443
                    line: this.startLine,
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11444
                    column: this.startColumn
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11445
                },
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11446
                end: {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11447
                    line: this.tokenizer.line,
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11448
                    column: this.tokenizer.column
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11449
                }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11450
            };
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11451
        }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11452
        this.startLine = this.tokenizer.line;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11453
        this.startColumn = this.tokenizer.column;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11454
    };
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11455
    // Data
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11456
    Tokenizer.prototype.beginDoctype = function () {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11457
        this.push({
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11458
            type: "Doctype" /* Doctype */,
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11459
            name: '',
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11460
        });
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11461
    };
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11462
    Tokenizer.prototype.appendToDoctypeName = function (char) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11463
        this.current("Doctype" /* Doctype */).name += char;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11464
    };
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11465
    Tokenizer.prototype.appendToDoctypePublicIdentifier = function (char) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11466
        var doctype = this.current("Doctype" /* Doctype */);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11467
        if (doctype.publicIdentifier === undefined) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11468
            doctype.publicIdentifier = char;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11469
        }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11470
        else {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11471
            doctype.publicIdentifier += char;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11472
        }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11473
    };
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11474
    Tokenizer.prototype.appendToDoctypeSystemIdentifier = function (char) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11475
        var doctype = this.current("Doctype" /* Doctype */);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11476
        if (doctype.systemIdentifier === undefined) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11477
            doctype.systemIdentifier = char;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11478
        }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11479
        else {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11480
            doctype.systemIdentifier += char;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11481
        }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11482
    };
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11483
    Tokenizer.prototype.endDoctype = function () {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11484
        this.addLocInfo();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11485
    };
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11486
    Tokenizer.prototype.beginData = function () {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11487
        this.push({
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11488
            type: "Chars" /* Chars */,
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11489
            chars: ''
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11490
        });
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11491
    };
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11492
    Tokenizer.prototype.appendToData = function (char) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11493
        this.current("Chars" /* Chars */).chars += char;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11494
    };
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11495
    Tokenizer.prototype.finishData = function () {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11496
        this.addLocInfo();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11497
    };
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11498
    // Comment
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11499
    Tokenizer.prototype.beginComment = function () {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11500
        this.push({
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11501
            type: "Comment" /* Comment */,
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11502
            chars: ''
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11503
        });
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11504
    };
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11505
    Tokenizer.prototype.appendToCommentData = function (char) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11506
        this.current("Comment" /* Comment */).chars += char;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11507
    };
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11508
    Tokenizer.prototype.finishComment = function () {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11509
        this.addLocInfo();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11510
    };
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11511
    // Tags - basic
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11512
    Tokenizer.prototype.tagOpen = function () { };
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11513
    Tokenizer.prototype.beginStartTag = function () {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11514
        this.push({
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11515
            type: "StartTag" /* StartTag */,
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11516
            tagName: '',
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11517
            attributes: [],
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11518
            selfClosing: false
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11519
        });
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11520
    };
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11521
    Tokenizer.prototype.beginEndTag = function () {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11522
        this.push({
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11523
            type: "EndTag" /* EndTag */,
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11524
            tagName: ''
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11525
        });
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11526
    };
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11527
    Tokenizer.prototype.finishTag = function () {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11528
        this.addLocInfo();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11529
    };
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11530
    Tokenizer.prototype.markTagAsSelfClosing = function () {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11531
        this.current("StartTag" /* StartTag */).selfClosing = true;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11532
    };
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11533
    // Tags - name
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11534
    Tokenizer.prototype.appendToTagName = function (char) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11535
        this.current("StartTag" /* StartTag */, "EndTag" /* EndTag */).tagName += char;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11536
    };
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11537
    // Tags - attributes
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11538
    Tokenizer.prototype.beginAttribute = function () {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11539
        this._currentAttribute = ['', '', false];
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11540
    };
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11541
    Tokenizer.prototype.appendToAttributeName = function (char) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11542
        this.currentAttribute()[0] += char;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11543
    };
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11544
    Tokenizer.prototype.beginAttributeValue = function (isQuoted) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11545
        this.currentAttribute()[2] = isQuoted;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11546
    };
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11547
    Tokenizer.prototype.appendToAttributeValue = function (char) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11548
        this.currentAttribute()[1] += char;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11549
    };
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11550
    Tokenizer.prototype.finishAttributeValue = function () {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11551
        this.current("StartTag" /* StartTag */).attributes.push(this._currentAttribute);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11552
    };
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11553
    Tokenizer.prototype.reportSyntaxError = function (message) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11554
        this.current().syntaxError = message;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11555
    };
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11556
    return Tokenizer;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11557
}());
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11558
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11559
function tokenize(input, options) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11560
    var tokenizer = new Tokenizer(new EntityParser(namedCharRefs), options);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11561
    return tokenizer.tokenize(input);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11562
}
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11563
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11564
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11565
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 11566
// EXTERNAL MODULE: ./node_modules/fast-deep-equal/es6/index.js
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 11567
var es6 = __webpack_require__(7734);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 11568
var es6_default = /*#__PURE__*/__webpack_require__.n(es6);
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11569
;// CONCATENATED MODULE: external ["wp","htmlEntities"]
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 11570
const external_wp_htmlEntities_namespaceObject = window["wp"]["htmlEntities"];
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11571
;// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/validation/logger.js
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11572
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11573
 * @typedef LoggerItem
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11574
 * @property {Function}   log  Which logger recorded the message
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11575
 * @property {Array<any>} args White arguments were supplied to the logger
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11576
 */
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 11577
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11578
function createLogger() {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11579
  /**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11580
   * Creates a log handler with block validation prefix.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11581
   *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11582
   * @param {Function} logger Original logger function.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11583
   *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11584
   * @return {Function} Augmented logger function.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11585
   */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11586
  function createLogHandler(logger) {
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 11587
    let log = (message, ...args) => logger('Block validation: ' + message, ...args);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 11588
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 11589
    // In test environments, pre-process string substitutions to improve
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11590
    // readability of error messages. We'd prefer to avoid pulling in this
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11591
    // dependency in runtime environments, and it can be dropped by a combo
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11592
    // of Webpack env substitution + UglifyJS dead code elimination.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11593
    if (false) {}
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11594
    return log;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11595
  }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11596
  return {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11597
    // eslint-disable-next-line no-console
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11598
    error: createLogHandler(console.error),
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11599
    // eslint-disable-next-line no-console
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11600
    warning: createLogHandler(console.warn),
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11601
    getItems() {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11602
      return [];
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11603
    }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11604
  };
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11605
}
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11606
function createQueuedLogger() {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11607
  /**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11608
   * The list of enqueued log actions to print.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11609
   *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11610
   * @type {Array<LoggerItem>}
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11611
   */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11612
  const queue = [];
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11613
  const logger = createLogger();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11614
  return {
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 11615
    error(...args) {
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11616
      queue.push({
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11617
        log: logger.error,
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11618
        args
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11619
      });
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11620
    },
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 11621
    warning(...args) {
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11622
      queue.push({
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11623
        log: logger.warning,
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11624
        args
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11625
      });
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11626
    },
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11627
    getItems() {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11628
      return queue;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11629
    }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11630
  };
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11631
}
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11632
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11633
;// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/validation/index.js
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11634
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11635
 * External dependencies
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11636
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11637
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11638
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 11639
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11640
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11641
 * WordPress dependencies
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11642
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11643
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11644
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11645
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11646
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11647
 * Internal dependencies
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11648
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11649
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11650
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11651
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11652
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11653
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11654
/** @typedef {import('../parser').WPBlock} WPBlock */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11655
/** @typedef {import('../registration').WPBlockType} WPBlockType */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11656
/** @typedef {import('./logger').LoggerItem} LoggerItem */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11657
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 11658
const identity = x => x;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 11659
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11660
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11661
 * Globally matches any consecutive whitespace
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11662
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11663
 * @type {RegExp}
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11664
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11665
const REGEXP_WHITESPACE = /[\t\n\r\v\f ]+/g;
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 11666
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11667
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11668
 * Matches a string containing only whitespace
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11669
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11670
 * @type {RegExp}
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11671
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11672
const REGEXP_ONLY_WHITESPACE = /^[\t\n\r\v\f ]*$/;
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 11673
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11674
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11675
 * Matches a CSS URL type value
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11676
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11677
 * @type {RegExp}
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11678
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11679
const REGEXP_STYLE_URL_TYPE = /^url\s*\(['"\s]*(.*?)['"\s]*\)$/;
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 11680
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11681
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11682
 * Boolean attributes are attributes whose presence as being assigned is
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11683
 * meaningful, even if only empty.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11684
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11685
 * See: https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#boolean-attributes
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11686
 * Extracted from: https://html.spec.whatwg.org/multipage/indices.html#attributes-3
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11687
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11688
 * Object.keys( Array.from( document.querySelectorAll( '#attributes-1 > tbody > tr' ) )
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11689
 *     .filter( ( tr ) => tr.lastChild.textContent.indexOf( 'Boolean attribute' ) !== -1 )
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11690
 *     .reduce( ( result, tr ) => Object.assign( result, {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11691
 *         [ tr.firstChild.textContent.trim() ]: true
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11692
 *     } ), {} ) ).sort();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11693
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11694
 * @type {Array}
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11695
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11696
const BOOLEAN_ATTRIBUTES = ['allowfullscreen', 'allowpaymentrequest', 'allowusermedia', 'async', 'autofocus', 'autoplay', 'checked', 'controls', 'default', 'defer', 'disabled', 'download', 'formnovalidate', 'hidden', 'ismap', 'itemscope', 'loop', 'multiple', 'muted', 'nomodule', 'novalidate', 'open', 'playsinline', 'readonly', 'required', 'reversed', 'selected', 'typemustmatch'];
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 11697
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11698
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11699
 * Enumerated attributes are attributes which must be of a specific value form.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11700
 * Like boolean attributes, these are meaningful if specified, even if not of a
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11701
 * valid enumerated value.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11702
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11703
 * See: https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#enumerated-attribute
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11704
 * Extracted from: https://html.spec.whatwg.org/multipage/indices.html#attributes-3
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11705
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11706
 * Object.keys( Array.from( document.querySelectorAll( '#attributes-1 > tbody > tr' ) )
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11707
 *     .filter( ( tr ) => /^("(.+?)";?\s*)+/.test( tr.lastChild.textContent.trim() ) )
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11708
 *     .reduce( ( result, tr ) => Object.assign( result, {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11709
 *         [ tr.firstChild.textContent.trim() ]: true
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11710
 *     } ), {} ) ).sort();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11711
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11712
 * @type {Array}
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11713
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11714
const ENUMERATED_ATTRIBUTES = ['autocapitalize', 'autocomplete', 'charset', 'contenteditable', 'crossorigin', 'decoding', 'dir', 'draggable', 'enctype', 'formenctype', 'formmethod', 'http-equiv', 'inputmode', 'kind', 'method', 'preload', 'scope', 'shape', 'spellcheck', 'translate', 'type', 'wrap'];
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 11715
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11716
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11717
 * Meaningful attributes are those who cannot be safely ignored when omitted in
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11718
 * one HTML markup string and not another.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11719
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11720
 * @type {Array}
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11721
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11722
const MEANINGFUL_ATTRIBUTES = [...BOOLEAN_ATTRIBUTES, ...ENUMERATED_ATTRIBUTES];
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 11723
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11724
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11725
 * Array of functions which receive a text string on which to apply normalizing
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11726
 * behavior for consideration in text token equivalence, carefully ordered from
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11727
 * least-to-most expensive operations.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11728
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11729
 * @type {Array}
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11730
 */
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 11731
const TEXT_NORMALIZATIONS = [identity, getTextWithCollapsedWhitespace];
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 11732
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11733
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11734
 * Regular expression matching a named character reference. In lieu of bundling
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11735
 * a full set of references, the pattern covers the minimal necessary to test
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11736
 * positively against the full set.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11737
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11738
 * "The ampersand must be followed by one of the names given in the named
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11739
 * character references section, using the same case."
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11740
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11741
 * Tested aginst "12.5 Named character references":
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11742
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11743
 * ```
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11744
 * const references = Array.from( document.querySelectorAll(
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11745
 *     '#named-character-references-table tr[id^=entity-] td:first-child'
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11746
 * ) ).map( ( code ) => code.textContent )
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11747
 * references.every( ( reference ) => /^[\da-z]+$/i.test( reference ) )
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11748
 * ```
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11749
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11750
 * @see https://html.spec.whatwg.org/multipage/syntax.html#character-references
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11751
 * @see https://html.spec.whatwg.org/multipage/named-characters.html#named-character-references
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11752
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11753
 * @type {RegExp}
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11754
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11755
const REGEXP_NAMED_CHARACTER_REFERENCE = /^[\da-z]+$/i;
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 11756
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11757
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11758
 * Regular expression matching a decimal character reference.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11759
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11760
 * "The ampersand must be followed by a U+0023 NUMBER SIGN character (#),
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11761
 * followed by one or more ASCII digits, representing a base-ten integer"
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11762
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11763
 * @see https://html.spec.whatwg.org/multipage/syntax.html#character-references
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11764
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11765
 * @type {RegExp}
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11766
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11767
const REGEXP_DECIMAL_CHARACTER_REFERENCE = /^#\d+$/;
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 11768
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11769
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11770
 * Regular expression matching a hexadecimal character reference.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11771
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11772
 * "The ampersand must be followed by a U+0023 NUMBER SIGN character (#), which
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11773
 * must be followed by either a U+0078 LATIN SMALL LETTER X character (x) or a
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11774
 * U+0058 LATIN CAPITAL LETTER X character (X), which must then be followed by
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11775
 * one or more ASCII hex digits, representing a hexadecimal integer"
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11776
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11777
 * @see https://html.spec.whatwg.org/multipage/syntax.html#character-references
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11778
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11779
 * @type {RegExp}
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11780
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11781
const REGEXP_HEXADECIMAL_CHARACTER_REFERENCE = /^#x[\da-f]+$/i;
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 11782
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11783
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11784
 * Returns true if the given string is a valid character reference segment, or
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11785
 * false otherwise. The text should be stripped of `&` and `;` demarcations.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11786
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11787
 * @param {string} text Text to test.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11788
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11789
 * @return {boolean} Whether text is valid character reference.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11790
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11791
function isValidCharacterReference(text) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11792
  return REGEXP_NAMED_CHARACTER_REFERENCE.test(text) || REGEXP_DECIMAL_CHARACTER_REFERENCE.test(text) || REGEXP_HEXADECIMAL_CHARACTER_REFERENCE.test(text);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11793
}
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 11794
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11795
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11796
 * Subsitute EntityParser class for `simple-html-tokenizer` which uses the
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11797
 * implementation of `decodeEntities` from `html-entities`, in order to avoid
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11798
 * bundling a massive named character reference.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11799
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11800
 * @see https://github.com/tildeio/simple-html-tokenizer/tree/HEAD/src/entity-parser.ts
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11801
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11802
class DecodeEntityParser {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11803
  /**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11804
   * Returns a substitute string for an entity string sequence between `&`
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11805
   * and `;`, or undefined if no substitution should occur.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11806
   *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11807
   * @param {string} entity Entity fragment discovered in HTML.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11808
   *
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 11809
   * @return {string | undefined} Entity substitute value.
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11810
   */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11811
  parse(entity) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11812
    if (isValidCharacterReference(entity)) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11813
      return (0,external_wp_htmlEntities_namespaceObject.decodeEntities)('&' + entity + ';');
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11814
    }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11815
  }
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 11816
}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 11817
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11818
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11819
 * Given a specified string, returns an array of strings split by consecutive
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11820
 * whitespace, ignoring leading or trailing whitespace.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11821
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11822
 * @param {string} text Original text.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11823
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11824
 * @return {string[]} Text pieces split on whitespace.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11825
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11826
function getTextPiecesSplitOnWhitespace(text) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11827
  return text.trim().split(REGEXP_WHITESPACE);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11828
}
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 11829
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11830
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11831
 * Given a specified string, returns a new trimmed string where all consecutive
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11832
 * whitespace is collapsed to a single space.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11833
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11834
 * @param {string} text Original text.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11835
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11836
 * @return {string} Trimmed text with consecutive whitespace collapsed.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11837
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11838
function getTextWithCollapsedWhitespace(text) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11839
  // This is an overly simplified whitespace comparison. The specification is
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11840
  // more prescriptive of whitespace behavior in inline and block contexts.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11841
  //
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11842
  // See: https://medium.com/@patrickbrosset/when-does-white-space-matter-in-html-b90e8a7cdd33
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11843
  return getTextPiecesSplitOnWhitespace(text).join(' ');
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11844
}
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 11845
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11846
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11847
 * Returns attribute pairs of the given StartTag token, including only pairs
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11848
 * where the value is non-empty or the attribute is a boolean attribute, an
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11849
 * enumerated attribute, or a custom data- attribute.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11850
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11851
 * @see MEANINGFUL_ATTRIBUTES
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11852
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11853
 * @param {Object} token StartTag token.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11854
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11855
 * @return {Array[]} Attribute pairs.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11856
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11857
function getMeaningfulAttributePairs(token) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11858
  return token.attributes.filter(pair => {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11859
    const [key, value] = pair;
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 11860
    return value || key.indexOf('data-') === 0 || MEANINGFUL_ATTRIBUTES.includes(key);
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11861
  });
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11862
}
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 11863
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11864
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11865
 * Returns true if two text tokens (with `chars` property) are equivalent, or
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11866
 * false otherwise.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11867
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11868
 * @param {Object} actual   Actual token.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11869
 * @param {Object} expected Expected token.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11870
 * @param {Object} logger   Validation logger object.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11871
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11872
 * @return {boolean} Whether two text tokens are equivalent.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11873
 */
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 11874
function isEquivalentTextTokens(actual, expected, logger = createLogger()) {
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11875
  // This function is intentionally written as syntactically "ugly" as a hot
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11876
  // path optimization. Text is progressively normalized in order from least-
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11877
  // to-most operationally expensive, until the earliest point at which text
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11878
  // can be confidently inferred as being equal.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11879
  let actualChars = actual.chars;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11880
  let expectedChars = expected.chars;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11881
  for (let i = 0; i < TEXT_NORMALIZATIONS.length; i++) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11882
    const normalize = TEXT_NORMALIZATIONS[i];
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11883
    actualChars = normalize(actualChars);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11884
    expectedChars = normalize(expectedChars);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11885
    if (actualChars === expectedChars) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11886
      return true;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11887
    }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11888
  }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11889
  logger.warning('Expected text `%s`, saw `%s`.', expected.chars, actual.chars);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11890
  return false;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11891
}
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 11892
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11893
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11894
 * Given a CSS length value, returns a normalized CSS length value for strict equality
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11895
 * comparison.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11896
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11897
 * @param {string} value CSS length value.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11898
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11899
 * @return {string} Normalized CSS length value.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11900
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11901
function getNormalizedLength(value) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11902
  if (0 === parseFloat(value)) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11903
    return '0';
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 11904
  }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 11905
  // Normalize strings with floats to always include a leading zero.
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11906
  if (value.indexOf('.') === 0) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11907
    return '0' + value;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11908
  }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11909
  return value;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11910
}
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 11911
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11912
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11913
 * Given a style value, returns a normalized style value for strict equality
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11914
 * comparison.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11915
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11916
 * @param {string} value Style value.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11917
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11918
 * @return {string} Normalized style value.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11919
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11920
function getNormalizedStyleValue(value) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11921
  const textPieces = getTextPiecesSplitOnWhitespace(value);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11922
  const normalizedPieces = textPieces.map(getNormalizedLength);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11923
  const result = normalizedPieces.join(' ');
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 11924
  return result
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 11925
  // Normalize URL type to omit whitespace or quotes.
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11926
  .replace(REGEXP_STYLE_URL_TYPE, 'url($1)');
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11927
}
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 11928
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11929
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11930
 * Given a style attribute string, returns an object of style properties.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11931
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11932
 * @param {string} text Style attribute.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11933
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11934
 * @return {Object} Style properties.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11935
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11936
function getStyleProperties(text) {
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 11937
  const pairs = text
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 11938
  // Trim ending semicolon (avoid including in split)
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 11939
  .replace(/;?\s*$/, '')
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 11940
  // Split on property assignment.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 11941
  .split(';')
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 11942
  // For each property assignment...
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11943
  .map(style => {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11944
    // ...split further into key-value pairs.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11945
    const [key, ...valueParts] = style.split(':');
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11946
    const value = valueParts.join(':');
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11947
    return [key.trim(), getNormalizedStyleValue(value.trim())];
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11948
  });
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 11949
  return Object.fromEntries(pairs);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 11950
}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 11951
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11952
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11953
 * Attribute-specific equality handlers
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11954
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11955
 * @type {Object}
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11956
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11957
const isEqualAttributesOfName = {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11958
  class: (actual, expected) => {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11959
    // Class matches if members are the same, even if out of order or
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11960
    // superfluous whitespace between.
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 11961
    const [actualPieces, expectedPieces] = [actual, expected].map(getTextPiecesSplitOnWhitespace);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 11962
    const actualDiff = actualPieces.filter(c => !expectedPieces.includes(c));
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 11963
    const expectedDiff = expectedPieces.filter(c => !actualPieces.includes(c));
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 11964
    return actualDiff.length === 0 && expectedDiff.length === 0;
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11965
  },
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11966
  style: (actual, expected) => {
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 11967
    return es6_default()(...[actual, expected].map(getStyleProperties));
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11968
  },
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11969
  // For each boolean attribute, mere presence of attribute in both is enough
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11970
  // to assume equivalence.
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 11971
  ...Object.fromEntries(BOOLEAN_ATTRIBUTES.map(attribute => [attribute, () => true]))
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 11972
};
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 11973
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11974
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11975
 * Given two sets of attribute tuples, returns true if the attribute sets are
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11976
 * equivalent.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11977
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11978
 * @param {Array[]} actual   Actual attributes tuples.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11979
 * @param {Array[]} expected Expected attributes tuples.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11980
 * @param {Object}  logger   Validation logger object.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11981
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11982
 * @return {boolean} Whether attributes are equivalent.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11983
 */
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 11984
function isEqualTagAttributePairs(actual, expected, logger = createLogger()) {
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11985
  // Attributes is tokenized as tuples. Their lengths should match. This also
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11986
  // avoids us needing to check both attributes sets, since if A has any keys
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11987
  // which do not exist in B, we know the sets to be different.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11988
  if (actual.length !== expected.length) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11989
    logger.warning('Expected attributes %o, instead saw %o.', expected, actual);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11990
    return false;
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 11991
  }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 11992
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 11993
  // Attributes are not guaranteed to occur in the same order. For validating
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11994
  // actual attributes, first convert the set of expected attribute values to
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11995
  // an object, for lookup by key.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11996
  const expectedAttributes = {};
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11997
  for (let i = 0; i < expected.length; i++) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11998
    expectedAttributes[expected[i][0].toLowerCase()] = expected[i][1];
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 11999
  }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12000
  for (let i = 0; i < actual.length; i++) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12001
    const [name, actualValue] = actual[i];
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12002
    const nameLower = name.toLowerCase();
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12003
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12004
    // As noted above, if missing member in B, assume different.
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12005
    if (!expectedAttributes.hasOwnProperty(nameLower)) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12006
      logger.warning('Encountered unexpected attribute `%s`.', name);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12007
      return false;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12008
    }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12009
    const expectedValue = expectedAttributes[nameLower];
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12010
    const isEqualAttributes = isEqualAttributesOfName[nameLower];
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12011
    if (isEqualAttributes) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12012
      // Defer custom attribute equality handling.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12013
      if (!isEqualAttributes(actualValue, expectedValue)) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12014
        logger.warning('Expected attribute `%s` of value `%s`, saw `%s`.', name, expectedValue, actualValue);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12015
        return false;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12016
      }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12017
    } else if (actualValue !== expectedValue) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12018
      // Otherwise strict inequality should bail.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12019
      logger.warning('Expected attribute `%s` of value `%s`, saw `%s`.', name, expectedValue, actualValue);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12020
      return false;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12021
    }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12022
  }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12023
  return true;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12024
}
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12025
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12026
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12027
 * Token-type-specific equality handlers
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12028
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12029
 * @type {Object}
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12030
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12031
const isEqualTokensOfType = {
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12032
  StartTag: (actual, expected, logger = createLogger()) => {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12033
    if (actual.tagName !== expected.tagName &&
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12034
    // Optimization: Use short-circuit evaluation to defer case-
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12035
    // insensitive check on the assumption that the majority case will
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12036
    // have exactly equal tag names.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12037
    actual.tagName.toLowerCase() !== expected.tagName.toLowerCase()) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12038
      logger.warning('Expected tag name `%s`, instead saw `%s`.', expected.tagName, actual.tagName);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12039
      return false;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12040
    }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12041
    return isEqualTagAttributePairs(...[actual, expected].map(getMeaningfulAttributePairs), logger);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12042
  },
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12043
  Chars: isEquivalentTextTokens,
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12044
  Comment: isEquivalentTextTokens
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12045
};
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12046
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12047
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12048
 * Given an array of tokens, returns the first token which is not purely
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12049
 * whitespace.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12050
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12051
 * Mutates the tokens array.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12052
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12053
 * @param {Object[]} tokens Set of tokens to search.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12054
 *
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12055
 * @return {Object | undefined} Next non-whitespace token.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12056
 */
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12057
function getNextNonWhitespaceToken(tokens) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12058
  let token;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12059
  while (token = tokens.shift()) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12060
    if (token.type !== 'Chars') {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12061
      return token;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12062
    }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12063
    if (!REGEXP_ONLY_WHITESPACE.test(token.chars)) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12064
      return token;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12065
    }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12066
  }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12067
}
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12068
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12069
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12070
 * Tokenize an HTML string, gracefully handling any errors thrown during
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12071
 * underlying tokenization.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12072
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12073
 * @param {string} html   HTML string to tokenize.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12074
 * @param {Object} logger Validation logger object.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12075
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12076
 * @return {Object[]|null} Array of valid tokenized HTML elements, or null on error
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12077
 */
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12078
function getHTMLTokens(html, logger = createLogger()) {
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12079
  try {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12080
    return new Tokenizer(new DecodeEntityParser()).tokenize(html);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12081
  } catch (e) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12082
    logger.warning('Malformed HTML detected: %s', html);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12083
  }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12084
  return null;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12085
}
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12086
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12087
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12088
 * Returns true if the next HTML token closes the current token.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12089
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12090
 * @param {Object}           currentToken Current token to compare with.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12091
 * @param {Object|undefined} nextToken    Next token to compare against.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12092
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12093
 * @return {boolean} true if `nextToken` closes `currentToken`, false otherwise
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12094
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12095
function isClosedByToken(currentToken, nextToken) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12096
  // Ensure this is a self closed token.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12097
  if (!currentToken.selfClosing) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12098
    return false;
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12099
  }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12100
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12101
  // Check token names and determine if nextToken is the closing tag for currentToken.
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12102
  if (nextToken && nextToken.tagName === currentToken.tagName && nextToken.type === 'EndTag') {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12103
    return true;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12104
  }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12105
  return false;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12106
}
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12107
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12108
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12109
 * Returns true if the given HTML strings are effectively equivalent, or
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12110
 * false otherwise. Invalid HTML is not considered equivalent, even if the
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12111
 * strings directly match.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12112
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12113
 * @param {string} actual   Actual HTML string.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12114
 * @param {string} expected Expected HTML string.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12115
 * @param {Object} logger   Validation logger object.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12116
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12117
 * @return {boolean} Whether HTML strings are equivalent.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12118
 */
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12119
function isEquivalentHTML(actual, expected, logger = createLogger()) {
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12120
  // Short-circuit if markup is identical.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12121
  if (actual === expected) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12122
    return true;
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12123
  }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12124
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12125
  // Tokenize input content and reserialized save content.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12126
  const [actualTokens, expectedTokens] = [actual, expected].map(html => getHTMLTokens(html, logger));
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12127
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12128
  // If either is malformed then stop comparing - the strings are not equivalent.
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12129
  if (!actualTokens || !expectedTokens) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12130
    return false;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12131
  }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12132
  let actualToken, expectedToken;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12133
  while (actualToken = getNextNonWhitespaceToken(actualTokens)) {
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12134
    expectedToken = getNextNonWhitespaceToken(expectedTokens);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12135
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12136
    // Inequal if exhausted all expected tokens.
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12137
    if (!expectedToken) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12138
      logger.warning('Expected end of content, instead saw %o.', actualToken);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12139
      return false;
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12140
    }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12141
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12142
    // Inequal if next non-whitespace token of each set are not same type.
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12143
    if (actualToken.type !== expectedToken.type) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12144
      logger.warning('Expected token of type `%s` (%o), instead saw `%s` (%o).', expectedToken.type, expectedToken, actualToken.type, actualToken);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12145
      return false;
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12146
    }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12147
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12148
    // Defer custom token type equality handling, otherwise continue and
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12149
    // assume as equal.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12150
    const isEqualTokens = isEqualTokensOfType[actualToken.type];
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12151
    if (isEqualTokens && !isEqualTokens(actualToken, expectedToken, logger)) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12152
      return false;
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12153
    }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12154
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12155
    // Peek at the next tokens (actual and expected) to see if they close
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12156
    // a self-closing tag.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12157
    if (isClosedByToken(actualToken, expectedTokens[0])) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12158
      // Consume the next expected token that closes the current actual
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12159
      // self-closing token.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12160
      getNextNonWhitespaceToken(expectedTokens);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12161
    } else if (isClosedByToken(expectedToken, actualTokens[0])) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12162
      // Consume the next actual token that closes the current expected
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12163
      // self-closing token.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12164
      getNextNonWhitespaceToken(actualTokens);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12165
    }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12166
  }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12167
  if (expectedToken = getNextNonWhitespaceToken(expectedTokens)) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12168
    // If any non-whitespace tokens remain in expected token set, this
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12169
    // indicates inequality.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12170
    logger.warning('Expected %o, instead saw end of content.', expectedToken);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12171
    return false;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12172
  }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12173
  return true;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12174
}
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12175
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12176
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12177
 * Returns an object with `isValid` property set to `true` if the parsed block
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12178
 * is valid given the input content. A block is considered valid if, when serialized
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12179
 * with assumed attributes, the content matches the original value. If block is
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12180
 * invalid, this function returns all validations issues as well.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12181
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12182
 * @param {string|Object} blockTypeOrName      Block type.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12183
 * @param {Object}        attributes           Parsed block attributes.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12184
 * @param {string}        originalBlockContent Original block content.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12185
 * @param {Object}        logger               Validation logger object.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12186
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12187
 * @return {Object} Whether block is valid and contains validation messages.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12188
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12189
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12190
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12191
 * Returns an object with `isValid` property set to `true` if the parsed block
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12192
 * is valid given the input content. A block is considered valid if, when serialized
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12193
 * with assumed attributes, the content matches the original value. If block is
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12194
 * invalid, this function returns all validations issues as well.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12195
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12196
 * @param {WPBlock}            block                          block object.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12197
 * @param {WPBlockType|string} [blockTypeOrName = block.name] Block type or name, inferred from block if not given.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12198
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12199
 * @return {[boolean,Array<LoggerItem>]} validation results.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12200
 */
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12201
function validateBlock(block, blockTypeOrName = block.name) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12202
  const isFallbackBlock = block.name === getFreeformContentHandlerName() || block.name === getUnregisteredTypeHandlerName();
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12203
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12204
  // Shortcut to avoid costly validation.
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12205
  if (isFallbackBlock) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12206
    return [true, []];
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12207
  }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12208
  const logger = createQueuedLogger();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12209
  const blockType = normalizeBlockType(blockTypeOrName);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12210
  let generatedBlockContent;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12211
  try {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12212
    generatedBlockContent = getSaveContent(blockType, block.attributes);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12213
  } catch (error) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12214
    logger.error('Block validation failed because an error occurred while generating block content:\n\n%s', error.toString());
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12215
    return [false, logger.getItems()];
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12216
  }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12217
  const isValid = isEquivalentHTML(block.originalContent, generatedBlockContent, logger);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12218
  if (!isValid) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12219
    logger.error('Block validation failed for `%s` (%o).\n\nContent generated by `save` function:\n\n%s\n\nContent retrieved from post body:\n\n%s', blockType.name, blockType, generatedBlockContent, block.originalContent);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12220
  }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12221
  return [isValid, logger.getItems()];
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12222
}
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12223
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12224
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12225
 * Returns true if the parsed block is valid given the input content. A block
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12226
 * is considered valid if, when serialized with assumed attributes, the content
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12227
 * matches the original value.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12228
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12229
 * Logs to console in development environments when invalid.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12230
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12231
 * @deprecated Use validateBlock instead to avoid data loss.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12232
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12233
 * @param {string|Object} blockTypeOrName      Block type.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12234
 * @param {Object}        attributes           Parsed block attributes.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12235
 * @param {string}        originalBlockContent Original block content.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12236
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12237
 * @return {boolean} Whether block is valid.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12238
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12239
function isValidBlockContent(blockTypeOrName, attributes, originalBlockContent) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12240
  external_wp_deprecated_default()('isValidBlockContent introduces opportunity for data loss', {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12241
    since: '12.6',
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12242
    plugin: 'Gutenberg',
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12243
    alternative: 'validateBlock'
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12244
  });
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12245
  const blockType = normalizeBlockType(blockTypeOrName);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12246
  const block = {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12247
    name: blockType.name,
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12248
    attributes,
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12249
    innerBlocks: [],
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12250
    originalContent: originalBlockContent
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12251
  };
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12252
  const [isValid] = validateBlock(block, blockType);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12253
  return isValid;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12254
}
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12255
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12256
;// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/parser/convert-legacy-block.js
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12257
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12258
 * Convert legacy blocks to their canonical form. This function is used
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12259
 * both in the parser level for previous content and to convert such blocks
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12260
 * used in Custom Post Types templates.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12261
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12262
 * @param {string} name       The block's name
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12263
 * @param {Object} attributes The block's attributes
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12264
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12265
 * @return {[string, Object]} The block's name and attributes, changed accordingly if a match was found
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12266
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12267
function convertLegacyBlockNameAndAttributes(name, attributes) {
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12268
  const newAttributes = {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12269
    ...attributes
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12270
  };
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12271
  // Convert 'core/cover-image' block in existing content to 'core/cover'.
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12272
  if ('core/cover-image' === name) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12273
    name = 'core/cover';
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12274
  }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12275
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12276
  // Convert 'core/text' blocks in existing content to 'core/paragraph'.
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12277
  if ('core/text' === name || 'core/cover-text' === name) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12278
    name = 'core/paragraph';
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12279
  }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12280
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12281
  // Convert derivative blocks such as 'core/social-link-wordpress' to the
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12282
  // canonical form 'core/social-link'.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12283
  if (name && name.indexOf('core/social-link-') === 0) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12284
    // Capture `social-link-wordpress` into `{"service":"wordpress"}`
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12285
    newAttributes.service = name.substring(17);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12286
    name = 'core/social-link';
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12287
  }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12288
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12289
  // Convert derivative blocks such as 'core-embed/instagram' to the
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12290
  // canonical form 'core/embed'.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12291
  if (name && name.indexOf('core-embed/') === 0) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12292
    // Capture `core-embed/instagram` into `{"providerNameSlug":"instagram"}`
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12293
    const providerSlug = name.substring(11);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12294
    const deprecated = {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12295
      speaker: 'speaker-deck',
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12296
      polldaddy: 'crowdsignal'
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12297
    };
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12298
    newAttributes.providerNameSlug = providerSlug in deprecated ? deprecated[providerSlug] : providerSlug;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12299
    // This is needed as the `responsive` attribute was passed
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12300
    // in a different way before the refactoring to block variations.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12301
    if (!['amazon-kindle', 'wordpress'].includes(providerSlug)) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12302
      newAttributes.responsive = true;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12303
    }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12304
    name = 'core/embed';
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12305
  }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12306
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12307
  // Convert Post Comment blocks in existing content to Comment blocks.
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12308
  // TODO: Remove these checks when WordPress 6.0 is released.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12309
  if (name === 'core/post-comment-author') {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12310
    name = 'core/comment-author-name';
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12311
  }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12312
  if (name === 'core/post-comment-content') {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12313
    name = 'core/comment-content';
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12314
  }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12315
  if (name === 'core/post-comment-date') {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12316
    name = 'core/comment-date';
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12317
  }
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12318
  if (name === 'core/comments-query-loop') {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12319
    name = 'core/comments';
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12320
    const {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12321
      className = ''
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12322
    } = newAttributes;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12323
    if (!className.includes('wp-block-comments-query-loop')) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12324
      newAttributes.className = ['wp-block-comments-query-loop', className].join(' ');
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12325
    }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12326
    // Note that we also had to add a deprecation to the block in order
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12327
    // for the ID change to work.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12328
  }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12329
  if (name === 'core/post-comments') {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12330
    name = 'core/comments';
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12331
    newAttributes.legacy = true;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12332
  }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12333
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12334
  // The following code is only relevant for the Gutenberg plugin.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12335
  // It's a stand-alone if statement for dead-code elimination.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12336
  if (false) {}
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12337
  return [name, newAttributes];
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12338
}
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12339
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12340
;// CONCATENATED MODULE: ./node_modules/hpq/es/get-path.js
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12341
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12342
 * Given object and string of dot-delimited path segments, returns value at
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12343
 * path or undefined if path cannot be resolved.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12344
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12345
 * @param  {Object} object Lookup object
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12346
 * @param  {string} path   Path to resolve
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12347
 * @return {?*}            Resolved value
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12348
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12349
function getPath(object, path) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12350
  var segments = path.split('.');
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12351
  var segment;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12352
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12353
  while (segment = segments.shift()) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12354
    if (!(segment in object)) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12355
      return;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12356
    }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12357
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12358
    object = object[segment];
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12359
  }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12360
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12361
  return object;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12362
}
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12363
;// CONCATENATED MODULE: ./node_modules/hpq/es/index.js
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12364
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12365
 * Internal dependencies
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12366
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12367
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12368
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12369
 * Function returning a DOM document created by `createHTMLDocument`. The same
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12370
 * document is returned between invocations.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12371
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12372
 * @return {Document} DOM document.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12373
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12374
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12375
var getDocument = function () {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12376
  var doc;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12377
  return function () {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12378
    if (!doc) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12379
      doc = document.implementation.createHTMLDocument('');
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12380
    }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12381
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12382
    return doc;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12383
  };
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12384
}();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12385
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12386
 * Given a markup string or DOM element, creates an object aligning with the
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12387
 * shape of the matchers object, or the value returned by the matcher.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12388
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12389
 * @param  {(string|Element)}  source   Source content
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12390
 * @param  {(Object|Function)} matchers Matcher function or object of matchers
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12391
 * @return {(Object|*)}                 Matched value(s), shaped by object
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12392
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12393
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12394
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12395
function parse(source, matchers) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12396
  if (!matchers) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12397
    return;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12398
  } // Coerce to element
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12399
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12400
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12401
  if ('string' === typeof source) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12402
    var doc = getDocument();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12403
    doc.body.innerHTML = source;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12404
    source = doc.body;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12405
  } // Return singular value
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12406
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12407
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12408
  if ('function' === typeof matchers) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12409
    return matchers(source);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12410
  } // Bail if we can't handle matchers
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12411
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12412
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12413
  if (Object !== matchers.constructor) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12414
    return;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12415
  } // Shape result by matcher object
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12416
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12417
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12418
  return Object.keys(matchers).reduce(function (memo, key) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12419
    memo[key] = parse(source, matchers[key]);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12420
    return memo;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12421
  }, {});
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12422
}
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12423
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12424
 * Generates a function which matches node of type selector, returning an
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12425
 * attribute by property if the attribute exists. If no selector is passed,
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12426
 * returns property of the query element.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12427
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12428
 * @param  {?string} selector Optional selector
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12429
 * @param  {string}  name     Property name
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12430
 * @return {*}                Property value
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12431
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12432
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12433
function prop(selector, name) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12434
  if (1 === arguments.length) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12435
    name = selector;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12436
    selector = undefined;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12437
  }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12438
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12439
  return function (node) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12440
    var match = node;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12441
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12442
    if (selector) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12443
      match = node.querySelector(selector);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12444
    }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12445
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12446
    if (match) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12447
      return getPath(match, name);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12448
    }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12449
  };
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12450
}
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12451
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12452
 * Generates a function which matches node of type selector, returning an
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12453
 * attribute by name if the attribute exists. If no selector is passed,
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12454
 * returns attribute of the query element.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12455
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12456
 * @param  {?string} selector Optional selector
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12457
 * @param  {string}  name     Attribute name
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12458
 * @return {?string}          Attribute value
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12459
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12460
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12461
function attr(selector, name) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12462
  if (1 === arguments.length) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12463
    name = selector;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12464
    selector = undefined;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12465
  }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12466
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12467
  return function (node) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12468
    var attributes = prop(selector, 'attributes')(node);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12469
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12470
    if (attributes && attributes.hasOwnProperty(name)) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12471
      return attributes[name].value;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12472
    }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12473
  };
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12474
}
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12475
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12476
 * Convenience for `prop( selector, 'innerHTML' )`.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12477
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12478
 * @see prop()
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12479
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12480
 * @param  {?string} selector Optional selector
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12481
 * @return {string}           Inner HTML
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12482
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12483
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12484
function html(selector) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12485
  return prop(selector, 'innerHTML');
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12486
}
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12487
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12488
 * Convenience for `prop( selector, 'textContent' )`.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12489
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12490
 * @see prop()
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12491
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12492
 * @param  {?string} selector Optional selector
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12493
 * @return {string}           Text content
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12494
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12495
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12496
function es_text(selector) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12497
  return prop(selector, 'textContent');
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12498
}
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12499
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12500
 * Creates a new matching context by first finding elements matching selector
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12501
 * using querySelectorAll before then running another `parse` on `matchers`
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12502
 * scoped to the matched elements.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12503
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12504
 * @see parse()
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12505
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12506
 * @param  {string}            selector Selector to match
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12507
 * @param  {(Object|Function)} matchers Matcher function or object of matchers
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12508
 * @return {Array.<*,Object>}           Array of matched value(s)
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12509
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12510
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12511
function query(selector, matchers) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12512
  return function (node) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12513
    var matches = node.querySelectorAll(selector);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12514
    return [].map.call(matches, function (match) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12515
      return parse(match, matchers);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12516
    });
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12517
  };
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12518
}
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12519
;// CONCATENATED MODULE: ./node_modules/memize/dist/index.js
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12520
/**
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12521
 * Memize options object.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12522
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12523
 * @typedef MemizeOptions
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12524
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12525
 * @property {number} [maxSize] Maximum size of the cache.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12526
 */
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12527
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12528
/**
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12529
 * Internal cache entry.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12530
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12531
 * @typedef MemizeCacheNode
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12532
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12533
 * @property {?MemizeCacheNode|undefined} [prev] Previous node.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12534
 * @property {?MemizeCacheNode|undefined} [next] Next node.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12535
 * @property {Array<*>}                   args   Function arguments for cache
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12536
 *                                               entry.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12537
 * @property {*}                          val    Function result.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12538
 */
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12539
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12540
/**
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12541
 * Properties of the enhanced function for controlling cache.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12542
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12543
 * @typedef MemizeMemoizedFunction
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12544
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12545
 * @property {()=>void} clear Clear the cache.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12546
 */
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12547
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12548
/**
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12549
 * Accepts a function to be memoized, and returns a new memoized function, with
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12550
 * optional options.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12551
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12552
 * @template {(...args: any[]) => any} F
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12553
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12554
 * @param {F}             fn        Function to memoize.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12555
 * @param {MemizeOptions} [options] Options object.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12556
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12557
 * @return {((...args: Parameters<F>) => ReturnType<F>) & MemizeMemoizedFunction} Memoized function.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12558
 */
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12559
function memize(fn, options) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12560
	var size = 0;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12561
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12562
	/** @type {?MemizeCacheNode|undefined} */
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12563
	var head;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12564
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12565
	/** @type {?MemizeCacheNode|undefined} */
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12566
	var tail;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12567
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12568
	options = options || {};
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12569
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12570
	function memoized(/* ...args */) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12571
		var node = head,
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12572
			len = arguments.length,
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12573
			args,
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12574
			i;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12575
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12576
		searchCache: while (node) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12577
			// Perform a shallow equality test to confirm that whether the node
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12578
			// under test is a candidate for the arguments passed. Two arrays
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12579
			// are shallowly equal if their length matches and each entry is
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12580
			// strictly equal between the two sets. Avoid abstracting to a
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12581
			// function which could incur an arguments leaking deoptimization.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12582
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12583
			// Check whether node arguments match arguments length
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12584
			if (node.args.length !== arguments.length) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12585
				node = node.next;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12586
				continue;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12587
			}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12588
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12589
			// Check whether node arguments match arguments values
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12590
			for (i = 0; i < len; i++) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12591
				if (node.args[i] !== arguments[i]) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12592
					node = node.next;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12593
					continue searchCache;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12594
				}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12595
			}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12596
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12597
			// At this point we can assume we've found a match
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12598
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12599
			// Surface matched node to head if not already
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12600
			if (node !== head) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12601
				// As tail, shift to previous. Must only shift if not also
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12602
				// head, since if both head and tail, there is no previous.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12603
				if (node === tail) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12604
					tail = node.prev;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12605
				}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12606
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12607
				// Adjust siblings to point to each other. If node was tail,
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12608
				// this also handles new tail's empty `next` assignment.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12609
				/** @type {MemizeCacheNode} */ (node.prev).next = node.next;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12610
				if (node.next) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12611
					node.next.prev = node.prev;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12612
				}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12613
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12614
				node.next = head;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12615
				node.prev = null;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12616
				/** @type {MemizeCacheNode} */ (head).prev = node;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12617
				head = node;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12618
			}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12619
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12620
			// Return immediately
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12621
			return node.val;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12622
		}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12623
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12624
		// No cached value found. Continue to insertion phase:
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12625
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12626
		// Create a copy of arguments (avoid leaking deoptimization)
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12627
		args = new Array(len);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12628
		for (i = 0; i < len; i++) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12629
			args[i] = arguments[i];
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12630
		}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12631
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12632
		node = {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12633
			args: args,
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12634
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12635
			// Generate the result from original function
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12636
			val: fn.apply(null, args),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12637
		};
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12638
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12639
		// Don't need to check whether node is already head, since it would
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12640
		// have been returned above already if it was
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12641
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12642
		// Shift existing head down list
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12643
		if (head) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12644
			head.prev = node;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12645
			node.next = head;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12646
		} else {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12647
			// If no head, follows that there's no tail (at initial or reset)
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12648
			tail = node;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12649
		}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12650
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12651
		// Trim tail if we're reached max size and are pending cache insertion
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12652
		if (size === /** @type {MemizeOptions} */ (options).maxSize) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12653
			tail = /** @type {MemizeCacheNode} */ (tail).prev;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12654
			/** @type {MemizeCacheNode} */ (tail).next = null;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12655
		} else {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12656
			size++;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12657
		}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12658
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12659
		head = node;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12660
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12661
		return node.val;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12662
	}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12663
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12664
	memoized.clear = function () {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12665
		head = null;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12666
		tail = null;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12667
		size = 0;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12668
	};
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12669
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12670
	// Ignore reason: There's not a clear solution to create an intersection of
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12671
	// the function with additional properties, where the goal is to retain the
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12672
	// function signature of the incoming argument and add control properties
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12673
	// on the return value.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12674
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12675
	// @ts-ignore
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12676
	return memoized;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12677
}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12678
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12679
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12680
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12681
;// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/matchers.js
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12682
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12683
 * External dependencies
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12684
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12685
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12686
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12687
/**
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12688
 * WordPress dependencies
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12689
 */
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12690
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12691
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12692
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12693
 * Internal dependencies
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12694
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12695
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12696
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12697
function matchers_html(selector, multilineTag) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12698
  return domNode => {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12699
    let match = domNode;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12700
    if (selector) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12701
      match = domNode.querySelector(selector);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12702
    }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12703
    if (!match) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12704
      return '';
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12705
    }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12706
    if (multilineTag) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12707
      let value = '';
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12708
      const length = match.children.length;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12709
      for (let index = 0; index < length; index++) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12710
        const child = match.children[index];
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12711
        if (child.nodeName.toLowerCase() !== multilineTag) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12712
          continue;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12713
        }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12714
        value += child.outerHTML;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12715
      }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12716
      return value;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12717
    }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12718
    return match.innerHTML;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12719
  };
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12720
}
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12721
const richText = (selector, preserveWhiteSpace) => el => {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12722
  const target = selector ? el.querySelector(selector) : el;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12723
  return target ? external_wp_richText_namespaceObject.RichTextData.fromHTMLElement(target, {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12724
    preserveWhiteSpace
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12725
  }) : external_wp_richText_namespaceObject.RichTextData.empty();
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12726
};
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12727
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12728
;// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/node.js
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12729
/**
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12730
 * WordPress dependencies
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12731
 */
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12732
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12733
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12734
/**
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12735
 * Internal dependencies
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12736
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12737
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12738
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12739
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12740
 * A representation of a single node within a block's rich text value. If
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12741
 * representing a text node, the value is simply a string of the node value.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12742
 * As representing an element node, it is an object of:
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12743
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12744
 * 1. `type` (string): Tag name.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12745
 * 2. `props` (object): Attributes and children array of WPBlockNode.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12746
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12747
 * @typedef {string|Object} WPBlockNode
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12748
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12749
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12750
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12751
 * Given a single node and a node type (e.g. `'br'`), returns true if the node
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12752
 * corresponds to that type, false otherwise.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12753
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12754
 * @param {WPBlockNode} node Block node to test
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12755
 * @param {string}      type Node to type to test against.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12756
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12757
 * @return {boolean} Whether node is of intended type.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12758
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12759
function isNodeOfType(node, type) {
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12760
  external_wp_deprecated_default()('wp.blocks.node.isNodeOfType', {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12761
    since: '6.1',
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12762
    version: '6.3',
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12763
    link: 'https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/introducing-attributes-and-editable-fields/'
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12764
  });
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12765
  return node && node.type === type;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12766
}
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12767
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12768
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12769
 * Given an object implementing the NamedNodeMap interface, returns a plain
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12770
 * object equivalent value of name, value key-value pairs.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12771
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12772
 * @see https://dom.spec.whatwg.org/#interface-namednodemap
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12773
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12774
 * @param {NamedNodeMap} nodeMap NamedNodeMap to convert to object.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12775
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12776
 * @return {Object} Object equivalent value of NamedNodeMap.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12777
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12778
function getNamedNodeMapAsObject(nodeMap) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12779
  const result = {};
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12780
  for (let i = 0; i < nodeMap.length; i++) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12781
    const {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12782
      name,
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12783
      value
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12784
    } = nodeMap[i];
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12785
    result[name] = value;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12786
  }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12787
  return result;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12788
}
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12789
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12790
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12791
 * Given a DOM Element or Text node, returns an equivalent block node. Throws
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12792
 * if passed any node type other than element or text.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12793
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12794
 * @throws {TypeError} If non-element/text node is passed.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12795
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12796
 * @param {Node} domNode DOM node to convert.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12797
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12798
 * @return {WPBlockNode} Block node equivalent to DOM node.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12799
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12800
function fromDOM(domNode) {
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12801
  external_wp_deprecated_default()('wp.blocks.node.fromDOM', {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12802
    since: '6.1',
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12803
    version: '6.3',
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12804
    alternative: 'wp.richText.create',
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12805
    link: 'https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/introducing-attributes-and-editable-fields/'
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12806
  });
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12807
  if (domNode.nodeType === domNode.TEXT_NODE) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12808
    return domNode.nodeValue;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12809
  }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12810
  if (domNode.nodeType !== domNode.ELEMENT_NODE) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12811
    throw new TypeError('A block node can only be created from a node of type text or ' + 'element.');
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12812
  }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12813
  return {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12814
    type: domNode.nodeName.toLowerCase(),
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12815
    props: {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12816
      ...getNamedNodeMapAsObject(domNode.attributes),
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12817
      children: children_fromDOM(domNode.childNodes)
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12818
    }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12819
  };
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12820
}
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12821
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12822
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12823
 * Given a block node, returns its HTML string representation.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12824
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12825
 * @param {WPBlockNode} node Block node to convert to string.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12826
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12827
 * @return {string} String HTML representation of block node.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12828
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12829
function toHTML(node) {
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12830
  external_wp_deprecated_default()('wp.blocks.node.toHTML', {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12831
    since: '6.1',
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12832
    version: '6.3',
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12833
    alternative: 'wp.richText.toHTMLString',
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12834
    link: 'https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/introducing-attributes-and-editable-fields/'
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12835
  });
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12836
  return children_toHTML([node]);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12837
}
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12838
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12839
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12840
 * Given a selector, returns an hpq matcher generating a WPBlockNode value
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12841
 * matching the selector result.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12842
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12843
 * @param {string} selector DOM selector.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12844
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12845
 * @return {Function} hpq matcher.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12846
 */
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12847
function matcher(selector) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12848
  external_wp_deprecated_default()('wp.blocks.node.matcher', {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12849
    since: '6.1',
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12850
    version: '6.3',
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12851
    alternative: 'html source',
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12852
    link: 'https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/introducing-attributes-and-editable-fields/'
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12853
  });
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12854
  return domNode => {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12855
    let match = domNode;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12856
    if (selector) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12857
      match = domNode.querySelector(selector);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12858
    }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12859
    try {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12860
      return fromDOM(match);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12861
    } catch (error) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12862
      return null;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12863
    }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12864
  };
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12865
}
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12866
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12867
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12868
 * Object of utility functions used in managing block attribute values of
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12869
 * source `node`.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12870
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12871
 * @see https://github.com/WordPress/gutenberg/pull/10439
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12872
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12873
 * @deprecated since 4.0. The `node` source should not be used, and can be
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12874
 *             replaced by the `html` source.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12875
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12876
 * @private
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12877
 */
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12878
/* harmony default export */ const node = ({
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12879
  isNodeOfType,
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12880
  fromDOM,
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12881
  toHTML,
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12882
  matcher
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12883
});
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12884
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12885
;// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/children.js
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12886
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12887
 * WordPress dependencies
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12888
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12889
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12890
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12891
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12892
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12893
 * Internal dependencies
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12894
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12895
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12896
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12897
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12898
 * A representation of a block's rich text value.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12899
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12900
 * @typedef {WPBlockNode[]} WPBlockChildren
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12901
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12902
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12903
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12904
 * Given block children, returns a serialize-capable WordPress element.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12905
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12906
 * @param {WPBlockChildren} children Block children object to convert.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12907
 *
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12908
 * @return {Element} A serialize-capable element.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12909
 */
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12910
function getSerializeCapableElement(children) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12911
  // The fact that block children are compatible with the element serializer is
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12912
  // merely an implementation detail that currently serves to be true, but
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12913
  // should not be mistaken as being a guarantee on the external API. The
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12914
  // public API only offers guarantees to work with strings (toHTML) and DOM
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12915
  // elements (fromDOM), and should provide utilities to manipulate the value
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12916
  // rather than expect consumers to inspect or construct its shape (concat).
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12917
  return children;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12918
}
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12919
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12920
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12921
 * Given block children, returns an array of block nodes.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12922
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12923
 * @param {WPBlockChildren} children Block children object to convert.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12924
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12925
 * @return {Array<WPBlockNode>} An array of individual block nodes.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12926
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12927
function getChildrenArray(children) {
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12928
  external_wp_deprecated_default()('wp.blocks.children.getChildrenArray', {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12929
    since: '6.1',
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12930
    version: '6.3',
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12931
    link: 'https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/introducing-attributes-and-editable-fields/'
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12932
  });
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12933
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12934
  // The fact that block children are compatible with the element serializer
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12935
  // is merely an implementation detail that currently serves to be true, but
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12936
  // should not be mistaken as being a guarantee on the external API.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12937
  return children;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12938
}
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12939
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12940
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12941
 * Given two or more block nodes, returns a new block node representing a
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12942
 * concatenation of its values.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12943
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12944
 * @param {...WPBlockChildren} blockNodes Block nodes to concatenate.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12945
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12946
 * @return {WPBlockChildren} Concatenated block node.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12947
 */
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12948
function concat(...blockNodes) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12949
  external_wp_deprecated_default()('wp.blocks.children.concat', {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12950
    since: '6.1',
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12951
    version: '6.3',
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12952
    alternative: 'wp.richText.concat',
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12953
    link: 'https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/introducing-attributes-and-editable-fields/'
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12954
  });
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12955
  const result = [];
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12956
  for (let i = 0; i < blockNodes.length; i++) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12957
    const blockNode = Array.isArray(blockNodes[i]) ? blockNodes[i] : [blockNodes[i]];
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12958
    for (let j = 0; j < blockNode.length; j++) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12959
      const child = blockNode[j];
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12960
      const canConcatToPreviousString = typeof child === 'string' && typeof result[result.length - 1] === 'string';
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12961
      if (canConcatToPreviousString) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12962
        result[result.length - 1] += child;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12963
      } else {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12964
        result.push(child);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12965
      }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12966
    }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12967
  }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12968
  return result;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12969
}
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12970
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12971
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12972
 * Given an iterable set of DOM nodes, returns equivalent block children.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12973
 * Ignores any non-element/text nodes included in set.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12974
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12975
 * @param {Iterable.<Node>} domNodes Iterable set of DOM nodes to convert.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12976
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12977
 * @return {WPBlockChildren} Block children equivalent to DOM nodes.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12978
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12979
function children_fromDOM(domNodes) {
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12980
  external_wp_deprecated_default()('wp.blocks.children.fromDOM', {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12981
    since: '6.1',
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12982
    version: '6.3',
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12983
    alternative: 'wp.richText.create',
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12984
    link: 'https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/introducing-attributes-and-editable-fields/'
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12985
  });
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12986
  const result = [];
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12987
  for (let i = 0; i < domNodes.length; i++) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12988
    try {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12989
      result.push(fromDOM(domNodes[i]));
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12990
    } catch (error) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12991
      // Simply ignore if DOM node could not be converted.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12992
    }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12993
  }
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12994
  return result;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12995
}
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 12996
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12997
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12998
 * Given a block node, returns its HTML string representation.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 12999
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13000
 * @param {WPBlockChildren} children Block node(s) to convert to string.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13001
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13002
 * @return {string} String HTML representation of block node.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13003
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13004
function children_toHTML(children) {
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13005
  external_wp_deprecated_default()('wp.blocks.children.toHTML', {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13006
    since: '6.1',
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13007
    version: '6.3',
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13008
    alternative: 'wp.richText.toHTMLString',
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13009
    link: 'https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/introducing-attributes-and-editable-fields/'
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13010
  });
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13011
  const element = getSerializeCapableElement(children);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13012
  return (0,external_wp_element_namespaceObject.renderToString)(element);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13013
}
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13014
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13015
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13016
 * Given a selector, returns an hpq matcher generating a WPBlockChildren value
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13017
 * matching the selector result.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13018
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13019
 * @param {string} selector DOM selector.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13020
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13021
 * @return {Function} hpq matcher.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13022
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13023
function children_matcher(selector) {
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13024
  external_wp_deprecated_default()('wp.blocks.children.matcher', {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13025
    since: '6.1',
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13026
    version: '6.3',
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13027
    alternative: 'html source',
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13028
    link: 'https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/introducing-attributes-and-editable-fields/'
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13029
  });
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13030
  return domNode => {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13031
    let match = domNode;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13032
    if (selector) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13033
      match = domNode.querySelector(selector);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13034
    }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13035
    if (match) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13036
      return children_fromDOM(match.childNodes);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13037
    }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13038
    return [];
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13039
  };
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13040
}
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13041
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13042
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13043
 * Object of utility functions used in managing block attribute values of
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13044
 * source `children`.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13045
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13046
 * @see https://github.com/WordPress/gutenberg/pull/10439
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13047
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13048
 * @deprecated since 4.0. The `children` source should not be used, and can be
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13049
 *             replaced by the `html` source.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13050
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13051
 * @private
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13052
 */
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13053
/* harmony default export */ const children = ({
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13054
  concat,
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13055
  getChildrenArray,
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13056
  fromDOM: children_fromDOM,
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13057
  toHTML: children_toHTML,
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13058
  matcher: children_matcher
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13059
});
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13060
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13061
;// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/parser/get-block-attributes.js
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13062
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13063
 * External dependencies
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13064
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13065
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13066
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13067
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13068
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13069
 * WordPress dependencies
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13070
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13071
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13072
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13073
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13074
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13075
 * Internal dependencies
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13076
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13077
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13078
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13079
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13080
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13081
 * Higher-order hpq matcher which enhances an attribute matcher to return true
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13082
 * or false depending on whether the original matcher returns undefined. This
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13083
 * is useful for boolean attributes (e.g. disabled) whose attribute values may
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13084
 * be technically falsey (empty string), though their mere presence should be
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13085
 * enough to infer as true.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13086
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13087
 * @param {Function} matcher Original hpq matcher.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13088
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13089
 * @return {Function} Enhanced hpq matcher.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13090
 */
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13091
const toBooleanAttributeMatcher = matcher => value => matcher(value) !== undefined;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13092
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13093
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13094
 * Returns true if value is of the given JSON schema type, or false otherwise.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13095
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13096
 * @see http://json-schema.org/latest/json-schema-validation.html#rfc.section.6.25
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13097
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13098
 * @param {*}      value Value to test.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13099
 * @param {string} type  Type to test.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13100
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13101
 * @return {boolean} Whether value is of type.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13102
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13103
function isOfType(value, type) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13104
  switch (type) {
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13105
    case 'rich-text':
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13106
      return value instanceof external_wp_richText_namespaceObject.RichTextData;
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13107
    case 'string':
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13108
      return typeof value === 'string';
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13109
    case 'boolean':
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13110
      return typeof value === 'boolean';
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13111
    case 'object':
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13112
      return !!value && value.constructor === Object;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13113
    case 'null':
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13114
      return value === null;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13115
    case 'array':
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13116
      return Array.isArray(value);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13117
    case 'integer':
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13118
    case 'number':
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13119
      return typeof value === 'number';
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13120
  }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13121
  return true;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13122
}
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13123
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13124
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13125
 * Returns true if value is of an array of given JSON schema types, or false
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13126
 * otherwise.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13127
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13128
 * @see http://json-schema.org/latest/json-schema-validation.html#rfc.section.6.25
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13129
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13130
 * @param {*}        value Value to test.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13131
 * @param {string[]} types Types to test.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13132
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13133
 * @return {boolean} Whether value is of types.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13134
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13135
function isOfTypes(value, types) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13136
  return types.some(type => isOfType(value, type));
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13137
}
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13138
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13139
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13140
 * Given an attribute key, an attribute's schema, a block's raw content and the
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13141
 * commentAttributes returns the attribute value depending on its source
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13142
 * definition of the given attribute key.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13143
 *
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13144
 * @param {string} attributeKey      Attribute key.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13145
 * @param {Object} attributeSchema   Attribute's schema.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13146
 * @param {Node}   innerDOM          Parsed DOM of block's inner HTML.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13147
 * @param {Object} commentAttributes Block's comment attributes.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13148
 * @param {string} innerHTML         Raw HTML from block node's innerHTML property.
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13149
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13150
 * @return {*} Attribute value.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13151
 */
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13152
function getBlockAttribute(attributeKey, attributeSchema, innerDOM, commentAttributes, innerHTML) {
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13153
  let value;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13154
  switch (attributeSchema.source) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13155
    // An undefined source means that it's an attribute serialized to the
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13156
    // block's "comment".
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13157
    case undefined:
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13158
      value = commentAttributes ? commentAttributes[attributeKey] : undefined;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13159
      break;
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13160
    // raw source means that it's the original raw block content.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13161
    case 'raw':
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13162
      value = innerHTML;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13163
      break;
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13164
    case 'attribute':
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13165
    case 'property':
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13166
    case 'html':
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13167
    case 'text':
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13168
    case 'rich-text':
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13169
    case 'children':
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13170
    case 'node':
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13171
    case 'query':
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13172
    case 'tag':
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13173
      value = parseWithAttributeSchema(innerDOM, attributeSchema);
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13174
      break;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13175
  }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13176
  if (!isValidByType(value, attributeSchema.type) || !isValidByEnum(value, attributeSchema.enum)) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13177
    // Reject the value if it is not valid. Reverting to the undefined
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13178
    // value ensures the default is respected, if applicable.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13179
    value = undefined;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13180
  }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13181
  if (value === undefined) {
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13182
    value = getDefault(attributeSchema);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13183
  }
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13184
  return value;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13185
}
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13186
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13187
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13188
 * Returns true if value is valid per the given block attribute schema type
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13189
 * definition, or false otherwise.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13190
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13191
 * @see https://json-schema.org/latest/json-schema-validation.html#rfc.section.6.1.1
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13192
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13193
 * @param {*}                       value Value to test.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13194
 * @param {?(Array<string>|string)} type  Block attribute schema type.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13195
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13196
 * @return {boolean} Whether value is valid.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13197
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13198
function isValidByType(value, type) {
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13199
  return type === undefined || isOfTypes(value, Array.isArray(type) ? type : [type]);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13200
}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13201
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13202
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13203
 * Returns true if value is valid per the given block attribute schema enum
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13204
 * definition, or false otherwise.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13205
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13206
 * @see https://json-schema.org/latest/json-schema-validation.html#rfc.section.6.1.2
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13207
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13208
 * @param {*}      value   Value to test.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13209
 * @param {?Array} enumSet Block attribute schema enum.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13210
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13211
 * @return {boolean} Whether value is valid.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13212
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13213
function isValidByEnum(value, enumSet) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13214
  return !Array.isArray(enumSet) || enumSet.includes(value);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13215
}
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13216
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13217
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13218
 * Returns an hpq matcher given a source object.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13219
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13220
 * @param {Object} sourceConfig Attribute Source object.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13221
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13222
 * @return {Function} A hpq Matcher.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13223
 */
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13224
const matcherFromSource = memize(sourceConfig => {
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13225
  switch (sourceConfig.source) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13226
    case 'attribute':
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13227
      {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13228
        let matcher = attr(sourceConfig.selector, sourceConfig.attribute);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13229
        if (sourceConfig.type === 'boolean') {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13230
          matcher = toBooleanAttributeMatcher(matcher);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13231
        }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13232
        return matcher;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13233
      }
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13234
    case 'html':
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13235
      return matchers_html(sourceConfig.selector, sourceConfig.multiline);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13236
    case 'text':
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13237
      return es_text(sourceConfig.selector);
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13238
    case 'rich-text':
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13239
      return richText(sourceConfig.selector, sourceConfig.__unstablePreserveWhiteSpace);
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13240
    case 'children':
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13241
      return children_matcher(sourceConfig.selector);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13242
    case 'node':
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13243
      return matcher(sourceConfig.selector);
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13244
    case 'query':
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13245
      const subMatchers = Object.fromEntries(Object.entries(sourceConfig.query).map(([key, subSourceConfig]) => [key, matcherFromSource(subSourceConfig)]));
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13246
      return query(sourceConfig.selector, subMatchers);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13247
    case 'tag':
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13248
      {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13249
        const matcher = prop(sourceConfig.selector, 'nodeName');
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13250
        return domNode => matcher(domNode)?.toLowerCase();
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13251
      }
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13252
    default:
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13253
      // eslint-disable-next-line no-console
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13254
      console.error(`Unknown source type "${sourceConfig.source}"`);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13255
  }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13256
});
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13257
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13258
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13259
 * Parse a HTML string into DOM tree.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13260
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13261
 * @param {string|Node} innerHTML HTML string or already parsed DOM node.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13262
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13263
 * @return {Node} Parsed DOM node.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13264
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13265
function parseHtml(innerHTML) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13266
  return parse(innerHTML, h => h);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13267
}
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13268
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13269
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13270
 * Given a block's raw content and an attribute's schema returns the attribute's
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13271
 * value depending on its source.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13272
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13273
 * @param {string|Node} innerHTML       Block's raw content.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13274
 * @param {Object}      attributeSchema Attribute's schema.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13275
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13276
 * @return {*} Attribute value.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13277
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13278
function parseWithAttributeSchema(innerHTML, attributeSchema) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13279
  return matcherFromSource(attributeSchema)(parseHtml(innerHTML));
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13280
}
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13281
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13282
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13283
 * Returns the block attributes of a registered block node given its type.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13284
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13285
 * @param {string|Object} blockTypeOrName Block type or name.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13286
 * @param {string|Node}   innerHTML       Raw block content.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13287
 * @param {?Object}       attributes      Known block attributes (from delimiters).
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13288
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13289
 * @return {Object} All block attributes.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13290
 */
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13291
function getBlockAttributes(blockTypeOrName, innerHTML, attributes = {}) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13292
  var _blockType$attributes;
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13293
  const doc = parseHtml(innerHTML);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13294
  const blockType = normalizeBlockType(blockTypeOrName);
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13295
  const blockAttributes = Object.fromEntries(Object.entries((_blockType$attributes = blockType.attributes) !== null && _blockType$attributes !== void 0 ? _blockType$attributes : {}).map(([key, schema]) => [key, getBlockAttribute(key, schema, doc, attributes, innerHTML)]));
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13296
  return (0,external_wp_hooks_namespaceObject.applyFilters)('blocks.getBlockAttributes', blockAttributes, blockType, innerHTML, attributes);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13297
}
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13298
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13299
;// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/parser/fix-custom-classname.js
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13300
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13301
 * Internal dependencies
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13302
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13303
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13304
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13305
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13306
const CLASS_ATTR_SCHEMA = {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13307
  type: 'string',
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13308
  source: 'attribute',
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13309
  selector: '[data-custom-class-name] > *',
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13310
  attribute: 'class'
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13311
};
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13312
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13313
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13314
 * Given an HTML string, returns an array of class names assigned to the root
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13315
 * element in the markup.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13316
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13317
 * @param {string} innerHTML Markup string from which to extract classes.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13318
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13319
 * @return {string[]} Array of class names assigned to the root element.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13320
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13321
function getHTMLRootElementClasses(innerHTML) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13322
  const parsed = parseWithAttributeSchema(`<div data-custom-class-name>${innerHTML}</div>`, CLASS_ATTR_SCHEMA);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13323
  return parsed ? parsed.trim().split(/\s+/) : [];
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13324
}
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13325
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13326
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13327
 * Given a parsed set of block attributes, if the block supports custom class
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13328
 * names and an unknown class (per the block's serialization behavior) is
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13329
 * found, the unknown classes are treated as custom classes. This prevents the
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13330
 * block from being considered as invalid.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13331
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13332
 * @param {Object} blockAttributes Original block attributes.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13333
 * @param {Object} blockType       Block type settings.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13334
 * @param {string} innerHTML       Original block markup.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13335
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13336
 * @return {Object} Filtered block attributes.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13337
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13338
function fixCustomClassname(blockAttributes, blockType, innerHTML) {
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13339
  if (hasBlockSupport(blockType, 'customClassName', true)) {
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13340
    // To determine difference, serialize block given the known set of
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13341
    // attributes, with the exception of `className`. This will determine
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13342
    // the default set of classes. From there, any difference in innerHTML
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13343
    // can be considered as custom classes.
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13344
    const {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13345
      className: omittedClassName,
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13346
      ...attributesSansClassName
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13347
    } = blockAttributes;
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13348
    const serialized = getSaveContent(blockType, attributesSansClassName);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13349
    const defaultClasses = getHTMLRootElementClasses(serialized);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13350
    const actualClasses = getHTMLRootElementClasses(innerHTML);
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13351
    const customClasses = actualClasses.filter(className => !defaultClasses.includes(className));
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13352
    if (customClasses.length) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13353
      blockAttributes.className = customClasses.join(' ');
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13354
    } else if (serialized) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13355
      delete blockAttributes.className;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13356
    }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13357
  }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13358
  return blockAttributes;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13359
}
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13360
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13361
;// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/parser/apply-built-in-validation-fixes.js
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13362
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13363
 * Internal dependencies
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13364
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13365
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13366
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13367
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13368
 * Attempts to fix block invalidation by applying build-in validation fixes
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13369
 * like moving all extra classNames to the className attribute.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13370
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13371
 * @param {WPBlock}                               block     block object.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13372
 * @param {import('../registration').WPBlockType} blockType Block type. This is normalize not necessary and
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13373
 *                                                          can be inferred from the block name,
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13374
 *                                                          but it's here for performance reasons.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13375
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13376
 * @return {WPBlock} Fixed block object
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13377
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13378
function applyBuiltInValidationFixes(block, blockType) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13379
  const updatedBlockAttributes = fixCustomClassname(block.attributes, blockType, block.originalContent);
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13380
  return {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13381
    ...block,
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13382
    attributes: updatedBlockAttributes
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13383
  };
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13384
}
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13385
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13386
;// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/parser/apply-block-deprecated-versions.js
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13387
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13388
 * Internal dependencies
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13389
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13390
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13391
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13392
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13393
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13394
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13395
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13396
/**
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13397
 * Function that takes no arguments and always returns false.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13398
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13399
 * @return {boolean} Always returns false.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13400
 */
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13401
function stubFalse() {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13402
  return false;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13403
}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13404
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13405
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13406
 * Given a block object, returns a new copy of the block with any applicable
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13407
 * deprecated migrations applied, or the original block if it was both valid
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13408
 * and no eligible migrations exist.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13409
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13410
 * @param {import(".").WPBlock}                   block     Parsed and invalid block object.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13411
 * @param {import(".").WPRawBlock}                rawBlock  Raw block object.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13412
 * @param {import('../registration').WPBlockType} blockType Block type. This is normalize not necessary and
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13413
 *                                                          can be inferred from the block name,
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13414
 *                                                          but it's here for performance reasons.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13415
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13416
 * @return {import(".").WPBlock} Migrated block object.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13417
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13418
function applyBlockDeprecatedVersions(block, rawBlock, blockType) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13419
  const parsedAttributes = rawBlock.attrs;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13420
  const {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13421
    deprecated: deprecatedDefinitions
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13422
  } = blockType;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13423
  // Bail early if there are no registered deprecations to be handled.
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13424
  if (!deprecatedDefinitions || !deprecatedDefinitions.length) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13425
    return block;
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13426
  }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13427
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13428
  // By design, blocks lack any sort of version tracking. Instead, to process
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13429
  // outdated content the system operates a queue out of all the defined
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13430
  // attribute shapes and tries each definition until the input produces a
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13431
  // valid result. This mechanism seeks to avoid polluting the user-space with
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13432
  // machine-specific code. An invalid block is thus a block that could not be
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13433
  // matched successfully with any of the registered deprecation definitions.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13434
  for (let i = 0; i < deprecatedDefinitions.length; i++) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13435
    // A block can opt into a migration even if the block is valid by
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13436
    // defining `isEligible` on its deprecation. If the block is both valid
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13437
    // and does not opt to migrate, skip.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13438
    const {
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13439
      isEligible = stubFalse
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13440
    } = deprecatedDefinitions[i];
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13441
    if (block.isValid && !isEligible(parsedAttributes, block.innerBlocks, {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13442
      blockNode: rawBlock,
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13443
      block
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13444
    })) {
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13445
      continue;
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13446
    }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13447
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13448
    // Block type properties which could impact either serialization or
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13449
    // parsing are not considered in the deprecated block type by default,
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13450
    // and must be explicitly provided.
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13451
    const deprecatedBlockType = Object.assign(omit(blockType, DEPRECATED_ENTRY_KEYS), deprecatedDefinitions[i]);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13452
    let migratedBlock = {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13453
      ...block,
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13454
      attributes: getBlockAttributes(deprecatedBlockType, block.originalContent, parsedAttributes)
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13455
    };
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13456
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13457
    // Ignore the deprecation if it produces a block which is not valid.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13458
    let [isValid] = validateBlock(migratedBlock, deprecatedBlockType);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13459
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13460
    // If the migrated block is not valid initially, try the built-in fixes.
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13461
    if (!isValid) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13462
      migratedBlock = applyBuiltInValidationFixes(migratedBlock, deprecatedBlockType);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13463
      [isValid] = validateBlock(migratedBlock, deprecatedBlockType);
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13464
    }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13465
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13466
    // An invalid block does not imply incorrect HTML but the fact block
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13467
    // source information could be lost on re-serialization.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13468
    if (!isValid) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13469
      continue;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13470
    }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13471
    let migratedInnerBlocks = migratedBlock.innerBlocks;
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13472
    let migratedAttributes = migratedBlock.attributes;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13473
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13474
    // A block may provide custom behavior to assign new attributes and/or
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13475
    // inner blocks.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13476
    const {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13477
      migrate
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13478
    } = deprecatedBlockType;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13479
    if (migrate) {
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13480
      let migrated = migrate(migratedAttributes, block.innerBlocks);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13481
      if (!Array.isArray(migrated)) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13482
        migrated = [migrated];
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13483
      }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13484
      [migratedAttributes = parsedAttributes, migratedInnerBlocks = block.innerBlocks] = migrated;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13485
    }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13486
    block = {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13487
      ...block,
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13488
      attributes: migratedAttributes,
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13489
      innerBlocks: migratedInnerBlocks,
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13490
      isValid: true,
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13491
      validationIssues: []
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13492
    };
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13493
  }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13494
  return block;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13495
}
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13496
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13497
;// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/parser/index.js
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13498
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13499
 * WordPress dependencies
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13500
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13501
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13502
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13503
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13504
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13505
 * Internal dependencies
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13506
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13507
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13508
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13509
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13510
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13511
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13512
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13513
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13514
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13515
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13516
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13517
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13518
 * The raw structure of a block includes its attributes, inner
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13519
 * blocks, and inner HTML. It is important to distinguish inner blocks from
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13520
 * the HTML content of the block as only the latter is relevant for block
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13521
 * validation and edit operations.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13522
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13523
 * @typedef WPRawBlock
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13524
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13525
 * @property {string=}         blockName    Block name
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13526
 * @property {Object=}         attrs        Block raw or comment attributes.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13527
 * @property {string}          innerHTML    HTML content of the block.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13528
 * @property {(string|null)[]} innerContent Content without inner blocks.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13529
 * @property {WPRawBlock[]}    innerBlocks  Inner Blocks.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13530
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13531
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13532
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13533
 * Fully parsed block object.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13534
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13535
 * @typedef WPBlock
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13536
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13537
 * @property {string}     name                    Block name
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13538
 * @property {Object}     attributes              Block raw or comment attributes.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13539
 * @property {WPBlock[]}  innerBlocks             Inner Blocks.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13540
 * @property {string}     originalContent         Original content of the block before validation fixes.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13541
 * @property {boolean}    isValid                 Whether the block is valid.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13542
 * @property {Object[]}   validationIssues        Validation issues.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13543
 * @property {WPRawBlock} [__unstableBlockSource] Un-processed original copy of block if created through parser.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13544
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13545
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13546
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13547
 * @typedef  {Object}  ParseOptions
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13548
 * @property {boolean?} __unstableSkipMigrationLogs If a block is migrated from a deprecated version, skip logging the migration details.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13549
 * @property {boolean?} __unstableSkipAutop         Whether to skip autop when processing freeform content.
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13550
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13551
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13552
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13553
 * Convert legacy blocks to their canonical form. This function is used
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13554
 * both in the parser level for previous content and to convert such blocks
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13555
 * used in Custom Post Types templates.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13556
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13557
 * @param {WPRawBlock} rawBlock
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13558
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13559
 * @return {WPRawBlock} The block's name and attributes, changed accordingly if a match was found
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13560
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13561
function convertLegacyBlocks(rawBlock) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13562
  const [correctName, correctedAttributes] = convertLegacyBlockNameAndAttributes(rawBlock.blockName, rawBlock.attrs);
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13563
  return {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13564
    ...rawBlock,
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13565
    blockName: correctName,
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13566
    attrs: correctedAttributes
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13567
  };
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13568
}
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13569
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13570
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13571
 * Normalize the raw block by applying the fallback block name if none given,
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13572
 * sanitize the parsed HTML...
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13573
 *
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13574
 * @param {WPRawBlock}    rawBlock The raw block object.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13575
 * @param {ParseOptions?} options  Extra options for handling block parsing.
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13576
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13577
 * @return {WPRawBlock} The normalized block object.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13578
 */
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13579
function normalizeRawBlock(rawBlock, options) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13580
  const fallbackBlockName = getFreeformContentHandlerName();
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13581
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13582
  // If the grammar parsing don't produce any block name, use the freeform block.
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13583
  const rawBlockName = rawBlock.blockName || getFreeformContentHandlerName();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13584
  const rawAttributes = rawBlock.attrs || {};
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13585
  const rawInnerBlocks = rawBlock.innerBlocks || [];
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13586
  let rawInnerHTML = rawBlock.innerHTML.trim();
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13587
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13588
  // Fallback content may be upgraded from classic content expecting implicit
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13589
  // automatic paragraphs, so preserve them. Assumes wpautop is idempotent,
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13590
  // meaning there are no negative consequences to repeated autop calls.
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13591
  if (rawBlockName === fallbackBlockName && rawBlockName === 'core/freeform' && !options?.__unstableSkipAutop) {
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13592
    rawInnerHTML = (0,external_wp_autop_namespaceObject.autop)(rawInnerHTML).trim();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13593
  }
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13594
  return {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13595
    ...rawBlock,
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13596
    blockName: rawBlockName,
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13597
    attrs: rawAttributes,
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13598
    innerHTML: rawInnerHTML,
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13599
    innerBlocks: rawInnerBlocks
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13600
  };
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13601
}
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13602
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13603
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13604
 * Uses the "unregistered blockType" to create a block object.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13605
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13606
 * @param {WPRawBlock} rawBlock block.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13607
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13608
 * @return {WPRawBlock} The unregistered block object.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13609
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13610
function createMissingBlockType(rawBlock) {
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13611
  const unregisteredFallbackBlock = getUnregisteredTypeHandlerName() || getFreeformContentHandlerName();
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13612
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13613
  // Preserve undelimited content for use by the unregistered type
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13614
  // handler. A block node's `innerHTML` isn't enough, as that field only
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13615
  // carries the block's own HTML and not its nested blocks.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13616
  const originalUndelimitedContent = serializeRawBlock(rawBlock, {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13617
    isCommentDelimited: false
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13618
  });
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13619
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13620
  // Preserve full block content for use by the unregistered type
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13621
  // handler, block boundaries included.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13622
  const originalContent = serializeRawBlock(rawBlock, {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13623
    isCommentDelimited: true
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13624
  });
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13625
  return {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13626
    blockName: unregisteredFallbackBlock,
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13627
    attrs: {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13628
      originalName: rawBlock.blockName,
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13629
      originalContent,
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13630
      originalUndelimitedContent
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13631
    },
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13632
    innerHTML: rawBlock.blockName ? originalContent : rawBlock.innerHTML,
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13633
    innerBlocks: rawBlock.innerBlocks,
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13634
    innerContent: rawBlock.innerContent
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13635
  };
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13636
}
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13637
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13638
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13639
 * Validates a block and wraps with validation meta.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13640
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13641
 * The name here is regrettable but `validateBlock` is already taken.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13642
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13643
 * @param {WPBlock}                               unvalidatedBlock
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13644
 * @param {import('../registration').WPBlockType} blockType
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13645
 * @return {WPBlock}                              validated block, with auto-fixes if initially invalid
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13646
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13647
function applyBlockValidation(unvalidatedBlock, blockType) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13648
  // Attempt to validate the block.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13649
  const [isValid] = validateBlock(unvalidatedBlock, blockType);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13650
  if (isValid) {
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13651
    return {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13652
      ...unvalidatedBlock,
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13653
      isValid,
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13654
      validationIssues: []
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13655
    };
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13656
  }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13657
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13658
  // If the block is invalid, attempt some built-in fixes
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13659
  // like custom classNames handling.
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13660
  const fixedBlock = applyBuiltInValidationFixes(unvalidatedBlock, blockType);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13661
  // Attempt to validate the block once again after the built-in fixes.
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13662
  const [isFixedValid, validationIssues] = validateBlock(unvalidatedBlock, blockType);
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13663
  return {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13664
    ...fixedBlock,
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13665
    isValid: isFixedValid,
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13666
    validationIssues
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13667
  };
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13668
}
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13669
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13670
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13671
 * Given a raw block returned by grammar parsing, returns a fully parsed block.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13672
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13673
 * @param {WPRawBlock}   rawBlock The raw block object.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13674
 * @param {ParseOptions} options  Extra options for handling block parsing.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13675
 *
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13676
 * @return {WPBlock | undefined} Fully parsed block.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13677
 */
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13678
function parseRawBlock(rawBlock, options) {
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13679
  let normalizedBlock = normalizeRawBlock(rawBlock, options);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13680
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13681
  // During the lifecycle of the project, we renamed some old blocks
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13682
  // and transformed others to new blocks. To avoid breaking existing content,
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13683
  // we added this function to properly parse the old content.
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13684
  normalizedBlock = convertLegacyBlocks(normalizedBlock);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13685
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13686
  // Try finding the type for known block name.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13687
  let blockType = getBlockType(normalizedBlock.blockName);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13688
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13689
  // If not blockType is found for the specified name, fallback to the "unregistedBlockType".
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13690
  if (!blockType) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13691
    normalizedBlock = createMissingBlockType(normalizedBlock);
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13692
    blockType = getBlockType(normalizedBlock.blockName);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13693
  }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13694
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13695
  // If it's an empty freeform block or there's no blockType (no missing block handler)
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13696
  // Then, just ignore the block.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13697
  // It might be a good idea to throw a warning here.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13698
  // TODO: I'm unsure about the unregisteredFallbackBlock check,
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13699
  // it might ignore some dynamic unregistered third party blocks wrongly.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13700
  const isFallbackBlock = normalizedBlock.blockName === getFreeformContentHandlerName() || normalizedBlock.blockName === getUnregisteredTypeHandlerName();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13701
  if (!blockType || !normalizedBlock.innerHTML && isFallbackBlock) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13702
    return;
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13703
  }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13704
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13705
  // Parse inner blocks recursively.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13706
  const parsedInnerBlocks = normalizedBlock.innerBlocks.map(innerBlock => parseRawBlock(innerBlock, options))
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13707
  // See https://github.com/WordPress/gutenberg/pull/17164.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13708
  .filter(innerBlock => !!innerBlock);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13709
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13710
  // Get the fully parsed block.
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13711
  const parsedBlock = createBlock(normalizedBlock.blockName, getBlockAttributes(blockType, normalizedBlock.innerHTML, normalizedBlock.attrs), parsedInnerBlocks);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13712
  parsedBlock.originalContent = normalizedBlock.innerHTML;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13713
  const validatedBlock = applyBlockValidation(parsedBlock, blockType);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13714
  const {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13715
    validationIssues
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13716
  } = validatedBlock;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13717
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13718
  // Run the block deprecation and migrations.
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13719
  // This is performed on both invalid and valid blocks because
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13720
  // migration using the `migrate` functions should run even
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13721
  // if the output is deemed valid.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13722
  const updatedBlock = applyBlockDeprecatedVersions(validatedBlock, normalizedBlock, blockType);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13723
  if (!updatedBlock.isValid) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13724
    // Preserve the original unprocessed version of the block
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13725
    // that we received (no fixes, no deprecations) so that
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13726
    // we can save it as close to exactly the same way as
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13727
    // we loaded it. This is important to avoid corruption
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13728
    // and data loss caused by block implementations trying
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13729
    // to process data that isn't fully recognized.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13730
    updatedBlock.__unstableBlockSource = rawBlock;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13731
  }
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13732
  if (!validatedBlock.isValid && updatedBlock.isValid && !options?.__unstableSkipMigrationLogs) {
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13733
    /* eslint-disable no-console */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13734
    console.groupCollapsed('Updated Block: %s', blockType.name);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13735
    console.info('Block successfully updated for `%s` (%o).\n\nNew content generated by `save` function:\n\n%s\n\nContent retrieved from post body:\n\n%s', blockType.name, blockType, getSaveContent(blockType, updatedBlock.attributes), updatedBlock.originalContent);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13736
    console.groupEnd();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13737
    /* eslint-enable no-console */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13738
  } else if (!validatedBlock.isValid && !updatedBlock.isValid) {
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13739
    validationIssues.forEach(({
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13740
      log,
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13741
      args
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13742
    }) => log(...args));
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13743
  }
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13744
  return updatedBlock;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13745
}
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13746
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13747
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13748
 * Utilizes an optimized token-driven parser based on the Gutenberg grammar spec
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13749
 * defined through a parsing expression grammar to take advantage of the regular
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13750
 * cadence provided by block delimiters -- composed syntactically through HTML
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13751
 * comments -- which, given a general HTML document as an input, returns a block
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13752
 * list array representation.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13753
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13754
 * This is a recursive-descent parser that scans linearly once through the input
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13755
 * document. Instead of directly recursing it utilizes a trampoline mechanism to
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13756
 * prevent stack overflow. This initial pass is mainly interested in separating
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13757
 * and isolating the blocks serialized in the document and manifestly not in the
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13758
 * content within the blocks.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13759
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13760
 * @see
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13761
 * https://developer.wordpress.org/block-editor/packages/packages-block-serialization-default-parser/
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13762
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13763
 * @param {string}       content The post content.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13764
 * @param {ParseOptions} options Extra options for handling block parsing.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13765
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13766
 * @return {Array} Block list.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13767
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13768
function parser_parse(content, options) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13769
  return (0,external_wp_blockSerializationDefaultParser_namespaceObject.parse)(content).reduce((accumulator, rawBlock) => {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13770
    const block = parseRawBlock(rawBlock, options);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13771
    if (block) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13772
      accumulator.push(block);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13773
    }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13774
    return accumulator;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13775
  }, []);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13776
}
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13777
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13778
;// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/get-raw-transforms.js
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13779
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13780
 * Internal dependencies
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13781
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13782
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13783
function getRawTransforms() {
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13784
  return getBlockTransforms('from').filter(({
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13785
    type
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13786
  }) => type === 'raw').map(transform => {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13787
    return transform.isMatch ? transform : {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13788
      ...transform,
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13789
      isMatch: node => transform.selector && node.matches(transform.selector)
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13790
    };
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13791
  });
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13792
}
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13793
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13794
;// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/html-to-blocks.js
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13795
/**
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13796
 * WordPress dependencies
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13797
 */
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13798
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13799
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13800
/**
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13801
 * Internal dependencies
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13802
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13803
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13804
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13805
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13806
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13807
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13808
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13809
 * Converts HTML directly to blocks. Looks for a matching transform for each
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13810
 * top-level tag. The HTML should be filtered to not have any text between
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13811
 * top-level tags and formatted in a way that blocks can handle the HTML.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13812
 *
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13813
 * @param {string}   html    HTML to convert.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13814
 * @param {Function} handler The handler calling htmlToBlocks: either rawHandler
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13815
 *                           or pasteHandler.
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13816
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13817
 * @return {Array} An array of blocks.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13818
 */
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13819
function htmlToBlocks(html, handler) {
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13820
  const doc = document.implementation.createHTMLDocument('');
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13821
  doc.body.innerHTML = html;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13822
  return Array.from(doc.body.children).flatMap(node => {
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13823
    const rawTransform = findTransform(getRawTransforms(), ({
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13824
      isMatch
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13825
    }) => isMatch(node));
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13826
    if (!rawTransform) {
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13827
      // Until the HTML block is supported in the native version, we'll parse it
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13828
      // instead of creating the block to generate it as an unsupported block.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13829
      if (external_wp_element_namespaceObject.Platform.isNative) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13830
        return parser_parse(`<!-- wp:html -->${node.outerHTML}<!-- /wp:html -->`);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13831
      }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13832
      return createBlock(
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13833
      // Should not be hardcoded.
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13834
      'core/html', getBlockAttributes('core/html', node.outerHTML));
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13835
    }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13836
    const {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13837
      transform,
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13838
      blockName
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13839
    } = rawTransform;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13840
    if (transform) {
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13841
      const block = transform(node, handler);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13842
      if (node.hasAttribute('class')) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13843
        block.attributes.className = node.getAttribute('class');
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13844
      }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13845
      return block;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13846
    }
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13847
    return createBlock(blockName, getBlockAttributes(blockName, node.outerHTML));
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13848
  });
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13849
}
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13850
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13851
;// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/normalise-blocks.js
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13852
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13853
 * WordPress dependencies
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13854
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13855
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13856
function normaliseBlocks(HTML, options = {}) {
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13857
  const decuDoc = document.implementation.createHTMLDocument('');
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13858
  const accuDoc = document.implementation.createHTMLDocument('');
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13859
  const decu = decuDoc.body;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13860
  const accu = accuDoc.body;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13861
  decu.innerHTML = HTML;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13862
  while (decu.firstChild) {
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13863
    const node = decu.firstChild;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13864
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13865
    // Text nodes: wrap in a paragraph, or append to previous.
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13866
    if (node.nodeType === node.TEXT_NODE) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13867
      if ((0,external_wp_dom_namespaceObject.isEmpty)(node)) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13868
        decu.removeChild(node);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13869
      } else {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13870
        if (!accu.lastChild || accu.lastChild.nodeName !== 'P') {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13871
          accu.appendChild(accuDoc.createElement('P'));
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13872
        }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13873
        accu.lastChild.appendChild(node);
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13874
      }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13875
      // Element nodes.
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13876
    } else if (node.nodeType === node.ELEMENT_NODE) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13877
      // BR nodes: create a new paragraph on double, or append to previous.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13878
      if (node.nodeName === 'BR') {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13879
        if (node.nextSibling && node.nextSibling.nodeName === 'BR') {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13880
          accu.appendChild(accuDoc.createElement('P'));
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13881
          decu.removeChild(node.nextSibling);
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13882
        }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13883
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13884
        // Don't append to an empty paragraph.
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13885
        if (accu.lastChild && accu.lastChild.nodeName === 'P' && accu.lastChild.hasChildNodes()) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13886
          accu.lastChild.appendChild(node);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13887
        } else {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13888
          decu.removeChild(node);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13889
        }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13890
      } else if (node.nodeName === 'P') {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13891
        // Only append non-empty paragraph nodes.
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13892
        if ((0,external_wp_dom_namespaceObject.isEmpty)(node) && !options.raw) {
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13893
          decu.removeChild(node);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13894
        } else {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13895
          accu.appendChild(node);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13896
        }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13897
      } else if ((0,external_wp_dom_namespaceObject.isPhrasingContent)(node)) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13898
        if (!accu.lastChild || accu.lastChild.nodeName !== 'P') {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13899
          accu.appendChild(accuDoc.createElement('P'));
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13900
        }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13901
        accu.lastChild.appendChild(node);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13902
      } else {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13903
        accu.appendChild(node);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13904
      }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13905
    } else {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13906
      decu.removeChild(node);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13907
    }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13908
  }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13909
  return accu.innerHTML;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13910
}
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13911
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13912
;// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/special-comment-converter.js
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13913
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13914
 * WordPress dependencies
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13915
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13916
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13917
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13918
/**
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13919
 * Looks for `<!--nextpage-->` and `<!--more-->` comments and
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13920
 * replaces them with a custom element representing a future block.
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13921
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13922
 * The custom element is a way to bypass the rest of the `raw-handling`
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13923
 * transforms, which would eliminate other kinds of node with which to carry
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13924
 * `<!--more-->`'s data: nodes with `data` attributes, empty paragraphs, etc.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13925
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13926
 * The custom element is then expected to be recognized by any registered
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13927
 * block's `raw` transform.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13928
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13929
 * @param {Node}     node The node to be processed.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13930
 * @param {Document} doc  The document of the node.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13931
 * @return {void}
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13932
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13933
function specialCommentConverter(node, doc) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13934
  if (node.nodeType !== node.COMMENT_NODE) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13935
    return;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13936
  }
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13937
  if (node.nodeValue !== 'nextpage' && node.nodeValue.indexOf('more') !== 0) {
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13938
    return;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13939
  }
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13940
  const block = special_comment_converter_createBlock(node, doc);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13941
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13942
  // If our `<!--more-->` comment is in the middle of a paragraph, we should
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13943
  // split the paragraph in two and insert the more block in between. If it's
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13944
  // inside an empty paragraph, we should still move it out of the paragraph
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13945
  // and remove the paragraph. If there's no paragraph, fall back to simply
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13946
  // replacing the comment.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13947
  if (!node.parentNode || node.parentNode.nodeName !== 'P') {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13948
    (0,external_wp_dom_namespaceObject.replace)(node, block);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13949
  } else {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13950
    const childNodes = Array.from(node.parentNode.childNodes);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13951
    const nodeIndex = childNodes.indexOf(node);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13952
    const wrapperNode = node.parentNode.parentNode || doc.body;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13953
    const paragraphBuilder = (acc, child) => {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13954
      if (!acc) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13955
        acc = doc.createElement('p');
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13956
      }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13957
      acc.appendChild(child);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13958
      return acc;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13959
    };
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13960
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13961
    // Split the original parent node and insert our more block
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13962
    [childNodes.slice(0, nodeIndex).reduce(paragraphBuilder, null), block, childNodes.slice(nodeIndex + 1).reduce(paragraphBuilder, null)].forEach(element => element && wrapperNode.insertBefore(element, node.parentNode));
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13963
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13964
    // Remove the old parent paragraph
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13965
    (0,external_wp_dom_namespaceObject.remove)(node.parentNode);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13966
  }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13967
}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13968
function special_comment_converter_createBlock(commentNode, doc) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13969
  if (commentNode.nodeValue === 'nextpage') {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13970
    return createNextpage(doc);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13971
  }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13972
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13973
  // Grab any custom text in the comment.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13974
  const customText = commentNode.nodeValue.slice(4).trim();
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13975
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13976
  /*
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13977
   * When a `<!--more-->` comment is found, we need to look for any
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13978
   * `<!--noteaser-->` sibling, but it may not be a direct sibling
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13979
   * (whitespace typically lies in between)
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13980
   */
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13981
  let sibling = commentNode;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13982
  let noTeaser = false;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13983
  while (sibling = sibling.nextSibling) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13984
    if (sibling.nodeType === sibling.COMMENT_NODE && sibling.nodeValue === 'noteaser') {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13985
      noTeaser = true;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13986
      (0,external_wp_dom_namespaceObject.remove)(sibling);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13987
      break;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13988
    }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13989
  }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13990
  return createMore(customText, noTeaser, doc);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 13991
}
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13992
function createMore(customText, noTeaser, doc) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13993
  const node = doc.createElement('wp-block');
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13994
  node.dataset.block = 'core/more';
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13995
  if (customText) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13996
    node.dataset.customText = customText;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13997
  }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13998
  if (noTeaser) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 13999
    // "Boolean" data attribute.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14000
    node.dataset.noTeaser = '';
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14001
  }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14002
  return node;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14003
}
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14004
function createNextpage(doc) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14005
  const node = doc.createElement('wp-block');
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14006
  node.dataset.block = 'core/nextpage';
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14007
  return node;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14008
}
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14009
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14010
;// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/list-reducer.js
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14011
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14012
 * WordPress dependencies
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14013
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14014
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14015
function isList(node) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14016
  return node.nodeName === 'OL' || node.nodeName === 'UL';
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14017
}
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14018
function shallowTextContent(element) {
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14019
  return Array.from(element.childNodes).map(({
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14020
    nodeValue = ''
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14021
  }) => nodeValue).join('');
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14022
}
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14023
function listReducer(node) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14024
  if (!isList(node)) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14025
    return;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14026
  }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14027
  const list = node;
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14028
  const prevElement = node.previousElementSibling;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14029
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14030
  // Merge with previous list if:
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14031
  // * There is a previous list of the same type.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14032
  // * There is only one list item.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14033
  if (prevElement && prevElement.nodeName === node.nodeName && list.children.length === 1) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14034
    // Move all child nodes, including any text nodes, if any.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14035
    while (list.firstChild) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14036
      prevElement.appendChild(list.firstChild);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14037
    }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14038
    list.parentNode.removeChild(list);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14039
  }
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14040
  const parentElement = node.parentNode;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14041
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14042
  // Nested list with empty parent item.
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14043
  if (parentElement && parentElement.nodeName === 'LI' && parentElement.children.length === 1 && !/\S/.test(shallowTextContent(parentElement))) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14044
    const parentListItem = parentElement;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14045
    const prevListItem = parentListItem.previousElementSibling;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14046
    const parentList = parentListItem.parentNode;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14047
    if (prevListItem) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14048
      prevListItem.appendChild(list);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14049
      parentList.removeChild(parentListItem);
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14050
    }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14051
  }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14052
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14053
  // Invalid: OL/UL > OL/UL.
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14054
  if (parentElement && isList(parentElement)) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14055
    const prevListItem = node.previousElementSibling;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14056
    if (prevListItem) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14057
      prevListItem.appendChild(node);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14058
    } else {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14059
      (0,external_wp_dom_namespaceObject.unwrap)(node);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14060
    }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14061
  }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14062
}
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14063
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14064
;// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/blockquote-normaliser.js
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14065
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14066
 * Internal dependencies
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14067
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14068
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14069
function blockquoteNormaliser(options) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14070
  return node => {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14071
    if (node.nodeName !== 'BLOCKQUOTE') {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14072
      return;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14073
    }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14074
    node.innerHTML = normaliseBlocks(node.innerHTML, options);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14075
  };
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14076
}
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14077
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14078
;// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/figure-content-reducer.js
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14079
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14080
 * WordPress dependencies
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14081
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14082
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14083
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14084
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14085
 * Whether or not the given node is figure content.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14086
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14087
 * @param {Node}   node   The node to check.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14088
 * @param {Object} schema The schema to use.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14089
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14090
 * @return {boolean} True if figure content, false if not.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14091
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14092
function isFigureContent(node, schema) {
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14093
  var _schema$figure$childr;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14094
  const tag = node.nodeName.toLowerCase();
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14095
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14096
  // We are looking for tags that can be a child of the figure tag, excluding
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14097
  // `figcaption` and any phrasing content.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14098
  if (tag === 'figcaption' || (0,external_wp_dom_namespaceObject.isTextContent)(node)) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14099
    return false;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14100
  }
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14101
  return tag in ((_schema$figure$childr = schema?.figure?.children) !== null && _schema$figure$childr !== void 0 ? _schema$figure$childr : {});
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14102
}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14103
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14104
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14105
 * Whether or not the given node can have an anchor.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14106
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14107
 * @param {Node}   node   The node to check.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14108
 * @param {Object} schema The schema to use.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14109
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14110
 * @return {boolean} True if it can, false if not.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14111
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14112
function canHaveAnchor(node, schema) {
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14113
  var _schema$figure$childr2;
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14114
  const tag = node.nodeName.toLowerCase();
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14115
  return tag in ((_schema$figure$childr2 = schema?.figure?.children?.a?.children) !== null && _schema$figure$childr2 !== void 0 ? _schema$figure$childr2 : {});
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14116
}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14117
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14118
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14119
 * Wraps the given element in a figure element.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14120
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14121
 * @param {Element} element       The element to wrap.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14122
 * @param {Element} beforeElement The element before which to place the figure.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14123
 */
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14124
function wrapFigureContent(element, beforeElement = element) {
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14125
  const figure = element.ownerDocument.createElement('figure');
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14126
  beforeElement.parentNode.insertBefore(figure, beforeElement);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14127
  figure.appendChild(element);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14128
}
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14129
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14130
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14131
 * This filter takes figure content out of paragraphs, wraps it in a figure
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14132
 * element, and moves any anchors with it if needed.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14133
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14134
 * @param {Node}     node   The node to filter.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14135
 * @param {Document} doc    The document of the node.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14136
 * @param {Object}   schema The schema to use.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14137
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14138
 * @return {void}
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14139
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14140
function figureContentReducer(node, doc, schema) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14141
  if (!isFigureContent(node, schema)) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14142
    return;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14143
  }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14144
  let nodeToInsert = node;
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14145
  const parentNode = node.parentNode;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14146
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14147
  // If the figure content can have an anchor and its parent is an anchor with
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14148
  // only the figure content, take the anchor out instead of just the content.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14149
  if (canHaveAnchor(node, schema) && parentNode.nodeName === 'A' && parentNode.childNodes.length === 1) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14150
    nodeToInsert = node.parentNode;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14151
  }
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14152
  const wrapper = nodeToInsert.closest('p,div');
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14153
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14154
  // If wrapped in a paragraph or div, only extract if it's aligned or if
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14155
  // there is no text content.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14156
  // Otherwise, if directly at the root, wrap in a figure element.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14157
  if (wrapper) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14158
    // In jsdom-jscore, 'node.classList' can be undefined.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14159
    // In this case, default to extract as it offers a better UI experience on mobile.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14160
    if (!node.classList) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14161
      wrapFigureContent(nodeToInsert, wrapper);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14162
    } else if (node.classList.contains('alignright') || node.classList.contains('alignleft') || node.classList.contains('aligncenter') || !wrapper.textContent.trim()) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14163
      wrapFigureContent(nodeToInsert, wrapper);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14164
    }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14165
  } else if (nodeToInsert.parentNode.nodeName === 'BODY') {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14166
    wrapFigureContent(nodeToInsert);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14167
  }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14168
}
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14169
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14170
;// CONCATENATED MODULE: external ["wp","shortcode"]
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14171
const external_wp_shortcode_namespaceObject = window["wp"]["shortcode"];
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14172
;// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/shortcode-converter.js
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14173
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14174
 * WordPress dependencies
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14175
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14176
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14177
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14178
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14179
 * Internal dependencies
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14180
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14181
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14182
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14183
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14184
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14185
const castArray = maybeArray => Array.isArray(maybeArray) ? maybeArray : [maybeArray];
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14186
const beforeLineRegexp = /(\n|<p>)\s*$/;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14187
const afterLineRegexp = /^\s*(\n|<\/p>)/;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14188
function segmentHTMLToShortcodeBlock(HTML, lastIndex = 0, excludedBlockNames = []) {
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14189
  // Get all matches.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14190
  const transformsFrom = getBlockTransforms('from');
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14191
  const transformation = findTransform(transformsFrom, transform => excludedBlockNames.indexOf(transform.blockName) === -1 && transform.type === 'shortcode' && castArray(transform.tag).some(tag => (0,external_wp_shortcode_namespaceObject.regexp)(tag).test(HTML)));
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14192
  if (!transformation) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14193
    return [HTML];
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14194
  }
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14195
  const transformTags = castArray(transformation.tag);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14196
  const transformTag = transformTags.find(tag => (0,external_wp_shortcode_namespaceObject.regexp)(tag).test(HTML));
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14197
  let match;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14198
  const previousIndex = lastIndex;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14199
  if (match = (0,external_wp_shortcode_namespaceObject.next)(transformTag, HTML, lastIndex)) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14200
    lastIndex = match.index + match.content.length;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14201
    const beforeHTML = HTML.substr(0, match.index);
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14202
    const afterHTML = HTML.substr(lastIndex);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14203
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14204
    // If the shortcode content does not contain HTML and the shortcode is
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14205
    // not on a new line (or in paragraph from Markdown converter),
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14206
    // consider the shortcode as inline text, and thus skip conversion for
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14207
    // this segment.
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14208
    if (!match.shortcode.content?.includes('<') && !(beforeLineRegexp.test(beforeHTML) && afterLineRegexp.test(afterHTML))) {
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14209
      return segmentHTMLToShortcodeBlock(HTML, lastIndex);
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14210
    }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14211
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14212
    // If a transformation's `isMatch` predicate fails for the inbound
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14213
    // shortcode, try again by excluding the current block type.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14214
    //
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14215
    // This is the only call to `segmentHTMLToShortcodeBlock` that should
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14216
    // ever carry over `excludedBlockNames`. Other calls in the module
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14217
    // should skip that argument as a way to reset the exclusion state, so
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14218
    // that one `isMatch` fail in an HTML fragment doesn't prevent any
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14219
    // valid matches in subsequent fragments.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14220
    if (transformation.isMatch && !transformation.isMatch(match.shortcode.attrs)) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14221
      return segmentHTMLToShortcodeBlock(HTML, previousIndex, [...excludedBlockNames, transformation.blockName]);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14222
    }
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14223
    let blocks = [];
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14224
    if (typeof transformation.transform === 'function') {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14225
      // Passing all of `match` as second argument is intentionally broad
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14226
      // but shouldn't be too relied upon.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14227
      //
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14228
      // See: https://github.com/WordPress/gutenberg/pull/3610#discussion_r152546926
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14229
      blocks = [].concat(transformation.transform(match.shortcode.attrs, match));
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14230
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14231
      // Applying the built-in fixes can enhance the attributes with missing content like "className".
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14232
      blocks = blocks.map(block => {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14233
        block.originalContent = match.shortcode.content;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14234
        return applyBuiltInValidationFixes(block, getBlockType(block.name));
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14235
      });
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14236
    } else {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14237
      const attributes = Object.fromEntries(Object.entries(transformation.attributes).filter(([, schema]) => schema.shortcode)
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14238
      // Passing all of `match` as second argument is intentionally broad
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14239
      // but shouldn't be too relied upon.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14240
      //
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14241
      // See: https://github.com/WordPress/gutenberg/pull/3610#discussion_r152546926
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14242
      .map(([key, schema]) => [key, schema.shortcode(match.shortcode.attrs, match)]));
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14243
      const blockType = getBlockType(transformation.blockName);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14244
      if (!blockType) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14245
        return [HTML];
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14246
      }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14247
      const transformationBlockType = {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14248
        ...blockType,
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14249
        attributes: transformation.attributes
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14250
      };
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14251
      let block = createBlock(transformation.blockName, getBlockAttributes(transformationBlockType, match.shortcode.content, attributes));
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14252
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14253
      // Applying the built-in fixes can enhance the attributes with missing content like "className".
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14254
      block.originalContent = match.shortcode.content;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14255
      block = applyBuiltInValidationFixes(block, transformationBlockType);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14256
      blocks = [block];
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14257
    }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14258
    return [...segmentHTMLToShortcodeBlock(beforeHTML.replace(beforeLineRegexp, '')), ...blocks, ...segmentHTMLToShortcodeBlock(afterHTML.replace(afterLineRegexp, ''))];
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14259
  }
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14260
  return [HTML];
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14261
}
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14262
/* harmony default export */ const shortcode_converter = (segmentHTMLToShortcodeBlock);
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14263
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14264
;// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/utils.js
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14265
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14266
 * WordPress dependencies
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14267
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14268
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14269
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14270
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14271
 * Internal dependencies
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14272
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14273
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14274
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14275
function getBlockContentSchemaFromTransforms(transforms, context) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14276
  const phrasingContentSchema = (0,external_wp_dom_namespaceObject.getPhrasingContentSchema)(context);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14277
  const schemaArgs = {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14278
    phrasingContentSchema,
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14279
    isPaste: context === 'paste'
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14280
  };
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14281
  const schemas = transforms.map(({
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14282
    isMatch,
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14283
    blockName,
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14284
    schema
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14285
  }) => {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14286
    const hasAnchorSupport = hasBlockSupport(blockName, 'anchor');
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14287
    schema = typeof schema === 'function' ? schema(schemaArgs) : schema;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14288
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14289
    // If the block does not has anchor support and the transform does not
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14290
    // provides an isMatch we can return the schema right away.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14291
    if (!hasAnchorSupport && !isMatch) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14292
      return schema;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14293
    }
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14294
    if (!schema) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14295
      return {};
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14296
    }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14297
    return Object.fromEntries(Object.entries(schema).map(([key, value]) => {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14298
      let attributes = value.attributes || [];
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14299
      // If the block supports the "anchor" functionality, it needs to keep its ID attribute.
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14300
      if (hasAnchorSupport) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14301
        attributes = [...attributes, 'id'];
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14302
      }
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14303
      return [key, {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14304
        ...value,
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14305
        attributes,
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14306
        isMatch: isMatch ? isMatch : undefined
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14307
      }];
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14308
    }));
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14309
  });
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14310
  function mergeTagNameSchemaProperties(objValue, srcValue, key) {
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14311
    switch (key) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14312
      case 'children':
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14313
        {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14314
          if (objValue === '*' || srcValue === '*') {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14315
            return '*';
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14316
          }
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14317
          return {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14318
            ...objValue,
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14319
            ...srcValue
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14320
          };
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14321
        }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14322
      case 'attributes':
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14323
      case 'require':
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14324
        {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14325
          return [...(objValue || []), ...(srcValue || [])];
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14326
        }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14327
      case 'isMatch':
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14328
        {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14329
          // If one of the values being merge is undefined (matches everything),
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14330
          // the result of the merge will be undefined.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14331
          if (!objValue || !srcValue) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14332
            return undefined;
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14333
          }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14334
          // When merging two isMatch functions, the result is a new function
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14335
          // that returns if one of the source functions returns true.
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14336
          return (...args) => {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14337
            return objValue(...args) || srcValue(...args);
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14338
          };
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14339
        }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14340
    }
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14341
  }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14342
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14343
  // A tagName schema is an object with children, attributes, require, and
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14344
  // isMatch properties.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14345
  function mergeTagNameSchemas(a, b) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14346
    for (const key in b) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14347
      a[key] = a[key] ? mergeTagNameSchemaProperties(a[key], b[key], key) : {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14348
        ...b[key]
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14349
      };
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14350
    }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14351
    return a;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14352
  }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14353
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14354
  // A schema is an object with tagName schemas by tag name.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14355
  function mergeSchemas(a, b) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14356
    for (const key in b) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14357
      a[key] = a[key] ? mergeTagNameSchemas(a[key], b[key]) : {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14358
        ...b[key]
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14359
      };
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14360
    }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14361
    return a;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14362
  }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14363
  return schemas.reduce(mergeSchemas, {});
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14364
}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14365
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14366
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14367
 * Gets the block content schema, which is extracted and merged from all
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14368
 * registered blocks with raw transfroms.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14369
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14370
 * @param {string} context Set to "paste" when in paste context, where the
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14371
 *                         schema is more strict.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14372
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14373
 * @return {Object} A complete block content schema.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14374
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14375
function getBlockContentSchema(context) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14376
  return getBlockContentSchemaFromTransforms(getRawTransforms(), context);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14377
}
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14378
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14379
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14380
 * Checks whether HTML can be considered plain text. That is, it does not contain
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14381
 * any elements that are not line breaks.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14382
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14383
 * @param {string} HTML The HTML to check.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14384
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14385
 * @return {boolean} Whether the HTML can be considered plain text.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14386
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14387
function isPlain(HTML) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14388
  return !/<(?!br[ />])/i.test(HTML);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14389
}
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14390
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14391
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14392
 * Given node filters, deeply filters and mutates a NodeList.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14393
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14394
 * @param {NodeList} nodeList The nodeList to filter.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14395
 * @param {Array}    filters  An array of functions that can mutate with the provided node.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14396
 * @param {Document} doc      The document of the nodeList.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14397
 * @param {Object}   schema   The schema to use.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14398
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14399
function deepFilterNodeList(nodeList, filters, doc, schema) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14400
  Array.from(nodeList).forEach(node => {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14401
    deepFilterNodeList(node.childNodes, filters, doc, schema);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14402
    filters.forEach(item => {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14403
      // Make sure the node is still attached to the document.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14404
      if (!doc.contains(node)) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14405
        return;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14406
      }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14407
      item(node, doc, schema);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14408
    });
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14409
  });
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14410
}
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14411
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14412
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14413
 * Given node filters, deeply filters HTML tags.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14414
 * Filters from the deepest nodes to the top.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14415
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14416
 * @param {string} HTML    The HTML to filter.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14417
 * @param {Array}  filters An array of functions that can mutate with the provided node.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14418
 * @param {Object} schema  The schema to use.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14419
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14420
 * @return {string} The filtered HTML.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14421
 */
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14422
function deepFilterHTML(HTML, filters = [], schema) {
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14423
  const doc = document.implementation.createHTMLDocument('');
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14424
  doc.body.innerHTML = HTML;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14425
  deepFilterNodeList(doc.body.childNodes, filters, doc, schema);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14426
  return doc.body.innerHTML;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14427
}
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14428
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14429
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14430
 * Gets a sibling within text-level context.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14431
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14432
 * @param {Element} node  The subject node.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14433
 * @param {string}  which "next" or "previous".
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14434
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14435
function getSibling(node, which) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14436
  const sibling = node[`${which}Sibling`];
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14437
  if (sibling && (0,external_wp_dom_namespaceObject.isPhrasingContent)(sibling)) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14438
    return sibling;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14439
  }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14440
  const {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14441
    parentNode
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14442
  } = node;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14443
  if (!parentNode || !(0,external_wp_dom_namespaceObject.isPhrasingContent)(parentNode)) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14444
    return;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14445
  }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14446
  return getSibling(parentNode, which);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14447
}
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14448
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14449
;// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/index.js
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14450
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14451
 * WordPress dependencies
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14452
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14453
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14454
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14455
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14456
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14457
 * Internal dependencies
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14458
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14459
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14460
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14461
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14462
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14463
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14464
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14465
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14466
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14467
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14468
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14469
function deprecatedGetPhrasingContentSchema(context) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14470
  external_wp_deprecated_default()('wp.blocks.getPhrasingContentSchema', {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14471
    since: '5.6',
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14472
    alternative: 'wp.dom.getPhrasingContentSchema'
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14473
  });
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14474
  return (0,external_wp_dom_namespaceObject.getPhrasingContentSchema)(context);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14475
}
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14476
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14477
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14478
 * Converts an HTML string to known blocks.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14479
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14480
 * @param {Object} $1
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14481
 * @param {string} $1.HTML The HTML to convert.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14482
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14483
 * @return {Array} A list of blocks.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14484
 */
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14485
function rawHandler({
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14486
  HTML = ''
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14487
}) {
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14488
  // If we detect block delimiters, parse entirely as blocks.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14489
  if (HTML.indexOf('<!-- wp:') !== -1) {
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14490
    const parseResult = parser_parse(HTML);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14491
    const isSingleFreeFormBlock = parseResult.length === 1 && parseResult[0].name === 'core/freeform';
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14492
    if (!isSingleFreeFormBlock) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14493
      return parseResult;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14494
    }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14495
  }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14496
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14497
  // An array of HTML strings and block objects. The blocks replace matched
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14498
  // shortcodes.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14499
  const pieces = shortcode_converter(HTML);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14500
  const blockContentSchema = getBlockContentSchema();
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14501
  return pieces.map(piece => {
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14502
    // Already a block from shortcode.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14503
    if (typeof piece !== 'string') {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14504
      return piece;
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14505
    }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14506
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14507
    // These filters are essential for some blocks to be able to transform
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14508
    // from raw HTML. These filters move around some content or add
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14509
    // additional tags, they do not remove any content.
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14510
    const filters = [
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14511
    // Needed to adjust invalid lists.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14512
    listReducer,
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14513
    // Needed to create more and nextpage blocks.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14514
    specialCommentConverter,
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14515
    // Needed to create media blocks.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14516
    figureContentReducer,
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14517
    // Needed to create the quote block, which cannot handle text
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14518
    // without wrapper paragraphs.
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14519
    blockquoteNormaliser({
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14520
      raw: true
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14521
    })];
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14522
    piece = deepFilterHTML(piece, filters, blockContentSchema);
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14523
    piece = normaliseBlocks(piece, {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14524
      raw: true
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14525
    });
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14526
    return htmlToBlocks(piece, rawHandler);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14527
  }).flat().filter(Boolean);
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14528
}
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14529
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14530
;// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/comment-remover.js
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14531
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14532
 * WordPress dependencies
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14533
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14534
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14535
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14536
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14537
 * Looks for comments, and removes them.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14538
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14539
 * @param {Node} node The node to be processed.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14540
 * @return {void}
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14541
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14542
function commentRemover(node) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14543
  if (node.nodeType === node.COMMENT_NODE) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14544
    (0,external_wp_dom_namespaceObject.remove)(node);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14545
  }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14546
}
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14547
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14548
;// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/is-inline-content.js
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14549
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14550
 * WordPress dependencies
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14551
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14552
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14553
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14554
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14555
 * Checks if the given node should be considered inline content, optionally
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14556
 * depending on a context tag.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14557
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14558
 * @param {Node}   node       Node name.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14559
 * @param {string} contextTag Tag name.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14560
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14561
 * @return {boolean} True if the node is inline content, false if nohe.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14562
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14563
function isInline(node, contextTag) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14564
  if ((0,external_wp_dom_namespaceObject.isTextContent)(node)) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14565
    return true;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14566
  }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14567
  if (!contextTag) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14568
    return false;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14569
  }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14570
  const tag = node.nodeName.toLowerCase();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14571
  const inlineAllowedTagGroups = [['ul', 'li', 'ol'], ['h1', 'h2', 'h3', 'h4', 'h5', 'h6']];
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14572
  return inlineAllowedTagGroups.some(tagGroup => [tag, contextTag].filter(t => !tagGroup.includes(t)).length === 0);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14573
}
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14574
function deepCheck(nodes, contextTag) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14575
  return nodes.every(node => isInline(node, contextTag) && deepCheck(Array.from(node.children), contextTag));
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14576
}
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14577
function isDoubleBR(node) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14578
  return node.nodeName === 'BR' && node.previousSibling && node.previousSibling.nodeName === 'BR';
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14579
}
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14580
function isInlineContent(HTML, contextTag) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14581
  const doc = document.implementation.createHTMLDocument('');
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14582
  doc.body.innerHTML = HTML;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14583
  const nodes = Array.from(doc.body.children);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14584
  return !nodes.some(isDoubleBR) && deepCheck(nodes, contextTag);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14585
}
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14586
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14587
;// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/phrasing-content-reducer.js
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14588
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14589
 * WordPress dependencies
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14590
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14591
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14592
function phrasingContentReducer(node, doc) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14593
  // In jsdom-jscore, 'node.style' can be null.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14594
  // TODO: Explore fixing this by patching jsdom-jscore.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14595
  if (node.nodeName === 'SPAN' && node.style) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14596
    const {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14597
      fontWeight,
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14598
      fontStyle,
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14599
      textDecorationLine,
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14600
      textDecoration,
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14601
      verticalAlign
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14602
    } = node.style;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14603
    if (fontWeight === 'bold' || fontWeight === '700') {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14604
      (0,external_wp_dom_namespaceObject.wrap)(doc.createElement('strong'), node);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14605
    }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14606
    if (fontStyle === 'italic') {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14607
      (0,external_wp_dom_namespaceObject.wrap)(doc.createElement('em'), node);
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14608
    }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14609
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14610
    // Some DOM implementations (Safari, JSDom) don't support
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14611
    // style.textDecorationLine, so we check style.textDecoration as a
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14612
    // fallback.
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14613
    if (textDecorationLine === 'line-through' || textDecoration.includes('line-through')) {
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14614
      (0,external_wp_dom_namespaceObject.wrap)(doc.createElement('s'), node);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14615
    }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14616
    if (verticalAlign === 'super') {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14617
      (0,external_wp_dom_namespaceObject.wrap)(doc.createElement('sup'), node);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14618
    } else if (verticalAlign === 'sub') {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14619
      (0,external_wp_dom_namespaceObject.wrap)(doc.createElement('sub'), node);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14620
    }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14621
  } else if (node.nodeName === 'B') {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14622
    node = (0,external_wp_dom_namespaceObject.replaceTag)(node, 'strong');
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14623
  } else if (node.nodeName === 'I') {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14624
    node = (0,external_wp_dom_namespaceObject.replaceTag)(node, 'em');
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14625
  } else if (node.nodeName === 'A') {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14626
    // In jsdom-jscore, 'node.target' can be null.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14627
    // TODO: Explore fixing this by patching jsdom-jscore.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14628
    if (node.target && node.target.toLowerCase() === '_blank') {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14629
      node.rel = 'noreferrer noopener';
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14630
    } else {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14631
      node.removeAttribute('target');
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14632
      node.removeAttribute('rel');
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14633
    }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14634
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14635
    // Saves anchor elements name attribute as id
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14636
    if (node.name && !node.id) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14637
      node.id = node.name;
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14638
    }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14639
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14640
    // Keeps id only if there is an internal link pointing to it
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14641
    if (node.id && !node.ownerDocument.querySelector(`[href="#${node.id}"]`)) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14642
      node.removeAttribute('id');
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14643
    }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14644
  }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14645
}
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14646
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14647
;// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/head-remover.js
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14648
function headRemover(node) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14649
  if (node.nodeName !== 'SCRIPT' && node.nodeName !== 'NOSCRIPT' && node.nodeName !== 'TEMPLATE' && node.nodeName !== 'STYLE') {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14650
    return;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14651
  }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14652
  node.parentNode.removeChild(node);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14653
}
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14654
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14655
;// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/ms-list-ignore.js
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14656
/**
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14657
 * Looks for comments, and removes them.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14658
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14659
 * @param {Node} node The node to be processed.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14660
 * @return {void}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14661
 */
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14662
function msListIgnore(node) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14663
  if (node.nodeType !== node.ELEMENT_NODE) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14664
    return;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14665
  }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14666
  const style = node.getAttribute('style');
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14667
  if (!style || !style.includes('mso-list')) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14668
    return;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14669
  }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14670
  const rules = style.split(';').reduce((acc, rule) => {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14671
    const [key, value] = rule.split(':');
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14672
    if (key && value) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14673
      acc[key.trim().toLowerCase()] = value.trim().toLowerCase();
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14674
    }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14675
    return acc;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14676
  }, {});
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14677
  if (rules['mso-list'] === 'ignore') {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14678
    node.remove();
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14679
  }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14680
}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14681
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14682
;// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/ms-list-converter.js
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14683
/**
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14684
 * Internal dependencies
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14685
 */
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14686
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14687
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14688
function ms_list_converter_isList(node) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14689
  return node.nodeName === 'OL' || node.nodeName === 'UL';
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14690
}
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14691
function msListConverter(node, doc) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14692
  if (node.nodeName !== 'P') {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14693
    return;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14694
  }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14695
  const style = node.getAttribute('style');
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14696
  if (!style || !style.includes('mso-list')) {
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14697
    return;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14698
  }
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14699
  const prevNode = node.previousElementSibling;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14700
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14701
  // Add new list if no previous.
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14702
  if (!prevNode || !ms_list_converter_isList(prevNode)) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14703
    // See https://html.spec.whatwg.org/multipage/grouping-content.html#attr-ol-type.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14704
    const type = node.textContent.trim().slice(0, 1);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14705
    const isNumeric = /[1iIaA]/.test(type);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14706
    const newListNode = doc.createElement(isNumeric ? 'ol' : 'ul');
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14707
    if (isNumeric) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14708
      newListNode.setAttribute('type', type);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14709
    }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14710
    node.parentNode.insertBefore(newListNode, node);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14711
  }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14712
  const listNode = node.previousElementSibling;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14713
  const listType = listNode.nodeName;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14714
  const listItem = doc.createElement('li');
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14715
  let receivingNode = listNode;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14716
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14717
  // Add content.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14718
  listItem.innerHTML = deepFilterHTML(node.innerHTML, [msListIgnore]);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14719
  const matches = /mso-list\s*:[^;]+level([0-9]+)/i.exec(style);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14720
  let level = matches ? parseInt(matches[1], 10) - 1 || 0 : 0;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14721
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14722
  // Change pointer depending on indentation level.
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14723
  while (level--) {
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14724
    receivingNode = receivingNode.lastChild || receivingNode;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14725
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14726
    // If it's a list, move pointer to the last item.
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14727
    if (ms_list_converter_isList(receivingNode)) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14728
      receivingNode = receivingNode.lastChild || receivingNode;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14729
    }
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14730
  }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14731
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14732
  // Make sure we append to a list.
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14733
  if (!ms_list_converter_isList(receivingNode)) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14734
    receivingNode = receivingNode.appendChild(doc.createElement(listType));
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14735
  }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14736
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14737
  // Append the list item to the list.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14738
  receivingNode.appendChild(listItem);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14739
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14740
  // Remove the wrapper paragraph.
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14741
  node.parentNode.removeChild(node);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14742
}
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14743
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14744
;// CONCATENATED MODULE: external ["wp","blob"]
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14745
const external_wp_blob_namespaceObject = window["wp"]["blob"];
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14746
;// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/image-corrector.js
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14747
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14748
 * WordPress dependencies
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14749
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14750
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14751
function imageCorrector(node) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14752
  if (node.nodeName !== 'IMG') {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14753
    return;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14754
  }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14755
  if (node.src.indexOf('file:') === 0) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14756
    node.src = '';
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14757
  }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14758
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14759
  // This piece cannot be tested outside a browser env.
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14760
  if (node.src.indexOf('data:') === 0) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14761
    const [properties, data] = node.src.split(',');
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14762
    const [type] = properties.slice(5).split(';');
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14763
    if (!data || !type) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14764
      node.src = '';
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14765
      return;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14766
    }
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14767
    let decoded;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14768
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14769
    // Can throw DOMException!
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14770
    try {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14771
      decoded = atob(data);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14772
    } catch (e) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14773
      node.src = '';
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14774
      return;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14775
    }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14776
    const uint8Array = new Uint8Array(decoded.length);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14777
    for (let i = 0; i < uint8Array.length; i++) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14778
      uint8Array[i] = decoded.charCodeAt(i);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14779
    }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14780
    const name = type.replace('/', '.');
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14781
    const file = new window.File([uint8Array], name, {
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14782
      type
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14783
    });
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14784
    node.src = (0,external_wp_blob_namespaceObject.createBlobURL)(file);
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14785
  }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14786
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14787
  // Remove trackers and hardly visible images.
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14788
  if (node.height === 1 || node.width === 1) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14789
    node.parentNode.removeChild(node);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14790
  }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14791
}
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14792
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14793
;// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/div-normaliser.js
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14794
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14795
 * Internal dependencies
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14796
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14797
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14798
function divNormaliser(node) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14799
  if (node.nodeName !== 'DIV') {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14800
    return;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14801
  }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14802
  node.innerHTML = normaliseBlocks(node.innerHTML);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14803
}
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14804
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14805
// EXTERNAL MODULE: ./node_modules/showdown/dist/showdown.js
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14806
var showdown = __webpack_require__(1030);
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14807
var showdown_default = /*#__PURE__*/__webpack_require__.n(showdown);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14808
;// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/markdown-converter.js
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14809
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14810
 * External dependencies
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14811
 */
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14812
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14813
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14814
// Reuse the same showdown converter.
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14815
const converter = new (showdown_default()).Converter({
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14816
  noHeaderId: true,
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14817
  tables: true,
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14818
  literalMidWordUnderscores: true,
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14819
  omitExtraWLInCodeBlocks: true,
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14820
  simpleLineBreaks: true,
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14821
  strikethrough: true
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14822
});
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14823
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14824
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14825
 * Corrects the Slack Markdown variant of the code block.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14826
 * If uncorrected, it will be converted to inline code.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14827
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14828
 * @see https://get.slack.help/hc/en-us/articles/202288908-how-can-i-add-formatting-to-my-messages-#code-blocks
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14829
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14830
 * @param {string} text The potential Markdown text to correct.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14831
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14832
 * @return {string} The corrected Markdown.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14833
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14834
function slackMarkdownVariantCorrector(text) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14835
  return text.replace(/((?:^|\n)```)([^\n`]+)(```(?:$|\n))/, (match, p1, p2, p3) => `${p1}\n${p2}\n${p3}`);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14836
}
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14837
function bulletsToAsterisks(text) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14838
  return text.replace(/(^|\n)•( +)/g, '$1*$2');
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14839
}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14840
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14841
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14842
 * Converts a piece of text into HTML based on any Markdown present.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14843
 * Also decodes any encoded HTML.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14844
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14845
 * @param {string} text The plain text to convert.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14846
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14847
 * @return {string} HTML.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14848
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14849
function markdownConverter(text) {
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14850
  return converter.makeHtml(slackMarkdownVariantCorrector(bulletsToAsterisks(text)));
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14851
}
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14852
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14853
;// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/iframe-remover.js
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14854
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14855
 * Removes iframes.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14856
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14857
 * @param {Node} node The node to check.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14858
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14859
 * @return {void}
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14860
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14861
function iframeRemover(node) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14862
  if (node.nodeName === 'IFRAME') {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14863
    const text = node.ownerDocument.createTextNode(node.src);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14864
    node.parentNode.replaceChild(text, node);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14865
  }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14866
}
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14867
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14868
;// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/google-docs-uid-remover.js
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14869
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14870
 * WordPress dependencies
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14871
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14872
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14873
function googleDocsUIdRemover(node) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14874
  if (!node.id || node.id.indexOf('docs-internal-guid-') !== 0) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14875
    return;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14876
  }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14877
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14878
  // Google Docs sometimes wraps the content in a B tag. We don't want to keep
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14879
  // this.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14880
  if (node.tagName === 'B') {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14881
    (0,external_wp_dom_namespaceObject.unwrap)(node);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14882
  } else {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14883
    node.removeAttribute('id');
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14884
  }
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14885
}
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14886
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14887
;// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/html-formatting-remover.js
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14888
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14889
 * Internal dependencies
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14890
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14891
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14892
function isFormattingSpace(character) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14893
  return character === ' ' || character === '\r' || character === '\n' || character === '\t';
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14894
}
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14895
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14896
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14897
 * Removes spacing that formats HTML.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14898
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14899
 * @see https://www.w3.org/TR/css-text-3/#white-space-processing
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14900
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14901
 * @param {Node} node The node to be processed.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14902
 * @return {void}
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14903
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14904
function htmlFormattingRemover(node) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14905
  if (node.nodeType !== node.TEXT_NODE) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14906
    return;
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14907
  }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14908
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14909
  // Ignore pre content. Note that this does not use Element#closest due to
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14910
  // a combination of (a) node may not be Element and (b) node.parentElement
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14911
  // does not have full support in all browsers (Internet Exporer).
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14912
  //
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14913
  // See: https://developer.mozilla.org/en-US/docs/Web/API/Node/parentElement#Browser_compatibility
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14914
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14915
  /** @type {Node?} */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14916
  let parent = node;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14917
  while (parent = parent.parentNode) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14918
    if (parent.nodeType === parent.ELEMENT_NODE && parent.nodeName === 'PRE') {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14919
      return;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14920
    }
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14921
  }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14922
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14923
  // First, replace any sequence of HTML formatting space with a single space.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14924
  let newData = node.data.replace(/[ \r\n\t]+/g, ' ');
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14925
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14926
  // Remove the leading space if the text element is at the start of a block,
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14927
  // is preceded by a line break element, or has a space in the previous
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14928
  // node.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14929
  if (newData[0] === ' ') {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14930
    const previousSibling = getSibling(node, 'previous');
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14931
    if (!previousSibling || previousSibling.nodeName === 'BR' || previousSibling.textContent.slice(-1) === ' ') {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14932
      newData = newData.slice(1);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14933
    }
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14934
  }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14935
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14936
  // Remove the trailing space if the text element is at the end of a block,
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14937
  // is succeded by a line break element, or has a space in the next text
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14938
  // node.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14939
  if (newData[newData.length - 1] === ' ') {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14940
    const nextSibling = getSibling(node, 'next');
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14941
    if (!nextSibling || nextSibling.nodeName === 'BR' || nextSibling.nodeType === nextSibling.TEXT_NODE && isFormattingSpace(nextSibling.textContent[0])) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14942
      newData = newData.slice(0, -1);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14943
    }
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14944
  }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14945
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14946
  // If there's no data left, remove the node, so `previousSibling` stays
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14947
  // accurate. Otherwise, update the node data.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14948
  if (!newData) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14949
    node.parentNode.removeChild(node);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14950
  } else {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14951
    node.data = newData;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14952
  }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14953
}
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14954
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14955
;// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/br-remover.js
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14956
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14957
 * Internal dependencies
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14958
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14959
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14960
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14961
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14962
 * Removes trailing br elements from text-level content.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14963
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14964
 * @param {Element} node Node to check.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14965
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14966
function brRemover(node) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14967
  if (node.nodeName !== 'BR') {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14968
    return;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14969
  }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14970
  if (getSibling(node, 'next')) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14971
    return;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14972
  }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14973
  node.parentNode.removeChild(node);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14974
}
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14975
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14976
;// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/empty-paragraph-remover.js
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14977
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14978
 * Removes empty paragraph elements.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14979
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14980
 * @param {Element} node Node to check.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14981
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14982
function emptyParagraphRemover(node) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14983
  if (node.nodeName !== 'P') {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14984
    return;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14985
  }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14986
  if (node.hasChildNodes()) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14987
    return;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14988
  }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14989
  node.parentNode.removeChild(node);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14990
}
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 14991
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14992
;// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/slack-paragraph-corrector.js
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14993
/**
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14994
 * Replaces Slack paragraph markup with a double line break (later converted to
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14995
 * a proper paragraph).
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14996
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14997
 * @param {Element} node Node to check.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14998
 */
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 14999
function slackParagraphCorrector(node) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15000
  if (node.nodeName !== 'SPAN') {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15001
    return;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15002
  }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15003
  if (node.getAttribute('data-stringify-type') !== 'paragraph-break') {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15004
    return;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15005
  }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15006
  const {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15007
    parentNode
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15008
  } = node;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15009
  parentNode.insertBefore(node.ownerDocument.createElement('br'), node);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15010
  parentNode.insertBefore(node.ownerDocument.createElement('br'), node);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15011
  parentNode.removeChild(node);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15012
}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15013
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15014
;// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/paste-handler.js
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15015
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15016
 * WordPress dependencies
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15017
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15018
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15019
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15020
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15021
 * Internal dependencies
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15022
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15023
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15024
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15025
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15026
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15027
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15028
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15029
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15030
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15031
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15032
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15033
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15034
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15035
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15036
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15037
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15038
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15039
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15040
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15041
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15042
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15043
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15044
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15045
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15046
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15047
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15048
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15049
const log = (...args) => window?.console?.log?.(...args);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15050
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15051
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15052
 * Filters HTML to only contain phrasing content.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15053
 *
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15054
 * @param {string} HTML The HTML to filter.
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15055
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15056
 * @return {string} HTML only containing phrasing content.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15057
 */
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15058
function filterInlineHTML(HTML) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15059
  HTML = deepFilterHTML(HTML, [headRemover, googleDocsUIdRemover, msListIgnore, phrasingContentReducer, commentRemover]);
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15060
  HTML = (0,external_wp_dom_namespaceObject.removeInvalidHTML)(HTML, (0,external_wp_dom_namespaceObject.getPhrasingContentSchema)('paste'), {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15061
    inline: true
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15062
  });
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15063
  HTML = deepFilterHTML(HTML, [htmlFormattingRemover, brRemover]);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15064
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15065
  // Allows us to ask for this information when we get a report.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15066
  log('Processed inline HTML:\n\n', HTML);
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15067
  return HTML;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15068
}
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15069
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15070
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15071
 * Converts an HTML string to known blocks. Strips everything else.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15072
 *
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15073
 * @param {Object} options
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15074
 * @param {string} [options.HTML]      The HTML to convert.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15075
 * @param {string} [options.plainText] Plain text version.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15076
 * @param {string} [options.mode]      Handle content as blocks or inline content.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15077
 *                                     * 'AUTO': Decide based on the content passed.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15078
 *                                     * 'INLINE': Always handle as inline content, and return string.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15079
 *                                     * 'BLOCKS': Always handle as blocks, and return array of blocks.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15080
 * @param {Array}  [options.tagName]   The tag into which content will be inserted.
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15081
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15082
 * @return {Array|string} A list of blocks or a string, depending on `handlerMode`.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15083
 */
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15084
function pasteHandler({
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15085
  HTML = '',
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15086
  plainText = '',
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15087
  mode = 'AUTO',
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15088
  tagName
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15089
}) {
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15090
  // First of all, strip any meta tags.
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15091
  HTML = HTML.replace(/<meta[^>]+>/g, '');
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15092
  // Strip Windows markers.
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15093
  HTML = HTML.replace(/^\s*<html[^>]*>\s*<body[^>]*>(?:\s*<!--\s*StartFragment\s*-->)?/i, '');
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15094
  HTML = HTML.replace(/(?:<!--\s*EndFragment\s*-->\s*)?<\/body>\s*<\/html>\s*$/i, '');
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15095
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15096
  // If we detect block delimiters in HTML, parse entirely as blocks.
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15097
  if (mode !== 'INLINE') {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15098
    // Check plain text if there is no HTML.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15099
    const content = HTML ? HTML : plainText;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15100
    if (content.indexOf('<!-- wp:') !== -1) {
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15101
      const parseResult = parser_parse(content);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15102
      const isSingleFreeFormBlock = parseResult.length === 1 && parseResult[0].name === 'core/freeform';
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15103
      if (!isSingleFreeFormBlock) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15104
        return parseResult;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15105
      }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15106
    }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15107
  }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15108
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15109
  // Normalize unicode to use composed characters.
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15110
  // This is unsupported in IE 11 but it's a nice-to-have feature, not mandatory.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15111
  // Not normalizing the content will only affect older browsers and won't
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15112
  // entirely break the app.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15113
  // See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/normalize
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15114
  // See: https://core.trac.wordpress.org/ticket/30130
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15115
  // See: https://github.com/WordPress/gutenberg/pull/6983#pullrequestreview-125151075
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15116
  if (String.prototype.normalize) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15117
    HTML = HTML.normalize();
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15118
  }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15119
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15120
  // Must be run before checking if it's inline content.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15121
  HTML = deepFilterHTML(HTML, [slackParagraphCorrector]);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15122
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15123
  // Consider plain text if:
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15124
  // * There is a plain text version.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15125
  // * There is no HTML version, or it has no formatting.
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15126
  const isPlainText = plainText && (!HTML || isPlain(HTML));
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15127
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15128
  // Parse Markdown (and encoded HTML) if it's considered plain text.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15129
  if (isPlainText) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15130
    HTML = plainText;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15131
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15132
    // The markdown converter (Showdown) trims whitespace.
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15133
    if (!/^\s+$/.test(plainText)) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15134
      HTML = markdownConverter(HTML);
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15135
    }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15136
  }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15137
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15138
  // An array of HTML strings and block objects. The blocks replace matched
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15139
  // shortcodes.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15140
  const pieces = shortcode_converter(HTML);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15141
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15142
  // The call to shortcodeConverter will always return more than one element
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15143
  // if shortcodes are matched. The reason is when shortcodes are matched
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15144
  // empty HTML strings are included.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15145
  const hasShortcodes = pieces.length > 1;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15146
  if (isPlainText && !hasShortcodes) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15147
    // Switch to inline mode if:
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15148
    // * The current mode is AUTO.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15149
    // * The original plain text had no line breaks.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15150
    // * The original plain text was not an HTML paragraph.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15151
    // * The converted text is just a paragraph.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15152
    if (mode === 'AUTO' && plainText.indexOf('\n') === -1 && plainText.indexOf('<p>') !== 0 && HTML.indexOf('<p>') === 0) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15153
      mode = 'INLINE';
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15154
    }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15155
  }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15156
  if (mode === 'INLINE') {
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15157
    return filterInlineHTML(HTML);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15158
  }
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15159
  if (mode === 'AUTO' && !hasShortcodes && isInlineContent(HTML, tagName)) {
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15160
    return filterInlineHTML(HTML);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15161
  }
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15162
  const phrasingContentSchema = (0,external_wp_dom_namespaceObject.getPhrasingContentSchema)('paste');
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15163
  const blockContentSchema = getBlockContentSchema('paste');
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15164
  const blocks = pieces.map(piece => {
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15165
    // Already a block from shortcode.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15166
    if (typeof piece !== 'string') {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15167
      return piece;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15168
    }
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15169
    const filters = [googleDocsUIdRemover, msListConverter, headRemover, listReducer, imageCorrector, phrasingContentReducer, specialCommentConverter, commentRemover, iframeRemover, figureContentReducer, blockquoteNormaliser(), divNormaliser];
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15170
    const schema = {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15171
      ...blockContentSchema,
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15172
      // Keep top-level phrasing content, normalised by `normaliseBlocks`.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15173
      ...phrasingContentSchema
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15174
    };
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15175
    piece = deepFilterHTML(piece, filters, blockContentSchema);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15176
    piece = (0,external_wp_dom_namespaceObject.removeInvalidHTML)(piece, schema);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15177
    piece = normaliseBlocks(piece);
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15178
    piece = deepFilterHTML(piece, [htmlFormattingRemover, brRemover, emptyParagraphRemover], blockContentSchema);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15179
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15180
    // Allows us to ask for this information when we get a report.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15181
    log('Processed HTML piece:\n\n', piece);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15182
    return htmlToBlocks(piece, pasteHandler);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15183
  }).flat().filter(Boolean);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15184
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15185
  // If we're allowed to return inline content, and there is only one
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15186
  // inlineable block, and the original plain text content does not have any
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15187
  // line breaks, then treat it as inline paste.
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15188
  if (mode === 'AUTO' && blocks.length === 1 && hasBlockSupport(blocks[0].name, '__unstablePasteTextInline', false)) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15189
    const trimRegex = /^[\n]+|[\n]+$/g;
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15190
    // Don't catch line breaks at the start or end.
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15191
    const trimmedPlainText = plainText.replace(trimRegex, '');
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15192
    if (trimmedPlainText !== '' && trimmedPlainText.indexOf('\n') === -1) {
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15193
      return (0,external_wp_dom_namespaceObject.removeInvalidHTML)(getBlockInnerHTML(blocks[0]), phrasingContentSchema).replace(trimRegex, '');
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15194
    }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15195
  }
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15196
  return blocks;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15197
}
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15198
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15199
;// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/categories.js
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15200
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15201
 * WordPress dependencies
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15202
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15203
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15204
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15205
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15206
 * Internal dependencies
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15207
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15208
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15209
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15210
/** @typedef {import('../store/reducer').WPBlockCategory} WPBlockCategory */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15211
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15212
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15213
 * Returns all the block categories.
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15214
 * Ignored from documentation as the recommended usage is via useSelect from @wordpress/data.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15215
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15216
 * @ignore
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15217
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15218
 * @return {WPBlockCategory[]} Block categories.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15219
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15220
function categories_getCategories() {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15221
  return (0,external_wp_data_namespaceObject.select)(store).getCategories();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15222
}
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15223
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15224
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15225
 * Sets the block categories.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15226
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15227
 * @param {WPBlockCategory[]} categories Block categories.
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15228
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15229
 * @example
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15230
 * ```js
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15231
 * import { __ } from '@wordpress/i18n';
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15232
 * import { store as blocksStore, setCategories } from '@wordpress/blocks';
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15233
 * import { useSelect } from '@wordpress/data';
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15234
 * import { Button } from '@wordpress/components';
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15235
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15236
 * const ExampleComponent = () => {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15237
 *     // Retrieve the list of current categories.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15238
 *     const blockCategories = useSelect(
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15239
 *         ( select ) => select( blocksStore ).getCategories(),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15240
 *         []
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15241
 *     );
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15242
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15243
 *     return (
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15244
 *         <Button
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15245
 *             onClick={ () => {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15246
 *                 // Add a custom category to the existing list.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15247
 *                 setCategories( [
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15248
 *                     ...blockCategories,
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15249
 *                     { title: 'Custom Category', slug: 'custom-category' },
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15250
 *                 ] );
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15251
 *             } }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15252
 *         >
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15253
 *             { __( 'Add a new custom block category' ) }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15254
 *         </Button>
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15255
 *     );
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15256
 * };
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15257
 * ```
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15258
 */
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15259
function categories_setCategories(categories) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15260
  (0,external_wp_data_namespaceObject.dispatch)(store).setCategories(categories);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15261
}
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15262
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15263
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15264
 * Updates a category.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15265
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15266
 * @param {string}          slug     Block category slug.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15267
 * @param {WPBlockCategory} category Object containing the category properties
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15268
 *                                   that should be updated.
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15269
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15270
 * @example
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15271
 * ```js
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15272
 * import { __ } from '@wordpress/i18n';
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15273
 * import { updateCategory } from '@wordpress/blocks';
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15274
 * import { Button } from '@wordpress/components';
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15275
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15276
 * const ExampleComponent = () => {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15277
 *     return (
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15278
 *         <Button
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15279
 *             onClick={ () => {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15280
 *                 updateCategory( 'text', { title: __( 'Written Word' ) } );
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15281
 *             } }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15282
 *         >
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15283
 *             { __( 'Update Text category title' ) }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15284
 *         </Button>
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15285
 * )    ;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15286
 * };
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15287
 * ```
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15288
 */
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15289
function categories_updateCategory(slug, category) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15290
  (0,external_wp_data_namespaceObject.dispatch)(store).updateCategory(slug, category);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15291
}
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15292
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15293
;// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/templates.js
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15294
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15295
 * WordPress dependencies
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15296
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15297
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15298
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15299
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15300
 * Internal dependencies
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15301
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15302
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15303
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15304
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15305
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15306
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15307
 * Checks whether a list of blocks matches a template by comparing the block names.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15308
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15309
 * @param {Array} blocks   Block list.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15310
 * @param {Array} template Block template.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15311
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15312
 * @return {boolean} Whether the list of blocks matches a templates.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15313
 */
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15314
function doBlocksMatchTemplate(blocks = [], template = []) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15315
  return blocks.length === template.length && template.every(([name,, innerBlocksTemplate], index) => {
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15316
    const block = blocks[index];
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15317
    return name === block.name && doBlocksMatchTemplate(block.innerBlocks, innerBlocksTemplate);
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15318
  });
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15319
}
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15320
const isHTMLAttribute = attributeDefinition => attributeDefinition?.source === 'html';
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15321
const isQueryAttribute = attributeDefinition => attributeDefinition?.source === 'query';
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15322
function normalizeAttributes(schema, values) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15323
  if (!values) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15324
    return {};
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15325
  }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15326
  return Object.fromEntries(Object.entries(values).map(([key, value]) => [key, normalizeAttribute(schema[key], value)]));
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15327
}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15328
function normalizeAttribute(definition, value) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15329
  if (isHTMLAttribute(definition) && Array.isArray(value)) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15330
    // Introduce a deprecated call at this point
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15331
    // When we're confident that "children" format should be removed from the templates.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15332
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15333
    return (0,external_wp_element_namespaceObject.renderToString)(value);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15334
  }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15335
  if (isQueryAttribute(definition) && value) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15336
    return value.map(subValues => {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15337
      return normalizeAttributes(definition.query, subValues);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15338
    });
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15339
  }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15340
  return value;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15341
}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15342
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15343
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15344
 * Synchronize a block list with a block template.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15345
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15346
 * Synchronizing a block list with a block template means that we loop over the blocks
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15347
 * keep the block as is if it matches the block at the same position in the template
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15348
 * (If it has the same name) and if doesn't match, we create a new block based on the template.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15349
 * Extra blocks not present in the template are removed.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15350
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15351
 * @param {Array} blocks   Block list.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15352
 * @param {Array} template Block template.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15353
 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15354
 * @return {Array} Updated Block list.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15355
 */
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15356
function synchronizeBlocksWithTemplate(blocks = [], template) {
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15357
  // If no template is provided, return blocks unmodified.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15358
  if (!template) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15359
    return blocks;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15360
  }
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15361
  return template.map(([name, attributes, innerBlocksTemplate], index) => {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15362
    var _blockType$attributes;
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15363
    const block = blocks[index];
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15364
    if (block && block.name === name) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15365
      const innerBlocks = synchronizeBlocksWithTemplate(block.innerBlocks, innerBlocksTemplate);
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15366
      return {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15367
        ...block,
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15368
        innerBlocks
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15369
      };
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15370
    }
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15371
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15372
    // To support old templates that were using the "children" format
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15373
    // for the attributes using "html" strings now, we normalize the template attributes
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15374
    // before creating the blocks.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15375
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15376
    const blockType = getBlockType(name);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15377
    const normalizedAttributes = normalizeAttributes((_blockType$attributes = blockType?.attributes) !== null && _blockType$attributes !== void 0 ? _blockType$attributes : {}, attributes);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15378
    let [blockName, blockAttributes] = convertLegacyBlockNameAndAttributes(name, normalizedAttributes);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15379
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15380
    // If a Block is undefined at this point, use the core/missing block as
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15381
    // a placeholder for a better user experience.
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15382
    if (undefined === getBlockType(blockName)) {
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15383
      blockAttributes = {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15384
        originalName: name,
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15385
        originalContent: '',
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15386
        originalUndelimitedContent: ''
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15387
      };
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15388
      blockName = 'core/missing';
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15389
    }
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15390
    return createBlock(blockName, blockAttributes, synchronizeBlocksWithTemplate([], innerBlocksTemplate));
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15391
  });
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15392
}
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15393
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15394
;// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/index.js
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15395
// The blocktype is the most important concept within the block API. It defines
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15396
// all aspects of the block configuration and its interfaces, including `edit`
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15397
// and `save`. The transforms specification allows converting one blocktype to
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15398
// another through formulas defined by either the source or the destination.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15399
// Switching a blocktype is to be considered a one-way operation implying a
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15400
// transformation in the opposite way has to be handled explicitly.
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15401
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15402
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15403
// The block tree is composed of a collection of block nodes. Blocks contained
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15404
// within other blocks are called inner blocks. An important design
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15405
// consideration is that inner blocks are -- conceptually -- not part of the
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15406
// territory established by the parent block that contains them.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15407
//
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15408
// This has multiple practical implications: when parsing, we can safely dispose
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15409
// of any block boundary found within a block from the innerHTML property when
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15410
// transfering to state. Not doing so would have a compounding effect on memory
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15411
// and uncertainty over the source of truth. This can be illustrated in how,
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15412
// given a tree of `n` nested blocks, the entry node would have to contain the
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15413
// actual content of each block while each subsequent block node in the state
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15414
// tree would replicate the entire chain `n-1`, meaning the extreme end node
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15415
// would have been replicated `n` times as the tree is traversed and would
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15416
// generate uncertainty as to which one is to hold the current value of the
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15417
// block. For composition, it also means inner blocks can effectively be child
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15418
// components whose mechanisms can be shielded from the `edit` implementation
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15419
// and just passed along.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15420
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15421
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15422
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15423
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15424
// While block transformations account for a specific surface of the API, there
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15425
// are also raw transformations which handle arbitrary sources not made out of
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15426
// blocks but producing block basaed on various heursitics. This includes
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15427
// pasting rich text or HTML data.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15428
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15429
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15430
// The process of serialization aims to deflate the internal memory of the block
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15431
// editor and its state representation back into an HTML valid string. This
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15432
// process restores the document integrity and inserts invisible delimiters
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15433
// around each block with HTML comment boundaries which can contain any extra
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15434
// attributes needed to operate with the block later on.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15435
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15436
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15437
// Validation is the process of comparing a block source with its output before
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15438
// there is any user input or interaction with a block. When this operation
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15439
// fails -- for whatever reason -- the block is to be considered invalid. As
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15440
// part of validating a block the system will attempt to run the source against
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15441
// any provided deprecation definitions.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15442
//
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15443
// Worth emphasizing that validation is not a case of whether the markup is
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15444
// merely HTML spec-compliant but about how the editor knows to create such
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15445
// markup and that its inability to create an identical result can be a strong
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15446
// indicator of potential data loss (the invalidation is then a protective
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15447
// measure).
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15448
//
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15449
// The invalidation process can also be deconstructed in phases: 1) validate the
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15450
// block exists; 2) validate the source matches the output; 3) validate the
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15451
// source matches deprecated outputs; 4) work through the significance of
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15452
// differences. These are stacked in a way that favors performance and optimizes
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15453
// for the majority of cases. That is to say, the evaluation logic can become
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15454
// more sophisticated the further down it goes in the process as the cost is
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15455
// accounted for. The first logic checks have to be extremely efficient since
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15456
// they will be run for all valid and invalid blocks alike. However, once a
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15457
// block is detected as invalid -- failing the three first steps -- it is
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15458
// adequate to spend more time determining validity before throwing a conflict.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15459
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15460
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15461
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15462
// Blocks are inherently indifferent about where the data they operate with ends
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15463
// up being saved. For example, all blocks can have a static and dynamic aspect
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15464
// to them depending on the needs. The static nature of a block is the `save()`
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15465
// definition that is meant to be serialized into HTML and which can be left
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15466
// void. Any block can also register a `render_callback` on the server, which
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15467
// makes its output dynamic either in part or in its totality.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15468
//
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15469
// Child blocks are defined as a relationship that builds on top of the inner
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15470
// blocks mechanism. A child block is a block node of a particular type that can
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15471
// only exist within the inner block boundaries of a specific parent type. This
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15472
// allows block authors to compose specific blocks that are not meant to be used
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15473
// outside of a specified parent block context. Thus, child blocks extend the
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15474
// concept of inner blocks to support a more direct relationship between sets of
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15475
// blocks. The addition of parent–child would be a subset of the inner block
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15476
// functionality under the premise that certain blocks only make sense as
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15477
// children of another block.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15478
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15479
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15480
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15481
// Templates are, in a general sense, a basic collection of block nodes with any
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15482
// given set of predefined attributes that are supplied as the initial state of
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15483
// an inner blocks group. These nodes can, in turn, contain any number of nested
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15484
// blocks within their definition. Templates allow both to specify a default
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15485
// state for an editor session or a default set of blocks for any inner block
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15486
// implementation within a specific block.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15487
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15488
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15489
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15490
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15491
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15492
;// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/deprecated.js
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15493
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15494
 * WordPress dependencies
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15495
 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15496
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15497
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15498
/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15499
 * A Higher Order Component used to inject BlockContent using context to the
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15500
 * wrapped component.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15501
 *
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15502
 * @deprecated
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15503
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15504
 * @param {Component} OriginalComponent The component to enhance.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15505
 * @return {Component} The same component.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15506
 */
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15507
function withBlockContentContext(OriginalComponent) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15508
  external_wp_deprecated_default()('wp.blocks.withBlockContentContext', {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15509
    since: '6.1'
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15510
  });
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15511
  return OriginalComponent;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15512
}
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15513
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15514
;// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/index.js
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15515
// A "block" is the abstract term used to describe units of markup that,
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15516
// when composed together, form the content or layout of a page.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15517
// The API for blocks is exposed via `wp.blocks`.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15518
//
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15519
// Supported blocks are registered by calling `registerBlockType`. Once registered,
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15520
// the block is made available as an option to the editor interface.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15521
//
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15522
// Blocks are inferred from the HTML source of a post through a parsing mechanism
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15523
// and then stored as objects in state, from which it is then rendered for editing.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15524
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15525
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15526
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15527
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15528
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15529
})();
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
 15530
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15531
(window.wp = window.wp || {}).blocks = __webpack_exports__;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15532
/******/ })()
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
 15533
;