[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

title

Body

[close]

/wp-includes/js/dist/script-modules/core-actions/ -> wp_block.js (source)

   1  var __create = Object.create;
   2  var __defProp = Object.defineProperty;
   3  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
   4  var __getOwnPropNames = Object.getOwnPropertyNames;
   5  var __getProtoOf = Object.getPrototypeOf;
   6  var __hasOwnProp = Object.prototype.hasOwnProperty;
   7  var __commonJS = (cb, mod) => function __require() {
   8    return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
   9  };
  10  var __copyProps = (to, from, except, desc) => {
  11    if (from && typeof from === "object" || typeof from === "function") {
  12      for (let key of __getOwnPropNames(from))
  13        if (!__hasOwnProp.call(to, key) && key !== except)
  14          __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  15    }
  16    return to;
  17  };
  18  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
  19    // If the importer is in node compatibility mode or this is not an ESM
  20    // file that has been converted to a CommonJS file using a Babel-
  21    // compatible transform (i.e. "__esModule" has not been set), then set
  22    // "default" to the CommonJS "module.exports" for node compatibility.
  23    isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
  24    mod
  25  ));
  26  
  27  // package-external:@wordpress/i18n
  28  var require_i18n = __commonJS({
  29    "package-external:@wordpress/i18n"(exports, module) {
  30      module.exports = window.wp.i18n;
  31    }
  32  });
  33  
  34  // package-external:@wordpress/patterns
  35  var require_patterns = __commonJS({
  36    "package-external:@wordpress/patterns"(exports, module) {
  37      module.exports = window.wp.patterns;
  38    }
  39  });
  40  
  41  // package-external:@wordpress/private-apis
  42  var require_private_apis = __commonJS({
  43    "package-external:@wordpress/private-apis"(exports, module) {
  44      module.exports = window.wp.privateApis;
  45    }
  46  });
  47  
  48  // vendor-external:react/jsx-runtime
  49  var require_jsx_runtime = __commonJS({
  50    "vendor-external:react/jsx-runtime"(exports, module) {
  51      module.exports = window.ReactJSXRuntime;
  52    }
  53  });
  54  
  55  // node_modules/.store/remove-accents@0.5.0-S_lnImruWgc6kBSjIJlPgw/node_modules/remove-accents/index.js
  56  var require_remove_accents = __commonJS({
  57    "node_modules/.store/remove-accents@0.5.0-S_lnImruWgc6kBSjIJlPgw/node_modules/remove-accents/index.js"(exports, module) {
  58      var characterMap = {
  59        "À": "A",
  60        "Á": "A",
  61        "Â": "A",
  62        "Ã": "A",
  63        "Ä": "A",
  64        "Å": "A",
  65        "Ấ": "A",
  66        "Ắ": "A",
  67        "Ẳ": "A",
  68        "Ẵ": "A",
  69        "Ặ": "A",
  70        "Æ": "AE",
  71        "Ầ": "A",
  72        "Ằ": "A",
  73        "Ȃ": "A",
  74        "Ả": "A",
  75        "Ạ": "A",
  76        "Ẩ": "A",
  77        "Ẫ": "A",
  78        "Ậ": "A",
  79        "Ç": "C",
  80        "Ḉ": "C",
  81        "È": "E",
  82        "É": "E",
  83        "Ê": "E",
  84        "Ë": "E",
  85        "Ế": "E",
  86        "Ḗ": "E",
  87        "Ề": "E",
  88        "Ḕ": "E",
  89        "Ḝ": "E",
  90        "Ȇ": "E",
  91        "Ẻ": "E",
  92        "Ẽ": "E",
  93        "Ẹ": "E",
  94        "Ể": "E",
  95        "Ễ": "E",
  96        "Ệ": "E",
  97        "Ì": "I",
  98        "Í": "I",
  99        "Î": "I",
 100        "Ï": "I",
 101        "Ḯ": "I",
 102        "Ȋ": "I",
 103        "Ỉ": "I",
 104        "Ị": "I",
 105        "Ð": "D",
 106        "Ñ": "N",
 107        "Ò": "O",
 108        "Ó": "O",
 109        "Ô": "O",
 110        "Õ": "O",
 111        "Ö": "O",
 112        "Ø": "O",
 113        "Ố": "O",
 114        "Ṍ": "O",
 115        "Ṓ": "O",
 116        "Ȏ": "O",
 117        "Ỏ": "O",
 118        "Ọ": "O",
 119        "Ổ": "O",
 120        "Ỗ": "O",
 121        "Ộ": "O",
 122        "Ờ": "O",
 123        "Ở": "O",
 124        "Ỡ": "O",
 125        "Ớ": "O",
 126        "Ợ": "O",
 127        "Ù": "U",
 128        "Ú": "U",
 129        "Û": "U",
 130        "Ü": "U",
 131        "Ủ": "U",
 132        "Ụ": "U",
 133        "Ử": "U",
 134        "Ữ": "U",
 135        "Ự": "U",
 136        "Ý": "Y",
 137        "à": "a",
 138        "á": "a",
 139        "â": "a",
 140        "ã": "a",
 141        "ä": "a",
 142        "å": "a",
 143        "ấ": "a",
 144        "ắ": "a",
 145        "ẳ": "a",
 146        "ẵ": "a",
 147        "ặ": "a",
 148        "æ": "ae",
 149        "ầ": "a",
 150        "ằ": "a",
 151        "ȃ": "a",
 152        "ả": "a",
 153        "ạ": "a",
 154        "ẩ": "a",
 155        "ẫ": "a",
 156        "ậ": "a",
 157        "ç": "c",
 158        "ḉ": "c",
 159        "è": "e",
 160        "é": "e",
 161        "ê": "e",
 162        "ë": "e",
 163        "ế": "e",
 164        "ḗ": "e",
 165        "ề": "e",
 166        "ḕ": "e",
 167        "ḝ": "e",
 168        "ȇ": "e",
 169        "ẻ": "e",
 170        "ẽ": "e",
 171        "ẹ": "e",
 172        "ể": "e",
 173        "ễ": "e",
 174        "ệ": "e",
 175        "ì": "i",
 176        "í": "i",
 177        "î": "i",
 178        "ï": "i",
 179        "ḯ": "i",
 180        "ȋ": "i",
 181        "ỉ": "i",
 182        "ị": "i",
 183        "ð": "d",
 184        "ñ": "n",
 185        "ò": "o",
 186        "ó": "o",
 187        "ô": "o",
 188        "õ": "o",
 189        "ö": "o",
 190        "ø": "o",
 191        "ố": "o",
 192        "ṍ": "o",
 193        "ṓ": "o",
 194        "ȏ": "o",
 195        "ỏ": "o",
 196        "ọ": "o",
 197        "ổ": "o",
 198        "ỗ": "o",
 199        "ộ": "o",
 200        "ờ": "o",
 201        "ở": "o",
 202        "ỡ": "o",
 203        "ớ": "o",
 204        "ợ": "o",
 205        "ù": "u",
 206        "ú": "u",
 207        "û": "u",
 208        "ü": "u",
 209        "ủ": "u",
 210        "ụ": "u",
 211        "ử": "u",
 212        "ữ": "u",
 213        "ự": "u",
 214        "ý": "y",
 215        "ÿ": "y",
 216        "Ā": "A",
 217        "ā": "a",
 218        "Ă": "A",
 219        "ă": "a",
 220        "Ą": "A",
 221        "ą": "a",
 222        "Ć": "C",
 223        "ć": "c",
 224        "Ĉ": "C",
 225        "ĉ": "c",
 226        "Ċ": "C",
 227        "ċ": "c",
 228        "Č": "C",
 229        "č": "c",
 230        "C̆": "C",
 231        "c̆": "c",
 232        "Ď": "D",
 233        "ď": "d",
 234        "Đ": "D",
 235        "đ": "d",
 236        "Ē": "E",
 237        "ē": "e",
 238        "Ĕ": "E",
 239        "ĕ": "e",
 240        "Ė": "E",
 241        "ė": "e",
 242        "Ę": "E",
 243        "ę": "e",
 244        "Ě": "E",
 245        "ě": "e",
 246        "Ĝ": "G",
 247        "Ǵ": "G",
 248        "ĝ": "g",
 249        "ǵ": "g",
 250        "Ğ": "G",
 251        "ğ": "g",
 252        "Ġ": "G",
 253        "ġ": "g",
 254        "Ģ": "G",
 255        "ģ": "g",
 256        "Ĥ": "H",
 257        "ĥ": "h",
 258        "Ħ": "H",
 259        "ħ": "h",
 260        "Ḫ": "H",
 261        "ḫ": "h",
 262        "Ĩ": "I",
 263        "ĩ": "i",
 264        "Ī": "I",
 265        "ī": "i",
 266        "Ĭ": "I",
 267        "ĭ": "i",
 268        "Į": "I",
 269        "į": "i",
 270        "İ": "I",
 271        "ı": "i",
 272        "IJ": "IJ",
 273        "ij": "ij",
 274        "Ĵ": "J",
 275        "ĵ": "j",
 276        "Ķ": "K",
 277        "ķ": "k",
 278        "Ḱ": "K",
 279        "ḱ": "k",
 280        "K̆": "K",
 281        "k̆": "k",
 282        "Ĺ": "L",
 283        "ĺ": "l",
 284        "Ļ": "L",
 285        "ļ": "l",
 286        "Ľ": "L",
 287        "ľ": "l",
 288        "Ŀ": "L",
 289        "ŀ": "l",
 290        "Ł": "l",
 291        "ł": "l",
 292        "Ḿ": "M",
 293        "ḿ": "m",
 294        "M̆": "M",
 295        "m̆": "m",
 296        "Ń": "N",
 297        "ń": "n",
 298        "Ņ": "N",
 299        "ņ": "n",
 300        "Ň": "N",
 301        "ň": "n",
 302        "ʼn": "n",
 303        "N̆": "N",
 304        "n̆": "n",
 305        "Ō": "O",
 306        "ō": "o",
 307        "Ŏ": "O",
 308        "ŏ": "o",
 309        "Ő": "O",
 310        "ő": "o",
 311        "Œ": "OE",
 312        "œ": "oe",
 313        "P̆": "P",
 314        "p̆": "p",
 315        "Ŕ": "R",
 316        "ŕ": "r",
 317        "Ŗ": "R",
 318        "ŗ": "r",
 319        "Ř": "R",
 320        "ř": "r",
 321        "R̆": "R",
 322        "r̆": "r",
 323        "Ȓ": "R",
 324        "ȓ": "r",
 325        "Ś": "S",
 326        "ś": "s",
 327        "Ŝ": "S",
 328        "ŝ": "s",
 329        "Ş": "S",
 330        "Ș": "S",
 331        "ș": "s",
 332        "ş": "s",
 333        "Š": "S",
 334        "š": "s",
 335        "Ţ": "T",
 336        "ţ": "t",
 337        "ț": "t",
 338        "Ț": "T",
 339        "Ť": "T",
 340        "ť": "t",
 341        "Ŧ": "T",
 342        "ŧ": "t",
 343        "T̆": "T",
 344        "t̆": "t",
 345        "Ũ": "U",
 346        "ũ": "u",
 347        "Ū": "U",
 348        "ū": "u",
 349        "Ŭ": "U",
 350        "ŭ": "u",
 351        "Ů": "U",
 352        "ů": "u",
 353        "Ű": "U",
 354        "ű": "u",
 355        "Ų": "U",
 356        "ų": "u",
 357        "Ȗ": "U",
 358        "ȗ": "u",
 359        "V̆": "V",
 360        "v̆": "v",
 361        "Ŵ": "W",
 362        "ŵ": "w",
 363        "Ẃ": "W",
 364        "ẃ": "w",
 365        "X̆": "X",
 366        "x̆": "x",
 367        "Ŷ": "Y",
 368        "ŷ": "y",
 369        "Ÿ": "Y",
 370        "Y̆": "Y",
 371        "y̆": "y",
 372        "Ź": "Z",
 373        "ź": "z",
 374        "Ż": "Z",
 375        "ż": "z",
 376        "Ž": "Z",
 377        "ž": "z",
 378        "ſ": "s",
 379        "ƒ": "f",
 380        "Ơ": "O",
 381        "ơ": "o",
 382        "Ư": "U",
 383        "ư": "u",
 384        "Ǎ": "A",
 385        "ǎ": "a",
 386        "Ǐ": "I",
 387        "ǐ": "i",
 388        "Ǒ": "O",
 389        "ǒ": "o",
 390        "Ǔ": "U",
 391        "ǔ": "u",
 392        "Ǖ": "U",
 393        "ǖ": "u",
 394        "Ǘ": "U",
 395        "ǘ": "u",
 396        "Ǚ": "U",
 397        "ǚ": "u",
 398        "Ǜ": "U",
 399        "ǜ": "u",
 400        "Ứ": "U",
 401        "ứ": "u",
 402        "Ṹ": "U",
 403        "ṹ": "u",
 404        "Ǻ": "A",
 405        "ǻ": "a",
 406        "Ǽ": "AE",
 407        "ǽ": "ae",
 408        "Ǿ": "O",
 409        "ǿ": "o",
 410        "Þ": "TH",
 411        "þ": "th",
 412        "Ṕ": "P",
 413        "ṕ": "p",
 414        "Ṥ": "S",
 415        "ṥ": "s",
 416        "X́": "X",
 417        "x́": "x",
 418        "Ѓ": "Г",
 419        "ѓ": "г",
 420        "Ќ": "К",
 421        "ќ": "к",
 422        "A̋": "A",
 423        "a̋": "a",
 424        "E̋": "E",
 425        "e̋": "e",
 426        "I̋": "I",
 427        "i̋": "i",
 428        "Ǹ": "N",
 429        "ǹ": "n",
 430        "Ồ": "O",
 431        "ồ": "o",
 432        "Ṑ": "O",
 433        "ṑ": "o",
 434        "Ừ": "U",
 435        "ừ": "u",
 436        "Ẁ": "W",
 437        "ẁ": "w",
 438        "Ỳ": "Y",
 439        "ỳ": "y",
 440        "Ȁ": "A",
 441        "ȁ": "a",
 442        "Ȅ": "E",
 443        "ȅ": "e",
 444        "Ȉ": "I",
 445        "ȉ": "i",
 446        "Ȍ": "O",
 447        "ȍ": "o",
 448        "Ȑ": "R",
 449        "ȑ": "r",
 450        "Ȕ": "U",
 451        "ȕ": "u",
 452        "B̌": "B",
 453        "b̌": "b",
 454        "Č̣": "C",
 455        "č̣": "c",
 456        "Ê̌": "E",
 457        "ê̌": "e",
 458        "F̌": "F",
 459        "f̌": "f",
 460        "Ǧ": "G",
 461        "ǧ": "g",
 462        "Ȟ": "H",
 463        "ȟ": "h",
 464        "J̌": "J",
 465        "ǰ": "j",
 466        "Ǩ": "K",
 467        "ǩ": "k",
 468        "M̌": "M",
 469        "m̌": "m",
 470        "P̌": "P",
 471        "p̌": "p",
 472        "Q̌": "Q",
 473        "q̌": "q",
 474        "Ř̩": "R",
 475        "ř̩": "r",
 476        "Ṧ": "S",
 477        "ṧ": "s",
 478        "V̌": "V",
 479        "v̌": "v",
 480        "W̌": "W",
 481        "w̌": "w",
 482        "X̌": "X",
 483        "x̌": "x",
 484        "Y̌": "Y",
 485        "y̌": "y",
 486        "A̧": "A",
 487        "a̧": "a",
 488        "B̧": "B",
 489        "b̧": "b",
 490        "Ḑ": "D",
 491        "ḑ": "d",
 492        "Ȩ": "E",
 493        "ȩ": "e",
 494        "Ɛ̧": "E",
 495        "ɛ̧": "e",
 496        "Ḩ": "H",
 497        "ḩ": "h",
 498        "I̧": "I",
 499        "i̧": "i",
 500        "Ɨ̧": "I",
 501        "ɨ̧": "i",
 502        "M̧": "M",
 503        "m̧": "m",
 504        "O̧": "O",
 505        "o̧": "o",
 506        "Q̧": "Q",
 507        "q̧": "q",
 508        "U̧": "U",
 509        "u̧": "u",
 510        "X̧": "X",
 511        "x̧": "x",
 512        "Z̧": "Z",
 513        "z̧": "z",
 514        "й": "и",
 515        "Й": "И",
 516        "ё": "е",
 517        "Ё": "Е"
 518      };
 519      var chars = Object.keys(characterMap).join("|");
 520      var allAccents = new RegExp(chars, "g");
 521      var firstAccent = new RegExp(chars, "");
 522      function matcher(match) {
 523        return characterMap[match];
 524      }
 525      var removeAccents2 = function(string) {
 526        return string.replace(allAccents, matcher);
 527      };
 528      var hasAccents = function(string) {
 529        return !!string.match(firstAccent);
 530      };
 531      module.exports = removeAccents2;
 532      module.exports.has = hasAccents;
 533      module.exports.remove = removeAccents2;
 534    }
 535  });
 536  
 537  // package-external:@wordpress/blob
 538  var require_blob = __commonJS({
 539    "package-external:@wordpress/blob"(exports, module) {
 540      module.exports = window.wp.blob;
 541    }
 542  });
 543  
 544  // package-external:@wordpress/primitives
 545  var require_primitives = __commonJS({
 546    "package-external:@wordpress/primitives"(exports, module) {
 547      module.exports = window.wp.primitives;
 548    }
 549  });
 550  
 551  // package-external:@wordpress/html-entities
 552  var require_html_entities = __commonJS({
 553    "package-external:@wordpress/html-entities"(exports, module) {
 554      module.exports = window.wp.htmlEntities;
 555    }
 556  });
 557  
 558  // packages/core-actions/build-module/wp_block/duplicate-pattern/action.mjs
 559  var import_i18n = __toESM(require_i18n(), 1);
 560  var import_patterns = __toESM(require_patterns(), 1);
 561  
 562  // packages/core-actions/build-module/lock-unlock.mjs
 563  var import_private_apis = __toESM(require_private_apis(), 1);
 564  var { lock, unlock } = (0, import_private_apis.__dangerousOptInToUnstableAPIsOnlyForCoreModules)(
 565    "I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.",
 566    "@wordpress/core-actions"
 567  );
 568  
 569  // packages/core-actions/build-module/wp_block/duplicate-pattern/action.mjs
 570  var import_jsx_runtime = __toESM(require_jsx_runtime(), 1);
 571  var { CreatePatternModalContents, useDuplicatePatternProps } = unlock(import_patterns.privateApis);
 572  var duplicatePattern = {
 573    isEligible: (item) => item.type !== "wp_template_part",
 574    RenderModal: ({ items, closeModal }) => {
 575      const [item] = items;
 576      const duplicatedProps = useDuplicatePatternProps({
 577        pattern: item,
 578        onSuccess: () => closeModal?.()
 579      });
 580      return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
 581        CreatePatternModalContents,
 582        {
 583          onClose: closeModal,
 584          confirmLabel: (0, import_i18n._x)("Duplicate", "action label"),
 585          ...duplicatedProps
 586        }
 587      );
 588    }
 589  };
 590  var action_default = duplicatePattern;
 591  
 592  // node_modules/.store/tslib@2.8.1-LT-dxu1EkVy7OUDyVf5glQ/node_modules/tslib/tslib.es6.mjs
 593  var __assign = function() {
 594    __assign = Object.assign || function __assign2(t2) {
 595      for (var s2, i2 = 1, n2 = arguments.length; i2 < n2; i2++) {
 596        s2 = arguments[i2];
 597        for (var p2 in s2) if (Object.prototype.hasOwnProperty.call(s2, p2)) t2[p2] = s2[p2];
 598      }
 599      return t2;
 600    };
 601    return __assign.apply(this, arguments);
 602  };
 603  
 604  // node_modules/.store/lower-case@2.0.2-5YZP5nczP5_f_8Vt5KBPjA/node_modules/lower-case/dist.es2015/index.js
 605  function lowerCase(str) {
 606    return str.toLowerCase();
 607  }
 608  
 609  // node_modules/.store/no-case@3.0.4-R4Hzt6qn-erEsTak7ojDpg/node_modules/no-case/dist.es2015/index.js
 610  var DEFAULT_SPLIT_REGEXP = [/([a-z0-9])([A-Z])/g, /([A-Z])([A-Z][a-z])/g];
 611  var DEFAULT_STRIP_REGEXP = /[^A-Z0-9]+/gi;
 612  function noCase(input, options) {
 613    if (options === void 0) {
 614      options = {};
 615    }
 616    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;
 617    var result = replace(replace(input, splitRegexp, "$1\0$2"), stripRegexp, "\0");
 618    var start = 0;
 619    var end = result.length;
 620    while (result.charAt(start) === "\0")
 621      start++;
 622    while (result.charAt(end - 1) === "\0")
 623      end--;
 624    return result.slice(start, end).split("\0").map(transform).join(delimiter);
 625  }
 626  function replace(input, re, value) {
 627    if (re instanceof RegExp)
 628      return input.replace(re, value);
 629    return re.reduce(function(input2, re2) {
 630      return input2.replace(re2, value);
 631    }, input);
 632  }
 633  
 634  // node_modules/.store/dot-case@3.0.4-hi-rLWlWmiZ169n4dWcbUA/node_modules/dot-case/dist.es2015/index.js
 635  function dotCase(input, options) {
 636    if (options === void 0) {
 637      options = {};
 638    }
 639    return noCase(input, __assign({ delimiter: "." }, options));
 640  }
 641  
 642  // node_modules/.store/param-case@3.0.4-rdAht_VwpGpefPRylN2bTA/node_modules/param-case/dist.es2015/index.js
 643  function paramCase(input, options) {
 644    if (options === void 0) {
 645      options = {};
 646    }
 647    return dotCase(input, __assign({ delimiter: "-" }, options));
 648  }
 649  
 650  // node_modules/.store/client-zip@2.4.5-5vcV2f6Upgr_SIgmkeGQpA/node_modules/client-zip/index.js
 651  "stream" in Blob.prototype || Object.defineProperty(Blob.prototype, "stream", { value() {
 652    return new Response(this).body;
 653  } }), "setBigUint64" in DataView.prototype || Object.defineProperty(DataView.prototype, "setBigUint64", { value(e2, n2, t2) {
 654    const i2 = Number(0xffffffffn & n2), r2 = Number(n2 >> 32n);
 655    this.setUint32(e2 + (t2 ? 0 : 4), i2, t2), this.setUint32(e2 + (t2 ? 4 : 0), r2, t2);
 656  } });
 657  var e = (e2) => new DataView(new ArrayBuffer(e2));
 658  var n = (e2) => new Uint8Array(e2.buffer || e2);
 659  var t = (e2) => new TextEncoder().encode(String(e2));
 660  var i = (e2) => Math.min(4294967295, Number(e2));
 661  var r = (e2) => Math.min(65535, Number(e2));
 662  function f(e2, i2) {
 663    if (void 0 === i2 || i2 instanceof Date || (i2 = new Date(i2)), e2 instanceof File) return { isFile: 1, t: i2 || new Date(e2.lastModified), i: e2.stream() };
 664    if (e2 instanceof Response) return { isFile: 1, t: i2 || new Date(e2.headers.get("Last-Modified") || Date.now()), i: e2.body };
 665    if (void 0 === i2) i2 = /* @__PURE__ */ new Date();
 666    else if (isNaN(i2)) throw new Error("Invalid modification date.");
 667    if (void 0 === e2) return { isFile: 0, t: i2 };
 668    if ("string" == typeof e2) return { isFile: 1, t: i2, i: t(e2) };
 669    if (e2 instanceof Blob) return { isFile: 1, t: i2, i: e2.stream() };
 670    if (e2 instanceof Uint8Array || e2 instanceof ReadableStream) return { isFile: 1, t: i2, i: e2 };
 671    if (e2 instanceof ArrayBuffer || ArrayBuffer.isView(e2)) return { isFile: 1, t: i2, i: n(e2) };
 672    if (Symbol.asyncIterator in e2) return { isFile: 1, t: i2, i: o(e2[Symbol.asyncIterator]()) };
 673    throw new TypeError("Unsupported input format.");
 674  }
 675  function o(e2, n2 = e2) {
 676    return new ReadableStream({ async pull(n3) {
 677      let t2 = 0;
 678      for (; n3.desiredSize > t2; ) {
 679        const i2 = await e2.next();
 680        if (!i2.value) {
 681          n3.close();
 682          break;
 683        }
 684        {
 685          const e3 = a(i2.value);
 686          n3.enqueue(e3), t2 += e3.byteLength;
 687        }
 688      }
 689    }, cancel(e3) {
 690      n2.throw?.(e3);
 691    } });
 692  }
 693  function a(e2) {
 694    return "string" == typeof e2 ? t(e2) : e2 instanceof Uint8Array ? e2 : n(e2);
 695  }
 696  function s(e2, i2, r2) {
 697    let [f2, o2] = (function(e3) {
 698      return e3 ? e3 instanceof Uint8Array ? [e3, 1] : ArrayBuffer.isView(e3) || e3 instanceof ArrayBuffer ? [n(e3), 1] : [t(e3), 0] : [void 0, 0];
 699    })(i2);
 700    if (e2 instanceof File) return { o: d(f2 || t(e2.name)), u: BigInt(e2.size), l: o2 };
 701    if (e2 instanceof Response) {
 702      const n2 = e2.headers.get("content-disposition"), i3 = n2 && n2.match(/;\s*filename\*?=["']?(.*?)["']?$/i), a2 = i3 && i3[1] || e2.url && new URL(e2.url).pathname.split("/").findLast(Boolean), s2 = a2 && decodeURIComponent(a2), u2 = r2 || +e2.headers.get("content-length");
 703      return { o: d(f2 || t(s2)), u: BigInt(u2), l: o2 };
 704    }
 705    return f2 = d(f2, void 0 !== e2 || void 0 !== r2), "string" == typeof e2 ? { o: f2, u: BigInt(t(e2).length), l: o2 } : e2 instanceof Blob ? { o: f2, u: BigInt(e2.size), l: o2 } : e2 instanceof ArrayBuffer || ArrayBuffer.isView(e2) ? { o: f2, u: BigInt(e2.byteLength), l: o2 } : { o: f2, u: u(e2, r2), l: o2 };
 706  }
 707  function u(e2, n2) {
 708    return n2 > -1 ? BigInt(n2) : e2 ? void 0 : 0n;
 709  }
 710  function d(e2, n2 = 1) {
 711    if (!e2 || e2.every(((c) => 47 === c))) throw new Error("The file must have a name.");
 712    if (n2) for (; 47 === e2[e2.length - 1]; ) e2 = e2.subarray(0, -1);
 713    else 47 !== e2[e2.length - 1] && (e2 = new Uint8Array([...e2, 47]));
 714    return e2;
 715  }
 716  var l = new Uint32Array(256);
 717  for (let e2 = 0; e2 < 256; ++e2) {
 718    let n2 = e2;
 719    for (let e3 = 0; e3 < 8; ++e3) n2 = n2 >>> 1 ^ (1 & n2 && 3988292384);
 720    l[e2] = n2;
 721  }
 722  function y(e2, n2 = 0) {
 723    n2 ^= -1;
 724    for (var t2 = 0, i2 = e2.length; t2 < i2; t2++) n2 = n2 >>> 8 ^ l[255 & n2 ^ e2[t2]];
 725    return (-1 ^ n2) >>> 0;
 726  }
 727  function w(e2, n2, t2 = 0) {
 728    const i2 = e2.getSeconds() >> 1 | e2.getMinutes() << 5 | e2.getHours() << 11, r2 = e2.getDate() | e2.getMonth() + 1 << 5 | e2.getFullYear() - 1980 << 9;
 729    n2.setUint16(t2, i2, 1), n2.setUint16(t2 + 2, r2, 1);
 730  }
 731  function B({ o: e2, l: n2 }, t2) {
 732    return 8 * (!n2 || (t2 ?? (function(e3) {
 733      try {
 734        b.decode(e3);
 735      } catch {
 736        return 0;
 737      }
 738      return 1;
 739    })(e2)));
 740  }
 741  var b = new TextDecoder("utf8", { fatal: 1 });
 742  function p(t2, i2 = 0) {
 743    const r2 = e(30);
 744    return r2.setUint32(0, 1347093252), r2.setUint32(4, 754976768 | i2), w(t2.t, r2, 10), r2.setUint16(26, t2.o.length, 1), n(r2);
 745  }
 746  async function* g(e2) {
 747    let { i: n2 } = e2;
 748    if ("then" in n2 && (n2 = await n2), n2 instanceof Uint8Array) yield n2, e2.m = y(n2, 0), e2.u = BigInt(n2.length);
 749    else {
 750      e2.u = 0n;
 751      const t2 = n2.getReader();
 752      for (; ; ) {
 753        const { value: n3, done: i2 } = await t2.read();
 754        if (i2) break;
 755        e2.m = y(n3, e2.m), e2.u += BigInt(n3.length), yield n3;
 756      }
 757    }
 758  }
 759  function I(t2, r2) {
 760    const f2 = e(16 + (r2 ? 8 : 0));
 761    return f2.setUint32(0, 1347094280), f2.setUint32(4, t2.isFile ? t2.m : 0, 1), r2 ? (f2.setBigUint64(8, t2.u, 1), f2.setBigUint64(16, t2.u, 1)) : (f2.setUint32(8, i(t2.u), 1), f2.setUint32(12, i(t2.u), 1)), n(f2);
 762  }
 763  function v(t2, r2, f2 = 0, o2 = 0) {
 764    const a2 = e(46);
 765    return a2.setUint32(0, 1347092738), a2.setUint32(4, 755182848), a2.setUint16(8, 2048 | f2), w(t2.t, a2, 12), a2.setUint32(16, t2.isFile ? t2.m : 0, 1), a2.setUint32(20, i(t2.u), 1), a2.setUint32(24, i(t2.u), 1), a2.setUint16(28, t2.o.length, 1), a2.setUint16(30, o2, 1), a2.setUint16(40, t2.isFile ? 33204 : 16893, 1), a2.setUint32(42, i(r2), 1), n(a2);
 766  }
 767  function h(t2, i2, r2) {
 768    const f2 = e(r2);
 769    return f2.setUint16(0, 1, 1), f2.setUint16(2, r2 - 4, 1), 16 & r2 && (f2.setBigUint64(4, t2.u, 1), f2.setBigUint64(12, t2.u, 1)), f2.setBigUint64(r2 - 8, i2, 1), n(f2);
 770  }
 771  function D(e2) {
 772    return e2 instanceof File || e2 instanceof Response ? [[e2], [e2]] : [[e2.input, e2.name, e2.size], [e2.input, e2.lastModified]];
 773  }
 774  var S = (e2) => (function(e3) {
 775    let n2 = BigInt(22), t2 = 0n, i2 = 0;
 776    for (const r2 of e3) {
 777      if (!r2.o) throw new Error("Every file must have a non-empty name.");
 778      if (void 0 === r2.u) throw new Error(`Missing size for file "$new TextDecoder().decode(r2.o)}".`);
 779      const e4 = r2.u >= 0xffffffffn, f2 = t2 >= 0xffffffffn;
 780      t2 += BigInt(46 + r2.o.length + (e4 && 8)) + r2.u, n2 += BigInt(r2.o.length + 46 + (12 * f2 | 28 * e4)), i2 || (i2 = e4);
 781    }
 782    return (i2 || t2 >= 0xffffffffn) && (n2 += BigInt(76)), n2 + t2;
 783  })((function* (e3) {
 784    for (const n2 of e3) yield s(...D(n2)[0]);
 785  })(e2));
 786  function A(e2, n2 = {}) {
 787    const t2 = { "Content-Type": "application/zip", "Content-Disposition": "attachment" };
 788    return ("bigint" == typeof n2.length || Number.isInteger(n2.length)) && n2.length > 0 && (t2["Content-Length"] = String(n2.length)), n2.metadata && (t2["Content-Length"] = String(S(n2.metadata))), new Response(N(e2, n2), { headers: t2 });
 789  }
 790  function N(t2, a2 = {}) {
 791    const u2 = (function(e2) {
 792      const n2 = e2[Symbol.iterator in e2 ? Symbol.iterator : Symbol.asyncIterator]();
 793      return { async next() {
 794        const e3 = await n2.next();
 795        if (e3.done) return e3;
 796        const [t3, i2] = D(e3.value);
 797        return { done: 0, value: Object.assign(f(...i2), s(...t3)) };
 798      }, throw: n2.throw?.bind(n2), [Symbol.asyncIterator]() {
 799        return this;
 800      } };
 801    })(t2);
 802    return o((async function* (t3, f2) {
 803      const o2 = [];
 804      let a3 = 0n, s2 = 0n, u3 = 0;
 805      for await (const e2 of t3) {
 806        const n2 = B(e2, f2.buffersAreUTF8);
 807        yield p(e2, n2), yield new Uint8Array(e2.o), e2.isFile && (yield* g(e2));
 808        const t4 = e2.u >= 0xffffffffn, i2 = 12 * (a3 >= 0xffffffffn) | 28 * t4;
 809        yield I(e2, t4), o2.push(v(e2, a3, n2, i2)), o2.push(e2.o), i2 && o2.push(h(e2, a3, i2)), t4 && (a3 += 8n), s2++, a3 += BigInt(46 + e2.o.length) + e2.u, u3 || (u3 = t4);
 810      }
 811      let d2 = 0n;
 812      for (const e2 of o2) yield e2, d2 += BigInt(e2.length);
 813      if (u3 || a3 >= 0xffffffffn) {
 814        const t4 = e(76);
 815        t4.setUint32(0, 1347094022), t4.setBigUint64(4, BigInt(44), 1), t4.setUint32(12, 755182848), t4.setBigUint64(24, s2, 1), t4.setBigUint64(32, s2, 1), t4.setBigUint64(40, d2, 1), t4.setBigUint64(48, a3, 1), t4.setUint32(56, 1347094023), t4.setBigUint64(64, a3 + d2, 1), t4.setUint32(72, 1, 1), yield n(t4);
 816      }
 817      const l2 = e(22);
 818      l2.setUint32(0, 1347093766), l2.setUint16(8, r(s2), 1), l2.setUint16(10, r(s2), 1), l2.setUint32(12, i(d2), 1), l2.setUint32(16, i(a3), 1), yield n(l2);
 819    })(u2, a2), u2);
 820  }
 821  
 822  // packages/core-actions/build-module/wp_block/export-pattern/action.mjs
 823  var import_remove_accents = __toESM(require_remove_accents(), 1);
 824  var import_blob = __toESM(require_blob(), 1);
 825  var import_i18n3 = __toESM(require_i18n(), 1);
 826  
 827  // packages/icons/build-module/library/download.mjs
 828  var import_primitives = __toESM(require_primitives(), 1);
 829  var import_jsx_runtime2 = __toESM(require_jsx_runtime(), 1);
 830  var download_default = /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_primitives.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", style: { fill: "none" }, stroke: "currentColor", strokeWidth: "1.5", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_primitives.Path, { d: "M12 3V16M6 10.5L12 16L17.5 10.5M4.75 15V19.25H19.25V15" }) });
 831  
 832  // packages/core-actions/build-module/shared/utils.mjs
 833  var import_html_entities = __toESM(require_html_entities(), 1);
 834  var import_i18n2 = __toESM(require_i18n(), 1);
 835  function getItemTitle(item, fallback = (0, import_i18n2.__)("(no title)")) {
 836    let title = "";
 837    if (typeof item.title === "string") {
 838      title = (0, import_html_entities.decodeEntities)(item.title);
 839    } else if (item.title && "rendered" in item.title) {
 840      title = (0, import_html_entities.decodeEntities)(item.title.rendered);
 841    } else if (item.title && "raw" in item.title) {
 842      title = (0, import_html_entities.decodeEntities)(item.title.raw);
 843    }
 844    return title || fallback;
 845  }
 846  
 847  // packages/core-actions/build-module/wp_block/export-pattern/action.mjs
 848  function getJsonFromItem(item) {
 849    return JSON.stringify(
 850      {
 851        __file: item.type,
 852        title: getItemTitle(item),
 853        content: typeof item.content === "string" ? item.content : item.content?.raw,
 854        syncStatus: item.wp_pattern_sync_status
 855      },
 856      null,
 857      2
 858    );
 859  }
 860  var exportPattern = {
 861    icon: download_default,
 862    isEligible: (item) => item.type === "wp_block",
 863    callback: async (items) => {
 864      if (items.length === 1) {
 865        return (0, import_blob.downloadBlob)(
 866          `$paramCase(
 867            (0, import_remove_accents.default)(
 868              getItemTitle(items[0]) || items[0].slug
 869            )
 870          )}.json`,
 871          getJsonFromItem(items[0]),
 872          "application/json"
 873        );
 874      }
 875      const nameCount = {};
 876      const filesToZip = items.map((item) => {
 877        const name = paramCase(
 878          (0, import_remove_accents.default)(getItemTitle(item) || item.slug)
 879        );
 880        nameCount[name] = (nameCount[name] || 0) + 1;
 881        return {
 882          name: `$name + (nameCount[name] > 1 ? "-" + (nameCount[name] - 1) : "")}.json`,
 883          lastModified: /* @__PURE__ */ new Date(),
 884          input: getJsonFromItem(item)
 885        };
 886      });
 887      return (0, import_blob.downloadBlob)(
 888        (0, import_i18n3.__)("patterns-export") + ".zip",
 889        await A(filesToZip).blob(),
 890        "application/zip"
 891      );
 892    }
 893  };
 894  var action_default2 = exportPattern;
 895  
 896  // packages/core-actions/build-module/wp_block/index.mjs
 897  var actions = {
 898    "duplicate-pattern": action_default,
 899    "export-pattern": action_default2
 900  };
 901  var wp_block_default = actions;
 902  export {
 903    wp_block_default as default
 904  };


Generated : Wed Oct 21 08:20:34 2026 Cross-referenced by PHPXref