/******/ (() => { // webpackBootstrap
/******/ 	var __webpack_modules__ = ({

/***/ 66:
/***/ ((module) => {

"use strict";


var isMergeableObject = function isMergeableObject(value) {
	return isNonNullObject(value)
		&& !isSpecial(value)
};

function isNonNullObject(value) {
	return !!value && typeof value === 'object'
}

function isSpecial(value) {
	var stringValue = Object.prototype.toString.call(value);

	return stringValue === '[object RegExp]'
		|| stringValue === '[object Date]'
		|| isReactElement(value)
}

// see https://github.com/facebook/react/blob/b5ac963fb791d1298e7f396236383bc955f916c1/src/isomorphic/classic/element/ReactElement.js#L21-L25
var canUseSymbol = typeof Symbol === 'function' && Symbol.for;
var REACT_ELEMENT_TYPE = canUseSymbol ? Symbol.for('react.element') : 0xeac7;

function isReactElement(value) {
	return value.$$typeof === REACT_ELEMENT_TYPE
}

function emptyTarget(val) {
	return Array.isArray(val) ? [] : {}
}

function cloneUnlessOtherwiseSpecified(value, options) {
	return (options.clone !== false && options.isMergeableObject(value))
		? deepmerge(emptyTarget(value), value, options)
		: value
}

function defaultArrayMerge(target, source, options) {
	return target.concat(source).map(function(element) {
		return cloneUnlessOtherwiseSpecified(element, options)
	})
}

function getMergeFunction(key, options) {
	if (!options.customMerge) {
		return deepmerge
	}
	var customMerge = options.customMerge(key);
	return typeof customMerge === 'function' ? customMerge : deepmerge
}

function getEnumerableOwnPropertySymbols(target) {
	return Object.getOwnPropertySymbols
		? Object.getOwnPropertySymbols(target).filter(function(symbol) {
			return Object.propertyIsEnumerable.call(target, symbol)
		})
		: []
}

function getKeys(target) {
	return Object.keys(target).concat(getEnumerableOwnPropertySymbols(target))
}

function propertyIsOnObject(object, property) {
	try {
		return property in object
	} catch(_) {
		return false
	}
}

// Protects from prototype poisoning and unexpected merging up the prototype chain.
function propertyIsUnsafe(target, key) {
	return propertyIsOnObject(target, key) // Properties are safe to merge if they don't exist in the target yet,
		&& !(Object.hasOwnProperty.call(target, key) // unsafe if they exist up the prototype chain,
			&& Object.propertyIsEnumerable.call(target, key)) // and also unsafe if they're nonenumerable.
}

function mergeObject(target, source, options) {
	var destination = {};
	if (options.isMergeableObject(target)) {
		getKeys(target).forEach(function(key) {
			destination[key] = cloneUnlessOtherwiseSpecified(target[key], options);
		});
	}
	getKeys(source).forEach(function(key) {
		if (propertyIsUnsafe(target, key)) {
			return
		}

		if (propertyIsOnObject(target, key) && options.isMergeableObject(source[key])) {
			destination[key] = getMergeFunction(key, options)(target[key], source[key], options);
		} else {
			destination[key] = cloneUnlessOtherwiseSpecified(source[key], options);
		}
	});
	return destination
}

function deepmerge(target, source, options) {
	options = options || {};
	options.arrayMerge = options.arrayMerge || defaultArrayMerge;
	options.isMergeableObject = options.isMergeableObject || isMergeableObject;
	// cloneUnlessOtherwiseSpecified is added to `options` so that custom arrayMerge()
	// implementations can use it. The caller may not replace it.
	options.cloneUnlessOtherwiseSpecified = cloneUnlessOtherwiseSpecified;

	var sourceIsArray = Array.isArray(source);
	var targetIsArray = Array.isArray(target);
	var sourceAndTargetTypesMatch = sourceIsArray === targetIsArray;

	if (!sourceAndTargetTypesMatch) {
		return cloneUnlessOtherwiseSpecified(source, options)
	} else if (sourceIsArray) {
		return options.arrayMerge(target, source, options)
	} else {
		return mergeObject(target, source, options)
	}
}

deepmerge.all = function deepmergeAll(array, options) {
	if (!Array.isArray(array)) {
		throw new Error('first argument should be an array')
	}

	return array.reduce(function(prev, next) {
		return deepmerge(prev, next, options)
	}, {})
};

var deepmerge_1 = deepmerge;

module.exports = deepmerge_1;


/***/ }),

/***/ 83:
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {

"use strict";
/**
 * @license React
 * use-sync-external-store-shim.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */


var React = __webpack_require__(1609);
function is(x, y) {
  return (x === y && (0 !== x || 1 / x === 1 / y)) || (x !== x && y !== y);
}
var objectIs = "function" === typeof Object.is ? Object.is : is,
  useState = React.useState,
  useEffect = React.useEffect,
  useLayoutEffect = React.useLayoutEffect,
  useDebugValue = React.useDebugValue;
function useSyncExternalStore$2(subscribe, getSnapshot) {
  var value = getSnapshot(),
    _useState = useState({ inst: { value: value, getSnapshot: getSnapshot } }),
    inst = _useState[0].inst,
    forceUpdate = _useState[1];
  useLayoutEffect(
    function () {
      inst.value = value;
      inst.getSnapshot = getSnapshot;
      checkIfSnapshotChanged(inst) && forceUpdate({ inst: inst });
    },
    [subscribe, value, getSnapshot]
  );
  useEffect(
    function () {
      checkIfSnapshotChanged(inst) && forceUpdate({ inst: inst });
      return subscribe(function () {
        checkIfSnapshotChanged(inst) && forceUpdate({ inst: inst });
      });
    },
    [subscribe]
  );
  useDebugValue(value);
  return value;
}
function checkIfSnapshotChanged(inst) {
  var latestGetSnapshot = inst.getSnapshot;
  inst = inst.value;
  try {
    var nextValue = latestGetSnapshot();
    return !objectIs(inst, nextValue);
  } catch (error) {
    return !0;
  }
}
function useSyncExternalStore$1(subscribe, getSnapshot) {
  return getSnapshot();
}
var shim =
  "undefined" === typeof window ||
  "undefined" === typeof window.document ||
  "undefined" === typeof window.document.createElement
    ? useSyncExternalStore$1
    : useSyncExternalStore$2;
exports.useSyncExternalStore =
  void 0 !== React.useSyncExternalStore ? React.useSyncExternalStore : shim;


/***/ }),

/***/ 422:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

"use strict";


if (true) {
  module.exports = __webpack_require__(83);
} else {}


/***/ }),

/***/ 1233:
/***/ ((module) => {

"use strict";
module.exports = window["wp"]["preferences"];

/***/ }),

/***/ 1609:
/***/ ((module) => {

"use strict";
module.exports = window["React"];

/***/ }),

/***/ 4660:
/***/ ((module) => {

/**
 * Credits:
 *
 * lib-font
 * https://github.com/Pomax/lib-font
 * https://github.com/Pomax/lib-font/blob/master/lib/inflate.js
 *
 * The MIT License (MIT)
 *
 * Copyright (c) 2020 pomax@nihongoresources.com
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in all
 * copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 */

/* eslint eslint-comments/no-unlimited-disable: 0 */
/* eslint-disable */
/* pako 1.0.10 nodeca/pako */(function(f){if(true){module.exports=f()}else { var g; }})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c=undefined;if(!f&&c)return require(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u=undefined,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
  'use strict';


  var TYPED_OK =  (typeof Uint8Array !== 'undefined') &&
                  (typeof Uint16Array !== 'undefined') &&
                  (typeof Int32Array !== 'undefined');

  function _has(obj, key) {
    return Object.prototype.hasOwnProperty.call(obj, key);
  }

  exports.assign = function (obj /*from1, from2, from3, ...*/) {
    var sources = Array.prototype.slice.call(arguments, 1);
    while (sources.length) {
      var source = sources.shift();
      if (!source) { continue; }

      if (typeof source !== 'object') {
        throw new TypeError(source + 'must be non-object');
      }

      for (var p in source) {
        if (_has(source, p)) {
          obj[p] = source[p];
        }
      }
    }

    return obj;
  };


  // reduce buffer size, avoiding mem copy
  exports.shrinkBuf = function (buf, size) {
    if (buf.length === size) { return buf; }
    if (buf.subarray) { return buf.subarray(0, size); }
    buf.length = size;
    return buf;
  };


  var fnTyped = {
    arraySet: function (dest, src, src_offs, len, dest_offs) {
      if (src.subarray && dest.subarray) {
        dest.set(src.subarray(src_offs, src_offs + len), dest_offs);
        return;
      }
      // Fallback to ordinary array
      for (var i = 0; i < len; i++) {
        dest[dest_offs + i] = src[src_offs + i];
      }
    },
    // Join array of chunks to single array.
    flattenChunks: function (chunks) {
      var i, l, len, pos, chunk, result;

      // calculate data length
      len = 0;
      for (i = 0, l = chunks.length; i < l; i++) {
        len += chunks[i].length;
      }

      // join chunks
      result = new Uint8Array(len);
      pos = 0;
      for (i = 0, l = chunks.length; i < l; i++) {
        chunk = chunks[i];
        result.set(chunk, pos);
        pos += chunk.length;
      }

      return result;
    }
  };

  var fnUntyped = {
    arraySet: function (dest, src, src_offs, len, dest_offs) {
      for (var i = 0; i < len; i++) {
        dest[dest_offs + i] = src[src_offs + i];
      }
    },
    // Join array of chunks to single array.
    flattenChunks: function (chunks) {
      return [].concat.apply([], chunks);
    }
  };


  // Enable/Disable typed arrays use, for testing
  //
  exports.setTyped = function (on) {
    if (on) {
      exports.Buf8  = Uint8Array;
      exports.Buf16 = Uint16Array;
      exports.Buf32 = Int32Array;
      exports.assign(exports, fnTyped);
    } else {
      exports.Buf8  = Array;
      exports.Buf16 = Array;
      exports.Buf32 = Array;
      exports.assign(exports, fnUntyped);
    }
  };

  exports.setTyped(TYPED_OK);

  },{}],2:[function(require,module,exports){
  // String encode/decode helpers
  'use strict';


  var utils = require('./common');


  // Quick check if we can use fast array to bin string conversion
  //
  // - apply(Array) can fail on Android 2.2
  // - apply(Uint8Array) can fail on iOS 5.1 Safari
  //
  var STR_APPLY_OK = true;
  var STR_APPLY_UIA_OK = true;

  try { String.fromCharCode.apply(null, [ 0 ]); } catch (__) { STR_APPLY_OK = false; }
  try { String.fromCharCode.apply(null, new Uint8Array(1)); } catch (__) { STR_APPLY_UIA_OK = false; }


  // Table with utf8 lengths (calculated by first byte of sequence)
  // Note, that 5 & 6-byte values and some 4-byte values can not be represented in JS,
  // because max possible codepoint is 0x10ffff
  var _utf8len = new utils.Buf8(256);
  for (var q = 0; q < 256; q++) {
    _utf8len[q] = (q >= 252 ? 6 : q >= 248 ? 5 : q >= 240 ? 4 : q >= 224 ? 3 : q >= 192 ? 2 : 1);
  }
  _utf8len[254] = _utf8len[254] = 1; // Invalid sequence start


  // convert string to array (typed, when possible)
  exports.string2buf = function (str) {
    var buf, c, c2, m_pos, i, str_len = str.length, buf_len = 0;

    // count binary size
    for (m_pos = 0; m_pos < str_len; m_pos++) {
      c = str.charCodeAt(m_pos);
      if ((c & 0xfc00) === 0xd800 && (m_pos + 1 < str_len)) {
        c2 = str.charCodeAt(m_pos + 1);
        if ((c2 & 0xfc00) === 0xdc00) {
          c = 0x10000 + ((c - 0xd800) << 10) + (c2 - 0xdc00);
          m_pos++;
        }
      }
      buf_len += c < 0x80 ? 1 : c < 0x800 ? 2 : c < 0x10000 ? 3 : 4;
    }

    // allocate buffer
    buf = new utils.Buf8(buf_len);

    // convert
    for (i = 0, m_pos = 0; i < buf_len; m_pos++) {
      c = str.charCodeAt(m_pos);
      if ((c & 0xfc00) === 0xd800 && (m_pos + 1 < str_len)) {
        c2 = str.charCodeAt(m_pos + 1);
        if ((c2 & 0xfc00) === 0xdc00) {
          c = 0x10000 + ((c - 0xd800) << 10) + (c2 - 0xdc00);
          m_pos++;
        }
      }
      if (c < 0x80) {
        /* one byte */
        buf[i++] = c;
      } else if (c < 0x800) {
        /* two bytes */
        buf[i++] = 0xC0 | (c >>> 6);
        buf[i++] = 0x80 | (c & 0x3f);
      } else if (c < 0x10000) {
        /* three bytes */
        buf[i++] = 0xE0 | (c >>> 12);
        buf[i++] = 0x80 | (c >>> 6 & 0x3f);
        buf[i++] = 0x80 | (c & 0x3f);
      } else {
        /* four bytes */
        buf[i++] = 0xf0 | (c >>> 18);
        buf[i++] = 0x80 | (c >>> 12 & 0x3f);
        buf[i++] = 0x80 | (c >>> 6 & 0x3f);
        buf[i++] = 0x80 | (c & 0x3f);
      }
    }

    return buf;
  };

  // Helper (used in 2 places)
  function buf2binstring(buf, len) {
    // On Chrome, the arguments in a function call that are allowed is `65534`.
    // If the length of the buffer is smaller than that, we can use this optimization,
    // otherwise we will take a slower path.
    if (len < 65534) {
      if ((buf.subarray && STR_APPLY_UIA_OK) || (!buf.subarray && STR_APPLY_OK)) {
        return String.fromCharCode.apply(null, utils.shrinkBuf(buf, len));
      }
    }

    var result = '';
    for (var i = 0; i < len; i++) {
      result += String.fromCharCode(buf[i]);
    }
    return result;
  }


  // Convert byte array to binary string
  exports.buf2binstring = function (buf) {
    return buf2binstring(buf, buf.length);
  };


  // Convert binary string (typed, when possible)
  exports.binstring2buf = function (str) {
    var buf = new utils.Buf8(str.length);
    for (var i = 0, len = buf.length; i < len; i++) {
      buf[i] = str.charCodeAt(i);
    }
    return buf;
  };


  // convert array to string
  exports.buf2string = function (buf, max) {
    var i, out, c, c_len;
    var len = max || buf.length;

    // Reserve max possible length (2 words per char)
    // NB: by unknown reasons, Array is significantly faster for
    //     String.fromCharCode.apply than Uint16Array.
    var utf16buf = new Array(len * 2);

    for (out = 0, i = 0; i < len;) {
      c = buf[i++];
      // quick process ascii
      if (c < 0x80) { utf16buf[out++] = c; continue; }

      c_len = _utf8len[c];
      // skip 5 & 6 byte codes
      if (c_len > 4) { utf16buf[out++] = 0xfffd; i += c_len - 1; continue; }

      // apply mask on first byte
      c &= c_len === 2 ? 0x1f : c_len === 3 ? 0x0f : 0x07;
      // join the rest
      while (c_len > 1 && i < len) {
        c = (c << 6) | (buf[i++] & 0x3f);
        c_len--;
      }

      // terminated by end of string?
      if (c_len > 1) { utf16buf[out++] = 0xfffd; continue; }

      if (c < 0x10000) {
        utf16buf[out++] = c;
      } else {
        c -= 0x10000;
        utf16buf[out++] = 0xd800 | ((c >> 10) & 0x3ff);
        utf16buf[out++] = 0xdc00 | (c & 0x3ff);
      }
    }

    return buf2binstring(utf16buf, out);
  };


  // Calculate max possible position in utf8 buffer,
  // that will not break sequence. If that's not possible
  // - (very small limits) return max size as is.
  //
  // buf[] - utf8 bytes array
  // max   - length limit (mandatory);
  exports.utf8border = function (buf, max) {
    var pos;

    max = max || buf.length;
    if (max > buf.length) { max = buf.length; }

    // go back from last position, until start of sequence found
    pos = max - 1;
    while (pos >= 0 && (buf[pos] & 0xC0) === 0x80) { pos--; }

    // Very small and broken sequence,
    // return max, because we should return something anyway.
    if (pos < 0) { return max; }

    // If we came to start of buffer - that means buffer is too small,
    // return max too.
    if (pos === 0) { return max; }

    return (pos + _utf8len[buf[pos]] > max) ? pos : max;
  };

  },{"./common":1}],3:[function(require,module,exports){
  'use strict';

  // Note: adler32 takes 12% for level 0 and 2% for level 6.
  // It isn't worth it to make additional optimizations as in original.
  // Small size is preferable.

  // (C) 1995-2013 Jean-loup Gailly and Mark Adler
  // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin
  //
  // This software is provided 'as-is', without any express or implied
  // warranty. In no event will the authors be held liable for any damages
  // arising from the use of this software.
  //
  // Permission is granted to anyone to use this software for any purpose,
  // including commercial applications, and to alter it and redistribute it
  // freely, subject to the following restrictions:
  //
  // 1. The origin of this software must not be misrepresented; you must not
  //   claim that you wrote the original software. If you use this software
  //   in a product, an acknowledgment in the product documentation would be
  //   appreciated but is not required.
  // 2. Altered source versions must be plainly marked as such, and must not be
  //   misrepresented as being the original software.
  // 3. This notice may not be removed or altered from any source distribution.

  function adler32(adler, buf, len, pos) {
    var s1 = (adler & 0xffff) |0,
        s2 = ((adler >>> 16) & 0xffff) |0,
        n = 0;

    while (len !== 0) {
      // Set limit ~ twice less than 5552, to keep
      // s2 in 31-bits, because we force signed ints.
      // in other case %= will fail.
      n = len > 2000 ? 2000 : len;
      len -= n;

      do {
        s1 = (s1 + buf[pos++]) |0;
        s2 = (s2 + s1) |0;
      } while (--n);

      s1 %= 65521;
      s2 %= 65521;
    }

    return (s1 | (s2 << 16)) |0;
  }


  module.exports = adler32;

  },{}],4:[function(require,module,exports){
  'use strict';

  // (C) 1995-2013 Jean-loup Gailly and Mark Adler
  // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin
  //
  // This software is provided 'as-is', without any express or implied
  // warranty. In no event will the authors be held liable for any damages
  // arising from the use of this software.
  //
  // Permission is granted to anyone to use this software for any purpose,
  // including commercial applications, and to alter it and redistribute it
  // freely, subject to the following restrictions:
  //
  // 1. The origin of this software must not be misrepresented; you must not
  //   claim that you wrote the original software. If you use this software
  //   in a product, an acknowledgment in the product documentation would be
  //   appreciated but is not required.
  // 2. Altered source versions must be plainly marked as such, and must not be
  //   misrepresented as being the original software.
  // 3. This notice may not be removed or altered from any source distribution.

  module.exports = {

    /* Allowed flush values; see deflate() and inflate() below for details */
    Z_NO_FLUSH:         0,
    Z_PARTIAL_FLUSH:    1,
    Z_SYNC_FLUSH:       2,
    Z_FULL_FLUSH:       3,
    Z_FINISH:           4,
    Z_BLOCK:            5,
    Z_TREES:            6,

    /* Return codes for the compression/decompression functions. Negative values
    * are errors, positive values are used for special but normal events.
    */
    Z_OK:               0,
    Z_STREAM_END:       1,
    Z_NEED_DICT:        2,
    Z_ERRNO:           -1,
    Z_STREAM_ERROR:    -2,
    Z_DATA_ERROR:      -3,
    //Z_MEM_ERROR:     -4,
    Z_BUF_ERROR:       -5,
    //Z_VERSION_ERROR: -6,

    /* compression levels */
    Z_NO_COMPRESSION:         0,
    Z_BEST_SPEED:             1,
    Z_BEST_COMPRESSION:       9,
    Z_DEFAULT_COMPRESSION:   -1,


    Z_FILTERED:               1,
    Z_HUFFMAN_ONLY:           2,
    Z_RLE:                    3,
    Z_FIXED:                  4,
    Z_DEFAULT_STRATEGY:       0,

    /* Possible values of the data_type field (though see inflate()) */
    Z_BINARY:                 0,
    Z_TEXT:                   1,
    //Z_ASCII:                1, // = Z_TEXT (deprecated)
    Z_UNKNOWN:                2,

    /* The deflate compression method */
    Z_DEFLATED:               8
    //Z_NULL:                 null // Use -1 or null inline, depending on var type
  };

  },{}],5:[function(require,module,exports){
  'use strict';

  // Note: we can't get significant speed boost here.
  // So write code to minimize size - no pregenerated tables
  // and array tools dependencies.

  // (C) 1995-2013 Jean-loup Gailly and Mark Adler
  // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin
  //
  // This software is provided 'as-is', without any express or implied
  // warranty. In no event will the authors be held liable for any damages
  // arising from the use of this software.
  //
  // Permission is granted to anyone to use this software for any purpose,
  // including commercial applications, and to alter it and redistribute it
  // freely, subject to the following restrictions:
  //
  // 1. The origin of this software must not be misrepresented; you must not
  //   claim that you wrote the original software. If you use this software
  //   in a product, an acknowledgment in the product documentation would be
  //   appreciated but is not required.
  // 2. Altered source versions must be plainly marked as such, and must not be
  //   misrepresented as being the original software.
  // 3. This notice may not be removed or altered from any source distribution.

  // Use ordinary array, since untyped makes no boost here
  function makeTable() {
    var c, table = [];

    for (var n = 0; n < 256; n++) {
      c = n;
      for (var k = 0; k < 8; k++) {
        c = ((c & 1) ? (0xEDB88320 ^ (c >>> 1)) : (c >>> 1));
      }
      table[n] = c;
    }

    return table;
  }

  // Create table on load. Just 255 signed longs. Not a problem.
  var crcTable = makeTable();


  function crc32(crc, buf, len, pos) {
    var t = crcTable,
        end = pos + len;

    crc ^= -1;

    for (var i = pos; i < end; i++) {
      crc = (crc >>> 8) ^ t[(crc ^ buf[i]) & 0xFF];
    }

    return (crc ^ (-1)); // >>> 0;
  }


  module.exports = crc32;

  },{}],6:[function(require,module,exports){
  'use strict';

  // (C) 1995-2013 Jean-loup Gailly and Mark Adler
  // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin
  //
  // This software is provided 'as-is', without any express or implied
  // warranty. In no event will the authors be held liable for any damages
  // arising from the use of this software.
  //
  // Permission is granted to anyone to use this software for any purpose,
  // including commercial applications, and to alter it and redistribute it
  // freely, subject to the following restrictions:
  //
  // 1. The origin of this software must not be misrepresented; you must not
  //   claim that you wrote the original software. If you use this software
  //   in a product, an acknowledgment in the product documentation would be
  //   appreciated but is not required.
  // 2. Altered source versions must be plainly marked as such, and must not be
  //   misrepresented as being the original software.
  // 3. This notice may not be removed or altered from any source distribution.

  function GZheader() {
    /* true if compressed data believed to be text */
    this.text       = 0;
    /* modification time */
    this.time       = 0;
    /* extra flags (not used when writing a gzip file) */
    this.xflags     = 0;
    /* operating system */
    this.os         = 0;
    /* pointer to extra field or Z_NULL if none */
    this.extra      = null;
    /* extra field length (valid if extra != Z_NULL) */
    this.extra_len  = 0; // Actually, we don't need it in JS,
                         // but leave for few code modifications

    //
    // Setup limits is not necessary because in js we should not preallocate memory
    // for inflate use constant limit in 65536 bytes
    //

    /* space at extra (only when reading header) */
    // this.extra_max  = 0;
    /* pointer to zero-terminated file name or Z_NULL */
    this.name       = '';
    /* space at name (only when reading header) */
    // this.name_max   = 0;
    /* pointer to zero-terminated comment or Z_NULL */
    this.comment    = '';
    /* space at comment (only when reading header) */
    // this.comm_max   = 0;
    /* true if there was or will be a header crc */
    this.hcrc       = 0;
    /* true when done reading gzip header (not used when writing a gzip file) */
    this.done       = false;
  }

  module.exports = GZheader;

  },{}],7:[function(require,module,exports){
  'use strict';

  // (C) 1995-2013 Jean-loup Gailly and Mark Adler
  // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin
  //
  // This software is provided 'as-is', without any express or implied
  // warranty. In no event will the authors be held liable for any damages
  // arising from the use of this software.
  //
  // Permission is granted to anyone to use this software for any purpose,
  // including commercial applications, and to alter it and redistribute it
  // freely, subject to the following restrictions:
  //
  // 1. The origin of this software must not be misrepresented; you must not
  //   claim that you wrote the original software. If you use this software
  //   in a product, an acknowledgment in the product documentation would be
  //   appreciated but is not required.
  // 2. Altered source versions must be plainly marked as such, and must not be
  //   misrepresented as being the original software.
  // 3. This notice may not be removed or altered from any source distribution.

  // See state defs from inflate.js
  var BAD = 30;       /* got a data error -- remain here until reset */
  var TYPE = 12;      /* i: waiting for type bits, including last-flag bit */

  /*
     Decode literal, length, and distance codes and write out the resulting
     literal and match bytes until either not enough input or output is
     available, an end-of-block is encountered, or a data error is encountered.
     When large enough input and output buffers are supplied to inflate(), for
     example, a 16K input buffer and a 64K output buffer, more than 95% of the
     inflate execution time is spent in this routine.

     Entry assumptions:

          state.mode === LEN
          strm.avail_in >= 6
          strm.avail_out >= 258
          start >= strm.avail_out
          state.bits < 8

     On return, state.mode is one of:

          LEN -- ran out of enough output space or enough available input
          TYPE -- reached end of block code, inflate() to interpret next block
          BAD -- error in block data

     Notes:

      - The maximum input bits used by a length/distance pair is 15 bits for the
        length code, 5 bits for the length extra, 15 bits for the distance code,
        and 13 bits for the distance extra.  This totals 48 bits, or six bytes.
        Therefore if strm.avail_in >= 6, then there is enough input to avoid
        checking for available input while decoding.

      - The maximum bytes that a single length/distance pair can output is 258
        bytes, which is the maximum length that can be coded.  inflate_fast()
        requires strm.avail_out >= 258 for each loop to avoid checking for
        output space.
   */
  module.exports = function inflate_fast(strm, start) {
    var state;
    var _in;                    /* local strm.input */
    var last;                   /* have enough input while in < last */
    var _out;                   /* local strm.output */
    var beg;                    /* inflate()'s initial strm.output */
    var end;                    /* while out < end, enough space available */
  //#ifdef INFLATE_STRICT
    var dmax;                   /* maximum distance from zlib header */
  //#endif
    var wsize;                  /* window size or zero if not using window */
    var whave;                  /* valid bytes in the window */
    var wnext;                  /* window write index */
    // Use `s_window` instead `window`, avoid conflict with instrumentation tools
    var s_window;               /* allocated sliding window, if wsize != 0 */
    var hold;                   /* local strm.hold */
    var bits;                   /* local strm.bits */
    var lcode;                  /* local strm.lencode */
    var dcode;                  /* local strm.distcode */
    var lmask;                  /* mask for first level of length codes */
    var dmask;                  /* mask for first level of distance codes */
    var here;                   /* retrieved table entry */
    var op;                     /* code bits, operation, extra bits, or */
                                /*  window position, window bytes to copy */
    var len;                    /* match length, unused bytes */
    var dist;                   /* match distance */
    var from;                   /* where to copy match from */
    var from_source;


    var input, output; // JS specific, because we have no pointers

    /* copy state to local variables */
    state = strm.state;
    //here = state.here;
    _in = strm.next_in;
    input = strm.input;
    last = _in + (strm.avail_in - 5);
    _out = strm.next_out;
    output = strm.output;
    beg = _out - (start - strm.avail_out);
    end = _out + (strm.avail_out - 257);
  //#ifdef INFLATE_STRICT
    dmax = state.dmax;
  //#endif
    wsize = state.wsize;
    whave = state.whave;
    wnext = state.wnext;
    s_window = state.window;
    hold = state.hold;
    bits = state.bits;
    lcode = state.lencode;
    dcode = state.distcode;
    lmask = (1 << state.lenbits) - 1;
    dmask = (1 << state.distbits) - 1;


    /* decode literals and length/distances until end-of-block or not enough
       input data or output space */

    top:
    do {
      if (bits < 15) {
        hold += input[_in++] << bits;
        bits += 8;
        hold += input[_in++] << bits;
        bits += 8;
      }

      here = lcode[hold & lmask];

      dolen:
      for (;;) { // Goto emulation
        op = here >>> 24/*here.bits*/;
        hold >>>= op;
        bits -= op;
        op = (here >>> 16) & 0xff/*here.op*/;
        if (op === 0) {                          /* literal */
          //Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ?
          //        "inflate:         literal '%c'\n" :
          //        "inflate:         literal 0x%02x\n", here.val));
          output[_out++] = here & 0xffff/*here.val*/;
        }
        else if (op & 16) {                     /* length base */
          len = here & 0xffff/*here.val*/;
          op &= 15;                           /* number of extra bits */
          if (op) {
            if (bits < op) {
              hold += input[_in++] << bits;
              bits += 8;
            }
            len += hold & ((1 << op) - 1);
            hold >>>= op;
            bits -= op;
          }
          //Tracevv((stderr, "inflate:         length %u\n", len));
          if (bits < 15) {
            hold += input[_in++] << bits;
            bits += 8;
            hold += input[_in++] << bits;
            bits += 8;
          }
          here = dcode[hold & dmask];

          dodist:
          for (;;) { // goto emulation
            op = here >>> 24/*here.bits*/;
            hold >>>= op;
            bits -= op;
            op = (here >>> 16) & 0xff/*here.op*/;

            if (op & 16) {                      /* distance base */
              dist = here & 0xffff/*here.val*/;
              op &= 15;                       /* number of extra bits */
              if (bits < op) {
                hold += input[_in++] << bits;
                bits += 8;
                if (bits < op) {
                  hold += input[_in++] << bits;
                  bits += 8;
                }
              }
              dist += hold & ((1 << op) - 1);
  //#ifdef INFLATE_STRICT
              if (dist > dmax) {
                strm.msg = 'invalid distance too far back';
                state.mode = BAD;
                break top;
              }
  //#endif
              hold >>>= op;
              bits -= op;
              //Tracevv((stderr, "inflate:         distance %u\n", dist));
              op = _out - beg;                /* max distance in output */
              if (dist > op) {                /* see if copy from window */
                op = dist - op;               /* distance back in window */
                if (op > whave) {
                  if (state.sane) {
                    strm.msg = 'invalid distance too far back';
                    state.mode = BAD;
                    break top;
                  }

  // (!) This block is disabled in zlib defaults,
  // don't enable it for binary compatibility
  //#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR
  //                if (len <= op - whave) {
  //                  do {
  //                    output[_out++] = 0;
  //                  } while (--len);
  //                  continue top;
  //                }
  //                len -= op - whave;
  //                do {
  //                  output[_out++] = 0;
  //                } while (--op > whave);
  //                if (op === 0) {
  //                  from = _out - dist;
  //                  do {
  //                    output[_out++] = output[from++];
  //                  } while (--len);
  //                  continue top;
  //                }
  //#endif
                }
                from = 0; // window index
                from_source = s_window;
                if (wnext === 0) {           /* very common case */
                  from += wsize - op;
                  if (op < len) {         /* some from window */
                    len -= op;
                    do {
                      output[_out++] = s_window[from++];
                    } while (--op);
                    from = _out - dist;  /* rest from output */
                    from_source = output;
                  }
                }
                else if (wnext < op) {      /* wrap around window */
                  from += wsize + wnext - op;
                  op -= wnext;
                  if (op < len) {         /* some from end of window */
                    len -= op;
                    do {
                      output[_out++] = s_window[from++];
                    } while (--op);
                    from = 0;
                    if (wnext < len) {  /* some from start of window */
                      op = wnext;
                      len -= op;
                      do {
                        output[_out++] = s_window[from++];
                      } while (--op);
                      from = _out - dist;      /* rest from output */
                      from_source = output;
                    }
                  }
                }
                else {                      /* contiguous in window */
                  from += wnext - op;
                  if (op < len) {         /* some from window */
                    len -= op;
                    do {
                      output[_out++] = s_window[from++];
                    } while (--op);
                    from = _out - dist;  /* rest from output */
                    from_source = output;
                  }
                }
                while (len > 2) {
                  output[_out++] = from_source[from++];
                  output[_out++] = from_source[from++];
                  output[_out++] = from_source[from++];
                  len -= 3;
                }
                if (len) {
                  output[_out++] = from_source[from++];
                  if (len > 1) {
                    output[_out++] = from_source[from++];
                  }
                }
              }
              else {
                from = _out - dist;          /* copy direct from output */
                do {                        /* minimum length is three */
                  output[_out++] = output[from++];
                  output[_out++] = output[from++];
                  output[_out++] = output[from++];
                  len -= 3;
                } while (len > 2);
                if (len) {
                  output[_out++] = output[from++];
                  if (len > 1) {
                    output[_out++] = output[from++];
                  }
                }
              }
            }
            else if ((op & 64) === 0) {          /* 2nd level distance code */
              here = dcode[(here & 0xffff)/*here.val*/ + (hold & ((1 << op) - 1))];
              continue dodist;
            }
            else {
              strm.msg = 'invalid distance code';
              state.mode = BAD;
              break top;
            }

            break; // need to emulate goto via "continue"
          }
        }
        else if ((op & 64) === 0) {              /* 2nd level length code */
          here = lcode[(here & 0xffff)/*here.val*/ + (hold & ((1 << op) - 1))];
          continue dolen;
        }
        else if (op & 32) {                     /* end-of-block */
          //Tracevv((stderr, "inflate:         end of block\n"));
          state.mode = TYPE;
          break top;
        }
        else {
          strm.msg = 'invalid literal/length code';
          state.mode = BAD;
          break top;
        }

        break; // need to emulate goto via "continue"
      }
    } while (_in < last && _out < end);

    /* return unused bytes (on entry, bits < 8, so in won't go too far back) */
    len = bits >> 3;
    _in -= len;
    bits -= len << 3;
    hold &= (1 << bits) - 1;

    /* update state and return */
    strm.next_in = _in;
    strm.next_out = _out;
    strm.avail_in = (_in < last ? 5 + (last - _in) : 5 - (_in - last));
    strm.avail_out = (_out < end ? 257 + (end - _out) : 257 - (_out - end));
    state.hold = hold;
    state.bits = bits;
    return;
  };

  },{}],8:[function(require,module,exports){
  'use strict';

  // (C) 1995-2013 Jean-loup Gailly and Mark Adler
  // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin
  //
  // This software is provided 'as-is', without any express or implied
  // warranty. In no event will the authors be held liable for any damages
  // arising from the use of this software.
  //
  // Permission is granted to anyone to use this software for any purpose,
  // including commercial applications, and to alter it and redistribute it
  // freely, subject to the following restrictions:
  //
  // 1. The origin of this software must not be misrepresented; you must not
  //   claim that you wrote the original software. If you use this software
  //   in a product, an acknowledgment in the product documentation would be
  //   appreciated but is not required.
  // 2. Altered source versions must be plainly marked as such, and must not be
  //   misrepresented as being the original software.
  // 3. This notice may not be removed or altered from any source distribution.

  var utils         = require('../utils/common');
  var adler32       = require('./adler32');
  var crc32         = require('./crc32');
  var inflate_fast  = require('./inffast');
  var inflate_table = require('./inftrees');

  var CODES = 0;
  var LENS = 1;
  var DISTS = 2;

  /* Public constants ==========================================================*/
  /* ===========================================================================*/


  /* Allowed flush values; see deflate() and inflate() below for details */
  //var Z_NO_FLUSH      = 0;
  //var Z_PARTIAL_FLUSH = 1;
  //var Z_SYNC_FLUSH    = 2;
  //var Z_FULL_FLUSH    = 3;
  var Z_FINISH        = 4;
  var Z_BLOCK         = 5;
  var Z_TREES         = 6;


  /* Return codes for the compression/decompression functions. Negative values
   * are errors, positive values are used for special but normal events.
   */
  var Z_OK            = 0;
  var Z_STREAM_END    = 1;
  var Z_NEED_DICT     = 2;
  //var Z_ERRNO         = -1;
  var Z_STREAM_ERROR  = -2;
  var Z_DATA_ERROR    = -3;
  var Z_MEM_ERROR     = -4;
  var Z_BUF_ERROR     = -5;
  //var Z_VERSION_ERROR = -6;

  /* The deflate compression method */
  var Z_DEFLATED  = 8;


  /* STATES ====================================================================*/
  /* ===========================================================================*/


  var    HEAD = 1;       /* i: waiting for magic header */
  var    FLAGS = 2;      /* i: waiting for method and flags (gzip) */
  var    TIME = 3;       /* i: waiting for modification time (gzip) */
  var    OS = 4;         /* i: waiting for extra flags and operating system (gzip) */
  var    EXLEN = 5;      /* i: waiting for extra length (gzip) */
  var    EXTRA = 6;      /* i: waiting for extra bytes (gzip) */
  var    NAME = 7;       /* i: waiting for end of file name (gzip) */
  var    COMMENT = 8;    /* i: waiting for end of comment (gzip) */
  var    HCRC = 9;       /* i: waiting for header crc (gzip) */
  var    DICTID = 10;    /* i: waiting for dictionary check value */
  var    DICT = 11;      /* waiting for inflateSetDictionary() call */
  var        TYPE = 12;      /* i: waiting for type bits, including last-flag bit */
  var        TYPEDO = 13;    /* i: same, but skip check to exit inflate on new block */
  var        STORED = 14;    /* i: waiting for stored size (length and complement) */
  var        COPY_ = 15;     /* i/o: same as COPY below, but only first time in */
  var        COPY = 16;      /* i/o: waiting for input or output to copy stored block */
  var        TABLE = 17;     /* i: waiting for dynamic block table lengths */
  var        LENLENS = 18;   /* i: waiting for code length code lengths */
  var        CODELENS = 19;  /* i: waiting for length/lit and distance code lengths */
  var            LEN_ = 20;      /* i: same as LEN below, but only first time in */
  var            LEN = 21;       /* i: waiting for length/lit/eob code */
  var            LENEXT = 22;    /* i: waiting for length extra bits */
  var            DIST = 23;      /* i: waiting for distance code */
  var            DISTEXT = 24;   /* i: waiting for distance extra bits */
  var            MATCH = 25;     /* o: waiting for output space to copy string */
  var            LIT = 26;       /* o: waiting for output space to write literal */
  var    CHECK = 27;     /* i: waiting for 32-bit check value */
  var    LENGTH = 28;    /* i: waiting for 32-bit length (gzip) */
  var    DONE = 29;      /* finished check, done -- remain here until reset */
  var    BAD = 30;       /* got a data error -- remain here until reset */
  var    MEM = 31;       /* got an inflate() memory error -- remain here until reset */
  var    SYNC = 32;      /* looking for synchronization bytes to restart inflate() */

  /* ===========================================================================*/



  var ENOUGH_LENS = 852;
  var ENOUGH_DISTS = 592;
  //var ENOUGH =  (ENOUGH_LENS+ENOUGH_DISTS);

  var MAX_WBITS = 15;
  /* 32K LZ77 window */
  var DEF_WBITS = MAX_WBITS;


  function zswap32(q) {
    return  (((q >>> 24) & 0xff) +
            ((q >>> 8) & 0xff00) +
            ((q & 0xff00) << 8) +
            ((q & 0xff) << 24));
  }


  function InflateState() {
    this.mode = 0;             /* current inflate mode */
    this.last = false;          /* true if processing last block */
    this.wrap = 0;              /* bit 0 true for zlib, bit 1 true for gzip */
    this.havedict = false;      /* true if dictionary provided */
    this.flags = 0;             /* gzip header method and flags (0 if zlib) */
    this.dmax = 0;              /* zlib header max distance (INFLATE_STRICT) */
    this.check = 0;             /* protected copy of check value */
    this.total = 0;             /* protected copy of output count */
    // TODO: may be {}
    this.head = null;           /* where to save gzip header information */

    /* sliding window */
    this.wbits = 0;             /* log base 2 of requested window size */
    this.wsize = 0;             /* window size or zero if not using window */
    this.whave = 0;             /* valid bytes in the window */
    this.wnext = 0;             /* window write index */
    this.window = null;         /* allocated sliding window, if needed */

    /* bit accumulator */
    this.hold = 0;              /* input bit accumulator */
    this.bits = 0;              /* number of bits in "in" */

    /* for string and stored block copying */
    this.length = 0;            /* literal or length of data to copy */
    this.offset = 0;            /* distance back to copy string from */

    /* for table and code decoding */
    this.extra = 0;             /* extra bits needed */

    /* fixed and dynamic code tables */
    this.lencode = null;          /* starting table for length/literal codes */
    this.distcode = null;         /* starting table for distance codes */
    this.lenbits = 0;           /* index bits for lencode */
    this.distbits = 0;          /* index bits for distcode */

    /* dynamic table building */
    this.ncode = 0;             /* number of code length code lengths */
    this.nlen = 0;              /* number of length code lengths */
    this.ndist = 0;             /* number of distance code lengths */
    this.have = 0;              /* number of code lengths in lens[] */
    this.next = null;              /* next available space in codes[] */

    this.lens = new utils.Buf16(320); /* temporary storage for code lengths */
    this.work = new utils.Buf16(288); /* work area for code table building */

    /*
     because we don't have pointers in js, we use lencode and distcode directly
     as buffers so we don't need codes
    */
    //this.codes = new utils.Buf32(ENOUGH);       /* space for code tables */
    this.lendyn = null;              /* dynamic table for length/literal codes (JS specific) */
    this.distdyn = null;             /* dynamic table for distance codes (JS specific) */
    this.sane = 0;                   /* if false, allow invalid distance too far */
    this.back = 0;                   /* bits back of last unprocessed length/lit */
    this.was = 0;                    /* initial length of match */
  }

  function inflateResetKeep(strm) {
    var state;

    if (!strm || !strm.state) { return Z_STREAM_ERROR; }
    state = strm.state;
    strm.total_in = strm.total_out = state.total = 0;
    strm.msg = ''; /*Z_NULL*/
    if (state.wrap) {       /* to support ill-conceived Java test suite */
      strm.adler = state.wrap & 1;
    }
    state.mode = HEAD;
    state.last = 0;
    state.havedict = 0;
    state.dmax = 32768;
    state.head = null/*Z_NULL*/;
    state.hold = 0;
    state.bits = 0;
    //state.lencode = state.distcode = state.next = state.codes;
    state.lencode = state.lendyn = new utils.Buf32(ENOUGH_LENS);
    state.distcode = state.distdyn = new utils.Buf32(ENOUGH_DISTS);

    state.sane = 1;
    state.back = -1;
    //Tracev((stderr, "inflate: reset\n"));
    return Z_OK;
  }

  function inflateReset(strm) {
    var state;

    if (!strm || !strm.state) { return Z_STREAM_ERROR; }
    state = strm.state;
    state.wsize = 0;
    state.whave = 0;
    state.wnext = 0;
    return inflateResetKeep(strm);

  }

  function inflateReset2(strm, windowBits) {
    var wrap;
    var state;

    /* get the state */
    if (!strm || !strm.state) { return Z_STREAM_ERROR; }
    state = strm.state;

    /* extract wrap request from windowBits parameter */
    if (windowBits < 0) {
      wrap = 0;
      windowBits = -windowBits;
    }
    else {
      wrap = (windowBits >> 4) + 1;
      if (windowBits < 48) {
        windowBits &= 15;
      }
    }

    /* set number of window bits, free window if different */
    if (windowBits && (windowBits < 8 || windowBits > 15)) {
      return Z_STREAM_ERROR;
    }
    if (state.window !== null && state.wbits !== windowBits) {
      state.window = null;
    }

    /* update state and reset the rest of it */
    state.wrap = wrap;
    state.wbits = windowBits;
    return inflateReset(strm);
  }

  function inflateInit2(strm, windowBits) {
    var ret;
    var state;

    if (!strm) { return Z_STREAM_ERROR; }
    //strm.msg = Z_NULL;                 /* in case we return an error */

    state = new InflateState();

    //if (state === Z_NULL) return Z_MEM_ERROR;
    //Tracev((stderr, "inflate: allocated\n"));
    strm.state = state;
    state.window = null/*Z_NULL*/;
    ret = inflateReset2(strm, windowBits);
    if (ret !== Z_OK) {
      strm.state = null/*Z_NULL*/;
    }
    return ret;
  }

  function inflateInit(strm) {
    return inflateInit2(strm, DEF_WBITS);
  }


  /*
   Return state with length and distance decoding tables and index sizes set to
   fixed code decoding.  Normally this returns fixed tables from inffixed.h.
   If BUILDFIXED is defined, then instead this routine builds the tables the
   first time it's called, and returns those tables the first time and
   thereafter.  This reduces the size of the code by about 2K bytes, in
   exchange for a little execution time.  However, BUILDFIXED should not be
   used for threaded applications, since the rewriting of the tables and virgin
   may not be thread-safe.
   */
  var virgin = true;

  var lenfix, distfix; // We have no pointers in JS, so keep tables separate

  function fixedtables(state) {
    /* build fixed huffman tables if first call (may not be thread safe) */
    if (virgin) {
      var sym;

      lenfix = new utils.Buf32(512);
      distfix = new utils.Buf32(32);

      /* literal/length table */
      sym = 0;
      while (sym < 144) { state.lens[sym++] = 8; }
      while (sym < 256) { state.lens[sym++] = 9; }
      while (sym < 280) { state.lens[sym++] = 7; }
      while (sym < 288) { state.lens[sym++] = 8; }

      inflate_table(LENS,  state.lens, 0, 288, lenfix,   0, state.work, { bits: 9 });

      /* distance table */
      sym = 0;
      while (sym < 32) { state.lens[sym++] = 5; }

      inflate_table(DISTS, state.lens, 0, 32,   distfix, 0, state.work, { bits: 5 });

      /* do this just once */
      virgin = false;
    }

    state.lencode = lenfix;
    state.lenbits = 9;
    state.distcode = distfix;
    state.distbits = 5;
  }


  /*
   Update the window with the last wsize (normally 32K) bytes written before
   returning.  If window does not exist yet, create it.  This is only called
   when a window is already in use, or when output has been written during this
   inflate call, but the end of the deflate stream has not been reached yet.
   It is also called to create a window for dictionary data when a dictionary
   is loaded.

   Providing output buffers larger than 32K to inflate() should provide a speed
   advantage, since only the last 32K of output is copied to the sliding window
   upon return from inflate(), and since all distances after the first 32K of
   output will fall in the output data, making match copies simpler and faster.
   The advantage may be dependent on the size of the processor's data caches.
   */
  function updatewindow(strm, src, end, copy) {
    var dist;
    var state = strm.state;

    /* if it hasn't been done already, allocate space for the window */
    if (state.window === null) {
      state.wsize = 1 << state.wbits;
      state.wnext = 0;
      state.whave = 0;

      state.window = new utils.Buf8(state.wsize);
    }

    /* copy state->wsize or less output bytes into the circular window */
    if (copy >= state.wsize) {
      utils.arraySet(state.window, src, end - state.wsize, state.wsize, 0);
      state.wnext = 0;
      state.whave = state.wsize;
    }
    else {
      dist = state.wsize - state.wnext;
      if (dist > copy) {
        dist = copy;
      }
      //zmemcpy(state->window + state->wnext, end - copy, dist);
      utils.arraySet(state.window, src, end - copy, dist, state.wnext);
      copy -= dist;
      if (copy) {
        //zmemcpy(state->window, end - copy, copy);
        utils.arraySet(state.window, src, end - copy, copy, 0);
        state.wnext = copy;
        state.whave = state.wsize;
      }
      else {
        state.wnext += dist;
        if (state.wnext === state.wsize) { state.wnext = 0; }
        if (state.whave < state.wsize) { state.whave += dist; }
      }
    }
    return 0;
  }

  function inflate(strm, flush) {
    var state;
    var input, output;          // input/output buffers
    var next;                   /* next input INDEX */
    var put;                    /* next output INDEX */
    var have, left;             /* available input and output */
    var hold;                   /* bit buffer */
    var bits;                   /* bits in bit buffer */
    var _in, _out;              /* save starting available input and output */
    var copy;                   /* number of stored or match bytes to copy */
    var from;                   /* where to copy match bytes from */
    var from_source;
    var here = 0;               /* current decoding table entry */
    var here_bits, here_op, here_val; // paked "here" denormalized (JS specific)
    //var last;                   /* parent table entry */
    var last_bits, last_op, last_val; // paked "last" denormalized (JS specific)
    var len;                    /* length to copy for repeats, bits to drop */
    var ret;                    /* return code */
    var hbuf = new utils.Buf8(4);    /* buffer for gzip header crc calculation */
    var opts;

    var n; // temporary var for NEED_BITS

    var order = /* permutation of code lengths */
      [ 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15 ];


    if (!strm || !strm.state || !strm.output ||
        (!strm.input && strm.avail_in !== 0)) {
      return Z_STREAM_ERROR;
    }

    state = strm.state;
    if (state.mode === TYPE) { state.mode = TYPEDO; }    /* skip check */


    //--- LOAD() ---
    put = strm.next_out;
    output = strm.output;
    left = strm.avail_out;
    next = strm.next_in;
    input = strm.input;
    have = strm.avail_in;
    hold = state.hold;
    bits = state.bits;
    //---

    _in = have;
    _out = left;
    ret = Z_OK;

    inf_leave: // goto emulation
    for (;;) {
      switch (state.mode) {
        case HEAD:
          if (state.wrap === 0) {
            state.mode = TYPEDO;
            break;
          }
          //=== NEEDBITS(16);
          while (bits < 16) {
            if (have === 0) { break inf_leave; }
            have--;
            hold += input[next++] << bits;
            bits += 8;
          }
          //===//
          if ((state.wrap & 2) && hold === 0x8b1f) {  /* gzip header */
            state.check = 0/*crc32(0L, Z_NULL, 0)*/;
            //=== CRC2(state.check, hold);
            hbuf[0] = hold & 0xff;
            hbuf[1] = (hold >>> 8) & 0xff;
            state.check = crc32(state.check, hbuf, 2, 0);
            //===//

            //=== INITBITS();
            hold = 0;
            bits = 0;
            //===//
            state.mode = FLAGS;
            break;
          }
          state.flags = 0;           /* expect zlib header */
          if (state.head) {
            state.head.done = false;
          }
          if (!(state.wrap & 1) ||   /* check if zlib header allowed */
            (((hold & 0xff)/*BITS(8)*/ << 8) + (hold >> 8)) % 31) {
            strm.msg = 'incorrect header check';
            state.mode = BAD;
            break;
          }
          if ((hold & 0x0f)/*BITS(4)*/ !== Z_DEFLATED) {
            strm.msg = 'unknown compression method';
            state.mode = BAD;
            break;
          }
          //--- DROPBITS(4) ---//
          hold >>>= 4;
          bits -= 4;
          //---//
          len = (hold & 0x0f)/*BITS(4)*/ + 8;
          if (state.wbits === 0) {
            state.wbits = len;
          }
          else if (len > state.wbits) {
            strm.msg = 'invalid window size';
            state.mode = BAD;
            break;
          }
          state.dmax = 1 << len;
          //Tracev((stderr, "inflate:   zlib header ok\n"));
          strm.adler = state.check = 1/*adler32(0L, Z_NULL, 0)*/;
          state.mode = hold & 0x200 ? DICTID : TYPE;
          //=== INITBITS();
          hold = 0;
          bits = 0;
          //===//
          break;
        case FLAGS:
          //=== NEEDBITS(16); */
          while (bits < 16) {
            if (have === 0) { break inf_leave; }
            have--;
            hold += input[next++] << bits;
            bits += 8;
          }
          //===//
          state.flags = hold;
          if ((state.flags & 0xff) !== Z_DEFLATED) {
            strm.msg = 'unknown compression method';
            state.mode = BAD;
            break;
          }
          if (state.flags & 0xe000) {
            strm.msg = 'unknown header flags set';
            state.mode = BAD;
            break;
          }
          if (state.head) {
            state.head.text = ((hold >> 8) & 1);
          }
          if (state.flags & 0x0200) {
            //=== CRC2(state.check, hold);
            hbuf[0] = hold & 0xff;
            hbuf[1] = (hold >>> 8) & 0xff;
            state.check = crc32(state.check, hbuf, 2, 0);
            //===//
          }
          //=== INITBITS();
          hold = 0;
          bits = 0;
          //===//
          state.mode = TIME;
          /* falls through */
        case TIME:
          //=== NEEDBITS(32); */
          while (bits < 32) {
            if (have === 0) { break inf_leave; }
            have--;
            hold += input[next++] << bits;
            bits += 8;
          }
          //===//
          if (state.head) {
            state.head.time = hold;
          }
          if (state.flags & 0x0200) {
            //=== CRC4(state.check, hold)
            hbuf[0] = hold & 0xff;
            hbuf[1] = (hold >>> 8) & 0xff;
            hbuf[2] = (hold >>> 16) & 0xff;
            hbuf[3] = (hold >>> 24) & 0xff;
            state.check = crc32(state.check, hbuf, 4, 0);
            //===
          }
          //=== INITBITS();
          hold = 0;
          bits = 0;
          //===//
          state.mode = OS;
          /* falls through */
        case OS:
          //=== NEEDBITS(16); */
          while (bits < 16) {
            if (have === 0) { break inf_leave; }
            have--;
            hold += input[next++] << bits;
            bits += 8;
          }
          //===//
          if (state.head) {
            state.head.xflags = (hold & 0xff);
            state.head.os = (hold >> 8);
          }
          if (state.flags & 0x0200) {
            //=== CRC2(state.check, hold);
            hbuf[0] = hold & 0xff;
            hbuf[1] = (hold >>> 8) & 0xff;
            state.check = crc32(state.check, hbuf, 2, 0);
            //===//
          }
          //=== INITBITS();
          hold = 0;
          bits = 0;
          //===//
          state.mode = EXLEN;
          /* falls through */
        case EXLEN:
          if (state.flags & 0x0400) {
            //=== NEEDBITS(16); */
            while (bits < 16) {
              if (have === 0) { break inf_leave; }
              have--;
              hold += input[next++] << bits;
              bits += 8;
            }
            //===//
            state.length = hold;
            if (state.head) {
              state.head.extra_len = hold;
            }
            if (state.flags & 0x0200) {
              //=== CRC2(state.check, hold);
              hbuf[0] = hold & 0xff;
              hbuf[1] = (hold >>> 8) & 0xff;
              state.check = crc32(state.check, hbuf, 2, 0);
              //===//
            }
            //=== INITBITS();
            hold = 0;
            bits = 0;
            //===//
          }
          else if (state.head) {
            state.head.extra = null/*Z_NULL*/;
          }
          state.mode = EXTRA;
          /* falls through */
        case EXTRA:
          if (state.flags & 0x0400) {
            copy = state.length;
            if (copy > have) { copy = have; }
            if (copy) {
              if (state.head) {
                len = state.head.extra_len - state.length;
                if (!state.head.extra) {
                  // Use untyped array for more convenient processing later
                  state.head.extra = new Array(state.head.extra_len);
                }
                utils.arraySet(
                  state.head.extra,
                  input,
                  next,
                  // extra field is limited to 65536 bytes
                  // - no need for additional size check
                  copy,
                  /*len + copy > state.head.extra_max - len ? state.head.extra_max : copy,*/
                  len
                );
                //zmemcpy(state.head.extra + len, next,
                //        len + copy > state.head.extra_max ?
                //        state.head.extra_max - len : copy);
              }
              if (state.flags & 0x0200) {
                state.check = crc32(state.check, input, copy, next);
              }
              have -= copy;
              next += copy;
              state.length -= copy;
            }
            if (state.length) { break inf_leave; }
          }
          state.length = 0;
          state.mode = NAME;
          /* falls through */
        case NAME:
          if (state.flags & 0x0800) {
            if (have === 0) { break inf_leave; }
            copy = 0;
            do {
              // TODO: 2 or 1 bytes?
              len = input[next + copy++];
              /* use constant limit because in js we should not preallocate memory */
              if (state.head && len &&
                  (state.length < 65536 /*state.head.name_max*/)) {
                state.head.name += String.fromCharCode(len);
              }
            } while (len && copy < have);

            if (state.flags & 0x0200) {
              state.check = crc32(state.check, input, copy, next);
            }
            have -= copy;
            next += copy;
            if (len) { break inf_leave; }
          }
          else if (state.head) {
            state.head.name = null;
          }
          state.length = 0;
          state.mode = COMMENT;
          /* falls through */
        case COMMENT:
          if (state.flags & 0x1000) {
            if (have === 0) { break inf_leave; }
            copy = 0;
            do {
              len = input[next + copy++];
              /* use constant limit because in js we should not preallocate memory */
              if (state.head && len &&
                  (state.length < 65536 /*state.head.comm_max*/)) {
                state.head.comment += String.fromCharCode(len);
              }
            } while (len && copy < have);
            if (state.flags & 0x0200) {
              state.check = crc32(state.check, input, copy, next);
            }
            have -= copy;
            next += copy;
            if (len) { break inf_leave; }
          }
          else if (state.head) {
            state.head.comment = null;
          }
          state.mode = HCRC;
          /* falls through */
        case HCRC:
          if (state.flags & 0x0200) {
            //=== NEEDBITS(16); */
            while (bits < 16) {
              if (have === 0) { break inf_leave; }
              have--;
              hold += input[next++] << bits;
              bits += 8;
            }
            //===//
            if (hold !== (state.check & 0xffff)) {
              strm.msg = 'header crc mismatch';
              state.mode = BAD;
              break;
            }
            //=== INITBITS();
            hold = 0;
            bits = 0;
            //===//
          }
          if (state.head) {
            state.head.hcrc = ((state.flags >> 9) & 1);
            state.head.done = true;
          }
          strm.adler = state.check = 0;
          state.mode = TYPE;
          break;
        case DICTID:
          //=== NEEDBITS(32); */
          while (bits < 32) {
            if (have === 0) { break inf_leave; }
            have--;
            hold += input[next++] << bits;
            bits += 8;
          }
          //===//
          strm.adler = state.check = zswap32(hold);
          //=== INITBITS();
          hold = 0;
          bits = 0;
          //===//
          state.mode = DICT;
          /* falls through */
        case DICT:
          if (state.havedict === 0) {
            //--- RESTORE() ---
            strm.next_out = put;
            strm.avail_out = left;
            strm.next_in = next;
            strm.avail_in = have;
            state.hold = hold;
            state.bits = bits;
            //---
            return Z_NEED_DICT;
          }
          strm.adler = state.check = 1/*adler32(0L, Z_NULL, 0)*/;
          state.mode = TYPE;
          /* falls through */
        case TYPE:
          if (flush === Z_BLOCK || flush === Z_TREES) { break inf_leave; }
          /* falls through */
        case TYPEDO:
          if (state.last) {
            //--- BYTEBITS() ---//
            hold >>>= bits & 7;
            bits -= bits & 7;
            //---//
            state.mode = CHECK;
            break;
          }
          //=== NEEDBITS(3); */
          while (bits < 3) {
            if (have === 0) { break inf_leave; }
            have--;
            hold += input[next++] << bits;
            bits += 8;
          }
          //===//
          state.last = (hold & 0x01)/*BITS(1)*/;
          //--- DROPBITS(1) ---//
          hold >>>= 1;
          bits -= 1;
          //---//

          switch ((hold & 0x03)/*BITS(2)*/) {
            case 0:                             /* stored block */
              //Tracev((stderr, "inflate:     stored block%s\n",
              //        state.last ? " (last)" : ""));
              state.mode = STORED;
              break;
            case 1:                             /* fixed block */
              fixedtables(state);
              //Tracev((stderr, "inflate:     fixed codes block%s\n",
              //        state.last ? " (last)" : ""));
              state.mode = LEN_;             /* decode codes */
              if (flush === Z_TREES) {
                //--- DROPBITS(2) ---//
                hold >>>= 2;
                bits -= 2;
                //---//
                break inf_leave;
              }
              break;
            case 2:                             /* dynamic block */
              //Tracev((stderr, "inflate:     dynamic codes block%s\n",
              //        state.last ? " (last)" : ""));
              state.mode = TABLE;
              break;
            case 3:
              strm.msg = 'invalid block type';
              state.mode = BAD;
          }
          //--- DROPBITS(2) ---//
          hold >>>= 2;
          bits -= 2;
          //---//
          break;
        case STORED:
          //--- BYTEBITS() ---// /* go to byte boundary */
          hold >>>= bits & 7;
          bits -= bits & 7;
          //---//
          //=== NEEDBITS(32); */
          while (bits < 32) {
            if (have === 0) { break inf_leave; }
            have--;
            hold += input[next++] << bits;
            bits += 8;
          }
          //===//
          if ((hold & 0xffff) !== ((hold >>> 16) ^ 0xffff)) {
            strm.msg = 'invalid stored block lengths';
            state.mode = BAD;
            break;
          }
          state.length = hold & 0xffff;
          //Tracev((stderr, "inflate:       stored length %u\n",
          //        state.length));
          //=== INITBITS();
          hold = 0;
          bits = 0;
          //===//
          state.mode = COPY_;
          if (flush === Z_TREES) { break inf_leave; }
          /* falls through */
        case COPY_:
          state.mode = COPY;
          /* falls through */
        case COPY:
          copy = state.length;
          if (copy) {
            if (copy > have) { copy = have; }
            if (copy > left) { copy = left; }
            if (copy === 0) { break inf_leave; }
            //--- zmemcpy(put, next, copy); ---
            utils.arraySet(output, input, next, copy, put);
            //---//
            have -= copy;
            next += copy;
            left -= copy;
            put += copy;
            state.length -= copy;
            break;
          }
          //Tracev((stderr, "inflate:       stored end\n"));
          state.mode = TYPE;
          break;
        case TABLE:
          //=== NEEDBITS(14); */
          while (bits < 14) {
            if (have === 0) { break inf_leave; }
            have--;
            hold += input[next++] << bits;
            bits += 8;
          }
          //===//
          state.nlen = (hold & 0x1f)/*BITS(5)*/ + 257;
          //--- DROPBITS(5) ---//
          hold >>>= 5;
          bits -= 5;
          //---//
          state.ndist = (hold & 0x1f)/*BITS(5)*/ + 1;
          //--- DROPBITS(5) ---//
          hold >>>= 5;
          bits -= 5;
          //---//
          state.ncode = (hold & 0x0f)/*BITS(4)*/ + 4;
          //--- DROPBITS(4) ---//
          hold >>>= 4;
          bits -= 4;
          //---//
  //#ifndef PKZIP_BUG_WORKAROUND
          if (state.nlen > 286 || state.ndist > 30) {
            strm.msg = 'too many length or distance symbols';
            state.mode = BAD;
            break;
          }
  //#endif
          //Tracev((stderr, "inflate:       table sizes ok\n"));
          state.have = 0;
          state.mode = LENLENS;
          /* falls through */
        case LENLENS:
          while (state.have < state.ncode) {
            //=== NEEDBITS(3);
            while (bits < 3) {
              if (have === 0) { break inf_leave; }
              have--;
              hold += input[next++] << bits;
              bits += 8;
            }
            //===//
            state.lens[order[state.have++]] = (hold & 0x07);//BITS(3);
            //--- DROPBITS(3) ---//
            hold >>>= 3;
            bits -= 3;
            //---//
          }
          while (state.have < 19) {
            state.lens[order[state.have++]] = 0;
          }
          // We have separate tables & no pointers. 2 commented lines below not needed.
          //state.next = state.codes;
          //state.lencode = state.next;
          // Switch to use dynamic table
          state.lencode = state.lendyn;
          state.lenbits = 7;

          opts = { bits: state.lenbits };
          ret = inflate_table(CODES, state.lens, 0, 19, state.lencode, 0, state.work, opts);
          state.lenbits = opts.bits;

          if (ret) {
            strm.msg = 'invalid code lengths set';
            state.mode = BAD;
            break;
          }
          //Tracev((stderr, "inflate:       code lengths ok\n"));
          state.have = 0;
          state.mode = CODELENS;
          /* falls through */
        case CODELENS:
          while (state.have < state.nlen + state.ndist) {
            for (;;) {
              here = state.lencode[hold & ((1 << state.lenbits) - 1)];/*BITS(state.lenbits)*/
              here_bits = here >>> 24;
              here_op = (here >>> 16) & 0xff;
              here_val = here & 0xffff;

              if ((here_bits) <= bits) { break; }
              //--- PULLBYTE() ---//
              if (have === 0) { break inf_leave; }
              have--;
              hold += input[next++] << bits;
              bits += 8;
              //---//
            }
            if (here_val < 16) {
              //--- DROPBITS(here.bits) ---//
              hold >>>= here_bits;
              bits -= here_bits;
              //---//
              state.lens[state.have++] = here_val;
            }
            else {
              if (here_val === 16) {
                //=== NEEDBITS(here.bits + 2);
                n = here_bits + 2;
                while (bits < n) {
                  if (have === 0) { break inf_leave; }
                  have--;
                  hold += input[next++] << bits;
                  bits += 8;
                }
                //===//
                //--- DROPBITS(here.bits) ---//
                hold >>>= here_bits;
                bits -= here_bits;
                //---//
                if (state.have === 0) {
                  strm.msg = 'invalid bit length repeat';
                  state.mode = BAD;
                  break;
                }
                len = state.lens[state.have - 1];
                copy = 3 + (hold & 0x03);//BITS(2);
                //--- DROPBITS(2) ---//
                hold >>>= 2;
                bits -= 2;
                //---//
              }
              else if (here_val === 17) {
                //=== NEEDBITS(here.bits + 3);
                n = here_bits + 3;
                while (bits < n) {
                  if (have === 0) { break inf_leave; }
                  have--;
                  hold += input[next++] << bits;
                  bits += 8;
                }
                //===//
                //--- DROPBITS(here.bits) ---//
                hold >>>= here_bits;
                bits -= here_bits;
                //---//
                len = 0;
                copy = 3 + (hold & 0x07);//BITS(3);
                //--- DROPBITS(3) ---//
                hold >>>= 3;
                bits -= 3;
                //---//
              }
              else {
                //=== NEEDBITS(here.bits + 7);
                n = here_bits + 7;
                while (bits < n) {
                  if (have === 0) { break inf_leave; }
                  have--;
                  hold += input[next++] << bits;
                  bits += 8;
                }
                //===//
                //--- DROPBITS(here.bits) ---//
                hold >>>= here_bits;
                bits -= here_bits;
                //---//
                len = 0;
                copy = 11 + (hold & 0x7f);//BITS(7);
                //--- DROPBITS(7) ---//
                hold >>>= 7;
                bits -= 7;
                //---//
              }
              if (state.have + copy > state.nlen + state.ndist) {
                strm.msg = 'invalid bit length repeat';
                state.mode = BAD;
                break;
              }
              while (copy--) {
                state.lens[state.have++] = len;
              }
            }
          }

          /* handle error breaks in while */
          if (state.mode === BAD) { break; }

          /* check for end-of-block code (better have one) */
          if (state.lens[256] === 0) {
            strm.msg = 'invalid code -- missing end-of-block';
            state.mode = BAD;
            break;
          }

          /* build code tables -- note: do not change the lenbits or distbits
             values here (9 and 6) without reading the comments in inftrees.h
             concerning the ENOUGH constants, which depend on those values */
          state.lenbits = 9;

          opts = { bits: state.lenbits };
          ret = inflate_table(LENS, state.lens, 0, state.nlen, state.lencode, 0, state.work, opts);
          // We have separate tables & no pointers. 2 commented lines below not needed.
          // state.next_index = opts.table_index;
          state.lenbits = opts.bits;
          // state.lencode = state.next;

          if (ret) {
            strm.msg = 'invalid literal/lengths set';
            state.mode = BAD;
            break;
          }

          state.distbits = 6;
          //state.distcode.copy(state.codes);
          // Switch to use dynamic table
          state.distcode = state.distdyn;
          opts = { bits: state.distbits };
          ret = inflate_table(DISTS, state.lens, state.nlen, state.ndist, state.distcode, 0, state.work, opts);
          // We have separate tables & no pointers. 2 commented lines below not needed.
          // state.next_index = opts.table_index;
          state.distbits = opts.bits;
          // state.distcode = state.next;

          if (ret) {
            strm.msg = 'invalid distances set';
            state.mode = BAD;
            break;
          }
          //Tracev((stderr, 'inflate:       codes ok\n'));
          state.mode = LEN_;
          if (flush === Z_TREES) { break inf_leave; }
          /* falls through */
        case LEN_:
          state.mode = LEN;
          /* falls through */
        case LEN:
          if (have >= 6 && left >= 258) {
            //--- RESTORE() ---
            strm.next_out = put;
            strm.avail_out = left;
            strm.next_in = next;
            strm.avail_in = have;
            state.hold = hold;
            state.bits = bits;
            //---
            inflate_fast(strm, _out);
            //--- LOAD() ---
            put = strm.next_out;
            output = strm.output;
            left = strm.avail_out;
            next = strm.next_in;
            input = strm.input;
            have = strm.avail_in;
            hold = state.hold;
            bits = state.bits;
            //---

            if (state.mode === TYPE) {
              state.back = -1;
            }
            break;
          }
          state.back = 0;
          for (;;) {
            here = state.lencode[hold & ((1 << state.lenbits) - 1)];  /*BITS(state.lenbits)*/
            here_bits = here >>> 24;
            here_op = (here >>> 16) & 0xff;
            here_val = here & 0xffff;

            if (here_bits <= bits) { break; }
            //--- PULLBYTE() ---//
            if (have === 0) { break inf_leave; }
            have--;
            hold += input[next++] << bits;
            bits += 8;
            //---//
          }
          if (here_op && (here_op & 0xf0) === 0) {
            last_bits = here_bits;
            last_op = here_op;
            last_val = here_val;
            for (;;) {
              here = state.lencode[last_val +
                      ((hold & ((1 << (last_bits + last_op)) - 1))/*BITS(last.bits + last.op)*/ >> last_bits)];
              here_bits = here >>> 24;
              here_op = (here >>> 16) & 0xff;
              here_val = here & 0xffff;

              if ((last_bits + here_bits) <= bits) { break; }
              //--- PULLBYTE() ---//
              if (have === 0) { break inf_leave; }
              have--;
              hold += input[next++] << bits;
              bits += 8;
              //---//
            }
            //--- DROPBITS(last.bits) ---//
            hold >>>= last_bits;
            bits -= last_bits;
            //---//
            state.back += last_bits;
          }
          //--- DROPBITS(here.bits) ---//
          hold >>>= here_bits;
          bits -= here_bits;
          //---//
          state.back += here_bits;
          state.length = here_val;
          if (here_op === 0) {
            //Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ?
            //        "inflate:         literal '%c'\n" :
            //        "inflate:         literal 0x%02x\n", here.val));
            state.mode = LIT;
            break;
          }
          if (here_op & 32) {
            //Tracevv((stderr, "inflate:         end of block\n"));
            state.back = -1;
            state.mode = TYPE;
            break;
          }
          if (here_op & 64) {
            strm.msg = 'invalid literal/length code';
            state.mode = BAD;
            break;
          }
          state.extra = here_op & 15;
          state.mode = LENEXT;
          /* falls through */
        case LENEXT:
          if (state.extra) {
            //=== NEEDBITS(state.extra);
            n = state.extra;
            while (bits < n) {
              if (have === 0) { break inf_leave; }
              have--;
              hold += input[next++] << bits;
              bits += 8;
            }
            //===//
            state.length += hold & ((1 << state.extra) - 1)/*BITS(state.extra)*/;
            //--- DROPBITS(state.extra) ---//
            hold >>>= state.extra;
            bits -= state.extra;
            //---//
            state.back += state.extra;
          }
          //Tracevv((stderr, "inflate:         length %u\n", state.length));
          state.was = state.length;
          state.mode = DIST;
          /* falls through */
        case DIST:
          for (;;) {
            here = state.distcode[hold & ((1 << state.distbits) - 1)];/*BITS(state.distbits)*/
            here_bits = here >>> 24;
            here_op = (here >>> 16) & 0xff;
            here_val = here & 0xffff;

            if ((here_bits) <= bits) { break; }
            //--- PULLBYTE() ---//
            if (have === 0) { break inf_leave; }
            have--;
            hold += input[next++] << bits;
            bits += 8;
            //---//
          }
          if ((here_op & 0xf0) === 0) {
            last_bits = here_bits;
            last_op = here_op;
            last_val = here_val;
            for (;;) {
              here = state.distcode[last_val +
                      ((hold & ((1 << (last_bits + last_op)) - 1))/*BITS(last.bits + last.op)*/ >> last_bits)];
              here_bits = here >>> 24;
              here_op = (here >>> 16) & 0xff;
              here_val = here & 0xffff;

              if ((last_bits + here_bits) <= bits) { break; }
              //--- PULLBYTE() ---//
              if (have === 0) { break inf_leave; }
              have--;
              hold += input[next++] << bits;
              bits += 8;
              //---//
            }
            //--- DROPBITS(last.bits) ---//
            hold >>>= last_bits;
            bits -= last_bits;
            //---//
            state.back += last_bits;
          }
          //--- DROPBITS(here.bits) ---//
          hold >>>= here_bits;
          bits -= here_bits;
          //---//
          state.back += here_bits;
          if (here_op & 64) {
            strm.msg = 'invalid distance code';
            state.mode = BAD;
            break;
          }
          state.offset = here_val;
          state.extra = (here_op) & 15;
          state.mode = DISTEXT;
          /* falls through */
        case DISTEXT:
          if (state.extra) {
            //=== NEEDBITS(state.extra);
            n = state.extra;
            while (bits < n) {
              if (have === 0) { break inf_leave; }
              have--;
              hold += input[next++] << bits;
              bits += 8;
            }
            //===//
            state.offset += hold & ((1 << state.extra) - 1)/*BITS(state.extra)*/;
            //--- DROPBITS(state.extra) ---//
            hold >>>= state.extra;
            bits -= state.extra;
            //---//
            state.back += state.extra;
          }
  //#ifdef INFLATE_STRICT
          if (state.offset > state.dmax) {
            strm.msg = 'invalid distance too far back';
            state.mode = BAD;
            break;
          }
  //#endif
          //Tracevv((stderr, "inflate:         distance %u\n", state.offset));
          state.mode = MATCH;
          /* falls through */
        case MATCH:
          if (left === 0) { break inf_leave; }
          copy = _out - left;
          if (state.offset > copy) {         /* copy from window */
            copy = state.offset - copy;
            if (copy > state.whave) {
              if (state.sane) {
                strm.msg = 'invalid distance too far back';
                state.mode = BAD;
                break;
              }
  // (!) This block is disabled in zlib defaults,
  // don't enable it for binary compatibility
  //#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR
  //          Trace((stderr, "inflate.c too far\n"));
  //          copy -= state.whave;
  //          if (copy > state.length) { copy = state.length; }
  //          if (copy > left) { copy = left; }
  //          left -= copy;
  //          state.length -= copy;
  //          do {
  //            output[put++] = 0;
  //          } while (--copy);
  //          if (state.length === 0) { state.mode = LEN; }
  //          break;
  //#endif
            }
            if (copy > state.wnext) {
              copy -= state.wnext;
              from = state.wsize - copy;
            }
            else {
              from = state.wnext - copy;
            }
            if (copy > state.length) { copy = state.length; }
            from_source = state.window;
          }
          else {                              /* copy from output */
            from_source = output;
            from = put - state.offset;
            copy = state.length;
          }
          if (copy > left) { copy = left; }
          left -= copy;
          state.length -= copy;
          do {
            output[put++] = from_source[from++];
          } while (--copy);
          if (state.length === 0) { state.mode = LEN; }
          break;
        case LIT:
          if (left === 0) { break inf_leave; }
          output[put++] = state.length;
          left--;
          state.mode = LEN;
          break;
        case CHECK:
          if (state.wrap) {
            //=== NEEDBITS(32);
            while (bits < 32) {
              if (have === 0) { break inf_leave; }
              have--;
              // Use '|' instead of '+' to make sure that result is signed
              hold |= input[next++] << bits;
              bits += 8;
            }
            //===//
            _out -= left;
            strm.total_out += _out;
            state.total += _out;
            if (_out) {
              strm.adler = state.check =
                  /*UPDATE(state.check, put - _out, _out);*/
                  (state.flags ? crc32(state.check, output, _out, put - _out) : adler32(state.check, output, _out, put - _out));

            }
            _out = left;
            // NB: crc32 stored as signed 32-bit int, zswap32 returns signed too
            if ((state.flags ? hold : zswap32(hold)) !== state.check) {
              strm.msg = 'incorrect data check';
              state.mode = BAD;
              break;
            }
            //=== INITBITS();
            hold = 0;
            bits = 0;
            //===//
            //Tracev((stderr, "inflate:   check matches trailer\n"));
          }
          state.mode = LENGTH;
          /* falls through */
        case LENGTH:
          if (state.wrap && state.flags) {
            //=== NEEDBITS(32);
            while (bits < 32) {
              if (have === 0) { break inf_leave; }
              have--;
              hold += input[next++] << bits;
              bits += 8;
            }
            //===//
            if (hold !== (state.total & 0xffffffff)) {
              strm.msg = 'incorrect length check';
              state.mode = BAD;
              break;
            }
            //=== INITBITS();
            hold = 0;
            bits = 0;
            //===//
            //Tracev((stderr, "inflate:   length matches trailer\n"));
          }
          state.mode = DONE;
          /* falls through */
        case DONE:
          ret = Z_STREAM_END;
          break inf_leave;
        case BAD:
          ret = Z_DATA_ERROR;
          break inf_leave;
        case MEM:
          return Z_MEM_ERROR;
        case SYNC:
          /* falls through */
        default:
          return Z_STREAM_ERROR;
      }
    }

    // inf_leave <- here is real place for "goto inf_leave", emulated via "break inf_leave"

    /*
       Return from inflate(), updating the total counts and the check value.
       If there was no progress during the inflate() call, return a buffer
       error.  Call updatewindow() to create and/or update the window state.
       Note: a memory error from inflate() is non-recoverable.
     */

    //--- RESTORE() ---
    strm.next_out = put;
    strm.avail_out = left;
    strm.next_in = next;
    strm.avail_in = have;
    state.hold = hold;
    state.bits = bits;
    //---

    if (state.wsize || (_out !== strm.avail_out && state.mode < BAD &&
                        (state.mode < CHECK || flush !== Z_FINISH))) {
      if (updatewindow(strm, strm.output, strm.next_out, _out - strm.avail_out)) {
        state.mode = MEM;
        return Z_MEM_ERROR;
      }
    }
    _in -= strm.avail_in;
    _out -= strm.avail_out;
    strm.total_in += _in;
    strm.total_out += _out;
    state.total += _out;
    if (state.wrap && _out) {
      strm.adler = state.check = /*UPDATE(state.check, strm.next_out - _out, _out);*/
        (state.flags ? crc32(state.check, output, _out, strm.next_out - _out) : adler32(state.check, output, _out, strm.next_out - _out));
    }
    strm.data_type = state.bits + (state.last ? 64 : 0) +
                      (state.mode === TYPE ? 128 : 0) +
                      (state.mode === LEN_ || state.mode === COPY_ ? 256 : 0);
    if (((_in === 0 && _out === 0) || flush === Z_FINISH) && ret === Z_OK) {
      ret = Z_BUF_ERROR;
    }
    return ret;
  }

  function inflateEnd(strm) {

    if (!strm || !strm.state /*|| strm->zfree == (free_func)0*/) {
      return Z_STREAM_ERROR;
    }

    var state = strm.state;
    if (state.window) {
      state.window = null;
    }
    strm.state = null;
    return Z_OK;
  }

  function inflateGetHeader(strm, head) {
    var state;

    /* check state */
    if (!strm || !strm.state) { return Z_STREAM_ERROR; }
    state = strm.state;
    if ((state.wrap & 2) === 0) { return Z_STREAM_ERROR; }

    /* save header structure */
    state.head = head;
    head.done = false;
    return Z_OK;
  }

  function inflateSetDictionary(strm, dictionary) {
    var dictLength = dictionary.length;

    var state;
    var dictid;
    var ret;

    /* check state */
    if (!strm /* == Z_NULL */ || !strm.state /* == Z_NULL */) { return Z_STREAM_ERROR; }
    state = strm.state;

    if (state.wrap !== 0 && state.mode !== DICT) {
      return Z_STREAM_ERROR;
    }

    /* check for correct dictionary identifier */
    if (state.mode === DICT) {
      dictid = 1; /* adler32(0, null, 0)*/
      /* dictid = adler32(dictid, dictionary, dictLength); */
      dictid = adler32(dictid, dictionary, dictLength, 0);
      if (dictid !== state.check) {
        return Z_DATA_ERROR;
      }
    }
    /* copy dictionary to window using updatewindow(), which will amend the
     existing dictionary if appropriate */
    ret = updatewindow(strm, dictionary, dictLength, dictLength);
    if (ret) {
      state.mode = MEM;
      return Z_MEM_ERROR;
    }
    state.havedict = 1;
    // Tracev((stderr, "inflate:   dictionary set\n"));
    return Z_OK;
  }

  exports.inflateReset = inflateReset;
  exports.inflateReset2 = inflateReset2;
  exports.inflateResetKeep = inflateResetKeep;
  exports.inflateInit = inflateInit;
  exports.inflateInit2 = inflateInit2;
  exports.inflate = inflate;
  exports.inflateEnd = inflateEnd;
  exports.inflateGetHeader = inflateGetHeader;
  exports.inflateSetDictionary = inflateSetDictionary;
  exports.inflateInfo = 'pako inflate (from Nodeca project)';

  /* Not implemented
  exports.inflateCopy = inflateCopy;
  exports.inflateGetDictionary = inflateGetDictionary;
  exports.inflateMark = inflateMark;
  exports.inflatePrime = inflatePrime;
  exports.inflateSync = inflateSync;
  exports.inflateSyncPoint = inflateSyncPoint;
  exports.inflateUndermine = inflateUndermine;
  */

  },{"../utils/common":1,"./adler32":3,"./crc32":5,"./inffast":7,"./inftrees":9}],9:[function(require,module,exports){
  'use strict';

  // (C) 1995-2013 Jean-loup Gailly and Mark Adler
  // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin
  //
  // This software is provided 'as-is', without any express or implied
  // warranty. In no event will the authors be held liable for any damages
  // arising from the use of this software.
  //
  // Permission is granted to anyone to use this software for any purpose,
  // including commercial applications, and to alter it and redistribute it
  // freely, subject to the following restrictions:
  //
  // 1. The origin of this software must not be misrepresented; you must not
  //   claim that you wrote the original software. If you use this software
  //   in a product, an acknowledgment in the product documentation would be
  //   appreciated but is not required.
  // 2. Altered source versions must be plainly marked as such, and must not be
  //   misrepresented as being the original software.
  // 3. This notice may not be removed or altered from any source distribution.

  var utils = require('../utils/common');

  var MAXBITS = 15;
  var ENOUGH_LENS = 852;
  var ENOUGH_DISTS = 592;
  //var ENOUGH = (ENOUGH_LENS+ENOUGH_DISTS);

  var CODES = 0;
  var LENS = 1;
  var DISTS = 2;

  var lbase = [ /* Length codes 257..285 base */
    3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31,
    35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0
  ];

  var lext = [ /* Length codes 257..285 extra */
    16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18,
    19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 72, 78
  ];

  var dbase = [ /* Distance codes 0..29 base */
    1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,
    257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,
    8193, 12289, 16385, 24577, 0, 0
  ];

  var dext = [ /* Distance codes 0..29 extra */
    16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22,
    23, 23, 24, 24, 25, 25, 26, 26, 27, 27,
    28, 28, 29, 29, 64, 64
  ];

  module.exports = function inflate_table(type, lens, lens_index, codes, table, table_index, work, opts)
  {
    var bits = opts.bits;
        //here = opts.here; /* table entry for duplication */

    var len = 0;               /* a code's length in bits */
    var sym = 0;               /* index of code symbols */
    var min = 0, max = 0;          /* minimum and maximum code lengths */
    var root = 0;              /* number of index bits for root table */
    var curr = 0;              /* number of index bits for current table */
    var drop = 0;              /* code bits to drop for sub-table */
    var left = 0;                   /* number of prefix codes available */
    var used = 0;              /* code entries in table used */
    var huff = 0;              /* Huffman code */
    var incr;              /* for incrementing code, index */
    var fill;              /* index for replicating entries */
    var low;               /* low bits for current root entry */
    var mask;              /* mask for low root bits */
    var next;             /* next available space in table */
    var base = null;     /* base value table to use */
    var base_index = 0;
  //  var shoextra;    /* extra bits table to use */
    var end;                    /* use base and extra for symbol > end */
    var count = new utils.Buf16(MAXBITS + 1); //[MAXBITS+1];    /* number of codes of each length */
    var offs = new utils.Buf16(MAXBITS + 1); //[MAXBITS+1];     /* offsets in table for each length */
    var extra = null;
    var extra_index = 0;

    var here_bits, here_op, here_val;

    /*
     Process a set of code lengths to create a canonical Huffman code.  The
     code lengths are lens[0..codes-1].  Each length corresponds to the
     symbols 0..codes-1.  The Huffman code is generated by first sorting the
     symbols by length from short to long, and retaining the symbol order
     for codes with equal lengths.  Then the code starts with all zero bits
     for the first code of the shortest length, and the codes are integer
     increments for the same length, and zeros are appended as the length
     increases.  For the deflate format, these bits are stored backwards
     from their more natural integer increment ordering, and so when the
     decoding tables are built in the large loop below, the integer codes
     are incremented backwards.

     This routine assumes, but does not check, that all of the entries in
     lens[] are in the range 0..MAXBITS.  The caller must assure this.
     1..MAXBITS is interpreted as that code length.  zero means that that
     symbol does not occur in this code.

     The codes are sorted by computing a count of codes for each length,
     creating from that a table of starting indices for each length in the
     sorted table, and then entering the symbols in order in the sorted
     table.  The sorted table is work[], with that space being provided by
     the caller.

     The length counts are used for other purposes as well, i.e. finding
     the minimum and maximum length codes, determining if there are any
     codes at all, checking for a valid set of lengths, and looking ahead
     at length counts to determine sub-table sizes when building the
     decoding tables.
     */

    /* accumulate lengths for codes (assumes lens[] all in 0..MAXBITS) */
    for (len = 0; len <= MAXBITS; len++) {
      count[len] = 0;
    }
    for (sym = 0; sym < codes; sym++) {
      count[lens[lens_index + sym]]++;
    }

    /* bound code lengths, force root to be within code lengths */
    root = bits;
    for (max = MAXBITS; max >= 1; max--) {
      if (count[max] !== 0) { break; }
    }
    if (root > max) {
      root = max;
    }
    if (max === 0) {                     /* no symbols to code at all */
      //table.op[opts.table_index] = 64;  //here.op = (var char)64;    /* invalid code marker */
      //table.bits[opts.table_index] = 1;   //here.bits = (var char)1;
      //table.val[opts.table_index++] = 0;   //here.val = (var short)0;
      table[table_index++] = (1 << 24) | (64 << 16) | 0;


      //table.op[opts.table_index] = 64;
      //table.bits[opts.table_index] = 1;
      //table.val[opts.table_index++] = 0;
      table[table_index++] = (1 << 24) | (64 << 16) | 0;

      opts.bits = 1;
      return 0;     /* no symbols, but wait for decoding to report error */
    }
    for (min = 1; min < max; min++) {
      if (count[min] !== 0) { break; }
    }
    if (root < min) {
      root = min;
    }

    /* check for an over-subscribed or incomplete set of lengths */
    left = 1;
    for (len = 1; len <= MAXBITS; len++) {
      left <<= 1;
      left -= count[len];
      if (left < 0) {
        return -1;
      }        /* over-subscribed */
    }
    if (left > 0 && (type === CODES || max !== 1)) {
      return -1;                      /* incomplete set */
    }

    /* generate offsets into symbol table for each length for sorting */
    offs[1] = 0;
    for (len = 1; len < MAXBITS; len++) {
      offs[len + 1] = offs[len] + count[len];
    }

    /* sort symbols by length, by symbol order within each length */
    for (sym = 0; sym < codes; sym++) {
      if (lens[lens_index + sym] !== 0) {
        work[offs[lens[lens_index + sym]]++] = sym;
      }
    }

    /*
     Create and fill in decoding tables.  In this loop, the table being
     filled is at next and has curr index bits.  The code being used is huff
     with length len.  That code is converted to an index by dropping drop
     bits off of the bottom.  For codes where len is less than drop + curr,
     those top drop + curr - len bits are incremented through all values to
     fill the table with replicated entries.

     root is the number of index bits for the root table.  When len exceeds
     root, sub-tables are created pointed to by the root entry with an index
     of the low root bits of huff.  This is saved in low to check for when a
     new sub-table should be started.  drop is zero when the root table is
     being filled, and drop is root when sub-tables are being filled.

     When a new sub-table is needed, it is necessary to look ahead in the
     code lengths to determine what size sub-table is needed.  The length
     counts are used for this, and so count[] is decremented as codes are
     entered in the tables.

     used keeps track of how many table entries have been allocated from the
     provided *table space.  It is checked for LENS and DIST tables against
     the constants ENOUGH_LENS and ENOUGH_DISTS to guard against changes in
     the initial root table size constants.  See the comments in inftrees.h
     for more information.

     sym increments through all symbols, and the loop terminates when
     all codes of length max, i.e. all codes, have been processed.  This
     routine permits incomplete codes, so another loop after this one fills
     in the rest of the decoding tables with invalid code markers.
     */

    /* set up for code type */
    // poor man optimization - use if-else instead of switch,
    // to avoid deopts in old v8
    if (type === CODES) {
      base = extra = work;    /* dummy value--not used */
      end = 19;

    } else if (type === LENS) {
      base = lbase;
      base_index -= 257;
      extra = lext;
      extra_index -= 257;
      end = 256;

    } else {                    /* DISTS */
      base = dbase;
      extra = dext;
      end = -1;
    }

    /* initialize opts for loop */
    huff = 0;                   /* starting code */
    sym = 0;                    /* starting code symbol */
    len = min;                  /* starting code length */
    next = table_index;              /* current table to fill in */
    curr = root;                /* current table index bits */
    drop = 0;                   /* current bits to drop from code for index */
    low = -1;                   /* trigger new sub-table when len > root */
    used = 1 << root;          /* use root table entries */
    mask = used - 1;            /* mask for comparing low */

    /* check available table space */
    if ((type === LENS && used > ENOUGH_LENS) ||
      (type === DISTS && used > ENOUGH_DISTS)) {
      return 1;
    }

    /* process all codes and make table entries */
    for (;;) {
      /* create table entry */
      here_bits = len - drop;
      if (work[sym] < end) {
        here_op = 0;
        here_val = work[sym];
      }
      else if (work[sym] > end) {
        here_op = extra[extra_index + work[sym]];
        here_val = base[base_index + work[sym]];
      }
      else {
        here_op = 32 + 64;         /* end of block */
        here_val = 0;
      }

      /* replicate for those indices with low len bits equal to huff */
      incr = 1 << (len - drop);
      fill = 1 << curr;
      min = fill;                 /* save offset to next table */
      do {
        fill -= incr;
        table[next + (huff >> drop) + fill] = (here_bits << 24) | (here_op << 16) | here_val |0;
      } while (fill !== 0);

      /* backwards increment the len-bit code huff */
      incr = 1 << (len - 1);
      while (huff & incr) {
        incr >>= 1;
      }
      if (incr !== 0) {
        huff &= incr - 1;
        huff += incr;
      } else {
        huff = 0;
      }

      /* go to next symbol, update count, len */
      sym++;
      if (--count[len] === 0) {
        if (len === max) { break; }
        len = lens[lens_index + work[sym]];
      }

      /* create new sub-table if needed */
      if (len > root && (huff & mask) !== low) {
        /* if first time, transition to sub-tables */
        if (drop === 0) {
          drop = root;
        }

        /* increment past last table */
        next += min;            /* here min is 1 << curr */

        /* determine length of next table */
        curr = len - drop;
        left = 1 << curr;
        while (curr + drop < max) {
          left -= count[curr + drop];
          if (left <= 0) { break; }
          curr++;
          left <<= 1;
        }

        /* check for enough space */
        used += 1 << curr;
        if ((type === LENS && used > ENOUGH_LENS) ||
          (type === DISTS && used > ENOUGH_DISTS)) {
          return 1;
        }

        /* point entry in root table to sub-table */
        low = huff & mask;
        /*table.op[low] = curr;
        table.bits[low] = root;
        table.val[low] = next - opts.table_index;*/
        table[low] = (root << 24) | (curr << 16) | (next - table_index) |0;
      }
    }

    /* fill in remaining table entry if code is incomplete (guaranteed to have
     at most one remaining entry, since if the code is incomplete, the
     maximum code length that was allowed to get this far is one bit) */
    if (huff !== 0) {
      //table.op[next + huff] = 64;            /* invalid code marker */
      //table.bits[next + huff] = len - drop;
      //table.val[next + huff] = 0;
      table[next + huff] = ((len - drop) << 24) | (64 << 16) |0;
    }

    /* set return parameters */
    //opts.table_index += used;
    opts.bits = root;
    return 0;
  };

  },{"../utils/common":1}],10:[function(require,module,exports){
  'use strict';

  // (C) 1995-2013 Jean-loup Gailly and Mark Adler
  // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin
  //
  // This software is provided 'as-is', without any express or implied
  // warranty. In no event will the authors be held liable for any damages
  // arising from the use of this software.
  //
  // Permission is granted to anyone to use this software for any purpose,
  // including commercial applications, and to alter it and redistribute it
  // freely, subject to the following restrictions:
  //
  // 1. The origin of this software must not be misrepresented; you must not
  //   claim that you wrote the original software. If you use this software
  //   in a product, an acknowledgment in the product documentation would be
  //   appreciated but is not required.
  // 2. Altered source versions must be plainly marked as such, and must not be
  //   misrepresented as being the original software.
  // 3. This notice may not be removed or altered from any source distribution.

  module.exports = {
    2:      'need dictionary',     /* Z_NEED_DICT       2  */
    1:      'stream end',          /* Z_STREAM_END      1  */
    0:      '',                    /* Z_OK              0  */
    '-1':   'file error',          /* Z_ERRNO         (-1) */
    '-2':   'stream error',        /* Z_STREAM_ERROR  (-2) */
    '-3':   'data error',          /* Z_DATA_ERROR    (-3) */
    '-4':   'insufficient memory', /* Z_MEM_ERROR     (-4) */
    '-5':   'buffer error',        /* Z_BUF_ERROR     (-5) */
    '-6':   'incompatible version' /* Z_VERSION_ERROR (-6) */
  };

  },{}],11:[function(require,module,exports){
  'use strict';

  // (C) 1995-2013 Jean-loup Gailly and Mark Adler
  // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin
  //
  // This software is provided 'as-is', without any express or implied
  // warranty. In no event will the authors be held liable for any damages
  // arising from the use of this software.
  //
  // Permission is granted to anyone to use this software for any purpose,
  // including commercial applications, and to alter it and redistribute it
  // freely, subject to the following restrictions:
  //
  // 1. The origin of this software must not be misrepresented; you must not
  //   claim that you wrote the original software. If you use this software
  //   in a product, an acknowledgment in the product documentation would be
  //   appreciated but is not required.
  // 2. Altered source versions must be plainly marked as such, and must not be
  //   misrepresented as being the original software.
  // 3. This notice may not be removed or altered from any source distribution.

  function ZStream() {
    /* next input byte */
    this.input = null; // JS specific, because we have no pointers
    this.next_in = 0;
    /* number of bytes available at input */
    this.avail_in = 0;
    /* total number of input bytes read so far */
    this.total_in = 0;
    /* next output byte should be put there */
    this.output = null; // JS specific, because we have no pointers
    this.next_out = 0;
    /* remaining free space at output */
    this.avail_out = 0;
    /* total number of bytes output so far */
    this.total_out = 0;
    /* last error message, NULL if no error */
    this.msg = ''/*Z_NULL*/;
    /* not visible by applications */
    this.state = null;
    /* best guess about the data type: binary or text */
    this.data_type = 2/*Z_UNKNOWN*/;
    /* adler32 value of the uncompressed data */
    this.adler = 0;
  }

  module.exports = ZStream;

  },{}],"/lib/inflate.js":[function(require,module,exports){
  'use strict';


  var zlib_inflate = require('./zlib/inflate');
  var utils        = require('./utils/common');
  var strings      = require('./utils/strings');
  var c            = require('./zlib/constants');
  var msg          = require('./zlib/messages');
  var ZStream      = require('./zlib/zstream');
  var GZheader     = require('./zlib/gzheader');

  var toString = Object.prototype.toString;

  /**
   * class Inflate
   *
   * Generic JS-style wrapper for zlib calls. If you don't need
   * streaming behaviour - use more simple functions: [[inflate]]
   * and [[inflateRaw]].
   **/

  /* internal
   * inflate.chunks -> Array
   *
   * Chunks of output data, if [[Inflate#onData]] not overridden.
   **/

  /**
   * Inflate.result -> Uint8Array|Array|String
   *
   * Uncompressed result, generated by default [[Inflate#onData]]
   * and [[Inflate#onEnd]] handlers. Filled after you push last chunk
   * (call [[Inflate#push]] with `Z_FINISH` / `true` param) or if you
   * push a chunk with explicit flush (call [[Inflate#push]] with
   * `Z_SYNC_FLUSH` param).
   **/

  /**
   * Inflate.err -> Number
   *
   * Error code after inflate finished. 0 (Z_OK) on success.
   * Should be checked if broken data possible.
   **/

  /**
   * Inflate.msg -> String
   *
   * Error message, if [[Inflate.err]] != 0
   **/


  /**
   * new Inflate(options)
   * - options (Object): zlib inflate options.
   *
   * Creates new inflator instance with specified params. Throws exception
   * on bad params. Supported options:
   *
   * - `windowBits`
   * - `dictionary`
   *
   * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced)
   * for more information on these.
   *
   * Additional options, for internal needs:
   *
   * - `chunkSize` - size of generated data chunks (16K by default)
   * - `raw` (Boolean) - do raw inflate
   * - `to` (String) - if equal to 'string', then result will be converted
   *   from utf8 to utf16 (javascript) string. When string output requested,
   *   chunk length can differ from `chunkSize`, depending on content.
   *
   * By default, when no options set, autodetect deflate/gzip data format via
   * wrapper header.
   *
   * ##### Example:
   *
   * ```javascript
   * var pako = require('pako')
   *   , chunk1 = Uint8Array([1,2,3,4,5,6,7,8,9])
   *   , chunk2 = Uint8Array([10,11,12,13,14,15,16,17,18,19]);
   *
   * var inflate = new pako.Inflate({ level: 3});
   *
   * inflate.push(chunk1, false);
   * inflate.push(chunk2, true);  // true -> last chunk
   *
   * if (inflate.err) { throw new Error(inflate.err); }
   *
   * console.log(inflate.result);
   * ```
   **/
  function Inflate(options) {
    if (!(this instanceof Inflate)) return new Inflate(options);

    this.options = utils.assign({
      chunkSize: 16384,
      windowBits: 0,
      to: ''
    }, options || {});

    var opt = this.options;

    // Force window size for `raw` data, if not set directly,
    // because we have no header for autodetect.
    if (opt.raw && (opt.windowBits >= 0) && (opt.windowBits < 16)) {
      opt.windowBits = -opt.windowBits;
      if (opt.windowBits === 0) { opt.windowBits = -15; }
    }

    // If `windowBits` not defined (and mode not raw) - set autodetect flag for gzip/deflate
    if ((opt.windowBits >= 0) && (opt.windowBits < 16) &&
        !(options && options.windowBits)) {
      opt.windowBits += 32;
    }

    // Gzip header has no info about windows size, we can do autodetect only
    // for deflate. So, if window size not set, force it to max when gzip possible
    if ((opt.windowBits > 15) && (opt.windowBits < 48)) {
      // bit 3 (16) -> gzipped data
      // bit 4 (32) -> autodetect gzip/deflate
      if ((opt.windowBits & 15) === 0) {
        opt.windowBits |= 15;
      }
    }

    this.err    = 0;      // error code, if happens (0 = Z_OK)
    this.msg    = '';     // error message
    this.ended  = false;  // used to avoid multiple onEnd() calls
    this.chunks = [];     // chunks of compressed data

    this.strm   = new ZStream();
    this.strm.avail_out = 0;

    var status  = zlib_inflate.inflateInit2(
      this.strm,
      opt.windowBits
    );

    if (status !== c.Z_OK) {
      throw new Error(msg[status]);
    }

    this.header = new GZheader();

    zlib_inflate.inflateGetHeader(this.strm, this.header);

    // Setup dictionary
    if (opt.dictionary) {
      // Convert data if needed
      if (typeof opt.dictionary === 'string') {
        opt.dictionary = strings.string2buf(opt.dictionary);
      } else if (toString.call(opt.dictionary) === '[object ArrayBuffer]') {
        opt.dictionary = new Uint8Array(opt.dictionary);
      }
      if (opt.raw) { //In raw mode we need to set the dictionary early
        status = zlib_inflate.inflateSetDictionary(this.strm, opt.dictionary);
        if (status !== c.Z_OK) {
          throw new Error(msg[status]);
        }
      }
    }
  }

  /**
   * Inflate#push(data[, mode]) -> Boolean
   * - data (Uint8Array|Array|ArrayBuffer|String): input data
   * - mode (Number|Boolean): 0..6 for corresponding Z_NO_FLUSH..Z_TREE modes.
   *   See constants. Skipped or `false` means Z_NO_FLUSH, `true` means Z_FINISH.
   *
   * Sends input data to inflate pipe, generating [[Inflate#onData]] calls with
   * new output chunks. Returns `true` on success. The last data block must have
   * mode Z_FINISH (or `true`). That will flush internal pending buffers and call
   * [[Inflate#onEnd]]. For interim explicit flushes (without ending the stream) you
   * can use mode Z_SYNC_FLUSH, keeping the decompression context.
   *
   * On fail call [[Inflate#onEnd]] with error code and return false.
   *
   * We strongly recommend to use `Uint8Array` on input for best speed (output
   * format is detected automatically). Also, don't skip last param and always
   * use the same type in your code (boolean or number). That will improve JS speed.
   *
   * For regular `Array`-s make sure all elements are [0..255].
   *
   * ##### Example
   *
   * ```javascript
   * push(chunk, false); // push one of data chunks
   * ...
   * push(chunk, true);  // push last chunk
   * ```
   **/
  Inflate.prototype.push = function (data, mode) {
    var strm = this.strm;
    var chunkSize = this.options.chunkSize;
    var dictionary = this.options.dictionary;
    var status, _mode;
    var next_out_utf8, tail, utf8str;

    // Flag to properly process Z_BUF_ERROR on testing inflate call
    // when we check that all output data was flushed.
    var allowBufError = false;

    if (this.ended) { return false; }
    _mode = (mode === ~~mode) ? mode : ((mode === true) ? c.Z_FINISH : c.Z_NO_FLUSH);

    // Convert data if needed
    if (typeof data === 'string') {
      // Only binary strings can be decompressed on practice
      strm.input = strings.binstring2buf(data);
    } else if (toString.call(data) === '[object ArrayBuffer]') {
      strm.input = new Uint8Array(data);
    } else {
      strm.input = data;
    }

    strm.next_in = 0;
    strm.avail_in = strm.input.length;

    do {
      if (strm.avail_out === 0) {
        strm.output = new utils.Buf8(chunkSize);
        strm.next_out = 0;
        strm.avail_out = chunkSize;
      }

      status = zlib_inflate.inflate(strm, c.Z_NO_FLUSH);    /* no bad return value */

      if (status === c.Z_NEED_DICT && dictionary) {
        status = zlib_inflate.inflateSetDictionary(this.strm, dictionary);
      }

      if (status === c.Z_BUF_ERROR && allowBufError === true) {
        status = c.Z_OK;
        allowBufError = false;
      }

      if (status !== c.Z_STREAM_END && status !== c.Z_OK) {
        this.onEnd(status);
        this.ended = true;
        return false;
      }

      if (strm.next_out) {
        if (strm.avail_out === 0 || status === c.Z_STREAM_END || (strm.avail_in === 0 && (_mode === c.Z_FINISH || _mode === c.Z_SYNC_FLUSH))) {

          if (this.options.to === 'string') {

            next_out_utf8 = strings.utf8border(strm.output, strm.next_out);

            tail = strm.next_out - next_out_utf8;
            utf8str = strings.buf2string(strm.output, next_out_utf8);

            // move tail
            strm.next_out = tail;
            strm.avail_out = chunkSize - tail;
            if (tail) { utils.arraySet(strm.output, strm.output, next_out_utf8, tail, 0); }

            this.onData(utf8str);

          } else {
            this.onData(utils.shrinkBuf(strm.output, strm.next_out));
          }
        }
      }

      // When no more input data, we should check that internal inflate buffers
      // are flushed. The only way to do it when avail_out = 0 - run one more
      // inflate pass. But if output data not exists, inflate return Z_BUF_ERROR.
      // Here we set flag to process this error properly.
      //
      // NOTE. Deflate does not return error in this case and does not needs such
      // logic.
      if (strm.avail_in === 0 && strm.avail_out === 0) {
        allowBufError = true;
      }

    } while ((strm.avail_in > 0 || strm.avail_out === 0) && status !== c.Z_STREAM_END);

    if (status === c.Z_STREAM_END) {
      _mode = c.Z_FINISH;
    }

    // Finalize on the last chunk.
    if (_mode === c.Z_FINISH) {
      status = zlib_inflate.inflateEnd(this.strm);
      this.onEnd(status);
      this.ended = true;
      return status === c.Z_OK;
    }

    // callback interim results if Z_SYNC_FLUSH.
    if (_mode === c.Z_SYNC_FLUSH) {
      this.onEnd(c.Z_OK);
      strm.avail_out = 0;
      return true;
    }

    return true;
  };


  /**
   * Inflate#onData(chunk) -> Void
   * - chunk (Uint8Array|Array|String): output data. Type of array depends
   *   on js engine support. When string output requested, each chunk
   *   will be string.
   *
   * By default, stores data blocks in `chunks[]` property and glue
   * those in `onEnd`. Override this handler, if you need another behaviour.
   **/
  Inflate.prototype.onData = function (chunk) {
    this.chunks.push(chunk);
  };


  /**
   * Inflate#onEnd(status) -> Void
   * - status (Number): inflate status. 0 (Z_OK) on success,
   *   other if not.
   *
   * Called either after you tell inflate that the input stream is
   * complete (Z_FINISH) or should be flushed (Z_SYNC_FLUSH)
   * or if an error happened. By default - join collected chunks,
   * free memory and fill `results` / `err` properties.
   **/
  Inflate.prototype.onEnd = function (status) {
    // On success - join
    if (status === c.Z_OK) {
      if (this.options.to === 'string') {
        // Glue & convert here, until we teach pako to send
        // utf8 aligned strings to onData
        this.result = this.chunks.join('');
      } else {
        this.result = utils.flattenChunks(this.chunks);
      }
    }
    this.chunks = [];
    this.err = status;
    this.msg = this.strm.msg;
  };


  /**
   * inflate(data[, options]) -> Uint8Array|Array|String
   * - data (Uint8Array|Array|String): input data to decompress.
   * - options (Object): zlib inflate options.
   *
   * Decompress `data` with inflate/ungzip and `options`. Autodetect
   * format via wrapper header by default. That's why we don't provide
   * separate `ungzip` method.
   *
   * Supported options are:
   *
   * - windowBits
   *
   * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced)
   * for more information.
   *
   * Sugar (options):
   *
   * - `raw` (Boolean) - say that we work with raw stream, if you don't wish to specify
   *   negative windowBits implicitly.
   * - `to` (String) - if equal to 'string', then result will be converted
   *   from utf8 to utf16 (javascript) string. When string output requested,
   *   chunk length can differ from `chunkSize`, depending on content.
   *
   *
   * ##### Example:
   *
   * ```javascript
   * var pako = require('pako')
   *   , input = pako.deflate([1,2,3,4,5,6,7,8,9])
   *   , output;
   *
   * try {
   *   output = pako.inflate(input);
   * } catch (err)
   *   console.log(err);
   * }
   * ```
   **/
  function inflate(input, options) {
    var inflator = new Inflate(options);

    inflator.push(input, true);

    // That will never happens, if you don't cheat with options :)
    if (inflator.err) { throw inflator.msg || msg[inflator.err]; }

    return inflator.result;
  }


  /**
   * inflateRaw(data[, options]) -> Uint8Array|Array|String
   * - data (Uint8Array|Array|String): input data to decompress.
   * - options (Object): zlib inflate options.
   *
   * The same as [[inflate]], but creates raw data, without wrapper
   * (header and adler32 crc).
   **/
  function inflateRaw(input, options) {
    options = options || {};
    options.raw = true;
    return inflate(input, options);
  }


  /**
   * ungzip(data[, options]) -> Uint8Array|Array|String
   * - data (Uint8Array|Array|String): input data to decompress.
   * - options (Object): zlib inflate options.
   *
   * Just shortcut to [[inflate]], because it autodetects format
   * by header.content. Done for convenience.
   **/


  exports.Inflate = Inflate;
  exports.inflate = inflate;
  exports.inflateRaw = inflateRaw;
  exports.ungzip  = inflate;

  },{"./utils/common":1,"./utils/strings":2,"./zlib/constants":4,"./zlib/gzheader":6,"./zlib/inflate":8,"./zlib/messages":10,"./zlib/zstream":11}]},{},[])("/lib/inflate.js")
  });
/* eslint-enable */


/***/ }),

/***/ 6087:
/***/ ((module) => {

"use strict";
module.exports = window["wp"]["element"];

/***/ }),

/***/ 7143:
/***/ ((module) => {

"use strict";
module.exports = window["wp"]["data"];

/***/ }),

/***/ 7734:
/***/ ((module) => {

"use strict";


// do not edit .js files directly - edit src/index.jst


  var envHasBigInt64Array = typeof BigInt64Array !== 'undefined';


module.exports = function equal(a, b) {
  if (a === b) return true;

  if (a && b && typeof a == 'object' && typeof b == 'object') {
    if (a.constructor !== b.constructor) return false;

    var length, i, keys;
    if (Array.isArray(a)) {
      length = a.length;
      if (length != b.length) return false;
      for (i = length; i-- !== 0;)
        if (!equal(a[i], b[i])) return false;
      return true;
    }


    if ((a instanceof Map) && (b instanceof Map)) {
      if (a.size !== b.size) return false;
      for (i of a.entries())
        if (!b.has(i[0])) return false;
      for (i of a.entries())
        if (!equal(i[1], b.get(i[0]))) return false;
      return true;
    }

    if ((a instanceof Set) && (b instanceof Set)) {
      if (a.size !== b.size) return false;
      for (i of a.entries())
        if (!b.has(i[0])) return false;
      return true;
    }

    if (ArrayBuffer.isView(a) && ArrayBuffer.isView(b)) {
      length = a.length;
      if (length != b.length) return false;
      for (i = length; i-- !== 0;)
        if (a[i] !== b[i]) return false;
      return true;
    }


    if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags;
    if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf();
    if (a.toString !== Object.prototype.toString) return a.toString() === b.toString();

    keys = Object.keys(a);
    length = keys.length;
    if (length !== Object.keys(b).length) return false;

    for (i = length; i-- !== 0;)
      if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false;

    for (i = length; i-- !== 0;) {
      var key = keys[i];

      if (!equal(a[key], b[key])) return false;
    }

    return true;
  }

  // true if both NaN, false otherwise
  return a!==a && b!==b;
};


/***/ }),

/***/ 7951:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";

// EXPORTS
__webpack_require__.d(__webpack_exports__, {
  loadView: () => (/* reexport */ loadView),
  useView: () => (/* reexport */ useView)
});

;// ./node_modules/dequal/dist/index.mjs
var has = Object.prototype.hasOwnProperty;

function find(iter, tar, key) {
	for (key of iter.keys()) {
		if (dequal(key, tar)) return key;
	}
}

function dequal(foo, bar) {
	var ctor, len, tmp;
	if (foo === bar) return true;

	if (foo && bar && (ctor=foo.constructor) === bar.constructor) {
		if (ctor === Date) return foo.getTime() === bar.getTime();
		if (ctor === RegExp) return foo.toString() === bar.toString();

		if (ctor === Array) {
			if ((len=foo.length) === bar.length) {
				while (len-- && dequal(foo[len], bar[len]));
			}
			return len === -1;
		}

		if (ctor === Set) {
			if (foo.size !== bar.size) {
				return false;
			}
			for (len of foo) {
				tmp = len;
				if (tmp && typeof tmp === 'object') {
					tmp = find(bar, tmp);
					if (!tmp) return false;
				}
				if (!bar.has(tmp)) return false;
			}
			return true;
		}

		if (ctor === Map) {
			if (foo.size !== bar.size) {
				return false;
			}
			for (len of foo) {
				tmp = len[0];
				if (tmp && typeof tmp === 'object') {
					tmp = find(bar, tmp);
					if (!tmp) return false;
				}
				if (!dequal(len[1], bar.get(tmp))) {
					return false;
				}
			}
			return true;
		}

		if (ctor === ArrayBuffer) {
			foo = new Uint8Array(foo);
			bar = new Uint8Array(bar);
		} else if (ctor === DataView) {
			if ((len=foo.byteLength) === bar.byteLength) {
				while (len-- && foo.getInt8(len) === bar.getInt8(len));
			}
			return len === -1;
		}

		if (ArrayBuffer.isView(foo)) {
			if ((len=foo.byteLength) === bar.byteLength) {
				while (len-- && foo[len] === bar[len]);
			}
			return len === -1;
		}

		if (!ctor || typeof foo === 'object') {
			len = 0;
			for (ctor in foo) {
				if (has.call(foo, ctor) && ++len && !has.call(bar, ctor)) return false;
				if (!(ctor in bar) || !dequal(foo[ctor], bar[ctor])) return false;
			}
			return Object.keys(bar).length === len;
		}
	}

	return foo !== foo && bar !== bar;
}

;// ./node_modules/@wordpress/views/build-module/preference-keys.js
function generatePreferenceKey(kind, name, slug) {
  return `dataviews-${kind}-${name}-${slug}`;
}


// EXTERNAL MODULE: external ["wp","element"]
var external_wp_element_ = __webpack_require__(6087);
// EXTERNAL MODULE: external ["wp","data"]
var external_wp_data_ = __webpack_require__(7143);
// EXTERNAL MODULE: external ["wp","preferences"]
var external_wp_preferences_ = __webpack_require__(1233);
;// ./node_modules/@wordpress/views/build-module/use-view.js





function omit(obj, keys) {
  const result = { ...obj };
  for (const key of keys) {
    delete result[key];
  }
  return result;
}
function useView(config) {
  const { kind, name, slug, defaultView, queryParams, onChangeQueryParams } = config;
  const preferenceKey = generatePreferenceKey(kind, name, slug);
  const persistedView = (0,external_wp_data_.useSelect)(
    (select) => {
      return select(external_wp_preferences_.store).get(
        "core/views",
        preferenceKey
      );
    },
    [preferenceKey]
  );
  const { set } = (0,external_wp_data_.useDispatch)(external_wp_preferences_.store);
  const baseView = persistedView ?? defaultView;
  const page = Number(queryParams?.page ?? baseView.page ?? 1);
  const search = queryParams?.search ?? baseView.search ?? "";
  const view = (0,external_wp_element_.useMemo)(() => {
    return {
      ...baseView,
      page,
      search
    };
  }, [baseView, page, search]);
  const isModified = !!persistedView;
  const updateView = (0,external_wp_element_.useCallback)(
    (newView) => {
      const urlParams = {
        page: newView?.page,
        search: newView?.search
      };
      const preferenceView = omit(newView, ["page", "search"]);
      if (onChangeQueryParams && !dequal(urlParams, { page, search })) {
        onChangeQueryParams(urlParams);
      }
      if (!dequal(baseView, preferenceView)) {
        if (dequal(preferenceView, defaultView)) {
          set("core/views", preferenceKey, void 0);
        } else {
          set("core/views", preferenceKey, preferenceView);
        }
      }
    },
    [
      onChangeQueryParams,
      page,
      search,
      baseView,
      defaultView,
      set,
      preferenceKey
    ]
  );
  const resetToDefault = (0,external_wp_element_.useCallback)(() => {
    set("core/views", preferenceKey, void 0);
  }, [preferenceKey, set]);
  return {
    view,
    isModified,
    updateView,
    resetToDefault
  };
}


;// ./node_modules/@wordpress/views/build-module/load-view.js



async function loadView(config) {
  const { kind, name, slug, defaultView, queryParams } = config;
  const preferenceKey = generatePreferenceKey(kind, name, slug);
  const persistedView = (0,external_wp_data_.select)(external_wp_preferences_.store).get(
    "core/views",
    preferenceKey
  );
  const baseView = persistedView ?? defaultView;
  const page = queryParams?.page ?? 1;
  const search = queryParams?.search ?? "";
  return {
    ...baseView,
    page,
    search
  };
}


;// ./node_modules/@wordpress/views/build-module/index.js





/***/ }),

/***/ 8572:
/***/ ((module) => {

/**
 * Credits:
 *
 * lib-font
 * https://github.com/Pomax/lib-font
 * https://github.com/Pomax/lib-font/blob/master/lib/unbrotli.js
 *
 * The MIT License (MIT)
 *
 * Copyright (c) 2020 pomax@nihongoresources.com
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in all
 * copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 */

/* eslint eslint-comments/no-unlimited-disable: 0 */
/* eslint-disable */
(function(f){if(true){module.exports=f()}else { var g; }})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c=undefined;if(!f&&c)return require(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u=undefined,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
/* Copyright 2013 Google Inc. All Rights Reserved.

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.

   Bit reading helpers
*/

var BROTLI_READ_SIZE = 4096;
var BROTLI_IBUF_SIZE =  (2 * BROTLI_READ_SIZE + 32);
var BROTLI_IBUF_MASK =  (2 * BROTLI_READ_SIZE - 1);

var kBitMask = new Uint32Array([
  0, 1, 3, 7, 15, 31, 63, 127, 255, 511, 1023, 2047, 4095, 8191, 16383, 32767,
  65535, 131071, 262143, 524287, 1048575, 2097151, 4194303, 8388607, 16777215
]);

/* Input byte buffer, consist of a ringbuffer and a "slack" region where */
/* bytes from the start of the ringbuffer are copied. */
function BrotliBitReader(input) {
  this.buf_ = new Uint8Array(BROTLI_IBUF_SIZE);
  this.input_ = input;    /* input callback */

  this.reset();
}

BrotliBitReader.READ_SIZE = BROTLI_READ_SIZE;
BrotliBitReader.IBUF_MASK = BROTLI_IBUF_MASK;

BrotliBitReader.prototype.reset = function() {
  this.buf_ptr_ = 0;      /* next input will write here */
  this.val_ = 0;          /* pre-fetched bits */
  this.pos_ = 0;          /* byte position in stream */
  this.bit_pos_ = 0;      /* current bit-reading position in val_ */
  this.bit_end_pos_ = 0;  /* bit-reading end position from LSB of val_ */
  this.eos_ = 0;          /* input stream is finished */

  this.readMoreInput();
  for (var i = 0; i < 4; i++) {
    this.val_ |= this.buf_[this.pos_] << (8 * i);
    ++this.pos_;
  }

  return this.bit_end_pos_ > 0;
};

/* Fills up the input ringbuffer by calling the input callback.

   Does nothing if there are at least 32 bytes present after current position.

   Returns 0 if either:
    - the input callback returned an error, or
    - there is no more input and the position is past the end of the stream.

   After encountering the end of the input stream, 32 additional zero bytes are
   copied to the ringbuffer, therefore it is safe to call this function after
   every 32 bytes of input is read.
*/
BrotliBitReader.prototype.readMoreInput = function() {
  if (this.bit_end_pos_ > 256) {
    return;
  } else if (this.eos_) {
    if (this.bit_pos_ > this.bit_end_pos_)
      throw new Error('Unexpected end of input ' + this.bit_pos_ + ' ' + this.bit_end_pos_);
  } else {
    var dst = this.buf_ptr_;
    var bytes_read = this.input_.read(this.buf_, dst, BROTLI_READ_SIZE);
    if (bytes_read < 0) {
      throw new Error('Unexpected end of input');
    }

    if (bytes_read < BROTLI_READ_SIZE) {
      this.eos_ = 1;
      /* Store 32 bytes of zero after the stream end. */
      for (var p = 0; p < 32; p++)
        this.buf_[dst + bytes_read + p] = 0;
    }

    if (dst === 0) {
      /* Copy the head of the ringbuffer to the slack region. */
      for (var p = 0; p < 32; p++)
        this.buf_[(BROTLI_READ_SIZE << 1) + p] = this.buf_[p];

      this.buf_ptr_ = BROTLI_READ_SIZE;
    } else {
      this.buf_ptr_ = 0;
    }

    this.bit_end_pos_ += bytes_read << 3;
  }
};

/* Guarantees that there are at least 24 bits in the buffer. */
BrotliBitReader.prototype.fillBitWindow = function() {
  while (this.bit_pos_ >= 8) {
    this.val_ >>>= 8;
    this.val_ |= this.buf_[this.pos_ & BROTLI_IBUF_MASK] << 24;
    ++this.pos_;
    this.bit_pos_ = this.bit_pos_ - 8 >>> 0;
    this.bit_end_pos_ = this.bit_end_pos_ - 8 >>> 0;
  }
};

/* Reads the specified number of bits from Read Buffer. */
BrotliBitReader.prototype.readBits = function(n_bits) {
  if (32 - this.bit_pos_ < n_bits) {
    this.fillBitWindow();
  }

  var val = ((this.val_ >>> this.bit_pos_) & kBitMask[n_bits]);
  this.bit_pos_ += n_bits;
  return val;
};

module.exports = BrotliBitReader;

},{}],2:[function(require,module,exports){
/* Copyright 2013 Google Inc. All Rights Reserved.

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.

   Lookup table to map the previous two bytes to a context id.

   There are four different context modeling modes defined here:
     CONTEXT_LSB6: context id is the least significant 6 bits of the last byte,
     CONTEXT_MSB6: context id is the most significant 6 bits of the last byte,
     CONTEXT_UTF8: second-order context model tuned for UTF8-encoded text,
     CONTEXT_SIGNED: second-order context model tuned for signed integers.

   The context id for the UTF8 context model is calculated as follows. If p1
   and p2 are the previous two bytes, we calcualte the context as

     context = kContextLookup[p1] | kContextLookup[p2 + 256].

   If the previous two bytes are ASCII characters (i.e. < 128), this will be
   equivalent to

     context = 4 * context1(p1) + context2(p2),

   where context1 is based on the previous byte in the following way:

     0  : non-ASCII control
     1  : \t, \n, \r
     2  : space
     3  : other punctuation
     4  : " '
     5  : %
     6  : ( < [ {
     7  : ) > ] }
     8  : , ; :
     9  : .
     10 : =
     11 : number
     12 : upper-case vowel
     13 : upper-case consonant
     14 : lower-case vowel
     15 : lower-case consonant

   and context2 is based on the second last byte:

     0 : control, space
     1 : punctuation
     2 : upper-case letter, number
     3 : lower-case letter

   If the last byte is ASCII, and the second last byte is not (in a valid UTF8
   stream it will be a continuation byte, value between 128 and 191), the
   context is the same as if the second last byte was an ASCII control or space.

   If the last byte is a UTF8 lead byte (value >= 192), then the next byte will
   be a continuation byte and the context id is 2 or 3 depending on the LSB of
   the last byte and to a lesser extent on the second last byte if it is ASCII.

   If the last byte is a UTF8 continuation byte, the second last byte can be:
     - continuation byte: the next byte is probably ASCII or lead byte (assuming
       4-byte UTF8 characters are rare) and the context id is 0 or 1.
     - lead byte (192 - 207): next byte is ASCII or lead byte, context is 0 or 1
     - lead byte (208 - 255): next byte is continuation byte, context is 2 or 3

   The possible value combinations of the previous two bytes, the range of
   context ids and the type of the next byte is summarized in the table below:

   |--------\-----------------------------------------------------------------|
   |         \                         Last byte                              |
   | Second   \---------------------------------------------------------------|
   | last byte \    ASCII            |   cont. byte        |   lead byte      |
   |            \   (0-127)          |   (128-191)         |   (192-)         |
   |=============|===================|=====================|==================|
   |  ASCII      | next: ASCII/lead  |  not valid          |  next: cont.     |
   |  (0-127)    | context: 4 - 63   |                     |  context: 2 - 3  |
   |-------------|-------------------|---------------------|------------------|
   |  cont. byte | next: ASCII/lead  |  next: ASCII/lead   |  next: cont.     |
   |  (128-191)  | context: 4 - 63   |  context: 0 - 1     |  context: 2 - 3  |
   |-------------|-------------------|---------------------|------------------|
   |  lead byte  | not valid         |  next: ASCII/lead   |  not valid       |
   |  (192-207)  |                   |  context: 0 - 1     |                  |
   |-------------|-------------------|---------------------|------------------|
   |  lead byte  | not valid         |  next: cont.        |  not valid       |
   |  (208-)     |                   |  context: 2 - 3     |                  |
   |-------------|-------------------|---------------------|------------------|

   The context id for the signed context mode is calculated as:

     context = (kContextLookup[512 + p1] << 3) | kContextLookup[512 + p2].

   For any context modeling modes, the context ids can be calculated by |-ing
   together two lookups from one table using context model dependent offsets:

     context = kContextLookup[offset1 + p1] | kContextLookup[offset2 + p2].

   where offset1 and offset2 are dependent on the context mode.
*/

var CONTEXT_LSB6         = 0;
var CONTEXT_MSB6         = 1;
var CONTEXT_UTF8         = 2;
var CONTEXT_SIGNED       = 3;

/* Common context lookup table for all context modes. */
exports.lookup = new Uint8Array([
  /* CONTEXT_UTF8, last byte. */
  /* ASCII range. */
   0,  0,  0,  0,  0,  0,  0,  0,  0,  4,  4,  0,  0,  4,  0,  0,
   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
   8, 12, 16, 12, 12, 20, 12, 16, 24, 28, 12, 12, 32, 12, 36, 12,
  44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 32, 32, 24, 40, 28, 12,
  12, 48, 52, 52, 52, 48, 52, 52, 52, 48, 52, 52, 52, 52, 52, 48,
  52, 52, 52, 52, 52, 48, 52, 52, 52, 52, 52, 24, 12, 28, 12, 12,
  12, 56, 60, 60, 60, 56, 60, 60, 60, 56, 60, 60, 60, 60, 60, 56,
  60, 60, 60, 60, 60, 56, 60, 60, 60, 60, 60, 24, 12, 28, 12,  0,
  /* UTF8 continuation byte range. */
  0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,
  0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,
  0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,
  0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,
  /* UTF8 lead byte range. */
  2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3,
  2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3,
  2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3,
  2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3,
  /* CONTEXT_UTF8 second last byte. */
  /* ASCII range. */
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1,
  1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1,
  1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
  3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 1, 1, 1, 1, 0,
  /* UTF8 continuation byte range. */
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  /* UTF8 lead byte range. */
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  /* CONTEXT_SIGNED, second last byte. */
  0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
  3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
  3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
  3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
  4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
  4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
  4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
  4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
  5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
  5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
  5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
  6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7,
  /* CONTEXT_SIGNED, last byte, same as the above values shifted by 3 bits. */
   0, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
  16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
  16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
  16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
  24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
  24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
  24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
  24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
  32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
  32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
  32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
  32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
  40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
  40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
  40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
  48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 56,
  /* CONTEXT_LSB6, last byte. */
   0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14, 15,
  16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
  32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
  48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
   0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14, 15,
  16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
  32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
  48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
   0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14, 15,
  16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
  32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
  48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
   0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14, 15,
  16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
  32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
  48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
  /* CONTEXT_MSB6, last byte. */
   0,  0,  0,  0,  1,  1,  1,  1,  2,  2,  2,  2,  3,  3,  3,  3,
   4,  4,  4,  4,  5,  5,  5,  5,  6,  6,  6,  6,  7,  7,  7,  7,
   8,  8,  8,  8,  9,  9,  9,  9, 10, 10, 10, 10, 11, 11, 11, 11,
  12, 12, 12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15,
  16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, 19, 19, 19, 19,
  20, 20, 20, 20, 21, 21, 21, 21, 22, 22, 22, 22, 23, 23, 23, 23,
  24, 24, 24, 24, 25, 25, 25, 25, 26, 26, 26, 26, 27, 27, 27, 27,
  28, 28, 28, 28, 29, 29, 29, 29, 30, 30, 30, 30, 31, 31, 31, 31,
  32, 32, 32, 32, 33, 33, 33, 33, 34, 34, 34, 34, 35, 35, 35, 35,
  36, 36, 36, 36, 37, 37, 37, 37, 38, 38, 38, 38, 39, 39, 39, 39,
  40, 40, 40, 40, 41, 41, 41, 41, 42, 42, 42, 42, 43, 43, 43, 43,
  44, 44, 44, 44, 45, 45, 45, 45, 46, 46, 46, 46, 47, 47, 47, 47,
  48, 48, 48, 48, 49, 49, 49, 49, 50, 50, 50, 50, 51, 51, 51, 51,
  52, 52, 52, 52, 53, 53, 53, 53, 54, 54, 54, 54, 55, 55, 55, 55,
  56, 56, 56, 56, 57, 57, 57, 57, 58, 58, 58, 58, 59, 59, 59, 59,
  60, 60, 60, 60, 61, 61, 61, 61, 62, 62, 62, 62, 63, 63, 63, 63,
  /* CONTEXT_{M,L}SB6, second last byte, */
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
]);

exports.lookupOffsets = new Uint16Array([
  /* CONTEXT_LSB6 */
  1024, 1536,
  /* CONTEXT_MSB6 */
  1280, 1536,
  /* CONTEXT_UTF8 */
  0, 256,
  /* CONTEXT_SIGNED */
  768, 512,
]);

},{}],3:[function(require,module,exports){
/* Copyright 2013 Google Inc. All Rights Reserved.

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
*/

var BrotliInput = require('./streams').BrotliInput;
var BrotliOutput = require('./streams').BrotliOutput;
var BrotliBitReader = require('./bit_reader');
var BrotliDictionary = require('./dictionary');
var HuffmanCode = require('./huffman').HuffmanCode;
var BrotliBuildHuffmanTable = require('./huffman').BrotliBuildHuffmanTable;
var Context = require('./context');
var Prefix = require('./prefix');
var Transform = require('./transform');

var kDefaultCodeLength = 8;
var kCodeLengthRepeatCode = 16;
var kNumLiteralCodes = 256;
var kNumInsertAndCopyCodes = 704;
var kNumBlockLengthCodes = 26;
var kLiteralContextBits = 6;
var kDistanceContextBits = 2;

var HUFFMAN_TABLE_BITS = 8;
var HUFFMAN_TABLE_MASK = 0xff;
/* Maximum possible Huffman table size for an alphabet size of 704, max code
 * length 15 and root table bits 8. */
var HUFFMAN_MAX_TABLE_SIZE = 1080;

var CODE_LENGTH_CODES = 18;
var kCodeLengthCodeOrder = new Uint8Array([
  1, 2, 3, 4, 0, 5, 17, 6, 16, 7, 8, 9, 10, 11, 12, 13, 14, 15,
]);

var NUM_DISTANCE_SHORT_CODES = 16;
var kDistanceShortCodeIndexOffset = new Uint8Array([
  3, 2, 1, 0, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2
]);

var kDistanceShortCodeValueOffset = new Int8Array([
  0, 0, 0, 0, -1, 1, -2, 2, -3, 3, -1, 1, -2, 2, -3, 3
]);

var kMaxHuffmanTableSize = new Uint16Array([
  256, 402, 436, 468, 500, 534, 566, 598, 630, 662, 694, 726, 758, 790, 822,
  854, 886, 920, 952, 984, 1016, 1048, 1080
]);

function DecodeWindowBits(br) {
  var n;
  if (br.readBits(1) === 0) {
    return 16;
  }

  n = br.readBits(3);
  if (n > 0) {
    return 17 + n;
  }

  n = br.readBits(3);
  if (n > 0) {
    return 8 + n;
  }

  return 17;
}

/* Decodes a number in the range [0..255], by reading 1 - 11 bits. */
function DecodeVarLenUint8(br) {
  if (br.readBits(1)) {
    var nbits = br.readBits(3);
    if (nbits === 0) {
      return 1;
    } else {
      return br.readBits(nbits) + (1 << nbits);
    }
  }
  return 0;
}

function MetaBlockLength() {
  this.meta_block_length = 0;
  this.input_end = 0;
  this.is_uncompressed = 0;
  this.is_metadata = false;
}

function DecodeMetaBlockLength(br) {
  var out = new MetaBlockLength;
  var size_nibbles;
  var size_bytes;
  var i;

  out.input_end = br.readBits(1);
  if (out.input_end && br.readBits(1)) {
    return out;
  }

  size_nibbles = br.readBits(2) + 4;
  if (size_nibbles === 7) {
    out.is_metadata = true;

    if (br.readBits(1) !== 0)
      throw new Error('Invalid reserved bit');

    size_bytes = br.readBits(2);
    if (size_bytes === 0)
      return out;

    for (i = 0; i < size_bytes; i++) {
      var next_byte = br.readBits(8);
      if (i + 1 === size_bytes && size_bytes > 1 && next_byte === 0)
        throw new Error('Invalid size byte');

      out.meta_block_length |= next_byte << (i * 8);
    }
  } else {
    for (i = 0; i < size_nibbles; ++i) {
      var next_nibble = br.readBits(4);
      if (i + 1 === size_nibbles && size_nibbles > 4 && next_nibble === 0)
        throw new Error('Invalid size nibble');

      out.meta_block_length |= next_nibble << (i * 4);
    }
  }

  ++out.meta_block_length;

  if (!out.input_end && !out.is_metadata) {
    out.is_uncompressed = br.readBits(1);
  }

  return out;
}

/* Decodes the next Huffman code from bit-stream. */
function ReadSymbol(table, index, br) {
  var start_index = index;

  var nbits;
  br.fillBitWindow();
  index += (br.val_ >>> br.bit_pos_) & HUFFMAN_TABLE_MASK;
  nbits = table[index].bits - HUFFMAN_TABLE_BITS;
  if (nbits > 0) {
    br.bit_pos_ += HUFFMAN_TABLE_BITS;
    index += table[index].value;
    index += (br.val_ >>> br.bit_pos_) & ((1 << nbits) - 1);
  }
  br.bit_pos_ += table[index].bits;
  return table[index].value;
}

function ReadHuffmanCodeLengths(code_length_code_lengths, num_symbols, code_lengths, br) {
  var symbol = 0;
  var prev_code_len = kDefaultCodeLength;
  var repeat = 0;
  var repeat_code_len = 0;
  var space = 32768;

  var table = [];
  for (var i = 0; i < 32; i++)
    table.push(new HuffmanCode(0, 0));

  BrotliBuildHuffmanTable(table, 0, 5, code_length_code_lengths, CODE_LENGTH_CODES);

  while (symbol < num_symbols && space > 0) {
    var p = 0;
    var code_len;

    br.readMoreInput();
    br.fillBitWindow();
    p += (br.val_ >>> br.bit_pos_) & 31;
    br.bit_pos_ += table[p].bits;
    code_len = table[p].value & 0xff;
    if (code_len < kCodeLengthRepeatCode) {
      repeat = 0;
      code_lengths[symbol++] = code_len;
      if (code_len !== 0) {
        prev_code_len = code_len;
        space -= 32768 >> code_len;
      }
    } else {
      var extra_bits = code_len - 14;
      var old_repeat;
      var repeat_delta;
      var new_len = 0;
      if (code_len === kCodeLengthRepeatCode) {
        new_len = prev_code_len;
      }
      if (repeat_code_len !== new_len) {
        repeat = 0;
        repeat_code_len = new_len;
      }
      old_repeat = repeat;
      if (repeat > 0) {
        repeat -= 2;
        repeat <<= extra_bits;
      }
      repeat += br.readBits(extra_bits) + 3;
      repeat_delta = repeat - old_repeat;
      if (symbol + repeat_delta > num_symbols) {
        throw new Error('[ReadHuffmanCodeLengths] symbol + repeat_delta > num_symbols');
      }

      for (var x = 0; x < repeat_delta; x++)
        code_lengths[symbol + x] = repeat_code_len;

      symbol += repeat_delta;

      if (repeat_code_len !== 0) {
        space -= repeat_delta << (15 - repeat_code_len);
      }
    }
  }
  if (space !== 0) {
    throw new Error("[ReadHuffmanCodeLengths] space = " + space);
  }

  for (; symbol < num_symbols; symbol++)
    code_lengths[symbol] = 0;
}

function ReadHuffmanCode(alphabet_size, tables, table, br) {
  var table_size = 0;
  var simple_code_or_skip;
  var code_lengths = new Uint8Array(alphabet_size);

  br.readMoreInput();

  /* simple_code_or_skip is used as follows:
     1 for simple code;
     0 for no skipping, 2 skips 2 code lengths, 3 skips 3 code lengths */
  simple_code_or_skip = br.readBits(2);
  if (simple_code_or_skip === 1) {
    /* Read symbols, codes & code lengths directly. */
    var i;
    var max_bits_counter = alphabet_size - 1;
    var max_bits = 0;
    var symbols = new Int32Array(4);
    var num_symbols = br.readBits(2) + 1;
    while (max_bits_counter) {
      max_bits_counter >>= 1;
      ++max_bits;
    }

    for (i = 0; i < num_symbols; ++i) {
      symbols[i] = br.readBits(max_bits) % alphabet_size;
      code_lengths[symbols[i]] = 2;
    }
    code_lengths[symbols[0]] = 1;
    switch (num_symbols) {
      case 1:
        break;
      case 3:
        if ((symbols[0] === symbols[1]) ||
            (symbols[0] === symbols[2]) ||
            (symbols[1] === symbols[2])) {
          throw new Error('[ReadHuffmanCode] invalid symbols');
        }
        break;
      case 2:
        if (symbols[0] === symbols[1]) {
          throw new Error('[ReadHuffmanCode] invalid symbols');
        }

        code_lengths[symbols[1]] = 1;
        break;
      case 4:
        if ((symbols[0] === symbols[1]) ||
            (symbols[0] === symbols[2]) ||
            (symbols[0] === symbols[3]) ||
            (symbols[1] === symbols[2]) ||
            (symbols[1] === symbols[3]) ||
            (symbols[2] === symbols[3])) {
          throw new Error('[ReadHuffmanCode] invalid symbols');
        }

        if (br.readBits(1)) {
          code_lengths[symbols[2]] = 3;
          code_lengths[symbols[3]] = 3;
        } else {
          code_lengths[symbols[0]] = 2;
        }
        break;
    }
  } else {  /* Decode Huffman-coded code lengths. */
    var i;
    var code_length_code_lengths = new Uint8Array(CODE_LENGTH_CODES);
    var space = 32;
    var num_codes = 0;
    /* Static Huffman code for the code length code lengths */
    var huff = [
      new HuffmanCode(2, 0), new HuffmanCode(2, 4), new HuffmanCode(2, 3), new HuffmanCode(3, 2),
      new HuffmanCode(2, 0), new HuffmanCode(2, 4), new HuffmanCode(2, 3), new HuffmanCode(4, 1),
      new HuffmanCode(2, 0), new HuffmanCode(2, 4), new HuffmanCode(2, 3), new HuffmanCode(3, 2),
      new HuffmanCode(2, 0), new HuffmanCode(2, 4), new HuffmanCode(2, 3), new HuffmanCode(4, 5)
    ];
    for (i = simple_code_or_skip; i < CODE_LENGTH_CODES && space > 0; ++i) {
      var code_len_idx = kCodeLengthCodeOrder[i];
      var p = 0;
      var v;
      br.fillBitWindow();
      p += (br.val_ >>> br.bit_pos_) & 15;
      br.bit_pos_ += huff[p].bits;
      v = huff[p].value;
      code_length_code_lengths[code_len_idx] = v;
      if (v !== 0) {
        space -= (32 >> v);
        ++num_codes;
      }
    }

    if (!(num_codes === 1 || space === 0))
      throw new Error('[ReadHuffmanCode] invalid num_codes or space');

    ReadHuffmanCodeLengths(code_length_code_lengths, alphabet_size, code_lengths, br);
  }

  table_size = BrotliBuildHuffmanTable(tables, table, HUFFMAN_TABLE_BITS, code_lengths, alphabet_size);

  if (table_size === 0) {
    throw new Error("[ReadHuffmanCode] BuildHuffmanTable failed: ");
  }

  return table_size;
}

function ReadBlockLength(table, index, br) {
  var code;
  var nbits;
  code = ReadSymbol(table, index, br);
  nbits = Prefix.kBlockLengthPrefixCode[code].nbits;
  return Prefix.kBlockLengthPrefixCode[code].offset + br.readBits(nbits);
}

function TranslateShortCodes(code, ringbuffer, index) {
  var val;
  if (code < NUM_DISTANCE_SHORT_CODES) {
    index += kDistanceShortCodeIndexOffset[code];
    index &= 3;
    val = ringbuffer[index] + kDistanceShortCodeValueOffset[code];
  } else {
    val = code - NUM_DISTANCE_SHORT_CODES + 1;
  }
  return val;
}

function MoveToFront(v, index) {
  var value = v[index];
  var i = index;
  for (; i; --i) v[i] = v[i - 1];
  v[0] = value;
}

function InverseMoveToFrontTransform(v, v_len) {
  var mtf = new Uint8Array(256);
  var i;
  for (i = 0; i < 256; ++i) {
    mtf[i] = i;
  }
  for (i = 0; i < v_len; ++i) {
    var index = v[i];
    v[i] = mtf[index];
    if (index) MoveToFront(mtf, index);
  }
}

/* Contains a collection of huffman trees with the same alphabet size. */
function HuffmanTreeGroup(alphabet_size, num_htrees) {
  this.alphabet_size = alphabet_size;
  this.num_htrees = num_htrees;
  this.codes = new Array(num_htrees + num_htrees * kMaxHuffmanTableSize[(alphabet_size + 31) >>> 5]);
  this.htrees = new Uint32Array(num_htrees);
}

HuffmanTreeGroup.prototype.decode = function(br) {
  var i;
  var table_size;
  var next = 0;
  for (i = 0; i < this.num_htrees; ++i) {
    this.htrees[i] = next;
    table_size = ReadHuffmanCode(this.alphabet_size, this.codes, next, br);
    next += table_size;
  }
};

function DecodeContextMap(context_map_size, br) {
  var out = { num_htrees: null, context_map: null };
  var use_rle_for_zeros;
  var max_run_length_prefix = 0;
  var table;
  var i;

  br.readMoreInput();
  var num_htrees = out.num_htrees = DecodeVarLenUint8(br) + 1;

  var context_map = out.context_map = new Uint8Array(context_map_size);
  if (num_htrees <= 1) {
    return out;
  }

  use_rle_for_zeros = br.readBits(1);
  if (use_rle_for_zeros) {
    max_run_length_prefix = br.readBits(4) + 1;
  }

  table = [];
  for (i = 0; i < HUFFMAN_MAX_TABLE_SIZE; i++) {
    table[i] = new HuffmanCode(0, 0);
  }

  ReadHuffmanCode(num_htrees + max_run_length_prefix, table, 0, br);

  for (i = 0; i < context_map_size;) {
    var code;

    br.readMoreInput();
    code = ReadSymbol(table, 0, br);
    if (code === 0) {
      context_map[i] = 0;
      ++i;
    } else if (code <= max_run_length_prefix) {
      var reps = 1 + (1 << code) + br.readBits(code);
      while (--reps) {
        if (i >= context_map_size) {
          throw new Error("[DecodeContextMap] i >= context_map_size");
        }
        context_map[i] = 0;
        ++i;
      }
    } else {
      context_map[i] = code - max_run_length_prefix;
      ++i;
    }
  }
  if (br.readBits(1)) {
    InverseMoveToFrontTransform(context_map, context_map_size);
  }

  return out;
}

function DecodeBlockType(max_block_type, trees, tree_type, block_types, ringbuffers, indexes, br) {
  var ringbuffer = tree_type * 2;
  var index = tree_type;
  var type_code = ReadSymbol(trees, tree_type * HUFFMAN_MAX_TABLE_SIZE, br);
  var block_type;
  if (type_code === 0) {
    block_type = ringbuffers[ringbuffer + (indexes[index] & 1)];
  } else if (type_code === 1) {
    block_type = ringbuffers[ringbuffer + ((indexes[index] - 1) & 1)] + 1;
  } else {
    block_type = type_code - 2;
  }
  if (block_type >= max_block_type) {
    block_type -= max_block_type;
  }
  block_types[tree_type] = block_type;
  ringbuffers[ringbuffer + (indexes[index] & 1)] = block_type;
  ++indexes[index];
}

function CopyUncompressedBlockToOutput(output, len, pos, ringbuffer, ringbuffer_mask, br) {
  var rb_size = ringbuffer_mask + 1;
  var rb_pos = pos & ringbuffer_mask;
  var br_pos = br.pos_ & BrotliBitReader.IBUF_MASK;
  var nbytes;

  /* For short lengths copy byte-by-byte */
  if (len < 8 || br.bit_pos_ + (len << 3) < br.bit_end_pos_) {
    while (len-- > 0) {
      br.readMoreInput();
      ringbuffer[rb_pos++] = br.readBits(8);
      if (rb_pos === rb_size) {
        output.write(ringbuffer, rb_size);
        rb_pos = 0;
      }
    }
    return;
  }

  if (br.bit_end_pos_ < 32) {
    throw new Error('[CopyUncompressedBlockToOutput] br.bit_end_pos_ < 32');
  }

  /* Copy remaining 0-4 bytes from br.val_ to ringbuffer. */
  while (br.bit_pos_ < 32) {
    ringbuffer[rb_pos] = (br.val_ >>> br.bit_pos_);
    br.bit_pos_ += 8;
    ++rb_pos;
    --len;
  }

  /* Copy remaining bytes from br.buf_ to ringbuffer. */
  nbytes = (br.bit_end_pos_ - br.bit_pos_) >> 3;
  if (br_pos + nbytes > BrotliBitReader.IBUF_MASK) {
    var tail = BrotliBitReader.IBUF_MASK + 1 - br_pos;
    for (var x = 0; x < tail; x++)
      ringbuffer[rb_pos + x] = br.buf_[br_pos + x];

    nbytes -= tail;
    rb_pos += tail;
    len -= tail;
    br_pos = 0;
  }

  for (var x = 0; x < nbytes; x++)
    ringbuffer[rb_pos + x] = br.buf_[br_pos + x];

  rb_pos += nbytes;
  len -= nbytes;

  /* If we wrote past the logical end of the ringbuffer, copy the tail of the
     ringbuffer to its beginning and flush the ringbuffer to the output. */
  if (rb_pos >= rb_size) {
    output.write(ringbuffer, rb_size);
    rb_pos -= rb_size;
    for (var x = 0; x < rb_pos; x++)
      ringbuffer[x] = ringbuffer[rb_size + x];
  }

  /* If we have more to copy than the remaining size of the ringbuffer, then we
     first fill the ringbuffer from the input and then flush the ringbuffer to
     the output */
  while (rb_pos + len >= rb_size) {
    nbytes = rb_size - rb_pos;
    if (br.input_.read(ringbuffer, rb_pos, nbytes) < nbytes) {
      throw new Error('[CopyUncompressedBlockToOutput] not enough bytes');
    }
    output.write(ringbuffer, rb_size);
    len -= nbytes;
    rb_pos = 0;
  }

  /* Copy straight from the input onto the ringbuffer. The ringbuffer will be
     flushed to the output at a later time. */
  if (br.input_.read(ringbuffer, rb_pos, len) < len) {
    throw new Error('[CopyUncompressedBlockToOutput] not enough bytes');
  }

  /* Restore the state of the bit reader. */
  br.reset();
}

/* Advances the bit reader position to the next byte boundary and verifies
   that any skipped bits are set to zero. */
function JumpToByteBoundary(br) {
  var new_bit_pos = (br.bit_pos_ + 7) & ~7;
  var pad_bits = br.readBits(new_bit_pos - br.bit_pos_);
  return pad_bits == 0;
}

function BrotliDecompressedSize(buffer) {
  var input = new BrotliInput(buffer);
  var br = new BrotliBitReader(input);
  DecodeWindowBits(br);
  var out = DecodeMetaBlockLength(br);
  return out.meta_block_length;
}

exports.BrotliDecompressedSize = BrotliDecompressedSize;

function BrotliDecompressBuffer(buffer, output_size) {
  var input = new BrotliInput(buffer);

  if (output_size == null) {
    output_size = BrotliDecompressedSize(buffer);
  }

  var output_buffer = new Uint8Array(output_size);
  var output = new BrotliOutput(output_buffer);

  BrotliDecompress(input, output);

  if (output.pos < output.buffer.length) {
    output.buffer = output.buffer.subarray(0, output.pos);
  }

  return output.buffer;
}

exports.BrotliDecompressBuffer = BrotliDecompressBuffer;

function BrotliDecompress(input, output) {
  var i;
  var pos = 0;
  var input_end = 0;
  var window_bits = 0;
  var max_backward_distance;
  var max_distance = 0;
  var ringbuffer_size;
  var ringbuffer_mask;
  var ringbuffer;
  var ringbuffer_end;
  /* This ring buffer holds a few past copy distances that will be used by */
  /* some special distance codes. */
  var dist_rb = [ 16, 15, 11, 4 ];
  var dist_rb_idx = 0;
  /* The previous 2 bytes used for context. */
  var prev_byte1 = 0;
  var prev_byte2 = 0;
  var hgroup = [new HuffmanTreeGroup(0, 0), new HuffmanTreeGroup(0, 0), new HuffmanTreeGroup(0, 0)];
  var block_type_trees;
  var block_len_trees;
  var br;

  /* We need the slack region for the following reasons:
       - always doing two 8-byte copies for fast backward copying
       - transforms
       - flushing the input ringbuffer when decoding uncompressed blocks */
  var kRingBufferWriteAheadSlack = 128 + BrotliBitReader.READ_SIZE;

  br = new BrotliBitReader(input);

  /* Decode window size. */
  window_bits = DecodeWindowBits(br);
  max_backward_distance = (1 << window_bits) - 16;

  ringbuffer_size = 1 << window_bits;
  ringbuffer_mask = ringbuffer_size - 1;
  ringbuffer = new Uint8Array(ringbuffer_size + kRingBufferWriteAheadSlack + BrotliDictionary.maxDictionaryWordLength);
  ringbuffer_end = ringbuffer_size;

  block_type_trees = [];
  block_len_trees = [];
  for (var x = 0; x < 3 * HUFFMAN_MAX_TABLE_SIZE; x++) {
    block_type_trees[x] = new HuffmanCode(0, 0);
    block_len_trees[x] = new HuffmanCode(0, 0);
  }

  while (!input_end) {
    var meta_block_remaining_len = 0;
    var is_uncompressed;
    var block_length = [ 1 << 28, 1 << 28, 1 << 28 ];
    var block_type = [ 0 ];
    var num_block_types = [ 1, 1, 1 ];
    var block_type_rb = [ 0, 1, 0, 1, 0, 1 ];
    var block_type_rb_index = [ 0 ];
    var distance_postfix_bits;
    var num_direct_distance_codes;
    var distance_postfix_mask;
    var num_distance_codes;
    var context_map = null;
    var context_modes = null;
    var num_literal_htrees;
    var dist_context_map = null;
    var num_dist_htrees;
    var context_offset = 0;
    var context_map_slice = null;
    var literal_htree_index = 0;
    var dist_context_offset = 0;
    var dist_context_map_slice = null;
    var dist_htree_index = 0;
    var context_lookup_offset1 = 0;
    var context_lookup_offset2 = 0;
    var context_mode;
    var htree_command;

    for (i = 0; i < 3; ++i) {
      hgroup[i].codes = null;
      hgroup[i].htrees = null;
    }

    br.readMoreInput();

    var _out = DecodeMetaBlockLength(br);
    meta_block_remaining_len = _out.meta_block_length;
    if (pos + meta_block_remaining_len > output.buffer.length) {
      /* We need to grow the output buffer to fit the additional data. */
      var tmp = new Uint8Array( pos + meta_block_remaining_len );
      tmp.set( output.buffer );
      output.buffer = tmp;
    }
    input_end = _out.input_end;
    is_uncompressed = _out.is_uncompressed;

    if (_out.is_metadata) {
      JumpToByteBoundary(br);

      for (; meta_block_remaining_len > 0; --meta_block_remaining_len) {
        br.readMoreInput();
        /* Read one byte and ignore it. */
        br.readBits(8);
      }

      continue;
    }

    if (meta_block_remaining_len === 0) {
      continue;
    }

    if (is_uncompressed) {
      br.bit_pos_ = (br.bit_pos_ + 7) & ~7;
      CopyUncompressedBlockToOutput(output, meta_block_remaining_len, pos,
                                    ringbuffer, ringbuffer_mask, br);
      pos += meta_block_remaining_len;
      continue;
    }

    for (i = 0; i < 3; ++i) {
      num_block_types[i] = DecodeVarLenUint8(br) + 1;
      if (num_block_types[i] >= 2) {
        ReadHuffmanCode(num_block_types[i] + 2, block_type_trees, i * HUFFMAN_MAX_TABLE_SIZE, br);
        ReadHuffmanCode(kNumBlockLengthCodes, block_len_trees, i * HUFFMAN_MAX_TABLE_SIZE, br);
        block_length[i] = ReadBlockLength(block_len_trees, i * HUFFMAN_MAX_TABLE_SIZE, br);
        block_type_rb_index[i] = 1;
      }
    }

    br.readMoreInput();

    distance_postfix_bits = br.readBits(2);
    num_direct_distance_codes = NUM_DISTANCE_SHORT_CODES + (br.readBits(4) << distance_postfix_bits);
    distance_postfix_mask = (1 << distance_postfix_bits) - 1;
    num_distance_codes = (num_direct_distance_codes + (48 << distance_postfix_bits));
    context_modes = new Uint8Array(num_block_types[0]);

    for (i = 0; i < num_block_types[0]; ++i) {
       br.readMoreInput();
       context_modes[i] = (br.readBits(2) << 1);
    }

    var _o1 = DecodeContextMap(num_block_types[0] << kLiteralContextBits, br);
    num_literal_htrees = _o1.num_htrees;
    context_map = _o1.context_map;

    var _o2 = DecodeContextMap(num_block_types[2] << kDistanceContextBits, br);
    num_dist_htrees = _o2.num_htrees;
    dist_context_map = _o2.context_map;

    hgroup[0] = new HuffmanTreeGroup(kNumLiteralCodes, num_literal_htrees);
    hgroup[1] = new HuffmanTreeGroup(kNumInsertAndCopyCodes, num_block_types[1]);
    hgroup[2] = new HuffmanTreeGroup(num_distance_codes, num_dist_htrees);

    for (i = 0; i < 3; ++i) {
      hgroup[i].decode(br);
    }

    context_map_slice = 0;
    dist_context_map_slice = 0;
    context_mode = context_modes[block_type[0]];
    context_lookup_offset1 = Context.lookupOffsets[context_mode];
    context_lookup_offset2 = Context.lookupOffsets[context_mode + 1];
    htree_command = hgroup[1].htrees[0];

    while (meta_block_remaining_len > 0) {
      var cmd_code;
      var range_idx;
      var insert_code;
      var copy_code;
      var insert_length;
      var copy_length;
      var distance_code;
      var distance;
      var context;
      var j;
      var copy_dst;

      br.readMoreInput();

      if (block_length[1] === 0) {
        DecodeBlockType(num_block_types[1],
                        block_type_trees, 1, block_type, block_type_rb,
                        block_type_rb_index, br);
        block_length[1] = ReadBlockLength(block_len_trees, HUFFMAN_MAX_TABLE_SIZE, br);
        htree_command = hgroup[1].htrees[block_type[1]];
      }
      --block_length[1];
      cmd_code = ReadSymbol(hgroup[1].codes, htree_command, br);
      range_idx = cmd_code >> 6;
      if (range_idx >= 2) {
        range_idx -= 2;
        distance_code = -1;
      } else {
        distance_code = 0;
      }
      insert_code = Prefix.kInsertRangeLut[range_idx] + ((cmd_code >> 3) & 7);
      copy_code = Prefix.kCopyRangeLut[range_idx] + (cmd_code & 7);
      insert_length = Prefix.kInsertLengthPrefixCode[insert_code].offset +
          br.readBits(Prefix.kInsertLengthPrefixCode[insert_code].nbits);
      copy_length = Prefix.kCopyLengthPrefixCode[copy_code].offset +
          br.readBits(Prefix.kCopyLengthPrefixCode[copy_code].nbits);
      prev_byte1 = ringbuffer[pos-1 & ringbuffer_mask];
      prev_byte2 = ringbuffer[pos-2 & ringbuffer_mask];
      for (j = 0; j < insert_length; ++j) {
        br.readMoreInput();

        if (block_length[0] === 0) {
          DecodeBlockType(num_block_types[0],
                          block_type_trees, 0, block_type, block_type_rb,
                          block_type_rb_index, br);
          block_length[0] = ReadBlockLength(block_len_trees, 0, br);
          context_offset = block_type[0] << kLiteralContextBits;
          context_map_slice = context_offset;
          context_mode = context_modes[block_type[0]];
          context_lookup_offset1 = Context.lookupOffsets[context_mode];
          context_lookup_offset2 = Context.lookupOffsets[context_mode + 1];
        }
        context = (Context.lookup[context_lookup_offset1 + prev_byte1] |
                   Context.lookup[context_lookup_offset2 + prev_byte2]);
        literal_htree_index = context_map[context_map_slice + context];
        --block_length[0];
        prev_byte2 = prev_byte1;
        prev_byte1 = ReadSymbol(hgroup[0].codes, hgroup[0].htrees[literal_htree_index], br);
        ringbuffer[pos & ringbuffer_mask] = prev_byte1;
        if ((pos & ringbuffer_mask) === ringbuffer_mask) {
          output.write(ringbuffer, ringbuffer_size);
        }
        ++pos;
      }
      meta_block_remaining_len -= insert_length;
      if (meta_block_remaining_len <= 0) break;

      if (distance_code < 0) {
        var context;

        br.readMoreInput();
        if (block_length[2] === 0) {
          DecodeBlockType(num_block_types[2],
                          block_type_trees, 2, block_type, block_type_rb,
                          block_type_rb_index, br);
          block_length[2] = ReadBlockLength(block_len_trees, 2 * HUFFMAN_MAX_TABLE_SIZE, br);
          dist_context_offset = block_type[2] << kDistanceContextBits;
          dist_context_map_slice = dist_context_offset;
        }
        --block_length[2];
        context = (copy_length > 4 ? 3 : copy_length - 2) & 0xff;
        dist_htree_index = dist_context_map[dist_context_map_slice + context];
        distance_code = ReadSymbol(hgroup[2].codes, hgroup[2].htrees[dist_htree_index], br);
        if (distance_code >= num_direct_distance_codes) {
          var nbits;
          var postfix;
          var offset;
          distance_code -= num_direct_distance_codes;
          postfix = distance_code & distance_postfix_mask;
          distance_code >>= distance_postfix_bits;
          nbits = (distance_code >> 1) + 1;
          offset = ((2 + (distance_code & 1)) << nbits) - 4;
          distance_code = num_direct_distance_codes +
              ((offset + br.readBits(nbits)) <<
               distance_postfix_bits) + postfix;
        }
      }

      /* Convert the distance code to the actual distance by possibly looking */
      /* up past distnaces from the ringbuffer. */
      distance = TranslateShortCodes(distance_code, dist_rb, dist_rb_idx);
      if (distance < 0) {
        throw new Error('[BrotliDecompress] invalid distance');
      }

      if (pos < max_backward_distance &&
          max_distance !== max_backward_distance) {
        max_distance = pos;
      } else {
        max_distance = max_backward_distance;
      }

      copy_dst = pos & ringbuffer_mask;

      if (distance > max_distance) {
        if (copy_length >= BrotliDictionary.minDictionaryWordLength &&
            copy_length <= BrotliDictionary.maxDictionaryWordLength) {
          var offset = BrotliDictionary.offsetsByLength[copy_length];
          var word_id = distance - max_distance - 1;
          var shift = BrotliDictionary.sizeBitsByLength[copy_length];
          var mask = (1 << shift) - 1;
          var word_idx = word_id & mask;
          var transform_idx = word_id >> shift;
          offset += word_idx * copy_length;
          if (transform_idx < Transform.kNumTransforms) {
            var len = Transform.transformDictionaryWord(ringbuffer, copy_dst, offset, copy_length, transform_idx);
            copy_dst += len;
            pos += len;
            meta_block_remaining_len -= len;
            if (copy_dst >= ringbuffer_end) {
              output.write(ringbuffer, ringbuffer_size);

              for (var _x = 0; _x < (copy_dst - ringbuffer_end); _x++)
                ringbuffer[_x] = ringbuffer[ringbuffer_end + _x];
            }
          } else {
            throw new Error("Invalid backward reference. pos: " + pos + " distance: " + distance +
              " len: " + copy_length + " bytes left: " + meta_block_remaining_len);
          }
        } else {
          throw new Error("Invalid backward reference. pos: " + pos + " distance: " + distance +
            " len: " + copy_length + " bytes left: " + meta_block_remaining_len);
        }
      } else {
        if (distance_code > 0) {
          dist_rb[dist_rb_idx & 3] = distance;
          ++dist_rb_idx;
        }

        if (copy_length > meta_block_remaining_len) {
          throw new Error("Invalid backward reference. pos: " + pos + " distance: " + distance +
            " len: " + copy_length + " bytes left: " + meta_block_remaining_len);
        }

        for (j = 0; j < copy_length; ++j) {
          ringbuffer[pos & ringbuffer_mask] = ringbuffer[(pos - distance) & ringbuffer_mask];
          if ((pos & ringbuffer_mask) === ringbuffer_mask) {
            output.write(ringbuffer, ringbuffer_size);
          }
          ++pos;
          --meta_block_remaining_len;
        }
      }

      /* When we get here, we must have inserted at least one literal and */
      /* made a copy of at least length two, therefore accessing the last 2 */
      /* bytes is valid. */
      prev_byte1 = ringbuffer[(pos - 1) & ringbuffer_mask];
      prev_byte2 = ringbuffer[(pos - 2) & ringbuffer_mask];
    }

    /* Protect pos from overflow, wrap it around at every GB of input data */
    pos &= 0x3fffffff;
  }

  output.write(ringbuffer, pos & ringbuffer_mask);
}

exports.BrotliDecompress = BrotliDecompress;

BrotliDictionary.init();

},{"./bit_reader":1,"./context":2,"./dictionary":6,"./huffman":7,"./prefix":9,"./streams":10,"./transform":11}],4:[function(require,module,exports){
var base64 = require('base64-js');
//var fs = require('fs');

/**
 * The normal dictionary-data.js is quite large, which makes it
 * unsuitable for browser usage. In order to make it smaller,
 * we read dictionary.bin, which is a compressed version of
 * the dictionary, and on initial load, Brotli decompresses
 * it's own dictionary. 😜
 */
exports.init = function() {
  var BrotliDecompressBuffer = require('./decode').BrotliDecompressBuffer;
  var compressed = base64.toByteArray(require('./dictionary.bin.js'));
  return BrotliDecompressBuffer(compressed);
};

},{"./decode":3,"./dictionary.bin.js":5,"base64-js":8}],5:[function(require,module,exports){
module.exports="[encoded data, 69000 characters]";

},{}],6:[function(require,module,exports){
/* Copyright 2013 Google Inc. All Rights Reserved.

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.

   Collection of static dictionary words.
*/

var data = require('./dictionary-browser');
exports.init = function() {
  exports.dictionary = data.init();
};

exports.offsetsByLength = new Uint32Array([
     0,     0,     0,     0,     0,  4096,  9216, 21504, 35840, 44032,
 53248, 63488, 74752, 87040, 93696, 100864, 104704, 106752, 108928, 113536,
 115968, 118528, 119872, 121280, 122016,
]);

exports.sizeBitsByLength = new Uint8Array([
  0,  0,  0,  0, 10, 10, 11, 11, 10, 10,
 10, 10, 10,  9,  9,  8,  7,  7,  8,  7,
  7,  6,  6,  5,  5,
]);

exports.minDictionaryWordLength = 4;
exports.maxDictionaryWordLength = 24;

},{"./dictionary-browser":4}],7:[function(require,module,exports){
function HuffmanCode(bits, value) {
  this.bits = bits;   /* number of bits used for this symbol */
  this.value = value; /* symbol value or table offset */
}

exports.HuffmanCode = HuffmanCode;

var MAX_LENGTH = 15;

/* Returns reverse(reverse(key, len) + 1, len), where reverse(key, len) is the
   bit-wise reversal of the len least significant bits of key. */
function GetNextKey(key, len) {
  var step = 1 << (len - 1);
  while (key & step) {
    step >>= 1;
  }
  return (key & (step - 1)) + step;
}

/* Stores code in table[0], table[step], table[2*step], ..., table[end] */
/* Assumes that end is an integer multiple of step */
function ReplicateValue(table, i, step, end, code) {
  do {
    end -= step;
    table[i + end] = new HuffmanCode(code.bits, code.value);
  } while (end > 0);
}

/* Returns the table width of the next 2nd level table. count is the histogram
   of bit lengths for the remaining symbols, len is the code length of the next
   processed symbol */
function NextTableBitSize(count, len, root_bits) {
  var left = 1 << (len - root_bits);
  while (len < MAX_LENGTH) {
    left -= count[len];
    if (left <= 0) break;
    ++len;
    left <<= 1;
  }
  return len - root_bits;
}

exports.BrotliBuildHuffmanTable = function(root_table, table, root_bits, code_lengths, code_lengths_size) {
  var start_table = table;
  var code;            /* current table entry */
  var len;             /* current code length */
  var symbol;          /* symbol index in original or sorted table */
  var key;             /* reversed prefix code */
  var step;            /* step size to replicate values in current table */
  var low;             /* low bits for current root entry */
  var mask;            /* mask for low bits */
  var table_bits;      /* key length of current table */
  var table_size;      /* size of current table */
  var total_size;      /* sum of root table size and 2nd level table sizes */
  var sorted;          /* symbols sorted by code length */
  var count = new Int32Array(MAX_LENGTH + 1);  /* number of codes of each length */
  var offset = new Int32Array(MAX_LENGTH + 1);  /* offsets in sorted table for each length */

  sorted = new Int32Array(code_lengths_size);

  /* build histogram of code lengths */
  for (symbol = 0; symbol < code_lengths_size; symbol++) {
    count[code_lengths[symbol]]++;
  }

  /* generate offsets into sorted symbol table by code length */
  offset[1] = 0;
  for (len = 1; len < MAX_LENGTH; len++) {
    offset[len + 1] = offset[len] + count[len];
  }

  /* sort symbols by length, by symbol order within each length */
  for (symbol = 0; symbol < code_lengths_size; symbol++) {
    if (code_lengths[symbol] !== 0) {
      sorted[offset[code_lengths[symbol]]++] = symbol;
    }
  }

  table_bits = root_bits;
  table_size = 1 << table_bits;
  total_size = table_size;

  /* special case code with only one value */
  if (offset[MAX_LENGTH] === 1) {
    for (key = 0; key < total_size; ++key) {
      root_table[table + key] = new HuffmanCode(0, sorted[0] & 0xffff);
    }

    return total_size;
  }

  /* fill in root table */
  key = 0;
  symbol = 0;
  for (len = 1, step = 2; len <= root_bits; ++len, step <<= 1) {
    for (; count[len] > 0; --count[len]) {
      code = new HuffmanCode(len & 0xff, sorted[symbol++] & 0xffff);
      ReplicateValue(root_table, table + key, step, table_size, code);
      key = GetNextKey(key, len);
    }
  }

  /* fill in 2nd level tables and add pointers to root table */
  mask = total_size - 1;
  low = -1;
  for (len = root_bits + 1, step = 2; len <= MAX_LENGTH; ++len, step <<= 1) {
    for (; count[len] > 0; --count[len]) {
      if ((key & mask) !== low) {
        table += table_size;
        table_bits = NextTableBitSize(count, len, root_bits);
        table_size = 1 << table_bits;
        total_size += table_size;
        low = key & mask;
        root_table[start_table + low] = new HuffmanCode((table_bits + root_bits) & 0xff, ((table - start_table) - low) & 0xffff);
      }
      code = new HuffmanCode((len - root_bits) & 0xff, sorted[symbol++] & 0xffff);
      ReplicateValue(root_table, table + (key >> root_bits), step, table_size, code);
      key = GetNextKey(key, len);
    }
  }

  return total_size;
}

},{}],8:[function(require,module,exports){
'use strict'

exports.byteLength = byteLength
exports.toByteArray = toByteArray
exports.fromByteArray = fromByteArray

var lookup = []
var revLookup = []
var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array

var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
for (var i = 0, len = code.length; i < len; ++i) {
  lookup[i] = code[i]
  revLookup[code.charCodeAt(i)] = i
}

// Support decoding URL-safe base64 strings, as Node.js does.
// See: https://en.wikipedia.org/wiki/Base64#URL_applications
revLookup['-'.charCodeAt(0)] = 62
revLookup['_'.charCodeAt(0)] = 63

function getLens (b64) {
  var len = b64.length

  if (len % 4 > 0) {
    throw new Error('Invalid string. Length must be a multiple of 4')
  }

  // Trim off extra bytes after placeholder bytes are found
  // See: https://github.com/beatgammit/base64-js/issues/42
  var validLen = b64.indexOf('=')
  if (validLen === -1) validLen = len

  var placeHoldersLen = validLen === len
    ? 0
    : 4 - (validLen % 4)

  return [validLen, placeHoldersLen]
}

// base64 is 4/3 + up to two characters of the original data
function byteLength (b64) {
  var lens = getLens(b64)
  var validLen = lens[0]
  var placeHoldersLen = lens[1]
  return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
}

function _byteLength (b64, validLen, placeHoldersLen) {
  return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
}

function toByteArray (b64) {
  var tmp
  var lens = getLens(b64)
  var validLen = lens[0]
  var placeHoldersLen = lens[1]

  var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen))

  var curByte = 0

  // if there are placeholders, only get up to the last complete 4 chars
  var len = placeHoldersLen > 0
    ? validLen - 4
    : validLen

  for (var i = 0; i < len; i += 4) {
    tmp =
      (revLookup[b64.charCodeAt(i)] << 18) |
      (revLookup[b64.charCodeAt(i + 1)] << 12) |
      (revLookup[b64.charCodeAt(i + 2)] << 6) |
      revLookup[b64.charCodeAt(i + 3)]
    arr[curByte++] = (tmp >> 16) & 0xFF
    arr[curByte++] = (tmp >> 8) & 0xFF
    arr[curByte++] = tmp & 0xFF
  }

  if (placeHoldersLen === 2) {
    tmp =
      (revLookup[b64.charCodeAt(i)] << 2) |
      (revLookup[b64.charCodeAt(i + 1)] >> 4)
    arr[curByte++] = tmp & 0xFF
  }

  if (placeHoldersLen === 1) {
    tmp =
      (revLookup[b64.charCodeAt(i)] << 10) |
      (revLookup[b64.charCodeAt(i + 1)] << 4) |
      (revLookup[b64.charCodeAt(i + 2)] >> 2)
    arr[curByte++] = (tmp >> 8) & 0xFF
    arr[curByte++] = tmp & 0xFF
  }

  return arr
}

function tripletToBase64 (num) {
  return lookup[num >> 18 & 0x3F] +
    lookup[num >> 12 & 0x3F] +
    lookup[num >> 6 & 0x3F] +
    lookup[num & 0x3F]
}

function encodeChunk (uint8, start, end) {
  var tmp
  var output = []
  for (var i = start; i < end; i += 3) {
    tmp =
      ((uint8[i] << 16) & 0xFF0000) +
      ((uint8[i + 1] << 8) & 0xFF00) +
      (uint8[i + 2] & 0xFF)
    output.push(tripletToBase64(tmp))
  }
  return output.join('')
}

function fromByteArray (uint8) {
  var tmp
  var len = uint8.length
  var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes
  var parts = []
  var maxChunkLength = 16383 // must be multiple of 3

  // go through the array every three bytes, we'll deal with trailing stuff later
  for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
    parts.push(encodeChunk(
      uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)
    ))
  }

  // pad the end with zeros, but make sure to not forget the extra bytes
  if (extraBytes === 1) {
    tmp = uint8[len - 1]
    parts.push(
      lookup[tmp >> 2] +
      lookup[(tmp << 4) & 0x3F] +
      '=='
    )
  } else if (extraBytes === 2) {
    tmp = (uint8[len - 2] << 8) + uint8[len - 1]
    parts.push(
      lookup[tmp >> 10] +
      lookup[(tmp >> 4) & 0x3F] +
      lookup[(tmp << 2) & 0x3F] +
      '='
    )
  }

  return parts.join('')
}

},{}],9:[function(require,module,exports){
/* Copyright 2013 Google Inc. All Rights Reserved.

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.

   Lookup tables to map prefix codes to value ranges. This is used during
   decoding of the block lengths, literal insertion lengths and copy lengths.
*/

/* Represents the range of values belonging to a prefix code: */
/* [offset, offset + 2^nbits) */
function PrefixCodeRange(offset, nbits) {
  this.offset = offset;
  this.nbits = nbits;
}

exports.kBlockLengthPrefixCode = [
  new PrefixCodeRange(1, 2), new PrefixCodeRange(5, 2), new PrefixCodeRange(9, 2), new PrefixCodeRange(13, 2),
  new PrefixCodeRange(17, 3), new PrefixCodeRange(25, 3), new PrefixCodeRange(33, 3), new PrefixCodeRange(41, 3),
  new PrefixCodeRange(49, 4), new PrefixCodeRange(65, 4), new PrefixCodeRange(81, 4), new PrefixCodeRange(97, 4),
  new PrefixCodeRange(113, 5), new PrefixCodeRange(145, 5), new PrefixCodeRange(177, 5), new PrefixCodeRange(209, 5),
  new PrefixCodeRange(241, 6), new PrefixCodeRange(305, 6), new PrefixCodeRange(369, 7), new PrefixCodeRange(497, 8),
  new PrefixCodeRange(753, 9), new PrefixCodeRange(1265, 10), new PrefixCodeRange(2289, 11), new PrefixCodeRange(4337, 12),
  new PrefixCodeRange(8433, 13), new PrefixCodeRange(16625, 24)
];

exports.kInsertLengthPrefixCode = [
  new PrefixCodeRange(0, 0), new PrefixCodeRange(1, 0), new PrefixCodeRange(2, 0), new PrefixCodeRange(3, 0),
  new PrefixCodeRange(4, 0), new PrefixCodeRange(5, 0), new PrefixCodeRange(6, 1), new PrefixCodeRange(8, 1),
  new PrefixCodeRange(10, 2), new PrefixCodeRange(14, 2), new PrefixCodeRange(18, 3), new PrefixCodeRange(26, 3),
  new PrefixCodeRange(34, 4), new PrefixCodeRange(50, 4), new PrefixCodeRange(66, 5), new PrefixCodeRange(98, 5),
  new PrefixCodeRange(130, 6), new PrefixCodeRange(194, 7), new PrefixCodeRange(322, 8), new PrefixCodeRange(578, 9),
  new PrefixCodeRange(1090, 10), new PrefixCodeRange(2114, 12), new PrefixCodeRange(6210, 14), new PrefixCodeRange(22594, 24),
];

exports.kCopyLengthPrefixCode = [
  new PrefixCodeRange(2, 0), new PrefixCodeRange(3, 0), new PrefixCodeRange(4, 0), new PrefixCodeRange(5, 0),
  new PrefixCodeRange(6, 0), new PrefixCodeRange(7, 0), new PrefixCodeRange(8, 0), new PrefixCodeRange(9, 0),
  new PrefixCodeRange(10, 1), new PrefixCodeRange(12, 1), new PrefixCodeRange(14, 2), new PrefixCodeRange(18, 2),
  new PrefixCodeRange(22, 3), new PrefixCodeRange(30, 3), new PrefixCodeRange(38, 4), new PrefixCodeRange(54, 4),
  new PrefixCodeRange(70, 5), new PrefixCodeRange(102, 5), new PrefixCodeRange(134, 6), new PrefixCodeRange(198, 7),
  new PrefixCodeRange(326, 8), new PrefixCodeRange(582, 9), new PrefixCodeRange(1094, 10), new PrefixCodeRange(2118, 24),
];

exports.kInsertRangeLut = [
  0, 0, 8, 8, 0, 16, 8, 16, 16,
];

exports.kCopyRangeLut = [
  0, 8, 0, 8, 16, 0, 16, 8, 16,
];

},{}],10:[function(require,module,exports){
function BrotliInput(buffer) {
  this.buffer = buffer;
  this.pos = 0;
}

BrotliInput.prototype.read = function(buf, i, count) {
  if (this.pos + count > this.buffer.length) {
    count = this.buffer.length - this.pos;
  }

  for (var p = 0; p < count; p++)
    buf[i + p] = this.buffer[this.pos + p];

  this.pos += count;
  return count;
}

exports.BrotliInput = BrotliInput;

function BrotliOutput(buf) {
  this.buffer = buf;
  this.pos = 0;
}

BrotliOutput.prototype.write = function(buf, count) {
  if (this.pos + count > this.buffer.length)
    throw new Error('Output buffer is not large enough');

  this.buffer.set(buf.subarray(0, count), this.pos);
  this.pos += count;
  return count;
};

exports.BrotliOutput = BrotliOutput;

},{}],11:[function(require,module,exports){
/* Copyright 2013 Google Inc. All Rights Reserved.

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.

   Transformations on dictionary words.
*/

var BrotliDictionary = require('./dictionary');

var kIdentity       = 0;
var kOmitLast1      = 1;
var kOmitLast2      = 2;
var kOmitLast3      = 3;
var kOmitLast4      = 4;
var kOmitLast5      = 5;
var kOmitLast6      = 6;
var kOmitLast7      = 7;
var kOmitLast8      = 8;
var kOmitLast9      = 9;
var kUppercaseFirst = 10;
var kUppercaseAll   = 11;
var kOmitFirst1     = 12;
var kOmitFirst2     = 13;
var kOmitFirst3     = 14;
var kOmitFirst4     = 15;
var kOmitFirst5     = 16;
var kOmitFirst6     = 17;
var kOmitFirst7     = 18;
var kOmitFirst8     = 19;
var kOmitFirst9     = 20;

function Transform(prefix, transform, suffix) {
  this.prefix = new Uint8Array(prefix.length);
  this.transform = transform;
  this.suffix = new Uint8Array(suffix.length);

  for (var i = 0; i < prefix.length; i++)
    this.prefix[i] = prefix.charCodeAt(i);

  for (var i = 0; i < suffix.length; i++)
    this.suffix[i] = suffix.charCodeAt(i);
}

var kTransforms = [
     new Transform(         "", kIdentity,       ""           ),
     new Transform(         "", kIdentity,       " "          ),
     new Transform(        " ", kIdentity,       " "          ),
     new Transform(         "", kOmitFirst1,     ""           ),
     new Transform(         "", kUppercaseFirst, " "          ),
     new Transform(         "", kIdentity,       " the "      ),
     new Transform(        " ", kIdentity,       ""           ),
     new Transform(       "s ", kIdentity,       " "          ),
     new Transform(         "", kIdentity,       " of "       ),
     new Transform(         "", kUppercaseFirst, ""           ),
     new Transform(         "", kIdentity,       " and "      ),
     new Transform(         "", kOmitFirst2,     ""           ),
     new Transform(         "", kOmitLast1,      ""           ),
     new Transform(       ", ", kIdentity,       " "          ),
     new Transform(         "", kIdentity,       ", "         ),
     new Transform(        " ", kUppercaseFirst, " "          ),
     new Transform(         "", kIdentity,       " in "       ),
     new Transform(         "", kIdentity,       " to "       ),
     new Transform(       "e ", kIdentity,       " "          ),
     new Transform(         "", kIdentity,       "\""         ),
     new Transform(         "", kIdentity,       "."          ),
     new Transform(         "", kIdentity,       "\">"        ),
     new Transform(         "", kIdentity,       "\n"         ),
     new Transform(         "", kOmitLast3,      ""           ),
     new Transform(         "", kIdentity,       "]"          ),
     new Transform(         "", kIdentity,       " for "      ),
     new Transform(         "", kOmitFirst3,     ""           ),
     new Transform(         "", kOmitLast2,      ""           ),
     new Transform(         "", kIdentity,       " a "        ),
     new Transform(         "", kIdentity,       " that "     ),
     new Transform(        " ", kUppercaseFirst, ""           ),
     new Transform(         "", kIdentity,       ". "         ),
     new Transform(        ".", kIdentity,       ""           ),
     new Transform(        " ", kIdentity,       ", "         ),
     new Transform(         "", kOmitFirst4,     ""           ),
     new Transform(         "", kIdentity,       " with "     ),
     new Transform(         "", kIdentity,       "'"          ),
     new Transform(         "", kIdentity,       " from "     ),
     new Transform(         "", kIdentity,       " by "       ),
     new Transform(         "", kOmitFirst5,     ""           ),
     new Transform(         "", kOmitFirst6,     ""           ),
     new Transform(    " the ", kIdentity,       ""           ),
     new Transform(         "", kOmitLast4,      ""           ),
     new Transform(         "", kIdentity,       ". The "     ),
     new Transform(         "", kUppercaseAll,   ""           ),
     new Transform(         "", kIdentity,       " on "       ),
     new Transform(         "", kIdentity,       " as "       ),
     new Transform(         "", kIdentity,       " is "       ),
     new Transform(         "", kOmitLast7,      ""           ),
     new Transform(         "", kOmitLast1,      "ing "       ),
     new Transform(         "", kIdentity,       "\n\t"       ),
     new Transform(         "", kIdentity,       ":"          ),
     new Transform(        " ", kIdentity,       ". "         ),
     new Transform(         "", kIdentity,       "ed "        ),
     new Transform(         "", kOmitFirst9,     ""           ),
     new Transform(         "", kOmitFirst7,     ""           ),
     new Transform(         "", kOmitLast6,      ""           ),
     new Transform(         "", kIdentity,       "("          ),
     new Transform(         "", kUppercaseFirst, ", "         ),
     new Transform(         "", kOmitLast8,      ""           ),
     new Transform(         "", kIdentity,       " at "       ),
     new Transform(         "", kIdentity,       "ly "        ),
     new Transform(    " the ", kIdentity,       " of "       ),
     new Transform(         "", kOmitLast5,      ""           ),
     new Transform(         "", kOmitLast9,      ""           ),
     new Transform(        " ", kUppercaseFirst, ", "         ),
     new Transform(         "", kUppercaseFirst, "\""         ),
     new Transform(        ".", kIdentity,       "("          ),
     new Transform(         "", kUppercaseAll,   " "          ),
     new Transform(         "", kUppercaseFirst, "\">"        ),
     new Transform(         "", kIdentity,       "=\""        ),
     new Transform(        " ", kIdentity,       "."          ),
     new Transform(    ".com/", kIdentity,       ""           ),
     new Transform(    " the ", kIdentity,       " of the "   ),
     new Transform(         "", kUppercaseFirst, "'"          ),
     new Transform(         "", kIdentity,       ". This "    ),
     new Transform(         "", kIdentity,       ","          ),
     new Transform(        ".", kIdentity,       " "          ),
     new Transform(         "", kUppercaseFirst, "("          ),
     new Transform(         "", kUppercaseFirst, "."          ),
     new Transform(         "", kIdentity,       " not "      ),
     new Transform(        " ", kIdentity,       "=\""        ),
     new Transform(         "", kIdentity,       "er "        ),
     new Transform(        " ", kUppercaseAll,   " "          ),
     new Transform(         "", kIdentity,       "al "        ),
     new Transform(        " ", kUppercaseAll,   ""           ),
     new Transform(         "", kIdentity,       "='"         ),
     new Transform(         "", kUppercaseAll,   "\""         ),
     new Transform(         "", kUppercaseFirst, ". "         ),
     new Transform(        " ", kIdentity,       "("          ),
     new Transform(         "", kIdentity,       "ful "       ),
     new Transform(        " ", kUppercaseFirst, ". "         ),
     new Transform(         "", kIdentity,       "ive "       ),
     new Transform(         "", kIdentity,       "less "      ),
     new Transform(         "", kUppercaseAll,   "'"          ),
     new Transform(         "", kIdentity,       "est "       ),
     new Transform(        " ", kUppercaseFirst, "."          ),
     new Transform(         "", kUppercaseAll,   "\">"        ),
     new Transform(        " ", kIdentity,       "='"         ),
     new Transform(         "", kUppercaseFirst, ","          ),
     new Transform(         "", kIdentity,       "ize "       ),
     new Transform(         "", kUppercaseAll,   "."          ),
     new Transform( "\xc2\xa0", kIdentity,       ""           ),
     new Transform(        " ", kIdentity,       ","          ),
     new Transform(         "", kUppercaseFirst, "=\""        ),
     new Transform(         "", kUppercaseAll,   "=\""        ),
     new Transform(         "", kIdentity,       "ous "       ),
     new Transform(         "", kUppercaseAll,   ", "         ),
     new Transform(         "", kUppercaseFirst, "='"         ),
     new Transform(        " ", kUppercaseFirst, ","          ),
     new Transform(        " ", kUppercaseAll,   "=\""        ),
     new Transform(        " ", kUppercaseAll,   ", "         ),
     new Transform(         "", kUppercaseAll,   ","          ),
     new Transform(         "", kUppercaseAll,   "("          ),
     new Transform(         "", kUppercaseAll,   ". "         ),
     new Transform(        " ", kUppercaseAll,   "."          ),
     new Transform(         "", kUppercaseAll,   "='"         ),
     new Transform(        " ", kUppercaseAll,   ". "         ),
     new Transform(        " ", kUppercaseFirst, "=\""        ),
     new Transform(        " ", kUppercaseAll,   "='"         ),
     new Transform(        " ", kUppercaseFirst, "='"         )
];

exports.kTransforms = kTransforms;
exports.kNumTransforms = kTransforms.length;

function ToUpperCase(p, i) {
  if (p[i] < 0xc0) {
    if (p[i] >= 97 && p[i] <= 122) {
      p[i] ^= 32;
    }
    return 1;
  }

  /* An overly simplified uppercasing model for utf-8. */
  if (p[i] < 0xe0) {
    p[i + 1] ^= 32;
    return 2;
  }

  /* An arbitrary transform for three byte characters. */
  p[i + 2] ^= 5;
  return 3;
}

exports.transformDictionaryWord = function(dst, idx, word, len, transform) {
  var prefix = kTransforms[transform].prefix;
  var suffix = kTransforms[transform].suffix;
  var t = kTransforms[transform].transform;
  var skip = t < kOmitFirst1 ? 0 : t - (kOmitFirst1 - 1);
  var i = 0;
  var start_idx = idx;
  var uppercase;

  if (skip > len) {
    skip = len;
  }

  var prefix_pos = 0;
  while (prefix_pos < prefix.length) {
    dst[idx++] = prefix[prefix_pos++];
  }

  word += skip;
  len -= skip;

  if (t <= kOmitLast9) {
    len -= t;
  }

  for (i = 0; i < len; i++) {
    dst[idx++] = BrotliDictionary.dictionary[word + i];
  }

  uppercase = idx - len;

  if (t === kUppercaseFirst) {
    ToUpperCase(dst, uppercase);
  } else if (t === kUppercaseAll) {
    while (len > 0) {
      var step = ToUpperCase(dst, uppercase);
      uppercase += step;
      len -= step;
    }
  }

  var suffix_pos = 0;
  while (suffix_pos < suffix.length) {
    dst[idx++] = suffix[suffix_pos++];
  }

  return idx - start_idx;
}

},{"./dictionary":6}],12:[function(require,module,exports){
module.exports = require('./dec/decode').BrotliDecompressBuffer;

},{"./dec/decode":3}]},{},[12])(12)
});
/* eslint-enable */


/***/ }),

/***/ 9681:
/***/ ((module) => {

var characterMap = {
	"À": "A",
	"Á": "A",
	"Â": "A",
	"Ã": "A",
	"Ä": "A",
	"Å": "A",
	"Ấ": "A",
	"Ắ": "A",
	"Ẳ": "A",
	"Ẵ": "A",
	"Ặ": "A",
	"Æ": "AE",
	"Ầ": "A",
	"Ằ": "A",
	"Ȃ": "A",
	"Ả": "A",
	"Ạ": "A",
	"Ẩ": "A",
	"Ẫ": "A",
	"Ậ": "A",
	"Ç": "C",
	"Ḉ": "C",
	"È": "E",
	"É": "E",
	"Ê": "E",
	"Ë": "E",
	"Ế": "E",
	"Ḗ": "E",
	"Ề": "E",
	"Ḕ": "E",
	"Ḝ": "E",
	"Ȇ": "E",
	"Ẻ": "E",
	"Ẽ": "E",
	"Ẹ": "E",
	"Ể": "E",
	"Ễ": "E",
	"Ệ": "E",
	"Ì": "I",
	"Í": "I",
	"Î": "I",
	"Ï": "I",
	"Ḯ": "I",
	"Ȋ": "I",
	"Ỉ": "I",
	"Ị": "I",
	"Ð": "D",
	"Ñ": "N",
	"Ò": "O",
	"Ó": "O",
	"Ô": "O",
	"Õ": "O",
	"Ö": "O",
	"Ø": "O",
	"Ố": "O",
	"Ṍ": "O",
	"Ṓ": "O",
	"Ȏ": "O",
	"Ỏ": "O",
	"Ọ": "O",
	"Ổ": "O",
	"Ỗ": "O",
	"Ộ": "O",
	"Ờ": "O",
	"Ở": "O",
	"Ỡ": "O",
	"Ớ": "O",
	"Ợ": "O",
	"Ù": "U",
	"Ú": "U",
	"Û": "U",
	"Ü": "U",
	"Ủ": "U",
	"Ụ": "U",
	"Ử": "U",
	"Ữ": "U",
	"Ự": "U",
	"Ý": "Y",
	"à": "a",
	"á": "a",
	"â": "a",
	"ã": "a",
	"ä": "a",
	"å": "a",
	"ấ": "a",
	"ắ": "a",
	"ẳ": "a",
	"ẵ": "a",
	"ặ": "a",
	"æ": "ae",
	"ầ": "a",
	"ằ": "a",
	"ȃ": "a",
	"ả": "a",
	"ạ": "a",
	"ẩ": "a",
	"ẫ": "a",
	"ậ": "a",
	"ç": "c",
	"ḉ": "c",
	"è": "e",
	"é": "e",
	"ê": "e",
	"ë": "e",
	"ế": "e",
	"ḗ": "e",
	"ề": "e",
	"ḕ": "e",
	"ḝ": "e",
	"ȇ": "e",
	"ẻ": "e",
	"ẽ": "e",
	"ẹ": "e",
	"ể": "e",
	"ễ": "e",
	"ệ": "e",
	"ì": "i",
	"í": "i",
	"î": "i",
	"ï": "i",
	"ḯ": "i",
	"ȋ": "i",
	"ỉ": "i",
	"ị": "i",
	"ð": "d",
	"ñ": "n",
	"ò": "o",
	"ó": "o",
	"ô": "o",
	"õ": "o",
	"ö": "o",
	"ø": "o",
	"ố": "o",
	"ṍ": "o",
	"ṓ": "o",
	"ȏ": "o",
	"ỏ": "o",
	"ọ": "o",
	"ổ": "o",
	"ỗ": "o",
	"ộ": "o",
	"ờ": "o",
	"ở": "o",
	"ỡ": "o",
	"ớ": "o",
	"ợ": "o",
	"ù": "u",
	"ú": "u",
	"û": "u",
	"ü": "u",
	"ủ": "u",
	"ụ": "u",
	"ử": "u",
	"ữ": "u",
	"ự": "u",
	"ý": "y",
	"ÿ": "y",
	"Ā": "A",
	"ā": "a",
	"Ă": "A",
	"ă": "a",
	"Ą": "A",
	"ą": "a",
	"Ć": "C",
	"ć": "c",
	"Ĉ": "C",
	"ĉ": "c",
	"Ċ": "C",
	"ċ": "c",
	"Č": "C",
	"č": "c",
	"C̆": "C",
	"c̆": "c",
	"Ď": "D",
	"ď": "d",
	"Đ": "D",
	"đ": "d",
	"Ē": "E",
	"ē": "e",
	"Ĕ": "E",
	"ĕ": "e",
	"Ė": "E",
	"ė": "e",
	"Ę": "E",
	"ę": "e",
	"Ě": "E",
	"ě": "e",
	"Ĝ": "G",
	"Ǵ": "G",
	"ĝ": "g",
	"ǵ": "g",
	"Ğ": "G",
	"ğ": "g",
	"Ġ": "G",
	"ġ": "g",
	"Ģ": "G",
	"ģ": "g",
	"Ĥ": "H",
	"ĥ": "h",
	"Ħ": "H",
	"ħ": "h",
	"Ḫ": "H",
	"ḫ": "h",
	"Ĩ": "I",
	"ĩ": "i",
	"Ī": "I",
	"ī": "i",
	"Ĭ": "I",
	"ĭ": "i",
	"Į": "I",
	"į": "i",
	"İ": "I",
	"ı": "i",
	"Ĳ": "IJ",
	"ĳ": "ij",
	"Ĵ": "J",
	"ĵ": "j",
	"Ķ": "K",
	"ķ": "k",
	"Ḱ": "K",
	"ḱ": "k",
	"K̆": "K",
	"k̆": "k",
	"Ĺ": "L",
	"ĺ": "l",
	"Ļ": "L",
	"ļ": "l",
	"Ľ": "L",
	"ľ": "l",
	"Ŀ": "L",
	"ŀ": "l",
	"Ł": "l",
	"ł": "l",
	"Ḿ": "M",
	"ḿ": "m",
	"M̆": "M",
	"m̆": "m",
	"Ń": "N",
	"ń": "n",
	"Ņ": "N",
	"ņ": "n",
	"Ň": "N",
	"ň": "n",
	"ŉ": "n",
	"N̆": "N",
	"n̆": "n",
	"Ō": "O",
	"ō": "o",
	"Ŏ": "O",
	"ŏ": "o",
	"Ő": "O",
	"ő": "o",
	"Œ": "OE",
	"œ": "oe",
	"P̆": "P",
	"p̆": "p",
	"Ŕ": "R",
	"ŕ": "r",
	"Ŗ": "R",
	"ŗ": "r",
	"Ř": "R",
	"ř": "r",
	"R̆": "R",
	"r̆": "r",
	"Ȓ": "R",
	"ȓ": "r",
	"Ś": "S",
	"ś": "s",
	"Ŝ": "S",
	"ŝ": "s",
	"Ş": "S",
	"Ș": "S",
	"ș": "s",
	"ş": "s",
	"Š": "S",
	"š": "s",
	"Ţ": "T",
	"ţ": "t",
	"ț": "t",
	"Ț": "T",
	"Ť": "T",
	"ť": "t",
	"Ŧ": "T",
	"ŧ": "t",
	"T̆": "T",
	"t̆": "t",
	"Ũ": "U",
	"ũ": "u",
	"Ū": "U",
	"ū": "u",
	"Ŭ": "U",
	"ŭ": "u",
	"Ů": "U",
	"ů": "u",
	"Ű": "U",
	"ű": "u",
	"Ų": "U",
	"ų": "u",
	"Ȗ": "U",
	"ȗ": "u",
	"V̆": "V",
	"v̆": "v",
	"Ŵ": "W",
	"ŵ": "w",
	"Ẃ": "W",
	"ẃ": "w",
	"X̆": "X",
	"x̆": "x",
	"Ŷ": "Y",
	"ŷ": "y",
	"Ÿ": "Y",
	"Y̆": "Y",
	"y̆": "y",
	"Ź": "Z",
	"ź": "z",
	"Ż": "Z",
	"ż": "z",
	"Ž": "Z",
	"ž": "z",
	"ſ": "s",
	"ƒ": "f",
	"Ơ": "O",
	"ơ": "o",
	"Ư": "U",
	"ư": "u",
	"Ǎ": "A",
	"ǎ": "a",
	"Ǐ": "I",
	"ǐ": "i",
	"Ǒ": "O",
	"ǒ": "o",
	"Ǔ": "U",
	"ǔ": "u",
	"Ǖ": "U",
	"ǖ": "u",
	"Ǘ": "U",
	"ǘ": "u",
	"Ǚ": "U",
	"ǚ": "u",
	"Ǜ": "U",
	"ǜ": "u",
	"Ứ": "U",
	"ứ": "u",
	"Ṹ": "U",
	"ṹ": "u",
	"Ǻ": "A",
	"ǻ": "a",
	"Ǽ": "AE",
	"ǽ": "ae",
	"Ǿ": "O",
	"ǿ": "o",
	"Þ": "TH",
	"þ": "th",
	"Ṕ": "P",
	"ṕ": "p",
	"Ṥ": "S",
	"ṥ": "s",
	"X́": "X",
	"x́": "x",
	"Ѓ": "Г",
	"ѓ": "г",
	"Ќ": "К",
	"ќ": "к",
	"A̋": "A",
	"a̋": "a",
	"E̋": "E",
	"e̋": "e",
	"I̋": "I",
	"i̋": "i",
	"Ǹ": "N",
	"ǹ": "n",
	"Ồ": "O",
	"ồ": "o",
	"Ṑ": "O",
	"ṑ": "o",
	"Ừ": "U",
	"ừ": "u",
	"Ẁ": "W",
	"ẁ": "w",
	"Ỳ": "Y",
	"ỳ": "y",
	"Ȁ": "A",
	"ȁ": "a",
	"Ȅ": "E",
	"ȅ": "e",
	"Ȉ": "I",
	"ȉ": "i",
	"Ȍ": "O",
	"ȍ": "o",
	"Ȑ": "R",
	"ȑ": "r",
	"Ȕ": "U",
	"ȕ": "u",
	"B̌": "B",
	"b̌": "b",
	"Č̣": "C",
	"č̣": "c",
	"Ê̌": "E",
	"ê̌": "e",
	"F̌": "F",
	"f̌": "f",
	"Ǧ": "G",
	"ǧ": "g",
	"Ȟ": "H",
	"ȟ": "h",
	"J̌": "J",
	"ǰ": "j",
	"Ǩ": "K",
	"ǩ": "k",
	"M̌": "M",
	"m̌": "m",
	"P̌": "P",
	"p̌": "p",
	"Q̌": "Q",
	"q̌": "q",
	"Ř̩": "R",
	"ř̩": "r",
	"Ṧ": "S",
	"ṧ": "s",
	"V̌": "V",
	"v̌": "v",
	"W̌": "W",
	"w̌": "w",
	"X̌": "X",
	"x̌": "x",
	"Y̌": "Y",
	"y̌": "y",
	"A̧": "A",
	"a̧": "a",
	"B̧": "B",
	"b̧": "b",
	"Ḑ": "D",
	"ḑ": "d",
	"Ȩ": "E",
	"ȩ": "e",
	"Ɛ̧": "E",
	"ɛ̧": "e",
	"Ḩ": "H",
	"ḩ": "h",
	"I̧": "I",
	"i̧": "i",
	"Ɨ̧": "I",
	"ɨ̧": "i",
	"M̧": "M",
	"m̧": "m",
	"O̧": "O",
	"o̧": "o",
	"Q̧": "Q",
	"q̧": "q",
	"U̧": "U",
	"u̧": "u",
	"X̧": "X",
	"x̧": "x",
	"Z̧": "Z",
	"z̧": "z",
	"й":"и",
	"Й":"И",
	"ё":"е",
	"Ё":"Е",
};

var chars = Object.keys(characterMap).join('|');
var allAccents = new RegExp(chars, 'g');
var firstAccent = new RegExp(chars, '');

function matcher(match) {
	return characterMap[match];
}

var removeAccents = function(string) {
	return string.replace(allAccents, matcher);
};

var hasAccents = function(string) {
	return !!string.match(firstAccent);
};

module.exports = removeAccents;
module.exports.has = hasAccents;
module.exports.remove = removeAccents;


/***/ })

/******/ 	});
/************************************************************************/
/******/ 	// The module cache
/******/ 	var __webpack_module_cache__ = {};
/******/ 	
/******/ 	// The require function
/******/ 	function __webpack_require__(moduleId) {
/******/ 		// Check if module is in cache
/******/ 		var cachedModule = __webpack_module_cache__[moduleId];
/******/ 		if (cachedModule !== undefined) {
/******/ 			return cachedModule.exports;
/******/ 		}
/******/ 		// Create a new module (and put it into the cache)
/******/ 		var module = __webpack_module_cache__[moduleId] = {
/******/ 			// no module.id needed
/******/ 			// no module.loaded needed
/******/ 			exports: {}
/******/ 		};
/******/ 	
/******/ 		// Execute the module function
/******/ 		__webpack_modules__[moduleId](module, module.exports, __webpack_require__);
/******/ 	
/******/ 		// Return the exports of the module
/******/ 		return module.exports;
/******/ 	}
/******/ 	
/************************************************************************/
/******/ 	/* webpack/runtime/compat get default export */
/******/ 	(() => {
/******/ 		// getDefaultExport function for compatibility with non-harmony modules
/******/ 		__webpack_require__.n = (module) => {
/******/ 			var getter = module && module.__esModule ?
/******/ 				() => (module['default']) :
/******/ 				() => (module);
/******/ 			__webpack_require__.d(getter, { a: getter });
/******/ 			return getter;
/******/ 		};
/******/ 	})();
/******/ 	
/******/ 	/* webpack/runtime/create fake namespace object */
/******/ 	(() => {
/******/ 		var getProto = Object.getPrototypeOf ? (obj) => (Object.getPrototypeOf(obj)) : (obj) => (obj.__proto__);
/******/ 		var leafPrototypes;
/******/ 		// create a fake namespace object
/******/ 		// mode & 1: value is a module id, require it
/******/ 		// mode & 2: merge all properties of value into the ns
/******/ 		// mode & 4: return value when already ns object
/******/ 		// mode & 16: return value when it's Promise-like
/******/ 		// mode & 8|1: behave like require
/******/ 		__webpack_require__.t = function(value, mode) {
/******/ 			if(mode & 1) value = this(value);
/******/ 			if(mode & 8) return value;
/******/ 			if(typeof value === 'object' && value) {
/******/ 				if((mode & 4) && value.__esModule) return value;
/******/ 				if((mode & 16) && typeof value.then === 'function') return value;
/******/ 			}
/******/ 			var ns = Object.create(null);
/******/ 			__webpack_require__.r(ns);
/******/ 			var def = {};
/******/ 			leafPrototypes = leafPrototypes || [null, getProto({}), getProto([]), getProto(getProto)];
/******/ 			for(var current = mode & 2 && value; typeof current == 'object' && !~leafPrototypes.indexOf(current); current = getProto(current)) {
/******/ 				Object.getOwnPropertyNames(current).forEach((key) => (def[key] = () => (value[key])));
/******/ 			}
/******/ 			def['default'] = () => (value);
/******/ 			__webpack_require__.d(ns, def);
/******/ 			return ns;
/******/ 		};
/******/ 	})();
/******/ 	
/******/ 	/* webpack/runtime/define property getters */
/******/ 	(() => {
/******/ 		// define getter functions for harmony exports
/******/ 		__webpack_require__.d = (exports, definition) => {
/******/ 			for(var key in definition) {
/******/ 				if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
/******/ 					Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
/******/ 				}
/******/ 			}
/******/ 		};
/******/ 	})();
/******/ 	
/******/ 	/* webpack/runtime/hasOwnProperty shorthand */
/******/ 	(() => {
/******/ 		__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
/******/ 	})();
/******/ 	
/******/ 	/* webpack/runtime/make namespace object */
/******/ 	(() => {
/******/ 		// define __esModule on exports
/******/ 		__webpack_require__.r = (exports) => {
/******/ 			if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ 				Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ 			}
/******/ 			Object.defineProperty(exports, '__esModule', { value: true });
/******/ 		};
/******/ 	})();
/******/ 	
/************************************************************************/
var __webpack_exports__ = {};
// This entry needs to be wrapped in an IIFE because it needs to be in strict mode.
(() => {
"use strict";
// ESM COMPAT FLAG
__webpack_require__.r(__webpack_exports__);

// EXPORTS
__webpack_require__.d(__webpack_exports__, {
  PluginMoreMenuItem: () => (/* reexport */ PluginMoreMenuItem),
  PluginSidebar: () => (/* reexport */ PluginSidebar),
  PluginSidebarMoreMenuItem: () => (/* reexport */ PluginSidebarMoreMenuItem),
  PluginTemplateSettingPanel: () => (/* reexport */ plugin_template_setting_panel_default),
  initializeEditor: () => (/* binding */ initializeEditor),
  initializePostsDashboard: () => (/* reexport */ initializePostsDashboard),
  reinitializeEditor: () => (/* binding */ reinitializeEditor),
  store: () => (/* reexport */ store)
});

// NAMESPACE OBJECT: ./node_modules/@wordpress/edit-site/build-module/store/actions.js
var actions_namespaceObject = {};
__webpack_require__.r(actions_namespaceObject);
__webpack_require__.d(actions_namespaceObject, {
  __experimentalSetPreviewDeviceType: () => (__experimentalSetPreviewDeviceType),
  addTemplate: () => (addTemplate),
  closeGeneralSidebar: () => (closeGeneralSidebar),
  openGeneralSidebar: () => (openGeneralSidebar),
  openNavigationPanelToMenu: () => (openNavigationPanelToMenu),
  removeTemplate: () => (removeTemplate),
  revertTemplate: () => (revertTemplate),
  setEditedEntity: () => (setEditedEntity),
  setEditedPostContext: () => (setEditedPostContext),
  setHasPageContentFocus: () => (setHasPageContentFocus),
  setHomeTemplateId: () => (setHomeTemplateId),
  setIsInserterOpened: () => (setIsInserterOpened),
  setIsListViewOpened: () => (setIsListViewOpened),
  setIsNavigationPanelOpened: () => (setIsNavigationPanelOpened),
  setIsSaveViewOpened: () => (setIsSaveViewOpened),
  setNavigationMenu: () => (setNavigationMenu),
  setNavigationPanelActiveMenu: () => (setNavigationPanelActiveMenu),
  setPage: () => (setPage),
  setTemplate: () => (setTemplate),
  setTemplatePart: () => (setTemplatePart),
  switchEditorMode: () => (switchEditorMode),
  toggleDistractionFree: () => (toggleDistractionFree),
  toggleFeature: () => (toggleFeature),
  updateSettings: () => (updateSettings)
});

// NAMESPACE OBJECT: ./node_modules/@wordpress/edit-site/build-module/store/private-actions.js
var private_actions_namespaceObject = {};
__webpack_require__.r(private_actions_namespaceObject);
__webpack_require__.d(private_actions_namespaceObject, {
  registerRoute: () => (registerRoute),
  setEditorCanvasContainerView: () => (setEditorCanvasContainerView),
  unregisterRoute: () => (unregisterRoute)
});

// NAMESPACE OBJECT: ./node_modules/@wordpress/edit-site/build-module/store/selectors.js
var selectors_namespaceObject = {};
__webpack_require__.r(selectors_namespaceObject);
__webpack_require__.d(selectors_namespaceObject, {
  __experimentalGetInsertionPoint: () => (__experimentalGetInsertionPoint),
  __experimentalGetPreviewDeviceType: () => (__experimentalGetPreviewDeviceType),
  getCanUserCreateMedia: () => (getCanUserCreateMedia),
  getCurrentTemplateNavigationPanelSubMenu: () => (getCurrentTemplateNavigationPanelSubMenu),
  getCurrentTemplateTemplateParts: () => (getCurrentTemplateTemplateParts),
  getEditedPostContext: () => (getEditedPostContext),
  getEditedPostId: () => (getEditedPostId),
  getEditedPostType: () => (getEditedPostType),
  getEditorMode: () => (getEditorMode),
  getHomeTemplateId: () => (getHomeTemplateId),
  getNavigationPanelActiveMenu: () => (getNavigationPanelActiveMenu),
  getPage: () => (getPage),
  getReusableBlocks: () => (getReusableBlocks),
  getSettings: () => (getSettings),
  hasPageContentFocus: () => (hasPageContentFocus),
  isFeatureActive: () => (isFeatureActive),
  isInserterOpened: () => (isInserterOpened),
  isListViewOpened: () => (isListViewOpened),
  isNavigationOpened: () => (isNavigationOpened),
  isPage: () => (isPage),
  isSaveViewOpened: () => (isSaveViewOpened)
});

// NAMESPACE OBJECT: ./node_modules/@wordpress/edit-site/build-module/store/private-selectors.js
var private_selectors_namespaceObject = {};
__webpack_require__.r(private_selectors_namespaceObject);
__webpack_require__.d(private_selectors_namespaceObject, {
  getEditorCanvasContainerView: () => (getEditorCanvasContainerView),
  getRoutes: () => (getRoutes)
});

;// external "ReactJSXRuntime"
const external_ReactJSXRuntime_namespaceObject = window["ReactJSXRuntime"];
;// external ["wp","blocks"]
const external_wp_blocks_namespaceObject = window["wp"]["blocks"];
;// external ["wp","blockLibrary"]
const external_wp_blockLibrary_namespaceObject = window["wp"]["blockLibrary"];
// EXTERNAL MODULE: external ["wp","data"]
var external_wp_data_ = __webpack_require__(7143);
;// external ["wp","deprecated"]
const external_wp_deprecated_namespaceObject = window["wp"]["deprecated"];
var external_wp_deprecated_default = /*#__PURE__*/__webpack_require__.n(external_wp_deprecated_namespaceObject);
// EXTERNAL MODULE: external ["wp","element"]
var external_wp_element_ = __webpack_require__(6087);
;// external ["wp","editor"]
const external_wp_editor_namespaceObject = window["wp"]["editor"];
// EXTERNAL MODULE: external ["wp","preferences"]
var external_wp_preferences_ = __webpack_require__(1233);
;// external ["wp","widgets"]
const external_wp_widgets_namespaceObject = window["wp"]["widgets"];
;// external ["wp","hooks"]
const external_wp_hooks_namespaceObject = window["wp"]["hooks"];
;// external ["wp","compose"]
const external_wp_compose_namespaceObject = window["wp"]["compose"];
;// external ["wp","blockEditor"]
const external_wp_blockEditor_namespaceObject = window["wp"]["blockEditor"];
;// external ["wp","components"]
const external_wp_components_namespaceObject = window["wp"]["components"];
;// external ["wp","i18n"]
const external_wp_i18n_namespaceObject = window["wp"]["i18n"];
;// external ["wp","notices"]
const external_wp_notices_namespaceObject = window["wp"]["notices"];
;// external ["wp","coreData"]
const external_wp_coreData_namespaceObject = window["wp"]["coreData"];
;// ./node_modules/colord/index.mjs
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,colord_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)||colord_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}},colord_j=function(){function r(r){this.parsed=x(r)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return r.prototype.isValid=function(){return null!==this.parsed},r.prototype.brightness=function(){return n(H(this.rgba),2)},r.prototype.isDark=function(){return H(this.rgba)<.5},r.prototype.isLight=function(){return H(this.rgba)>=.5},r.prototype.toHex=function(){return r=o(this.rgba),t=r.r,e=r.g,u=r.b,i=(a=r.a)<1?s(n(255*a)):"","#"+s(t)+s(e)+s(u)+i;var r,t,e,u,a,i},r.prototype.toRgb=function(){return o(this.rgba)},r.prototype.toRgbString=function(){return r=o(this.rgba),t=r.r,n=r.g,e=r.b,(u=r.a)<1?"rgba("+t+", "+n+", "+e+", "+u+")":"rgb("+t+", "+n+", "+e+")";var r,t,n,e,u},r.prototype.toHsl=function(){return d(c(this.rgba))},r.prototype.toHslString=function(){return r=d(c(this.rgba)),t=r.h,n=r.s,e=r.l,(u=r.a)<1?"hsla("+t+", "+n+"%, "+e+"%, "+u+")":"hsl("+t+", "+n+"%, "+e+"%)";var r,t,n,e,u},r.prototype.toHsv=function(){return r=h(this.rgba),{h:n(r.h),s:n(r.s),v:n(r.v),a:n(r.a,3)};var r},r.prototype.invert=function(){return w({r:255-(r=this.rgba).r,g:255-r.g,b:255-r.b,a:r.a});var r},r.prototype.saturate=function(r){return void 0===r&&(r=.1),w(M(this.rgba,r))},r.prototype.desaturate=function(r){return void 0===r&&(r=.1),w(M(this.rgba,-r))},r.prototype.grayscale=function(){return w(M(this.rgba,-1))},r.prototype.lighten=function(r){return void 0===r&&(r=.1),w($(this.rgba,r))},r.prototype.darken=function(r){return void 0===r&&(r=.1),w($(this.rgba,-r))},r.prototype.rotate=function(r){return void 0===r&&(r=15),this.hue(this.hue()+r)},r.prototype.alpha=function(r){return"number"==typeof r?w({r:(t=this.rgba).r,g:t.g,b:t.b,a:r}):n(this.rgba.a,3);var t},r.prototype.hue=function(r){var t=c(this.rgba);return"number"==typeof r?w({h:r,s:t.s,l:t.l,a:t.a}):n(t.h)},r.prototype.isEqual=function(r){return this.toHex()===w(r).toHex()},r}(),w=function(r){return r instanceof colord_j?r:new colord_j(r)},S=[],k=function(r){r.forEach(function(r){S.indexOf(r)<0&&(r(colord_j,y),S.push(r))})},E=function(){return new colord_j({r:255*Math.random(),g:255*Math.random(),b:255*Math.random()})};

;// ./node_modules/colord/plugins/a11y.mjs
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}}

;// external ["wp","privateApis"]
const external_wp_privateApis_namespaceObject = window["wp"]["privateApis"];
;// ./node_modules/@wordpress/edit-site/build-module/lock-unlock.js

const { lock, unlock } = (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/edit-site"
);


;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/hooks.js






const { useGlobalSetting, useGlobalStyle } = unlock(external_wp_blockEditor_namespaceObject.privateApis);
k([a11y]);
function useColorRandomizer(name) {
  const [themeColors, setThemeColors] = useGlobalSetting(
    "color.palette.theme",
    name
  );
  function randomizeColors() {
    const randomRotationValue = Math.floor(Math.random() * 225);
    const newColors = themeColors.map((colorObject) => {
      const { color } = colorObject;
      const newColor = w(color).rotate(randomRotationValue).toHex();
      return {
        ...colorObject,
        color: newColor
      };
    });
    setThemeColors(newColors);
  }
  return window.__experimentalEnableColorRandomizer ? [randomizeColors] : [];
}
function useStylesPreviewColors() {
  const [textColor = "black"] = useGlobalStyle("color.text");
  const [backgroundColor = "white"] = useGlobalStyle("color.background");
  const [headingColor = textColor] = useGlobalStyle(
    "elements.h1.color.text"
  );
  const [linkColor = headingColor] = useGlobalStyle(
    "elements.link.color.text"
  );
  const [buttonBackgroundColor = linkColor] = useGlobalStyle(
    "elements.button.color.background"
  );
  const [coreColors] = useGlobalSetting("color.palette.core");
  const [themeColors] = useGlobalSetting("color.palette.theme");
  const [customColors] = useGlobalSetting("color.palette.custom");
  const paletteColors = (themeColors ?? []).concat(customColors ?? []).concat(coreColors ?? []);
  const textColorObject = paletteColors.filter(
    ({ color }) => color === textColor
  );
  const buttonBackgroundColorObject = paletteColors.filter(
    ({ color }) => color === buttonBackgroundColor
  );
  const highlightedColors = textColorObject.concat(buttonBackgroundColorObject).concat(paletteColors).filter(
    // we exclude these background color because it is already visible in the preview.
    ({ color }) => color !== backgroundColor
  ).slice(0, 2);
  return {
    paletteColors,
    highlightedColors
  };
}
function useSupportedStyles(name, element) {
  const { supportedPanels } = (0,external_wp_data_.useSelect)(
    (select) => {
      return {
        supportedPanels: unlock(
          select(external_wp_blocks_namespaceObject.store)
        ).getSupportedStyles(name, element)
      };
    },
    [name, element]
  );
  return supportedPanels;
}


;// ./node_modules/@wordpress/edit-site/build-module/utils/set-nested-value.js
function setNestedValue(object, path, value) {
  if (!object || typeof object !== "object") {
    return object;
  }
  path.reduce((acc, key, idx) => {
    if (acc[key] === void 0) {
      if (Number.isInteger(path[idx + 1])) {
        acc[key] = [];
      } else {
        acc[key] = {};
      }
    }
    if (idx === path.length - 1) {
      acc[key] = value;
    }
    return acc[key];
  }, object);
  return object;
}


;// ./node_modules/@wordpress/edit-site/build-module/hooks/push-changes-to-global-styles/index.js














const { cleanEmptyObject, GlobalStylesContext } = unlock(
  external_wp_blockEditor_namespaceObject.privateApis
);
const STYLE_PROPERTY = {
  ...external_wp_blocks_namespaceObject.__EXPERIMENTAL_STYLE_PROPERTY,
  blockGap: { value: ["spacing", "blockGap"] }
};
const STYLE_PATH_TO_CSS_VAR_INFIX = {
  "border.color": "color",
  "color.background": "color",
  "color.text": "color",
  "elements.link.color.text": "color",
  "elements.link.:hover.color.text": "color",
  "elements.link.typography.fontFamily": "font-family",
  "elements.link.typography.fontSize": "font-size",
  "elements.button.color.text": "color",
  "elements.button.color.background": "color",
  "elements.button.typography.fontFamily": "font-family",
  "elements.button.typography.fontSize": "font-size",
  "elements.caption.color.text": "color",
  "elements.heading.color": "color",
  "elements.heading.color.background": "color",
  "elements.heading.typography.fontFamily": "font-family",
  "elements.heading.gradient": "gradient",
  "elements.heading.color.gradient": "gradient",
  "elements.h1.color": "color",
  "elements.h1.color.background": "color",
  "elements.h1.typography.fontFamily": "font-family",
  "elements.h1.color.gradient": "gradient",
  "elements.h2.color": "color",
  "elements.h2.color.background": "color",
  "elements.h2.typography.fontFamily": "font-family",
  "elements.h2.color.gradient": "gradient",
  "elements.h3.color": "color",
  "elements.h3.color.background": "color",
  "elements.h3.typography.fontFamily": "font-family",
  "elements.h3.color.gradient": "gradient",
  "elements.h4.color": "color",
  "elements.h4.color.background": "color",
  "elements.h4.typography.fontFamily": "font-family",
  "elements.h4.color.gradient": "gradient",
  "elements.h5.color": "color",
  "elements.h5.color.background": "color",
  "elements.h5.typography.fontFamily": "font-family",
  "elements.h5.color.gradient": "gradient",
  "elements.h6.color": "color",
  "elements.h6.color.background": "color",
  "elements.h6.typography.fontFamily": "font-family",
  "elements.h6.color.gradient": "gradient",
  "color.gradient": "gradient",
  blockGap: "spacing",
  "typography.fontSize": "font-size",
  "typography.fontFamily": "font-family"
};
const STYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE = {
  "border.color": "borderColor",
  "color.background": "backgroundColor",
  "color.text": "textColor",
  "color.gradient": "gradient",
  "typography.fontSize": "fontSize",
  "typography.fontFamily": "fontFamily"
};
const SUPPORTED_STYLES = ["border", "color", "spacing", "typography"];
const getValueFromObjectPath = (object, path) => {
  let value = object;
  path.forEach((fieldName) => {
    value = value?.[fieldName];
  });
  return value;
};
const flatBorderProperties = ["borderColor", "borderWidth", "borderStyle"];
const sides = ["top", "right", "bottom", "left"];
function getBorderStyleChanges(border, presetColor, userStyle) {
  if (!border && !presetColor) {
    return [];
  }
  const changes = [
    ...getFallbackBorderStyleChange("top", border, userStyle),
    ...getFallbackBorderStyleChange("right", border, userStyle),
    ...getFallbackBorderStyleChange("bottom", border, userStyle),
    ...getFallbackBorderStyleChange("left", border, userStyle)
  ];
  const { color: customColor, style, width } = border || {};
  const hasColorOrWidth = presetColor || customColor || width;
  if (hasColorOrWidth && !style) {
    sides.forEach((side) => {
      if (!userStyle?.[side]?.style) {
        changes.push({
          path: ["border", side, "style"],
          value: "solid"
        });
      }
    });
  }
  return changes;
}
function getFallbackBorderStyleChange(side, border, globalBorderStyle) {
  if (!border?.[side] || globalBorderStyle?.[side]?.style) {
    return [];
  }
  const { color, style, width } = border[side];
  const hasColorOrWidth = color || width;
  if (!hasColorOrWidth || style) {
    return [];
  }
  return [{ path: ["border", side, "style"], value: "solid" }];
}
function useChangesToPush(name, attributes, userConfig) {
  const supports = useSupportedStyles(name);
  const blockUserConfig = userConfig?.styles?.blocks?.[name];
  return (0,external_wp_element_.useMemo)(() => {
    const changes = supports.flatMap((key) => {
      if (!STYLE_PROPERTY[key]) {
        return [];
      }
      const { value: path } = STYLE_PROPERTY[key];
      const presetAttributeKey = path.join(".");
      const presetAttributeValue = attributes[STYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE[presetAttributeKey]];
      const value = presetAttributeValue ? `var:preset|${STYLE_PATH_TO_CSS_VAR_INFIX[presetAttributeKey]}|${presetAttributeValue}` : getValueFromObjectPath(attributes.style, path);
      if (key === "linkColor") {
        const linkChanges = value ? [{ path, value }] : [];
        const hoverPath = [
          "elements",
          "link",
          ":hover",
          "color",
          "text"
        ];
        const hoverValue = getValueFromObjectPath(
          attributes.style,
          hoverPath
        );
        if (hoverValue) {
          linkChanges.push({ path: hoverPath, value: hoverValue });
        }
        return linkChanges;
      }
      if (flatBorderProperties.includes(key) && value) {
        const borderChanges = [{ path, value }];
        sides.forEach((side) => {
          const currentPath = [...path];
          currentPath.splice(-1, 0, side);
          borderChanges.push({ path: currentPath, value });
        });
        return borderChanges;
      }
      return value ? [{ path, value }] : [];
    });
    getBorderStyleChanges(
      attributes.style?.border,
      attributes.borderColor,
      blockUserConfig?.border
    ).forEach((change) => changes.push(change));
    return changes;
  }, [supports, attributes, blockUserConfig]);
}
function PushChangesToGlobalStylesControl({
  name,
  attributes,
  setAttributes
}) {
  const { user: userConfig, setUserConfig } = (0,external_wp_element_.useContext)(GlobalStylesContext);
  const changes = useChangesToPush(name, attributes, userConfig);
  const { __unstableMarkNextChangeAsNotPersistent } = (0,external_wp_data_.useDispatch)(external_wp_blockEditor_namespaceObject.store);
  const { createSuccessNotice } = (0,external_wp_data_.useDispatch)(external_wp_notices_namespaceObject.store);
  const pushChanges = (0,external_wp_element_.useCallback)(() => {
    if (changes.length === 0) {
      return;
    }
    if (changes.length > 0) {
      const { style: blockStyles } = attributes;
      const newBlockStyles = structuredClone(blockStyles);
      const newUserConfig = structuredClone(userConfig);
      for (const { path, value } of changes) {
        setNestedValue(newBlockStyles, path, void 0);
        setNestedValue(
          newUserConfig,
          ["styles", "blocks", name, ...path],
          value
        );
      }
      const newBlockAttributes = {
        borderColor: void 0,
        backgroundColor: void 0,
        textColor: void 0,
        gradient: void 0,
        fontSize: void 0,
        fontFamily: void 0,
        style: cleanEmptyObject(newBlockStyles)
      };
      __unstableMarkNextChangeAsNotPersistent();
      setAttributes(newBlockAttributes);
      setUserConfig(newUserConfig, { undoIgnore: true });
      createSuccessNotice(
        (0,external_wp_i18n_namespaceObject.sprintf)(
          // translators: %s: Title of the block e.g. 'Heading'.
          (0,external_wp_i18n_namespaceObject.__)("%s styles applied."),
          (0,external_wp_blocks_namespaceObject.getBlockType)(name).title
        ),
        {
          type: "snackbar",
          actions: [
            {
              label: (0,external_wp_i18n_namespaceObject.__)("Undo"),
              onClick() {
                __unstableMarkNextChangeAsNotPersistent();
                setAttributes(attributes);
                setUserConfig(userConfig, {
                  undoIgnore: true
                });
              }
            }
          ]
        }
      );
    }
  }, [
    __unstableMarkNextChangeAsNotPersistent,
    attributes,
    changes,
    createSuccessNotice,
    name,
    setAttributes,
    setUserConfig,
    userConfig
  ]);
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
    external_wp_components_namespaceObject.BaseControl,
    {
      __nextHasNoMarginBottom: true,
      className: "edit-site-push-changes-to-global-styles-control",
      help: (0,external_wp_i18n_namespaceObject.sprintf)(
        // translators: %s: Title of the block e.g. 'Heading'.
        (0,external_wp_i18n_namespaceObject.__)(
          "Apply this block\u2019s typography, spacing, dimensions, and color styles to all %s blocks."
        ),
        (0,external_wp_blocks_namespaceObject.getBlockType)(name).title
      ),
      children: [
        /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.BaseControl.VisualLabel, { children: (0,external_wp_i18n_namespaceObject.__)("Styles") }),
        /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
          external_wp_components_namespaceObject.Button,
          {
            __next40pxDefaultSize: true,
            variant: "secondary",
            accessibleWhenDisabled: true,
            disabled: changes.length === 0,
            onClick: pushChanges,
            children: (0,external_wp_i18n_namespaceObject.__)("Apply globally")
          }
        )
      ]
    }
  );
}
function PushChangesToGlobalStyles(props) {
  const blockEditingMode = (0,external_wp_blockEditor_namespaceObject.useBlockEditingMode)();
  const isBlockBasedTheme = (0,external_wp_data_.useSelect)(
    (select) => select(external_wp_coreData_namespaceObject.store).getCurrentTheme()?.is_block_theme,
    []
  );
  const supportsStyles = SUPPORTED_STYLES.some(
    (feature) => (0,external_wp_blocks_namespaceObject.hasBlockSupport)(props.name, feature)
  );
  const isDisplayed = blockEditingMode === "default" && supportsStyles && isBlockBasedTheme;
  if (!isDisplayed) {
    return null;
  }
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.InspectorAdvancedControls, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PushChangesToGlobalStylesControl, { ...props }) });
}
const withPushChangesToGlobalStyles = (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(
  (BlockEdit) => (props) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
    /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockEdit, { ...props }, "edit"),
    props.isSelected && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PushChangesToGlobalStyles, { ...props })
  ] })
);
(0,external_wp_hooks_namespaceObject.addFilter)(
  "editor.BlockEdit",
  "core/edit-site/push-changes-to-global-styles",
  withPushChangesToGlobalStyles
);

;// ./node_modules/@wordpress/edit-site/build-module/hooks/index.js


;// ./node_modules/@wordpress/edit-site/build-module/store/reducer.js

function settings(state = {}, action) {
  switch (action.type) {
    case "UPDATE_SETTINGS":
      return {
        ...state,
        ...action.settings
      };
  }
  return state;
}
function editedPost(state = {}, action) {
  switch (action.type) {
    case "SET_EDITED_POST":
      return {
        postType: action.postType,
        id: action.id,
        context: action.context
      };
    case "SET_EDITED_POST_CONTEXT":
      return {
        ...state,
        context: action.context
      };
  }
  return state;
}
function saveViewPanel(state = false, action) {
  switch (action.type) {
    case "SET_IS_SAVE_VIEW_OPENED":
      return action.isOpen;
  }
  return state;
}
function editorCanvasContainerView(state = void 0, action) {
  switch (action.type) {
    case "SET_EDITOR_CANVAS_CONTAINER_VIEW":
      return action.view;
  }
  return state;
}
function routes(state = [], action) {
  switch (action.type) {
    case "REGISTER_ROUTE":
      return [...state, action.route];
    case "UNREGISTER_ROUTE":
      return state.filter((route) => route.name !== action.name);
  }
  return state;
}
var reducer_default = (0,external_wp_data_.combineReducers)({
  settings,
  editedPost,
  saveViewPanel,
  editorCanvasContainerView,
  routes
});


;// external ["wp","patterns"]
const external_wp_patterns_namespaceObject = window["wp"]["patterns"];
;// ./node_modules/@wordpress/edit-site/build-module/utils/constants.js



const NAVIGATION_POST_TYPE = "wp_navigation";
const TEMPLATE_POST_TYPE = "wp_template";
const TEMPLATE_PART_POST_TYPE = "wp_template_part";
const TEMPLATE_ORIGINS = {
  custom: "custom",
  theme: "theme",
  plugin: "plugin"
};
const TEMPLATE_PART_AREA_DEFAULT_CATEGORY = "uncategorized";
const TEMPLATE_PART_ALL_AREAS_CATEGORY = "all-parts";
const {
  PATTERN_TYPES,
  PATTERN_DEFAULT_CATEGORY,
  PATTERN_USER_CATEGORY,
  EXCLUDED_PATTERN_SOURCES,
  PATTERN_SYNC_TYPES
} = unlock(external_wp_patterns_namespaceObject.privateApis);
const FOCUSABLE_ENTITIES = [
  TEMPLATE_PART_POST_TYPE,
  NAVIGATION_POST_TYPE,
  PATTERN_TYPES.user
];
const POST_TYPE_LABELS = {
  [TEMPLATE_POST_TYPE]: (0,external_wp_i18n_namespaceObject.__)("Template"),
  [TEMPLATE_PART_POST_TYPE]: (0,external_wp_i18n_namespaceObject.__)("Template part"),
  [PATTERN_TYPES.user]: (0,external_wp_i18n_namespaceObject.__)("Pattern"),
  [NAVIGATION_POST_TYPE]: (0,external_wp_i18n_namespaceObject.__)("Navigation")
};
const LAYOUT_GRID = "grid";
const LAYOUT_TABLE = "table";
const LAYOUT_LIST = "list";
const OPERATOR_IS = "is";
const OPERATOR_IS_NOT = "isNot";
const OPERATOR_IS_ANY = "isAny";
const OPERATOR_IS_NONE = "isNone";


;// ./node_modules/@wordpress/edit-site/build-module/store/actions.js








const { interfaceStore } = unlock(external_wp_editor_namespaceObject.privateApis);
function toggleFeature(featureName) {
  return function({ registry }) {
    external_wp_deprecated_default()(
      "dispatch( 'core/edit-site' ).toggleFeature( featureName )",
      {
        since: "6.0",
        alternative: "dispatch( 'core/preferences').toggle( 'core/edit-site', featureName )"
      }
    );
    registry.dispatch(external_wp_preferences_.store).toggle("core/edit-site", featureName);
  };
}
const __experimentalSetPreviewDeviceType = (deviceType) => ({ registry }) => {
  external_wp_deprecated_default()(
    "dispatch( 'core/edit-site' ).__experimentalSetPreviewDeviceType",
    {
      since: "6.5",
      version: "6.7",
      hint: "registry.dispatch( editorStore ).setDeviceType"
    }
  );
  registry.dispatch(external_wp_editor_namespaceObject.store).setDeviceType(deviceType);
};
function setTemplate() {
  external_wp_deprecated_default()("dispatch( 'core/edit-site' ).setTemplate", {
    since: "6.5",
    version: "6.8",
    hint: "The setTemplate is not needed anymore, the correct entity is resolved from the URL automatically."
  });
  return {
    type: "NOTHING"
  };
}
const addTemplate = (template) => async ({ dispatch, registry }) => {
  external_wp_deprecated_default()("dispatch( 'core/edit-site' ).addTemplate", {
    since: "6.5",
    version: "6.8",
    hint: "use saveEntityRecord directly"
  });
  const newTemplate = await registry.dispatch(external_wp_coreData_namespaceObject.store).saveEntityRecord("postType", TEMPLATE_POST_TYPE, template);
  if (template.content) {
    registry.dispatch(external_wp_coreData_namespaceObject.store).editEntityRecord(
      "postType",
      TEMPLATE_POST_TYPE,
      newTemplate.id,
      { blocks: (0,external_wp_blocks_namespaceObject.parse)(template.content) },
      { undoIgnore: true }
    );
  }
  dispatch({
    type: "SET_EDITED_POST",
    postType: TEMPLATE_POST_TYPE,
    id: newTemplate.id
  });
};
const removeTemplate = (template) => ({ registry }) => {
  return unlock(registry.dispatch(external_wp_editor_namespaceObject.store)).removeTemplates([
    template
  ]);
};
function setTemplatePart(templatePartId) {
  external_wp_deprecated_default()("dispatch( 'core/edit-site' ).setTemplatePart", {
    since: "6.8"
  });
  return {
    type: "SET_EDITED_POST",
    postType: TEMPLATE_PART_POST_TYPE,
    id: templatePartId
  };
}
function setNavigationMenu(navigationMenuId) {
  external_wp_deprecated_default()("dispatch( 'core/edit-site' ).setNavigationMenu", {
    since: "6.8"
  });
  return {
    type: "SET_EDITED_POST",
    postType: NAVIGATION_POST_TYPE,
    id: navigationMenuId
  };
}
function setEditedEntity(postType, postId, context) {
  return {
    type: "SET_EDITED_POST",
    postType,
    id: postId,
    context
  };
}
function setHomeTemplateId() {
  external_wp_deprecated_default()("dispatch( 'core/edit-site' ).setHomeTemplateId", {
    since: "6.2",
    version: "6.4"
  });
  return {
    type: "NOTHING"
  };
}
function setEditedPostContext(context) {
  external_wp_deprecated_default()("dispatch( 'core/edit-site' ).setEditedPostContext", {
    since: "6.8"
  });
  return {
    type: "SET_EDITED_POST_CONTEXT",
    context
  };
}
function setPage() {
  external_wp_deprecated_default()("dispatch( 'core/edit-site' ).setPage", {
    since: "6.5",
    version: "6.8",
    hint: "The setPage is not needed anymore, the correct entity is resolved from the URL automatically."
  });
  return { type: "NOTHING" };
}
function setNavigationPanelActiveMenu() {
  external_wp_deprecated_default()("dispatch( 'core/edit-site' ).setNavigationPanelActiveMenu", {
    since: "6.2",
    version: "6.4"
  });
  return { type: "NOTHING" };
}
function openNavigationPanelToMenu() {
  external_wp_deprecated_default()("dispatch( 'core/edit-site' ).openNavigationPanelToMenu", {
    since: "6.2",
    version: "6.4"
  });
  return { type: "NOTHING" };
}
function setIsNavigationPanelOpened() {
  external_wp_deprecated_default()("dispatch( 'core/edit-site' ).setIsNavigationPanelOpened", {
    since: "6.2",
    version: "6.4"
  });
  return { type: "NOTHING" };
}
const setIsInserterOpened = (value) => ({ registry }) => {
  external_wp_deprecated_default()("dispatch( 'core/edit-site' ).setIsInserterOpened", {
    since: "6.5",
    alternative: "dispatch( 'core/editor').setIsInserterOpened"
  });
  registry.dispatch(external_wp_editor_namespaceObject.store).setIsInserterOpened(value);
};
const setIsListViewOpened = (isOpen) => ({ registry }) => {
  external_wp_deprecated_default()("dispatch( 'core/edit-site' ).setIsListViewOpened", {
    since: "6.5",
    alternative: "dispatch( 'core/editor').setIsListViewOpened"
  });
  registry.dispatch(external_wp_editor_namespaceObject.store).setIsListViewOpened(isOpen);
};
function updateSettings(settings) {
  return {
    type: "UPDATE_SETTINGS",
    settings
  };
}
function setIsSaveViewOpened(isOpen) {
  return {
    type: "SET_IS_SAVE_VIEW_OPENED",
    isOpen
  };
}
const revertTemplate = (template, options) => ({ registry }) => {
  return unlock(registry.dispatch(external_wp_editor_namespaceObject.store)).revertTemplate(
    template,
    options
  );
};
const openGeneralSidebar = (name) => ({ registry }) => {
  registry.dispatch(interfaceStore).enableComplementaryArea("core", name);
};
const closeGeneralSidebar = () => ({ registry }) => {
  registry.dispatch(interfaceStore).disableComplementaryArea("core");
};
const switchEditorMode = (mode) => ({ registry }) => {
  external_wp_deprecated_default()("dispatch( 'core/edit-site' ).switchEditorMode", {
    since: "6.6",
    alternative: "dispatch( 'core/editor').switchEditorMode"
  });
  registry.dispatch(external_wp_editor_namespaceObject.store).switchEditorMode(mode);
};
const setHasPageContentFocus = (hasPageContentFocus) => ({ dispatch, registry }) => {
  external_wp_deprecated_default()(`dispatch( 'core/edit-site' ).setHasPageContentFocus`, {
    since: "6.5"
  });
  if (hasPageContentFocus) {
    registry.dispatch(external_wp_blockEditor_namespaceObject.store).clearSelectedBlock();
  }
  dispatch({
    type: "SET_HAS_PAGE_CONTENT_FOCUS",
    hasPageContentFocus
  });
};
const toggleDistractionFree = () => ({ registry }) => {
  external_wp_deprecated_default()("dispatch( 'core/edit-site' ).toggleDistractionFree", {
    since: "6.6",
    alternative: "dispatch( 'core/editor').toggleDistractionFree"
  });
  registry.dispatch(external_wp_editor_namespaceObject.store).toggleDistractionFree();
};


;// ./node_modules/@wordpress/edit-site/build-module/store/private-actions.js
const setEditorCanvasContainerView = (view) => ({ dispatch }) => {
  dispatch({
    type: "SET_EDITOR_CANVAS_CONTAINER_VIEW",
    view
  });
};
function registerRoute(route) {
  return {
    type: "REGISTER_ROUTE",
    route
  };
}
function unregisterRoute(name) {
  return {
    type: "UNREGISTER_ROUTE",
    name
  };
}


;// ./node_modules/@wordpress/edit-site/build-module/utils/get-filtered-template-parts.js

const EMPTY_ARRAY = [];
function getFilteredTemplatePartBlocks(blocks = EMPTY_ARRAY, templateParts) {
  const templatePartsById = templateParts ? (
    // Key template parts by their ID.
    templateParts.reduce(
      (newTemplateParts, part) => ({
        ...newTemplateParts,
        [part.id]: part
      }),
      {}
    )
  ) : {};
  const result = [];
  const stack = [...blocks];
  while (stack.length) {
    const { innerBlocks, ...block } = stack.shift();
    stack.unshift(...innerBlocks);
    if ((0,external_wp_blocks_namespaceObject.isTemplatePart)(block)) {
      const {
        attributes: { theme, slug }
      } = block;
      const templatePartId = `${theme}//${slug}`;
      const templatePart = templatePartsById[templatePartId];
      if (templatePart) {
        result.push({
          templatePart,
          block
        });
      }
    }
  }
  return result;
}


;// ./node_modules/@wordpress/edit-site/build-module/store/selectors.js










const isFeatureActive = (0,external_wp_data_.createRegistrySelector)(
  (select) => (_, featureName) => {
    external_wp_deprecated_default()(`select( 'core/edit-site' ).isFeatureActive`, {
      since: "6.0",
      alternative: `select( 'core/preferences' ).get`
    });
    return !!select(external_wp_preferences_.store).get(
      "core/edit-site",
      featureName
    );
  }
);
const __experimentalGetPreviewDeviceType = (0,external_wp_data_.createRegistrySelector)(
  (select) => () => {
    external_wp_deprecated_default()(
      `select( 'core/edit-site' ).__experimentalGetPreviewDeviceType`,
      {
        since: "6.5",
        version: "6.7",
        alternative: `select( 'core/editor' ).getDeviceType`
      }
    );
    return select(external_wp_editor_namespaceObject.store).getDeviceType();
  }
);
const getCanUserCreateMedia = (0,external_wp_data_.createRegistrySelector)(
  (select) => () => {
    external_wp_deprecated_default()(
      `wp.data.select( 'core/edit-site' ).getCanUserCreateMedia()`,
      {
        since: "6.7",
        alternative: `wp.data.select( 'core' ).canUser( 'create', { kind: 'postType', type: 'attachment' } )`
      }
    );
    return select(external_wp_coreData_namespaceObject.store).canUser("create", "media");
  }
);
const getReusableBlocks = (0,external_wp_data_.createRegistrySelector)((select) => () => {
  external_wp_deprecated_default()(`select( 'core/edit-site' ).getReusableBlocks()`, {
    since: "6.5",
    version: "6.8",
    alternative: `select( 'core/core' ).getEntityRecords( 'postType', 'wp_block' )`
  });
  const isWeb = external_wp_element_.Platform.OS === "web";
  return isWeb ? select(external_wp_coreData_namespaceObject.store).getEntityRecords("postType", "wp_block", {
    per_page: -1
  }) : [];
});
function getSettings(state) {
  return state.settings;
}
function getHomeTemplateId() {
  external_wp_deprecated_default()("select( 'core/edit-site' ).getHomeTemplateId", {
    since: "6.2",
    version: "6.4"
  });
}
function getEditedPostType(state) {
  external_wp_deprecated_default()("select( 'core/edit-site' ).getEditedPostType", {
    since: "6.8",
    alternative: "select( 'core/editor' ).getCurrentPostType"
  });
  return state.editedPost.postType;
}
function getEditedPostId(state) {
  external_wp_deprecated_default()("select( 'core/edit-site' ).getEditedPostId", {
    since: "6.8",
    alternative: "select( 'core/editor' ).getCurrentPostId"
  });
  return state.editedPost.id;
}
function getEditedPostContext(state) {
  external_wp_deprecated_default()("select( 'core/edit-site' ).getEditedPostContext", {
    since: "6.8"
  });
  return state.editedPost.context;
}
function getPage(state) {
  external_wp_deprecated_default()("select( 'core/edit-site' ).getPage", {
    since: "6.8"
  });
  return { context: state.editedPost.context };
}
const isInserterOpened = (0,external_wp_data_.createRegistrySelector)((select) => () => {
  external_wp_deprecated_default()(`select( 'core/edit-site' ).isInserterOpened`, {
    since: "6.5",
    alternative: `select( 'core/editor' ).isInserterOpened`
  });
  return select(external_wp_editor_namespaceObject.store).isInserterOpened();
});
const __experimentalGetInsertionPoint = (0,external_wp_data_.createRegistrySelector)(
  (select) => () => {
    external_wp_deprecated_default()(
      `select( 'core/edit-site' ).__experimentalGetInsertionPoint`,
      {
        since: "6.5",
        version: "6.7"
      }
    );
    return unlock(select(external_wp_editor_namespaceObject.store)).getInserter();
  }
);
const isListViewOpened = (0,external_wp_data_.createRegistrySelector)((select) => () => {
  external_wp_deprecated_default()(`select( 'core/edit-site' ).isListViewOpened`, {
    since: "6.5",
    alternative: `select( 'core/editor' ).isListViewOpened`
  });
  return select(external_wp_editor_namespaceObject.store).isListViewOpened();
});
function isSaveViewOpened(state) {
  return state.saveViewPanel;
}
function getBlocksAndTemplateParts(select) {
  const templateParts = select(external_wp_coreData_namespaceObject.store).getEntityRecords(
    "postType",
    TEMPLATE_PART_POST_TYPE,
    { per_page: -1 }
  );
  const { getBlocksByName, getBlocksByClientId } = select(external_wp_blockEditor_namespaceObject.store);
  const clientIds = getBlocksByName("core/template-part");
  const blocks = getBlocksByClientId(clientIds);
  return [blocks, templateParts];
}
const getCurrentTemplateTemplateParts = (0,external_wp_data_.createRegistrySelector)(
  (select) => (0,external_wp_data_.createSelector)(
    () => {
      external_wp_deprecated_default()(
        `select( 'core/edit-site' ).getCurrentTemplateTemplateParts()`,
        {
          since: "6.7",
          version: "6.9",
          alternative: `select( 'core/block-editor' ).getBlocksByName( 'core/template-part' )`
        }
      );
      return getFilteredTemplatePartBlocks(
        ...getBlocksAndTemplateParts(select)
      );
    },
    () => getBlocksAndTemplateParts(select)
  )
);
const getEditorMode = (0,external_wp_data_.createRegistrySelector)((select) => () => {
  return select(external_wp_preferences_.store).get("core", "editorMode");
});
function getCurrentTemplateNavigationPanelSubMenu() {
  external_wp_deprecated_default()(
    "dispatch( 'core/edit-site' ).getCurrentTemplateNavigationPanelSubMenu",
    {
      since: "6.2",
      version: "6.4"
    }
  );
}
function getNavigationPanelActiveMenu() {
  external_wp_deprecated_default()("dispatch( 'core/edit-site' ).getNavigationPanelActiveMenu", {
    since: "6.2",
    version: "6.4"
  });
}
function isNavigationOpened() {
  external_wp_deprecated_default()("dispatch( 'core/edit-site' ).isNavigationOpened", {
    since: "6.2",
    version: "6.4"
  });
}
function isPage(state) {
  external_wp_deprecated_default()("select( 'core/edit-site' ).isPage", {
    since: "6.8",
    alternative: "select( 'core/editor' ).getCurrentPostType"
  });
  return !!state.editedPost.context?.postId;
}
function hasPageContentFocus() {
  external_wp_deprecated_default()(`select( 'core/edit-site' ).hasPageContentFocus`, {
    since: "6.5"
  });
  return false;
}


;// ./node_modules/@wordpress/edit-site/build-module/store/private-selectors.js
function getEditorCanvasContainerView(state) {
  return state.editorCanvasContainerView;
}
function getRoutes(state) {
  return state.routes;
}


;// ./node_modules/@wordpress/edit-site/build-module/store/constants.js
const STORE_NAME = "core/edit-site";


;// ./node_modules/@wordpress/edit-site/build-module/store/index.js








const storeConfig = {
  reducer: reducer_default,
  actions: actions_namespaceObject,
  selectors: selectors_namespaceObject
};
const store = (0,external_wp_data_.createReduxStore)(STORE_NAME, storeConfig);
(0,external_wp_data_.register)(store);
unlock(store).registerPrivateSelectors(private_selectors_namespaceObject);
unlock(store).registerPrivateActions(private_actions_namespaceObject);


;// external ["wp","router"]
const external_wp_router_namespaceObject = window["wp"]["router"];
;// ./node_modules/clsx/dist/clsx.mjs
function clsx_r(e){var t,f,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(f=clsx_r(e[t]))&&(n&&(n+=" "),n+=f)}else for(f in e)e[f]&&(n&&(n+=" "),n+=f);return n}function clsx(){for(var e,t,f=0,n="",o=arguments.length;f<o;f++)(e=arguments[f])&&(t=clsx_r(e))&&(n&&(n+=" "),n+=t);return n}/* harmony default export */ const dist_clsx = (clsx);
;// ./node_modules/@wordpress/admin-ui/build-module/navigable-region/index.js



const NavigableRegion = (0,external_wp_element_.forwardRef)(
  ({ children, className, ariaLabel, as: Tag = "div", ...props }, ref) => {
    return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
      Tag,
      {
        ref,
        className: dist_clsx("admin-ui-navigable-region", className),
        "aria-label": ariaLabel,
        role: "region",
        tabIndex: "-1",
        ...props,
        children
      }
    );
  }
);
NavigableRegion.displayName = "NavigableRegion";
var navigable_region_default = NavigableRegion;


;// external ["wp","plugins"]
const external_wp_plugins_namespaceObject = window["wp"]["plugins"];
;// external ["wp","htmlEntities"]
const external_wp_htmlEntities_namespaceObject = window["wp"]["htmlEntities"];
;// external ["wp","primitives"]
const external_wp_primitives_namespaceObject = window["wp"]["primitives"];
;// ./node_modules/@wordpress/icons/build-module/library/search.js


var search_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M13 5c-3.3 0-6 2.7-6 6 0 1.4.5 2.7 1.3 3.7l-3.8 3.8 1.1 1.1 3.8-3.8c1 .8 2.3 1.3 3.7 1.3 3.3 0 6-2.7 6-6S16.3 5 13 5zm0 10.5c-2.5 0-4.5-2-4.5-4.5s2-4.5 4.5-4.5 4.5 2 4.5 4.5-2 4.5-4.5 4.5z" }) });


;// external ["wp","commands"]
const external_wp_commands_namespaceObject = window["wp"]["commands"];
;// external ["wp","keycodes"]
const external_wp_keycodes_namespaceObject = window["wp"]["keycodes"];
;// external ["wp","url"]
const external_wp_url_namespaceObject = window["wp"]["url"];
;// ./node_modules/@wordpress/icons/build-module/library/wordpress.js


var wordpress_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "-2 -2 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M20 10c0-5.51-4.49-10-10-10C4.48 0 0 4.49 0 10c0 5.52 4.48 10 10 10 5.51 0 10-4.48 10-10zM7.78 15.37L4.37 6.22c.55-.02 1.17-.08 1.17-.08.5-.06.44-1.13-.06-1.11 0 0-1.45.11-2.37.11-.18 0-.37 0-.58-.01C4.12 2.69 6.87 1.11 10 1.11c2.33 0 4.45.87 6.05 2.34-.68-.11-1.65.39-1.65 1.58 0 .74.45 1.36.9 2.1.35.61.55 1.36.55 2.46 0 1.49-1.4 5-1.4 5l-3.03-8.37c.54-.02.82-.17.82-.17.5-.05.44-1.25-.06-1.22 0 0-1.44.12-2.38.12-.87 0-2.33-.12-2.33-.12-.5-.03-.56 1.2-.06 1.22l.92.08 1.26 3.41zM17.41 10c.24-.64.74-1.87.43-4.25.7 1.29 1.05 2.71 1.05 4.25 0 3.29-1.73 6.24-4.4 7.78.97-2.59 1.94-5.2 2.92-7.78zM6.1 18.09C3.12 16.65 1.11 13.53 1.11 10c0-1.3.23-2.48.72-3.59C3.25 10.3 4.67 14.2 6.1 18.09zm4.03-6.63l2.58 6.98c-.86.29-1.76.45-2.71.45-.79 0-1.57-.11-2.29-.33.81-2.38 1.62-4.74 2.42-7.1z" }) });


;// ./node_modules/@wordpress/edit-site/build-module/components/site-icon/index.js







function SiteIcon({ className }) {
  const { isRequestingSite, siteIconUrl } = (0,external_wp_data_.useSelect)((select) => {
    const { getEntityRecord } = select(external_wp_coreData_namespaceObject.store);
    const siteData = getEntityRecord("root", "__unstableBase", void 0);
    return {
      isRequestingSite: !siteData,
      siteIconUrl: siteData?.site_icon_url
    };
  }, []);
  if (isRequestingSite && !siteIconUrl) {
    return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "edit-site-site-icon__image" });
  }
  const icon = siteIconUrl ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    "img",
    {
      className: "edit-site-site-icon__image",
      alt: (0,external_wp_i18n_namespaceObject.__)("Site Icon"),
      src: siteIconUrl
    }
  ) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    external_wp_components_namespaceObject.Icon,
    {
      className: "edit-site-site-icon__icon",
      icon: wordpress_default,
      size: 48
    }
  );
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: dist_clsx(className, "edit-site-site-icon"), children: icon });
}
var site_icon_default = SiteIcon;


;// external ["wp","dom"]
const external_wp_dom_namespaceObject = window["wp"]["dom"];
;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar/index.js




const SidebarNavigationContext = (0,external_wp_element_.createContext)(() => {
});
SidebarNavigationContext.displayName = "SidebarNavigationContext";
function focusSidebarElement(el, direction, focusSelector) {
  let elementToFocus;
  if (direction === "back" && focusSelector) {
    elementToFocus = el.querySelector(focusSelector);
  }
  if (direction !== null && !elementToFocus) {
    const [firstTabbable] = external_wp_dom_namespaceObject.focus.tabbable.find(el);
    elementToFocus = firstTabbable ?? el;
  }
  elementToFocus?.focus();
}
function createNavState() {
  let state = {
    direction: null,
    focusSelector: null
  };
  return {
    get() {
      return state;
    },
    navigate(direction, focusSelector = null) {
      state = {
        direction,
        focusSelector: direction === "forward" && focusSelector ? focusSelector : state.focusSelector
      };
    }
  };
}
function SidebarContentWrapper({ children, shouldAnimate }) {
  const navState = (0,external_wp_element_.useContext)(SidebarNavigationContext);
  const wrapperRef = (0,external_wp_element_.useRef)();
  const [navAnimation, setNavAnimation] = (0,external_wp_element_.useState)(null);
  (0,external_wp_element_.useLayoutEffect)(() => {
    const { direction, focusSelector } = navState.get();
    focusSidebarElement(wrapperRef.current, direction, focusSelector);
    setNavAnimation(direction);
  }, [navState]);
  const wrapperCls = dist_clsx(
    "edit-site-sidebar__screen-wrapper",
    /*
     * Some panes do not have sub-panes and therefore
     * should not animate when clicked on.
     */
    shouldAnimate ? {
      "slide-from-left": navAnimation === "back",
      "slide-from-right": navAnimation === "forward"
    } : {}
  );
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { ref: wrapperRef, className: wrapperCls, children });
}
function SidebarNavigationProvider({ children }) {
  const [navState] = (0,external_wp_element_.useState)(createNavState);
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationContext.Provider, { value: navState, children });
}
function SidebarContent({ routeKey, shouldAnimate, children }) {
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "edit-site-sidebar__content", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    SidebarContentWrapper,
    {
      shouldAnimate,
      children
    },
    routeKey
  ) });
}


;// ./node_modules/@wordpress/edit-site/build-module/components/site-hub/index.js

















const { useLocation, useHistory } = unlock(external_wp_router_namespaceObject.privateApis);
const SiteHub = (0,external_wp_element_.memo)(
  (0,external_wp_element_.forwardRef)(({ isTransparent }, ref) => {
    const { dashboardLink, homeUrl, siteTitle } = (0,external_wp_data_.useSelect)((select) => {
      const { getSettings } = unlock(select(store));
      const { getEntityRecord } = select(external_wp_coreData_namespaceObject.store);
      const _site = getEntityRecord("root", "site");
      return {
        dashboardLink: getSettings().__experimentalDashboardLink,
        homeUrl: getEntityRecord("root", "__unstableBase")?.home,
        siteTitle: !_site?.title && !!_site?.url ? (0,external_wp_url_namespaceObject.filterURLForDisplay)(_site?.url) : _site?.title
      };
    }, []);
    const { open: openCommandCenter } = (0,external_wp_data_.useDispatch)(external_wp_commands_namespaceObject.store);
    return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "edit-site-site-hub", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "flex-start", spacing: "0", children: [
      /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
        "div",
        {
          className: dist_clsx(
            "edit-site-site-hub__view-mode-toggle-container",
            {
              "has-transparent-background": isTransparent
            }
          ),
          children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
            external_wp_components_namespaceObject.Button,
            {
              __next40pxDefaultSize: true,
              ref,
              href: dashboardLink,
              label: (0,external_wp_i18n_namespaceObject.__)("Go to the Dashboard"),
              className: "edit-site-layout__view-mode-toggle",
              style: {
                transform: "scale(0.5333) translateX(-4px)",
                // Offset to position the icon 12px from viewport edge
                borderRadius: 4
              },
              children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(site_icon_default, { className: "edit-site-layout__view-mode-toggle-icon" })
            }
          )
        }
      ),
      /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { children: [
        /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "edit-site-site-hub__title", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
          external_wp_components_namespaceObject.Button,
          {
            __next40pxDefaultSize: true,
            variant: "link",
            href: homeUrl,
            target: "_blank",
            children: [
              (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(siteTitle),
              /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, {
                as: "span",
                /* translators: accessibility text */
                children: (0,external_wp_i18n_namespaceObject.__)("(opens in a new tab)")
              })
            ]
          }
        ) }),
        /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
          external_wp_components_namespaceObject.__experimentalHStack,
          {
            spacing: 0,
            expanded: false,
            className: "edit-site-site-hub__actions",
            children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
              external_wp_components_namespaceObject.Button,
              {
                size: "compact",
                className: "edit-site-site-hub_toggle-command-center",
                icon: search_default,
                onClick: () => openCommandCenter(),
                label: (0,external_wp_i18n_namespaceObject.__)("Open command palette"),
                shortcut: external_wp_keycodes_namespaceObject.displayShortcut.primary("k")
              }
            )
          }
        )
      ] })
    ] }) });
  })
);
var site_hub_default = SiteHub;
const SiteHubMobile = (0,external_wp_element_.memo)(
  (0,external_wp_element_.forwardRef)(({ isTransparent }, ref) => {
    const { path } = useLocation();
    const history = useHistory();
    const { navigate } = (0,external_wp_element_.useContext)(SidebarNavigationContext);
    const {
      dashboardLink,
      homeUrl,
      siteTitle,
      isBlockTheme,
      isClassicThemeWithStyleBookSupport
    } = (0,external_wp_data_.useSelect)((select) => {
      const { getSettings } = unlock(select(store));
      const { getEntityRecord, getCurrentTheme } = select(external_wp_coreData_namespaceObject.store);
      const _site = getEntityRecord("root", "site");
      const currentTheme = getCurrentTheme();
      const settings = getSettings();
      const supportsEditorStyles = currentTheme.theme_supports["editor-styles"];
      const hasThemeJson = settings.supportsLayout;
      return {
        dashboardLink: settings.__experimentalDashboardLink,
        homeUrl: getEntityRecord("root", "__unstableBase")?.home,
        siteTitle: !_site?.title && !!_site?.url ? (0,external_wp_url_namespaceObject.filterURLForDisplay)(_site?.url) : _site?.title,
        isBlockTheme: currentTheme?.is_block_theme,
        isClassicThemeWithStyleBookSupport: !currentTheme?.is_block_theme && (supportsEditorStyles || hasThemeJson)
      };
    }, []);
    const { open: openCommandCenter } = (0,external_wp_data_.useDispatch)(external_wp_commands_namespaceObject.store);
    let backPath;
    if (path !== "/") {
      if (isBlockTheme || isClassicThemeWithStyleBookSupport) {
        backPath = "/";
      } else if (path !== "/pattern") {
        backPath = "/pattern";
      }
    }
    const backButtonProps = {
      href: !!backPath ? void 0 : dashboardLink,
      label: !!backPath ? (0,external_wp_i18n_namespaceObject.__)("Go to Site Editor") : (0,external_wp_i18n_namespaceObject.__)("Go to the Dashboard"),
      onClick: !!backPath ? () => {
        history.navigate(backPath);
        navigate("back");
      } : void 0
    };
    return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "edit-site-site-hub", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "flex-start", spacing: "0", children: [
      /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
        "div",
        {
          className: dist_clsx(
            "edit-site-site-hub__view-mode-toggle-container",
            {
              "has-transparent-background": isTransparent
            }
          ),
          children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
            external_wp_components_namespaceObject.Button,
            {
              __next40pxDefaultSize: true,
              ref,
              className: "edit-site-layout__view-mode-toggle",
              style: {
                transform: "scale(0.5)",
                borderRadius: 4
              },
              ...backButtonProps,
              children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(site_icon_default, { className: "edit-site-layout__view-mode-toggle-icon" })
            }
          )
        }
      ),
      /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { children: [
        /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "edit-site-site-hub__title", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
          external_wp_components_namespaceObject.Button,
          {
            __next40pxDefaultSize: true,
            variant: "link",
            href: homeUrl,
            target: "_blank",
            label: (0,external_wp_i18n_namespaceObject.__)("View site (opens in a new tab)"),
            children: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(siteTitle)
          }
        ) }),
        /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
          external_wp_components_namespaceObject.__experimentalHStack,
          {
            spacing: 0,
            expanded: false,
            className: "edit-site-site-hub__actions",
            children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
              external_wp_components_namespaceObject.Button,
              {
                __next40pxDefaultSize: true,
                className: "edit-site-site-hub_toggle-command-center",
                icon: search_default,
                onClick: () => openCommandCenter(),
                label: (0,external_wp_i18n_namespaceObject.__)("Open command palette"),
                shortcut: external_wp_keycodes_namespaceObject.displayShortcut.primary("k")
              }
            )
          }
        )
      ] })
    ] }) });
  })
);


;// ./node_modules/@wordpress/edit-site/build-module/components/resizable-frame/index.js











const { useLocation: resizable_frame_useLocation, useHistory: resizable_frame_useHistory } = unlock(external_wp_router_namespaceObject.privateApis);
const HANDLE_STYLES_OVERRIDE = {
  position: void 0,
  userSelect: void 0,
  cursor: void 0,
  width: void 0,
  height: void 0,
  top: void 0,
  right: void 0,
  bottom: void 0,
  left: void 0
};
const FRAME_MIN_WIDTH = 320;
const FRAME_REFERENCE_WIDTH = 1300;
const FRAME_TARGET_ASPECT_RATIO = 9 / 19.5;
const SNAP_TO_EDIT_CANVAS_MODE_THRESHOLD = 200;
const INITIAL_FRAME_SIZE = { width: "100%", height: "100%" };
function calculateNewHeight(width, initialAspectRatio) {
  const lerp = (a, b, amount) => {
    return a + (b - a) * amount;
  };
  const lerpFactor = 1 - Math.max(
    0,
    Math.min(
      1,
      (width - FRAME_MIN_WIDTH) / (FRAME_REFERENCE_WIDTH - FRAME_MIN_WIDTH)
    )
  );
  const intermediateAspectRatio = lerp(
    initialAspectRatio,
    FRAME_TARGET_ASPECT_RATIO,
    lerpFactor
  );
  return width / intermediateAspectRatio;
}
function ResizableFrame({
  isFullWidth,
  isOversized,
  setIsOversized,
  isReady,
  children,
  /** The default (unresized) width/height of the frame, based on the space available in the viewport. */
  defaultSize,
  innerContentStyle
}) {
  const history = resizable_frame_useHistory();
  const { path, query } = resizable_frame_useLocation();
  const { canvas = "view" } = query;
  const disableMotion = (0,external_wp_compose_namespaceObject.useReducedMotion)();
  const [frameSize, setFrameSize] = (0,external_wp_element_.useState)(INITIAL_FRAME_SIZE);
  const [startingWidth, setStartingWidth] = (0,external_wp_element_.useState)();
  const [isResizing, setIsResizing] = (0,external_wp_element_.useState)(false);
  const [shouldShowHandle, setShouldShowHandle] = (0,external_wp_element_.useState)(false);
  const [resizeRatio, setResizeRatio] = (0,external_wp_element_.useState)(1);
  const FRAME_TRANSITION = { type: "tween", duration: isResizing ? 0 : 0.5 };
  const frameRef = (0,external_wp_element_.useRef)(null);
  const resizableHandleHelpId = (0,external_wp_compose_namespaceObject.useInstanceId)(
    ResizableFrame,
    "edit-site-resizable-frame-handle-help"
  );
  const defaultAspectRatio = defaultSize.width / defaultSize.height;
  const isBlockTheme = (0,external_wp_data_.useSelect)((select) => {
    const { getCurrentTheme } = select(external_wp_coreData_namespaceObject.store);
    return getCurrentTheme()?.is_block_theme;
  }, []);
  const handleResizeStart = (_event, _direction, ref) => {
    setStartingWidth(ref.offsetWidth);
    setIsResizing(true);
  };
  const handleResize = (_event, _direction, _ref, delta) => {
    const normalizedDelta = delta.width / resizeRatio;
    const deltaAbs = Math.abs(normalizedDelta);
    const maxDoubledDelta = delta.width < 0 ? deltaAbs : (defaultSize.width - startingWidth) / 2;
    const deltaToDouble = Math.min(deltaAbs, maxDoubledDelta);
    const doubleSegment = deltaAbs === 0 ? 0 : deltaToDouble / deltaAbs;
    const singleSegment = 1 - doubleSegment;
    setResizeRatio(singleSegment + doubleSegment * 2);
    const updatedWidth = startingWidth + delta.width;
    setIsOversized(updatedWidth > defaultSize.width);
    setFrameSize({
      height: isOversized ? "100%" : calculateNewHeight(updatedWidth, defaultAspectRatio)
    });
  };
  const handleResizeStop = (_event, _direction, ref) => {
    setIsResizing(false);
    if (!isOversized) {
      return;
    }
    setIsOversized(false);
    const remainingWidth = ref.ownerDocument.documentElement.offsetWidth - ref.offsetWidth;
    if (remainingWidth > SNAP_TO_EDIT_CANVAS_MODE_THRESHOLD || !isBlockTheme) {
      setFrameSize(INITIAL_FRAME_SIZE);
    } else {
      history.navigate(
        (0,external_wp_url_namespaceObject.addQueryArgs)(path, {
          canvas: "edit"
        }),
        {
          transition: "canvas-mode-edit-transition"
        }
      );
    }
  };
  const handleResizableHandleKeyDown = (event) => {
    if (!["ArrowLeft", "ArrowRight"].includes(event.key)) {
      return;
    }
    event.preventDefault();
    const step = 20 * (event.shiftKey ? 5 : 1);
    const delta = step * (event.key === "ArrowLeft" ? 1 : -1) * ((0,external_wp_i18n_namespaceObject.isRTL)() ? -1 : 1);
    const newWidth = Math.min(
      Math.max(
        FRAME_MIN_WIDTH,
        frameRef.current.resizable.offsetWidth + delta
      ),
      defaultSize.width
    );
    setFrameSize({
      width: newWidth,
      height: calculateNewHeight(newWidth, defaultAspectRatio)
    });
  };
  const frameAnimationVariants = {
    default: {
      flexGrow: 0,
      height: frameSize.height
    },
    fullWidth: {
      flexGrow: 1,
      height: frameSize.height
    }
  };
  const resizeHandleVariants = {
    hidden: {
      opacity: 0,
      ...(0,external_wp_i18n_namespaceObject.isRTL)() ? { right: 0 } : { left: 0 }
    },
    visible: {
      opacity: 1,
      // Account for the handle's width.
      ...(0,external_wp_i18n_namespaceObject.isRTL)() ? { right: -14 } : { left: -14 }
    },
    active: {
      opacity: 1,
      // Account for the handle's width.
      ...(0,external_wp_i18n_namespaceObject.isRTL)() ? { right: -14 } : { left: -14 },
      scaleY: 1.3
    }
  };
  const currentResizeHandleVariant = (() => {
    if (isResizing) {
      return "active";
    }
    return shouldShowHandle ? "visible" : "hidden";
  })();
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    external_wp_components_namespaceObject.ResizableBox,
    {
      as: external_wp_components_namespaceObject.__unstableMotion.div,
      ref: frameRef,
      initial: false,
      variants: frameAnimationVariants,
      animate: isFullWidth ? "fullWidth" : "default",
      onAnimationComplete: (definition) => {
        if (definition === "fullWidth") {
          setFrameSize({ width: "100%", height: "100%" });
        }
      },
      whileHover: canvas === "view" && isBlockTheme ? {
        scale: 1.005,
        transition: {
          duration: disableMotion ? 0 : 0.5,
          ease: "easeOut"
        }
      } : {},
      transition: FRAME_TRANSITION,
      size: frameSize,
      enable: {
        top: false,
        bottom: false,
        // Resizing will be disabled until the editor content is loaded.
        ...(0,external_wp_i18n_namespaceObject.isRTL)() ? { right: isReady, left: false } : { left: isReady, right: false },
        topRight: false,
        bottomRight: false,
        bottomLeft: false,
        topLeft: false
      },
      resizeRatio,
      handleClasses: void 0,
      handleStyles: {
        left: HANDLE_STYLES_OVERRIDE,
        right: HANDLE_STYLES_OVERRIDE
      },
      minWidth: FRAME_MIN_WIDTH,
      maxWidth: isFullWidth ? "100%" : "150%",
      maxHeight: "100%",
      onFocus: () => setShouldShowHandle(true),
      onBlur: () => setShouldShowHandle(false),
      onMouseOver: () => setShouldShowHandle(true),
      onMouseOut: () => setShouldShowHandle(false),
      handleComponent: {
        [(0,external_wp_i18n_namespaceObject.isRTL)() ? "right" : "left"]: canvas === "view" && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
          /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Tooltip, { text: (0,external_wp_i18n_namespaceObject.__)("Drag to resize"), children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
            external_wp_components_namespaceObject.__unstableMotion.button,
            {
              role: "separator",
              "aria-orientation": "vertical",
              className: dist_clsx(
                "edit-site-resizable-frame__handle",
                { "is-resizing": isResizing }
              ),
              variants: resizeHandleVariants,
              animate: currentResizeHandleVariant,
              "aria-label": (0,external_wp_i18n_namespaceObject.__)("Drag to resize"),
              "aria-describedby": resizableHandleHelpId,
              "aria-valuenow": frameRef.current?.resizable?.offsetWidth || void 0,
              "aria-valuemin": FRAME_MIN_WIDTH,
              "aria-valuemax": defaultSize.width,
              onKeyDown: handleResizableHandleKeyDown,
              initial: "hidden",
              exit: "hidden",
              whileFocus: "active",
              whileHover: "active"
            },
            "handle"
          ) }),
          /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { hidden: true, id: resizableHandleHelpId, children: (0,external_wp_i18n_namespaceObject.__)(
            "Use left and right arrow keys to resize the canvas. Hold shift to resize in larger increments."
          ) })
        ] })
      },
      onResizeStart: handleResizeStart,
      onResize: handleResize,
      onResizeStop: handleResizeStop,
      className: dist_clsx("edit-site-resizable-frame__inner", {
        "is-resizing": isResizing
      }),
      showHandle: false,
      children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
        "div",
        {
          className: "edit-site-resizable-frame__inner-content",
          style: innerContentStyle,
          children
        }
      )
    }
  );
}
var resizable_frame_default = ResizableFrame;


;// external ["wp","keyboardShortcuts"]
const external_wp_keyboardShortcuts_namespaceObject = window["wp"]["keyboardShortcuts"];
;// ./node_modules/@wordpress/edit-site/build-module/components/save-keyboard-shortcut/index.js







const shortcutName = "core/edit-site/save";
function SaveKeyboardShortcut() {
  const { __experimentalGetDirtyEntityRecords, isSavingEntityRecord } = (0,external_wp_data_.useSelect)(external_wp_coreData_namespaceObject.store);
  const { hasNonPostEntityChanges, isPostSavingLocked } = (0,external_wp_data_.useSelect)(external_wp_editor_namespaceObject.store);
  const { savePost } = (0,external_wp_data_.useDispatch)(external_wp_editor_namespaceObject.store);
  const { setIsSaveViewOpened } = (0,external_wp_data_.useDispatch)(store);
  const { registerShortcut, unregisterShortcut } = (0,external_wp_data_.useDispatch)(
    external_wp_keyboardShortcuts_namespaceObject.store
  );
  (0,external_wp_element_.useEffect)(() => {
    registerShortcut({
      name: shortcutName,
      category: "global",
      description: (0,external_wp_i18n_namespaceObject.__)("Save your changes."),
      keyCombination: {
        modifier: "primary",
        character: "s"
      }
    });
    return () => {
      unregisterShortcut(shortcutName);
    };
  }, [registerShortcut, unregisterShortcut]);
  (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)("core/edit-site/save", (event) => {
    event.preventDefault();
    const dirtyEntityRecords = __experimentalGetDirtyEntityRecords();
    const hasDirtyEntities = !!dirtyEntityRecords.length;
    const isSaving = dirtyEntityRecords.some(
      (record) => isSavingEntityRecord(record.kind, record.name, record.key)
    );
    if (!hasDirtyEntities || isSaving) {
      return;
    }
    if (hasNonPostEntityChanges()) {
      setIsSaveViewOpened(true);
    } else if (!isPostSavingLocked()) {
      savePost();
    }
  });
  return null;
}


;// ./node_modules/@wordpress/edit-site/build-module/components/layout/hooks.js



const MAX_LOADING_TIME = 1e4;
function useIsSiteEditorLoading() {
  const [loaded, setLoaded] = (0,external_wp_element_.useState)(false);
  const inLoadingPause = (0,external_wp_data_.useSelect)(
    (select) => {
      const hasResolvingSelectors = select(external_wp_coreData_namespaceObject.store).hasResolvingSelectors();
      return !loaded && !hasResolvingSelectors;
    },
    [loaded]
  );
  (0,external_wp_element_.useEffect)(() => {
    let timeout;
    if (!loaded) {
      timeout = setTimeout(() => {
        setLoaded(true);
      }, MAX_LOADING_TIME);
    }
    return () => {
      clearTimeout(timeout);
    };
  }, [loaded]);
  (0,external_wp_element_.useEffect)(() => {
    if (inLoadingPause) {
      const ARTIFICIAL_DELAY = 100;
      const timeout = setTimeout(() => {
        setLoaded(true);
      }, ARTIFICIAL_DELAY);
      return () => {
        clearTimeout(timeout);
      };
    }
  }, [inLoadingPause]);
  return !loaded;
}


;// ./node_modules/@react-spring/rafz/dist/esm/index.js
var esm_f=esm_l(),esm_n=e=>esm_c(e,esm_f),esm_m=esm_l();esm_n.write=e=>esm_c(e,esm_m);var esm_d=esm_l();esm_n.onStart=e=>esm_c(e,esm_d);var esm_h=esm_l();esm_n.onFrame=e=>esm_c(e,esm_h);var esm_p=esm_l();esm_n.onFinish=e=>esm_c(e,esm_p);var esm_i=[];esm_n.setTimeout=(e,t)=>{let a=esm_n.now()+t,o=()=>{let F=esm_i.findIndex(z=>z.cancel==o);~F&&esm_i.splice(F,1),esm_u-=~F?1:0},s={time:a,handler:e,cancel:o};return esm_i.splice(esm_w(a),0,s),esm_u+=1,esm_v(),s};var esm_w=e=>~(~esm_i.findIndex(t=>t.time>e)||~esm_i.length);esm_n.cancel=e=>{esm_d.delete(e),esm_h.delete(e),esm_p.delete(e),esm_f.delete(e),esm_m.delete(e)};esm_n.sync=e=>{T=!0,esm_n.batchedUpdates(e),T=!1};esm_n.throttle=e=>{let t;function a(){try{e(...t)}finally{t=null}}function o(...s){t=s,esm_n.onStart(a)}return o.handler=e,o.cancel=()=>{esm_d.delete(a),t=null},o};var esm_y=typeof window<"u"?window.requestAnimationFrame:()=>{};esm_n.use=e=>esm_y=e;esm_n.now=typeof performance<"u"?()=>performance.now():Date.now;esm_n.batchedUpdates=e=>e();esm_n.catch=console.error;esm_n.frameLoop="always";esm_n.advance=()=>{esm_n.frameLoop!=="demand"?console.warn("Cannot call the manual advancement of rafz whilst frameLoop is not set as demand"):esm_x()};var esm_r=-1,esm_u=0,T=!1;function esm_c(e,t){T?(t.delete(e),e(0)):(t.add(e),esm_v())}function esm_v(){esm_r<0&&(esm_r=0,esm_n.frameLoop!=="demand"&&esm_y(esm_b))}function esm_R(){esm_r=-1}function esm_b(){~esm_r&&(esm_y(esm_b),esm_n.batchedUpdates(esm_x))}function esm_x(){let e=esm_r;esm_r=esm_n.now();let t=esm_w(esm_r);if(t&&(Q(esm_i.splice(0,t),a=>a.handler()),esm_u-=t),!esm_u){esm_R();return}esm_d.flush(),esm_f.flush(e?Math.min(64,esm_r-e):16.667),esm_h.flush(),esm_m.flush(),esm_p.flush()}function esm_l(){let e=new Set,t=e;return{add(a){esm_u+=t==e&&!e.has(a)?1:0,e.add(a)},delete(a){return esm_u-=t==e&&e.has(a)?1:0,e.delete(a)},flush(a){t.size&&(e=new Set,esm_u-=t.size,Q(t,o=>o(a)&&e.add(o)),esm_u+=e.size,t=e)}}}function Q(e,t){e.forEach(a=>{try{t(a)}catch(o){esm_n.catch(o)}})}var esm_S={count(){return esm_u},isRunning(){return esm_r>=0},clear(){esm_r=-1,esm_i=[],esm_d=esm_l(),esm_f=esm_l(),esm_h=esm_l(),esm_m=esm_l(),esm_p=esm_l(),esm_u=0}};

// EXTERNAL MODULE: external "React"
var external_React_ = __webpack_require__(1609);
var external_React_namespaceObject = /*#__PURE__*/__webpack_require__.t(external_React_, 2);
;// ./node_modules/@react-spring/shared/dist/esm/index.js
var ze=Object.defineProperty;var Le=(e,t)=>{for(var r in t)ze(e,r,{get:t[r],enumerable:!0})};var dist_esm_p={};Le(dist_esm_p,{assign:()=>U,colors:()=>dist_esm_c,createStringInterpolator:()=>esm_k,skipAnimation:()=>ee,to:()=>J,willAdvance:()=>dist_esm_S});function Y(){}var mt=(e,t,r)=>Object.defineProperty(e,t,{value:r,writable:!0,configurable:!0}),dist_esm_l={arr:Array.isArray,obj:e=>!!e&&e.constructor.name==="Object",fun:e=>typeof e=="function",str:e=>typeof e=="string",num:e=>typeof e=="number",und:e=>e===void 0};function bt(e,t){if(dist_esm_l.arr(e)){if(!dist_esm_l.arr(t)||e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0}return e===t}var esm_Ve=(e,t)=>e.forEach(t);function xt(e,t,r){if(dist_esm_l.arr(e)){for(let n=0;n<e.length;n++)t.call(r,e[n],`${n}`);return}for(let n in e)e.hasOwnProperty(n)&&t.call(r,e[n],n)}var ht=e=>dist_esm_l.und(e)?[]:dist_esm_l.arr(e)?e:[e];function Pe(e,t){if(e.size){let r=Array.from(e);e.clear(),esm_Ve(r,t)}}var yt=(e,...t)=>Pe(e,r=>r(...t)),dist_esm_h=()=>typeof window>"u"||!window.navigator||/ServerSideRendering|^Deno\//.test(window.navigator.userAgent);var esm_k,J,dist_esm_c=null,ee=!1,dist_esm_S=Y,U=e=>{e.to&&(J=e.to),e.now&&(esm_n.now=e.now),e.colors!==void 0&&(dist_esm_c=e.colors),e.skipAnimation!=null&&(ee=e.skipAnimation),e.createStringInterpolator&&(esm_k=e.createStringInterpolator),e.requestAnimationFrame&&esm_n.use(e.requestAnimationFrame),e.batchedUpdates&&(esm_n.batchedUpdates=e.batchedUpdates),e.willAdvance&&(dist_esm_S=e.willAdvance),e.frameLoop&&(esm_n.frameLoop=e.frameLoop)};var esm_E=new Set,dist_esm_u=[],esm_H=[],A=0,qe={get idle(){return!esm_E.size&&!dist_esm_u.length},start(e){A>e.priority?(esm_E.add(e),esm_n.onStart($e)):(te(e),esm_n(B))},advance:B,sort(e){if(A)esm_n.onFrame(()=>qe.sort(e));else{let t=dist_esm_u.indexOf(e);~t&&(dist_esm_u.splice(t,1),re(e))}},clear(){dist_esm_u=[],esm_E.clear()}};function $e(){esm_E.forEach(te),esm_E.clear(),esm_n(B)}function te(e){dist_esm_u.includes(e)||re(e)}function re(e){dist_esm_u.splice(Ge(dist_esm_u,t=>t.priority>e.priority),0,e)}function B(e){let t=esm_H;for(let r=0;r<dist_esm_u.length;r++){let n=dist_esm_u[r];A=n.priority,n.idle||(dist_esm_S(n),n.advance(e),n.idle||t.push(n))}return A=0,esm_H=dist_esm_u,esm_H.length=0,dist_esm_u=t,dist_esm_u.length>0}function Ge(e,t){let r=e.findIndex(t);return r<0?e.length:r}var ne=(e,t,r)=>Math.min(Math.max(r,e),t);var It={transparent:0,aliceblue:4042850303,antiquewhite:4209760255,aqua:16777215,aquamarine:2147472639,azure:4043309055,beige:4126530815,bisque:4293182719,black:255,blanchedalmond:4293643775,blue:65535,blueviolet:2318131967,brown:2771004159,burlywood:3736635391,burntsienna:3934150143,cadetblue:1604231423,chartreuse:2147418367,chocolate:3530104575,coral:4286533887,cornflowerblue:1687547391,cornsilk:4294499583,crimson:3692313855,cyan:16777215,darkblue:35839,darkcyan:9145343,darkgoldenrod:3095792639,darkgray:2846468607,darkgreen:6553855,darkgrey:2846468607,darkkhaki:3182914559,darkmagenta:2332068863,darkolivegreen:1433087999,darkorange:4287365375,darkorchid:2570243327,darkred:2332033279,darksalmon:3918953215,darkseagreen:2411499519,darkslateblue:1211993087,darkslategray:793726975,darkslategrey:793726975,darkturquoise:13554175,darkviolet:2483082239,deeppink:4279538687,deepskyblue:12582911,dimgray:1768516095,dimgrey:1768516095,dodgerblue:512819199,firebrick:2988581631,floralwhite:4294635775,forestgreen:579543807,fuchsia:4278255615,gainsboro:3705462015,ghostwhite:4177068031,gold:4292280575,goldenrod:3668254975,gray:2155905279,green:8388863,greenyellow:2919182335,grey:2155905279,honeydew:4043305215,hotpink:4285117695,indianred:3445382399,indigo:1258324735,ivory:4294963455,khaki:4041641215,lavender:3873897215,lavenderblush:4293981695,lawngreen:2096890111,lemonchiffon:4294626815,lightblue:2916673279,lightcoral:4034953471,lightcyan:3774873599,lightgoldenrodyellow:4210742015,lightgray:3553874943,lightgreen:2431553791,lightgrey:3553874943,lightpink:4290167295,lightsalmon:4288707327,lightseagreen:548580095,lightskyblue:2278488831,lightslategray:2005441023,lightslategrey:2005441023,lightsteelblue:2965692159,lightyellow:4294959359,lime:16711935,limegreen:852308735,linen:4210091775,magenta:4278255615,maroon:2147483903,mediumaquamarine:1724754687,mediumblue:52735,mediumorchid:3126187007,mediumpurple:2473647103,mediumseagreen:1018393087,mediumslateblue:2070474495,mediumspringgreen:16423679,mediumturquoise:1221709055,mediumvioletred:3340076543,midnightblue:421097727,mintcream:4127193855,mistyrose:4293190143,moccasin:4293178879,navajowhite:4292783615,navy:33023,oldlace:4260751103,olive:2155872511,olivedrab:1804477439,orange:4289003775,orangered:4282712319,orchid:3664828159,palegoldenrod:4008225535,palegreen:2566625535,paleturquoise:2951671551,palevioletred:3681588223,papayawhip:4293907967,peachpuff:4292524543,peru:3448061951,pink:4290825215,plum:3718307327,powderblue:2967529215,purple:2147516671,rebeccapurple:1714657791,red:4278190335,rosybrown:3163525119,royalblue:1097458175,saddlebrown:2336560127,salmon:4202722047,sandybrown:4104413439,seagreen:780883967,seashell:4294307583,sienna:2689740287,silver:3233857791,skyblue:2278484991,slateblue:1784335871,slategray:1887473919,slategrey:1887473919,snow:4294638335,springgreen:16744447,steelblue:1182971135,tan:3535047935,teal:8421631,thistle:3636451583,tomato:4284696575,turquoise:1088475391,violet:4001558271,wheat:4125012991,white:4294967295,whitesmoke:4126537215,yellow:4294902015,yellowgreen:2597139199};var dist_esm_d="[-+]?\\d*\\.?\\d+",esm_M=dist_esm_d+"%";function C(...e){return"\\(\\s*("+e.join(")\\s*,\\s*(")+")\\s*\\)"}var oe=new RegExp("rgb"+C(dist_esm_d,dist_esm_d,dist_esm_d)),fe=new RegExp("rgba"+C(dist_esm_d,dist_esm_d,dist_esm_d,dist_esm_d)),ae=new RegExp("hsl"+C(dist_esm_d,esm_M,esm_M)),ie=new RegExp("hsla"+C(dist_esm_d,esm_M,esm_M,dist_esm_d)),se=/^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,ue=/^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,le=/^#([0-9a-fA-F]{6})$/,esm_ce=/^#([0-9a-fA-F]{8})$/;function be(e){let t;return typeof e=="number"?e>>>0===e&&e>=0&&e<=4294967295?e:null:(t=le.exec(e))?parseInt(t[1]+"ff",16)>>>0:dist_esm_c&&dist_esm_c[e]!==void 0?dist_esm_c[e]:(t=oe.exec(e))?(dist_esm_y(t[1])<<24|dist_esm_y(t[2])<<16|dist_esm_y(t[3])<<8|255)>>>0:(t=fe.exec(e))?(dist_esm_y(t[1])<<24|dist_esm_y(t[2])<<16|dist_esm_y(t[3])<<8|me(t[4]))>>>0:(t=se.exec(e))?parseInt(t[1]+t[1]+t[2]+t[2]+t[3]+t[3]+"ff",16)>>>0:(t=esm_ce.exec(e))?parseInt(t[1],16)>>>0:(t=ue.exec(e))?parseInt(t[1]+t[1]+t[2]+t[2]+t[3]+t[3]+t[4]+t[4],16)>>>0:(t=ae.exec(e))?(de(esm_pe(t[1]),esm_z(t[2]),esm_z(t[3]))|255)>>>0:(t=ie.exec(e))?(de(esm_pe(t[1]),esm_z(t[2]),esm_z(t[3]))|me(t[4]))>>>0:null}function esm_j(e,t,r){return r<0&&(r+=1),r>1&&(r-=1),r<1/6?e+(t-e)*6*r:r<1/2?t:r<2/3?e+(t-e)*(2/3-r)*6:e}function de(e,t,r){let n=r<.5?r*(1+t):r+t-r*t,f=2*r-n,o=esm_j(f,n,e+1/3),i=esm_j(f,n,e),s=esm_j(f,n,e-1/3);return Math.round(o*255)<<24|Math.round(i*255)<<16|Math.round(s*255)<<8}function dist_esm_y(e){let t=parseInt(e,10);return t<0?0:t>255?255:t}function esm_pe(e){return(parseFloat(e)%360+360)%360/360}function me(e){let t=parseFloat(e);return t<0?0:t>1?255:Math.round(t*255)}function esm_z(e){let t=parseFloat(e);return t<0?0:t>100?1:t/100}function D(e){let t=be(e);if(t===null)return e;t=t||0;let r=(t&4278190080)>>>24,n=(t&16711680)>>>16,f=(t&65280)>>>8,o=(t&255)/255;return`rgba(${r}, ${n}, ${f}, ${o})`}var W=(e,t,r)=>{if(dist_esm_l.fun(e))return e;if(dist_esm_l.arr(e))return W({range:e,output:t,extrapolate:r});if(dist_esm_l.str(e.output[0]))return esm_k(e);let n=e,f=n.output,o=n.range||[0,1],i=n.extrapolateLeft||n.extrapolate||"extend",s=n.extrapolateRight||n.extrapolate||"extend",x=n.easing||(a=>a);return a=>{let F=He(a,o);return Ue(a,o[F],o[F+1],f[F],f[F+1],x,i,s,n.map)}};function Ue(e,t,r,n,f,o,i,s,x){let a=x?x(e):e;if(a<t){if(i==="identity")return a;i==="clamp"&&(a=t)}if(a>r){if(s==="identity")return a;s==="clamp"&&(a=r)}return n===f?n:t===r?e<=t?n:f:(t===-1/0?a=-a:r===1/0?a=a-t:a=(a-t)/(r-t),a=o(a),n===-1/0?a=-a:f===1/0?a=a+n:a=a*(f-n)+n,a)}function He(e,t){for(var r=1;r<t.length-1&&!(t[r]>=e);++r);return r-1}var Be=(e,t="end")=>r=>{r=t==="end"?Math.min(r,.999):Math.max(r,.001);let n=r*e,f=t==="end"?Math.floor(n):Math.ceil(n);return ne(0,1,f/e)},P=1.70158,L=P*1.525,xe=P+1,he=2*Math.PI/3,ye=2*Math.PI/4.5,V=e=>e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375,Lt={linear:e=>e,easeInQuad:e=>e*e,easeOutQuad:e=>1-(1-e)*(1-e),easeInOutQuad:e=>e<.5?2*e*e:1-Math.pow(-2*e+2,2)/2,easeInCubic:e=>e*e*e,easeOutCubic:e=>1-Math.pow(1-e,3),easeInOutCubic:e=>e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2,easeInQuart:e=>e*e*e*e,easeOutQuart:e=>1-Math.pow(1-e,4),easeInOutQuart:e=>e<.5?8*e*e*e*e:1-Math.pow(-2*e+2,4)/2,easeInQuint:e=>e*e*e*e*e,easeOutQuint:e=>1-Math.pow(1-e,5),easeInOutQuint:e=>e<.5?16*e*e*e*e*e:1-Math.pow(-2*e+2,5)/2,easeInSine:e=>1-Math.cos(e*Math.PI/2),easeOutSine:e=>Math.sin(e*Math.PI/2),easeInOutSine:e=>-(Math.cos(Math.PI*e)-1)/2,easeInExpo:e=>e===0?0:Math.pow(2,10*e-10),easeOutExpo:e=>e===1?1:1-Math.pow(2,-10*e),easeInOutExpo:e=>e===0?0:e===1?1:e<.5?Math.pow(2,20*e-10)/2:(2-Math.pow(2,-20*e+10))/2,easeInCirc:e=>1-Math.sqrt(1-Math.pow(e,2)),easeOutCirc:e=>Math.sqrt(1-Math.pow(e-1,2)),easeInOutCirc:e=>e<.5?(1-Math.sqrt(1-Math.pow(2*e,2)))/2:(Math.sqrt(1-Math.pow(-2*e+2,2))+1)/2,easeInBack:e=>xe*e*e*e-P*e*e,easeOutBack:e=>1+xe*Math.pow(e-1,3)+P*Math.pow(e-1,2),easeInOutBack:e=>e<.5?Math.pow(2*e,2)*((L+1)*2*e-L)/2:(Math.pow(2*e-2,2)*((L+1)*(e*2-2)+L)+2)/2,easeInElastic:e=>e===0?0:e===1?1:-Math.pow(2,10*e-10)*Math.sin((e*10-10.75)*he),easeOutElastic:e=>e===0?0:e===1?1:Math.pow(2,-10*e)*Math.sin((e*10-.75)*he)+1,easeInOutElastic:e=>e===0?0:e===1?1:e<.5?-(Math.pow(2,20*e-10)*Math.sin((20*e-11.125)*ye))/2:Math.pow(2,-20*e+10)*Math.sin((20*e-11.125)*ye)/2+1,easeInBounce:e=>1-V(1-e),easeOutBounce:V,easeInOutBounce:e=>e<.5?(1-V(1-2*e))/2:(1+V(2*e-1))/2,steps:Be};var esm_g=Symbol.for("FluidValue.get"),dist_esm_m=Symbol.for("FluidValue.observers");var Pt=e=>Boolean(e&&e[esm_g]),ve=e=>e&&e[esm_g]?e[esm_g]():e,esm_qt=e=>e[dist_esm_m]||null;function je(e,t){e.eventObserved?e.eventObserved(t):e(t)}function $t(e,t){let r=e[dist_esm_m];r&&r.forEach(n=>{je(n,t)})}var esm_ge=class{[esm_g];[dist_esm_m];constructor(t){if(!t&&!(t=this.get))throw Error("Unknown getter");De(this,t)}},De=(e,t)=>Ee(e,esm_g,t);function Gt(e,t){if(e[esm_g]){let r=e[dist_esm_m];r||Ee(e,dist_esm_m,r=new Set),r.has(t)||(r.add(t),e.observerAdded&&e.observerAdded(r.size,t))}return t}function Qt(e,t){let r=e[dist_esm_m];if(r&&r.has(t)){let n=r.size-1;n?r.delete(t):e[dist_esm_m]=null,e.observerRemoved&&e.observerRemoved(n,t)}}var Ee=(e,t,r)=>Object.defineProperty(e,t,{value:r,writable:!0,configurable:!0});var O=/[+\-]?(?:0|[1-9]\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,esm_Oe=/(#(?:[0-9a-f]{2}){2,4}|(#[0-9a-f]{3})|(rgb|hsl)a?\((-?\d+%?[,\s]+){2,3}\s*[\d\.]+%?\))/gi,K=new RegExp(`(${O.source})(%|[a-z]+)`,"i"),we=/rgba\(([0-9\.-]+), ([0-9\.-]+), ([0-9\.-]+), ([0-9\.-]+)\)/gi,dist_esm_b=/var\((--[a-zA-Z0-9-_]+),? ?([a-zA-Z0-9 ()%#.,-]+)?\)/;var esm_N=e=>{let[t,r]=We(e);if(!t||dist_esm_h())return e;let n=window.getComputedStyle(document.documentElement).getPropertyValue(t);if(n)return n.trim();if(r&&r.startsWith("--")){let f=window.getComputedStyle(document.documentElement).getPropertyValue(r);return f||e}else{if(r&&dist_esm_b.test(r))return esm_N(r);if(r)return r}return e},We=e=>{let t=dist_esm_b.exec(e);if(!t)return[,];let[,r,n]=t;return[r,n]};var _,esm_Ke=(e,t,r,n,f)=>`rgba(${Math.round(t)}, ${Math.round(r)}, ${Math.round(n)}, ${f})`,Xt=e=>{_||(_=dist_esm_c?new RegExp(`(${Object.keys(dist_esm_c).join("|")})(?!\\w)`,"g"):/^\b$/);let t=e.output.map(o=>ve(o).replace(dist_esm_b,esm_N).replace(esm_Oe,D).replace(_,D)),r=t.map(o=>o.match(O).map(Number)),f=r[0].map((o,i)=>r.map(s=>{if(!(i in s))throw Error('The arity of each "output" value must be equal');return s[i]})).map(o=>W({...e,output:o}));return o=>{let i=!K.test(t[0])&&t.find(x=>K.test(x))?.replace(O,""),s=0;return t[0].replace(O,()=>`${f[s++](o)}${i||""}`).replace(we,esm_Ke)}};var Z="react-spring: ",Te=e=>{let t=e,r=!1;if(typeof t!="function")throw new TypeError(`${Z}once requires a function parameter`);return(...n)=>{r||(t(...n),r=!0)}},Ne=Te(console.warn);function Jt(){Ne(`${Z}The "interpolate" function is deprecated in v9 (use "to" instead)`)}var _e=Te(console.warn);function er(){_e(`${Z}Directly calling start instead of using the api object is deprecated in v9 (use ".start" instead), this will be removed in later 0.X.0 versions`)}function esm_or(e){return dist_esm_l.str(e)&&(e[0]=="#"||/\d/.test(e)||!dist_esm_h()&&dist_esm_b.test(e)||e in(dist_esm_c||{}))}var dist_esm_v,q=new WeakMap,Ze=e=>e.forEach(({target:t,contentRect:r})=>q.get(t)?.forEach(n=>n(r)));function Fe(e,t){dist_esm_v||typeof ResizeObserver<"u"&&(dist_esm_v=new ResizeObserver(Ze));let r=q.get(t);return r||(r=new Set,q.set(t,r)),r.add(e),dist_esm_v&&dist_esm_v.observe(t),()=>{let n=q.get(t);!n||(n.delete(e),!n.size&&dist_esm_v&&dist_esm_v.unobserve(t))}}var esm_$=new Set,dist_esm_w,esm_Xe=()=>{let e=()=>{esm_$.forEach(t=>t({width:window.innerWidth,height:window.innerHeight}))};return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}},Ie=e=>(esm_$.add(e),dist_esm_w||(dist_esm_w=esm_Xe()),()=>{esm_$.delete(e),!esm_$.size&&dist_esm_w&&(dist_esm_w(),dist_esm_w=void 0)});var ke=(e,{container:t=document.documentElement}={})=>t===document.documentElement?Ie(e):Fe(e,t);var Se=(e,t,r)=>t-e===0?1:(r-e)/(t-e);var esm_Ye={x:{length:"Width",position:"Left"},y:{length:"Height",position:"Top"}},esm_G=class{callback;container;info;constructor(t,r){this.callback=t,this.container=r,this.info={time:0,x:this.createAxis(),y:this.createAxis()}}createAxis=()=>({current:0,progress:0,scrollLength:0});updateAxis=t=>{let r=this.info[t],{length:n,position:f}=esm_Ye[t];r.current=this.container[`scroll${f}`],r.scrollLength=this.container["scroll"+n]-this.container["client"+n],r.progress=Se(0,r.scrollLength,r.current)};update=()=>{this.updateAxis("x"),this.updateAxis("y")};sendEvent=()=>{this.callback(this.info)};advance=()=>{this.update(),this.sendEvent()}};var esm_T=new WeakMap,Ae=new WeakMap,X=new WeakMap,Me=e=>e===document.documentElement?window:e,yr=(e,{container:t=document.documentElement}={})=>{let r=X.get(t);r||(r=new Set,X.set(t,r));let n=new esm_G(e,t);if(r.add(n),!esm_T.has(t)){let o=()=>(r?.forEach(s=>s.advance()),!0);esm_T.set(t,o);let i=Me(t);window.addEventListener("resize",o,{passive:!0}),t!==document.documentElement&&Ae.set(t,ke(o,{container:t})),i.addEventListener("scroll",o,{passive:!0})}let f=esm_T.get(t);return Re(f),()=>{Re.cancel(f);let o=X.get(t);if(!o||(o.delete(n),o.size))return;let i=esm_T.get(t);esm_T.delete(t),i&&(Me(t).removeEventListener("scroll",i),window.removeEventListener("resize",i),Ae.get(t)?.())}};function Er(e){let t=Je(null);return t.current===null&&(t.current=e()),t.current}var esm_Q=dist_esm_h()?external_React_.useEffect:external_React_.useLayoutEffect;var Ce=()=>{let e=(0,external_React_.useRef)(!1);return esm_Q(()=>(e.current=!0,()=>{e.current=!1}),[]),e};function Mr(){let e=(0,external_React_.useState)()[1],t=Ce();return()=>{t.current&&e(Math.random())}}function Lr(e,t){let[r]=(0,external_React_.useState)(()=>({inputs:t,result:e()})),n=(0,external_React_.useRef)(),f=n.current,o=f;return o?Boolean(t&&o.inputs&&it(t,o.inputs))||(o={inputs:t,result:e()}):o=r,(0,external_React_.useEffect)(()=>{n.current=o,f==r&&(r.inputs=r.result=void 0)},[o]),o.result}function it(e,t){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0}var $r=e=>(0,external_React_.useEffect)(e,ut),ut=[];function Ur(e){let t=ct();return lt(()=>{t.current=e}),t.current}var Wr=()=>{let[e,t]=dt(null);return esm_Q(()=>{let r=window.matchMedia("(prefers-reduced-motion)"),n=f=>{t(f.matches),U({skipAnimation:f.matches})};return n(r),r.addEventListener("change",n),()=>{r.removeEventListener("change",n)}},[]),e};

;// ./node_modules/@react-spring/animated/dist/esm/index.js
var animated_dist_esm_h=Symbol.for("Animated:node"),animated_dist_esm_v=e=>!!e&&e[animated_dist_esm_h]===e,dist_esm_k=e=>e&&e[animated_dist_esm_h],esm_D=(e,t)=>mt(e,animated_dist_esm_h,t),F=e=>e&&e[animated_dist_esm_h]&&e[animated_dist_esm_h].getPayload(),animated_dist_esm_c=class{payload;constructor(){esm_D(this,this)}getPayload(){return this.payload||[]}};var animated_dist_esm_l=class extends animated_dist_esm_c{constructor(r){super();this._value=r;dist_esm_l.num(this._value)&&(this.lastPosition=this._value)}done=!0;elapsedTime;lastPosition;lastVelocity;v0;durationProgress=0;static create(r){return new animated_dist_esm_l(r)}getPayload(){return[this]}getValue(){return this._value}setValue(r,n){return dist_esm_l.num(r)&&(this.lastPosition=r,n&&(r=Math.round(r/n)*n,this.done&&(this.lastPosition=r))),this._value===r?!1:(this._value=r,!0)}reset(){let{done:r}=this;this.done=!1,dist_esm_l.num(this._value)&&(this.elapsedTime=0,this.durationProgress=0,this.lastPosition=this._value,r&&(this.lastVelocity=null),this.v0=null)}};var animated_dist_esm_d=class extends animated_dist_esm_l{_string=null;_toString;constructor(t){super(0),this._toString=W({output:[t,t]})}static create(t){return new animated_dist_esm_d(t)}getValue(){let t=this._string;return t??(this._string=this._toString(this._value))}setValue(t){if(dist_esm_l.str(t)){if(t==this._string)return!1;this._string=t,this._value=1}else if(super.setValue(t))this._string=null;else return!1;return!0}reset(t){t&&(this._toString=W({output:[this.getValue(),t]})),this._value=0,super.reset()}};var dist_esm_f={dependencies:null};var animated_dist_esm_u=class extends animated_dist_esm_c{constructor(r){super();this.source=r;this.setValue(r)}getValue(r){let n={};return xt(this.source,(a,i)=>{animated_dist_esm_v(a)?n[i]=a.getValue(r):Pt(a)?n[i]=ve(a):r||(n[i]=a)}),n}setValue(r){this.source=r,this.payload=this._makePayload(r)}reset(){this.payload&&esm_Ve(this.payload,r=>r.reset())}_makePayload(r){if(r){let n=new Set;return xt(r,this._addToPayload,n),Array.from(n)}}_addToPayload(r){dist_esm_f.dependencies&&Pt(r)&&dist_esm_f.dependencies.add(r);let n=F(r);n&&esm_Ve(n,a=>this.add(a))}};var animated_dist_esm_y=class extends animated_dist_esm_u{constructor(t){super(t)}static create(t){return new animated_dist_esm_y(t)}getValue(){return this.source.map(t=>t.getValue())}setValue(t){let r=this.getPayload();return t.length==r.length?r.map((n,a)=>n.setValue(t[a])).some(Boolean):(super.setValue(t.map(dist_esm_z)),!0)}};function dist_esm_z(e){return(esm_or(e)?animated_dist_esm_d:animated_dist_esm_l).create(e)}function esm_Le(e){let t=dist_esm_k(e);return t?t.constructor:dist_esm_l.arr(e)?animated_dist_esm_y:esm_or(e)?animated_dist_esm_d:animated_dist_esm_l}var dist_esm_x=(e,t)=>{let r=!dist_esm_l.fun(e)||e.prototype&&e.prototype.isReactComponent;return (0,external_React_.forwardRef)((n,a)=>{let i=(0,external_React_.useRef)(null),o=r&&(0,external_React_.useCallback)(s=>{i.current=esm_ae(a,s)},[a]),[m,T]=esm_ne(n,t),W=Mr(),P=()=>{let s=i.current;if(r&&!s)return;(s?t.applyAnimatedValues(s,m.getValue(!0)):!1)===!1&&W()},_=new animated_dist_esm_b(P,T),p=(0,external_React_.useRef)();esm_Q(()=>(p.current=_,esm_Ve(T,s=>Gt(s,_)),()=>{p.current&&(esm_Ve(p.current.deps,s=>Qt(s,p.current)),esm_n.cancel(p.current.update))})),(0,external_React_.useEffect)(P,[]),$r(()=>()=>{let s=p.current;esm_Ve(s.deps,S=>Qt(S,s))});let $=t.getComponentProps(m.getValue());return external_React_.createElement(e,{...$,ref:o})})},animated_dist_esm_b=class{constructor(t,r){this.update=t;this.deps=r}eventObserved(t){t.type=="change"&&esm_n.write(this.update)}};function esm_ne(e,t){let r=new Set;return dist_esm_f.dependencies=r,e.style&&(e={...e,style:t.createAnimatedStyle(e.style)}),e=new animated_dist_esm_u(e),dist_esm_f.dependencies=null,[e,r]}function esm_ae(e,t){return e&&(dist_esm_l.fun(e)?e(t):e.current=t),t}var dist_esm_j=Symbol.for("AnimatedComponent"),dist_esm_Ke=(e,{applyAnimatedValues:t=()=>!1,createAnimatedStyle:r=a=>new animated_dist_esm_u(a),getComponentProps:n=a=>a}={})=>{let a={applyAnimatedValues:t,createAnimatedStyle:r,getComponentProps:n},i=o=>{let m=esm_I(o)||"Anonymous";return dist_esm_l.str(o)?o=i[o]||(i[o]=dist_esm_x(o,a)):o=o[dist_esm_j]||(o[dist_esm_j]=dist_esm_x(o,a)),o.displayName=`Animated(${m})`,o};return xt(e,(o,m)=>{dist_esm_l.arr(e)&&(m=esm_I(o)),i[m]=i(o)}),{animated:i}},esm_I=e=>dist_esm_l.str(e)?e:e&&dist_esm_l.str(e.displayName)?e.displayName:dist_esm_l.fun(e)&&e.name||null;

;// ./node_modules/@react-spring/core/dist/esm/index.js
function dist_esm_I(t,...e){return dist_esm_l.fun(t)?t(...e):t}var esm_te=(t,e)=>t===!0||!!(e&&t&&(dist_esm_l.fun(t)?t(e):ht(t).includes(e))),et=(t,e)=>dist_esm_l.obj(t)?e&&t[e]:t;var esm_ke=(t,e)=>t.default===!0?t[e]:t.default?t.default[e]:void 0,nn=t=>t,dist_esm_ne=(t,e=nn)=>{let n=rn;t.default&&t.default!==!0&&(t=t.default,n=Object.keys(t));let r={};for(let o of n){let s=e(t[o],o);dist_esm_l.und(s)||(r[o]=s)}return r},rn=["config","onProps","onStart","onChange","onPause","onResume","onRest"],on={config:1,from:1,to:1,ref:1,loop:1,reset:1,pause:1,cancel:1,reverse:1,immediate:1,default:1,delay:1,onProps:1,onStart:1,onChange:1,onPause:1,onResume:1,onRest:1,onResolve:1,items:1,trail:1,sort:1,expires:1,initial:1,enter:1,update:1,leave:1,children:1,onDestroyed:1,keys:1,callId:1,parentId:1};function sn(t){let e={},n=0;if(xt(t,(r,o)=>{on[o]||(e[o]=r,n++)}),n)return e}function esm_de(t){let e=sn(t);if(e){let n={to:e};return xt(t,(r,o)=>o in e||(n[o]=r)),n}return{...t}}function esm_me(t){return t=ve(t),dist_esm_l.arr(t)?t.map(esm_me):esm_or(t)?dist_esm_p.createStringInterpolator({range:[0,1],output:[t,t]})(1):t}function esm_Ue(t){for(let e in t)return!0;return!1}function esm_Ee(t){return dist_esm_l.fun(t)||dist_esm_l.arr(t)&&dist_esm_l.obj(t[0])}function esm_xe(t,e){t.ref?.delete(t),e?.delete(t)}function esm_he(t,e){e&&t.ref!==e&&(t.ref?.delete(t),e.add(t),t.ref=e)}function wr(t,e,n=1e3){an(()=>{if(e){let r=0;ge(t,(o,s)=>{let a=o.current;if(a.length){let i=n*e[s];isNaN(i)?i=r:r=i,ge(a,u=>{ge(u.queue,p=>{let f=p.delay;p.delay=d=>i+dist_esm_I(f||0,d)})}),o.start()}})}else{let r=Promise.resolve();ge(t,o=>{let s=o.current;if(s.length){let a=s.map(i=>{let u=i.queue;return i.queue=[],u});r=r.then(()=>(ge(s,(i,u)=>ge(a[u]||[],p=>i.queue.push(p))),Promise.all(o.start())))}})}})}var esm_mt={default:{tension:170,friction:26},gentle:{tension:120,friction:14},wobbly:{tension:180,friction:12},stiff:{tension:210,friction:20},slow:{tension:280,friction:60},molasses:{tension:280,friction:120}};var tt={...esm_mt.default,mass:1,damping:1,easing:Lt.linear,clamp:!1},esm_we=class{tension;friction;frequency;damping;mass;velocity=0;restVelocity;precision;progress;duration;easing;clamp;bounce;decay;round;constructor(){Object.assign(this,tt)}};function gt(t,e,n){n&&(n={...n},esm_ht(n,e),e={...n,...e}),esm_ht(t,e),Object.assign(t,e);for(let a in tt)t[a]==null&&(t[a]=tt[a]);let{mass:r,frequency:o,damping:s}=t;return dist_esm_l.und(o)||(o<.01&&(o=.01),s<0&&(s=0),t.tension=Math.pow(2*Math.PI/o,2)*r,t.friction=4*Math.PI*s*r/o),t}function esm_ht(t,e){if(!dist_esm_l.und(e.decay))t.duration=void 0;else{let n=!dist_esm_l.und(e.tension)||!dist_esm_l.und(e.friction);(n||!dist_esm_l.und(e.frequency)||!dist_esm_l.und(e.damping)||!dist_esm_l.und(e.mass))&&(t.duration=void 0,t.decay=void 0),n&&(t.frequency=void 0)}}var esm_yt=[],dist_esm_Le=class{changed=!1;values=esm_yt;toValues=null;fromValues=esm_yt;to;from;config=new esm_we;immediate=!1};function esm_Me(t,{key:e,props:n,defaultProps:r,state:o,actions:s}){return new Promise((a,i)=>{let u,p,f=esm_te(n.cancel??r?.cancel,e);if(f)b();else{dist_esm_l.und(n.pause)||(o.paused=esm_te(n.pause,e));let c=r?.pause;c!==!0&&(c=o.paused||esm_te(c,e)),u=dist_esm_I(n.delay||0,e),c?(o.resumeQueue.add(m),s.pause()):(s.resume(),m())}function d(){o.resumeQueue.add(m),o.timeouts.delete(p),p.cancel(),u=p.time-esm_n.now()}function m(){u>0&&!dist_esm_p.skipAnimation?(o.delayed=!0,p=esm_n.setTimeout(b,u),o.pauseQueue.add(d),o.timeouts.add(p)):b()}function b(){o.delayed&&(o.delayed=!1),o.pauseQueue.delete(d),o.timeouts.delete(p),t<=(o.cancelId||0)&&(f=!0);try{s.start({...n,callId:t,cancel:f},a)}catch(c){i(c)}}})}var esm_be=(t,e)=>e.length==1?e[0]:e.some(n=>n.cancelled)?esm_q(t.get()):e.every(n=>n.noop)?nt(t.get()):dist_esm_E(t.get(),e.every(n=>n.finished)),nt=t=>({value:t,noop:!0,finished:!0,cancelled:!1}),dist_esm_E=(t,e,n=!1)=>({value:t,finished:e,cancelled:n}),esm_q=t=>({value:t,cancelled:!0,finished:!1});function esm_De(t,e,n,r){let{callId:o,parentId:s,onRest:a}=e,{asyncTo:i,promise:u}=n;return!s&&t===i&&!e.reset?u:n.promise=(async()=>{n.asyncId=o,n.asyncTo=t;let p=dist_esm_ne(e,(l,h)=>h==="onRest"?void 0:l),f,d,m=new Promise((l,h)=>(f=l,d=h)),b=l=>{let h=o<=(n.cancelId||0)&&esm_q(r)||o!==n.asyncId&&dist_esm_E(r,!1);if(h)throw l.result=h,d(l),l},c=(l,h)=>{let g=new esm_Ae,x=new esm_Ne;return(async()=>{if(dist_esm_p.skipAnimation)throw esm_oe(n),x.result=dist_esm_E(r,!1),d(x),x;b(g);let S=dist_esm_l.obj(l)?{...l}:{...h,to:l};S.parentId=o,xt(p,(V,_)=>{dist_esm_l.und(S[_])&&(S[_]=V)});let A=await r.start(S);return b(g),n.paused&&await new Promise(V=>{n.resumeQueue.add(V)}),A})()},P;if(dist_esm_p.skipAnimation)return esm_oe(n),dist_esm_E(r,!1);try{let l;dist_esm_l.arr(t)?l=(async h=>{for(let g of h)await c(g)})(t):l=Promise.resolve(t(c,r.stop.bind(r))),await Promise.all([l.then(f),m]),P=dist_esm_E(r.get(),!0,!1)}catch(l){if(l instanceof esm_Ae)P=l.result;else if(l instanceof esm_Ne)P=l.result;else throw l}finally{o==n.asyncId&&(n.asyncId=s,n.asyncTo=s?i:void 0,n.promise=s?u:void 0)}return dist_esm_l.fun(a)&&esm_n.batchedUpdates(()=>{a(P,r,r.item)}),P})()}function esm_oe(t,e){Pe(t.timeouts,n=>n.cancel()),t.pauseQueue.clear(),t.resumeQueue.clear(),t.asyncId=t.asyncTo=t.promise=void 0,e&&(t.cancelId=e)}var esm_Ae=class extends Error{result;constructor(){super("An async animation has been interrupted. You see this error because you forgot to use `await` or `.catch(...)` on its returned promise.")}},esm_Ne=class extends Error{result;constructor(){super("SkipAnimationSignal")}};var esm_Re=t=>t instanceof esm_X,Sn=1,esm_X=class extends esm_ge{id=Sn++;_priority=0;get priority(){return this._priority}set priority(e){this._priority!=e&&(this._priority=e,this._onPriorityChange(e))}get(){let e=dist_esm_k(this);return e&&e.getValue()}to(...e){return dist_esm_p.to(this,e)}interpolate(...e){return Jt(),dist_esm_p.to(this,e)}toJSON(){return this.get()}observerAdded(e){e==1&&this._attach()}observerRemoved(e){e==0&&this._detach()}_attach(){}_detach(){}_onChange(e,n=!1){$t(this,{type:"change",parent:this,value:e,idle:n})}_onPriorityChange(e){this.idle||qe.sort(this),$t(this,{type:"priority",parent:this,priority:e})}};var esm_se=Symbol.for("SpringPhase"),esm_bt=1,rt=2,ot=4,esm_qe=t=>(t[esm_se]&esm_bt)>0,dist_esm_Q=t=>(t[esm_se]&rt)>0,esm_ye=t=>(t[esm_se]&ot)>0,st=(t,e)=>e?t[esm_se]|=rt|esm_bt:t[esm_se]&=~rt,esm_it=(t,e)=>e?t[esm_se]|=ot:t[esm_se]&=~ot;var esm_ue=class extends esm_X{key;animation=new dist_esm_Le;queue;defaultProps={};_state={paused:!1,delayed:!1,pauseQueue:new Set,resumeQueue:new Set,timeouts:new Set};_pendingCalls=new Set;_lastCallId=0;_lastToId=0;_memoizedDuration=0;constructor(e,n){if(super(),!dist_esm_l.und(e)||!dist_esm_l.und(n)){let r=dist_esm_l.obj(e)?{...e}:{...n,from:e};dist_esm_l.und(r.default)&&(r.default=!0),this.start(r)}}get idle(){return!(dist_esm_Q(this)||this._state.asyncTo)||esm_ye(this)}get goal(){return ve(this.animation.to)}get velocity(){let e=dist_esm_k(this);return e instanceof animated_dist_esm_l?e.lastVelocity||0:e.getPayload().map(n=>n.lastVelocity||0)}get hasAnimated(){return esm_qe(this)}get isAnimating(){return dist_esm_Q(this)}get isPaused(){return esm_ye(this)}get isDelayed(){return this._state.delayed}advance(e){let n=!0,r=!1,o=this.animation,{config:s,toValues:a}=o,i=F(o.to);!i&&Pt(o.to)&&(a=ht(ve(o.to))),o.values.forEach((f,d)=>{if(f.done)return;let m=f.constructor==animated_dist_esm_d?1:i?i[d].lastPosition:a[d],b=o.immediate,c=m;if(!b){if(c=f.lastPosition,s.tension<=0){f.done=!0;return}let P=f.elapsedTime+=e,l=o.fromValues[d],h=f.v0!=null?f.v0:f.v0=dist_esm_l.arr(s.velocity)?s.velocity[d]:s.velocity,g,x=s.precision||(l==m?.005:Math.min(1,Math.abs(m-l)*.001));if(dist_esm_l.und(s.duration))if(s.decay){let S=s.decay===!0?.998:s.decay,A=Math.exp(-(1-S)*P);c=l+h/(1-S)*(1-A),b=Math.abs(f.lastPosition-c)<=x,g=h*A}else{g=f.lastVelocity==null?h:f.lastVelocity;let S=s.restVelocity||x/10,A=s.clamp?0:s.bounce,V=!dist_esm_l.und(A),_=l==m?f.v0>0:l<m,v,w=!1,C=1,$=Math.ceil(e/C);for(let L=0;L<$&&(v=Math.abs(g)>S,!(!v&&(b=Math.abs(m-c)<=x,b)));++L){V&&(w=c==m||c>m==_,w&&(g=-g*A,c=m));let N=-s.tension*1e-6*(c-m),y=-s.friction*.001*g,T=(N+y)/s.mass;g=g+T*C,c=c+g*C}}else{let S=1;s.duration>0&&(this._memoizedDuration!==s.duration&&(this._memoizedDuration=s.duration,f.durationProgress>0&&(f.elapsedTime=s.duration*f.durationProgress,P=f.elapsedTime+=e)),S=(s.progress||0)+P/this._memoizedDuration,S=S>1?1:S<0?0:S,f.durationProgress=S),c=l+s.easing(S)*(m-l),g=(c-f.lastPosition)/e,b=S==1}f.lastVelocity=g,Number.isNaN(c)&&(console.warn("Got NaN while animating:",this),b=!0)}i&&!i[d].done&&(b=!1),b?f.done=!0:n=!1,f.setValue(c,s.round)&&(r=!0)});let u=dist_esm_k(this),p=u.getValue();if(n){let f=ve(o.to);(p!==f||r)&&!s.decay?(u.setValue(f),this._onChange(f)):r&&s.decay&&this._onChange(p),this._stop()}else r&&this._onChange(p)}set(e){return esm_n.batchedUpdates(()=>{this._stop(),this._focus(e),this._set(e)}),this}pause(){this._update({pause:!0})}resume(){this._update({pause:!1})}finish(){if(dist_esm_Q(this)){let{to:e,config:n}=this.animation;esm_n.batchedUpdates(()=>{this._onStart(),n.decay||this._set(e,!1),this._stop()})}return this}update(e){return(this.queue||(this.queue=[])).push(e),this}start(e,n){let r;return dist_esm_l.und(e)?(r=this.queue||[],this.queue=[]):r=[dist_esm_l.obj(e)?e:{...n,to:e}],Promise.all(r.map(o=>this._update(o))).then(o=>esm_be(this,o))}stop(e){let{to:n}=this.animation;return this._focus(this.get()),esm_oe(this._state,e&&this._lastCallId),esm_n.batchedUpdates(()=>this._stop(n,e)),this}reset(){this._update({reset:!0})}eventObserved(e){e.type=="change"?this._start():e.type=="priority"&&(this.priority=e.priority+1)}_prepareNode(e){let n=this.key||"",{to:r,from:o}=e;r=dist_esm_l.obj(r)?r[n]:r,(r==null||esm_Ee(r))&&(r=void 0),o=dist_esm_l.obj(o)?o[n]:o,o==null&&(o=void 0);let s={to:r,from:o};return esm_qe(this)||(e.reverse&&([r,o]=[o,r]),o=ve(o),dist_esm_l.und(o)?dist_esm_k(this)||this._set(r):this._set(o)),s}_update({...e},n){let{key:r,defaultProps:o}=this;e.default&&Object.assign(o,dist_esm_ne(e,(i,u)=>/^on/.test(u)?et(i,r):i)),_t(this,e,"onProps"),esm_Ie(this,"onProps",e,this);let s=this._prepareNode(e);if(Object.isFrozen(this))throw Error("Cannot animate a `SpringValue` object that is frozen. Did you forget to pass your component to `animated(...)` before animating its props?");let a=this._state;return esm_Me(++this._lastCallId,{key:r,props:e,defaultProps:o,state:a,actions:{pause:()=>{esm_ye(this)||(esm_it(this,!0),yt(a.pauseQueue),esm_Ie(this,"onPause",dist_esm_E(this,esm_Ce(this,this.animation.to)),this))},resume:()=>{esm_ye(this)&&(esm_it(this,!1),dist_esm_Q(this)&&this._resume(),yt(a.resumeQueue),esm_Ie(this,"onResume",dist_esm_E(this,esm_Ce(this,this.animation.to)),this))},start:this._merge.bind(this,s)}}).then(i=>{if(e.loop&&i.finished&&!(n&&i.noop)){let u=at(e);if(u)return this._update(u,!0)}return i})}_merge(e,n,r){if(n.cancel)return this.stop(!0),r(esm_q(this));let o=!dist_esm_l.und(e.to),s=!dist_esm_l.und(e.from);if(o||s)if(n.callId>this._lastToId)this._lastToId=n.callId;else return r(esm_q(this));let{key:a,defaultProps:i,animation:u}=this,{to:p,from:f}=u,{to:d=p,from:m=f}=e;s&&!o&&(!n.default||dist_esm_l.und(d))&&(d=m),n.reverse&&([d,m]=[m,d]);let b=!bt(m,f);b&&(u.from=m),m=ve(m);let c=!bt(d,p);c&&this._focus(d);let P=esm_Ee(n.to),{config:l}=u,{decay:h,velocity:g}=l;(o||s)&&(l.velocity=0),n.config&&!P&&gt(l,dist_esm_I(n.config,a),n.config!==i.config?dist_esm_I(i.config,a):void 0);let x=dist_esm_k(this);if(!x||dist_esm_l.und(d))return r(dist_esm_E(this,!0));let S=dist_esm_l.und(n.reset)?s&&!n.default:!dist_esm_l.und(m)&&esm_te(n.reset,a),A=S?m:this.get(),V=esm_me(d),_=dist_esm_l.num(V)||dist_esm_l.arr(V)||esm_or(V),v=!P&&(!_||esm_te(i.immediate||n.immediate,a));if(c){let L=esm_Le(d);if(L!==x.constructor)if(v)x=this._set(V);else throw Error(`Cannot animate between ${x.constructor.name} and ${L.name}, as the "to" prop suggests`)}let w=x.constructor,C=Pt(d),$=!1;if(!C){let L=S||!esm_qe(this)&&b;(c||L)&&($=bt(esm_me(A),V),C=!$),(!bt(u.immediate,v)&&!v||!bt(l.decay,h)||!bt(l.velocity,g))&&(C=!0)}if($&&dist_esm_Q(this)&&(u.changed&&!S?C=!0:C||this._stop(p)),!P&&((C||Pt(p))&&(u.values=x.getPayload(),u.toValues=Pt(d)?null:w==animated_dist_esm_d?[1]:ht(V)),u.immediate!=v&&(u.immediate=v,!v&&!S&&this._set(p)),C)){let{onRest:L}=u;esm_Ve(dist_esm_n,y=>_t(this,n,y));let N=dist_esm_E(this,esm_Ce(this,p));yt(this._pendingCalls,N),this._pendingCalls.add(r),u.changed&&esm_n.batchedUpdates(()=>{u.changed=!S,L?.(N,this),S?dist_esm_I(i.onRest,N):u.onStart?.(N,this)})}S&&this._set(A),P?r(esm_De(n.to,n,this._state,this)):C?this._start():dist_esm_Q(this)&&!c?this._pendingCalls.add(r):r(nt(A))}_focus(e){let n=this.animation;e!==n.to&&(esm_qt(this)&&this._detach(),n.to=e,esm_qt(this)&&this._attach())}_attach(){let e=0,{to:n}=this.animation;Pt(n)&&(Gt(n,this),esm_Re(n)&&(e=n.priority+1)),this.priority=e}_detach(){let{to:e}=this.animation;Pt(e)&&Qt(e,this)}_set(e,n=!0){let r=ve(e);if(!dist_esm_l.und(r)){let o=dist_esm_k(this);if(!o||!bt(r,o.getValue())){let s=esm_Le(r);!o||o.constructor!=s?esm_D(this,s.create(r)):o.setValue(r),o&&esm_n.batchedUpdates(()=>{this._onChange(r,n)})}}return dist_esm_k(this)}_onStart(){let e=this.animation;e.changed||(e.changed=!0,esm_Ie(this,"onStart",dist_esm_E(this,esm_Ce(this,e.to)),this))}_onChange(e,n){n||(this._onStart(),dist_esm_I(this.animation.onChange,e,this)),dist_esm_I(this.defaultProps.onChange,e,this),super._onChange(e,n)}_start(){let e=this.animation;dist_esm_k(this).reset(ve(e.to)),e.immediate||(e.fromValues=e.values.map(n=>n.lastPosition)),dist_esm_Q(this)||(st(this,!0),esm_ye(this)||this._resume())}_resume(){dist_esm_p.skipAnimation?this.finish():qe.start(this)}_stop(e,n){if(dist_esm_Q(this)){st(this,!1);let r=this.animation;esm_Ve(r.values,s=>{s.done=!0}),r.toValues&&(r.onChange=r.onPause=r.onResume=void 0),$t(this,{type:"idle",parent:this});let o=n?esm_q(this.get()):dist_esm_E(this.get(),esm_Ce(this,e??r.to));yt(this._pendingCalls,o),r.changed&&(r.changed=!1,esm_Ie(this,"onRest",o,this))}}};function esm_Ce(t,e){let n=esm_me(e),r=esm_me(t.get());return bt(r,n)}function at(t,e=t.loop,n=t.to){let r=dist_esm_I(e);if(r){let o=r!==!0&&esm_de(r),s=(o||t).reverse,a=!o||o.reset;return esm_Pe({...t,loop:e,default:!1,pause:void 0,to:!s||esm_Ee(n)?n:void 0,from:a?t.from:void 0,reset:a,...o})}}function esm_Pe(t){let{to:e,from:n}=t=esm_de(t),r=new Set;return dist_esm_l.obj(e)&&Vt(e,r),dist_esm_l.obj(n)&&Vt(n,r),t.keys=r.size?Array.from(r):null,t}function Ot(t){let e=esm_Pe(t);return R.und(e.default)&&(e.default=dist_esm_ne(e)),e}function Vt(t,e){xt(t,(n,r)=>n!=null&&e.add(r))}var dist_esm_n=["onStart","onRest","onChange","onPause","onResume"];function _t(t,e,n){t.animation[n]=e[n]!==esm_ke(e,n)?et(e[n],t.key):void 0}function esm_Ie(t,e,...n){t.animation[e]?.(...n),t.defaultProps[e]?.(...n)}var Fn=["onStart","onChange","onRest"],kn=1,esm_le=class{id=kn++;springs={};queue=[];ref;_flush;_initialProps;_lastAsyncId=0;_active=new Set;_changed=new Set;_started=!1;_item;_state={paused:!1,pauseQueue:new Set,resumeQueue:new Set,timeouts:new Set};_events={onStart:new Map,onChange:new Map,onRest:new Map};constructor(e,n){this._onFrame=this._onFrame.bind(this),n&&(this._flush=n),e&&this.start({default:!0,...e})}get idle(){return!this._state.asyncTo&&Object.values(this.springs).every(e=>e.idle&&!e.isDelayed&&!e.isPaused)}get item(){return this._item}set item(e){this._item=e}get(){let e={};return this.each((n,r)=>e[r]=n.get()),e}set(e){for(let n in e){let r=e[n];dist_esm_l.und(r)||this.springs[n].set(r)}}update(e){return e&&this.queue.push(esm_Pe(e)),this}start(e){let{queue:n}=this;return e?n=ht(e).map(esm_Pe):this.queue=[],this._flush?this._flush(this,n):(jt(this,n),esm_ze(this,n))}stop(e,n){if(e!==!!e&&(n=e),n){let r=this.springs;esm_Ve(ht(n),o=>r[o].stop(!!e))}else esm_oe(this._state,this._lastAsyncId),this.each(r=>r.stop(!!e));return this}pause(e){if(dist_esm_l.und(e))this.start({pause:!0});else{let n=this.springs;esm_Ve(ht(e),r=>n[r].pause())}return this}resume(e){if(dist_esm_l.und(e))this.start({pause:!1});else{let n=this.springs;esm_Ve(ht(e),r=>n[r].resume())}return this}each(e){xt(this.springs,e)}_onFrame(){let{onStart:e,onChange:n,onRest:r}=this._events,o=this._active.size>0,s=this._changed.size>0;(o&&!this._started||s&&!this._started)&&(this._started=!0,Pe(e,([u,p])=>{p.value=this.get(),u(p,this,this._item)}));let a=!o&&this._started,i=s||a&&r.size?this.get():null;s&&n.size&&Pe(n,([u,p])=>{p.value=i,u(p,this,this._item)}),a&&(this._started=!1,Pe(r,([u,p])=>{p.value=i,u(p,this,this._item)}))}eventObserved(e){if(e.type=="change")this._changed.add(e.parent),e.idle||this._active.add(e.parent);else if(e.type=="idle")this._active.delete(e.parent);else return;esm_n.onFrame(this._onFrame)}};function esm_ze(t,e){return Promise.all(e.map(n=>wt(t,n))).then(n=>esm_be(t,n))}async function wt(t,e,n){let{keys:r,to:o,from:s,loop:a,onRest:i,onResolve:u}=e,p=dist_esm_l.obj(e.default)&&e.default;a&&(e.loop=!1),o===!1&&(e.to=null),s===!1&&(e.from=null);let f=dist_esm_l.arr(o)||dist_esm_l.fun(o)?o:void 0;f?(e.to=void 0,e.onRest=void 0,p&&(p.onRest=void 0)):esm_Ve(Fn,P=>{let l=e[P];if(dist_esm_l.fun(l)){let h=t._events[P];e[P]=({finished:g,cancelled:x})=>{let S=h.get(l);S?(g||(S.finished=!1),x&&(S.cancelled=!0)):h.set(l,{value:null,finished:g||!1,cancelled:x||!1})},p&&(p[P]=e[P])}});let d=t._state;e.pause===!d.paused?(d.paused=e.pause,yt(e.pause?d.pauseQueue:d.resumeQueue)):d.paused&&(e.pause=!0);let m=(r||Object.keys(t.springs)).map(P=>t.springs[P].start(e)),b=e.cancel===!0||esm_ke(e,"cancel")===!0;(f||b&&d.asyncId)&&m.push(esm_Me(++t._lastAsyncId,{props:e,state:d,actions:{pause:Y,resume:Y,start(P,l){b?(esm_oe(d,t._lastAsyncId),l(esm_q(t))):(P.onRest=i,l(esm_De(f,P,d,t)))}}})),d.paused&&await new Promise(P=>{d.resumeQueue.add(P)});let c=esm_be(t,await Promise.all(m));if(a&&c.finished&&!(n&&c.noop)){let P=at(e,a,o);if(P)return jt(t,[P]),wt(t,P,!0)}return u&&esm_n.batchedUpdates(()=>u(c,t,t.item)),c}function esm_e(t,e){let n={...t.springs};return e&&pe(Ve(e),r=>{z.und(r.keys)&&(r=esm_Pe(r)),z.obj(r.to)||(r={...r,to:void 0}),Mt(n,r,o=>esm_Lt(o))}),pt(t,n),n}function pt(t,e){Ut(e,(n,r)=>{t.springs[r]||(t.springs[r]=n,Et(n,t))})}function esm_Lt(t,e){let n=new esm_ue;return n.key=t,e&&Gt(n,e),n}function Mt(t,e,n){e.keys&&esm_Ve(e.keys,r=>{(t[r]||(t[r]=n(r)))._prepareNode(e)})}function jt(t,e){esm_Ve(e,n=>{Mt(t.springs,n,r=>esm_Lt(r,t))})}var dist_esm_H=({children:t,...e})=>{let n=(0,external_React_.useContext)(esm_Ge),r=e.pause||!!n.pause,o=e.immediate||!!n.immediate;e=Lr(()=>({pause:r,immediate:o}),[r,o]);let{Provider:s}=esm_Ge;return external_React_.createElement(s,{value:e},t)},esm_Ge=wn(dist_esm_H,{});dist_esm_H.Provider=esm_Ge.Provider;dist_esm_H.Consumer=esm_Ge.Consumer;function wn(t,e){return Object.assign(t,external_React_.createContext(e)),t.Provider._context=t,t.Consumer._context=t,t}var esm_fe=()=>{let t=[],e=function(r){Ln();let o=[];return ce(t,(s,a)=>{if(Ke.und(r))o.push(s.start());else{let i=n(r,s,a);i&&o.push(s.start(i))}}),o};e.current=t,e.add=function(r){t.includes(r)||t.push(r)},e.delete=function(r){let o=t.indexOf(r);~o&&t.splice(o,1)},e.pause=function(){return ce(t,r=>r.pause(...arguments)),this},e.resume=function(){return ce(t,r=>r.resume(...arguments)),this},e.set=function(r){ce(t,(o,s)=>{let a=Ke.fun(r)?r(s,o):r;a&&o.set(a)})},e.start=function(r){let o=[];return ce(t,(s,a)=>{if(Ke.und(r))o.push(s.start());else{let i=this._getProps(r,s,a);i&&o.push(s.start(i))}}),o},e.stop=function(){return ce(t,r=>r.stop(...arguments)),this},e.update=function(r){return ce(t,(o,s)=>o.update(this._getProps(r,o,s))),this};let n=function(r,o,s){return Ke.fun(r)?r(s,o):r};return e._getProps=n,e};function esm_He(t,e,n){let r=jn.fun(e)&&e;r&&!n&&(n=[]);let o=Xe(()=>r||arguments.length==3?esm_fe():void 0,[]),s=Nt(0),a=Dn(),i=Xe(()=>({ctrls:[],queue:[],flush(h,g){let x=esm_e(h,g);return s.current>0&&!i.queue.length&&!Object.keys(x).some(A=>!h.springs[A])?esm_ze(h,g):new Promise(A=>{pt(h,x),i.queue.push(()=>{A(esm_ze(h,g))}),a()})}}),[]),u=Nt([...i.ctrls]),p=[],f=Dt(t)||0;Xe(()=>{Ye(u.current.slice(t,f),h=>{esm_xe(h,o),h.stop(!0)}),u.current.length=t,d(f,t)},[t]),Xe(()=>{d(0,Math.min(f,t))},n);function d(h,g){for(let x=h;x<g;x++){let S=u.current[x]||(u.current[x]=new esm_le(null,i.flush)),A=r?r(x,S):e[x];A&&(p[x]=Ot(A))}}let m=u.current.map((h,g)=>esm_e(h,p[g])),b=Mn(dist_esm_H),c=Dt(b),P=b!==c&&esm_Ue(b);qn(()=>{s.current++,i.ctrls=u.current;let{queue:h}=i;h.length&&(i.queue=[],Ye(h,g=>g())),Ye(u.current,(g,x)=>{o?.add(g),P&&g.start({default:b});let S=p[x];S&&(esm_he(g,S.ref),g.ref?g.queue.push(S):g.start(S))})}),Nn(()=>()=>{Ye(i.ctrls,h=>h.stop(!0))});let l=m.map(h=>({...h}));return o?[l,o]:l}function esm_J(t,e){let n=Qn.fun(t),[[r],o]=esm_He(1,n?t:[t],n?e||[]:e);return n||arguments.length==2?[r,o]:r}var Gn=()=>esm_fe(),Xo=()=>zn(Gn)[0];var Wo=(t,e)=>{let n=Bn(()=>new esm_ue(t,e));return Kn(()=>()=>{n.stop()}),n};function esm_Qt(t,e,n){let r=qt.fun(e)&&e;r&&!n&&(n=[]);let o=!0,s,a=esm_He(t,(i,u)=>{let p=r?r(i,u):e;return s=p.ref,o=o&&p.reverse,p},n||[{}]);if(Yn(()=>{Xn(a[1].current,(i,u)=>{let p=a[1].current[u+(o?1:-1)];if(esm_he(i,s),i.ref){p&&i.update({to:p.springs});return}p?i.start({to:p.springs}):i.start()})},n),r||arguments.length==3){let i=s??a[1];return i._getProps=(u,p,f)=>{let d=qt.fun(u)?u(f,p):u;if(d){let m=i.current[f+(d.reverse?1:-1)];return m&&(d.to=m.springs),d}},a}return a[0]}function esm_Gt(t,e,n){let r=G.fun(e)&&e,{reset:o,sort:s,trail:a=0,expires:i=!0,exitBeforeEnter:u=!1,onDestroyed:p,ref:f,config:d}=r?r():e,m=Jn(()=>r||arguments.length==3?esm_fe():void 0,[]),b=zt(t),c=[],P=lt(null),l=o?null:P.current;Je(()=>{P.current=c}),$n(()=>(j(c,y=>{m?.add(y.ctrl),y.ctrl.ref=m}),()=>{j(P.current,y=>{y.expired&&clearTimeout(y.expirationId),esm_xe(y.ctrl,m),y.ctrl.stop(!0)})}));let h=tr(b,r?r():e,l),g=o&&P.current||[];Je(()=>j(g,({ctrl:y,item:T,key:F})=>{esm_xe(y,m),dist_esm_I(p,T,F)}));let x=[];if(l&&j(l,(y,T)=>{y.expired?(clearTimeout(y.expirationId),g.push(y)):(T=x[T]=h.indexOf(y.key),~T&&(c[T]=y))}),j(b,(y,T)=>{c[T]||(c[T]={key:h[T],item:y,phase:"mount",ctrl:new esm_le},c[T].ctrl.item=y)}),x.length){let y=-1,{leave:T}=r?r():e;j(x,(F,k)=>{let O=l[k];~F?(y=c.indexOf(O),c[y]={...O,item:b[F]}):T&&c.splice(++y,0,O)})}G.fun(s)&&c.sort((y,T)=>s(y.item,T.item));let S=-a,A=Wn(),V=dist_esm_ne(e),_=new Map,v=lt(new Map),w=lt(!1);j(c,(y,T)=>{let F=y.key,k=y.phase,O=r?r():e,U,D,Jt=dist_esm_I(O.delay||0,F);if(k=="mount")U=O.enter,D="enter";else{let M=h.indexOf(F)<0;if(k!="leave")if(M)U=O.leave,D="leave";else if(U=O.update)D="update";else return;else if(!M)U=O.enter,D="enter";else return}if(U=dist_esm_I(U,y.item,T),U=G.obj(U)?esm_de(U):{to:U},!U.config){let M=d||V.config;U.config=dist_esm_I(M,y.item,T,D)}S+=a;let Z={...V,delay:Jt+S,ref:f,immediate:O.immediate,reset:!1,...U};if(D=="enter"&&G.und(Z.from)){let M=r?r():e,Te=G.und(M.initial)||l?M.from:M.initial;Z.from=dist_esm_I(Te,y.item,T)}let{onResolve:Wt}=Z;Z.onResolve=M=>{dist_esm_I(Wt,M);let Te=P.current,B=Te.find(Fe=>Fe.key===F);if(!!B&&!(M.cancelled&&B.phase!="update")&&B.ctrl.idle){let Fe=Te.every(ee=>ee.ctrl.idle);if(B.phase=="leave"){let ee=dist_esm_I(i,B.item);if(ee!==!1){let Ze=ee===!0?0:ee;if(B.expired=!0,!Fe&&Ze>0){Ze<=2147483647&&(B.expirationId=setTimeout(A,Ze));return}}}Fe&&Te.some(ee=>ee.expired)&&(v.current.delete(B),u&&(w.current=!0),A())}};let ft=esm_e(y.ctrl,Z);D==="leave"&&u?v.current.set(y,{phase:D,springs:ft,payload:Z}):_.set(y,{phase:D,springs:ft,payload:Z})});let C=Hn(dist_esm_H),$=Zn(C),L=C!==$&&esm_Ue(C);Je(()=>{L&&j(c,y=>{y.ctrl.start({default:C})})},[C]),j(_,(y,T)=>{if(v.current.size){let F=c.findIndex(k=>k.key===T.key);c.splice(F,1)}}),Je(()=>{j(v.current.size?v.current:_,({phase:y,payload:T},F)=>{let{ctrl:k}=F;F.phase=y,m?.add(k),L&&y=="enter"&&k.start({default:C}),T&&(esm_he(k,T.ref),(k.ref||m)&&!w.current?k.update(T):(k.start(T),w.current&&(w.current=!1)))})},o?void 0:n);let N=y=>Oe.createElement(Oe.Fragment,null,c.map((T,F)=>{let{springs:k}=_.get(T)||T.ctrl,O=y({...k},T.item,T,F);return O&&O.type?Oe.createElement(O.type,{...O.props,key:G.str(T.key)||G.num(T.key)?T.key:T.ctrl.id,ref:O.ref}):O}));return m?[N,m]:N}var esm_er=1;function tr(t,{key:e,keys:n=e},r){if(n===null){let o=new Set;return t.map(s=>{let a=r&&r.find(i=>i.item===s&&i.phase!=="leave"&&!o.has(i));return a?(o.add(a),a.key):esm_er++})}return G.und(n)?t:G.fun(n)?t.map(n):zt(n)}var hs=({container:t,...e}={})=>{let[n,r]=esm_J(()=>({scrollX:0,scrollY:0,scrollXProgress:0,scrollYProgress:0,...e}),[]);return or(()=>{let o=rr(({x:s,y:a})=>{r.start({scrollX:s.current,scrollXProgress:s.progress,scrollY:a.current,scrollYProgress:a.progress})},{container:t?.current||void 0});return()=>{nr(Object.values(n),s=>s.stop()),o()}},[]),n};var Ps=({container:t,...e})=>{let[n,r]=esm_J(()=>({width:0,height:0,...e}),[]);return ar(()=>{let o=sr(({width:s,height:a})=>{r.start({width:s,height:a,immediate:n.width.get()===0||n.height.get()===0})},{container:t?.current||void 0});return()=>{ir(Object.values(n),s=>s.stop()),o()}},[]),n};var cr={any:0,all:1};function Cs(t,e){let[n,r]=pr(!1),o=ur(),s=Bt.fun(t)&&t,a=s?s():{},{to:i={},from:u={},...p}=a,f=s?e:t,[d,m]=esm_J(()=>({from:u,...p}),[]);return lr(()=>{let b=o.current,{root:c,once:P,amount:l="any",...h}=f??{};if(!b||P&&n||typeof IntersectionObserver>"u")return;let g=new WeakMap,x=()=>(i&&m.start(i),r(!0),P?void 0:()=>{u&&m.start(u),r(!1)}),S=V=>{V.forEach(_=>{let v=g.get(_.target);if(_.isIntersecting!==Boolean(v))if(_.isIntersecting){let w=x();Bt.fun(w)?g.set(_.target,w):A.unobserve(_.target)}else v&&(v(),g.delete(_.target))})},A=new IntersectionObserver(S,{root:c&&c.current||void 0,threshold:typeof l=="number"||Array.isArray(l)?l:cr[l],...h});return A.observe(b),()=>A.unobserve(b)},[f]),s?[o,d]:[o,n]}function qs({children:t,...e}){return t(esm_J(e))}function Bs({items:t,children:e,...n}){let r=esm_Qt(t.length,n);return t.map((o,s)=>{let a=e(o,s);return fr.fun(a)?a(r[s]):a})}function Ys({items:t,children:e,...n}){return esm_Gt(t,n)(e)}var esm_W=class extends esm_X{constructor(n,r){super();this.source=n;this.calc=W(...r);let o=this._get(),s=esm_Le(o);esm_D(this,s.create(o))}key;idle=!0;calc;_active=new Set;advance(n){let r=this._get(),o=this.get();bt(r,o)||(dist_esm_k(this).setValue(r),this._onChange(r,this.idle)),!this.idle&&Yt(this._active)&&esm_ct(this)}_get(){let n=dist_esm_l.arr(this.source)?this.source.map(ve):ht(ve(this.source));return this.calc(...n)}_start(){this.idle&&!Yt(this._active)&&(this.idle=!1,esm_Ve(F(this),n=>{n.done=!1}),dist_esm_p.skipAnimation?(esm_n.batchedUpdates(()=>this.advance()),esm_ct(this)):qe.start(this))}_attach(){let n=1;esm_Ve(ht(this.source),r=>{Pt(r)&&Gt(r,this),esm_Re(r)&&(r.idle||this._active.add(r),n=Math.max(n,r.priority+1))}),this.priority=n,this._start()}_detach(){esm_Ve(ht(this.source),n=>{Pt(n)&&Qt(n,this)}),this._active.clear(),esm_ct(this)}eventObserved(n){n.type=="change"?n.idle?this.advance():(this._active.add(n.parent),this._start()):n.type=="idle"?this._active.delete(n.parent):n.type=="priority"&&(this.priority=ht(this.source).reduce((r,o)=>Math.max(r,(esm_Re(o)?o.priority:0)+1),0))}};function vr(t){return t.idle!==!1}function Yt(t){return!t.size||Array.from(t).every(vr)}function esm_ct(t){t.idle||(t.idle=!0,esm_Ve(F(t),e=>{e.done=!0}),$t(t,{type:"idle",parent:t}))}var ui=(t,...e)=>new esm_W(t,e),pi=(t,...e)=>(Cr(),new esm_W(t,e));dist_esm_p.assign({createStringInterpolator:Xt,to:(t,e)=>new esm_W(t,e)});var di=qe.advance;

;// external "ReactDOM"
const external_ReactDOM_namespaceObject = window["ReactDOM"];
;// ./node_modules/@react-spring/web/dist/esm/index.js
var web_dist_esm_k=/^--/;function web_dist_esm_I(t,e){return e==null||typeof e=="boolean"||e===""?"":typeof e=="number"&&e!==0&&!web_dist_esm_k.test(t)&&!(web_dist_esm_c.hasOwnProperty(t)&&web_dist_esm_c[t])?e+"px":(""+e).trim()}var web_dist_esm_v={};function esm_V(t,e){if(!t.nodeType||!t.setAttribute)return!1;let r=t.nodeName==="filter"||t.parentNode&&t.parentNode.nodeName==="filter",{style:i,children:s,scrollTop:u,scrollLeft:l,viewBox:a,...n}=e,d=Object.values(n),m=Object.keys(n).map(o=>r||t.hasAttribute(o)?o:web_dist_esm_v[o]||(web_dist_esm_v[o]=o.replace(/([A-Z])/g,p=>"-"+p.toLowerCase())));s!==void 0&&(t.textContent=s);for(let o in i)if(i.hasOwnProperty(o)){let p=web_dist_esm_I(o,i[o]);web_dist_esm_k.test(o)?t.style.setProperty(o,p):t.style[o]=p}m.forEach((o,p)=>{t.setAttribute(o,d[p])}),u!==void 0&&(t.scrollTop=u),l!==void 0&&(t.scrollLeft=l),a!==void 0&&t.setAttribute("viewBox",a)}var web_dist_esm_c={animationIterationCount:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},esm_F=(t,e)=>t+e.charAt(0).toUpperCase()+e.substring(1),esm_L=["Webkit","Ms","Moz","O"];web_dist_esm_c=Object.keys(web_dist_esm_c).reduce((t,e)=>(esm_L.forEach(r=>t[esm_F(r,e)]=t[e]),t),web_dist_esm_c);var esm_=/^(matrix|translate|scale|rotate|skew)/,dist_esm_$=/^(translate)/,dist_esm_G=/^(rotate|skew)/,web_dist_esm_y=(t,e)=>dist_esm_l.num(t)&&t!==0?t+e:t,web_dist_esm_h=(t,e)=>dist_esm_l.arr(t)?t.every(r=>web_dist_esm_h(r,e)):dist_esm_l.num(t)?t===e:parseFloat(t)===e,dist_esm_g=class extends animated_dist_esm_u{constructor({x:e,y:r,z:i,...s}){let u=[],l=[];(e||r||i)&&(u.push([e||0,r||0,i||0]),l.push(a=>[`translate3d(${a.map(n=>web_dist_esm_y(n,"px")).join(",")})`,web_dist_esm_h(a,0)])),xt(s,(a,n)=>{if(n==="transform")u.push([a||""]),l.push(d=>[d,d===""]);else if(esm_.test(n)){if(delete s[n],dist_esm_l.und(a))return;let d=dist_esm_$.test(n)?"px":dist_esm_G.test(n)?"deg":"";u.push(ht(a)),l.push(n==="rotate3d"?([m,o,p,O])=>[`rotate3d(${m},${o},${p},${web_dist_esm_y(O,d)})`,web_dist_esm_h(O,0)]:m=>[`${n}(${m.map(o=>web_dist_esm_y(o,d)).join(",")})`,web_dist_esm_h(m,n.startsWith("scale")?1:0)])}}),u.length&&(s.transform=new web_dist_esm_x(u,l)),super(s)}},web_dist_esm_x=class extends esm_ge{constructor(r,i){super();this.inputs=r;this.transforms=i}_value=null;get(){return this._value||(this._value=this._get())}_get(){let r="",i=!0;return esm_Ve(this.inputs,(s,u)=>{let l=ve(s[0]),[a,n]=this.transforms[u](dist_esm_l.arr(l)?l:s.map(ve));r+=" "+a,i=i&&n}),i?"none":r}observerAdded(r){r==1&&esm_Ve(this.inputs,i=>esm_Ve(i,s=>Pt(s)&&Gt(s,this)))}observerRemoved(r){r==0&&esm_Ve(this.inputs,i=>esm_Ve(i,s=>Pt(s)&&Qt(s,this)))}eventObserved(r){r.type=="change"&&(this._value=null),$t(this,r)}};var esm_C=["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","circle","clipPath","defs","ellipse","foreignObject","g","image","line","linearGradient","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","text","tspan"];dist_esm_p.assign({batchedUpdates:external_ReactDOM_namespaceObject.unstable_batchedUpdates,createStringInterpolator:Xt,colors:It});var dist_esm_q=dist_esm_Ke(esm_C,{applyAnimatedValues:esm_V,createAnimatedStyle:t=>new dist_esm_g(t),getComponentProps:({scrollTop:t,scrollLeft:e,...r})=>r}),dist_esm_it=dist_esm_q.animated;

;// ./node_modules/@wordpress/edit-site/build-module/components/layout/animation.js


function getAbsolutePosition(element) {
  return {
    top: element.offsetTop,
    left: element.offsetLeft
  };
}
const ANIMATION_DURATION = 400;
function useMovingAnimation({ triggerAnimationOnChange }) {
  const ref = (0,external_wp_element_.useRef)();
  const { previous, prevRect } = (0,external_wp_element_.useMemo)(
    () => ({
      previous: ref.current && getAbsolutePosition(ref.current),
      prevRect: ref.current && ref.current.getBoundingClientRect()
    }),
    [triggerAnimationOnChange]
  );
  (0,external_wp_element_.useLayoutEffect)(() => {
    if (!previous || !ref.current) {
      return;
    }
    const disableAnimation = window.matchMedia(
      "(prefers-reduced-motion: reduce)"
    ).matches;
    if (disableAnimation) {
      return;
    }
    const controller = new esm_le({
      x: 0,
      y: 0,
      width: prevRect.width,
      height: prevRect.height,
      config: {
        duration: ANIMATION_DURATION,
        easing: Lt.easeInOutQuint
      },
      onChange({ value }) {
        if (!ref.current) {
          return;
        }
        let { x: x2, y: y2, width: width2, height: height2 } = value;
        x2 = Math.round(x2);
        y2 = Math.round(y2);
        width2 = Math.round(width2);
        height2 = Math.round(height2);
        const finishedMoving = x2 === 0 && y2 === 0;
        ref.current.style.transformOrigin = "center center";
        ref.current.style.transform = finishedMoving ? null : `translate3d(${x2}px,${y2}px,0)`;
        ref.current.style.width = finishedMoving ? null : `${width2}px`;
        ref.current.style.height = finishedMoving ? null : `${height2}px`;
      }
    });
    ref.current.style.transform = void 0;
    const destination = ref.current.getBoundingClientRect();
    const x = Math.round(prevRect.left - destination.left);
    const y = Math.round(prevRect.top - destination.top);
    const width = destination.width;
    const height = destination.height;
    controller.start({
      x: 0,
      y: 0,
      width,
      height,
      from: { x, y, width: prevRect.width, height: prevRect.height }
    });
    return () => {
      controller.stop();
      controller.set({
        x: 0,
        y: 0,
        width: prevRect.width,
        height: prevRect.height
      });
    };
  }, [previous, prevRect]);
  return ref;
}
var animation_default = useMovingAnimation;


;// ./node_modules/@wordpress/icons/build-module/library/check.js


var check_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M16.5 7.5 10 13.9l-2.5-2.4-1 1 3.5 3.6 7.5-7.6z" }) });


;// ./node_modules/@wordpress/edit-site/build-module/utils/is-previewing-theme.js

function isPreviewingTheme() {
  return !!(0,external_wp_url_namespaceObject.getQueryArg)(window.location.href, "wp_theme_preview");
}
function currentlyPreviewingTheme() {
  if (isPreviewingTheme()) {
    return (0,external_wp_url_namespaceObject.getQueryArg)(window.location.href, "wp_theme_preview");
  }
  return null;
}


;// ./node_modules/@wordpress/edit-site/build-module/components/save-button/index.js











const { useLocation: save_button_useLocation } = unlock(external_wp_router_namespaceObject.privateApis);
function SaveButton({
  className = "edit-site-save-button__button",
  variant = "primary",
  showTooltip = true,
  showReviewMessage,
  icon,
  size,
  __next40pxDefaultSize = false
}) {
  const { params } = save_button_useLocation();
  const { setIsSaveViewOpened } = (0,external_wp_data_.useDispatch)(store);
  const { saveDirtyEntities } = unlock((0,external_wp_data_.useDispatch)(external_wp_editor_namespaceObject.store));
  const { dirtyEntityRecords } = (0,external_wp_editor_namespaceObject.useEntitiesSavedStatesIsDirty)();
  const { isSaving, isSaveViewOpen, previewingThemeName } = (0,external_wp_data_.useSelect)(
    (select) => {
      const { isSavingEntityRecord, isResolving } = select(external_wp_coreData_namespaceObject.store);
      const { isSaveViewOpened } = select(store);
      const isActivatingTheme = isResolving("activateTheme");
      const currentlyPreviewingThemeId = currentlyPreviewingTheme();
      return {
        isSaving: dirtyEntityRecords.some(
          (record) => isSavingEntityRecord(
            record.kind,
            record.name,
            record.key
          )
        ) || isActivatingTheme,
        isSaveViewOpen: isSaveViewOpened(),
        // Do not call `getTheme` with null, it will cause a request to
        // the server.
        previewingThemeName: currentlyPreviewingThemeId ? select(external_wp_coreData_namespaceObject.store).getTheme(currentlyPreviewingThemeId)?.name?.rendered : void 0
      };
    },
    [dirtyEntityRecords]
  );
  const hasDirtyEntities = !!dirtyEntityRecords.length;
  let isOnlyCurrentEntityDirty;
  if (dirtyEntityRecords.length === 1) {
    if (params.postId) {
      isOnlyCurrentEntityDirty = `${dirtyEntityRecords[0].key}` === params.postId && dirtyEntityRecords[0].name === params.postType;
    } else if (params.path?.includes("wp_global_styles")) {
      isOnlyCurrentEntityDirty = dirtyEntityRecords[0].name === "globalStyles";
    }
  }
  const disabled = isSaving || !hasDirtyEntities && !isPreviewingTheme();
  const getLabel = () => {
    if (isPreviewingTheme()) {
      if (isSaving) {
        return (0,external_wp_i18n_namespaceObject.sprintf)(
          /* translators: %s: The name of theme to be activated. */
          (0,external_wp_i18n_namespaceObject.__)("Activating %s"),
          previewingThemeName
        );
      } else if (disabled) {
        return (0,external_wp_i18n_namespaceObject.__)("Saved");
      } else if (hasDirtyEntities) {
        return (0,external_wp_i18n_namespaceObject.sprintf)(
          /* translators: %s: The name of theme to be activated. */
          (0,external_wp_i18n_namespaceObject.__)("Activate %s & Save"),
          previewingThemeName
        );
      }
      return (0,external_wp_i18n_namespaceObject.sprintf)(
        /* translators: %s: The name of theme to be activated. */
        (0,external_wp_i18n_namespaceObject.__)("Activate %s"),
        previewingThemeName
      );
    }
    if (isSaving) {
      return (0,external_wp_i18n_namespaceObject.__)("Saving");
    }
    if (disabled) {
      return (0,external_wp_i18n_namespaceObject.__)("Saved");
    }
    if (!isOnlyCurrentEntityDirty && showReviewMessage) {
      return (0,external_wp_i18n_namespaceObject.sprintf)(
        // translators: %d: number of unsaved changes (number).
        (0,external_wp_i18n_namespaceObject._n)(
          "Review %d change\u2026",
          "Review %d changes\u2026",
          dirtyEntityRecords.length
        ),
        dirtyEntityRecords.length
      );
    }
    return (0,external_wp_i18n_namespaceObject.__)("Save");
  };
  const label = getLabel();
  const onClick = isOnlyCurrentEntityDirty ? () => saveDirtyEntities({ dirtyEntityRecords }) : () => setIsSaveViewOpened(true);
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    external_wp_components_namespaceObject.Button,
    {
      variant,
      className,
      "aria-disabled": disabled,
      "aria-expanded": isSaveViewOpen,
      isBusy: isSaving,
      onClick: disabled ? void 0 : onClick,
      label,
      shortcut: disabled ? void 0 : external_wp_keycodes_namespaceObject.displayShortcut.primary("s"),
      showTooltip,
      icon,
      __next40pxDefaultSize,
      size,
      children: label
    }
  );
}


;// ./node_modules/@wordpress/edit-site/build-module/components/save-hub/index.js







function SaveHub() {
  const { isDisabled, isSaving } = (0,external_wp_data_.useSelect)((select) => {
    const { __experimentalGetDirtyEntityRecords, isSavingEntityRecord } = select(external_wp_coreData_namespaceObject.store);
    const dirtyEntityRecords = __experimentalGetDirtyEntityRecords();
    const _isSaving = dirtyEntityRecords.some(
      (record) => isSavingEntityRecord(record.kind, record.name, record.key)
    );
    return {
      isSaving: _isSaving,
      isDisabled: _isSaving || !dirtyEntityRecords.length && !isPreviewingTheme()
    };
  }, []);
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHStack, { className: "edit-site-save-hub", alignment: "right", spacing: 4, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    SaveButton,
    {
      className: "edit-site-save-hub__button",
      variant: isDisabled ? null : "primary",
      showTooltip: false,
      icon: isDisabled && !isSaving ? check_default : null,
      showReviewMessage: true,
      __next40pxDefaultSize: true
    }
  ) });
}


;// ./node_modules/@wordpress/edit-site/build-module/utils/use-activate-theme.js






const { useHistory: use_activate_theme_useHistory, useLocation: use_activate_theme_useLocation } = unlock(external_wp_router_namespaceObject.privateApis);
function useActivateTheme() {
  const history = use_activate_theme_useHistory();
  const { path } = use_activate_theme_useLocation();
  const { startResolution, finishResolution } = (0,external_wp_data_.useDispatch)(external_wp_coreData_namespaceObject.store);
  return async () => {
    if (isPreviewingTheme()) {
      const activationURL = "themes.php?action=activate&stylesheet=" + currentlyPreviewingTheme() + "&_wpnonce=" + window.WP_BLOCK_THEME_ACTIVATE_NONCE;
      startResolution("activateTheme");
      await window.fetch(activationURL);
      finishResolution("activateTheme");
      history.navigate((0,external_wp_url_namespaceObject.addQueryArgs)(path, { wp_theme_preview: "" }));
    }
  };
}


;// external ["wp","apiFetch"]
const external_wp_apiFetch_namespaceObject = window["wp"]["apiFetch"];
var external_wp_apiFetch_default = /*#__PURE__*/__webpack_require__.n(external_wp_apiFetch_namespaceObject);
;// ./node_modules/@wordpress/edit-site/build-module/utils/use-actual-current-theme.js



const ACTIVE_THEMES_URL = "/wp/v2/themes?status=active";
function useActualCurrentTheme() {
  const [currentTheme, setCurrentTheme] = (0,external_wp_element_.useState)();
  (0,external_wp_element_.useEffect)(() => {
    const path = (0,external_wp_url_namespaceObject.addQueryArgs)(ACTIVE_THEMES_URL, {
      context: "edit",
      wp_theme_preview: ""
    });
    external_wp_apiFetch_default()({ path }).then((activeThemes) => setCurrentTheme(activeThemes[0])).catch(() => {
    });
  }, []);
  return currentTheme;
}


;// ./node_modules/@wordpress/edit-site/build-module/components/save-panel/index.js















const { EntitiesSavedStatesExtensible } = unlock(external_wp_editor_namespaceObject.privateApis);
const { useLocation: save_panel_useLocation } = unlock(external_wp_router_namespaceObject.privateApis);
const EntitiesSavedStatesForPreview = ({
  onClose,
  renderDialog,
  variant
}) => {
  const isDirtyProps = (0,external_wp_editor_namespaceObject.useEntitiesSavedStatesIsDirty)();
  let activateSaveLabel;
  if (isDirtyProps.isDirty) {
    activateSaveLabel = (0,external_wp_i18n_namespaceObject.__)("Activate & Save");
  } else {
    activateSaveLabel = (0,external_wp_i18n_namespaceObject.__)("Activate");
  }
  const currentTheme = useActualCurrentTheme();
  const previewingTheme = (0,external_wp_data_.useSelect)(
    (select) => select(external_wp_coreData_namespaceObject.store).getCurrentTheme(),
    []
  );
  const additionalPrompt = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { children: (0,external_wp_i18n_namespaceObject.sprintf)(
    /* translators: 1: The name of active theme, 2: The name of theme to be activated. */
    (0,external_wp_i18n_namespaceObject.__)(
      "Saving your changes will change your active theme from %1$s to %2$s."
    ),
    currentTheme?.name?.rendered ?? "...",
    previewingTheme?.name?.rendered ?? "..."
  ) });
  const activateTheme = useActivateTheme();
  const onSave = async (values) => {
    await activateTheme();
    return values;
  };
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    EntitiesSavedStatesExtensible,
    {
      ...{
        ...isDirtyProps,
        additionalPrompt,
        close: onClose,
        onSave,
        saveEnabled: true,
        saveLabel: activateSaveLabel,
        renderDialog,
        variant
      }
    }
  );
};
const _EntitiesSavedStates = ({ onClose, renderDialog, variant }) => {
  if (isPreviewingTheme()) {
    return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
      EntitiesSavedStatesForPreview,
      {
        onClose,
        renderDialog,
        variant
      }
    );
  }
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    external_wp_editor_namespaceObject.EntitiesSavedStates,
    {
      close: onClose,
      renderDialog,
      variant
    }
  );
};
function SavePanel() {
  const { query } = save_panel_useLocation();
  const { canvas = "view" } = query;
  const { isSaveViewOpen, isDirty, isSaving } = (0,external_wp_data_.useSelect)((select) => {
    const {
      __experimentalGetDirtyEntityRecords,
      isSavingEntityRecord,
      isResolving
    } = select(external_wp_coreData_namespaceObject.store);
    const dirtyEntityRecords = __experimentalGetDirtyEntityRecords();
    const isActivatingTheme = isResolving("activateTheme");
    const { isSaveViewOpened } = unlock(select(store));
    return {
      isSaveViewOpen: isSaveViewOpened(),
      isDirty: dirtyEntityRecords.length > 0,
      isSaving: dirtyEntityRecords.some(
        (record) => isSavingEntityRecord(record.kind, record.name, record.key)
      ) || isActivatingTheme
    };
  }, []);
  const { setIsSaveViewOpened } = (0,external_wp_data_.useDispatch)(store);
  const onClose = () => setIsSaveViewOpened(false);
  (0,external_wp_element_.useEffect)(() => {
    setIsSaveViewOpened(false);
  }, [canvas, setIsSaveViewOpened]);
  if (canvas === "view") {
    return isSaveViewOpen ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
      external_wp_components_namespaceObject.Modal,
      {
        className: "edit-site-save-panel__modal",
        onRequestClose: onClose,
        title: (0,external_wp_i18n_namespaceObject.__)("Review changes"),
        size: "small",
        children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(_EntitiesSavedStates, { onClose, variant: "inline" })
      }
    ) : null;
  }
  const activateSaveEnabled = isPreviewingTheme() || isDirty;
  const disabled = isSaving || !activateSaveEnabled;
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
    navigable_region_default,
    {
      className: dist_clsx("edit-site-layout__actions", {
        "is-entity-save-view-open": isSaveViewOpen
      }),
      ariaLabel: (0,external_wp_i18n_namespaceObject.__)("Save panel"),
      children: [
        /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
          "div",
          {
            className: dist_clsx("edit-site-editor__toggle-save-panel", {
              "screen-reader-text": isSaveViewOpen
            }),
            children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
              external_wp_components_namespaceObject.Button,
              {
                __next40pxDefaultSize: true,
                variant: "secondary",
                className: "edit-site-editor__toggle-save-panel-button",
                onClick: () => setIsSaveViewOpened(true),
                "aria-haspopup": "dialog",
                disabled,
                accessibleWhenDisabled: true,
                children: (0,external_wp_i18n_namespaceObject.__)("Open save panel")
              }
            )
          }
        ),
        isSaveViewOpen && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(_EntitiesSavedStates, { onClose, renderDialog: true })
      ]
    }
  );
}


;// ./node_modules/@wordpress/edit-site/build-module/components/layout/index.js























const { useGlobalStyle: layout_useGlobalStyle } = unlock(external_wp_blockEditor_namespaceObject.privateApis);
const { GlobalStylesProvider } = unlock(external_wp_editor_namespaceObject.privateApis);
const { useLocation: layout_useLocation } = unlock(external_wp_router_namespaceObject.privateApis);
const layout_ANIMATION_DURATION = 0.3;
function Layout() {
  const { query, name: routeKey, areas, widths } = layout_useLocation();
  const { canvas = "view" } = query;
  const isMobileViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)("medium", "<");
  const toggleRef = (0,external_wp_element_.useRef)();
  const navigateRegionsProps = (0,external_wp_components_namespaceObject.__unstableUseNavigateRegions)();
  const disableMotion = (0,external_wp_compose_namespaceObject.useReducedMotion)();
  const [canvasResizer, canvasSize] = (0,external_wp_compose_namespaceObject.useResizeObserver)();
  const isEditorLoading = useIsSiteEditorLoading();
  const [isResizableFrameOversized, setIsResizableFrameOversized] = (0,external_wp_element_.useState)(false);
  const animationRef = animation_default({
    triggerAnimationOnChange: routeKey + "-" + canvas
  });
  const { showIconLabels } = (0,external_wp_data_.useSelect)((select) => {
    return {
      showIconLabels: select(external_wp_preferences_.store).get(
        "core",
        "showIconLabels"
      )
    };
  });
  const [backgroundColor] = layout_useGlobalStyle("color.background");
  const [gradientValue] = layout_useGlobalStyle("color.gradient");
  const previousCanvaMode = (0,external_wp_compose_namespaceObject.usePrevious)(canvas);
  (0,external_wp_element_.useEffect)(() => {
    if (previousCanvaMode === "edit") {
      toggleRef.current?.focus();
    }
  }, [canvas]);
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
    /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_editor_namespaceObject.UnsavedChangesWarning, {}),
    canvas === "view" && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SaveKeyboardShortcut, {}),
    /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
      "div",
      {
        ...navigateRegionsProps,
        ref: navigateRegionsProps.ref,
        className: dist_clsx(
          "edit-site-layout",
          navigateRegionsProps.className,
          {
            "is-full-canvas": canvas === "edit",
            "show-icon-labels": showIconLabels
          }
        ),
        children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "edit-site-layout__content", children: [
          (!isMobileViewport || !areas.mobile) && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
            navigable_region_default,
            {
              ariaLabel: (0,external_wp_i18n_namespaceObject.__)("Navigation"),
              className: "edit-site-layout__sidebar-region",
              children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__unstableAnimatePresence, { children: canvas === "view" && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
                external_wp_components_namespaceObject.__unstableMotion.div,
                {
                  initial: { opacity: 0 },
                  animate: { opacity: 1 },
                  exit: { opacity: 0 },
                  transition: {
                    type: "tween",
                    duration: (
                      // Disable transition in mobile to emulate a full page transition.
                      disableMotion || isMobileViewport ? 0 : layout_ANIMATION_DURATION
                    ),
                    ease: "easeOut"
                  },
                  className: "edit-site-layout__sidebar",
                  children: [
                    /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
                      site_hub_default,
                      {
                        ref: toggleRef,
                        isTransparent: isResizableFrameOversized
                      }
                    ),
                    /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationProvider, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
                      SidebarContent,
                      {
                        shouldAnimate: routeKey !== "styles",
                        routeKey,
                        children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_editor_namespaceObject.ErrorBoundary, { children: areas.sidebar })
                      }
                    ) }),
                    /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SaveHub, {}),
                    /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SavePanel, {})
                  ]
                }
              ) })
            }
          ),
          /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_editor_namespaceObject.EditorSnackbars, {}),
          isMobileViewport && areas.mobile && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "edit-site-layout__mobile", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationProvider, { children: canvas !== "edit" ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
            /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
              SiteHubMobile,
              {
                ref: toggleRef,
                isTransparent: isResizableFrameOversized
              }
            ),
            /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarContent, { routeKey, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_editor_namespaceObject.ErrorBoundary, { children: areas.mobile }) }),
            /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SaveHub, {}),
            /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SavePanel, {})
          ] }) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_editor_namespaceObject.ErrorBoundary, { children: areas.mobile }) }) }),
          !isMobileViewport && areas.content && canvas !== "edit" && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
            "div",
            {
              className: "edit-site-layout__area",
              style: {
                maxWidth: widths?.content
              },
              children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_editor_namespaceObject.ErrorBoundary, { children: areas.content })
            }
          ),
          !isMobileViewport && areas.edit && canvas !== "edit" && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
            "div",
            {
              className: "edit-site-layout__area",
              style: {
                maxWidth: widths?.edit
              },
              children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_editor_namespaceObject.ErrorBoundary, { children: areas.edit })
            }
          ),
          !isMobileViewport && areas.preview && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "edit-site-layout__canvas-container", children: [
            canvasResizer,
            !!canvasSize.width && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
              "div",
              {
                className: dist_clsx(
                  "edit-site-layout__canvas",
                  {
                    "is-right-aligned": isResizableFrameOversized
                  }
                ),
                ref: animationRef,
                children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_editor_namespaceObject.ErrorBoundary, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
                  resizable_frame_default,
                  {
                    isReady: !isEditorLoading,
                    isFullWidth: canvas === "edit",
                    defaultSize: {
                      width: canvasSize.width - 24,
                      height: canvasSize.height
                    },
                    isOversized: isResizableFrameOversized,
                    setIsOversized: setIsResizableFrameOversized,
                    innerContentStyle: {
                      background: gradientValue ?? backgroundColor
                    },
                    children: areas.preview
                  }
                ) })
              }
            )
          ] })
        ] })
      }
    )
  ] });
}
function LayoutWithGlobalStylesProvider(props) {
  const { createErrorNotice } = (0,external_wp_data_.useDispatch)(external_wp_notices_namespaceObject.store);
  function onPluginAreaError(name) {
    createErrorNotice(
      (0,external_wp_i18n_namespaceObject.sprintf)(
        /* translators: %s: plugin name */
        (0,external_wp_i18n_namespaceObject.__)(
          'The "%s" plugin has encountered an error and cannot be rendered.'
        ),
        name
      )
    );
  }
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SlotFillProvider, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(GlobalStylesProvider, { children: [
    /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_plugins_namespaceObject.PluginArea, { onError: onPluginAreaError }),
    /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Layout, { ...props })
  ] }) });
}


;// ./node_modules/@wordpress/icons/build-module/library/help.js


var help_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M12 4a8 8 0 1 1 .001 16.001A8 8 0 0 1 12 4Zm0 1.5a6.5 6.5 0 1 0-.001 13.001A6.5 6.5 0 0 0 12 5.5Zm.75 11h-1.5V15h1.5v1.5Zm-.445-9.234a3 3 0 0 1 .445 5.89V14h-1.5v-1.25c0-.57.452-.958.917-1.01A1.5 1.5 0 0 0 12 8.75a1.5 1.5 0 0 0-1.5 1.5H9a3 3 0 0 1 3.305-2.984Z" }) });


;// ./node_modules/@wordpress/icons/build-module/library/rotate-right.js


var rotate_right_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M15.1 4.8l-3-2.5V4c-4.4 0-8 3.6-8 8 0 3.7 2.5 6.9 6 7.7.3.1.6.1 1 .2l.2-1.5c-.4 0-.7-.1-1.1-.2l-.1.2v-.2c-2.6-.8-4.5-3.3-4.5-6.2 0-3.6 2.9-6.5 6.5-6.5v1.8l3-2.5zM20 11c-.2-1.4-.7-2.7-1.6-3.8l-1.2.8c.7.9 1.1 2 1.3 3.1L20 11zm-1.5 1.8c-.1.5-.2 1.1-.4 1.6s-.5 1-.8 1.5l1.2.9c.4-.5.8-1.1 1-1.8s.5-1.3.5-2l-1.5-.2zm-5.6 5.6l.2 1.5c1.4-.2 2.7-.7 3.8-1.6l-.9-1.1c-.9.7-2 1.1-3.1 1.2z" }) });


;// ./node_modules/@wordpress/icons/build-module/library/rotate-left.js


var rotate_left_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M12 4V2.2L9 4.8l3 2.5V5.5c3.6 0 6.5 2.9 6.5 6.5 0 2.9-1.9 5.3-4.5 6.2v.2l-.1-.2c-.4.1-.7.2-1.1.2l.2 1.5c.3 0 .6-.1 1-.2 3.5-.9 6-4 6-7.7 0-4.4-3.6-8-8-8zm-7.9 7l1.5.2c.1-1.2.5-2.3 1.2-3.2l-1.1-.9C4.8 8.2 4.3 9.6 4.1 11zm1.5 1.8l-1.5.2c.1.7.3 1.4.5 2 .3.7.6 1.3 1 1.8l1.2-.8c-.3-.5-.6-1-.8-1.5s-.4-1.1-.4-1.7zm1.5 5.5c1.1.9 2.4 1.4 3.8 1.6l.2-1.5c-1.1-.1-2.2-.5-3.1-1.2l-.9 1.1z" }) });


;// ./node_modules/@wordpress/icons/build-module/library/backup.js


var backup_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M5.5 12h1.75l-2.5 3-2.5-3H4a8 8 0 113.134 6.35l.907-1.194A6.5 6.5 0 105.5 12zm9.53 1.97l-2.28-2.28V8.5a.75.75 0 00-1.5 0V12a.747.747 0 00.218.529l1.282-.84-1.28.842 2.5 2.5a.75.75 0 101.06-1.061z" }) });


;// ./node_modules/@wordpress/edit-site/build-module/hooks/commands/use-common-commands.js











const { useGlobalStylesReset } = unlock(external_wp_blockEditor_namespaceObject.privateApis);
const { useHistory: use_common_commands_useHistory, useLocation: use_common_commands_useLocation } = unlock(external_wp_router_namespaceObject.privateApis);
const getGlobalStylesToggleWelcomeGuideCommands = () => function useGlobalStylesToggleWelcomeGuideCommands() {
  const { openGeneralSidebar } = unlock((0,external_wp_data_.useDispatch)(store));
  const { params } = use_common_commands_useLocation();
  const { canvas = "view" } = params;
  const { set } = (0,external_wp_data_.useDispatch)(external_wp_preferences_.store);
  const history = use_common_commands_useHistory();
  const isBlockBasedTheme = (0,external_wp_data_.useSelect)((select) => {
    return select(external_wp_coreData_namespaceObject.store).getCurrentTheme().is_block_theme;
  }, []);
  const commands = (0,external_wp_element_.useMemo)(() => {
    if (!isBlockBasedTheme) {
      return [];
    }
    return [
      {
        name: "core/edit-site/toggle-styles-welcome-guide",
        label: (0,external_wp_i18n_namespaceObject.__)("Learn about styles"),
        callback: ({ close }) => {
          close();
          if (canvas !== "edit") {
            history.navigate("/styles?canvas=edit", {
              transition: "canvas-mode-edit-transition"
            });
          }
          openGeneralSidebar("edit-site/global-styles");
          set("core/edit-site", "welcomeGuideStyles", true);
          setTimeout(() => {
            set("core/edit-site", "welcomeGuideStyles", true);
          }, 500);
        },
        icon: help_default
      }
    ];
  }, [history, openGeneralSidebar, canvas, isBlockBasedTheme, set]);
  return {
    isLoading: false,
    commands
  };
};
const getGlobalStylesResetCommands = () => function useGlobalStylesResetCommands() {
  const [canReset, onReset] = useGlobalStylesReset();
  const commands = (0,external_wp_element_.useMemo)(() => {
    if (!canReset) {
      return [];
    }
    return [
      {
        name: "core/edit-site/reset-global-styles",
        label: (0,external_wp_i18n_namespaceObject.__)("Reset styles"),
        icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? rotate_right_default : rotate_left_default,
        callback: ({ close }) => {
          close();
          onReset();
        }
      }
    ];
  }, [canReset, onReset]);
  return {
    isLoading: false,
    commands
  };
};
const getGlobalStylesOpenRevisionsCommands = () => function useGlobalStylesOpenRevisionsCommands() {
  const { openGeneralSidebar, setEditorCanvasContainerView } = unlock(
    (0,external_wp_data_.useDispatch)(store)
  );
  const { params } = use_common_commands_useLocation();
  const { canvas = "view" } = params;
  const history = use_common_commands_useHistory();
  const hasRevisions = (0,external_wp_data_.useSelect)((select) => {
    const { getEntityRecord, __experimentalGetCurrentGlobalStylesId } = select(external_wp_coreData_namespaceObject.store);
    const globalStylesId = __experimentalGetCurrentGlobalStylesId();
    const globalStyles = globalStylesId ? getEntityRecord("root", "globalStyles", globalStylesId) : void 0;
    return !!globalStyles?._links?.["version-history"]?.[0]?.count;
  }, []);
  const commands = (0,external_wp_element_.useMemo)(() => {
    if (!hasRevisions) {
      return [];
    }
    return [
      {
        name: "core/edit-site/open-styles-revisions",
        label: (0,external_wp_i18n_namespaceObject.__)("Open style revisions"),
        icon: backup_default,
        callback: ({ close }) => {
          close();
          if (canvas !== "edit") {
            history.navigate("/styles?canvas=edit", {
              transition: "canvas-mode-edit-transition"
            });
          }
          openGeneralSidebar("edit-site/global-styles");
          setEditorCanvasContainerView(
            "global-styles-revisions"
          );
        }
      }
    ];
  }, [
    history,
    openGeneralSidebar,
    setEditorCanvasContainerView,
    hasRevisions,
    canvas
  ]);
  return {
    isLoading: false,
    commands
  };
};
function useCommonCommands() {
  (0,external_wp_commands_namespaceObject.useCommandLoader)({
    name: "core/edit-site/toggle-styles-welcome-guide",
    hook: getGlobalStylesToggleWelcomeGuideCommands()
  });
  (0,external_wp_commands_namespaceObject.useCommandLoader)({
    name: "core/edit-site/reset-global-styles",
    hook: getGlobalStylesResetCommands()
  });
  (0,external_wp_commands_namespaceObject.useCommandLoader)({
    name: "core/edit-site/open-styles-revisions",
    hook: getGlobalStylesOpenRevisionsCommands()
  });
}


;// ./node_modules/@wordpress/icons/build-module/library/close-small.js


var close_small_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M12 13.06l3.712 3.713 1.061-1.06L13.061 12l3.712-3.712-1.06-1.06L12 10.938 8.288 7.227l-1.061 1.06L10.939 12l-3.712 3.712 1.06 1.061L12 13.061z" }) });


;// ./node_modules/@wordpress/edit-site/build-module/components/editor-canvas-container/index.js












const { EditorContentSlotFill, ResizableEditor } = unlock(external_wp_editor_namespaceObject.privateApis);
function getEditorCanvasContainerTitle(view) {
  switch (view) {
    case "style-book":
      return (0,external_wp_i18n_namespaceObject.__)("Style Book");
    case "global-styles-revisions":
    case "global-styles-revisions:style-book":
      return (0,external_wp_i18n_namespaceObject.__)("Style Revisions");
    default:
      return "";
  }
}
function EditorCanvasContainer({
  children,
  closeButtonLabel,
  onClose,
  enableResizing = false
}) {
  const { editorCanvasContainerView, showListViewByDefault } = (0,external_wp_data_.useSelect)(
    (select) => {
      const _editorCanvasContainerView = unlock(
        select(store)
      ).getEditorCanvasContainerView();
      const _showListViewByDefault = select(external_wp_preferences_.store).get(
        "core",
        "showListViewByDefault"
      );
      return {
        editorCanvasContainerView: _editorCanvasContainerView,
        showListViewByDefault: _showListViewByDefault
      };
    },
    []
  );
  const [isClosed, setIsClosed] = (0,external_wp_element_.useState)(false);
  const { setEditorCanvasContainerView } = unlock(
    (0,external_wp_data_.useDispatch)(store)
  );
  const { setIsListViewOpened } = (0,external_wp_data_.useDispatch)(external_wp_editor_namespaceObject.store);
  const focusOnMountRef = (0,external_wp_compose_namespaceObject.useFocusOnMount)("firstElement");
  const sectionFocusReturnRef = (0,external_wp_compose_namespaceObject.useFocusReturn)();
  function onCloseContainer() {
    setIsListViewOpened(showListViewByDefault);
    setEditorCanvasContainerView(void 0);
    setIsClosed(true);
    if (typeof onClose === "function") {
      onClose();
    }
  }
  function closeOnEscape(event) {
    if (event.keyCode === external_wp_keycodes_namespaceObject.ESCAPE && !event.defaultPrevented) {
      event.preventDefault();
      onCloseContainer();
    }
  }
  const childrenWithProps = Array.isArray(children) ? external_wp_element_.Children.map(
    children,
    (child, index) => index === 0 ? (0,external_wp_element_.cloneElement)(child, {
      ref: sectionFocusReturnRef
    }) : child
  ) : (0,external_wp_element_.cloneElement)(children, {
    ref: sectionFocusReturnRef
  });
  if (isClosed) {
    return null;
  }
  const title = getEditorCanvasContainerTitle(editorCanvasContainerView);
  const shouldShowCloseButton = onClose || closeButtonLabel;
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(EditorContentSlotFill.Fill, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "edit-site-editor-canvas-container", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ResizableEditor, { enableResizing, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
    "section",
    {
      className: "edit-site-editor-canvas-container__section",
      ref: shouldShowCloseButton ? focusOnMountRef : null,
      onKeyDown: closeOnEscape,
      "aria-label": title,
      children: [
        shouldShowCloseButton && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
          external_wp_components_namespaceObject.Button,
          {
            size: "compact",
            className: "edit-site-editor-canvas-container__close-button",
            icon: close_small_default,
            label: closeButtonLabel || (0,external_wp_i18n_namespaceObject.__)("Close"),
            onClick: onCloseContainer
          }
        ),
        childrenWithProps
      ]
    }
  ) }) }) });
}
function useHasEditorCanvasContainer() {
  const fills = (0,external_wp_components_namespaceObject.__experimentalUseSlotFills)(EditorContentSlotFill.name);
  return !!fills?.length;
}
var editor_canvas_container_default = EditorCanvasContainer;


;// ./node_modules/@wordpress/edit-site/build-module/hooks/commands/use-set-command-context.js






const { useCommandContext } = unlock(external_wp_commands_namespaceObject.privateApis);
const { useLocation: use_set_command_context_useLocation } = unlock(external_wp_router_namespaceObject.privateApis);
function useSetCommandContext() {
  const { query = {} } = use_set_command_context_useLocation();
  const { canvas = "view" } = query;
  const hasBlockSelected = (0,external_wp_data_.useSelect)((select) => {
    return select(external_wp_blockEditor_namespaceObject.store).getBlockSelectionStart();
  }, []);
  const hasEditorCanvasContainer = useHasEditorCanvasContainer();
  let commandContext = "site-editor";
  if (canvas === "edit") {
    commandContext = "entity-edit";
  }
  if (hasBlockSelected) {
    commandContext = "block-selection-edit";
  }
  if (hasEditorCanvasContainer) {
    commandContext = "";
  }
  useCommandContext(commandContext);
}


;// ./node_modules/@wordpress/icons/build-module/library/styles.js


var styles_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
  external_wp_primitives_namespaceObject.Path,
  {
    fillRule: "evenodd",
    clipRule: "evenodd",
    d: "M20 12a8 8 0 1 1-16 0 8 8 0 0 1 16 0Zm-1.5 0a6.5 6.5 0 0 1-6.5 6.5v-13a6.5 6.5 0 0 1 6.5 6.5Z"
  }
) });


;// ./node_modules/@wordpress/icons/build-module/library/navigation.js


var navigation_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M12 4c-4.4 0-8 3.6-8 8s3.6 8 8 8 8-3.6 8-8-3.6-8-8-8zm0 14.5c-3.6 0-6.5-2.9-6.5-6.5S8.4 5.5 12 5.5s6.5 2.9 6.5 6.5-2.9 6.5-6.5 6.5zM9 16l4.5-3L15 8.4l-4.5 3L9 16z" }) });


;// ./node_modules/@wordpress/icons/build-module/library/page.js


var page_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: [
  /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M15.5 7.5h-7V9h7V7.5Zm-7 3.5h7v1.5h-7V11Zm7 3.5h-7V16h7v-1.5Z" }),
  /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M17 4H7a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2ZM7 5.5h10a.5.5 0 0 1 .5.5v12a.5.5 0 0 1-.5.5H7a.5.5 0 0 1-.5-.5V6a.5.5 0 0 1 .5-.5Z" })
] });


;// ./node_modules/@wordpress/icons/build-module/library/layout.js


var layout_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M18 5.5H6a.5.5 0 00-.5.5v3h13V6a.5.5 0 00-.5-.5zm.5 5H10v8h8a.5.5 0 00.5-.5v-7.5zm-10 0h-3V18a.5.5 0 00.5.5h2.5v-8zM6 4h12a2 2 0 012 2v12a2 2 0 01-2 2H6a2 2 0 01-2-2V6a2 2 0 012-2z" }) });


;// ./node_modules/@wordpress/icons/build-module/library/symbol.js


var symbol_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M21.3 10.8l-5.6-5.6c-.7-.7-1.8-.7-2.5 0l-5.6 5.6c-.7.7-.7 1.8 0 2.5l5.6 5.6c.3.3.8.5 1.2.5s.9-.2 1.2-.5l5.6-5.6c.8-.7.8-1.9.1-2.5zm-1 1.4l-5.6 5.6c-.1.1-.3.1-.4 0l-5.6-5.6c-.1-.1-.1-.3 0-.4l5.6-5.6s.1-.1.2-.1.1 0 .2.1l5.6 5.6c.1.1.1.3 0 .4zm-16.6-.4L10 5.5l-1-1-6.3 6.3c-.7.7-.7 1.8 0 2.5L9 19.5l1.1-1.1-6.3-6.3c-.2 0-.2-.2-.1-.3z" }) });


;// ./node_modules/@wordpress/icons/build-module/library/chevron-right.js


var chevron_right_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M10.6 6L9.4 7l4.6 5-4.6 5 1.2 1 5.4-6z" }) });


;// ./node_modules/@wordpress/icons/build-module/library/chevron-left.js


var chevron_left_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M14.6 7l-1.2-1L8 12l5.4 6 1.2-1-4.6-5z" }) });


;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-button/index.js



function SidebarButton(props) {
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    external_wp_components_namespaceObject.Button,
    {
      size: "compact",
      ...props,
      className: dist_clsx("edit-site-sidebar-button", props.className)
    }
  );
}


;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen/index.js














const { useHistory: sidebar_navigation_screen_useHistory, useLocation: sidebar_navigation_screen_useLocation } = unlock(external_wp_router_namespaceObject.privateApis);
function SidebarNavigationScreen({
  isRoot,
  title,
  actions,
  content,
  footer,
  description,
  backPath: backPathProp
}) {
  const { dashboardLink, dashboardLinkText, previewingThemeName } = (0,external_wp_data_.useSelect)(
    (select) => {
      const { getSettings } = unlock(select(store));
      const currentlyPreviewingThemeId = currentlyPreviewingTheme();
      return {
        dashboardLink: getSettings().__experimentalDashboardLink,
        dashboardLinkText: getSettings().__experimentalDashboardLinkText,
        // Do not call `getTheme` with null, it will cause a request to
        // the server.
        previewingThemeName: currentlyPreviewingThemeId ? select(external_wp_coreData_namespaceObject.store).getTheme(currentlyPreviewingThemeId)?.name?.rendered : void 0
      };
    },
    []
  );
  const location = sidebar_navigation_screen_useLocation();
  const history = sidebar_navigation_screen_useHistory();
  const { navigate } = (0,external_wp_element_.useContext)(SidebarNavigationContext);
  const backPath = backPathProp ?? location.state?.backPath;
  const icon = (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_right_default : chevron_left_default;
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
    /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
      external_wp_components_namespaceObject.__experimentalVStack,
      {
        className: dist_clsx("edit-site-sidebar-navigation-screen__main", {
          "has-footer": !!footer
        }),
        spacing: 0,
        justify: "flex-start",
        children: [
          /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
            external_wp_components_namespaceObject.__experimentalHStack,
            {
              spacing: 3,
              alignment: "flex-start",
              className: "edit-site-sidebar-navigation-screen__title-icon",
              children: [
                !isRoot && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
                  SidebarButton,
                  {
                    onClick: () => {
                      history.navigate(backPath);
                      navigate("back");
                    },
                    icon,
                    label: (0,external_wp_i18n_namespaceObject.__)("Back"),
                    showTooltip: false
                  }
                ),
                isRoot && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
                  SidebarButton,
                  {
                    icon,
                    label: dashboardLinkText || (0,external_wp_i18n_namespaceObject.__)("Go to the Dashboard"),
                    href: dashboardLink
                  }
                ),
                /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
                  external_wp_components_namespaceObject.__experimentalHeading,
                  {
                    className: "edit-site-sidebar-navigation-screen__title",
                    color: "#e0e0e0",
                    level: 1,
                    size: 20,
                    children: !isPreviewingTheme() ? title : (0,external_wp_i18n_namespaceObject.sprintf)(
                      /* translators: 1: theme name. 2: title */
                      (0,external_wp_i18n_namespaceObject.__)("Previewing %1$s: %2$s"),
                      previewingThemeName,
                      title
                    )
                  }
                ),
                actions && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "edit-site-sidebar-navigation-screen__actions", children: actions })
              ]
            }
          ),
          /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "edit-site-sidebar-navigation-screen__content", children: [
            description && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "edit-site-sidebar-navigation-screen__description", children: description }),
            content
          ] })
        ]
      }
    ),
    footer && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("footer", { className: "edit-site-sidebar-navigation-screen__footer", children: footer })
  ] });
}


;// ./node_modules/@wordpress/icons/build-module/icon/index.js

var icon_default = (0,external_wp_element_.forwardRef)(
  ({ icon, size = 24, ...props }, ref) => {
    return (0,external_wp_element_.cloneElement)(icon, {
      width: size,
      height: size,
      ...props,
      ref
    });
  }
);


;// ./node_modules/@wordpress/icons/build-module/library/chevron-left-small.js


var chevron_left_small_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "m13.1 16-3.4-4 3.4-4 1.1 1-2.6 3 2.6 3-1.1 1z" }) });


;// ./node_modules/@wordpress/icons/build-module/library/chevron-right-small.js


var chevron_right_small_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M10.8622 8.04053L14.2805 12.0286L10.8622 16.0167L9.72327 15.0405L12.3049 12.0286L9.72327 9.01672L10.8622 8.04053Z" }) });


;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-item/index.js









const { useHistory: sidebar_navigation_item_useHistory, useLink } = unlock(external_wp_router_namespaceObject.privateApis);
function SidebarNavigationItem({
  className,
  icon,
  withChevron = false,
  suffix,
  uid,
  to,
  onClick,
  children,
  ...props
}) {
  const history = sidebar_navigation_item_useHistory();
  const { navigate } = (0,external_wp_element_.useContext)(SidebarNavigationContext);
  function handleClick(e) {
    if (onClick) {
      onClick(e);
      navigate("forward");
    } else if (to) {
      e.preventDefault();
      history.navigate(to);
      navigate("forward", `[id="${uid}"]`);
    }
  }
  const linkProps = useLink(to);
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    external_wp_components_namespaceObject.__experimentalItem,
    {
      className: dist_clsx(
        "edit-site-sidebar-navigation-item",
        { "with-suffix": !withChevron && suffix },
        className
      ),
      id: uid,
      onClick: handleClick,
      href: to ? linkProps.href : void 0,
      ...props,
      children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "flex-start", children: [
        icon && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
          icon_default,
          {
            style: { fill: "currentcolor" },
            icon,
            size: 24
          }
        ),
        /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexBlock, { children }),
        withChevron && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
          icon_default,
          {
            icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left_small_default : chevron_right_small_default,
            className: "edit-site-sidebar-navigation-item__drilldown-indicator",
            size: 24
          }
        ),
        !withChevron && suffix
      ] })
    }
  );
}


;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-revisions/use-global-styles-revisions.js





const SITE_EDITOR_AUTHORS_QUERY = {
  per_page: -1,
  _fields: "id,name,avatar_urls",
  context: "view",
  capabilities: ["edit_theme_options"]
};
const DEFAULT_QUERY = { per_page: 100, page: 1 };
const use_global_styles_revisions_EMPTY_ARRAY = [];
const { GlobalStylesContext: use_global_styles_revisions_GlobalStylesContext } = unlock(external_wp_blockEditor_namespaceObject.privateApis);
function useGlobalStylesRevisions({ query } = {}) {
  const { user: userConfig } = (0,external_wp_element_.useContext)(use_global_styles_revisions_GlobalStylesContext);
  const _query = { ...DEFAULT_QUERY, ...query };
  const {
    authors,
    currentUser,
    isDirty,
    revisions,
    isLoadingGlobalStylesRevisions,
    revisionsCount
  } = (0,external_wp_data_.useSelect)(
    (select) => {
      const {
        __experimentalGetDirtyEntityRecords,
        getCurrentUser,
        getUsers,
        getRevisions,
        __experimentalGetCurrentGlobalStylesId,
        getEntityRecord,
        isResolving
      } = select(external_wp_coreData_namespaceObject.store);
      const dirtyEntityRecords = __experimentalGetDirtyEntityRecords();
      const _currentUser = getCurrentUser();
      const _isDirty = dirtyEntityRecords.length > 0;
      const globalStylesId = __experimentalGetCurrentGlobalStylesId();
      const globalStyles = globalStylesId ? getEntityRecord("root", "globalStyles", globalStylesId) : void 0;
      const _revisionsCount = globalStyles?._links?.["version-history"]?.[0]?.count ?? 0;
      const globalStylesRevisions = getRevisions(
        "root",
        "globalStyles",
        globalStylesId,
        _query
      ) || use_global_styles_revisions_EMPTY_ARRAY;
      const _authors = getUsers(SITE_EDITOR_AUTHORS_QUERY) || use_global_styles_revisions_EMPTY_ARRAY;
      const _isResolving = isResolving("getRevisions", [
        "root",
        "globalStyles",
        globalStylesId,
        _query
      ]);
      return {
        authors: _authors,
        currentUser: _currentUser,
        isDirty: _isDirty,
        revisions: globalStylesRevisions,
        isLoadingGlobalStylesRevisions: _isResolving,
        revisionsCount: _revisionsCount
      };
    },
    [query]
  );
  return (0,external_wp_element_.useMemo)(() => {
    if (!authors.length || isLoadingGlobalStylesRevisions) {
      return {
        revisions: use_global_styles_revisions_EMPTY_ARRAY,
        hasUnsavedChanges: isDirty,
        isLoading: true,
        revisionsCount
      };
    }
    const _modifiedRevisions = revisions.map((revision) => {
      return {
        ...revision,
        author: authors.find(
          (author) => author.id === revision.author
        )
      };
    });
    const fetchedRevisionsCount = revisions.length;
    if (fetchedRevisionsCount) {
      if (_modifiedRevisions[0].id !== "unsaved" && _query.page === 1) {
        _modifiedRevisions[0].isLatest = true;
      }
      if (isDirty && userConfig && Object.keys(userConfig).length > 0 && currentUser && _query.page === 1) {
        const unsavedRevision = {
          id: "unsaved",
          styles: userConfig?.styles,
          settings: userConfig?.settings,
          _links: userConfig?._links,
          author: {
            name: currentUser?.name,
            avatar_urls: currentUser?.avatar_urls
          },
          modified: /* @__PURE__ */ new Date()
        };
        _modifiedRevisions.unshift(unsavedRevision);
      }
      if (_query.page === Math.ceil(revisionsCount / _query.per_page)) {
        _modifiedRevisions.push({
          id: "parent",
          styles: {},
          settings: {}
        });
      }
    }
    return {
      revisions: _modifiedRevisions,
      hasUnsavedChanges: isDirty,
      isLoading: false,
      revisionsCount
    };
  }, [
    isDirty,
    revisions,
    currentUser,
    authors,
    userConfig,
    isLoadingGlobalStylesRevisions
  ]);
}


;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-details-footer/index.js






function SidebarNavigationScreenDetailsFooter({
  record,
  revisionsCount,
  ...otherProps
}) {
  const hrefProps = {};
  const lastRevisionId = record?._links?.["predecessor-version"]?.[0]?.id ?? null;
  revisionsCount = revisionsCount || record?._links?.["version-history"]?.[0]?.count || 0;
  if (lastRevisionId && revisionsCount > 1) {
    hrefProps.href = (0,external_wp_url_namespaceObject.addQueryArgs)("revision.php", {
      revision: record?._links["predecessor-version"][0].id
    });
    hrefProps.as = "a";
  }
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    external_wp_components_namespaceObject.__experimentalItemGroup,
    {
      size: "large",
      className: "edit-site-sidebar-navigation-screen-details-footer",
      children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
        SidebarNavigationItem,
        {
          icon: backup_default,
          ...hrefProps,
          ...otherProps,
          children: (0,external_wp_i18n_namespaceObject.sprintf)(
            /* translators: %d: Number of Styles revisions. */
            (0,external_wp_i18n_namespaceObject._n)("%d Revision", "%d Revisions", revisionsCount),
            revisionsCount
          )
        }
      )
    }
  );
}


;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-global-styles/index.js














const { useLocation: sidebar_navigation_screen_global_styles_useLocation, useHistory: sidebar_navigation_screen_global_styles_useHistory } = unlock(external_wp_router_namespaceObject.privateApis);
function SidebarNavigationItemGlobalStyles(props) {
  const { name } = sidebar_navigation_screen_global_styles_useLocation();
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    SidebarNavigationItem,
    {
      ...props,
      "aria-current": name === "styles"
    }
  );
}
function SidebarNavigationScreenGlobalStyles() {
  const history = sidebar_navigation_screen_global_styles_useHistory();
  const { path } = sidebar_navigation_screen_global_styles_useLocation();
  const {
    revisions,
    isLoading: isLoadingRevisions,
    revisionsCount
  } = useGlobalStylesRevisions();
  const { openGeneralSidebar } = (0,external_wp_data_.useDispatch)(store);
  const { setEditorCanvasContainerView } = unlock(
    (0,external_wp_data_.useDispatch)(store)
  );
  const { set: setPreference } = (0,external_wp_data_.useDispatch)(external_wp_preferences_.store);
  const openGlobalStyles = (0,external_wp_element_.useCallback)(async () => {
    history.navigate((0,external_wp_url_namespaceObject.addQueryArgs)(path, { canvas: "edit" }), {
      transition: "canvas-mode-edit-transition"
    });
    return Promise.all([
      setPreference("core", "distractionFree", false),
      openGeneralSidebar("edit-site/global-styles")
    ]);
  }, [path, history, openGeneralSidebar, setPreference]);
  const openRevisions = (0,external_wp_element_.useCallback)(async () => {
    await openGlobalStyles();
    setEditorCanvasContainerView("global-styles-revisions");
  }, [openGlobalStyles, setEditorCanvasContainerView]);
  const shouldShowGlobalStylesFooter = !!revisionsCount && !isLoadingRevisions;
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    SidebarNavigationScreen,
    {
      title: (0,external_wp_i18n_namespaceObject.__)("Design"),
      isRoot: true,
      description: (0,external_wp_i18n_namespaceObject.__)(
        "Customize the appearance of your website using the block editor."
      ),
      content: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(MainSidebarNavigationContent, { activeItem: "styles-navigation-item" }),
      footer: shouldShowGlobalStylesFooter && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
        SidebarNavigationScreenDetailsFooter,
        {
          record: revisions?.[0],
          revisionsCount,
          onClick: openRevisions
        }
      )
    }
  ) });
}


;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-main/index.js












function MainSidebarNavigationContent({ isBlockBasedTheme = true }) {
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalItemGroup, { className: "edit-site-sidebar-navigation-screen-main", children: [
    isBlockBasedTheme && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
      /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
        SidebarNavigationItemGlobalStyles,
        {
          to: "/styles",
          uid: "global-styles-navigation-item",
          icon: styles_default,
          children: (0,external_wp_i18n_namespaceObject.__)("Styles")
        }
      ),
      /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
        SidebarNavigationItem,
        {
          uid: "navigation-navigation-item",
          to: "/navigation",
          withChevron: true,
          icon: navigation_default,
          children: (0,external_wp_i18n_namespaceObject.__)("Navigation")
        }
      ),
      /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
        SidebarNavigationItem,
        {
          uid: "page-navigation-item",
          to: "/page",
          withChevron: true,
          icon: page_default,
          children: (0,external_wp_i18n_namespaceObject.__)("Pages")
        }
      ),
      /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
        SidebarNavigationItem,
        {
          uid: "template-navigation-item",
          to: "/template",
          withChevron: true,
          icon: layout_default,
          children: (0,external_wp_i18n_namespaceObject.__)("Templates")
        }
      )
    ] }),
    !isBlockBasedTheme && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
      SidebarNavigationItem,
      {
        uid: "stylebook-navigation-item",
        to: "/stylebook",
        withChevron: true,
        icon: styles_default,
        children: (0,external_wp_i18n_namespaceObject.__)("Styles")
      }
    ),
    /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
      SidebarNavigationItem,
      {
        uid: "patterns-navigation-item",
        to: "/pattern",
        withChevron: true,
        icon: symbol_default,
        children: (0,external_wp_i18n_namespaceObject.__)("Patterns")
      }
    )
  ] });
}
function SidebarNavigationScreenMain({ customDescription }) {
  const isBlockBasedTheme = (0,external_wp_data_.useSelect)(
    (select) => select(external_wp_coreData_namespaceObject.store).getCurrentTheme()?.is_block_theme,
    []
  );
  const { setEditorCanvasContainerView } = unlock(
    (0,external_wp_data_.useDispatch)(store)
  );
  (0,external_wp_element_.useEffect)(() => {
    setEditorCanvasContainerView(void 0);
  }, [setEditorCanvasContainerView]);
  let description;
  if (customDescription) {
    description = customDescription;
  } else if (isBlockBasedTheme) {
    description = (0,external_wp_i18n_namespaceObject.__)(
      "Customize the appearance of your website using the block editor."
    );
  } else {
    description = (0,external_wp_i18n_namespaceObject.__)(
      "Explore block styles and patterns to refine your site."
    );
  }
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    SidebarNavigationScreen,
    {
      isRoot: true,
      title: (0,external_wp_i18n_namespaceObject.__)("Design"),
      description,
      content: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
        MainSidebarNavigationContent,
        {
          isBlockBasedTheme
        }
      )
    }
  );
}


;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-unsupported/index.js



function SidebarNavigationScreenUnsupported() {
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { padding: 3, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Notice, { status: "warning", isDismissible: false, children: (0,external_wp_i18n_namespaceObject.__)(
    "The theme you are currently using does not support this screen."
  ) }) });
}


;// ./node_modules/@wordpress/icons/build-module/library/arrow-up-left.js


var arrow_up_left_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M14 6H6v8h1.5V8.5L17 18l1-1-9.5-9.5H14V6Z" }) });


;// ./node_modules/@wordpress/edit-site/build-module/components/welcome-guide/image.js

function WelcomeGuideImage({ nonAnimatedSrc, animatedSrc }) {
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("picture", { className: "edit-site-welcome-guide__image", children: [
    /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
      "source",
      {
        srcSet: nonAnimatedSrc,
        media: "(prefers-reduced-motion: reduce)"
      }
    ),
    /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("img", { src: animatedSrc, width: "312", height: "240", alt: "" })
  ] });
}


;// ./node_modules/@wordpress/edit-site/build-module/components/welcome-guide/editor.js








function WelcomeGuideEditor() {
  const { toggle } = (0,external_wp_data_.useDispatch)(external_wp_preferences_.store);
  const { isActive, isBlockBasedTheme } = (0,external_wp_data_.useSelect)((select) => {
    return {
      isActive: !!select(external_wp_preferences_.store).get(
        "core/edit-site",
        "welcomeGuide"
      ),
      isBlockBasedTheme: select(external_wp_coreData_namespaceObject.store).getCurrentTheme()?.is_block_theme
    };
  }, []);
  if (!isActive || !isBlockBasedTheme) {
    return null;
  }
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    external_wp_components_namespaceObject.Guide,
    {
      className: "edit-site-welcome-guide guide-editor",
      contentLabel: (0,external_wp_i18n_namespaceObject.__)("Welcome to the site editor"),
      finishButtonText: (0,external_wp_i18n_namespaceObject.__)("Get started"),
      onFinish: () => toggle("core/edit-site", "welcomeGuide"),
      pages: [
        {
          image: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
            WelcomeGuideImage,
            {
              nonAnimatedSrc: "https://s.w.org/images/block-editor/edit-your-site.svg?1",
              animatedSrc: "https://s.w.org/images/block-editor/edit-your-site.gif?1"
            }
          ),
          content: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
            /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("h1", { className: "edit-site-welcome-guide__heading", children: (0,external_wp_i18n_namespaceObject.__)("Edit your site") }),
            /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { className: "edit-site-welcome-guide__text", children: (0,external_wp_i18n_namespaceObject.__)(
              "Design everything on your site \u2014 from the header right down to the footer \u2014 using blocks."
            ) }),
            /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { className: "edit-site-welcome-guide__text", children: (0,external_wp_element_.createInterpolateElement)(
              (0,external_wp_i18n_namespaceObject.__)(
                "Click <StylesIconImage /> to start designing your blocks, and choose your typography, layout, and colors."
              ),
              {
                StylesIconImage: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
                  "img",
                  {
                    alt: (0,external_wp_i18n_namespaceObject.__)("styles"),
                    src: "data:image/svg+xml,%3Csvg width='18' height='18' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M12 4c-4.4 0-8 3.6-8 8v.1c0 4.1 3.2 7.5 7.2 7.9h.8c4.4 0 8-3.6 8-8s-3.6-8-8-8zm0 15V5c3.9 0 7 3.1 7 7s-3.1 7-7 7z' fill='%231E1E1E'/%3E%3C/svg%3E%0A"
                  }
                )
              }
            ) })
          ] })
        }
      ]
    }
  );
}


;// ./node_modules/@wordpress/edit-site/build-module/components/welcome-guide/styles.js








const { interfaceStore: styles_interfaceStore } = unlock(external_wp_editor_namespaceObject.privateApis);
function WelcomeGuideStyles() {
  const { toggle } = (0,external_wp_data_.useDispatch)(external_wp_preferences_.store);
  const { isActive, isStylesOpen } = (0,external_wp_data_.useSelect)((select) => {
    const sidebar = select(styles_interfaceStore).getActiveComplementaryArea("core");
    return {
      isActive: !!select(external_wp_preferences_.store).get(
        "core/edit-site",
        "welcomeGuideStyles"
      ),
      isStylesOpen: sidebar === "edit-site/global-styles"
    };
  }, []);
  if (!isActive || !isStylesOpen) {
    return null;
  }
  const welcomeLabel = (0,external_wp_i18n_namespaceObject.__)("Welcome to Styles");
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    external_wp_components_namespaceObject.Guide,
    {
      className: "edit-site-welcome-guide guide-styles",
      contentLabel: welcomeLabel,
      finishButtonText: (0,external_wp_i18n_namespaceObject.__)("Get started"),
      onFinish: () => toggle("core/edit-site", "welcomeGuideStyles"),
      pages: [
        {
          image: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
            WelcomeGuideImage,
            {
              nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-to-styles.svg?1",
              animatedSrc: "https://s.w.org/images/block-editor/welcome-to-styles.gif?1"
            }
          ),
          content: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
            /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("h1", { className: "edit-site-welcome-guide__heading", children: welcomeLabel }),
            /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { className: "edit-site-welcome-guide__text", children: (0,external_wp_i18n_namespaceObject.__)(
              "Tweak your site, or give it a whole new look! Get creative \u2014 how about a new color palette for your buttons, or choosing a new font? Take a look at what you can do here."
            ) })
          ] })
        },
        {
          image: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
            WelcomeGuideImage,
            {
              nonAnimatedSrc: "https://s.w.org/images/block-editor/set-the-design.svg?1",
              animatedSrc: "https://s.w.org/images/block-editor/set-the-design.gif?1"
            }
          ),
          content: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
            /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("h1", { className: "edit-site-welcome-guide__heading", children: (0,external_wp_i18n_namespaceObject.__)("Set the design") }),
            /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { className: "edit-site-welcome-guide__text", children: (0,external_wp_i18n_namespaceObject.__)(
              "You can customize your site as much as you like with different colors, typography, and layouts. Or if you prefer, just leave it up to your theme to handle!"
            ) })
          ] })
        },
        {
          image: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
            WelcomeGuideImage,
            {
              nonAnimatedSrc: "https://s.w.org/images/block-editor/personalize-blocks.svg?1",
              animatedSrc: "https://s.w.org/images/block-editor/personalize-blocks.gif?1"
            }
          ),
          content: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
            /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("h1", { className: "edit-site-welcome-guide__heading", children: (0,external_wp_i18n_namespaceObject.__)("Personalize blocks") }),
            /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { className: "edit-site-welcome-guide__text", children: (0,external_wp_i18n_namespaceObject.__)(
              "You can adjust your blocks to ensure a cohesive experience across your site \u2014 add your unique colors to a branded Button block, or adjust the Heading block to your preferred size."
            ) })
          ] })
        },
        {
          image: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
            WelcomeGuideImage,
            {
              nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-documentation.svg",
              animatedSrc: "https://s.w.org/images/block-editor/welcome-documentation.gif"
            }
          ),
          content: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
            /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("h1", { className: "edit-site-welcome-guide__heading", children: (0,external_wp_i18n_namespaceObject.__)("Learn more") }),
            /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("p", { className: "edit-site-welcome-guide__text", children: [
              (0,external_wp_i18n_namespaceObject.__)(
                "New to block themes and styling your site?"
              ),
              " ",
              /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
                external_wp_components_namespaceObject.ExternalLink,
                {
                  href: (0,external_wp_i18n_namespaceObject.__)(
                    "https://wordpress.org/documentation/article/styles-overview/"
                  ),
                  children: (0,external_wp_i18n_namespaceObject.__)(
                    "Here\u2019s a detailed guide to learn how to make the most of it."
                  )
                }
              )
            ] })
          ] })
        }
      ]
    }
  );
}


;// ./node_modules/@wordpress/edit-site/build-module/components/welcome-guide/page.js





function WelcomeGuidePage() {
  const { toggle } = (0,external_wp_data_.useDispatch)(external_wp_preferences_.store);
  const isVisible = (0,external_wp_data_.useSelect)((select) => {
    const isPageActive = !!select(external_wp_preferences_.store).get(
      "core/edit-site",
      "welcomeGuidePage"
    );
    const isEditorActive = !!select(external_wp_preferences_.store).get(
      "core/edit-site",
      "welcomeGuide"
    );
    return isPageActive && !isEditorActive;
  }, []);
  if (!isVisible) {
    return null;
  }
  const heading = (0,external_wp_i18n_namespaceObject.__)("Editing a page");
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    external_wp_components_namespaceObject.Guide,
    {
      className: "edit-site-welcome-guide guide-page",
      contentLabel: heading,
      finishButtonText: (0,external_wp_i18n_namespaceObject.__)("Continue"),
      onFinish: () => toggle("core/edit-site", "welcomeGuidePage"),
      pages: [
        {
          image: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
            "video",
            {
              className: "edit-site-welcome-guide__video",
              autoPlay: true,
              loop: true,
              muted: true,
              width: "312",
              height: "240",
              children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
                "source",
                {
                  src: "https://s.w.org/images/block-editor/editing-your-page.mp4",
                  type: "video/mp4"
                }
              )
            }
          ),
          content: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
            /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("h1", { className: "edit-site-welcome-guide__heading", children: heading }),
            /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { className: "edit-site-welcome-guide__text", children: (0,external_wp_i18n_namespaceObject.__)(
              // eslint-disable-next-line no-restricted-syntax -- 'sidebar' is a common web design term for layouts
              "It\u2019s now possible to edit page content in the site editor. To customise other parts of the page like the header and footer switch to editing the template using the settings sidebar."
            ) })
          ] })
        }
      ]
    }
  );
}


;// ./node_modules/@wordpress/edit-site/build-module/components/welcome-guide/template.js






function WelcomeGuideTemplate() {
  const { toggle } = (0,external_wp_data_.useDispatch)(external_wp_preferences_.store);
  const { isActive, hasPreviousEntity } = (0,external_wp_data_.useSelect)((select) => {
    const { getEditorSettings } = select(external_wp_editor_namespaceObject.store);
    const { get } = select(external_wp_preferences_.store);
    return {
      isActive: get("core/edit-site", "welcomeGuideTemplate"),
      hasPreviousEntity: !!getEditorSettings().onNavigateToPreviousEntityRecord
    };
  }, []);
  const isVisible = isActive && hasPreviousEntity;
  if (!isVisible) {
    return null;
  }
  const heading = (0,external_wp_i18n_namespaceObject.__)("Editing a template");
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    external_wp_components_namespaceObject.Guide,
    {
      className: "edit-site-welcome-guide guide-template",
      contentLabel: heading,
      finishButtonText: (0,external_wp_i18n_namespaceObject.__)("Continue"),
      onFinish: () => toggle("core/edit-site", "welcomeGuideTemplate"),
      pages: [
        {
          image: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
            "video",
            {
              className: "edit-site-welcome-guide__video",
              autoPlay: true,
              loop: true,
              muted: true,
              width: "312",
              height: "240",
              children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
                "source",
                {
                  src: "https://s.w.org/images/block-editor/editing-your-template.mp4",
                  type: "video/mp4"
                }
              )
            }
          ),
          content: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
            /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("h1", { className: "edit-site-welcome-guide__heading", children: heading }),
            /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { className: "edit-site-welcome-guide__text", children: (0,external_wp_i18n_namespaceObject.__)(
              "Note that the same template can be used by multiple pages, so any changes made here may affect other pages on the site. To switch back to editing the page content click the \u2018Back\u2019 button in the toolbar."
            ) })
          ] })
        }
      ]
    }
  );
}


;// ./node_modules/@wordpress/edit-site/build-module/components/welcome-guide/index.js





function WelcomeGuide({ postType }) {
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
    /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(WelcomeGuideEditor, {}),
    /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(WelcomeGuideStyles, {}),
    postType === "page" && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(WelcomeGuidePage, {}),
    postType === "wp_template" && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(WelcomeGuideTemplate, {})
  ] });
}


;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles-renderer/index.js





const { useGlobalStylesOutput } = unlock(external_wp_blockEditor_namespaceObject.privateApis);
function useGlobalStylesRenderer(disableRootPadding) {
  const [styles, settings] = useGlobalStylesOutput(disableRootPadding);
  const { getSettings } = (0,external_wp_data_.useSelect)(store);
  const { updateSettings } = (0,external_wp_data_.useDispatch)(store);
  (0,external_wp_element_.useEffect)(() => {
    if (!styles || !settings) {
      return;
    }
    const currentStoreSettings = getSettings();
    const nonGlobalStyles = Object.values(
      currentStoreSettings.styles ?? []
    ).filter((style) => !style.isGlobalStyles);
    updateSettings({
      ...currentStoreSettings,
      styles: [...nonGlobalStyles, ...styles],
      __experimentalFeatures: settings
    });
  }, [styles, settings, updateSettings, getSettings]);
}
function GlobalStylesRenderer({ disableRootPadding }) {
  useGlobalStylesRenderer(disableRootPadding);
  return null;
}


;// ./node_modules/@wordpress/edit-site/build-module/components/canvas-loader/index.js







const { Theme } = unlock(external_wp_components_namespaceObject.privateApis);
const { useGlobalStyle: canvas_loader_useGlobalStyle } = unlock(external_wp_blockEditor_namespaceObject.privateApis);
function CanvasLoader({ id }) {
  const [fallbackIndicatorColor] = canvas_loader_useGlobalStyle("color.text");
  const [backgroundColor] = canvas_loader_useGlobalStyle("color.background");
  const { highlightedColors } = useStylesPreviewColors();
  const indicatorColor = highlightedColors[0]?.color ?? fallbackIndicatorColor;
  const { elapsed, total } = (0,external_wp_data_.useSelect)((select) => {
    const selectorsByStatus = select(external_wp_coreData_namespaceObject.store).countSelectorsByStatus();
    const resolving = selectorsByStatus.resolving ?? 0;
    const finished = selectorsByStatus.finished ?? 0;
    return {
      elapsed: finished,
      total: finished + resolving
    };
  }, []);
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "edit-site-canvas-loader", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Theme, { accent: indicatorColor, background: backgroundColor, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ProgressBar, { id, max: total, value: elapsed }) }) });
}


;// ./node_modules/@wordpress/edit-site/build-module/components/block-editor/use-navigate-to-entity-record.js



const { useHistory: use_navigate_to_entity_record_useHistory } = unlock(external_wp_router_namespaceObject.privateApis);
function useNavigateToEntityRecord() {
  const history = use_navigate_to_entity_record_useHistory();
  const onNavigateToEntityRecord = (0,external_wp_element_.useCallback)(
    (params) => {
      history.navigate(
        `/${params.postType}/${params.postId}?canvas=edit&focusMode=true`
      );
    },
    [history]
  );
  return onNavigateToEntityRecord;
}


;// ./node_modules/@wordpress/edit-site/build-module/components/block-editor/use-site-editor-settings.js








const { useLocation: use_site_editor_settings_useLocation, useHistory: use_site_editor_settings_useHistory } = unlock(external_wp_router_namespaceObject.privateApis);
function useNavigateToPreviousEntityRecord() {
  const location = use_site_editor_settings_useLocation();
  const previousLocation = (0,external_wp_compose_namespaceObject.usePrevious)(location);
  const history = use_site_editor_settings_useHistory();
  const goBack = (0,external_wp_element_.useMemo)(() => {
    const isFocusMode = location.query.focusMode || location?.params?.postId && FOCUSABLE_ENTITIES.includes(location?.params?.postType);
    const didComeFromEditorCanvas = previousLocation?.query.canvas === "edit";
    const showBackButton = isFocusMode && didComeFromEditorCanvas;
    return showBackButton ? () => history.back() : void 0;
  }, [location, history]);
  return goBack;
}
function useSpecificEditorSettings() {
  const { query } = use_site_editor_settings_useLocation();
  const { canvas = "view" } = query;
  const onNavigateToEntityRecord = useNavigateToEntityRecord();
  const { settings } = (0,external_wp_data_.useSelect)((select) => {
    const { getSettings } = select(store);
    return {
      settings: getSettings()
    };
  }, []);
  const onNavigateToPreviousEntityRecord = useNavigateToPreviousEntityRecord();
  const defaultEditorSettings = (0,external_wp_element_.useMemo)(() => {
    return {
      ...settings,
      richEditingEnabled: true,
      supportsTemplateMode: true,
      focusMode: canvas !== "view",
      onNavigateToEntityRecord,
      onNavigateToPreviousEntityRecord,
      isPreviewMode: canvas === "view"
    };
  }, [
    settings,
    canvas,
    onNavigateToEntityRecord,
    onNavigateToPreviousEntityRecord
  ]);
  return defaultEditorSettings;
}


;// ./node_modules/@wordpress/edit-site/build-module/components/plugin-template-setting-panel/index.js





const { Fill, Slot } = (0,external_wp_components_namespaceObject.createSlotFill)("PluginTemplateSettingPanel");
const PluginTemplateSettingPanel = ({ children }) => {
  external_wp_deprecated_default()("wp.editSite.PluginTemplateSettingPanel", {
    since: "6.6",
    version: "6.8",
    alternative: "wp.editor.PluginDocumentSettingPanel"
  });
  const isCurrentEntityTemplate = (0,external_wp_data_.useSelect)(
    (select) => select(external_wp_editor_namespaceObject.store).getCurrentPostType() === "wp_template",
    []
  );
  if (!isCurrentEntityTemplate) {
    return null;
  }
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Fill, { children });
};
PluginTemplateSettingPanel.Slot = Slot;
var plugin_template_setting_panel_default = PluginTemplateSettingPanel;


;// ./node_modules/@wordpress/icons/build-module/library/seen.js


var seen_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M3.99961 13C4.67043 13.3354 4.6703 13.3357 4.67017 13.3359L4.67298 13.3305C4.67621 13.3242 4.68184 13.3135 4.68988 13.2985C4.70595 13.2686 4.7316 13.2218 4.76695 13.1608C4.8377 13.0385 4.94692 12.8592 5.09541 12.6419C5.39312 12.2062 5.84436 11.624 6.45435 11.0431C7.67308 9.88241 9.49719 8.75 11.9996 8.75C14.502 8.75 16.3261 9.88241 17.5449 11.0431C18.1549 11.624 18.6061 12.2062 18.9038 12.6419C19.0523 12.8592 19.1615 13.0385 19.2323 13.1608C19.2676 13.2218 19.2933 13.2686 19.3093 13.2985C19.3174 13.3135 19.323 13.3242 19.3262 13.3305L19.3291 13.3359C19.3289 13.3357 19.3288 13.3354 19.9996 13C20.6704 12.6646 20.6703 12.6643 20.6701 12.664L20.6697 12.6632L20.6688 12.6614L20.6662 12.6563L20.6583 12.6408C20.6517 12.6282 20.6427 12.6108 20.631 12.5892C20.6078 12.5459 20.5744 12.4852 20.5306 12.4096C20.4432 12.2584 20.3141 12.0471 20.1423 11.7956C19.7994 11.2938 19.2819 10.626 18.5794 9.9569C17.1731 8.61759 14.9972 7.25 11.9996 7.25C9.00203 7.25 6.82614 8.61759 5.41987 9.9569C4.71736 10.626 4.19984 11.2938 3.85694 11.7956C3.68511 12.0471 3.55605 12.2584 3.4686 12.4096C3.42484 12.4852 3.39142 12.5459 3.36818 12.5892C3.35656 12.6108 3.34748 12.6282 3.34092 12.6408L3.33297 12.6563L3.33041 12.6614L3.32948 12.6632L3.32911 12.664C3.32894 12.6643 3.32879 12.6646 3.99961 13ZM11.9996 16C13.9326 16 15.4996 14.433 15.4996 12.5C15.4996 10.567 13.9326 9 11.9996 9C10.0666 9 8.49961 10.567 8.49961 12.5C8.49961 14.433 10.0666 16 11.9996 16Z" }) });


;// ./node_modules/@wordpress/icons/build-module/library/more-vertical.js


var more_vertical_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M13 19h-2v-2h2v2zm0-6h-2v-2h2v2zm0-6h-2V5h2v2z" }) });


;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/icon-with-current-color.js



function IconWithCurrentColor({ className, ...props }) {
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    external_wp_components_namespaceObject.Icon,
    {
      className: dist_clsx(
        className,
        "edit-site-global-styles-icon-with-current-color"
      ),
      ...props
    }
  );
}


;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/navigation-button.js



function GenericNavigationButton({ icon, children, ...props }) {
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalItem, { ...props, children: [
    icon && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "flex-start", children: [
      /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(IconWithCurrentColor, { icon, size: 24 }),
      /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children })
    ] }),
    !icon && children
  ] });
}
function NavigationButtonAsItem(props) {
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Navigator.Button, { as: GenericNavigationButton, ...props });
}
function NavigationBackButtonAsItem(props) {
  return /* @__PURE__ */ jsx(Navigator.BackButton, { as: GenericNavigationButton, ...props });
}


;// ./node_modules/@wordpress/icons/build-module/library/typography.js


var typography_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "m8.6 7 3.9 10.8h-1.7l-1-2.8H5.7l-1 2.8H3L6.9 7h1.7Zm-2.4 6.6h3L7.7 9.3l-1.5 4.3ZM17.691 8.879c.473 0 .88.055 1.221.165.352.1.643.264.875.495.274.253.456.572.544.957.088.374.132.83.132 1.37v4.554c0 .274.033.472.099.593.077.11.198.166.363.166.11 0 .215-.028.313-.083.11-.055.237-.137.38-.247l.165.28a3.304 3.304 0 0 1-.71.446c-.23.11-.527.165-.89.165-.352 0-.639-.055-.858-.165-.22-.11-.386-.27-.495-.479-.1-.209-.149-.468-.149-.775-.286.462-.627.814-1.023 1.056-.396.242-.858.363-1.386.363-.462 0-.858-.088-1.188-.264a1.752 1.752 0 0 1-.742-.726 2.201 2.201 0 0 1-.248-1.056c0-.484.11-.875.33-1.172.22-.308.5-.556.841-.742.352-.187.721-.341 1.106-.462.396-.132.765-.253 1.106-.363.351-.121.637-.259.857-.413.232-.154.347-.357.347-.61V10.81c0-.396-.066-.71-.198-.941a1.05 1.05 0 0 0-.511-.511 1.763 1.763 0 0 0-.76-.149c-.253 0-.522.039-.808.116a1.165 1.165 0 0 0-.677.412 1.1 1.1 0 0 1 .595.396c.165.187.247.424.247.71 0 .307-.104.55-.313.726-.198.176-.451.263-.76.263-.34 0-.594-.104-.758-.313a1.231 1.231 0 0 1-.248-.759c0-.297.072-.539.214-.726.154-.187.352-.363.595-.528.264-.176.6-.324 1.006-.445.418-.121.88-.182 1.386-.182Zm.99 3.729a1.57 1.57 0 0 1-.528.462c-.231.121-.479.248-.742.38a5.377 5.377 0 0 0-.76.462c-.23.165-.423.38-.577.643-.154.264-.231.6-.231 1.007 0 .429.11.77.33 1.023.22.242.517.363.891.363.308 0 .594-.088.858-.264.275-.176.528-.44.759-.792v-3.284Z" }) });


;// ./node_modules/@wordpress/icons/build-module/library/color.js


var color_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M17.2 10.9c-.5-1-1.2-2.1-2.1-3.2-.6-.9-1.3-1.7-2.1-2.6L12 4l-1 1.1c-.6.9-1.3 1.7-2 2.6-.8 1.2-1.5 2.3-2 3.2-.6 1.2-1 2.2-1 3 0 3.4 2.7 6.1 6.1 6.1s6.1-2.7 6.1-6.1c0-.8-.3-1.8-1-3zm-5.1 7.6c-2.5 0-4.6-2.1-4.6-4.6 0-.3.1-1 .8-2.3.5-.9 1.1-1.9 2-3.1.7-.9 1.3-1.7 1.8-2.3.7.8 1.3 1.6 1.8 2.3.8 1.1 1.5 2.2 2 3.1.7 1.3.8 2 .8 2.3 0 2.5-2.1 4.6-4.6 4.6z" }) });


;// ./node_modules/@wordpress/icons/build-module/library/background.js


var background_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
  external_wp_primitives_namespaceObject.Path,
  {
    fillRule: "evenodd",
    clipRule: "evenodd",
    d: "M11.53 4.47a.75.75 0 1 0-1.06 1.06l8 8a.75.75 0 1 0 1.06-1.06l-8-8Zm5 1a.75.75 0 1 0-1.06 1.06l2 2a.75.75 0 1 0 1.06-1.06l-2-2Zm-11.06 10a.75.75 0 0 1 1.06 0l2 2a.75.75 0 1 1-1.06 1.06l-2-2a.75.75 0 0 1 0-1.06Zm.06-5a.75.75 0 0 0-1.06 1.06l8 8a.75.75 0 1 0 1.06-1.06l-8-8Zm-.06-3a.75.75 0 0 1 1.06 0l10 10a.75.75 0 1 1-1.06 1.06l-10-10a.75.75 0 0 1 0-1.06Zm3.06-2a.75.75 0 0 0-1.06 1.06l10 10a.75.75 0 1 0 1.06-1.06l-10-10Z"
  }
) });


;// ./node_modules/@wordpress/icons/build-module/library/shadow.js


var shadow_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M12 8c-2.2 0-4 1.8-4 4s1.8 4 4 4 4-1.8 4-4-1.8-4-4-4zm0 6.5c-1.4 0-2.5-1.1-2.5-2.5s1.1-2.5 2.5-2.5 2.5 1.1 2.5 2.5-1.1 2.5-2.5 2.5zM12.8 3h-1.5v3h1.5V3zm-1.6 18h1.5v-3h-1.5v3zm6.8-9.8v1.5h3v-1.5h-3zm-12 0H3v1.5h3v-1.5zm9.7 5.6 2.1 2.1 1.1-1.1-2.1-2.1-1.1 1.1zM8.3 7.2 6.2 5.1 5.1 6.2l2.1 2.1 1.1-1.1zM5.1 17.8l1.1 1.1 2.1-2.1-1.1-1.1-2.1 2.1zM18.9 6.2l-1.1-1.1-2.1 2.1 1.1 1.1 2.1-2.1z" }) });


;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/root-menu.js







const {
  useHasDimensionsPanel,
  useHasTypographyPanel,
  useHasColorPanel,
  useGlobalSetting: root_menu_useGlobalSetting,
  useSettingsForBlockElement,
  useHasBackgroundPanel
} = unlock(external_wp_blockEditor_namespaceObject.privateApis);
function RootMenu() {
  const [rawSettings] = root_menu_useGlobalSetting("");
  const settings = useSettingsForBlockElement(rawSettings);
  const hasBackgroundPanel = useHasBackgroundPanel(rawSettings);
  const hasTypographyPanel = useHasTypographyPanel(settings);
  const hasColorPanel = useHasColorPanel(settings);
  const hasShadowPanel = true;
  const hasDimensionsPanel = useHasDimensionsPanel(settings);
  const hasLayoutPanel = hasDimensionsPanel;
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalItemGroup, { children: [
    hasTypographyPanel && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
      NavigationButtonAsItem,
      {
        icon: typography_default,
        path: "/typography",
        children: (0,external_wp_i18n_namespaceObject.__)("Typography")
      }
    ),
    hasColorPanel && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigationButtonAsItem, { icon: color_default, path: "/colors", children: (0,external_wp_i18n_namespaceObject.__)("Colors") }),
    hasBackgroundPanel && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
      NavigationButtonAsItem,
      {
        icon: background_default,
        path: "/background",
        "aria-label": (0,external_wp_i18n_namespaceObject.__)("Background styles"),
        children: (0,external_wp_i18n_namespaceObject.__)("Background")
      }
    ),
    hasShadowPanel && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigationButtonAsItem, { icon: shadow_default, path: "/shadows", children: (0,external_wp_i18n_namespaceObject.__)("Shadows") }),
    hasLayoutPanel && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigationButtonAsItem, { icon: layout_default, path: "/layout", children: (0,external_wp_i18n_namespaceObject.__)("Layout") })
  ] }) });
}
var root_menu_default = RootMenu;


;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/utils/preview-styles.js
function findNearest(input, numbers) {
  if (numbers.length === 0) {
    return null;
  }
  numbers.sort((a, b) => Math.abs(input - a) - Math.abs(input - b));
  return numbers[0];
}
function extractFontWeights(fontFaces) {
  const result = [];
  fontFaces.forEach((face) => {
    const weights = String(face.fontWeight).split(" ");
    if (weights.length === 2) {
      const start = parseInt(weights[0]);
      const end = parseInt(weights[1]);
      for (let i = start; i <= end; i += 100) {
        result.push(i);
      }
    } else if (weights.length === 1) {
      result.push(parseInt(weights[0]));
    }
  });
  return result;
}
function formatFontFamily(input) {
  const regex = /^(?!generic\([ a-zA-Z\-]+\)$)(?!^[a-zA-Z\-]+$).+/;
  const output = input.trim();
  const formatItem = (item) => {
    item = item.trim();
    if (item.match(regex)) {
      item = item.replace(/^["']|["']$/g, "");
      return `"${item}"`;
    }
    return item;
  };
  if (output.includes(",")) {
    return output.split(",").map(formatItem).filter((item) => item !== "").join(", ");
  }
  return formatItem(output);
}
function formatFontFaceName(input) {
  if (!input) {
    return "";
  }
  let output = input.trim();
  if (output.includes(",")) {
    output = output.split(",").find((item) => item.trim() !== "").trim();
  }
  output = output.replace(/^["']|["']$/g, "");
  if (window.navigator.userAgent.toLowerCase().includes("firefox")) {
    output = `"${output}"`;
  }
  return output;
}
function getFamilyPreviewStyle(family) {
  const style = { fontFamily: formatFontFamily(family.fontFamily) };
  if (!Array.isArray(family.fontFace)) {
    style.fontWeight = "400";
    style.fontStyle = "normal";
    return style;
  }
  if (family.fontFace) {
    const normalFaces = family.fontFace.filter(
      (face) => face?.fontStyle && face.fontStyle.toLowerCase() === "normal"
    );
    if (normalFaces.length > 0) {
      style.fontStyle = "normal";
      const normalWeights = extractFontWeights(normalFaces);
      const nearestWeight = findNearest(400, normalWeights);
      style.fontWeight = String(nearestWeight) || "400";
    } else {
      style.fontStyle = family.fontFace.length && family.fontFace[0].fontStyle || "normal";
      style.fontWeight = family.fontFace.length && String(family.fontFace[0].fontWeight) || "400";
    }
  }
  return style;
}
function getFacePreviewStyle(face) {
  return {
    fontFamily: formatFontFamily(face.fontFamily),
    fontStyle: face.fontStyle || "normal",
    fontWeight: face.fontWeight || "400"
  };
}


;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/utils.js
function getVariationClassName(variation) {
  if (!variation) {
    return "";
  }
  return `is-style-${variation}`;
}
function getNewIndexFromPresets(presets, slugPrefix) {
  const nameRegex = new RegExp(`^${slugPrefix}([\\d]+)$`);
  const highestPresetValue = presets.reduce((currentHighest, preset) => {
    if (typeof preset?.slug === "string") {
      const matches = preset?.slug.match(nameRegex);
      if (matches) {
        const id = parseInt(matches[1], 10);
        if (id > currentHighest) {
          return id;
        }
      }
    }
    return currentHighest;
  }, 0);
  return highestPresetValue + 1;
}
function getFontFamilyFromSetting(fontFamilies, setting) {
  if (!Array.isArray(fontFamilies) || !setting) {
    return null;
  }
  const fontFamilyVariable = setting.replace("var(", "").replace(")", "");
  const fontFamilySlug = fontFamilyVariable?.split("--").slice(-1)[0];
  return fontFamilies.find(
    (fontFamily) => fontFamily.slug === fontFamilySlug
  );
}
function getFontFamilies(themeJson) {
  const themeFontFamilies = themeJson?.settings?.typography?.fontFamilies?.theme;
  const customFontFamilies = themeJson?.settings?.typography?.fontFamilies?.custom;
  let fontFamilies = [];
  if (themeFontFamilies && customFontFamilies) {
    fontFamilies = [...themeFontFamilies, ...customFontFamilies];
  } else if (themeFontFamilies) {
    fontFamilies = themeFontFamilies;
  } else if (customFontFamilies) {
    fontFamilies = customFontFamilies;
  }
  const bodyFontFamilySetting = themeJson?.styles?.typography?.fontFamily;
  const bodyFontFamily = getFontFamilyFromSetting(
    fontFamilies,
    bodyFontFamilySetting
  );
  const headingFontFamilySetting = themeJson?.styles?.elements?.heading?.typography?.fontFamily;
  let headingFontFamily;
  if (!headingFontFamilySetting) {
    headingFontFamily = bodyFontFamily;
  } else {
    headingFontFamily = getFontFamilyFromSetting(
      fontFamilies,
      themeJson?.styles?.elements?.heading?.typography?.fontFamily
    );
  }
  return [bodyFontFamily, headingFontFamily];
}


;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/typography-example.js









const { useGlobalStyle: typography_example_useGlobalStyle, GlobalStylesContext: typography_example_GlobalStylesContext } = unlock(
  external_wp_blockEditor_namespaceObject.privateApis
);
const { mergeBaseAndUserConfigs } = unlock(external_wp_editor_namespaceObject.privateApis);
function PreviewTypography({ fontSize, variation }) {
  const { base } = (0,external_wp_element_.useContext)(typography_example_GlobalStylesContext);
  let config = base;
  if (variation) {
    config = mergeBaseAndUserConfigs(base, variation);
  }
  const [textColor] = typography_example_useGlobalStyle("color.text");
  const [bodyFontFamilies, headingFontFamilies] = getFontFamilies(config);
  const bodyPreviewStyle = bodyFontFamilies ? getFamilyPreviewStyle(bodyFontFamilies) : {};
  const headingPreviewStyle = headingFontFamilies ? getFamilyPreviewStyle(headingFontFamilies) : {};
  if (textColor) {
    bodyPreviewStyle.color = textColor;
    headingPreviewStyle.color = textColor;
  }
  if (fontSize) {
    bodyPreviewStyle.fontSize = fontSize;
    headingPreviewStyle.fontSize = fontSize;
  }
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
    external_wp_components_namespaceObject.__unstableMotion.div,
    {
      animate: {
        scale: 1,
        opacity: 1
      },
      initial: {
        scale: 0.1,
        opacity: 0
      },
      transition: {
        delay: 0.3,
        type: "tween"
      },
      style: {
        textAlign: "center",
        lineHeight: 1
      },
      children: [
        /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { style: headingPreviewStyle, children: (0,external_wp_i18n_namespaceObject._x)("A", "Uppercase letter A") }),
        /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { style: bodyPreviewStyle, children: (0,external_wp_i18n_namespaceObject._x)("a", "Lowercase letter A") })
      ]
    }
  );
}


;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/highlighted-colors.js



function HighlightedColors({
  normalizedColorSwatchSize,
  ratio
}) {
  const { highlightedColors } = useStylesPreviewColors();
  const scaledSwatchSize = normalizedColorSwatchSize * ratio;
  return highlightedColors.map(({ slug, color }, index) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    external_wp_components_namespaceObject.__unstableMotion.div,
    {
      style: {
        height: scaledSwatchSize,
        width: scaledSwatchSize,
        background: color,
        borderRadius: scaledSwatchSize / 2
      },
      animate: {
        scale: 1,
        opacity: 1
      },
      initial: {
        scale: 0.1,
        opacity: 0
      },
      transition: {
        delay: index === 1 ? 0.2 : 0.1
      }
    },
    `${slug}-${index}`
  ));
}


;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/preview-wrapper.js






const { useGlobalStyle: preview_wrapper_useGlobalStyle } = unlock(external_wp_blockEditor_namespaceObject.privateApis);
const normalizedWidth = 248;
const normalizedHeight = 152;
const THROTTLE_OPTIONS = {
  leading: true,
  trailing: true
};
function PreviewWrapper({
  children,
  label,
  isFocused,
  withHoverView
}) {
  const [backgroundColor = "white"] = preview_wrapper_useGlobalStyle("color.background");
  const [gradientValue] = preview_wrapper_useGlobalStyle("color.gradient");
  const disableMotion = (0,external_wp_compose_namespaceObject.useReducedMotion)();
  const [isHovered, setIsHovered] = (0,external_wp_element_.useState)(false);
  const [containerResizeListener, { width }] = (0,external_wp_compose_namespaceObject.useResizeObserver)();
  const [throttledWidth, setThrottledWidthState] = (0,external_wp_element_.useState)(width);
  const [ratioState, setRatioState] = (0,external_wp_element_.useState)();
  const setThrottledWidth = (0,external_wp_compose_namespaceObject.useThrottle)(
    setThrottledWidthState,
    250,
    THROTTLE_OPTIONS
  );
  (0,external_wp_element_.useLayoutEffect)(() => {
    if (width) {
      setThrottledWidth(width);
    }
  }, [width, setThrottledWidth]);
  (0,external_wp_element_.useLayoutEffect)(() => {
    const newRatio = throttledWidth ? throttledWidth / normalizedWidth : 1;
    const ratioDiff = newRatio - (ratioState || 0);
    const isRatioDiffBigEnough = Math.abs(ratioDiff) > 0.1;
    if (isRatioDiffBigEnough || !ratioState) {
      setRatioState(newRatio);
    }
  }, [throttledWidth, ratioState]);
  const fallbackRatio = width ? width / normalizedWidth : 1;
  const ratio = ratioState ? ratioState : fallbackRatio;
  const isReady = !!width;
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
    /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { style: { position: "relative" }, children: containerResizeListener }),
    isReady && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
      "div",
      {
        className: "edit-site-global-styles-preview__wrapper",
        style: {
          height: normalizedHeight * ratio
        },
        onMouseEnter: () => setIsHovered(true),
        onMouseLeave: () => setIsHovered(false),
        tabIndex: -1,
        children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
          external_wp_components_namespaceObject.__unstableMotion.div,
          {
            style: {
              height: normalizedHeight * ratio,
              width: "100%",
              background: gradientValue ?? backgroundColor,
              cursor: withHoverView ? "pointer" : void 0
            },
            initial: "start",
            animate: (isHovered || isFocused) && !disableMotion && label ? "hover" : "start",
            children: [].concat(children).map((child, key) => child({ ratio, key }))
          }
        )
      }
    )
  ] });
}


;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/preview-styles.js








const { useGlobalStyle: preview_styles_useGlobalStyle } = unlock(external_wp_blockEditor_namespaceObject.privateApis);
const firstFrameVariants = {
  start: {
    scale: 1,
    opacity: 1
  },
  hover: {
    scale: 0,
    opacity: 0
  }
};
const midFrameVariants = {
  hover: {
    opacity: 1
  },
  start: {
    opacity: 0.5
  }
};
const secondFrameVariants = {
  hover: {
    scale: 1,
    opacity: 1
  },
  start: {
    scale: 0,
    opacity: 0
  }
};
const PreviewStyles = ({ label, isFocused, withHoverView, variation }) => {
  const [fontWeight] = preview_styles_useGlobalStyle("typography.fontWeight");
  const [fontFamily = "serif"] = preview_styles_useGlobalStyle("typography.fontFamily");
  const [headingFontFamily = fontFamily] = preview_styles_useGlobalStyle(
    "elements.h1.typography.fontFamily"
  );
  const [headingFontWeight = fontWeight] = preview_styles_useGlobalStyle(
    "elements.h1.typography.fontWeight"
  );
  const [textColor = "black"] = preview_styles_useGlobalStyle("color.text");
  const [headingColor = textColor] = preview_styles_useGlobalStyle(
    "elements.h1.color.text"
  );
  const { paletteColors } = useStylesPreviewColors();
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
    PreviewWrapper,
    {
      label,
      isFocused,
      withHoverView,
      children: [
        ({ ratio, key }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
          external_wp_components_namespaceObject.__unstableMotion.div,
          {
            variants: firstFrameVariants,
            style: {
              height: "100%",
              overflow: "hidden"
            },
            children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
              external_wp_components_namespaceObject.__experimentalHStack,
              {
                spacing: 10 * ratio,
                justify: "center",
                style: {
                  height: "100%",
                  overflow: "hidden"
                },
                children: [
                  /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
                    PreviewTypography,
                    {
                      fontSize: 65 * ratio,
                      variation
                    }
                  ),
                  /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 4 * ratio, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
                    HighlightedColors,
                    {
                      normalizedColorSwatchSize: 32,
                      ratio
                    }
                  ) })
                ]
              }
            )
          },
          key
        ),
        ({ key }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
          external_wp_components_namespaceObject.__unstableMotion.div,
          {
            variants: withHoverView && midFrameVariants,
            style: {
              height: "100%",
              width: "100%",
              position: "absolute",
              top: 0,
              overflow: "hidden",
              filter: "blur(60px)",
              opacity: 0.1
            },
            children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
              external_wp_components_namespaceObject.__experimentalHStack,
              {
                spacing: 0,
                justify: "flex-start",
                style: {
                  height: "100%",
                  overflow: "hidden"
                },
                children: paletteColors.slice(0, 4).map(({ color }, index) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
                  "div",
                  {
                    style: {
                      height: "100%",
                      background: color,
                      flexGrow: 1
                    }
                  },
                  index
                ))
              }
            )
          },
          key
        ),
        ({ ratio, key }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
          external_wp_components_namespaceObject.__unstableMotion.div,
          {
            variants: secondFrameVariants,
            style: {
              height: "100%",
              width: "100%",
              overflow: "hidden",
              position: "absolute",
              top: 0
            },
            children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
              external_wp_components_namespaceObject.__experimentalVStack,
              {
                spacing: 3 * ratio,
                justify: "center",
                style: {
                  height: "100%",
                  overflow: "hidden",
                  padding: 10 * ratio,
                  boxSizing: "border-box"
                },
                children: label && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
                  "div",
                  {
                    style: {
                      fontSize: 40 * ratio,
                      fontFamily: headingFontFamily,
                      color: headingColor,
                      fontWeight: headingFontWeight,
                      lineHeight: "1em",
                      textAlign: "center"
                    },
                    children: label
                  }
                )
              }
            )
          },
          key
        )
      ]
    }
  );
};
var preview_styles_default = PreviewStyles;


;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-root.js










function ScreenRoot() {
  const hasVariations = (0,external_wp_data_.useSelect)((select) => {
    const { __experimentalGetCurrentThemeGlobalStylesVariations } = select(external_wp_coreData_namespaceObject.store);
    return !!__experimentalGetCurrentThemeGlobalStylesVariations()?.length;
  }, []);
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
    external_wp_components_namespaceObject.Card,
    {
      size: "small",
      isBorderless: true,
      className: "edit-site-global-styles-screen-root",
      isRounded: false,
      children: [
        /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.CardBody, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 4, children: [
          /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Card, { className: "edit-site-global-styles-screen-root__active-style-tile", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.CardMedia, { className: "edit-site-global-styles-screen-root__active-style-tile-preview", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(preview_styles_default, {}) }) }),
          hasVariations && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItemGroup, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigationButtonAsItem, { path: "/variations", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "space-between", children: [
            /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: (0,external_wp_i18n_namespaceObject.__)("Browse styles") }),
            /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
              IconWithCurrentColor,
              {
                icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left_default : chevron_right_default
              }
            )
          ] }) }) }),
          /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(root_menu_default, {})
        ] }) }),
        /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.CardDivider, {}),
        /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.CardBody, { children: [
          /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
            external_wp_components_namespaceObject.__experimentalSpacer,
            {
              as: "p",
              paddingTop: 2,
              paddingX: "13px",
              marginBottom: 2,
              children: (0,external_wp_i18n_namespaceObject.__)(
                "Customize the appearance of specific blocks for the whole site."
              )
            }
          ),
          /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItemGroup, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigationButtonAsItem, { path: "/blocks", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "space-between", children: [
            /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: (0,external_wp_i18n_namespaceObject.__)("Blocks") }),
            /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
              IconWithCurrentColor,
              {
                icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left_default : chevron_right_default
              }
            )
          ] }) }) })
        ] })
      ]
    }
  );
}
var screen_root_default = ScreenRoot;


;// external ["wp","a11y"]
const external_wp_a11y_namespaceObject = window["wp"]["a11y"];
;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/variations/variations-panel.js







const { useGlobalStyle: variations_panel_useGlobalStyle } = unlock(external_wp_blockEditor_namespaceObject.privateApis);
function getFilteredBlockStyles(blockStyles, variations) {
  return blockStyles?.filter(
    (style) => style.source === "block" || variations.includes(style.name)
  );
}
function useBlockVariations(name) {
  const blockStyles = (0,external_wp_data_.useSelect)(
    (select) => {
      const { getBlockStyles } = select(external_wp_blocks_namespaceObject.store);
      return getBlockStyles(name);
    },
    [name]
  );
  const [variations] = variations_panel_useGlobalStyle("variations", name);
  const variationNames = Object.keys(variations ?? {});
  return getFilteredBlockStyles(blockStyles, variationNames);
}
function VariationsPanel({ name }) {
  const coreBlockStyles = useBlockVariations(name);
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItemGroup, { isBordered: true, isSeparated: true, children: coreBlockStyles.map((style, index) => {
    if (style?.isDefault) {
      return null;
    }
    return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
      NavigationButtonAsItem,
      {
        path: "/blocks/" + encodeURIComponent(name) + "/variations/" + encodeURIComponent(style.name),
        children: style.label
      },
      index
    );
  }) });
}


;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/header.js




function ScreenHeader({ title, description, onBack }) {
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 0, children: [
    /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalView, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { marginBottom: 0, paddingX: 4, paddingY: 3, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { spacing: 2, children: [
      /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
        external_wp_components_namespaceObject.Navigator.BackButton,
        {
          icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_right_default : chevron_left_default,
          size: "small",
          label: (0,external_wp_i18n_namespaceObject.__)("Back"),
          onClick: onBack
        }
      ),
      /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
        external_wp_components_namespaceObject.__experimentalHeading,
        {
          className: "edit-site-global-styles-header",
          level: 2,
          size: 13,
          children: title
        }
      ) })
    ] }) }) }),
    description && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { className: "edit-site-global-styles-header__description", children: description })
  ] });
}
var header_default = ScreenHeader;


;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-block-list.js













const {
  useHasDimensionsPanel: screen_block_list_useHasDimensionsPanel,
  useHasTypographyPanel: screen_block_list_useHasTypographyPanel,
  useHasBorderPanel,
  useGlobalSetting: screen_block_list_useGlobalSetting,
  useSettingsForBlockElement: screen_block_list_useSettingsForBlockElement,
  useHasColorPanel: screen_block_list_useHasColorPanel
} = unlock(external_wp_blockEditor_namespaceObject.privateApis);
function useSortedBlockTypes() {
  const blockItems = (0,external_wp_data_.useSelect)(
    (select) => select(external_wp_blocks_namespaceObject.store).getBlockTypes(),
    []
  );
  const groupByType = (blocks, block) => {
    const { core, noncore } = blocks;
    const type = block.name.startsWith("core/") ? core : noncore;
    type.push(block);
    return blocks;
  };
  const { core: coreItems, noncore: nonCoreItems } = blockItems.reduce(
    groupByType,
    { core: [], noncore: [] }
  );
  return [...coreItems, ...nonCoreItems];
}
function useBlockHasGlobalStyles(blockName) {
  const [rawSettings] = screen_block_list_useGlobalSetting("", blockName);
  const settings = screen_block_list_useSettingsForBlockElement(rawSettings, blockName);
  const hasTypographyPanel = screen_block_list_useHasTypographyPanel(settings);
  const hasColorPanel = screen_block_list_useHasColorPanel(settings);
  const hasBorderPanel = useHasBorderPanel(settings);
  const hasDimensionsPanel = screen_block_list_useHasDimensionsPanel(settings);
  const hasLayoutPanel = hasBorderPanel || hasDimensionsPanel;
  const hasVariationsPanel = !!useBlockVariations(blockName)?.length;
  const hasGlobalStyles = hasTypographyPanel || hasColorPanel || hasLayoutPanel || hasVariationsPanel;
  return hasGlobalStyles;
}
function BlockMenuItem({ block }) {
  const hasBlockMenuItem = useBlockHasGlobalStyles(block.name);
  if (!hasBlockMenuItem) {
    return null;
  }
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    NavigationButtonAsItem,
    {
      path: "/blocks/" + encodeURIComponent(block.name),
      children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "flex-start", children: [
        /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockIcon, { icon: block.icon }),
        /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: block.title })
      ] })
    }
  );
}
function BlockList({ filterValue }) {
  const sortedBlockTypes = useSortedBlockTypes();
  const debouncedSpeak = (0,external_wp_compose_namespaceObject.useDebounce)(external_wp_a11y_namespaceObject.speak, 500);
  const { isMatchingSearchTerm } = (0,external_wp_data_.useSelect)(external_wp_blocks_namespaceObject.store);
  const filteredBlockTypes = !filterValue ? sortedBlockTypes : sortedBlockTypes.filter(
    (blockType) => isMatchingSearchTerm(blockType, filterValue)
  );
  const blockTypesListRef = (0,external_wp_element_.useRef)();
  (0,external_wp_element_.useEffect)(() => {
    if (!filterValue) {
      return;
    }
    const count = blockTypesListRef.current.childElementCount;
    const resultsFoundMessage = (0,external_wp_i18n_namespaceObject.sprintf)(
      /* translators: %d: number of results. */
      (0,external_wp_i18n_namespaceObject._n)("%d result found.", "%d results found.", count),
      count
    );
    debouncedSpeak(resultsFoundMessage, count);
  }, [filterValue, debouncedSpeak]);
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    "div",
    {
      ref: blockTypesListRef,
      className: "edit-site-block-types-item-list",
      role: "list",
      children: filteredBlockTypes.length === 0 ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { align: "center", as: "p", children: (0,external_wp_i18n_namespaceObject.__)("No blocks found.") }) : filteredBlockTypes.map((block) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
        BlockMenuItem,
        {
          block
        },
        "menu-itemblock-" + block.name
      ))
    }
  );
}
const MemoizedBlockList = (0,external_wp_element_.memo)(BlockList);
function ScreenBlockList() {
  const [filterValue, setFilterValue] = (0,external_wp_element_.useState)("");
  const deferredFilterValue = (0,external_wp_element_.useDeferredValue)(filterValue);
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
    /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
      header_default,
      {
        title: (0,external_wp_i18n_namespaceObject.__)("Blocks"),
        description: (0,external_wp_i18n_namespaceObject.__)(
          "Customize the appearance of specific blocks and for the whole site."
        )
      }
    ),
    /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
      external_wp_components_namespaceObject.SearchControl,
      {
        __nextHasNoMarginBottom: true,
        className: "edit-site-block-types-search",
        onChange: setFilterValue,
        value: filterValue,
        label: (0,external_wp_i18n_namespaceObject.__)("Search"),
        placeholder: (0,external_wp_i18n_namespaceObject.__)("Search")
      }
    ),
    /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(MemoizedBlockList, { filterValue: deferredFilterValue })
  ] });
}
var screen_block_list_default = ScreenBlockList;


;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/block-preview-panel.js






const BlockPreviewPanel = ({ name, variation = "" }) => {
  const blockExample = (0,external_wp_blocks_namespaceObject.getBlockType)(name)?.example;
  const blocks = (0,external_wp_element_.useMemo)(() => {
    if (!blockExample) {
      return null;
    }
    const example = {
      ...blockExample,
      attributes: {
        ...blockExample.attributes,
        style: void 0,
        className: variation ? getVariationClassName(variation) : blockExample.attributes?.className
      }
    };
    return (0,external_wp_blocks_namespaceObject.getBlockFromExample)(name, example);
  }, [name, blockExample, variation]);
  const viewportWidth = blockExample?.viewportWidth ?? 500;
  const previewHeight = 144;
  const sidebarWidth = 235;
  const scale = sidebarWidth / viewportWidth;
  const minHeight = scale !== 0 && scale < 1 && previewHeight ? previewHeight / scale : previewHeight;
  if (!blockExample) {
    return null;
  }
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { marginX: 4, marginBottom: 4, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    "div",
    {
      className: "edit-site-global-styles__block-preview-panel",
      style: { maxHeight: previewHeight, boxSizing: "initial" },
      children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
        external_wp_blockEditor_namespaceObject.BlockPreview,
        {
          blocks,
          viewportWidth,
          minHeight: previewHeight,
          additionalStyles: (
            //We want this CSS to be in sync with the one in InserterPreviewPanel.
            [
              {
                css: `
								body{
									padding: 24px;
									min-height:${Math.round(minHeight)}px;
									display:flex;
									align-items:center;
								}
								.is-root-container { width: 100%; }
							`
              }
            ]
          )
        }
      )
    }
  ) });
};
var block_preview_panel_default = BlockPreviewPanel;


;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/subtitle.js


function Subtitle({ children, level }) {
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    external_wp_components_namespaceObject.__experimentalHeading,
    {
      className: "edit-site-global-styles-subtitle",
      level: level ?? 2,
      children
    }
  );
}
var subtitle_default = Subtitle;


;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-block.js













const BACKGROUND_BLOCK_DEFAULT_VALUES = {
  backgroundSize: "cover",
  backgroundPosition: "50% 50%"
  // used only when backgroundSize is 'contain'.
};
function applyFallbackStyle(border) {
  if (!border) {
    return border;
  }
  const hasColorOrWidth = border.color || border.width;
  if (!border.style && hasColorOrWidth) {
    return { ...border, style: "solid" };
  }
  if (border.style && !hasColorOrWidth) {
    return void 0;
  }
  return border;
}
function applyAllFallbackStyles(border) {
  if (!border) {
    return border;
  }
  if ((0,external_wp_components_namespaceObject.__experimentalHasSplitBorders)(border)) {
    return {
      top: applyFallbackStyle(border.top),
      right: applyFallbackStyle(border.right),
      bottom: applyFallbackStyle(border.bottom),
      left: applyFallbackStyle(border.left)
    };
  }
  return applyFallbackStyle(border);
}
const {
  useHasDimensionsPanel: screen_block_useHasDimensionsPanel,
  useHasTypographyPanel: screen_block_useHasTypographyPanel,
  useHasBorderPanel: screen_block_useHasBorderPanel,
  useGlobalSetting: screen_block_useGlobalSetting,
  useSettingsForBlockElement: screen_block_useSettingsForBlockElement,
  useHasColorPanel: screen_block_useHasColorPanel,
  useHasFiltersPanel,
  useHasImageSettingsPanel,
  useGlobalStyle: screen_block_useGlobalStyle,
  useHasBackgroundPanel: screen_block_useHasBackgroundPanel,
  BackgroundPanel: StylesBackgroundPanel,
  BorderPanel: StylesBorderPanel,
  ColorPanel: StylesColorPanel,
  TypographyPanel: StylesTypographyPanel,
  DimensionsPanel: StylesDimensionsPanel,
  FiltersPanel: StylesFiltersPanel,
  ImageSettingsPanel,
  AdvancedPanel: StylesAdvancedPanel
} = unlock(external_wp_blockEditor_namespaceObject.privateApis);
function ScreenBlock({ name, variation }) {
  let prefixParts = [];
  if (variation) {
    prefixParts = ["variations", variation].concat(prefixParts);
  }
  const prefix = prefixParts.join(".");
  const [style] = screen_block_useGlobalStyle(prefix, name, "user", {
    shouldDecodeEncode: false
  });
  const [inheritedStyle, setStyle] = screen_block_useGlobalStyle(prefix, name, "all", {
    shouldDecodeEncode: false
  });
  const [userSettings] = screen_block_useGlobalSetting("", name, "user");
  const [rawSettings, setSettings] = screen_block_useGlobalSetting("", name);
  const settingsForBlockElement = screen_block_useSettingsForBlockElement(
    rawSettings,
    name
  );
  const blockType = (0,external_wp_blocks_namespaceObject.getBlockType)(name);
  let disableBlockGap = false;
  if (settingsForBlockElement?.spacing?.blockGap && blockType?.supports?.spacing?.blockGap && (blockType?.supports?.spacing?.__experimentalSkipSerialization === true || blockType?.supports?.spacing?.__experimentalSkipSerialization?.some?.(
    (spacingType) => spacingType === "blockGap"
  ))) {
    disableBlockGap = true;
  }
  let disableAspectRatio = false;
  if (settingsForBlockElement?.dimensions?.aspectRatio && name === "core/group") {
    disableAspectRatio = true;
  }
  const settings = (0,external_wp_element_.useMemo)(() => {
    const updatedSettings = structuredClone(settingsForBlockElement);
    if (disableBlockGap) {
      updatedSettings.spacing.blockGap = false;
    }
    if (disableAspectRatio) {
      updatedSettings.dimensions.aspectRatio = false;
    }
    return updatedSettings;
  }, [settingsForBlockElement, disableBlockGap, disableAspectRatio]);
  const blockVariations = useBlockVariations(name);
  const hasBackgroundPanel = screen_block_useHasBackgroundPanel(settings);
  const hasTypographyPanel = screen_block_useHasTypographyPanel(settings);
  const hasColorPanel = screen_block_useHasColorPanel(settings);
  const hasBorderPanel = screen_block_useHasBorderPanel(settings);
  const hasDimensionsPanel = screen_block_useHasDimensionsPanel(settings);
  const hasFiltersPanel = useHasFiltersPanel(settings);
  const hasImageSettingsPanel = useHasImageSettingsPanel(
    name,
    userSettings,
    settings
  );
  const hasVariationsPanel = !!blockVariations?.length && !variation;
  const { canEditCSS } = (0,external_wp_data_.useSelect)((select) => {
    const { getEntityRecord, __experimentalGetCurrentGlobalStylesId } = select(external_wp_coreData_namespaceObject.store);
    const globalStylesId = __experimentalGetCurrentGlobalStylesId();
    const globalStyles = globalStylesId ? getEntityRecord("root", "globalStyles", globalStylesId) : void 0;
    return {
      canEditCSS: !!globalStyles?._links?.["wp:action-edit-css"]
    };
  }, []);
  const currentBlockStyle = variation ? blockVariations.find((s) => s.name === variation) : null;
  const inheritedStyleWithLayout = (0,external_wp_element_.useMemo)(() => {
    return {
      ...inheritedStyle,
      layout: settings.layout
    };
  }, [inheritedStyle, settings.layout]);
  const styleWithLayout = (0,external_wp_element_.useMemo)(() => {
    return {
      ...style,
      layout: userSettings.layout
    };
  }, [style, userSettings.layout]);
  const onChangeDimensions = (newStyle) => {
    const updatedStyle = { ...newStyle };
    delete updatedStyle.layout;
    setStyle(updatedStyle);
    if (newStyle.layout !== userSettings.layout) {
      setSettings({
        ...userSettings,
        layout: newStyle.layout
      });
    }
  };
  const onChangeLightbox = (newSetting) => {
    if (newSetting === void 0) {
      setSettings({
        ...rawSettings,
        lightbox: void 0
      });
    } else {
      setSettings({
        ...rawSettings,
        lightbox: {
          ...rawSettings.lightbox,
          ...newSetting
        }
      });
    }
  };
  const onChangeBorders = (newStyle) => {
    if (!newStyle?.border) {
      setStyle(newStyle);
      return;
    }
    const { radius, ...newBorder } = newStyle.border;
    const border = applyAllFallbackStyles(newBorder);
    const updatedBorder = !(0,external_wp_components_namespaceObject.__experimentalHasSplitBorders)(border) ? {
      top: border,
      right: border,
      bottom: border,
      left: border
    } : {
      color: null,
      style: null,
      width: null,
      ...border
    };
    setStyle({ ...newStyle, border: { ...updatedBorder, radius } });
  };
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
    /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
      header_default,
      {
        title: variation ? currentBlockStyle?.label : blockType.title
      }
    ),
    /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(block_preview_panel_default, { name, variation }),
    hasVariationsPanel && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "edit-site-global-styles-screen-variations", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 3, children: [
      /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(subtitle_default, { children: (0,external_wp_i18n_namespaceObject.__)("Style Variations") }),
      /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(VariationsPanel, { name })
    ] }) }),
    hasColorPanel && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
      StylesColorPanel,
      {
        inheritedValue: inheritedStyle,
        value: style,
        onChange: setStyle,
        settings
      }
    ),
    hasBackgroundPanel && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
      StylesBackgroundPanel,
      {
        inheritedValue: inheritedStyle,
        value: style,
        onChange: setStyle,
        settings,
        defaultValues: BACKGROUND_BLOCK_DEFAULT_VALUES
      }
    ),
    hasTypographyPanel && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
      StylesTypographyPanel,
      {
        inheritedValue: inheritedStyle,
        value: style,
        onChange: setStyle,
        settings
      }
    ),
    hasDimensionsPanel && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
      StylesDimensionsPanel,
      {
        inheritedValue: inheritedStyleWithLayout,
        value: styleWithLayout,
        onChange: onChangeDimensions,
        settings,
        includeLayoutControls: true
      }
    ),
    hasBorderPanel && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
      StylesBorderPanel,
      {
        inheritedValue: inheritedStyle,
        value: style,
        onChange: onChangeBorders,
        settings
      }
    ),
    hasFiltersPanel && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
      StylesFiltersPanel,
      {
        inheritedValue: inheritedStyleWithLayout,
        value: styleWithLayout,
        onChange: setStyle,
        settings,
        includeLayoutControls: true
      }
    ),
    hasImageSettingsPanel && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
      ImageSettingsPanel,
      {
        onChange: onChangeLightbox,
        value: userSettings,
        inheritedValue: settings
      }
    ),
    canEditCSS && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.PanelBody, { title: (0,external_wp_i18n_namespaceObject.__)("Advanced"), initialOpen: false, children: [
      /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { children: (0,external_wp_i18n_namespaceObject.sprintf)(
        // translators: %s: is the name of a block e.g., 'Image' or 'Table'.
        (0,external_wp_i18n_namespaceObject.__)(
          "Add your own CSS to customize the appearance of the %s block. You do not need to include a CSS selector, just add the property and value."
        ),
        blockType?.title
      ) }),
      /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
        StylesAdvancedPanel,
        {
          value: style,
          onChange: setStyle,
          inheritedValue: inheritedStyle
        }
      )
    ] })
  ] });
}
var screen_block_default = ScreenBlock;


;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/typography-elements.js







const { useGlobalStyle: typography_elements_useGlobalStyle } = unlock(external_wp_blockEditor_namespaceObject.privateApis);
function ElementItem({ parentMenu, element, label }) {
  const prefix = element === "text" || !element ? "" : `elements.${element}.`;
  const extraStyles = element === "link" ? {
    textDecoration: "underline"
  } : {};
  const [fontFamily] = typography_elements_useGlobalStyle(prefix + "typography.fontFamily");
  const [fontStyle] = typography_elements_useGlobalStyle(prefix + "typography.fontStyle");
  const [fontWeight] = typography_elements_useGlobalStyle(prefix + "typography.fontWeight");
  const [backgroundColor] = typography_elements_useGlobalStyle(prefix + "color.background");
  const [fallbackBackgroundColor] = typography_elements_useGlobalStyle("color.background");
  const [gradientValue] = typography_elements_useGlobalStyle(prefix + "color.gradient");
  const [color] = typography_elements_useGlobalStyle(prefix + "color.text");
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigationButtonAsItem, { path: parentMenu + "/typography/" + element, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "flex-start", children: [
    /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
      external_wp_components_namespaceObject.FlexItem,
      {
        className: "edit-site-global-styles-screen-typography__indicator",
        style: {
          fontFamily: fontFamily ?? "serif",
          background: gradientValue ?? backgroundColor ?? fallbackBackgroundColor,
          color,
          fontStyle,
          fontWeight,
          ...extraStyles
        },
        "aria-hidden": "true",
        children: (0,external_wp_i18n_namespaceObject.__)("Aa")
      }
    ),
    /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: label })
  ] }) });
}
function TypographyElements() {
  const parentMenu = "";
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 3, children: [
    /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(subtitle_default, { level: 3, children: (0,external_wp_i18n_namespaceObject.__)("Elements") }),
    /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalItemGroup, { isBordered: true, isSeparated: true, children: [
      /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
        ElementItem,
        {
          parentMenu,
          element: "text",
          label: (0,external_wp_i18n_namespaceObject.__)("Text")
        }
      ),
      /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
        ElementItem,
        {
          parentMenu,
          element: "link",
          label: (0,external_wp_i18n_namespaceObject.__)("Links")
        }
      ),
      /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
        ElementItem,
        {
          parentMenu,
          element: "heading",
          label: (0,external_wp_i18n_namespaceObject.__)("Headings")
        }
      ),
      /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
        ElementItem,
        {
          parentMenu,
          element: "caption",
          label: (0,external_wp_i18n_namespaceObject.__)("Captions")
        }
      ),
      /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
        ElementItem,
        {
          parentMenu,
          element: "button",
          label: (0,external_wp_i18n_namespaceObject.__)("Buttons")
        }
      )
    ] })
  ] });
}
var typography_elements_default = TypographyElements;


;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/preview-typography.js




const StylesPreviewTypography = ({ variation, isFocused, withHoverView }) => {
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    PreviewWrapper,
    {
      label: variation.title,
      isFocused,
      withHoverView,
      children: ({ ratio, key }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
        external_wp_components_namespaceObject.__experimentalHStack,
        {
          spacing: 10 * ratio,
          justify: "center",
          style: {
            height: "100%",
            overflow: "hidden"
          },
          children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
            PreviewTypography,
            {
              variation,
              fontSize: 85 * ratio
            }
          )
        },
        key
      )
    }
  );
};
var preview_typography_default = StylesPreviewTypography;


;// ./node_modules/@wordpress/edit-site/build-module/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js







const use_theme_style_variations_by_property_EMPTY_ARRAY = [];
const { GlobalStylesContext: use_theme_style_variations_by_property_GlobalStylesContext, areGlobalStyleConfigsEqual } = unlock(
  external_wp_blockEditor_namespaceObject.privateApis
);
const { mergeBaseAndUserConfigs: use_theme_style_variations_by_property_mergeBaseAndUserConfigs } = unlock(external_wp_editor_namespaceObject.privateApis);
function removePropertiesFromObject(object, properties) {
  if (!properties?.length) {
    return object;
  }
  if (typeof object !== "object" || !object || !Object.keys(object).length) {
    return object;
  }
  for (const key in object) {
    if (properties.includes(key)) {
      delete object[key];
    } else if (typeof object[key] === "object") {
      removePropertiesFromObject(object[key], properties);
    }
  }
  return object;
}
function hasThemeVariation({ title, settings, styles }) {
  return title === (0,external_wp_i18n_namespaceObject.__)("Default") || // Always preserve the default variation.
  Object.keys(settings).length > 0 || Object.keys(styles).length > 0;
}
function useCurrentMergeThemeStyleVariationsWithUserConfig(properties = []) {
  const { variationsFromTheme } = (0,external_wp_data_.useSelect)((select) => {
    const _variationsFromTheme = select(
      external_wp_coreData_namespaceObject.store
    ).__experimentalGetCurrentThemeGlobalStylesVariations();
    return {
      variationsFromTheme: _variationsFromTheme || use_theme_style_variations_by_property_EMPTY_ARRAY
    };
  }, []);
  const { user: userVariation } = (0,external_wp_element_.useContext)(use_theme_style_variations_by_property_GlobalStylesContext);
  const propertiesAsString = properties.toString();
  return (0,external_wp_element_.useMemo)(() => {
    const clonedUserVariation = structuredClone(userVariation);
    const userVariationWithoutProperties = removePropertiesFromObject(
      clonedUserVariation,
      properties
    );
    userVariationWithoutProperties.title = (0,external_wp_i18n_namespaceObject.__)("Default");
    const variationsWithPropertiesAndBase = variationsFromTheme.filter((variation) => {
      return isVariationWithProperties(variation, properties);
    }).map((variation) => {
      return use_theme_style_variations_by_property_mergeBaseAndUserConfigs(
        userVariationWithoutProperties,
        variation
      );
    });
    const variationsByProperties = [
      userVariationWithoutProperties,
      ...variationsWithPropertiesAndBase
    ];
    return variationsByProperties?.length ? variationsByProperties.filter(hasThemeVariation) : [];
  }, [propertiesAsString, userVariation, variationsFromTheme]);
}
const filterObjectByProperties = (object, properties) => {
  if (!object || !properties?.length) {
    return {};
  }
  const newObject = {};
  Object.keys(object).forEach((key) => {
    if (properties.includes(key)) {
      newObject[key] = object[key];
    } else if (typeof object[key] === "object") {
      const newFilter = filterObjectByProperties(
        object[key],
        properties
      );
      if (Object.keys(newFilter).length) {
        newObject[key] = newFilter;
      }
    }
  });
  return newObject;
};
function isVariationWithProperties(variation, properties) {
  const variationWithProperties = filterObjectByProperties(
    structuredClone(variation),
    properties
  );
  return areGlobalStyleConfigsEqual(variationWithProperties, variation);
}


;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/variations/variation.js










const { mergeBaseAndUserConfigs: variation_mergeBaseAndUserConfigs } = unlock(external_wp_editor_namespaceObject.privateApis);
const { GlobalStylesContext: variation_GlobalStylesContext, areGlobalStyleConfigsEqual: variation_areGlobalStyleConfigsEqual } = unlock(
  external_wp_blockEditor_namespaceObject.privateApis
);
function Variation({
  variation,
  children,
  isPill,
  properties,
  showTooltip
}) {
  const [isFocused, setIsFocused] = (0,external_wp_element_.useState)(false);
  const { base, user, setUserConfig } = (0,external_wp_element_.useContext)(variation_GlobalStylesContext);
  const context = (0,external_wp_element_.useMemo)(() => {
    let merged = variation_mergeBaseAndUserConfigs(base, variation);
    if (properties) {
      merged = filterObjectByProperties(merged, properties);
    }
    return {
      user: variation,
      base,
      merged,
      setUserConfig: () => {
      }
    };
  }, [variation, base, properties]);
  const selectVariation = () => setUserConfig(variation);
  const selectOnEnter = (event) => {
    if (event.keyCode === external_wp_keycodes_namespaceObject.ENTER) {
      event.preventDefault();
      selectVariation();
    }
  };
  const isActive = (0,external_wp_element_.useMemo)(
    () => variation_areGlobalStyleConfigsEqual(user, variation),
    [user, variation]
  );
  let label = variation?.title;
  if (variation?.description) {
    label = (0,external_wp_i18n_namespaceObject.sprintf)(
      /* translators: 1: variation title. 2: variation description. */
      (0,external_wp_i18n_namespaceObject._x)("%1$s (%2$s)", "variation label"),
      variation?.title,
      variation?.description
    );
  }
  const content = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    "div",
    {
      className: dist_clsx("edit-site-global-styles-variations_item", {
        "is-active": isActive
      }),
      role: "button",
      onClick: selectVariation,
      onKeyDown: selectOnEnter,
      tabIndex: "0",
      "aria-label": label,
      "aria-current": isActive,
      onFocus: () => setIsFocused(true),
      onBlur: () => setIsFocused(false),
      children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
        "div",
        {
          className: dist_clsx(
            "edit-site-global-styles-variations_item-preview",
            { "is-pill": isPill }
          ),
          children: children(isFocused)
        }
      )
    }
  );
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(variation_GlobalStylesContext.Provider, { value: context, children: showTooltip ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Tooltip, { text: variation?.title, children: content }) : content });
}


;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/variations/variations-typography.js






function TypographyVariations({ title, gap = 2 }) {
  const propertiesToFilter = ["typography"];
  const typographyVariations = useCurrentMergeThemeStyleVariationsWithUserConfig(propertiesToFilter);
  if (typographyVariations?.length <= 1) {
    return null;
  }
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 3, children: [
    title && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(subtitle_default, { level: 3, children: title }),
    /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
      external_wp_components_namespaceObject.__experimentalGrid,
      {
        columns: 3,
        gap,
        className: "edit-site-global-styles-style-variations-container",
        children: typographyVariations.map((variation, index) => {
          return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
            Variation,
            {
              variation,
              properties: propertiesToFilter,
              showTooltip: true,
              children: () => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
                preview_typography_default,
                {
                  variation
                }
              )
            },
            index
          );
        })
      }
    )
  ] });
}


;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-sizes/font-sizes-count.js






function FontSizes() {
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 2, children: [
    /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "space-between", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(subtitle_default, { level: 3, children: (0,external_wp_i18n_namespaceObject.__)("Font Sizes") }) }),
    /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItemGroup, { isBordered: true, isSeparated: true, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigationButtonAsItem, { path: "/typography/font-sizes", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { direction: "row", children: [
      /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: (0,external_wp_i18n_namespaceObject.__)("Font size presets") }),
      /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(icon_default, { icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left_default : chevron_right_default })
    ] }) }) })
  ] });
}
var font_sizes_count_default = FontSizes;


;// ./node_modules/@wordpress/icons/build-module/library/settings.js


var settings_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: [
  /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "m19 7.5h-7.628c-.3089-.87389-1.1423-1.5-2.122-1.5-.97966 0-1.81309.62611-2.12197 1.5h-2.12803v1.5h2.12803c.30888.87389 1.14231 1.5 2.12197 1.5.9797 0 1.8131-.62611 2.122-1.5h7.628z" }),
  /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "m19 15h-2.128c-.3089-.8739-1.1423-1.5-2.122-1.5s-1.8131.6261-2.122 1.5h-7.628v1.5h7.628c.3089.8739 1.1423 1.5 2.122 1.5s1.8131-.6261 2.122-1.5h2.128z" })
] });


;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/resolvers.js

const FONT_FAMILIES_URL = "/wp/v2/font-families";
const FONT_COLLECTIONS_URL = "/wp/v2/font-collections";
async function fetchInstallFontFamily(data) {
  const config = {
    path: FONT_FAMILIES_URL,
    method: "POST",
    body: data
  };
  const response = await external_wp_apiFetch_default()(config);
  return {
    id: response.id,
    ...response.font_family_settings,
    fontFace: []
  };
}
async function fetchInstallFontFace(fontFamilyId, data) {
  const config = {
    path: `${FONT_FAMILIES_URL}/${fontFamilyId}/font-faces`,
    method: "POST",
    body: data
  };
  const response = await external_wp_apiFetch_default()(config);
  return {
    id: response.id,
    ...response.font_face_settings
  };
}
async function fetchGetFontFamilyBySlug(slug) {
  const config = {
    path: `${FONT_FAMILIES_URL}?slug=${slug}&_embed=true`,
    method: "GET"
  };
  const response = await external_wp_apiFetch_default()(config);
  if (!response || response.length === 0) {
    return null;
  }
  const fontFamilyPost = response[0];
  return {
    id: fontFamilyPost.id,
    ...fontFamilyPost.font_family_settings,
    fontFace: fontFamilyPost?._embedded?.font_faces.map(
      (face) => face.font_face_settings
    ) || []
  };
}
async function fetchUninstallFontFamily(fontFamilyId) {
  const config = {
    path: `${FONT_FAMILIES_URL}/${fontFamilyId}?force=true`,
    method: "DELETE"
  };
  return await external_wp_apiFetch_default()(config);
}
async function fetchFontCollections() {
  const config = {
    path: `${FONT_COLLECTIONS_URL}?_fields=slug,name,description`,
    method: "GET"
  };
  return await external_wp_apiFetch_default()(config);
}
async function fetchFontCollection(id) {
  const config = {
    path: `${FONT_COLLECTIONS_URL}/${id}`,
    method: "GET"
  };
  return await external_wp_apiFetch_default()(config);
}


;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/utils/constants.js

const ALLOWED_FILE_EXTENSIONS = ["otf", "ttf", "woff", "woff2"];
const FONT_WEIGHTS = {
  100: (0,external_wp_i18n_namespaceObject._x)("Thin", "font weight"),
  200: (0,external_wp_i18n_namespaceObject._x)("Extra-light", "font weight"),
  300: (0,external_wp_i18n_namespaceObject._x)("Light", "font weight"),
  400: (0,external_wp_i18n_namespaceObject._x)("Normal", "font weight"),
  500: (0,external_wp_i18n_namespaceObject._x)("Medium", "font weight"),
  600: (0,external_wp_i18n_namespaceObject._x)("Semi-bold", "font weight"),
  700: (0,external_wp_i18n_namespaceObject._x)("Bold", "font weight"),
  800: (0,external_wp_i18n_namespaceObject._x)("Extra-bold", "font weight"),
  900: (0,external_wp_i18n_namespaceObject._x)("Black", "font weight")
};
const FONT_STYLES = {
  normal: (0,external_wp_i18n_namespaceObject._x)("Normal", "font style"),
  italic: (0,external_wp_i18n_namespaceObject._x)("Italic", "font style")
};


;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/utils/index.js





const { File } = window;
const { kebabCase } = unlock(external_wp_components_namespaceObject.privateApis);
function setUIValuesNeeded(font, extraValues = {}) {
  if (!font.name && (font.fontFamily || font.slug)) {
    font.name = font.fontFamily || font.slug;
  }
  return {
    ...font,
    ...extraValues
  };
}
function isUrlEncoded(url) {
  if (typeof url !== "string") {
    return false;
  }
  return url !== decodeURIComponent(url);
}
function getFontFaceVariantName(face) {
  const weightName = FONT_WEIGHTS[face.fontWeight] || face.fontWeight;
  const styleName = face.fontStyle === "normal" ? "" : FONT_STYLES[face.fontStyle] || face.fontStyle;
  return `${weightName} ${styleName}`;
}
function mergeFontFaces(existing = [], incoming = []) {
  const map = /* @__PURE__ */ new Map();
  for (const face of existing) {
    map.set(`${face.fontWeight}${face.fontStyle}`, face);
  }
  for (const face of incoming) {
    map.set(`${face.fontWeight}${face.fontStyle}`, face);
  }
  return Array.from(map.values());
}
function mergeFontFamilies(existing = [], incoming = []) {
  const map = /* @__PURE__ */ new Map();
  for (const font of existing) {
    map.set(font.slug, { ...font });
  }
  for (const font of incoming) {
    if (map.has(font.slug)) {
      const { fontFace: incomingFontFaces, ...restIncoming } = font;
      const existingFont = map.get(font.slug);
      const mergedFontFaces = mergeFontFaces(
        existingFont.fontFace,
        incomingFontFaces
      );
      map.set(font.slug, {
        ...restIncoming,
        fontFace: mergedFontFaces
      });
    } else {
      map.set(font.slug, { ...font });
    }
  }
  return Array.from(map.values());
}
async function loadFontFaceInBrowser(fontFace, source, addTo = "all") {
  let dataSource;
  if (typeof source === "string") {
    dataSource = `url(${source})`;
  } else if (source instanceof File) {
    dataSource = await source.arrayBuffer();
  } else {
    return;
  }
  const newFont = new window.FontFace(
    formatFontFaceName(fontFace.fontFamily),
    dataSource,
    {
      style: fontFace.fontStyle,
      weight: fontFace.fontWeight
    }
  );
  const loadedFace = await newFont.load();
  if (addTo === "document" || addTo === "all") {
    document.fonts.add(loadedFace);
  }
  if (addTo === "iframe" || addTo === "all") {
    const iframeDocument = document.querySelector(
      'iframe[name="editor-canvas"]'
    ).contentDocument;
    iframeDocument.fonts.add(loadedFace);
  }
}
function unloadFontFaceInBrowser(fontFace, removeFrom = "all") {
  const unloadFontFace = (fonts) => {
    fonts.forEach((f) => {
      if (f.family === formatFontFaceName(fontFace?.fontFamily) && f.weight === fontFace?.fontWeight && f.style === fontFace?.fontStyle) {
        fonts.delete(f);
      }
    });
  };
  if (removeFrom === "document" || removeFrom === "all") {
    unloadFontFace(document.fonts);
  }
  if (removeFrom === "iframe" || removeFrom === "all") {
    const iframeDocument = document.querySelector(
      'iframe[name="editor-canvas"]'
    ).contentDocument;
    unloadFontFace(iframeDocument.fonts);
  }
}
function getDisplaySrcFromFontFace(input) {
  if (!input) {
    return;
  }
  let src;
  if (Array.isArray(input)) {
    src = input[0];
  } else {
    src = input;
  }
  if (src.startsWith("file:.")) {
    return;
  }
  if (!isUrlEncoded(src)) {
    src = encodeURI(src);
  }
  return src;
}
function makeFontFamilyFormData(fontFamily) {
  const formData = new FormData();
  const { fontFace, category, ...familyWithValidParameters } = fontFamily;
  const fontFamilySettings = {
    ...familyWithValidParameters,
    slug: kebabCase(fontFamily.slug)
  };
  formData.append(
    "font_family_settings",
    JSON.stringify(fontFamilySettings)
  );
  return formData;
}
function makeFontFacesFormData(font) {
  if (font?.fontFace) {
    const fontFacesFormData = font.fontFace.map((item, faceIndex) => {
      const face = { ...item };
      const formData = new FormData();
      if (face.file) {
        const files = Array.isArray(face.file) ? face.file : [face.file];
        const src = [];
        files.forEach((file, key) => {
          const fileId = `file-${faceIndex}-${key}`;
          formData.append(fileId, file, file.name);
          src.push(fileId);
        });
        face.src = src.length === 1 ? src[0] : src;
        delete face.file;
        formData.append("font_face_settings", JSON.stringify(face));
      } else {
        formData.append("font_face_settings", JSON.stringify(face));
      }
      return formData;
    });
    return fontFacesFormData;
  }
}
async function batchInstallFontFaces(fontFamilyId, fontFacesData) {
  const responses = [];
  for (const faceData of fontFacesData) {
    try {
      const response = await fetchInstallFontFace(
        fontFamilyId,
        faceData
      );
      responses.push({ status: "fulfilled", value: response });
    } catch (error) {
      responses.push({ status: "rejected", reason: error });
    }
  }
  const results = {
    errors: [],
    successes: []
  };
  responses.forEach((result, index) => {
    if (result.status === "fulfilled") {
      const response = result.value;
      if (response.id) {
        results.successes.push(response);
      } else {
        results.errors.push({
          data: fontFacesData[index],
          message: `Error: ${response.message}`
        });
      }
    } else {
      results.errors.push({
        data: fontFacesData[index],
        message: result.reason.message
      });
    }
  });
  return results;
}
async function downloadFontFaceAssets(src) {
  src = Array.isArray(src) ? src : [src];
  const files = await Promise.all(
    src.map(async (url) => {
      return fetch(new Request(url)).then((response) => {
        if (!response.ok) {
          throw new Error(
            `Error downloading font face asset from ${url}. Server responded with status: ${response.status}`
          );
        }
        return response.blob();
      }).then((blob) => {
        const filename = url.split("/").pop();
        const file = new File([blob], filename, {
          type: blob.type
        });
        return file;
      });
    })
  );
  return files.length === 1 ? files[0] : files;
}
function checkFontFaceInstalled(fontFace, collection) {
  return -1 !== collection.findIndex((collectionFontFace) => {
    return collectionFontFace.fontWeight === fontFace.fontWeight && collectionFontFace.fontStyle === fontFace.fontStyle;
  });
}


;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/utils/toggleFont.js
function toggleFont(font, face, initialfonts) {
  const isFontActivated = (f) => f.slug === font.slug;
  const getActivatedFont = (fonts) => fonts.find(isFontActivated);
  const toggleEntireFontFamily = (activatedFont2) => {
    if (!activatedFont2) {
      return [...initialfonts, font];
    }
    return initialfonts.filter((f) => !isFontActivated(f));
  };
  const toggleFontVariant = (activatedFont2) => {
    const isFaceActivated = (f) => f.fontWeight === face.fontWeight && f.fontStyle === face.fontStyle;
    if (!activatedFont2) {
      return [...initialfonts, { ...font, fontFace: [face] }];
    }
    let newFontFaces = activatedFont2.fontFace || [];
    if (newFontFaces.find(isFaceActivated)) {
      newFontFaces = newFontFaces.filter(
        (f) => !isFaceActivated(f)
      );
    } else {
      newFontFaces = [...newFontFaces, face];
    }
    if (newFontFaces.length === 0) {
      return initialfonts.filter((f) => !isFontActivated(f));
    }
    return initialfonts.map(
      (f) => isFontActivated(f) ? { ...f, fontFace: newFontFaces } : f
    );
  };
  const activatedFont = getActivatedFont(initialfonts);
  if (!face) {
    return toggleEntireFontFamily(activatedFont);
  }
  return toggleFontVariant(activatedFont);
}


;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/context.js








const { useGlobalSetting: context_useGlobalSetting } = unlock(external_wp_blockEditor_namespaceObject.privateApis);



const FontLibraryContext = (0,external_wp_element_.createContext)({});
FontLibraryContext.displayName = "FontLibraryContext";
function FontLibraryProvider({ children }) {
  const { saveEntityRecord } = (0,external_wp_data_.useDispatch)(external_wp_coreData_namespaceObject.store);
  const { globalStylesId } = (0,external_wp_data_.useSelect)((select) => {
    const { __experimentalGetCurrentGlobalStylesId } = select(external_wp_coreData_namespaceObject.store);
    return { globalStylesId: __experimentalGetCurrentGlobalStylesId() };
  });
  const globalStyles = (0,external_wp_coreData_namespaceObject.useEntityRecord)(
    "root",
    "globalStyles",
    globalStylesId
  );
  const [isInstalling, setIsInstalling] = (0,external_wp_element_.useState)(false);
  const [refreshKey, setRefreshKey] = (0,external_wp_element_.useState)(0);
  const refreshLibrary = () => {
    setRefreshKey(Date.now());
  };
  const { records: libraryPosts = [], isResolving: isResolvingLibrary } = (0,external_wp_coreData_namespaceObject.useEntityRecords)("postType", "wp_font_family", {
    refreshKey,
    _embed: true
  });
  const libraryFonts = (libraryPosts || []).map((fontFamilyPost) => {
    return {
      id: fontFamilyPost.id,
      ...fontFamilyPost.font_family_settings,
      fontFace: fontFamilyPost?._embedded?.font_faces.map(
        (face) => face.font_face_settings
      ) || []
    };
  }) || [];
  const [fontFamilies, setFontFamilies] = context_useGlobalSetting(
    "typography.fontFamilies"
  );
  const saveFontFamilies = async (fonts) => {
    const updatedGlobalStyles = globalStyles.record;
    setNestedValue(
      updatedGlobalStyles,
      ["settings", "typography", "fontFamilies"],
      fonts
    );
    await saveEntityRecord("root", "globalStyles", updatedGlobalStyles);
  };
  const [modalTabOpen, setModalTabOpen] = (0,external_wp_element_.useState)(false);
  const [libraryFontSelected, setLibraryFontSelected] = (0,external_wp_element_.useState)(null);
  const themeFonts = fontFamilies?.theme ? fontFamilies.theme.map((f) => setUIValuesNeeded(f, { source: "theme" })).sort((a, b) => a.name.localeCompare(b.name)) : [];
  const customFonts = fontFamilies?.custom ? fontFamilies.custom.map((f) => setUIValuesNeeded(f, { source: "custom" })).sort((a, b) => a.name.localeCompare(b.name)) : [];
  const baseCustomFonts = libraryFonts ? libraryFonts.map((f) => setUIValuesNeeded(f, { source: "custom" })).sort((a, b) => a.name.localeCompare(b.name)) : [];
  (0,external_wp_element_.useEffect)(() => {
    if (!modalTabOpen) {
      setLibraryFontSelected(null);
    }
  }, [modalTabOpen]);
  const handleSetLibraryFontSelected = (font) => {
    if (!font) {
      setLibraryFontSelected(null);
      return;
    }
    const fonts = font.source === "theme" ? themeFonts : baseCustomFonts;
    const fontSelected = fonts.find((f) => f.slug === font.slug);
    setLibraryFontSelected({
      ...fontSelected || font,
      source: font.source
    });
  };
  const [loadedFontUrls] = (0,external_wp_element_.useState)(/* @__PURE__ */ new Set());
  const getAvailableFontsOutline = (availableFontFamilies) => {
    const outline = availableFontFamilies.reduce((acc, font) => {
      const availableFontFaces = font?.fontFace && font.fontFace?.length > 0 ? font?.fontFace.map(
        (face) => `${face.fontStyle + face.fontWeight}`
      ) : ["normal400"];
      acc[font.slug] = availableFontFaces;
      return acc;
    }, {});
    return outline;
  };
  const getActivatedFontsOutline = (source) => {
    switch (source) {
      case "theme":
        return getAvailableFontsOutline(themeFonts);
      case "custom":
      default:
        return getAvailableFontsOutline(customFonts);
    }
  };
  const isFontActivated = (slug, style, weight, source) => {
    if (!style && !weight) {
      return !!getActivatedFontsOutline(source)[slug];
    }
    return !!getActivatedFontsOutline(source)[slug]?.includes(
      style + weight
    );
  };
  const getFontFacesActivated = (slug, source) => {
    return getActivatedFontsOutline(source)[slug] || [];
  };
  async function installFonts(fontFamiliesToInstall) {
    setIsInstalling(true);
    try {
      const fontFamiliesToActivate = [];
      let installationErrors = [];
      for (const fontFamilyToInstall of fontFamiliesToInstall) {
        let isANewFontFamily = false;
        let installedFontFamily = await fetchGetFontFamilyBySlug(
          fontFamilyToInstall.slug
        );
        if (!installedFontFamily) {
          isANewFontFamily = true;
          installedFontFamily = await fetchInstallFontFamily(
            makeFontFamilyFormData(fontFamilyToInstall)
          );
        }
        const alreadyInstalledFontFaces = installedFontFamily.fontFace && fontFamilyToInstall.fontFace ? installedFontFamily.fontFace.filter(
          (fontFaceToInstall) => checkFontFaceInstalled(
            fontFaceToInstall,
            fontFamilyToInstall.fontFace
          )
        ) : [];
        if (installedFontFamily.fontFace && fontFamilyToInstall.fontFace) {
          fontFamilyToInstall.fontFace = fontFamilyToInstall.fontFace.filter(
            (fontFaceToInstall) => !checkFontFaceInstalled(
              fontFaceToInstall,
              installedFontFamily.fontFace
            )
          );
        }
        let successfullyInstalledFontFaces = [];
        let unsuccessfullyInstalledFontFaces = [];
        if (fontFamilyToInstall?.fontFace?.length > 0) {
          const response = await batchInstallFontFaces(
            installedFontFamily.id,
            makeFontFacesFormData(fontFamilyToInstall)
          );
          successfullyInstalledFontFaces = response?.successes;
          unsuccessfullyInstalledFontFaces = response?.errors;
        }
        if (successfullyInstalledFontFaces?.length > 0 || alreadyInstalledFontFaces?.length > 0) {
          installedFontFamily.fontFace = [
            ...successfullyInstalledFontFaces
          ];
          fontFamiliesToActivate.push(installedFontFamily);
        }
        if (installedFontFamily && !fontFamilyToInstall?.fontFace?.length) {
          fontFamiliesToActivate.push(installedFontFamily);
        }
        if (isANewFontFamily && fontFamilyToInstall?.fontFace?.length > 0 && successfullyInstalledFontFaces?.length === 0) {
          await fetchUninstallFontFamily(installedFontFamily.id);
        }
        installationErrors = installationErrors.concat(
          unsuccessfullyInstalledFontFaces
        );
      }
      installationErrors = installationErrors.reduce(
        (unique, item) => unique.includes(item.message) ? unique : [...unique, item.message],
        []
      );
      if (fontFamiliesToActivate.length > 0) {
        const activeFonts = activateCustomFontFamilies(
          fontFamiliesToActivate
        );
        await saveFontFamilies(activeFonts);
        refreshLibrary();
      }
      if (installationErrors.length > 0) {
        const installError = new Error(
          (0,external_wp_i18n_namespaceObject.__)("There was an error installing fonts.")
        );
        installError.installationErrors = installationErrors;
        throw installError;
      }
    } finally {
      setIsInstalling(false);
    }
  }
  async function uninstallFontFamily(fontFamilyToUninstall) {
    try {
      const uninstalledFontFamily = await fetchUninstallFontFamily(
        fontFamilyToUninstall.id
      );
      if (uninstalledFontFamily.deleted) {
        const activeFonts = deactivateFontFamily(
          fontFamilyToUninstall
        );
        await saveFontFamilies(activeFonts);
      }
      refreshLibrary();
      return uninstalledFontFamily;
    } catch (error) {
      console.error(
        `There was an error uninstalling the font family:`,
        error
      );
      throw error;
    }
  }
  const deactivateFontFamily = (font) => {
    const initialCustomFonts = fontFamilies?.[font.source] ?? [];
    const newCustomFonts = initialCustomFonts.filter(
      (f) => f.slug !== font.slug
    );
    const activeFonts = {
      ...fontFamilies,
      [font.source]: newCustomFonts
    };
    setFontFamilies(activeFonts);
    if (font.fontFace) {
      font.fontFace.forEach((face) => {
        unloadFontFaceInBrowser(face, "all");
      });
    }
    return activeFonts;
  };
  const activateCustomFontFamilies = (fontsToAdd) => {
    const fontsToActivate = cleanFontsForSave(fontsToAdd);
    const activeFonts = {
      ...fontFamilies,
      // Merge the existing custom fonts with the new fonts.
      custom: mergeFontFamilies(fontFamilies?.custom, fontsToActivate)
    };
    setFontFamilies(activeFonts);
    loadFontsInBrowser(fontsToActivate);
    return activeFonts;
  };
  const cleanFontsForSave = (fonts) => {
    return fonts.map(({ id: _familyDbId, fontFace, ...font }) => ({
      ...font,
      ...fontFace && fontFace.length > 0 ? {
        fontFace: fontFace.map(
          ({ id: _faceDbId, ...face }) => face
        )
      } : {}
    }));
  };
  const loadFontsInBrowser = (fonts) => {
    fonts.forEach((font) => {
      if (font.fontFace) {
        font.fontFace.forEach((face) => {
          loadFontFaceInBrowser(
            face,
            getDisplaySrcFromFontFace(face.src),
            "all"
          );
        });
      }
    });
  };
  const toggleActivateFont = (font, face) => {
    const initialFonts = fontFamilies?.[font.source] ?? [];
    const newFonts = toggleFont(font, face, initialFonts);
    setFontFamilies({
      ...fontFamilies,
      [font.source]: newFonts
    });
    const isFaceActivated = isFontActivated(
      font.slug,
      face?.fontStyle,
      face?.fontWeight,
      font.source
    );
    if (isFaceActivated) {
      unloadFontFaceInBrowser(face, "all");
    } else {
      loadFontFaceInBrowser(
        face,
        getDisplaySrcFromFontFace(face?.src),
        "all"
      );
    }
  };
  const loadFontFaceAsset = async (fontFace) => {
    if (!fontFace.src) {
      return;
    }
    const src = getDisplaySrcFromFontFace(fontFace.src);
    if (!src || loadedFontUrls.has(src)) {
      return;
    }
    loadFontFaceInBrowser(fontFace, src, "document");
    loadedFontUrls.add(src);
  };
  const [collections, setFontCollections] = (0,external_wp_element_.useState)([]);
  const getFontCollections = async () => {
    const response = await fetchFontCollections();
    setFontCollections(response);
  };
  const getFontCollection = async (slug) => {
    try {
      const hasData = !!collections.find(
        (collection) => collection.slug === slug
      )?.font_families;
      if (hasData) {
        return;
      }
      const response = await fetchFontCollection(slug);
      const updatedCollections = collections.map(
        (collection) => collection.slug === slug ? { ...collection, ...response } : collection
      );
      setFontCollections(updatedCollections);
    } catch (e) {
      console.error(e);
      throw e;
    }
  };
  (0,external_wp_element_.useEffect)(() => {
    getFontCollections();
  }, []);
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    FontLibraryContext.Provider,
    {
      value: {
        libraryFontSelected,
        handleSetLibraryFontSelected,
        fontFamilies,
        baseCustomFonts,
        isFontActivated,
        getFontFacesActivated,
        loadFontFaceAsset,
        installFonts,
        uninstallFontFamily,
        toggleActivateFont,
        getAvailableFontsOutline,
        modalTabOpen,
        setModalTabOpen,
        refreshLibrary,
        saveFontFamilies,
        isResolvingLibrary,
        isInstalling,
        collections,
        getFontCollection
      },
      children
    }
  );
}
var context_default = FontLibraryProvider;


;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/font-demo.js





function getPreviewUrl(fontFace) {
  if (fontFace.preview) {
    return fontFace.preview;
  }
  if (fontFace.src) {
    return Array.isArray(fontFace.src) ? fontFace.src[0] : fontFace.src;
  }
}
function getDisplayFontFace(font) {
  if (font.fontStyle || font.fontWeight) {
    return font;
  }
  if (font.fontFace && font.fontFace.length) {
    return font.fontFace.find(
      (face) => face.fontStyle === "normal" && face.fontWeight === "400"
    ) || font.fontFace[0];
  }
  return {
    fontStyle: "normal",
    fontWeight: "400",
    fontFamily: font.fontFamily,
    fake: true
  };
}
function FontDemo({ font, text }) {
  const ref = (0,external_wp_element_.useRef)(null);
  const fontFace = getDisplayFontFace(font);
  const style = getFamilyPreviewStyle(font);
  text = text || font.name;
  const customPreviewUrl = font.preview;
  const [isIntersecting, setIsIntersecting] = (0,external_wp_element_.useState)(false);
  const [isAssetLoaded, setIsAssetLoaded] = (0,external_wp_element_.useState)(false);
  const { loadFontFaceAsset } = (0,external_wp_element_.useContext)(FontLibraryContext);
  const previewUrl = customPreviewUrl ?? getPreviewUrl(fontFace);
  const isPreviewImage = previewUrl && previewUrl.match(/\.(png|jpg|jpeg|gif|svg)$/i);
  const faceStyles = getFacePreviewStyle(fontFace);
  const textDemoStyle = {
    fontSize: "18px",
    lineHeight: 1,
    opacity: isAssetLoaded ? "1" : "0",
    ...style,
    ...faceStyles
  };
  (0,external_wp_element_.useEffect)(() => {
    const observer = new window.IntersectionObserver(([entry]) => {
      setIsIntersecting(entry.isIntersecting);
    }, {});
    observer.observe(ref.current);
    return () => observer.disconnect();
  }, [ref]);
  (0,external_wp_element_.useEffect)(() => {
    const loadAsset = async () => {
      if (isIntersecting) {
        if (!isPreviewImage && fontFace.src) {
          await loadFontFaceAsset(fontFace);
        }
        setIsAssetLoaded(true);
      }
    };
    loadAsset();
  }, [fontFace, isIntersecting, loadFontFaceAsset, isPreviewImage]);
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { ref, children: isPreviewImage ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    "img",
    {
      src: previewUrl,
      loading: "lazy",
      alt: text,
      className: "font-library-modal__font-variant_demo-image"
    }
  ) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    external_wp_components_namespaceObject.__experimentalText,
    {
      style: textDemoStyle,
      className: "font-library-modal__font-variant_demo-text",
      children: text
    }
  ) });
}
var font_demo_default = FontDemo;


;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/font-card.js





function FontCard({ font, onClick, variantsText, navigatorPath }) {
  const variantsCount = font.fontFace?.length || 1;
  const style = {
    cursor: !!onClick ? "pointer" : "default"
  };
  const navigator = (0,external_wp_components_namespaceObject.useNavigator)();
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    external_wp_components_namespaceObject.Button,
    {
      __next40pxDefaultSize: true,
      onClick: () => {
        onClick();
        if (navigatorPath) {
          navigator.goTo(navigatorPath);
        }
      },
      style,
      className: "font-library-modal__font-card",
      children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, { justify: "space-between", wrap: false, children: [
        /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(font_demo_default, { font }),
        /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, { justify: "flex-end", children: [
          /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { className: "font-library-modal__font-card__count", children: variantsText || (0,external_wp_i18n_namespaceObject.sprintf)(
            /* translators: %d: Number of font variants. */
            (0,external_wp_i18n_namespaceObject._n)(
              "%d variant",
              "%d variants",
              variantsCount
            ),
            variantsCount
          ) }) }),
          /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left_default : chevron_right_default }) })
        ] })
      ] })
    }
  );
}
var font_card_default = FontCard;


;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/library-font-variant.js






function LibraryFontVariant({ face, font }) {
  const { isFontActivated, toggleActivateFont } = (0,external_wp_element_.useContext)(FontLibraryContext);
  const isInstalled = font?.fontFace?.length > 0 ? isFontActivated(
    font.slug,
    face.fontStyle,
    face.fontWeight,
    font.source
  ) : isFontActivated(font.slug, null, null, font.source);
  const handleToggleActivation = () => {
    if (font?.fontFace?.length > 0) {
      toggleActivateFont(font, face);
      return;
    }
    toggleActivateFont(font);
  };
  const displayName = font.name + " " + getFontFaceVariantName(face);
  const checkboxId = (0,external_wp_element_.useId)();
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "font-library-modal__font-card", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, { justify: "flex-start", align: "center", gap: "1rem", children: [
    /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
      external_wp_components_namespaceObject.CheckboxControl,
      {
        checked: isInstalled,
        onChange: handleToggleActivation,
        __nextHasNoMarginBottom: true,
        id: checkboxId
      }
    ),
    /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("label", { htmlFor: checkboxId, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
      font_demo_default,
      {
        font: face,
        text: displayName,
        onClick: handleToggleActivation
      }
    ) })
  ] }) });
}
var library_font_variant_default = LibraryFontVariant;


;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/utils/sort-font-faces.js
function getNumericFontWeight(value) {
  switch (value) {
    case "normal":
      return 400;
    case "bold":
      return 700;
    case "bolder":
      return 500;
    case "lighter":
      return 300;
    default:
      return parseInt(value, 10);
  }
}
function sortFontFaces(faces) {
  return faces.sort((a, b) => {
    if (a.fontStyle === "normal" && b.fontStyle !== "normal") {
      return -1;
    }
    if (b.fontStyle === "normal" && a.fontStyle !== "normal") {
      return 1;
    }
    if (a.fontStyle === b.fontStyle) {
      return getNumericFontWeight(a.fontWeight) - getNumericFontWeight(b.fontWeight);
    }
    return a.fontStyle.localeCompare(b.fontStyle);
  });
}


;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/installed-fonts.js














const { useGlobalSetting: installed_fonts_useGlobalSetting } = unlock(external_wp_blockEditor_namespaceObject.privateApis);
function InstalledFonts() {
  const {
    baseCustomFonts,
    libraryFontSelected,
    handleSetLibraryFontSelected,
    refreshLibrary,
    uninstallFontFamily,
    isResolvingLibrary,
    isInstalling,
    saveFontFamilies,
    getFontFacesActivated
  } = (0,external_wp_element_.useContext)(FontLibraryContext);
  const [fontFamilies, setFontFamilies] = installed_fonts_useGlobalSetting(
    "typography.fontFamilies"
  );
  const [isConfirmDeleteOpen, setIsConfirmDeleteOpen] = (0,external_wp_element_.useState)(false);
  const [notice, setNotice] = (0,external_wp_element_.useState)(false);
  const [baseFontFamilies] = installed_fonts_useGlobalSetting(
    "typography.fontFamilies",
    void 0,
    "base"
  );
  const globalStylesId = (0,external_wp_data_.useSelect)((select) => {
    const { __experimentalGetCurrentGlobalStylesId } = select(external_wp_coreData_namespaceObject.store);
    return __experimentalGetCurrentGlobalStylesId();
  });
  const globalStyles = (0,external_wp_coreData_namespaceObject.useEntityRecord)(
    "root",
    "globalStyles",
    globalStylesId
  );
  const fontFamiliesHasChanges = !!globalStyles?.edits?.settings?.typography?.fontFamilies;
  const themeFonts = fontFamilies?.theme ? fontFamilies.theme.map((f) => setUIValuesNeeded(f, { source: "theme" })).sort((a, b) => a.name.localeCompare(b.name)) : [];
  const themeFontsSlugs = new Set(themeFonts.map((f) => f.slug));
  const baseThemeFonts = baseFontFamilies?.theme ? themeFonts.concat(
    baseFontFamilies.theme.filter((f) => !themeFontsSlugs.has(f.slug)).map((f) => setUIValuesNeeded(f, { source: "theme" })).sort((a, b) => a.name.localeCompare(b.name))
  ) : [];
  const customFontFamilyId = libraryFontSelected?.source === "custom" && libraryFontSelected?.id;
  const canUserDelete = (0,external_wp_data_.useSelect)(
    (select) => {
      const { canUser } = select(external_wp_coreData_namespaceObject.store);
      return customFontFamilyId && canUser("delete", {
        kind: "postType",
        name: "wp_font_family",
        id: customFontFamilyId
      });
    },
    [customFontFamilyId]
  );
  const shouldDisplayDeleteButton = !!libraryFontSelected && libraryFontSelected?.source !== "theme" && canUserDelete;
  const handleUninstallClick = () => {
    setIsConfirmDeleteOpen(true);
  };
  const handleUpdate = async () => {
    setNotice(null);
    try {
      await saveFontFamilies(fontFamilies);
      setNotice({
        type: "success",
        message: (0,external_wp_i18n_namespaceObject.__)("Font family updated successfully.")
      });
    } catch (error) {
      setNotice({
        type: "error",
        message: (0,external_wp_i18n_namespaceObject.sprintf)(
          /* translators: %s: error message */
          (0,external_wp_i18n_namespaceObject.__)("There was an error updating the font family. %s"),
          error.message
        )
      });
    }
  };
  const getFontFacesToDisplay = (font) => {
    if (!font) {
      return [];
    }
    if (!font.fontFace || !font.fontFace.length) {
      return [
        {
          fontFamily: font.fontFamily,
          fontStyle: "normal",
          fontWeight: "400"
        }
      ];
    }
    return sortFontFaces(font.fontFace);
  };
  const getFontCardVariantsText = (font) => {
    const variantsInstalled = font?.fontFace?.length > 0 ? font.fontFace.length : 1;
    const variantsActive = getFontFacesActivated(
      font.slug,
      font.source
    ).length;
    return (0,external_wp_i18n_namespaceObject.sprintf)(
      /* translators: 1: Active font variants, 2: Total font variants. */
      (0,external_wp_i18n_namespaceObject.__)("%1$s/%2$s variants active"),
      variantsActive,
      variantsInstalled
    );
  };
  (0,external_wp_element_.useEffect)(() => {
    handleSetLibraryFontSelected(libraryFontSelected);
    refreshLibrary();
  }, []);
  const activeFontsCount = libraryFontSelected ? getFontFacesActivated(
    libraryFontSelected.slug,
    libraryFontSelected.source
  ).length : 0;
  const selectedFontsCount = libraryFontSelected?.fontFace?.length ?? (libraryFontSelected?.fontFamily ? 1 : 0);
  const isIndeterminate = activeFontsCount > 0 && activeFontsCount !== selectedFontsCount;
  const isSelectAllChecked = activeFontsCount === selectedFontsCount;
  const toggleSelectAll = () => {
    const initialFonts = fontFamilies?.[libraryFontSelected.source]?.filter(
      (f) => f.slug !== libraryFontSelected.slug
    ) ?? [];
    const newFonts = isSelectAllChecked ? initialFonts : [...initialFonts, libraryFontSelected];
    setFontFamilies({
      ...fontFamilies,
      [libraryFontSelected.source]: newFonts
    });
    if (libraryFontSelected.fontFace) {
      libraryFontSelected.fontFace.forEach((face) => {
        if (isSelectAllChecked) {
          unloadFontFaceInBrowser(face, "all");
        } else {
          loadFontFaceInBrowser(
            face,
            getDisplaySrcFromFontFace(face?.src),
            "all"
          );
        }
      });
    }
  };
  const hasFonts = baseThemeFonts.length > 0 || baseCustomFonts.length > 0;
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "font-library-modal__tabpanel-layout", children: [
    isResolvingLibrary && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "font-library-modal__loading", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ProgressBar, {}) }),
    !isResolvingLibrary && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
      /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
        external_wp_components_namespaceObject.Navigator,
        {
          initialPath: libraryFontSelected ? "/fontFamily" : "/",
          children: [
            /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Navigator.Screen, { path: "/", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: "8", children: [
              notice && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
                external_wp_components_namespaceObject.Notice,
                {
                  status: notice.type,
                  onRemove: () => setNotice(null),
                  children: notice.message
                }
              ),
              !hasFonts && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { as: "p", children: (0,external_wp_i18n_namespaceObject.__)("No fonts installed.") }),
              baseThemeFonts.length > 0 && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { children: [
                /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("h2", {
                  className: "font-library-modal__fonts-title",
                  /* translators: Heading for a list of fonts provided by the theme. */
                  children: (0,external_wp_i18n_namespaceObject._x)("Theme", "font source")
                }),
                /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
                  "ul",
                  {
                    role: "list",
                    className: "font-library-modal__fonts-list",
                    children: baseThemeFonts.map((font) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
                      "li",
                      {
                        className: "font-library-modal__fonts-list-item",
                        children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
                          font_card_default,
                          {
                            font,
                            navigatorPath: "/fontFamily",
                            variantsText: getFontCardVariantsText(
                              font
                            ),
                            onClick: () => {
                              setNotice(null);
                              handleSetLibraryFontSelected(
                                font
                              );
                            }
                          }
                        )
                      },
                      font.slug
                    ))
                  }
                )
              ] }),
              baseCustomFonts.length > 0 && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { children: [
                /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("h2", {
                  className: "font-library-modal__fonts-title",
                  /* translators: Heading for a list of fonts installed by the user. */
                  children: (0,external_wp_i18n_namespaceObject._x)("Custom", "font source")
                }),
                /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
                  "ul",
                  {
                    role: "list",
                    className: "font-library-modal__fonts-list",
                    children: baseCustomFonts.map((font) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
                      "li",
                      {
                        className: "font-library-modal__fonts-list-item",
                        children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
                          font_card_default,
                          {
                            font,
                            navigatorPath: "/fontFamily",
                            variantsText: getFontCardVariantsText(
                              font
                            ),
                            onClick: () => {
                              setNotice(null);
                              handleSetLibraryFontSelected(
                                font
                              );
                            }
                          }
                        )
                      },
                      font.slug
                    ))
                  }
                )
              ] })
            ] }) }),
            /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Navigator.Screen, { path: "/fontFamily", children: [
              /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
                ConfirmDeleteDialog,
                {
                  font: libraryFontSelected,
                  isOpen: isConfirmDeleteOpen,
                  setIsOpen: setIsConfirmDeleteOpen,
                  setNotice,
                  uninstallFontFamily,
                  handleSetLibraryFontSelected
                }
              ),
              /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, { justify: "flex-start", children: [
                /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
                  external_wp_components_namespaceObject.Navigator.BackButton,
                  {
                    icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_right_default : chevron_left_default,
                    size: "small",
                    onClick: () => {
                      handleSetLibraryFontSelected(null);
                      setNotice(null);
                    },
                    label: (0,external_wp_i18n_namespaceObject.__)("Back")
                  }
                ),
                /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
                  external_wp_components_namespaceObject.__experimentalHeading,
                  {
                    level: 2,
                    size: 13,
                    className: "edit-site-global-styles-header",
                    children: libraryFontSelected?.name
                  }
                )
              ] }),
              notice && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
                /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { margin: 1 }),
                /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
                  external_wp_components_namespaceObject.Notice,
                  {
                    status: notice.type,
                    onRemove: () => setNotice(null),
                    children: notice.message
                  }
                ),
                /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { margin: 1 })
              ] }),
              /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { margin: 4 }),
              /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { children: (0,external_wp_i18n_namespaceObject.__)(
                "Choose font variants. Keep in mind that too many variants could make your site slower."
              ) }),
              /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { margin: 4 }),
              /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 0, children: [
                /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
                  external_wp_components_namespaceObject.CheckboxControl,
                  {
                    className: "font-library-modal__select-all",
                    label: (0,external_wp_i18n_namespaceObject.__)("Select all"),
                    checked: isSelectAllChecked,
                    onChange: toggleSelectAll,
                    indeterminate: isIndeterminate,
                    __nextHasNoMarginBottom: true
                  }
                ),
                /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { margin: 8 }),
                /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
                  "ul",
                  {
                    role: "list",
                    className: "font-library-modal__fonts-list",
                    children: getFontFacesToDisplay(
                      libraryFontSelected
                    ).map((face, i) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
                      "li",
                      {
                        className: "font-library-modal__fonts-list-item",
                        children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
                          library_font_variant_default,
                          {
                            font: libraryFontSelected,
                            face
                          },
                          `face${i}`
                        )
                      },
                      `face${i}`
                    ))
                  }
                )
              ] })
            ] })
          ]
        }
      ),
      /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
        external_wp_components_namespaceObject.__experimentalHStack,
        {
          justify: "flex-end",
          className: "font-library-modal__footer",
          children: [
            isInstalling && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ProgressBar, {}),
            shouldDisplayDeleteButton && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
              external_wp_components_namespaceObject.Button,
              {
                __next40pxDefaultSize: true,
                isDestructive: true,
                variant: "tertiary",
                onClick: handleUninstallClick,
                children: (0,external_wp_i18n_namespaceObject.__)("Delete")
              }
            ),
            /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
              external_wp_components_namespaceObject.Button,
              {
                __next40pxDefaultSize: true,
                variant: "primary",
                onClick: handleUpdate,
                disabled: !fontFamiliesHasChanges,
                accessibleWhenDisabled: true,
                children: (0,external_wp_i18n_namespaceObject.__)("Update")
              }
            )
          ]
        }
      )
    ] })
  ] });
}
function ConfirmDeleteDialog({
  font,
  isOpen,
  setIsOpen,
  setNotice,
  uninstallFontFamily,
  handleSetLibraryFontSelected
}) {
  const navigator = (0,external_wp_components_namespaceObject.useNavigator)();
  const handleConfirmUninstall = async () => {
    setNotice(null);
    setIsOpen(false);
    try {
      await uninstallFontFamily(font);
      navigator.goBack();
      handleSetLibraryFontSelected(null);
      setNotice({
        type: "success",
        message: (0,external_wp_i18n_namespaceObject.__)("Font family uninstalled successfully.")
      });
    } catch (error) {
      setNotice({
        type: "error",
        message: (0,external_wp_i18n_namespaceObject.__)("There was an error uninstalling the font family.") + error.message
      });
    }
  };
  const handleCancelUninstall = () => {
    setIsOpen(false);
  };
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    external_wp_components_namespaceObject.__experimentalConfirmDialog,
    {
      isOpen,
      cancelButtonText: (0,external_wp_i18n_namespaceObject.__)("Cancel"),
      confirmButtonText: (0,external_wp_i18n_namespaceObject.__)("Delete"),
      onCancel: handleCancelUninstall,
      onConfirm: handleConfirmUninstall,
      size: "medium",
      children: font && (0,external_wp_i18n_namespaceObject.sprintf)(
        /* translators: %s: Name of the font. */
        (0,external_wp_i18n_namespaceObject.__)(
          'Are you sure you want to delete "%s" font and all its variants and assets?'
        ),
        font.name
      )
    }
  );
}
var installed_fonts_default = InstalledFonts;


;// ./node_modules/@wordpress/icons/build-module/library/next.js


var next_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M6.6 6L5.4 7l4.5 5-4.5 5 1.1 1 5.5-6-5.4-6zm6 0l-1.1 1 4.5 5-4.5 5 1.1 1 5.5-6-5.5-6z" }) });


;// ./node_modules/@wordpress/icons/build-module/library/previous.js


var previous_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M11.6 7l-1.1-1L5 12l5.5 6 1.1-1L7 12l4.6-5zm6 0l-1.1-1-5.5 6 5.5 6 1.1-1-4.6-5 4.6-5z" }) });


;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/utils/filter-fonts.js
function filterFonts(fonts, filters) {
  const { category, search } = filters;
  let filteredFonts = fonts || [];
  if (category && category !== "all") {
    filteredFonts = filteredFonts.filter(
      (font) => font.categories.indexOf(category) !== -1
    );
  }
  if (search) {
    filteredFonts = filteredFonts.filter(
      (font) => font.font_family_settings.name.toLowerCase().includes(search.toLowerCase())
    );
  }
  return filteredFonts;
}


;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/utils/fonts-outline.js
function getFontsOutline(fonts) {
  return fonts.reduce(
    (acc, font) => ({
      ...acc,
      [font.slug]: (font?.fontFace || []).reduce(
        (faces, face) => ({
          ...faces,
          [`${face.fontStyle}-${face.fontWeight}`]: true
        }),
        {}
      )
    }),
    {}
  );
}
function isFontFontFaceInOutline(slug, face, outline) {
  if (!face) {
    return !!outline[slug];
  }
  return !!outline[slug]?.[`${face.fontStyle}-${face.fontWeight}`];
}


;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/google-fonts-confirm-dialog.js



function GoogleFontsConfirmDialog() {
  const handleConfirm = () => {
    window.localStorage.setItem(
      "wp-font-library-google-fonts-permission",
      "true"
    );
    window.dispatchEvent(new Event("storage"));
  };
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "font-library__google-fonts-confirm", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Card, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.CardBody, { children: [
    /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHeading, { level: 2, children: (0,external_wp_i18n_namespaceObject.__)("Connect to Google Fonts") }),
    /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { margin: 6 }),
    /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { as: "p", children: (0,external_wp_i18n_namespaceObject.__)(
      "To install fonts from Google you must give permission to connect directly to Google servers. The fonts you install will be downloaded from Google and stored on your site. Your site will then use these locally-hosted fonts."
    ) }),
    /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { margin: 3 }),
    /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { as: "p", children: (0,external_wp_i18n_namespaceObject.__)(
      "You can alternatively upload files directly on the Upload tab."
    ) }),
    /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { margin: 6 }),
    /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
      external_wp_components_namespaceObject.Button,
      {
        __next40pxDefaultSize: true,
        variant: "primary",
        onClick: handleConfirm,
        children: (0,external_wp_i18n_namespaceObject.__)("Allow access to Google Fonts")
      }
    )
  ] }) }) });
}
var google_fonts_confirm_dialog_default = GoogleFontsConfirmDialog;


;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/collection-font-variant.js





function CollectionFontVariant({
  face,
  font,
  handleToggleVariant,
  selected
}) {
  const handleToggleActivation = () => {
    if (font?.fontFace) {
      handleToggleVariant(font, face);
      return;
    }
    handleToggleVariant(font);
  };
  const displayName = font.name + " " + getFontFaceVariantName(face);
  const checkboxId = (0,external_wp_element_.useId)();
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "font-library-modal__font-card", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, { justify: "flex-start", align: "center", gap: "1rem", children: [
    /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
      external_wp_components_namespaceObject.CheckboxControl,
      {
        checked: selected,
        onChange: handleToggleActivation,
        __nextHasNoMarginBottom: true,
        id: checkboxId
      }
    ),
    /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("label", { htmlFor: checkboxId, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
      font_demo_default,
      {
        font: face,
        text: displayName,
        onClick: handleToggleActivation
      }
    ) })
  ] }) });
}
var collection_font_variant_default = CollectionFontVariant;


;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/font-collection.js















const DEFAULT_CATEGORY = {
  slug: "all",
  name: (0,external_wp_i18n_namespaceObject._x)("All", "font categories")
};
const LOCAL_STORAGE_ITEM = "wp-font-library-google-fonts-permission";
const MIN_WINDOW_HEIGHT = 500;
function FontCollection({ slug }) {
  const requiresPermission = slug === "google-fonts";
  const getGoogleFontsPermissionFromStorage = () => {
    return window.localStorage.getItem(LOCAL_STORAGE_ITEM) === "true";
  };
  const [selectedFont, setSelectedFont] = (0,external_wp_element_.useState)(null);
  const [notice, setNotice] = (0,external_wp_element_.useState)(false);
  const [fontsToInstall, setFontsToInstall] = (0,external_wp_element_.useState)([]);
  const [page, setPage] = (0,external_wp_element_.useState)(1);
  const [filters, setFilters] = (0,external_wp_element_.useState)({});
  const [renderConfirmDialog, setRenderConfirmDialog] = (0,external_wp_element_.useState)(
    requiresPermission && !getGoogleFontsPermissionFromStorage()
  );
  const { collections, getFontCollection, installFonts, isInstalling } = (0,external_wp_element_.useContext)(FontLibraryContext);
  const selectedCollection = collections.find(
    (collection) => collection.slug === slug
  );
  (0,external_wp_element_.useEffect)(() => {
    const handleStorage = () => {
      setRenderConfirmDialog(
        requiresPermission && !getGoogleFontsPermissionFromStorage()
      );
    };
    handleStorage();
    window.addEventListener("storage", handleStorage);
    return () => window.removeEventListener("storage", handleStorage);
  }, [slug, requiresPermission]);
  const revokeAccess = () => {
    window.localStorage.setItem(LOCAL_STORAGE_ITEM, "false");
    window.dispatchEvent(new Event("storage"));
  };
  (0,external_wp_element_.useEffect)(() => {
    const fetchFontCollection = async () => {
      try {
        await getFontCollection(slug);
        resetFilters();
      } catch (e) {
        if (!notice) {
          setNotice({
            type: "error",
            message: e?.message
          });
        }
      }
    };
    fetchFontCollection();
  }, [slug, getFontCollection, setNotice, notice]);
  (0,external_wp_element_.useEffect)(() => {
    setSelectedFont(null);
  }, [slug]);
  (0,external_wp_element_.useEffect)(() => {
    setFontsToInstall([]);
  }, [selectedFont]);
  const collectionFonts = (0,external_wp_element_.useMemo)(
    () => selectedCollection?.font_families ?? [],
    [selectedCollection]
  );
  const collectionCategories = selectedCollection?.categories ?? [];
  const categories = [DEFAULT_CATEGORY, ...collectionCategories];
  const fonts = (0,external_wp_element_.useMemo)(
    () => filterFonts(collectionFonts, filters),
    [collectionFonts, filters]
  );
  const isLoading = !selectedCollection?.font_families && !notice;
  const windowHeight = Math.max(window.innerHeight, MIN_WINDOW_HEIGHT);
  const pageSize = Math.floor((windowHeight - 417) / 61);
  const totalPages = Math.ceil(fonts.length / pageSize);
  const itemsStart = (page - 1) * pageSize;
  const itemsLimit = page * pageSize;
  const items = fonts.slice(itemsStart, itemsLimit);
  const handleCategoryFilter = (category) => {
    setFilters({ ...filters, category });
    setPage(1);
  };
  const handleUpdateSearchInput = (value) => {
    setFilters({ ...filters, search: value });
    setPage(1);
  };
  const debouncedUpdateSearchInput = (0,external_wp_compose_namespaceObject.debounce)(handleUpdateSearchInput, 300);
  const resetFilters = () => {
    setFilters({});
    setPage(1);
  };
  const handleToggleVariant = (font, face) => {
    const newFontsToInstall = toggleFont(font, face, fontsToInstall);
    setFontsToInstall(newFontsToInstall);
  };
  const fontToInstallOutline = getFontsOutline(fontsToInstall);
  const resetFontsToInstall = () => {
    setFontsToInstall([]);
  };
  const selectFontCount = fontsToInstall.length > 0 ? fontsToInstall[0]?.fontFace?.length : 0;
  const isIndeterminate = selectFontCount > 0 && selectFontCount !== selectedFont?.fontFace?.length;
  const isSelectAllChecked = selectFontCount === selectedFont?.fontFace?.length;
  const toggleSelectAll = () => {
    const newFonts = isSelectAllChecked ? [] : [selectedFont];
    setFontsToInstall(newFonts);
  };
  const handleInstall = async () => {
    setNotice(null);
    const fontFamily = fontsToInstall[0];
    try {
      if (fontFamily?.fontFace) {
        await Promise.all(
          fontFamily.fontFace.map(async (fontFace) => {
            if (fontFace.src) {
              fontFace.file = await downloadFontFaceAssets(
                fontFace.src
              );
            }
          })
        );
      }
    } catch (error) {
      setNotice({
        type: "error",
        message: (0,external_wp_i18n_namespaceObject.__)(
          "Error installing the fonts, could not be downloaded."
        )
      });
      return;
    }
    try {
      await installFonts([fontFamily]);
      setNotice({
        type: "success",
        message: (0,external_wp_i18n_namespaceObject.__)("Fonts were installed successfully.")
      });
    } catch (error) {
      setNotice({
        type: "error",
        message: error.message
      });
    }
    resetFontsToInstall();
  };
  const getSortedFontFaces = (fontFamily) => {
    if (!fontFamily) {
      return [];
    }
    if (!fontFamily.fontFace || !fontFamily.fontFace.length) {
      return [
        {
          fontFamily: fontFamily.fontFamily,
          fontStyle: "normal",
          fontWeight: "400"
        }
      ];
    }
    return sortFontFaces(fontFamily.fontFace);
  };
  if (renderConfirmDialog) {
    return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(google_fonts_confirm_dialog_default, {});
  }
  const ActionsComponent = () => {
    if (slug !== "google-fonts" || renderConfirmDialog || selectedFont) {
      return null;
    }
    return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
      external_wp_components_namespaceObject.DropdownMenu,
      {
        icon: more_vertical_default,
        label: (0,external_wp_i18n_namespaceObject.__)("Actions"),
        popoverProps: {
          position: "bottom left"
        },
        controls: [
          {
            title: (0,external_wp_i18n_namespaceObject.__)("Revoke access to Google Fonts"),
            onClick: revokeAccess
          }
        ]
      }
    );
  };
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "font-library-modal__tabpanel-layout", children: [
    isLoading && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "font-library-modal__loading", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ProgressBar, {}) }),
    !isLoading && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
      /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
        external_wp_components_namespaceObject.Navigator,
        {
          initialPath: "/",
          className: "font-library-modal__tabpanel-layout",
          children: [
            /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Navigator.Screen, { path: "/", children: [
              /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "space-between", children: [
                /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { children: [
                  /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHeading, { level: 2, size: 13, children: selectedCollection.name }),
                  /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { children: selectedCollection.description })
                ] }),
                /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ActionsComponent, {})
              ] }),
              /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { margin: 4 }),
              /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, { children: [
                /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
                  external_wp_components_namespaceObject.SearchControl,
                  {
                    className: "font-library-modal__search",
                    value: filters.search,
                    placeholder: (0,external_wp_i18n_namespaceObject.__)("Font name\u2026"),
                    label: (0,external_wp_i18n_namespaceObject.__)("Search"),
                    onChange: debouncedUpdateSearchInput,
                    __nextHasNoMarginBottom: true,
                    hideLabelFromVision: false
                  }
                ) }),
                /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
                  external_wp_components_namespaceObject.SelectControl,
                  {
                    __nextHasNoMarginBottom: true,
                    __next40pxDefaultSize: true,
                    label: (0,external_wp_i18n_namespaceObject.__)("Category"),
                    value: filters.category,
                    onChange: handleCategoryFilter,
                    children: categories && categories.map((category) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
                      "option",
                      {
                        value: category.slug,
                        children: category.name
                      },
                      category.slug
                    ))
                  }
                ) })
              ] }),
              /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { margin: 4 }),
              !!selectedCollection?.font_families?.length && !fonts.length && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { children: (0,external_wp_i18n_namespaceObject.__)(
                "No fonts found. Try with a different search term."
              ) }),
              /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "font-library-modal__fonts-grid__main", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
                "ul",
                {
                  role: "list",
                  className: "font-library-modal__fonts-list",
                  children: items.map((font) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
                    "li",
                    {
                      className: "font-library-modal__fonts-list-item",
                      children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
                        font_card_default,
                        {
                          font: font.font_family_settings,
                          navigatorPath: "/fontFamily",
                          onClick: () => {
                            setSelectedFont(
                              font.font_family_settings
                            );
                          }
                        }
                      )
                    },
                    font.font_family_settings.slug
                  ))
                }
              ) })
            ] }),
            /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Navigator.Screen, { path: "/fontFamily", children: [
              /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, { justify: "flex-start", children: [
                /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
                  external_wp_components_namespaceObject.Navigator.BackButton,
                  {
                    icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_right_default : chevron_left_default,
                    size: "small",
                    onClick: () => {
                      setSelectedFont(null);
                      setNotice(null);
                    },
                    label: (0,external_wp_i18n_namespaceObject.__)("Back")
                  }
                ),
                /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
                  external_wp_components_namespaceObject.__experimentalHeading,
                  {
                    level: 2,
                    size: 13,
                    className: "edit-site-global-styles-header",
                    children: selectedFont?.name
                  }
                )
              ] }),
              notice && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
                /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { margin: 1 }),
                /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
                  external_wp_components_namespaceObject.Notice,
                  {
                    status: notice.type,
                    onRemove: () => setNotice(null),
                    children: notice.message
                  }
                ),
                /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { margin: 1 })
              ] }),
              /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { margin: 4 }),
              /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { children: (0,external_wp_i18n_namespaceObject.__)("Select font variants to install.") }),
              /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { margin: 4 }),
              /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
                external_wp_components_namespaceObject.CheckboxControl,
                {
                  className: "font-library-modal__select-all",
                  label: (0,external_wp_i18n_namespaceObject.__)("Select all"),
                  checked: isSelectAllChecked,
                  onChange: toggleSelectAll,
                  indeterminate: isIndeterminate,
                  __nextHasNoMarginBottom: true
                }
              ),
              /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 0, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
                "ul",
                {
                  role: "list",
                  className: "font-library-modal__fonts-list",
                  children: getSortedFontFaces(selectedFont).map(
                    (face, i) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
                      "li",
                      {
                        className: "font-library-modal__fonts-list-item",
                        children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
                          collection_font_variant_default,
                          {
                            font: selectedFont,
                            face,
                            handleToggleVariant,
                            selected: isFontFontFaceInOutline(
                              selectedFont.slug,
                              selectedFont.fontFace ? face : null,
                              // If the font has no fontFace, we want to check if the font is in the outline
                              fontToInstallOutline
                            )
                          }
                        )
                      },
                      `face${i}`
                    )
                  )
                }
              ) }),
              /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { margin: 16 })
            ] })
          ]
        }
      ),
      selectedFont && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
        external_wp_components_namespaceObject.Flex,
        {
          justify: "flex-end",
          className: "font-library-modal__footer",
          children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
            external_wp_components_namespaceObject.Button,
            {
              __next40pxDefaultSize: true,
              variant: "primary",
              onClick: handleInstall,
              isBusy: isInstalling,
              disabled: fontsToInstall.length === 0 || isInstalling,
              accessibleWhenDisabled: true,
              children: (0,external_wp_i18n_namespaceObject.__)("Install")
            }
          )
        }
      ),
      !selectedFont && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
        external_wp_components_namespaceObject.__experimentalHStack,
        {
          expanded: false,
          className: "font-library-modal__footer",
          justify: "end",
          spacing: 6,
          children: [
            /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
              external_wp_components_namespaceObject.__experimentalHStack,
              {
                justify: "flex-start",
                expanded: false,
                spacing: 1,
                className: "font-library-modal__page-selection",
                children: (0,external_wp_element_.createInterpolateElement)(
                  (0,external_wp_i18n_namespaceObject.sprintf)(
                    // translators: 1: Current page number, 2: Total number of pages.
                    (0,external_wp_i18n_namespaceObject._x)(
                      "<div>Page</div>%1$s<div>of %2$s</div>",
                      "paging"
                    ),
                    "<CurrentPage />",
                    totalPages
                  ),
                  {
                    div: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { "aria-hidden": true }),
                    CurrentPage: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
                      external_wp_components_namespaceObject.SelectControl,
                      {
                        "aria-label": (0,external_wp_i18n_namespaceObject.__)(
                          "Current page"
                        ),
                        value: page,
                        options: [
                          ...Array(totalPages)
                        ].map((e, i) => {
                          return {
                            label: i + 1,
                            value: i + 1
                          };
                        }),
                        onChange: (newPage) => setPage(
                          parseInt(newPage)
                        ),
                        size: "small",
                        __nextHasNoMarginBottom: true,
                        variant: "minimal"
                      }
                    )
                  }
                )
              }
            ),
            /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { expanded: false, spacing: 1, children: [
              /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
                external_wp_components_namespaceObject.Button,
                {
                  onClick: () => setPage(page - 1),
                  disabled: page === 1,
                  accessibleWhenDisabled: true,
                  label: (0,external_wp_i18n_namespaceObject.__)("Previous page"),
                  icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? next_default : previous_default,
                  showTooltip: true,
                  size: "compact",
                  tooltipPosition: "top"
                }
              ),
              /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
                external_wp_components_namespaceObject.Button,
                {
                  onClick: () => setPage(page + 1),
                  disabled: page === totalPages,
                  accessibleWhenDisabled: true,
                  label: (0,external_wp_i18n_namespaceObject.__)("Next page"),
                  icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? previous_default : next_default,
                  showTooltip: true,
                  size: "compact",
                  tooltipPosition: "top"
                }
              )
            ] })
          ]
        }
      )
    ] })
  ] });
}
var font_collection_default = FontCollection;


// EXTERNAL MODULE: ./node_modules/@wordpress/edit-site/lib/unbrotli.js
var unbrotli = __webpack_require__(8572);
var unbrotli_default = /*#__PURE__*/__webpack_require__.n(unbrotli);
// EXTERNAL MODULE: ./node_modules/@wordpress/edit-site/lib/inflate.js
var inflate = __webpack_require__(4660);
var inflate_default = /*#__PURE__*/__webpack_require__.n(inflate);
;// ./node_modules/@wordpress/edit-site/lib/lib-font.browser.js
/**
 * Credits:
 *
 * lib-font
 * https://github.com/Pomax/lib-font
 * https://github.com/Pomax/lib-font/blob/master/lib-font.browser.js
 *
 * The MIT License (MIT)
 *
 * Copyright (c) 2020 pomax@nihongoresources.com
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in all
 * copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 */

/* eslint eslint-comments/no-unlimited-disable: 0 */
/* eslint-disable */
// import pako from 'pako';



let fetchFunction = globalThis.fetch;
// if ( ! fetchFunction ) {
// 	let backlog = [];
// 	fetchFunction = globalThis.fetch = ( ...args ) =>
// 		new Promise( ( resolve, reject ) => {
// 			backlog.push( { args: args, resolve: resolve, reject: reject } );
// 		} );
// 	import( 'fs' )
// 		.then( ( fs ) => {
// 			fetchFunction = globalThis.fetch = async function ( path ) {
// 				return new Promise( ( resolve, reject ) => {
// 					fs.readFile( path, ( err, data ) => {
// 						if ( err ) return reject( err );
// 						resolve( { ok: true, arrayBuffer: () => data.buffer } );
// 					} );
// 				} );
// 			};
// 			while ( backlog.length ) {
// 				let instruction = backlog.shift();
// 				fetchFunction( ...instruction.args )
// 					.then( ( data ) => instruction.resolve( data ) )
// 					.catch( ( err ) => instruction.reject( err ) );
// 			}
// 		} )
// 		.catch( ( err ) => {
// 			console.error( err );
// 			throw new Error(
// 				`lib-font cannot run unless either the Fetch API or Node's filesystem module is available.`
// 			);
// 		} );
// }
class lib_font_browser_Event {
	constructor( type, detail = {}, msg ) {
		this.type = type;
		this.detail = detail;
		this.msg = msg;
		Object.defineProperty( this, `__mayPropagate`, {
			enumerable: false,
			writable: true,
		} );
		this.__mayPropagate = true;
	}
	preventDefault() {}
	stopPropagation() {
		this.__mayPropagate = false;
	}
	valueOf() {
		return this;
	}
	toString() {
		return this.msg
			? `[${ this.type } event]: ${ this.msg }`
			: `[${ this.type } event]`;
	}
}
class EventManager {
	constructor() {
		this.listeners = {};
	}
	addEventListener( type, listener, useCapture ) {
		let bin = this.listeners[ type ] || [];
		if ( useCapture ) bin.unshift( listener );
		else bin.push( listener );
		this.listeners[ type ] = bin;
	}
	removeEventListener( type, listener ) {
		let bin = this.listeners[ type ] || [];
		let pos = bin.findIndex( ( e ) => e === listener );
		if ( pos > -1 ) {
			bin.splice( pos, 1 );
			this.listeners[ type ] = bin;
		}
	}
	dispatch( event ) {
		let bin = this.listeners[ event.type ];
		if ( bin ) {
			for ( let l = 0, e = bin.length; l < e; l++ ) {
				if ( ! event.__mayPropagate ) break;
				bin[ l ]( event );
			}
		}
	}
}
const startDate = new Date( `1904-01-01T00:00:00+0000` ).getTime();
function asText( data ) {
	return Array.from( data )
		.map( ( v ) => String.fromCharCode( v ) )
		.join( `` );
}
class Parser {
	constructor( dict, dataview, name ) {
		this.name = ( name || dict.tag || `` ).trim();
		this.length = dict.length;
		this.start = dict.offset;
		this.offset = 0;
		this.data = dataview;
		[
			`getInt8`,
			`getUint8`,
			`getInt16`,
			`getUint16`,
			`getInt32`,
			`getUint32`,
			`getBigInt64`,
			`getBigUint64`,
		].forEach( ( name ) => {
			let fn = name.replace( /get(Big)?/, '' ).toLowerCase();
			let increment = parseInt( name.replace( /[^\d]/g, '' ) ) / 8;
			Object.defineProperty( this, fn, {
				get: () => this.getValue( name, increment ),
			} );
		} );
	}
	get currentPosition() {
		return this.start + this.offset;
	}
	set currentPosition( position ) {
		this.start = position;
		this.offset = 0;
	}
	skip( n = 0, bits = 8 ) {
		this.offset += ( n * bits ) / 8;
	}
	getValue( type, increment ) {
		let pos = this.start + this.offset;
		this.offset += increment;
		try {
			return this.data[ type ]( pos );
		} catch ( e ) {
			console.error( `parser`, type, increment, this );
			console.error( `parser`, this.start, this.offset );
			throw e;
		}
	}
	flags( n ) {
		if ( n === 8 || n === 16 || n === 32 || n === 64 ) {
			return this[ `uint${ n }` ]
				.toString( 2 )
				.padStart( n, 0 )
				.split( `` )
				.map( ( v ) => v === '1' );
		}
		console.error(
			`Error parsing flags: flag types can only be 1, 2, 4, or 8 bytes long`
		);
		console.trace();
	}
	get tag() {
		const t = this.uint32;
		return asText( [
			( t >> 24 ) & 255,
			( t >> 16 ) & 255,
			( t >> 8 ) & 255,
			t & 255,
		] );
	}
	get fixed() {
		let major = this.int16;
		let minor = Math.round( ( 1e3 * this.uint16 ) / 65356 );
		return major + minor / 1e3;
	}
	get legacyFixed() {
		let major = this.uint16;
		let minor = this.uint16.toString( 16 ).padStart( 4, 0 );
		return parseFloat( `${ major }.${ minor }` );
	}
	get uint24() {
		return ( this.uint8 << 16 ) + ( this.uint8 << 8 ) + this.uint8;
	}
	get uint128() {
		let value = 0;
		for ( let i = 0; i < 5; i++ ) {
			let byte = this.uint8;
			value = value * 128 + ( byte & 127 );
			if ( byte < 128 ) break;
		}
		return value;
	}
	get longdatetime() {
		return new Date( startDate + 1e3 * parseInt( this.int64.toString() ) );
	}
	get fword() {
		return this.int16;
	}
	get ufword() {
		return this.uint16;
	}
	get Offset16() {
		return this.uint16;
	}
	get Offset32() {
		return this.uint32;
	}
	get F2DOT14() {
		const bits = p.uint16;
		const integer = [ 0, 1, -2, -1 ][ bits >> 14 ];
		const fraction = bits & 16383;
		return integer + fraction / 16384;
	}
	verifyLength() {
		if ( this.offset != this.length ) {
			console.error(
				`unexpected parsed table size (${ this.offset }) for "${ this.name }" (expected ${ this.length })`
			);
		}
	}
	readBytes( n = 0, position = 0, bits = 8, signed = false ) {
		n = n || this.length;
		if ( n === 0 ) return [];
		if ( position ) this.currentPosition = position;
		const fn = `${ signed ? `` : `u` }int${ bits }`,
			slice = [];
		while ( n-- ) slice.push( this[ fn ] );
		return slice;
	}
}
class ParsedData {
	constructor( parser ) {
		const pGetter = { enumerable: false, get: () => parser };
		Object.defineProperty( this, `parser`, pGetter );
		const start = parser.currentPosition;
		const startGetter = { enumerable: false, get: () => start };
		Object.defineProperty( this, `start`, startGetter );
	}
	load( struct ) {
		Object.keys( struct ).forEach( ( p ) => {
			let props = Object.getOwnPropertyDescriptor( struct, p );
			if ( props.get ) {
				this[ p ] = props.get.bind( this );
			} else if ( props.value !== undefined ) {
				this[ p ] = props.value;
			}
		} );
		if ( this.parser.length ) {
			this.parser.verifyLength();
		}
	}
}
class SimpleTable extends ParsedData {
	constructor( dict, dataview, name ) {
		const { parser: parser, start: start } = super(
			new Parser( dict, dataview, name )
		);
		const pGetter = { enumerable: false, get: () => parser };
		Object.defineProperty( this, `p`, pGetter );
		const startGetter = { enumerable: false, get: () => start };
		Object.defineProperty( this, `tableStart`, startGetter );
	}
}
function lazy$1( object, property, getter ) {
	let val;
	Object.defineProperty( object, property, {
		get: () => {
			if ( val ) return val;
			val = getter();
			return val;
		},
		enumerable: true,
	} );
}
class SFNT extends SimpleTable {
	constructor( font, dataview, createTable ) {
		const { p: p } = super( { offset: 0, length: 12 }, dataview, `sfnt` );
		this.version = p.uint32;
		this.numTables = p.uint16;
		this.searchRange = p.uint16;
		this.entrySelector = p.uint16;
		this.rangeShift = p.uint16;
		p.verifyLength();
		this.directory = [ ...new Array( this.numTables ) ].map(
			( _ ) => new TableRecord( p )
		);
		this.tables = {};
		this.directory.forEach( ( entry ) => {
			const getter = () =>
				createTable(
					this.tables,
					{
						tag: entry.tag,
						offset: entry.offset,
						length: entry.length,
					},
					dataview
				);
			lazy$1( this.tables, entry.tag.trim(), getter );
		} );
	}
}
class TableRecord {
	constructor( p ) {
		this.tag = p.tag;
		this.checksum = p.uint32;
		this.offset = p.uint32;
		this.length = p.uint32;
	}
}
const gzipDecode = (inflate_default()).inflate || undefined;
let nativeGzipDecode = undefined;
// if ( ! gzipDecode ) {
// 	import( 'zlib' ).then( ( zlib ) => {
// 		nativeGzipDecode = ( buffer ) => zlib.unzipSync( buffer );
// 	} );
// }
class WOFF$1 extends SimpleTable {
	constructor( font, dataview, createTable ) {
		const { p: p } = super( { offset: 0, length: 44 }, dataview, `woff` );
		this.signature = p.tag;
		this.flavor = p.uint32;
		this.length = p.uint32;
		this.numTables = p.uint16;
		p.uint16;
		this.totalSfntSize = p.uint32;
		this.majorVersion = p.uint16;
		this.minorVersion = p.uint16;
		this.metaOffset = p.uint32;
		this.metaLength = p.uint32;
		this.metaOrigLength = p.uint32;
		this.privOffset = p.uint32;
		this.privLength = p.uint32;
		p.verifyLength();
		this.directory = [ ...new Array( this.numTables ) ].map(
			( _ ) => new WoffTableDirectoryEntry( p )
		);
		buildWoffLazyLookups( this, dataview, createTable );
	}
}
class WoffTableDirectoryEntry {
	constructor( p ) {
		this.tag = p.tag;
		this.offset = p.uint32;
		this.compLength = p.uint32;
		this.origLength = p.uint32;
		this.origChecksum = p.uint32;
	}
}
function buildWoffLazyLookups( woff, dataview, createTable ) {
	woff.tables = {};
	woff.directory.forEach( ( entry ) => {
		lazy$1( woff.tables, entry.tag.trim(), () => {
			let offset = 0;
			let view = dataview;
			if ( entry.compLength !== entry.origLength ) {
				const data = dataview.buffer.slice(
					entry.offset,
					entry.offset + entry.compLength
				);
				let unpacked;
				if ( gzipDecode ) {
					unpacked = gzipDecode( new Uint8Array( data ) );
				} else if ( nativeGzipDecode ) {
					unpacked = nativeGzipDecode( new Uint8Array( data ) );
				} else {
					const msg = `no brotli decoder available to decode WOFF2 font`;
					if ( font.onerror ) font.onerror( msg );
					throw new Error( msg );
				}
				view = new DataView( unpacked.buffer );
			} else {
				offset = entry.offset;
			}
			return createTable(
				woff.tables,
				{ tag: entry.tag, offset: offset, length: entry.origLength },
				view
			);
		} );
	} );
}
const brotliDecode = (unbrotli_default());
let nativeBrotliDecode = undefined;
// if ( ! brotliDecode ) {
// 	import( 'zlib' ).then( ( zlib ) => {
// 		nativeBrotliDecode = ( buffer ) => zlib.brotliDecompressSync( buffer );
// 	} );
// }
class WOFF2$1 extends SimpleTable {
	constructor( font, dataview, createTable ) {
		const { p: p } = super( { offset: 0, length: 48 }, dataview, `woff2` );
		this.signature = p.tag;
		this.flavor = p.uint32;
		this.length = p.uint32;
		this.numTables = p.uint16;
		p.uint16;
		this.totalSfntSize = p.uint32;
		this.totalCompressedSize = p.uint32;
		this.majorVersion = p.uint16;
		this.minorVersion = p.uint16;
		this.metaOffset = p.uint32;
		this.metaLength = p.uint32;
		this.metaOrigLength = p.uint32;
		this.privOffset = p.uint32;
		this.privLength = p.uint32;
		p.verifyLength();
		this.directory = [ ...new Array( this.numTables ) ].map(
			( _ ) => new Woff2TableDirectoryEntry( p )
		);
		let dictOffset = p.currentPosition;
		this.directory[ 0 ].offset = 0;
		this.directory.forEach( ( e, i ) => {
			let next = this.directory[ i + 1 ];
			if ( next ) {
				next.offset =
					e.offset +
					( e.transformLength !== undefined
						? e.transformLength
						: e.origLength );
			}
		} );
		let decoded;
		let buffer = dataview.buffer.slice( dictOffset );
		if ( brotliDecode ) {
			decoded = brotliDecode( new Uint8Array( buffer ) );
		} else if ( nativeBrotliDecode ) {
			decoded = new Uint8Array( nativeBrotliDecode( buffer ) );
		} else {
			const msg = `no brotli decoder available to decode WOFF2 font`;
			if ( font.onerror ) font.onerror( msg );
			throw new Error( msg );
		}
		buildWoff2LazyLookups( this, decoded, createTable );
	}
}
class Woff2TableDirectoryEntry {
	constructor( p ) {
		this.flags = p.uint8;
		const tagNumber = ( this.tagNumber = this.flags & 63 );
		if ( tagNumber === 63 ) {
			this.tag = p.tag;
		} else {
			this.tag = getWOFF2Tag( tagNumber );
		}
		const transformVersion = ( this.transformVersion =
			( this.flags & 192 ) >> 6 );
		let hasTransforms = transformVersion !== 0;
		if ( this.tag === `glyf` || this.tag === `loca` ) {
			hasTransforms = this.transformVersion !== 3;
		}
		this.origLength = p.uint128;
		if ( hasTransforms ) {
			this.transformLength = p.uint128;
		}
	}
}
function buildWoff2LazyLookups( woff2, decoded, createTable ) {
	woff2.tables = {};
	woff2.directory.forEach( ( entry ) => {
		lazy$1( woff2.tables, entry.tag.trim(), () => {
			const start = entry.offset;
			const end =
				start +
				( entry.transformLength
					? entry.transformLength
					: entry.origLength );
			const data = new DataView( decoded.slice( start, end ).buffer );
			try {
				return createTable(
					woff2.tables,
					{ tag: entry.tag, offset: 0, length: entry.origLength },
					data
				);
			} catch ( e ) {
				console.error( e );
			}
		} );
	} );
}
function getWOFF2Tag( flag ) {
	return [
		`cmap`,
		`head`,
		`hhea`,
		`hmtx`,
		`maxp`,
		`name`,
		`OS/2`,
		`post`,
		`cvt `,
		`fpgm`,
		`glyf`,
		`loca`,
		`prep`,
		`CFF `,
		`VORG`,
		`EBDT`,
		`EBLC`,
		`gasp`,
		`hdmx`,
		`kern`,
		`LTSH`,
		`PCLT`,
		`VDMX`,
		`vhea`,
		`vmtx`,
		`BASE`,
		`GDEF`,
		`GPOS`,
		`GSUB`,
		`EBSC`,
		`JSTF`,
		`MATH`,
		`CBDT`,
		`CBLC`,
		`COLR`,
		`CPAL`,
		`SVG `,
		`sbix`,
		`acnt`,
		`avar`,
		`bdat`,
		`bloc`,
		`bsln`,
		`cvar`,
		`fdsc`,
		`feat`,
		`fmtx`,
		`fvar`,
		`gvar`,
		`hsty`,
		`just`,
		`lcar`,
		`mort`,
		`morx`,
		`opbd`,
		`prop`,
		`trak`,
		`Zapf`,
		`Silf`,
		`Glat`,
		`Gloc`,
		`Feat`,
		`Sill`,
	][ flag & 63 ];
}
const tableClasses = {};
let tableClassesLoaded = false;
Promise.all( [
	Promise.resolve().then( function () {
		return cmap$1;
	} ),
	Promise.resolve().then( function () {
		return head$1;
	} ),
	Promise.resolve().then( function () {
		return hhea$1;
	} ),
	Promise.resolve().then( function () {
		return hmtx$1;
	} ),
	Promise.resolve().then( function () {
		return maxp$1;
	} ),
	Promise.resolve().then( function () {
		return name$1;
	} ),
	Promise.resolve().then( function () {
		return OS2$1;
	} ),
	Promise.resolve().then( function () {
		return post$1;
	} ),
	Promise.resolve().then( function () {
		return BASE$1;
	} ),
	Promise.resolve().then( function () {
		return GDEF$1;
	} ),
	Promise.resolve().then( function () {
		return GSUB$1;
	} ),
	Promise.resolve().then( function () {
		return GPOS$1;
	} ),
	Promise.resolve().then( function () {
		return SVG$1;
	} ),
	Promise.resolve().then( function () {
		return fvar$1;
	} ),
	Promise.resolve().then( function () {
		return cvt$1;
	} ),
	Promise.resolve().then( function () {
		return fpgm$1;
	} ),
	Promise.resolve().then( function () {
		return gasp$1;
	} ),
	Promise.resolve().then( function () {
		return glyf$1;
	} ),
	Promise.resolve().then( function () {
		return loca$1;
	} ),
	Promise.resolve().then( function () {
		return prep$1;
	} ),
	Promise.resolve().then( function () {
		return CFF$1;
	} ),
	Promise.resolve().then( function () {
		return CFF2$1;
	} ),
	Promise.resolve().then( function () {
		return VORG$1;
	} ),
	Promise.resolve().then( function () {
		return EBLC$1;
	} ),
	Promise.resolve().then( function () {
		return EBDT$1;
	} ),
	Promise.resolve().then( function () {
		return EBSC$1;
	} ),
	Promise.resolve().then( function () {
		return CBLC$1;
	} ),
	Promise.resolve().then( function () {
		return CBDT$1;
	} ),
	Promise.resolve().then( function () {
		return sbix$1;
	} ),
	Promise.resolve().then( function () {
		return COLR$1;
	} ),
	Promise.resolve().then( function () {
		return CPAL$1;
	} ),
	Promise.resolve().then( function () {
		return DSIG$1;
	} ),
	Promise.resolve().then( function () {
		return hdmx$1;
	} ),
	Promise.resolve().then( function () {
		return kern$1;
	} ),
	Promise.resolve().then( function () {
		return LTSH$1;
	} ),
	Promise.resolve().then( function () {
		return MERG$1;
	} ),
	Promise.resolve().then( function () {
		return meta$1;
	} ),
	Promise.resolve().then( function () {
		return PCLT$1;
	} ),
	Promise.resolve().then( function () {
		return VDMX$1;
	} ),
	Promise.resolve().then( function () {
		return vhea$1;
	} ),
	Promise.resolve().then( function () {
		return vmtx$1;
	} ),
] ).then( ( data ) => {
	data.forEach( ( e ) => {
		let name = Object.keys( e )[ 0 ];
		tableClasses[ name ] = e[ name ];
	} );
	tableClassesLoaded = true;
} );
function createTable( tables, dict, dataview ) {
	let name = dict.tag.replace( /[^\w\d]/g, `` );
	let Type = tableClasses[ name ];
	if ( Type ) return new Type( dict, dataview, tables );
	console.warn(
		`lib-font has no definition for ${ name }. The table was skipped.`
	);
	return {};
}
function loadTableClasses() {
	let count = 0;
	function checkLoaded( resolve, reject ) {
		if ( ! tableClassesLoaded ) {
			if ( count > 10 ) {
				return reject( new Error( `loading took too long` ) );
			}
			count++;
			return setTimeout( () => checkLoaded( resolve ), 250 );
		}
		resolve( createTable );
	}
	return new Promise( ( resolve, reject ) => checkLoaded( resolve ) );
}
function getFontCSSFormat( path, errorOnStyle ) {
	let pos = path.lastIndexOf( `.` );
	let ext = ( path.substring( pos + 1 ) || `` ).toLowerCase();
	let format = {
		ttf: `truetype`,
		otf: `opentype`,
		woff: `woff`,
		woff2: `woff2`,
	}[ ext ];
	if ( format ) return format;
	let msg = {
		eot: `The .eot format is not supported: it died in January 12, 2016, when Microsoft retired all versions of IE that didn't already support WOFF.`,
		svg: `The .svg format is not supported: SVG fonts (not to be confused with OpenType with embedded SVG) were so bad we took the entire fonts chapter out of the SVG specification again.`,
		fon: `The .fon format is not supported: this is an ancient Windows bitmap font format.`,
		ttc: `Based on the current CSS specification, font collections are not (yet?) supported.`,
	}[ ext ];
	if ( ! msg ) msg = `${ path } is not a known webfont format.`;
	if ( errorOnStyle ) {
		throw new Error( msg );
	} else {
		console.warn( `Could not load font: ${ msg }` );
	}
}
async function setupFontFace( name, url, options = {} ) {
	if ( ! globalThis.document ) return;
	let format = getFontCSSFormat( url, options.errorOnStyle );
	if ( ! format ) return;
	let style = document.createElement( `style` );
	style.className = `injected-by-Font-js`;
	let rules = [];
	if ( options.styleRules ) {
		rules = Object.entries( options.styleRules ).map(
			( [ key, value ] ) => `${ key }: ${ value };`
		);
	}
	style.textContent = `\n@font-face {\n    font-family: "${ name }";\n    ${ rules.join(
		`\n\t`
	) }\n    src: url("${ url }") format("${ format }");\n}`;
	globalThis.document.head.appendChild( style );
	return style;
}
const TTF = [ 0, 1, 0, 0 ];
const OTF = [ 79, 84, 84, 79 ];
const WOFF = [ 119, 79, 70, 70 ];
const WOFF2 = [ 119, 79, 70, 50 ];
function match( ar1, ar2 ) {
	if ( ar1.length !== ar2.length ) return;
	for ( let i = 0; i < ar1.length; i++ ) {
		if ( ar1[ i ] !== ar2[ i ] ) return;
	}
	return true;
}
function validFontFormat( dataview ) {
	const LEAD_BYTES = [
		dataview.getUint8( 0 ),
		dataview.getUint8( 1 ),
		dataview.getUint8( 2 ),
		dataview.getUint8( 3 ),
	];
	if ( match( LEAD_BYTES, TTF ) || match( LEAD_BYTES, OTF ) ) return `SFNT`;
	if ( match( LEAD_BYTES, WOFF ) ) return `WOFF`;
	if ( match( LEAD_BYTES, WOFF2 ) ) return `WOFF2`;
}
function checkFetchResponseStatus( response ) {
	if ( ! response.ok ) {
		throw new Error(
			`HTTP ${ response.status } - ${ response.statusText }`
		);
	}
	return response;
}
class Font extends EventManager {
	constructor( name, options = {} ) {
		super();
		this.name = name;
		this.options = options;
		this.metrics = false;
	}
	get src() {
		return this.__src;
	}
	set src( src ) {
		this.__src = src;
		( async () => {
			if ( globalThis.document && ! this.options.skipStyleSheet ) {
				await setupFontFace( this.name, src, this.options );
			}
			this.loadFont( src );
		} )();
	}
	async loadFont( url, filename ) {
		fetch( url )
			.then(
				( response ) =>
					checkFetchResponseStatus( response ) &&
					response.arrayBuffer()
			)
			.then( ( buffer ) =>
				this.fromDataBuffer( buffer, filename || url )
			)
			.catch( ( err ) => {
				const evt = new lib_font_browser_Event(
					`error`,
					err,
					`Failed to load font at ${ filename || url }`
				);
				this.dispatch( evt );
				if ( this.onerror ) this.onerror( evt );
			} );
	}
	async fromDataBuffer( buffer, filenameOrUrL ) {
		this.fontData = new DataView( buffer );
		let type = validFontFormat( this.fontData );
		if ( ! type ) {
			throw new Error(
				`${ filenameOrUrL } is either an unsupported font format, or not a font at all.`
			);
		}
		await this.parseBasicData( type );
		const evt = new lib_font_browser_Event( 'load', { font: this } );
		this.dispatch( evt );
		if ( this.onload ) this.onload( evt );
	}
	async parseBasicData( type ) {
		return loadTableClasses().then( ( createTable ) => {
			if ( type === `SFNT` ) {
				this.opentype = new SFNT( this, this.fontData, createTable );
			}
			if ( type === `WOFF` ) {
				this.opentype = new WOFF$1( this, this.fontData, createTable );
			}
			if ( type === `WOFF2` ) {
				this.opentype = new WOFF2$1( this, this.fontData, createTable );
			}
			return this.opentype;
		} );
	}
	getGlyphId( char ) {
		return this.opentype.tables.cmap.getGlyphId( char );
	}
	reverse( glyphid ) {
		return this.opentype.tables.cmap.reverse( glyphid );
	}
	supports( char ) {
		return this.getGlyphId( char ) !== 0;
	}
	supportsVariation( variation ) {
		return (
			this.opentype.tables.cmap.supportsVariation( variation ) !== false
		);
	}
	measureText( text, size = 16 ) {
		if ( this.__unloaded )
			throw new Error(
				'Cannot measure text: font was unloaded. Please reload before calling measureText()'
			);
		let d = document.createElement( 'div' );
		d.textContent = text;
		d.style.fontFamily = this.name;
		d.style.fontSize = `${ size }px`;
		d.style.color = `transparent`;
		d.style.background = `transparent`;
		d.style.top = `0`;
		d.style.left = `0`;
		d.style.position = `absolute`;
		document.body.appendChild( d );
		let bbox = d.getBoundingClientRect();
		document.body.removeChild( d );
		const OS2 = this.opentype.tables[ 'OS/2' ];
		bbox.fontSize = size;
		bbox.ascender = OS2.sTypoAscender;
		bbox.descender = OS2.sTypoDescender;
		return bbox;
	}
	unload() {
		if ( this.styleElement.parentNode ) {
			this.styleElement.parentNode.removeElement( this.styleElement );
			const evt = new lib_font_browser_Event( 'unload', { font: this } );
			this.dispatch( evt );
			if ( this.onunload ) this.onunload( evt );
		}
		this._unloaded = true;
	}
	load() {
		if ( this.__unloaded ) {
			delete this.__unloaded;
			document.head.appendChild( this.styleElement );
			const evt = new lib_font_browser_Event( 'load', { font: this } );
			this.dispatch( evt );
			if ( this.onload ) this.onload( evt );
		}
	}
}
globalThis.Font = Font;
class Subtable extends ParsedData {
	constructor( p, plaformID, encodingID ) {
		super( p );
		this.plaformID = plaformID;
		this.encodingID = encodingID;
	}
}
class Format0 extends Subtable {
	constructor( p, platformID, encodingID ) {
		super( p, platformID, encodingID );
		this.format = 0;
		this.length = p.uint16;
		this.language = p.uint16;
		this.glyphIdArray = [ ...new Array( 256 ) ].map( ( _ ) => p.uint8 );
	}
	supports( charCode ) {
		if ( charCode.charCodeAt ) {
			charCode = -1;
			console.warn(
				`supports(character) not implemented for cmap subtable format 0. only supports(id) is implemented.`
			);
		}
		return 0 <= charCode && charCode <= 255;
	}
	reverse( glyphID ) {
		console.warn( `reverse not implemented for cmap subtable format 0` );
		return {};
	}
	getSupportedCharCodes() {
		return [ { start: 1, end: 256 } ];
	}
}
class Format2 extends Subtable {
	constructor( p, platformID, encodingID ) {
		super( p, platformID, encodingID );
		this.format = 2;
		this.length = p.uint16;
		this.language = p.uint16;
		this.subHeaderKeys = [ ...new Array( 256 ) ].map( ( _ ) => p.uint16 );
		const subHeaderCount = Math.max( ...this.subHeaderKeys );
		const subHeaderOffset = p.currentPosition;
		lazy$1( this, `subHeaders`, () => {
			p.currentPosition = subHeaderOffset;
			return [ ...new Array( subHeaderCount ) ].map(
				( _ ) => new SubHeader( p )
			);
		} );
		const glyphIndexOffset = subHeaderOffset + subHeaderCount * 8;
		lazy$1( this, `glyphIndexArray`, () => {
			p.currentPosition = glyphIndexOffset;
			return [ ...new Array( subHeaderCount ) ].map( ( _ ) => p.uint16 );
		} );
	}
	supports( charCode ) {
		if ( charCode.charCodeAt ) {
			charCode = -1;
			console.warn(
				`supports(character) not implemented for cmap subtable format 2. only supports(id) is implemented.`
			);
		}
		const low = charCode && 255;
		const high = charCode && 65280;
		const subHeaderKey = this.subHeaders[ high ];
		const subheader = this.subHeaders[ subHeaderKey ];
		const first = subheader.firstCode;
		const last = first + subheader.entryCount;
		return first <= low && low <= last;
	}
	reverse( glyphID ) {
		console.warn( `reverse not implemented for cmap subtable format 2` );
		return {};
	}
	getSupportedCharCodes( preservePropNames = false ) {
		if ( preservePropNames ) {
			return this.subHeaders.map( ( h ) => ( {
				firstCode: h.firstCode,
				lastCode: h.lastCode,
			} ) );
		}
		return this.subHeaders.map( ( h ) => ( {
			start: h.firstCode,
			end: h.lastCode,
		} ) );
	}
}
class SubHeader {
	constructor( p ) {
		this.firstCode = p.uint16;
		this.entryCount = p.uint16;
		this.lastCode = this.first + this.entryCount;
		this.idDelta = p.int16;
		this.idRangeOffset = p.uint16;
	}
}
class Format4 extends Subtable {
	constructor( p, platformID, encodingID ) {
		super( p, platformID, encodingID );
		this.format = 4;
		this.length = p.uint16;
		this.language = p.uint16;
		this.segCountX2 = p.uint16;
		this.segCount = this.segCountX2 / 2;
		this.searchRange = p.uint16;
		this.entrySelector = p.uint16;
		this.rangeShift = p.uint16;
		const endCodePosition = p.currentPosition;
		lazy$1( this, `endCode`, () =>
			p.readBytes( this.segCount, endCodePosition, 16 )
		);
		const startCodePosition = endCodePosition + 2 + this.segCountX2;
		lazy$1( this, `startCode`, () =>
			p.readBytes( this.segCount, startCodePosition, 16 )
		);
		const idDeltaPosition = startCodePosition + this.segCountX2;
		lazy$1( this, `idDelta`, () =>
			p.readBytes( this.segCount, idDeltaPosition, 16, true )
		);
		const idRangePosition = idDeltaPosition + this.segCountX2;
		lazy$1( this, `idRangeOffset`, () =>
			p.readBytes( this.segCount, idRangePosition, 16 )
		);
		const glyphIdArrayPosition = idRangePosition + this.segCountX2;
		const glyphIdArrayLength =
			this.length - ( glyphIdArrayPosition - this.tableStart );
		lazy$1( this, `glyphIdArray`, () =>
			p.readBytes( glyphIdArrayLength, glyphIdArrayPosition, 16 )
		);
		lazy$1( this, `segments`, () =>
			this.buildSegments( idRangePosition, glyphIdArrayPosition, p )
		);
	}
	buildSegments( idRangePosition, glyphIdArrayPosition, p ) {
		const build = ( _, i ) => {
			let startCode = this.startCode[ i ],
				endCode = this.endCode[ i ],
				idDelta = this.idDelta[ i ],
				idRangeOffset = this.idRangeOffset[ i ],
				idRangeOffsetPointer = idRangePosition + 2 * i,
				glyphIDs = [];
			if ( idRangeOffset === 0 ) {
				for (
					let i = startCode + idDelta, e = endCode + idDelta;
					i <= e;
					i++
				) {
					glyphIDs.push( i );
				}
			} else {
				for ( let i = 0, e = endCode - startCode; i <= e; i++ ) {
					p.currentPosition =
						idRangeOffsetPointer + idRangeOffset + i * 2;
					glyphIDs.push( p.uint16 );
				}
			}
			return {
				startCode: startCode,
				endCode: endCode,
				idDelta: idDelta,
				idRangeOffset: idRangeOffset,
				glyphIDs: glyphIDs,
			};
		};
		return [ ...new Array( this.segCount ) ].map( build );
	}
	reverse( glyphID ) {
		let s = this.segments.find( ( v ) => v.glyphIDs.includes( glyphID ) );
		if ( ! s ) return {};
		const code = s.startCode + s.glyphIDs.indexOf( glyphID );
		return { code: code, unicode: String.fromCodePoint( code ) };
	}
	getGlyphId( charCode ) {
		if ( charCode.charCodeAt ) charCode = charCode.charCodeAt( 0 );
		if ( 55296 <= charCode && charCode <= 57343 ) return 0;
		if ( ( charCode & 65534 ) === 65534 || ( charCode & 65535 ) === 65535 )
			return 0;
		let segment = this.segments.find(
			( s ) => s.startCode <= charCode && charCode <= s.endCode
		);
		if ( ! segment ) return 0;
		return segment.glyphIDs[ charCode - segment.startCode ];
	}
	supports( charCode ) {
		return this.getGlyphId( charCode ) !== 0;
	}
	getSupportedCharCodes( preservePropNames = false ) {
		if ( preservePropNames ) return this.segments;
		return this.segments.map( ( v ) => ( {
			start: v.startCode,
			end: v.endCode,
		} ) );
	}
}
class Format6 extends Subtable {
	constructor( p, platformID, encodingID ) {
		super( p, platformID, encodingID );
		this.format = 6;
		this.length = p.uint16;
		this.language = p.uint16;
		this.firstCode = p.uint16;
		this.entryCount = p.uint16;
		this.lastCode = this.firstCode + this.entryCount - 1;
		const getter = () =>
			[ ...new Array( this.entryCount ) ].map( ( _ ) => p.uint16 );
		lazy$1( this, `glyphIdArray`, getter );
	}
	supports( charCode ) {
		if ( charCode.charCodeAt ) {
			charCode = -1;
			console.warn(
				`supports(character) not implemented for cmap subtable format 6. only supports(id) is implemented.`
			);
		}
		if ( charCode < this.firstCode ) return {};
		if ( charCode > this.firstCode + this.entryCount ) return {};
		const code = charCode - this.firstCode;
		return { code: code, unicode: String.fromCodePoint( code ) };
	}
	reverse( glyphID ) {
		let pos = this.glyphIdArray.indexOf( glyphID );
		if ( pos > -1 ) return this.firstCode + pos;
	}
	getSupportedCharCodes( preservePropNames = false ) {
		if ( preservePropNames ) {
			return [ { firstCode: this.firstCode, lastCode: this.lastCode } ];
		}
		return [ { start: this.firstCode, end: this.lastCode } ];
	}
}
class Format8 extends Subtable {
	constructor( p, platformID, encodingID ) {
		super( p, platformID, encodingID );
		this.format = 8;
		p.uint16;
		this.length = p.uint32;
		this.language = p.uint32;
		this.is32 = [ ...new Array( 8192 ) ].map( ( _ ) => p.uint8 );
		this.numGroups = p.uint32;
		const getter = () =>
			[ ...new Array( this.numGroups ) ].map(
				( _ ) => new SequentialMapGroup$1( p )
			);
		lazy$1( this, `groups`, getter );
	}
	supports( charCode ) {
		if ( charCode.charCodeAt ) {
			charCode = -1;
			console.warn(
				`supports(character) not implemented for cmap subtable format 8. only supports(id) is implemented.`
			);
		}
		return (
			this.groups.findIndex(
				( s ) =>
					s.startcharCode <= charCode && charCode <= s.endcharCode
			) !== -1
		);
	}
	reverse( glyphID ) {
		console.warn( `reverse not implemented for cmap subtable format 8` );
		return {};
	}
	getSupportedCharCodes( preservePropNames = false ) {
		if ( preservePropNames ) return this.groups;
		return this.groups.map( ( v ) => ( {
			start: v.startcharCode,
			end: v.endcharCode,
		} ) );
	}
}
class SequentialMapGroup$1 {
	constructor( p ) {
		this.startcharCode = p.uint32;
		this.endcharCode = p.uint32;
		this.startGlyphID = p.uint32;
	}
}
class Format10 extends Subtable {
	constructor( p, platformID, encodingID ) {
		super( p, platformID, encodingID );
		this.format = 10;
		p.uint16;
		this.length = p.uint32;
		this.language = p.uint32;
		this.startCharCode = p.uint32;
		this.numChars = p.uint32;
		this.endCharCode = this.startCharCode + this.numChars;
		const getter = () =>
			[ ...new Array( this.numChars ) ].map( ( _ ) => p.uint16 );
		lazy$1( this, `glyphs`, getter );
	}
	supports( charCode ) {
		if ( charCode.charCodeAt ) {
			charCode = -1;
			console.warn(
				`supports(character) not implemented for cmap subtable format 10. only supports(id) is implemented.`
			);
		}
		if ( charCode < this.startCharCode ) return false;
		if ( charCode > this.startCharCode + this.numChars ) return false;
		return charCode - this.startCharCode;
	}
	reverse( glyphID ) {
		console.warn( `reverse not implemented for cmap subtable format 10` );
		return {};
	}
	getSupportedCharCodes( preservePropNames = false ) {
		if ( preservePropNames ) {
			return [
				{
					startCharCode: this.startCharCode,
					endCharCode: this.endCharCode,
				},
			];
		}
		return [ { start: this.startCharCode, end: this.endCharCode } ];
	}
}
class Format12 extends Subtable {
	constructor( p, platformID, encodingID ) {
		super( p, platformID, encodingID );
		this.format = 12;
		p.uint16;
		this.length = p.uint32;
		this.language = p.uint32;
		this.numGroups = p.uint32;
		const getter = () =>
			[ ...new Array( this.numGroups ) ].map(
				( _ ) => new SequentialMapGroup( p )
			);
		lazy$1( this, `groups`, getter );
	}
	supports( charCode ) {
		if ( charCode.charCodeAt ) charCode = charCode.charCodeAt( 0 );
		if ( 55296 <= charCode && charCode <= 57343 ) return 0;
		if ( ( charCode & 65534 ) === 65534 || ( charCode & 65535 ) === 65535 )
			return 0;
		return (
			this.groups.findIndex(
				( s ) =>
					s.startCharCode <= charCode && charCode <= s.endCharCode
			) !== -1
		);
	}
	reverse( glyphID ) {
		for ( let group of this.groups ) {
			let start = group.startGlyphID;
			if ( start > glyphID ) continue;
			if ( start === glyphID ) return group.startCharCode;
			let end = start + ( group.endCharCode - group.startCharCode );
			if ( end < glyphID ) continue;
			const code = group.startCharCode + ( glyphID - start );
			return { code: code, unicode: String.fromCodePoint( code ) };
		}
		return {};
	}
	getSupportedCharCodes( preservePropNames = false ) {
		if ( preservePropNames ) return this.groups;
		return this.groups.map( ( v ) => ( {
			start: v.startCharCode,
			end: v.endCharCode,
		} ) );
	}
}
class SequentialMapGroup {
	constructor( p ) {
		this.startCharCode = p.uint32;
		this.endCharCode = p.uint32;
		this.startGlyphID = p.uint32;
	}
}
class Format13 extends Subtable {
	constructor( p, platformID, encodingID ) {
		super( p, platformID, encodingID );
		this.format = 13;
		p.uint16;
		this.length = p.uint32;
		this.language = p.uint32;
		this.numGroups = p.uint32;
		const getter = [ ...new Array( this.numGroups ) ].map(
			( _ ) => new ConstantMapGroup( p )
		);
		lazy$1( this, `groups`, getter );
	}
	supports( charCode ) {
		if ( charCode.charCodeAt ) charCode = charCode.charCodeAt( 0 );
		return (
			this.groups.findIndex(
				( s ) =>
					s.startCharCode <= charCode && charCode <= s.endCharCode
			) !== -1
		);
	}
	reverse( glyphID ) {
		console.warn( `reverse not implemented for cmap subtable format 13` );
		return {};
	}
	getSupportedCharCodes( preservePropNames = false ) {
		if ( preservePropNames ) return this.groups;
		return this.groups.map( ( v ) => ( {
			start: v.startCharCode,
			end: v.endCharCode,
		} ) );
	}
}
class ConstantMapGroup {
	constructor( p ) {
		this.startCharCode = p.uint32;
		this.endCharCode = p.uint32;
		this.glyphID = p.uint32;
	}
}
class Format14 extends Subtable {
	constructor( p, platformID, encodingID ) {
		super( p, platformID, encodingID );
		this.subTableStart = p.currentPosition;
		this.format = 14;
		this.length = p.uint32;
		this.numVarSelectorRecords = p.uint32;
		lazy$1( this, `varSelectors`, () =>
			[ ...new Array( this.numVarSelectorRecords ) ].map(
				( _ ) => new VariationSelector( p )
			)
		);
	}
	supports() {
		console.warn( `supports not implemented for cmap subtable format 14` );
		return 0;
	}
	getSupportedCharCodes() {
		console.warn(
			`getSupportedCharCodes not implemented for cmap subtable format 14`
		);
		return [];
	}
	reverse( glyphID ) {
		console.warn( `reverse not implemented for cmap subtable format 14` );
		return {};
	}
	supportsVariation( variation ) {
		let v = this.varSelector.find(
			( uvs ) => uvs.varSelector === variation
		);
		return v ? v : false;
	}
	getSupportedVariations() {
		return this.varSelectors.map( ( v ) => v.varSelector );
	}
}
class VariationSelector {
	constructor( p ) {
		this.varSelector = p.uint24;
		this.defaultUVSOffset = p.Offset32;
		this.nonDefaultUVSOffset = p.Offset32;
	}
}
function createSubTable( parser, platformID, encodingID ) {
	const format = parser.uint16;
	if ( format === 0 ) return new Format0( parser, platformID, encodingID );
	if ( format === 2 ) return new Format2( parser, platformID, encodingID );
	if ( format === 4 ) return new Format4( parser, platformID, encodingID );
	if ( format === 6 ) return new Format6( parser, platformID, encodingID );
	if ( format === 8 ) return new Format8( parser, platformID, encodingID );
	if ( format === 10 ) return new Format10( parser, platformID, encodingID );
	if ( format === 12 ) return new Format12( parser, platformID, encodingID );
	if ( format === 13 ) return new Format13( parser, platformID, encodingID );
	if ( format === 14 ) return new Format14( parser, platformID, encodingID );
	return {};
}
class cmap extends SimpleTable {
	constructor( dict, dataview ) {
		const { p: p } = super( dict, dataview );
		this.version = p.uint16;
		this.numTables = p.uint16;
		this.encodingRecords = [ ...new Array( this.numTables ) ].map(
			( _ ) => new EncodingRecord( p, this.tableStart )
		);
	}
	getSubTable( tableID ) {
		return this.encodingRecords[ tableID ].table;
	}
	getSupportedEncodings() {
		return this.encodingRecords.map( ( r ) => ( {
			platformID: r.platformID,
			encodingId: r.encodingID,
		} ) );
	}
	getSupportedCharCodes( platformID, encodingID ) {
		const recordID = this.encodingRecords.findIndex(
			( r ) => r.platformID === platformID && r.encodingID === encodingID
		);
		if ( recordID === -1 ) return false;
		const subtable = this.getSubTable( recordID );
		return subtable.getSupportedCharCodes();
	}
	reverse( glyphid ) {
		for ( let i = 0; i < this.numTables; i++ ) {
			let code = this.getSubTable( i ).reverse( glyphid );
			if ( code ) return code;
		}
	}
	getGlyphId( char ) {
		let last = 0;
		this.encodingRecords.some( ( _, tableID ) => {
			let t = this.getSubTable( tableID );
			if ( ! t.getGlyphId ) return false;
			last = t.getGlyphId( char );
			return last !== 0;
		} );
		return last;
	}
	supports( char ) {
		return this.encodingRecords.some( ( _, tableID ) => {
			const t = this.getSubTable( tableID );
			return t.supports && t.supports( char ) !== false;
		} );
	}
	supportsVariation( variation ) {
		return this.encodingRecords.some( ( _, tableID ) => {
			const t = this.getSubTable( tableID );
			return (
				t.supportsVariation &&
				t.supportsVariation( variation ) !== false
			);
		} );
	}
}
class EncodingRecord {
	constructor( p, tableStart ) {
		const platformID = ( this.platformID = p.uint16 );
		const encodingID = ( this.encodingID = p.uint16 );
		const offset = ( this.offset = p.Offset32 );
		lazy$1( this, `table`, () => {
			p.currentPosition = tableStart + offset;
			return createSubTable( p, platformID, encodingID );
		} );
	}
}
var cmap$1 = Object.freeze( { __proto__: null, cmap: cmap } );
class head extends SimpleTable {
	constructor( dict, dataview ) {
		const { p: p } = super( dict, dataview );
		this.load( {
			majorVersion: p.uint16,
			minorVersion: p.uint16,
			fontRevision: p.fixed,
			checkSumAdjustment: p.uint32,
			magicNumber: p.uint32,
			flags: p.flags( 16 ),
			unitsPerEm: p.uint16,
			created: p.longdatetime,
			modified: p.longdatetime,
			xMin: p.int16,
			yMin: p.int16,
			xMax: p.int16,
			yMax: p.int16,
			macStyle: p.flags( 16 ),
			lowestRecPPEM: p.uint16,
			fontDirectionHint: p.uint16,
			indexToLocFormat: p.uint16,
			glyphDataFormat: p.uint16,
		} );
	}
}
var head$1 = Object.freeze( { __proto__: null, head: head } );
class hhea extends SimpleTable {
	constructor( dict, dataview ) {
		const { p: p } = super( dict, dataview );
		this.majorVersion = p.uint16;
		this.minorVersion = p.uint16;
		this.ascender = p.fword;
		this.descender = p.fword;
		this.lineGap = p.fword;
		this.advanceWidthMax = p.ufword;
		this.minLeftSideBearing = p.fword;
		this.minRightSideBearing = p.fword;
		this.xMaxExtent = p.fword;
		this.caretSlopeRise = p.int16;
		this.caretSlopeRun = p.int16;
		this.caretOffset = p.int16;
		p.int16;
		p.int16;
		p.int16;
		p.int16;
		this.metricDataFormat = p.int16;
		this.numberOfHMetrics = p.uint16;
		p.verifyLength();
	}
}
var hhea$1 = Object.freeze( { __proto__: null, hhea: hhea } );
class hmtx extends SimpleTable {
	constructor( dict, dataview, tables ) {
		const { p: p } = super( dict, dataview );
		const numberOfHMetrics = tables.hhea.numberOfHMetrics;
		const numGlyphs = tables.maxp.numGlyphs;
		const metricsStart = p.currentPosition;
		lazy$1( this, `hMetrics`, () => {
			p.currentPosition = metricsStart;
			return [ ...new Array( numberOfHMetrics ) ].map(
				( _ ) => new LongHorMetric( p.uint16, p.int16 )
			);
		} );
		if ( numberOfHMetrics < numGlyphs ) {
			const lsbStart = metricsStart + numberOfHMetrics * 4;
			lazy$1( this, `leftSideBearings`, () => {
				p.currentPosition = lsbStart;
				return [ ...new Array( numGlyphs - numberOfHMetrics ) ].map(
					( _ ) => p.int16
				);
			} );
		}
	}
}
class LongHorMetric {
	constructor( w, b ) {
		this.advanceWidth = w;
		this.lsb = b;
	}
}
var hmtx$1 = Object.freeze( { __proto__: null, hmtx: hmtx } );
class maxp extends SimpleTable {
	constructor( dict, dataview ) {
		const { p: p } = super( dict, dataview );
		this.version = p.legacyFixed;
		this.numGlyphs = p.uint16;
		if ( this.version === 1 ) {
			this.maxPoints = p.uint16;
			this.maxContours = p.uint16;
			this.maxCompositePoints = p.uint16;
			this.maxCompositeContours = p.uint16;
			this.maxZones = p.uint16;
			this.maxTwilightPoints = p.uint16;
			this.maxStorage = p.uint16;
			this.maxFunctionDefs = p.uint16;
			this.maxInstructionDefs = p.uint16;
			this.maxStackElements = p.uint16;
			this.maxSizeOfInstructions = p.uint16;
			this.maxComponentElements = p.uint16;
			this.maxComponentDepth = p.uint16;
		}
		p.verifyLength();
	}
}
var maxp$1 = Object.freeze( { __proto__: null, maxp: maxp } );
class lib_font_browser_name extends SimpleTable {
	constructor( dict, dataview ) {
		const { p: p } = super( dict, dataview );
		this.format = p.uint16;
		this.count = p.uint16;
		this.stringOffset = p.Offset16;
		this.nameRecords = [ ...new Array( this.count ) ].map(
			( _ ) => new NameRecord( p, this )
		);
		if ( this.format === 1 ) {
			this.langTagCount = p.uint16;
			this.langTagRecords = [ ...new Array( this.langTagCount ) ].map(
				( _ ) => new LangTagRecord( p.uint16, p.Offset16 )
			);
		}
		this.stringStart = this.tableStart + this.stringOffset;
	}
	get( nameID ) {
		let record = this.nameRecords.find(
			( record ) => record.nameID === nameID
		);
		if ( record ) return record.string;
	}
}
class LangTagRecord {
	constructor( length, offset ) {
		this.length = length;
		this.offset = offset;
	}
}
class NameRecord {
	constructor( p, nameTable ) {
		this.platformID = p.uint16;
		this.encodingID = p.uint16;
		this.languageID = p.uint16;
		this.nameID = p.uint16;
		this.length = p.uint16;
		this.offset = p.Offset16;
		lazy$1( this, `string`, () => {
			p.currentPosition = nameTable.stringStart + this.offset;
			return decodeString( p, this );
		} );
	}
}
function decodeString( p, record ) {
	const { platformID: platformID, length: length } = record;
	if ( length === 0 ) return ``;
	if ( platformID === 0 || platformID === 3 ) {
		const str = [];
		for ( let i = 0, e = length / 2; i < e; i++ )
			str[ i ] = String.fromCharCode( p.uint16 );
		return str.join( `` );
	}
	const bytes = p.readBytes( length );
	const str = [];
	bytes.forEach( function ( b, i ) {
		str[ i ] = String.fromCharCode( b );
	} );
	return str.join( `` );
}
var name$1 = Object.freeze( { __proto__: null, name: lib_font_browser_name } );
class OS2 extends SimpleTable {
	constructor( dict, dataview ) {
		const { p: p } = super( dict, dataview );
		this.version = p.uint16;
		this.xAvgCharWidth = p.int16;
		this.usWeightClass = p.uint16;
		this.usWidthClass = p.uint16;
		this.fsType = p.uint16;
		this.ySubscriptXSize = p.int16;
		this.ySubscriptYSize = p.int16;
		this.ySubscriptXOffset = p.int16;
		this.ySubscriptYOffset = p.int16;
		this.ySuperscriptXSize = p.int16;
		this.ySuperscriptYSize = p.int16;
		this.ySuperscriptXOffset = p.int16;
		this.ySuperscriptYOffset = p.int16;
		this.yStrikeoutSize = p.int16;
		this.yStrikeoutPosition = p.int16;
		this.sFamilyClass = p.int16;
		this.panose = [ ...new Array( 10 ) ].map( ( _ ) => p.uint8 );
		this.ulUnicodeRange1 = p.flags( 32 );
		this.ulUnicodeRange2 = p.flags( 32 );
		this.ulUnicodeRange3 = p.flags( 32 );
		this.ulUnicodeRange4 = p.flags( 32 );
		this.achVendID = p.tag;
		this.fsSelection = p.uint16;
		this.usFirstCharIndex = p.uint16;
		this.usLastCharIndex = p.uint16;
		this.sTypoAscender = p.int16;
		this.sTypoDescender = p.int16;
		this.sTypoLineGap = p.int16;
		this.usWinAscent = p.uint16;
		this.usWinDescent = p.uint16;
		if ( this.version === 0 ) return p.verifyLength();
		this.ulCodePageRange1 = p.flags( 32 );
		this.ulCodePageRange2 = p.flags( 32 );
		if ( this.version === 1 ) return p.verifyLength();
		this.sxHeight = p.int16;
		this.sCapHeight = p.int16;
		this.usDefaultChar = p.uint16;
		this.usBreakChar = p.uint16;
		this.usMaxContext = p.uint16;
		if ( this.version <= 4 ) return p.verifyLength();
		this.usLowerOpticalPointSize = p.uint16;
		this.usUpperOpticalPointSize = p.uint16;
		if ( this.version === 5 ) return p.verifyLength();
	}
}
var OS2$1 = Object.freeze( { __proto__: null, OS2: OS2 } );
class post extends SimpleTable {
	constructor( dict, dataview ) {
		const { p: p } = super( dict, dataview );
		this.version = p.legacyFixed;
		this.italicAngle = p.fixed;
		this.underlinePosition = p.fword;
		this.underlineThickness = p.fword;
		this.isFixedPitch = p.uint32;
		this.minMemType42 = p.uint32;
		this.maxMemType42 = p.uint32;
		this.minMemType1 = p.uint32;
		this.maxMemType1 = p.uint32;
		if ( this.version === 1 || this.version === 3 ) return p.verifyLength();
		this.numGlyphs = p.uint16;
		if ( this.version === 2 ) {
			this.glyphNameIndex = [ ...new Array( this.numGlyphs ) ].map(
				( _ ) => p.uint16
			);
			this.namesOffset = p.currentPosition;
			this.glyphNameOffsets = [ 1 ];
			for ( let i = 0; i < this.numGlyphs; i++ ) {
				let index = this.glyphNameIndex[ i ];
				if ( index < macStrings.length ) {
					this.glyphNameOffsets.push( this.glyphNameOffsets[ i ] );
					continue;
				}
				let bytelength = p.int8;
				p.skip( bytelength );
				this.glyphNameOffsets.push(
					this.glyphNameOffsets[ i ] + bytelength + 1
				);
			}
		}
		if ( this.version === 2.5 ) {
			this.offset = [ ...new Array( this.numGlyphs ) ].map(
				( _ ) => p.int8
			);
		}
	}
	getGlyphName( glyphid ) {
		if ( this.version !== 2 ) {
			console.warn(
				`post table version ${ this.version } does not support glyph name lookups`
			);
			return ``;
		}
		let index = this.glyphNameIndex[ glyphid ];
		if ( index < 258 ) return macStrings[ index ];
		let offset = this.glyphNameOffsets[ glyphid ];
		let next = this.glyphNameOffsets[ glyphid + 1 ];
		let len = next - offset - 1;
		if ( len === 0 ) return `.notdef.`;
		this.parser.currentPosition = this.namesOffset + offset;
		const data = this.parser.readBytes(
			len,
			this.namesOffset + offset,
			8,
			true
		);
		return data.map( ( b ) => String.fromCharCode( b ) ).join( `` );
	}
}
const macStrings = [
	`.notdef`,
	`.null`,
	`nonmarkingreturn`,
	`space`,
	`exclam`,
	`quotedbl`,
	`numbersign`,
	`dollar`,
	`percent`,
	`ampersand`,
	`quotesingle`,
	`parenleft`,
	`parenright`,
	`asterisk`,
	`plus`,
	`comma`,
	`hyphen`,
	`period`,
	`slash`,
	`zero`,
	`one`,
	`two`,
	`three`,
	`four`,
	`five`,
	`six`,
	`seven`,
	`eight`,
	`nine`,
	`colon`,
	`semicolon`,
	`less`,
	`equal`,
	`greater`,
	`question`,
	`at`,
	`A`,
	`B`,
	`C`,
	`D`,
	`E`,
	`F`,
	`G`,
	`H`,
	`I`,
	`J`,
	`K`,
	`L`,
	`M`,
	`N`,
	`O`,
	`P`,
	`Q`,
	`R`,
	`S`,
	`T`,
	`U`,
	`V`,
	`W`,
	`X`,
	`Y`,
	`Z`,
	`bracketleft`,
	`backslash`,
	`bracketright`,
	`asciicircum`,
	`underscore`,
	`grave`,
	`a`,
	`b`,
	`c`,
	`d`,
	`e`,
	`f`,
	`g`,
	`h`,
	`i`,
	`j`,
	`k`,
	`l`,
	`m`,
	`n`,
	`o`,
	`p`,
	`q`,
	`r`,
	`s`,
	`t`,
	`u`,
	`v`,
	`w`,
	`x`,
	`y`,
	`z`,
	`braceleft`,
	`bar`,
	`braceright`,
	`asciitilde`,
	`Adieresis`,
	`Aring`,
	`Ccedilla`,
	`Eacute`,
	`Ntilde`,
	`Odieresis`,
	`Udieresis`,
	`aacute`,
	`agrave`,
	`acircumflex`,
	`adieresis`,
	`atilde`,
	`aring`,
	`ccedilla`,
	`eacute`,
	`egrave`,
	`ecircumflex`,
	`edieresis`,
	`iacute`,
	`igrave`,
	`icircumflex`,
	`idieresis`,
	`ntilde`,
	`oacute`,
	`ograve`,
	`ocircumflex`,
	`odieresis`,
	`otilde`,
	`uacute`,
	`ugrave`,
	`ucircumflex`,
	`udieresis`,
	`dagger`,
	`degree`,
	`cent`,
	`sterling`,
	`section`,
	`bullet`,
	`paragraph`,
	`germandbls`,
	`registered`,
	`copyright`,
	`trademark`,
	`acute`,
	`dieresis`,
	`notequal`,
	`AE`,
	`Oslash`,
	`infinity`,
	`plusminus`,
	`lessequal`,
	`greaterequal`,
	`yen`,
	`mu`,
	`partialdiff`,
	`summation`,
	`product`,
	`pi`,
	`integral`,
	`ordfeminine`,
	`ordmasculine`,
	`Omega`,
	`ae`,
	`oslash`,
	`questiondown`,
	`exclamdown`,
	`logicalnot`,
	`radical`,
	`florin`,
	`approxequal`,
	`Delta`,
	`guillemotleft`,
	`guillemotright`,
	`ellipsis`,
	`nonbreakingspace`,
	`Agrave`,
	`Atilde`,
	`Otilde`,
	`OE`,
	`oe`,
	`endash`,
	`emdash`,
	`quotedblleft`,
	`quotedblright`,
	`quoteleft`,
	`quoteright`,
	`divide`,
	`lozenge`,
	`ydieresis`,
	`Ydieresis`,
	`fraction`,
	`currency`,
	`guilsinglleft`,
	`guilsinglright`,
	`fi`,
	`fl`,
	`daggerdbl`,
	`periodcentered`,
	`quotesinglbase`,
	`quotedblbase`,
	`perthousand`,
	`Acircumflex`,
	`Ecircumflex`,
	`Aacute`,
	`Edieresis`,
	`Egrave`,
	`Iacute`,
	`Icircumflex`,
	`Idieresis`,
	`Igrave`,
	`Oacute`,
	`Ocircumflex`,
	`apple`,
	`Ograve`,
	`Uacute`,
	`Ucircumflex`,
	`Ugrave`,
	`dotlessi`,
	`circumflex`,
	`tilde`,
	`macron`,
	`breve`,
	`dotaccent`,
	`ring`,
	`cedilla`,
	`hungarumlaut`,
	`ogonek`,
	`caron`,
	`Lslash`,
	`lslash`,
	`Scaron`,
	`scaron`,
	`Zcaron`,
	`zcaron`,
	`brokenbar`,
	`Eth`,
	`eth`,
	`Yacute`,
	`yacute`,
	`Thorn`,
	`thorn`,
	`minus`,
	`multiply`,
	`onesuperior`,
	`twosuperior`,
	`threesuperior`,
	`onehalf`,
	`onequarter`,
	`threequarters`,
	`franc`,
	`Gbreve`,
	`gbreve`,
	`Idotaccent`,
	`Scedilla`,
	`scedilla`,
	`Cacute`,
	`cacute`,
	`Ccaron`,
	`ccaron`,
	`dcroat`,
];
var post$1 = Object.freeze( { __proto__: null, post: post } );
class BASE extends SimpleTable {
	constructor( dict, dataview ) {
		const { p: p } = super( dict, dataview );
		this.majorVersion = p.uint16;
		this.minorVersion = p.uint16;
		this.horizAxisOffset = p.Offset16;
		this.vertAxisOffset = p.Offset16;
		lazy$1(
			this,
			`horizAxis`,
			() =>
				new AxisTable(
					{ offset: dict.offset + this.horizAxisOffset },
					dataview
				)
		);
		lazy$1(
			this,
			`vertAxis`,
			() =>
				new AxisTable(
					{ offset: dict.offset + this.vertAxisOffset },
					dataview
				)
		);
		if ( this.majorVersion === 1 && this.minorVersion === 1 ) {
			this.itemVarStoreOffset = p.Offset32;
			lazy$1(
				this,
				`itemVarStore`,
				() =>
					new AxisTable(
						{ offset: dict.offset + this.itemVarStoreOffset },
						dataview
					)
			);
		}
	}
}
class AxisTable extends SimpleTable {
	constructor( dict, dataview ) {
		const { p: p } = super( dict, dataview, `AxisTable` );
		this.baseTagListOffset = p.Offset16;
		this.baseScriptListOffset = p.Offset16;
		lazy$1(
			this,
			`baseTagList`,
			() =>
				new BaseTagListTable(
					{ offset: dict.offset + this.baseTagListOffset },
					dataview
				)
		);
		lazy$1(
			this,
			`baseScriptList`,
			() =>
				new BaseScriptListTable(
					{ offset: dict.offset + this.baseScriptListOffset },
					dataview
				)
		);
	}
}
class BaseTagListTable extends SimpleTable {
	constructor( dict, dataview ) {
		const { p: p } = super( dict, dataview, `BaseTagListTable` );
		this.baseTagCount = p.uint16;
		this.baselineTags = [ ...new Array( this.baseTagCount ) ].map(
			( _ ) => p.tag
		);
	}
}
class BaseScriptListTable extends SimpleTable {
	constructor( dict, dataview ) {
		const { p: p } = super( dict, dataview, `BaseScriptListTable` );
		this.baseScriptCount = p.uint16;
		const recordStart = p.currentPosition;
		lazy$1( this, `baseScriptRecords`, () => {
			p.currentPosition = recordStart;
			return [ ...new Array( this.baseScriptCount ) ].map(
				( _ ) => new BaseScriptRecord( this.start, p )
			);
		} );
	}
}
class BaseScriptRecord {
	constructor( baseScriptListTableStart, p ) {
		this.baseScriptTag = p.tag;
		this.baseScriptOffset = p.Offset16;
		lazy$1( this, `baseScriptTable`, () => {
			p.currentPosition =
				baseScriptListTableStart + this.baseScriptOffset;
			return new BaseScriptTable( p );
		} );
	}
}
class BaseScriptTable {
	constructor( p ) {
		this.start = p.currentPosition;
		this.baseValuesOffset = p.Offset16;
		this.defaultMinMaxOffset = p.Offset16;
		this.baseLangSysCount = p.uint16;
		this.baseLangSysRecords = [ ...new Array( this.baseLangSysCount ) ].map(
			( _ ) => new BaseLangSysRecord( this.start, p )
		);
		lazy$1( this, `baseValues`, () => {
			p.currentPosition = this.start + this.baseValuesOffset;
			return new BaseValuesTable( p );
		} );
		lazy$1( this, `defaultMinMax`, () => {
			p.currentPosition = this.start + this.defaultMinMaxOffset;
			return new MinMaxTable( p );
		} );
	}
}
class BaseLangSysRecord {
	constructor( baseScriptTableStart, p ) {
		this.baseLangSysTag = p.tag;
		this.minMaxOffset = p.Offset16;
		lazy$1( this, `minMax`, () => {
			p.currentPosition = baseScriptTableStart + this.minMaxOffset;
			return new MinMaxTable( p );
		} );
	}
}
class BaseValuesTable {
	constructor( p ) {
		this.parser = p;
		this.start = p.currentPosition;
		this.defaultBaselineIndex = p.uint16;
		this.baseCoordCount = p.uint16;
		this.baseCoords = [ ...new Array( this.baseCoordCount ) ].map(
			( _ ) => p.Offset16
		);
	}
	getTable( id ) {
		this.parser.currentPosition = this.start + this.baseCoords[ id ];
		return new BaseCoordTable( this.parser );
	}
}
class MinMaxTable {
	constructor( p ) {
		this.minCoord = p.Offset16;
		this.maxCoord = p.Offset16;
		this.featMinMaxCount = p.uint16;
		const recordStart = p.currentPosition;
		lazy$1( this, `featMinMaxRecords`, () => {
			p.currentPosition = recordStart;
			return [ ...new Array( this.featMinMaxCount ) ].map(
				( _ ) => new FeatMinMaxRecord( p )
			);
		} );
	}
}
class FeatMinMaxRecord {
	constructor( p ) {
		this.featureTableTag = p.tag;
		this.minCoord = p.Offset16;
		this.maxCoord = p.Offset16;
	}
}
class BaseCoordTable {
	constructor( p ) {
		this.baseCoordFormat = p.uint16;
		this.coordinate = p.int16;
		if ( this.baseCoordFormat === 2 ) {
			this.referenceGlyph = p.uint16;
			this.baseCoordPoint = p.uint16;
		}
		if ( this.baseCoordFormat === 3 ) {
			this.deviceTable = p.Offset16;
		}
	}
}
var BASE$1 = Object.freeze( { __proto__: null, BASE: BASE } );
class ClassDefinition {
	constructor( p ) {
		this.classFormat = p.uint16;
		if ( this.classFormat === 1 ) {
			this.startGlyphID = p.uint16;
			this.glyphCount = p.uint16;
			this.classValueArray = [ ...new Array( this.glyphCount ) ].map(
				( _ ) => p.uint16
			);
		}
		if ( this.classFormat === 2 ) {
			this.classRangeCount = p.uint16;
			this.classRangeRecords = [
				...new Array( this.classRangeCount ),
			].map( ( _ ) => new ClassRangeRecord( p ) );
		}
	}
}
class ClassRangeRecord {
	constructor( p ) {
		this.startGlyphID = p.uint16;
		this.endGlyphID = p.uint16;
		this.class = p.uint16;
	}
}
class CoverageTable extends ParsedData {
	constructor( p ) {
		super( p );
		this.coverageFormat = p.uint16;
		if ( this.coverageFormat === 1 ) {
			this.glyphCount = p.uint16;
			this.glyphArray = [ ...new Array( this.glyphCount ) ].map(
				( _ ) => p.uint16
			);
		}
		if ( this.coverageFormat === 2 ) {
			this.rangeCount = p.uint16;
			this.rangeRecords = [ ...new Array( this.rangeCount ) ].map(
				( _ ) => new CoverageRangeRecord( p )
			);
		}
	}
}
class CoverageRangeRecord {
	constructor( p ) {
		this.startGlyphID = p.uint16;
		this.endGlyphID = p.uint16;
		this.startCoverageIndex = p.uint16;
	}
}
class ItemVariationStoreTable {
	constructor( table, p ) {
		this.table = table;
		this.parser = p;
		this.start = p.currentPosition;
		this.format = p.uint16;
		this.variationRegionListOffset = p.Offset32;
		this.itemVariationDataCount = p.uint16;
		this.itemVariationDataOffsets = [
			...new Array( this.itemVariationDataCount ),
		].map( ( _ ) => p.Offset32 );
	}
}
class GDEF extends SimpleTable {
	constructor( dict, dataview ) {
		const { p: p } = super( dict, dataview );
		this.majorVersion = p.uint16;
		this.minorVersion = p.uint16;
		this.glyphClassDefOffset = p.Offset16;
		lazy$1( this, `glyphClassDefs`, () => {
			if ( this.glyphClassDefOffset === 0 ) return undefined;
			p.currentPosition = this.tableStart + this.glyphClassDefOffset;
			return new ClassDefinition( p );
		} );
		this.attachListOffset = p.Offset16;
		lazy$1( this, `attachList`, () => {
			if ( this.attachListOffset === 0 ) return undefined;
			p.currentPosition = this.tableStart + this.attachListOffset;
			return new AttachList( p );
		} );
		this.ligCaretListOffset = p.Offset16;
		lazy$1( this, `ligCaretList`, () => {
			if ( this.ligCaretListOffset === 0 ) return undefined;
			p.currentPosition = this.tableStart + this.ligCaretListOffset;
			return new LigCaretList( p );
		} );
		this.markAttachClassDefOffset = p.Offset16;
		lazy$1( this, `markAttachClassDef`, () => {
			if ( this.markAttachClassDefOffset === 0 ) return undefined;
			p.currentPosition = this.tableStart + this.markAttachClassDefOffset;
			return new ClassDefinition( p );
		} );
		if ( this.minorVersion >= 2 ) {
			this.markGlyphSetsDefOffset = p.Offset16;
			lazy$1( this, `markGlyphSetsDef`, () => {
				if ( this.markGlyphSetsDefOffset === 0 ) return undefined;
				p.currentPosition =
					this.tableStart + this.markGlyphSetsDefOffset;
				return new MarkGlyphSetsTable( p );
			} );
		}
		if ( this.minorVersion === 3 ) {
			this.itemVarStoreOffset = p.Offset32;
			lazy$1( this, `itemVarStore`, () => {
				if ( this.itemVarStoreOffset === 0 ) return undefined;
				p.currentPosition = this.tableStart + this.itemVarStoreOffset;
				return new ItemVariationStoreTable( p );
			} );
		}
	}
}
class AttachList extends ParsedData {
	constructor( p ) {
		super( p );
		this.coverageOffset = p.Offset16;
		this.glyphCount = p.uint16;
		this.attachPointOffsets = [ ...new Array( this.glyphCount ) ].map(
			( _ ) => p.Offset16
		);
	}
	getPoint( pointID ) {
		this.parser.currentPosition =
			this.start + this.attachPointOffsets[ pointID ];
		return new AttachPoint( this.parser );
	}
}
class AttachPoint {
	constructor( p ) {
		this.pointCount = p.uint16;
		this.pointIndices = [ ...new Array( this.pointCount ) ].map(
			( _ ) => p.uint16
		);
	}
}
class LigCaretList extends ParsedData {
	constructor( p ) {
		super( p );
		this.coverageOffset = p.Offset16;
		lazy$1( this, `coverage`, () => {
			p.currentPosition = this.start + this.coverageOffset;
			return new CoverageTable( p );
		} );
		this.ligGlyphCount = p.uint16;
		this.ligGlyphOffsets = [ ...new Array( this.ligGlyphCount ) ].map(
			( _ ) => p.Offset16
		);
	}
	getLigGlyph( ligGlyphID ) {
		this.parser.currentPosition =
			this.start + this.ligGlyphOffsets[ ligGlyphID ];
		return new LigGlyph( this.parser );
	}
}
class LigGlyph extends ParsedData {
	constructor( p ) {
		super( p );
		this.caretCount = p.uint16;
		this.caretValueOffsets = [ ...new Array( this.caretCount ) ].map(
			( _ ) => p.Offset16
		);
	}
	getCaretValue( caretID ) {
		this.parser.currentPosition =
			this.start + this.caretValueOffsets[ caretID ];
		return new CaretValue( this.parser );
	}
}
class CaretValue {
	constructor( p ) {
		this.caretValueFormat = p.uint16;
		if ( this.caretValueFormat === 1 ) {
			this.coordinate = p.int16;
		}
		if ( this.caretValueFormat === 2 ) {
			this.caretValuePointIndex = p.uint16;
		}
		if ( this.caretValueFormat === 3 ) {
			this.coordinate = p.int16;
			this.deviceOffset = p.Offset16;
		}
	}
}
class MarkGlyphSetsTable extends ParsedData {
	constructor( p ) {
		super( p );
		this.markGlyphSetTableFormat = p.uint16;
		this.markGlyphSetCount = p.uint16;
		this.coverageOffsets = [ ...new Array( this.markGlyphSetCount ) ].map(
			( _ ) => p.Offset32
		);
	}
	getMarkGlyphSet( markGlyphSetID ) {
		this.parser.currentPosition =
			this.start + this.coverageOffsets[ markGlyphSetID ];
		return new CoverageTable( this.parser );
	}
}
var GDEF$1 = Object.freeze( { __proto__: null, GDEF: GDEF } );
class ScriptList extends ParsedData {
	static EMPTY = { scriptCount: 0, scriptRecords: [] };
	constructor( p ) {
		super( p );
		this.scriptCount = p.uint16;
		this.scriptRecords = [ ...new Array( this.scriptCount ) ].map(
			( _ ) => new ScriptRecord( p )
		);
	}
}
class ScriptRecord {
	constructor( p ) {
		this.scriptTag = p.tag;
		this.scriptOffset = p.Offset16;
	}
}
class ScriptTable extends ParsedData {
	constructor( p ) {
		super( p );
		this.defaultLangSys = p.Offset16;
		this.langSysCount = p.uint16;
		this.langSysRecords = [ ...new Array( this.langSysCount ) ].map(
			( _ ) => new LangSysRecord( p )
		);
	}
}
class LangSysRecord {
	constructor( p ) {
		this.langSysTag = p.tag;
		this.langSysOffset = p.Offset16;
	}
}
class LangSysTable {
	constructor( p ) {
		this.lookupOrder = p.Offset16;
		this.requiredFeatureIndex = p.uint16;
		this.featureIndexCount = p.uint16;
		this.featureIndices = [ ...new Array( this.featureIndexCount ) ].map(
			( _ ) => p.uint16
		);
	}
}
class FeatureList extends ParsedData {
	static EMPTY = { featureCount: 0, featureRecords: [] };
	constructor( p ) {
		super( p );
		this.featureCount = p.uint16;
		this.featureRecords = [ ...new Array( this.featureCount ) ].map(
			( _ ) => new FeatureRecord( p )
		);
	}
}
class FeatureRecord {
	constructor( p ) {
		this.featureTag = p.tag;
		this.featureOffset = p.Offset16;
	}
}
class FeatureTable extends ParsedData {
	constructor( p ) {
		super( p );
		this.featureParams = p.Offset16;
		this.lookupIndexCount = p.uint16;
		this.lookupListIndices = [ ...new Array( this.lookupIndexCount ) ].map(
			( _ ) => p.uint16
		);
	}
	getFeatureParams() {
		if ( this.featureParams > 0 ) {
			const p = this.parser;
			p.currentPosition = this.start + this.featureParams;
			const tag = this.featureTag;
			if ( tag === `size` ) return new Size( p );
			if ( tag.startsWith( `cc` ) ) return new CharacterVariant( p );
			if ( tag.startsWith( `ss` ) ) return new StylisticSet( p );
		}
	}
}
class CharacterVariant {
	constructor( p ) {
		this.format = p.uint16;
		this.featUiLabelNameId = p.uint16;
		this.featUiTooltipTextNameId = p.uint16;
		this.sampleTextNameId = p.uint16;
		this.numNamedParameters = p.uint16;
		this.firstParamUiLabelNameId = p.uint16;
		this.charCount = p.uint16;
		this.character = [ ...new Array( this.charCount ) ].map(
			( _ ) => p.uint24
		);
	}
}
class Size {
	constructor( p ) {
		this.designSize = p.uint16;
		this.subfamilyIdentifier = p.uint16;
		this.subfamilyNameID = p.uint16;
		this.smallEnd = p.uint16;
		this.largeEnd = p.uint16;
	}
}
class StylisticSet {
	constructor( p ) {
		this.version = p.uint16;
		this.UINameID = p.uint16;
	}
}
function undoCoverageOffsetParsing( instance ) {
	instance.parser.currentPosition -= 2;
	delete instance.coverageOffset;
	delete instance.getCoverageTable;
}
class LookupType$1 extends ParsedData {
	constructor( p ) {
		super( p );
		this.substFormat = p.uint16;
		this.coverageOffset = p.Offset16;
	}
	getCoverageTable() {
		let p = this.parser;
		p.currentPosition = this.start + this.coverageOffset;
		return new CoverageTable( p );
	}
}
class SubstLookupRecord {
	constructor( p ) {
		this.glyphSequenceIndex = p.uint16;
		this.lookupListIndex = p.uint16;
	}
}
class LookupType1$1 extends LookupType$1 {
	constructor( p ) {
		super( p );
		this.deltaGlyphID = p.int16;
	}
}
class LookupType2$1 extends LookupType$1 {
	constructor( p ) {
		super( p );
		this.sequenceCount = p.uint16;
		this.sequenceOffsets = [ ...new Array( this.sequenceCount ) ].map(
			( _ ) => p.Offset16
		);
	}
	getSequence( index ) {
		let p = this.parser;
		p.currentPosition = this.start + this.sequenceOffsets[ index ];
		return new SequenceTable( p );
	}
}
class SequenceTable {
	constructor( p ) {
		this.glyphCount = p.uint16;
		this.substituteGlyphIDs = [ ...new Array( this.glyphCount ) ].map(
			( _ ) => p.uint16
		);
	}
}
class LookupType3$1 extends LookupType$1 {
	constructor( p ) {
		super( p );
		this.alternateSetCount = p.uint16;
		this.alternateSetOffsets = [
			...new Array( this.alternateSetCount ),
		].map( ( _ ) => p.Offset16 );
	}
	getAlternateSet( index ) {
		let p = this.parser;
		p.currentPosition = this.start + this.alternateSetOffsets[ index ];
		return new AlternateSetTable( p );
	}
}
class AlternateSetTable {
	constructor( p ) {
		this.glyphCount = p.uint16;
		this.alternateGlyphIDs = [ ...new Array( this.glyphCount ) ].map(
			( _ ) => p.uint16
		);
	}
}
class LookupType4$1 extends LookupType$1 {
	constructor( p ) {
		super( p );
		this.ligatureSetCount = p.uint16;
		this.ligatureSetOffsets = [ ...new Array( this.ligatureSetCount ) ].map(
			( _ ) => p.Offset16
		);
	}
	getLigatureSet( index ) {
		let p = this.parser;
		p.currentPosition = this.start + this.ligatureSetOffsets[ index ];
		return new LigatureSetTable( p );
	}
}
class LigatureSetTable extends ParsedData {
	constructor( p ) {
		super( p );
		this.ligatureCount = p.uint16;
		this.ligatureOffsets = [ ...new Array( this.ligatureCount ) ].map(
			( _ ) => p.Offset16
		);
	}
	getLigature( index ) {
		let p = this.parser;
		p.currentPosition = this.start + this.ligatureOffsets[ index ];
		return new LigatureTable( p );
	}
}
class LigatureTable {
	constructor( p ) {
		this.ligatureGlyph = p.uint16;
		this.componentCount = p.uint16;
		this.componentGlyphIDs = [
			...new Array( this.componentCount - 1 ),
		].map( ( _ ) => p.uint16 );
	}
}
class LookupType5$1 extends LookupType$1 {
	constructor( p ) {
		super( p );
		if ( this.substFormat === 1 ) {
			this.subRuleSetCount = p.uint16;
			this.subRuleSetOffsets = [
				...new Array( this.subRuleSetCount ),
			].map( ( _ ) => p.Offset16 );
		}
		if ( this.substFormat === 2 ) {
			this.classDefOffset = p.Offset16;
			this.subClassSetCount = p.uint16;
			this.subClassSetOffsets = [
				...new Array( this.subClassSetCount ),
			].map( ( _ ) => p.Offset16 );
		}
		if ( this.substFormat === 3 ) {
			undoCoverageOffsetParsing( this );
			this.glyphCount = p.uint16;
			this.substitutionCount = p.uint16;
			this.coverageOffsets = [ ...new Array( this.glyphCount ) ].map(
				( _ ) => p.Offset16
			);
			this.substLookupRecords = [
				...new Array( this.substitutionCount ),
			].map( ( _ ) => new SubstLookupRecord( p ) );
		}
	}
	getSubRuleSet( index ) {
		if ( this.substFormat !== 1 )
			throw new Error(
				`lookup type 5.${ this.substFormat } has no subrule sets.`
			);
		let p = this.parser;
		p.currentPosition = this.start + this.subRuleSetOffsets[ index ];
		return new SubRuleSetTable( p );
	}
	getSubClassSet( index ) {
		if ( this.substFormat !== 2 )
			throw new Error(
				`lookup type 5.${ this.substFormat } has no subclass sets.`
			);
		let p = this.parser;
		p.currentPosition = this.start + this.subClassSetOffsets[ index ];
		return new SubClassSetTable( p );
	}
	getCoverageTable( index ) {
		if ( this.substFormat !== 3 && ! index )
			return super.getCoverageTable();
		if ( ! index )
			throw new Error(
				`lookup type 5.${ this.substFormat } requires an coverage table index.`
			);
		let p = this.parser;
		p.currentPosition = this.start + this.coverageOffsets[ index ];
		return new CoverageTable( p );
	}
}
class SubRuleSetTable extends ParsedData {
	constructor( p ) {
		super( p );
		this.subRuleCount = p.uint16;
		this.subRuleOffsets = [ ...new Array( this.subRuleCount ) ].map(
			( _ ) => p.Offset16
		);
	}
	getSubRule( index ) {
		let p = this.parser;
		p.currentPosition = this.start + this.subRuleOffsets[ index ];
		return new SubRuleTable( p );
	}
}
class SubRuleTable {
	constructor( p ) {
		this.glyphCount = p.uint16;
		this.substitutionCount = p.uint16;
		this.inputSequence = [ ...new Array( this.glyphCount - 1 ) ].map(
			( _ ) => p.uint16
		);
		this.substLookupRecords = [
			...new Array( this.substitutionCount ),
		].map( ( _ ) => new SubstLookupRecord( p ) );
	}
}
class SubClassSetTable extends ParsedData {
	constructor( p ) {
		super( p );
		this.subClassRuleCount = p.uint16;
		this.subClassRuleOffsets = [
			...new Array( this.subClassRuleCount ),
		].map( ( _ ) => p.Offset16 );
	}
	getSubClass( index ) {
		let p = this.parser;
		p.currentPosition = this.start + this.subClassRuleOffsets[ index ];
		return new SubClassRuleTable( p );
	}
}
class SubClassRuleTable extends SubRuleTable {
	constructor( p ) {
		super( p );
	}
}
class LookupType6$1 extends LookupType$1 {
	constructor( p ) {
		super( p );
		if ( this.substFormat === 1 ) {
			this.chainSubRuleSetCount = p.uint16;
			this.chainSubRuleSetOffsets = [
				...new Array( this.chainSubRuleSetCount ),
			].map( ( _ ) => p.Offset16 );
		}
		if ( this.substFormat === 2 ) {
			this.backtrackClassDefOffset = p.Offset16;
			this.inputClassDefOffset = p.Offset16;
			this.lookaheadClassDefOffset = p.Offset16;
			this.chainSubClassSetCount = p.uint16;
			this.chainSubClassSetOffsets = [
				...new Array( this.chainSubClassSetCount ),
			].map( ( _ ) => p.Offset16 );
		}
		if ( this.substFormat === 3 ) {
			undoCoverageOffsetParsing( this );
			this.backtrackGlyphCount = p.uint16;
			this.backtrackCoverageOffsets = [
				...new Array( this.backtrackGlyphCount ),
			].map( ( _ ) => p.Offset16 );
			this.inputGlyphCount = p.uint16;
			this.inputCoverageOffsets = [
				...new Array( this.inputGlyphCount ),
			].map( ( _ ) => p.Offset16 );
			this.lookaheadGlyphCount = p.uint16;
			this.lookaheadCoverageOffsets = [
				...new Array( this.lookaheadGlyphCount ),
			].map( ( _ ) => p.Offset16 );
			this.seqLookupCount = p.uint16;
			this.seqLookupRecords = [
				...new Array( this.substitutionCount ),
			].map( ( _ ) => new SequenceLookupRecord( p ) );
		}
	}
	getChainSubRuleSet( index ) {
		if ( this.substFormat !== 1 )
			throw new Error(
				`lookup type 6.${ this.substFormat } has no chainsubrule sets.`
			);
		let p = this.parser;
		p.currentPosition = this.start + this.chainSubRuleSetOffsets[ index ];
		return new ChainSubRuleSetTable( p );
	}
	getChainSubClassSet( index ) {
		if ( this.substFormat !== 2 )
			throw new Error(
				`lookup type 6.${ this.substFormat } has no chainsubclass sets.`
			);
		let p = this.parser;
		p.currentPosition = this.start + this.chainSubClassSetOffsets[ index ];
		return new ChainSubClassSetTable( p );
	}
	getCoverageFromOffset( offset ) {
		if ( this.substFormat !== 3 )
			throw new Error(
				`lookup type 6.${ this.substFormat } does not use contextual coverage offsets.`
			);
		let p = this.parser;
		p.currentPosition = this.start + offset;
		return new CoverageTable( p );
	}
}
class ChainSubRuleSetTable extends ParsedData {
	constructor( p ) {
		super( p );
		this.chainSubRuleCount = p.uint16;
		this.chainSubRuleOffsets = [
			...new Array( this.chainSubRuleCount ),
		].map( ( _ ) => p.Offset16 );
	}
	getSubRule( index ) {
		let p = this.parser;
		p.currentPosition = this.start + this.chainSubRuleOffsets[ index ];
		return new ChainSubRuleTable( p );
	}
}
class ChainSubRuleTable {
	constructor( p ) {
		this.backtrackGlyphCount = p.uint16;
		this.backtrackSequence = [
			...new Array( this.backtrackGlyphCount ),
		].map( ( _ ) => p.uint16 );
		this.inputGlyphCount = p.uint16;
		this.inputSequence = [ ...new Array( this.inputGlyphCount - 1 ) ].map(
			( _ ) => p.uint16
		);
		this.lookaheadGlyphCount = p.uint16;
		this.lookAheadSequence = [
			...new Array( this.lookAheadGlyphCount ),
		].map( ( _ ) => p.uint16 );
		this.substitutionCount = p.uint16;
		this.substLookupRecords = [ ...new Array( this.SubstCount ) ].map(
			( _ ) => new SubstLookupRecord( p )
		);
	}
}
class ChainSubClassSetTable extends ParsedData {
	constructor( p ) {
		super( p );
		this.chainSubClassRuleCount = p.uint16;
		this.chainSubClassRuleOffsets = [
			...new Array( this.chainSubClassRuleCount ),
		].map( ( _ ) => p.Offset16 );
	}
	getSubClass( index ) {
		let p = this.parser;
		p.currentPosition = this.start + this.chainSubRuleOffsets[ index ];
		return new ChainSubClassRuleTable( p );
	}
}
class ChainSubClassRuleTable {
	constructor( p ) {
		this.backtrackGlyphCount = p.uint16;
		this.backtrackSequence = [
			...new Array( this.backtrackGlyphCount ),
		].map( ( _ ) => p.uint16 );
		this.inputGlyphCount = p.uint16;
		this.inputSequence = [ ...new Array( this.inputGlyphCount - 1 ) ].map(
			( _ ) => p.uint16
		);
		this.lookaheadGlyphCount = p.uint16;
		this.lookAheadSequence = [
			...new Array( this.lookAheadGlyphCount ),
		].map( ( _ ) => p.uint16 );
		this.substitutionCount = p.uint16;
		this.substLookupRecords = [
			...new Array( this.substitutionCount ),
		].map( ( _ ) => new SequenceLookupRecord( p ) );
	}
}
class SequenceLookupRecord extends ParsedData {
	constructor( p ) {
		super( p );
		this.sequenceIndex = p.uint16;
		this.lookupListIndex = p.uint16;
	}
}
class LookupType7$1 extends ParsedData {
	constructor( p ) {
		super( p );
		this.substFormat = p.uint16;
		this.extensionLookupType = p.uint16;
		this.extensionOffset = p.Offset32;
	}
}
class LookupType8$1 extends LookupType$1 {
	constructor( p ) {
		super( p );
		this.backtrackGlyphCount = p.uint16;
		this.backtrackCoverageOffsets = [
			...new Array( this.backtrackGlyphCount ),
		].map( ( _ ) => p.Offset16 );
		this.lookaheadGlyphCount = p.uint16;
		this.lookaheadCoverageOffsets = [
			new Array( this.lookaheadGlyphCount ),
		].map( ( _ ) => p.Offset16 );
		this.glyphCount = p.uint16;
		this.substituteGlyphIDs = [ ...new Array( this.glyphCount ) ].map(
			( _ ) => p.uint16
		);
	}
}
var GSUBtables = {
	buildSubtable: function ( type, p ) {
		const subtable = new [
			undefined,
			LookupType1$1,
			LookupType2$1,
			LookupType3$1,
			LookupType4$1,
			LookupType5$1,
			LookupType6$1,
			LookupType7$1,
			LookupType8$1,
		][ type ]( p );
		subtable.type = type;
		return subtable;
	},
};
class LookupType extends ParsedData {
	constructor( p ) {
		super( p );
	}
}
class LookupType1 extends LookupType {
	constructor( p ) {
		super( p );
		console.log( `lookup type 1` );
	}
}
class LookupType2 extends LookupType {
	constructor( p ) {
		super( p );
		console.log( `lookup type 2` );
	}
}
class LookupType3 extends LookupType {
	constructor( p ) {
		super( p );
		console.log( `lookup type 3` );
	}
}
class LookupType4 extends LookupType {
	constructor( p ) {
		super( p );
		console.log( `lookup type 4` );
	}
}
class LookupType5 extends LookupType {
	constructor( p ) {
		super( p );
		console.log( `lookup type 5` );
	}
}
class LookupType6 extends LookupType {
	constructor( p ) {
		super( p );
		console.log( `lookup type 6` );
	}
}
class LookupType7 extends LookupType {
	constructor( p ) {
		super( p );
		console.log( `lookup type 7` );
	}
}
class LookupType8 extends LookupType {
	constructor( p ) {
		super( p );
		console.log( `lookup type 8` );
	}
}
class LookupType9 extends LookupType {
	constructor( p ) {
		super( p );
		console.log( `lookup type 9` );
	}
}
var GPOStables = {
	buildSubtable: function ( type, p ) {
		const subtable = new [
			undefined,
			LookupType1,
			LookupType2,
			LookupType3,
			LookupType4,
			LookupType5,
			LookupType6,
			LookupType7,
			LookupType8,
			LookupType9,
		][ type ]( p );
		subtable.type = type;
		return subtable;
	},
};
class LookupList extends ParsedData {
	static EMPTY = { lookupCount: 0, lookups: [] };
	constructor( p ) {
		super( p );
		this.lookupCount = p.uint16;
		this.lookups = [ ...new Array( this.lookupCount ) ].map(
			( _ ) => p.Offset16
		);
	}
}
class LookupTable extends ParsedData {
	constructor( p, type ) {
		super( p );
		this.ctType = type;
		this.lookupType = p.uint16;
		this.lookupFlag = p.uint16;
		this.subTableCount = p.uint16;
		this.subtableOffsets = [ ...new Array( this.subTableCount ) ].map(
			( _ ) => p.Offset16
		);
		this.markFilteringSet = p.uint16;
	}
	get rightToLeft() {
		return this.lookupFlag & ( 1 === 1 );
	}
	get ignoreBaseGlyphs() {
		return this.lookupFlag & ( 2 === 2 );
	}
	get ignoreLigatures() {
		return this.lookupFlag & ( 4 === 4 );
	}
	get ignoreMarks() {
		return this.lookupFlag & ( 8 === 8 );
	}
	get useMarkFilteringSet() {
		return this.lookupFlag & ( 16 === 16 );
	}
	get markAttachmentType() {
		return this.lookupFlag & ( 65280 === 65280 );
	}
	getSubTable( index ) {
		const builder = this.ctType === `GSUB` ? GSUBtables : GPOStables;
		this.parser.currentPosition =
			this.start + this.subtableOffsets[ index ];
		return builder.buildSubtable( this.lookupType, this.parser );
	}
}
class CommonLayoutTable extends SimpleTable {
	constructor( dict, dataview, name ) {
		const { p: p, tableStart: tableStart } = super( dict, dataview, name );
		this.majorVersion = p.uint16;
		this.minorVersion = p.uint16;
		this.scriptListOffset = p.Offset16;
		this.featureListOffset = p.Offset16;
		this.lookupListOffset = p.Offset16;
		if ( this.majorVersion === 1 && this.minorVersion === 1 ) {
			this.featureVariationsOffset = p.Offset32;
		}
		const no_content = ! (
			this.scriptListOffset ||
			this.featureListOffset ||
			this.lookupListOffset
		);
		lazy$1( this, `scriptList`, () => {
			if ( no_content ) return ScriptList.EMPTY;
			p.currentPosition = tableStart + this.scriptListOffset;
			return new ScriptList( p );
		} );
		lazy$1( this, `featureList`, () => {
			if ( no_content ) return FeatureList.EMPTY;
			p.currentPosition = tableStart + this.featureListOffset;
			return new FeatureList( p );
		} );
		lazy$1( this, `lookupList`, () => {
			if ( no_content ) return LookupList.EMPTY;
			p.currentPosition = tableStart + this.lookupListOffset;
			return new LookupList( p );
		} );
		if ( this.featureVariationsOffset ) {
			lazy$1( this, `featureVariations`, () => {
				if ( no_content ) return FeatureVariations.EMPTY;
				p.currentPosition = tableStart + this.featureVariationsOffset;
				return new FeatureVariations( p );
			} );
		}
	}
	getSupportedScripts() {
		return this.scriptList.scriptRecords.map( ( r ) => r.scriptTag );
	}
	getScriptTable( scriptTag ) {
		let record = this.scriptList.scriptRecords.find(
			( r ) => r.scriptTag === scriptTag
		);
		this.parser.currentPosition =
			this.scriptList.start + record.scriptOffset;
		let table = new ScriptTable( this.parser );
		table.scriptTag = scriptTag;
		return table;
	}
	ensureScriptTable( arg ) {
		if ( typeof arg === 'string' ) {
			return this.getScriptTable( arg );
		}
		return arg;
	}
	getSupportedLangSys( scriptTable ) {
		scriptTable = this.ensureScriptTable( scriptTable );
		const hasDefault = scriptTable.defaultLangSys !== 0;
		const supported = scriptTable.langSysRecords.map(
			( l ) => l.langSysTag
		);
		if ( hasDefault ) supported.unshift( `dflt` );
		return supported;
	}
	getDefaultLangSysTable( scriptTable ) {
		scriptTable = this.ensureScriptTable( scriptTable );
		let offset = scriptTable.defaultLangSys;
		if ( offset !== 0 ) {
			this.parser.currentPosition = scriptTable.start + offset;
			let table = new LangSysTable( this.parser );
			table.langSysTag = ``;
			table.defaultForScript = scriptTable.scriptTag;
			return table;
		}
	}
	getLangSysTable( scriptTable, langSysTag = `dflt` ) {
		if ( langSysTag === `dflt` )
			return this.getDefaultLangSysTable( scriptTable );
		scriptTable = this.ensureScriptTable( scriptTable );
		let record = scriptTable.langSysRecords.find(
			( l ) => l.langSysTag === langSysTag
		);
		this.parser.currentPosition = scriptTable.start + record.langSysOffset;
		let table = new LangSysTable( this.parser );
		table.langSysTag = langSysTag;
		return table;
	}
	getFeatures( langSysTable ) {
		return langSysTable.featureIndices.map( ( index ) =>
			this.getFeature( index )
		);
	}
	getFeature( indexOrTag ) {
		let record;
		if ( parseInt( indexOrTag ) == indexOrTag ) {
			record = this.featureList.featureRecords[ indexOrTag ];
		} else {
			record = this.featureList.featureRecords.find(
				( f ) => f.featureTag === indexOrTag
			);
		}
		if ( ! record ) return;
		this.parser.currentPosition =
			this.featureList.start + record.featureOffset;
		let table = new FeatureTable( this.parser );
		table.featureTag = record.featureTag;
		return table;
	}
	getLookups( featureTable ) {
		return featureTable.lookupListIndices.map( ( index ) =>
			this.getLookup( index )
		);
	}
	getLookup( lookupIndex, type ) {
		let lookupOffset = this.lookupList.lookups[ lookupIndex ];
		this.parser.currentPosition = this.lookupList.start + lookupOffset;
		return new LookupTable( this.parser, type );
	}
}
class GSUB extends CommonLayoutTable {
	constructor( dict, dataview ) {
		super( dict, dataview, `GSUB` );
	}
	getLookup( lookupIndex ) {
		return super.getLookup( lookupIndex, `GSUB` );
	}
}
var GSUB$1 = Object.freeze( { __proto__: null, GSUB: GSUB } );
class GPOS extends CommonLayoutTable {
	constructor( dict, dataview ) {
		super( dict, dataview, `GPOS` );
	}
	getLookup( lookupIndex ) {
		return super.getLookup( lookupIndex, `GPOS` );
	}
}
var GPOS$1 = Object.freeze( { __proto__: null, GPOS: GPOS } );
class SVG extends SimpleTable {
	constructor( dict, dataview ) {
		const { p: p } = super( dict, dataview );
		this.version = p.uint16;
		this.offsetToSVGDocumentList = p.Offset32;
		p.currentPosition = this.tableStart + this.offsetToSVGDocumentList;
		this.documentList = new SVGDocumentList( p );
	}
}
class SVGDocumentList extends ParsedData {
	constructor( p ) {
		super( p );
		this.numEntries = p.uint16;
		this.documentRecords = [ ...new Array( this.numEntries ) ].map(
			( _ ) => new SVGDocumentRecord( p )
		);
	}
	getDocument( documentID ) {
		let record = this.documentRecords[ documentID ];
		if ( ! record ) return '';
		let offset = this.start + record.svgDocOffset;
		this.parser.currentPosition = offset;
		return this.parser.readBytes( record.svgDocLength );
	}
	getDocumentForGlyph( glyphID ) {
		let id = this.documentRecords.findIndex(
			( d ) => d.startGlyphID <= glyphID && glyphID <= d.endGlyphID
		);
		if ( id === -1 ) return '';
		return this.getDocument( id );
	}
}
class SVGDocumentRecord {
	constructor( p ) {
		this.startGlyphID = p.uint16;
		this.endGlyphID = p.uint16;
		this.svgDocOffset = p.Offset32;
		this.svgDocLength = p.uint32;
	}
}
var SVG$1 = Object.freeze( { __proto__: null, SVG: SVG } );
class fvar extends SimpleTable {
	constructor( dict, dataview ) {
		const { p: p } = super( dict, dataview );
		this.majorVersion = p.uint16;
		this.minorVersion = p.uint16;
		this.axesArrayOffset = p.Offset16;
		p.uint16;
		this.axisCount = p.uint16;
		this.axisSize = p.uint16;
		this.instanceCount = p.uint16;
		this.instanceSize = p.uint16;
		const axisStart = this.tableStart + this.axesArrayOffset;
		lazy$1( this, `axes`, () => {
			p.currentPosition = axisStart;
			return [ ...new Array( this.axisCount ) ].map(
				( _ ) => new VariationAxisRecord( p )
			);
		} );
		const instanceStart = axisStart + this.axisCount * this.axisSize;
		lazy$1( this, `instances`, () => {
			let instances = [];
			for ( let i = 0; i < this.instanceCount; i++ ) {
				p.currentPosition = instanceStart + i * this.instanceSize;
				instances.push(
					new InstanceRecord( p, this.axisCount, this.instanceSize )
				);
			}
			return instances;
		} );
	}
	getSupportedAxes() {
		return this.axes.map( ( a ) => a.tag );
	}
	getAxis( name ) {
		return this.axes.find( ( a ) => a.tag === name );
	}
}
class VariationAxisRecord {
	constructor( p ) {
		this.tag = p.tag;
		this.minValue = p.fixed;
		this.defaultValue = p.fixed;
		this.maxValue = p.fixed;
		this.flags = p.flags( 16 );
		this.axisNameID = p.uint16;
	}
}
class InstanceRecord {
	constructor( p, axisCount, size ) {
		let start = p.currentPosition;
		this.subfamilyNameID = p.uint16;
		p.uint16;
		this.coordinates = [ ...new Array( axisCount ) ].map(
			( _ ) => p.fixed
		);
		if ( p.currentPosition - start < size ) {
			this.postScriptNameID = p.uint16;
		}
	}
}
var fvar$1 = Object.freeze( { __proto__: null, fvar: fvar } );
class cvt extends SimpleTable {
	constructor( dict, dataview ) {
		const { p: p } = super( dict, dataview );
		const n = dict.length / 2;
		lazy$1( this, `items`, () =>
			[ ...new Array( n ) ].map( ( _ ) => p.fword )
		);
	}
}
var cvt$1 = Object.freeze( { __proto__: null, cvt: cvt } );
class fpgm extends SimpleTable {
	constructor( dict, dataview ) {
		const { p: p } = super( dict, dataview );
		lazy$1( this, `instructions`, () =>
			[ ...new Array( dict.length ) ].map( ( _ ) => p.uint8 )
		);
	}
}
var fpgm$1 = Object.freeze( { __proto__: null, fpgm: fpgm } );
class gasp extends SimpleTable {
	constructor( dict, dataview ) {
		const { p: p } = super( dict, dataview );
		this.version = p.uint16;
		this.numRanges = p.uint16;
		const getter = () =>
			[ ...new Array( this.numRanges ) ].map(
				( _ ) => new GASPRange( p )
			);
		lazy$1( this, `gaspRanges`, getter );
	}
}
class GASPRange {
	constructor( p ) {
		this.rangeMaxPPEM = p.uint16;
		this.rangeGaspBehavior = p.uint16;
	}
}
var gasp$1 = Object.freeze( { __proto__: null, gasp: gasp } );
class glyf extends SimpleTable {
	constructor( dict, dataview ) {
		super( dict, dataview );
	}
	getGlyphData( offset, length ) {
		this.parser.currentPosition = this.tableStart + offset;
		return this.parser.readBytes( length );
	}
}
var glyf$1 = Object.freeze( { __proto__: null, glyf: glyf } );
class loca extends SimpleTable {
	constructor( dict, dataview, tables ) {
		const { p: p } = super( dict, dataview );
		const n = tables.maxp.numGlyphs + 1;
		if ( tables.head.indexToLocFormat === 0 ) {
			this.x2 = true;
			lazy$1( this, `offsets`, () =>
				[ ...new Array( n ) ].map( ( _ ) => p.Offset16 )
			);
		} else {
			lazy$1( this, `offsets`, () =>
				[ ...new Array( n ) ].map( ( _ ) => p.Offset32 )
			);
		}
	}
	getGlyphDataOffsetAndLength( glyphID ) {
		let offset = this.offsets[ glyphID ] * this.x2 ? 2 : 1;
		let nextOffset = this.offsets[ glyphID + 1 ] * this.x2 ? 2 : 1;
		return { offset: offset, length: nextOffset - offset };
	}
}
var loca$1 = Object.freeze( { __proto__: null, loca: loca } );
class prep extends SimpleTable {
	constructor( dict, dataview ) {
		const { p: p } = super( dict, dataview );
		lazy$1( this, `instructions`, () =>
			[ ...new Array( dict.length ) ].map( ( _ ) => p.uint8 )
		);
	}
}
var prep$1 = Object.freeze( { __proto__: null, prep: prep } );
class CFF extends SimpleTable {
	constructor( dict, dataview ) {
		const { p: p } = super( dict, dataview );
		lazy$1( this, `data`, () => p.readBytes() );
	}
}
var CFF$1 = Object.freeze( { __proto__: null, CFF: CFF } );
class CFF2 extends SimpleTable {
	constructor( dict, dataview ) {
		const { p: p } = super( dict, dataview );
		lazy$1( this, `data`, () => p.readBytes() );
	}
}
var CFF2$1 = Object.freeze( { __proto__: null, CFF2: CFF2 } );
class VORG extends SimpleTable {
	constructor( dict, dataview ) {
		const { p: p } = super( dict, dataview );
		this.majorVersion = p.uint16;
		this.minorVersion = p.uint16;
		this.defaultVertOriginY = p.int16;
		this.numVertOriginYMetrics = p.uint16;
		lazy$1( this, `vertORiginYMetrics`, () =>
			[ ...new Array( this.numVertOriginYMetrics ) ].map(
				( _ ) => new VertOriginYMetric( p )
			)
		);
	}
}
class VertOriginYMetric {
	constructor( p ) {
		this.glyphIndex = p.uint16;
		this.vertOriginY = p.int16;
	}
}
var VORG$1 = Object.freeze( { __proto__: null, VORG: VORG } );
class BitmapSize {
	constructor( p ) {
		this.indexSubTableArrayOffset = p.Offset32;
		this.indexTablesSize = p.uint32;
		this.numberofIndexSubTables = p.uint32;
		this.colorRef = p.uint32;
		this.hori = new SbitLineMetrics( p );
		this.vert = new SbitLineMetrics( p );
		this.startGlyphIndex = p.uint16;
		this.endGlyphIndex = p.uint16;
		this.ppemX = p.uint8;
		this.ppemY = p.uint8;
		this.bitDepth = p.uint8;
		this.flags = p.int8;
	}
}
class BitmapScale {
	constructor( p ) {
		this.hori = new SbitLineMetrics( p );
		this.vert = new SbitLineMetrics( p );
		this.ppemX = p.uint8;
		this.ppemY = p.uint8;
		this.substitutePpemX = p.uint8;
		this.substitutePpemY = p.uint8;
	}
}
class SbitLineMetrics {
	constructor( p ) {
		this.ascender = p.int8;
		this.descender = p.int8;
		this.widthMax = p.uint8;
		this.caretSlopeNumerator = p.int8;
		this.caretSlopeDenominator = p.int8;
		this.caretOffset = p.int8;
		this.minOriginSB = p.int8;
		this.minAdvanceSB = p.int8;
		this.maxBeforeBL = p.int8;
		this.minAfterBL = p.int8;
		this.pad1 = p.int8;
		this.pad2 = p.int8;
	}
}
class EBLC extends SimpleTable {
	constructor( dict, dataview, name ) {
		const { p: p } = super( dict, dataview, name );
		this.majorVersion = p.uint16;
		this.minorVersion = p.uint16;
		this.numSizes = p.uint32;
		lazy$1( this, `bitMapSizes`, () =>
			[ ...new Array( this.numSizes ) ].map(
				( _ ) => new BitmapSize( p )
			)
		);
	}
}
var EBLC$1 = Object.freeze( { __proto__: null, EBLC: EBLC } );
class EBDT extends SimpleTable {
	constructor( dict, dataview, name ) {
		const { p: p } = super( dict, dataview, name );
		this.majorVersion = p.uint16;
		this.minorVersion = p.uint16;
	}
}
var EBDT$1 = Object.freeze( { __proto__: null, EBDT: EBDT } );
class EBSC extends SimpleTable {
	constructor( dict, dataview ) {
		const { p: p } = super( dict, dataview );
		this.majorVersion = p.uint16;
		this.minorVersion = p.uint16;
		this.numSizes = p.uint32;
		lazy$1( this, `bitmapScales`, () =>
			[ ...new Array( this.numSizes ) ].map(
				( _ ) => new BitmapScale( p )
			)
		);
	}
}
var EBSC$1 = Object.freeze( { __proto__: null, EBSC: EBSC } );
class CBLC extends EBLC {
	constructor( dict, dataview ) {
		super( dict, dataview, `CBLC` );
	}
}
var CBLC$1 = Object.freeze( { __proto__: null, CBLC: CBLC } );
class CBDT extends EBDT {
	constructor( dict, dataview ) {
		super( dict, dataview, `CBDT` );
	}
}
var CBDT$1 = Object.freeze( { __proto__: null, CBDT: CBDT } );
class sbix extends SimpleTable {
	constructor( dict, dataview ) {
		const { p: p } = super( dict, dataview );
		this.version = p.uint16;
		this.flags = p.flags( 16 );
		this.numStrikes = p.uint32;
		lazy$1( this, `strikeOffsets`, () =>
			[ ...new Array( this.numStrikes ) ].map( ( _ ) => p.Offset32 )
		);
	}
}
var sbix$1 = Object.freeze( { __proto__: null, sbix: sbix } );
class COLR extends SimpleTable {
	constructor( dict, dataview ) {
		const { p: p } = super( dict, dataview );
		this.version = p.uint16;
		this.numBaseGlyphRecords = p.uint16;
		this.baseGlyphRecordsOffset = p.Offset32;
		this.layerRecordsOffset = p.Offset32;
		this.numLayerRecords = p.uint16;
	}
	getBaseGlyphRecord( glyphID ) {
		let start = this.tableStart + this.baseGlyphRecordsOffset;
		this.parser.currentPosition = start;
		let first = new BaseGlyphRecord( this.parser );
		let firstID = first.gID;
		let end = this.tableStart + this.layerRecordsOffset - 6;
		this.parser.currentPosition = end;
		let last = new BaseGlyphRecord( this.parser );
		let lastID = last.gID;
		if ( firstID === glyphID ) return first;
		if ( lastID === glyphID ) return last;
		while ( true ) {
			if ( start === end ) break;
			let mid = start + ( end - start ) / 12;
			this.parser.currentPosition = mid;
			let middle = new BaseGlyphRecord( this.parser );
			let midID = middle.gID;
			if ( midID === glyphID ) return middle;
			else if ( midID > glyphID ) {
				end = mid;
			} else if ( midID < glyphID ) {
				start = mid;
			}
		}
		return false;
	}
	getLayers( glyphID ) {
		let record = this.getBaseGlyphRecord( glyphID );
		this.parser.currentPosition =
			this.tableStart +
			this.layerRecordsOffset +
			4 * record.firstLayerIndex;
		return [ ...new Array( record.numLayers ) ].map(
			( _ ) => new LayerRecord( p )
		);
	}
}
class BaseGlyphRecord {
	constructor( p ) {
		this.gID = p.uint16;
		this.firstLayerIndex = p.uint16;
		this.numLayers = p.uint16;
	}
}
class LayerRecord {
	constructor( p ) {
		this.gID = p.uint16;
		this.paletteIndex = p.uint16;
	}
}
var COLR$1 = Object.freeze( { __proto__: null, COLR: COLR } );
class CPAL extends SimpleTable {
	constructor( dict, dataview ) {
		const { p: p } = super( dict, dataview );
		this.version = p.uint16;
		this.numPaletteEntries = p.uint16;
		const numPalettes = ( this.numPalettes = p.uint16 );
		this.numColorRecords = p.uint16;
		this.offsetFirstColorRecord = p.Offset32;
		this.colorRecordIndices = [ ...new Array( this.numPalettes ) ].map(
			( _ ) => p.uint16
		);
		lazy$1( this, `colorRecords`, () => {
			p.currentPosition = this.tableStart + this.offsetFirstColorRecord;
			return [ ...new Array( this.numColorRecords ) ].map(
				( _ ) => new ColorRecord( p )
			);
		} );
		if ( this.version === 1 ) {
			this.offsetPaletteTypeArray = p.Offset32;
			this.offsetPaletteLabelArray = p.Offset32;
			this.offsetPaletteEntryLabelArray = p.Offset32;
			lazy$1( this, `paletteTypeArray`, () => {
				p.currentPosition =
					this.tableStart + this.offsetPaletteTypeArray;
				return new PaletteTypeArray( p, numPalettes );
			} );
			lazy$1( this, `paletteLabelArray`, () => {
				p.currentPosition =
					this.tableStart + this.offsetPaletteLabelArray;
				return new PaletteLabelsArray( p, numPalettes );
			} );
			lazy$1( this, `paletteEntryLabelArray`, () => {
				p.currentPosition =
					this.tableStart + this.offsetPaletteEntryLabelArray;
				return new PaletteEntryLabelArray( p, numPalettes );
			} );
		}
	}
}
class ColorRecord {
	constructor( p ) {
		this.blue = p.uint8;
		this.green = p.uint8;
		this.red = p.uint8;
		this.alpha = p.uint8;
	}
}
class PaletteTypeArray {
	constructor( p, numPalettes ) {
		this.paletteTypes = [ ...new Array( numPalettes ) ].map(
			( _ ) => p.uint32
		);
	}
}
class PaletteLabelsArray {
	constructor( p, numPalettes ) {
		this.paletteLabels = [ ...new Array( numPalettes ) ].map(
			( _ ) => p.uint16
		);
	}
}
class PaletteEntryLabelArray {
	constructor( p, numPalettes ) {
		this.paletteEntryLabels = [ ...new Array( numPalettes ) ].map(
			( _ ) => p.uint16
		);
	}
}
var CPAL$1 = Object.freeze( { __proto__: null, CPAL: CPAL } );
class DSIG extends SimpleTable {
	constructor( dict, dataview ) {
		const { p: p } = super( dict, dataview );
		this.version = p.uint32;
		this.numSignatures = p.uint16;
		this.flags = p.uint16;
		this.signatureRecords = [ ...new Array( this.numSignatures ) ].map(
			( _ ) => new SignatureRecord( p )
		);
	}
	getData( signatureID ) {
		const record = this.signatureRecords[ signatureID ];
		this.parser.currentPosition = this.tableStart + record.offset;
		return new SignatureBlockFormat1( this.parser );
	}
}
class SignatureRecord {
	constructor( p ) {
		this.format = p.uint32;
		this.length = p.uint32;
		this.offset = p.Offset32;
	}
}
class SignatureBlockFormat1 {
	constructor( p ) {
		p.uint16;
		p.uint16;
		this.signatureLength = p.uint32;
		this.signature = p.readBytes( this.signatureLength );
	}
}
var DSIG$1 = Object.freeze( { __proto__: null, DSIG: DSIG } );
class hdmx extends SimpleTable {
	constructor( dict, dataview, tables ) {
		const { p: p } = super( dict, dataview );
		const numGlyphs = tables.hmtx.numGlyphs;
		this.version = p.uint16;
		this.numRecords = p.int16;
		this.sizeDeviceRecord = p.int32;
		this.records = [ ...new Array( numRecords ) ].map(
			( _ ) => new DeviceRecord( p, numGlyphs )
		);
	}
}
class DeviceRecord {
	constructor( p, numGlyphs ) {
		this.pixelSize = p.uint8;
		this.maxWidth = p.uint8;
		this.widths = p.readBytes( numGlyphs );
	}
}
var hdmx$1 = Object.freeze( { __proto__: null, hdmx: hdmx } );
class kern extends SimpleTable {
	constructor( dict, dataview ) {
		const { p: p } = super( dict, dataview );
		this.version = p.uint16;
		this.nTables = p.uint16;
		lazy$1( this, `tables`, () => {
			let offset = this.tableStart + 4;
			const tables = [];
			for ( let i = 0; i < this.nTables; i++ ) {
				p.currentPosition = offset;
				let subtable = new KernSubTable( p );
				tables.push( subtable );
				offset += subtable;
			}
			return tables;
		} );
	}
}
class KernSubTable {
	constructor( p ) {
		this.version = p.uint16;
		this.length = p.uint16;
		this.coverage = p.flags( 8 );
		this.format = p.uint8;
		if ( this.format === 0 ) {
			this.nPairs = p.uint16;
			this.searchRange = p.uint16;
			this.entrySelector = p.uint16;
			this.rangeShift = p.uint16;
			lazy$1( this, `pairs`, () =>
				[ ...new Array( this.nPairs ) ].map( ( _ ) => new Pair( p ) )
			);
		}
		if ( this.format === 2 ) {
			console.warn(
				`Kern subtable format 2 is not supported: this parser currently only parses universal table data.`
			);
		}
	}
	get horizontal() {
		return this.coverage[ 0 ];
	}
	get minimum() {
		return this.coverage[ 1 ];
	}
	get crossstream() {
		return this.coverage[ 2 ];
	}
	get override() {
		return this.coverage[ 3 ];
	}
}
class Pair {
	constructor( p ) {
		this.left = p.uint16;
		this.right = p.uint16;
		this.value = p.fword;
	}
}
var kern$1 = Object.freeze( { __proto__: null, kern: kern } );
class LTSH extends SimpleTable {
	constructor( dict, dataview ) {
		const { p: p } = super( dict, dataview );
		this.version = p.uint16;
		this.numGlyphs = p.uint16;
		this.yPels = p.readBytes( this.numGlyphs );
	}
}
var LTSH$1 = Object.freeze( { __proto__: null, LTSH: LTSH } );
class MERG extends SimpleTable {
	constructor( dict, dataview ) {
		const { p: p } = super( dict, dataview );
		this.version = p.uint16;
		this.mergeClassCount = p.uint16;
		this.mergeDataOffset = p.Offset16;
		this.classDefCount = p.uint16;
		this.offsetToClassDefOffsets = p.Offset16;
		lazy$1( this, `mergeEntryMatrix`, () =>
			[ ...new Array( this.mergeClassCount ) ].map( ( _ ) =>
				p.readBytes( this.mergeClassCount )
			)
		);
		console.warn( `Full MERG parsing is currently not supported.` );
		console.warn(
			`If you need this table parsed, please file an issue, or better yet, a PR.`
		);
	}
}
var MERG$1 = Object.freeze( { __proto__: null, MERG: MERG } );
class meta extends SimpleTable {
	constructor( dict, dataview ) {
		const { p: p } = super( dict, dataview );
		this.version = p.uint32;
		this.flags = p.uint32;
		p.uint32;
		this.dataMapsCount = p.uint32;
		this.dataMaps = [ ...new Array( this.dataMapsCount ) ].map(
			( _ ) => new DataMap( this.tableStart, p )
		);
	}
}
class DataMap {
	constructor( tableStart, p ) {
		this.tableStart = tableStart;
		this.parser = p;
		this.tag = p.tag;
		this.dataOffset = p.Offset32;
		this.dataLength = p.uint32;
	}
	getData() {
		this.parser.currentField = this.tableStart + this.dataOffset;
		return this.parser.readBytes( this.dataLength );
	}
}
var meta$1 = Object.freeze( { __proto__: null, meta: meta } );
class PCLT extends SimpleTable {
	constructor( dict, dataview ) {
		super( dict, dataview );
		console.warn(
			`This font uses a PCLT table, which is currently not supported by this parser.`
		);
		console.warn(
			`If you need this table parsed, please file an issue, or better yet, a PR.`
		);
	}
}
var PCLT$1 = Object.freeze( { __proto__: null, PCLT: PCLT } );
class VDMX extends SimpleTable {
	constructor( dict, dataview ) {
		const { p: p } = super( dict, dataview );
		this.version = p.uint16;
		this.numRecs = p.uint16;
		this.numRatios = p.uint16;
		this.ratRanges = [ ...new Array( this.numRatios ) ].map(
			( _ ) => new RatioRange( p )
		);
		this.offsets = [ ...new Array( this.numRatios ) ].map(
			( _ ) => p.Offset16
		);
		this.VDMXGroups = [ ...new Array( this.numRecs ) ].map(
			( _ ) => new VDMXGroup( p )
		);
	}
}
class RatioRange {
	constructor( p ) {
		this.bCharSet = p.uint8;
		this.xRatio = p.uint8;
		this.yStartRatio = p.uint8;
		this.yEndRatio = p.uint8;
	}
}
class VDMXGroup {
	constructor( p ) {
		this.recs = p.uint16;
		this.startsz = p.uint8;
		this.endsz = p.uint8;
		this.records = [ ...new Array( this.recs ) ].map(
			( _ ) => new vTable( p )
		);
	}
}
class vTable {
	constructor( p ) {
		this.yPelHeight = p.uint16;
		this.yMax = p.int16;
		this.yMin = p.int16;
	}
}
var VDMX$1 = Object.freeze( { __proto__: null, VDMX: VDMX } );
class vhea extends SimpleTable {
	constructor( dict, dataview ) {
		const { p: p } = super( dict, dataview );
		this.version = p.fixed;
		this.ascent = this.vertTypoAscender = p.int16;
		this.descent = this.vertTypoDescender = p.int16;
		this.lineGap = this.vertTypoLineGap = p.int16;
		this.advanceHeightMax = p.int16;
		this.minTopSideBearing = p.int16;
		this.minBottomSideBearing = p.int16;
		this.yMaxExtent = p.int16;
		this.caretSlopeRise = p.int16;
		this.caretSlopeRun = p.int16;
		this.caretOffset = p.int16;
		this.reserved = p.int16;
		this.reserved = p.int16;
		this.reserved = p.int16;
		this.reserved = p.int16;
		this.metricDataFormat = p.int16;
		this.numOfLongVerMetrics = p.uint16;
		p.verifyLength();
	}
}
var vhea$1 = Object.freeze( { __proto__: null, vhea: vhea } );
class vmtx extends SimpleTable {
	constructor( dict, dataview, tables ) {
		super( dict, dataview );
		const numOfLongVerMetrics = tables.vhea.numOfLongVerMetrics;
		const numGlyphs = tables.maxp.numGlyphs;
		const metricsStart = p.currentPosition;
		lazy( this, `vMetrics`, () => {
			p.currentPosition = metricsStart;
			return [ ...new Array( numOfLongVerMetrics ) ].map(
				( _ ) => new LongVertMetric( p.uint16, p.int16 )
			);
		} );
		if ( numOfLongVerMetrics < numGlyphs ) {
			const tsbStart = metricsStart + numOfLongVerMetrics * 4;
			lazy( this, `topSideBearings`, () => {
				p.currentPosition = tsbStart;
				return [ ...new Array( numGlyphs - numOfLongVerMetrics ) ].map(
					( _ ) => p.int16
				);
			} );
		}
	}
}
class LongVertMetric {
	constructor( h, b ) {
		this.advanceHeight = h;
		this.topSideBearing = b;
	}
}
var vmtx$1 = Object.freeze( { __proto__: null, vmtx: vmtx } );

/* eslint-enable */

;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/utils/make-families-from-faces.js


const { kebabCase: make_families_from_faces_kebabCase } = unlock(external_wp_components_namespaceObject.privateApis);
function makeFamiliesFromFaces(fontFaces) {
  const fontFamiliesObject = fontFaces.reduce((acc, item) => {
    if (!acc[item.fontFamily]) {
      acc[item.fontFamily] = {
        name: item.fontFamily,
        fontFamily: item.fontFamily,
        slug: make_families_from_faces_kebabCase(item.fontFamily.toLowerCase()),
        fontFace: []
      };
    }
    acc[item.fontFamily].fontFace.push(item);
    return acc;
  }, {});
  return Object.values(fontFamiliesObject);
}


;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/upload-fonts.js









function UploadFonts() {
  const { installFonts } = (0,external_wp_element_.useContext)(FontLibraryContext);
  const [isUploading, setIsUploading] = (0,external_wp_element_.useState)(false);
  const [notice, setNotice] = (0,external_wp_element_.useState)(false);
  const handleDropZone = (files) => {
    handleFilesUpload(files);
  };
  const onFilesUpload = (event) => {
    handleFilesUpload(event.target.files);
  };
  const handleFilesUpload = async (files) => {
    setNotice(null);
    setIsUploading(true);
    const uniqueFilenames = /* @__PURE__ */ new Set();
    const selectedFiles = [...files];
    let hasInvalidFiles = false;
    const checkFilesPromises = selectedFiles.map(async (file) => {
      const isFont = await isFontFile(file);
      if (!isFont) {
        hasInvalidFiles = true;
        return null;
      }
      if (uniqueFilenames.has(file.name)) {
        return null;
      }
      const fileExtension = file.name.split(".").pop().toLowerCase();
      if (ALLOWED_FILE_EXTENSIONS.includes(fileExtension)) {
        uniqueFilenames.add(file.name);
        return file;
      }
      return null;
    });
    const allowedFiles = (await Promise.all(checkFilesPromises)).filter(
      (file) => null !== file
    );
    if (allowedFiles.length > 0) {
      loadFiles(allowedFiles);
    } else {
      const message = hasInvalidFiles ? (0,external_wp_i18n_namespaceObject.__)("Sorry, you are not allowed to upload this file type.") : (0,external_wp_i18n_namespaceObject.__)("No fonts found to install.");
      setNotice({
        type: "error",
        message
      });
      setIsUploading(false);
    }
  };
  const loadFiles = async (files) => {
    const fontFacesLoaded = await Promise.all(
      files.map(async (fontFile) => {
        const fontFaceData = await getFontFaceMetadata(fontFile);
        await loadFontFaceInBrowser(
          fontFaceData,
          fontFaceData.file,
          "all"
        );
        return fontFaceData;
      })
    );
    handleInstall(fontFacesLoaded);
  };
  async function isFontFile(file) {
    const font = new Font("Uploaded Font");
    try {
      const buffer = await readFileAsArrayBuffer(file);
      await font.fromDataBuffer(buffer, "font");
      return true;
    } catch (error) {
      return false;
    }
  }
  async function readFileAsArrayBuffer(file) {
    return new Promise((resolve, reject) => {
      const reader = new window.FileReader();
      reader.readAsArrayBuffer(file);
      reader.onload = () => resolve(reader.result);
      reader.onerror = reject;
    });
  }
  const getFontFaceMetadata = async (fontFile) => {
    const buffer = await readFileAsArrayBuffer(fontFile);
    const fontObj = new Font("Uploaded Font");
    fontObj.fromDataBuffer(buffer, fontFile.name);
    const onloadEvent = await new Promise(
      (resolve) => fontObj.onload = resolve
    );
    const font = onloadEvent.detail.font;
    const { name } = font.opentype.tables;
    const fontName = name.get(16) || name.get(1);
    const isItalic = name.get(2).toLowerCase().includes("italic");
    const fontWeight = font.opentype.tables["OS/2"].usWeightClass || "normal";
    const isVariable = !!font.opentype.tables.fvar;
    const weightAxis = isVariable && font.opentype.tables.fvar.axes.find(
      ({ tag }) => tag === "wght"
    );
    const weightRange = weightAxis ? `${weightAxis.minValue} ${weightAxis.maxValue}` : null;
    return {
      file: fontFile,
      fontFamily: fontName,
      fontStyle: isItalic ? "italic" : "normal",
      fontWeight: weightRange || fontWeight
    };
  };
  const handleInstall = async (fontFaces) => {
    const fontFamilies = makeFamiliesFromFaces(fontFaces);
    try {
      await installFonts(fontFamilies);
      setNotice({
        type: "success",
        message: (0,external_wp_i18n_namespaceObject.__)("Fonts were installed successfully.")
      });
    } catch (error) {
      setNotice({
        type: "error",
        message: error.message,
        errors: error?.installationErrors
      });
    }
    setIsUploading(false);
  };
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "font-library-modal__tabpanel-layout", children: [
    /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.DropZone, { onFilesDrop: handleDropZone }),
    /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { className: "font-library-modal__local-fonts", children: [
      notice && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
        external_wp_components_namespaceObject.Notice,
        {
          status: notice.type,
          __unstableHTML: true,
          onRemove: () => setNotice(null),
          children: [
            notice.message,
            notice.errors && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("ul", { children: notice.errors.map((error, index) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("li", { children: error }, index)) })
          ]
        }
      ),
      isUploading && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "font-library-modal__upload-area", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ProgressBar, {}) }) }),
      !isUploading && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
        external_wp_components_namespaceObject.FormFileUpload,
        {
          accept: ALLOWED_FILE_EXTENSIONS.map(
            (ext) => `.${ext}`
          ).join(","),
          multiple: true,
          onChange: onFilesUpload,
          render: ({ openFileDialog }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
            external_wp_components_namespaceObject.Button,
            {
              __next40pxDefaultSize: true,
              className: "font-library-modal__upload-area",
              onClick: openFileDialog,
              children: (0,external_wp_i18n_namespaceObject.__)("Upload font")
            }
          )
        }
      ),
      /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { margin: 2 }),
      /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { className: "font-library-modal__upload-area__text", children: (0,external_wp_i18n_namespaceObject.__)(
        "Uploaded fonts appear in your library and can be used in your theme. Supported formats: .ttf, .otf, .woff, and .woff2."
      ) })
    ] })
  ] });
}
var upload_fonts_default = UploadFonts;


;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/index.js











const { Tabs } = unlock(external_wp_components_namespaceObject.privateApis);
const DEFAULT_TAB = {
  id: "installed-fonts",
  title: (0,external_wp_i18n_namespaceObject._x)("Library", "Font library")
};
const UPLOAD_TAB = {
  id: "upload-fonts",
  title: (0,external_wp_i18n_namespaceObject._x)("Upload", "noun")
};
const tabsFromCollections = (collections) => collections.map(({ slug, name }) => ({
  id: slug,
  title: collections.length === 1 && slug === "google-fonts" ? (0,external_wp_i18n_namespaceObject.__)("Install Fonts") : name
}));
function FontLibraryModal({
  onRequestClose,
  defaultTabId = "installed-fonts"
}) {
  const { collections } = (0,external_wp_element_.useContext)(FontLibraryContext);
  const canUserCreate = (0,external_wp_data_.useSelect)((select) => {
    return select(external_wp_coreData_namespaceObject.store).canUser("create", {
      kind: "postType",
      name: "wp_font_family"
    });
  }, []);
  const tabs = [DEFAULT_TAB];
  if (canUserCreate) {
    tabs.push(UPLOAD_TAB);
    tabs.push(...tabsFromCollections(collections || []));
  }
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    external_wp_components_namespaceObject.Modal,
    {
      title: (0,external_wp_i18n_namespaceObject.__)("Fonts"),
      onRequestClose,
      isFullScreen: true,
      className: "font-library-modal",
      children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(Tabs, { defaultTabId, children: [
        /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "font-library-modal__tablist-container", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Tabs.TabList, { children: tabs.map(({ id, title }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Tabs.Tab, { tabId: id, children: title }, id)) }) }),
        tabs.map(({ id }) => {
          let contents;
          switch (id) {
            case "upload-fonts":
              contents = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(upload_fonts_default, {});
              break;
            case "installed-fonts":
              contents = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(installed_fonts_default, {});
              break;
            default:
              contents = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(font_collection_default, { slug: id });
          }
          return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
            Tabs.TabPanel,
            {
              tabId: id,
              focusable: false,
              children: contents
            },
            id
          );
        })
      ] })
    }
  );
}
var font_library_modal_default = FontLibraryModal;


;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-family-item.js






function FontFamilyItem({ font }) {
  const { handleSetLibraryFontSelected, setModalTabOpen } = (0,external_wp_element_.useContext)(FontLibraryContext);
  const variantsCount = font?.fontFace?.length || 1;
  const handleClick = () => {
    handleSetLibraryFontSelected(font);
    setModalTabOpen("installed-fonts");
  };
  const previewStyle = getFamilyPreviewStyle(font);
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItem, { onClick: handleClick, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "space-between", children: [
    /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { style: previewStyle, children: font.name }),
    /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { className: "edit-site-global-styles-screen-typography__font-variants-count", children: (0,external_wp_i18n_namespaceObject.sprintf)(
      /* translators: %d: Number of font variants. */
      (0,external_wp_i18n_namespaceObject._n)("%d variant", "%d variants", variantsCount),
      variantsCount
    ) })
  ] }) });
}
var font_family_item_default = FontFamilyItem;


;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-families.js












const { useGlobalSetting: font_families_useGlobalSetting } = unlock(external_wp_blockEditor_namespaceObject.privateApis);
function mapFontsWithSource(fonts, source) {
  return fonts ? fonts.map((f) => setUIValuesNeeded(f, { source })) : [];
}
function FontFamilies() {
  const { baseCustomFonts, modalTabOpen, setModalTabOpen } = (0,external_wp_element_.useContext)(FontLibraryContext);
  const [fontFamilies] = font_families_useGlobalSetting("typography.fontFamilies");
  const [baseFontFamilies] = font_families_useGlobalSetting(
    "typography.fontFamilies",
    void 0,
    "base"
  );
  const themeFonts = mapFontsWithSource(fontFamilies?.theme, "theme");
  const customFonts = mapFontsWithSource(fontFamilies?.custom, "custom");
  const activeFonts = [...themeFonts, ...customFonts].sort(
    (a, b) => a.name.localeCompare(b.name)
  );
  const hasFonts = 0 < activeFonts.length;
  const hasInstalledFonts = hasFonts || baseFontFamilies?.theme?.length > 0 || baseCustomFonts?.length > 0;
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
    !!modalTabOpen && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
      font_library_modal_default,
      {
        onRequestClose: () => setModalTabOpen(null),
        defaultTabId: modalTabOpen
      }
    ),
    /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 2, children: [
      /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "space-between", children: [
        /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(subtitle_default, { level: 3, children: (0,external_wp_i18n_namespaceObject.__)("Fonts") }),
        /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
          external_wp_components_namespaceObject.Button,
          {
            onClick: () => setModalTabOpen("installed-fonts"),
            label: (0,external_wp_i18n_namespaceObject.__)("Manage fonts"),
            icon: settings_default,
            size: "small"
          }
        )
      ] }),
      activeFonts.length > 0 && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItemGroup, { size: "large", isBordered: true, isSeparated: true, children: activeFonts.map((font) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
        font_family_item_default,
        {
          font
        },
        font.slug
      )) }) }),
      !hasFonts && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
        /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { as: "p", children: hasInstalledFonts ? (0,external_wp_i18n_namespaceObject.__)("No fonts activated.") : (0,external_wp_i18n_namespaceObject.__)("No fonts installed.") }),
        /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
          external_wp_components_namespaceObject.Button,
          {
            className: "edit-site-global-styles-font-families__manage-fonts",
            variant: "secondary",
            __next40pxDefaultSize: true,
            onClick: () => {
              setModalTabOpen(
                hasInstalledFonts ? "installed-fonts" : "upload-fonts"
              );
            },
            children: hasInstalledFonts ? (0,external_wp_i18n_namespaceObject.__)("Manage fonts") : (0,external_wp_i18n_namespaceObject.__)("Add fonts")
          }
        )
      ] })
    ] })
  ] });
}
var font_families_default = ({ ...props }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(context_default, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(FontFamilies, { ...props }) });


;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-typography.js










function ScreenTypography() {
  const fontLibraryEnabled = (0,external_wp_data_.useSelect)(
    (select) => select(external_wp_editor_namespaceObject.store).getEditorSettings().fontLibraryEnabled,
    []
  );
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
    /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
      header_default,
      {
        title: (0,external_wp_i18n_namespaceObject.__)("Typography"),
        description: (0,external_wp_i18n_namespaceObject.__)(
          "Available fonts, typographic styles, and the application of those styles."
        )
      }
    ),
    /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "edit-site-global-styles-screen", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 7, children: [
      /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(TypographyVariations, { title: (0,external_wp_i18n_namespaceObject.__)("Typesets") }),
      fontLibraryEnabled && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(font_families_default, {}),
      /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(typography_elements_default, {}),
      /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(font_sizes_count_default, {})
    ] }) })
  ] });
}
var screen_typography_default = ScreenTypography;


;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/typography-panel.js



const {
  useGlobalStyle: typography_panel_useGlobalStyle,
  useGlobalSetting: typography_panel_useGlobalSetting,
  useSettingsForBlockElement: typography_panel_useSettingsForBlockElement,
  TypographyPanel: typography_panel_StylesTypographyPanel
} = unlock(external_wp_blockEditor_namespaceObject.privateApis);
function TypographyPanel({ element, headingLevel }) {
  let prefixParts = [];
  if (element === "heading") {
    prefixParts = prefixParts.concat(["elements", headingLevel]);
  } else if (element && element !== "text") {
    prefixParts = prefixParts.concat(["elements", element]);
  }
  const prefix = prefixParts.join(".");
  const [style] = typography_panel_useGlobalStyle(prefix, void 0, "user", {
    shouldDecodeEncode: false
  });
  const [inheritedStyle, setStyle] = typography_panel_useGlobalStyle(
    prefix,
    void 0,
    "all",
    {
      shouldDecodeEncode: false
    }
  );
  const [rawSettings] = typography_panel_useGlobalSetting("");
  const usedElement = element === "heading" ? headingLevel : element;
  const settings = typography_panel_useSettingsForBlockElement(
    rawSettings,
    void 0,
    usedElement
  );
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    typography_panel_StylesTypographyPanel,
    {
      inheritedValue: inheritedStyle,
      value: style,
      onChange: setStyle,
      settings
    }
  );
}


;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/typography-preview.js



const { useGlobalStyle: typography_preview_useGlobalStyle } = unlock(external_wp_blockEditor_namespaceObject.privateApis);
function TypographyPreview({ name, element, headingLevel }) {
  let prefix = "";
  if (element === "heading") {
    prefix = `elements.${headingLevel}.`;
  } else if (element && element !== "text") {
    prefix = `elements.${element}.`;
  }
  const [fontFamily] = typography_preview_useGlobalStyle(
    prefix + "typography.fontFamily",
    name
  );
  const [gradientValue] = typography_preview_useGlobalStyle(prefix + "color.gradient", name);
  const [backgroundColor] = typography_preview_useGlobalStyle(
    prefix + "color.background",
    name
  );
  const [fallbackBackgroundColor] = typography_preview_useGlobalStyle("color.background");
  const [color] = typography_preview_useGlobalStyle(prefix + "color.text", name);
  const [fontSize] = typography_preview_useGlobalStyle(prefix + "typography.fontSize", name);
  const [fontStyle] = typography_preview_useGlobalStyle(
    prefix + "typography.fontStyle",
    name
  );
  const [fontWeight] = typography_preview_useGlobalStyle(
    prefix + "typography.fontWeight",
    name
  );
  const [letterSpacing] = typography_preview_useGlobalStyle(
    prefix + "typography.letterSpacing",
    name
  );
  const extraStyles = element === "link" ? {
    textDecoration: "underline"
  } : {};
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    "div",
    {
      className: "edit-site-typography-preview",
      style: {
        fontFamily: fontFamily ?? "serif",
        background: gradientValue ?? backgroundColor ?? fallbackBackgroundColor,
        color,
        fontSize,
        fontStyle,
        fontWeight,
        letterSpacing,
        ...extraStyles
      },
      children: "Aa"
    }
  );
}


;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-typography-element.js







const screen_typography_element_elements = {
  text: {
    description: (0,external_wp_i18n_namespaceObject.__)("Manage the fonts used on the site."),
    title: (0,external_wp_i18n_namespaceObject.__)("Text")
  },
  link: {
    description: (0,external_wp_i18n_namespaceObject.__)("Manage the fonts and typography used on the links."),
    title: (0,external_wp_i18n_namespaceObject.__)("Links")
  },
  heading: {
    description: (0,external_wp_i18n_namespaceObject.__)("Manage the fonts and typography used on headings."),
    title: (0,external_wp_i18n_namespaceObject.__)("Headings")
  },
  caption: {
    description: (0,external_wp_i18n_namespaceObject.__)("Manage the fonts and typography used on captions."),
    title: (0,external_wp_i18n_namespaceObject.__)("Captions")
  },
  button: {
    description: (0,external_wp_i18n_namespaceObject.__)("Manage the fonts and typography used on buttons."),
    title: (0,external_wp_i18n_namespaceObject.__)("Buttons")
  }
};
function ScreenTypographyElement({ element }) {
  const [headingLevel, setHeadingLevel] = (0,external_wp_element_.useState)("heading");
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
    /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
      header_default,
      {
        title: screen_typography_element_elements[element].title,
        description: screen_typography_element_elements[element].description
      }
    ),
    /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { marginX: 4, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
      TypographyPreview,
      {
        element,
        headingLevel
      }
    ) }),
    element === "heading" && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { marginX: 4, marginBottom: "1em", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
      external_wp_components_namespaceObject.__experimentalToggleGroupControl,
      {
        label: (0,external_wp_i18n_namespaceObject.__)("Select heading level"),
        hideLabelFromVision: true,
        value: headingLevel,
        onChange: setHeadingLevel,
        isBlock: true,
        size: "__unstable-large",
        __nextHasNoMarginBottom: true,
        children: [
          /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
            external_wp_components_namespaceObject.__experimentalToggleGroupControlOption,
            {
              value: "heading",
              showTooltip: true,
              "aria-label": (0,external_wp_i18n_namespaceObject.__)("All headings"),
              label: (0,external_wp_i18n_namespaceObject._x)("All", "heading levels")
            }
          ),
          /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
            external_wp_components_namespaceObject.__experimentalToggleGroupControlOption,
            {
              value: "h1",
              showTooltip: true,
              "aria-label": (0,external_wp_i18n_namespaceObject.__)("Heading 1"),
              label: (0,external_wp_i18n_namespaceObject.__)("H1")
            }
          ),
          /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
            external_wp_components_namespaceObject.__experimentalToggleGroupControlOption,
            {
              value: "h2",
              showTooltip: true,
              "aria-label": (0,external_wp_i18n_namespaceObject.__)("Heading 2"),
              label: (0,external_wp_i18n_namespaceObject.__)("H2")
            }
          ),
          /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
            external_wp_components_namespaceObject.__experimentalToggleGroupControlOption,
            {
              value: "h3",
              showTooltip: true,
              "aria-label": (0,external_wp_i18n_namespaceObject.__)("Heading 3"),
              label: (0,external_wp_i18n_namespaceObject.__)("H3")
            }
          ),
          /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
            external_wp_components_namespaceObject.__experimentalToggleGroupControlOption,
            {
              value: "h4",
              showTooltip: true,
              "aria-label": (0,external_wp_i18n_namespaceObject.__)("Heading 4"),
              label: (0,external_wp_i18n_namespaceObject.__)("H4")
            }
          ),
          /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
            external_wp_components_namespaceObject.__experimentalToggleGroupControlOption,
            {
              value: "h5",
              showTooltip: true,
              "aria-label": (0,external_wp_i18n_namespaceObject.__)("Heading 5"),
              label: (0,external_wp_i18n_namespaceObject.__)("H5")
            }
          ),
          /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
            external_wp_components_namespaceObject.__experimentalToggleGroupControlOption,
            {
              value: "h6",
              showTooltip: true,
              "aria-label": (0,external_wp_i18n_namespaceObject.__)("Heading 6"),
              label: (0,external_wp_i18n_namespaceObject.__)("H6")
            }
          )
        ]
      }
    ) }),
    /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
      TypographyPanel,
      {
        element,
        headingLevel
      }
    )
  ] });
}
var screen_typography_element_default = ScreenTypographyElement;


;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-sizes/font-size-preview.js




const { useGlobalStyle: font_size_preview_useGlobalStyle } = unlock(external_wp_blockEditor_namespaceObject.privateApis);
function FontSizePreview({ fontSize }) {
  const [font] = font_size_preview_useGlobalStyle("typography");
  const input = fontSize?.fluid?.min && fontSize?.fluid?.max ? {
    minimumFontSize: fontSize.fluid.min,
    maximumFontSize: fontSize.fluid.max
  } : {
    fontSize: fontSize.size
  };
  const computedFontSize = (0,external_wp_blockEditor_namespaceObject.getComputedFluidTypographyValue)(input);
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    "div",
    {
      className: "edit-site-typography-preview",
      style: {
        fontSize: computedFontSize,
        fontFamily: font?.fontFamily ?? "serif"
      },
      children: (0,external_wp_i18n_namespaceObject.__)("Aa")
    }
  );
}
var font_size_preview_default = FontSizePreview;


;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-sizes/confirm-delete-font-size-dialog.js



function ConfirmDeleteFontSizeDialog({
  fontSize,
  isOpen,
  toggleOpen,
  handleRemoveFontSize
}) {
  const handleConfirm = async () => {
    toggleOpen();
    handleRemoveFontSize(fontSize);
  };
  const handleCancel = () => {
    toggleOpen();
  };
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    external_wp_components_namespaceObject.__experimentalConfirmDialog,
    {
      isOpen,
      cancelButtonText: (0,external_wp_i18n_namespaceObject.__)("Cancel"),
      confirmButtonText: (0,external_wp_i18n_namespaceObject.__)("Delete"),
      onCancel: handleCancel,
      onConfirm: handleConfirm,
      size: "medium",
      children: fontSize && (0,external_wp_i18n_namespaceObject.sprintf)(
        /* translators: %s: Name of the font size preset. */
        (0,external_wp_i18n_namespaceObject.__)(
          'Are you sure you want to delete "%s" font size preset?'
        ),
        fontSize.name
      )
    }
  );
}
var confirm_delete_font_size_dialog_default = ConfirmDeleteFontSizeDialog;


;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-sizes/rename-font-size-dialog.js




function RenameFontSizeDialog({ fontSize, toggleOpen, handleRename }) {
  const [newName, setNewName] = (0,external_wp_element_.useState)(fontSize.name);
  const handleConfirm = () => {
    if (newName.trim()) {
      handleRename(newName);
    }
    toggleOpen();
  };
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    external_wp_components_namespaceObject.Modal,
    {
      onRequestClose: toggleOpen,
      focusOnMount: "firstContentElement",
      title: (0,external_wp_i18n_namespaceObject.__)("Rename"),
      size: "small",
      children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
        "form",
        {
          onSubmit: (event) => {
            event.preventDefault();
            handleConfirm();
            toggleOpen();
          },
          children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: "3", children: [
            /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
              external_wp_components_namespaceObject.__experimentalInputControl,
              {
                __next40pxDefaultSize: true,
                autoComplete: "off",
                value: newName,
                onChange: setNewName,
                label: (0,external_wp_i18n_namespaceObject.__)("Name"),
                placeholder: (0,external_wp_i18n_namespaceObject.__)("Font size preset name")
              }
            ),
            /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "right", children: [
              /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
                external_wp_components_namespaceObject.Button,
                {
                  __next40pxDefaultSize: true,
                  variant: "tertiary",
                  onClick: toggleOpen,
                  children: (0,external_wp_i18n_namespaceObject.__)("Cancel")
                }
              ),
              /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
                external_wp_components_namespaceObject.Button,
                {
                  __next40pxDefaultSize: true,
                  variant: "primary",
                  type: "submit",
                  children: (0,external_wp_i18n_namespaceObject.__)("Save")
                }
              )
            ] })
          ] })
        }
      )
    }
  );
}
var rename_font_size_dialog_default = RenameFontSizeDialog;


;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/size-control/index.js


const DEFAULT_UNITS = ["px", "em", "rem", "vw", "vh"];
function SizeControl({
  // Do not allow manipulation of margin bottom
  __nextHasNoMarginBottom,
  ...props
}) {
  const { baseControlProps } = (0,external_wp_components_namespaceObject.useBaseControlProps)(props);
  const { value, onChange, fallbackValue, disabled, label } = props;
  const units = (0,external_wp_components_namespaceObject.__experimentalUseCustomUnits)({
    availableUnits: DEFAULT_UNITS
  });
  const [valueQuantity, valueUnit = "px"] = (0,external_wp_components_namespaceObject.__experimentalParseQuantityAndUnitFromRawValue)(value, units);
  const isValueUnitRelative = !!valueUnit && ["em", "rem", "vw", "vh"].includes(valueUnit);
  const handleUnitControlChange = (newValue) => {
    onChange(newValue);
  };
  const handleRangeControlChange = (newValue) => {
    onChange?.(newValue + valueUnit);
  };
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.BaseControl, { ...baseControlProps, __nextHasNoMarginBottom: true, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, { children: [
    /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { isBlock: true, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
      external_wp_components_namespaceObject.__experimentalUnitControl,
      {
        __next40pxDefaultSize: true,
        __nextHasNoMarginBottom: true,
        label,
        hideLabelFromVision: true,
        value,
        onChange: handleUnitControlChange,
        units,
        min: 0,
        disabled
      }
    ) }),
    /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { isBlock: true, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { marginX: 2, marginBottom: 0, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
      external_wp_components_namespaceObject.RangeControl,
      {
        __next40pxDefaultSize: true,
        __nextHasNoMarginBottom: true,
        label,
        hideLabelFromVision: true,
        value: valueQuantity,
        initialPosition: fallbackValue,
        withInputField: false,
        onChange: handleRangeControlChange,
        min: 0,
        max: isValueUnitRelative ? 10 : 100,
        step: isValueUnitRelative ? 0.1 : 1,
        disabled
      }
    ) }) })
  ] }) });
}
var size_control_default = SizeControl;


;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-sizes/font-size.js












const { Menu } = unlock(external_wp_components_namespaceObject.privateApis);
const { useGlobalSetting: font_size_useGlobalSetting } = unlock(external_wp_blockEditor_namespaceObject.privateApis);
function FontSize() {
  const [isDeleteConfirmOpen, setIsDeleteConfirmOpen] = (0,external_wp_element_.useState)(false);
  const [isRenameDialogOpen, setIsRenameDialogOpen] = (0,external_wp_element_.useState)(false);
  const {
    params: { origin, slug },
    goBack
  } = (0,external_wp_components_namespaceObject.useNavigator)();
  const [fontSizes, setFontSizes] = font_size_useGlobalSetting(
    "typography.fontSizes"
  );
  const [globalFluid] = font_size_useGlobalSetting("typography.fluid");
  const sizes = fontSizes[origin] ?? [];
  const fontSize = sizes.find((size) => size.slug === slug);
  (0,external_wp_element_.useEffect)(() => {
    if (!!slug && !fontSize) {
      goBack();
    }
  }, [slug, fontSize, goBack]);
  if (!origin || !slug || !fontSize) {
    return null;
  }
  const isFluid = fontSize?.fluid !== void 0 ? !!fontSize.fluid : !!globalFluid;
  const isCustomFluid = typeof fontSize?.fluid === "object";
  const handleNameChange = (value) => {
    updateFontSize("name", value);
  };
  const handleFontSizeChange = (value) => {
    updateFontSize("size", value);
  };
  const handleFluidChange = (value) => {
    updateFontSize("fluid", value);
  };
  const handleCustomFluidValues = (value) => {
    if (value) {
      updateFontSize("fluid", {
        min: fontSize.size,
        max: fontSize.size
      });
    } else {
      updateFontSize("fluid", true);
    }
  };
  const handleMinChange = (value) => {
    updateFontSize("fluid", { ...fontSize.fluid, min: value });
  };
  const handleMaxChange = (value) => {
    updateFontSize("fluid", { ...fontSize.fluid, max: value });
  };
  const updateFontSize = (key, value) => {
    const newFontSizes = sizes.map((size) => {
      if (size.slug === slug) {
        return { ...size, [key]: value };
      }
      return size;
    });
    setFontSizes({
      ...fontSizes,
      [origin]: newFontSizes
    });
  };
  const handleRemoveFontSize = () => {
    const newFontSizes = sizes.filter((size) => size.slug !== slug);
    setFontSizes({
      ...fontSizes,
      [origin]: newFontSizes
    });
  };
  const toggleDeleteConfirm = () => {
    setIsDeleteConfirmOpen(!isDeleteConfirmOpen);
  };
  const toggleRenameDialog = () => {
    setIsRenameDialogOpen(!isRenameDialogOpen);
  };
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
    /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
      confirm_delete_font_size_dialog_default,
      {
        fontSize,
        isOpen: isDeleteConfirmOpen,
        toggleOpen: toggleDeleteConfirm,
        handleRemoveFontSize
      }
    ),
    isRenameDialogOpen && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
      rename_font_size_dialog_default,
      {
        fontSize,
        toggleOpen: toggleRenameDialog,
        handleRename: handleNameChange
      }
    ),
    /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 4, children: [
      /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "space-between", align: "flex-start", children: [
        /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
          header_default,
          {
            title: fontSize.name,
            description: (0,external_wp_i18n_namespaceObject.sprintf)(
              /* translators: %s: font size preset name. */
              (0,external_wp_i18n_namespaceObject.__)("Manage the font size %s."),
              fontSize.name
            )
          }
        ),
        origin === "custom" && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
          external_wp_components_namespaceObject.__experimentalSpacer,
          {
            marginTop: 3,
            marginBottom: 0,
            paddingX: 4,
            children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(Menu, { children: [
              /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
                Menu.TriggerButton,
                {
                  render: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
                    external_wp_components_namespaceObject.Button,
                    {
                      size: "small",
                      icon: more_vertical_default,
                      label: (0,external_wp_i18n_namespaceObject.__)(
                        "Font size options"
                      )
                    }
                  )
                }
              ),
              /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(Menu.Popover, { children: [
                /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
                  Menu.Item,
                  {
                    onClick: toggleRenameDialog,
                    children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Menu.ItemLabel, { children: (0,external_wp_i18n_namespaceObject.__)("Rename") })
                  }
                ),
                /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
                  Menu.Item,
                  {
                    onClick: toggleDeleteConfirm,
                    children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Menu.ItemLabel, { children: (0,external_wp_i18n_namespaceObject.__)("Delete") })
                  }
                )
              ] })
            ] })
          }
        ) })
      ] }),
      /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalView, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
        external_wp_components_namespaceObject.__experimentalSpacer,
        {
          paddingX: 4,
          marginBottom: 0,
          paddingBottom: 6,
          children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 4, children: [
            /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(font_size_preview_default, { fontSize }) }),
            /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
              size_control_default,
              {
                label: (0,external_wp_i18n_namespaceObject.__)("Size"),
                value: !isCustomFluid ? fontSize.size : "",
                onChange: handleFontSizeChange,
                disabled: isCustomFluid
              }
            ),
            /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
              external_wp_components_namespaceObject.ToggleControl,
              {
                label: (0,external_wp_i18n_namespaceObject.__)("Fluid typography"),
                help: (0,external_wp_i18n_namespaceObject.__)(
                  "Scale the font size dynamically to fit the screen or viewport."
                ),
                checked: isFluid,
                onChange: handleFluidChange,
                __nextHasNoMarginBottom: true
              }
            ),
            isFluid && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
              external_wp_components_namespaceObject.ToggleControl,
              {
                label: (0,external_wp_i18n_namespaceObject.__)("Custom fluid values"),
                help: (0,external_wp_i18n_namespaceObject.__)(
                  "Set custom min and max values for the fluid font size."
                ),
                checked: isCustomFluid,
                onChange: handleCustomFluidValues,
                __nextHasNoMarginBottom: true
              }
            ),
            isCustomFluid && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
              /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
                size_control_default,
                {
                  label: (0,external_wp_i18n_namespaceObject.__)("Minimum"),
                  value: fontSize.fluid?.min,
                  onChange: handleMinChange
                }
              ),
              /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
                size_control_default,
                {
                  label: (0,external_wp_i18n_namespaceObject.__)("Maximum"),
                  value: fontSize.fluid?.max,
                  onChange: handleMaxChange
                }
              )
            ] })
          ] })
        }
      ) })
    ] })
  ] });
}
var font_size_default = FontSize;


;// ./node_modules/@wordpress/icons/build-module/library/plus.js


var plus_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M11 12.5V17.5H12.5V12.5H17.5V11H12.5V6H11V11H6V12.5H11Z" }) });


;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-sizes/confirm-reset-font-sizes-dialog.js



function ConfirmResetFontSizesDialog({
  text,
  confirmButtonText,
  isOpen,
  toggleOpen,
  onConfirm
}) {
  const handleConfirm = async () => {
    toggleOpen();
    onConfirm();
  };
  const handleCancel = () => {
    toggleOpen();
  };
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    external_wp_components_namespaceObject.__experimentalConfirmDialog,
    {
      isOpen,
      cancelButtonText: (0,external_wp_i18n_namespaceObject.__)("Cancel"),
      confirmButtonText,
      onCancel: handleCancel,
      onConfirm: handleConfirm,
      size: "medium",
      children: text
    }
  );
}
var confirm_reset_font_sizes_dialog_default = ConfirmResetFontSizesDialog;


;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-sizes/font-sizes.js












const { Menu: font_sizes_Menu } = unlock(external_wp_components_namespaceObject.privateApis);
const { useGlobalSetting: font_sizes_useGlobalSetting } = unlock(external_wp_blockEditor_namespaceObject.privateApis);
function FontSizeGroup({
  label,
  origin,
  sizes,
  handleAddFontSize,
  handleResetFontSizes
}) {
  const [isResetDialogOpen, setIsResetDialogOpen] = (0,external_wp_element_.useState)(false);
  const toggleResetDialog = () => setIsResetDialogOpen(!isResetDialogOpen);
  const resetDialogText = origin === "custom" ? (0,external_wp_i18n_namespaceObject.__)(
    "Are you sure you want to remove all custom font size presets?"
  ) : (0,external_wp_i18n_namespaceObject.__)(
    "Are you sure you want to reset all font size presets to their default values?"
  );
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
    isResetDialogOpen && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
      confirm_reset_font_sizes_dialog_default,
      {
        text: resetDialogText,
        confirmButtonText: origin === "custom" ? (0,external_wp_i18n_namespaceObject.__)("Remove") : (0,external_wp_i18n_namespaceObject.__)("Reset"),
        isOpen: isResetDialogOpen,
        toggleOpen: toggleResetDialog,
        onConfirm: handleResetFontSizes
      }
    ),
    /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 4, children: [
      /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { children: [
        /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(subtitle_default, { level: 3, children: label }),
        /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.FlexItem, { className: "edit-site-global-styles__typography-panel__options-container", children: [
          origin === "custom" && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
            external_wp_components_namespaceObject.Button,
            {
              label: (0,external_wp_i18n_namespaceObject.__)("Add font size"),
              icon: plus_default,
              size: "small",
              onClick: handleAddFontSize
            }
          ),
          !!handleResetFontSizes && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(font_sizes_Menu, { children: [
            /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
              font_sizes_Menu.TriggerButton,
              {
                render: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
                  external_wp_components_namespaceObject.Button,
                  {
                    size: "small",
                    icon: more_vertical_default,
                    label: (0,external_wp_i18n_namespaceObject.__)(
                      "Font size presets options"
                    )
                  }
                )
              }
            ),
            /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(font_sizes_Menu.Popover, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(font_sizes_Menu.Item, { onClick: toggleResetDialog, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(font_sizes_Menu.ItemLabel, { children: origin === "custom" ? (0,external_wp_i18n_namespaceObject.__)(
              "Remove font size presets"
            ) : (0,external_wp_i18n_namespaceObject.__)(
              "Reset font size presets"
            ) }) }) })
          ] })
        ] })
      ] }),
      !!sizes.length && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItemGroup, { isBordered: true, isSeparated: true, children: sizes.map((size) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
        NavigationButtonAsItem,
        {
          path: `/typography/font-sizes/${origin}/${size.slug}`,
          children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { children: [
            /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { className: "edit-site-font-size__item", children: size.name }),
            /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { display: "flex", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
              icon_default,
              {
                icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left_default : chevron_right_default
              }
            ) })
          ] })
        },
        size.slug
      )) })
    ] })
  ] });
}
function font_sizes_FontSizes() {
  const [themeFontSizes, setThemeFontSizes] = font_sizes_useGlobalSetting(
    "typography.fontSizes.theme"
  );
  const [baseThemeFontSizes] = font_sizes_useGlobalSetting(
    "typography.fontSizes.theme",
    null,
    "base"
  );
  const [defaultFontSizes, setDefaultFontSizes] = font_sizes_useGlobalSetting(
    "typography.fontSizes.default"
  );
  const [baseDefaultFontSizes] = font_sizes_useGlobalSetting(
    "typography.fontSizes.default",
    null,
    "base"
  );
  const [customFontSizes = [], setCustomFontSizes] = font_sizes_useGlobalSetting(
    "typography.fontSizes.custom"
  );
  const [defaultFontSizesEnabled] = font_sizes_useGlobalSetting(
    "typography.defaultFontSizes"
  );
  const handleAddFontSize = () => {
    const index = getNewIndexFromPresets(customFontSizes, "custom-");
    const newFontSize = {
      /* translators: %d: font size index */
      name: (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)("New Font Size %d"), index),
      size: "16px",
      slug: `custom-${index}`
    };
    setCustomFontSizes([...customFontSizes, newFontSize]);
  };
  const hasSameSizeValues = (arr1, arr2) => arr1.map((item) => item.size).join("") === arr2.map((item) => item.size).join("");
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 2, children: [
    /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
      header_default,
      {
        title: (0,external_wp_i18n_namespaceObject.__)("Font size presets"),
        description: (0,external_wp_i18n_namespaceObject.__)(
          "Create and edit the presets used for font sizes across the site."
        )
      }
    ),
    /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalView, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { paddingX: 4, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 8, children: [
      !!themeFontSizes?.length && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
        FontSizeGroup,
        {
          label: (0,external_wp_i18n_namespaceObject.__)("Theme"),
          origin: "theme",
          sizes: themeFontSizes,
          baseSizes: baseThemeFontSizes,
          handleAddFontSize,
          handleResetFontSizes: hasSameSizeValues(
            themeFontSizes,
            baseThemeFontSizes
          ) ? null : () => setThemeFontSizes(
            baseThemeFontSizes
          )
        }
      ),
      defaultFontSizesEnabled && !!defaultFontSizes?.length && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
        FontSizeGroup,
        {
          label: (0,external_wp_i18n_namespaceObject.__)("Default"),
          origin: "default",
          sizes: defaultFontSizes,
          baseSizes: baseDefaultFontSizes,
          handleAddFontSize,
          handleResetFontSizes: hasSameSizeValues(
            defaultFontSizes,
            baseDefaultFontSizes
          ) ? null : () => setDefaultFontSizes(
            baseDefaultFontSizes
          )
        }
      ),
      /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
        FontSizeGroup,
        {
          label: (0,external_wp_i18n_namespaceObject.__)("Custom"),
          origin: "custom",
          sizes: customFontSizes,
          handleAddFontSize,
          handleResetFontSizes: customFontSizes.length > 0 ? () => setCustomFontSizes([]) : null
        }
      )
    ] }) }) })
  ] });
}
var font_sizes_default = font_sizes_FontSizes;


;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/color-indicator-wrapper.js



function ColorIndicatorWrapper({ className, ...props }) {
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    external_wp_components_namespaceObject.Flex,
    {
      className: dist_clsx(
        "edit-site-global-styles__color-indicator-wrapper",
        className
      ),
      ...props
    }
  );
}
var color_indicator_wrapper_default = ColorIndicatorWrapper;


;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/palette.js










const { useGlobalSetting: palette_useGlobalSetting } = unlock(external_wp_blockEditor_namespaceObject.privateApis);
const EMPTY_COLORS = [];
function Palette({ name }) {
  const [customColors] = palette_useGlobalSetting("color.palette.custom");
  const [themeColors] = palette_useGlobalSetting("color.palette.theme");
  const [defaultColors] = palette_useGlobalSetting("color.palette.default");
  const [defaultPaletteEnabled] = palette_useGlobalSetting(
    "color.defaultPalette",
    name
  );
  const colors = (0,external_wp_element_.useMemo)(
    () => [
      ...customColors || EMPTY_COLORS,
      ...themeColors || EMPTY_COLORS,
      ...defaultColors && defaultPaletteEnabled ? defaultColors : EMPTY_COLORS
    ],
    [customColors, themeColors, defaultColors, defaultPaletteEnabled]
  );
  const screenPath = !name ? "/colors/palette" : "/blocks/" + encodeURIComponent(name) + "/colors/palette";
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 3, children: [
    /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(subtitle_default, { level: 3, children: (0,external_wp_i18n_namespaceObject.__)("Palette") }),
    /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItemGroup, { isBordered: true, isSeparated: true, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigationButtonAsItem, { path: screenPath, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { direction: "row", children: [
      colors.length > 0 ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
        /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalZStack, { isLayered: false, offset: -8, children: colors.slice(0, 5).map(({ color }, index) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
          color_indicator_wrapper_default,
          {
            children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
              external_wp_components_namespaceObject.ColorIndicator,
              {
                colorValue: color
              }
            )
          },
          `${color}-${index}`
        )) }),
        /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { isBlock: true, children: (0,external_wp_i18n_namespaceObject.__)("Edit palette") })
      ] }) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: (0,external_wp_i18n_namespaceObject.__)("Add colors") }),
      /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(icon_default, { icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left_default : chevron_right_default })
    ] }) }) })
  ] });
}
var palette_default = Palette;


;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-colors.js







const {
  useGlobalStyle: screen_colors_useGlobalStyle,
  useGlobalSetting: screen_colors_useGlobalSetting,
  useSettingsForBlockElement: screen_colors_useSettingsForBlockElement,
  ColorPanel: screen_colors_StylesColorPanel
} = unlock(external_wp_blockEditor_namespaceObject.privateApis);
function ScreenColors() {
  const [style] = screen_colors_useGlobalStyle("", void 0, "user", {
    shouldDecodeEncode: false
  });
  const [inheritedStyle, setStyle] = screen_colors_useGlobalStyle("", void 0, "all", {
    shouldDecodeEncode: false
  });
  const [rawSettings] = screen_colors_useGlobalSetting("");
  const settings = screen_colors_useSettingsForBlockElement(rawSettings);
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
    /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
      header_default,
      {
        title: (0,external_wp_i18n_namespaceObject.__)("Colors"),
        description: (0,external_wp_i18n_namespaceObject.__)(
          "Palette colors and the application of those colors on site elements."
        )
      }
    ),
    /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "edit-site-global-styles-screen", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 7, children: [
      /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(palette_default, {}),
      /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
        screen_colors_StylesColorPanel,
        {
          inheritedValue: inheritedStyle,
          value: style,
          onChange: setStyle,
          settings
        }
      )
    ] }) })
  ] });
}
var screen_colors_default = ScreenColors;


;// ./node_modules/@wordpress/icons/build-module/library/shuffle.js


var shuffle_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/SVG", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M17.192 6.75L15.47 5.03l1.06-1.06 3.537 3.53-3.537 3.53-1.06-1.06 1.723-1.72h-3.19c-.602 0-.993.202-1.28.498-.309.319-.538.792-.695 1.383-.13.488-.222 1.023-.296 1.508-.034.664-.116 1.413-.303 2.117-.193.721-.513 1.467-1.068 2.04-.575.594-1.359.954-2.357.954H4v-1.5h4.003c.601 0 .993-.202 1.28-.498.308-.319.538-.792.695-1.383.149-.557.216-1.093.288-1.662l.039-.31a9.653 9.653 0 0 1 .272-1.653c.193-.722.513-1.467 1.067-2.04.576-.594 1.36-.954 2.358-.954h3.19zM8.004 6.75c.8 0 1.46.23 1.988.628a6.24 6.24 0 0 0-.684 1.396 1.725 1.725 0 0 0-.024-.026c-.287-.296-.679-.498-1.28-.498H4v-1.5h4.003zM12.699 14.726c-.161.459-.38.94-.684 1.396.527.397 1.188.628 1.988.628h3.19l-1.722 1.72 1.06 1.06L20.067 16l-3.537-3.53-1.06 1.06 1.723 1.72h-3.19c-.602 0-.993-.202-1.28-.498a1.96 1.96 0 0 1-.024-.026z" }) });


;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/preset-colors.js


function PresetColors() {
  const { paletteColors } = useStylesPreviewColors();
  return paletteColors.slice(0, 4).map(({ slug, color }, index) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    "div",
    {
      style: {
        flexGrow: 1,
        height: "100%",
        background: color
      }
    },
    `${slug}-${index}`
  ));
}


;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/preview-colors.js




const preview_colors_firstFrameVariants = {
  start: {
    scale: 1,
    opacity: 1
  },
  hover: {
    scale: 0,
    opacity: 0
  }
};
const StylesPreviewColors = ({ label, isFocused, withHoverView }) => {
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    PreviewWrapper,
    {
      label,
      isFocused,
      withHoverView,
      children: ({ key }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
        external_wp_components_namespaceObject.__unstableMotion.div,
        {
          variants: preview_colors_firstFrameVariants,
          style: {
            height: "100%",
            overflow: "hidden"
          },
          children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
            external_wp_components_namespaceObject.__experimentalHStack,
            {
              spacing: 0,
              justify: "center",
              style: {
                height: "100%",
                overflow: "hidden"
              },
              children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PresetColors, {})
            }
          )
        },
        key
      )
    }
  );
};
var preview_colors_default = StylesPreviewColors;


;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/variations/variations-color.js






function ColorVariations({ title, gap = 2 }) {
  const propertiesToFilter = ["color"];
  const colorVariations = useCurrentMergeThemeStyleVariationsWithUserConfig(propertiesToFilter);
  if (colorVariations?.length <= 1) {
    return null;
  }
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 3, children: [
    title && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(subtitle_default, { level: 3, children: title }),
    /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalGrid, { spacing: gap, children: colorVariations.map((variation, index) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
      Variation,
      {
        variation,
        isPill: true,
        properties: propertiesToFilter,
        showTooltip: true,
        children: () => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(preview_colors_default, {})
      },
      index
    )) })
  ] });
}


;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/color-palette-panel.js









const { useGlobalSetting: color_palette_panel_useGlobalSetting } = unlock(external_wp_blockEditor_namespaceObject.privateApis);
const mobilePopoverProps = { placement: "bottom-start", offset: 8 };
function ColorPalettePanel({ name }) {
  const [themeColors, setThemeColors] = color_palette_panel_useGlobalSetting(
    "color.palette.theme",
    name
  );
  const [baseThemeColors] = color_palette_panel_useGlobalSetting(
    "color.palette.theme",
    name,
    "base"
  );
  const [defaultColors, setDefaultColors] = color_palette_panel_useGlobalSetting(
    "color.palette.default",
    name
  );
  const [baseDefaultColors] = color_palette_panel_useGlobalSetting(
    "color.palette.default",
    name,
    "base"
  );
  const [customColors, setCustomColors] = color_palette_panel_useGlobalSetting(
    "color.palette.custom",
    name
  );
  const [defaultPaletteEnabled] = color_palette_panel_useGlobalSetting(
    "color.defaultPalette",
    name
  );
  const isMobileViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)("small", "<");
  const popoverProps = isMobileViewport ? mobilePopoverProps : void 0;
  const [randomizeThemeColors] = useColorRandomizer();
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
    external_wp_components_namespaceObject.__experimentalVStack,
    {
      className: "edit-site-global-styles-color-palette-panel",
      spacing: 8,
      children: [
        /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 4, children: [
          !!themeColors && !!themeColors.length && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
            external_wp_components_namespaceObject.__experimentalPaletteEdit,
            {
              canReset: themeColors !== baseThemeColors,
              canOnlyChangeValues: true,
              colors: themeColors,
              onChange: setThemeColors,
              paletteLabel: (0,external_wp_i18n_namespaceObject.__)("Theme"),
              paletteLabelHeadingLevel: 3,
              popoverProps
            }
          ),
          window.__experimentalEnableColorRandomizer && themeColors?.length > 0 && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
            external_wp_components_namespaceObject.Button,
            {
              __next40pxDefaultSize: true,
              variant: "secondary",
              icon: shuffle_default,
              onClick: randomizeThemeColors,
              children: (0,external_wp_i18n_namespaceObject.__)("Randomize colors")
            }
          )
        ] }),
        !!defaultColors && !!defaultColors.length && !!defaultPaletteEnabled && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
          external_wp_components_namespaceObject.__experimentalPaletteEdit,
          {
            canReset: defaultColors !== baseDefaultColors,
            canOnlyChangeValues: true,
            colors: defaultColors,
            onChange: setDefaultColors,
            paletteLabel: (0,external_wp_i18n_namespaceObject.__)("Default"),
            paletteLabelHeadingLevel: 3,
            popoverProps
          }
        ),
        /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
          external_wp_components_namespaceObject.__experimentalPaletteEdit,
          {
            colors: customColors,
            onChange: setCustomColors,
            paletteLabel: (0,external_wp_i18n_namespaceObject.__)("Custom"),
            paletteLabelHeadingLevel: 3,
            slugPrefix: "custom-",
            popoverProps
          }
        ),
        /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ColorVariations, { title: (0,external_wp_i18n_namespaceObject.__)("Palettes") })
      ]
    }
  );
}


;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/gradients-palette-panel.js







const { useGlobalSetting: gradients_palette_panel_useGlobalSetting } = unlock(external_wp_blockEditor_namespaceObject.privateApis);
const gradients_palette_panel_mobilePopoverProps = { placement: "bottom-start", offset: 8 };
const noop = () => {
};
function GradientPalettePanel({ name }) {
  const [themeGradients, setThemeGradients] = gradients_palette_panel_useGlobalSetting(
    "color.gradients.theme",
    name
  );
  const [baseThemeGradients] = gradients_palette_panel_useGlobalSetting(
    "color.gradients.theme",
    name,
    "base"
  );
  const [defaultGradients, setDefaultGradients] = gradients_palette_panel_useGlobalSetting(
    "color.gradients.default",
    name
  );
  const [baseDefaultGradients] = gradients_palette_panel_useGlobalSetting(
    "color.gradients.default",
    name,
    "base"
  );
  const [customGradients, setCustomGradients] = gradients_palette_panel_useGlobalSetting(
    "color.gradients.custom",
    name
  );
  const [defaultPaletteEnabled] = gradients_palette_panel_useGlobalSetting(
    "color.defaultGradients",
    name
  );
  const [customDuotone] = gradients_palette_panel_useGlobalSetting("color.duotone.custom") || [];
  const [defaultDuotone] = gradients_palette_panel_useGlobalSetting("color.duotone.default") || [];
  const [themeDuotone] = gradients_palette_panel_useGlobalSetting("color.duotone.theme") || [];
  const [defaultDuotoneEnabled] = gradients_palette_panel_useGlobalSetting(
    "color.defaultDuotone"
  );
  const duotonePalette = [
    ...customDuotone || [],
    ...themeDuotone || [],
    ...defaultDuotone && defaultDuotoneEnabled ? defaultDuotone : []
  ];
  const isMobileViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)("small", "<");
  const popoverProps = isMobileViewport ? gradients_palette_panel_mobilePopoverProps : void 0;
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
    external_wp_components_namespaceObject.__experimentalVStack,
    {
      className: "edit-site-global-styles-gradient-palette-panel",
      spacing: 8,
      children: [
        !!themeGradients && !!themeGradients.length && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
          external_wp_components_namespaceObject.__experimentalPaletteEdit,
          {
            canReset: themeGradients !== baseThemeGradients,
            canOnlyChangeValues: true,
            gradients: themeGradients,
            onChange: setThemeGradients,
            paletteLabel: (0,external_wp_i18n_namespaceObject.__)("Theme"),
            paletteLabelHeadingLevel: 3,
            popoverProps
          }
        ),
        !!defaultGradients && !!defaultGradients.length && !!defaultPaletteEnabled && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
          external_wp_components_namespaceObject.__experimentalPaletteEdit,
          {
            canReset: defaultGradients !== baseDefaultGradients,
            canOnlyChangeValues: true,
            gradients: defaultGradients,
            onChange: setDefaultGradients,
            paletteLabel: (0,external_wp_i18n_namespaceObject.__)("Default"),
            paletteLabelLevel: 3,
            popoverProps
          }
        ),
        /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
          external_wp_components_namespaceObject.__experimentalPaletteEdit,
          {
            gradients: customGradients,
            onChange: setCustomGradients,
            paletteLabel: (0,external_wp_i18n_namespaceObject.__)("Custom"),
            paletteLabelLevel: 3,
            slugPrefix: "custom-",
            popoverProps
          }
        ),
        !!duotonePalette && !!duotonePalette.length && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { children: [
          /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(subtitle_default, { level: 3, children: (0,external_wp_i18n_namespaceObject.__)("Duotone") }),
          /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { margin: 3 }),
          /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
            external_wp_components_namespaceObject.DuotonePicker,
            {
              duotonePalette,
              disableCustomDuotone: true,
              disableCustomColors: true,
              clearable: false,
              onChange: noop
            }
          )
        ] })
      ]
    }
  );
}


;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-color-palette.js







const { Tabs: screen_color_palette_Tabs } = unlock(external_wp_components_namespaceObject.privateApis);
function ScreenColorPalette({ name }) {
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
    /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
      header_default,
      {
        title: (0,external_wp_i18n_namespaceObject.__)("Edit palette"),
        description: (0,external_wp_i18n_namespaceObject.__)(
          "The combination of colors used across the site and in color pickers."
        )
      }
    ),
    /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(screen_color_palette_Tabs, { children: [
      /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(screen_color_palette_Tabs.TabList, { children: [
        /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_color_palette_Tabs.Tab, { tabId: "color", children: (0,external_wp_i18n_namespaceObject.__)("Color") }),
        /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_color_palette_Tabs.Tab, { tabId: "gradient", children: (0,external_wp_i18n_namespaceObject.__)("Gradient") })
      ] }),
      /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_color_palette_Tabs.TabPanel, { tabId: "color", focusable: false, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ColorPalettePanel, { name }) }),
      /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_color_palette_Tabs.TabPanel, { tabId: "gradient", focusable: false, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(GradientPalettePanel, { name }) })
    ] })
  ] });
}
var screen_color_palette_default = ScreenColorPalette;


;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/background-panel.js



const BACKGROUND_DEFAULT_VALUES = {
  backgroundSize: "auto"
};
const {
  useGlobalStyle: background_panel_useGlobalStyle,
  useGlobalSetting: background_panel_useGlobalSetting,
  BackgroundPanel: background_panel_StylesBackgroundPanel
} = unlock(external_wp_blockEditor_namespaceObject.privateApis);
function hasBackgroundImageValue(style) {
  return !!style?.background?.backgroundImage?.id || !!style?.background?.backgroundImage?.url || typeof style?.background?.backgroundImage === "string";
}
function BackgroundPanel() {
  const [style] = background_panel_useGlobalStyle("", void 0, "user", {
    shouldDecodeEncode: false
  });
  const [inheritedStyle, setStyle] = background_panel_useGlobalStyle("", void 0, "all", {
    shouldDecodeEncode: false
  });
  const [settings] = background_panel_useGlobalSetting("");
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    background_panel_StylesBackgroundPanel,
    {
      inheritedValue: inheritedStyle,
      value: style,
      onChange: setStyle,
      settings,
      defaultValues: BACKGROUND_DEFAULT_VALUES
    }
  );
}


;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-background.js







const { useHasBackgroundPanel: screen_background_useHasBackgroundPanel, useGlobalSetting: screen_background_useGlobalSetting } = unlock(
  external_wp_blockEditor_namespaceObject.privateApis
);
function ScreenBackground() {
  const [settings] = screen_background_useGlobalSetting("");
  const hasBackgroundPanel = screen_background_useHasBackgroundPanel(settings);
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
    /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
      header_default,
      {
        title: (0,external_wp_i18n_namespaceObject.__)("Background"),
        description: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { children: (0,external_wp_i18n_namespaceObject.__)("Set styles for the site\u2019s background.") })
      }
    ),
    hasBackgroundPanel && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(BackgroundPanel, {})
  ] });
}
var screen_background_default = ScreenBackground;


;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/confirm-reset-shadow-dialog.js



function ConfirmResetShadowDialog({
  text,
  confirmButtonText,
  isOpen,
  toggleOpen,
  onConfirm
}) {
  const handleConfirm = async () => {
    toggleOpen();
    onConfirm();
  };
  const handleCancel = () => {
    toggleOpen();
  };
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    external_wp_components_namespaceObject.__experimentalConfirmDialog,
    {
      isOpen,
      cancelButtonText: (0,external_wp_i18n_namespaceObject.__)("Cancel"),
      confirmButtonText,
      onCancel: handleCancel,
      onConfirm: handleConfirm,
      size: "medium",
      children: text
    }
  );
}
var confirm_reset_shadow_dialog_default = ConfirmResetShadowDialog;


;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/shadows-panel.js












const { useGlobalSetting: shadows_panel_useGlobalSetting } = unlock(external_wp_blockEditor_namespaceObject.privateApis);
const { Menu: shadows_panel_Menu } = unlock(external_wp_components_namespaceObject.privateApis);
const defaultShadow = "6px 6px 9px rgba(0, 0, 0, 0.2)";
function ShadowsPanel() {
  const [defaultShadows] = shadows_panel_useGlobalSetting("shadow.presets.default");
  const [defaultShadowsEnabled] = shadows_panel_useGlobalSetting(
    "shadow.defaultPresets"
  );
  const [themeShadows] = shadows_panel_useGlobalSetting("shadow.presets.theme");
  const [customShadows, setCustomShadows] = shadows_panel_useGlobalSetting(
    "shadow.presets.custom"
  );
  const onCreateShadow = (shadow) => {
    setCustomShadows([...customShadows || [], shadow]);
  };
  const handleResetShadows = () => {
    setCustomShadows([]);
  };
  const [isResetDialogOpen, setIsResetDialogOpen] = (0,external_wp_element_.useState)(false);
  const toggleResetDialog = () => setIsResetDialogOpen(!isResetDialogOpen);
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
    isResetDialogOpen && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
      confirm_reset_shadow_dialog_default,
      {
        text: (0,external_wp_i18n_namespaceObject.__)(
          "Are you sure you want to remove all custom shadows?"
        ),
        confirmButtonText: (0,external_wp_i18n_namespaceObject.__)("Remove"),
        isOpen: isResetDialogOpen,
        toggleOpen: toggleResetDialog,
        onConfirm: handleResetShadows
      }
    ),
    /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
      header_default,
      {
        title: (0,external_wp_i18n_namespaceObject.__)("Shadows"),
        description: (0,external_wp_i18n_namespaceObject.__)(
          "Manage and create shadow styles for use across the site."
        )
      }
    ),
    /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "edit-site-global-styles-screen", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
      external_wp_components_namespaceObject.__experimentalVStack,
      {
        className: "edit-site-global-styles__shadows-panel",
        spacing: 7,
        children: [
          defaultShadowsEnabled && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
            ShadowList,
            {
              label: (0,external_wp_i18n_namespaceObject.__)("Default"),
              shadows: defaultShadows || [],
              category: "default"
            }
          ),
          themeShadows && themeShadows.length > 0 && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
            ShadowList,
            {
              label: (0,external_wp_i18n_namespaceObject.__)("Theme"),
              shadows: themeShadows || [],
              category: "theme"
            }
          ),
          /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
            ShadowList,
            {
              label: (0,external_wp_i18n_namespaceObject.__)("Custom"),
              shadows: customShadows || [],
              category: "custom",
              canCreate: true,
              onCreate: onCreateShadow,
              onReset: toggleResetDialog
            }
          )
        ]
      }
    ) })
  ] });
}
function ShadowList({
  label,
  shadows,
  category,
  canCreate,
  onCreate,
  onReset
}) {
  const handleAddShadow = () => {
    const newIndex = getNewIndexFromPresets(shadows, "shadow-");
    onCreate({
      name: (0,external_wp_i18n_namespaceObject.sprintf)(
        /* translators: %s: is an index for a preset */
        (0,external_wp_i18n_namespaceObject.__)("Shadow %s"),
        newIndex
      ),
      shadow: defaultShadow,
      slug: `shadow-${newIndex}`
    });
  };
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 2, children: [
    /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "space-between", children: [
      /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(subtitle_default, { level: 3, children: label }),
      /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.FlexItem, { className: "edit-site-global-styles__shadows-panel__options-container", children: [
        canCreate && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
          external_wp_components_namespaceObject.Button,
          {
            size: "small",
            icon: plus_default,
            label: (0,external_wp_i18n_namespaceObject.__)("Add shadow"),
            onClick: () => {
              handleAddShadow();
            }
          }
        ),
        !!shadows?.length && category === "custom" && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(shadows_panel_Menu, { children: [
          /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
            shadows_panel_Menu.TriggerButton,
            {
              render: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
                external_wp_components_namespaceObject.Button,
                {
                  size: "small",
                  icon: more_vertical_default,
                  label: (0,external_wp_i18n_namespaceObject.__)("Shadow options")
                }
              )
            }
          ),
          /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(shadows_panel_Menu.Popover, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(shadows_panel_Menu.Item, { onClick: onReset, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(shadows_panel_Menu.ItemLabel, { children: (0,external_wp_i18n_namespaceObject.__)("Remove all custom shadows") }) }) })
        ] })
      ] })
    ] }),
    shadows.length > 0 && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItemGroup, { isBordered: true, isSeparated: true, children: shadows.map((shadow) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
      ShadowItem,
      {
        shadow,
        category
      },
      shadow.slug
    )) })
  ] });
}
function ShadowItem({ shadow, category }) {
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    NavigationButtonAsItem,
    {
      path: `/shadows/edit/${category}/${shadow.slug}`,
      children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { children: [
        /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: shadow.name }),
        /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(icon_default, { icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left_default : chevron_right_default })
      ] })
    }
  );
}


;// ./node_modules/@wordpress/icons/build-module/library/reset.js


var reset_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M7 11.5h10V13H7z" }) });


;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/shadow-utils.js
const CUSTOM_VALUE_SETTINGS = {
  px: { max: 20, step: 1 },
  "%": { max: 100, step: 1 },
  vw: { max: 100, step: 1 },
  vh: { max: 100, step: 1 },
  em: { max: 10, step: 0.1 },
  rm: { max: 10, step: 0.1 },
  svw: { max: 100, step: 1 },
  lvw: { max: 100, step: 1 },
  dvw: { max: 100, step: 1 },
  svh: { max: 100, step: 1 },
  lvh: { max: 100, step: 1 },
  dvh: { max: 100, step: 1 },
  vi: { max: 100, step: 1 },
  svi: { max: 100, step: 1 },
  lvi: { max: 100, step: 1 },
  dvi: { max: 100, step: 1 },
  vb: { max: 100, step: 1 },
  svb: { max: 100, step: 1 },
  lvb: { max: 100, step: 1 },
  dvb: { max: 100, step: 1 },
  vmin: { max: 100, step: 1 },
  svmin: { max: 100, step: 1 },
  lvmin: { max: 100, step: 1 },
  dvmin: { max: 100, step: 1 },
  vmax: { max: 100, step: 1 },
  svmax: { max: 100, step: 1 },
  lvmax: { max: 100, step: 1 },
  dvmax: { max: 100, step: 1 }
};
function getShadowParts(shadow) {
  const shadowValues = shadow.match(/(?:[^,(]|\([^)]*\))+/g) || [];
  return shadowValues.map((value) => value.trim());
}
function shadowStringToObject(shadowValue) {
  const defaultShadow = {
    x: "0",
    y: "0",
    blur: "0",
    spread: "0",
    color: "#000",
    inset: false
  };
  if (!shadowValue) {
    return defaultShadow;
  }
  if (shadowValue.includes("none")) {
    return defaultShadow;
  }
  const lengthsRegex = /((?:^|\s+)(-?\d*\.?\d+(?:px|%|in|cm|mm|em|rem|ex|pt|pc|vh|vw|vmin|vmax|ch|lh)?)(?=\s|$)(?![^(]*\))){1,4}/g;
  const matches = shadowValue.match(lengthsRegex) || [];
  if (matches.length !== 1) {
    return defaultShadow;
  }
  const lengths = matches[0].split(" ").map((value) => value.trim()).filter((value) => value);
  if (lengths.length < 2) {
    return defaultShadow;
  }
  const insets = shadowValue.match(/inset/gi) || [];
  if (insets.length > 1) {
    return defaultShadow;
  }
  const hasInset = insets.length === 1;
  let colorString = shadowValue.replace(lengthsRegex, "").trim();
  if (hasInset) {
    colorString = colorString.replace("inset", "").replace("INSET", "").trim();
  }
  const colorRegex = /^#([0-9a-f]{3}){1,2}$|^#([0-9a-f]{4}){1,2}$|^(?:rgb|hsl)a?\(?[\d*\.?\d+%?,?\/?\s]*\)$/gi;
  let colorMatches = (colorString.match(colorRegex) || []).map((value) => value?.trim()).filter((value) => value);
  if (colorMatches.length > 1) {
    return defaultShadow;
  } else if (colorMatches.length === 0) {
    colorMatches = colorString.trim().split(" ").filter((value) => value);
    if (colorMatches.length > 1) {
      return defaultShadow;
    }
  }
  const [x, y, blur, spread] = lengths;
  return {
    x,
    y,
    blur: blur || defaultShadow.blur,
    spread: spread || defaultShadow.spread,
    inset: hasInset,
    color: colorString || defaultShadow.color
  };
}
function shadowObjectToString(shadowObj) {
  const shadowString = `${shadowObj.x || "0px"} ${shadowObj.y || "0px"} ${shadowObj.blur || "0px"} ${shadowObj.spread || "0px"}`;
  return `${shadowObj.inset ? "inset" : ""} ${shadowString} ${shadowObj.color || ""}`.trim();
}


;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/shadows-edit-panel.js












const { useGlobalSetting: shadows_edit_panel_useGlobalSetting } = unlock(external_wp_blockEditor_namespaceObject.privateApis);
const { Menu: shadows_edit_panel_Menu } = unlock(external_wp_components_namespaceObject.privateApis);
const customShadowMenuItems = [
  {
    label: (0,external_wp_i18n_namespaceObject.__)("Rename"),
    action: "rename"
  },
  {
    label: (0,external_wp_i18n_namespaceObject.__)("Delete"),
    action: "delete"
  }
];
const presetShadowMenuItems = [
  {
    label: (0,external_wp_i18n_namespaceObject.__)("Reset"),
    action: "reset"
  }
];
function ShadowsEditPanel() {
  const {
    goBack,
    params: { category, slug }
  } = (0,external_wp_components_namespaceObject.useNavigator)();
  const [shadows, setShadows] = shadows_edit_panel_useGlobalSetting(
    `shadow.presets.${category}`
  );
  (0,external_wp_element_.useEffect)(() => {
    const hasCurrentShadow = shadows?.some(
      (shadow) => shadow.slug === slug
    );
    if (!!slug && !hasCurrentShadow) {
      goBack();
    }
  }, [shadows, slug, goBack]);
  const [baseShadows] = shadows_edit_panel_useGlobalSetting(
    `shadow.presets.${category}`,
    void 0,
    "base"
  );
  const [selectedShadow, setSelectedShadow] = (0,external_wp_element_.useState)(
    () => (shadows || []).find((shadow) => shadow.slug === slug)
  );
  const baseSelectedShadow = (0,external_wp_element_.useMemo)(
    () => (baseShadows || []).find((b) => b.slug === slug),
    [baseShadows, slug]
  );
  const [isConfirmDialogVisible, setIsConfirmDialogVisible] = (0,external_wp_element_.useState)(false);
  const [isRenameModalVisible, setIsRenameModalVisible] = (0,external_wp_element_.useState)(false);
  const [shadowName, setShadowName] = (0,external_wp_element_.useState)(selectedShadow.name);
  if (!category || !slug) {
    return null;
  }
  const onShadowChange = (shadow) => {
    setSelectedShadow({ ...selectedShadow, shadow });
    const updatedShadows = shadows.map(
      (s) => s.slug === slug ? { ...selectedShadow, shadow } : s
    );
    setShadows(updatedShadows);
  };
  const onMenuClick = (action) => {
    if (action === "reset") {
      const updatedShadows = shadows.map(
        (s) => s.slug === slug ? baseSelectedShadow : s
      );
      setSelectedShadow(baseSelectedShadow);
      setShadows(updatedShadows);
    } else if (action === "delete") {
      setIsConfirmDialogVisible(true);
    } else if (action === "rename") {
      setIsRenameModalVisible(true);
    }
  };
  const handleShadowDelete = () => {
    setShadows(shadows.filter((s) => s.slug !== slug));
  };
  const handleShadowRename = (newName) => {
    if (!newName) {
      return;
    }
    const updatedShadows = shadows.map(
      (s) => s.slug === slug ? { ...selectedShadow, name: newName } : s
    );
    setSelectedShadow({ ...selectedShadow, name: newName });
    setShadows(updatedShadows);
  };
  return !selectedShadow ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(header_default, { title: "" }) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
    /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "space-between", children: [
      /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(header_default, { title: selectedShadow.name }),
      /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { marginTop: 2, marginBottom: 0, paddingX: 4, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(shadows_edit_panel_Menu, { children: [
        /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
          shadows_edit_panel_Menu.TriggerButton,
          {
            render: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
              external_wp_components_namespaceObject.Button,
              {
                size: "small",
                icon: more_vertical_default,
                label: (0,external_wp_i18n_namespaceObject.__)("Menu")
              }
            )
          }
        ),
        /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(shadows_edit_panel_Menu.Popover, { children: (category === "custom" ? customShadowMenuItems : presetShadowMenuItems).map((item) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
          shadows_edit_panel_Menu.Item,
          {
            onClick: () => onMenuClick(item.action),
            disabled: item.action === "reset" && selectedShadow.shadow === baseSelectedShadow.shadow,
            children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(shadows_edit_panel_Menu.ItemLabel, { children: item.label })
          },
          item.action
        )) })
      ] }) }) })
    ] }),
    /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "edit-site-global-styles-screen", children: [
      /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ShadowsPreview, { shadow: selectedShadow.shadow }),
      /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
        ShadowEditor,
        {
          shadow: selectedShadow.shadow,
          onChange: onShadowChange
        }
      )
    ] }),
    isConfirmDialogVisible && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
      external_wp_components_namespaceObject.__experimentalConfirmDialog,
      {
        isOpen: true,
        onConfirm: () => {
          handleShadowDelete();
          setIsConfirmDialogVisible(false);
        },
        onCancel: () => {
          setIsConfirmDialogVisible(false);
        },
        confirmButtonText: (0,external_wp_i18n_namespaceObject.__)("Delete"),
        size: "medium",
        children: (0,external_wp_i18n_namespaceObject.sprintf)(
          /* translators: %s: Name of the shadow preset. */
          (0,external_wp_i18n_namespaceObject.__)(
            'Are you sure you want to delete "%s" shadow preset?'
          ),
          selectedShadow.name
        )
      }
    ),
    isRenameModalVisible && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
      external_wp_components_namespaceObject.Modal,
      {
        title: (0,external_wp_i18n_namespaceObject.__)("Rename"),
        onRequestClose: () => setIsRenameModalVisible(false),
        size: "small",
        children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
          "form",
          {
            onSubmit: (event) => {
              event.preventDefault();
              handleShadowRename(shadowName);
              setIsRenameModalVisible(false);
            },
            children: [
              /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
                external_wp_components_namespaceObject.__experimentalInputControl,
                {
                  __next40pxDefaultSize: true,
                  autoComplete: "off",
                  label: (0,external_wp_i18n_namespaceObject.__)("Name"),
                  placeholder: (0,external_wp_i18n_namespaceObject.__)("Shadow name"),
                  value: shadowName,
                  onChange: (value) => setShadowName(value)
                }
              ),
              /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { marginBottom: 6 }),
              /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
                external_wp_components_namespaceObject.Flex,
                {
                  className: "block-editor-shadow-edit-modal__actions",
                  justify: "flex-end",
                  expanded: false,
                  children: [
                    /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
                      external_wp_components_namespaceObject.Button,
                      {
                        __next40pxDefaultSize: true,
                        variant: "tertiary",
                        onClick: () => setIsRenameModalVisible(false),
                        children: (0,external_wp_i18n_namespaceObject.__)("Cancel")
                      }
                    ) }),
                    /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
                      external_wp_components_namespaceObject.Button,
                      {
                        __next40pxDefaultSize: true,
                        variant: "primary",
                        type: "submit",
                        children: (0,external_wp_i18n_namespaceObject.__)("Save")
                      }
                    ) })
                  ]
                }
              )
            ]
          }
        )
      }
    )
  ] });
}
function ShadowsPreview({ shadow }) {
  const shadowStyle = {
    boxShadow: shadow
  };
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { marginBottom: 4, marginTop: -2, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    external_wp_components_namespaceObject.__experimentalHStack,
    {
      align: "center",
      justify: "center",
      className: "edit-site-global-styles__shadow-preview-panel",
      children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
        "div",
        {
          className: "edit-site-global-styles__shadow-preview-block",
          style: shadowStyle
        }
      )
    }
  ) });
}
function ShadowEditor({ shadow, onChange }) {
  const addShadowButtonRef = (0,external_wp_element_.useRef)();
  const shadowParts = (0,external_wp_element_.useMemo)(() => getShadowParts(shadow), [shadow]);
  const onChangeShadowPart = (index, part) => {
    const newShadowParts = [...shadowParts];
    newShadowParts[index] = part;
    onChange(newShadowParts.join(", "));
  };
  const onAddShadowPart = () => {
    onChange([...shadowParts, defaultShadow].join(", "));
  };
  const onRemoveShadowPart = (index) => {
    onChange(shadowParts.filter((p, i) => i !== index).join(", "));
    addShadowButtonRef.current.focus();
  };
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
    /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 2, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "space-between", children: [
      /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(subtitle_default, { level: 3, children: (0,external_wp_i18n_namespaceObject.__)("Shadows") }),
      /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { className: "edit-site-global-styles__shadows-panel__options-container", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
        external_wp_components_namespaceObject.Button,
        {
          size: "small",
          icon: plus_default,
          label: (0,external_wp_i18n_namespaceObject.__)("Add shadow"),
          onClick: () => {
            onAddShadowPart();
          },
          ref: addShadowButtonRef
        }
      ) })
    ] }) }),
    /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, {}),
    /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItemGroup, { isBordered: true, isSeparated: true, children: shadowParts.map((part, index) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
      shadows_edit_panel_ShadowItem,
      {
        shadow: part,
        onChange: (value) => onChangeShadowPart(index, value),
        canRemove: shadowParts.length > 1,
        onRemove: () => onRemoveShadowPart(index)
      },
      index
    )) })
  ] });
}
function shadows_edit_panel_ShadowItem({ shadow, onChange, canRemove, onRemove }) {
  const popoverProps = {
    placement: "left-start",
    offset: 36,
    shift: true
  };
  const shadowObj = (0,external_wp_element_.useMemo)(
    () => shadowStringToObject(shadow),
    [shadow]
  );
  const onShadowChange = (newShadow) => {
    onChange(shadowObjectToString(newShadow));
  };
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    external_wp_components_namespaceObject.Dropdown,
    {
      popoverProps,
      className: "edit-site-global-styles__shadow-editor__dropdown",
      renderToggle: ({ onToggle, isOpen }) => {
        const toggleProps = {
          onClick: onToggle,
          className: dist_clsx(
            "edit-site-global-styles__shadow-editor__dropdown-toggle",
            { "is-open": isOpen }
          ),
          "aria-expanded": isOpen
        };
        const removeButtonProps = {
          onClick: () => {
            if (isOpen) {
              onToggle();
            }
            onRemove();
          },
          className: dist_clsx(
            "edit-site-global-styles__shadow-editor__remove-button",
            { "is-open": isOpen }
          ),
          label: (0,external_wp_i18n_namespaceObject.__)("Remove shadow")
        };
        return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
          /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
            external_wp_components_namespaceObject.Button,
            {
              __next40pxDefaultSize: true,
              icon: shadow_default,
              ...toggleProps,
              children: shadowObj.inset ? (0,external_wp_i18n_namespaceObject.__)("Inner shadow") : (0,external_wp_i18n_namespaceObject.__)("Drop shadow")
            }
          ),
          canRemove && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
            external_wp_components_namespaceObject.Button,
            {
              size: "small",
              icon: reset_default,
              ...removeButtonProps
            }
          )
        ] });
      },
      renderContent: () => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
        external_wp_components_namespaceObject.__experimentalDropdownContentWrapper,
        {
          paddingSize: "medium",
          className: "edit-site-global-styles__shadow-editor__dropdown-content",
          children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
            ShadowPopover,
            {
              shadowObj,
              onChange: onShadowChange
            }
          )
        }
      )
    }
  );
}
function ShadowPopover({ shadowObj, onChange }) {
  const __experimentalIsRenderedInSidebar = true;
  const enableAlpha = true;
  const onShadowChange = (key, value) => {
    const newShadow = {
      ...shadowObj,
      [key]: value
    };
    onChange(newShadow);
  };
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
    external_wp_components_namespaceObject.__experimentalVStack,
    {
      spacing: 4,
      className: "edit-site-global-styles__shadow-editor-panel",
      children: [
        /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
          external_wp_components_namespaceObject.ColorPalette,
          {
            clearable: false,
            enableAlpha,
            __experimentalIsRenderedInSidebar,
            value: shadowObj.color,
            onChange: (value) => onShadowChange("color", value)
          }
        ),
        /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
          external_wp_components_namespaceObject.__experimentalToggleGroupControl,
          {
            __nextHasNoMarginBottom: true,
            value: shadowObj.inset ? "inset" : "outset",
            isBlock: true,
            onChange: (value) => onShadowChange("inset", value === "inset"),
            hideLabelFromVision: true,
            __next40pxDefaultSize: true,
            children: [
              /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
                external_wp_components_namespaceObject.__experimentalToggleGroupControlOption,
                {
                  value: "outset",
                  label: (0,external_wp_i18n_namespaceObject.__)("Outset")
                }
              ),
              /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
                external_wp_components_namespaceObject.__experimentalToggleGroupControlOption,
                {
                  value: "inset",
                  label: (0,external_wp_i18n_namespaceObject.__)("Inset")
                }
              )
            ]
          }
        ),
        /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalGrid, { columns: 2, gap: 4, children: [
          /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
            ShadowInputControl,
            {
              label: (0,external_wp_i18n_namespaceObject.__)("X Position"),
              value: shadowObj.x,
              onChange: (value) => onShadowChange("x", value)
            }
          ),
          /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
            ShadowInputControl,
            {
              label: (0,external_wp_i18n_namespaceObject.__)("Y Position"),
              value: shadowObj.y,
              onChange: (value) => onShadowChange("y", value)
            }
          ),
          /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
            ShadowInputControl,
            {
              label: (0,external_wp_i18n_namespaceObject.__)("Blur"),
              value: shadowObj.blur,
              onChange: (value) => onShadowChange("blur", value)
            }
          ),
          /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
            ShadowInputControl,
            {
              label: (0,external_wp_i18n_namespaceObject.__)("Spread"),
              value: shadowObj.spread,
              onChange: (value) => onShadowChange("spread", value)
            }
          )
        ] })
      ]
    }
  );
}
function ShadowInputControl({ label, value, onChange }) {
  const onValueChange = (next) => {
    const isNumeric = next !== void 0 && !isNaN(parseFloat(next));
    const nextValue = isNumeric ? next : "0px";
    onChange(nextValue);
  };
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    external_wp_components_namespaceObject.__experimentalUnitControl,
    {
      label,
      __next40pxDefaultSize: true,
      value,
      onChange: onValueChange
    }
  );
}


;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-shadows.js



function ScreenShadows() {
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ShadowsPanel, {});
}
function ScreenShadowsEdit() {
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ShadowsEditPanel, {});
}


;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/dimensions-panel.js




const {
  useGlobalStyle: dimensions_panel_useGlobalStyle,
  useGlobalSetting: dimensions_panel_useGlobalSetting,
  useSettingsForBlockElement: dimensions_panel_useSettingsForBlockElement,
  DimensionsPanel: dimensions_panel_StylesDimensionsPanel
} = unlock(external_wp_blockEditor_namespaceObject.privateApis);
const DEFAULT_CONTROLS = {
  contentSize: true,
  wideSize: true,
  padding: true,
  margin: true,
  blockGap: true,
  minHeight: true,
  childLayout: false
};
function DimensionsPanel() {
  const [style] = dimensions_panel_useGlobalStyle("", void 0, "user", {
    shouldDecodeEncode: false
  });
  const [inheritedStyle, setStyle] = dimensions_panel_useGlobalStyle("", void 0, "all", {
    shouldDecodeEncode: false
  });
  const [userSettings] = dimensions_panel_useGlobalSetting("", void 0, "user");
  const [rawSettings, setSettings] = dimensions_panel_useGlobalSetting("");
  const settings = dimensions_panel_useSettingsForBlockElement(rawSettings);
  const inheritedStyleWithLayout = (0,external_wp_element_.useMemo)(() => {
    return {
      ...inheritedStyle,
      layout: settings.layout
    };
  }, [inheritedStyle, settings.layout]);
  const styleWithLayout = (0,external_wp_element_.useMemo)(() => {
    return {
      ...style,
      layout: userSettings.layout
    };
  }, [style, userSettings.layout]);
  const onChange = (newStyle) => {
    const updatedStyle = { ...newStyle };
    delete updatedStyle.layout;
    setStyle(updatedStyle);
    if (newStyle.layout !== userSettings.layout) {
      const updatedSettings = {
        ...userSettings,
        layout: newStyle.layout
      };
      if (updatedSettings.layout?.definitions) {
        delete updatedSettings.layout.definitions;
      }
      setSettings(updatedSettings);
    }
  };
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    dimensions_panel_StylesDimensionsPanel,
    {
      inheritedValue: inheritedStyleWithLayout,
      value: styleWithLayout,
      onChange,
      settings,
      includeLayoutControls: true,
      defaultControls: DEFAULT_CONTROLS
    }
  );
}


;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-layout.js






const { useHasDimensionsPanel: screen_layout_useHasDimensionsPanel, useGlobalSetting: screen_layout_useGlobalSetting, useSettingsForBlockElement: screen_layout_useSettingsForBlockElement } = unlock(external_wp_blockEditor_namespaceObject.privateApis);
function ScreenLayout() {
  const [rawSettings] = screen_layout_useGlobalSetting("");
  const settings = screen_layout_useSettingsForBlockElement(rawSettings);
  const hasDimensionsPanel = screen_layout_useHasDimensionsPanel(settings);
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
    /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(header_default, { title: (0,external_wp_i18n_namespaceObject.__)("Layout") }),
    hasDimensionsPanel && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(DimensionsPanel, {})
  ] });
}
var screen_layout_default = ScreenLayout;


;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/style-variations-container.js











const { GlobalStylesContext: style_variations_container_GlobalStylesContext } = unlock(external_wp_blockEditor_namespaceObject.privateApis);
function StyleVariationsContainer({ gap = 2 }) {
  const { user } = (0,external_wp_element_.useContext)(style_variations_container_GlobalStylesContext);
  const userStyles = user?.styles;
  const variations = (0,external_wp_data_.useSelect)((select) => {
    return select(
      external_wp_coreData_namespaceObject.store
    ).__experimentalGetCurrentThemeGlobalStylesVariations();
  }, []);
  const fullStyleVariations = variations?.filter((variation) => {
    return !isVariationWithProperties(variation, ["color"]) && !isVariationWithProperties(variation, [
      "typography",
      "spacing"
    ]);
  });
  const themeVariations = (0,external_wp_element_.useMemo)(() => {
    const withEmptyVariation = [
      {
        title: (0,external_wp_i18n_namespaceObject.__)("Default"),
        settings: {},
        styles: {}
      },
      ...fullStyleVariations ?? []
    ];
    return [
      ...withEmptyVariation.map((variation) => {
        const blockStyles = { ...variation?.styles?.blocks };
        if (userStyles?.blocks) {
          Object.keys(userStyles.blocks).forEach((blockName) => {
            if (userStyles.blocks[blockName].css) {
              const variationBlockStyles = blockStyles[blockName] || {};
              const customCSS = {
                css: `${blockStyles[blockName]?.css || ""} ${userStyles.blocks[blockName].css.trim() || ""}`
              };
              blockStyles[blockName] = {
                ...variationBlockStyles,
                ...customCSS
              };
            }
          });
        }
        const css = userStyles?.css || variation.styles?.css ? {
          css: `${variation.styles?.css || ""} ${userStyles?.css || ""}`
        } : {};
        const blocks = Object.keys(blockStyles).length > 0 ? { blocks: blockStyles } : {};
        const styles = {
          ...variation.styles,
          ...css,
          ...blocks
        };
        return {
          ...variation,
          settings: variation.settings ?? {},
          styles
        };
      })
    ];
  }, [fullStyleVariations, userStyles?.blocks, userStyles?.css]);
  if (!fullStyleVariations || fullStyleVariations?.length < 1) {
    return null;
  }
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    external_wp_components_namespaceObject.__experimentalGrid,
    {
      columns: 2,
      className: "edit-site-global-styles-style-variations-container",
      gap,
      children: themeVariations.map((variation, index) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Variation, { variation, children: (isFocused) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
        preview_styles_default,
        {
          label: variation?.title,
          withHoverView: true,
          isFocused,
          variation
        }
      ) }, index))
    }
  );
}


;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-global-styles/content.js






function SidebarNavigationScreenGlobalStylesContent() {
  const gap = 3;
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
    external_wp_components_namespaceObject.__experimentalVStack,
    {
      spacing: 10,
      className: "edit-site-global-styles-variation-container",
      children: [
        /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(StyleVariationsContainer, { gap }),
        /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ColorVariations, { title: (0,external_wp_i18n_namespaceObject.__)("Palettes"), gap }),
        /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(TypographyVariations, { title: (0,external_wp_i18n_namespaceObject.__)("Typography"), gap })
      ]
    }
  );
}


;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-style-variations.js








const { useZoomOut } = unlock(external_wp_blockEditor_namespaceObject.privateApis);
function ScreenStyleVariations() {
  const isPreviewMode = (0,external_wp_data_.useSelect)((select) => {
    return select(external_wp_blockEditor_namespaceObject.store).getSettings().isPreviewMode;
  }, []);
  useZoomOut(!isPreviewMode);
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
    /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
      header_default,
      {
        title: (0,external_wp_i18n_namespaceObject.__)("Browse styles"),
        description: (0,external_wp_i18n_namespaceObject.__)(
          "Choose a variation to change the look of the site."
        )
      }
    ),
    /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
      external_wp_components_namespaceObject.Card,
      {
        size: "small",
        isBorderless: true,
        className: "edit-site-global-styles-screen-style-variations",
        children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.CardBody, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenGlobalStylesContent, {}) })
      }
    )
  ] });
}
var screen_style_variations_default = ScreenStyleVariations;


;// external ["wp","mediaUtils"]
const external_wp_mediaUtils_namespaceObject = window["wp"]["mediaUtils"];
;// ./node_modules/@wordpress/edit-site/build-module/components/style-book/constants.js

const STYLE_BOOK_COLOR_GROUPS = [
  {
    slug: "theme-colors",
    title: (0,external_wp_i18n_namespaceObject.__)("Theme Colors"),
    origin: "theme",
    type: "colors"
  },
  {
    slug: "theme-gradients",
    title: (0,external_wp_i18n_namespaceObject.__)("Theme Gradients"),
    origin: "theme",
    type: "gradients"
  },
  {
    slug: "custom-colors",
    title: (0,external_wp_i18n_namespaceObject.__)("Custom Colors"),
    origin: "custom",
    type: "colors"
  },
  {
    slug: "custom-gradients",
    title: (0,external_wp_i18n_namespaceObject.__)("Custom Gradients"),
    origin: "custom",
    // User.
    type: "gradients"
  },
  {
    slug: "duotones",
    title: (0,external_wp_i18n_namespaceObject.__)("Duotones"),
    origin: "theme",
    type: "duotones"
  },
  {
    slug: "default-colors",
    title: (0,external_wp_i18n_namespaceObject.__)("Default Colors"),
    origin: "default",
    type: "colors"
  },
  {
    slug: "default-gradients",
    title: (0,external_wp_i18n_namespaceObject.__)("Default Gradients"),
    origin: "default",
    type: "gradients"
  }
];
const STYLE_BOOK_THEME_SUBCATEGORIES = [
  {
    slug: "site-identity",
    title: (0,external_wp_i18n_namespaceObject.__)("Site Identity"),
    blocks: ["core/site-logo", "core/site-title", "core/site-tagline"]
  },
  {
    slug: "design",
    title: (0,external_wp_i18n_namespaceObject.__)("Design"),
    blocks: ["core/navigation", "core/avatar", "core/post-time-to-read"],
    exclude: ["core/home-link", "core/navigation-link"]
  },
  {
    slug: "posts",
    title: (0,external_wp_i18n_namespaceObject.__)("Posts"),
    blocks: [
      "core/post-title",
      "core/post-excerpt",
      "core/post-author",
      "core/post-author-name",
      "core/post-author-biography",
      "core/post-date",
      "core/post-terms",
      "core/term-description",
      "core/query-title",
      "core/query-no-results",
      "core/query-pagination",
      "core/query-numbers"
    ]
  },
  {
    slug: "comments",
    title: (0,external_wp_i18n_namespaceObject.__)("Comments"),
    blocks: [
      "core/comments-title",
      "core/comments-pagination",
      "core/comments-pagination-numbers",
      "core/comments",
      "core/comments-author-name",
      "core/comment-content",
      "core/comment-date",
      "core/comment-edit-link",
      "core/comment-reply-link",
      "core/comment-template",
      "core/post-comments-count",
      "core/post-comments-link"
    ]
  }
];
const STYLE_BOOK_CATEGORIES = [
  {
    slug: "overview",
    title: (0,external_wp_i18n_namespaceObject.__)("Overview"),
    blocks: []
  },
  {
    slug: "text",
    title: (0,external_wp_i18n_namespaceObject.__)("Text"),
    blocks: [
      "core/post-content",
      "core/home-link",
      "core/navigation-link"
    ]
  },
  {
    slug: "colors",
    title: (0,external_wp_i18n_namespaceObject.__)("Colors"),
    blocks: []
  },
  {
    slug: "theme",
    title: (0,external_wp_i18n_namespaceObject.__)("Theme"),
    subcategories: STYLE_BOOK_THEME_SUBCATEGORIES
  },
  {
    slug: "media",
    title: (0,external_wp_i18n_namespaceObject.__)("Media"),
    blocks: ["core/post-featured-image"]
  },
  {
    slug: "widgets",
    title: (0,external_wp_i18n_namespaceObject.__)("Widgets"),
    blocks: []
  },
  {
    slug: "embed",
    title: (0,external_wp_i18n_namespaceObject.__)("Embeds"),
    include: []
  }
];
const STYLE_BOOK_ALL_BLOCKS_SUBCATEGORIES = [
  ...STYLE_BOOK_THEME_SUBCATEGORIES,
  {
    slug: "media",
    title: (0,external_wp_i18n_namespaceObject.__)("Media"),
    blocks: ["core/post-featured-image"]
  },
  {
    slug: "widgets",
    title: (0,external_wp_i18n_namespaceObject.__)("Widgets"),
    blocks: []
  },
  {
    slug: "embed",
    title: (0,external_wp_i18n_namespaceObject.__)("Embeds"),
    include: []
  }
];
const STYLE_BOOK_PREVIEW_CATEGORIES = [
  {
    slug: "overview",
    title: (0,external_wp_i18n_namespaceObject.__)("Overview"),
    blocks: []
  },
  {
    slug: "text",
    title: (0,external_wp_i18n_namespaceObject.__)("Text"),
    blocks: [
      "core/post-content",
      "core/home-link",
      "core/navigation-link"
    ]
  },
  {
    slug: "colors",
    title: (0,external_wp_i18n_namespaceObject.__)("Colors"),
    blocks: []
  },
  {
    slug: "blocks",
    title: (0,external_wp_i18n_namespaceObject.__)("All Blocks"),
    blocks: [],
    subcategories: STYLE_BOOK_ALL_BLOCKS_SUBCATEGORIES
  }
];
const ROOT_CONTAINER = `
	.is-root-container {
		display: flow-root;
	}
`;
const STYLE_BOOK_IFRAME_STYLES = `
	body {
		position: relative;
		padding: 32px !important;
	}

	${ROOT_CONTAINER}

	.edit-site-style-book__examples {
		max-width: 1200px;
		margin: 0 auto;
	}

	.edit-site-style-book__example {
	    max-width: 900px;
		border-radius: 2px;
		cursor: pointer;
		display: flex;
		flex-direction: column;
		gap: 40px;
		padding: 16px;
		width: 100%;
		box-sizing: border-box;
		scroll-margin-top: 32px;
		scroll-margin-bottom: 32px;
		margin: 0 auto 40px auto;
	}

	.edit-site-style-book__example.is-selected {
		box-shadow: 0 0 0 1px var(--wp-components-color-accent, var(--wp-admin-theme-color, #007cba));
	}

	.edit-site-style-book__example.is-disabled-example {
		pointer-events: none;
	}

	.edit-site-style-book__example:focus:not(:disabled) {
		box-shadow: 0 0 0 var(--wp-admin-border-width-focus) var(--wp-components-color-accent, var(--wp-admin-theme-color, #007cba));
		outline: 3px solid transparent;
	}

	.edit-site-style-book__duotone-example > div:first-child {
		display: flex;
		aspect-ratio: 16 / 9;
		grid-row: span 1;
		grid-column: span 2;
	}
	.edit-site-style-book__duotone-example img {
		width: 100%;
		height: 100%;
		object-fit: cover;
	}
	.edit-site-style-book__duotone-example > div:not(:first-child) {
		height: 20px;
		border: 1px solid color-mix( in srgb, currentColor 10%, transparent );
	}

	.edit-site-style-book__color-example {
		border: 1px solid color-mix( in srgb, currentColor 10%, transparent );
	}

	.edit-site-style-book__subcategory-title,
	.edit-site-style-book__example-title {
		font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
		font-size: 13px;
		font-weight: normal;
		line-height: normal;
		margin: 0;
		text-align: left;
		padding-top: 8px;
		border-top: 1px solid color-mix( in srgb, currentColor 10%, transparent );
		color: color-mix( in srgb, currentColor 60%, transparent );
	}

	.edit-site-style-book__subcategory-title {
		font-size: 16px;
		margin-bottom: 40px;
    	padding-bottom: 8px;
	}

	.edit-site-style-book__example-preview {
		width: 100%;
	}

	.edit-site-style-book__example-preview .block-editor-block-list__insertion-point,
	.edit-site-style-book__example-preview .block-list-appender {
		display: none;
	}
	:where(.is-root-container > .wp-block:first-child) {
		margin-top: 0;
	}
	:where(.is-root-container > .wp-block:last-child) {
		margin-bottom: 0;
	}
`;


;// ./node_modules/@wordpress/edit-site/build-module/components/style-book/categories.js


function getExamplesByCategory(categoryDefinition, examples) {
  if (!categoryDefinition?.slug || !examples?.length) {
    return;
  }
  const categories = categoryDefinition?.subcategories ?? [];
  if (categories.length) {
    return categories.reduce(
      (acc, subcategoryDefinition) => {
        const subcategoryExamples = getExamplesByCategory(
          subcategoryDefinition,
          examples
        );
        if (subcategoryExamples) {
          if (!acc.subcategories) {
            acc.subcategories = [];
          }
          acc.subcategories = [
            ...acc.subcategories,
            subcategoryExamples
          ];
        }
        return acc;
      },
      {
        title: categoryDefinition.title,
        slug: categoryDefinition.slug
      }
    );
  }
  const blocksToInclude = categoryDefinition?.blocks || [];
  const blocksToExclude = categoryDefinition?.exclude || [];
  const categoryExamples = examples.filter((example) => {
    return !blocksToExclude.includes(example.name) && (example.category === categoryDefinition.slug || blocksToInclude.includes(example.name));
  });
  if (!categoryExamples.length) {
    return;
  }
  return {
    title: categoryDefinition.title,
    slug: categoryDefinition.slug,
    examples: categoryExamples
  };
}
function getTopLevelStyleBookCategories() {
  const reservedCategories = [
    ...STYLE_BOOK_THEME_SUBCATEGORIES,
    ...STYLE_BOOK_CATEGORIES
  ].map(({ slug }) => slug);
  const extraCategories = (0,external_wp_blocks_namespaceObject.getCategories)();
  const extraCategoriesFiltered = extraCategories.filter(
    ({ slug }) => !reservedCategories.includes(slug)
  );
  return [...STYLE_BOOK_CATEGORIES, ...extraCategoriesFiltered];
}


;// ./node_modules/@wordpress/edit-site/build-module/components/style-book/color-examples.js





const ColorExamples = ({
  colors,
  type,
  templateColumns = "1fr 1fr",
  itemHeight = "52px"
}) => {
  if (!colors) {
    return null;
  }
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalGrid, { templateColumns, rowGap: 8, columnGap: 16, children: colors.map((color) => {
    const className = type === "gradients" ? (0,external_wp_blockEditor_namespaceObject.__experimentalGetGradientClass)(color.slug) : (0,external_wp_blockEditor_namespaceObject.getColorClassName)("background-color", color.slug);
    const classes = dist_clsx(
      "edit-site-style-book__color-example",
      className
    );
    return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
      external_wp_primitives_namespaceObject.View,
      {
        className: classes,
        style: { height: itemHeight }
      },
      color.slug
    );
  }) });
};
var color_examples_default = ColorExamples;


;// ./node_modules/@wordpress/edit-site/build-module/components/style-book/duotone-examples.js



const DuotoneExamples = ({
  duotones
}) => {
  if (!duotones) {
    return null;
  }
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalGrid, { columns: 2, rowGap: 16, columnGap: 16, children: duotones.map((duotone) => {
    return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
      external_wp_components_namespaceObject.__experimentalGrid,
      {
        className: "edit-site-style-book__duotone-example",
        columns: 2,
        rowGap: 8,
        columnGap: 8,
        children: [
          /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.View, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
            "img",
            {
              alt: `Duotone example: ${duotone.slug}`,
              src: "https://s.w.org/images/core/5.3/MtBlanc1.jpg",
              style: {
                filter: `url(#wp-duotone-${duotone.slug})`
              }
            }
          ) }),
          duotone.colors.map((color) => {
            return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
              external_wp_primitives_namespaceObject.View,
              {
                className: "edit-site-style-book__color-example",
                style: { backgroundColor: color }
              },
              color
            );
          })
        ]
      },
      duotone.slug
    );
  }) });
};
var duotone_examples_default = DuotoneExamples;


;// ./node_modules/@wordpress/edit-site/build-module/components/style-book/examples.js






function getColorExamples(colors) {
  if (!colors) {
    return [];
  }
  const examples = [];
  STYLE_BOOK_COLOR_GROUPS.forEach((group) => {
    const palette = colors[group.type];
    const paletteFiltered = Array.isArray(palette) ? palette.find(
      (origin) => origin.slug === group.origin
    ) : void 0;
    if (paletteFiltered?.[group.type]) {
      const example = {
        name: group.slug,
        title: group.title,
        category: "colors"
      };
      if (group.type === "duotones") {
        example.content = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
          duotone_examples_default,
          {
            duotones: paletteFiltered[group.type]
          }
        );
        examples.push(example);
      } else {
        example.content = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
          color_examples_default,
          {
            colors: paletteFiltered[group.type],
            type: group.type
          }
        );
        examples.push(example);
      }
    }
  });
  return examples;
}
function getOverviewBlockExamples(colors) {
  const examples = [];
  const themePalette = Array.isArray(colors?.colors) ? colors.colors.find(
    (origin) => origin.slug === "theme"
  ) : void 0;
  if (themePalette) {
    const themeColorexample = {
      name: "theme-colors",
      title: (0,external_wp_i18n_namespaceObject.__)("Colors"),
      category: "overview",
      content: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
        color_examples_default,
        {
          colors: themePalette.colors,
          type: "colors",
          templateColumns: "repeat(auto-fill, minmax( 200px, 1fr ))",
          itemHeight: "32px"
        }
      )
    };
    examples.push(themeColorexample);
  }
  const typographyBlockExamples = [];
  if ((0,external_wp_blocks_namespaceObject.getBlockType)("core/heading")) {
    const headingBlock = (0,external_wp_blocks_namespaceObject.createBlock)("core/heading", {
      // translators: Typography example. Your local alphabet, numbers and some common special characters.
      content: (0,external_wp_i18n_namespaceObject.__)(
        `AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz0123456789X{(\u2026)},.-<>?!*&:/A@HELFO\u2122\xA9`
      ),
      level: 1
    });
    typographyBlockExamples.push(headingBlock);
  }
  if ((0,external_wp_blocks_namespaceObject.getBlockType)("core/paragraph")) {
    const firstParagraphBlock = (0,external_wp_blocks_namespaceObject.createBlock)("core/paragraph", {
      content: (0,external_wp_i18n_namespaceObject.__)(
        `A paragraph in a website refers to a distinct block of text that is used to present and organize information. It is a fundamental unit of content in web design and is typically composed of a group of related sentences or thoughts focused on a particular topic or idea. Paragraphs play a crucial role in improving the readability and user experience of a website. They break down the text into smaller, manageable chunks, allowing readers to scan the content more easily.`
      )
    });
    const secondParagraphBlock = (0,external_wp_blocks_namespaceObject.createBlock)("core/paragraph", {
      content: (0,external_wp_i18n_namespaceObject.__)(
        `Additionally, paragraphs help structure the flow of information and provide logical breaks between different concepts or pieces of information. In terms of formatting, paragraphs in websites are commonly denoted by a vertical gap or indentation between each block of text. This visual separation helps visually distinguish one paragraph from another, creating a clear and organized layout that guides the reader through the content smoothly.`
      )
    });
    if ((0,external_wp_blocks_namespaceObject.getBlockType)("core/group")) {
      const groupBlock = (0,external_wp_blocks_namespaceObject.createBlock)(
        "core/group",
        {
          layout: {
            type: "grid",
            columnCount: 2,
            minimumColumnWidth: "12rem"
          },
          style: {
            spacing: {
              blockGap: "1.5rem"
            }
          }
        },
        [firstParagraphBlock, secondParagraphBlock]
      );
      typographyBlockExamples.push(groupBlock);
    } else {
      typographyBlockExamples.push(firstParagraphBlock);
    }
  }
  if (!!typographyBlockExamples.length) {
    examples.push({
      name: "typography",
      title: (0,external_wp_i18n_namespaceObject.__)("Typography"),
      category: "overview",
      blocks: typographyBlockExamples
    });
  }
  const otherBlockExamples = [
    "core/image",
    "core/separator",
    "core/buttons",
    "core/pullquote",
    "core/search"
  ];
  otherBlockExamples.forEach((blockName) => {
    const blockType = (0,external_wp_blocks_namespaceObject.getBlockType)(blockName);
    if (blockType && blockType.example) {
      const blockExample = {
        name: blockName,
        title: blockType.title,
        category: "overview",
        /*
         * CSS generated from style attributes will take precedence over global styles CSS,
         * so remove the style attribute from the example to ensure the example
         * demonstrates changes to global styles.
         */
        blocks: (0,external_wp_blocks_namespaceObject.getBlockFromExample)(blockName, {
          ...blockType.example,
          attributes: {
            ...blockType.example.attributes,
            style: void 0
          }
        })
      };
      examples.push(blockExample);
    }
  });
  return examples;
}
function getExamples(colors) {
  const nonHeadingBlockExamples = (0,external_wp_blocks_namespaceObject.getBlockTypes)().filter((blockType) => {
    const { name, example, supports } = blockType;
    return name !== "core/heading" && !!example && supports?.inserter !== false;
  }).map((blockType) => ({
    name: blockType.name,
    title: blockType.title,
    category: blockType.category,
    /*
     * CSS generated from style attributes will take precedence over global styles CSS,
     * so remove the style attribute from the example to ensure the example
     * demonstrates changes to global styles.
     */
    blocks: (0,external_wp_blocks_namespaceObject.getBlockFromExample)(blockType.name, {
      ...blockType.example,
      attributes: {
        ...blockType.example.attributes,
        style: void 0
      }
    })
  }));
  const isHeadingBlockRegistered = !!(0,external_wp_blocks_namespaceObject.getBlockType)("core/heading");
  if (!isHeadingBlockRegistered) {
    return nonHeadingBlockExamples;
  }
  const headingsExample = {
    name: "core/heading",
    title: (0,external_wp_i18n_namespaceObject.__)("Headings"),
    category: "text",
    blocks: [1, 2, 3, 4, 5, 6].map((level) => {
      return (0,external_wp_blocks_namespaceObject.createBlock)("core/heading", {
        content: (0,external_wp_i18n_namespaceObject.sprintf)(
          // translators: %d: heading level e.g: "1", "2", "3"
          (0,external_wp_i18n_namespaceObject.__)("Heading %d"),
          level
        ),
        level
      });
    })
  };
  const colorExamples = getColorExamples(colors);
  const overviewBlockExamples = getOverviewBlockExamples(colors);
  return [
    headingsExample,
    ...colorExamples,
    ...nonHeadingBlockExamples,
    ...overviewBlockExamples
  ];
}


;// ./node_modules/@wordpress/admin-ui/build-module/page/header.js


function Header({
  breadcrumbs,
  badges,
  title,
  subTitle,
  actions
}) {
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { className: "admin-ui-page__header", as: "header", children: [
    /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
      external_wp_components_namespaceObject.__experimentalHStack,
      {
        className: "admin-ui-page__header-title",
        justify: "space-between",
        spacing: 2,
        children: [
          /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { spacing: 2, children: [
            title && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHeading, { as: "h2", level: 3, weight: 500, truncate: true, children: title }),
            breadcrumbs,
            badges
          ] }),
          /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
            external_wp_components_namespaceObject.__experimentalHStack,
            {
              style: { width: "auto", flexShrink: 0 },
              spacing: 2,
              className: "admin-ui-page__header-actions",
              children: actions
            }
          )
        ]
      }
    ),
    subTitle && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { className: "admin-ui-page__header-subtitle", children: subTitle })
  ] });
}


;// ./node_modules/@wordpress/admin-ui/build-module/page/index.js




function Page({
  breadcrumbs,
  badges,
  title,
  subTitle,
  children,
  className,
  actions,
  hasPadding = false
}) {
  const classes = dist_clsx("admin-ui-page", className);
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(navigable_region_default, { className: classes, ariaLabel: title, children: [
    (title || breadcrumbs || badges) && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
      Header,
      {
        breadcrumbs,
        badges,
        title,
        subTitle,
        actions
      }
    ),
    hasPadding ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "admin-ui-page__content has-padding", children }) : children
  ] });
}
var page_page_default = Page;


;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-global-styles-wrapper/index.js













const { useLocation: sidebar_global_styles_wrapper_useLocation, useHistory: sidebar_global_styles_wrapper_useHistory } = unlock(external_wp_router_namespaceObject.privateApis);
const GlobalStylesPageActions = ({
  isStyleBookOpened,
  setIsStyleBookOpened,
  path
}) => {
  const history = sidebar_global_styles_wrapper_useHistory();
  const canEditCSS = (0,external_wp_data_.useSelect)((select) => {
    const { getEntityRecord, __experimentalGetCurrentGlobalStylesId } = select(external_wp_coreData_namespaceObject.store);
    const globalStylesId = __experimentalGetCurrentGlobalStylesId();
    const globalStyles = globalStylesId ? getEntityRecord("root", "globalStyles", globalStylesId) : void 0;
    return !!globalStyles?._links?.["wp:action-edit-css"];
  }, []);
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { children: [
    /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
      external_wp_components_namespaceObject.Button,
      {
        isPressed: isStyleBookOpened,
        icon: seen_default,
        label: (0,external_wp_i18n_namespaceObject.__)("Style Book"),
        onClick: () => {
          setIsStyleBookOpened(!isStyleBookOpened);
          const updatedPath = !isStyleBookOpened ? (0,external_wp_url_namespaceObject.addQueryArgs)(path, { preview: "stylebook" }) : (0,external_wp_url_namespaceObject.removeQueryArgs)(path, "preview");
          history.navigate(updatedPath);
        },
        size: "compact"
      }
    ),
    canEditCSS && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
      external_wp_components_namespaceObject.DropdownMenu,
      {
        icon: more_vertical_default,
        label: (0,external_wp_i18n_namespaceObject.__)("More"),
        toggleProps: { size: "compact" },
        children: ({ onClose }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuGroup, { children: canEditCSS && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
          external_wp_components_namespaceObject.MenuItem,
          {
            onClick: () => {
              onClose();
              history.navigate(
                (0,external_wp_url_namespaceObject.addQueryArgs)(path, {
                  section: "/css"
                })
              );
            },
            children: (0,external_wp_i18n_namespaceObject.__)("Additional CSS")
          }
        ) })
      }
    )
  ] });
};
const useSection = () => {
  const { path, query } = sidebar_global_styles_wrapper_useLocation();
  const history = sidebar_global_styles_wrapper_useHistory();
  return (0,external_wp_element_.useMemo)(() => {
    return [
      query.section ?? "/",
      (updatedSection) => {
        history.navigate(
          (0,external_wp_url_namespaceObject.addQueryArgs)(path, {
            section: updatedSection
          })
        );
      }
    ];
  }, [path, query.section, history]);
};
function GlobalStylesUIWrapper() {
  const { path } = sidebar_global_styles_wrapper_useLocation();
  const [isStyleBookOpened, setIsStyleBookOpened] = (0,external_wp_element_.useState)(
    path.includes("preview=stylebook")
  );
  const isMobileViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)("medium", "<");
  const [section, onChangeSection] = useSection();
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    page_page_default,
    {
      actions: !isMobileViewport ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
        GlobalStylesPageActions,
        {
          isStyleBookOpened,
          setIsStyleBookOpened,
          path
        }
      ) : null,
      className: "edit-site-styles",
      title: (0,external_wp_i18n_namespaceObject.__)("Styles"),
      children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ui_default, { path: section, onPathChange: onChangeSection })
    }
  );
}


;// ./node_modules/@wordpress/edit-site/build-module/components/style-book/index.js





















const {
  ExperimentalBlockEditorProvider,
  useGlobalStyle: style_book_useGlobalStyle,
  GlobalStylesContext: style_book_GlobalStylesContext,
  useGlobalStylesOutputWithConfig
} = unlock(external_wp_blockEditor_namespaceObject.privateApis);
const { mergeBaseAndUserConfigs: style_book_mergeBaseAndUserConfigs } = unlock(external_wp_editor_namespaceObject.privateApis);
const { Tabs: style_book_Tabs } = unlock(external_wp_components_namespaceObject.privateApis);
function isObjectEmpty(object) {
  return !object || Object.keys(object).length === 0;
}
const scrollToSection = (anchorId, iframe) => {
  if (!anchorId || !iframe || !iframe?.contentDocument) {
    return;
  }
  const element = anchorId === "top" ? iframe.contentDocument.body : iframe.contentDocument.getElementById(anchorId);
  if (element) {
    element.scrollIntoView({
      behavior: "smooth"
    });
  }
};
const getStyleBookNavigationFromPath = (path) => {
  if (path && typeof path === "string") {
    if (path === "/" || path.startsWith("/typography") || path.startsWith("/colors") || path.startsWith("/blocks")) {
      return {
        top: true
      };
    }
  }
  return null;
};
function useMultiOriginPalettes() {
  const { colors, gradients } = (0,external_wp_blockEditor_namespaceObject.__experimentalUseMultipleOriginColorsAndGradients)();
  const [
    shouldDisplayDefaultDuotones,
    customDuotones,
    themeDuotones,
    defaultDuotones
  ] = (0,external_wp_blockEditor_namespaceObject.useSettings)(
    "color.defaultDuotone",
    "color.duotone.custom",
    "color.duotone.theme",
    "color.duotone.default"
  );
  const palettes = (0,external_wp_element_.useMemo)(() => {
    const result = { colors, gradients, duotones: [] };
    if (themeDuotones && themeDuotones.length) {
      result.duotones.push({
        name: (0,external_wp_i18n_namespaceObject._x)(
          "Theme",
          "Indicates these duotone filters come from the theme."
        ),
        slug: "theme",
        duotones: themeDuotones
      });
    }
    if (shouldDisplayDefaultDuotones && defaultDuotones && defaultDuotones.length) {
      result.duotones.push({
        name: (0,external_wp_i18n_namespaceObject._x)(
          "Default",
          "Indicates these duotone filters come from WordPress."
        ),
        slug: "default",
        duotones: defaultDuotones
      });
    }
    if (customDuotones && customDuotones.length) {
      result.duotones.push({
        name: (0,external_wp_i18n_namespaceObject._x)(
          "Custom",
          "Indicates these doutone filters are created by the user."
        ),
        slug: "custom",
        duotones: customDuotones
      });
    }
    return result;
  }, [
    colors,
    gradients,
    customDuotones,
    themeDuotones,
    defaultDuotones,
    shouldDisplayDefaultDuotones
  ]);
  return palettes;
}
function getExamplesForSinglePageUse(examples) {
  const examplesForSinglePageUse = [];
  const overviewCategoryExamples = getExamplesByCategory(
    { slug: "overview" },
    examples
  );
  examplesForSinglePageUse.push(...overviewCategoryExamples.examples);
  const otherExamples = examples.filter((example) => {
    return example.category !== "overview" && !overviewCategoryExamples.examples.find(
      (overviewExample) => overviewExample.name === example.name
    );
  });
  examplesForSinglePageUse.push(...otherExamples);
  return examplesForSinglePageUse;
}
function applyBlockVariationsToExamples(examples, variation) {
  if (!variation) {
    return examples;
  }
  return examples.map((example) => {
    return {
      ...example,
      variation,
      blocks: Array.isArray(example.blocks) ? example.blocks.map((block) => ({
        ...block,
        attributes: {
          ...block.attributes,
          style: void 0,
          className: getVariationClassName(variation)
        }
      })) : {
        ...example.blocks,
        attributes: {
          ...example.blocks.attributes,
          style: void 0,
          className: getVariationClassName(variation)
        }
      }
    };
  });
}
function StyleBook({
  enableResizing = true,
  isSelected,
  onClick,
  onSelect,
  showCloseButton = true,
  onClose,
  showTabs = true,
  userConfig = {},
  path = ""
}) {
  const [textColor] = style_book_useGlobalStyle("color.text");
  const [backgroundColor] = style_book_useGlobalStyle("color.background");
  const colors = useMultiOriginPalettes();
  const examples = (0,external_wp_element_.useMemo)(() => getExamples(colors), [colors]);
  const tabs = (0,external_wp_element_.useMemo)(
    () => getTopLevelStyleBookCategories().filter(
      (category) => examples.some(
        (example) => example.category === category.slug
      )
    ),
    [examples]
  );
  const examplesForSinglePageUse = getExamplesForSinglePageUse(examples);
  const { base: baseConfig } = (0,external_wp_element_.useContext)(style_book_GlobalStylesContext);
  const goTo = getStyleBookNavigationFromPath(path);
  const mergedConfig = (0,external_wp_element_.useMemo)(() => {
    if (!isObjectEmpty(userConfig) && !isObjectEmpty(baseConfig)) {
      return style_book_mergeBaseAndUserConfigs(baseConfig, userConfig);
    }
    return {};
  }, [baseConfig, userConfig]);
  const originalSettings = (0,external_wp_data_.useSelect)(
    (select) => select(external_wp_blockEditor_namespaceObject.store).getSettings(),
    []
  );
  const [globalStyles] = useGlobalStylesOutputWithConfig(mergedConfig);
  const settings = (0,external_wp_element_.useMemo)(
    () => ({
      ...originalSettings,
      styles: !isObjectEmpty(globalStyles) && !isObjectEmpty(userConfig) ? globalStyles : originalSettings.styles,
      isPreviewMode: true
    }),
    [globalStyles, originalSettings, userConfig]
  );
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    editor_canvas_container_default,
    {
      onClose,
      enableResizing,
      closeButtonLabel: showCloseButton ? (0,external_wp_i18n_namespaceObject.__)("Close") : null,
      children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
        "div",
        {
          className: dist_clsx("edit-site-style-book", {
            "is-button": !!onClick
          }),
          style: {
            color: textColor,
            background: backgroundColor
          },
          children: showTabs ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(style_book_Tabs, { children: [
            /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "edit-site-style-book__tablist-container", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(style_book_Tabs.TabList, { children: tabs.map((tab) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
              style_book_Tabs.Tab,
              {
                tabId: tab.slug,
                children: tab.title
              },
              tab.slug
            )) }) }),
            tabs.map((tab) => {
              const categoryDefinition = tab.slug ? getTopLevelStyleBookCategories().find(
                (_category) => _category.slug === tab.slug
              ) : null;
              const filteredExamples = categoryDefinition ? getExamplesByCategory(
                categoryDefinition,
                examples
              ) : { examples };
              return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
                style_book_Tabs.TabPanel,
                {
                  tabId: tab.slug,
                  focusable: false,
                  className: "edit-site-style-book__tabpanel",
                  children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
                    StyleBookBody,
                    {
                      category: tab.slug,
                      examples: filteredExamples,
                      isSelected,
                      onSelect,
                      settings,
                      title: tab.title,
                      goTo
                    }
                  )
                },
                tab.slug
              );
            })
          ] }) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
            StyleBookBody,
            {
              examples: { examples: examplesForSinglePageUse },
              isSelected,
              onClick,
              onSelect,
              settings,
              goTo
            }
          )
        }
      )
    }
  );
}
const StyleBookPreview = ({ userConfig = {}, isStatic = false }) => {
  const siteEditorSettings = (0,external_wp_data_.useSelect)(
    (select) => select(store).getSettings(),
    []
  );
  const canUserUploadMedia = (0,external_wp_data_.useSelect)(
    (select) => select(external_wp_coreData_namespaceObject.store).canUser("create", {
      kind: "postType",
      name: "attachment"
    }),
    []
  );
  (0,external_wp_element_.useEffect)(() => {
    (0,external_wp_data_.dispatch)(external_wp_blockEditor_namespaceObject.store).updateSettings({
      ...siteEditorSettings,
      mediaUpload: canUserUploadMedia ? external_wp_mediaUtils_namespaceObject.uploadMedia : void 0
    });
  }, [siteEditorSettings, canUserUploadMedia]);
  const [section, onChangeSection] = useSection();
  const isSelected = (blockName) => {
    return section === `/blocks/${encodeURIComponent(blockName)}` || section.startsWith(
      `/blocks/${encodeURIComponent(blockName)}/`
    );
  };
  const onSelect = (blockName, isBlockVariation = false) => {
    if (STYLE_BOOK_COLOR_GROUPS.find(
      (group) => group.slug === blockName
    )) {
      onChangeSection("/colors/palette");
      return;
    }
    if (blockName === "typography") {
      onChangeSection("/typography");
      return;
    }
    if (isBlockVariation) {
      return;
    }
    onChangeSection(`/blocks/${encodeURIComponent(blockName)}`);
  };
  const colors = useMultiOriginPalettes();
  const examples = getExamples(colors);
  const examplesForSinglePageUse = getExamplesForSinglePageUse(examples);
  let previewCategory = null;
  let blockVariation = null;
  if (section.includes("/colors")) {
    previewCategory = "colors";
  } else if (section.includes("/typography")) {
    previewCategory = "text";
  } else if (section.includes("/blocks")) {
    previewCategory = "blocks";
    let blockName = decodeURIComponent(section).split("/blocks/")[1];
    if (blockName?.includes("/variations")) {
      [blockName, blockVariation] = blockName.split("/variations/");
    }
    if (blockName && examples.find((example) => example.name === blockName)) {
      previewCategory = blockName;
    }
  } else if (!isStatic) {
    previewCategory = "overview";
  }
  const categoryDefinition = STYLE_BOOK_PREVIEW_CATEGORIES.find(
    (category) => category.slug === previewCategory
  );
  const filteredExamples = (0,external_wp_element_.useMemo)(() => {
    if (!categoryDefinition) {
      return {
        examples: [
          examples.find(
            (example) => example.name === previewCategory
          )
        ]
      };
    }
    return getExamplesByCategory(categoryDefinition, examples);
  }, [categoryDefinition, examples, previewCategory]);
  const displayedExamples = (0,external_wp_element_.useMemo)(() => {
    if (!previewCategory) {
      return { examples: examplesForSinglePageUse };
    }
    if (blockVariation) {
      return {
        examples: applyBlockVariationsToExamples(
          filteredExamples.examples,
          blockVariation
        )
      };
    }
    return filteredExamples;
  }, [
    previewCategory,
    examplesForSinglePageUse,
    blockVariation,
    filteredExamples
  ]);
  const { base: baseConfig } = (0,external_wp_element_.useContext)(style_book_GlobalStylesContext);
  const goTo = getStyleBookNavigationFromPath(section);
  const mergedConfig = (0,external_wp_element_.useMemo)(() => {
    if (!isObjectEmpty(userConfig) && !isObjectEmpty(baseConfig)) {
      return style_book_mergeBaseAndUserConfigs(baseConfig, userConfig);
    }
    return {};
  }, [baseConfig, userConfig]);
  const [globalStyles] = useGlobalStylesOutputWithConfig(mergedConfig);
  const settings = (0,external_wp_element_.useMemo)(
    () => ({
      ...siteEditorSettings,
      styles: !isObjectEmpty(globalStyles) && !isObjectEmpty(userConfig) ? globalStyles : siteEditorSettings.styles,
      isPreviewMode: true
    }),
    [globalStyles, siteEditorSettings, userConfig]
  );
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "edit-site-style-book", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_blockEditor_namespaceObject.BlockEditorProvider, { settings, children: [
    /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesRenderer, { disableRootPadding: true }),
    /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
      StyleBookBody,
      {
        examples: displayedExamples,
        settings,
        goTo,
        isSelected: !isStatic ? isSelected : null,
        onSelect: !isStatic ? onSelect : null
      }
    )
  ] }) });
};
const StyleBookBody = ({
  examples,
  isSelected,
  onClick,
  onSelect,
  settings,
  title,
  goTo
}) => {
  const [isFocused, setIsFocused] = (0,external_wp_element_.useState)(false);
  const [hasIframeLoaded, setHasIframeLoaded] = (0,external_wp_element_.useState)(false);
  const iframeRef = (0,external_wp_element_.useRef)(null);
  const buttonModeProps = {
    role: "button",
    onFocus: () => setIsFocused(true),
    onBlur: () => setIsFocused(false),
    onKeyDown: (event) => {
      if (event.defaultPrevented) {
        return;
      }
      const { keyCode } = event;
      if (onClick && (keyCode === external_wp_keycodes_namespaceObject.ENTER || keyCode === external_wp_keycodes_namespaceObject.SPACE)) {
        event.preventDefault();
        onClick(event);
      }
    },
    onClick: (event) => {
      if (event.defaultPrevented) {
        return;
      }
      if (onClick) {
        event.preventDefault();
        onClick(event);
      }
    },
    readonly: true
  };
  const handleLoad = () => setHasIframeLoaded(true);
  (0,external_wp_element_.useLayoutEffect)(() => {
    if (hasIframeLoaded && iframeRef?.current) {
      if (goTo?.top) {
        scrollToSection("top", iframeRef?.current);
      }
    }
  }, [iframeRef?.current, goTo, scrollToSection, hasIframeLoaded]);
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
    external_wp_blockEditor_namespaceObject.__unstableIframe,
    {
      onLoad: handleLoad,
      ref: iframeRef,
      className: dist_clsx("edit-site-style-book__iframe", {
        "is-focused": isFocused && !!onClick,
        "is-button": !!onClick
      }),
      name: "style-book-canvas",
      tabIndex: 0,
      ...onClick ? buttonModeProps : {},
      children: [
        /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__unstableEditorStyles, { styles: settings.styles }),
        /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("style", { children: [
          STYLE_BOOK_IFRAME_STYLES,
          !!onClick && "body { cursor: pointer; } body * { pointer-events: none; }"
        ] }),
        /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
          Examples,
          {
            className: "edit-site-style-book__examples",
            filteredExamples: examples,
            label: title ? (0,external_wp_i18n_namespaceObject.sprintf)(
              // translators: %s: Category of blocks, e.g. Text.
              (0,external_wp_i18n_namespaceObject.__)("Examples of blocks in the %s category"),
              title
            ) : (0,external_wp_i18n_namespaceObject.__)("Examples of blocks"),
            isSelected,
            onSelect
          },
          title
        )
      ]
    }
  );
};
const Examples = (0,external_wp_element_.memo)(
  ({ className, filteredExamples, label, isSelected, onSelect }) => {
    return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
      external_wp_components_namespaceObject.Composite,
      {
        orientation: "vertical",
        className,
        "aria-label": label,
        role: "grid",
        children: [
          !!filteredExamples?.examples?.length && filteredExamples.examples.map((example) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
            Example,
            {
              id: `example-${example.name}`,
              title: example.title,
              content: example.content,
              blocks: example.blocks,
              isSelected: isSelected?.(example.name),
              onClick: !!onSelect ? () => onSelect(
                example.name,
                !!example.variation
              ) : null
            },
            example.name
          )),
          !!filteredExamples?.subcategories?.length && filteredExamples.subcategories.map((subcategory) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
            external_wp_components_namespaceObject.Composite.Group,
            {
              className: "edit-site-style-book__subcategory",
              children: [
                /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Composite.GroupLabel, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("h2", { className: "edit-site-style-book__subcategory-title", children: subcategory.title }) }),
                /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
                  Subcategory,
                  {
                    examples: subcategory.examples,
                    isSelected,
                    onSelect
                  }
                )
              ]
            },
            `subcategory-${subcategory.slug}`
          ))
        ]
      }
    );
  }
);
const Subcategory = ({ examples, isSelected, onSelect }) => {
  return !!examples?.length && examples.map((example) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    Example,
    {
      id: `example-${example.name}`,
      title: example.title,
      content: example.content,
      blocks: example.blocks,
      isSelected: isSelected?.(example.name),
      onClick: !!onSelect ? () => onSelect(example.name) : null
    },
    example.name
  ));
};
const disabledExamples = ["example-duotones"];
const Example = ({ id, title, blocks, isSelected, onClick, content }) => {
  const originalSettings = (0,external_wp_data_.useSelect)(
    (select) => select(external_wp_blockEditor_namespaceObject.store).getSettings(),
    []
  );
  const settings = (0,external_wp_element_.useMemo)(
    () => ({
      ...originalSettings,
      focusMode: false,
      // Disable "Spotlight mode".
      isPreviewMode: true
    }),
    [originalSettings]
  );
  const renderedBlocks = (0,external_wp_element_.useMemo)(
    () => Array.isArray(blocks) ? blocks : [blocks],
    [blocks]
  );
  const disabledProps = disabledExamples.includes(id) || !onClick ? {
    disabled: true,
    accessibleWhenDisabled: !!onClick
  } : {};
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { role: "row", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { role: "gridcell", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
    external_wp_components_namespaceObject.Composite.Item,
    {
      className: dist_clsx("edit-site-style-book__example", {
        "is-selected": isSelected,
        "is-disabled-example": !!disabledProps?.disabled
      }),
      id,
      "aria-label": !!onClick ? (0,external_wp_i18n_namespaceObject.sprintf)(
        // translators: %s: Title of a block, e.g. Heading.
        (0,external_wp_i18n_namespaceObject.__)("Open %s styles in Styles panel"),
        title
      ) : void 0,
      render: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {}),
      role: !!onClick ? "button" : null,
      onClick,
      ...disabledProps,
      children: [
        /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "edit-site-style-book__example-title", children: title }),
        /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
          "div",
          {
            className: "edit-site-style-book__example-preview",
            "aria-hidden": true,
            children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Disabled, { className: "edit-site-style-book__example-preview__content", children: content ? content : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
              ExperimentalBlockEditorProvider,
              {
                value: renderedBlocks,
                settings,
                children: [
                  /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__unstableEditorStyles, {}),
                  /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockList, { renderAppender: false })
                ]
              }
            ) })
          }
        )
      ]
    }
  ) }) });
};
var style_book_default = StyleBook;


;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-css.js








const { useGlobalStyle: screen_css_useGlobalStyle, AdvancedPanel: screen_css_StylesAdvancedPanel } = unlock(
  external_wp_blockEditor_namespaceObject.privateApis
);
function ScreenCSS() {
  const [style] = screen_css_useGlobalStyle("", void 0, "user", {
    shouldDecodeEncode: false
  });
  const [inheritedStyle, setStyle] = screen_css_useGlobalStyle("", void 0, "all", {
    shouldDecodeEncode: false
  });
  const { setEditorCanvasContainerView } = unlock(
    (0,external_wp_data_.useDispatch)(store)
  );
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
    /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
      header_default,
      {
        title: (0,external_wp_i18n_namespaceObject.__)("Additional CSS"),
        description: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
          (0,external_wp_i18n_namespaceObject.__)(
            "You can add custom CSS to further customize the appearance and layout of your site."
          ),
          /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("br", {}),
          /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
            external_wp_components_namespaceObject.ExternalLink,
            {
              href: (0,external_wp_i18n_namespaceObject.__)(
                "https://developer.wordpress.org/advanced-administration/wordpress/css/"
              ),
              className: "edit-site-global-styles-screen-css-help-link",
              children: (0,external_wp_i18n_namespaceObject.__)("Learn more about CSS")
            }
          )
        ] }),
        onBack: () => {
          setEditorCanvasContainerView(void 0);
        }
      }
    ),
    /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "edit-site-global-styles-screen-css", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
      screen_css_StylesAdvancedPanel,
      {
        value: style,
        onChange: setStyle,
        inheritedValue: inheritedStyle
      }
    ) })
  ] });
}
var screen_css_default = ScreenCSS;


;// ./node_modules/@wordpress/edit-site/build-module/components/revisions/index.js









const {
  ExperimentalBlockEditorProvider: revisions_ExperimentalBlockEditorProvider,
  GlobalStylesContext: revisions_GlobalStylesContext,
  useGlobalStylesOutputWithConfig: revisions_useGlobalStylesOutputWithConfig,
  __unstableBlockStyleVariationOverridesWithConfig
} = unlock(external_wp_blockEditor_namespaceObject.privateApis);
const { mergeBaseAndUserConfigs: revisions_mergeBaseAndUserConfigs } = unlock(external_wp_editor_namespaceObject.privateApis);
function revisions_isObjectEmpty(object) {
  return !object || Object.keys(object).length === 0;
}
function Revisions({ userConfig, blocks }) {
  const { base: baseConfig } = (0,external_wp_element_.useContext)(revisions_GlobalStylesContext);
  const mergedConfig = (0,external_wp_element_.useMemo)(() => {
    if (!revisions_isObjectEmpty(userConfig) && !revisions_isObjectEmpty(baseConfig)) {
      return revisions_mergeBaseAndUserConfigs(baseConfig, userConfig);
    }
    return {};
  }, [baseConfig, userConfig]);
  const renderedBlocksArray = (0,external_wp_element_.useMemo)(
    () => Array.isArray(blocks) ? blocks : [blocks],
    [blocks]
  );
  const originalSettings = (0,external_wp_data_.useSelect)(
    (select) => select(external_wp_blockEditor_namespaceObject.store).getSettings(),
    []
  );
  const settings = (0,external_wp_element_.useMemo)(
    () => ({
      ...originalSettings,
      isPreviewMode: true
    }),
    [originalSettings]
  );
  const [globalStyles] = revisions_useGlobalStylesOutputWithConfig(mergedConfig);
  const editorStyles = !revisions_isObjectEmpty(globalStyles) && !revisions_isObjectEmpty(userConfig) ? globalStyles : settings.styles;
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    editor_canvas_container_default,
    {
      title: (0,external_wp_i18n_namespaceObject.__)("Revisions"),
      closeButtonLabel: (0,external_wp_i18n_namespaceObject.__)("Close revisions"),
      enableResizing: true,
      children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
        external_wp_blockEditor_namespaceObject.__unstableIframe,
        {
          className: "edit-site-revisions__iframe",
          name: "revisions",
          tabIndex: 0,
          children: [
            /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("style", {
              // Forming a "block formatting context" to prevent margin collapsing.
              // @see https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Block_formatting_context
              children: `.is-root-container { display: flow-root; }`
            }),
            /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Disabled, { className: "edit-site-revisions__example-preview__content", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
              revisions_ExperimentalBlockEditorProvider,
              {
                value: renderedBlocksArray,
                settings,
                children: [
                  /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockList, { renderAppender: false }),
                  /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__unstableEditorStyles, { styles: editorStyles }),
                  /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
                    __unstableBlockStyleVariationOverridesWithConfig,
                    {
                      config: mergedConfig
                    }
                  )
                ]
              }
            ) })
          ]
        }
      )
    }
  );
}
var revisions_default = Revisions;


;// external ["wp","date"]
const external_wp_date_namespaceObject = window["wp"]["date"];
;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-revisions/revisions-buttons.js









const DAY_IN_MILLISECONDS = 60 * 60 * 1e3 * 24;
const { getGlobalStylesChanges } = unlock(external_wp_blockEditor_namespaceObject.privateApis);
function ChangesSummary({ revision, previousRevision }) {
  const changes = getGlobalStylesChanges(revision, previousRevision, {
    maxResults: 7
  });
  if (!changes.length) {
    return null;
  }
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    "ul",
    {
      "data-testid": "global-styles-revision-changes",
      className: "edit-site-global-styles-screen-revisions__changes",
      children: changes.map((change) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("li", { children: change }, change))
    }
  );
}
function getRevisionLabel(id, authorDisplayName, formattedModifiedDate, areStylesEqual) {
  if ("parent" === id) {
    return (0,external_wp_i18n_namespaceObject.__)("Reset the styles to the theme defaults");
  }
  if ("unsaved" === id) {
    return (0,external_wp_i18n_namespaceObject.sprintf)(
      /* translators: %s: author display name */
      (0,external_wp_i18n_namespaceObject.__)("Unsaved changes by %s"),
      authorDisplayName
    );
  }
  return areStylesEqual ? (0,external_wp_i18n_namespaceObject.sprintf)(
    // translators: 1: author display name. 2: revision creation date.
    (0,external_wp_i18n_namespaceObject.__)(
      "Changes saved by %1$s on %2$s. This revision matches current editor styles."
    ),
    authorDisplayName,
    formattedModifiedDate
  ) : (0,external_wp_i18n_namespaceObject.sprintf)(
    // translators: 1: author display name. 2: revision creation date.
    (0,external_wp_i18n_namespaceObject.__)("Changes saved by %1$s on %2$s"),
    authorDisplayName,
    formattedModifiedDate
  );
}
function RevisionsButtons({
  userRevisions,
  selectedRevisionId,
  onChange,
  canApplyRevision,
  onApplyRevision
}) {
  const { currentThemeName, currentUser } = (0,external_wp_data_.useSelect)((select) => {
    const { getCurrentTheme, getCurrentUser } = select(external_wp_coreData_namespaceObject.store);
    const currentTheme = getCurrentTheme();
    return {
      currentThemeName: currentTheme?.name?.rendered || currentTheme?.stylesheet,
      currentUser: getCurrentUser()
    };
  }, []);
  const dateNowInMs = (0,external_wp_date_namespaceObject.getDate)().getTime();
  const { datetimeAbbreviated } = (0,external_wp_date_namespaceObject.getSettings)().formats;
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    external_wp_components_namespaceObject.Composite,
    {
      orientation: "vertical",
      className: "edit-site-global-styles-screen-revisions__revisions-list",
      "aria-label": (0,external_wp_i18n_namespaceObject.__)("Global styles revisions list"),
      role: "listbox",
      children: userRevisions.map((revision, index) => {
        const { id, author, modified } = revision;
        const isUnsaved = "unsaved" === id;
        const revisionAuthor = isUnsaved ? currentUser : author;
        const authorDisplayName = revisionAuthor?.name || (0,external_wp_i18n_namespaceObject.__)("User");
        const authorAvatar = revisionAuthor?.avatar_urls?.["48"];
        const isFirstItem = index === 0;
        const isSelected = selectedRevisionId ? selectedRevisionId === id : isFirstItem;
        const areStylesEqual = !canApplyRevision && isSelected;
        const isReset = "parent" === id;
        const modifiedDate = (0,external_wp_date_namespaceObject.getDate)(modified);
        const displayDate = modified && dateNowInMs - modifiedDate.getTime() > DAY_IN_MILLISECONDS ? (0,external_wp_date_namespaceObject.dateI18n)(datetimeAbbreviated, modifiedDate) : (0,external_wp_date_namespaceObject.humanTimeDiff)(modified);
        const revisionLabel = getRevisionLabel(
          id,
          authorDisplayName,
          (0,external_wp_date_namespaceObject.dateI18n)(datetimeAbbreviated, modifiedDate),
          areStylesEqual
        );
        return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
          external_wp_components_namespaceObject.Composite.Item,
          {
            className: "edit-site-global-styles-screen-revisions__revision-item",
            "aria-current": isSelected,
            role: "option",
            onKeyDown: (event) => {
              const { keyCode } = event;
              if (keyCode === external_wp_keycodes_namespaceObject.ENTER || keyCode === external_wp_keycodes_namespaceObject.SPACE) {
                onChange(revision);
              }
            },
            onClick: (event) => {
              event.preventDefault();
              onChange(revision);
            },
            "aria-selected": isSelected,
            "aria-label": revisionLabel,
            render: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {}),
            children: [
              /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "edit-site-global-styles-screen-revisions__revision-item-wrapper", children: isReset ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("span", { className: "edit-site-global-styles-screen-revisions__description", children: [
                (0,external_wp_i18n_namespaceObject.__)("Default styles"),
                /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "edit-site-global-styles-screen-revisions__meta", children: currentThemeName })
              ] }) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("span", { className: "edit-site-global-styles-screen-revisions__description", children: [
                isUnsaved ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "edit-site-global-styles-screen-revisions__date", children: (0,external_wp_i18n_namespaceObject.__)("(Unsaved)") }) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
                  "time",
                  {
                    className: "edit-site-global-styles-screen-revisions__date",
                    dateTime: modified,
                    children: displayDate
                  }
                ),
                /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("span", { className: "edit-site-global-styles-screen-revisions__meta", children: [
                  /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
                    "img",
                    {
                      alt: authorDisplayName,
                      src: authorAvatar
                    }
                  ),
                  authorDisplayName
                ] }),
                isSelected && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
                  ChangesSummary,
                  {
                    revision,
                    previousRevision: index < userRevisions.length ? userRevisions[index + 1] : {}
                  }
                )
              ] }) }),
              isSelected && (areStylesEqual ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { className: "edit-site-global-styles-screen-revisions__applied-text", children: (0,external_wp_i18n_namespaceObject.__)(
                "These styles are already applied to your site."
              ) }) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
                external_wp_components_namespaceObject.Button,
                {
                  size: "compact",
                  variant: "primary",
                  className: "edit-site-global-styles-screen-revisions__apply-button",
                  onClick: onApplyRevision,
                  "aria-label": (0,external_wp_i18n_namespaceObject.__)(
                    "Apply the selected revision to your site."
                  ),
                  children: isReset ? (0,external_wp_i18n_namespaceObject.__)("Reset to defaults") : (0,external_wp_i18n_namespaceObject.__)("Apply")
                }
              ))
            ]
          },
          id
        );
      })
    }
  );
}
var revisions_buttons_default = RevisionsButtons;


;// ./node_modules/@wordpress/edit-site/build-module/components/pagination/index.js





function Pagination({
  currentPage,
  numPages,
  changePage,
  totalItems,
  className,
  disabled = false,
  buttonVariant = "tertiary",
  label = (0,external_wp_i18n_namespaceObject.__)("Pagination")
}) {
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
    external_wp_components_namespaceObject.__experimentalHStack,
    {
      expanded: false,
      as: "nav",
      "aria-label": label,
      spacing: 3,
      justify: "flex-start",
      className: dist_clsx("edit-site-pagination", className),
      children: [
        /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, {
          variant: "muted",
          className: "edit-site-pagination__total",
          // translators: %s: Total number of patterns.
          children: (0,external_wp_i18n_namespaceObject.sprintf)(
            // translators: %s: Total number of patterns.
            (0,external_wp_i18n_namespaceObject._n)("%s item", "%s items", totalItems),
            totalItems
          )
        }),
        /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { expanded: false, spacing: 1, children: [
          /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
            external_wp_components_namespaceObject.Button,
            {
              variant: buttonVariant,
              onClick: () => changePage(1),
              accessibleWhenDisabled: true,
              disabled: disabled || currentPage === 1,
              label: (0,external_wp_i18n_namespaceObject.__)("First page"),
              icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? next_default : previous_default,
              size: "compact"
            }
          ),
          /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
            external_wp_components_namespaceObject.Button,
            {
              variant: buttonVariant,
              onClick: () => changePage(currentPage - 1),
              accessibleWhenDisabled: true,
              disabled: disabled || currentPage === 1,
              label: (0,external_wp_i18n_namespaceObject.__)("Previous page"),
              icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_right_default : chevron_left_default,
              size: "compact"
            }
          )
        ] }),
        /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { variant: "muted", children: (0,external_wp_i18n_namespaceObject.sprintf)(
          // translators: 1: Current page number. 2: Total number of pages.
          (0,external_wp_i18n_namespaceObject._x)("%1$s of %2$s", "paging"),
          currentPage,
          numPages
        ) }),
        /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { expanded: false, spacing: 1, children: [
          /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
            external_wp_components_namespaceObject.Button,
            {
              variant: buttonVariant,
              onClick: () => changePage(currentPage + 1),
              accessibleWhenDisabled: true,
              disabled: disabled || currentPage === numPages,
              label: (0,external_wp_i18n_namespaceObject.__)("Next page"),
              icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left_default : chevron_right_default,
              size: "compact"
            }
          ),
          /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
            external_wp_components_namespaceObject.Button,
            {
              variant: buttonVariant,
              onClick: () => changePage(numPages),
              accessibleWhenDisabled: true,
              disabled: disabled || currentPage === numPages,
              label: (0,external_wp_i18n_namespaceObject.__)("Last page"),
              icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? previous_default : next_default,
              size: "compact"
            }
          )
        ] })
      ]
    }
  );
}


;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-revisions/index.js














const { GlobalStylesContext: screen_revisions_GlobalStylesContext, areGlobalStyleConfigsEqual: screen_revisions_areGlobalStyleConfigsEqual } = unlock(
  external_wp_blockEditor_namespaceObject.privateApis
);
const PAGE_SIZE = 10;
function ScreenRevisions() {
  const { user: currentEditorGlobalStyles, setUserConfig } = (0,external_wp_element_.useContext)(screen_revisions_GlobalStylesContext);
  const { blocks, editorCanvasContainerView } = (0,external_wp_data_.useSelect)(
    (select) => ({
      editorCanvasContainerView: unlock(
        select(store)
      ).getEditorCanvasContainerView(),
      blocks: select(external_wp_blockEditor_namespaceObject.store).getBlocks()
    }),
    []
  );
  const [currentPage, setCurrentPage] = (0,external_wp_element_.useState)(1);
  const [currentRevisions, setCurrentRevisions] = (0,external_wp_element_.useState)([]);
  const { revisions, isLoading, hasUnsavedChanges, revisionsCount } = useGlobalStylesRevisions({
    query: {
      per_page: PAGE_SIZE,
      page: currentPage
    }
  });
  const numPages = Math.ceil(revisionsCount / PAGE_SIZE);
  const [currentlySelectedRevision, setCurrentlySelectedRevision] = (0,external_wp_element_.useState)(currentEditorGlobalStyles);
  const [
    isLoadingRevisionWithUnsavedChanges,
    setIsLoadingRevisionWithUnsavedChanges
  ] = (0,external_wp_element_.useState)(false);
  const { setEditorCanvasContainerView } = unlock(
    (0,external_wp_data_.useDispatch)(store)
  );
  const selectedRevisionMatchesEditorStyles = screen_revisions_areGlobalStyleConfigsEqual(
    currentlySelectedRevision,
    currentEditorGlobalStyles
  );
  const onCloseRevisions = () => {
    const canvasContainerView = editorCanvasContainerView === "global-styles-revisions:style-book" ? "style-book" : void 0;
    setEditorCanvasContainerView(canvasContainerView);
  };
  const restoreRevision = (revision) => {
    setUserConfig(() => revision);
    setIsLoadingRevisionWithUnsavedChanges(false);
    onCloseRevisions();
  };
  (0,external_wp_element_.useEffect)(() => {
    if (!isLoading && revisions.length) {
      setCurrentRevisions(revisions);
    }
  }, [revisions, isLoading]);
  const firstRevision = revisions[0];
  const currentlySelectedRevisionId = currentlySelectedRevision?.id;
  const shouldSelectFirstItem = !!firstRevision?.id && !selectedRevisionMatchesEditorStyles && !currentlySelectedRevisionId;
  (0,external_wp_element_.useEffect)(() => {
    if (shouldSelectFirstItem) {
      setCurrentlySelectedRevision(firstRevision);
    }
  }, [shouldSelectFirstItem, firstRevision]);
  const isLoadButtonEnabled = !!currentlySelectedRevisionId && currentlySelectedRevisionId !== "unsaved" && !selectedRevisionMatchesEditorStyles;
  const hasRevisions = !!currentRevisions.length;
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
    /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
      header_default,
      {
        title: revisionsCount && // translators: %s: number of revisions.
        (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)("Revisions (%s)"), revisionsCount),
        description: (0,external_wp_i18n_namespaceObject.__)(
          `Click on previously saved styles to preview them. To restore a selected version to the editor, hit "Apply." When you're ready, use the Save button to save your changes.`
        ),
        onBack: onCloseRevisions
      }
    ),
    !hasRevisions && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, { className: "edit-site-global-styles-screen-revisions__loading" }),
    hasRevisions && (editorCanvasContainerView === "global-styles-revisions:style-book" ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
      style_book_default,
      {
        userConfig: currentlySelectedRevision,
        isSelected: () => {
        },
        onClose: () => {
          setEditorCanvasContainerView(
            "global-styles-revisions"
          );
        }
      }
    ) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
      revisions_default,
      {
        blocks,
        userConfig: currentlySelectedRevision,
        closeButtonLabel: (0,external_wp_i18n_namespaceObject.__)("Close revisions")
      }
    )),
    /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
      revisions_buttons_default,
      {
        onChange: setCurrentlySelectedRevision,
        selectedRevisionId: currentlySelectedRevisionId,
        userRevisions: currentRevisions,
        canApplyRevision: isLoadButtonEnabled,
        onApplyRevision: () => hasUnsavedChanges ? setIsLoadingRevisionWithUnsavedChanges(true) : restoreRevision(currentlySelectedRevision)
      }
    ),
    numPages > 1 && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "edit-site-global-styles-screen-revisions__footer", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
      Pagination,
      {
        className: "edit-site-global-styles-screen-revisions__pagination",
        currentPage,
        numPages,
        changePage: setCurrentPage,
        totalItems: revisionsCount,
        disabled: isLoading,
        label: (0,external_wp_i18n_namespaceObject.__)("Global Styles pagination")
      }
    ) }),
    isLoadingRevisionWithUnsavedChanges && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
      external_wp_components_namespaceObject.__experimentalConfirmDialog,
      {
        isOpen: isLoadingRevisionWithUnsavedChanges,
        confirmButtonText: (0,external_wp_i18n_namespaceObject.__)("Apply"),
        onConfirm: () => restoreRevision(currentlySelectedRevision),
        onCancel: () => setIsLoadingRevisionWithUnsavedChanges(false),
        size: "medium",
        children: (0,external_wp_i18n_namespaceObject.__)(
          "Are you sure you want to apply this revision? Any unsaved changes will be lost."
        )
      }
    )
  ] });
}
var screen_revisions_default = ScreenRevisions;


;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/ui.js






























const SLOT_FILL_NAME = "GlobalStylesMenu";
const { useGlobalStylesReset: ui_useGlobalStylesReset } = unlock(external_wp_blockEditor_namespaceObject.privateApis);
const { Slot: GlobalStylesMenuSlot, Fill: GlobalStylesMenuFill } = (0,external_wp_components_namespaceObject.createSlotFill)(SLOT_FILL_NAME);
function GlobalStylesActionMenu() {
  const [canReset, onReset] = ui_useGlobalStylesReset();
  const { toggle } = (0,external_wp_data_.useDispatch)(external_wp_preferences_.store);
  const { canEditCSS } = (0,external_wp_data_.useSelect)((select) => {
    const { getEntityRecord, __experimentalGetCurrentGlobalStylesId } = select(external_wp_coreData_namespaceObject.store);
    const globalStylesId = __experimentalGetCurrentGlobalStylesId();
    const globalStyles = globalStylesId ? getEntityRecord("root", "globalStyles", globalStylesId) : void 0;
    return {
      canEditCSS: !!globalStyles?._links?.["wp:action-edit-css"]
    };
  }, []);
  const { setEditorCanvasContainerView } = unlock(
    (0,external_wp_data_.useDispatch)(store)
  );
  const loadCustomCSS = () => {
    setEditorCanvasContainerView("global-styles-css");
  };
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesMenuFill, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    external_wp_components_namespaceObject.DropdownMenu,
    {
      icon: more_vertical_default,
      label: (0,external_wp_i18n_namespaceObject.__)("More"),
      toggleProps: { size: "compact" },
      children: ({ onClose }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
        /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.MenuGroup, { children: [
          canEditCSS && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { onClick: loadCustomCSS, children: (0,external_wp_i18n_namespaceObject.__)("Additional CSS") }),
          /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
            external_wp_components_namespaceObject.MenuItem,
            {
              onClick: () => {
                toggle(
                  "core/edit-site",
                  "welcomeGuideStyles"
                );
                onClose();
              },
              children: (0,external_wp_i18n_namespaceObject.__)("Welcome Guide")
            }
          )
        ] }),
        /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuGroup, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
          external_wp_components_namespaceObject.MenuItem,
          {
            onClick: () => {
              onReset();
              onClose();
            },
            disabled: !canReset,
            children: (0,external_wp_i18n_namespaceObject.__)("Reset styles")
          }
        ) })
      ] })
    }
  ) });
}
function GlobalStylesNavigationScreen({ className, ...props }) {
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    external_wp_components_namespaceObject.Navigator.Screen,
    {
      className: [
        "edit-site-global-styles-sidebar__navigator-screen",
        className
      ].filter(Boolean).join(" "),
      ...props
    }
  );
}
function BlockStylesNavigationScreens({
  parentMenu,
  blockStyles,
  blockName
}) {
  return blockStyles.map((style, index) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    GlobalStylesNavigationScreen,
    {
      path: parentMenu + "/variations/" + style.name,
      children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_block_default, { name: blockName, variation: style.name })
    },
    index
  ));
}
function ContextScreens({ name, parentMenu = "" }) {
  const blockStyleVariations = (0,external_wp_data_.useSelect)(
    (select) => {
      const { getBlockStyles } = select(external_wp_blocks_namespaceObject.store);
      return getBlockStyles(name);
    },
    [name]
  );
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
    /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
      GlobalStylesNavigationScreen,
      {
        path: parentMenu + "/colors/palette",
        children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_color_palette_default, { name })
      }
    ),
    !!blockStyleVariations?.length && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
      BlockStylesNavigationScreens,
      {
        parentMenu,
        blockStyles: blockStyleVariations,
        blockName: name
      }
    )
  ] });
}
function GlobalStylesStyleBook() {
  const navigator = (0,external_wp_components_namespaceObject.useNavigator)();
  const { path } = navigator.location;
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    style_book_default,
    {
      isSelected: (blockName) => (
        // Match '/blocks/core%2Fbutton' and
        // '/blocks/core%2Fbutton/typography', but not
        // '/blocks/core%2Fbuttons'.
        path === `/blocks/${encodeURIComponent(blockName)}` || path.startsWith(
          `/blocks/${encodeURIComponent(blockName)}/`
        )
      ),
      onSelect: (blockName) => {
        if (STYLE_BOOK_COLOR_GROUPS.find(
          (group) => group.slug === blockName
        )) {
          navigator.goTo("/colors/palette");
          return;
        }
        if (blockName === "typography") {
          navigator.goTo("/typography");
          return;
        }
        navigator.goTo("/blocks/" + encodeURIComponent(blockName));
      }
    }
  );
}
function GlobalStylesBlockLink() {
  const navigator = (0,external_wp_components_namespaceObject.useNavigator)();
  const { selectedBlockName, selectedBlockClientId } = (0,external_wp_data_.useSelect)(
    (select) => {
      const { getSelectedBlockClientId, getBlockName } = select(external_wp_blockEditor_namespaceObject.store);
      const clientId = getSelectedBlockClientId();
      return {
        selectedBlockName: getBlockName(clientId),
        selectedBlockClientId: clientId
      };
    },
    []
  );
  const blockHasGlobalStyles = useBlockHasGlobalStyles(selectedBlockName);
  (0,external_wp_element_.useEffect)(() => {
    if (!selectedBlockClientId || !blockHasGlobalStyles) {
      return;
    }
    const currentPath = navigator.location.path;
    if (currentPath !== "/blocks" && !currentPath.startsWith("/blocks/")) {
      return;
    }
    const newPath = "/blocks/" + encodeURIComponent(selectedBlockName);
    if (newPath !== currentPath) {
      navigator.goTo(newPath, { skipFocus: true });
    }
  }, [selectedBlockClientId, selectedBlockName, blockHasGlobalStyles]);
}
function GlobalStylesEditorCanvasContainerLink() {
  const { goTo, location } = (0,external_wp_components_namespaceObject.useNavigator)();
  const editorCanvasContainerView = (0,external_wp_data_.useSelect)(
    (select) => unlock(select(store)).getEditorCanvasContainerView(),
    []
  );
  const path = location?.path;
  const isRevisionsOpen = path === "/revisions";
  (0,external_wp_element_.useEffect)(() => {
    switch (editorCanvasContainerView) {
      case "global-styles-revisions":
      case "global-styles-revisions:style-book":
        if (!isRevisionsOpen) {
          goTo("/revisions");
        }
        break;
      case "global-styles-css":
        goTo("/css");
        break;
      // The stand-alone style book is open
      // and the revisions panel is open,
      // close the revisions panel.
      // Otherwise keep the style book open while
      // browsing global styles panel.
      //
      // Falling through as it matches the default scenario.
      case "style-book":
      default:
        if (isRevisionsOpen) {
          goTo("/", { isBack: true });
        }
        break;
    }
  }, [editorCanvasContainerView, isRevisionsOpen, goTo]);
}
function useNavigatorSync(parentPath, onPathChange) {
  const navigator = (0,external_wp_components_namespaceObject.useNavigator)();
  const { path: childPath } = navigator.location;
  const previousParentPath = (0,external_wp_compose_namespaceObject.usePrevious)(parentPath);
  const previousChildPath = (0,external_wp_compose_namespaceObject.usePrevious)(childPath);
  (0,external_wp_element_.useEffect)(() => {
    if (parentPath !== childPath) {
      if (parentPath !== previousParentPath) {
        navigator.goTo(parentPath);
      } else if (childPath !== previousChildPath) {
        onPathChange(childPath);
      }
    }
  }, [
    onPathChange,
    parentPath,
    previousChildPath,
    previousParentPath,
    childPath,
    navigator
  ]);
}
function NavigationSync({ path: parentPath, onPathChange, children }) {
  useNavigatorSync(parentPath, onPathChange);
  return children;
}
function GlobalStylesUI({ path, onPathChange }) {
  const blocks = (0,external_wp_blocks_namespaceObject.getBlockTypes)();
  const editorCanvasContainerView = (0,external_wp_data_.useSelect)(
    (select) => unlock(select(store)).getEditorCanvasContainerView(),
    []
  );
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
    external_wp_components_namespaceObject.Navigator,
    {
      className: "edit-site-global-styles-sidebar__navigator-provider",
      initialPath: "/",
      children: [
        path && onPathChange && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigationSync, { path, onPathChange }),
        /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { path: "/", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_root_default, {}) }),
        /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { path: "/variations", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_style_variations_default, {}) }),
        /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { path: "/blocks", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_block_list_default, {}) }),
        /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { path: "/typography", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_typography_default, {}) }),
        /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { path: "/typography/font-sizes", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(font_sizes_default, {}) }),
        /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { path: "/typography/font-sizes/:origin/:slug", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(font_size_default, {}) }),
        /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { path: "/typography/text", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_typography_element_default, { element: "text" }) }),
        /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { path: "/typography/link", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_typography_element_default, { element: "link" }) }),
        /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { path: "/typography/heading", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_typography_element_default, { element: "heading" }) }),
        /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { path: "/typography/caption", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_typography_element_default, { element: "caption" }) }),
        /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { path: "/typography/button", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_typography_element_default, { element: "button" }) }),
        /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { path: "/colors", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_colors_default, {}) }),
        /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { path: "/shadows", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ScreenShadows, {}) }),
        /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { path: "/shadows/edit/:category/:slug", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ScreenShadowsEdit, {}) }),
        /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { path: "/layout", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_layout_default, {}) }),
        /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { path: "/css", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_css_default, {}) }),
        /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { path: "/revisions", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_revisions_default, {}) }),
        /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesNavigationScreen, { path: "/background", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_background_default, {}) }),
        blocks.map((block) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
          GlobalStylesNavigationScreen,
          {
            path: "/blocks/" + encodeURIComponent(block.name),
            children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(screen_block_default, { name: block.name })
          },
          "menu-block-" + block.name
        )),
        /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ContextScreens, {}),
        blocks.map((block) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
          ContextScreens,
          {
            name: block.name,
            parentMenu: "/blocks/" + encodeURIComponent(block.name)
          },
          "screens-block-" + block.name
        )),
        "style-book" === editorCanvasContainerView && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesStyleBook, {}),
        /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesActionMenu, {}),
        /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesBlockLink, {}),
        /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesEditorCanvasContainerLink, {})
      ]
    }
  );
}
var ui_default = GlobalStylesUI;


;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles/index.js



;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles-sidebar/default-sidebar.js



const { ComplementaryArea, ComplementaryAreaMoreMenuItem } = unlock(external_wp_editor_namespaceObject.privateApis);
function DefaultSidebar({
  className,
  identifier,
  title,
  icon,
  children,
  closeLabel,
  header,
  headerClassName,
  panelClassName,
  isActiveByDefault
}) {
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
    /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
      ComplementaryArea,
      {
        className,
        scope: "core",
        identifier,
        title,
        icon,
        closeLabel,
        header,
        headerClassName,
        panelClassName,
        isActiveByDefault,
        children
      }
    ),
    /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
      ComplementaryAreaMoreMenuItem,
      {
        scope: "core",
        identifier,
        icon,
        children: title
      }
    )
  ] });
}


;// ./node_modules/@wordpress/edit-site/build-module/components/global-styles-sidebar/index.js
















const { interfaceStore: global_styles_sidebar_interfaceStore } = unlock(external_wp_editor_namespaceObject.privateApis);
const { useLocation: global_styles_sidebar_useLocation } = unlock(external_wp_router_namespaceObject.privateApis);
function GlobalStylesSidebar() {
  const { query } = global_styles_sidebar_useLocation();
  const { canvas = "view", name } = query;
  const {
    shouldClearCanvasContainerView,
    isStyleBookOpened,
    showListViewByDefault,
    hasRevisions,
    isRevisionsOpened,
    isRevisionsStyleBookOpened
  } = (0,external_wp_data_.useSelect)(
    (select) => {
      const { getActiveComplementaryArea: getActiveComplementaryArea2 } = select(global_styles_sidebar_interfaceStore);
      const { getEditorCanvasContainerView } = unlock(
        select(store)
      );
      const canvasContainerView = getEditorCanvasContainerView();
      const _isVisualEditorMode = "visual" === select(external_wp_editor_namespaceObject.store).getEditorMode();
      const _isEditCanvasMode = "edit" === canvas;
      const _showListViewByDefault = select(external_wp_preferences_.store).get(
        "core",
        "showListViewByDefault"
      );
      const { getEntityRecord, __experimentalGetCurrentGlobalStylesId } = select(external_wp_coreData_namespaceObject.store);
      const globalStylesId = __experimentalGetCurrentGlobalStylesId();
      const globalStyles = globalStylesId ? getEntityRecord("root", "globalStyles", globalStylesId) : void 0;
      return {
        isStyleBookOpened: "style-book" === canvasContainerView,
        shouldClearCanvasContainerView: "edit-site/global-styles" !== getActiveComplementaryArea2("core") || !_isVisualEditorMode || !_isEditCanvasMode,
        showListViewByDefault: _showListViewByDefault,
        hasRevisions: !!globalStyles?._links?.["version-history"]?.[0]?.count,
        isRevisionsStyleBookOpened: "global-styles-revisions:style-book" === canvasContainerView,
        isRevisionsOpened: "global-styles-revisions" === canvasContainerView
      };
    },
    [canvas]
  );
  const { setEditorCanvasContainerView } = unlock(
    (0,external_wp_data_.useDispatch)(store)
  );
  const isMobileViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)("medium", "<");
  (0,external_wp_element_.useEffect)(() => {
    if (shouldClearCanvasContainerView) {
      setEditorCanvasContainerView(void 0);
    }
  }, [shouldClearCanvasContainerView, setEditorCanvasContainerView]);
  const { setIsListViewOpened } = (0,external_wp_data_.useDispatch)(external_wp_editor_namespaceObject.store);
  const toggleRevisions = () => {
    setIsListViewOpened(false);
    if (isRevisionsStyleBookOpened) {
      setEditorCanvasContainerView("style-book");
      return;
    }
    if (isRevisionsOpened) {
      setEditorCanvasContainerView(void 0);
      return;
    }
    if (isStyleBookOpened) {
      setEditorCanvasContainerView(
        "global-styles-revisions:style-book"
      );
    } else {
      setEditorCanvasContainerView("global-styles-revisions");
    }
  };
  const toggleStyleBook = () => {
    if (isRevisionsOpened) {
      setEditorCanvasContainerView(
        "global-styles-revisions:style-book"
      );
      return;
    }
    if (isRevisionsStyleBookOpened) {
      setEditorCanvasContainerView("global-styles-revisions");
      return;
    }
    setIsListViewOpened(isStyleBookOpened && showListViewByDefault);
    setEditorCanvasContainerView(
      isStyleBookOpened ? void 0 : "style-book"
    );
  };
  const { getActiveComplementaryArea } = (0,external_wp_data_.useSelect)(global_styles_sidebar_interfaceStore);
  const { enableComplementaryArea } = (0,external_wp_data_.useDispatch)(global_styles_sidebar_interfaceStore);
  const previousActiveAreaRef = (0,external_wp_element_.useRef)(null);
  (0,external_wp_element_.useEffect)(() => {
    if (name === "styles" && canvas === "edit") {
      previousActiveAreaRef.current = getActiveComplementaryArea("core");
      enableComplementaryArea("core", "edit-site/global-styles");
    } else if (previousActiveAreaRef.current) {
      enableComplementaryArea("core", previousActiveAreaRef.current);
    }
  }, [name, enableComplementaryArea, canvas, getActiveComplementaryArea]);
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    DefaultSidebar,
    {
      className: "edit-site-global-styles-sidebar",
      identifier: "edit-site/global-styles",
      title: (0,external_wp_i18n_namespaceObject.__)("Styles"),
      icon: styles_default,
      closeLabel: (0,external_wp_i18n_namespaceObject.__)("Close Styles"),
      panelClassName: "edit-site-global-styles-sidebar__panel",
      header: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
        external_wp_components_namespaceObject.Flex,
        {
          className: "edit-site-global-styles-sidebar__header",
          gap: 1,
          children: [
            /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("h2", { className: "edit-site-global-styles-sidebar__header-title", children: (0,external_wp_i18n_namespaceObject.__)("Styles") }) }),
            /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
              external_wp_components_namespaceObject.Flex,
              {
                justify: "flex-end",
                gap: 1,
                className: "edit-site-global-styles-sidebar__header-actions",
                children: [
                  !isMobileViewport && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
                    external_wp_components_namespaceObject.Button,
                    {
                      icon: seen_default,
                      label: (0,external_wp_i18n_namespaceObject.__)("Style Book"),
                      isPressed: isStyleBookOpened || isRevisionsStyleBookOpened,
                      accessibleWhenDisabled: true,
                      disabled: shouldClearCanvasContainerView,
                      onClick: toggleStyleBook,
                      size: "compact"
                    }
                  ) }),
                  /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
                    external_wp_components_namespaceObject.Button,
                    {
                      label: (0,external_wp_i18n_namespaceObject.__)("Revisions"),
                      icon: backup_default,
                      onClick: toggleRevisions,
                      accessibleWhenDisabled: true,
                      disabled: !hasRevisions,
                      isPressed: isRevisionsOpened || isRevisionsStyleBookOpened,
                      size: "compact"
                    }
                  ) }),
                  /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesMenuSlot, {})
                ]
              }
            )
          ]
        }
      ),
      children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ui_default, {})
    }
  );
}


;// ./node_modules/@wordpress/icons/build-module/library/download.js


var download_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M18 11.3l-1-1.1-4 4V3h-1.5v11.3L7 10.2l-1 1.1 6.2 5.8 5.8-5.8zm.5 3.7v3.5h-13V15H4v5h16v-5h-1.5z" }) });


;// external ["wp","blob"]
const external_wp_blob_namespaceObject = window["wp"]["blob"];
;// ./node_modules/@wordpress/edit-site/build-module/components/more-menu/site-export.js









function SiteExport() {
  const canExport = (0,external_wp_data_.useSelect)((select) => {
    const targetHints = select(external_wp_coreData_namespaceObject.store).getCurrentTheme()?._links?.["wp:export-theme"]?.[0]?.targetHints ?? {};
    return !!targetHints.allow?.includes("GET");
  }, []);
  const { createErrorNotice } = (0,external_wp_data_.useDispatch)(external_wp_notices_namespaceObject.store);
  if (!canExport) {
    return null;
  }
  async function handleExport() {
    try {
      const response = await external_wp_apiFetch_default()({
        path: "/wp-block-editor/v1/export",
        parse: false,
        headers: {
          Accept: "application/zip"
        }
      });
      const blob = await response.blob();
      const contentDisposition = response.headers.get(
        "content-disposition"
      );
      const contentDispositionMatches = contentDisposition.match(/=(.+)\.zip/);
      const fileName = contentDispositionMatches[1] ? contentDispositionMatches[1] : "edit-site-export";
      (0,external_wp_blob_namespaceObject.downloadBlob)(fileName + ".zip", blob, "application/zip");
    } catch (errorResponse) {
      let error = {};
      try {
        error = await errorResponse.json();
      } catch (e) {
      }
      const errorMessage = error.message && error.code !== "unknown_error" ? error.message : (0,external_wp_i18n_namespaceObject.__)("An error occurred while creating the site export.");
      createErrorNotice(errorMessage, { type: "snackbar" });
    }
  }
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    external_wp_components_namespaceObject.MenuItem,
    {
      role: "menuitem",
      icon: download_default,
      onClick: handleExport,
      info: (0,external_wp_i18n_namespaceObject.__)(
        "Download your theme with updated templates and styles."
      ),
      children: (0,external_wp_i18n_namespaceObject._x)("Export", "site exporter menu item")
    }
  );
}


;// ./node_modules/@wordpress/edit-site/build-module/components/more-menu/welcome-guide-menu-item.js





function WelcomeGuideMenuItem() {
  const { toggle } = (0,external_wp_data_.useDispatch)(external_wp_preferences_.store);
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { onClick: () => toggle("core/edit-site", "welcomeGuide"), children: (0,external_wp_i18n_namespaceObject.__)("Welcome Guide") });
}


;// ./node_modules/@wordpress/edit-site/build-module/components/more-menu/index.js





const { ToolsMoreMenuGroup, PreferencesModal } = unlock(external_wp_editor_namespaceObject.privateApis);
function MoreMenu() {
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
    /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(ToolsMoreMenuGroup, { children: [
      /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SiteExport, {}),
      /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(WelcomeGuideMenuItem, {})
    ] }),
    /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PreferencesModal, {})
  ] });
}


;// ./node_modules/@wordpress/edit-site/build-module/components/block-editor/use-editor-iframe-props.js









const { useLocation: use_editor_iframe_props_useLocation, useHistory: use_editor_iframe_props_useHistory } = unlock(external_wp_router_namespaceObject.privateApis);
function useEditorIframeProps() {
  const { query, path } = use_editor_iframe_props_useLocation();
  const history = use_editor_iframe_props_useHistory();
  const { canvas = "view" } = query;
  const currentPostIsTrashed = (0,external_wp_data_.useSelect)((select) => {
    return select(external_wp_editor_namespaceObject.store).getCurrentPostAttribute("status") === "trash";
  }, []);
  const [isFocused, setIsFocused] = (0,external_wp_element_.useState)(false);
  (0,external_wp_element_.useEffect)(() => {
    if (canvas === "edit") {
      setIsFocused(false);
    }
  }, [canvas]);
  const viewModeIframeProps = {
    "aria-label": (0,external_wp_i18n_namespaceObject.__)("Edit"),
    "aria-disabled": currentPostIsTrashed,
    title: null,
    role: "button",
    tabIndex: 0,
    onFocus: () => setIsFocused(true),
    onBlur: () => setIsFocused(false),
    onKeyDown: (event) => {
      const { keyCode } = event;
      if ((keyCode === external_wp_keycodes_namespaceObject.ENTER || keyCode === external_wp_keycodes_namespaceObject.SPACE) && !currentPostIsTrashed) {
        event.preventDefault();
        history.navigate((0,external_wp_url_namespaceObject.addQueryArgs)(path, { canvas: "edit" }), {
          transition: "canvas-mode-edit-transition"
        });
      }
    },
    onClick: () => history.navigate((0,external_wp_url_namespaceObject.addQueryArgs)(path, { canvas: "edit" }), {
      transition: "canvas-mode-edit-transition"
    }),
    onClickCapture: (event) => {
      if (currentPostIsTrashed) {
        event.preventDefault();
        event.stopPropagation();
      }
    },
    readonly: true
  };
  return {
    className: dist_clsx("edit-site-visual-editor__editor-canvas", {
      "is-focused": isFocused && canvas === "view"
    }),
    ...canvas === "view" ? viewModeIframeProps : {}
  };
}


;// ./node_modules/@wordpress/edit-site/build-module/components/routes/use-title.js








const { useLocation: use_title_useLocation } = unlock(external_wp_router_namespaceObject.privateApis);
function useTitle(title) {
  const location = use_title_useLocation();
  const siteTitle = (0,external_wp_data_.useSelect)(
    (select) => select(external_wp_coreData_namespaceObject.store).getEntityRecord("root", "site")?.title,
    []
  );
  const isInitialLocationRef = (0,external_wp_element_.useRef)(true);
  (0,external_wp_element_.useEffect)(() => {
    isInitialLocationRef.current = false;
  }, [location]);
  (0,external_wp_element_.useEffect)(() => {
    if (isInitialLocationRef.current) {
      return;
    }
    if (title && siteTitle) {
      const formattedTitle = (0,external_wp_i18n_namespaceObject.sprintf)(
        /* translators: Admin document title. 1: Admin screen name, 2: Network or site name. */
        (0,external_wp_i18n_namespaceObject.__)("%1$s \u2039 %2$s \u2039 Editor \u2014 WordPress"),
        (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(title),
        (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(siteTitle)
      );
      document.title = formattedTitle;
      (0,external_wp_a11y_namespaceObject.speak)(title, "assertive");
    }
  }, [title, siteTitle, location]);
}


;// ./node_modules/@wordpress/edit-site/build-module/components/editor/use-editor-title.js








const { getTemplateInfo } = unlock(external_wp_editor_namespaceObject.privateApis);
function useEditorTitle(postType, postId) {
  const { title, isLoaded } = (0,external_wp_data_.useSelect)(
    (select) => {
      const {
        getEditedEntityRecord,
        getCurrentTheme,
        hasFinishedResolution
      } = select(external_wp_coreData_namespaceObject.store);
      if (!postId) {
        return { isLoaded: false };
      }
      const _record = getEditedEntityRecord(
        "postType",
        postType,
        postId
      );
      const { default_template_types: templateTypes = [] } = getCurrentTheme() ?? {};
      const templateInfo = getTemplateInfo({
        template: _record,
        templateTypes
      });
      const _isLoaded = hasFinishedResolution("getEditedEntityRecord", [
        "postType",
        postType,
        postId
      ]);
      return {
        title: templateInfo.title,
        isLoaded: _isLoaded
      };
    },
    [postType, postId]
  );
  let editorTitle;
  if (isLoaded) {
    editorTitle = (0,external_wp_i18n_namespaceObject.sprintf)(
      // translators: A breadcrumb trail for the Admin document title. 1: title of template being edited, 2: type of template (Template or Template Part).
      (0,external_wp_i18n_namespaceObject._x)("%1$s \u2039 %2$s", "breadcrumb trail"),
      (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(title),
      POST_TYPE_LABELS[postType] ?? POST_TYPE_LABELS[TEMPLATE_POST_TYPE]
    );
  }
  useTitle(isLoaded && editorTitle);
}
var use_editor_title_default = useEditorTitle;


;// ./node_modules/@wordpress/edit-site/build-module/components/editor/use-adapt-editor-to-canvas.js





function useAdaptEditorToCanvas(canvas) {
  const { clearSelectedBlock } = (0,external_wp_data_.useDispatch)(external_wp_blockEditor_namespaceObject.store);
  const {
    setDeviceType,
    closePublishSidebar,
    setIsListViewOpened,
    setIsInserterOpened
  } = (0,external_wp_data_.useDispatch)(external_wp_editor_namespaceObject.store);
  const { get: getPreference } = (0,external_wp_data_.useSelect)(external_wp_preferences_.store);
  const registry = (0,external_wp_data_.useRegistry)();
  (0,external_wp_element_.useLayoutEffect)(() => {
    const isMediumOrBigger = window.matchMedia("(min-width: 782px)").matches;
    registry.batch(() => {
      clearSelectedBlock();
      setDeviceType("Desktop");
      closePublishSidebar();
      setIsInserterOpened(false);
      if (isMediumOrBigger && canvas === "edit" && getPreference("core", "showListViewByDefault") && !getPreference("core", "distractionFree")) {
        setIsListViewOpened(true);
      } else {
        setIsListViewOpened(false);
      }
    });
  }, [
    canvas,
    registry,
    clearSelectedBlock,
    setDeviceType,
    closePublishSidebar,
    setIsInserterOpened,
    setIsListViewOpened,
    getPreference
  ]);
}


;// ./node_modules/@wordpress/edit-site/build-module/components/editor/use-resolve-edited-entity.js







const { useLocation: use_resolve_edited_entity_useLocation } = unlock(external_wp_router_namespaceObject.privateApis);
const postTypesWithoutParentTemplate = [
  TEMPLATE_POST_TYPE,
  TEMPLATE_PART_POST_TYPE,
  NAVIGATION_POST_TYPE,
  PATTERN_TYPES.user
];
const authorizedPostTypes = ["page", "post"];
function useResolveEditedEntity() {
  const { name, params = {}, query } = use_resolve_edited_entity_useLocation();
  const { postId = query?.postId } = params;
  let postType;
  if (name === "navigation-item") {
    postType = NAVIGATION_POST_TYPE;
  } else if (name === "pattern-item") {
    postType = PATTERN_TYPES.user;
  } else if (name === "template-part-item") {
    postType = TEMPLATE_PART_POST_TYPE;
  } else if (name === "template-item" || name === "templates") {
    postType = TEMPLATE_POST_TYPE;
  } else if (name === "page-item" || name === "pages") {
    postType = "page";
  } else if (name === "post-item" || name === "posts") {
    postType = "post";
  }
  const homePage = (0,external_wp_data_.useSelect)((select) => {
    const { getHomePage } = unlock(select(external_wp_coreData_namespaceObject.store));
    return getHomePage();
  }, []);
  const resolvedTemplateId = (0,external_wp_data_.useSelect)(
    (select) => {
      if (postTypesWithoutParentTemplate.includes(postType) && postId) {
        return;
      }
      if (postId && postId.includes(",")) {
        return;
      }
      const { getTemplateId } = unlock(select(external_wp_coreData_namespaceObject.store));
      if (postType && postId && authorizedPostTypes.includes(postType)) {
        return getTemplateId(postType, postId);
      }
      if (homePage?.postType === "page") {
        return getTemplateId("page", homePage?.postId);
      }
      if (homePage?.postType === "wp_template") {
        return homePage?.postId;
      }
    },
    [homePage, postId, postType]
  );
  const context = (0,external_wp_element_.useMemo)(() => {
    if (postTypesWithoutParentTemplate.includes(postType) && postId) {
      return {};
    }
    if (postType && postId && authorizedPostTypes.includes(postType)) {
      return { postType, postId };
    }
    if (homePage?.postType === "page") {
      return { postType: "page", postId: homePage?.postId };
    }
    return {};
  }, [homePage, postType, postId]);
  if (postTypesWithoutParentTemplate.includes(postType) && postId) {
    return { isReady: true, postType, postId, context };
  }
  if (!!homePage) {
    return {
      isReady: resolvedTemplateId !== void 0,
      postType: TEMPLATE_POST_TYPE,
      postId: resolvedTemplateId,
      context
    };
  }
  return { isReady: false };
}
function useSyncDeprecatedEntityIntoState({
  postType,
  postId,
  context,
  isReady
}) {
  const { setEditedEntity } = (0,external_wp_data_.useDispatch)(store);
  (0,external_wp_element_.useEffect)(() => {
    if (isReady) {
      setEditedEntity(postType, postId, context);
    }
  }, [isReady, postType, postId, context, setEditedEntity]);
}


;// ./node_modules/@wordpress/edit-site/build-module/components/editor/site-preview.js






function SitePreview() {
  const siteUrl = (0,external_wp_data_.useSelect)((select) => {
    const { getEntityRecord } = select(external_wp_coreData_namespaceObject.store);
    const siteData = getEntityRecord("root", "__unstableBase");
    return siteData?.home;
  }, []);
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    "iframe",
    {
      src: (0,external_wp_url_namespaceObject.addQueryArgs)(siteUrl, {
        // Parameter for hiding the admin bar.
        wp_site_preview: 1
      }),
      title: (0,external_wp_i18n_namespaceObject.__)("Site Preview"),
      style: {
        display: "block",
        width: "100%",
        height: "100%",
        backgroundColor: "#fff"
      },
      onLoad: (event) => {
        const document = event.target.contentDocument;
        const focusableElements = external_wp_dom_namespaceObject.focus.focusable.find(document);
        focusableElements.forEach((element) => {
          element.style.pointerEvents = "none";
          element.tabIndex = -1;
          element.setAttribute("aria-hidden", "true");
        });
      }
    }
  );
}


;// ./node_modules/@wordpress/edit-site/build-module/components/editor/index.js





































const { Editor, BackButton } = unlock(external_wp_editor_namespaceObject.privateApis);
const { useHistory: editor_useHistory, useLocation: editor_useLocation } = unlock(external_wp_router_namespaceObject.privateApis);
const { BlockKeyboardShortcuts } = unlock(external_wp_blockLibrary_namespaceObject.privateApis);
const toggleHomeIconVariants = {
  edit: {
    opacity: 0,
    scale: 0.2
  },
  hover: {
    opacity: 1,
    scale: 1,
    clipPath: "inset( 22% round 2px )"
  }
};
const siteIconVariants = {
  edit: {
    clipPath: "inset(0% round 0px)"
  },
  hover: {
    clipPath: "inset( 22% round 2px )"
  },
  tap: {
    clipPath: "inset(0% round 0px)"
  }
};
function getListPathForPostType(postType) {
  switch (postType) {
    case "navigation":
      return "/navigation";
    case "wp_block":
      return "/pattern?postType=wp_block";
    case "wp_template_part":
      return "/pattern?postType=wp_template_part";
    case "wp_template":
      return "/template";
    case "page":
      return "/page";
    case "post":
      return "/";
  }
  throw "Unknown post type";
}
function getNavigationPath(location, postType) {
  const { path, name } = location;
  if ([
    "pattern-item",
    "template-part-item",
    "page-item",
    "template-item",
    "post-item"
  ].includes(name)) {
    return getListPathForPostType(postType);
  }
  return (0,external_wp_url_namespaceObject.addQueryArgs)(path, { canvas: void 0 });
}
function EditSiteEditor({
  isHomeRoute = false,
  isPostsList = false
}) {
  const disableMotion = (0,external_wp_compose_namespaceObject.useReducedMotion)();
  const location = editor_useLocation();
  const { canvas = "view" } = location.query;
  const isLoading = useIsSiteEditorLoading();
  useAdaptEditorToCanvas(canvas);
  const entity = useResolveEditedEntity();
  useSyncDeprecatedEntityIntoState(entity);
  const { postType, postId, context } = entity;
  const {
    isBlockBasedTheme,
    editorCanvasView,
    currentPostIsTrashed,
    hasSiteIcon
  } = (0,external_wp_data_.useSelect)((select) => {
    const { getEditorCanvasContainerView } = unlock(
      select(store)
    );
    const { getCurrentTheme, getEntityRecord } = select(external_wp_coreData_namespaceObject.store);
    const siteData = getEntityRecord("root", "__unstableBase", void 0);
    return {
      isBlockBasedTheme: getCurrentTheme()?.is_block_theme,
      editorCanvasView: getEditorCanvasContainerView(),
      currentPostIsTrashed: select(external_wp_editor_namespaceObject.store).getCurrentPostAttribute("status") === "trash",
      hasSiteIcon: !!siteData?.site_icon_url
    };
  }, []);
  const postWithTemplate = !!context?.postId;
  use_editor_title_default(
    postWithTemplate ? context.postType : postType,
    postWithTemplate ? context.postId : postId
  );
  const _isPreviewingTheme = isPreviewingTheme();
  const hasDefaultEditorCanvasView = !useHasEditorCanvasContainer();
  const iframeProps = useEditorIframeProps();
  const isEditMode = canvas === "edit";
  const loadingProgressId = (0,external_wp_compose_namespaceObject.useInstanceId)(
    CanvasLoader,
    "edit-site-editor__loading-progress"
  );
  const settings = useSpecificEditorSettings();
  const styles = (0,external_wp_element_.useMemo)(
    () => [
      ...settings.styles,
      {
        // Forming a "block formatting context" to prevent margin collapsing.
        // @see https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Block_formatting_context
        css: canvas === "view" ? `body{min-height: 100vh; ${currentPostIsTrashed ? "" : "cursor: pointer;"}}` : void 0
      }
    ],
    [settings.styles, canvas, currentPostIsTrashed]
  );
  const { resetZoomLevel } = unlock((0,external_wp_data_.useDispatch)(external_wp_blockEditor_namespaceObject.store));
  const { createSuccessNotice } = (0,external_wp_data_.useDispatch)(external_wp_notices_namespaceObject.store);
  const history = editor_useHistory();
  const onActionPerformed = (0,external_wp_element_.useCallback)(
    (actionId, items) => {
      switch (actionId) {
        case "move-to-trash":
        case "delete-post":
          {
            history.navigate(
              getListPathForPostType(
                postWithTemplate ? context.postType : postType
              )
            );
          }
          break;
        case "duplicate-post":
          {
            const newItem = items[0];
            const _title = typeof newItem.title === "string" ? newItem.title : newItem.title?.rendered;
            createSuccessNotice(
              (0,external_wp_i18n_namespaceObject.sprintf)(
                // translators: %s: Title of the created post or template, e.g: "Hello world".
                (0,external_wp_i18n_namespaceObject.__)('"%s" successfully created.'),
                (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(_title) || (0,external_wp_i18n_namespaceObject.__)("(no title)")
              ),
              {
                type: "snackbar",
                id: "duplicate-post-action",
                actions: [
                  {
                    label: (0,external_wp_i18n_namespaceObject.__)("Edit"),
                    onClick: () => {
                      history.navigate(
                        `/${newItem.type}/${newItem.id}?canvas=edit`
                      );
                    }
                  }
                ]
              }
            );
          }
          break;
      }
    },
    [
      postType,
      context?.postType,
      postWithTemplate,
      history,
      createSuccessNotice
    ]
  );
  const title = getEditorCanvasContainerTitle(editorCanvasView);
  const isReady = !isLoading;
  const transition = {
    duration: disableMotion ? 0 : 0.2
  };
  return !isBlockBasedTheme && isHomeRoute ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SitePreview, {}) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
    /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
      GlobalStylesRenderer,
      {
        disableRootPadding: postType !== TEMPLATE_POST_TYPE
      }
    ),
    /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_editor_namespaceObject.EditorKeyboardShortcutsRegister, {}),
    isEditMode && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockKeyboardShortcuts, {}),
    !isReady ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(CanvasLoader, { id: loadingProgressId }) : null,
    isEditMode && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
      WelcomeGuide,
      {
        postType: postWithTemplate ? context.postType : postType
      }
    ),
    isReady && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
      Editor,
      {
        postType: postWithTemplate ? context.postType : postType,
        postId: postWithTemplate ? context.postId : postId,
        templateId: postWithTemplate ? postId : void 0,
        settings,
        className: "edit-site-editor__editor-interface",
        styles,
        customSaveButton: _isPreviewingTheme && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SaveButton, { size: "compact" }),
        customSavePanel: _isPreviewingTheme && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SavePanel, {}),
        forceDisableBlockTools: !hasDefaultEditorCanvasView,
        title,
        iframeProps,
        onActionPerformed,
        extraSidebarPanels: !postWithTemplate && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(plugin_template_setting_panel_default.Slot, {}),
        children: [
          isEditMode && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(BackButton, { children: ({ length }) => length <= 1 && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
            external_wp_components_namespaceObject.__unstableMotion.div,
            {
              className: "edit-site-editor__view-mode-toggle",
              transition,
              animate: "edit",
              initial: "edit",
              whileHover: "hover",
              whileTap: "tap",
              children: [
                /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
                  external_wp_components_namespaceObject.Button,
                  {
                    __next40pxDefaultSize: true,
                    label: (0,external_wp_i18n_namespaceObject.__)("Open Navigation"),
                    showTooltip: true,
                    tooltipPosition: "middle right",
                    onClick: () => {
                      resetZoomLevel();
                      if (isPostsList && location.query?.focusMode) {
                        history.navigate("/", {
                          transition: "canvas-mode-view-transition"
                        });
                      } else {
                        history.navigate(
                          getNavigationPath(
                            location,
                            postWithTemplate ? context.postType : postType
                          ),
                          {
                            transition: "canvas-mode-view-transition"
                          }
                        );
                      }
                    },
                    children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
                      external_wp_components_namespaceObject.__unstableMotion.div,
                      {
                        variants: siteIconVariants,
                        children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(site_icon_default, { className: "edit-site-editor__view-mode-toggle-icon" })
                      }
                    )
                  }
                ),
                /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
                  external_wp_components_namespaceObject.__unstableMotion.div,
                  {
                    className: dist_clsx(
                      "edit-site-editor__back-icon",
                      {
                        "has-site-icon": hasSiteIcon
                      }
                    ),
                    variants: toggleHomeIconVariants,
                    children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(icon_default, { icon: arrow_up_left_default })
                  }
                )
              ]
            }
          ) }),
          /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(MoreMenu, {}),
          isBlockBasedTheme && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesSidebar, {})
        ]
      }
    )
  ] });
}


;// ./node_modules/@wordpress/edit-site/build-module/components/site-editor-routes/utils.js
function isClassicThemeWithStyleBookSupport(siteData) {
  const isBlockTheme = siteData.currentTheme?.is_block_theme;
  const supportsEditorStyles = siteData.currentTheme?.theme_supports["editor-styles"];
  const hasThemeJson = siteData.editorSettings?.supportsLayout;
  return !isBlockTheme && (supportsEditorStyles || hasThemeJson);
}


;// ./node_modules/@wordpress/edit-site/build-module/components/site-editor-routes/home.js





const homeRoute = {
  name: "home",
  path: "/",
  areas: {
    sidebar({ siteData }) {
      const isBlockTheme = siteData.currentTheme?.is_block_theme;
      return isBlockTheme || isClassicThemeWithStyleBookSupport(siteData) ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenMain, {}) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenUnsupported, {});
    },
    preview({ siteData }) {
      const isBlockTheme = siteData.currentTheme?.is_block_theme;
      return isBlockTheme || isClassicThemeWithStyleBookSupport(siteData) ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, { isHomeRoute: true }) : void 0;
    },
    mobile({ siteData }) {
      const isBlockTheme = siteData.currentTheme?.is_block_theme;
      return isBlockTheme || isClassicThemeWithStyleBookSupport(siteData) ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenMain, {}) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenUnsupported, {});
    }
  }
};


;// ./node_modules/@wordpress/edit-site/build-module/components/site-editor-routes/styles.js







const { useLocation: styles_useLocation } = unlock(external_wp_router_namespaceObject.privateApis);
function MobileGlobalStylesUI() {
  const { query = {} } = styles_useLocation();
  const { canvas } = query;
  if (canvas === "edit") {
    return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {});
  }
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesUIWrapper, {});
}
const stylesRoute = {
  name: "styles",
  path: "/styles",
  areas: {
    content: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesUIWrapper, {}),
    sidebar: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenGlobalStyles, { backPath: "/" }),
    preview({ query }) {
      const isStylebook = query.preview === "stylebook";
      return isStylebook ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(StyleBookPreview, {}) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {});
    },
    mobile: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(MobileGlobalStylesUI, {})
  },
  widths: {
    content: 380
  }
};


;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-navigation-menus/constants.js
const PRELOADED_NAVIGATION_MENUS_QUERY = {
  per_page: 100,
  status: ["publish", "draft"],
  order: "desc",
  orderby: "date"
};


;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-navigation-menu/rename-modal.js




const notEmptyString = (testString) => testString?.trim()?.length > 0;
function RenameModal({ menuTitle, onClose, onSave }) {
  const [editedMenuTitle, setEditedMenuTitle] = (0,external_wp_element_.useState)(menuTitle);
  const titleHasChanged = editedMenuTitle !== menuTitle;
  const isEditedMenuTitleValid = titleHasChanged && notEmptyString(editedMenuTitle);
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    external_wp_components_namespaceObject.Modal,
    {
      title: (0,external_wp_i18n_namespaceObject.__)("Rename"),
      onRequestClose: onClose,
      focusOnMount: "firstContentElement",
      size: "small",
      children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("form", { className: "sidebar-navigation__rename-modal-form", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: "3", children: [
        /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
          external_wp_components_namespaceObject.TextControl,
          {
            __nextHasNoMarginBottom: true,
            __next40pxDefaultSize: true,
            value: editedMenuTitle,
            placeholder: (0,external_wp_i18n_namespaceObject.__)("Navigation title"),
            onChange: setEditedMenuTitle,
            label: (0,external_wp_i18n_namespaceObject.__)("Name")
          }
        ),
        /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "right", children: [
          /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
            external_wp_components_namespaceObject.Button,
            {
              __next40pxDefaultSize: true,
              variant: "tertiary",
              onClick: onClose,
              children: (0,external_wp_i18n_namespaceObject.__)("Cancel")
            }
          ),
          /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
            external_wp_components_namespaceObject.Button,
            {
              __next40pxDefaultSize: true,
              accessibleWhenDisabled: true,
              disabled: !isEditedMenuTitleValid,
              variant: "primary",
              type: "submit",
              onClick: (e) => {
                e.preventDefault();
                if (!isEditedMenuTitleValid) {
                  return;
                }
                onSave({ title: editedMenuTitle });
                onClose();
              },
              children: (0,external_wp_i18n_namespaceObject.__)("Save")
            }
          )
        ] })
      ] }) })
    }
  );
}


;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-navigation-menu/delete-confirm-dialog.js



function DeleteConfirmDialog({ onClose, onConfirm }) {
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    external_wp_components_namespaceObject.__experimentalConfirmDialog,
    {
      isOpen: true,
      onConfirm: () => {
        onConfirm();
        onClose();
      },
      onCancel: onClose,
      confirmButtonText: (0,external_wp_i18n_namespaceObject.__)("Delete"),
      size: "medium",
      children: (0,external_wp_i18n_namespaceObject.__)("Are you sure you want to delete this Navigation Menu?")
    }
  );
}


;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-navigation-menu/more-menu.js









const { useHistory: more_menu_useHistory } = unlock(external_wp_router_namespaceObject.privateApis);
const POPOVER_PROPS = {
  position: "bottom right"
};
function ScreenNavigationMoreMenu(props) {
  const { onDelete, onSave, onDuplicate, menuTitle, menuId } = props;
  const [renameModalOpen, setRenameModalOpen] = (0,external_wp_element_.useState)(false);
  const [deleteConfirmDialogOpen, setDeleteConfirmDialogOpen] = (0,external_wp_element_.useState)(false);
  const history = more_menu_useHistory();
  const closeModals = () => {
    setRenameModalOpen(false);
    setDeleteConfirmDialogOpen(false);
  };
  const openRenameModal = () => setRenameModalOpen(true);
  const openDeleteConfirmDialog = () => setDeleteConfirmDialogOpen(true);
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
    /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
      external_wp_components_namespaceObject.DropdownMenu,
      {
        className: "sidebar-navigation__more-menu",
        label: (0,external_wp_i18n_namespaceObject.__)("Actions"),
        icon: more_vertical_default,
        popoverProps: POPOVER_PROPS,
        children: ({ onClose }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.MenuGroup, { children: [
          /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
            external_wp_components_namespaceObject.MenuItem,
            {
              onClick: () => {
                openRenameModal();
                onClose();
              },
              children: (0,external_wp_i18n_namespaceObject.__)("Rename")
            }
          ),
          /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
            external_wp_components_namespaceObject.MenuItem,
            {
              onClick: () => {
                history.navigate(
                  `/wp_navigation/${menuId}?canvas=edit`
                );
              },
              children: (0,external_wp_i18n_namespaceObject.__)("Edit")
            }
          ),
          /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
            external_wp_components_namespaceObject.MenuItem,
            {
              onClick: () => {
                onDuplicate();
                onClose();
              },
              children: (0,external_wp_i18n_namespaceObject.__)("Duplicate")
            }
          ),
          /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
            external_wp_components_namespaceObject.MenuItem,
            {
              isDestructive: true,
              onClick: () => {
                openDeleteConfirmDialog();
                onClose();
              },
              children: (0,external_wp_i18n_namespaceObject.__)("Delete")
            }
          )
        ] })
      }
    ),
    deleteConfirmDialogOpen && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
      DeleteConfirmDialog,
      {
        onClose: closeModals,
        onConfirm: onDelete
      }
    ),
    renameModalOpen && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
      RenameModal,
      {
        onClose: closeModals,
        menuTitle,
        onSave
      }
    )
  ] });
}


;// ./node_modules/@wordpress/icons/build-module/library/chevron-up.js


var chevron_up_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M6.5 12.4L12 8l5.5 4.4-.9 1.2L12 10l-4.5 3.6-1-1.2z" }) });


;// ./node_modules/@wordpress/icons/build-module/library/chevron-down.js


var chevron_down_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M17.5 11.6L12 16l-5.5-4.4.9-1.2L12 14l4.5-3.6 1 1.2z" }) });


;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js








const leaf_more_menu_POPOVER_PROPS = {
  className: "block-editor-block-settings-menu__popover",
  placement: "bottom-start"
};

const { useHistory: leaf_more_menu_useHistory, useLocation: leaf_more_menu_useLocation } = unlock(external_wp_router_namespaceObject.privateApis);
function LeafMoreMenu(props) {
  const history = leaf_more_menu_useHistory();
  const { path } = leaf_more_menu_useLocation();
  const { block } = props;
  const { clientId } = block;
  const { moveBlocksDown, moveBlocksUp, removeBlocks } = (0,external_wp_data_.useDispatch)(external_wp_blockEditor_namespaceObject.store);
  const removeLabel = (0,external_wp_i18n_namespaceObject.sprintf)(
    /* translators: %s: block name */
    (0,external_wp_i18n_namespaceObject.__)("Remove %s"),
    (0,external_wp_blockEditor_namespaceObject.BlockTitle)({ clientId, maximumLength: 25 })
  );
  const goToLabel = (0,external_wp_i18n_namespaceObject.sprintf)(
    /* translators: %s: block name */
    (0,external_wp_i18n_namespaceObject.__)("Go to %s"),
    (0,external_wp_blockEditor_namespaceObject.BlockTitle)({ clientId, maximumLength: 25 })
  );
  const rootClientId = (0,external_wp_data_.useSelect)(
    (select) => {
      const { getBlockRootClientId } = select(external_wp_blockEditor_namespaceObject.store);
      return getBlockRootClientId(clientId);
    },
    [clientId]
  );
  const onGoToPage = (0,external_wp_element_.useCallback)(
    (selectedBlock) => {
      const { attributes, name } = selectedBlock;
      if (attributes.kind === "post-type" && attributes.id && attributes.type && history) {
        history.navigate(
          `/${attributes.type}/${attributes.id}?canvas=edit`,
          {
            state: { backPath: path }
          }
        );
      }
      if (name === "core/page-list-item" && attributes.id && history) {
        history.navigate(`/page/${attributes.id}?canvas=edit`, {
          state: { backPath: path }
        });
      }
    },
    [path, history]
  );
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    external_wp_components_namespaceObject.DropdownMenu,
    {
      icon: more_vertical_default,
      label: (0,external_wp_i18n_namespaceObject.__)("Options"),
      className: "block-editor-block-settings-menu",
      popoverProps: leaf_more_menu_POPOVER_PROPS,
      noIcons: true,
      ...props,
      children: ({ onClose }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
        /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.MenuGroup, { children: [
          /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
            external_wp_components_namespaceObject.MenuItem,
            {
              icon: chevron_up_default,
              onClick: () => {
                moveBlocksUp([clientId], rootClientId);
                onClose();
              },
              children: (0,external_wp_i18n_namespaceObject.__)("Move up")
            }
          ),
          /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
            external_wp_components_namespaceObject.MenuItem,
            {
              icon: chevron_down_default,
              onClick: () => {
                moveBlocksDown([clientId], rootClientId);
                onClose();
              },
              children: (0,external_wp_i18n_namespaceObject.__)("Move down")
            }
          ),
          block.attributes?.type === "page" && block.attributes?.id && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
            external_wp_components_namespaceObject.MenuItem,
            {
              onClick: () => {
                onGoToPage(block);
                onClose();
              },
              children: goToLabel
            }
          )
        ] }),
        /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuGroup, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
          external_wp_components_namespaceObject.MenuItem,
          {
            onClick: () => {
              removeBlocks([clientId], false);
              onClose();
            },
            children: removeLabel
          }
        ) })
      ] })
    }
  );
}


;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js








const { PrivateListView } = unlock(external_wp_blockEditor_namespaceObject.privateApis);
const MAX_PAGE_COUNT = 100;
const PAGES_QUERY = [
  "postType",
  "page",
  {
    per_page: MAX_PAGE_COUNT,
    _fields: ["id", "link", "menu_order", "parent", "title", "type"],
    // TODO: When https://core.trac.wordpress.org/ticket/39037 REST API support for multiple orderby
    // values is resolved, update 'orderby' to [ 'menu_order', 'post_title' ] to provide a consistent
    // sort.
    orderby: "menu_order",
    order: "asc"
  }
];
function NavigationMenuContent({ rootClientId }) {
  const { listViewRootClientId, isLoading } = (0,external_wp_data_.useSelect)(
    (select) => {
      const {
        areInnerBlocksControlled,
        getBlockName,
        getBlockCount,
        getBlockOrder
      } = select(external_wp_blockEditor_namespaceObject.store);
      const { isResolving } = select(external_wp_coreData_namespaceObject.store);
      const blockClientIds = getBlockOrder(rootClientId);
      const hasOnlyPageListBlock = blockClientIds.length === 1 && getBlockName(blockClientIds[0]) === "core/page-list";
      const pageListHasBlocks = hasOnlyPageListBlock && getBlockCount(blockClientIds[0]) > 0;
      const isLoadingPages = isResolving(
        "getEntityRecords",
        PAGES_QUERY
      );
      return {
        listViewRootClientId: pageListHasBlocks ? blockClientIds[0] : rootClientId,
        // This is a small hack to wait for the navigation block
        // to actually load its inner blocks.
        isLoading: !areInnerBlocksControlled(rootClientId) || isLoadingPages
      };
    },
    [rootClientId]
  );
  const { replaceBlock, __unstableMarkNextChangeAsNotPersistent } = (0,external_wp_data_.useDispatch)(external_wp_blockEditor_namespaceObject.store);
  const offCanvasOnselect = (0,external_wp_element_.useCallback)(
    (block) => {
      if (block.name === "core/navigation-link" && !block.attributes.url) {
        __unstableMarkNextChangeAsNotPersistent();
        replaceBlock(
          block.clientId,
          (0,external_wp_blocks_namespaceObject.createBlock)("core/navigation-link", block.attributes)
        );
      }
    },
    [__unstableMarkNextChangeAsNotPersistent, replaceBlock]
  );
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
    !isLoading && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
      PrivateListView,
      {
        rootClientId: listViewRootClientId,
        onSelect: offCanvasOnselect,
        blockSettingsMenu: LeafMoreMenu,
        showAppender: false,
        isExpanded: true
      }
    ),
    /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "edit-site-sidebar-navigation-screen-navigation-menus__helper-block-editor", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockList, {}) })
  ] });
}


;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-navigation-menu/navigation-menu-editor.js








const navigation_menu_editor_noop = () => {
};
function NavigationMenuEditor({ navigationMenuId }) {
  const { storedSettings } = (0,external_wp_data_.useSelect)((select) => {
    const { getSettings } = unlock(select(store));
    return {
      storedSettings: getSettings()
    };
  }, []);
  const blocks = (0,external_wp_element_.useMemo)(() => {
    if (!navigationMenuId) {
      return [];
    }
    return [(0,external_wp_blocks_namespaceObject.createBlock)("core/navigation", { ref: navigationMenuId })];
  }, [navigationMenuId]);
  if (!navigationMenuId || !blocks?.length) {
    return null;
  }
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    external_wp_blockEditor_namespaceObject.BlockEditorProvider,
    {
      settings: storedSettings,
      value: blocks,
      onChange: navigation_menu_editor_noop,
      onInput: navigation_menu_editor_noop,
      children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "edit-site-sidebar-navigation-screen-navigation-menus__content", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigationMenuContent, { rootClientId: blocks[0].clientId }) })
    }
  );
}


;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-navigation-menus/build-navigation-label.js


function buildNavigationLabel(title, id, status) {
  if (!title?.rendered) {
    return (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)("(no title %s)"), id);
  }
  if (status === "publish") {
    return (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(title?.rendered);
  }
  return (0,external_wp_i18n_namespaceObject.sprintf)(
    // translators: 1: title of the menu. 2: status of the menu (draft, pending, etc.).
    (0,external_wp_i18n_namespaceObject._x)("%1$s (%2$s)", "menu label"),
    (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(title?.rendered),
    status
  );
}


;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js







function SingleNavigationMenu({
  navigationMenu,
  backPath,
  handleDelete,
  handleDuplicate,
  handleSave
}) {
  const menuTitle = navigationMenu?.title?.rendered;
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    SidebarNavigationScreenWrapper,
    {
      actions: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
        ScreenNavigationMoreMenu,
        {
          menuId: navigationMenu?.id,
          menuTitle: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(menuTitle),
          onDelete: handleDelete,
          onSave: handleSave,
          onDuplicate: handleDuplicate
        }
      ) }),
      backPath,
      title: buildNavigationLabel(
        navigationMenu?.title,
        navigationMenu?.id,
        navigationMenu?.status
      ),
      description: (0,external_wp_i18n_namespaceObject.__)(
        "Navigation Menus are a curated collection of blocks that allow visitors to get around your site."
      ),
      children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigationMenuEditor, { navigationMenuId: navigationMenu?.id })
    }
  );
}


;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-navigation-menu/index.js













const { useLocation: sidebar_navigation_screen_navigation_menu_useLocation } = unlock(external_wp_router_namespaceObject.privateApis);
const postType = `wp_navigation`;
function SidebarNavigationScreenNavigationMenu({ backPath }) {
  const {
    params: { postId }
  } = sidebar_navigation_screen_navigation_menu_useLocation();
  const { record: navigationMenu, isResolving } = (0,external_wp_coreData_namespaceObject.useEntityRecord)(
    "postType",
    postType,
    postId
  );
  const { isSaving, isDeleting } = (0,external_wp_data_.useSelect)(
    (select) => {
      const { isSavingEntityRecord, isDeletingEntityRecord } = select(external_wp_coreData_namespaceObject.store);
      return {
        isSaving: isSavingEntityRecord("postType", postType, postId),
        isDeleting: isDeletingEntityRecord(
          "postType",
          postType,
          postId
        )
      };
    },
    [postId]
  );
  const isLoading = isResolving || isSaving || isDeleting;
  const menuTitle = navigationMenu?.title?.rendered || navigationMenu?.slug;
  const { handleSave, handleDelete, handleDuplicate } = useNavigationMenuHandlers();
  const _handleDelete = () => handleDelete(navigationMenu);
  const _handleSave = (edits) => handleSave(navigationMenu, edits);
  const _handleDuplicate = () => handleDuplicate(navigationMenu);
  if (isLoading) {
    return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
      SidebarNavigationScreenWrapper,
      {
        description: (0,external_wp_i18n_namespaceObject.__)(
          "Navigation Menus are a curated collection of blocks that allow visitors to get around your site."
        ),
        backPath,
        children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, { className: "edit-site-sidebar-navigation-screen-navigation-menus__loading" })
      }
    );
  }
  if (!isLoading && !navigationMenu) {
    return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
      SidebarNavigationScreenWrapper,
      {
        description: (0,external_wp_i18n_namespaceObject.__)("Navigation Menu missing."),
        backPath
      }
    );
  }
  if (!navigationMenu?.content?.raw) {
    return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
      SidebarNavigationScreenWrapper,
      {
        actions: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
          ScreenNavigationMoreMenu,
          {
            menuId: navigationMenu?.id,
            menuTitle: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(menuTitle),
            onDelete: _handleDelete,
            onSave: _handleSave,
            onDuplicate: _handleDuplicate
          }
        ),
        backPath,
        title: buildNavigationLabel(
          navigationMenu?.title,
          navigationMenu?.id,
          navigationMenu?.status
        ),
        description: (0,external_wp_i18n_namespaceObject.__)("This Navigation Menu is empty.")
      }
    );
  }
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    SingleNavigationMenu,
    {
      navigationMenu,
      backPath,
      handleDelete: _handleDelete,
      handleSave: _handleSave,
      handleDuplicate: _handleDuplicate
    }
  );
}


;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js








const { useHistory: use_navigation_menu_handlers_useHistory } = unlock(external_wp_router_namespaceObject.privateApis);
function useDeleteNavigationMenu() {
  const { deleteEntityRecord } = (0,external_wp_data_.useDispatch)(external_wp_coreData_namespaceObject.store);
  const { createSuccessNotice, createErrorNotice } = (0,external_wp_data_.useDispatch)(external_wp_notices_namespaceObject.store);
  const history = use_navigation_menu_handlers_useHistory();
  const handleDelete = async (navigationMenu) => {
    const postId = navigationMenu?.id;
    try {
      await deleteEntityRecord(
        "postType",
        postType,
        postId,
        {
          force: true
        },
        {
          throwOnError: true
        }
      );
      createSuccessNotice(
        (0,external_wp_i18n_namespaceObject.__)("Navigation Menu successfully deleted."),
        {
          type: "snackbar"
        }
      );
      history.navigate("/navigation");
    } catch (error) {
      createErrorNotice(
        (0,external_wp_i18n_namespaceObject.sprintf)(
          /* translators: %s: error message describing why the navigation menu could not be deleted. */
          (0,external_wp_i18n_namespaceObject.__)(`Unable to delete Navigation Menu (%s).`),
          error?.message
        ),
        {
          type: "snackbar"
        }
      );
    }
  };
  return handleDelete;
}
function useSaveNavigationMenu() {
  const { getEditedEntityRecord } = (0,external_wp_data_.useSelect)((select) => {
    const { getEditedEntityRecord: getEditedEntityRecordSelector } = select(external_wp_coreData_namespaceObject.store);
    return {
      getEditedEntityRecord: getEditedEntityRecordSelector
    };
  }, []);
  const {
    editEntityRecord,
    __experimentalSaveSpecifiedEntityEdits: saveSpecifiedEntityEdits
  } = (0,external_wp_data_.useDispatch)(external_wp_coreData_namespaceObject.store);
  const { createSuccessNotice, createErrorNotice } = (0,external_wp_data_.useDispatch)(external_wp_notices_namespaceObject.store);
  const handleSave = async (navigationMenu, edits) => {
    if (!edits) {
      return;
    }
    const postId = navigationMenu?.id;
    const originalRecord = getEditedEntityRecord(
      "postType",
      NAVIGATION_POST_TYPE,
      postId
    );
    editEntityRecord("postType", postType, postId, edits);
    const recordPropertiesToSave = Object.keys(edits);
    try {
      await saveSpecifiedEntityEdits(
        "postType",
        postType,
        postId,
        recordPropertiesToSave,
        {
          throwOnError: true
        }
      );
      createSuccessNotice((0,external_wp_i18n_namespaceObject.__)("Renamed Navigation Menu"), {
        type: "snackbar"
      });
    } catch (error) {
      editEntityRecord("postType", postType, postId, originalRecord);
      createErrorNotice(
        (0,external_wp_i18n_namespaceObject.sprintf)(
          /* translators: %s: error message describing why the navigation menu could not be renamed. */
          (0,external_wp_i18n_namespaceObject.__)(`Unable to rename Navigation Menu (%s).`),
          error?.message
        ),
        {
          type: "snackbar"
        }
      );
    }
  };
  return handleSave;
}
function useDuplicateNavigationMenu() {
  const history = use_navigation_menu_handlers_useHistory();
  const { saveEntityRecord } = (0,external_wp_data_.useDispatch)(external_wp_coreData_namespaceObject.store);
  const { createSuccessNotice, createErrorNotice } = (0,external_wp_data_.useDispatch)(external_wp_notices_namespaceObject.store);
  const handleDuplicate = async (navigationMenu) => {
    const menuTitle = navigationMenu?.title?.rendered || navigationMenu?.slug;
    try {
      const savedRecord = await saveEntityRecord(
        "postType",
        postType,
        {
          title: (0,external_wp_i18n_namespaceObject.sprintf)(
            /* translators: %s: Navigation menu title */
            (0,external_wp_i18n_namespaceObject._x)("%s (Copy)", "navigation menu"),
            menuTitle
          ),
          content: navigationMenu?.content?.raw,
          status: "publish"
        },
        {
          throwOnError: true
        }
      );
      if (savedRecord) {
        createSuccessNotice((0,external_wp_i18n_namespaceObject.__)("Duplicated Navigation Menu"), {
          type: "snackbar"
        });
        history.navigate(`/wp_navigation/${savedRecord.id}`);
      }
    } catch (error) {
      createErrorNotice(
        (0,external_wp_i18n_namespaceObject.sprintf)(
          /* translators: %s: error message describing why the navigation menu could not be deleted. */
          (0,external_wp_i18n_namespaceObject.__)(`Unable to duplicate Navigation Menu (%s).`),
          error?.message
        ),
        {
          type: "snackbar"
        }
      );
    }
  };
  return handleDuplicate;
}
function useNavigationMenuHandlers() {
  return {
    handleDelete: useDeleteNavigationMenu(),
    handleSave: useSaveNavigationMenu(),
    handleDuplicate: useDuplicateNavigationMenu()
  };
}


;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-navigation-menus/index.js














function buildMenuLabel(title, id, status) {
  if (!title) {
    return (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)("(no title %s)"), id);
  }
  if (status === "publish") {
    return (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(title);
  }
  return (0,external_wp_i18n_namespaceObject.sprintf)(
    // translators: 1: title of the menu. 2: status of the menu (draft, pending, etc.).
    (0,external_wp_i18n_namespaceObject._x)("%1$s (%2$s)", "menu label"),
    (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(title),
    status
  );
}
function SidebarNavigationScreenNavigationMenus({ backPath }) {
  const {
    records: navigationMenus,
    isResolving: isResolvingNavigationMenus,
    hasResolved: hasResolvedNavigationMenus
  } = (0,external_wp_coreData_namespaceObject.useEntityRecords)(
    "postType",
    NAVIGATION_POST_TYPE,
    PRELOADED_NAVIGATION_MENUS_QUERY
  );
  const isLoading = isResolvingNavigationMenus && !hasResolvedNavigationMenus;
  const { getNavigationFallbackId } = unlock((0,external_wp_data_.useSelect)(external_wp_coreData_namespaceObject.store));
  const isCreatingNavigationFallback = (0,external_wp_data_.useSelect)(
    (select) => select(external_wp_coreData_namespaceObject.store).isResolving("getNavigationFallbackId"),
    []
  );
  const firstNavigationMenu = navigationMenus?.[0];
  if (!firstNavigationMenu && !isResolvingNavigationMenus && hasResolvedNavigationMenus && // Ensure a fallback navigation is created only once
  !isCreatingNavigationFallback) {
    getNavigationFallbackId();
  }
  const { handleSave, handleDelete, handleDuplicate } = useNavigationMenuHandlers();
  const hasNavigationMenus = !!navigationMenus?.length;
  if (isLoading) {
    return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenWrapper, { backPath, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, { className: "edit-site-sidebar-navigation-screen-navigation-menus__loading" }) });
  }
  if (!isLoading && !hasNavigationMenus) {
    return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
      SidebarNavigationScreenWrapper,
      {
        description: (0,external_wp_i18n_namespaceObject.__)("No Navigation Menus found."),
        backPath
      }
    );
  }
  if (navigationMenus?.length === 1) {
    return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
      SingleNavigationMenu,
      {
        navigationMenu: firstNavigationMenu,
        backPath,
        handleDelete: () => handleDelete(firstNavigationMenu),
        handleDuplicate: () => handleDuplicate(firstNavigationMenu),
        handleSave: (edits) => handleSave(firstNavigationMenu, edits)
      }
    );
  }
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenWrapper, { backPath, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItemGroup, { className: "edit-site-sidebar-navigation-screen-navigation-menus", children: navigationMenus?.map(({ id, title, status }, index) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    NavMenuItem,
    {
      postId: id,
      withChevron: true,
      icon: navigation_default,
      children: buildMenuLabel(title?.rendered, index + 1, status)
    },
    id
  )) }) });
}
function SidebarNavigationScreenWrapper({
  children,
  actions,
  title,
  description,
  backPath
}) {
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    SidebarNavigationScreen,
    {
      title: title || (0,external_wp_i18n_namespaceObject.__)("Navigation"),
      actions,
      description: description || (0,external_wp_i18n_namespaceObject.__)("Manage your Navigation Menus."),
      backPath,
      content: children
    }
  );
}
const NavMenuItem = ({ postId, ...props }) => {
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    SidebarNavigationItem,
    {
      to: `/wp_navigation/${postId}`,
      ...props
    }
  );
};


;// ./node_modules/@wordpress/edit-site/build-module/components/site-editor-routes/navigation.js






const { useLocation: navigation_useLocation } = unlock(external_wp_router_namespaceObject.privateApis);
function MobileNavigationView() {
  const { query = {} } = navigation_useLocation();
  const { canvas = "view" } = query;
  return canvas === "edit" ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {}) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenNavigationMenus, { backPath: "/" });
}
const navigationRoute = {
  name: "navigation",
  path: "/navigation",
  areas: {
    sidebar({ siteData }) {
      const isBlockTheme = siteData.currentTheme?.is_block_theme;
      return isBlockTheme ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenNavigationMenus, { backPath: "/" }) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenUnsupported, {});
    },
    preview({ siteData }) {
      const isBlockTheme = siteData.currentTheme?.is_block_theme;
      return isBlockTheme ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {}) : void 0;
    },
    mobile({ siteData }) {
      const isBlockTheme = siteData.currentTheme?.is_block_theme;
      return isBlockTheme ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(MobileNavigationView, {}) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenUnsupported, {});
    }
  }
};


;// ./node_modules/@wordpress/edit-site/build-module/components/site-editor-routes/navigation-item.js






const { useLocation: navigation_item_useLocation } = unlock(external_wp_router_namespaceObject.privateApis);
function MobileNavigationItemView() {
  const { query = {} } = navigation_item_useLocation();
  const { canvas = "view" } = query;
  return canvas === "edit" ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {}) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenNavigationMenu, { backPath: "/navigation" });
}
const navigationItemRoute = {
  name: "navigation-item",
  path: "/wp_navigation/:postId",
  areas: {
    sidebar({ siteData }) {
      const isBlockTheme = siteData.currentTheme?.is_block_theme;
      return isBlockTheme ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenNavigationMenu, { backPath: "/navigation" }) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenUnsupported, {});
    },
    preview({ siteData }) {
      const isBlockTheme = siteData.currentTheme?.is_block_theme;
      return isBlockTheme ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {}) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenUnsupported, {});
    },
    mobile({ siteData }) {
      const isBlockTheme = siteData.currentTheme?.is_block_theme;
      return isBlockTheme ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(MobileNavigationItemView, {}) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenUnsupported, {});
    }
  }
};


;// ./node_modules/@wordpress/icons/build-module/library/file.js


var file_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
  external_wp_primitives_namespaceObject.Path,
  {
    fillRule: "evenodd",
    clipRule: "evenodd",
    d: "M12.848 8a1 1 0 0 1-.914-.594l-.723-1.63a.5.5 0 0 0-.447-.276H5a.5.5 0 0 0-.5.5v11.5a.5.5 0 0 0 .5.5h14a.5.5 0 0 0 .5-.5v-9A.5.5 0 0 0 19 8h-6.152Zm.612-1.5a.5.5 0 0 1-.462-.31l-.445-1.084A2 2 0 0 0 10.763 4H5a2 2 0 0 0-2 2v11.5a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-9a2 2 0 0 0-2-2h-5.54Z"
  }
) });


;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-patterns/category-item.js


function CategoryItem({
  count,
  icon,
  id,
  isActive,
  label,
  type
}) {
  if (!count) {
    return;
  }
  const queryArgs = [`postType=${type}`];
  if (id) {
    queryArgs.push(`categoryId=${id}`);
  }
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    SidebarNavigationItem,
    {
      icon,
      suffix: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { children: count }),
      "aria-current": isActive ? "true" : void 0,
      to: `/pattern?${queryArgs.join("&")}`,
      children: label
    }
  );
}


;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-patterns/use-default-pattern-categories.js




function useDefaultPatternCategories() {
  const blockPatternCategories = (0,external_wp_data_.useSelect)((select) => {
    const { getSettings } = unlock(select(store));
    const settings = getSettings();
    return settings.__experimentalAdditionalBlockPatternCategories ?? settings.__experimentalBlockPatternCategories;
  });
  const restBlockPatternCategories = (0,external_wp_data_.useSelect)(
    (select) => select(external_wp_coreData_namespaceObject.store).getBlockPatternCategories()
  );
  return [
    ...blockPatternCategories || [],
    ...restBlockPatternCategories || []
  ];
}


;// ./node_modules/@wordpress/edit-site/build-module/components/page-patterns/utils.js
const filterOutDuplicatesByName = (currentItem, index, items) => index === items.findIndex((item) => currentItem.name === item.name);


;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-patterns/use-theme-patterns.js







function useThemePatterns() {
  const blockPatterns = (0,external_wp_data_.useSelect)((select) => {
    const { getSettings } = unlock(select(store));
    return getSettings().__experimentalAdditionalBlockPatterns ?? getSettings().__experimentalBlockPatterns;
  });
  const restBlockPatterns = (0,external_wp_data_.useSelect)(
    (select) => select(external_wp_coreData_namespaceObject.store).getBlockPatterns()
  );
  const patterns = (0,external_wp_element_.useMemo)(
    () => [...blockPatterns || [], ...restBlockPatterns || []].filter(
      (pattern) => !EXCLUDED_PATTERN_SOURCES.includes(pattern.source)
    ).filter(filterOutDuplicatesByName).filter((pattern) => pattern.inserter !== false),
    [blockPatterns, restBlockPatterns]
  );
  return patterns;
}


;// ./node_modules/@wordpress/edit-site/build-module/components/page-patterns/search-items.js


const { extractWords, getNormalizedSearchTerms, normalizeString } = unlock(
  external_wp_blockEditor_namespaceObject.privateApis
);

const defaultGetName = (item) => {
  if (item.type === PATTERN_TYPES.user) {
    return item.slug;
  }
  if (item.type === TEMPLATE_PART_POST_TYPE) {
    return "";
  }
  return item.name || "";
};
const defaultGetTitle = (item) => {
  if (typeof item.title === "string") {
    return item.title;
  }
  if (item.title && item.title.rendered) {
    return item.title.rendered;
  }
  if (item.title && item.title.raw) {
    return item.title.raw;
  }
  return "";
};
const defaultGetDescription = (item) => {
  if (item.type === PATTERN_TYPES.user) {
    return item.excerpt.raw;
  }
  return item.description || "";
};
const defaultGetKeywords = (item) => item.keywords || [];
const defaultHasCategory = () => false;
const removeMatchingTerms = (unmatchedTerms, unprocessedTerms) => {
  return unmatchedTerms.filter(
    (term) => !getNormalizedSearchTerms(unprocessedTerms).some(
      (unprocessedTerm) => unprocessedTerm.includes(term)
    )
  );
};
const searchItems = (items = [], searchInput = "", config = {}) => {
  const normalizedSearchTerms = getNormalizedSearchTerms(searchInput);
  const onlyFilterByCategory = config.categoryId !== PATTERN_DEFAULT_CATEGORY && !normalizedSearchTerms.length;
  const searchRankConfig = { ...config, onlyFilterByCategory };
  const threshold = onlyFilterByCategory ? 0 : 1;
  const rankedItems = items.map((item) => {
    return [
      item,
      getItemSearchRank(item, searchInput, searchRankConfig)
    ];
  }).filter(([, rank]) => rank > threshold);
  if (normalizedSearchTerms.length === 0) {
    return rankedItems.map(([item]) => item);
  }
  rankedItems.sort(([, rank1], [, rank2]) => rank2 - rank1);
  return rankedItems.map(([item]) => item);
};
function getItemSearchRank(item, searchTerm, config) {
  const {
    categoryId,
    getName = defaultGetName,
    getTitle = defaultGetTitle,
    getDescription = defaultGetDescription,
    getKeywords = defaultGetKeywords,
    hasCategory = defaultHasCategory,
    onlyFilterByCategory
  } = config;
  let rank = categoryId === PATTERN_DEFAULT_CATEGORY || categoryId === TEMPLATE_PART_ALL_AREAS_CATEGORY || categoryId === PATTERN_USER_CATEGORY && item.type === PATTERN_TYPES.user || hasCategory(item, categoryId) ? 1 : 0;
  if (!rank || onlyFilterByCategory) {
    return rank;
  }
  const name = getName(item);
  const title = getTitle(item);
  const description = getDescription(item);
  const keywords = getKeywords(item);
  const normalizedSearchInput = normalizeString(searchTerm);
  const normalizedTitle = normalizeString(title);
  if (normalizedSearchInput === normalizedTitle) {
    rank += 30;
  } else if (normalizedTitle.startsWith(normalizedSearchInput)) {
    rank += 20;
  } else {
    const terms = [name, title, description, ...keywords].join(" ");
    const normalizedSearchTerms = extractWords(normalizedSearchInput);
    const unmatchedTerms = removeMatchingTerms(
      normalizedSearchTerms,
      terms
    );
    if (unmatchedTerms.length === 0) {
      rank += 10;
    }
  }
  return rank;
}


;// ./node_modules/@wordpress/edit-site/build-module/components/page-patterns/use-patterns.js









const EMPTY_PATTERN_LIST = [];
const selectTemplateParts = (0,external_wp_data_.createSelector)(
  (select, categoryId, search = "") => {
    const {
      getEntityRecords,
      getCurrentTheme,
      isResolving: isResolvingSelector
    } = select(external_wp_coreData_namespaceObject.store);
    const query = { per_page: -1 };
    const templateParts = getEntityRecords("postType", TEMPLATE_PART_POST_TYPE, query) ?? EMPTY_PATTERN_LIST;
    const knownAreas = getCurrentTheme()?.default_template_part_areas || [];
    const templatePartAreas = knownAreas.map((area) => area.area);
    const templatePartHasCategory = (item, category) => {
      if (category !== TEMPLATE_PART_AREA_DEFAULT_CATEGORY) {
        return item.area === category;
      }
      return item.area === category || !templatePartAreas.includes(item.area);
    };
    const isResolving = isResolvingSelector("getEntityRecords", [
      "postType",
      TEMPLATE_PART_POST_TYPE,
      query
    ]);
    const patterns = searchItems(templateParts, search, {
      categoryId,
      hasCategory: templatePartHasCategory
    });
    return { patterns, isResolving };
  },
  (select) => [
    select(external_wp_coreData_namespaceObject.store).getEntityRecords(
      "postType",
      TEMPLATE_PART_POST_TYPE,
      {
        per_page: -1
      }
    ),
    select(external_wp_coreData_namespaceObject.store).isResolving("getEntityRecords", [
      "postType",
      TEMPLATE_PART_POST_TYPE,
      { per_page: -1 }
    ]),
    select(external_wp_coreData_namespaceObject.store).getCurrentTheme()?.default_template_part_areas
  ]
);
const selectThemePatterns = (0,external_wp_data_.createSelector)(
  (select) => {
    const { getSettings } = unlock(select(store));
    const { isResolving: isResolvingSelector } = select(external_wp_coreData_namespaceObject.store);
    const settings = getSettings();
    const blockPatterns = settings.__experimentalAdditionalBlockPatterns ?? settings.__experimentalBlockPatterns;
    const restBlockPatterns = select(external_wp_coreData_namespaceObject.store).getBlockPatterns();
    const patterns = [
      ...blockPatterns || [],
      ...restBlockPatterns || []
    ].filter(
      (pattern) => !EXCLUDED_PATTERN_SOURCES.includes(pattern.source)
    ).filter(filterOutDuplicatesByName).filter((pattern) => pattern.inserter !== false).map((pattern) => ({
      ...pattern,
      keywords: pattern.keywords || [],
      type: PATTERN_TYPES.theme,
      blocks: (0,external_wp_blocks_namespaceObject.parse)(pattern.content, {
        __unstableSkipMigrationLogs: true
      })
    }));
    return {
      patterns,
      isResolving: isResolvingSelector("getBlockPatterns")
    };
  },
  (select) => [
    select(external_wp_coreData_namespaceObject.store).getBlockPatterns(),
    select(external_wp_coreData_namespaceObject.store).isResolving("getBlockPatterns"),
    unlock(select(store)).getSettings()
  ]
);
const selectPatterns = (0,external_wp_data_.createSelector)(
  (select, categoryId, syncStatus, search = "") => {
    const {
      patterns: themePatterns,
      isResolving: isResolvingThemePatterns
    } = selectThemePatterns(select);
    const {
      patterns: userPatterns,
      isResolving: isResolvingUserPatterns,
      categories: userPatternCategories
    } = selectUserPatterns(select);
    let patterns = [
      ...themePatterns || [],
      ...userPatterns || []
    ];
    if (syncStatus) {
      patterns = patterns.filter((pattern) => {
        return pattern.type === PATTERN_TYPES.user ? (pattern.wp_pattern_sync_status || PATTERN_SYNC_TYPES.full) === syncStatus : syncStatus === PATTERN_SYNC_TYPES.unsynced;
      });
    }
    if (categoryId) {
      patterns = searchItems(patterns, search, {
        categoryId,
        hasCategory: (item, currentCategory) => {
          if (item.type === PATTERN_TYPES.user) {
            return item.wp_pattern_category?.some(
              (catId) => userPatternCategories.find(
                (cat) => cat.id === catId
              )?.slug === currentCategory
            );
          }
          return item.categories?.includes(currentCategory);
        }
      });
    } else {
      patterns = searchItems(patterns, search, {
        hasCategory: (item) => {
          if (item.type === PATTERN_TYPES.user) {
            return userPatternCategories?.length && (!item.wp_pattern_category?.length || !item.wp_pattern_category?.some(
              (catId) => userPatternCategories.find(
                (cat) => cat.id === catId
              )
            ));
          }
          return !item.hasOwnProperty("categories");
        }
      });
    }
    return {
      patterns,
      isResolving: isResolvingThemePatterns || isResolvingUserPatterns
    };
  },
  (select) => [
    selectThemePatterns(select),
    selectUserPatterns(select)
  ]
);
const selectUserPatterns = (0,external_wp_data_.createSelector)(
  (select, syncStatus, search = "") => {
    const {
      getEntityRecords,
      isResolving: isResolvingSelector,
      getUserPatternCategories
    } = select(external_wp_coreData_namespaceObject.store);
    const query = { per_page: -1 };
    const patternPosts = getEntityRecords(
      "postType",
      PATTERN_TYPES.user,
      query
    );
    const userPatternCategories = getUserPatternCategories();
    const categories = /* @__PURE__ */ new Map();
    userPatternCategories.forEach(
      (userCategory) => categories.set(userCategory.id, userCategory)
    );
    let patterns = patternPosts ?? EMPTY_PATTERN_LIST;
    const isResolving = isResolvingSelector("getEntityRecords", [
      "postType",
      PATTERN_TYPES.user,
      query
    ]);
    if (syncStatus) {
      patterns = patterns.filter(
        (pattern) => pattern.wp_pattern_sync_status || PATTERN_SYNC_TYPES.full === syncStatus
      );
    }
    patterns = searchItems(patterns, search, {
      // We exit user pattern retrieval early if we aren't in the
      // catch-all category for user created patterns, so it has
      // to be in the category.
      hasCategory: () => true
    });
    return {
      patterns,
      isResolving,
      categories: userPatternCategories
    };
  },
  (select) => [
    select(external_wp_coreData_namespaceObject.store).getEntityRecords("postType", PATTERN_TYPES.user, {
      per_page: -1
    }),
    select(external_wp_coreData_namespaceObject.store).isResolving("getEntityRecords", [
      "postType",
      PATTERN_TYPES.user,
      { per_page: -1 }
    ]),
    select(external_wp_coreData_namespaceObject.store).getUserPatternCategories()
  ]
);
function useAugmentPatternsWithPermissions(patterns) {
  const idsAndTypes = (0,external_wp_element_.useMemo)(
    () => patterns?.filter((record) => record.type !== PATTERN_TYPES.theme).map((record) => [record.type, record.id]) ?? [],
    [patterns]
  );
  const permissions = (0,external_wp_data_.useSelect)(
    (select) => {
      const { getEntityRecordPermissions } = unlock(
        select(external_wp_coreData_namespaceObject.store)
      );
      return idsAndTypes.reduce((acc, [type, id]) => {
        acc[id] = getEntityRecordPermissions("postType", type, id);
        return acc;
      }, {});
    },
    [idsAndTypes]
  );
  return (0,external_wp_element_.useMemo)(
    () => patterns?.map((record) => ({
      ...record,
      permissions: permissions?.[record.id] ?? {}
    })) ?? [],
    [patterns, permissions]
  );
}
const usePatterns = (postType, categoryId, { search = "", syncStatus } = {}) => {
  return (0,external_wp_data_.useSelect)(
    (select) => {
      if (postType === TEMPLATE_PART_POST_TYPE) {
        return selectTemplateParts(select, categoryId, search);
      } else if (postType === PATTERN_TYPES.user && !!categoryId) {
        const appliedCategory = categoryId === "uncategorized" ? "" : categoryId;
        return selectPatterns(
          select,
          appliedCategory,
          syncStatus,
          search
        );
      } else if (postType === PATTERN_TYPES.user) {
        return selectUserPatterns(select, syncStatus, search);
      }
      return {
        patterns: EMPTY_PATTERN_LIST,
        isResolving: false
      };
    },
    [categoryId, postType, search, syncStatus]
  );
};
var use_patterns_default = usePatterns;


;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-patterns/use-pattern-categories.js






function usePatternCategories() {
  const defaultCategories = useDefaultPatternCategories();
  defaultCategories.push({
    name: TEMPLATE_PART_AREA_DEFAULT_CATEGORY,
    label: (0,external_wp_i18n_namespaceObject.__)("Uncategorized")
  });
  const themePatterns = useThemePatterns();
  const { patterns: userPatterns, categories: userPatternCategories } = use_patterns_default(PATTERN_TYPES.user);
  const patternCategories = (0,external_wp_element_.useMemo)(() => {
    const categoryMap = {};
    const categoriesWithCounts = [];
    defaultCategories.forEach((category) => {
      if (!categoryMap[category.name]) {
        categoryMap[category.name] = { ...category, count: 0 };
      }
    });
    userPatternCategories.forEach((category) => {
      if (!categoryMap[category.name]) {
        categoryMap[category.name] = { ...category, count: 0 };
      }
    });
    themePatterns.forEach((pattern) => {
      pattern.categories?.forEach((category) => {
        if (categoryMap[category]) {
          categoryMap[category].count += 1;
        }
      });
      if (!pattern.categories?.length) {
        categoryMap.uncategorized.count += 1;
      }
    });
    userPatterns.forEach((pattern) => {
      pattern.wp_pattern_category?.forEach((catId) => {
        const category = userPatternCategories.find(
          (cat) => cat.id === catId
        )?.name;
        if (categoryMap[category]) {
          categoryMap[category].count += 1;
        }
      });
      if (!pattern.wp_pattern_category?.length || !pattern.wp_pattern_category?.some(
        (catId) => userPatternCategories.find((cat) => cat.id === catId)
      )) {
        categoryMap.uncategorized.count += 1;
      }
    });
    [...defaultCategories, ...userPatternCategories].forEach(
      (category) => {
        if (categoryMap[category.name].count && !categoriesWithCounts.find(
          (cat) => cat.name === category.name
        )) {
          categoriesWithCounts.push(categoryMap[category.name]);
        }
      }
    );
    const sortedCategories = categoriesWithCounts.sort(
      (a, b) => a.label.localeCompare(b.label)
    );
    sortedCategories.unshift({
      name: PATTERN_USER_CATEGORY,
      label: (0,external_wp_i18n_namespaceObject.__)("My patterns"),
      count: userPatterns.length
    });
    sortedCategories.unshift({
      name: PATTERN_DEFAULT_CATEGORY,
      label: (0,external_wp_i18n_namespaceObject.__)("All patterns"),
      description: (0,external_wp_i18n_namespaceObject.__)("A list of all patterns from all sources."),
      count: themePatterns.length + userPatterns.length
    });
    return sortedCategories;
  }, [
    defaultCategories,
    themePatterns,
    userPatternCategories,
    userPatterns
  ]);
  return { patternCategories, hasPatterns: !!patternCategories.length };
}


;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-patterns/use-template-part-areas.js



const useTemplatePartsGroupedByArea = (items) => {
  const allItems = items || [];
  const templatePartAreas = (0,external_wp_data_.useSelect)(
    (select) => select(external_wp_coreData_namespaceObject.store).getCurrentTheme()?.default_template_part_areas || [],
    []
  );
  const knownAreas = {
    header: {},
    footer: {},
    sidebar: {},
    uncategorized: {}
  };
  templatePartAreas.forEach(
    (templatePartArea) => knownAreas[templatePartArea.area] = {
      ...templatePartArea,
      templateParts: []
    }
  );
  const groupedByArea = allItems.reduce((accumulator, item) => {
    const key = accumulator[item.area] ? item.area : TEMPLATE_PART_AREA_DEFAULT_CATEGORY;
    accumulator[key]?.templateParts?.push(item);
    return accumulator;
  }, knownAreas);
  return groupedByArea;
};
function useTemplatePartAreas() {
  const { records: templateParts, isResolving: isLoading } = (0,external_wp_coreData_namespaceObject.useEntityRecords)(
    "postType",
    TEMPLATE_PART_POST_TYPE,
    { per_page: -1 }
  );
  return {
    hasTemplateParts: templateParts ? !!templateParts.length : false,
    isLoading,
    templatePartAreas: useTemplatePartsGroupedByArea(templateParts)
  };
}


;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-patterns/index.js












const { useLocation: sidebar_navigation_screen_patterns_useLocation } = unlock(external_wp_router_namespaceObject.privateApis);
function CategoriesGroup({
  templatePartAreas,
  patternCategories,
  currentCategory,
  currentType
}) {
  const [allPatterns, ...otherPatterns] = patternCategories;
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalItemGroup, { className: "edit-site-sidebar-navigation-screen-patterns__group", children: [
    /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
      CategoryItem,
      {
        count: Object.values(templatePartAreas).map(({ templateParts }) => templateParts?.length || 0).reduce((acc, val) => acc + val, 0),
        icon: (0,external_wp_editor_namespaceObject.getTemplatePartIcon)(),
        label: (0,external_wp_i18n_namespaceObject.__)("All template parts"),
        id: TEMPLATE_PART_ALL_AREAS_CATEGORY,
        type: TEMPLATE_PART_POST_TYPE,
        isActive: currentCategory === TEMPLATE_PART_ALL_AREAS_CATEGORY && currentType === TEMPLATE_PART_POST_TYPE
      },
      "all"
    ),
    Object.entries(templatePartAreas).map(
      ([area, { label, templateParts }]) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
        CategoryItem,
        {
          count: templateParts?.length,
          icon: (0,external_wp_editor_namespaceObject.getTemplatePartIcon)(area),
          label,
          id: area,
          type: TEMPLATE_PART_POST_TYPE,
          isActive: currentCategory === area && currentType === TEMPLATE_PART_POST_TYPE
        },
        area
      )
    ),
    /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "edit-site-sidebar-navigation-screen-patterns__divider" }),
    allPatterns && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
      CategoryItem,
      {
        count: allPatterns.count,
        label: allPatterns.label,
        icon: file_default,
        id: allPatterns.name,
        type: PATTERN_TYPES.user,
        isActive: currentCategory === `${allPatterns.name}` && currentType === PATTERN_TYPES.user
      },
      allPatterns.name
    ),
    otherPatterns.map((category) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
      CategoryItem,
      {
        count: category.count,
        label: category.label,
        icon: file_default,
        id: category.name,
        type: PATTERN_TYPES.user,
        isActive: currentCategory === `${category.name}` && currentType === PATTERN_TYPES.user
      },
      category.name
    ))
  ] });
}
function SidebarNavigationScreenPatterns({ backPath }) {
  const {
    query: { postType = "wp_block", categoryId }
  } = sidebar_navigation_screen_patterns_useLocation();
  const currentCategory = categoryId || (postType === PATTERN_TYPES.user ? PATTERN_DEFAULT_CATEGORY : TEMPLATE_PART_ALL_AREAS_CATEGORY);
  const { templatePartAreas, hasTemplateParts, isLoading } = useTemplatePartAreas();
  const { patternCategories, hasPatterns } = usePatternCategories();
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    SidebarNavigationScreen,
    {
      title: (0,external_wp_i18n_namespaceObject.__)("Patterns"),
      description: (0,external_wp_i18n_namespaceObject.__)(
        "Manage what patterns are available when editing the site."
      ),
      isRoot: !backPath,
      backPath,
      content: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
        isLoading && (0,external_wp_i18n_namespaceObject.__)("Loading items\u2026"),
        !isLoading && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
          !hasTemplateParts && !hasPatterns && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItemGroup, { className: "edit-site-sidebar-navigation-screen-patterns__group", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItem, { children: (0,external_wp_i18n_namespaceObject.__)("No items found") }) }),
          /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
            CategoriesGroup,
            {
              templatePartAreas,
              patternCategories,
              currentCategory,
              currentType: postType
            }
          )
        ] })
      ] })
    }
  );
}


// EXTERNAL MODULE: ./node_modules/remove-accents/index.js
var remove_accents = __webpack_require__(9681);
var remove_accents_default = /*#__PURE__*/__webpack_require__.n(remove_accents);
;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/constants.js
/**
 * @module constants
 * @summary Useful constants
 * @description
 * Collection of useful date constants.
 *
 * The constants could be imported from `date-fns/constants`:
 *
 * ```ts
 * import { maxTime, minTime } from "./constants/date-fns/constants";
 *
 * function isAllowedTime(time) {
 *   return time <= maxTime && time >= minTime;
 * }
 * ```
 */

/**
 * @constant
 * @name daysInWeek
 * @summary Days in 1 week.
 */
const daysInWeek = 7;

/**
 * @constant
 * @name daysInYear
 * @summary Days in 1 year.
 *
 * @description
 * How many days in a year.
 *
 * One years equals 365.2425 days according to the formula:
 *
 * > Leap year occurs every 4 years, except for years that are divisible by 100 and not divisible by 400.
 * > 1 mean year = (365+1/4-1/100+1/400) days = 365.2425 days
 */
const daysInYear = 365.2425;

/**
 * @constant
 * @name maxTime
 * @summary Maximum allowed time.
 *
 * @example
 * import { maxTime } from "./constants/date-fns/constants";
 *
 * const isValid = 8640000000000001 <= maxTime;
 * //=> false
 *
 * new Date(8640000000000001);
 * //=> Invalid Date
 */
const maxTime = Math.pow(10, 8) * 24 * 60 * 60 * 1000;

/**
 * @constant
 * @name minTime
 * @summary Minimum allowed time.
 *
 * @example
 * import { minTime } from "./constants/date-fns/constants";
 *
 * const isValid = -8640000000000001 >= minTime;
 * //=> false
 *
 * new Date(-8640000000000001)
 * //=> Invalid Date
 */
const minTime = -maxTime;

/**
 * @constant
 * @name millisecondsInWeek
 * @summary Milliseconds in 1 week.
 */
const millisecondsInWeek = 604800000;

/**
 * @constant
 * @name millisecondsInDay
 * @summary Milliseconds in 1 day.
 */
const millisecondsInDay = 86400000;

/**
 * @constant
 * @name millisecondsInMinute
 * @summary Milliseconds in 1 minute
 */
const millisecondsInMinute = 60000;

/**
 * @constant
 * @name millisecondsInHour
 * @summary Milliseconds in 1 hour
 */
const millisecondsInHour = 3600000;

/**
 * @constant
 * @name millisecondsInSecond
 * @summary Milliseconds in 1 second
 */
const millisecondsInSecond = 1000;

/**
 * @constant
 * @name minutesInYear
 * @summary Minutes in 1 year.
 */
const minutesInYear = 525600;

/**
 * @constant
 * @name minutesInMonth
 * @summary Minutes in 1 month.
 */
const minutesInMonth = 43200;

/**
 * @constant
 * @name minutesInDay
 * @summary Minutes in 1 day.
 */
const minutesInDay = 1440;

/**
 * @constant
 * @name minutesInHour
 * @summary Minutes in 1 hour.
 */
const minutesInHour = 60;

/**
 * @constant
 * @name monthsInQuarter
 * @summary Months in 1 quarter.
 */
const monthsInQuarter = 3;

/**
 * @constant
 * @name monthsInYear
 * @summary Months in 1 year.
 */
const monthsInYear = 12;

/**
 * @constant
 * @name quartersInYear
 * @summary Quarters in 1 year
 */
const quartersInYear = 4;

/**
 * @constant
 * @name secondsInHour
 * @summary Seconds in 1 hour.
 */
const secondsInHour = 3600;

/**
 * @constant
 * @name secondsInMinute
 * @summary Seconds in 1 minute.
 */
const secondsInMinute = 60;

/**
 * @constant
 * @name secondsInDay
 * @summary Seconds in 1 day.
 */
const secondsInDay = secondsInHour * 24;

/**
 * @constant
 * @name secondsInWeek
 * @summary Seconds in 1 week.
 */
const secondsInWeek = secondsInDay * 7;

/**
 * @constant
 * @name secondsInYear
 * @summary Seconds in 1 year.
 */
const secondsInYear = secondsInDay * daysInYear;

/**
 * @constant
 * @name secondsInMonth
 * @summary Seconds in 1 month
 */
const secondsInMonth = secondsInYear / 12;

/**
 * @constant
 * @name secondsInQuarter
 * @summary Seconds in 1 quarter.
 */
const secondsInQuarter = secondsInMonth * 3;

/**
 * @constant
 * @name constructFromSymbol
 * @summary Symbol enabling Date extensions to inherit properties from the reference date.
 *
 * The symbol is used to enable the `constructFrom` function to construct a date
 * using a reference date and a value. It allows to transfer extra properties
 * from the reference date to the new date. It's useful for extensions like
 * [`TZDate`](https://github.com/date-fns/tz) that accept a time zone as
 * a constructor argument.
 */
const constructFromSymbol = Symbol.for("constructDateFrom");

;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/constructFrom.js


/**
 * @name constructFrom
 * @category Generic Helpers
 * @summary Constructs a date using the reference date and the value
 *
 * @description
 * The function constructs a new date using the constructor from the reference
 * date and the given value. It helps to build generic functions that accept
 * date extensions.
 *
 * It defaults to `Date` if the passed reference date is a number or a string.
 *
 * Starting from v3.7.0, it allows to construct a date using `[Symbol.for("constructDateFrom")]`
 * enabling to transfer extra properties from the reference date to the new date.
 * It's useful for extensions like [`TZDate`](https://github.com/date-fns/tz)
 * that accept a time zone as a constructor argument.
 *
 * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
 *
 * @param date - The reference date to take constructor from
 * @param value - The value to create the date
 *
 * @returns Date initialized using the given date and value
 *
 * @example
 * import { constructFrom } from "./constructFrom/date-fns";
 *
 * // A function that clones a date preserving the original type
 * function cloneDate<DateType extends Date>(date: DateType): DateType {
 *   return constructFrom(
 *     date, // Use constructor from the given date
 *     date.getTime() // Use the date value to create a new date
 *   );
 * }
 */
function constructFrom(date, value) {
  if (typeof date === "function") return date(value);

  if (date && typeof date === "object" && constructFromSymbol in date)
    return date[constructFromSymbol](value);

  if (date instanceof Date) return new date.constructor(value);

  return new Date(value);
}

// Fallback for modularized imports:
/* harmony default export */ const date_fns_constructFrom = ((/* unused pure expression or super */ null && (constructFrom)));

;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/toDate.js


/**
 * @name toDate
 * @category Common Helpers
 * @summary Convert the given argument to an instance of Date.
 *
 * @description
 * Convert the given argument to an instance of Date.
 *
 * If the argument is an instance of Date, the function returns its clone.
 *
 * If the argument is a number, it is treated as a timestamp.
 *
 * If the argument is none of the above, the function returns Invalid Date.
 *
 * Starting from v3.7.0, it clones a date using `[Symbol.for("constructDateFrom")]`
 * enabling to transfer extra properties from the reference date to the new date.
 * It's useful for extensions like [`TZDate`](https://github.com/date-fns/tz)
 * that accept a time zone as a constructor argument.
 *
 * **Note**: *all* Date arguments passed to any *date-fns* function is processed by `toDate`.
 *
 * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
 * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.
 *
 * @param argument - The value to convert
 *
 * @returns The parsed date in the local time zone
 *
 * @example
 * // Clone the date:
 * const result = toDate(new Date(2014, 1, 11, 11, 30, 30))
 * //=> Tue Feb 11 2014 11:30:30
 *
 * @example
 * // Convert the timestamp to date:
 * const result = toDate(1392098430000)
 * //=> Tue Feb 11 2014 11:30:30
 */
function toDate(argument, context) {
  // [TODO] Get rid of `toDate` or `constructFrom`?
  return constructFrom(context || argument, argument);
}

// Fallback for modularized imports:
/* harmony default export */ const date_fns_toDate = ((/* unused pure expression or super */ null && (toDate)));

;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/addDays.js



/**
 * The {@link addDays} function options.
 */

/**
 * @name addDays
 * @category Day Helpers
 * @summary Add the specified number of days to the given date.
 *
 * @description
 * Add the specified number of days to the given date.
 *
 * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
 * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.
 *
 * @param date - The date to be changed
 * @param amount - The amount of days to be added.
 * @param options - An object with options
 *
 * @returns The new date with the days added
 *
 * @example
 * // Add 10 days to 1 September 2014:
 * const result = addDays(new Date(2014, 8, 1), 10)
 * //=> Thu Sep 11 2014 00:00:00
 */
function addDays(date, amount, options) {
  const _date = toDate(date, options?.in);
  if (isNaN(amount)) return constructFrom(options?.in || date, NaN);

  // If 0 days, no-op to avoid changing times in the hour before end of DST
  if (!amount) return _date;

  _date.setDate(_date.getDate() + amount);
  return _date;
}

// Fallback for modularized imports:
/* harmony default export */ const date_fns_addDays = ((/* unused pure expression or super */ null && (addDays)));

;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/subDays.js


/**
 * The {@link subDays} function options.
 */

/**
 * @name subDays
 * @category Day Helpers
 * @summary Subtract the specified number of days from the given date.
 *
 * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
 * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.
 *
 * @param date - The date to be changed
 * @param amount - The amount of days to be subtracted.
 * @param options - An object with options
 *
 * @returns The new date with the days subtracted
 *
 * @example
 * // Subtract 10 days from 1 September 2014:
 * const result = subDays(new Date(2014, 8, 1), 10)
 * //=> Fri Aug 22 2014 00:00:00
 */
function subDays(date, amount, options) {
  return addDays(date, -amount, options);
}

// Fallback for modularized imports:
/* harmony default export */ const date_fns_subDays = ((/* unused pure expression or super */ null && (subDays)));

;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/addWeeks.js


/**
 * The {@link addWeeks} function options.
 */

/**
 * @name addWeeks
 * @category Week Helpers
 * @summary Add the specified number of weeks to the given date.
 *
 * @description
 * Add the specified number of weeks to the given date.
 *
 * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
 * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.
 *
 * @param date - The date to be changed
 * @param amount - The amount of weeks to be added.
 * @param options - An object with options
 *
 * @returns The new date with the weeks added
 *
 * @example
 * // Add 4 weeks to 1 September 2014:
 * const result = addWeeks(new Date(2014, 8, 1), 4)
 * //=> Mon Sep 29 2014 00:00:00
 */
function addWeeks(date, amount, options) {
  return addDays(date, amount * 7, options);
}

// Fallback for modularized imports:
/* harmony default export */ const date_fns_addWeeks = ((/* unused pure expression or super */ null && (addWeeks)));

;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/subWeeks.js


/**
 * The {@link subWeeks} function options.
 */

/**
 * @name subWeeks
 * @category Week Helpers
 * @summary Subtract the specified number of weeks from the given date.
 *
 * @description
 * Subtract the specified number of weeks from the given date.
 *
 * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
 * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.
 *
 * @param date - The date to be changed
 * @param amount - The amount of weeks to be subtracted.
 * @param options - An object with options
 *
 * @returns The new date with the weeks subtracted
 *
 * @example
 * // Subtract 4 weeks from 1 September 2014:
 * const result = subWeeks(new Date(2014, 8, 1), 4)
 * //=> Mon Aug 04 2014 00:00:00
 */
function subWeeks(date, amount, options) {
  return addWeeks(date, -amount, options);
}

// Fallback for modularized imports:
/* harmony default export */ const date_fns_subWeeks = ((/* unused pure expression or super */ null && (subWeeks)));

;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/addMonths.js



/**
 * The {@link addMonths} function options.
 */

/**
 * @name addMonths
 * @category Month Helpers
 * @summary Add the specified number of months to the given date.
 *
 * @description
 * Add the specified number of months to the given date.
 *
 * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
 * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.
 *
 * @param date - The date to be changed
 * @param amount - The amount of months to be added.
 * @param options - The options object
 *
 * @returns The new date with the months added
 *
 * @example
 * // Add 5 months to 1 September 2014:
 * const result = addMonths(new Date(2014, 8, 1), 5)
 * //=> Sun Feb 01 2015 00:00:00
 *
 * // Add one month to 30 January 2023:
 * const result = addMonths(new Date(2023, 0, 30), 1)
 * //=> Tue Feb 28 2023 00:00:00
 */
function addMonths(date, amount, options) {
  const _date = toDate(date, options?.in);
  if (isNaN(amount)) return constructFrom(options?.in || date, NaN);
  if (!amount) {
    // If 0 months, no-op to avoid changing times in the hour before end of DST
    return _date;
  }
  const dayOfMonth = _date.getDate();

  // The JS Date object supports date math by accepting out-of-bounds values for
  // month, day, etc. For example, new Date(2020, 0, 0) returns 31 Dec 2019 and
  // new Date(2020, 13, 1) returns 1 Feb 2021.  This is *almost* the behavior we
  // want except that dates will wrap around the end of a month, meaning that
  // new Date(2020, 13, 31) will return 3 Mar 2021 not 28 Feb 2021 as desired. So
  // we'll default to the end of the desired month by adding 1 to the desired
  // month and using a date of 0 to back up one day to the end of the desired
  // month.
  const endOfDesiredMonth = constructFrom(options?.in || date, _date.getTime());
  endOfDesiredMonth.setMonth(_date.getMonth() + amount + 1, 0);
  const daysInMonth = endOfDesiredMonth.getDate();
  if (dayOfMonth >= daysInMonth) {
    // If we're already at the end of the month, then this is the correct date
    // and we're done.
    return endOfDesiredMonth;
  } else {
    // Otherwise, we now know that setting the original day-of-month value won't
    // cause an overflow, so set the desired day-of-month. Note that we can't
    // just set the date of `endOfDesiredMonth` because that object may have had
    // its time changed in the unusual case where where a DST transition was on
    // the last day of the month and its local time was in the hour skipped or
    // repeated next to a DST transition.  So we use `date` instead which is
    // guaranteed to still have the original time.
    _date.setFullYear(
      endOfDesiredMonth.getFullYear(),
      endOfDesiredMonth.getMonth(),
      dayOfMonth,
    );
    return _date;
  }
}

// Fallback for modularized imports:
/* harmony default export */ const date_fns_addMonths = ((/* unused pure expression or super */ null && (addMonths)));

;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/subMonths.js


/**
 * The subMonths function options.
 */

/**
 * @name subMonths
 * @category Month Helpers
 * @summary Subtract the specified number of months from the given date.
 *
 * @description
 * Subtract the specified number of months from the given date.
 *
 * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
 * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.
 *
 * @param date - The date to be changed
 * @param amount - The amount of months to be subtracted.
 * @param options - An object with options
 *
 * @returns The new date with the months subtracted
 *
 * @example
 * // Subtract 5 months from 1 February 2015:
 * const result = subMonths(new Date(2015, 1, 1), 5)
 * //=> Mon Sep 01 2014 00:00:00
 */
function subMonths(date, amount, options) {
  return addMonths(date, -amount, options);
}

// Fallback for modularized imports:
/* harmony default export */ const date_fns_subMonths = ((/* unused pure expression or super */ null && (subMonths)));

;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/addYears.js


/**
 * The {@link addYears} function options.
 */

/**
 * @name addYears
 * @category Year Helpers
 * @summary Add the specified number of years to the given date.
 *
 * @description
 * Add the specified number of years to the given date.
 *
 * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
 * @typeParam ResultDate - The result `Date` type.
 *
 * @param date - The date to be changed
 * @param amount - The amount of years to be added.
 * @param options - The options
 *
 * @returns The new date with the years added
 *
 * @example
 * // Add 5 years to 1 September 2014:
 * const result = addYears(new Date(2014, 8, 1), 5)
 * //=> Sun Sep 01 2019 00:00:00
 */
function addYears(date, amount, options) {
  return addMonths(date, amount * 12, options);
}

// Fallback for modularized imports:
/* harmony default export */ const date_fns_addYears = ((/* unused pure expression or super */ null && (addYears)));

;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/subYears.js


/**
 * The {@link subYears} function options.
 */

/**
 * @name subYears
 * @category Year Helpers
 * @summary Subtract the specified number of years from the given date.
 *
 * @description
 * Subtract the specified number of years from the given date.
 *
 * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
 * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.
 *
 * @param date - The date to be changed
 * @param amount - The amount of years to be subtracted.
 * @param options - An object with options
 *
 * @returns The new date with the years subtracted
 *
 * @example
 * // Subtract 5 years from 1 September 2014:
 * const result = subYears(new Date(2014, 8, 1), 5)
 * //=> Tue Sep 01 2009 00:00:00
 */
function subYears(date, amount, options) {
  return addYears(date, -amount, options);
}

// Fallback for modularized imports:
/* harmony default export */ const date_fns_subYears = ((/* unused pure expression or super */ null && (subYears)));

;// ./node_modules/@wordpress/icons/build-module/library/arrow-up.js


var arrow_up_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M12 3.9 6.5 9.5l1 1 3.8-3.7V20h1.5V6.8l3.7 3.7 1-1z" }) });


;// ./node_modules/@wordpress/icons/build-module/library/arrow-down.js


var arrow_down_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "m16.5 13.5-3.7 3.7V4h-1.5v13.2l-3.8-3.7-1 1 5.5 5.6 5.5-5.6z" }) });


;// ./node_modules/@wordpress/dataviews/build-module/constants.js


const constants_OPERATOR_IS = "is";
const constants_OPERATOR_IS_NOT = "isNot";
const constants_OPERATOR_IS_ANY = "isAny";
const constants_OPERATOR_IS_NONE = "isNone";
const OPERATOR_IS_ALL = "isAll";
const OPERATOR_IS_NOT_ALL = "isNotAll";
const OPERATOR_LESS_THAN = "lessThan";
const OPERATOR_GREATER_THAN = "greaterThan";
const OPERATOR_LESS_THAN_OR_EQUAL = "lessThanOrEqual";
const OPERATOR_GREATER_THAN_OR_EQUAL = "greaterThanOrEqual";
const OPERATOR_BEFORE = "before";
const OPERATOR_AFTER = "after";
const OPERATOR_BEFORE_INC = "beforeInc";
const OPERATOR_AFTER_INC = "afterInc";
const OPERATOR_CONTAINS = "contains";
const OPERATOR_NOT_CONTAINS = "notContains";
const OPERATOR_STARTS_WITH = "startsWith";
const OPERATOR_BETWEEN = "between";
const OPERATOR_ON = "on";
const OPERATOR_NOT_ON = "notOn";
const OPERATOR_IN_THE_PAST = "inThePast";
const OPERATOR_OVER = "over";
const ALL_OPERATORS = [
  constants_OPERATOR_IS,
  constants_OPERATOR_IS_NOT,
  constants_OPERATOR_IS_ANY,
  constants_OPERATOR_IS_NONE,
  OPERATOR_IS_ALL,
  OPERATOR_IS_NOT_ALL,
  OPERATOR_LESS_THAN,
  OPERATOR_GREATER_THAN,
  OPERATOR_LESS_THAN_OR_EQUAL,
  OPERATOR_GREATER_THAN_OR_EQUAL,
  OPERATOR_BEFORE,
  OPERATOR_AFTER,
  OPERATOR_BEFORE_INC,
  OPERATOR_AFTER_INC,
  OPERATOR_CONTAINS,
  OPERATOR_NOT_CONTAINS,
  OPERATOR_STARTS_WITH,
  OPERATOR_BETWEEN,
  OPERATOR_ON,
  OPERATOR_NOT_ON,
  OPERATOR_IN_THE_PAST,
  OPERATOR_OVER
];
const SINGLE_SELECTION_OPERATORS = [
  constants_OPERATOR_IS,
  constants_OPERATOR_IS_NOT,
  OPERATOR_LESS_THAN,
  OPERATOR_GREATER_THAN,
  OPERATOR_LESS_THAN_OR_EQUAL,
  OPERATOR_GREATER_THAN_OR_EQUAL,
  OPERATOR_BEFORE,
  OPERATOR_AFTER,
  OPERATOR_BEFORE_INC,
  OPERATOR_AFTER_INC,
  OPERATOR_CONTAINS,
  OPERATOR_NOT_CONTAINS,
  OPERATOR_STARTS_WITH,
  OPERATOR_ON,
  OPERATOR_NOT_ON
];
const OPERATORS = {
  [constants_OPERATOR_IS]: {
    key: "is-filter",
    label: (0,external_wp_i18n_namespaceObject.__)("Is")
  },
  [constants_OPERATOR_IS_NOT]: {
    key: "is-not-filter",
    label: (0,external_wp_i18n_namespaceObject.__)("Is not")
  },
  [constants_OPERATOR_IS_ANY]: {
    key: "is-any-filter",
    label: (0,external_wp_i18n_namespaceObject.__)("Is any")
  },
  [constants_OPERATOR_IS_NONE]: {
    key: "is-none-filter",
    label: (0,external_wp_i18n_namespaceObject.__)("Is none")
  },
  [OPERATOR_IS_ALL]: {
    key: "is-all-filter",
    label: (0,external_wp_i18n_namespaceObject.__)("Is all")
  },
  [OPERATOR_IS_NOT_ALL]: {
    key: "is-not-all-filter",
    label: (0,external_wp_i18n_namespaceObject.__)("Is not all")
  },
  [OPERATOR_LESS_THAN]: {
    key: "less-than-filter",
    label: (0,external_wp_i18n_namespaceObject.__)("Less than")
  },
  [OPERATOR_GREATER_THAN]: {
    key: "greater-than-filter",
    label: (0,external_wp_i18n_namespaceObject.__)("Greater than")
  },
  [OPERATOR_LESS_THAN_OR_EQUAL]: {
    key: "less-than-or-equal-filter",
    label: (0,external_wp_i18n_namespaceObject.__)("Less than or equal")
  },
  [OPERATOR_GREATER_THAN_OR_EQUAL]: {
    key: "greater-than-or-equal-filter",
    label: (0,external_wp_i18n_namespaceObject.__)("Greater than or equal")
  },
  [OPERATOR_BEFORE]: {
    key: "before-filter",
    label: (0,external_wp_i18n_namespaceObject.__)("Before")
  },
  [OPERATOR_AFTER]: {
    key: "after-filter",
    label: (0,external_wp_i18n_namespaceObject.__)("After")
  },
  [OPERATOR_BEFORE_INC]: {
    key: "before-inc-filter",
    label: (0,external_wp_i18n_namespaceObject.__)("Before (inc)")
  },
  [OPERATOR_AFTER_INC]: {
    key: "after-inc-filter",
    label: (0,external_wp_i18n_namespaceObject.__)("After (inc)")
  },
  [OPERATOR_CONTAINS]: {
    key: "contains-filter",
    label: (0,external_wp_i18n_namespaceObject.__)("Contains")
  },
  [OPERATOR_NOT_CONTAINS]: {
    key: "not-contains-filter",
    label: (0,external_wp_i18n_namespaceObject.__)("Doesn't contain")
  },
  [OPERATOR_STARTS_WITH]: {
    key: "starts-with-filter",
    label: (0,external_wp_i18n_namespaceObject.__)("Starts with")
  },
  [OPERATOR_BETWEEN]: {
    key: "between-filter",
    label: (0,external_wp_i18n_namespaceObject.__)("Between (inc)")
  },
  [OPERATOR_ON]: {
    key: "on-filter",
    label: (0,external_wp_i18n_namespaceObject.__)("On")
  },
  [OPERATOR_NOT_ON]: {
    key: "not-on-filter",
    label: (0,external_wp_i18n_namespaceObject.__)("Not on")
  },
  [OPERATOR_IN_THE_PAST]: {
    key: "in-the-past-filter",
    label: (0,external_wp_i18n_namespaceObject.__)("In the past")
  },
  [OPERATOR_OVER]: {
    key: "over-filter",
    label: (0,external_wp_i18n_namespaceObject.__)("Over")
  }
};
const SORTING_DIRECTIONS = ["asc", "desc"];
const sortArrows = { asc: "\u2191", desc: "\u2193" };
const sortValues = { asc: "ascending", desc: "descending" };
const sortLabels = {
  asc: (0,external_wp_i18n_namespaceObject.__)("Sort ascending"),
  desc: (0,external_wp_i18n_namespaceObject.__)("Sort descending")
};
const sortIcons = {
  asc: arrow_up_default,
  desc: arrow_down_default
};
const constants_LAYOUT_TABLE = "table";
const constants_LAYOUT_GRID = "grid";
const constants_LAYOUT_LIST = "list";
const LAYOUT_PICKER_GRID = "pickerGrid";


;// ./node_modules/@wordpress/dataviews/build-module/hooks/use-elements.js

const use_elements_EMPTY_ARRAY = [];
function useElements({
  elements,
  getElements
}) {
  const staticElements = Array.isArray(elements) && elements.length > 0 ? elements : use_elements_EMPTY_ARRAY;
  const [records, setRecords] = (0,external_wp_element_.useState)(staticElements);
  const [isLoading, setIsLoading] = (0,external_wp_element_.useState)(false);
  (0,external_wp_element_.useEffect)(() => {
    if (!getElements) {
      setRecords(staticElements);
      return;
    }
    let cancelled = false;
    setIsLoading(true);
    getElements().then((fetchedElements) => {
      if (!cancelled) {
        const dynamicElements = Array.isArray(fetchedElements) && fetchedElements.length > 0 ? fetchedElements : staticElements;
        setRecords(dynamicElements);
      }
    }).catch(() => {
      if (!cancelled) {
        setRecords(staticElements);
      }
    }).finally(() => {
      if (!cancelled) {
        setIsLoading(false);
      }
    });
    return () => {
      cancelled = true;
    };
  }, [getElements, staticElements]);
  return {
    elements: records,
    isLoading
  };
}


;// ./node_modules/@wordpress/dataviews/build-module/field-types/utils/render-from-elements.js

function RenderFromElements({
  item,
  field
}) {
  const { elements, isLoading } = useElements({
    elements: field.elements,
    getElements: field.getElements
  });
  const value = field.getValue({ item });
  if (isLoading) {
    return value;
  }
  if (elements.length === 0) {
    return value;
  }
  return elements?.find((element) => element.value === value)?.label || field.getValue({ item });
}


;// ./node_modules/@wordpress/dataviews/build-module/field-types/email.js




function sort(valueA, valueB, direction) {
  return direction === "asc" ? valueA.localeCompare(valueB) : valueB.localeCompare(valueA);
}
const emailRegex = /^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/;
var email_default = {
  sort,
  isValid: {
    elements: true,
    custom: (item, field) => {
      const value = field.getValue({ item });
      if (![void 0, "", null].includes(value) && !emailRegex.test(value)) {
        return (0,external_wp_i18n_namespaceObject.__)("Value must be a valid email address.");
      }
      return null;
    }
  },
  Edit: "email",
  render: ({ item, field }) => {
    return field.hasElements ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(RenderFromElements, { item, field }) : field.getValue({ item });
  },
  enableSorting: true,
  filterBy: {
    defaultOperators: [constants_OPERATOR_IS_ANY, constants_OPERATOR_IS_NONE],
    validOperators: [
      constants_OPERATOR_IS,
      constants_OPERATOR_IS_NOT,
      OPERATOR_CONTAINS,
      OPERATOR_NOT_CONTAINS,
      OPERATOR_STARTS_WITH,
      // Multiple selection
      constants_OPERATOR_IS_ANY,
      constants_OPERATOR_IS_NONE,
      OPERATOR_IS_ALL,
      OPERATOR_IS_NOT_ALL
    ]
  }
};


;// ./node_modules/@wordpress/dataviews/build-module/field-types/integer.js




function integer_sort(a, b, direction) {
  return direction === "asc" ? a - b : b - a;
}
var integer_default = {
  sort: integer_sort,
  isValid: {
    elements: true,
    custom: (item, field) => {
      const value = field.getValue({ item });
      if (![void 0, "", null].includes(value) && !Number.isInteger(value)) {
        return (0,external_wp_i18n_namespaceObject.__)("Value must be an integer.");
      }
      return null;
    }
  },
  Edit: "integer",
  render: ({ item, field }) => {
    return field.hasElements ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(RenderFromElements, { item, field }) : field.getValue({ item });
  },
  enableSorting: true,
  filterBy: {
    defaultOperators: [
      constants_OPERATOR_IS,
      constants_OPERATOR_IS_NOT,
      OPERATOR_LESS_THAN,
      OPERATOR_GREATER_THAN,
      OPERATOR_LESS_THAN_OR_EQUAL,
      OPERATOR_GREATER_THAN_OR_EQUAL,
      OPERATOR_BETWEEN
    ],
    validOperators: [
      // Single-selection
      constants_OPERATOR_IS,
      constants_OPERATOR_IS_NOT,
      OPERATOR_LESS_THAN,
      OPERATOR_GREATER_THAN,
      OPERATOR_LESS_THAN_OR_EQUAL,
      OPERATOR_GREATER_THAN_OR_EQUAL,
      OPERATOR_BETWEEN,
      // Multiple-selection
      constants_OPERATOR_IS_ANY,
      constants_OPERATOR_IS_NONE,
      OPERATOR_IS_ALL,
      OPERATOR_IS_NOT_ALL
    ]
  }
};


;// ./node_modules/@wordpress/dataviews/build-module/field-types/number.js




function number_sort(a, b, direction) {
  return direction === "asc" ? a - b : b - a;
}
function isEmpty(value) {
  return value === "" || value === void 0 || value === null;
}
var number_default = {
  sort: number_sort,
  isValid: {
    elements: true,
    custom: (item, field) => {
      const value = field.getValue({ item });
      if (!isEmpty(value) && !Number.isFinite(value)) {
        return (0,external_wp_i18n_namespaceObject.__)("Value must be a number.");
      }
      return null;
    }
  },
  Edit: "number",
  render: ({ item, field }) => {
    if (field.hasElements) {
      /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(RenderFromElements, { item, field });
    }
    const value = field.getValue({ item });
    if (![null, void 0].includes(value)) {
      return Number(value).toFixed(2);
    }
    return null;
  },
  enableSorting: true,
  filterBy: {
    defaultOperators: [
      constants_OPERATOR_IS,
      constants_OPERATOR_IS_NOT,
      OPERATOR_LESS_THAN,
      OPERATOR_GREATER_THAN,
      OPERATOR_LESS_THAN_OR_EQUAL,
      OPERATOR_GREATER_THAN_OR_EQUAL,
      OPERATOR_BETWEEN
    ],
    validOperators: [
      // Single-selection
      constants_OPERATOR_IS,
      constants_OPERATOR_IS_NOT,
      OPERATOR_LESS_THAN,
      OPERATOR_GREATER_THAN,
      OPERATOR_LESS_THAN_OR_EQUAL,
      OPERATOR_GREATER_THAN_OR_EQUAL,
      OPERATOR_BETWEEN,
      // Multiple-selection
      constants_OPERATOR_IS_ANY,
      constants_OPERATOR_IS_NONE,
      OPERATOR_IS_ALL,
      OPERATOR_IS_NOT_ALL
    ]
  }
};


;// ./node_modules/@wordpress/dataviews/build-module/field-types/text.js



function text_sort(valueA, valueB, direction) {
  return direction === "asc" ? valueA.localeCompare(valueB) : valueB.localeCompare(valueA);
}
var text_default = {
  sort: text_sort,
  isValid: {
    elements: true,
    custom: () => null
  },
  Edit: "text",
  render: ({ item, field }) => {
    return field.hasElements ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(RenderFromElements, { item, field }) : field.getValue({ item });
  },
  enableSorting: true,
  filterBy: {
    defaultOperators: [constants_OPERATOR_IS_ANY, constants_OPERATOR_IS_NONE],
    validOperators: [
      // Single selection
      constants_OPERATOR_IS,
      constants_OPERATOR_IS_NOT,
      OPERATOR_CONTAINS,
      OPERATOR_NOT_CONTAINS,
      OPERATOR_STARTS_WITH,
      // Multiple selection
      constants_OPERATOR_IS_ANY,
      constants_OPERATOR_IS_NONE,
      OPERATOR_IS_ALL,
      OPERATOR_IS_NOT_ALL
    ]
  }
};


;// ./node_modules/@wordpress/dataviews/build-module/field-types/datetime.js



function datetime_sort(a, b, direction) {
  const timeA = new Date(a).getTime();
  const timeB = new Date(b).getTime();
  return direction === "asc" ? timeA - timeB : timeB - timeA;
}
var datetime_default = {
  sort: datetime_sort,
  isValid: {
    elements: true,
    custom: () => null
  },
  Edit: "datetime",
  render: ({ item, field }) => {
    return field.hasElements ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(RenderFromElements, { item, field }) : field.getValue({ item });
  },
  enableSorting: true,
  filterBy: {
    defaultOperators: [
      OPERATOR_ON,
      OPERATOR_NOT_ON,
      OPERATOR_BEFORE,
      OPERATOR_AFTER,
      OPERATOR_BEFORE_INC,
      OPERATOR_AFTER_INC,
      OPERATOR_IN_THE_PAST,
      OPERATOR_OVER
    ],
    validOperators: [
      OPERATOR_ON,
      OPERATOR_NOT_ON,
      OPERATOR_BEFORE,
      OPERATOR_AFTER,
      OPERATOR_BEFORE_INC,
      OPERATOR_AFTER_INC,
      OPERATOR_IN_THE_PAST,
      OPERATOR_OVER
    ]
  }
};


;// ./node_modules/@wordpress/dataviews/build-module/field-types/date.js




const getFormattedDate = (dateToDisplay) => (0,external_wp_date_namespaceObject.dateI18n)((0,external_wp_date_namespaceObject.getSettings)().formats.date, (0,external_wp_date_namespaceObject.getDate)(dateToDisplay));
function date_sort(a, b, direction) {
  const timeA = new Date(a).getTime();
  const timeB = new Date(b).getTime();
  return direction === "asc" ? timeA - timeB : timeB - timeA;
}
var date_default = {
  sort: date_sort,
  Edit: "date",
  isValid: {
    elements: true,
    custom: () => null
  },
  render: ({ item, field }) => {
    if (field.hasElements) {
      return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(RenderFromElements, { item, field });
    }
    const value = field.getValue({ item });
    if (!value) {
      return "";
    }
    return getFormattedDate(value);
  },
  enableSorting: true,
  filterBy: {
    defaultOperators: [
      OPERATOR_ON,
      OPERATOR_NOT_ON,
      OPERATOR_BEFORE,
      OPERATOR_AFTER,
      OPERATOR_BEFORE_INC,
      OPERATOR_AFTER_INC,
      OPERATOR_IN_THE_PAST,
      OPERATOR_OVER,
      OPERATOR_BETWEEN
    ],
    validOperators: [
      OPERATOR_ON,
      OPERATOR_NOT_ON,
      OPERATOR_BEFORE,
      OPERATOR_AFTER,
      OPERATOR_BEFORE_INC,
      OPERATOR_AFTER_INC,
      OPERATOR_IN_THE_PAST,
      OPERATOR_OVER,
      OPERATOR_BETWEEN
    ]
  }
};


;// ./node_modules/@wordpress/dataviews/build-module/field-types/boolean.js




function boolean_sort(a, b, direction) {
  const boolA = Boolean(a);
  const boolB = Boolean(b);
  if (boolA === boolB) {
    return 0;
  }
  if (direction === "asc") {
    return boolA ? 1 : -1;
  }
  return boolA ? -1 : 1;
}
var boolean_default = {
  sort: boolean_sort,
  isValid: {
    elements: true,
    custom: (item, field) => {
      const value = field.getValue({ item });
      if (![void 0, "", null].includes(value) && ![true, false].includes(value)) {
        return (0,external_wp_i18n_namespaceObject.__)("Value must be true, false, or undefined");
      }
      return null;
    }
  },
  Edit: "checkbox",
  render: ({ item, field }) => {
    if (field.hasElements) {
      return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(RenderFromElements, { item, field });
    }
    if (field.getValue({ item }) === true) {
      return (0,external_wp_i18n_namespaceObject.__)("True");
    }
    if (field.getValue({ item }) === false) {
      return (0,external_wp_i18n_namespaceObject.__)("False");
    }
    return null;
  },
  enableSorting: true,
  filterBy: {
    defaultOperators: [constants_OPERATOR_IS, constants_OPERATOR_IS_NOT],
    validOperators: [constants_OPERATOR_IS, constants_OPERATOR_IS_NOT]
  }
};


;// ./node_modules/@wordpress/dataviews/build-module/field-types/media.js
function media_sort() {
  return 0;
}
var media_default = {
  sort: media_sort,
  isValid: {
    elements: true,
    custom: () => null
  },
  Edit: null,
  render: () => null,
  enableSorting: false,
  filterBy: false
};


;// ./node_modules/@wordpress/dataviews/build-module/field-types/array.js


function array_sort(valueA, valueB, direction) {
  const arrA = Array.isArray(valueA) ? valueA : [];
  const arrB = Array.isArray(valueB) ? valueB : [];
  if (arrA.length !== arrB.length) {
    return direction === "asc" ? arrA.length - arrB.length : arrB.length - arrA.length;
  }
  const joinedA = arrA.join(",");
  const joinedB = arrB.join(",");
  return direction === "asc" ? joinedA.localeCompare(joinedB) : joinedB.localeCompare(joinedA);
}
function render({ item, field }) {
  const value = field.getValue({ item }) || [];
  return value.join(", ");
}
const arrayFieldType = {
  sort: array_sort,
  isValid: {
    elements: true,
    custom: (item, field) => {
      const value = field.getValue({ item });
      if (![void 0, "", null].includes(value) && !Array.isArray(value)) {
        return (0,external_wp_i18n_namespaceObject.__)("Value must be an array.");
      }
      if (!value.every((v) => typeof v === "string")) {
        return (0,external_wp_i18n_namespaceObject.__)("Every value must be a string.");
      }
      return null;
    }
  },
  Edit: "array",
  // Use array control
  render,
  enableSorting: true,
  filterBy: {
    defaultOperators: [constants_OPERATOR_IS_ANY, constants_OPERATOR_IS_NONE],
    validOperators: [
      constants_OPERATOR_IS_ANY,
      constants_OPERATOR_IS_NONE,
      OPERATOR_IS_ALL,
      OPERATOR_IS_NOT_ALL
    ]
  }
};
var array_default = arrayFieldType;


;// ./node_modules/@wordpress/dataviews/build-module/field-types/password.js


function password_sort(valueA, valueB, direction) {
  return 0;
}
var password_default = {
  sort: password_sort,
  isValid: {
    elements: true,
    custom: () => null
  },
  Edit: "password",
  render: ({ item, field }) => {
    return field.hasElements ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(RenderFromElements, { item, field }) : "\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022";
  },
  enableSorting: false,
  filterBy: false
};


;// ./node_modules/@wordpress/dataviews/build-module/field-types/telephone.js



function telephone_sort(valueA, valueB, direction) {
  return direction === "asc" ? valueA.localeCompare(valueB) : valueB.localeCompare(valueA);
}
var telephone_default = {
  sort: telephone_sort,
  isValid: {
    elements: true,
    custom: () => null
  },
  Edit: "telephone",
  render: ({ item, field }) => {
    return field.hasElements ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(RenderFromElements, { item, field }) : field.getValue({ item });
  },
  enableSorting: true,
  filterBy: {
    defaultOperators: [constants_OPERATOR_IS_ANY, constants_OPERATOR_IS_NONE],
    validOperators: [
      constants_OPERATOR_IS,
      constants_OPERATOR_IS_NOT,
      OPERATOR_CONTAINS,
      OPERATOR_NOT_CONTAINS,
      OPERATOR_STARTS_WITH,
      // Multiple selection
      constants_OPERATOR_IS_ANY,
      constants_OPERATOR_IS_NONE,
      OPERATOR_IS_ALL,
      OPERATOR_IS_NOT_ALL
    ]
  }
};


;// ./node_modules/@wordpress/dataviews/build-module/field-types/color.js





function color_sort(valueA, valueB, direction) {
  const colorA = w(valueA);
  const colorB = w(valueB);
  if (!colorA.isValid() && !colorB.isValid()) {
    return 0;
  }
  if (!colorA.isValid()) {
    return direction === "asc" ? 1 : -1;
  }
  if (!colorB.isValid()) {
    return direction === "asc" ? -1 : 1;
  }
  const hslA = colorA.toHsl();
  const hslB = colorB.toHsl();
  if (hslA.h !== hslB.h) {
    return direction === "asc" ? hslA.h - hslB.h : hslB.h - hslA.h;
  }
  if (hslA.s !== hslB.s) {
    return direction === "asc" ? hslA.s - hslB.s : hslB.s - hslA.s;
  }
  return direction === "asc" ? hslA.l - hslB.l : hslB.l - hslA.l;
}
var color_color_default = {
  sort: color_sort,
  isValid: {
    elements: true,
    custom: (item, field) => {
      const value = field.getValue({ item });
      if (![void 0, "", null].includes(value) && !w(value).isValid()) {
        return (0,external_wp_i18n_namespaceObject.__)("Value must be a valid color.");
      }
      return null;
    }
  },
  Edit: "color",
  render: ({ item, field }) => {
    if (field.hasElements) {
      return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(RenderFromElements, { item, field });
    }
    const value = field.getValue({ item });
    if (!value || !w(value).isValid()) {
      return value;
    }
    return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
      "div",
      {
        style: { display: "flex", alignItems: "center", gap: "8px" },
        children: [
          /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
            "div",
            {
              style: {
                width: "16px",
                height: "16px",
                borderRadius: "50%",
                backgroundColor: value,
                border: "1px solid #ddd",
                flexShrink: 0
              }
            }
          ),
          /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { children: value })
        ]
      }
    );
  },
  enableSorting: true,
  filterBy: {
    defaultOperators: [constants_OPERATOR_IS_ANY, constants_OPERATOR_IS_NONE],
    validOperators: [constants_OPERATOR_IS, constants_OPERATOR_IS_NOT]
  }
};


;// ./node_modules/@wordpress/dataviews/build-module/field-types/url.js



function url_sort(valueA, valueB, direction) {
  return direction === "asc" ? valueA.localeCompare(valueB) : valueB.localeCompare(valueA);
}
var url_default = {
  sort: url_sort,
  isValid: {
    elements: true,
    custom: () => null
  },
  Edit: "url",
  render: ({ item, field }) => {
    return field.hasElements ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(RenderFromElements, { item, field }) : field.getValue({ item });
  },
  enableSorting: true,
  filterBy: {
    defaultOperators: [constants_OPERATOR_IS_ANY, constants_OPERATOR_IS_NONE],
    validOperators: [
      constants_OPERATOR_IS,
      constants_OPERATOR_IS_NOT,
      OPERATOR_CONTAINS,
      OPERATOR_NOT_CONTAINS,
      OPERATOR_STARTS_WITH,
      // Multiple selection
      constants_OPERATOR_IS_ANY,
      constants_OPERATOR_IS_NONE,
      OPERATOR_IS_ALL,
      OPERATOR_IS_NOT_ALL
    ]
  }
};


;// ./node_modules/@wordpress/dataviews/build-module/field-types/index.js
















function getFieldTypeDefinition(type) {
  if ("email" === type) {
    return email_default;
  }
  if ("integer" === type) {
    return integer_default;
  }
  if ("number" === type) {
    return number_default;
  }
  if ("text" === type) {
    return text_default;
  }
  if ("datetime" === type) {
    return datetime_default;
  }
  if ("date" === type) {
    return date_default;
  }
  if ("boolean" === type) {
    return boolean_default;
  }
  if ("media" === type) {
    return media_default;
  }
  if ("array" === type) {
    return array_default;
  }
  if ("password" === type) {
    return password_default;
  }
  if ("telephone" === type) {
    return telephone_default;
  }
  if ("color" === type) {
    return color_color_default;
  }
  if ("url" === type) {
    return url_default;
  }
  return {
    sort: (a, b, direction) => {
      if (typeof a === "number" && typeof b === "number") {
        return direction === "asc" ? a - b : b - a;
      }
      return direction === "asc" ? a.localeCompare(b) : b.localeCompare(a);
    },
    isValid: {
      elements: true,
      custom: () => null
    },
    Edit: null,
    render: ({ item, field }) => {
      return field.hasElements ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(RenderFromElements, { item, field }) : field.getValue({ item });
    },
    enableSorting: true,
    filterBy: {
      defaultOperators: [constants_OPERATOR_IS, constants_OPERATOR_IS_NOT],
      validOperators: ALL_OPERATORS
    }
  };
}


;// ./node_modules/@wordpress/dataviews/build-module/lock-unlock.js

const { lock: lock_unlock_lock, unlock: lock_unlock_unlock } = (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/dataviews"
);


;// ./node_modules/@wordpress/dataviews/build-module/dataform-controls/utils/get-custom-validity.js
function getCustomValidity(isValid, validity) {
  let customValidity;
  if (isValid?.required && validity?.required) {
    customValidity = validity?.required?.message ? validity.required : void 0;
  } else if (isValid?.elements && validity?.elements) {
    customValidity = validity.elements;
  } else if (validity?.custom) {
    customValidity = validity.custom;
  }
  return customValidity;
}


;// ./node_modules/@wordpress/dataviews/build-module/dataform-controls/checkbox.js





const { ValidatedCheckboxControl } = lock_unlock_unlock(external_wp_components_namespaceObject.privateApis);
function Checkbox({
  field,
  onChange,
  data,
  hideLabelFromVision,
  validity
}) {
  const { getValue, setValue, label, description, isValid } = field;
  const onChangeControl = (0,external_wp_element_.useCallback)(() => {
    onChange(
      setValue({ item: data, value: !getValue({ item: data }) })
    );
  }, [data, getValue, onChange, setValue]);
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    ValidatedCheckboxControl,
    {
      required: !!field.isValid?.required,
      customValidity: getCustomValidity(isValid, validity),
      hidden: hideLabelFromVision,
      label,
      help: description,
      checked: getValue({ item: data }),
      onChange: onChangeControl
    }
  );
}


;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/isDate.js
/**
 * @name isDate
 * @category Common Helpers
 * @summary Is the given value a date?
 *
 * @description
 * Returns true if the given value is an instance of Date. The function works for dates transferred across iframes.
 *
 * @param value - The value to check
 *
 * @returns True if the given value is a date
 *
 * @example
 * // For a valid date:
 * const result = isDate(new Date())
 * //=> true
 *
 * @example
 * // For an invalid date:
 * const result = isDate(new Date(NaN))
 * //=> true
 *
 * @example
 * // For some value:
 * const result = isDate('2014-02-31')
 * //=> false
 *
 * @example
 * // For an object:
 * const result = isDate({})
 * //=> false
 */
function isDate(value) {
  return (
    value instanceof Date ||
    (typeof value === "object" &&
      Object.prototype.toString.call(value) === "[object Date]")
  );
}

// Fallback for modularized imports:
/* harmony default export */ const date_fns_isDate = ((/* unused pure expression or super */ null && (isDate)));

;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/isValid.js



/**
 * @name isValid
 * @category Common Helpers
 * @summary Is the given date valid?
 *
 * @description
 * Returns false if argument is Invalid Date and true otherwise.
 * Argument is converted to Date using `toDate`. See [toDate](https://date-fns.org/docs/toDate)
 * Invalid Date is a Date, whose time value is NaN.
 *
 * Time value of Date: http://es5.github.io/#x15.9.1.1
 *
 * @param date - The date to check
 *
 * @returns The date is valid
 *
 * @example
 * // For the valid date:
 * const result = isValid(new Date(2014, 1, 31))
 * //=> true
 *
 * @example
 * // For the value, convertible into a date:
 * const result = isValid(1393804800000)
 * //=> true
 *
 * @example
 * // For the invalid date:
 * const result = isValid(new Date(''))
 * //=> false
 */
function isValid(date) {
  return !((!isDate(date) && typeof date !== "number") || isNaN(+toDate(date)));
}

// Fallback for modularized imports:
/* harmony default export */ const date_fns_isValid = ((/* unused pure expression or super */ null && (isValid)));

;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/locale/en-US/_lib/formatDistance.js
const formatDistanceLocale = {
  lessThanXSeconds: {
    one: "less than a second",
    other: "less than {{count}} seconds",
  },

  xSeconds: {
    one: "1 second",
    other: "{{count}} seconds",
  },

  halfAMinute: "half a minute",

  lessThanXMinutes: {
    one: "less than a minute",
    other: "less than {{count}} minutes",
  },

  xMinutes: {
    one: "1 minute",
    other: "{{count}} minutes",
  },

  aboutXHours: {
    one: "about 1 hour",
    other: "about {{count}} hours",
  },

  xHours: {
    one: "1 hour",
    other: "{{count}} hours",
  },

  xDays: {
    one: "1 day",
    other: "{{count}} days",
  },

  aboutXWeeks: {
    one: "about 1 week",
    other: "about {{count}} weeks",
  },

  xWeeks: {
    one: "1 week",
    other: "{{count}} weeks",
  },

  aboutXMonths: {
    one: "about 1 month",
    other: "about {{count}} months",
  },

  xMonths: {
    one: "1 month",
    other: "{{count}} months",
  },

  aboutXYears: {
    one: "about 1 year",
    other: "about {{count}} years",
  },

  xYears: {
    one: "1 year",
    other: "{{count}} years",
  },

  overXYears: {
    one: "over 1 year",
    other: "over {{count}} years",
  },

  almostXYears: {
    one: "almost 1 year",
    other: "almost {{count}} years",
  },
};

const formatDistance = (token, count, options) => {
  let result;

  const tokenValue = formatDistanceLocale[token];
  if (typeof tokenValue === "string") {
    result = tokenValue;
  } else if (count === 1) {
    result = tokenValue.one;
  } else {
    result = tokenValue.other.replace("{{count}}", count.toString());
  }

  if (options?.addSuffix) {
    if (options.comparison && options.comparison > 0) {
      return "in " + result;
    } else {
      return result + " ago";
    }
  }

  return result;
};

;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/locale/_lib/buildFormatLongFn.js
function buildFormatLongFn(args) {
  return (options = {}) => {
    // TODO: Remove String()
    const width = options.width ? String(options.width) : args.defaultWidth;
    const format = args.formats[width] || args.formats[args.defaultWidth];
    return format;
  };
}

;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/locale/en-US/_lib/formatLong.js


const dateFormats = {
  full: "EEEE, MMMM do, y",
  long: "MMMM do, y",
  medium: "MMM d, y",
  short: "MM/dd/yyyy",
};

const timeFormats = {
  full: "h:mm:ss a zzzz",
  long: "h:mm:ss a z",
  medium: "h:mm:ss a",
  short: "h:mm a",
};

const dateTimeFormats = {
  full: "{{date}} 'at' {{time}}",
  long: "{{date}} 'at' {{time}}",
  medium: "{{date}}, {{time}}",
  short: "{{date}}, {{time}}",
};

const formatLong = {
  date: buildFormatLongFn({
    formats: dateFormats,
    defaultWidth: "full",
  }),

  time: buildFormatLongFn({
    formats: timeFormats,
    defaultWidth: "full",
  }),

  dateTime: buildFormatLongFn({
    formats: dateTimeFormats,
    defaultWidth: "full",
  }),
};

;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/locale/en-US/_lib/formatRelative.js
const formatRelativeLocale = {
  lastWeek: "'last' eeee 'at' p",
  yesterday: "'yesterday at' p",
  today: "'today at' p",
  tomorrow: "'tomorrow at' p",
  nextWeek: "eeee 'at' p",
  other: "P",
};

const formatRelative = (token, _date, _baseDate, _options) =>
  formatRelativeLocale[token];

;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/locale/_lib/buildLocalizeFn.js
/**
 * The localize function argument callback which allows to convert raw value to
 * the actual type.
 *
 * @param value - The value to convert
 *
 * @returns The converted value
 */

/**
 * The map of localized values for each width.
 */

/**
 * The index type of the locale unit value. It types conversion of units of
 * values that don't start at 0 (i.e. quarters).
 */

/**
 * Converts the unit value to the tuple of values.
 */

/**
 * The tuple of localized era values. The first element represents BC,
 * the second element represents AD.
 */

/**
 * The tuple of localized quarter values. The first element represents Q1.
 */

/**
 * The tuple of localized day values. The first element represents Sunday.
 */

/**
 * The tuple of localized month values. The first element represents January.
 */

function buildLocalizeFn(args) {
  return (value, options) => {
    const context = options?.context ? String(options.context) : "standalone";

    let valuesArray;
    if (context === "formatting" && args.formattingValues) {
      const defaultWidth = args.defaultFormattingWidth || args.defaultWidth;
      const width = options?.width ? String(options.width) : defaultWidth;

      valuesArray =
        args.formattingValues[width] || args.formattingValues[defaultWidth];
    } else {
      const defaultWidth = args.defaultWidth;
      const width = options?.width ? String(options.width) : args.defaultWidth;

      valuesArray = args.values[width] || args.values[defaultWidth];
    }
    const index = args.argumentCallback ? args.argumentCallback(value) : value;

    // @ts-expect-error - For some reason TypeScript just don't want to match it, no matter how hard we try. I challenge you to try to remove it!
    return valuesArray[index];
  };
}

;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/locale/en-US/_lib/localize.js


const eraValues = {
  narrow: ["B", "A"],
  abbreviated: ["BC", "AD"],
  wide: ["Before Christ", "Anno Domini"],
};

const quarterValues = {
  narrow: ["1", "2", "3", "4"],
  abbreviated: ["Q1", "Q2", "Q3", "Q4"],
  wide: ["1st quarter", "2nd quarter", "3rd quarter", "4th quarter"],
};

// Note: in English, the names of days of the week and months are capitalized.
// If you are making a new locale based on this one, check if the same is true for the language you're working on.
// Generally, formatted dates should look like they are in the middle of a sentence,
// e.g. in Spanish language the weekdays and months should be in the lowercase.
const monthValues = {
  narrow: ["J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"],
  abbreviated: [
    "Jan",
    "Feb",
    "Mar",
    "Apr",
    "May",
    "Jun",
    "Jul",
    "Aug",
    "Sep",
    "Oct",
    "Nov",
    "Dec",
  ],

  wide: [
    "January",
    "February",
    "March",
    "April",
    "May",
    "June",
    "July",
    "August",
    "September",
    "October",
    "November",
    "December",
  ],
};

const dayValues = {
  narrow: ["S", "M", "T", "W", "T", "F", "S"],
  short: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"],
  abbreviated: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
  wide: [
    "Sunday",
    "Monday",
    "Tuesday",
    "Wednesday",
    "Thursday",
    "Friday",
    "Saturday",
  ],
};

const dayPeriodValues = {
  narrow: {
    am: "a",
    pm: "p",
    midnight: "mi",
    noon: "n",
    morning: "morning",
    afternoon: "afternoon",
    evening: "evening",
    night: "night",
  },
  abbreviated: {
    am: "AM",
    pm: "PM",
    midnight: "midnight",
    noon: "noon",
    morning: "morning",
    afternoon: "afternoon",
    evening: "evening",
    night: "night",
  },
  wide: {
    am: "a.m.",
    pm: "p.m.",
    midnight: "midnight",
    noon: "noon",
    morning: "morning",
    afternoon: "afternoon",
    evening: "evening",
    night: "night",
  },
};

const formattingDayPeriodValues = {
  narrow: {
    am: "a",
    pm: "p",
    midnight: "mi",
    noon: "n",
    morning: "in the morning",
    afternoon: "in the afternoon",
    evening: "in the evening",
    night: "at night",
  },
  abbreviated: {
    am: "AM",
    pm: "PM",
    midnight: "midnight",
    noon: "noon",
    morning: "in the morning",
    afternoon: "in the afternoon",
    evening: "in the evening",
    night: "at night",
  },
  wide: {
    am: "a.m.",
    pm: "p.m.",
    midnight: "midnight",
    noon: "noon",
    morning: "in the morning",
    afternoon: "in the afternoon",
    evening: "in the evening",
    night: "at night",
  },
};

const ordinalNumber = (dirtyNumber, _options) => {
  const number = Number(dirtyNumber);

  // If ordinal numbers depend on context, for example,
  // if they are different for different grammatical genders,
  // use `options.unit`.
  //
  // `unit` can be 'year', 'quarter', 'month', 'week', 'date', 'dayOfYear',
  // 'day', 'hour', 'minute', 'second'.

  const rem100 = number % 100;
  if (rem100 > 20 || rem100 < 10) {
    switch (rem100 % 10) {
      case 1:
        return number + "st";
      case 2:
        return number + "nd";
      case 3:
        return number + "rd";
    }
  }
  return number + "th";
};

const localize = {
  ordinalNumber,

  era: buildLocalizeFn({
    values: eraValues,
    defaultWidth: "wide",
  }),

  quarter: buildLocalizeFn({
    values: quarterValues,
    defaultWidth: "wide",
    argumentCallback: (quarter) => quarter - 1,
  }),

  month: buildLocalizeFn({
    values: monthValues,
    defaultWidth: "wide",
  }),

  day: buildLocalizeFn({
    values: dayValues,
    defaultWidth: "wide",
  }),

  dayPeriod: buildLocalizeFn({
    values: dayPeriodValues,
    defaultWidth: "wide",
    formattingValues: formattingDayPeriodValues,
    defaultFormattingWidth: "wide",
  }),
};

;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/locale/_lib/buildMatchFn.js
function buildMatchFn(args) {
  return (string, options = {}) => {
    const width = options.width;

    const matchPattern =
      (width && args.matchPatterns[width]) ||
      args.matchPatterns[args.defaultMatchWidth];
    const matchResult = string.match(matchPattern);

    if (!matchResult) {
      return null;
    }
    const matchedString = matchResult[0];

    const parsePatterns =
      (width && args.parsePatterns[width]) ||
      args.parsePatterns[args.defaultParseWidth];

    const key = Array.isArray(parsePatterns)
      ? findIndex(parsePatterns, (pattern) => pattern.test(matchedString))
      : // [TODO] -- I challenge you to fix the type
        findKey(parsePatterns, (pattern) => pattern.test(matchedString));

    let value;

    value = args.valueCallback ? args.valueCallback(key) : key;
    value = options.valueCallback
      ? // [TODO] -- I challenge you to fix the type
        options.valueCallback(value)
      : value;

    const rest = string.slice(matchedString.length);

    return { value, rest };
  };
}

function findKey(object, predicate) {
  for (const key in object) {
    if (
      Object.prototype.hasOwnProperty.call(object, key) &&
      predicate(object[key])
    ) {
      return key;
    }
  }
  return undefined;
}

function findIndex(array, predicate) {
  for (let key = 0; key < array.length; key++) {
    if (predicate(array[key])) {
      return key;
    }
  }
  return undefined;
}

;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/locale/_lib/buildMatchPatternFn.js
function buildMatchPatternFn(args) {
  return (string, options = {}) => {
    const matchResult = string.match(args.matchPattern);
    if (!matchResult) return null;
    const matchedString = matchResult[0];

    const parseResult = string.match(args.parsePattern);
    if (!parseResult) return null;
    let value = args.valueCallback
      ? args.valueCallback(parseResult[0])
      : parseResult[0];

    // [TODO] I challenge you to fix the type
    value = options.valueCallback ? options.valueCallback(value) : value;

    const rest = string.slice(matchedString.length);

    return { value, rest };
  };
}

;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/locale/en-US/_lib/match.js



const matchOrdinalNumberPattern = /^(\d+)(th|st|nd|rd)?/i;
const parseOrdinalNumberPattern = /\d+/i;

const matchEraPatterns = {
  narrow: /^(b|a)/i,
  abbreviated: /^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,
  wide: /^(before christ|before common era|anno domini|common era)/i,
};
const parseEraPatterns = {
  any: [/^b/i, /^(a|c)/i],
};

const matchQuarterPatterns = {
  narrow: /^[1234]/i,
  abbreviated: /^q[1234]/i,
  wide: /^[1234](th|st|nd|rd)? quarter/i,
};
const parseQuarterPatterns = {
  any: [/1/i, /2/i, /3/i, /4/i],
};

const matchMonthPatterns = {
  narrow: /^[jfmasond]/i,
  abbreviated: /^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,
  wide: /^(january|february|march|april|may|june|july|august|september|october|november|december)/i,
};
const parseMonthPatterns = {
  narrow: [
    /^j/i,
    /^f/i,
    /^m/i,
    /^a/i,
    /^m/i,
    /^j/i,
    /^j/i,
    /^a/i,
    /^s/i,
    /^o/i,
    /^n/i,
    /^d/i,
  ],

  any: [
    /^ja/i,
    /^f/i,
    /^mar/i,
    /^ap/i,
    /^may/i,
    /^jun/i,
    /^jul/i,
    /^au/i,
    /^s/i,
    /^o/i,
    /^n/i,
    /^d/i,
  ],
};

const matchDayPatterns = {
  narrow: /^[smtwf]/i,
  short: /^(su|mo|tu|we|th|fr|sa)/i,
  abbreviated: /^(sun|mon|tue|wed|thu|fri|sat)/i,
  wide: /^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i,
};
const parseDayPatterns = {
  narrow: [/^s/i, /^m/i, /^t/i, /^w/i, /^t/i, /^f/i, /^s/i],
  any: [/^su/i, /^m/i, /^tu/i, /^w/i, /^th/i, /^f/i, /^sa/i],
};

const matchDayPeriodPatterns = {
  narrow: /^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,
  any: /^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i,
};
const parseDayPeriodPatterns = {
  any: {
    am: /^a/i,
    pm: /^p/i,
    midnight: /^mi/i,
    noon: /^no/i,
    morning: /morning/i,
    afternoon: /afternoon/i,
    evening: /evening/i,
    night: /night/i,
  },
};

const match_match = {
  ordinalNumber: buildMatchPatternFn({
    matchPattern: matchOrdinalNumberPattern,
    parsePattern: parseOrdinalNumberPattern,
    valueCallback: (value) => parseInt(value, 10),
  }),

  era: buildMatchFn({
    matchPatterns: matchEraPatterns,
    defaultMatchWidth: "wide",
    parsePatterns: parseEraPatterns,
    defaultParseWidth: "any",
  }),

  quarter: buildMatchFn({
    matchPatterns: matchQuarterPatterns,
    defaultMatchWidth: "wide",
    parsePatterns: parseQuarterPatterns,
    defaultParseWidth: "any",
    valueCallback: (index) => index + 1,
  }),

  month: buildMatchFn({
    matchPatterns: matchMonthPatterns,
    defaultMatchWidth: "wide",
    parsePatterns: parseMonthPatterns,
    defaultParseWidth: "any",
  }),

  day: buildMatchFn({
    matchPatterns: matchDayPatterns,
    defaultMatchWidth: "wide",
    parsePatterns: parseDayPatterns,
    defaultParseWidth: "any",
  }),

  dayPeriod: buildMatchFn({
    matchPatterns: matchDayPeriodPatterns,
    defaultMatchWidth: "any",
    parsePatterns: parseDayPeriodPatterns,
    defaultParseWidth: "any",
  }),
};

;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/locale/en-US.js






/**
 * @category Locales
 * @summary English locale (United States).
 * @language English
 * @iso-639-2 eng
 * @author Sasha Koss [@kossnocorp](https://github.com/kossnocorp)
 * @author Lesha Koss [@leshakoss](https://github.com/leshakoss)
 */
const enUS = {
  code: "en-US",
  formatDistance: formatDistance,
  formatLong: formatLong,
  formatRelative: formatRelative,
  localize: localize,
  match: match_match,
  options: {
    weekStartsOn: 0 /* Sunday */,
    firstWeekContainsDate: 1,
  },
};

// Fallback for modularized imports:
/* harmony default export */ const en_US = ((/* unused pure expression or super */ null && (enUS)));

;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/_lib/defaultOptions.js
let defaultOptions = {};

function getDefaultOptions() {
  return defaultOptions;
}

function setDefaultOptions(newOptions) {
  defaultOptions = newOptions;
}

;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/_lib/getTimezoneOffsetInMilliseconds.js


/**
 * Google Chrome as of 67.0.3396.87 introduced timezones with offset that includes seconds.
 * They usually appear for dates that denote time before the timezones were introduced
 * (e.g. for 'Europe/Prague' timezone the offset is GMT+00:57:44 before 1 October 1891
 * and GMT+01:00:00 after that date)
 *
 * Date#getTimezoneOffset returns the offset in minutes and would return 57 for the example above,
 * which would lead to incorrect calculations.
 *
 * This function returns the timezone offset in milliseconds that takes seconds in account.
 */
function getTimezoneOffsetInMilliseconds(date) {
  const _date = toDate(date);
  const utcDate = new Date(
    Date.UTC(
      _date.getFullYear(),
      _date.getMonth(),
      _date.getDate(),
      _date.getHours(),
      _date.getMinutes(),
      _date.getSeconds(),
      _date.getMilliseconds(),
    ),
  );
  utcDate.setUTCFullYear(_date.getFullYear());
  return +date - +utcDate;
}

;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/_lib/normalizeDates.js


function normalizeDates(context, ...dates) {
  const normalize = constructFrom.bind(
    null,
    context || dates.find((date) => typeof date === "object"),
  );
  return dates.map(normalize);
}

;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/startOfDay.js


/**
 * The {@link startOfDay} function options.
 */

/**
 * @name startOfDay
 * @category Day Helpers
 * @summary Return the start of a day for the given date.
 *
 * @description
 * Return the start of a day for the given date.
 * The result will be in the local timezone.
 *
 * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
 * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.
 *
 * @param date - The original date
 * @param options - The options
 *
 * @returns The start of a day
 *
 * @example
 * // The start of a day for 2 September 2014 11:55:00:
 * const result = startOfDay(new Date(2014, 8, 2, 11, 55, 0))
 * //=> Tue Sep 02 2014 00:00:00
 */
function startOfDay(date, options) {
  const _date = toDate(date, options?.in);
  _date.setHours(0, 0, 0, 0);
  return _date;
}

// Fallback for modularized imports:
/* harmony default export */ const date_fns_startOfDay = ((/* unused pure expression or super */ null && (startOfDay)));

;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/differenceInCalendarDays.js





/**
 * The {@link differenceInCalendarDays} function options.
 */

/**
 * @name differenceInCalendarDays
 * @category Day Helpers
 * @summary Get the number of calendar days between the given dates.
 *
 * @description
 * Get the number of calendar days between the given dates. This means that the times are removed
 * from the dates and then the difference in days is calculated.
 *
 * @param laterDate - The later date
 * @param earlierDate - The earlier date
 * @param options - The options object
 *
 * @returns The number of calendar days
 *
 * @example
 * // How many calendar days are between
 * // 2 July 2011 23:00:00 and 2 July 2012 00:00:00?
 * const result = differenceInCalendarDays(
 *   new Date(2012, 6, 2, 0, 0),
 *   new Date(2011, 6, 2, 23, 0)
 * )
 * //=> 366
 * // How many calendar days are between
 * // 2 July 2011 23:59:00 and 3 July 2011 00:01:00?
 * const result = differenceInCalendarDays(
 *   new Date(2011, 6, 3, 0, 1),
 *   new Date(2011, 6, 2, 23, 59)
 * )
 * //=> 1
 */
function differenceInCalendarDays(laterDate, earlierDate, options) {
  const [laterDate_, earlierDate_] = normalizeDates(
    options?.in,
    laterDate,
    earlierDate,
  );

  const laterStartOfDay = startOfDay(laterDate_);
  const earlierStartOfDay = startOfDay(earlierDate_);

  const laterTimestamp =
    +laterStartOfDay - getTimezoneOffsetInMilliseconds(laterStartOfDay);
  const earlierTimestamp =
    +earlierStartOfDay - getTimezoneOffsetInMilliseconds(earlierStartOfDay);

  // Round the number of days to the nearest integer because the number of
  // milliseconds in a day is not constant (e.g. it's different in the week of
  // the daylight saving time clock shift).
  return Math.round((laterTimestamp - earlierTimestamp) / millisecondsInDay);
}

// Fallback for modularized imports:
/* harmony default export */ const date_fns_differenceInCalendarDays = ((/* unused pure expression or super */ null && (differenceInCalendarDays)));

;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/startOfYear.js


/**
 * The {@link startOfYear} function options.
 */

/**
 * @name startOfYear
 * @category Year Helpers
 * @summary Return the start of a year for the given date.
 *
 * @description
 * Return the start of a year for the given date.
 * The result will be in the local timezone.
 *
 * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
 * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.
 *
 * @param date - The original date
 * @param options - The options
 *
 * @returns The start of a year
 *
 * @example
 * // The start of a year for 2 September 2014 11:55:00:
 * const result = startOfYear(new Date(2014, 8, 2, 11, 55, 00))
 * //=> Wed Jan 01 2014 00:00:00
 */
function startOfYear(date, options) {
  const date_ = toDate(date, options?.in);
  date_.setFullYear(date_.getFullYear(), 0, 1);
  date_.setHours(0, 0, 0, 0);
  return date_;
}

// Fallback for modularized imports:
/* harmony default export */ const date_fns_startOfYear = ((/* unused pure expression or super */ null && (startOfYear)));

;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/getDayOfYear.js




/**
 * The {@link getDayOfYear} function options.
 */

/**
 * @name getDayOfYear
 * @category Day Helpers
 * @summary Get the day of the year of the given date.
 *
 * @description
 * Get the day of the year of the given date.
 *
 * @param date - The given date
 * @param options - The options
 *
 * @returns The day of year
 *
 * @example
 * // Which day of the year is 2 July 2014?
 * const result = getDayOfYear(new Date(2014, 6, 2))
 * //=> 183
 */
function getDayOfYear(date, options) {
  const _date = toDate(date, options?.in);
  const diff = differenceInCalendarDays(_date, startOfYear(_date));
  const dayOfYear = diff + 1;
  return dayOfYear;
}

// Fallback for modularized imports:
/* harmony default export */ const date_fns_getDayOfYear = ((/* unused pure expression or super */ null && (getDayOfYear)));

;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/startOfWeek.js



/**
 * The {@link startOfWeek} function options.
 */

/**
 * @name startOfWeek
 * @category Week Helpers
 * @summary Return the start of a week for the given date.
 *
 * @description
 * Return the start of a week for the given date.
 * The result will be in the local timezone.
 *
 * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
 * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.
 *
 * @param date - The original date
 * @param options - An object with options
 *
 * @returns The start of a week
 *
 * @example
 * // The start of a week for 2 September 2014 11:55:00:
 * const result = startOfWeek(new Date(2014, 8, 2, 11, 55, 0))
 * //=> Sun Aug 31 2014 00:00:00
 *
 * @example
 * // If the week starts on Monday, the start of the week for 2 September 2014 11:55:00:
 * const result = startOfWeek(new Date(2014, 8, 2, 11, 55, 0), { weekStartsOn: 1 })
 * //=> Mon Sep 01 2014 00:00:00
 */
function startOfWeek(date, options) {
  const defaultOptions = getDefaultOptions();
  const weekStartsOn =
    options?.weekStartsOn ??
    options?.locale?.options?.weekStartsOn ??
    defaultOptions.weekStartsOn ??
    defaultOptions.locale?.options?.weekStartsOn ??
    0;

  const _date = toDate(date, options?.in);
  const day = _date.getDay();
  const diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;

  _date.setDate(_date.getDate() - diff);
  _date.setHours(0, 0, 0, 0);
  return _date;
}

// Fallback for modularized imports:
/* harmony default export */ const date_fns_startOfWeek = ((/* unused pure expression or super */ null && (startOfWeek)));

;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/startOfISOWeek.js


/**
 * The {@link startOfISOWeek} function options.
 */

/**
 * @name startOfISOWeek
 * @category ISO Week Helpers
 * @summary Return the start of an ISO week for the given date.
 *
 * @description
 * Return the start of an ISO week for the given date.
 * The result will be in the local timezone.
 *
 * ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date
 *
 * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
 * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.
 *
 * @param date - The original date
 * @param options - An object with options
 *
 * @returns The start of an ISO week
 *
 * @example
 * // The start of an ISO week for 2 September 2014 11:55:00:
 * const result = startOfISOWeek(new Date(2014, 8, 2, 11, 55, 0))
 * //=> Mon Sep 01 2014 00:00:00
 */
function startOfISOWeek(date, options) {
  return startOfWeek(date, { ...options, weekStartsOn: 1 });
}

// Fallback for modularized imports:
/* harmony default export */ const date_fns_startOfISOWeek = ((/* unused pure expression or super */ null && (startOfISOWeek)));

;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/getISOWeekYear.js




/**
 * The {@link getISOWeekYear} function options.
 */

/**
 * @name getISOWeekYear
 * @category ISO Week-Numbering Year Helpers
 * @summary Get the ISO week-numbering year of the given date.
 *
 * @description
 * Get the ISO week-numbering year of the given date,
 * which always starts 3 days before the year's first Thursday.
 *
 * ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date
 *
 * @param date - The given date
 *
 * @returns The ISO week-numbering year
 *
 * @example
 * // Which ISO-week numbering year is 2 January 2005?
 * const result = getISOWeekYear(new Date(2005, 0, 2))
 * //=> 2004
 */
function getISOWeekYear(date, options) {
  const _date = toDate(date, options?.in);
  const year = _date.getFullYear();

  const fourthOfJanuaryOfNextYear = constructFrom(_date, 0);
  fourthOfJanuaryOfNextYear.setFullYear(year + 1, 0, 4);
  fourthOfJanuaryOfNextYear.setHours(0, 0, 0, 0);
  const startOfNextYear = startOfISOWeek(fourthOfJanuaryOfNextYear);

  const fourthOfJanuaryOfThisYear = constructFrom(_date, 0);
  fourthOfJanuaryOfThisYear.setFullYear(year, 0, 4);
  fourthOfJanuaryOfThisYear.setHours(0, 0, 0, 0);
  const startOfThisYear = startOfISOWeek(fourthOfJanuaryOfThisYear);

  if (_date.getTime() >= startOfNextYear.getTime()) {
    return year + 1;
  } else if (_date.getTime() >= startOfThisYear.getTime()) {
    return year;
  } else {
    return year - 1;
  }
}

// Fallback for modularized imports:
/* harmony default export */ const date_fns_getISOWeekYear = ((/* unused pure expression or super */ null && (getISOWeekYear)));

;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/startOfISOWeekYear.js




/**
 * The {@link startOfISOWeekYear} function options.
 */

/**
 * @name startOfISOWeekYear
 * @category ISO Week-Numbering Year Helpers
 * @summary Return the start of an ISO week-numbering year for the given date.
 *
 * @description
 * Return the start of an ISO week-numbering year,
 * which always starts 3 days before the year's first Thursday.
 * The result will be in the local timezone.
 *
 * ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date
 *
 * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
 * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.
 *
 * @param date - The original date
 * @param options - An object with options
 *
 * @returns The start of an ISO week-numbering year
 *
 * @example
 * // The start of an ISO week-numbering year for 2 July 2005:
 * const result = startOfISOWeekYear(new Date(2005, 6, 2))
 * //=> Mon Jan 03 2005 00:00:00
 */
function startOfISOWeekYear(date, options) {
  const year = getISOWeekYear(date, options);
  const fourthOfJanuary = constructFrom(options?.in || date, 0);
  fourthOfJanuary.setFullYear(year, 0, 4);
  fourthOfJanuary.setHours(0, 0, 0, 0);
  return startOfISOWeek(fourthOfJanuary);
}

// Fallback for modularized imports:
/* harmony default export */ const date_fns_startOfISOWeekYear = ((/* unused pure expression or super */ null && (startOfISOWeekYear)));

;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/getISOWeek.js





/**
 * The {@link getISOWeek} function options.
 */

/**
 * @name getISOWeek
 * @category ISO Week Helpers
 * @summary Get the ISO week of the given date.
 *
 * @description
 * Get the ISO week of the given date.
 *
 * ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date
 *
 * @param date - The given date
 * @param options - The options
 *
 * @returns The ISO week
 *
 * @example
 * // Which week of the ISO-week numbering year is 2 January 2005?
 * const result = getISOWeek(new Date(2005, 0, 2))
 * //=> 53
 */
function getISOWeek(date, options) {
  const _date = toDate(date, options?.in);
  const diff = +startOfISOWeek(_date) - +startOfISOWeekYear(_date);

  // Round the number of weeks to the nearest integer because the number of
  // milliseconds in a week is not constant (e.g. it's different in the week of
  // the daylight saving time clock shift).
  return Math.round(diff / millisecondsInWeek) + 1;
}

// Fallback for modularized imports:
/* harmony default export */ const date_fns_getISOWeek = ((/* unused pure expression or super */ null && (getISOWeek)));

;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/getWeekYear.js





/**
 * The {@link getWeekYear} function options.
 */

/**
 * @name getWeekYear
 * @category Week-Numbering Year Helpers
 * @summary Get the local week-numbering year of the given date.
 *
 * @description
 * Get the local week-numbering year of the given date.
 * The exact calculation depends on the values of
 * `options.weekStartsOn` (which is the index of the first day of the week)
 * and `options.firstWeekContainsDate` (which is the day of January, which is always in
 * the first week of the week-numbering year)
 *
 * Week numbering: https://en.wikipedia.org/wiki/Week#The_ISO_week_date_system
 *
 * @param date - The given date
 * @param options - An object with options.
 *
 * @returns The local week-numbering year
 *
 * @example
 * // Which week numbering year is 26 December 2004 with the default settings?
 * const result = getWeekYear(new Date(2004, 11, 26))
 * //=> 2005
 *
 * @example
 * // Which week numbering year is 26 December 2004 if week starts on Saturday?
 * const result = getWeekYear(new Date(2004, 11, 26), { weekStartsOn: 6 })
 * //=> 2004
 *
 * @example
 * // Which week numbering year is 26 December 2004 if the first week contains 4 January?
 * const result = getWeekYear(new Date(2004, 11, 26), { firstWeekContainsDate: 4 })
 * //=> 2004
 */
function getWeekYear(date, options) {
  const _date = toDate(date, options?.in);
  const year = _date.getFullYear();

  const defaultOptions = getDefaultOptions();
  const firstWeekContainsDate =
    options?.firstWeekContainsDate ??
    options?.locale?.options?.firstWeekContainsDate ??
    defaultOptions.firstWeekContainsDate ??
    defaultOptions.locale?.options?.firstWeekContainsDate ??
    1;

  const firstWeekOfNextYear = constructFrom(options?.in || date, 0);
  firstWeekOfNextYear.setFullYear(year + 1, 0, firstWeekContainsDate);
  firstWeekOfNextYear.setHours(0, 0, 0, 0);
  const startOfNextYear = startOfWeek(firstWeekOfNextYear, options);

  const firstWeekOfThisYear = constructFrom(options?.in || date, 0);
  firstWeekOfThisYear.setFullYear(year, 0, firstWeekContainsDate);
  firstWeekOfThisYear.setHours(0, 0, 0, 0);
  const startOfThisYear = startOfWeek(firstWeekOfThisYear, options);

  if (+_date >= +startOfNextYear) {
    return year + 1;
  } else if (+_date >= +startOfThisYear) {
    return year;
  } else {
    return year - 1;
  }
}

// Fallback for modularized imports:
/* harmony default export */ const date_fns_getWeekYear = ((/* unused pure expression or super */ null && (getWeekYear)));

;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/startOfWeekYear.js





/**
 * The {@link startOfWeekYear} function options.
 */

/**
 * @name startOfWeekYear
 * @category Week-Numbering Year Helpers
 * @summary Return the start of a local week-numbering year for the given date.
 *
 * @description
 * Return the start of a local week-numbering year.
 * The exact calculation depends on the values of
 * `options.weekStartsOn` (which is the index of the first day of the week)
 * and `options.firstWeekContainsDate` (which is the day of January, which is always in
 * the first week of the week-numbering year)
 *
 * Week numbering: https://en.wikipedia.org/wiki/Week#The_ISO_week_date_system
 *
 * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
 * @typeParam ResultDate - The result `Date` type.
 *
 * @param date - The original date
 * @param options - An object with options
 *
 * @returns The start of a week-numbering year
 *
 * @example
 * // The start of an a week-numbering year for 2 July 2005 with default settings:
 * const result = startOfWeekYear(new Date(2005, 6, 2))
 * //=> Sun Dec 26 2004 00:00:00
 *
 * @example
 * // The start of a week-numbering year for 2 July 2005
 * // if Monday is the first day of week
 * // and 4 January is always in the first week of the year:
 * const result = startOfWeekYear(new Date(2005, 6, 2), {
 *   weekStartsOn: 1,
 *   firstWeekContainsDate: 4
 * })
 * //=> Mon Jan 03 2005 00:00:00
 */
function startOfWeekYear(date, options) {
  const defaultOptions = getDefaultOptions();
  const firstWeekContainsDate =
    options?.firstWeekContainsDate ??
    options?.locale?.options?.firstWeekContainsDate ??
    defaultOptions.firstWeekContainsDate ??
    defaultOptions.locale?.options?.firstWeekContainsDate ??
    1;

  const year = getWeekYear(date, options);
  const firstWeek = constructFrom(options?.in || date, 0);
  firstWeek.setFullYear(year, 0, firstWeekContainsDate);
  firstWeek.setHours(0, 0, 0, 0);
  const _date = startOfWeek(firstWeek, options);
  return _date;
}

// Fallback for modularized imports:
/* harmony default export */ const date_fns_startOfWeekYear = ((/* unused pure expression or super */ null && (startOfWeekYear)));

;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/getWeek.js





/**
 * The {@link getWeek} function options.
 */

/**
 * @name getWeek
 * @category Week Helpers
 * @summary Get the local week index of the given date.
 *
 * @description
 * Get the local week index of the given date.
 * The exact calculation depends on the values of
 * `options.weekStartsOn` (which is the index of the first day of the week)
 * and `options.firstWeekContainsDate` (which is the day of January, which is always in
 * the first week of the week-numbering year)
 *
 * Week numbering: https://en.wikipedia.org/wiki/Week#The_ISO_week_date_system
 *
 * @param date - The given date
 * @param options - An object with options
 *
 * @returns The week
 *
 * @example
 * // Which week of the local week numbering year is 2 January 2005 with default options?
 * const result = getWeek(new Date(2005, 0, 2))
 * //=> 2
 *
 * @example
 * // Which week of the local week numbering year is 2 January 2005,
 * // if Monday is the first day of the week,
 * // and the first week of the year always contains 4 January?
 * const result = getWeek(new Date(2005, 0, 2), {
 *   weekStartsOn: 1,
 *   firstWeekContainsDate: 4
 * })
 * //=> 53
 */
function getWeek(date, options) {
  const _date = toDate(date, options?.in);
  const diff = +startOfWeek(_date, options) - +startOfWeekYear(_date, options);

  // Round the number of weeks to the nearest integer because the number of
  // milliseconds in a week is not constant (e.g. it's different in the week of
  // the daylight saving time clock shift).
  return Math.round(diff / millisecondsInWeek) + 1;
}

// Fallback for modularized imports:
/* harmony default export */ const date_fns_getWeek = ((/* unused pure expression or super */ null && (getWeek)));

;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/_lib/addLeadingZeros.js
function addLeadingZeros(number, targetLength) {
  const sign = number < 0 ? "-" : "";
  const output = Math.abs(number).toString().padStart(targetLength, "0");
  return sign + output;
}

;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/_lib/format/lightFormatters.js


/*
 * |     | Unit                           |     | Unit                           |
 * |-----|--------------------------------|-----|--------------------------------|
 * |  a  | AM, PM                         |  A* |                                |
 * |  d  | Day of month                   |  D  |                                |
 * |  h  | Hour [1-12]                    |  H  | Hour [0-23]                    |
 * |  m  | Minute                         |  M  | Month                          |
 * |  s  | Second                         |  S  | Fraction of second             |
 * |  y  | Year (abs)                     |  Y  |                                |
 *
 * Letters marked by * are not implemented but reserved by Unicode standard.
 */

const lightFormatters = {
  // Year
  y(date, token) {
    // From http://www.unicode.org/reports/tr35/tr35-31/tr35-dates.html#Date_Format_tokens
    // | Year     |     y | yy |   yyy |  yyyy | yyyyy |
    // |----------|-------|----|-------|-------|-------|
    // | AD 1     |     1 | 01 |   001 |  0001 | 00001 |
    // | AD 12    |    12 | 12 |   012 |  0012 | 00012 |
    // | AD 123   |   123 | 23 |   123 |  0123 | 00123 |
    // | AD 1234  |  1234 | 34 |  1234 |  1234 | 01234 |
    // | AD 12345 | 12345 | 45 | 12345 | 12345 | 12345 |

    const signedYear = date.getFullYear();
    // Returns 1 for 1 BC (which is year 0 in JavaScript)
    const year = signedYear > 0 ? signedYear : 1 - signedYear;
    return addLeadingZeros(token === "yy" ? year % 100 : year, token.length);
  },

  // Month
  M(date, token) {
    const month = date.getMonth();
    return token === "M" ? String(month + 1) : addLeadingZeros(month + 1, 2);
  },

  // Day of the month
  d(date, token) {
    return addLeadingZeros(date.getDate(), token.length);
  },

  // AM or PM
  a(date, token) {
    const dayPeriodEnumValue = date.getHours() / 12 >= 1 ? "pm" : "am";

    switch (token) {
      case "a":
      case "aa":
        return dayPeriodEnumValue.toUpperCase();
      case "aaa":
        return dayPeriodEnumValue;
      case "aaaaa":
        return dayPeriodEnumValue[0];
      case "aaaa":
      default:
        return dayPeriodEnumValue === "am" ? "a.m." : "p.m.";
    }
  },

  // Hour [1-12]
  h(date, token) {
    return addLeadingZeros(date.getHours() % 12 || 12, token.length);
  },

  // Hour [0-23]
  H(date, token) {
    return addLeadingZeros(date.getHours(), token.length);
  },

  // Minute
  m(date, token) {
    return addLeadingZeros(date.getMinutes(), token.length);
  },

  // Second
  s(date, token) {
    return addLeadingZeros(date.getSeconds(), token.length);
  },

  // Fraction of second
  S(date, token) {
    const numberOfDigits = token.length;
    const milliseconds = date.getMilliseconds();
    const fractionalSeconds = Math.trunc(
      milliseconds * Math.pow(10, numberOfDigits - 3),
    );
    return addLeadingZeros(fractionalSeconds, token.length);
  },
};

;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/_lib/format/formatters.js









const dayPeriodEnum = {
  am: "am",
  pm: "pm",
  midnight: "midnight",
  noon: "noon",
  morning: "morning",
  afternoon: "afternoon",
  evening: "evening",
  night: "night",
};

/*
 * |     | Unit                           |     | Unit                           |
 * |-----|--------------------------------|-----|--------------------------------|
 * |  a  | AM, PM                         |  A* | Milliseconds in day            |
 * |  b  | AM, PM, noon, midnight         |  B  | Flexible day period            |
 * |  c  | Stand-alone local day of week  |  C* | Localized hour w/ day period   |
 * |  d  | Day of month                   |  D  | Day of year                    |
 * |  e  | Local day of week              |  E  | Day of week                    |
 * |  f  |                                |  F* | Day of week in month           |
 * |  g* | Modified Julian day            |  G  | Era                            |
 * |  h  | Hour [1-12]                    |  H  | Hour [0-23]                    |
 * |  i! | ISO day of week                |  I! | ISO week of year               |
 * |  j* | Localized hour w/ day period   |  J* | Localized hour w/o day period  |
 * |  k  | Hour [1-24]                    |  K  | Hour [0-11]                    |
 * |  l* | (deprecated)                   |  L  | Stand-alone month              |
 * |  m  | Minute                         |  M  | Month                          |
 * |  n  |                                |  N  |                                |
 * |  o! | Ordinal number modifier        |  O  | Timezone (GMT)                 |
 * |  p! | Long localized time            |  P! | Long localized date            |
 * |  q  | Stand-alone quarter            |  Q  | Quarter                        |
 * |  r* | Related Gregorian year         |  R! | ISO week-numbering year        |
 * |  s  | Second                         |  S  | Fraction of second             |
 * |  t! | Seconds timestamp              |  T! | Milliseconds timestamp         |
 * |  u  | Extended year                  |  U* | Cyclic year                    |
 * |  v* | Timezone (generic non-locat.)  |  V* | Timezone (location)            |
 * |  w  | Local week of year             |  W* | Week of month                  |
 * |  x  | Timezone (ISO-8601 w/o Z)      |  X  | Timezone (ISO-8601)            |
 * |  y  | Year (abs)                     |  Y  | Local week-numbering year      |
 * |  z  | Timezone (specific non-locat.) |  Z* | Timezone (aliases)             |
 *
 * Letters marked by * are not implemented but reserved by Unicode standard.
 *
 * Letters marked by ! are non-standard, but implemented by date-fns:
 * - `o` modifies the previous token to turn it into an ordinal (see `format` docs)
 * - `i` is ISO day of week. For `i` and `ii` is returns numeric ISO week days,
 *   i.e. 7 for Sunday, 1 for Monday, etc.
 * - `I` is ISO week of year, as opposed to `w` which is local week of year.
 * - `R` is ISO week-numbering year, as opposed to `Y` which is local week-numbering year.
 *   `R` is supposed to be used in conjunction with `I` and `i`
 *   for universal ISO week-numbering date, whereas
 *   `Y` is supposed to be used in conjunction with `w` and `e`
 *   for week-numbering date specific to the locale.
 * - `P` is long localized date format
 * - `p` is long localized time format
 */

const formatters = {
  // Era
  G: function (date, token, localize) {
    const era = date.getFullYear() > 0 ? 1 : 0;
    switch (token) {
      // AD, BC
      case "G":
      case "GG":
      case "GGG":
        return localize.era(era, { width: "abbreviated" });
      // A, B
      case "GGGGG":
        return localize.era(era, { width: "narrow" });
      // Anno Domini, Before Christ
      case "GGGG":
      default:
        return localize.era(era, { width: "wide" });
    }
  },

  // Year
  y: function (date, token, localize) {
    // Ordinal number
    if (token === "yo") {
      const signedYear = date.getFullYear();
      // Returns 1 for 1 BC (which is year 0 in JavaScript)
      const year = signedYear > 0 ? signedYear : 1 - signedYear;
      return localize.ordinalNumber(year, { unit: "year" });
    }

    return lightFormatters.y(date, token);
  },

  // Local week-numbering year
  Y: function (date, token, localize, options) {
    const signedWeekYear = getWeekYear(date, options);
    // Returns 1 for 1 BC (which is year 0 in JavaScript)
    const weekYear = signedWeekYear > 0 ? signedWeekYear : 1 - signedWeekYear;

    // Two digit year
    if (token === "YY") {
      const twoDigitYear = weekYear % 100;
      return addLeadingZeros(twoDigitYear, 2);
    }

    // Ordinal number
    if (token === "Yo") {
      return localize.ordinalNumber(weekYear, { unit: "year" });
    }

    // Padding
    return addLeadingZeros(weekYear, token.length);
  },

  // ISO week-numbering year
  R: function (date, token) {
    const isoWeekYear = getISOWeekYear(date);

    // Padding
    return addLeadingZeros(isoWeekYear, token.length);
  },

  // Extended year. This is a single number designating the year of this calendar system.
  // The main difference between `y` and `u` localizers are B.C. years:
  // | Year | `y` | `u` |
  // |------|-----|-----|
  // | AC 1 |   1 |   1 |
  // | BC 1 |   1 |   0 |
  // | BC 2 |   2 |  -1 |
  // Also `yy` always returns the last two digits of a year,
  // while `uu` pads single digit years to 2 characters and returns other years unchanged.
  u: function (date, token) {
    const year = date.getFullYear();
    return addLeadingZeros(year, token.length);
  },

  // Quarter
  Q: function (date, token, localize) {
    const quarter = Math.ceil((date.getMonth() + 1) / 3);
    switch (token) {
      // 1, 2, 3, 4
      case "Q":
        return String(quarter);
      // 01, 02, 03, 04
      case "QQ":
        return addLeadingZeros(quarter, 2);
      // 1st, 2nd, 3rd, 4th
      case "Qo":
        return localize.ordinalNumber(quarter, { unit: "quarter" });
      // Q1, Q2, Q3, Q4
      case "QQQ":
        return localize.quarter(quarter, {
          width: "abbreviated",
          context: "formatting",
        });
      // 1, 2, 3, 4 (narrow quarter; could be not numerical)
      case "QQQQQ":
        return localize.quarter(quarter, {
          width: "narrow",
          context: "formatting",
        });
      // 1st quarter, 2nd quarter, ...
      case "QQQQ":
      default:
        return localize.quarter(quarter, {
          width: "wide",
          context: "formatting",
        });
    }
  },

  // Stand-alone quarter
  q: function (date, token, localize) {
    const quarter = Math.ceil((date.getMonth() + 1) / 3);
    switch (token) {
      // 1, 2, 3, 4
      case "q":
        return String(quarter);
      // 01, 02, 03, 04
      case "qq":
        return addLeadingZeros(quarter, 2);
      // 1st, 2nd, 3rd, 4th
      case "qo":
        return localize.ordinalNumber(quarter, { unit: "quarter" });
      // Q1, Q2, Q3, Q4
      case "qqq":
        return localize.quarter(quarter, {
          width: "abbreviated",
          context: "standalone",
        });
      // 1, 2, 3, 4 (narrow quarter; could be not numerical)
      case "qqqqq":
        return localize.quarter(quarter, {
          width: "narrow",
          context: "standalone",
        });
      // 1st quarter, 2nd quarter, ...
      case "qqqq":
      default:
        return localize.quarter(quarter, {
          width: "wide",
          context: "standalone",
        });
    }
  },

  // Month
  M: function (date, token, localize) {
    const month = date.getMonth();
    switch (token) {
      case "M":
      case "MM":
        return lightFormatters.M(date, token);
      // 1st, 2nd, ..., 12th
      case "Mo":
        return localize.ordinalNumber(month + 1, { unit: "month" });
      // Jan, Feb, ..., Dec
      case "MMM":
        return localize.month(month, {
          width: "abbreviated",
          context: "formatting",
        });
      // J, F, ..., D
      case "MMMMM":
        return localize.month(month, {
          width: "narrow",
          context: "formatting",
        });
      // January, February, ..., December
      case "MMMM":
      default:
        return localize.month(month, { width: "wide", context: "formatting" });
    }
  },

  // Stand-alone month
  L: function (date, token, localize) {
    const month = date.getMonth();
    switch (token) {
      // 1, 2, ..., 12
      case "L":
        return String(month + 1);
      // 01, 02, ..., 12
      case "LL":
        return addLeadingZeros(month + 1, 2);
      // 1st, 2nd, ..., 12th
      case "Lo":
        return localize.ordinalNumber(month + 1, { unit: "month" });
      // Jan, Feb, ..., Dec
      case "LLL":
        return localize.month(month, {
          width: "abbreviated",
          context: "standalone",
        });
      // J, F, ..., D
      case "LLLLL":
        return localize.month(month, {
          width: "narrow",
          context: "standalone",
        });
      // January, February, ..., December
      case "LLLL":
      default:
        return localize.month(month, { width: "wide", context: "standalone" });
    }
  },

  // Local week of year
  w: function (date, token, localize, options) {
    const week = getWeek(date, options);

    if (token === "wo") {
      return localize.ordinalNumber(week, { unit: "week" });
    }

    return addLeadingZeros(week, token.length);
  },

  // ISO week of year
  I: function (date, token, localize) {
    const isoWeek = getISOWeek(date);

    if (token === "Io") {
      return localize.ordinalNumber(isoWeek, { unit: "week" });
    }

    return addLeadingZeros(isoWeek, token.length);
  },

  // Day of the month
  d: function (date, token, localize) {
    if (token === "do") {
      return localize.ordinalNumber(date.getDate(), { unit: "date" });
    }

    return lightFormatters.d(date, token);
  },

  // Day of year
  D: function (date, token, localize) {
    const dayOfYear = getDayOfYear(date);

    if (token === "Do") {
      return localize.ordinalNumber(dayOfYear, { unit: "dayOfYear" });
    }

    return addLeadingZeros(dayOfYear, token.length);
  },

  // Day of week
  E: function (date, token, localize) {
    const dayOfWeek = date.getDay();
    switch (token) {
      // Tue
      case "E":
      case "EE":
      case "EEE":
        return localize.day(dayOfWeek, {
          width: "abbreviated",
          context: "formatting",
        });
      // T
      case "EEEEE":
        return localize.day(dayOfWeek, {
          width: "narrow",
          context: "formatting",
        });
      // Tu
      case "EEEEEE":
        return localize.day(dayOfWeek, {
          width: "short",
          context: "formatting",
        });
      // Tuesday
      case "EEEE":
      default:
        return localize.day(dayOfWeek, {
          width: "wide",
          context: "formatting",
        });
    }
  },

  // Local day of week
  e: function (date, token, localize, options) {
    const dayOfWeek = date.getDay();
    const localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7;
    switch (token) {
      // Numerical value (Nth day of week with current locale or weekStartsOn)
      case "e":
        return String(localDayOfWeek);
      // Padded numerical value
      case "ee":
        return addLeadingZeros(localDayOfWeek, 2);
      // 1st, 2nd, ..., 7th
      case "eo":
        return localize.ordinalNumber(localDayOfWeek, { unit: "day" });
      case "eee":
        return localize.day(dayOfWeek, {
          width: "abbreviated",
          context: "formatting",
        });
      // T
      case "eeeee":
        return localize.day(dayOfWeek, {
          width: "narrow",
          context: "formatting",
        });
      // Tu
      case "eeeeee":
        return localize.day(dayOfWeek, {
          width: "short",
          context: "formatting",
        });
      // Tuesday
      case "eeee":
      default:
        return localize.day(dayOfWeek, {
          width: "wide",
          context: "formatting",
        });
    }
  },

  // Stand-alone local day of week
  c: function (date, token, localize, options) {
    const dayOfWeek = date.getDay();
    const localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7;
    switch (token) {
      // Numerical value (same as in `e`)
      case "c":
        return String(localDayOfWeek);
      // Padded numerical value
      case "cc":
        return addLeadingZeros(localDayOfWeek, token.length);
      // 1st, 2nd, ..., 7th
      case "co":
        return localize.ordinalNumber(localDayOfWeek, { unit: "day" });
      case "ccc":
        return localize.day(dayOfWeek, {
          width: "abbreviated",
          context: "standalone",
        });
      // T
      case "ccccc":
        return localize.day(dayOfWeek, {
          width: "narrow",
          context: "standalone",
        });
      // Tu
      case "cccccc":
        return localize.day(dayOfWeek, {
          width: "short",
          context: "standalone",
        });
      // Tuesday
      case "cccc":
      default:
        return localize.day(dayOfWeek, {
          width: "wide",
          context: "standalone",
        });
    }
  },

  // ISO day of week
  i: function (date, token, localize) {
    const dayOfWeek = date.getDay();
    const isoDayOfWeek = dayOfWeek === 0 ? 7 : dayOfWeek;
    switch (token) {
      // 2
      case "i":
        return String(isoDayOfWeek);
      // 02
      case "ii":
        return addLeadingZeros(isoDayOfWeek, token.length);
      // 2nd
      case "io":
        return localize.ordinalNumber(isoDayOfWeek, { unit: "day" });
      // Tue
      case "iii":
        return localize.day(dayOfWeek, {
          width: "abbreviated",
          context: "formatting",
        });
      // T
      case "iiiii":
        return localize.day(dayOfWeek, {
          width: "narrow",
          context: "formatting",
        });
      // Tu
      case "iiiiii":
        return localize.day(dayOfWeek, {
          width: "short",
          context: "formatting",
        });
      // Tuesday
      case "iiii":
      default:
        return localize.day(dayOfWeek, {
          width: "wide",
          context: "formatting",
        });
    }
  },

  // AM or PM
  a: function (date, token, localize) {
    const hours = date.getHours();
    const dayPeriodEnumValue = hours / 12 >= 1 ? "pm" : "am";

    switch (token) {
      case "a":
      case "aa":
        return localize.dayPeriod(dayPeriodEnumValue, {
          width: "abbreviated",
          context: "formatting",
        });
      case "aaa":
        return localize
          .dayPeriod(dayPeriodEnumValue, {
            width: "abbreviated",
            context: "formatting",
          })
          .toLowerCase();
      case "aaaaa":
        return localize.dayPeriod(dayPeriodEnumValue, {
          width: "narrow",
          context: "formatting",
        });
      case "aaaa":
      default:
        return localize.dayPeriod(dayPeriodEnumValue, {
          width: "wide",
          context: "formatting",
        });
    }
  },

  // AM, PM, midnight, noon
  b: function (date, token, localize) {
    const hours = date.getHours();
    let dayPeriodEnumValue;
    if (hours === 12) {
      dayPeriodEnumValue = dayPeriodEnum.noon;
    } else if (hours === 0) {
      dayPeriodEnumValue = dayPeriodEnum.midnight;
    } else {
      dayPeriodEnumValue = hours / 12 >= 1 ? "pm" : "am";
    }

    switch (token) {
      case "b":
      case "bb":
        return localize.dayPeriod(dayPeriodEnumValue, {
          width: "abbreviated",
          context: "formatting",
        });
      case "bbb":
        return localize
          .dayPeriod(dayPeriodEnumValue, {
            width: "abbreviated",
            context: "formatting",
          })
          .toLowerCase();
      case "bbbbb":
        return localize.dayPeriod(dayPeriodEnumValue, {
          width: "narrow",
          context: "formatting",
        });
      case "bbbb":
      default:
        return localize.dayPeriod(dayPeriodEnumValue, {
          width: "wide",
          context: "formatting",
        });
    }
  },

  // in the morning, in the afternoon, in the evening, at night
  B: function (date, token, localize) {
    const hours = date.getHours();
    let dayPeriodEnumValue;
    if (hours >= 17) {
      dayPeriodEnumValue = dayPeriodEnum.evening;
    } else if (hours >= 12) {
      dayPeriodEnumValue = dayPeriodEnum.afternoon;
    } else if (hours >= 4) {
      dayPeriodEnumValue = dayPeriodEnum.morning;
    } else {
      dayPeriodEnumValue = dayPeriodEnum.night;
    }

    switch (token) {
      case "B":
      case "BB":
      case "BBB":
        return localize.dayPeriod(dayPeriodEnumValue, {
          width: "abbreviated",
          context: "formatting",
        });
      case "BBBBB":
        return localize.dayPeriod(dayPeriodEnumValue, {
          width: "narrow",
          context: "formatting",
        });
      case "BBBB":
      default:
        return localize.dayPeriod(dayPeriodEnumValue, {
          width: "wide",
          context: "formatting",
        });
    }
  },

  // Hour [1-12]
  h: function (date, token, localize) {
    if (token === "ho") {
      let hours = date.getHours() % 12;
      if (hours === 0) hours = 12;
      return localize.ordinalNumber(hours, { unit: "hour" });
    }

    return lightFormatters.h(date, token);
  },

  // Hour [0-23]
  H: function (date, token, localize) {
    if (token === "Ho") {
      return localize.ordinalNumber(date.getHours(), { unit: "hour" });
    }

    return lightFormatters.H(date, token);
  },

  // Hour [0-11]
  K: function (date, token, localize) {
    const hours = date.getHours() % 12;

    if (token === "Ko") {
      return localize.ordinalNumber(hours, { unit: "hour" });
    }

    return addLeadingZeros(hours, token.length);
  },

  // Hour [1-24]
  k: function (date, token, localize) {
    let hours = date.getHours();
    if (hours === 0) hours = 24;

    if (token === "ko") {
      return localize.ordinalNumber(hours, { unit: "hour" });
    }

    return addLeadingZeros(hours, token.length);
  },

  // Minute
  m: function (date, token, localize) {
    if (token === "mo") {
      return localize.ordinalNumber(date.getMinutes(), { unit: "minute" });
    }

    return lightFormatters.m(date, token);
  },

  // Second
  s: function (date, token, localize) {
    if (token === "so") {
      return localize.ordinalNumber(date.getSeconds(), { unit: "second" });
    }

    return lightFormatters.s(date, token);
  },

  // Fraction of second
  S: function (date, token) {
    return lightFormatters.S(date, token);
  },

  // Timezone (ISO-8601. If offset is 0, output is always `'Z'`)
  X: function (date, token, _localize) {
    const timezoneOffset = date.getTimezoneOffset();

    if (timezoneOffset === 0) {
      return "Z";
    }

    switch (token) {
      // Hours and optional minutes
      case "X":
        return formatTimezoneWithOptionalMinutes(timezoneOffset);

      // Hours, minutes and optional seconds without `:` delimiter
      // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
      // so this token always has the same output as `XX`
      case "XXXX":
      case "XX": // Hours and minutes without `:` delimiter
        return formatTimezone(timezoneOffset);

      // Hours, minutes and optional seconds with `:` delimiter
      // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
      // so this token always has the same output as `XXX`
      case "XXXXX":
      case "XXX": // Hours and minutes with `:` delimiter
      default:
        return formatTimezone(timezoneOffset, ":");
    }
  },

  // Timezone (ISO-8601. If offset is 0, output is `'+00:00'` or equivalent)
  x: function (date, token, _localize) {
    const timezoneOffset = date.getTimezoneOffset();

    switch (token) {
      // Hours and optional minutes
      case "x":
        return formatTimezoneWithOptionalMinutes(timezoneOffset);

      // Hours, minutes and optional seconds without `:` delimiter
      // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
      // so this token always has the same output as `xx`
      case "xxxx":
      case "xx": // Hours and minutes without `:` delimiter
        return formatTimezone(timezoneOffset);

      // Hours, minutes and optional seconds with `:` delimiter
      // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
      // so this token always has the same output as `xxx`
      case "xxxxx":
      case "xxx": // Hours and minutes with `:` delimiter
      default:
        return formatTimezone(timezoneOffset, ":");
    }
  },

  // Timezone (GMT)
  O: function (date, token, _localize) {
    const timezoneOffset = date.getTimezoneOffset();

    switch (token) {
      // Short
      case "O":
      case "OO":
      case "OOO":
        return "GMT" + formatTimezoneShort(timezoneOffset, ":");
      // Long
      case "OOOO":
      default:
        return "GMT" + formatTimezone(timezoneOffset, ":");
    }
  },

  // Timezone (specific non-location)
  z: function (date, token, _localize) {
    const timezoneOffset = date.getTimezoneOffset();

    switch (token) {
      // Short
      case "z":
      case "zz":
      case "zzz":
        return "GMT" + formatTimezoneShort(timezoneOffset, ":");
      // Long
      case "zzzz":
      default:
        return "GMT" + formatTimezone(timezoneOffset, ":");
    }
  },

  // Seconds timestamp
  t: function (date, token, _localize) {
    const timestamp = Math.trunc(+date / 1000);
    return addLeadingZeros(timestamp, token.length);
  },

  // Milliseconds timestamp
  T: function (date, token, _localize) {
    return addLeadingZeros(+date, token.length);
  },
};

function formatTimezoneShort(offset, delimiter = "") {
  const sign = offset > 0 ? "-" : "+";
  const absOffset = Math.abs(offset);
  const hours = Math.trunc(absOffset / 60);
  const minutes = absOffset % 60;
  if (minutes === 0) {
    return sign + String(hours);
  }
  return sign + String(hours) + delimiter + addLeadingZeros(minutes, 2);
}

function formatTimezoneWithOptionalMinutes(offset, delimiter) {
  if (offset % 60 === 0) {
    const sign = offset > 0 ? "-" : "+";
    return sign + addLeadingZeros(Math.abs(offset) / 60, 2);
  }
  return formatTimezone(offset, delimiter);
}

function formatTimezone(offset, delimiter = "") {
  const sign = offset > 0 ? "-" : "+";
  const absOffset = Math.abs(offset);
  const hours = addLeadingZeros(Math.trunc(absOffset / 60), 2);
  const minutes = addLeadingZeros(absOffset % 60, 2);
  return sign + hours + delimiter + minutes;
}

;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/_lib/format/longFormatters.js
const dateLongFormatter = (pattern, formatLong) => {
  switch (pattern) {
    case "P":
      return formatLong.date({ width: "short" });
    case "PP":
      return formatLong.date({ width: "medium" });
    case "PPP":
      return formatLong.date({ width: "long" });
    case "PPPP":
    default:
      return formatLong.date({ width: "full" });
  }
};

const timeLongFormatter = (pattern, formatLong) => {
  switch (pattern) {
    case "p":
      return formatLong.time({ width: "short" });
    case "pp":
      return formatLong.time({ width: "medium" });
    case "ppp":
      return formatLong.time({ width: "long" });
    case "pppp":
    default:
      return formatLong.time({ width: "full" });
  }
};

const dateTimeLongFormatter = (pattern, formatLong) => {
  const matchResult = pattern.match(/(P+)(p+)?/) || [];
  const datePattern = matchResult[1];
  const timePattern = matchResult[2];

  if (!timePattern) {
    return dateLongFormatter(pattern, formatLong);
  }

  let dateTimeFormat;

  switch (datePattern) {
    case "P":
      dateTimeFormat = formatLong.dateTime({ width: "short" });
      break;
    case "PP":
      dateTimeFormat = formatLong.dateTime({ width: "medium" });
      break;
    case "PPP":
      dateTimeFormat = formatLong.dateTime({ width: "long" });
      break;
    case "PPPP":
    default:
      dateTimeFormat = formatLong.dateTime({ width: "full" });
      break;
  }

  return dateTimeFormat
    .replace("{{date}}", dateLongFormatter(datePattern, formatLong))
    .replace("{{time}}", timeLongFormatter(timePattern, formatLong));
};

const longFormatters = {
  p: timeLongFormatter,
  P: dateTimeLongFormatter,
};

;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/_lib/protectedTokens.js
const dayOfYearTokenRE = /^D+$/;
const weekYearTokenRE = /^Y+$/;

const throwTokens = ["D", "DD", "YY", "YYYY"];

function isProtectedDayOfYearToken(token) {
  return dayOfYearTokenRE.test(token);
}

function isProtectedWeekYearToken(token) {
  return weekYearTokenRE.test(token);
}

function warnOrThrowProtectedError(token, format, input) {
  const _message = message(token, format, input);
  console.warn(_message);
  if (throwTokens.includes(token)) throw new RangeError(_message);
}

function message(token, format, input) {
  const subject = token[0] === "Y" ? "years" : "days of the month";
  return `Use \`${token.toLowerCase()}\` instead of \`${token}\` (in \`${format}\`) for formatting ${subject} to the input \`${input}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`;
}

;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/format.js








// Rexports of internal for libraries to use.
// See: https://github.com/date-fns/date-fns/issues/3638#issuecomment-1877082874


// This RegExp consists of three parts separated by `|`:
// - [yYQqMLwIdDecihHKkms]o matches any available ordinal number token
//   (one of the certain letters followed by `o`)
// - (\w)\1* matches any sequences of the same letter
// - '' matches two quote characters in a row
// - '(''|[^'])+('|$) matches anything surrounded by two quote characters ('),
//   except a single quote symbol, which ends the sequence.
//   Two quote characters do not end the sequence.
//   If there is no matching single quote
//   then the sequence will continue until the end of the string.
// - . matches any single character unmatched by previous parts of the RegExps
const formattingTokensRegExp =
  /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g;

// This RegExp catches symbols escaped by quotes, and also
// sequences of symbols P, p, and the combinations like `PPPPPPPppppp`
const longFormattingTokensRegExp = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g;

const escapedStringRegExp = /^'([^]*?)'?$/;
const doubleQuoteRegExp = /''/g;
const unescapedLatinCharacterRegExp = /[a-zA-Z]/;



/**
 * The {@link format} function options.
 */

/**
 * @name format
 * @alias formatDate
 * @category Common Helpers
 * @summary Format the date.
 *
 * @description
 * Return the formatted date string in the given format. The result may vary by locale.
 *
 * > ⚠️ Please note that the `format` tokens differ from Moment.js and other libraries.
 * > See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
 *
 * The characters wrapped between two single quotes characters (') are escaped.
 * Two single quotes in a row, whether inside or outside a quoted sequence, represent a 'real' single quote.
 * (see the last example)
 *
 * Format of the string is based on Unicode Technical Standard #35:
 * https://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table
 * with a few additions (see note 7 below the table).
 *
 * Accepted patterns:
 * | Unit                            | Pattern | Result examples                   | Notes |
 * |---------------------------------|---------|-----------------------------------|-------|
 * | Era                             | G..GGG  | AD, BC                            |       |
 * |                                 | GGGG    | Anno Domini, Before Christ        | 2     |
 * |                                 | GGGGG   | A, B                              |       |
 * | Calendar year                   | y       | 44, 1, 1900, 2017                 | 5     |
 * |                                 | yo      | 44th, 1st, 0th, 17th              | 5,7   |
 * |                                 | yy      | 44, 01, 00, 17                    | 5     |
 * |                                 | yyy     | 044, 001, 1900, 2017              | 5     |
 * |                                 | yyyy    | 0044, 0001, 1900, 2017            | 5     |
 * |                                 | yyyyy   | ...                               | 3,5   |
 * | Local week-numbering year       | Y       | 44, 1, 1900, 2017                 | 5     |
 * |                                 | Yo      | 44th, 1st, 1900th, 2017th         | 5,7   |
 * |                                 | YY      | 44, 01, 00, 17                    | 5,8   |
 * |                                 | YYY     | 044, 001, 1900, 2017              | 5     |
 * |                                 | YYYY    | 0044, 0001, 1900, 2017            | 5,8   |
 * |                                 | YYYYY   | ...                               | 3,5   |
 * | ISO week-numbering year         | R       | -43, 0, 1, 1900, 2017             | 5,7   |
 * |                                 | RR      | -43, 00, 01, 1900, 2017           | 5,7   |
 * |                                 | RRR     | -043, 000, 001, 1900, 2017        | 5,7   |
 * |                                 | RRRR    | -0043, 0000, 0001, 1900, 2017     | 5,7   |
 * |                                 | RRRRR   | ...                               | 3,5,7 |
 * | Extended year                   | u       | -43, 0, 1, 1900, 2017             | 5     |
 * |                                 | uu      | -43, 01, 1900, 2017               | 5     |
 * |                                 | uuu     | -043, 001, 1900, 2017             | 5     |
 * |                                 | uuuu    | -0043, 0001, 1900, 2017           | 5     |
 * |                                 | uuuuu   | ...                               | 3,5   |
 * | Quarter (formatting)            | Q       | 1, 2, 3, 4                        |       |
 * |                                 | Qo      | 1st, 2nd, 3rd, 4th                | 7     |
 * |                                 | QQ      | 01, 02, 03, 04                    |       |
 * |                                 | QQQ     | Q1, Q2, Q3, Q4                    |       |
 * |                                 | QQQQ    | 1st quarter, 2nd quarter, ...     | 2     |
 * |                                 | QQQQQ   | 1, 2, 3, 4                        | 4     |
 * | Quarter (stand-alone)           | q       | 1, 2, 3, 4                        |       |
 * |                                 | qo      | 1st, 2nd, 3rd, 4th                | 7     |
 * |                                 | qq      | 01, 02, 03, 04                    |       |
 * |                                 | qqq     | Q1, Q2, Q3, Q4                    |       |
 * |                                 | qqqq    | 1st quarter, 2nd quarter, ...     | 2     |
 * |                                 | qqqqq   | 1, 2, 3, 4                        | 4     |
 * | Month (formatting)              | M       | 1, 2, ..., 12                     |       |
 * |                                 | Mo      | 1st, 2nd, ..., 12th               | 7     |
 * |                                 | MM      | 01, 02, ..., 12                   |       |
 * |                                 | MMM     | Jan, Feb, ..., Dec                |       |
 * |                                 | MMMM    | January, February, ..., December  | 2     |
 * |                                 | MMMMM   | J, F, ..., D                      |       |
 * | Month (stand-alone)             | L       | 1, 2, ..., 12                     |       |
 * |                                 | Lo      | 1st, 2nd, ..., 12th               | 7     |
 * |                                 | LL      | 01, 02, ..., 12                   |       |
 * |                                 | LLL     | Jan, Feb, ..., Dec                |       |
 * |                                 | LLLL    | January, February, ..., December  | 2     |
 * |                                 | LLLLL   | J, F, ..., D                      |       |
 * | Local week of year              | w       | 1, 2, ..., 53                     |       |
 * |                                 | wo      | 1st, 2nd, ..., 53th               | 7     |
 * |                                 | ww      | 01, 02, ..., 53                   |       |
 * | ISO week of year                | I       | 1, 2, ..., 53                     | 7     |
 * |                                 | Io      | 1st, 2nd, ..., 53th               | 7     |
 * |                                 | II      | 01, 02, ..., 53                   | 7     |
 * | Day of month                    | d       | 1, 2, ..., 31                     |       |
 * |                                 | do      | 1st, 2nd, ..., 31st               | 7     |
 * |                                 | dd      | 01, 02, ..., 31                   |       |
 * | Day of year                     | D       | 1, 2, ..., 365, 366               | 9     |
 * |                                 | Do      | 1st, 2nd, ..., 365th, 366th       | 7     |
 * |                                 | DD      | 01, 02, ..., 365, 366             | 9     |
 * |                                 | DDD     | 001, 002, ..., 365, 366           |       |
 * |                                 | DDDD    | ...                               | 3     |
 * | Day of week (formatting)        | E..EEE  | Mon, Tue, Wed, ..., Sun           |       |
 * |                                 | EEEE    | Monday, Tuesday, ..., Sunday      | 2     |
 * |                                 | EEEEE   | M, T, W, T, F, S, S               |       |
 * |                                 | EEEEEE  | Mo, Tu, We, Th, Fr, Sa, Su        |       |
 * | ISO day of week (formatting)    | i       | 1, 2, 3, ..., 7                   | 7     |
 * |                                 | io      | 1st, 2nd, ..., 7th                | 7     |
 * |                                 | ii      | 01, 02, ..., 07                   | 7     |
 * |                                 | iii     | Mon, Tue, Wed, ..., Sun           | 7     |
 * |                                 | iiii    | Monday, Tuesday, ..., Sunday      | 2,7   |
 * |                                 | iiiii   | M, T, W, T, F, S, S               | 7     |
 * |                                 | iiiiii  | Mo, Tu, We, Th, Fr, Sa, Su        | 7     |
 * | Local day of week (formatting)  | e       | 2, 3, 4, ..., 1                   |       |
 * |                                 | eo      | 2nd, 3rd, ..., 1st                | 7     |
 * |                                 | ee      | 02, 03, ..., 01                   |       |
 * |                                 | eee     | Mon, Tue, Wed, ..., Sun           |       |
 * |                                 | eeee    | Monday, Tuesday, ..., Sunday      | 2     |
 * |                                 | eeeee   | M, T, W, T, F, S, S               |       |
 * |                                 | eeeeee  | Mo, Tu, We, Th, Fr, Sa, Su        |       |
 * | Local day of week (stand-alone) | c       | 2, 3, 4, ..., 1                   |       |
 * |                                 | co      | 2nd, 3rd, ..., 1st                | 7     |
 * |                                 | cc      | 02, 03, ..., 01                   |       |
 * |                                 | ccc     | Mon, Tue, Wed, ..., Sun           |       |
 * |                                 | cccc    | Monday, Tuesday, ..., Sunday      | 2     |
 * |                                 | ccccc   | M, T, W, T, F, S, S               |       |
 * |                                 | cccccc  | Mo, Tu, We, Th, Fr, Sa, Su        |       |
 * | AM, PM                          | a..aa   | AM, PM                            |       |
 * |                                 | aaa     | am, pm                            |       |
 * |                                 | aaaa    | a.m., p.m.                        | 2     |
 * |                                 | aaaaa   | a, p                              |       |
 * | AM, PM, noon, midnight          | b..bb   | AM, PM, noon, midnight            |       |
 * |                                 | bbb     | am, pm, noon, midnight            |       |
 * |                                 | bbbb    | a.m., p.m., noon, midnight        | 2     |
 * |                                 | bbbbb   | a, p, n, mi                       |       |
 * | Flexible day period             | B..BBB  | at night, in the morning, ...     |       |
 * |                                 | BBBB    | at night, in the morning, ...     | 2     |
 * |                                 | BBBBB   | at night, in the morning, ...     |       |
 * | Hour [1-12]                     | h       | 1, 2, ..., 11, 12                 |       |
 * |                                 | ho      | 1st, 2nd, ..., 11th, 12th         | 7     |
 * |                                 | hh      | 01, 02, ..., 11, 12               |       |
 * | Hour [0-23]                     | H       | 0, 1, 2, ..., 23                  |       |
 * |                                 | Ho      | 0th, 1st, 2nd, ..., 23rd          | 7     |
 * |                                 | HH      | 00, 01, 02, ..., 23               |       |
 * | Hour [0-11]                     | K       | 1, 2, ..., 11, 0                  |       |
 * |                                 | Ko      | 1st, 2nd, ..., 11th, 0th          | 7     |
 * |                                 | KK      | 01, 02, ..., 11, 00               |       |
 * | Hour [1-24]                     | k       | 24, 1, 2, ..., 23                 |       |
 * |                                 | ko      | 24th, 1st, 2nd, ..., 23rd         | 7     |
 * |                                 | kk      | 24, 01, 02, ..., 23               |       |
 * | Minute                          | m       | 0, 1, ..., 59                     |       |
 * |                                 | mo      | 0th, 1st, ..., 59th               | 7     |
 * |                                 | mm      | 00, 01, ..., 59                   |       |
 * | Second                          | s       | 0, 1, ..., 59                     |       |
 * |                                 | so      | 0th, 1st, ..., 59th               | 7     |
 * |                                 | ss      | 00, 01, ..., 59                   |       |
 * | Fraction of second              | S       | 0, 1, ..., 9                      |       |
 * |                                 | SS      | 00, 01, ..., 99                   |       |
 * |                                 | SSS     | 000, 001, ..., 999                |       |
 * |                                 | SSSS    | ...                               | 3     |
 * | Timezone (ISO-8601 w/ Z)        | X       | -08, +0530, Z                     |       |
 * |                                 | XX      | -0800, +0530, Z                   |       |
 * |                                 | XXX     | -08:00, +05:30, Z                 |       |
 * |                                 | XXXX    | -0800, +0530, Z, +123456          | 2     |
 * |                                 | XXXXX   | -08:00, +05:30, Z, +12:34:56      |       |
 * | Timezone (ISO-8601 w/o Z)       | x       | -08, +0530, +00                   |       |
 * |                                 | xx      | -0800, +0530, +0000               |       |
 * |                                 | xxx     | -08:00, +05:30, +00:00            | 2     |
 * |                                 | xxxx    | -0800, +0530, +0000, +123456      |       |
 * |                                 | xxxxx   | -08:00, +05:30, +00:00, +12:34:56 |       |
 * | Timezone (GMT)                  | O...OOO | GMT-8, GMT+5:30, GMT+0            |       |
 * |                                 | OOOO    | GMT-08:00, GMT+05:30, GMT+00:00   | 2     |
 * | Timezone (specific non-locat.)  | z...zzz | GMT-8, GMT+5:30, GMT+0            | 6     |
 * |                                 | zzzz    | GMT-08:00, GMT+05:30, GMT+00:00   | 2,6   |
 * | Seconds timestamp               | t       | 512969520                         | 7     |
 * |                                 | tt      | ...                               | 3,7   |
 * | Milliseconds timestamp          | T       | 512969520900                      | 7     |
 * |                                 | TT      | ...                               | 3,7   |
 * | Long localized date             | P       | 04/29/1453                        | 7     |
 * |                                 | PP      | Apr 29, 1453                      | 7     |
 * |                                 | PPP     | April 29th, 1453                  | 7     |
 * |                                 | PPPP    | Friday, April 29th, 1453          | 2,7   |
 * | Long localized time             | p       | 12:00 AM                          | 7     |
 * |                                 | pp      | 12:00:00 AM                       | 7     |
 * |                                 | ppp     | 12:00:00 AM GMT+2                 | 7     |
 * |                                 | pppp    | 12:00:00 AM GMT+02:00             | 2,7   |
 * | Combination of date and time    | Pp      | 04/29/1453, 12:00 AM              | 7     |
 * |                                 | PPpp    | Apr 29, 1453, 12:00:00 AM         | 7     |
 * |                                 | PPPppp  | April 29th, 1453 at ...           | 7     |
 * |                                 | PPPPpppp| Friday, April 29th, 1453 at ...   | 2,7   |
 * Notes:
 * 1. "Formatting" units (e.g. formatting quarter) in the default en-US locale
 *    are the same as "stand-alone" units, but are different in some languages.
 *    "Formatting" units are declined according to the rules of the language
 *    in the context of a date. "Stand-alone" units are always nominative singular:
 *
 *    `format(new Date(2017, 10, 6), 'do LLLL', {locale: cs}) //=> '6. listopad'`
 *
 *    `format(new Date(2017, 10, 6), 'do MMMM', {locale: cs}) //=> '6. listopadu'`
 *
 * 2. Any sequence of the identical letters is a pattern, unless it is escaped by
 *    the single quote characters (see below).
 *    If the sequence is longer than listed in table (e.g. `EEEEEEEEEEE`)
 *    the output will be the same as default pattern for this unit, usually
 *    the longest one (in case of ISO weekdays, `EEEE`). Default patterns for units
 *    are marked with "2" in the last column of the table.
 *
 *    `format(new Date(2017, 10, 6), 'MMM') //=> 'Nov'`
 *
 *    `format(new Date(2017, 10, 6), 'MMMM') //=> 'November'`
 *
 *    `format(new Date(2017, 10, 6), 'MMMMM') //=> 'N'`
 *
 *    `format(new Date(2017, 10, 6), 'MMMMMM') //=> 'November'`
 *
 *    `format(new Date(2017, 10, 6), 'MMMMMMM') //=> 'November'`
 *
 * 3. Some patterns could be unlimited length (such as `yyyyyyyy`).
 *    The output will be padded with zeros to match the length of the pattern.
 *
 *    `format(new Date(2017, 10, 6), 'yyyyyyyy') //=> '00002017'`
 *
 * 4. `QQQQQ` and `qqqqq` could be not strictly numerical in some locales.
 *    These tokens represent the shortest form of the quarter.
 *
 * 5. The main difference between `y` and `u` patterns are B.C. years:
 *
 *    | Year | `y` | `u` |
 *    |------|-----|-----|
 *    | AC 1 |   1 |   1 |
 *    | BC 1 |   1 |   0 |
 *    | BC 2 |   2 |  -1 |
 *
 *    Also `yy` always returns the last two digits of a year,
 *    while `uu` pads single digit years to 2 characters and returns other years unchanged:
 *
 *    | Year | `yy` | `uu` |
 *    |------|------|------|
 *    | 1    |   01 |   01 |
 *    | 14   |   14 |   14 |
 *    | 376  |   76 |  376 |
 *    | 1453 |   53 | 1453 |
 *
 *    The same difference is true for local and ISO week-numbering years (`Y` and `R`),
 *    except local week-numbering years are dependent on `options.weekStartsOn`
 *    and `options.firstWeekContainsDate` (compare [getISOWeekYear](https://date-fns.org/docs/getISOWeekYear)
 *    and [getWeekYear](https://date-fns.org/docs/getWeekYear)).
 *
 * 6. Specific non-location timezones are currently unavailable in `date-fns`,
 *    so right now these tokens fall back to GMT timezones.
 *
 * 7. These patterns are not in the Unicode Technical Standard #35:
 *    - `i`: ISO day of week
 *    - `I`: ISO week of year
 *    - `R`: ISO week-numbering year
 *    - `t`: seconds timestamp
 *    - `T`: milliseconds timestamp
 *    - `o`: ordinal number modifier
 *    - `P`: long localized date
 *    - `p`: long localized time
 *
 * 8. `YY` and `YYYY` tokens represent week-numbering years but they are often confused with years.
 *    You should enable `options.useAdditionalWeekYearTokens` to use them. See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
 *
 * 9. `D` and `DD` tokens represent days of the year but they are often confused with days of the month.
 *    You should enable `options.useAdditionalDayOfYearTokens` to use them. See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
 *
 * @param date - The original date
 * @param format - The string of tokens
 * @param options - An object with options
 *
 * @returns The formatted date string
 *
 * @throws `date` must not be Invalid Date
 * @throws `options.locale` must contain `localize` property
 * @throws `options.locale` must contain `formatLong` property
 * @throws use `yyyy` instead of `YYYY` for formatting years using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
 * @throws use `yy` instead of `YY` for formatting years using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
 * @throws use `d` instead of `D` for formatting days of the month using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
 * @throws use `dd` instead of `DD` for formatting days of the month using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
 * @throws format string contains an unescaped latin alphabet character
 *
 * @example
 * // Represent 11 February 2014 in middle-endian format:
 * const result = format(new Date(2014, 1, 11), 'MM/dd/yyyy')
 * //=> '02/11/2014'
 *
 * @example
 * // Represent 2 July 2014 in Esperanto:
 * import { eoLocale } from 'date-fns/locale/eo'
 * const result = format(new Date(2014, 6, 2), "do 'de' MMMM yyyy", {
 *   locale: eoLocale
 * })
 * //=> '2-a de julio 2014'
 *
 * @example
 * // Escape string by single quote characters:
 * const result = format(new Date(2014, 6, 2, 15), "h 'o''clock'")
 * //=> "3 o'clock"
 */
function format(date, formatStr, options) {
  const defaultOptions = getDefaultOptions();
  const locale = options?.locale ?? defaultOptions.locale ?? enUS;

  const firstWeekContainsDate =
    options?.firstWeekContainsDate ??
    options?.locale?.options?.firstWeekContainsDate ??
    defaultOptions.firstWeekContainsDate ??
    defaultOptions.locale?.options?.firstWeekContainsDate ??
    1;

  const weekStartsOn =
    options?.weekStartsOn ??
    options?.locale?.options?.weekStartsOn ??
    defaultOptions.weekStartsOn ??
    defaultOptions.locale?.options?.weekStartsOn ??
    0;

  const originalDate = toDate(date, options?.in);

  if (!isValid(originalDate)) {
    throw new RangeError("Invalid time value");
  }

  let parts = formatStr
    .match(longFormattingTokensRegExp)
    .map((substring) => {
      const firstCharacter = substring[0];
      if (firstCharacter === "p" || firstCharacter === "P") {
        const longFormatter = longFormatters[firstCharacter];
        return longFormatter(substring, locale.formatLong);
      }
      return substring;
    })
    .join("")
    .match(formattingTokensRegExp)
    .map((substring) => {
      // Replace two single quote characters with one single quote character
      if (substring === "''") {
        return { isToken: false, value: "'" };
      }

      const firstCharacter = substring[0];
      if (firstCharacter === "'") {
        return { isToken: false, value: cleanEscapedString(substring) };
      }

      if (formatters[firstCharacter]) {
        return { isToken: true, value: substring };
      }

      if (firstCharacter.match(unescapedLatinCharacterRegExp)) {
        throw new RangeError(
          "Format string contains an unescaped latin alphabet character `" +
            firstCharacter +
            "`",
        );
      }

      return { isToken: false, value: substring };
    });

  // invoke localize preprocessor (only for french locales at the moment)
  if (locale.localize.preprocessor) {
    parts = locale.localize.preprocessor(originalDate, parts);
  }

  const formatterOptions = {
    firstWeekContainsDate,
    weekStartsOn,
    locale,
  };

  return parts
    .map((part) => {
      if (!part.isToken) return part.value;

      const token = part.value;

      if (
        (!options?.useAdditionalWeekYearTokens &&
          isProtectedWeekYearToken(token)) ||
        (!options?.useAdditionalDayOfYearTokens &&
          isProtectedDayOfYearToken(token))
      ) {
        warnOrThrowProtectedError(token, formatStr, String(date));
      }

      const formatter = formatters[token[0]];
      return formatter(originalDate, token, locale.localize, formatterOptions);
    })
    .join("");
}

function cleanEscapedString(input) {
  const matched = input.match(escapedStringRegExp);

  if (!matched) {
    return input;
  }

  return matched[1].replace(doubleQuoteRegExp, "'");
}

// Fallback for modularized imports:
/* harmony default export */ const date_fns_format = ((/* unused pure expression or super */ null && (format)));

;// ./node_modules/@wordpress/dataviews/build-module/dataform-controls/utils/relative-date-control.js






const TIME_UNITS_OPTIONS = {
  [OPERATOR_IN_THE_PAST]: [
    { value: "days", label: (0,external_wp_i18n_namespaceObject.__)("Days") },
    { value: "weeks", label: (0,external_wp_i18n_namespaceObject.__)("Weeks") },
    { value: "months", label: (0,external_wp_i18n_namespaceObject.__)("Months") },
    { value: "years", label: (0,external_wp_i18n_namespaceObject.__)("Years") }
  ],
  [OPERATOR_OVER]: [
    { value: "days", label: (0,external_wp_i18n_namespaceObject.__)("Days ago") },
    { value: "weeks", label: (0,external_wp_i18n_namespaceObject.__)("Weeks ago") },
    { value: "months", label: (0,external_wp_i18n_namespaceObject.__)("Months ago") },
    { value: "years", label: (0,external_wp_i18n_namespaceObject.__)("Years ago") }
  ]
};
function RelativeDateControl({
  className,
  data,
  field,
  onChange,
  hideLabelFromVision,
  operator
}) {
  const options = TIME_UNITS_OPTIONS[operator === OPERATOR_IN_THE_PAST ? "inThePast" : "over"];
  const { id, label, getValue, setValue } = field;
  const fieldValue = getValue({ item: data });
  const { value: relValue = "", unit = options[0].value } = fieldValue && typeof fieldValue === "object" ? fieldValue : {};
  const onChangeValue = (0,external_wp_element_.useCallback)(
    (newValue) => onChange(
      setValue({
        item: data,
        value: { value: Number(newValue), unit }
      })
    ),
    [onChange, setValue, data, unit]
  );
  const onChangeUnit = (0,external_wp_element_.useCallback)(
    (newUnit) => onChange(
      setValue({
        item: data,
        value: { value: relValue, unit: newUnit }
      })
    ),
    [onChange, setValue, data, relValue]
  );
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    external_wp_components_namespaceObject.BaseControl,
    {
      id,
      __nextHasNoMarginBottom: true,
      className: dist_clsx(className, "dataviews-controls__relative-date"),
      label,
      hideLabelFromVision,
      children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { spacing: 2.5, children: [
        /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
          external_wp_components_namespaceObject.__experimentalNumberControl,
          {
            __next40pxDefaultSize: true,
            className: "dataviews-controls__relative-date-number",
            spinControls: "none",
            min: 1,
            step: 1,
            value: relValue,
            onChange: onChangeValue
          }
        ),
        /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
          external_wp_components_namespaceObject.SelectControl,
          {
            className: "dataviews-controls__relative-date-unit",
            __next40pxDefaultSize: true,
            __nextHasNoMarginBottom: true,
            label: (0,external_wp_i18n_namespaceObject.__)("Unit"),
            value: unit,
            options,
            onChange: onChangeUnit,
            hideLabelFromVision: true
          }
        )
      ] })
    }
  );
}


;// ./node_modules/@wordpress/dataviews/build-module/dataform-controls/datetime.js










const { DateCalendar, ValidatedInputControl } = lock_unlock_unlock(external_wp_components_namespaceObject.privateApis);
const parseDateTime = (dateTimeString) => {
  if (!dateTimeString) {
    return null;
  }
  const parsed = (0,external_wp_date_namespaceObject.getDate)(dateTimeString);
  return parsed && isValid(parsed) ? parsed : null;
};
const formatDateTime = (date) => {
  if (!date) {
    return "";
  }
  if (typeof date === "string") {
    return date;
  }
  return format(date, "yyyy-MM-dd'T'HH:mm");
};
function CalendarDateTimeControl({
  data,
  field,
  onChange,
  hideLabelFromVision,
  validity
}) {
  const { id, label, description, setValue, getValue, isValid } = field;
  const fieldValue = getValue({ item: data });
  const value = typeof fieldValue === "string" ? fieldValue : void 0;
  const [calendarMonth, setCalendarMonth] = (0,external_wp_element_.useState)(() => {
    const parsedDate = parseDateTime(value);
    return parsedDate || /* @__PURE__ */ new Date();
  });
  const inputControlRef = (0,external_wp_element_.useRef)(null);
  const validationTimeoutRef = (0,external_wp_element_.useRef)();
  const previousFocusRef = (0,external_wp_element_.useRef)(null);
  const onChangeCallback = (0,external_wp_element_.useCallback)(
    (newValue) => onChange(setValue({ item: data, value: newValue })),
    [data, onChange, setValue]
  );
  (0,external_wp_element_.useEffect)(() => {
    return () => {
      if (validationTimeoutRef.current) {
        clearTimeout(validationTimeoutRef.current);
      }
    };
  }, []);
  const onSelectDate = (0,external_wp_element_.useCallback)(
    (newDate) => {
      let dateTimeValue;
      if (newDate) {
        let finalDateTime = newDate;
        if (value) {
          const currentDateTime = parseDateTime(value);
          if (currentDateTime) {
            finalDateTime = new Date(newDate);
            finalDateTime.setHours(currentDateTime.getHours());
            finalDateTime.setMinutes(
              currentDateTime.getMinutes()
            );
          }
        }
        dateTimeValue = finalDateTime.toISOString();
        onChangeCallback(dateTimeValue);
        if (validationTimeoutRef.current) {
          clearTimeout(validationTimeoutRef.current);
        }
      } else {
        onChangeCallback(void 0);
      }
      previousFocusRef.current = inputControlRef.current && inputControlRef.current.ownerDocument.activeElement;
      validationTimeoutRef.current = setTimeout(() => {
        if (inputControlRef.current) {
          inputControlRef.current.focus();
          inputControlRef.current.blur();
          onChangeCallback(dateTimeValue);
          if (previousFocusRef.current && previousFocusRef.current instanceof HTMLElement) {
            previousFocusRef.current.focus();
          }
        }
      }, 0);
    },
    [onChangeCallback, value]
  );
  const handleManualDateTimeChange = (0,external_wp_element_.useCallback)(
    (newValue) => {
      if (newValue) {
        const dateTime = new Date(newValue);
        onChangeCallback(dateTime.toISOString());
        const parsedDate = parseDateTime(dateTime.toISOString());
        if (parsedDate) {
          setCalendarMonth(parsedDate);
        }
      } else {
        onChangeCallback(void 0);
      }
    },
    [onChangeCallback]
  );
  const {
    timezone: { string: timezoneString },
    l10n: { startOfWeek }
  } = (0,external_wp_date_namespaceObject.getSettings)();
  const displayLabel = isValid?.required && !hideLabelFromVision ? `${label} (${(0,external_wp_i18n_namespaceObject.__)("Required")})` : label;
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    external_wp_components_namespaceObject.BaseControl,
    {
      __nextHasNoMarginBottom: true,
      id,
      label: displayLabel,
      help: description,
      hideLabelFromVision,
      children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 4, children: [
        /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
          DateCalendar,
          {
            style: { width: "100%" },
            selected: value ? parseDateTime(value) || void 0 : void 0,
            onSelect: onSelectDate,
            month: calendarMonth,
            onMonthChange: setCalendarMonth,
            timeZone: timezoneString || void 0,
            weekStartsOn: startOfWeek
          }
        ),
        /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
          ValidatedInputControl,
          {
            ref: inputControlRef,
            __next40pxDefaultSize: true,
            required: !!isValid?.required,
            customValidity: getCustomValidity(isValid, validity),
            type: "datetime-local",
            label: (0,external_wp_i18n_namespaceObject.__)("Date time"),
            hideLabelFromVision: true,
            value: value ? formatDateTime(
              parseDateTime(value) || void 0
            ) : "",
            onChange: handleManualDateTimeChange
          }
        )
      ] })
    }
  );
}
function DateTime({
  data,
  field,
  onChange,
  hideLabelFromVision,
  operator,
  validity
}) {
  if (operator === OPERATOR_IN_THE_PAST || operator === OPERATOR_OVER) {
    return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
      RelativeDateControl,
      {
        className: "dataviews-controls__datetime",
        data,
        field,
        onChange,
        hideLabelFromVision,
        operator
      }
    );
  }
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    CalendarDateTimeControl,
    {
      data,
      field,
      onChange,
      hideLabelFromVision,
      validity
    }
  );
}


;// ./node_modules/@wordpress/dataviews/node_modules/date-fns/startOfMonth.js


/**
 * The {@link startOfMonth} function options.
 */

/**
 * @name startOfMonth
 * @category Month Helpers
 * @summary Return the start of a month for the given date.
 *
 * @description
 * Return the start of a month for the given date. The result will be in the local timezone.
 *
 * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments.
 * Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
 * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed,
 * or inferred from the arguments.
 *
 * @param date - The original date
 * @param options - An object with options
 *
 * @returns The start of a month
 *
 * @example
 * // The start of a month for 2 September 2014 11:55:00:
 * const result = startOfMonth(new Date(2014, 8, 2, 11, 55, 0))
 * //=> Mon Sep 01 2014 00:00:00
 */
function startOfMonth(date, options) {
  const _date = toDate(date, options?.in);
  _date.setDate(1);
  _date.setHours(0, 0, 0, 0);
  return _date;
}

// Fallback for modularized imports:
/* harmony default export */ const date_fns_startOfMonth = ((/* unused pure expression or super */ null && (startOfMonth)));

;// ./node_modules/@wordpress/icons/build-module/library/error.js


var error_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
  external_wp_primitives_namespaceObject.Path,
  {
    fillRule: "evenodd",
    clipRule: "evenodd",
    d: "M12.218 5.377a.25.25 0 0 0-.436 0l-7.29 12.96a.25.25 0 0 0 .218.373h14.58a.25.25 0 0 0 .218-.372l-7.29-12.96Zm-1.743-.735c.669-1.19 2.381-1.19 3.05 0l7.29 12.96a1.75 1.75 0 0 1-1.525 2.608H4.71a1.75 1.75 0 0 1-1.525-2.608l7.29-12.96ZM12.75 17.46h-1.5v-1.5h1.5v1.5Zm-1.5-3h1.5v-5h-1.5v5Z"
  }
) });


;// ./node_modules/@wordpress/dataviews/build-module/dataform-controls/date.js












const { DateCalendar: date_DateCalendar, DateRangeCalendar } = lock_unlock_unlock(external_wp_components_namespaceObject.privateApis);
const DATE_PRESETS = [
  {
    id: "today",
    label: (0,external_wp_i18n_namespaceObject.__)("Today"),
    getValue: () => (0,external_wp_date_namespaceObject.getDate)(null)
  },
  {
    id: "yesterday",
    label: (0,external_wp_i18n_namespaceObject.__)("Yesterday"),
    getValue: () => {
      const today = (0,external_wp_date_namespaceObject.getDate)(null);
      return subDays(today, 1);
    }
  },
  {
    id: "past-week",
    label: (0,external_wp_i18n_namespaceObject.__)("Past week"),
    getValue: () => {
      const today = (0,external_wp_date_namespaceObject.getDate)(null);
      return subDays(today, 7);
    }
  },
  {
    id: "past-month",
    label: (0,external_wp_i18n_namespaceObject.__)("Past month"),
    getValue: () => {
      const today = (0,external_wp_date_namespaceObject.getDate)(null);
      return subMonths(today, 1);
    }
  }
];
const DATE_RANGE_PRESETS = [
  {
    id: "last-7-days",
    label: (0,external_wp_i18n_namespaceObject.__)("Last 7 days"),
    getValue: () => {
      const today = (0,external_wp_date_namespaceObject.getDate)(null);
      return [subDays(today, 7), today];
    }
  },
  {
    id: "last-30-days",
    label: (0,external_wp_i18n_namespaceObject.__)("Last 30 days"),
    getValue: () => {
      const today = (0,external_wp_date_namespaceObject.getDate)(null);
      return [subDays(today, 30), today];
    }
  },
  {
    id: "month-to-date",
    label: (0,external_wp_i18n_namespaceObject.__)("Month to date"),
    getValue: () => {
      const today = (0,external_wp_date_namespaceObject.getDate)(null);
      return [startOfMonth(today), today];
    }
  },
  {
    id: "last-year",
    label: (0,external_wp_i18n_namespaceObject.__)("Last year"),
    getValue: () => {
      const today = (0,external_wp_date_namespaceObject.getDate)(null);
      return [subYears(today, 1), today];
    }
  },
  {
    id: "year-to-date",
    label: (0,external_wp_i18n_namespaceObject.__)("Year to date"),
    getValue: () => {
      const today = (0,external_wp_date_namespaceObject.getDate)(null);
      return [startOfYear(today), today];
    }
  }
];
const parseDate = (dateString) => {
  if (!dateString) {
    return null;
  }
  const parsed = (0,external_wp_date_namespaceObject.getDate)(dateString);
  return parsed && isValid(parsed) ? parsed : null;
};
const formatDate = (date) => {
  if (!date) {
    return "";
  }
  return typeof date === "string" ? date : format(date, "yyyy-MM-dd");
};
function ValidatedDateControl({
  field,
  validity,
  inputRefs,
  isTouched,
  setIsTouched,
  children
}) {
  const { isValid } = field;
  const [customValidity, setCustomValidity] = (0,external_wp_element_.useState)(void 0);
  const validateRefs = (0,external_wp_element_.useCallback)(() => {
    const refs = Array.isArray(inputRefs) ? inputRefs : [inputRefs];
    for (const ref of refs) {
      const input = ref.current;
      if (input && !input.validity.valid) {
        setCustomValidity({
          type: "invalid",
          message: input.validationMessage
        });
        return;
      }
    }
    setCustomValidity(void 0);
  }, [inputRefs]);
  (0,external_wp_element_.useEffect)(() => {
    if (isTouched) {
      const timeoutId = setTimeout(() => {
        if (validity) {
          setCustomValidity(getCustomValidity(isValid, validity));
        } else {
          validateRefs();
        }
      }, 0);
      return () => clearTimeout(timeoutId);
    }
    return void 0;
  }, [isTouched, isValid, validity, validateRefs]);
  const onBlur = (event) => {
    if (isTouched) {
      return;
    }
    if (!event.relatedTarget || !event.currentTarget.contains(event.relatedTarget)) {
      setIsTouched(true);
    }
  };
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { onBlur, children: [
    children,
    /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { "aria-live": "polite", children: customValidity && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
      "p",
      {
        className: dist_clsx(
          "components-validated-control__indicator",
          customValidity.type === "invalid" ? "is-invalid" : void 0,
          customValidity.type === "valid" ? "is-valid" : void 0
        ),
        children: [
          /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
            external_wp_components_namespaceObject.Icon,
            {
              className: "components-validated-control__indicator-icon",
              icon: error_default,
              size: 16,
              fill: "currentColor"
            }
          ),
          customValidity.message
        ]
      }
    ) })
  ] });
}
function CalendarDateControl({
  data,
  field,
  onChange,
  hideLabelFromVision,
  validity
}) {
  const { id, label, setValue, getValue, isValid } = field;
  const [selectedPresetId, setSelectedPresetId] = (0,external_wp_element_.useState)(
    null
  );
  const fieldValue = getValue({ item: data });
  const value = typeof fieldValue === "string" ? fieldValue : void 0;
  const [calendarMonth, setCalendarMonth] = (0,external_wp_element_.useState)(() => {
    const parsedDate = parseDate(value);
    return parsedDate || /* @__PURE__ */ new Date();
  });
  const [isTouched, setIsTouched] = (0,external_wp_element_.useState)(false);
  const validityTargetRef = (0,external_wp_element_.useRef)(null);
  const onChangeCallback = (0,external_wp_element_.useCallback)(
    (newValue) => onChange(setValue({ item: data, value: newValue })),
    [data, onChange, setValue]
  );
  const onSelectDate = (0,external_wp_element_.useCallback)(
    (newDate) => {
      const dateValue = newDate ? format(newDate, "yyyy-MM-dd") : void 0;
      onChangeCallback(dateValue);
      setSelectedPresetId(null);
      setIsTouched(true);
    },
    [onChangeCallback]
  );
  const handlePresetClick = (0,external_wp_element_.useCallback)(
    (preset) => {
      const presetDate = preset.getValue();
      const dateValue = formatDate(presetDate);
      setCalendarMonth(presetDate);
      onChangeCallback(dateValue);
      setSelectedPresetId(preset.id);
      setIsTouched(true);
    },
    [onChangeCallback]
  );
  const handleManualDateChange = (0,external_wp_element_.useCallback)(
    (newValue) => {
      onChangeCallback(newValue);
      if (newValue) {
        const parsedDate = parseDate(newValue);
        if (parsedDate) {
          setCalendarMonth(parsedDate);
        }
      }
      setSelectedPresetId(null);
      setIsTouched(true);
    },
    [onChangeCallback]
  );
  const {
    timezone: { string: timezoneString },
    l10n: { startOfWeek }
  } = (0,external_wp_date_namespaceObject.getSettings)();
  const displayLabel = isValid?.required ? `${label} (${(0,external_wp_i18n_namespaceObject.__)("Required")})` : label;
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    ValidatedDateControl,
    {
      field,
      validity,
      inputRefs: validityTargetRef,
      isTouched,
      setIsTouched,
      children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
        external_wp_components_namespaceObject.BaseControl,
        {
          __nextHasNoMarginBottom: true,
          id,
          className: "dataviews-controls__date",
          label: displayLabel,
          hideLabelFromVision,
          children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 4, children: [
            /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { spacing: 2, wrap: true, justify: "flex-start", children: [
              DATE_PRESETS.map((preset) => {
                const isSelected = selectedPresetId === preset.id;
                return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
                  external_wp_components_namespaceObject.Button,
                  {
                    className: "dataviews-controls__date-preset",
                    variant: "tertiary",
                    isPressed: isSelected,
                    size: "small",
                    onClick: () => handlePresetClick(preset),
                    children: preset.label
                  },
                  preset.id
                );
              }),
              /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
                external_wp_components_namespaceObject.Button,
                {
                  className: "dataviews-controls__date-preset",
                  variant: "tertiary",
                  isPressed: !selectedPresetId,
                  size: "small",
                  disabled: !!selectedPresetId,
                  accessibleWhenDisabled: false,
                  children: (0,external_wp_i18n_namespaceObject.__)("Custom")
                }
              )
            ] }),
            /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
              external_wp_components_namespaceObject.__experimentalInputControl,
              {
                __next40pxDefaultSize: true,
                ref: validityTargetRef,
                type: "date",
                label: (0,external_wp_i18n_namespaceObject.__)("Date"),
                hideLabelFromVision: true,
                value,
                onChange: handleManualDateChange,
                required: !!field.isValid?.required
              }
            ),
            /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
              date_DateCalendar,
              {
                style: { width: "100%" },
                selected: value ? parseDate(value) || void 0 : void 0,
                onSelect: onSelectDate,
                month: calendarMonth,
                onMonthChange: setCalendarMonth,
                timeZone: timezoneString || void 0,
                weekStartsOn: startOfWeek
              }
            )
          ] })
        }
      )
    }
  );
}
function CalendarDateRangeControl({
  data,
  field,
  onChange,
  hideLabelFromVision,
  validity
}) {
  const { id, label, getValue, setValue } = field;
  let value;
  const fieldValue = getValue({ item: data });
  if (Array.isArray(fieldValue) && fieldValue.length === 2 && fieldValue.every((date) => typeof date === "string")) {
    value = fieldValue;
  }
  const onChangeCallback = (0,external_wp_element_.useCallback)(
    (newValue) => {
      onChange(
        setValue({
          item: data,
          value: newValue
        })
      );
    },
    [data, onChange, setValue]
  );
  const [selectedPresetId, setSelectedPresetId] = (0,external_wp_element_.useState)(
    null
  );
  const selectedRange = (0,external_wp_element_.useMemo)(() => {
    if (!value) {
      return { from: void 0, to: void 0 };
    }
    const [from, to] = value;
    return {
      from: parseDate(from) || void 0,
      to: parseDate(to) || void 0
    };
  }, [value]);
  const [calendarMonth, setCalendarMonth] = (0,external_wp_element_.useState)(() => {
    return selectedRange.from || /* @__PURE__ */ new Date();
  });
  const [isTouched, setIsTouched] = (0,external_wp_element_.useState)(false);
  const fromInputRef = (0,external_wp_element_.useRef)(null);
  const toInputRef = (0,external_wp_element_.useRef)(null);
  const updateDateRange = (0,external_wp_element_.useCallback)(
    (fromDate, toDate) => {
      if (fromDate && toDate) {
        onChangeCallback([
          formatDate(fromDate),
          formatDate(toDate)
        ]);
      } else if (!fromDate && !toDate) {
        onChangeCallback(void 0);
      }
    },
    [onChangeCallback]
  );
  const onSelectCalendarRange = (0,external_wp_element_.useCallback)(
    (newRange) => {
      updateDateRange(newRange?.from, newRange?.to);
      setSelectedPresetId(null);
      setIsTouched(true);
    },
    [updateDateRange]
  );
  const handlePresetClick = (0,external_wp_element_.useCallback)(
    (preset) => {
      const [startDate, endDate] = preset.getValue();
      setCalendarMonth(startDate);
      updateDateRange(startDate, endDate);
      setSelectedPresetId(preset.id);
      setIsTouched(true);
    },
    [updateDateRange]
  );
  const handleManualDateChange = (0,external_wp_element_.useCallback)(
    (fromOrTo, newValue) => {
      const [currentFrom, currentTo] = value || [
        void 0,
        void 0
      ];
      const updatedFrom = fromOrTo === "from" ? newValue : currentFrom;
      const updatedTo = fromOrTo === "to" ? newValue : currentTo;
      updateDateRange(updatedFrom, updatedTo);
      if (newValue) {
        const parsedDate = parseDate(newValue);
        if (parsedDate) {
          setCalendarMonth(parsedDate);
        }
      }
      setSelectedPresetId(null);
      setIsTouched(true);
    },
    [value, updateDateRange]
  );
  const { timezone, l10n } = (0,external_wp_date_namespaceObject.getSettings)();
  const displayLabel = field.isValid?.required ? `${label} (${(0,external_wp_i18n_namespaceObject.__)("Required")})` : label;
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    ValidatedDateControl,
    {
      field,
      validity,
      inputRefs: [fromInputRef, toInputRef],
      isTouched,
      setIsTouched,
      children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
        external_wp_components_namespaceObject.BaseControl,
        {
          __nextHasNoMarginBottom: true,
          id,
          className: "dataviews-controls__date",
          label: displayLabel,
          hideLabelFromVision,
          children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 4, children: [
            /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { spacing: 2, wrap: true, justify: "flex-start", children: [
              DATE_RANGE_PRESETS.map((preset) => {
                const isSelected = selectedPresetId === preset.id;
                return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
                  external_wp_components_namespaceObject.Button,
                  {
                    className: "dataviews-controls__date-preset",
                    variant: "tertiary",
                    isPressed: isSelected,
                    size: "small",
                    onClick: () => handlePresetClick(preset),
                    children: preset.label
                  },
                  preset.id
                );
              }),
              /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
                external_wp_components_namespaceObject.Button,
                {
                  className: "dataviews-controls__date-preset",
                  variant: "tertiary",
                  isPressed: !selectedPresetId,
                  size: "small",
                  accessibleWhenDisabled: false,
                  disabled: !!selectedPresetId,
                  children: (0,external_wp_i18n_namespaceObject.__)("Custom")
                }
              )
            ] }),
            /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { spacing: 2, children: [
              /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
                external_wp_components_namespaceObject.__experimentalInputControl,
                {
                  __next40pxDefaultSize: true,
                  ref: fromInputRef,
                  type: "date",
                  label: (0,external_wp_i18n_namespaceObject.__)("From"),
                  hideLabelFromVision: true,
                  value: value?.[0],
                  onChange: (newValue) => handleManualDateChange("from", newValue),
                  required: !!field.isValid?.required
                }
              ),
              /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
                external_wp_components_namespaceObject.__experimentalInputControl,
                {
                  __next40pxDefaultSize: true,
                  ref: toInputRef,
                  type: "date",
                  label: (0,external_wp_i18n_namespaceObject.__)("To"),
                  hideLabelFromVision: true,
                  value: value?.[1],
                  onChange: (newValue) => handleManualDateChange("to", newValue),
                  required: !!field.isValid?.required
                }
              )
            ] }),
            /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
              DateRangeCalendar,
              {
                style: { width: "100%" },
                selected: selectedRange,
                onSelect: onSelectCalendarRange,
                month: calendarMonth,
                onMonthChange: setCalendarMonth,
                timeZone: timezone.string || void 0,
                weekStartsOn: l10n.startOfWeek
              }
            )
          ] })
        }
      )
    }
  );
}
function DateControl({
  data,
  field,
  onChange,
  hideLabelFromVision,
  operator,
  validity
}) {
  if (operator === OPERATOR_IN_THE_PAST || operator === OPERATOR_OVER) {
    return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
      RelativeDateControl,
      {
        className: "dataviews-controls__date",
        data,
        field,
        onChange,
        hideLabelFromVision,
        operator
      }
    );
  }
  if (operator === OPERATOR_BETWEEN) {
    return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
      CalendarDateRangeControl,
      {
        data,
        field,
        onChange,
        hideLabelFromVision,
        validity
      }
    );
  }
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    CalendarDateControl,
    {
      data,
      field,
      onChange,
      hideLabelFromVision,
      validity
    }
  );
}


;// ./node_modules/@wordpress/icons/build-module/library/at-symbol.js


var at_symbol_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M12.5939 21C14.1472 21 16.1269 20.5701 17.0711 20.1975L16.6447 18.879C16.0964 19.051 14.3299 19.6242 12.6548 19.6242C7.4467 19.6242 4.67513 16.8726 4.67513 12C4.67513 7.21338 7.50762 4.34713 12.2893 4.34713C17.132 4.34713 19.4162 7.55732 19.4162 10.7675C19.4162 14.035 19.0508 15.4968 17.4975 15.4968C16.5838 15.4968 16.0964 14.7803 16.0964 13.9777V7.5H14.4822V8.30255H14.3909C14.1777 7.67198 12.9898 7.12739 11.467 7.2707C9.18274 7.5 7.4467 9.27707 7.4467 11.8567C7.4467 14.5796 8.81726 16.672 11.467 16.758C13.203 16.8153 14.1168 16.0127 14.4822 15.1815H14.5736C14.7563 16.414 16.401 16.8439 17.467 16.8439C20.6954 16.8439 21 13.5764 21 10.7962C21 6.86943 18.0761 3 12.3807 3C6.50254 3 3 6.3535 3 11.9427C3 17.7325 6.38071 21 12.5939 21ZM11.7107 15.2962C9.73096 15.2962 9.03046 13.6051 9.03046 11.7707C9.03046 10.1083 10.0355 8.67516 11.7716 8.67516C13.599 8.67516 14.5736 9.36306 14.5736 11.7707C14.5736 14.1497 13.7513 15.2962 11.7107 15.2962Z" }) });


;// ./node_modules/@wordpress/dataviews/build-module/dataform-controls/utils/validated-input.js





const { ValidatedInputControl: validated_input_ValidatedInputControl } = lock_unlock_unlock(external_wp_components_namespaceObject.privateApis);
function ValidatedText({
  data,
  field,
  onChange,
  hideLabelFromVision,
  type,
  prefix,
  suffix,
  validity
}) {
  const { label, placeholder, description, getValue, setValue, isValid } = field;
  const value = getValue({ item: data });
  const onChangeControl = (0,external_wp_element_.useCallback)(
    (newValue) => onChange(
      setValue({
        item: data,
        value: newValue
      })
    ),
    [data, setValue, onChange]
  );
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    validated_input_ValidatedInputControl,
    {
      required: !!isValid?.required,
      customValidity: getCustomValidity(isValid, validity),
      label,
      placeholder,
      value: value ?? "",
      help: description,
      onChange: onChangeControl,
      hideLabelFromVision,
      type,
      prefix,
      suffix,
      __next40pxDefaultSize: true
    }
  );
}


;// ./node_modules/@wordpress/dataviews/build-module/dataform-controls/email.js




function Email({
  data,
  field,
  onChange,
  hideLabelFromVision,
  validity
}) {
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    ValidatedText,
    {
      ...{
        data,
        field,
        onChange,
        hideLabelFromVision,
        validity,
        type: "email",
        prefix: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalInputControlPrefixWrapper, { variant: "icon", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { icon: at_symbol_default }) })
      }
    }
  );
}


;// ./node_modules/@wordpress/icons/build-module/library/mobile.js


var mobile_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M15 4H9c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h6c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm.5 14c0 .3-.2.5-.5.5H9c-.3 0-.5-.2-.5-.5V6c0-.3.2-.5.5-.5h6c.3 0 .5.2.5.5v12zm-4.5-.5h2V16h-2v1.5z" }) });


;// ./node_modules/@wordpress/dataviews/build-module/dataform-controls/telephone.js




function Telephone({
  data,
  field,
  onChange,
  hideLabelFromVision,
  validity
}) {
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    ValidatedText,
    {
      ...{
        data,
        field,
        onChange,
        hideLabelFromVision,
        validity,
        type: "tel",
        prefix: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalInputControlPrefixWrapper, { variant: "icon", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { icon: mobile_default }) })
      }
    }
  );
}


;// ./node_modules/@wordpress/icons/build-module/library/link.js


var link_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M10 17.389H8.444A5.194 5.194 0 1 1 8.444 7H10v1.5H8.444a3.694 3.694 0 0 0 0 7.389H10v1.5ZM14 7h1.556a5.194 5.194 0 0 1 0 10.39H14v-1.5h1.556a3.694 3.694 0 0 0 0-7.39H14V7Zm-4.5 6h5v-1.5h-5V13Z" }) });


;// ./node_modules/@wordpress/dataviews/build-module/dataform-controls/url.js




function Url({
  data,
  field,
  onChange,
  hideLabelFromVision,
  validity
}) {
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    ValidatedText,
    {
      ...{
        data,
        field,
        onChange,
        hideLabelFromVision,
        validity,
        type: "url",
        prefix: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalInputControlPrefixWrapper, { variant: "icon", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { icon: link_default }) })
      }
    }
  );
}


;// ./node_modules/@wordpress/dataviews/build-module/dataform-controls/utils/validated-number.js







const { ValidatedNumberControl } = lock_unlock_unlock(external_wp_components_namespaceObject.privateApis);
function toNumberOrEmpty(value) {
  if (value === "" || value === void 0) {
    return "";
  }
  const number = Number(value);
  return Number.isFinite(number) ? number : "";
}
function BetweenControls({
  value,
  onChange,
  hideLabelFromVision,
  step
}) {
  const [min = "", max = ""] = value;
  const onChangeMin = (0,external_wp_element_.useCallback)(
    (newValue) => onChange([toNumberOrEmpty(newValue), max]),
    [onChange, max]
  );
  const onChangeMax = (0,external_wp_element_.useCallback)(
    (newValue) => onChange([min, toNumberOrEmpty(newValue)]),
    [onChange, min]
  );
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    external_wp_components_namespaceObject.BaseControl,
    {
      __nextHasNoMarginBottom: true,
      help: (0,external_wp_i18n_namespaceObject.__)("The max. value must be greater than the min. value."),
      children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, { direction: "row", gap: 4, children: [
        /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
          external_wp_components_namespaceObject.__experimentalNumberControl,
          {
            label: (0,external_wp_i18n_namespaceObject.__)("Min."),
            value: min,
            max: max ? Number(max) - step : void 0,
            onChange: onChangeMin,
            __next40pxDefaultSize: true,
            hideLabelFromVision,
            step
          }
        ),
        /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
          external_wp_components_namespaceObject.__experimentalNumberControl,
          {
            label: (0,external_wp_i18n_namespaceObject.__)("Max."),
            value: max,
            min: min ? Number(min) + step : void 0,
            onChange: onChangeMax,
            __next40pxDefaultSize: true,
            hideLabelFromVision,
            step
          }
        )
      ] })
    }
  );
}
function ValidatedNumber({
  data,
  field,
  onChange,
  hideLabelFromVision,
  operator,
  decimals,
  validity
}) {
  const step = Math.pow(10, Math.abs(decimals) * -1);
  const { label, description, getValue, setValue, isValid } = field;
  const value = getValue({ item: data }) ?? "";
  const onChangeControl = (0,external_wp_element_.useCallback)(
    (newValue) => {
      onChange(
        setValue({
          item: data,
          // Do not convert an empty string or undefined to a number,
          // otherwise there's a mismatch between the UI control (empty)
          // and the data relied by onChange (0).
          value: ["", void 0].includes(newValue) ? void 0 : Number(newValue)
        })
      );
    },
    [data, onChange, setValue]
  );
  const onChangeBetweenControls = (0,external_wp_element_.useCallback)(
    (newValue) => {
      onChange(
        setValue({
          item: data,
          value: newValue
        })
      );
    },
    [data, onChange, setValue]
  );
  if (operator === OPERATOR_BETWEEN) {
    let valueBetween = ["", ""];
    if (Array.isArray(value) && value.length === 2 && value.every(
      (element) => typeof element === "number" || element === ""
    )) {
      valueBetween = value;
    }
    return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
      BetweenControls,
      {
        value: valueBetween,
        onChange: onChangeBetweenControls,
        hideLabelFromVision,
        step
      }
    );
  }
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    ValidatedNumberControl,
    {
      required: !!isValid?.required,
      customValidity: getCustomValidity(isValid, validity),
      label,
      help: description,
      value,
      onChange: onChangeControl,
      __next40pxDefaultSize: true,
      hideLabelFromVision,
      step
    }
  );
}


;// ./node_modules/@wordpress/dataviews/build-module/dataform-controls/integer.js


function integer_Number(props) {
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ValidatedNumber, { ...props, decimals: 0 });
}


;// ./node_modules/@wordpress/dataviews/build-module/dataform-controls/number.js


function number_Number(props) {
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ValidatedNumber, { ...props, decimals: 2 });
}


;// ./node_modules/@wordpress/dataviews/build-module/dataform-controls/radio.js






const { ValidatedRadioControl } = lock_unlock_unlock(external_wp_components_namespaceObject.privateApis);
function Radio({
  data,
  field,
  onChange,
  hideLabelFromVision,
  validity
}) {
  const { label, description, getValue, setValue, isValid } = field;
  const { elements, isLoading } = useElements({
    elements: field.elements,
    getElements: field.getElements
  });
  const value = getValue({ item: data });
  const onChangeControl = (0,external_wp_element_.useCallback)(
    (newValue) => onChange(setValue({ item: data, value: newValue })),
    [data, onChange, setValue]
  );
  if (isLoading) {
    return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {});
  }
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    ValidatedRadioControl,
    {
      required: !!field.isValid?.required,
      customValidity: getCustomValidity(isValid, validity),
      label,
      help: description,
      onChange: onChangeControl,
      options: elements,
      selected: value,
      hideLabelFromVision
    }
  );
}


;// ./node_modules/@wordpress/dataviews/build-module/dataform-controls/select.js






const { ValidatedSelectControl } = lock_unlock_unlock(external_wp_components_namespaceObject.privateApis);
function Select({
  data,
  field,
  onChange,
  hideLabelFromVision,
  validity
}) {
  const { type, label, description, getValue, setValue, isValid } = field;
  const isMultiple = type === "array";
  const value = getValue({ item: data }) ?? (isMultiple ? [] : "");
  const onChangeControl = (0,external_wp_element_.useCallback)(
    (newValue) => onChange(setValue({ item: data, value: newValue })),
    [data, onChange, setValue]
  );
  const { elements, isLoading } = useElements({
    elements: field.elements,
    getElements: field.getElements
  });
  if (isLoading) {
    return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {});
  }
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    ValidatedSelectControl,
    {
      required: !!field.isValid?.required,
      customValidity: getCustomValidity(isValid, validity),
      label,
      value,
      help: description,
      options: elements,
      onChange: onChangeControl,
      __next40pxDefaultSize: true,
      __nextHasNoMarginBottom: true,
      hideLabelFromVision,
      multiple: isMultiple
    }
  );
}


;// ./node_modules/@wordpress/dataviews/build-module/dataform-controls/text.js



function Text({
  data,
  field,
  onChange,
  hideLabelFromVision,
  config,
  validity
}) {
  const { prefix, suffix } = config || {};
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    ValidatedText,
    {
      ...{
        data,
        field,
        onChange,
        hideLabelFromVision,
        validity,
        prefix: prefix ? (0,external_wp_element_.createElement)(prefix) : void 0,
        suffix: suffix ? (0,external_wp_element_.createElement)(suffix) : void 0
      }
    }
  );
}


;// ./node_modules/@wordpress/dataviews/build-module/dataform-controls/toggle.js





const { ValidatedToggleControl } = lock_unlock_unlock(external_wp_components_namespaceObject.privateApis);
function Toggle({
  field,
  onChange,
  data,
  hideLabelFromVision,
  validity
}) {
  const { label, description, getValue, setValue, isValid } = field;
  const onChangeControl = (0,external_wp_element_.useCallback)(() => {
    onChange(
      setValue({ item: data, value: !getValue({ item: data }) })
    );
  }, [onChange, setValue, data, getValue]);
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    ValidatedToggleControl,
    {
      required: !!isValid.required,
      customValidity: getCustomValidity(isValid, validity),
      hidden: hideLabelFromVision,
      __nextHasNoMarginBottom: true,
      label,
      help: description,
      checked: getValue({ item: data }),
      onChange: onChangeControl
    }
  );
}


;// ./node_modules/@wordpress/dataviews/build-module/dataform-controls/textarea.js





const { ValidatedTextareaControl } = lock_unlock_unlock(external_wp_components_namespaceObject.privateApis);
function Textarea({
  data,
  field,
  onChange,
  hideLabelFromVision,
  config,
  validity
}) {
  const { rows = 4 } = config || {};
  const { label, placeholder, description, setValue, isValid } = field;
  const value = field.getValue({ item: data });
  const onChangeControl = (0,external_wp_element_.useCallback)(
    (newValue) => onChange(setValue({ item: data, value: newValue })),
    [data, onChange, setValue]
  );
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    ValidatedTextareaControl,
    {
      required: !!isValid?.required,
      customValidity: getCustomValidity(isValid, validity),
      label,
      placeholder,
      value: value ?? "",
      help: description,
      onChange: onChangeControl,
      rows,
      __next40pxDefaultSize: true,
      __nextHasNoMarginBottom: true,
      hideLabelFromVision
    }
  );
}


;// ./node_modules/@wordpress/dataviews/build-module/dataform-controls/toggle-group.js






const { ValidatedToggleGroupControl } = lock_unlock_unlock(external_wp_components_namespaceObject.privateApis);
function ToggleGroup({
  data,
  field,
  onChange,
  hideLabelFromVision,
  validity
}) {
  const { getValue, setValue, isValid } = field;
  const value = getValue({ item: data });
  const onChangeControl = (0,external_wp_element_.useCallback)(
    (newValue) => onChange(setValue({ item: data, value: newValue })),
    [data, onChange, setValue]
  );
  const { elements, isLoading } = useElements({
    elements: field.elements,
    getElements: field.getElements
  });
  if (isLoading) {
    return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {});
  }
  if (elements.length === 0) {
    return null;
  }
  const selectedOption = elements.find((el) => el.value === value);
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    ValidatedToggleGroupControl,
    {
      required: !!field.isValid?.required,
      customValidity: getCustomValidity(isValid, validity),
      __next40pxDefaultSize: true,
      __nextHasNoMarginBottom: true,
      isBlock: true,
      label: field.label,
      help: selectedOption?.description || field.description,
      onChange: onChangeControl,
      value,
      hideLabelFromVision,
      children: elements.map((el) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
        external_wp_components_namespaceObject.__experimentalToggleGroupControlOption,
        {
          label: el.label,
          value: el.value
        },
        el.value
      ))
    }
  );
}


;// ./node_modules/@wordpress/dataviews/build-module/dataform-controls/array.js






const { ValidatedFormTokenField } = lock_unlock_unlock(external_wp_components_namespaceObject.privateApis);
function ArrayControl({
  data,
  field,
  onChange,
  hideLabelFromVision,
  validity
}) {
  const { label, placeholder, getValue, setValue, isValid } = field;
  const value = getValue({ item: data });
  const { elements, isLoading } = useElements({
    elements: field.elements,
    getElements: field.getElements
  });
  const arrayValueAsElements = (0,external_wp_element_.useMemo)(
    () => Array.isArray(value) ? value.map((token) => {
      const element = elements?.find(
        (suggestion) => suggestion.value === token
      );
      return element || { value: token, label: token };
    }) : [],
    [value, elements]
  );
  const onChangeControl = (0,external_wp_element_.useCallback)(
    (tokens) => {
      const valueTokens = tokens.map((token) => {
        if (typeof token === "object" && "value" in token) {
          return token.value;
        }
        return token;
      });
      onChange(setValue({ item: data, value: valueTokens }));
    },
    [onChange, setValue, data]
  );
  if (isLoading) {
    return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {});
  }
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    ValidatedFormTokenField,
    {
      required: !!isValid?.required,
      customValidity: getCustomValidity(isValid, validity),
      label: hideLabelFromVision ? void 0 : label,
      value: arrayValueAsElements,
      onChange: onChangeControl,
      placeholder,
      suggestions: elements?.map((element) => element.value),
      __experimentalValidateInput: (token) => {
        if (field.isValid?.elements && elements) {
          return elements.some(
            (element) => element.value === token || element.label === token
          );
        }
        return true;
      },
      __experimentalExpandOnFocus: elements && elements.length > 0,
      __experimentalShowHowTo: !field.isValid?.elements,
      displayTransform: (token) => {
        if (typeof token === "object" && "label" in token) {
          return token.label;
        }
        if (typeof token === "string" && elements) {
          const element = elements.find(
            (el) => el.value === token
          );
          return element?.label || token;
        }
        return token;
      },
      __experimentalRenderItem: ({ item }) => {
        if (typeof item === "string" && elements) {
          const element = elements.find(
            (el) => el.value === item
          );
          return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { children: element?.label || item });
        }
        return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { children: item });
      }
    }
  );
}


;// ./node_modules/@wordpress/dataviews/build-module/dataform-controls/color.js






const { ValidatedInputControl: color_ValidatedInputControl, Picker } = lock_unlock_unlock(external_wp_components_namespaceObject.privateApis);
const ColorPicker = ({
  color,
  onColorChange
}) => {
  const validColor = color && w(color).isValid() ? color : "#ffffff";
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    external_wp_components_namespaceObject.Dropdown,
    {
      renderToggle: ({ onToggle, isOpen }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalInputControlPrefixWrapper, { variant: "icon", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
        "button",
        {
          type: "button",
          onClick: onToggle,
          style: {
            width: "24px",
            height: "24px",
            borderRadius: "50%",
            backgroundColor: validColor,
            border: "1px solid #ddd",
            cursor: "pointer",
            outline: isOpen ? "2px solid #007cba" : "none",
            outlineOffset: "2px",
            display: "flex",
            alignItems: "center",
            justifyContent: "center",
            padding: 0,
            margin: 0
          },
          "aria-label": "Open color picker"
        }
      ) }),
      renderContent: () => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { style: { padding: "16px" }, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
        Picker,
        {
          color: w(validColor),
          onChange: onColorChange,
          enableAlpha: true
        }
      ) })
    }
  );
};
function Color({
  data,
  field,
  onChange,
  hideLabelFromVision,
  validity
}) {
  const { label, placeholder, description, setValue, isValid } = field;
  const value = field.getValue({ item: data }) || "";
  const handleColorChange = (0,external_wp_element_.useCallback)(
    (colorObject) => {
      onChange(setValue({ item: data, value: colorObject.toHex() }));
    },
    [data, onChange, setValue]
  );
  const handleInputChange = (0,external_wp_element_.useCallback)(
    (newValue) => {
      onChange(setValue({ item: data, value: newValue || "" }));
    },
    [data, onChange, setValue]
  );
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    color_ValidatedInputControl,
    {
      required: !!field.isValid?.required,
      customValidity: getCustomValidity(isValid, validity),
      label,
      placeholder,
      value,
      help: description,
      onChange: handleInputChange,
      hideLabelFromVision,
      type: "text",
      prefix: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
        ColorPicker,
        {
          color: value,
          onColorChange: handleColorChange
        }
      )
    }
  );
}


;// ./node_modules/@wordpress/icons/build-module/library/unseen.js


var unseen_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M20.7 12.7s0-.1-.1-.2c0-.2-.2-.4-.4-.6-.3-.5-.9-1.2-1.6-1.8-.7-.6-1.5-1.3-2.6-1.8l-.6 1.4c.9.4 1.6 1 2.1 1.5.6.6 1.1 1.2 1.4 1.6.1.2.3.4.3.5v.1l.7-.3.7-.3Zm-5.2-9.3-1.8 4c-.5-.1-1.1-.2-1.7-.2-3 0-5.2 1.4-6.6 2.7-.7.7-1.2 1.3-1.6 1.8-.2.3-.3.5-.4.6 0 0 0 .1-.1.2s0 0 .7.3l.7.3V13c0-.1.2-.3.3-.5.3-.4.7-1 1.4-1.6 1.2-1.2 3-2.3 5.5-2.3H13v.3c-.4 0-.8-.1-1.1-.1-1.9 0-3.5 1.6-3.5 3.5s.6 2.3 1.6 2.9l-2 4.4.9.4 7.6-16.2-.9-.4Zm-3 12.6c1.7-.2 3-1.7 3-3.5s-.2-1.4-.6-1.9L12.4 16Z" }) });


;// ./node_modules/@wordpress/dataviews/build-module/dataform-controls/password.js






function Password({
  data,
  field,
  onChange,
  hideLabelFromVision,
  validity
}) {
  const [isVisible, setIsVisible] = (0,external_wp_element_.useState)(false);
  const toggleVisibility = (0,external_wp_element_.useCallback)(() => {
    setIsVisible((prev) => !prev);
  }, []);
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    ValidatedText,
    {
      ...{
        data,
        field,
        onChange,
        hideLabelFromVision,
        validity,
        type: isVisible ? "text" : "password",
        suffix: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
          external_wp_components_namespaceObject.Button,
          {
            icon: isVisible ? unseen_default : seen_default,
            onClick: toggleVisibility,
            size: "small",
            variant: "tertiary",
            "aria-label": isVisible ? (0,external_wp_i18n_namespaceObject.__)("Hide password") : (0,external_wp_i18n_namespaceObject.__)("Show password")
          }
        )
      }
    }
  );
}


;// ./node_modules/@wordpress/dataviews/build-module/utils/has-elements.js
function hasElements(field) {
  return Array.isArray(field.elements) && field.elements.length > 0 || typeof field.getElements === "function";
}


;// ./node_modules/@wordpress/dataviews/build-module/dataform-controls/index.js



















const FORM_CONTROLS = {
  array: ArrayControl,
  checkbox: Checkbox,
  color: Color,
  datetime: DateTime,
  date: DateControl,
  email: Email,
  telephone: Telephone,
  url: Url,
  integer: integer_Number,
  number: number_Number,
  password: Password,
  radio: Radio,
  select: Select,
  text: Text,
  toggle: Toggle,
  textarea: Textarea,
  toggleGroup: ToggleGroup
};
function isEditConfig(value) {
  return value && typeof value === "object" && typeof value.control === "string";
}
function createConfiguredControl(config) {
  const { control, ...controlConfig } = config;
  const BaseControlType = getControlByType(control);
  return function ConfiguredControl(props) {
    return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(BaseControlType, { ...props, config: controlConfig });
  };
}
function getControl(field, fieldTypeDefinition) {
  if (typeof field.Edit === "function") {
    return field.Edit;
  }
  if (typeof field.Edit === "string") {
    return getControlByType(field.Edit);
  }
  if (isEditConfig(field.Edit)) {
    return createConfiguredControl(field.Edit);
  }
  if (hasElements(field) && field.type !== "array") {
    return getControlByType("select");
  }
  if (typeof fieldTypeDefinition.Edit === "string") {
    return getControlByType(fieldTypeDefinition.Edit);
  }
  if (isEditConfig(fieldTypeDefinition.Edit)) {
    return createConfiguredControl(fieldTypeDefinition.Edit);
  }
  return fieldTypeDefinition.Edit;
}
function getControlByType(type) {
  if (Object.keys(FORM_CONTROLS).includes(type)) {
    return FORM_CONTROLS[type];
  }
  throw "Control " + type + " not found";
}


;// ./node_modules/@wordpress/dataviews/build-module/utils/normalize-fields.js




const getValueFromId = (id) => ({ item }) => {
  const path = id.split(".");
  let value = item;
  for (const segment of path) {
    if (value.hasOwnProperty(segment)) {
      value = value[segment];
    } else {
      value = void 0;
    }
  }
  return value;
};
const setValueFromId = (id) => ({ value }) => {
  const path = id.split(".");
  const result = {};
  let current = result;
  for (const segment of path.slice(0, -1)) {
    current[segment] = {};
    current = current[segment];
  }
  current[path.at(-1)] = value;
  return result;
};
function getFilterBy(field, fieldTypeDefinition) {
  if (field.filterBy === false) {
    return false;
  }
  if (typeof field.filterBy === "object") {
    let operators = field.filterBy.operators;
    if (!operators || !Array.isArray(operators)) {
      operators = !!fieldTypeDefinition.filterBy ? fieldTypeDefinition.filterBy.defaultOperators : [];
    }
    let validOperators = ALL_OPERATORS;
    if (typeof fieldTypeDefinition.filterBy === "object") {
      validOperators = fieldTypeDefinition.filterBy.validOperators;
    }
    operators = operators.filter(
      (operator) => validOperators.includes(operator)
    );
    if (hasElements(field) && operators.includes(OPERATOR_BETWEEN)) {
      operators = operators.filter(
        (operator) => operator !== OPERATOR_BETWEEN
      );
    }
    const hasSingleSelectionOperator = operators.some(
      (operator) => SINGLE_SELECTION_OPERATORS.includes(operator)
    );
    if (hasSingleSelectionOperator) {
      operators = operators.filter(
        (operator) => (
          // The 'Between' operator is unique as it can be combined with single selection operators.
          [...SINGLE_SELECTION_OPERATORS, OPERATOR_BETWEEN].includes(
            operator
          )
        )
      );
    }
    if (operators.length === 0) {
      return false;
    }
    return {
      isPrimary: !!field.filterBy.isPrimary,
      operators
    };
  }
  if (fieldTypeDefinition.filterBy === false) {
    return false;
  }
  let defaultOperators = fieldTypeDefinition.filterBy.defaultOperators;
  if (hasElements(field) && defaultOperators.includes(OPERATOR_BETWEEN)) {
    defaultOperators = defaultOperators.filter(
      (operator) => operator !== OPERATOR_BETWEEN
    );
  }
  return {
    operators: defaultOperators
  };
}
function normalizeFields(fields) {
  return fields.map((field) => {
    const fieldTypeDefinition = getFieldTypeDefinition(
      field.type
    );
    const getValue = field.getValue || getValueFromId(field.id);
    const setValue = field.setValue || setValueFromId(field.id);
    const sort = field.sort ?? function sort2(a, b, direction) {
      return fieldTypeDefinition.sort(
        getValue({ item: a }),
        getValue({ item: b }),
        direction
      );
    };
    const isValid = {
      ...fieldTypeDefinition.isValid,
      ...field.isValid
    };
    const Edit = getControl(field, fieldTypeDefinition);
    const render = field.render ?? function render2({
      item,
      field: renderedField
    }) {
      return fieldTypeDefinition.render({ item, field: renderedField });
    };
    const filterBy = getFilterBy(field, fieldTypeDefinition);
    return {
      ...field,
      label: field.label || field.id,
      header: field.header || field.label || field.id,
      getValue,
      setValue,
      render,
      sort,
      isValid,
      Edit,
      hasElements: hasElements(field),
      enableHiding: field.enableHiding ?? true,
      enableSorting: field.enableSorting ?? fieldTypeDefinition.enableSorting ?? true,
      filterBy,
      readOnly: field.readOnly ?? fieldTypeDefinition.readOnly ?? false
    };
  });
}


;// ./node_modules/@wordpress/dataviews/build-module/utils/filter-sort-and-paginate.js





function normalizeSearchInput(input = "") {
  return remove_accents_default()(input.trim().toLowerCase());
}
const filter_sort_and_paginate_EMPTY_ARRAY = [];
function getRelativeDate(value, unit) {
  switch (unit) {
    case "days":
      return subDays(/* @__PURE__ */ new Date(), value);
    case "weeks":
      return subWeeks(/* @__PURE__ */ new Date(), value);
    case "months":
      return subMonths(/* @__PURE__ */ new Date(), value);
    case "years":
      return subYears(/* @__PURE__ */ new Date(), value);
    default:
      return /* @__PURE__ */ new Date();
  }
}
function filterSortAndPaginate(data, view, fields) {
  if (!data) {
    return {
      data: filter_sort_and_paginate_EMPTY_ARRAY,
      paginationInfo: { totalItems: 0, totalPages: 0 }
    };
  }
  const _fields = normalizeFields(fields);
  let filteredData = [...data];
  if (view.search) {
    const normalizedSearch = normalizeSearchInput(view.search);
    filteredData = filteredData.filter((item) => {
      return _fields.filter((field) => field.enableGlobalSearch).some((field) => {
        const fieldValue = field.getValue({ item });
        const values = Array.isArray(fieldValue) ? fieldValue : [fieldValue];
        return values.some(
          (value) => normalizeSearchInput(String(value)).includes(
            normalizedSearch
          )
        );
      });
    });
  }
  if (view.filters && view.filters?.length > 0) {
    view.filters.forEach((filter) => {
      const field = _fields.find(
        (_field) => _field.id === filter.field
      );
      if (field) {
        if (filter.operator === constants_OPERATOR_IS_ANY && filter?.value?.length > 0) {
          filteredData = filteredData.filter((item) => {
            const fieldValue = field.getValue({ item });
            if (Array.isArray(fieldValue)) {
              return filter.value.some(
                (filterValue) => fieldValue.includes(filterValue)
              );
            } else if (typeof fieldValue === "string") {
              return filter.value.includes(fieldValue);
            }
            return false;
          });
        } else if (filter.operator === constants_OPERATOR_IS_NONE && filter?.value?.length > 0) {
          filteredData = filteredData.filter((item) => {
            const fieldValue = field.getValue({ item });
            if (Array.isArray(fieldValue)) {
              return !filter.value.some(
                (filterValue) => fieldValue.includes(filterValue)
              );
            } else if (typeof fieldValue === "string") {
              return !filter.value.includes(fieldValue);
            }
            return false;
          });
        } else if (filter.operator === OPERATOR_IS_ALL && filter?.value?.length > 0) {
          filteredData = filteredData.filter((item) => {
            return filter.value.every((value) => {
              return field.getValue({ item })?.includes(value);
            });
          });
        } else if (filter.operator === OPERATOR_IS_NOT_ALL && filter?.value?.length > 0) {
          filteredData = filteredData.filter((item) => {
            return filter.value.every((value) => {
              return !field.getValue({ item })?.includes(value);
            });
          });
        } else if (filter.operator === constants_OPERATOR_IS) {
          filteredData = filteredData.filter((item) => {
            return filter.value === field.getValue({ item }) || filter.value === void 0;
          });
        } else if (filter.operator === constants_OPERATOR_IS_NOT) {
          filteredData = filteredData.filter((item) => {
            return filter.value !== field.getValue({ item });
          });
        } else if (filter.operator === OPERATOR_ON && filter.value !== void 0) {
          const filterDate = (0,external_wp_date_namespaceObject.getDate)(filter.value);
          filteredData = filteredData.filter((item) => {
            const fieldDate = (0,external_wp_date_namespaceObject.getDate)(field.getValue({ item }));
            return filterDate.getTime() === fieldDate.getTime();
          });
        } else if (filter.operator === OPERATOR_NOT_ON && filter.value !== void 0) {
          const filterDate = (0,external_wp_date_namespaceObject.getDate)(filter.value);
          filteredData = filteredData.filter((item) => {
            const fieldDate = (0,external_wp_date_namespaceObject.getDate)(field.getValue({ item }));
            return filterDate.getTime() !== fieldDate.getTime();
          });
        } else if (filter.operator === OPERATOR_LESS_THAN && filter.value !== void 0) {
          filteredData = filteredData.filter((item) => {
            const fieldValue = field.getValue({ item });
            return fieldValue < filter.value;
          });
        } else if (filter.operator === OPERATOR_GREATER_THAN && filter.value !== void 0) {
          filteredData = filteredData.filter((item) => {
            const fieldValue = field.getValue({ item });
            return fieldValue > filter.value;
          });
        } else if (filter.operator === OPERATOR_LESS_THAN_OR_EQUAL && filter.value !== void 0) {
          filteredData = filteredData.filter((item) => {
            const fieldValue = field.getValue({ item });
            return fieldValue <= filter.value;
          });
        } else if (filter.operator === OPERATOR_GREATER_THAN_OR_EQUAL && filter.value !== void 0) {
          filteredData = filteredData.filter((item) => {
            const fieldValue = field.getValue({ item });
            return fieldValue >= filter.value;
          });
        } else if (filter.operator === OPERATOR_CONTAINS && filter?.value !== void 0) {
          filteredData = filteredData.filter((item) => {
            const fieldValue = field.getValue({ item });
            return typeof fieldValue === "string" && filter.value && fieldValue.toLowerCase().includes(
              String(filter.value).toLowerCase()
            );
          });
        } else if (filter.operator === OPERATOR_NOT_CONTAINS && filter?.value !== void 0) {
          filteredData = filteredData.filter((item) => {
            const fieldValue = field.getValue({ item });
            return typeof fieldValue === "string" && filter.value && !fieldValue.toLowerCase().includes(
              String(filter.value).toLowerCase()
            );
          });
        } else if (filter.operator === OPERATOR_STARTS_WITH && filter?.value !== void 0) {
          filteredData = filteredData.filter((item) => {
            const fieldValue = field.getValue({ item });
            return typeof fieldValue === "string" && filter.value && fieldValue.toLowerCase().startsWith(
              String(filter.value).toLowerCase()
            );
          });
        } else if (filter.operator === OPERATOR_BEFORE && filter.value !== void 0) {
          const filterValue = (0,external_wp_date_namespaceObject.getDate)(filter.value);
          filteredData = filteredData.filter((item) => {
            const fieldValue = (0,external_wp_date_namespaceObject.getDate)(
              field.getValue({ item })
            );
            return fieldValue < filterValue;
          });
        } else if (filter.operator === OPERATOR_AFTER && filter.value !== void 0) {
          const filterValue = (0,external_wp_date_namespaceObject.getDate)(filter.value);
          filteredData = filteredData.filter((item) => {
            const fieldValue = (0,external_wp_date_namespaceObject.getDate)(
              field.getValue({ item })
            );
            return fieldValue > filterValue;
          });
        } else if (filter.operator === OPERATOR_BEFORE_INC && filter.value !== void 0) {
          const filterValue = (0,external_wp_date_namespaceObject.getDate)(filter.value);
          filteredData = filteredData.filter((item) => {
            const fieldValue = (0,external_wp_date_namespaceObject.getDate)(
              field.getValue({ item })
            );
            return fieldValue <= filterValue;
          });
        } else if (filter.operator === OPERATOR_AFTER_INC && filter.value !== void 0) {
          const filterValue = (0,external_wp_date_namespaceObject.getDate)(filter.value);
          filteredData = filteredData.filter((item) => {
            const fieldValue = (0,external_wp_date_namespaceObject.getDate)(
              field.getValue({ item })
            );
            return fieldValue >= filterValue;
          });
        } else if (filter.operator === OPERATOR_BETWEEN && Array.isArray(filter.value) && filter.value.length === 2 && filter.value[0] !== void 0 && filter.value[1] !== void 0) {
          filteredData = filteredData.filter((item) => {
            const fieldValue = field.getValue({ item });
            if (typeof fieldValue === "number" || fieldValue instanceof Date || typeof fieldValue === "string") {
              return fieldValue >= filter.value[0] && fieldValue <= filter.value[1];
            }
            return false;
          });
        } else if (filter.operator === OPERATOR_IN_THE_PAST && filter.value?.value !== void 0 && filter.value?.unit !== void 0) {
          const targetDate = getRelativeDate(
            filter.value.value,
            filter.value.unit
          );
          filteredData = filteredData.filter((item) => {
            const fieldValue = (0,external_wp_date_namespaceObject.getDate)(
              field.getValue({ item })
            );
            return fieldValue >= targetDate && fieldValue <= /* @__PURE__ */ new Date();
          });
        } else if (filter.operator === OPERATOR_OVER && filter.value?.value !== void 0 && filter.value?.unit !== void 0) {
          const targetDate = getRelativeDate(
            filter.value.value,
            filter.value.unit
          );
          filteredData = filteredData.filter((item) => {
            const fieldValue = (0,external_wp_date_namespaceObject.getDate)(
              field.getValue({ item })
            );
            return fieldValue < targetDate;
          });
        }
      }
    });
  }
  const sortByField = view.sort?.field ? _fields.find((field) => {
    return field.id === view.sort?.field;
  }) : null;
  const groupByField = view.groupByField ? _fields.find((field) => {
    return field.id === view.groupByField;
  }) : null;
  if (sortByField || groupByField) {
    filteredData.sort((a, b) => {
      if (groupByField) {
        const groupCompare = groupByField.sort(a, b, "asc");
        if (groupCompare !== 0) {
          return groupCompare;
        }
      }
      if (sortByField) {
        return sortByField.sort(a, b, view.sort?.direction ?? "desc");
      }
      return 0;
    });
  }
  let totalItems = filteredData.length;
  let totalPages = 1;
  if (view.page !== void 0 && view.perPage !== void 0) {
    const start = (view.page - 1) * view.perPage;
    totalItems = filteredData?.length || 0;
    totalPages = Math.ceil(totalItems / view.perPage);
    filteredData = filteredData?.slice(start, start + view.perPage);
  }
  return {
    data: filteredData,
    paginationInfo: {
      totalItems,
      totalPages
    }
  };
}


;// ./node_modules/@wordpress/dataviews/build-module/components/dataviews-context/index.js


const dataviews_context_DataViewsContext = (0,external_wp_element_.createContext)({
  view: { type: constants_LAYOUT_TABLE },
  onChangeView: () => {
  },
  fields: [],
  data: [],
  paginationInfo: {
    totalItems: 0,
    totalPages: 0
  },
  selection: [],
  onChangeSelection: () => {
  },
  setOpenedFilter: () => {
  },
  openedFilter: null,
  getItemId: (item) => item.id,
  isItemClickable: () => true,
  renderItemLink: void 0,
  containerWidth: 0,
  containerRef: (0,external_wp_element_.createRef)(),
  resizeObserverRef: () => {
  },
  defaultLayouts: { list: {}, grid: {}, table: {} },
  filters: [],
  isShowingFilter: false,
  setIsShowingFilter: () => {
  },
  hasInfiniteScrollHandler: false,
  config: {
    perPageSizes: []
  }
});
dataviews_context_DataViewsContext.displayName = "DataViewsContext";
var dataviews_context_default = dataviews_context_DataViewsContext;


;// ./node_modules/@wordpress/icons/build-module/library/block-table.js


var block_table_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM5 4.5h14c.3 0 .5.2.5.5v3.5h-15V5c0-.3.2-.5.5-.5zm8 5.5h6.5v3.5H13V10zm-1.5 3.5h-7V10h7v3.5zm-7 5.5v-4h7v4.5H5c-.3 0-.5-.2-.5-.5zm14.5.5h-6V15h6.5v4c0 .3-.2.5-.5.5z" }) });


;// ./node_modules/@wordpress/icons/build-module/library/category.js


var category_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
  external_wp_primitives_namespaceObject.Path,
  {
    d: "M6 5.5h3a.5.5 0 01.5.5v3a.5.5 0 01-.5.5H6a.5.5 0 01-.5-.5V6a.5.5 0 01.5-.5zM4 6a2 2 0 012-2h3a2 2 0 012 2v3a2 2 0 01-2 2H6a2 2 0 01-2-2V6zm11-.5h3a.5.5 0 01.5.5v3a.5.5 0 01-.5.5h-3a.5.5 0 01-.5-.5V6a.5.5 0 01.5-.5zM13 6a2 2 0 012-2h3a2 2 0 012 2v3a2 2 0 01-2 2h-3a2 2 0 01-2-2V6zm5 8.5h-3a.5.5 0 00-.5.5v3a.5.5 0 00.5.5h3a.5.5 0 00.5-.5v-3a.5.5 0 00-.5-.5zM15 13a2 2 0 00-2 2v3a2 2 0 002 2h3a2 2 0 002-2v-3a2 2 0 00-2-2h-3zm-9 1.5h3a.5.5 0 01.5.5v3a.5.5 0 01-.5.5H6a.5.5 0 01-.5-.5v-3a.5.5 0 01.5-.5zM4 15a2 2 0 012-2h3a2 2 0 012 2v3a2 2 0 01-2 2H6a2 2 0 01-2-2v-3z",
    fillRule: "evenodd",
    clipRule: "evenodd"
  }
) });


;// ./node_modules/@wordpress/icons/build-module/library/format-list-bullets-rtl.js


var format_list_bullets_rtl_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M4 8.8h8.9V7.2H4v1.6zm0 7h8.9v-1.5H4v1.5zM18 13c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0-3c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2z" }) });


;// ./node_modules/@wordpress/icons/build-module/library/format-list-bullets.js


var format_list_bullets_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M11.1 15.8H20v-1.5h-8.9v1.5zm0-8.6v1.5H20V7.2h-8.9zM6 13c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0-7c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z" }) });


;// ./node_modules/@wordpress/dataviews/build-module/components/dataviews-selection-checkbox/index.js



function DataViewsSelectionCheckbox({
  selection,
  onChangeSelection,
  item,
  getItemId,
  titleField,
  disabled,
  ...extraProps
}) {
  const id = getItemId(item);
  const checked = !disabled && selection.includes(id);
  const selectionLabel = titleField?.getValue?.({ item }) || (0,external_wp_i18n_namespaceObject.__)("(no title)");
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    external_wp_components_namespaceObject.CheckboxControl,
    {
      className: "dataviews-selection-checkbox",
      __nextHasNoMarginBottom: true,
      "aria-label": selectionLabel,
      "aria-disabled": disabled,
      checked,
      onChange: () => {
        if (disabled) {
          return;
        }
        onChangeSelection(
          selection.includes(id) ? selection.filter((itemId) => id !== itemId) : [...selection, id]
        );
      },
      ...extraProps
    }
  );
}


;// ./node_modules/@wordpress/dataviews/build-module/components/dataviews-item-actions/index.js








const { Menu: dataviews_item_actions_Menu, kebabCase: dataviews_item_actions_kebabCase } = lock_unlock_unlock(external_wp_components_namespaceObject.privateApis);
function ButtonTrigger({
  action,
  onClick,
  items
}) {
  const label = typeof action.label === "string" ? action.label : action.label(items);
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    external_wp_components_namespaceObject.Button,
    {
      disabled: !!action.disabled,
      accessibleWhenDisabled: true,
      size: "compact",
      onClick,
      children: label
    }
  );
}
function MenuItemTrigger({
  action,
  onClick,
  items
}) {
  const label = typeof action.label === "string" ? action.label : action.label(items);
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(dataviews_item_actions_Menu.Item, { disabled: action.disabled, onClick, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(dataviews_item_actions_Menu.ItemLabel, { children: label }) });
}
function ActionModal({
  action,
  items,
  closeModal
}) {
  const label = typeof action.label === "string" ? action.label : action.label(items);
  const modalHeader = typeof action.modalHeader === "function" ? action.modalHeader(items) : action.modalHeader;
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    external_wp_components_namespaceObject.Modal,
    {
      title: modalHeader || label,
      __experimentalHideHeader: !!action.hideModalHeader,
      onRequestClose: closeModal,
      focusOnMount: action.modalFocusOnMount ?? true,
      size: action.modalSize || "medium",
      overlayClassName: `dataviews-action-modal dataviews-action-modal__${dataviews_item_actions_kebabCase(
        action.id
      )}`,
      children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(action.RenderModal, { items, closeModal })
    }
  );
}
function ActionsMenuGroup({
  actions,
  item,
  registry,
  setActiveModalAction
}) {
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(dataviews_item_actions_Menu.Group, { children: actions.map((action) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    MenuItemTrigger,
    {
      action,
      onClick: () => {
        if ("RenderModal" in action) {
          setActiveModalAction(action);
          return;
        }
        action.callback([item], { registry });
      },
      items: [item]
    },
    action.id
  )) });
}
function ItemActions({
  item,
  actions,
  isCompact
}) {
  const registry = (0,external_wp_data_.useRegistry)();
  const { primaryActions, eligibleActions } = (0,external_wp_element_.useMemo)(() => {
    const _eligibleActions = actions.filter(
      (action) => !action.isEligible || action.isEligible(item)
    );
    const _primaryActions = _eligibleActions.filter(
      (action) => action.isPrimary
    );
    return {
      primaryActions: _primaryActions,
      eligibleActions: _eligibleActions
    };
  }, [actions, item]);
  if (isCompact) {
    return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
      CompactItemActions,
      {
        item,
        actions: eligibleActions,
        isSmall: true,
        registry
      }
    );
  }
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
    external_wp_components_namespaceObject.__experimentalHStack,
    {
      spacing: 0,
      justify: "flex-end",
      className: "dataviews-item-actions",
      style: {
        flexShrink: 0,
        width: "auto"
      },
      children: [
        /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
          PrimaryActions,
          {
            item,
            actions: primaryActions,
            registry
          }
        ),
        primaryActions.length < eligibleActions.length && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
          CompactItemActions,
          {
            item,
            actions: eligibleActions,
            registry
          }
        )
      ]
    }
  );
}
function CompactItemActions({
  item,
  actions,
  isSmall,
  registry
}) {
  const [activeModalAction, setActiveModalAction] = (0,external_wp_element_.useState)(
    null
  );
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
    /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(dataviews_item_actions_Menu, { placement: "bottom-end", children: [
      /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
        dataviews_item_actions_Menu.TriggerButton,
        {
          render: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
            external_wp_components_namespaceObject.Button,
            {
              size: isSmall ? "small" : "compact",
              icon: more_vertical_default,
              label: (0,external_wp_i18n_namespaceObject.__)("Actions"),
              accessibleWhenDisabled: true,
              disabled: !actions.length,
              className: "dataviews-all-actions-button"
            }
          )
        }
      ),
      /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(dataviews_item_actions_Menu.Popover, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
        ActionsMenuGroup,
        {
          actions,
          item,
          registry,
          setActiveModalAction
        }
      ) })
    ] }),
    !!activeModalAction && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
      ActionModal,
      {
        action: activeModalAction,
        items: [item],
        closeModal: () => setActiveModalAction(null)
      }
    )
  ] });
}
function PrimaryActions({
  item,
  actions,
  registry
}) {
  const [activeModalAction, setActiveModalAction] = (0,external_wp_element_.useState)(null);
  const isMobileViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)("medium", "<");
  if (isMobileViewport) {
    return null;
  }
  if (!Array.isArray(actions) || actions.length === 0) {
    return null;
  }
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
    actions.map((action) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
      ButtonTrigger,
      {
        action,
        onClick: () => {
          if ("RenderModal" in action) {
            setActiveModalAction(action);
            return;
          }
          action.callback([item], { registry });
        },
        items: [item]
      },
      action.id
    )),
    !!activeModalAction && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
      ActionModal,
      {
        action: activeModalAction,
        items: [item],
        closeModal: () => setActiveModalAction(null)
      }
    )
  ] });
}


;// ./node_modules/@wordpress/dataviews/build-module/components/dataviews-bulk-actions/index.js









function ActionWithModal({
  action,
  items,
  ActionTriggerComponent
}) {
  const [isModalOpen, setIsModalOpen] = (0,external_wp_element_.useState)(false);
  const actionTriggerProps = {
    action,
    onClick: () => {
      setIsModalOpen(true);
    },
    items
  };
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
    /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ActionTriggerComponent, { ...actionTriggerProps }),
    isModalOpen && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
      ActionModal,
      {
        action,
        items,
        closeModal: () => setIsModalOpen(false)
      }
    )
  ] });
}
function useHasAPossibleBulkAction(actions, item) {
  return (0,external_wp_element_.useMemo)(() => {
    return actions.some((action) => {
      return action.supportsBulk && (!action.isEligible || action.isEligible(item));
    });
  }, [actions, item]);
}
function useSomeItemHasAPossibleBulkAction(actions, data) {
  return (0,external_wp_element_.useMemo)(() => {
    return data.some((item) => {
      return actions.some((action) => {
        return action.supportsBulk && (!action.isEligible || action.isEligible(item));
      });
    });
  }, [actions, data]);
}
function BulkSelectionCheckbox({
  selection,
  onChangeSelection,
  data,
  actions,
  getItemId
}) {
  const selectableItems = (0,external_wp_element_.useMemo)(() => {
    return data.filter((item) => {
      return actions.some(
        (action) => action.supportsBulk && (!action.isEligible || action.isEligible(item))
      );
    });
  }, [data, actions]);
  const selectedItems = data.filter(
    (item) => selection.includes(getItemId(item)) && selectableItems.includes(item)
  );
  const areAllSelected = selectedItems.length === selectableItems.length;
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    external_wp_components_namespaceObject.CheckboxControl,
    {
      className: "dataviews-view-table-selection-checkbox",
      __nextHasNoMarginBottom: true,
      checked: areAllSelected,
      indeterminate: !areAllSelected && !!selectedItems.length,
      onChange: () => {
        if (areAllSelected) {
          onChangeSelection([]);
        } else {
          onChangeSelection(
            selectableItems.map((item) => getItemId(item))
          );
        }
      },
      "aria-label": areAllSelected ? (0,external_wp_i18n_namespaceObject.__)("Deselect all") : (0,external_wp_i18n_namespaceObject.__)("Select all")
    }
  );
}
function ActionTrigger({
  action,
  onClick,
  isBusy,
  items
}) {
  const label = typeof action.label === "string" ? action.label : action.label(items);
  const isMobile = (0,external_wp_compose_namespaceObject.useViewportMatch)("medium", "<");
  if (isMobile) {
    return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
      external_wp_components_namespaceObject.Button,
      {
        disabled: isBusy,
        accessibleWhenDisabled: true,
        label,
        icon: action.icon,
        size: "compact",
        onClick,
        isBusy
      }
    );
  }
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    external_wp_components_namespaceObject.Button,
    {
      disabled: isBusy,
      accessibleWhenDisabled: true,
      size: "compact",
      onClick,
      isBusy,
      children: label
    }
  );
}
const dataviews_bulk_actions_EMPTY_ARRAY = [];
function ActionButton({
  action,
  selectedItems,
  actionInProgress,
  setActionInProgress
}) {
  const registry = (0,external_wp_data_.useRegistry)();
  const selectedEligibleItems = (0,external_wp_element_.useMemo)(() => {
    return selectedItems.filter((item) => {
      return !action.isEligible || action.isEligible(item);
    });
  }, [action, selectedItems]);
  if ("RenderModal" in action) {
    return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
      ActionWithModal,
      {
        action,
        items: selectedEligibleItems,
        ActionTriggerComponent: ActionTrigger
      },
      action.id
    );
  }
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    ActionTrigger,
    {
      action,
      onClick: async () => {
        setActionInProgress(action.id);
        await action.callback(selectedItems, {
          registry
        });
        setActionInProgress(null);
      },
      items: selectedEligibleItems,
      isBusy: actionInProgress === action.id
    },
    action.id
  );
}
function renderFooterContent(data, actions, getItemId, selection, actionsToShow, selectedItems, actionInProgress, setActionInProgress, onChangeSelection) {
  const message = selectedItems.length > 0 ? (0,external_wp_i18n_namespaceObject.sprintf)(
    /* translators: %d: number of items. */
    (0,external_wp_i18n_namespaceObject._n)(
      "%d Item selected",
      "%d Items selected",
      selectedItems.length
    ),
    selectedItems.length
  ) : (0,external_wp_i18n_namespaceObject.sprintf)(
    /* translators: %d: number of items. */
    (0,external_wp_i18n_namespaceObject._n)("%d Item", "%d Items", data.length),
    data.length
  );
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
    external_wp_components_namespaceObject.__experimentalHStack,
    {
      expanded: false,
      className: "dataviews-bulk-actions-footer__container",
      spacing: 3,
      children: [
        /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
          BulkSelectionCheckbox,
          {
            selection,
            onChangeSelection,
            data,
            actions,
            getItemId
          }
        ),
        /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "dataviews-bulk-actions-footer__item-count", children: message }),
        /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
          external_wp_components_namespaceObject.__experimentalHStack,
          {
            className: "dataviews-bulk-actions-footer__action-buttons",
            expanded: false,
            spacing: 1,
            children: [
              actionsToShow.map((action) => {
                return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
                  ActionButton,
                  {
                    action,
                    selectedItems,
                    actionInProgress,
                    setActionInProgress
                  },
                  action.id
                );
              }),
              selectedItems.length > 0 && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
                external_wp_components_namespaceObject.Button,
                {
                  icon: close_small_default,
                  showTooltip: true,
                  tooltipPosition: "top",
                  size: "compact",
                  label: (0,external_wp_i18n_namespaceObject.__)("Cancel"),
                  disabled: !!actionInProgress,
                  accessibleWhenDisabled: false,
                  onClick: () => {
                    onChangeSelection(dataviews_bulk_actions_EMPTY_ARRAY);
                  }
                }
              )
            ]
          }
        )
      ]
    }
  );
}
function FooterContent({
  selection,
  actions,
  onChangeSelection,
  data,
  getItemId
}) {
  const [actionInProgress, setActionInProgress] = (0,external_wp_element_.useState)(
    null
  );
  const footerContentRef = (0,external_wp_element_.useRef)(null);
  const isMobile = (0,external_wp_compose_namespaceObject.useViewportMatch)("medium", "<");
  const bulkActions = (0,external_wp_element_.useMemo)(
    () => actions.filter((action) => action.supportsBulk),
    [actions]
  );
  const selectableItems = (0,external_wp_element_.useMemo)(() => {
    return data.filter((item) => {
      return bulkActions.some(
        (action) => !action.isEligible || action.isEligible(item)
      );
    });
  }, [data, bulkActions]);
  const selectedItems = (0,external_wp_element_.useMemo)(() => {
    return data.filter(
      (item) => selection.includes(getItemId(item)) && selectableItems.includes(item)
    );
  }, [selection, data, getItemId, selectableItems]);
  const actionsToShow = (0,external_wp_element_.useMemo)(
    () => actions.filter((action) => {
      return action.supportsBulk && (!isMobile || action.icon) && selectedItems.some(
        (item) => !action.isEligible || action.isEligible(item)
      );
    }),
    [actions, selectedItems, isMobile]
  );
  if (!actionInProgress) {
    if (footerContentRef.current) {
      footerContentRef.current = null;
    }
    return renderFooterContent(
      data,
      actions,
      getItemId,
      selection,
      actionsToShow,
      selectedItems,
      actionInProgress,
      setActionInProgress,
      onChangeSelection
    );
  } else if (!footerContentRef.current) {
    footerContentRef.current = renderFooterContent(
      data,
      actions,
      getItemId,
      selection,
      actionsToShow,
      selectedItems,
      actionInProgress,
      setActionInProgress,
      onChangeSelection
    );
  }
  return footerContentRef.current;
}
function BulkActionsFooter() {
  const {
    data,
    selection,
    actions = dataviews_bulk_actions_EMPTY_ARRAY,
    onChangeSelection,
    getItemId
  } = (0,external_wp_element_.useContext)(dataviews_context_default);
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    FooterContent,
    {
      selection,
      onChangeSelection,
      data,
      actions,
      getItemId
    }
  );
}


;// ./node_modules/@wordpress/icons/build-module/library/funnel.js


var funnel_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M10 17.5H14V16H10V17.5ZM6 6V7.5H18V6H6ZM8 12.5H16V11H8V12.5Z" }) });


;// ./node_modules/@wordpress/icons/build-module/library/arrow-left.js


var arrow_left_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M20 11.2H6.8l3.7-3.7-1-1L3.9 12l5.6 5.5 1-1-3.7-3.7H20z" }) });


;// ./node_modules/@wordpress/icons/build-module/library/arrow-right.js


var arrow_right_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "m14.5 6.5-1 1 3.7 3.7H4v1.6h13.2l-3.7 3.7 1 1 5.6-5.5z" }) });


;// ./node_modules/@wordpress/dataviews/build-module/dataviews-layouts/table/column-header-menu.js







const { Menu: column_header_menu_Menu } = lock_unlock_unlock(external_wp_components_namespaceObject.privateApis);
function WithMenuSeparators({ children }) {
  return external_wp_element_.Children.toArray(children).filter(Boolean).map((child, i) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_element_.Fragment, { children: [
    i > 0 && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(column_header_menu_Menu.Separator, {}),
    child
  ] }, i));
}
const _HeaderMenu = (0,external_wp_element_.forwardRef)(function HeaderMenu({
  fieldId,
  view,
  fields,
  onChangeView,
  onHide,
  setOpenedFilter,
  canMove = true
}, ref) {
  const visibleFieldIds = view.fields ?? [];
  const index = visibleFieldIds?.indexOf(fieldId);
  const isSorted = view.sort?.field === fieldId;
  let isHidable = false;
  let isSortable = false;
  let canAddFilter = false;
  let operators = [];
  const field = fields.find((f) => f.id === fieldId);
  if (!field) {
    return null;
  }
  isHidable = field.enableHiding !== false;
  isSortable = field.enableSorting !== false;
  const header = field.header;
  operators = !!field.filterBy && field.filterBy?.operators || [];
  canAddFilter = !view.filters?.some((_filter) => fieldId === _filter.field) && !!(field.hasElements || field.Edit) && field.filterBy !== false && !field.filterBy?.isPrimary;
  if (!isSortable && !canMove && !isHidable && !canAddFilter) {
    return header;
  }
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(column_header_menu_Menu, { children: [
    /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
      column_header_menu_Menu.TriggerButton,
      {
        render: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
          external_wp_components_namespaceObject.Button,
          {
            size: "compact",
            className: "dataviews-view-table-header-button",
            ref,
            variant: "tertiary"
          }
        ),
        children: [
          header,
          view.sort && isSorted && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { "aria-hidden": "true", children: sortArrows[view.sort.direction] })
        ]
      }
    ),
    /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(column_header_menu_Menu.Popover, { style: { minWidth: "240px" }, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(WithMenuSeparators, { children: [
      isSortable && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(column_header_menu_Menu.Group, { children: SORTING_DIRECTIONS.map(
        (direction) => {
          const isChecked = view.sort && isSorted && view.sort.direction === direction;
          const value = `${fieldId}-${direction}`;
          return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
            column_header_menu_Menu.RadioItem,
            {
              name: "view-table-sorting",
              value,
              checked: isChecked,
              onChange: () => {
                onChangeView({
                  ...view,
                  sort: {
                    field: fieldId,
                    direction
                  },
                  showLevels: false
                });
              },
              children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(column_header_menu_Menu.ItemLabel, { children: sortLabels[direction] })
            },
            value
          );
        }
      ) }),
      canAddFilter && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(column_header_menu_Menu.Group, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
        column_header_menu_Menu.Item,
        {
          prefix: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { icon: funnel_default }),
          onClick: () => {
            setOpenedFilter(fieldId);
            onChangeView({
              ...view,
              page: 1,
              filters: [
                ...view.filters || [],
                {
                  field: fieldId,
                  value: void 0,
                  operator: operators[0]
                }
              ]
            });
          },
          children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(column_header_menu_Menu.ItemLabel, { children: (0,external_wp_i18n_namespaceObject.__)("Add filter") })
        }
      ) }),
      (canMove || isHidable) && field && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(column_header_menu_Menu.Group, { children: [
        canMove && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
          column_header_menu_Menu.Item,
          {
            prefix: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { icon: arrow_left_default }),
            disabled: index < 1,
            onClick: () => {
              onChangeView({
                ...view,
                fields: [
                  ...visibleFieldIds.slice(
                    0,
                    index - 1
                  ) ?? [],
                  fieldId,
                  visibleFieldIds[index - 1],
                  ...visibleFieldIds.slice(
                    index + 1
                  )
                ]
              });
            },
            children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(column_header_menu_Menu.ItemLabel, { children: (0,external_wp_i18n_namespaceObject.__)("Move left") })
          }
        ),
        canMove && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
          column_header_menu_Menu.Item,
          {
            prefix: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { icon: arrow_right_default }),
            disabled: index >= visibleFieldIds.length - 1,
            onClick: () => {
              onChangeView({
                ...view,
                fields: [
                  ...visibleFieldIds.slice(
                    0,
                    index
                  ) ?? [],
                  visibleFieldIds[index + 1],
                  fieldId,
                  ...visibleFieldIds.slice(
                    index + 2
                  )
                ]
              });
            },
            children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(column_header_menu_Menu.ItemLabel, { children: (0,external_wp_i18n_namespaceObject.__)("Move right") })
          }
        ),
        isHidable && field && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
          column_header_menu_Menu.Item,
          {
            prefix: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { icon: unseen_default }),
            onClick: () => {
              onHide(field);
              onChangeView({
                ...view,
                fields: visibleFieldIds.filter(
                  (id) => id !== fieldId
                )
              });
            },
            children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(column_header_menu_Menu.ItemLabel, { children: (0,external_wp_i18n_namespaceObject.__)("Hide column") })
          }
        )
      ] })
    ] }) })
  ] });
});
const ColumnHeaderMenu = _HeaderMenu;
var column_header_menu_default = ColumnHeaderMenu;


;// ./node_modules/@wordpress/dataviews/build-module/dataviews-layouts/utils/item-click-wrapper.js


function getClickableItemProps({
  item,
  isItemClickable,
  onClickItem,
  className
}) {
  if (!isItemClickable(item) || !onClickItem) {
    return { className };
  }
  return {
    className: className ? `${className} ${className}--clickable` : void 0,
    role: "button",
    tabIndex: 0,
    onClick: (event) => {
      event.stopPropagation();
      onClickItem(item);
    },
    onKeyDown: (event) => {
      if (event.key === "Enter" || event.key === "" || event.key === " ") {
        event.stopPropagation();
        onClickItem(item);
      }
    }
  };
}
function ItemClickWrapper({
  item,
  isItemClickable,
  onClickItem,
  renderItemLink,
  className,
  children,
  ...extraProps
}) {
  if (!isItemClickable(item)) {
    return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className, ...extraProps, children });
  }
  if (renderItemLink) {
    const renderedElement = renderItemLink({
      item,
      className: `${className} ${className}--clickable`,
      ...extraProps,
      children
    });
    return (0,external_wp_element_.cloneElement)(renderedElement, {
      onClick: (event) => {
        event.stopPropagation();
        if (renderedElement.props.onClick) {
          renderedElement.props.onClick(event);
        }
      },
      onKeyDown: (event) => {
        if (event.key === "Enter" || event.key === "" || event.key === " ") {
          event.stopPropagation();
          if (renderedElement.props.onKeyDown) {
            renderedElement.props.onKeyDown(event);
          }
        }
      }
    });
  }
  const clickProps = getClickableItemProps({
    item,
    isItemClickable,
    onClickItem,
    className
  });
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { ...clickProps, ...extraProps, children });
}


;// ./node_modules/@wordpress/dataviews/build-module/dataviews-layouts/table/column-primary.js




function ColumnPrimary({
  item,
  level,
  titleField,
  mediaField,
  descriptionField,
  onClickItem,
  renderItemLink,
  isItemClickable
}) {
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { spacing: 3, justify: "flex-start", children: [
    mediaField && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
      ItemClickWrapper,
      {
        item,
        isItemClickable,
        onClickItem,
        renderItemLink,
        className: "dataviews-view-table__cell-content-wrapper dataviews-column-primary__media",
        "aria-label": titleField ? (0,external_wp_i18n_namespaceObject.sprintf)(
          // translators: %s is the item title.
          (0,external_wp_i18n_namespaceObject.__)("Click item: %s"),
          titleField.getValue?.({ item })
        ) : void 0,
        children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
          mediaField.render,
          {
            item,
            field: mediaField,
            config: { sizes: "32px" }
          }
        )
      }
    ),
    /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
      external_wp_components_namespaceObject.__experimentalVStack,
      {
        spacing: 0,
        alignment: "flex-start",
        className: "dataviews-view-table__primary-column-content",
        children: [
          titleField && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
            ItemClickWrapper,
            {
              item,
              isItemClickable,
              onClickItem,
              renderItemLink,
              className: "dataviews-view-table__cell-content-wrapper dataviews-title-field",
              children: [
                level !== void 0 && level > 0 && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("span", { className: "dataviews-view-table__level", children: [
                  "\u2014".repeat(level),
                  "\xA0"
                ] }),
                /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(titleField.render, { item, field: titleField })
              ]
            }
          ),
          descriptionField && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
            descriptionField.render,
            {
              item,
              field: descriptionField
            }
          )
        ]
      }
    )
  ] });
}
var column_primary_default = ColumnPrimary;


;// ./node_modules/@wordpress/dataviews/build-module/dataviews-layouts/table/use-is-horizontal-scroll-end.js



const isScrolledToEnd = (element) => {
  if ((0,external_wp_i18n_namespaceObject.isRTL)()) {
    const scrollLeft = Math.abs(element.scrollLeft);
    return scrollLeft <= 1;
  }
  return element.scrollLeft + element.clientWidth >= element.scrollWidth - 1;
};
function useIsHorizontalScrollEnd({
  scrollContainerRef,
  enabled = false
}) {
  const [isHorizontalScrollEnd, setIsHorizontalScrollEnd] = (0,external_wp_element_.useState)(false);
  const handleIsHorizontalScrollEnd = (0,external_wp_compose_namespaceObject.useDebounce)(
    (0,external_wp_element_.useCallback)(() => {
      const scrollContainer = scrollContainerRef.current;
      if (scrollContainer) {
        setIsHorizontalScrollEnd(isScrolledToEnd(scrollContainer));
      }
    }, [scrollContainerRef, setIsHorizontalScrollEnd]),
    200
  );
  (0,external_wp_element_.useEffect)(() => {
    if (typeof window === "undefined" || !enabled || !scrollContainerRef.current) {
      return () => {
      };
    }
    handleIsHorizontalScrollEnd();
    scrollContainerRef.current.addEventListener(
      "scroll",
      handleIsHorizontalScrollEnd
    );
    window.addEventListener("resize", handleIsHorizontalScrollEnd);
    return () => {
      scrollContainerRef.current?.removeEventListener(
        "scroll",
        handleIsHorizontalScrollEnd
      );
      window.removeEventListener("resize", handleIsHorizontalScrollEnd);
    };
  }, [scrollContainerRef, enabled]);
  return isHorizontalScrollEnd;
}


;// ./node_modules/@wordpress/dataviews/build-module/dataviews-layouts/utils/get-data-by-group.js
function getDataByGroup(data, groupByField) {
  return data.reduce((groups, item) => {
    const groupName = groupByField.getValue({ item });
    if (!groups.has(groupName)) {
      groups.set(groupName, []);
    }
    groups.get(groupName)?.push(item);
    return groups;
  }, /* @__PURE__ */ new Map());
}


;// ./node_modules/@wordpress/dataviews/build-module/dataviews-layouts/table/index.js















function TableColumnField({
  item,
  fields,
  column,
  align
}) {
  const field = fields.find((f) => f.id === column);
  if (!field) {
    return null;
  }
  const className = dist_clsx("dataviews-view-table__cell-content-wrapper", {
    "dataviews-view-table__cell-align-end": align === "end",
    "dataviews-view-table__cell-align-center": align === "center"
  });
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(field.render, { item, field }) });
}
function TableRow({
  hasBulkActions,
  item,
  level,
  actions,
  fields,
  id,
  view,
  titleField,
  mediaField,
  descriptionField,
  selection,
  getItemId,
  isItemClickable,
  onClickItem,
  renderItemLink,
  onChangeSelection,
  isActionsColumnSticky,
  posinset
}) {
  const { paginationInfo } = (0,external_wp_element_.useContext)(dataviews_context_default);
  const hasPossibleBulkAction = useHasAPossibleBulkAction(actions, item);
  const isSelected = hasPossibleBulkAction && selection.includes(id);
  const [isHovered, setIsHovered] = (0,external_wp_element_.useState)(false);
  const {
    showTitle = true,
    showMedia = true,
    showDescription = true,
    infiniteScrollEnabled
  } = view;
  const handleMouseEnter = () => {
    setIsHovered(true);
  };
  const handleMouseLeave = () => {
    setIsHovered(false);
  };
  const isTouchDeviceRef = (0,external_wp_element_.useRef)(false);
  const columns = view.fields ?? [];
  const hasPrimaryColumn = titleField && showTitle || mediaField && showMedia || descriptionField && showDescription;
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
    "tr",
    {
      className: dist_clsx("dataviews-view-table__row", {
        "is-selected": hasPossibleBulkAction && isSelected,
        "is-hovered": isHovered,
        "has-bulk-actions": hasPossibleBulkAction
      }),
      onMouseEnter: handleMouseEnter,
      onMouseLeave: handleMouseLeave,
      onTouchStart: () => {
        isTouchDeviceRef.current = true;
      },
      "aria-setsize": infiniteScrollEnabled ? paginationInfo.totalItems : void 0,
      "aria-posinset": posinset,
      role: infiniteScrollEnabled ? "article" : void 0,
      onClick: (event) => {
        if (!hasPossibleBulkAction) {
          return;
        }
        if (!isTouchDeviceRef.current && document.getSelection()?.type !== "Range") {
          if ((0,external_wp_keycodes_namespaceObject.isAppleOS)() ? event.metaKey : event.ctrlKey) {
            onChangeSelection(
              selection.includes(id) ? selection.filter(
                (itemId) => id !== itemId
              ) : [...selection, id]
            );
          } else {
            onChangeSelection(
              selection.includes(id) ? selection.filter(
                (itemId) => id !== itemId
              ) : [id]
            );
          }
        }
      },
      children: [
        hasBulkActions && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("td", { className: "dataviews-view-table__checkbox-column", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "dataviews-view-table__cell-content-wrapper", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
          DataViewsSelectionCheckbox,
          {
            item,
            selection,
            onChangeSelection,
            getItemId,
            titleField,
            disabled: !hasPossibleBulkAction
          }
        ) }) }),
        hasPrimaryColumn && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("td", { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
          column_primary_default,
          {
            item,
            level,
            titleField: showTitle ? titleField : void 0,
            mediaField: showMedia ? mediaField : void 0,
            descriptionField: showDescription ? descriptionField : void 0,
            isItemClickable,
            onClickItem,
            renderItemLink
          }
        ) }),
        columns.map((column) => {
          const { width, maxWidth, minWidth, align } = view.layout?.styles?.[column] ?? {};
          return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
            "td",
            {
              style: {
                width,
                maxWidth,
                minWidth
              },
              children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
                TableColumnField,
                {
                  fields,
                  item,
                  column,
                  align
                }
              )
            },
            column
          );
        }),
        !!actions?.length && // Disable reason: we are not making the element interactive,
        // but preventing any click events from bubbling up to the
        // table row. This allows us to add a click handler to the row
        // itself (to toggle row selection) without erroneously
        // intercepting click events from ItemActions.
        /* eslint-disable jsx-a11y/no-noninteractive-element-interactions, jsx-a11y/click-events-have-key-events */
        /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
          "td",
          {
            className: dist_clsx("dataviews-view-table__actions-column", {
              "dataviews-view-table__actions-column--sticky": true,
              "dataviews-view-table__actions-column--stuck": isActionsColumnSticky
            }),
            onClick: (e) => e.stopPropagation(),
            children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ItemActions, { item, actions })
          }
        )
      ]
    }
  );
}
function ViewTable({
  actions,
  data,
  fields,
  getItemId,
  getItemLevel,
  isLoading = false,
  onChangeView,
  onChangeSelection,
  selection,
  setOpenedFilter,
  onClickItem,
  isItemClickable,
  renderItemLink,
  view,
  className,
  empty
}) {
  const { containerRef } = (0,external_wp_element_.useContext)(dataviews_context_default);
  const headerMenuRefs = (0,external_wp_element_.useRef)(/* @__PURE__ */ new Map());
  const headerMenuToFocusRef = (0,external_wp_element_.useRef)();
  const [nextHeaderMenuToFocus, setNextHeaderMenuToFocus] = (0,external_wp_element_.useState)();
  const hasBulkActions = useSomeItemHasAPossibleBulkAction(actions, data);
  (0,external_wp_element_.useEffect)(() => {
    if (headerMenuToFocusRef.current) {
      headerMenuToFocusRef.current.focus();
      headerMenuToFocusRef.current = void 0;
    }
  });
  const tableNoticeId = (0,external_wp_element_.useId)();
  const isHorizontalScrollEnd = useIsHorizontalScrollEnd({
    scrollContainerRef: containerRef,
    enabled: !!actions?.length
  });
  if (nextHeaderMenuToFocus) {
    headerMenuToFocusRef.current = nextHeaderMenuToFocus;
    setNextHeaderMenuToFocus(void 0);
    return;
  }
  const onHide = (field) => {
    const hidden = headerMenuRefs.current.get(field.id);
    const fallback = hidden ? headerMenuRefs.current.get(hidden.fallback) : void 0;
    setNextHeaderMenuToFocus(fallback?.node);
  };
  const hasData = !!data?.length;
  const titleField = fields.find((field) => field.id === view.titleField);
  const mediaField = fields.find((field) => field.id === view.mediaField);
  const descriptionField = fields.find(
    (field) => field.id === view.descriptionField
  );
  const groupField = view.groupByField ? fields.find((f) => f.id === view.groupByField) : null;
  const dataByGroup = groupField ? getDataByGroup(data, groupField) : null;
  const { showTitle = true, showMedia = true, showDescription = true } = view;
  const hasPrimaryColumn = titleField && showTitle || mediaField && showMedia || descriptionField && showDescription;
  const columns = view.fields ?? [];
  const headerMenuRef = (column, index) => (node) => {
    if (node) {
      headerMenuRefs.current.set(column, {
        node,
        fallback: columns[index > 0 ? index - 1 : 1]
      });
    } else {
      headerMenuRefs.current.delete(column);
    }
  };
  const isInfiniteScroll = view.infiniteScrollEnabled && !dataByGroup;
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
    /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
      "table",
      {
        className: dist_clsx("dataviews-view-table", className, {
          [`has-${view.layout?.density}-density`]: view.layout?.density && ["compact", "comfortable"].includes(
            view.layout.density
          )
        }),
        "aria-busy": isLoading,
        "aria-describedby": tableNoticeId,
        role: isInfiniteScroll ? "feed" : void 0,
        children: [
          /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("colgroup", { children: [
            hasBulkActions && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("col", { className: "dataviews-view-table__col-checkbox" }),
            hasPrimaryColumn && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("col", { className: "dataviews-view-table__col-primary" }),
            columns.map((column) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
              "col",
              {
                className: `dataviews-view-table__col-${column}`
              },
              `col-${column}`
            )),
            !!actions?.length && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("col", { className: "dataviews-view-table__col-actions" })
          ] }),
          /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("thead", { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("tr", { className: "dataviews-view-table__row", children: [
            hasBulkActions && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
              "th",
              {
                className: "dataviews-view-table__checkbox-column",
                scope: "col",
                children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
                  BulkSelectionCheckbox,
                  {
                    selection,
                    onChangeSelection,
                    data,
                    actions,
                    getItemId
                  }
                )
              }
            ),
            hasPrimaryColumn && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("th", { scope: "col", children: titleField && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
              column_header_menu_default,
              {
                ref: headerMenuRef(
                  titleField.id,
                  0
                ),
                fieldId: titleField.id,
                view,
                fields,
                onChangeView,
                onHide,
                setOpenedFilter,
                canMove: false
              }
            ) }),
            columns.map((column, index) => {
              const { width, maxWidth, minWidth, align } = view.layout?.styles?.[column] ?? {};
              return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
                "th",
                {
                  style: {
                    width,
                    maxWidth,
                    minWidth,
                    textAlign: align
                  },
                  "aria-sort": view.sort?.direction && view.sort?.field === column ? sortValues[view.sort.direction] : void 0,
                  scope: "col",
                  children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
                    column_header_menu_default,
                    {
                      ref: headerMenuRef(column, index),
                      fieldId: column,
                      view,
                      fields,
                      onChangeView,
                      onHide,
                      setOpenedFilter,
                      canMove: view.layout?.enableMoving ?? true
                    }
                  )
                },
                column
              );
            }),
            !!actions?.length && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
              "th",
              {
                className: dist_clsx(
                  "dataviews-view-table__actions-column",
                  {
                    "dataviews-view-table__actions-column--sticky": true,
                    "dataviews-view-table__actions-column--stuck": !isHorizontalScrollEnd
                  }
                ),
                children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "dataviews-view-table-header", children: (0,external_wp_i18n_namespaceObject.__)("Actions") })
              }
            )
          ] }) }),
          hasData && groupField && dataByGroup ? Array.from(dataByGroup.entries()).map(
            ([groupName, groupItems]) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("tbody", { children: [
              /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("tr", { className: "dataviews-view-table__group-header-row", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
                "td",
                {
                  colSpan: columns.length + (hasPrimaryColumn ? 1 : 0) + (hasBulkActions ? 1 : 0) + (actions?.length ? 1 : 0),
                  className: "dataviews-view-table__group-header-cell",
                  children: (0,external_wp_i18n_namespaceObject.sprintf)(
                    // translators: 1: The label of the field e.g. "Date". 2: The value of the field, e.g.: "May 2022".
                    (0,external_wp_i18n_namespaceObject.__)("%1$s: %2$s"),
                    groupField.label,
                    groupName
                  )
                }
              ) }),
              groupItems.map((item, index) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
                TableRow,
                {
                  item,
                  level: view.showLevels && typeof getItemLevel === "function" ? getItemLevel(item) : void 0,
                  hasBulkActions,
                  actions,
                  fields,
                  id: getItemId(item) || index.toString(),
                  view,
                  titleField,
                  mediaField,
                  descriptionField,
                  selection,
                  getItemId,
                  onChangeSelection,
                  onClickItem,
                  renderItemLink,
                  isItemClickable,
                  isActionsColumnSticky: !isHorizontalScrollEnd
                },
                getItemId(item)
              ))
            ] }, `group-${groupName}`)
          ) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("tbody", { children: hasData && data.map((item, index) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
            TableRow,
            {
              item,
              level: view.showLevels && typeof getItemLevel === "function" ? getItemLevel(item) : void 0,
              hasBulkActions,
              actions,
              fields,
              id: getItemId(item) || index.toString(),
              view,
              titleField,
              mediaField,
              descriptionField,
              selection,
              getItemId,
              onChangeSelection,
              onClickItem,
              renderItemLink,
              isItemClickable,
              isActionsColumnSticky: !isHorizontalScrollEnd,
              posinset: isInfiniteScroll ? index + 1 : void 0
            },
            getItemId(item)
          )) })
        ]
      }
    ),
    /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
      "div",
      {
        className: dist_clsx({
          "dataviews-loading": isLoading,
          "dataviews-no-results": !hasData && !isLoading
        }),
        id: tableNoticeId,
        children: [
          !hasData && (isLoading ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {}) }) : empty),
          hasData && isLoading && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { className: "dataviews-loading-more", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {}) })
        ]
      }
    )
  ] });
}
var table_default = ViewTable;


;// ./node_modules/@wordpress/dataviews/build-module/dataviews-layouts/utils/grid-items.js



const GridItems = (0,external_wp_element_.forwardRef)(({ className, previewSize, ...props }, ref) => {
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    "div",
    {
      ref,
      className: dist_clsx("dataviews-view-grid-items", className),
      style: {
        gridTemplateColumns: previewSize && `repeat(auto-fill, minmax(${previewSize}px, 1fr))`
      },
      ...props
    }
  );
});


;// ./node_modules/@wordpress/dataviews/build-module/dataviews-layouts/grid/index.js














const { Badge } = lock_unlock_unlock(external_wp_components_namespaceObject.privateApis);

function GridItem({
  view,
  selection,
  onChangeSelection,
  onClickItem,
  isItemClickable,
  renderItemLink,
  getItemId,
  item,
  actions,
  mediaField,
  titleField,
  descriptionField,
  regularFields,
  badgeFields,
  hasBulkActions,
  config,
  posinset
}) {
  const {
    showTitle = true,
    showMedia = true,
    showDescription = true,
    infiniteScrollEnabled
  } = view;
  const hasBulkAction = useHasAPossibleBulkAction(actions, item);
  const id = getItemId(item);
  const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(GridItem);
  const isSelected = selection.includes(id);
  const renderedMediaField = mediaField?.render ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    mediaField.render,
    {
      item,
      field: mediaField,
      config
    }
  ) : null;
  const renderedTitleField = showTitle && titleField?.render ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(titleField.render, { item, field: titleField }) : null;
  const shouldRenderMedia = showMedia && renderedMediaField;
  let mediaA11yProps;
  let titleA11yProps;
  if (isItemClickable(item) && onClickItem) {
    if (renderedTitleField) {
      mediaA11yProps = {
        "aria-labelledby": `dataviews-view-grid__title-field-${instanceId}`
      };
      titleA11yProps = {
        id: `dataviews-view-grid__title-field-${instanceId}`
      };
    } else {
      mediaA11yProps = {
        "aria-label": (0,external_wp_i18n_namespaceObject.__)("Navigate to item")
      };
    }
  }
  const { paginationInfo } = (0,external_wp_element_.useContext)(dataviews_context_default);
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
    external_wp_components_namespaceObject.__experimentalVStack,
    {
      spacing: 0,
      className: dist_clsx("dataviews-view-grid__card", {
        "is-selected": hasBulkAction && isSelected
      }),
      onClickCapture: (event) => {
        if ((0,external_wp_keycodes_namespaceObject.isAppleOS)() ? event.metaKey : event.ctrlKey) {
          event.stopPropagation();
          event.preventDefault();
          if (!hasBulkAction) {
            return;
          }
          onChangeSelection(
            selection.includes(id) ? selection.filter((itemId) => id !== itemId) : [...selection, id]
          );
        }
      },
      role: infiniteScrollEnabled ? "article" : void 0,
      "aria-setsize": infiniteScrollEnabled ? paginationInfo.totalItems : void 0,
      "aria-posinset": posinset,
      children: [
        shouldRenderMedia && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
          ItemClickWrapper,
          {
            item,
            isItemClickable,
            onClickItem,
            renderItemLink,
            className: "dataviews-view-grid__media",
            ...mediaA11yProps,
            children: renderedMediaField
          }
        ),
        hasBulkActions && shouldRenderMedia && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
          DataViewsSelectionCheckbox,
          {
            item,
            selection,
            onChangeSelection,
            getItemId,
            titleField,
            disabled: !hasBulkAction
          }
        ),
        !showTitle && shouldRenderMedia && !!actions?.length && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "dataviews-view-grid__media-actions", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ItemActions, { item, actions, isCompact: true }) }),
        showTitle && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
          external_wp_components_namespaceObject.__experimentalHStack,
          {
            justify: "space-between",
            className: "dataviews-view-grid__title-actions",
            children: [
              /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
                ItemClickWrapper,
                {
                  item,
                  isItemClickable,
                  onClickItem,
                  renderItemLink,
                  className: "dataviews-view-grid__title-field dataviews-title-field",
                  ...titleA11yProps,
                  children: renderedTitleField
                }
              ),
              !!actions?.length && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
                ItemActions,
                {
                  item,
                  actions,
                  isCompact: true
                }
              )
            ]
          }
        ),
        /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 1, children: [
          showDescription && descriptionField?.render && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
            descriptionField.render,
            {
              item,
              field: descriptionField
            }
          ),
          !!badgeFields?.length && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
            external_wp_components_namespaceObject.__experimentalHStack,
            {
              className: "dataviews-view-grid__badge-fields",
              spacing: 2,
              wrap: true,
              alignment: "top",
              justify: "flex-start",
              children: badgeFields.map((field) => {
                return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
                  Badge,
                  {
                    className: "dataviews-view-grid__field-value",
                    children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
                      field.render,
                      {
                        item,
                        field
                      }
                    )
                  },
                  field.id
                );
              })
            }
          ),
          !!regularFields?.length && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
            external_wp_components_namespaceObject.__experimentalVStack,
            {
              className: "dataviews-view-grid__fields",
              spacing: 1,
              children: regularFields.map((field) => {
                return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
                  external_wp_components_namespaceObject.Flex,
                  {
                    className: "dataviews-view-grid__field",
                    gap: 1,
                    justify: "flex-start",
                    expanded: true,
                    style: { height: "auto" },
                    direction: "row",
                    children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
                      /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Tooltip, { text: field.label, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { className: "dataviews-view-grid__field-name", children: field.header }) }),
                      /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
                        external_wp_components_namespaceObject.FlexItem,
                        {
                          className: "dataviews-view-grid__field-value",
                          style: { maxHeight: "none" },
                          children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
                            field.render,
                            {
                              item,
                              field
                            }
                          )
                        }
                      )
                    ] })
                  },
                  field.id
                );
              })
            }
          )
        ] })
      ]
    },
    id
  );
}
function ViewGrid({
  actions,
  data,
  fields,
  getItemId,
  isLoading,
  onChangeSelection,
  onClickItem,
  isItemClickable,
  renderItemLink,
  selection,
  view,
  className,
  empty
}) {
  const { resizeObserverRef } = (0,external_wp_element_.useContext)(dataviews_context_default);
  const titleField = fields.find(
    (field) => field.id === view?.titleField
  );
  const mediaField = fields.find(
    (field) => field.id === view?.mediaField
  );
  const descriptionField = fields.find(
    (field) => field.id === view?.descriptionField
  );
  const otherFields = view.fields ?? [];
  const { regularFields, badgeFields } = otherFields.reduce(
    (accumulator, fieldId) => {
      const field = fields.find((f) => f.id === fieldId);
      if (!field) {
        return accumulator;
      }
      const key = view.layout?.badgeFields?.includes(fieldId) ? "badgeFields" : "regularFields";
      accumulator[key].push(field);
      return accumulator;
    },
    { regularFields: [], badgeFields: [] }
  );
  const hasData = !!data?.length;
  const hasBulkActions = useSomeItemHasAPossibleBulkAction(actions, data);
  const usedPreviewSize = view.layout?.previewSize;
  const size = "900px";
  const groupField = view.groupByField ? fields.find((f) => f.id === view.groupByField) : null;
  const dataByGroup = groupField ? getDataByGroup(data, groupField) : null;
  const isInfiniteScroll = view.infiniteScrollEnabled && !dataByGroup;
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
    // Render multiple groups.
    children: [
      hasData && groupField && dataByGroup && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 4, children: Array.from(dataByGroup.entries()).map(
        ([groupName, groupItems]) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 2, children: [
          /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("h3", { className: "dataviews-view-grid__group-header", children: (0,external_wp_i18n_namespaceObject.sprintf)(
            // translators: 1: The label of the field e.g. "Date". 2: The value of the field, e.g.: "May 2022".
            (0,external_wp_i18n_namespaceObject.__)("%1$s: %2$s"),
            groupField.label,
            groupName
          ) }),
          /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
            GridItems,
            {
              className: dist_clsx(
                "dataviews-view-grid",
                className
              ),
              previewSize: usedPreviewSize,
              "aria-busy": isLoading,
              ref: resizeObserverRef,
              children: groupItems.map((item) => {
                return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
                  GridItem,
                  {
                    view,
                    selection,
                    onChangeSelection,
                    onClickItem,
                    isItemClickable,
                    renderItemLink,
                    getItemId,
                    item,
                    actions,
                    mediaField,
                    titleField,
                    descriptionField,
                    regularFields,
                    badgeFields,
                    hasBulkActions,
                    config: {
                      sizes: size
                    }
                  },
                  getItemId(item)
                );
              })
            }
          )
        ] }, groupName)
      ) }),
      // Render a single grid with all data.
      hasData && !dataByGroup && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
        GridItems,
        {
          className: dist_clsx("dataviews-view-grid", className),
          previewSize: usedPreviewSize,
          "aria-busy": isLoading,
          ref: resizeObserverRef,
          role: isInfiniteScroll ? "feed" : void 0,
          children: data.map((item, index) => {
            return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
              GridItem,
              {
                view,
                selection,
                onChangeSelection,
                onClickItem,
                isItemClickable,
                renderItemLink,
                getItemId,
                item,
                actions,
                mediaField,
                titleField,
                descriptionField,
                regularFields,
                badgeFields,
                hasBulkActions,
                config: {
                  sizes: size
                },
                posinset: isInfiniteScroll ? index + 1 : void 0
              },
              getItemId(item)
            );
          })
        }
      ),
      // Render empty state.
      !hasData && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
        "div",
        {
          className: dist_clsx({
            "dataviews-loading": isLoading,
            "dataviews-no-results": !isLoading
          }),
          children: isLoading ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {}) }) : empty
        }
      ),
      hasData && isLoading && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { className: "dataviews-loading-more", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {}) })
    ]
  });
}
var grid_default = ViewGrid;


;// ./node_modules/@wordpress/dataviews/build-module/dataviews-layouts/list/index.js












const { Menu: list_Menu } = lock_unlock_unlock(external_wp_components_namespaceObject.privateApis);
function generateItemWrapperCompositeId(idPrefix) {
  return `${idPrefix}-item-wrapper`;
}
function generatePrimaryActionCompositeId(idPrefix, primaryActionId) {
  return `${idPrefix}-primary-action-${primaryActionId}`;
}
function generateDropdownTriggerCompositeId(idPrefix) {
  return `${idPrefix}-dropdown`;
}
function PrimaryActionGridCell({
  idPrefix,
  primaryAction,
  item
}) {
  const registry = (0,external_wp_data_.useRegistry)();
  const [isModalOpen, setIsModalOpen] = (0,external_wp_element_.useState)(false);
  const compositeItemId = generatePrimaryActionCompositeId(
    idPrefix,
    primaryAction.id
  );
  const label = typeof primaryAction.label === "string" ? primaryAction.label : primaryAction.label([item]);
  return "RenderModal" in primaryAction ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { role: "gridcell", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    external_wp_components_namespaceObject.Composite.Item,
    {
      id: compositeItemId,
      render: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
        external_wp_components_namespaceObject.Button,
        {
          disabled: !!primaryAction.disabled,
          accessibleWhenDisabled: true,
          text: label,
          size: "small",
          onClick: () => setIsModalOpen(true)
        }
      ),
      children: isModalOpen && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
        ActionModal,
        {
          action: primaryAction,
          items: [item],
          closeModal: () => setIsModalOpen(false)
        }
      )
    }
  ) }, primaryAction.id) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { role: "gridcell", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    external_wp_components_namespaceObject.Composite.Item,
    {
      id: compositeItemId,
      render: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
        external_wp_components_namespaceObject.Button,
        {
          disabled: !!primaryAction.disabled,
          accessibleWhenDisabled: true,
          size: "small",
          onClick: () => {
            primaryAction.callback([item], { registry });
          },
          children: label
        }
      )
    }
  ) }, primaryAction.id);
}
function ListItem({
  view,
  actions,
  idPrefix,
  isSelected,
  item,
  titleField,
  mediaField,
  descriptionField,
  onSelect,
  otherFields,
  onDropdownTriggerKeyDown,
  posinset
}) {
  const {
    showTitle = true,
    showMedia = true,
    showDescription = true,
    infiniteScrollEnabled
  } = view;
  const itemRef = (0,external_wp_element_.useRef)(null);
  const labelId = `${idPrefix}-label`;
  const descriptionId = `${idPrefix}-description`;
  const registry = (0,external_wp_data_.useRegistry)();
  const [isHovered, setIsHovered] = (0,external_wp_element_.useState)(false);
  const [activeModalAction, setActiveModalAction] = (0,external_wp_element_.useState)(
    null
  );
  const handleHover = ({ type }) => {
    const isHover = type === "mouseenter";
    setIsHovered(isHover);
  };
  const { paginationInfo } = (0,external_wp_element_.useContext)(dataviews_context_default);
  (0,external_wp_element_.useEffect)(() => {
    if (isSelected) {
      itemRef.current?.scrollIntoView({
        behavior: "auto",
        block: "nearest",
        inline: "nearest"
      });
    }
  }, [isSelected]);
  const { primaryAction, eligibleActions } = (0,external_wp_element_.useMemo)(() => {
    const _eligibleActions = actions.filter(
      (action) => !action.isEligible || action.isEligible(item)
    );
    const _primaryActions = _eligibleActions.filter(
      (action) => action.isPrimary
    );
    return {
      primaryAction: _primaryActions[0],
      eligibleActions: _eligibleActions
    };
  }, [actions, item]);
  const hasOnlyOnePrimaryAction = primaryAction && actions.length === 1;
  const renderedMediaField = showMedia && mediaField?.render ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "dataviews-view-list__media-wrapper", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    mediaField.render,
    {
      item,
      field: mediaField,
      config: { sizes: "52px" }
    }
  ) }) : null;
  const renderedTitleField = showTitle && titleField?.render ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(titleField.render, { item, field: titleField }) : null;
  const usedActions = eligibleActions?.length > 0 && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { spacing: 3, className: "dataviews-view-list__item-actions", children: [
    primaryAction && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
      PrimaryActionGridCell,
      {
        idPrefix,
        primaryAction,
        item
      }
    ),
    !hasOnlyOnePrimaryAction && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { role: "gridcell", children: [
      /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(list_Menu, { placement: "bottom-end", children: [
        /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
          list_Menu.TriggerButton,
          {
            render: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
              external_wp_components_namespaceObject.Composite.Item,
              {
                id: generateDropdownTriggerCompositeId(
                  idPrefix
                ),
                render: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
                  external_wp_components_namespaceObject.Button,
                  {
                    size: "small",
                    icon: more_vertical_default,
                    label: (0,external_wp_i18n_namespaceObject.__)("Actions"),
                    accessibleWhenDisabled: true,
                    disabled: !actions.length,
                    onKeyDown: onDropdownTriggerKeyDown
                  }
                )
              }
            )
          }
        ),
        /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(list_Menu.Popover, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
          ActionsMenuGroup,
          {
            actions: eligibleActions,
            item,
            registry,
            setActiveModalAction
          }
        ) })
      ] }),
      !!activeModalAction && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
        ActionModal,
        {
          action: activeModalAction,
          items: [item],
          closeModal: () => setActiveModalAction(null)
        }
      )
    ] })
  ] });
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    external_wp_components_namespaceObject.Composite.Row,
    {
      ref: itemRef,
      render: (
        /* aria-posinset breaks Composite.Row if passed to it directly. */
        /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
          "div",
          {
            "aria-posinset": posinset,
            "aria-setsize": infiniteScrollEnabled ? paginationInfo.totalItems : void 0
          }
        )
      ),
      role: infiniteScrollEnabled ? "article" : "row",
      className: dist_clsx({
        "is-selected": isSelected,
        "is-hovered": isHovered
      }),
      onMouseEnter: handleHover,
      onMouseLeave: handleHover,
      children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { className: "dataviews-view-list__item-wrapper", spacing: 0, children: [
        /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { role: "gridcell", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
          external_wp_components_namespaceObject.Composite.Item,
          {
            id: generateItemWrapperCompositeId(idPrefix),
            "aria-pressed": isSelected,
            "aria-labelledby": labelId,
            "aria-describedby": descriptionId,
            className: "dataviews-view-list__item",
            onClick: () => onSelect(item)
          }
        ) }),
        /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { spacing: 3, justify: "start", alignment: "flex-start", children: [
          renderedMediaField,
          /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
            external_wp_components_namespaceObject.__experimentalVStack,
            {
              spacing: 1,
              className: "dataviews-view-list__field-wrapper",
              children: [
                /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { spacing: 0, children: [
                  /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
                    "div",
                    {
                      className: "dataviews-title-field",
                      id: labelId,
                      children: renderedTitleField
                    }
                  ),
                  usedActions
                ] }),
                showDescription && descriptionField?.render && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "dataviews-view-list__field", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
                  descriptionField.render,
                  {
                    item,
                    field: descriptionField
                  }
                ) }),
                /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
                  "div",
                  {
                    className: "dataviews-view-list__fields",
                    id: descriptionId,
                    children: otherFields.map((field) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
                      "div",
                      {
                        className: "dataviews-view-list__field",
                        children: [
                          /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
                            external_wp_components_namespaceObject.VisuallyHidden,
                            {
                              as: "span",
                              className: "dataviews-view-list__field-label",
                              children: field.label
                            }
                          ),
                          /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "dataviews-view-list__field-value", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
                            field.render,
                            {
                              item,
                              field
                            }
                          ) })
                        ]
                      },
                      field.id
                    ))
                  }
                )
              ]
            }
          )
        ] })
      ] })
    }
  );
}
function isDefined(item) {
  return !!item;
}
function ViewList(props) {
  const {
    actions,
    data,
    fields,
    getItemId,
    isLoading,
    onChangeSelection,
    selection,
    view,
    className,
    empty
  } = props;
  const baseId = (0,external_wp_compose_namespaceObject.useInstanceId)(ViewList, "view-list");
  const selectedItem = data?.findLast(
    (item) => selection.includes(getItemId(item))
  );
  const titleField = fields.find((field) => field.id === view.titleField);
  const mediaField = fields.find((field) => field.id === view.mediaField);
  const descriptionField = fields.find(
    (field) => field.id === view.descriptionField
  );
  const otherFields = (view?.fields ?? []).map((fieldId) => fields.find((f) => fieldId === f.id)).filter(isDefined);
  const onSelect = (item) => onChangeSelection([getItemId(item)]);
  const generateCompositeItemIdPrefix = (0,external_wp_element_.useCallback)(
    (item) => `${baseId}-${getItemId(item)}`,
    [baseId, getItemId]
  );
  const isActiveCompositeItem = (0,external_wp_element_.useCallback)(
    (item, idToCheck) => {
      return idToCheck.startsWith(
        generateCompositeItemIdPrefix(item)
      );
    },
    [generateCompositeItemIdPrefix]
  );
  const [activeCompositeId, setActiveCompositeId] = (0,external_wp_element_.useState)(void 0);
  (0,external_wp_element_.useEffect)(() => {
    if (selectedItem) {
      setActiveCompositeId(
        generateItemWrapperCompositeId(
          generateCompositeItemIdPrefix(selectedItem)
        )
      );
    }
  }, [selectedItem, generateCompositeItemIdPrefix]);
  const activeItemIndex = data.findIndex(
    (item) => isActiveCompositeItem(item, activeCompositeId ?? "")
  );
  const previousActiveItemIndex = (0,external_wp_compose_namespaceObject.usePrevious)(activeItemIndex);
  const isActiveIdInList = activeItemIndex !== -1;
  const selectCompositeItem = (0,external_wp_element_.useCallback)(
    (targetIndex, generateCompositeId) => {
      const clampedIndex = Math.min(
        data.length - 1,
        Math.max(0, targetIndex)
      );
      if (!data[clampedIndex]) {
        return;
      }
      const itemIdPrefix = generateCompositeItemIdPrefix(
        data[clampedIndex]
      );
      const targetCompositeItemId = generateCompositeId(itemIdPrefix);
      setActiveCompositeId(targetCompositeItemId);
      document.getElementById(targetCompositeItemId)?.focus();
    },
    [data, generateCompositeItemIdPrefix]
  );
  (0,external_wp_element_.useEffect)(() => {
    const wasActiveIdInList = previousActiveItemIndex !== void 0 && previousActiveItemIndex !== -1;
    if (!isActiveIdInList && wasActiveIdInList) {
      selectCompositeItem(
        previousActiveItemIndex,
        generateItemWrapperCompositeId
      );
    }
  }, [isActiveIdInList, selectCompositeItem, previousActiveItemIndex]);
  const onDropdownTriggerKeyDown = (0,external_wp_element_.useCallback)(
    (event) => {
      if (event.key === "ArrowDown") {
        event.preventDefault();
        selectCompositeItem(
          activeItemIndex + 1,
          generateDropdownTriggerCompositeId
        );
      }
      if (event.key === "ArrowUp") {
        event.preventDefault();
        selectCompositeItem(
          activeItemIndex - 1,
          generateDropdownTriggerCompositeId
        );
      }
    },
    [selectCompositeItem, activeItemIndex]
  );
  const hasData = data?.length;
  if (!hasData) {
    return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
      "div",
      {
        className: dist_clsx({
          "dataviews-loading": isLoading,
          "dataviews-no-results": !hasData && !isLoading
        }),
        children: !hasData && (isLoading ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {}) }) : empty)
      }
    );
  }
  const groupField = view.groupByField ? fields.find((field) => field.id === view.groupByField) : null;
  const dataByGroup = groupField ? getDataByGroup(data, groupField) : null;
  if (hasData && groupField && dataByGroup) {
    return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
      external_wp_components_namespaceObject.Composite,
      {
        id: `${baseId}`,
        render: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {}),
        className: "dataviews-view-list__group",
        role: "grid",
        activeId: activeCompositeId,
        setActiveId: setActiveCompositeId,
        children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
          external_wp_components_namespaceObject.__experimentalVStack,
          {
            spacing: 4,
            className: dist_clsx("dataviews-view-list", className),
            children: Array.from(dataByGroup.entries()).map(
              ([groupName, groupItems]) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 2, children: [
                /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("h3", { className: "dataviews-view-list__group-header", children: (0,external_wp_i18n_namespaceObject.sprintf)(
                  // translators: 1: The label of the field e.g. "Date". 2: The value of the field, e.g.: "May 2022".
                  (0,external_wp_i18n_namespaceObject.__)("%1$s: %2$s"),
                  groupField.label,
                  groupName
                ) }),
                groupItems.map((item) => {
                  const id = generateCompositeItemIdPrefix(item);
                  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
                    ListItem,
                    {
                      view,
                      idPrefix: id,
                      actions,
                      item,
                      isSelected: item === selectedItem,
                      onSelect,
                      mediaField,
                      titleField,
                      descriptionField,
                      otherFields,
                      onDropdownTriggerKeyDown
                    },
                    id
                  );
                })
              ] }, groupName)
            )
          }
        )
      }
    );
  }
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
    /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
      external_wp_components_namespaceObject.Composite,
      {
        id: baseId,
        render: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {}),
        className: dist_clsx("dataviews-view-list", className),
        role: view.infiniteScrollEnabled ? "feed" : "grid",
        activeId: activeCompositeId,
        setActiveId: setActiveCompositeId,
        children: data.map((item, index) => {
          const id = generateCompositeItemIdPrefix(item);
          return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
            ListItem,
            {
              view,
              idPrefix: id,
              actions,
              item,
              isSelected: item === selectedItem,
              onSelect,
              mediaField,
              titleField,
              descriptionField,
              otherFields,
              onDropdownTriggerKeyDown,
              posinset: view.infiniteScrollEnabled ? index + 1 : void 0
            },
            id
          );
        })
      }
    ),
    hasData && isLoading && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { className: "dataviews-loading-more", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {}) })
  ] });
}


;// ./node_modules/@wordpress/dataviews/build-module/components/dataviews-picker/footer.js







const footer_EMPTY_ARRAY = (/* unused pure expression or super */ null && ([]));
function useIsMultiselectPicker(actions) {
  return (0,external_wp_element_.useMemo)(() => {
    return actions?.every((action) => action.supportsBulk);
  }, [actions]);
}
function footer_BulkSelectionCheckbox({
  selection,
  selectedItems,
  onChangeSelection,
  data,
  getItemId
}) {
  const areAllSelected = selectedItems.length === data.length;
  return /* @__PURE__ */ jsx(
    CheckboxControl,
    {
      className: "dataviews-view-table-selection-checkbox",
      __nextHasNoMarginBottom: true,
      checked: areAllSelected,
      indeterminate: !areAllSelected && !!selectedItems.length,
      onChange: () => {
        if (areAllSelected) {
          onChangeSelection(
            selection.filter(
              (id) => !data.some(
                (item) => id === getItemId(item)
              )
            )
          );
        } else {
          const selectionSet = /* @__PURE__ */ new Set([
            ...selection,
            ...data.map((item) => getItemId(item))
          ]);
          onChangeSelection(Array.from(selectionSet));
        }
      },
      "aria-label": areAllSelected ? __("Deselect all") : __("Select all")
    }
  );
}
function ActionButtons({
  actions,
  items,
  selection
}) {
  const registry = useRegistry();
  const [actionInProgress, setActionInProgress] = useState(
    null
  );
  return /* @__PURE__ */ jsx(HStack, { expanded: false, spacing: 1, children: actions.map((action) => {
    if (!("callback" in action)) {
      return null;
    }
    const { id, label, icon, isPrimary, callback } = action;
    const _label = typeof label === "string" ? label : label(items);
    const variant = isPrimary ? "primary" : "tertiary";
    const isInProgress = id === actionInProgress;
    return /* @__PURE__ */ jsx(
      Button,
      {
        accessibleWhenDisabled: true,
        icon,
        disabled: isInProgress || !selection?.length,
        isBusy: isInProgress,
        onClick: async () => {
          setActionInProgress(id);
          await callback(items, {
            registry
          });
          setActionInProgress(null);
        },
        size: "compact",
        variant,
        children: _label
      },
      id
    );
  }) });
}
function DataViewsPickerFooter() {
  const {
    data,
    selection,
    onChangeSelection,
    getItemId,
    actions = footer_EMPTY_ARRAY
  } = useContext(DataViewsContext);
  const selectionCount = selection.length;
  const isMultiselect = useIsMultiselectPicker(actions);
  const message = selectionCount > 0 ? sprintf(
    /* translators: %d: number of items. */
    _n(
      "%d Item selected",
      "%d Items selected",
      selectionCount
    ),
    selectionCount
  ) : sprintf(
    /* translators: %d: number of items. */
    _n("%d Item", "%d Items", data.length),
    data.length
  );
  const selectedItems = useMemo(
    () => data.filter((item) => selection.includes(getItemId(item))),
    [selection, getItemId, data]
  );
  return /* @__PURE__ */ jsxs(
    HStack,
    {
      expanded: false,
      justify: "space-between",
      className: "dataviews-footer",
      children: [
        /* @__PURE__ */ jsxs(
          HStack,
          {
            className: "dataviews-picker-footer__bulk-selection",
            expanded: false,
            spacing: 3,
            children: [
              isMultiselect && /* @__PURE__ */ jsx(
                footer_BulkSelectionCheckbox,
                {
                  selection,
                  selectedItems,
                  onChangeSelection,
                  data,
                  getItemId
                }
              ),
              /* @__PURE__ */ jsx("span", { className: "dataviews-bulk-actions-footer__item-count", children: message })
            ]
          }
        ),
        /* @__PURE__ */ jsx(DataViewsPagination, {}),
        Boolean(actions?.length) && /* @__PURE__ */ jsx("div", { className: "dataviews-picker-footer__actions", children: /* @__PURE__ */ jsx(
          ActionButtons,
          {
            actions,
            items: selectedItems,
            selection
          }
        ) })
      ]
    }
  );
}


;// ./node_modules/@wordpress/dataviews/build-module/dataviews-layouts/picker-grid/index.js











const { Badge: picker_grid_Badge } = lock_unlock_unlock(external_wp_components_namespaceObject.privateApis);

function picker_grid_GridItem({
  view,
  multiselect,
  selection,
  onChangeSelection,
  getItemId,
  item,
  mediaField,
  titleField,
  descriptionField,
  regularFields,
  badgeFields,
  config,
  posinset,
  setsize
}) {
  const { showTitle = true, showMedia = true, showDescription = true } = view;
  const id = getItemId(item);
  const isSelected = selection.includes(id);
  const renderedMediaField = mediaField?.render ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    mediaField.render,
    {
      item,
      field: mediaField,
      config
    }
  ) : null;
  const renderedTitleField = showTitle && titleField?.render ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(titleField.render, { item, field: titleField }) : null;
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
    external_wp_components_namespaceObject.Composite.Item,
    {
      "aria-label": titleField ? titleField.getValue({ item }) || (0,external_wp_i18n_namespaceObject.__)("(no title)") : void 0,
      render: ({ children, ...props }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 0, children, ...props }),
      role: "option",
      "aria-posinset": posinset,
      "aria-setsize": setsize,
      className: dist_clsx("dataviews-view-picker-grid__card", {
        "is-selected": isSelected
      }),
      "aria-selected": isSelected,
      onClick: () => {
        if (isSelected) {
          onChangeSelection(
            selection.filter((itemId) => id !== itemId)
          );
        } else {
          const newSelection = multiselect ? [...selection, id] : [id];
          onChangeSelection(newSelection);
        }
      },
      children: [
        showMedia && renderedMediaField && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "dataviews-view-picker-grid__media", children: renderedMediaField }),
        showMedia && renderedMediaField && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
          DataViewsSelectionCheckbox,
          {
            item,
            selection,
            onChangeSelection,
            getItemId,
            titleField,
            disabled: false,
            "aria-hidden": true,
            tabIndex: -1
          }
        ),
        showTitle && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
          external_wp_components_namespaceObject.__experimentalHStack,
          {
            justify: "space-between",
            className: "dataviews-view-picker-grid__title-actions",
            children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "dataviews-view-picker-grid__title-field dataviews-title-field", children: renderedTitleField })
          }
        ),
        /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 1, children: [
          showDescription && descriptionField?.render && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
            descriptionField.render,
            {
              item,
              field: descriptionField
            }
          ),
          !!badgeFields?.length && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
            external_wp_components_namespaceObject.__experimentalHStack,
            {
              className: "dataviews-view-picker-grid__badge-fields",
              spacing: 2,
              wrap: true,
              alignment: "top",
              justify: "flex-start",
              children: badgeFields.map((field) => {
                return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
                  picker_grid_Badge,
                  {
                    className: "dataviews-view-picker-grid__field-value",
                    children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
                      field.render,
                      {
                        item,
                        field
                      }
                    )
                  },
                  field.id
                );
              })
            }
          ),
          !!regularFields?.length && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
            external_wp_components_namespaceObject.__experimentalVStack,
            {
              className: "dataviews-view-picker-grid__fields",
              spacing: 1,
              children: regularFields.map((field) => {
                return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
                  external_wp_components_namespaceObject.Flex,
                  {
                    className: "dataviews-view-picker-grid__field",
                    gap: 1,
                    justify: "flex-start",
                    expanded: true,
                    style: { height: "auto" },
                    direction: "row",
                    children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
                      /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { className: "dataviews-view-picker-grid__field-name", children: field.header }),
                      /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
                        external_wp_components_namespaceObject.FlexItem,
                        {
                          className: "dataviews-view-picker-grid__field-value",
                          style: { maxHeight: "none" },
                          children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
                            field.render,
                            {
                              item,
                              field
                            }
                          )
                        }
                      )
                    ] })
                  },
                  field.id
                );
              })
            }
          )
        ] })
      ]
    },
    id
  );
}
function GridGroup({
  groupName,
  groupField,
  children
}) {
  const headerId = (0,external_wp_compose_namespaceObject.useInstanceId)(
    GridGroup,
    "dataviews-view-picker-grid-group__header"
  );
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
    external_wp_components_namespaceObject.__experimentalVStack,
    {
      spacing: 2,
      role: "group",
      "aria-labelledby": headerId,
      children: [
        /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
          "h3",
          {
            className: "dataviews-view-picker-grid-group__header",
            id: headerId,
            children: (0,external_wp_i18n_namespaceObject.sprintf)(
              // translators: 1: The label of the field e.g. "Date". 2: The value of the field, e.g.: "May 2022".
              (0,external_wp_i18n_namespaceObject.__)("%1$s: %2$s"),
              groupField.label,
              groupName
            )
          }
        ),
        children
      ]
    },
    groupName
  );
}
function ViewPickerGrid({
  actions,
  data,
  fields,
  getItemId,
  isLoading,
  onChangeSelection,
  selection,
  view,
  className,
  empty
}) {
  const { resizeObserverRef, paginationInfo, itemListLabel } = (0,external_wp_element_.useContext)(dataviews_context_default);
  const titleField = fields.find(
    (field) => field.id === view?.titleField
  );
  const mediaField = fields.find(
    (field) => field.id === view?.mediaField
  );
  const descriptionField = fields.find(
    (field) => field.id === view?.descriptionField
  );
  const otherFields = view.fields ?? [];
  const { regularFields, badgeFields } = otherFields.reduce(
    (accumulator, fieldId) => {
      const field = fields.find((f) => f.id === fieldId);
      if (!field) {
        return accumulator;
      }
      const key = view.layout?.badgeFields?.includes(fieldId) ? "badgeFields" : "regularFields";
      accumulator[key].push(field);
      return accumulator;
    },
    { regularFields: [], badgeFields: [] }
  );
  const hasData = !!data?.length;
  const usedPreviewSize = view.layout?.previewSize;
  const isMultiselect = useIsMultiselectPicker(actions);
  const size = "900px";
  const groupField = view.groupByField ? fields.find((f) => f.id === view.groupByField) : null;
  const dataByGroup = groupField ? getDataByGroup(data, groupField) : null;
  const isInfiniteScroll = view.infiniteScrollEnabled && !dataByGroup;
  const currentPage = view?.page ?? 1;
  const perPage = view?.perPage ?? 0;
  const setSize = isInfiniteScroll ? paginationInfo?.totalItems : void 0;
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
    // Render multiple groups.
    children: [
      hasData && groupField && dataByGroup && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
        external_wp_components_namespaceObject.Composite,
        {
          virtualFocus: true,
          orientation: "horizontal",
          role: "listbox",
          "aria-multiselectable": isMultiselect,
          className: dist_clsx(
            "dataviews-view-picker-grid",
            className
          ),
          "aria-label": itemListLabel,
          render: ({ children, ...props }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
            external_wp_components_namespaceObject.__experimentalVStack,
            {
              spacing: 4,
              children,
              ...props
            }
          ),
          children: Array.from(dataByGroup.entries()).map(
            ([groupName, groupItems]) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
              GridGroup,
              {
                groupName,
                groupField,
                children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
                  GridItems,
                  {
                    previewSize: usedPreviewSize,
                    style: {
                      gridTemplateColumns: usedPreviewSize && `repeat(auto-fill, minmax(${usedPreviewSize}px, 1fr))`
                    },
                    "aria-busy": isLoading,
                    ref: resizeObserverRef,
                    children: groupItems.map((item) => {
                      const posInSet = (currentPage - 1) * perPage + data.indexOf(item) + 1;
                      return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
                        picker_grid_GridItem,
                        {
                          view,
                          multiselect: isMultiselect,
                          selection,
                          onChangeSelection,
                          getItemId,
                          item,
                          mediaField,
                          titleField,
                          descriptionField,
                          regularFields,
                          badgeFields,
                          config: {
                            sizes: size
                          },
                          posinset: posInSet,
                          setsize: setSize
                        },
                        getItemId(item)
                      );
                    })
                  }
                )
              },
              groupName
            )
          )
        }
      ),
      // Render a single grid with all data.
      hasData && !dataByGroup && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
        external_wp_components_namespaceObject.Composite,
        {
          render: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
            GridItems,
            {
              className: dist_clsx(
                "dataviews-view-picker-grid",
                className
              ),
              previewSize: usedPreviewSize,
              "aria-busy": isLoading,
              ref: resizeObserverRef
            }
          ),
          virtualFocus: true,
          orientation: "horizontal",
          role: "listbox",
          "aria-multiselectable": isMultiselect,
          "aria-label": itemListLabel,
          children: data.map((item, index) => {
            let posinset = isInfiniteScroll ? index + 1 : void 0;
            if (!isInfiniteScroll) {
              posinset = (currentPage - 1) * perPage + index + 1;
            }
            return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
              picker_grid_GridItem,
              {
                view,
                multiselect: isMultiselect,
                selection,
                onChangeSelection,
                getItemId,
                item,
                mediaField,
                titleField,
                descriptionField,
                regularFields,
                badgeFields,
                config: {
                  sizes: size
                },
                posinset,
                setsize: setSize
              },
              getItemId(item)
            );
          })
        }
      ),
      // Render empty state.
      !hasData && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
        "div",
        {
          className: dist_clsx({
            "dataviews-loading": isLoading,
            "dataviews-no-results": !isLoading
          }),
          children: isLoading ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {}) }) : empty
        }
      ),
      hasData && isLoading && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { className: "dataviews-loading-more", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {}) })
    ]
  });
}
var picker_grid_default = ViewPickerGrid;


;// ./node_modules/@wordpress/dataviews/build-module/dataviews-layouts/utils/preview-size-picker.js





const imageSizes = [
  {
    value: 120,
    breakpoint: 1
  },
  {
    value: 170,
    breakpoint: 1
  },
  {
    value: 230,
    breakpoint: 1
  },
  {
    value: 290,
    breakpoint: 1112
    // at minimum image width, 4 images display at this container size
  },
  {
    value: 350,
    breakpoint: 1636
    // at minimum image width, 6 images display at this container size
  },
  {
    value: 430,
    breakpoint: 588
    // at minimum image width, 2 images display at this container size
  }
];
function PreviewSizePicker() {
  const context = (0,external_wp_element_.useContext)(dataviews_context_default);
  const view = context.view;
  const breakValues = imageSizes.filter((size) => {
    return context.containerWidth >= size.breakpoint;
  });
  const layoutPreviewSize = view.layout?.previewSize ?? 230;
  const previewSizeToUse = breakValues.map((size, index) => ({ ...size, index })).filter((size) => size.value <= layoutPreviewSize).sort((a, b) => b.value - a.value)[0]?.index ?? 0;
  const marks = breakValues.map((size, index) => {
    return {
      value: index
    };
  });
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    external_wp_components_namespaceObject.RangeControl,
    {
      __nextHasNoMarginBottom: true,
      __next40pxDefaultSize: true,
      showTooltip: false,
      label: (0,external_wp_i18n_namespaceObject.__)("Preview size"),
      value: previewSizeToUse,
      min: 0,
      max: breakValues.length - 1,
      withInputField: false,
      onChange: (value = 0) => {
        context.onChangeView({
          ...view,
          layout: {
            ...view.layout,
            previewSize: breakValues[value].value
          }
        });
      },
      step: 1,
      marks
    }
  );
}


;// ./node_modules/@wordpress/dataviews/build-module/dataviews-layouts/table/density-picker.js





function DensityPicker() {
  const context = (0,external_wp_element_.useContext)(dataviews_context_default);
  const view = context.view;
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
    external_wp_components_namespaceObject.__experimentalToggleGroupControl,
    {
      __nextHasNoMarginBottom: true,
      size: "__unstable-large",
      label: (0,external_wp_i18n_namespaceObject.__)("Density"),
      value: view.layout?.density || "balanced",
      onChange: (value) => {
        context.onChangeView({
          ...view,
          layout: {
            ...view.layout,
            density: value
          }
        });
      },
      isBlock: true,
      children: [
        /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
          external_wp_components_namespaceObject.__experimentalToggleGroupControlOption,
          {
            value: "comfortable",
            label: (0,external_wp_i18n_namespaceObject._x)(
              "Comfortable",
              "Density option for DataView layout"
            )
          },
          "comfortable"
        ),
        /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
          external_wp_components_namespaceObject.__experimentalToggleGroupControlOption,
          {
            value: "balanced",
            label: (0,external_wp_i18n_namespaceObject._x)("Balanced", "Density option for DataView layout")
          },
          "balanced"
        ),
        /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
          external_wp_components_namespaceObject.__experimentalToggleGroupControlOption,
          {
            value: "compact",
            label: (0,external_wp_i18n_namespaceObject._x)("Compact", "Density option for DataView layout")
          },
          "compact"
        )
      ]
    }
  );
}


;// ./node_modules/@wordpress/dataviews/build-module/dataviews-layouts/index.js









const VIEW_LAYOUTS = [
  {
    type: constants_LAYOUT_TABLE,
    label: (0,external_wp_i18n_namespaceObject.__)("Table"),
    component: table_default,
    icon: block_table_default,
    viewConfigOptions: DensityPicker
  },
  {
    type: constants_LAYOUT_GRID,
    label: (0,external_wp_i18n_namespaceObject.__)("Grid"),
    component: grid_default,
    icon: category_default,
    viewConfigOptions: PreviewSizePicker
  },
  {
    type: constants_LAYOUT_LIST,
    label: (0,external_wp_i18n_namespaceObject.__)("List"),
    component: ViewList,
    icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? format_list_bullets_rtl_default : format_list_bullets_default
  },
  {
    type: LAYOUT_PICKER_GRID,
    label: (0,external_wp_i18n_namespaceObject.__)("Grid"),
    component: picker_grid_default,
    icon: category_default,
    viewConfigOptions: PreviewSizePicker,
    isPicker: true
  }
];


;// ./node_modules/@wordpress/dataviews/build-module/components/dataviews-filters/add-filter.js





const { Menu: add_filter_Menu } = lock_unlock_unlock(external_wp_components_namespaceObject.privateApis);
function AddFilterMenu({
  filters,
  view,
  onChangeView,
  setOpenedFilter,
  triggerProps
}) {
  const inactiveFilters = filters.filter((filter) => !filter.isVisible);
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(add_filter_Menu, { children: [
    /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(add_filter_Menu.TriggerButton, { ...triggerProps }),
    /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(add_filter_Menu.Popover, { children: inactiveFilters.map((filter) => {
      return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
        add_filter_Menu.Item,
        {
          onClick: () => {
            setOpenedFilter(filter.field);
            onChangeView({
              ...view,
              page: 1,
              filters: [
                ...view.filters || [],
                {
                  field: filter.field,
                  value: void 0,
                  operator: filter.operators[0]
                }
              ]
            });
          },
          children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(add_filter_Menu.ItemLabel, { children: filter.name })
        },
        filter.field
      );
    }) })
  ] });
}
function AddFilter({ filters, view, onChangeView, setOpenedFilter }, ref) {
  if (!filters.length || filters.every(({ isPrimary }) => isPrimary)) {
    return null;
  }
  const inactiveFilters = filters.filter((filter) => !filter.isVisible);
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    AddFilterMenu,
    {
      triggerProps: {
        render: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
          external_wp_components_namespaceObject.Button,
          {
            accessibleWhenDisabled: true,
            size: "compact",
            className: "dataviews-filters-button",
            variant: "tertiary",
            disabled: !inactiveFilters.length,
            ref
          }
        ),
        children: (0,external_wp_i18n_namespaceObject.__)("Add filter")
      },
      ...{ filters, view, onChangeView, setOpenedFilter }
    }
  );
}
var add_filter_default = (0,external_wp_element_.forwardRef)(AddFilter);


;// ./node_modules/@wordpress/dataviews/build-module/components/dataviews-filters/toggle.js







function FiltersToggle() {
  const {
    filters,
    view,
    onChangeView,
    setOpenedFilter,
    isShowingFilter,
    setIsShowingFilter
  } = (0,external_wp_element_.useContext)(dataviews_context_default);
  const buttonRef = (0,external_wp_element_.useRef)(null);
  const onChangeViewWithFilterVisibility = (0,external_wp_element_.useCallback)(
    (_view) => {
      onChangeView(_view);
      setIsShowingFilter(true);
    },
    [onChangeView, setIsShowingFilter]
  );
  const visibleFilters = filters.filter((filter) => filter.isVisible);
  const hasVisibleFilters = !!visibleFilters.length;
  if (filters.length === 0) {
    return null;
  }
  const addFilterButtonProps = {
    label: (0,external_wp_i18n_namespaceObject.__)("Add filter"),
    "aria-expanded": false,
    isPressed: false
  };
  const toggleFiltersButtonProps = {
    label: (0,external_wp_i18n_namespaceObject._x)("Filter", "verb"),
    "aria-expanded": isShowingFilter,
    isPressed: isShowingFilter,
    onClick: () => {
      if (!isShowingFilter) {
        setOpenedFilter(null);
      }
      setIsShowingFilter(!isShowingFilter);
    }
  };
  const buttonComponent = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    external_wp_components_namespaceObject.Button,
    {
      ref: buttonRef,
      className: "dataviews-filters__visibility-toggle",
      size: "compact",
      icon: funnel_default,
      ...hasVisibleFilters ? toggleFiltersButtonProps : addFilterButtonProps
    }
  );
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "dataviews-filters__container-visibility-toggle", children: !hasVisibleFilters ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    AddFilterMenu,
    {
      filters,
      view,
      onChangeView: onChangeViewWithFilterVisibility,
      setOpenedFilter,
      triggerProps: { render: buttonComponent }
    }
  ) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    FilterVisibilityToggle,
    {
      buttonRef,
      filtersCount: view.filters?.length,
      children: buttonComponent
    }
  ) });
}
function FilterVisibilityToggle({
  buttonRef,
  filtersCount,
  children
}) {
  (0,external_wp_element_.useEffect)(
    () => () => {
      buttonRef.current?.focus();
    },
    [buttonRef]
  );
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
    children,
    !!filtersCount && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "dataviews-filters-toggle__count", children: filtersCount })
  ] });
}
var toggle_default = FiltersToggle;


;// ./node_modules/@ariakit/react-core/esm/__chunks/3YLGPPWQ.js
"use client";
var __defProp = Object.defineProperty;
var __defProps = Object.defineProperties;
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __propIsEnum = Object.prototype.propertyIsEnumerable;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var _3YLGPPWQ_spreadValues = (a, b) => {
  for (var prop in b || (b = {}))
    if (__hasOwnProp.call(b, prop))
      __defNormalProp(a, prop, b[prop]);
  if (__getOwnPropSymbols)
    for (var prop of __getOwnPropSymbols(b)) {
      if (__propIsEnum.call(b, prop))
        __defNormalProp(a, prop, b[prop]);
    }
  return a;
};
var _3YLGPPWQ_spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
var __objRest = (source, exclude) => {
  var target = {};
  for (var prop in source)
    if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
      target[prop] = source[prop];
  if (source != null && __getOwnPropSymbols)
    for (var prop of __getOwnPropSymbols(source)) {
      if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
        target[prop] = source[prop];
    }
  return target;
};



;// ./node_modules/@ariakit/core/esm/__chunks/3YLGPPWQ.js
"use client";
var _3YLGPPWQ_defProp = Object.defineProperty;
var _3YLGPPWQ_defProps = Object.defineProperties;
var _3YLGPPWQ_getOwnPropDescs = Object.getOwnPropertyDescriptors;
var _3YLGPPWQ_getOwnPropSymbols = Object.getOwnPropertySymbols;
var _3YLGPPWQ_hasOwnProp = Object.prototype.hasOwnProperty;
var _3YLGPPWQ_propIsEnum = Object.prototype.propertyIsEnumerable;
var _3YLGPPWQ_defNormalProp = (obj, key, value) => key in obj ? _3YLGPPWQ_defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var _chunks_3YLGPPWQ_spreadValues = (a, b) => {
  for (var prop in b || (b = {}))
    if (_3YLGPPWQ_hasOwnProp.call(b, prop))
      _3YLGPPWQ_defNormalProp(a, prop, b[prop]);
  if (_3YLGPPWQ_getOwnPropSymbols)
    for (var prop of _3YLGPPWQ_getOwnPropSymbols(b)) {
      if (_3YLGPPWQ_propIsEnum.call(b, prop))
        _3YLGPPWQ_defNormalProp(a, prop, b[prop]);
    }
  return a;
};
var _chunks_3YLGPPWQ_spreadProps = (a, b) => _3YLGPPWQ_defProps(a, _3YLGPPWQ_getOwnPropDescs(b));
var _3YLGPPWQ_objRest = (source, exclude) => {
  var target = {};
  for (var prop in source)
    if (_3YLGPPWQ_hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
      target[prop] = source[prop];
  if (source != null && _3YLGPPWQ_getOwnPropSymbols)
    for (var prop of _3YLGPPWQ_getOwnPropSymbols(source)) {
      if (exclude.indexOf(prop) < 0 && _3YLGPPWQ_propIsEnum.call(source, prop))
        target[prop] = source[prop];
    }
  return target;
};



;// ./node_modules/@ariakit/core/esm/__chunks/PBFD2E7P.js
"use client";


// src/utils/misc.ts
function PBFD2E7P_noop(..._) {
}
function shallowEqual(a, b) {
  if (a === b) return true;
  if (!a) return false;
  if (!b) return false;
  if (typeof a !== "object") return false;
  if (typeof b !== "object") return false;
  const aKeys = Object.keys(a);
  const bKeys = Object.keys(b);
  const { length } = aKeys;
  if (bKeys.length !== length) return false;
  for (const key of aKeys) {
    if (a[key] !== b[key]) {
      return false;
    }
  }
  return true;
}
function applyState(argument, currentValue) {
  if (isUpdater(argument)) {
    const value = isLazyValue(currentValue) ? currentValue() : currentValue;
    return argument(value);
  }
  return argument;
}
function isUpdater(argument) {
  return typeof argument === "function";
}
function isLazyValue(value) {
  return typeof value === "function";
}
function isObject(arg) {
  return typeof arg === "object" && arg != null;
}
function PBFD2E7P_isEmpty(arg) {
  if (Array.isArray(arg)) return !arg.length;
  if (isObject(arg)) return !Object.keys(arg).length;
  if (arg == null) return true;
  if (arg === "") return true;
  return false;
}
function isInteger(arg) {
  if (typeof arg === "number") {
    return Math.floor(arg) === arg;
  }
  return String(Math.floor(Number(arg))) === arg;
}
function PBFD2E7P_hasOwnProperty(object, prop) {
  if (typeof Object.hasOwn === "function") {
    return Object.hasOwn(object, prop);
  }
  return Object.prototype.hasOwnProperty.call(object, prop);
}
function chain(...fns) {
  return (...args) => {
    for (const fn of fns) {
      if (typeof fn === "function") {
        fn(...args);
      }
    }
  };
}
function cx(...args) {
  return args.filter(Boolean).join(" ") || void 0;
}
function PBFD2E7P_normalizeString(str) {
  return str.normalize("NFD").replace(/[\u0300-\u036f]/g, "");
}
function omit(object, keys) {
  const result = _chunks_3YLGPPWQ_spreadValues({}, object);
  for (const key of keys) {
    if (PBFD2E7P_hasOwnProperty(result, key)) {
      delete result[key];
    }
  }
  return result;
}
function pick(object, paths) {
  const result = {};
  for (const key of paths) {
    if (PBFD2E7P_hasOwnProperty(object, key)) {
      result[key] = object[key];
    }
  }
  return result;
}
function identity(value) {
  return value;
}
function beforePaint(cb = PBFD2E7P_noop) {
  const raf = requestAnimationFrame(cb);
  return () => cancelAnimationFrame(raf);
}
function afterPaint(cb = PBFD2E7P_noop) {
  let raf = requestAnimationFrame(() => {
    raf = requestAnimationFrame(cb);
  });
  return () => cancelAnimationFrame(raf);
}
function invariant(condition, message) {
  if (condition) return;
  if (typeof message !== "string") throw new Error("Invariant failed");
  throw new Error(message);
}
function getKeys(obj) {
  return Object.keys(obj);
}
function isFalsyBooleanCallback(booleanOrCallback, ...args) {
  const result = typeof booleanOrCallback === "function" ? booleanOrCallback(...args) : booleanOrCallback;
  if (result == null) return false;
  return !result;
}
function disabledFromProps(props) {
  return props.disabled || props["aria-disabled"] === true || props["aria-disabled"] === "true";
}
function removeUndefinedValues(obj) {
  const result = {};
  for (const key in obj) {
    if (obj[key] !== void 0) {
      result[key] = obj[key];
    }
  }
  return result;
}
function defaultValue(...values) {
  for (const value of values) {
    if (value !== void 0) return value;
  }
  return void 0;
}



;// ./node_modules/@ariakit/react-core/esm/__chunks/SK3NAZA3.js
"use client";


// src/utils/misc.ts


function setRef(ref, value) {
  if (typeof ref === "function") {
    ref(value);
  } else if (ref) {
    ref.current = value;
  }
}
function isValidElementWithRef(element) {
  if (!element) return false;
  if (!(0,external_React_.isValidElement)(element)) return false;
  if ("ref" in element.props) return true;
  if ("ref" in element) return true;
  return false;
}
function getRefProperty(element) {
  if (!isValidElementWithRef(element)) return null;
  const props = _3YLGPPWQ_spreadValues({}, element.props);
  return props.ref || element.ref;
}
function mergeProps(base, overrides) {
  const props = _3YLGPPWQ_spreadValues({}, base);
  for (const key in overrides) {
    if (!PBFD2E7P_hasOwnProperty(overrides, key)) continue;
    if (key === "className") {
      const prop = "className";
      props[prop] = base[prop] ? `${base[prop]} ${overrides[prop]}` : overrides[prop];
      continue;
    }
    if (key === "style") {
      const prop = "style";
      props[prop] = base[prop] ? _3YLGPPWQ_spreadValues(_3YLGPPWQ_spreadValues({}, base[prop]), overrides[prop]) : overrides[prop];
      continue;
    }
    const overrideValue = overrides[key];
    if (typeof overrideValue === "function" && key.startsWith("on")) {
      const baseValue = base[key];
      if (typeof baseValue === "function") {
        props[key] = (...args) => {
          overrideValue(...args);
          baseValue(...args);
        };
        continue;
      }
    }
    props[key] = overrideValue;
  }
  return props;
}



;// ./node_modules/@ariakit/core/esm/__chunks/DTR5TSDJ.js
"use client";

// src/utils/dom.ts
var DTR5TSDJ_canUseDOM = checkIsBrowser();
function checkIsBrowser() {
  var _a;
  return typeof window !== "undefined" && !!((_a = window.document) == null ? void 0 : _a.createElement);
}
function getDocument(node) {
  if (!node) return document;
  if ("self" in node) return node.document;
  return node.ownerDocument || document;
}
function getWindow(node) {
  if (!node) return self;
  if ("self" in node) return node.self;
  return getDocument(node).defaultView || window;
}
function DTR5TSDJ_getActiveElement(node, activeDescendant = false) {
  const { activeElement } = getDocument(node);
  if (!(activeElement == null ? void 0 : activeElement.nodeName)) {
    return null;
  }
  if (DTR5TSDJ_isFrame(activeElement) && activeElement.contentDocument) {
    return DTR5TSDJ_getActiveElement(
      activeElement.contentDocument.body,
      activeDescendant
    );
  }
  if (activeDescendant) {
    const id = activeElement.getAttribute("aria-activedescendant");
    if (id) {
      const element = getDocument(activeElement).getElementById(id);
      if (element) {
        return element;
      }
    }
  }
  return activeElement;
}
function contains(parent, child) {
  return parent === child || parent.contains(child);
}
function DTR5TSDJ_isFrame(element) {
  return element.tagName === "IFRAME";
}
function isButton(element) {
  const tagName = element.tagName.toLowerCase();
  if (tagName === "button") return true;
  if (tagName === "input" && element.type) {
    return buttonInputTypes.indexOf(element.type) !== -1;
  }
  return false;
}
var buttonInputTypes = [
  "button",
  "color",
  "file",
  "image",
  "reset",
  "submit"
];
function isVisible(element) {
  if (typeof element.checkVisibility === "function") {
    return element.checkVisibility();
  }
  const htmlElement = element;
  return htmlElement.offsetWidth > 0 || htmlElement.offsetHeight > 0 || element.getClientRects().length > 0;
}
function isTextField(element) {
  try {
    const isTextInput = element instanceof HTMLInputElement && element.selectionStart !== null;
    const isTextArea = element.tagName === "TEXTAREA";
    return isTextInput || isTextArea || false;
  } catch (error) {
    return false;
  }
}
function isTextbox(element) {
  return element.isContentEditable || isTextField(element);
}
function getTextboxValue(element) {
  if (isTextField(element)) {
    return element.value;
  }
  if (element.isContentEditable) {
    const range = getDocument(element).createRange();
    range.selectNodeContents(element);
    return range.toString();
  }
  return "";
}
function getTextboxSelection(element) {
  let start = 0;
  let end = 0;
  if (isTextField(element)) {
    start = element.selectionStart || 0;
    end = element.selectionEnd || 0;
  } else if (element.isContentEditable) {
    const selection = getDocument(element).getSelection();
    if ((selection == null ? void 0 : selection.rangeCount) && selection.anchorNode && contains(element, selection.anchorNode) && selection.focusNode && contains(element, selection.focusNode)) {
      const range = selection.getRangeAt(0);
      const nextRange = range.cloneRange();
      nextRange.selectNodeContents(element);
      nextRange.setEnd(range.startContainer, range.startOffset);
      start = nextRange.toString().length;
      nextRange.setEnd(range.endContainer, range.endOffset);
      end = nextRange.toString().length;
    }
  }
  return { start, end };
}
function getPopupRole(element, fallback) {
  const allowedPopupRoles = ["dialog", "menu", "listbox", "tree", "grid"];
  const role = element == null ? void 0 : element.getAttribute("role");
  if (role && allowedPopupRoles.indexOf(role) !== -1) {
    return role;
  }
  return fallback;
}
function getPopupItemRole(element, fallback) {
  var _a;
  const itemRoleByPopupRole = {
    menu: "menuitem",
    listbox: "option",
    tree: "treeitem"
  };
  const popupRole = getPopupRole(element);
  if (!popupRole) return fallback;
  const key = popupRole;
  return (_a = itemRoleByPopupRole[key]) != null ? _a : fallback;
}
function scrollIntoViewIfNeeded(element, arg) {
  if (isPartiallyHidden(element) && "scrollIntoView" in element) {
    element.scrollIntoView(arg);
  }
}
function getScrollingElement(element) {
  if (!element) return null;
  const isScrollableOverflow = (overflow) => {
    if (overflow === "auto") return true;
    if (overflow === "scroll") return true;
    return false;
  };
  if (element.clientHeight && element.scrollHeight > element.clientHeight) {
    const { overflowY } = getComputedStyle(element);
    if (isScrollableOverflow(overflowY)) return element;
  } else if (element.clientWidth && element.scrollWidth > element.clientWidth) {
    const { overflowX } = getComputedStyle(element);
    if (isScrollableOverflow(overflowX)) return element;
  }
  return getScrollingElement(element.parentElement) || document.scrollingElement || document.body;
}
function isPartiallyHidden(element) {
  const elementRect = element.getBoundingClientRect();
  const scroller = getScrollingElement(element);
  if (!scroller) return false;
  const scrollerRect = scroller.getBoundingClientRect();
  const isHTML = scroller.tagName === "HTML";
  const scrollerTop = isHTML ? scrollerRect.top + scroller.scrollTop : scrollerRect.top;
  const scrollerBottom = isHTML ? scroller.clientHeight : scrollerRect.bottom;
  const scrollerLeft = isHTML ? scrollerRect.left + scroller.scrollLeft : scrollerRect.left;
  const scrollerRight = isHTML ? scroller.clientWidth : scrollerRect.right;
  const top = elementRect.top < scrollerTop;
  const left = elementRect.left < scrollerLeft;
  const bottom = elementRect.bottom > scrollerBottom;
  const right = elementRect.right > scrollerRight;
  return top || left || bottom || right;
}
function setSelectionRange(element, ...args) {
  if (/text|search|password|tel|url/i.test(element.type)) {
    element.setSelectionRange(...args);
  }
}
function sortBasedOnDOMPosition(items, getElement) {
  const pairs = items.map((item, index) => [index, item]);
  let isOrderDifferent = false;
  pairs.sort(([indexA, a], [indexB, b]) => {
    const elementA = getElement(a);
    const elementB = getElement(b);
    if (elementA === elementB) return 0;
    if (!elementA || !elementB) return 0;
    if (isElementPreceding(elementA, elementB)) {
      if (indexA > indexB) {
        isOrderDifferent = true;
      }
      return -1;
    }
    if (indexA < indexB) {
      isOrderDifferent = true;
    }
    return 1;
  });
  if (isOrderDifferent) {
    return pairs.map(([_, item]) => item);
  }
  return items;
}
function isElementPreceding(a, b) {
  return Boolean(
    b.compareDocumentPosition(a) & Node.DOCUMENT_POSITION_PRECEDING
  );
}



;// ./node_modules/@ariakit/core/esm/__chunks/QAGXQEUG.js
"use client";


// src/utils/platform.ts
function isTouchDevice() {
  return DTR5TSDJ_canUseDOM && !!navigator.maxTouchPoints;
}
function isApple() {
  if (!DTR5TSDJ_canUseDOM) return false;
  return /mac|iphone|ipad|ipod/i.test(navigator.platform);
}
function isSafari() {
  return DTR5TSDJ_canUseDOM && isApple() && /apple/i.test(navigator.vendor);
}
function isFirefox() {
  return DTR5TSDJ_canUseDOM && /firefox\//i.test(navigator.userAgent);
}
function isMac() {
  return canUseDOM && navigator.platform.startsWith("Mac") && !isTouchDevice();
}



;// ./node_modules/@ariakit/core/esm/utils/events.js
"use client";




// src/utils/events.ts
function isPortalEvent(event) {
  return Boolean(
    event.currentTarget && !contains(event.currentTarget, event.target)
  );
}
function isSelfTarget(event) {
  return event.target === event.currentTarget;
}
function isOpeningInNewTab(event) {
  const element = event.currentTarget;
  if (!element) return false;
  const isAppleDevice = isApple();
  if (isAppleDevice && !event.metaKey) return false;
  if (!isAppleDevice && !event.ctrlKey) return false;
  const tagName = element.tagName.toLowerCase();
  if (tagName === "a") return true;
  if (tagName === "button" && element.type === "submit") return true;
  if (tagName === "input" && element.type === "submit") return true;
  return false;
}
function isDownloading(event) {
  const element = event.currentTarget;
  if (!element) return false;
  const tagName = element.tagName.toLowerCase();
  if (!event.altKey) return false;
  if (tagName === "a") return true;
  if (tagName === "button" && element.type === "submit") return true;
  if (tagName === "input" && element.type === "submit") return true;
  return false;
}
function fireEvent(element, type, eventInit) {
  const event = new Event(type, eventInit);
  return element.dispatchEvent(event);
}
function fireBlurEvent(element, eventInit) {
  const event = new FocusEvent("blur", eventInit);
  const defaultAllowed = element.dispatchEvent(event);
  const bubbleInit = _chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues({}, eventInit), { bubbles: true });
  element.dispatchEvent(new FocusEvent("focusout", bubbleInit));
  return defaultAllowed;
}
function fireFocusEvent(element, eventInit) {
  const event = new FocusEvent("focus", eventInit);
  const defaultAllowed = element.dispatchEvent(event);
  const bubbleInit = __spreadProps(__spreadValues({}, eventInit), { bubbles: true });
  element.dispatchEvent(new FocusEvent("focusin", bubbleInit));
  return defaultAllowed;
}
function fireKeyboardEvent(element, type, eventInit) {
  const event = new KeyboardEvent(type, eventInit);
  return element.dispatchEvent(event);
}
function fireClickEvent(element, eventInit) {
  const event = new MouseEvent("click", eventInit);
  return element.dispatchEvent(event);
}
function isFocusEventOutside(event, container) {
  const containerElement = container || event.currentTarget;
  const relatedTarget = event.relatedTarget;
  return !relatedTarget || !contains(containerElement, relatedTarget);
}
function getInputType(event) {
  const nativeEvent = "nativeEvent" in event ? event.nativeEvent : event;
  if (!nativeEvent) return;
  if (!("inputType" in nativeEvent)) return;
  if (typeof nativeEvent.inputType !== "string") return;
  return nativeEvent.inputType;
}
function queueBeforeEvent(element, type, callback, timeout) {
  const createTimer = (callback2) => {
    if (timeout) {
      const timerId2 = setTimeout(callback2, timeout);
      return () => clearTimeout(timerId2);
    }
    const timerId = requestAnimationFrame(callback2);
    return () => cancelAnimationFrame(timerId);
  };
  const cancelTimer = createTimer(() => {
    element.removeEventListener(type, callSync, true);
    callback();
  });
  const callSync = () => {
    cancelTimer();
    callback();
  };
  element.addEventListener(type, callSync, { once: true, capture: true });
  return cancelTimer;
}
function addGlobalEventListener(type, listener, options, scope = window) {
  const children = [];
  try {
    scope.document.addEventListener(type, listener, options);
    for (const frame of Array.from(scope.frames)) {
      children.push(addGlobalEventListener(type, listener, options, frame));
    }
  } catch (e) {
  }
  const removeEventListener = () => {
    try {
      scope.document.removeEventListener(type, listener, options);
    } catch (e) {
    }
    for (const remove of children) {
      remove();
    }
  };
  return removeEventListener;
}


;// ./node_modules/@ariakit/react-core/esm/__chunks/ABQUS43J.js
"use client";



// src/utils/hooks.ts




var _React = _3YLGPPWQ_spreadValues({}, external_React_namespaceObject);
var useReactId = _React.useId;
var useReactDeferredValue = _React.useDeferredValue;
var useReactInsertionEffect = _React.useInsertionEffect;
var useSafeLayoutEffect = DTR5TSDJ_canUseDOM ? external_React_.useLayoutEffect : external_React_.useEffect;
function useInitialValue(value) {
  const [initialValue] = (0,external_React_.useState)(value);
  return initialValue;
}
function useLazyValue(init) {
  const ref = useRef();
  if (ref.current === void 0) {
    ref.current = init();
  }
  return ref.current;
}
function useLiveRef(value) {
  const ref = (0,external_React_.useRef)(value);
  useSafeLayoutEffect(() => {
    ref.current = value;
  });
  return ref;
}
function usePreviousValue(value) {
  const [previousValue, setPreviousValue] = useState(value);
  if (value !== previousValue) {
    setPreviousValue(value);
  }
  return previousValue;
}
function useEvent(callback) {
  const ref = (0,external_React_.useRef)(() => {
    throw new Error("Cannot call an event handler while rendering.");
  });
  if (useReactInsertionEffect) {
    useReactInsertionEffect(() => {
      ref.current = callback;
    });
  } else {
    ref.current = callback;
  }
  return (0,external_React_.useCallback)((...args) => {
    var _a;
    return (_a = ref.current) == null ? void 0 : _a.call(ref, ...args);
  }, []);
}
function useTransactionState(callback) {
  const [state, setState] = (0,external_React_.useState)(null);
  useSafeLayoutEffect(() => {
    if (state == null) return;
    if (!callback) return;
    let prevState = null;
    callback((prev) => {
      prevState = prev;
      return state;
    });
    return () => {
      callback(prevState);
    };
  }, [state, callback]);
  return [state, setState];
}
function useMergeRefs(...refs) {
  return (0,external_React_.useMemo)(() => {
    if (!refs.some(Boolean)) return;
    return (value) => {
      for (const ref of refs) {
        setRef(ref, value);
      }
    };
  }, refs);
}
function useId(defaultId) {
  if (useReactId) {
    const reactId = useReactId();
    if (defaultId) return defaultId;
    return reactId;
  }
  const [id, setId] = (0,external_React_.useState)(defaultId);
  useSafeLayoutEffect(() => {
    if (defaultId || id) return;
    const random = Math.random().toString(36).slice(2, 8);
    setId(`id-${random}`);
  }, [defaultId, id]);
  return defaultId || id;
}
function useDeferredValue(value) {
  if (useReactDeferredValue) {
    return useReactDeferredValue(value);
  }
  const [deferredValue, setDeferredValue] = useState(value);
  useEffect(() => {
    const raf = requestAnimationFrame(() => setDeferredValue(value));
    return () => cancelAnimationFrame(raf);
  }, [value]);
  return deferredValue;
}
function useTagName(refOrElement, type) {
  const stringOrUndefined = (type2) => {
    if (typeof type2 !== "string") return;
    return type2;
  };
  const [tagName, setTagName] = (0,external_React_.useState)(() => stringOrUndefined(type));
  useSafeLayoutEffect(() => {
    const element = refOrElement && "current" in refOrElement ? refOrElement.current : refOrElement;
    setTagName((element == null ? void 0 : element.tagName.toLowerCase()) || stringOrUndefined(type));
  }, [refOrElement, type]);
  return tagName;
}
function useAttribute(refOrElement, attributeName, defaultValue) {
  const initialValue = useInitialValue(defaultValue);
  const [attribute, setAttribute] = (0,external_React_.useState)(initialValue);
  (0,external_React_.useEffect)(() => {
    const element = refOrElement && "current" in refOrElement ? refOrElement.current : refOrElement;
    if (!element) return;
    const callback = () => {
      const value = element.getAttribute(attributeName);
      setAttribute(value == null ? initialValue : value);
    };
    const observer = new MutationObserver(callback);
    observer.observe(element, { attributeFilter: [attributeName] });
    callback();
    return () => observer.disconnect();
  }, [refOrElement, attributeName, initialValue]);
  return attribute;
}
function useUpdateEffect(effect, deps) {
  const mounted = (0,external_React_.useRef)(false);
  (0,external_React_.useEffect)(() => {
    if (mounted.current) {
      return effect();
    }
    mounted.current = true;
  }, deps);
  (0,external_React_.useEffect)(
    () => () => {
      mounted.current = false;
    },
    []
  );
}
function useUpdateLayoutEffect(effect, deps) {
  const mounted = (0,external_React_.useRef)(false);
  useSafeLayoutEffect(() => {
    if (mounted.current) {
      return effect();
    }
    mounted.current = true;
  }, deps);
  useSafeLayoutEffect(
    () => () => {
      mounted.current = false;
    },
    []
  );
}
function useForceUpdate() {
  return (0,external_React_.useReducer)(() => [], []);
}
function useBooleanEvent(booleanOrCallback) {
  return useEvent(
    typeof booleanOrCallback === "function" ? booleanOrCallback : () => booleanOrCallback
  );
}
function useWrapElement(props, callback, deps = []) {
  const wrapElement = (0,external_React_.useCallback)(
    (element) => {
      if (props.wrapElement) {
        element = props.wrapElement(element);
      }
      return callback(element);
    },
    [...deps, props.wrapElement]
  );
  return _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, props), { wrapElement });
}
function usePortalRef(portalProp = false, portalRefProp) {
  const [portalNode, setPortalNode] = useState(null);
  const portalRef = useMergeRefs(setPortalNode, portalRefProp);
  const domReady = !portalProp || portalNode;
  return { portalRef, portalNode, domReady };
}
function useMetadataProps(props, key, value) {
  const parent = props.onLoadedMetadataCapture;
  const onLoadedMetadataCapture = (0,external_React_.useMemo)(() => {
    return Object.assign(() => {
    }, _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, parent), { [key]: value }));
  }, [parent, key, value]);
  return [parent == null ? void 0 : parent[key], { onLoadedMetadataCapture }];
}
function useIsMouseMoving() {
  (0,external_React_.useEffect)(() => {
    addGlobalEventListener("mousemove", setMouseMoving, true);
    addGlobalEventListener("mousedown", resetMouseMoving, true);
    addGlobalEventListener("mouseup", resetMouseMoving, true);
    addGlobalEventListener("keydown", resetMouseMoving, true);
    addGlobalEventListener("scroll", resetMouseMoving, true);
  }, []);
  const isMouseMoving = useEvent(() => mouseMoving);
  return isMouseMoving;
}
var mouseMoving = false;
var previousScreenX = 0;
var previousScreenY = 0;
function hasMouseMovement(event) {
  const movementX = event.movementX || event.screenX - previousScreenX;
  const movementY = event.movementY || event.screenY - previousScreenY;
  previousScreenX = event.screenX;
  previousScreenY = event.screenY;
  return movementX || movementY || "production" === "test";
}
function setMouseMoving(event) {
  if (!hasMouseMovement(event)) return;
  mouseMoving = true;
}
function resetMouseMoving() {
  mouseMoving = false;
}



;// ./node_modules/@ariakit/react-core/esm/__chunks/LMDWO4NN.js
"use client";




// src/utils/system.tsx


function forwardRef2(render) {
  const Role = external_React_.forwardRef((props, ref) => render(_3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, props), { ref })));
  Role.displayName = render.displayName || render.name;
  return Role;
}
function memo2(Component, propsAreEqual) {
  return external_React_.memo(Component, propsAreEqual);
}
function createElement(Type, props) {
  const _a = props, { wrapElement, render } = _a, rest = __objRest(_a, ["wrapElement", "render"]);
  const mergedRef = useMergeRefs(props.ref, getRefProperty(render));
  let element;
  if (external_React_.isValidElement(render)) {
    const renderProps = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, render.props), { ref: mergedRef });
    element = external_React_.cloneElement(render, mergeProps(rest, renderProps));
  } else if (render) {
    element = render(rest);
  } else {
    element = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Type, _3YLGPPWQ_spreadValues({}, rest));
  }
  if (wrapElement) {
    return wrapElement(element);
  }
  return element;
}
function createHook(useProps) {
  const useRole = (props = {}) => {
    return useProps(props);
  };
  useRole.displayName = useProps.name;
  return useRole;
}
function createStoreContext(providers = [], scopedProviders = []) {
  const context = external_React_.createContext(void 0);
  const scopedContext = external_React_.createContext(void 0);
  const useContext2 = () => external_React_.useContext(context);
  const useScopedContext = (onlyScoped = false) => {
    const scoped = external_React_.useContext(scopedContext);
    const store = useContext2();
    if (onlyScoped) return scoped;
    return scoped || store;
  };
  const useProviderContext = () => {
    const scoped = external_React_.useContext(scopedContext);
    const store = useContext2();
    if (scoped && scoped === store) return;
    return store;
  };
  const ContextProvider = (props) => {
    return providers.reduceRight(
      (children, Provider) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Provider, _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, props), { children })),
      /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(context.Provider, _3YLGPPWQ_spreadValues({}, props))
    );
  };
  const ScopedContextProvider = (props) => {
    return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ContextProvider, _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, props), { children: scopedProviders.reduceRight(
      (children, Provider) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Provider, _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, props), { children })),
      /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(scopedContext.Provider, _3YLGPPWQ_spreadValues({}, props))
    ) }));
  };
  return {
    context,
    scopedContext,
    useContext: useContext2,
    useScopedContext,
    useProviderContext,
    ContextProvider,
    ScopedContextProvider
  };
}



;// ./node_modules/@ariakit/react-core/esm/__chunks/VDHZ5F7K.js
"use client";


// src/collection/collection-context.tsx
var ctx = createStoreContext();
var useCollectionContext = ctx.useContext;
var useCollectionScopedContext = ctx.useScopedContext;
var useCollectionProviderContext = ctx.useProviderContext;
var CollectionContextProvider = ctx.ContextProvider;
var CollectionScopedContextProvider = ctx.ScopedContextProvider;



;// ./node_modules/@ariakit/react-core/esm/__chunks/P7GR5CS5.js
"use client";



// src/composite/composite-context.tsx

var P7GR5CS5_ctx = createStoreContext(
  [CollectionContextProvider],
  [CollectionScopedContextProvider]
);
var useCompositeContext = P7GR5CS5_ctx.useContext;
var useCompositeScopedContext = P7GR5CS5_ctx.useScopedContext;
var useCompositeProviderContext = P7GR5CS5_ctx.useProviderContext;
var CompositeContextProvider = P7GR5CS5_ctx.ContextProvider;
var CompositeScopedContextProvider = P7GR5CS5_ctx.ScopedContextProvider;
var CompositeItemContext = (0,external_React_.createContext)(
  void 0
);
var CompositeRowContext = (0,external_React_.createContext)(
  void 0
);



;// ./node_modules/@ariakit/react-core/esm/__chunks/3XAVFTCA.js
"use client";



// src/tag/tag-context.tsx

var TagValueContext = (0,external_React_.createContext)(null);
var TagRemoveIdContext = (0,external_React_.createContext)(
  null
);
var _3XAVFTCA_ctx = createStoreContext(
  [CompositeContextProvider],
  [CompositeScopedContextProvider]
);
var useTagContext = _3XAVFTCA_ctx.useContext;
var useTagScopedContext = _3XAVFTCA_ctx.useScopedContext;
var useTagProviderContext = _3XAVFTCA_ctx.useProviderContext;
var TagContextProvider = _3XAVFTCA_ctx.ContextProvider;
var TagScopedContextProvider = _3XAVFTCA_ctx.ScopedContextProvider;



;// ./node_modules/@ariakit/core/esm/__chunks/BCALMBPZ.js
"use client";



// src/utils/store.ts
function getInternal(store, key) {
  const internals = store.__unstableInternals;
  invariant(internals, "Invalid store");
  return internals[key];
}
function createStore(initialState, ...stores) {
  let state = initialState;
  let prevStateBatch = state;
  let lastUpdate = Symbol();
  let destroy = PBFD2E7P_noop;
  const instances = /* @__PURE__ */ new Set();
  const updatedKeys = /* @__PURE__ */ new Set();
  const setups = /* @__PURE__ */ new Set();
  const listeners = /* @__PURE__ */ new Set();
  const batchListeners = /* @__PURE__ */ new Set();
  const disposables = /* @__PURE__ */ new WeakMap();
  const listenerKeys = /* @__PURE__ */ new WeakMap();
  const storeSetup = (callback) => {
    setups.add(callback);
    return () => setups.delete(callback);
  };
  const storeInit = () => {
    const initialized = instances.size;
    const instance = Symbol();
    instances.add(instance);
    const maybeDestroy = () => {
      instances.delete(instance);
      if (instances.size) return;
      destroy();
    };
    if (initialized) return maybeDestroy;
    const desyncs = getKeys(state).map(
      (key) => chain(
        ...stores.map((store) => {
          var _a;
          const storeState = (_a = store == null ? void 0 : store.getState) == null ? void 0 : _a.call(store);
          if (!storeState) return;
          if (!PBFD2E7P_hasOwnProperty(storeState, key)) return;
          return sync(store, [key], (state2) => {
            setState(
              key,
              state2[key],
              // @ts-expect-error - Not public API. This is just to prevent
              // infinite loops.
              true
            );
          });
        })
      )
    );
    const teardowns = [];
    for (const setup2 of setups) {
      teardowns.push(setup2());
    }
    const cleanups = stores.map(init);
    destroy = chain(...desyncs, ...teardowns, ...cleanups);
    return maybeDestroy;
  };
  const sub = (keys, listener, set = listeners) => {
    set.add(listener);
    listenerKeys.set(listener, keys);
    return () => {
      var _a;
      (_a = disposables.get(listener)) == null ? void 0 : _a();
      disposables.delete(listener);
      listenerKeys.delete(listener);
      set.delete(listener);
    };
  };
  const storeSubscribe = (keys, listener) => sub(keys, listener);
  const storeSync = (keys, listener) => {
    disposables.set(listener, listener(state, state));
    return sub(keys, listener);
  };
  const storeBatch = (keys, listener) => {
    disposables.set(listener, listener(state, prevStateBatch));
    return sub(keys, listener, batchListeners);
  };
  const storePick = (keys) => createStore(pick(state, keys), finalStore);
  const storeOmit = (keys) => createStore(omit(state, keys), finalStore);
  const getState = () => state;
  const setState = (key, value, fromStores = false) => {
    var _a;
    if (!PBFD2E7P_hasOwnProperty(state, key)) return;
    const nextValue = applyState(value, state[key]);
    if (nextValue === state[key]) return;
    if (!fromStores) {
      for (const store of stores) {
        (_a = store == null ? void 0 : store.setState) == null ? void 0 : _a.call(store, key, nextValue);
      }
    }
    const prevState = state;
    state = _chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues({}, state), { [key]: nextValue });
    const thisUpdate = Symbol();
    lastUpdate = thisUpdate;
    updatedKeys.add(key);
    const run = (listener, prev, uKeys) => {
      var _a2;
      const keys = listenerKeys.get(listener);
      const updated = (k) => uKeys ? uKeys.has(k) : k === key;
      if (!keys || keys.some(updated)) {
        (_a2 = disposables.get(listener)) == null ? void 0 : _a2();
        disposables.set(listener, listener(state, prev));
      }
    };
    for (const listener of listeners) {
      run(listener, prevState);
    }
    queueMicrotask(() => {
      if (lastUpdate !== thisUpdate) return;
      const snapshot = state;
      for (const listener of batchListeners) {
        run(listener, prevStateBatch, updatedKeys);
      }
      prevStateBatch = snapshot;
      updatedKeys.clear();
    });
  };
  const finalStore = {
    getState,
    setState,
    __unstableInternals: {
      setup: storeSetup,
      init: storeInit,
      subscribe: storeSubscribe,
      sync: storeSync,
      batch: storeBatch,
      pick: storePick,
      omit: storeOmit
    }
  };
  return finalStore;
}
function setup(store, ...args) {
  if (!store) return;
  return getInternal(store, "setup")(...args);
}
function init(store, ...args) {
  if (!store) return;
  return getInternal(store, "init")(...args);
}
function subscribe(store, ...args) {
  if (!store) return;
  return getInternal(store, "subscribe")(...args);
}
function sync(store, ...args) {
  if (!store) return;
  return getInternal(store, "sync")(...args);
}
function batch(store, ...args) {
  if (!store) return;
  return getInternal(store, "batch")(...args);
}
function omit2(store, ...args) {
  if (!store) return;
  return getInternal(store, "omit")(...args);
}
function pick2(store, ...args) {
  if (!store) return;
  return getInternal(store, "pick")(...args);
}
function mergeStore(...stores) {
  const initialState = stores.reduce((state, store2) => {
    var _a;
    const nextState = (_a = store2 == null ? void 0 : store2.getState) == null ? void 0 : _a.call(store2);
    if (!nextState) return state;
    return Object.assign(state, nextState);
  }, {});
  const store = createStore(initialState, ...stores);
  return Object.assign({}, ...stores, store);
}
function throwOnConflictingProps(props, store) {
  if (true) return;
  if (!store) return;
  const defaultKeys = Object.entries(props).filter(([key, value]) => key.startsWith("default") && value !== void 0).map(([key]) => {
    var _a;
    const stateKey = key.replace("default", "");
    return `${((_a = stateKey[0]) == null ? void 0 : _a.toLowerCase()) || ""}${stateKey.slice(1)}`;
  });
  if (!defaultKeys.length) return;
  const storeState = store.getState();
  const conflictingProps = defaultKeys.filter(
    (key) => PBFD2E7P_hasOwnProperty(storeState, key)
  );
  if (!conflictingProps.length) return;
  throw new Error(
    `Passing a store prop in conjunction with a default state is not supported.

const store = useSelectStore();
<SelectProvider store={store} defaultValue="Apple" />
                ^             ^

Instead, pass the default state to the topmost store:

const store = useSelectStore({ defaultValue: "Apple" });
<SelectProvider store={store} />

See https://github.com/ariakit/ariakit/pull/2745 for more details.

If there's a particular need for this, please submit a feature request at https://github.com/ariakit/ariakit
`
  );
}



// EXTERNAL MODULE: ./node_modules/use-sync-external-store/shim/index.js
var shim = __webpack_require__(422);
;// ./node_modules/@ariakit/react-core/esm/__chunks/YV4JVR4I.js
"use client";



// src/utils/store.tsx




var { useSyncExternalStore } = shim;
var noopSubscribe = () => () => {
};
function useStoreState(store, keyOrSelector = identity) {
  const storeSubscribe = external_React_.useCallback(
    (callback) => {
      if (!store) return noopSubscribe();
      return subscribe(store, null, callback);
    },
    [store]
  );
  const getSnapshot = () => {
    const key = typeof keyOrSelector === "string" ? keyOrSelector : null;
    const selector = typeof keyOrSelector === "function" ? keyOrSelector : null;
    const state = store == null ? void 0 : store.getState();
    if (selector) return selector(state);
    if (!state) return;
    if (!key) return;
    if (!PBFD2E7P_hasOwnProperty(state, key)) return;
    return state[key];
  };
  return useSyncExternalStore(storeSubscribe, getSnapshot, getSnapshot);
}
function useStoreStateObject(store, object) {
  const objRef = external_React_.useRef(
    {}
  );
  const storeSubscribe = external_React_.useCallback(
    (callback) => {
      if (!store) return noopSubscribe();
      return subscribe(store, null, callback);
    },
    [store]
  );
  const getSnapshot = () => {
    const state = store == null ? void 0 : store.getState();
    let updated = false;
    const obj = objRef.current;
    for (const prop in object) {
      const keyOrSelector = object[prop];
      if (typeof keyOrSelector === "function") {
        const value = keyOrSelector(state);
        if (value !== obj[prop]) {
          obj[prop] = value;
          updated = true;
        }
      }
      if (typeof keyOrSelector === "string") {
        if (!state) continue;
        if (!PBFD2E7P_hasOwnProperty(state, keyOrSelector)) continue;
        const value = state[keyOrSelector];
        if (value !== obj[prop]) {
          obj[prop] = value;
          updated = true;
        }
      }
    }
    if (updated) {
      objRef.current = _3YLGPPWQ_spreadValues({}, obj);
    }
    return objRef.current;
  };
  return useSyncExternalStore(storeSubscribe, getSnapshot, getSnapshot);
}
function useStoreProps(store, props, key, setKey) {
  const value = PBFD2E7P_hasOwnProperty(props, key) ? props[key] : void 0;
  const setValue = setKey ? props[setKey] : void 0;
  const propsRef = useLiveRef({ value, setValue });
  useSafeLayoutEffect(() => {
    return sync(store, [key], (state, prev) => {
      const { value: value2, setValue: setValue2 } = propsRef.current;
      if (!setValue2) return;
      if (state[key] === prev[key]) return;
      if (state[key] === value2) return;
      setValue2(state[key]);
    });
  }, [store, key]);
  useSafeLayoutEffect(() => {
    if (value === void 0) return;
    store.setState(key, value);
    return batch(store, [key], () => {
      if (value === void 0) return;
      store.setState(key, value);
    });
  });
}
function YV4JVR4I_useStore(createStore, props) {
  const [store, setStore] = external_React_.useState(() => createStore(props));
  useSafeLayoutEffect(() => init(store), [store]);
  const useState2 = external_React_.useCallback(
    (keyOrSelector) => useStoreState(store, keyOrSelector),
    [store]
  );
  const memoizedStore = external_React_.useMemo(
    () => _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, store), { useState: useState2 }),
    [store, useState2]
  );
  const updateStore = useEvent(() => {
    setStore((store2) => createStore(_3YLGPPWQ_spreadValues(_3YLGPPWQ_spreadValues({}, props), store2.getState())));
  });
  return [memoizedStore, updateStore];
}



;// ./node_modules/@ariakit/react-core/esm/__chunks/C3IKGW5T.js
"use client";



// src/collection/collection-store.ts

function useCollectionStoreProps(store, update, props) {
  useUpdateEffect(update, [props.store]);
  useStoreProps(store, props, "items", "setItems");
  return store;
}
function useCollectionStore(props = {}) {
  const [store, update] = useStore(Core.createCollectionStore, props);
  return useCollectionStoreProps(store, update, props);
}



;// ./node_modules/@ariakit/react-core/esm/__chunks/4CMBR7SL.js
"use client";





// src/composite/composite-store.ts

function useCompositeStoreOptions(props) {
  const id = useId(props.id);
  return _3YLGPPWQ_spreadValues({ id }, props);
}
function useCompositeStoreProps(store, update, props) {
  store = useCollectionStoreProps(store, update, props);
  useStoreProps(store, props, "activeId", "setActiveId");
  useStoreProps(store, props, "includesBaseElement");
  useStoreProps(store, props, "virtualFocus");
  useStoreProps(store, props, "orientation");
  useStoreProps(store, props, "rtl");
  useStoreProps(store, props, "focusLoop");
  useStoreProps(store, props, "focusWrap");
  useStoreProps(store, props, "focusShift");
  return store;
}
function useCompositeStore(props = {}) {
  props = useCompositeStoreOptions(props);
  const [store, update] = useStore(Core.createCompositeStore, props);
  return useCompositeStoreProps(store, update, props);
}



;// ./node_modules/@ariakit/react-core/esm/__chunks/WYCIER3C.js
"use client";



// src/disclosure/disclosure-store.ts

function useDisclosureStoreProps(store, update, props) {
  useUpdateEffect(update, [props.store, props.disclosure]);
  useStoreProps(store, props, "open", "setOpen");
  useStoreProps(store, props, "mounted", "setMounted");
  useStoreProps(store, props, "animated");
  return Object.assign(store, { disclosure: props.disclosure });
}
function useDisclosureStore(props = {}) {
  const [store, update] = useStore(Core.createDisclosureStore, props);
  return useDisclosureStoreProps(store, update, props);
}



;// ./node_modules/@ariakit/react-core/esm/__chunks/BM6PGYQY.js
"use client";



// src/dialog/dialog-store.ts

function useDialogStoreProps(store, update, props) {
  return useDisclosureStoreProps(store, update, props);
}
function useDialogStore(props = {}) {
  const [store, update] = useStore(Core.createDialogStore, props);
  return useDialogStoreProps(store, update, props);
}



;// ./node_modules/@ariakit/react-core/esm/__chunks/O2PQ2652.js
"use client";




// src/popover/popover-store.ts

function usePopoverStoreProps(store, update, props) {
  useUpdateEffect(update, [props.popover]);
  useStoreProps(store, props, "placement");
  return useDialogStoreProps(store, update, props);
}
function usePopoverStore(props = {}) {
  const [store, update] = useStore(Core.createPopoverStore, props);
  return usePopoverStoreProps(store, update, props);
}



;// ./node_modules/@ariakit/core/esm/__chunks/CYQWQL4J.js
"use client";





// src/collection/collection-store.ts
function getCommonParent(items) {
  var _a;
  const firstItem = items.find((item) => !!item.element);
  const lastItem = [...items].reverse().find((item) => !!item.element);
  let parentElement = (_a = firstItem == null ? void 0 : firstItem.element) == null ? void 0 : _a.parentElement;
  while (parentElement && (lastItem == null ? void 0 : lastItem.element)) {
    const parent = parentElement;
    if (lastItem && parent.contains(lastItem.element)) {
      return parentElement;
    }
    parentElement = parentElement.parentElement;
  }
  return getDocument(parentElement).body;
}
function getPrivateStore(store) {
  return store == null ? void 0 : store.__unstablePrivateStore;
}
function createCollectionStore(props = {}) {
  var _a;
  throwOnConflictingProps(props, props.store);
  const syncState = (_a = props.store) == null ? void 0 : _a.getState();
  const items = defaultValue(
    props.items,
    syncState == null ? void 0 : syncState.items,
    props.defaultItems,
    []
  );
  const itemsMap = new Map(items.map((item) => [item.id, item]));
  const initialState = {
    items,
    renderedItems: defaultValue(syncState == null ? void 0 : syncState.renderedItems, [])
  };
  const syncPrivateStore = getPrivateStore(props.store);
  const privateStore = createStore(
    { items, renderedItems: initialState.renderedItems },
    syncPrivateStore
  );
  const collection = createStore(initialState, props.store);
  const sortItems = (renderedItems) => {
    const sortedItems = sortBasedOnDOMPosition(renderedItems, (i) => i.element);
    privateStore.setState("renderedItems", sortedItems);
    collection.setState("renderedItems", sortedItems);
  };
  setup(collection, () => init(privateStore));
  setup(privateStore, () => {
    return batch(privateStore, ["items"], (state) => {
      collection.setState("items", state.items);
    });
  });
  setup(privateStore, () => {
    return batch(privateStore, ["renderedItems"], (state) => {
      let firstRun = true;
      let raf = requestAnimationFrame(() => {
        const { renderedItems } = collection.getState();
        if (state.renderedItems === renderedItems) return;
        sortItems(state.renderedItems);
      });
      if (typeof IntersectionObserver !== "function") {
        return () => cancelAnimationFrame(raf);
      }
      const ioCallback = () => {
        if (firstRun) {
          firstRun = false;
          return;
        }
        cancelAnimationFrame(raf);
        raf = requestAnimationFrame(() => sortItems(state.renderedItems));
      };
      const root = getCommonParent(state.renderedItems);
      const observer = new IntersectionObserver(ioCallback, { root });
      for (const item of state.renderedItems) {
        if (!item.element) continue;
        observer.observe(item.element);
      }
      return () => {
        cancelAnimationFrame(raf);
        observer.disconnect();
      };
    });
  });
  const mergeItem = (item, setItems, canDeleteFromMap = false) => {
    let prevItem;
    setItems((items2) => {
      const index = items2.findIndex(({ id }) => id === item.id);
      const nextItems = items2.slice();
      if (index !== -1) {
        prevItem = items2[index];
        const nextItem = _chunks_3YLGPPWQ_spreadValues(_chunks_3YLGPPWQ_spreadValues({}, prevItem), item);
        nextItems[index] = nextItem;
        itemsMap.set(item.id, nextItem);
      } else {
        nextItems.push(item);
        itemsMap.set(item.id, item);
      }
      return nextItems;
    });
    const unmergeItem = () => {
      setItems((items2) => {
        if (!prevItem) {
          if (canDeleteFromMap) {
            itemsMap.delete(item.id);
          }
          return items2.filter(({ id }) => id !== item.id);
        }
        const index = items2.findIndex(({ id }) => id === item.id);
        if (index === -1) return items2;
        const nextItems = items2.slice();
        nextItems[index] = prevItem;
        itemsMap.set(item.id, prevItem);
        return nextItems;
      });
    };
    return unmergeItem;
  };
  const registerItem = (item) => mergeItem(
    item,
    (getItems) => privateStore.setState("items", getItems),
    true
  );
  return _chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues({}, collection), {
    registerItem,
    renderItem: (item) => chain(
      registerItem(item),
      mergeItem(
        item,
        (getItems) => privateStore.setState("renderedItems", getItems)
      )
    ),
    item: (id) => {
      if (!id) return null;
      let item = itemsMap.get(id);
      if (!item) {
        const { items: items2 } = privateStore.getState();
        item = items2.find((item2) => item2.id === id);
        if (item) {
          itemsMap.set(id, item);
        }
      }
      return item || null;
    },
    // @ts-expect-error Internal
    __unstablePrivateStore: privateStore
  });
}



;// ./node_modules/@ariakit/core/esm/__chunks/7PRQYBBV.js
"use client";

// src/utils/array.ts
function toArray(arg) {
  if (Array.isArray(arg)) {
    return arg;
  }
  return typeof arg !== "undefined" ? [arg] : [];
}
function addItemToArray(array, item, index = -1) {
  if (!(index in array)) {
    return [...array, item];
  }
  return [...array.slice(0, index), item, ...array.slice(index)];
}
function flatten2DArray(array) {
  const flattened = [];
  for (const row of array) {
    flattened.push(...row);
  }
  return flattened;
}
function reverseArray(array) {
  return array.slice().reverse();
}



;// ./node_modules/@ariakit/core/esm/__chunks/AJZ4BYF3.js
"use client";






// src/composite/composite-store.ts
var NULL_ITEM = { id: null };
function findFirstEnabledItem(items, excludeId) {
  return items.find((item) => {
    if (excludeId) {
      return !item.disabled && item.id !== excludeId;
    }
    return !item.disabled;
  });
}
function getEnabledItems(items, excludeId) {
  return items.filter((item) => {
    if (excludeId) {
      return !item.disabled && item.id !== excludeId;
    }
    return !item.disabled;
  });
}
function getItemsInRow(items, rowId) {
  return items.filter((item) => item.rowId === rowId);
}
function flipItems(items, activeId, shouldInsertNullItem = false) {
  const index = items.findIndex((item) => item.id === activeId);
  return [
    ...items.slice(index + 1),
    ...shouldInsertNullItem ? [NULL_ITEM] : [],
    ...items.slice(0, index)
  ];
}
function groupItemsByRows(items) {
  const rows = [];
  for (const item of items) {
    const row = rows.find((currentRow) => {
      var _a;
      return ((_a = currentRow[0]) == null ? void 0 : _a.rowId) === item.rowId;
    });
    if (row) {
      row.push(item);
    } else {
      rows.push([item]);
    }
  }
  return rows;
}
function getMaxRowLength(array) {
  let maxLength = 0;
  for (const { length } of array) {
    if (length > maxLength) {
      maxLength = length;
    }
  }
  return maxLength;
}
function createEmptyItem(rowId) {
  return {
    id: "__EMPTY_ITEM__",
    disabled: true,
    rowId
  };
}
function normalizeRows(rows, activeId, focusShift) {
  const maxLength = getMaxRowLength(rows);
  for (const row of rows) {
    for (let i = 0; i < maxLength; i += 1) {
      const item = row[i];
      if (!item || focusShift && item.disabled) {
        const isFirst = i === 0;
        const previousItem = isFirst && focusShift ? findFirstEnabledItem(row) : row[i - 1];
        row[i] = previousItem && activeId !== previousItem.id && focusShift ? previousItem : createEmptyItem(previousItem == null ? void 0 : previousItem.rowId);
      }
    }
  }
  return rows;
}
function verticalizeItems(items) {
  const rows = groupItemsByRows(items);
  const maxLength = getMaxRowLength(rows);
  const verticalized = [];
  for (let i = 0; i < maxLength; i += 1) {
    for (const row of rows) {
      const item = row[i];
      if (item) {
        verticalized.push(_chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues({}, item), {
          // If there's no rowId, it means that it's not a grid composite, but
          // a single row instead. So, instead of verticalizing it, that is,
          // assigning a different rowId based on the column index, we keep it
          // undefined so they will be part of the same row. This is useful
          // when using up/down on one-dimensional composites.
          rowId: item.rowId ? `${i}` : void 0
        }));
      }
    }
  }
  return verticalized;
}
function createCompositeStore(props = {}) {
  var _a;
  const syncState = (_a = props.store) == null ? void 0 : _a.getState();
  const collection = createCollectionStore(props);
  const activeId = defaultValue(
    props.activeId,
    syncState == null ? void 0 : syncState.activeId,
    props.defaultActiveId
  );
  const initialState = _chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues({}, collection.getState()), {
    id: defaultValue(
      props.id,
      syncState == null ? void 0 : syncState.id,
      `id-${Math.random().toString(36).slice(2, 8)}`
    ),
    activeId,
    baseElement: defaultValue(syncState == null ? void 0 : syncState.baseElement, null),
    includesBaseElement: defaultValue(
      props.includesBaseElement,
      syncState == null ? void 0 : syncState.includesBaseElement,
      activeId === null
    ),
    moves: defaultValue(syncState == null ? void 0 : syncState.moves, 0),
    orientation: defaultValue(
      props.orientation,
      syncState == null ? void 0 : syncState.orientation,
      "both"
    ),
    rtl: defaultValue(props.rtl, syncState == null ? void 0 : syncState.rtl, false),
    virtualFocus: defaultValue(
      props.virtualFocus,
      syncState == null ? void 0 : syncState.virtualFocus,
      false
    ),
    focusLoop: defaultValue(props.focusLoop, syncState == null ? void 0 : syncState.focusLoop, false),
    focusWrap: defaultValue(props.focusWrap, syncState == null ? void 0 : syncState.focusWrap, false),
    focusShift: defaultValue(props.focusShift, syncState == null ? void 0 : syncState.focusShift, false)
  });
  const composite = createStore(initialState, collection, props.store);
  setup(
    composite,
    () => sync(composite, ["renderedItems", "activeId"], (state) => {
      composite.setState("activeId", (activeId2) => {
        var _a2;
        if (activeId2 !== void 0) return activeId2;
        return (_a2 = findFirstEnabledItem(state.renderedItems)) == null ? void 0 : _a2.id;
      });
    })
  );
  const getNextId = (direction = "next", options = {}) => {
    var _a2, _b;
    const defaultState = composite.getState();
    const {
      skip = 0,
      activeId: activeId2 = defaultState.activeId,
      focusShift = defaultState.focusShift,
      focusLoop = defaultState.focusLoop,
      focusWrap = defaultState.focusWrap,
      includesBaseElement = defaultState.includesBaseElement,
      renderedItems = defaultState.renderedItems,
      rtl = defaultState.rtl
    } = options;
    const isVerticalDirection = direction === "up" || direction === "down";
    const isNextDirection = direction === "next" || direction === "down";
    const canReverse = isNextDirection ? rtl && !isVerticalDirection : !rtl || isVerticalDirection;
    const canShift = focusShift && !skip;
    let items = !isVerticalDirection ? renderedItems : flatten2DArray(
      normalizeRows(groupItemsByRows(renderedItems), activeId2, canShift)
    );
    items = canReverse ? reverseArray(items) : items;
    items = isVerticalDirection ? verticalizeItems(items) : items;
    if (activeId2 == null) {
      return (_a2 = findFirstEnabledItem(items)) == null ? void 0 : _a2.id;
    }
    const activeItem = items.find((item) => item.id === activeId2);
    if (!activeItem) {
      return (_b = findFirstEnabledItem(items)) == null ? void 0 : _b.id;
    }
    const isGrid = items.some((item) => item.rowId);
    const activeIndex = items.indexOf(activeItem);
    const nextItems = items.slice(activeIndex + 1);
    const nextItemsInRow = getItemsInRow(nextItems, activeItem.rowId);
    if (skip) {
      const nextEnabledItemsInRow = getEnabledItems(nextItemsInRow, activeId2);
      const nextItem2 = nextEnabledItemsInRow.slice(skip)[0] || // If we can't find an item, just return the last one.
      nextEnabledItemsInRow[nextEnabledItemsInRow.length - 1];
      return nextItem2 == null ? void 0 : nextItem2.id;
    }
    const canLoop = focusLoop && (isVerticalDirection ? focusLoop !== "horizontal" : focusLoop !== "vertical");
    const canWrap = isGrid && focusWrap && (isVerticalDirection ? focusWrap !== "horizontal" : focusWrap !== "vertical");
    const hasNullItem = isNextDirection ? (!isGrid || isVerticalDirection) && canLoop && includesBaseElement : isVerticalDirection ? includesBaseElement : false;
    if (canLoop) {
      const loopItems = canWrap && !hasNullItem ? items : getItemsInRow(items, activeItem.rowId);
      const sortedItems = flipItems(loopItems, activeId2, hasNullItem);
      const nextItem2 = findFirstEnabledItem(sortedItems, activeId2);
      return nextItem2 == null ? void 0 : nextItem2.id;
    }
    if (canWrap) {
      const nextItem2 = findFirstEnabledItem(
        // We can use nextItems, which contains all the next items, including
        // items from other rows, to wrap between rows. However, if there is a
        // null item (the composite container), we'll only use the next items in
        // the row. So moving next from the last item will focus on the
        // composite container. On grid composites, horizontal navigation never
        // focuses on the composite container, only vertical.
        hasNullItem ? nextItemsInRow : nextItems,
        activeId2
      );
      const nextId = hasNullItem ? (nextItem2 == null ? void 0 : nextItem2.id) || null : nextItem2 == null ? void 0 : nextItem2.id;
      return nextId;
    }
    const nextItem = findFirstEnabledItem(nextItemsInRow, activeId2);
    if (!nextItem && hasNullItem) {
      return null;
    }
    return nextItem == null ? void 0 : nextItem.id;
  };
  return _chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues(_chunks_3YLGPPWQ_spreadValues({}, collection), composite), {
    setBaseElement: (element) => composite.setState("baseElement", element),
    setActiveId: (id) => composite.setState("activeId", id),
    move: (id) => {
      if (id === void 0) return;
      composite.setState("activeId", id);
      composite.setState("moves", (moves) => moves + 1);
    },
    first: () => {
      var _a2;
      return (_a2 = findFirstEnabledItem(composite.getState().renderedItems)) == null ? void 0 : _a2.id;
    },
    last: () => {
      var _a2;
      return (_a2 = findFirstEnabledItem(reverseArray(composite.getState().renderedItems))) == null ? void 0 : _a2.id;
    },
    next: (options) => {
      if (options !== void 0 && typeof options === "number") {
        options = { skip: options };
      }
      return getNextId("next", options);
    },
    previous: (options) => {
      if (options !== void 0 && typeof options === "number") {
        options = { skip: options };
      }
      return getNextId("previous", options);
    },
    down: (options) => {
      if (options !== void 0 && typeof options === "number") {
        options = { skip: options };
      }
      return getNextId("down", options);
    },
    up: (options) => {
      if (options !== void 0 && typeof options === "number") {
        options = { skip: options };
      }
      return getNextId("up", options);
    }
  });
}



;// ./node_modules/@ariakit/core/esm/__chunks/RCQ5P4YE.js
"use client";




// src/disclosure/disclosure-store.ts
function createDisclosureStore(props = {}) {
  const store = mergeStore(
    props.store,
    omit2(props.disclosure, ["contentElement", "disclosureElement"])
  );
  throwOnConflictingProps(props, store);
  const syncState = store == null ? void 0 : store.getState();
  const open = defaultValue(
    props.open,
    syncState == null ? void 0 : syncState.open,
    props.defaultOpen,
    false
  );
  const animated = defaultValue(props.animated, syncState == null ? void 0 : syncState.animated, false);
  const initialState = {
    open,
    animated,
    animating: !!animated && open,
    mounted: open,
    contentElement: defaultValue(syncState == null ? void 0 : syncState.contentElement, null),
    disclosureElement: defaultValue(syncState == null ? void 0 : syncState.disclosureElement, null)
  };
  const disclosure = createStore(initialState, store);
  setup(
    disclosure,
    () => sync(disclosure, ["animated", "animating"], (state) => {
      if (state.animated) return;
      disclosure.setState("animating", false);
    })
  );
  setup(
    disclosure,
    () => subscribe(disclosure, ["open"], () => {
      if (!disclosure.getState().animated) return;
      disclosure.setState("animating", true);
    })
  );
  setup(
    disclosure,
    () => sync(disclosure, ["open", "animating"], (state) => {
      disclosure.setState("mounted", state.open || state.animating);
    })
  );
  return _chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues({}, disclosure), {
    disclosure: props.disclosure,
    setOpen: (value) => disclosure.setState("open", value),
    show: () => disclosure.setState("open", true),
    hide: () => disclosure.setState("open", false),
    toggle: () => disclosure.setState("open", (open2) => !open2),
    stopAnimation: () => disclosure.setState("animating", false),
    setContentElement: (value) => disclosure.setState("contentElement", value),
    setDisclosureElement: (value) => disclosure.setState("disclosureElement", value)
  });
}



;// ./node_modules/@ariakit/core/esm/__chunks/FZZ2AVHF.js
"use client";


// src/dialog/dialog-store.ts
function createDialogStore(props = {}) {
  return createDisclosureStore(props);
}



;// ./node_modules/@ariakit/core/esm/__chunks/ME2CUF3F.js
"use client";





// src/popover/popover-store.ts
function createPopoverStore(_a = {}) {
  var _b = _a, {
    popover: otherPopover
  } = _b, props = _3YLGPPWQ_objRest(_b, [
    "popover"
  ]);
  const store = mergeStore(
    props.store,
    omit2(otherPopover, [
      "arrowElement",
      "anchorElement",
      "contentElement",
      "popoverElement",
      "disclosureElement"
    ])
  );
  throwOnConflictingProps(props, store);
  const syncState = store == null ? void 0 : store.getState();
  const dialog = createDialogStore(_chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues({}, props), { store }));
  const placement = defaultValue(
    props.placement,
    syncState == null ? void 0 : syncState.placement,
    "bottom"
  );
  const initialState = _chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues({}, dialog.getState()), {
    placement,
    currentPlacement: placement,
    anchorElement: defaultValue(syncState == null ? void 0 : syncState.anchorElement, null),
    popoverElement: defaultValue(syncState == null ? void 0 : syncState.popoverElement, null),
    arrowElement: defaultValue(syncState == null ? void 0 : syncState.arrowElement, null),
    rendered: Symbol("rendered")
  });
  const popover = createStore(initialState, dialog, store);
  return _chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues(_chunks_3YLGPPWQ_spreadValues({}, dialog), popover), {
    setAnchorElement: (element) => popover.setState("anchorElement", element),
    setPopoverElement: (element) => popover.setState("popoverElement", element),
    setArrowElement: (element) => popover.setState("arrowElement", element),
    render: () => popover.setState("rendered", Symbol("rendered"))
  });
}



;// ./node_modules/@ariakit/core/esm/combobox/combobox-store.js
"use client";












// src/combobox/combobox-store.ts
var isTouchSafari = isSafari() && isTouchDevice();
function createComboboxStore(_a = {}) {
  var _b = _a, {
    tag
  } = _b, props = _3YLGPPWQ_objRest(_b, [
    "tag"
  ]);
  const store = mergeStore(props.store, pick2(tag, ["value", "rtl"]));
  throwOnConflictingProps(props, store);
  const tagState = tag == null ? void 0 : tag.getState();
  const syncState = store == null ? void 0 : store.getState();
  const activeId = defaultValue(
    props.activeId,
    syncState == null ? void 0 : syncState.activeId,
    props.defaultActiveId,
    null
  );
  const composite = createCompositeStore(_chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues({}, props), {
    activeId,
    includesBaseElement: defaultValue(
      props.includesBaseElement,
      syncState == null ? void 0 : syncState.includesBaseElement,
      true
    ),
    orientation: defaultValue(
      props.orientation,
      syncState == null ? void 0 : syncState.orientation,
      "vertical"
    ),
    focusLoop: defaultValue(props.focusLoop, syncState == null ? void 0 : syncState.focusLoop, true),
    focusWrap: defaultValue(props.focusWrap, syncState == null ? void 0 : syncState.focusWrap, true),
    virtualFocus: defaultValue(
      props.virtualFocus,
      syncState == null ? void 0 : syncState.virtualFocus,
      true
    )
  }));
  const popover = createPopoverStore(_chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues({}, props), {
    placement: defaultValue(
      props.placement,
      syncState == null ? void 0 : syncState.placement,
      "bottom-start"
    )
  }));
  const value = defaultValue(
    props.value,
    syncState == null ? void 0 : syncState.value,
    props.defaultValue,
    ""
  );
  const selectedValue = defaultValue(
    props.selectedValue,
    syncState == null ? void 0 : syncState.selectedValue,
    tagState == null ? void 0 : tagState.values,
    props.defaultSelectedValue,
    ""
  );
  const multiSelectable = Array.isArray(selectedValue);
  const initialState = _chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues(_chunks_3YLGPPWQ_spreadValues({}, composite.getState()), popover.getState()), {
    value,
    selectedValue,
    resetValueOnSelect: defaultValue(
      props.resetValueOnSelect,
      syncState == null ? void 0 : syncState.resetValueOnSelect,
      multiSelectable
    ),
    resetValueOnHide: defaultValue(
      props.resetValueOnHide,
      syncState == null ? void 0 : syncState.resetValueOnHide,
      multiSelectable && !tag
    ),
    activeValue: syncState == null ? void 0 : syncState.activeValue
  });
  const combobox = createStore(initialState, composite, popover, store);
  if (isTouchSafari) {
    setup(
      combobox,
      () => sync(combobox, ["virtualFocus"], () => {
        combobox.setState("virtualFocus", false);
      })
    );
  }
  setup(combobox, () => {
    if (!tag) return;
    return chain(
      sync(combobox, ["selectedValue"], (state) => {
        if (!Array.isArray(state.selectedValue)) return;
        tag.setValues(state.selectedValue);
      }),
      sync(tag, ["values"], (state) => {
        combobox.setState("selectedValue", state.values);
      })
    );
  });
  setup(
    combobox,
    () => sync(combobox, ["resetValueOnHide", "mounted"], (state) => {
      if (!state.resetValueOnHide) return;
      if (state.mounted) return;
      combobox.setState("value", value);
    })
  );
  setup(
    combobox,
    () => sync(combobox, ["open"], (state) => {
      if (state.open) return;
      combobox.setState("activeId", activeId);
      combobox.setState("moves", 0);
    })
  );
  setup(
    combobox,
    () => sync(combobox, ["moves", "activeId"], (state, prevState) => {
      if (state.moves === prevState.moves) {
        combobox.setState("activeValue", void 0);
      }
    })
  );
  setup(
    combobox,
    () => batch(combobox, ["moves", "renderedItems"], (state, prev) => {
      if (state.moves === prev.moves) return;
      const { activeId: activeId2 } = combobox.getState();
      const activeItem = composite.item(activeId2);
      combobox.setState("activeValue", activeItem == null ? void 0 : activeItem.value);
    })
  );
  return _chunks_3YLGPPWQ_spreadProps(_chunks_3YLGPPWQ_spreadValues(_chunks_3YLGPPWQ_spreadValues(_chunks_3YLGPPWQ_spreadValues({}, popover), composite), combobox), {
    tag,
    setValue: (value2) => combobox.setState("value", value2),
    resetValue: () => combobox.setState("value", initialState.value),
    setSelectedValue: (selectedValue2) => combobox.setState("selectedValue", selectedValue2)
  });
}


;// ./node_modules/@ariakit/react-core/esm/__chunks/FEOFMWBY.js
"use client";







// src/combobox/combobox-store.ts

function useComboboxStoreOptions(props) {
  const tag = useTagContext();
  props = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, props), {
    tag: props.tag !== void 0 ? props.tag : tag
  });
  return useCompositeStoreOptions(props);
}
function useComboboxStoreProps(store, update, props) {
  useUpdateEffect(update, [props.tag]);
  useStoreProps(store, props, "value", "setValue");
  useStoreProps(store, props, "selectedValue", "setSelectedValue");
  useStoreProps(store, props, "resetValueOnHide");
  useStoreProps(store, props, "resetValueOnSelect");
  return Object.assign(
    useCompositeStoreProps(
      usePopoverStoreProps(store, update, props),
      update,
      props
    ),
    { tag: props.tag }
  );
}
function useComboboxStore(props = {}) {
  props = useComboboxStoreOptions(props);
  const [store, update] = YV4JVR4I_useStore(createComboboxStore, props);
  return useComboboxStoreProps(store, update, props);
}



;// ./node_modules/@ariakit/react-core/esm/__chunks/S6EF7IVO.js
"use client";


// src/disclosure/disclosure-context.tsx
var S6EF7IVO_ctx = createStoreContext();
var useDisclosureContext = S6EF7IVO_ctx.useContext;
var useDisclosureScopedContext = S6EF7IVO_ctx.useScopedContext;
var useDisclosureProviderContext = S6EF7IVO_ctx.useProviderContext;
var DisclosureContextProvider = S6EF7IVO_ctx.ContextProvider;
var DisclosureScopedContextProvider = S6EF7IVO_ctx.ScopedContextProvider;



;// ./node_modules/@ariakit/react-core/esm/__chunks/RS7LB2H4.js
"use client";



// src/dialog/dialog-context.tsx

var RS7LB2H4_ctx = createStoreContext(
  [DisclosureContextProvider],
  [DisclosureScopedContextProvider]
);
var useDialogContext = RS7LB2H4_ctx.useContext;
var useDialogScopedContext = RS7LB2H4_ctx.useScopedContext;
var useDialogProviderContext = RS7LB2H4_ctx.useProviderContext;
var DialogContextProvider = RS7LB2H4_ctx.ContextProvider;
var DialogScopedContextProvider = RS7LB2H4_ctx.ScopedContextProvider;
var DialogHeadingContext = (0,external_React_.createContext)(void 0);
var DialogDescriptionContext = (0,external_React_.createContext)(void 0);



;// ./node_modules/@ariakit/react-core/esm/__chunks/MTZPJQMC.js
"use client";



// src/popover/popover-context.tsx
var MTZPJQMC_ctx = createStoreContext(
  [DialogContextProvider],
  [DialogScopedContextProvider]
);
var usePopoverContext = MTZPJQMC_ctx.useContext;
var usePopoverScopedContext = MTZPJQMC_ctx.useScopedContext;
var usePopoverProviderContext = MTZPJQMC_ctx.useProviderContext;
var PopoverContextProvider = MTZPJQMC_ctx.ContextProvider;
var PopoverScopedContextProvider = MTZPJQMC_ctx.ScopedContextProvider;



;// ./node_modules/@ariakit/react-core/esm/__chunks/VEVQD5MH.js
"use client";




// src/combobox/combobox-context.tsx

var ComboboxListRoleContext = (0,external_React_.createContext)(
  void 0
);
var VEVQD5MH_ctx = createStoreContext(
  [PopoverContextProvider, CompositeContextProvider],
  [PopoverScopedContextProvider, CompositeScopedContextProvider]
);
var useComboboxContext = VEVQD5MH_ctx.useContext;
var useComboboxScopedContext = VEVQD5MH_ctx.useScopedContext;
var useComboboxProviderContext = VEVQD5MH_ctx.useProviderContext;
var ComboboxContextProvider = VEVQD5MH_ctx.ContextProvider;
var ComboboxScopedContextProvider = VEVQD5MH_ctx.ScopedContextProvider;
var ComboboxItemValueContext = (0,external_React_.createContext)(
  void 0
);
var ComboboxItemCheckedContext = (0,external_React_.createContext)(false);



;// ./node_modules/@ariakit/react-core/esm/combobox/combobox-provider.js
"use client";



















// src/combobox/combobox-provider.tsx

function ComboboxProvider(props = {}) {
  const store = useComboboxStore(props);
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ComboboxContextProvider, { value: store, children: props.children });
}


;// ./node_modules/@ariakit/react-core/esm/combobox/combobox-label.js
"use client";











// src/combobox/combobox-label.tsx

var TagName = "label";
var useComboboxLabel = createHook(
  function useComboboxLabel2(_a) {
    var _b = _a, { store } = _b, props = __objRest(_b, ["store"]);
    const context = useComboboxProviderContext();
    store = store || context;
    invariant(
      store,
       false && 0
    );
    const comboboxId = store.useState((state) => {
      var _a2;
      return (_a2 = state.baseElement) == null ? void 0 : _a2.id;
    });
    props = _3YLGPPWQ_spreadValues({
      htmlFor: comboboxId
    }, props);
    return removeUndefinedValues(props);
  }
);
var ComboboxLabel = memo2(
  forwardRef2(function ComboboxLabel2(props) {
    const htmlProps = useComboboxLabel(props);
    return createElement(TagName, htmlProps);
  })
);


;// ./node_modules/@ariakit/react-core/esm/__chunks/OMU7RWRV.js
"use client";





// src/popover/popover-anchor.tsx
var OMU7RWRV_TagName = "div";
var usePopoverAnchor = createHook(
  function usePopoverAnchor2(_a) {
    var _b = _a, { store } = _b, props = __objRest(_b, ["store"]);
    const context = usePopoverProviderContext();
    store = store || context;
    props = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, props), {
      ref: useMergeRefs(store == null ? void 0 : store.setAnchorElement, props.ref)
    });
    return props;
  }
);
var PopoverAnchor = forwardRef2(function PopoverAnchor2(props) {
  const htmlProps = usePopoverAnchor(props);
  return createElement(OMU7RWRV_TagName, htmlProps);
});



;// ./node_modules/@ariakit/react-core/esm/__chunks/5VQZOHHZ.js
"use client";

// src/composite/utils.ts

var _5VQZOHHZ_NULL_ITEM = { id: null };
function _5VQZOHHZ_flipItems(items, activeId, shouldInsertNullItem = false) {
  const index = items.findIndex((item) => item.id === activeId);
  return [
    ...items.slice(index + 1),
    ...shouldInsertNullItem ? [_5VQZOHHZ_NULL_ITEM] : [],
    ...items.slice(0, index)
  ];
}
function _5VQZOHHZ_findFirstEnabledItem(items, excludeId) {
  return items.find((item) => {
    if (excludeId) {
      return !item.disabled && item.id !== excludeId;
    }
    return !item.disabled;
  });
}
function getEnabledItem(store, id) {
  if (!id) return null;
  return store.item(id) || null;
}
function _5VQZOHHZ_groupItemsByRows(items) {
  const rows = [];
  for (const item of items) {
    const row = rows.find((currentRow) => {
      var _a;
      return ((_a = currentRow[0]) == null ? void 0 : _a.rowId) === item.rowId;
    });
    if (row) {
      row.push(item);
    } else {
      rows.push([item]);
    }
  }
  return rows;
}
function selectTextField(element, collapseToEnd = false) {
  if (isTextField(element)) {
    element.setSelectionRange(
      collapseToEnd ? element.value.length : 0,
      element.value.length
    );
  } else if (element.isContentEditable) {
    const selection = getDocument(element).getSelection();
    selection == null ? void 0 : selection.selectAllChildren(element);
    if (collapseToEnd) {
      selection == null ? void 0 : selection.collapseToEnd();
    }
  }
}
var FOCUS_SILENTLY = Symbol("FOCUS_SILENTLY");
function focusSilently(element) {
  element[FOCUS_SILENTLY] = true;
  element.focus({ preventScroll: true });
}
function silentlyFocused(element) {
  const isSilentlyFocused = element[FOCUS_SILENTLY];
  delete element[FOCUS_SILENTLY];
  return isSilentlyFocused;
}
function isItem(store, element, exclude) {
  if (!element) return false;
  if (element === exclude) return false;
  const item = store.item(element.id);
  if (!item) return false;
  if (exclude && item.element === exclude) return false;
  return true;
}



;// ./node_modules/@ariakit/react-core/esm/__chunks/SWN3JYXT.js
"use client";

// src/focusable/focusable-context.tsx

var FocusableContext = (0,external_React_.createContext)(true);



;// ./node_modules/@ariakit/core/esm/utils/focus.js
"use client";



// src/utils/focus.ts
var selector = "input:not([type='hidden']):not([disabled]), select:not([disabled]), textarea:not([disabled]), a[href], button:not([disabled]), [tabindex], summary, iframe, object, embed, area[href], audio[controls], video[controls], [contenteditable]:not([contenteditable='false'])";
function hasNegativeTabIndex(element) {
  const tabIndex = Number.parseInt(element.getAttribute("tabindex") || "0", 10);
  return tabIndex < 0;
}
function isFocusable(element) {
  if (!element.matches(selector)) return false;
  if (!isVisible(element)) return false;
  if (element.closest("[inert]")) return false;
  return true;
}
function isTabbable(element) {
  if (!isFocusable(element)) return false;
  if (hasNegativeTabIndex(element)) return false;
  if (!("form" in element)) return true;
  if (!element.form) return true;
  if (element.checked) return true;
  if (element.type !== "radio") return true;
  const radioGroup = element.form.elements.namedItem(element.name);
  if (!radioGroup) return true;
  if (!("length" in radioGroup)) return true;
  const activeElement = getActiveElement(element);
  if (!activeElement) return true;
  if (activeElement === element) return true;
  if (!("form" in activeElement)) return true;
  if (activeElement.form !== element.form) return true;
  if (activeElement.name !== element.name) return true;
  return false;
}
function getAllFocusableIn(container, includeContainer) {
  const elements = Array.from(
    container.querySelectorAll(selector)
  );
  if (includeContainer) {
    elements.unshift(container);
  }
  const focusableElements = elements.filter(isFocusable);
  focusableElements.forEach((element, i) => {
    if (isFrame(element) && element.contentDocument) {
      const frameBody = element.contentDocument.body;
      focusableElements.splice(i, 1, ...getAllFocusableIn(frameBody));
    }
  });
  return focusableElements;
}
function getAllFocusable(includeBody) {
  return getAllFocusableIn(document.body, includeBody);
}
function getFirstFocusableIn(container, includeContainer) {
  const [first] = getAllFocusableIn(container, includeContainer);
  return first || null;
}
function getFirstFocusable(includeBody) {
  return getFirstFocusableIn(document.body, includeBody);
}
function getAllTabbableIn(container, includeContainer, fallbackToFocusable) {
  const elements = Array.from(
    container.querySelectorAll(selector)
  );
  const tabbableElements = elements.filter(isTabbable);
  if (includeContainer && isTabbable(container)) {
    tabbableElements.unshift(container);
  }
  tabbableElements.forEach((element, i) => {
    if (isFrame(element) && element.contentDocument) {
      const frameBody = element.contentDocument.body;
      const allFrameTabbable = getAllTabbableIn(
        frameBody,
        false,
        fallbackToFocusable
      );
      tabbableElements.splice(i, 1, ...allFrameTabbable);
    }
  });
  if (!tabbableElements.length && fallbackToFocusable) {
    return elements;
  }
  return tabbableElements;
}
function getAllTabbable(fallbackToFocusable) {
  return getAllTabbableIn(document.body, false, fallbackToFocusable);
}
function getFirstTabbableIn(container, includeContainer, fallbackToFocusable) {
  const [first] = getAllTabbableIn(
    container,
    includeContainer,
    fallbackToFocusable
  );
  return first || null;
}
function getFirstTabbable(fallbackToFocusable) {
  return getFirstTabbableIn(document.body, false, fallbackToFocusable);
}
function getLastTabbableIn(container, includeContainer, fallbackToFocusable) {
  const allTabbable = getAllTabbableIn(
    container,
    includeContainer,
    fallbackToFocusable
  );
  return allTabbable[allTabbable.length - 1] || null;
}
function getLastTabbable(fallbackToFocusable) {
  return getLastTabbableIn(document.body, false, fallbackToFocusable);
}
function getNextTabbableIn(container, includeContainer, fallbackToFirst, fallbackToFocusable) {
  const activeElement = getActiveElement(container);
  const allFocusable = getAllFocusableIn(container, includeContainer);
  const activeIndex = allFocusable.indexOf(activeElement);
  const nextFocusableElements = allFocusable.slice(activeIndex + 1);
  return nextFocusableElements.find(isTabbable) || (fallbackToFirst ? allFocusable.find(isTabbable) : null) || (fallbackToFocusable ? nextFocusableElements[0] : null) || null;
}
function getNextTabbable(fallbackToFirst, fallbackToFocusable) {
  return getNextTabbableIn(
    document.body,
    false,
    fallbackToFirst,
    fallbackToFocusable
  );
}
function getPreviousTabbableIn(container, includeContainer, fallbackToLast, fallbackToFocusable) {
  const activeElement = getActiveElement(container);
  const allFocusable = getAllFocusableIn(container, includeContainer).reverse();
  const activeIndex = allFocusable.indexOf(activeElement);
  const previousFocusableElements = allFocusable.slice(activeIndex + 1);
  return previousFocusableElements.find(isTabbable) || (fallbackToLast ? allFocusable.find(isTabbable) : null) || (fallbackToFocusable ? previousFocusableElements[0] : null) || null;
}
function getPreviousTabbable(fallbackToFirst, fallbackToFocusable) {
  return getPreviousTabbableIn(
    document.body,
    false,
    fallbackToFirst,
    fallbackToFocusable
  );
}
function getClosestFocusable(element) {
  while (element && !isFocusable(element)) {
    element = element.closest(selector);
  }
  return element || null;
}
function hasFocus(element) {
  const activeElement = DTR5TSDJ_getActiveElement(element);
  if (!activeElement) return false;
  if (activeElement === element) return true;
  const activeDescendant = activeElement.getAttribute("aria-activedescendant");
  if (!activeDescendant) return false;
  return activeDescendant === element.id;
}
function hasFocusWithin(element) {
  const activeElement = DTR5TSDJ_getActiveElement(element);
  if (!activeElement) return false;
  if (contains(element, activeElement)) return true;
  const activeDescendant = activeElement.getAttribute("aria-activedescendant");
  if (!activeDescendant) return false;
  if (!("id" in element)) return false;
  if (activeDescendant === element.id) return true;
  return !!element.querySelector(`#${CSS.escape(activeDescendant)}`);
}
function focusIfNeeded(element) {
  if (!hasFocusWithin(element) && isFocusable(element)) {
    element.focus();
  }
}
function disableFocus(element) {
  var _a;
  const currentTabindex = (_a = element.getAttribute("tabindex")) != null ? _a : "";
  element.setAttribute("data-tabindex", currentTabindex);
  element.setAttribute("tabindex", "-1");
}
function disableFocusIn(container, includeContainer) {
  const tabbableElements = getAllTabbableIn(container, includeContainer);
  for (const element of tabbableElements) {
    disableFocus(element);
  }
}
function restoreFocusIn(container) {
  const elements = container.querySelectorAll("[data-tabindex]");
  const restoreTabIndex = (element) => {
    const tabindex = element.getAttribute("data-tabindex");
    element.removeAttribute("data-tabindex");
    if (tabindex) {
      element.setAttribute("tabindex", tabindex);
    } else {
      element.removeAttribute("tabindex");
    }
  };
  if (container.hasAttribute("data-tabindex")) {
    restoreTabIndex(container);
  }
  for (const element of elements) {
    restoreTabIndex(element);
  }
}
function focusIntoView(element, options) {
  if (!("scrollIntoView" in element)) {
    element.focus();
  } else {
    element.focus({ preventScroll: true });
    element.scrollIntoView(_chunks_3YLGPPWQ_spreadValues({ block: "nearest", inline: "nearest" }, options));
  }
}


;// ./node_modules/@ariakit/react-core/esm/__chunks/LVA2YJMS.js
"use client";





// src/focusable/focusable.tsx






var LVA2YJMS_TagName = "div";
var isSafariBrowser = isSafari();
var alwaysFocusVisibleInputTypes = [
  "text",
  "search",
  "url",
  "tel",
  "email",
  "password",
  "number",
  "date",
  "month",
  "week",
  "time",
  "datetime",
  "datetime-local"
];
var safariFocusAncestorSymbol = Symbol("safariFocusAncestor");
function isSafariFocusAncestor(element) {
  if (!element) return false;
  return !!element[safariFocusAncestorSymbol];
}
function markSafariFocusAncestor(element, value) {
  if (!element) return;
  element[safariFocusAncestorSymbol] = value;
}
function isAlwaysFocusVisible(element) {
  const { tagName, readOnly, type } = element;
  if (tagName === "TEXTAREA" && !readOnly) return true;
  if (tagName === "SELECT" && !readOnly) return true;
  if (tagName === "INPUT" && !readOnly) {
    return alwaysFocusVisibleInputTypes.includes(type);
  }
  if (element.isContentEditable) return true;
  const role = element.getAttribute("role");
  if (role === "combobox" && element.dataset.name) {
    return true;
  }
  return false;
}
function getLabels(element) {
  if ("labels" in element) {
    return element.labels;
  }
  return null;
}
function isNativeCheckboxOrRadio(element) {
  const tagName = element.tagName.toLowerCase();
  if (tagName === "input" && element.type) {
    return element.type === "radio" || element.type === "checkbox";
  }
  return false;
}
function isNativeTabbable(tagName) {
  if (!tagName) return true;
  return tagName === "button" || tagName === "summary" || tagName === "input" || tagName === "select" || tagName === "textarea" || tagName === "a";
}
function supportsDisabledAttribute(tagName) {
  if (!tagName) return true;
  return tagName === "button" || tagName === "input" || tagName === "select" || tagName === "textarea";
}
function getTabIndex(focusable, trulyDisabled, nativeTabbable, supportsDisabled, tabIndexProp) {
  if (!focusable) {
    return tabIndexProp;
  }
  if (trulyDisabled) {
    if (nativeTabbable && !supportsDisabled) {
      return -1;
    }
    return;
  }
  if (nativeTabbable) {
    return tabIndexProp;
  }
  return tabIndexProp || 0;
}
function useDisableEvent(onEvent, disabled) {
  return useEvent((event) => {
    onEvent == null ? void 0 : onEvent(event);
    if (event.defaultPrevented) return;
    if (disabled) {
      event.stopPropagation();
      event.preventDefault();
    }
  });
}
var isKeyboardModality = true;
function onGlobalMouseDown(event) {
  const target = event.target;
  if (target && "hasAttribute" in target) {
    if (!target.hasAttribute("data-focus-visible")) {
      isKeyboardModality = false;
    }
  }
}
function onGlobalKeyDown(event) {
  if (event.metaKey) return;
  if (event.ctrlKey) return;
  if (event.altKey) return;
  isKeyboardModality = true;
}
var useFocusable = createHook(
  function useFocusable2(_a) {
    var _b = _a, {
      focusable = true,
      accessibleWhenDisabled,
      autoFocus,
      onFocusVisible
    } = _b, props = __objRest(_b, [
      "focusable",
      "accessibleWhenDisabled",
      "autoFocus",
      "onFocusVisible"
    ]);
    const ref = (0,external_React_.useRef)(null);
    (0,external_React_.useEffect)(() => {
      if (!focusable) return;
      addGlobalEventListener("mousedown", onGlobalMouseDown, true);
      addGlobalEventListener("keydown", onGlobalKeyDown, true);
    }, [focusable]);
    if (isSafariBrowser) {
      (0,external_React_.useEffect)(() => {
        if (!focusable) return;
        const element = ref.current;
        if (!element) return;
        if (!isNativeCheckboxOrRadio(element)) return;
        const labels = getLabels(element);
        if (!labels) return;
        const onMouseUp = () => queueMicrotask(() => element.focus());
        for (const label of labels) {
          label.addEventListener("mouseup", onMouseUp);
        }
        return () => {
          for (const label of labels) {
            label.removeEventListener("mouseup", onMouseUp);
          }
        };
      }, [focusable]);
    }
    const disabled = focusable && disabledFromProps(props);
    const trulyDisabled = !!disabled && !accessibleWhenDisabled;
    const [focusVisible, setFocusVisible] = (0,external_React_.useState)(false);
    (0,external_React_.useEffect)(() => {
      if (!focusable) return;
      if (trulyDisabled && focusVisible) {
        setFocusVisible(false);
      }
    }, [focusable, trulyDisabled, focusVisible]);
    (0,external_React_.useEffect)(() => {
      if (!focusable) return;
      if (!focusVisible) return;
      const element = ref.current;
      if (!element) return;
      if (typeof IntersectionObserver === "undefined") return;
      const observer = new IntersectionObserver(() => {
        if (!isFocusable(element)) {
          setFocusVisible(false);
        }
      });
      observer.observe(element);
      return () => observer.disconnect();
    }, [focusable, focusVisible]);
    const onKeyPressCapture = useDisableEvent(
      props.onKeyPressCapture,
      disabled
    );
    const onMouseDownCapture = useDisableEvent(
      props.onMouseDownCapture,
      disabled
    );
    const onClickCapture = useDisableEvent(props.onClickCapture, disabled);
    const onMouseDownProp = props.onMouseDown;
    const onMouseDown = useEvent((event) => {
      onMouseDownProp == null ? void 0 : onMouseDownProp(event);
      if (event.defaultPrevented) return;
      if (!focusable) return;
      const element = event.currentTarget;
      if (!isSafariBrowser) return;
      if (isPortalEvent(event)) return;
      if (!isButton(element) && !isNativeCheckboxOrRadio(element)) return;
      let receivedFocus = false;
      const onFocus = () => {
        receivedFocus = true;
      };
      const options = { capture: true, once: true };
      element.addEventListener("focusin", onFocus, options);
      const focusableContainer = getClosestFocusable(element.parentElement);
      markSafariFocusAncestor(focusableContainer, true);
      queueBeforeEvent(element, "mouseup", () => {
        element.removeEventListener("focusin", onFocus, true);
        markSafariFocusAncestor(focusableContainer, false);
        if (receivedFocus) return;
        focusIfNeeded(element);
      });
    });
    const handleFocusVisible = (event, currentTarget) => {
      if (currentTarget) {
        event.currentTarget = currentTarget;
      }
      if (!focusable) return;
      const element = event.currentTarget;
      if (!element) return;
      if (!hasFocus(element)) return;
      onFocusVisible == null ? void 0 : onFocusVisible(event);
      if (event.defaultPrevented) return;
      element.dataset.focusVisible = "true";
      setFocusVisible(true);
    };
    const onKeyDownCaptureProp = props.onKeyDownCapture;
    const onKeyDownCapture = useEvent((event) => {
      onKeyDownCaptureProp == null ? void 0 : onKeyDownCaptureProp(event);
      if (event.defaultPrevented) return;
      if (!focusable) return;
      if (focusVisible) return;
      if (event.metaKey) return;
      if (event.altKey) return;
      if (event.ctrlKey) return;
      if (!isSelfTarget(event)) return;
      const element = event.currentTarget;
      const applyFocusVisible = () => handleFocusVisible(event, element);
      queueBeforeEvent(element, "focusout", applyFocusVisible);
    });
    const onFocusCaptureProp = props.onFocusCapture;
    const onFocusCapture = useEvent((event) => {
      onFocusCaptureProp == null ? void 0 : onFocusCaptureProp(event);
      if (event.defaultPrevented) return;
      if (!focusable) return;
      if (!isSelfTarget(event)) {
        setFocusVisible(false);
        return;
      }
      const element = event.currentTarget;
      const applyFocusVisible = () => handleFocusVisible(event, element);
      if (isKeyboardModality || isAlwaysFocusVisible(event.target)) {
        queueBeforeEvent(event.target, "focusout", applyFocusVisible);
      } else {
        setFocusVisible(false);
      }
    });
    const onBlurProp = props.onBlur;
    const onBlur = useEvent((event) => {
      onBlurProp == null ? void 0 : onBlurProp(event);
      if (!focusable) return;
      if (!isFocusEventOutside(event)) return;
      setFocusVisible(false);
    });
    const autoFocusOnShow = (0,external_React_.useContext)(FocusableContext);
    const autoFocusRef = useEvent((element) => {
      if (!focusable) return;
      if (!autoFocus) return;
      if (!element) return;
      if (!autoFocusOnShow) return;
      queueMicrotask(() => {
        if (hasFocus(element)) return;
        if (!isFocusable(element)) return;
        element.focus();
      });
    });
    const tagName = useTagName(ref);
    const nativeTabbable = focusable && isNativeTabbable(tagName);
    const supportsDisabled = focusable && supportsDisabledAttribute(tagName);
    const styleProp = props.style;
    const style = (0,external_React_.useMemo)(() => {
      if (trulyDisabled) {
        return _3YLGPPWQ_spreadValues({ pointerEvents: "none" }, styleProp);
      }
      return styleProp;
    }, [trulyDisabled, styleProp]);
    props = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({
      "data-focus-visible": focusable && focusVisible || void 0,
      "data-autofocus": autoFocus || void 0,
      "aria-disabled": disabled || void 0
    }, props), {
      ref: useMergeRefs(ref, autoFocusRef, props.ref),
      style,
      tabIndex: getTabIndex(
        focusable,
        trulyDisabled,
        nativeTabbable,
        supportsDisabled,
        props.tabIndex
      ),
      disabled: supportsDisabled && trulyDisabled ? true : void 0,
      // TODO: Test Focusable contentEditable.
      contentEditable: disabled ? void 0 : props.contentEditable,
      onKeyPressCapture,
      onClickCapture,
      onMouseDownCapture,
      onMouseDown,
      onKeyDownCapture,
      onFocusCapture,
      onBlur
    });
    return removeUndefinedValues(props);
  }
);
var Focusable = forwardRef2(function Focusable2(props) {
  const htmlProps = useFocusable(props);
  return createElement(LVA2YJMS_TagName, htmlProps);
});



;// ./node_modules/@ariakit/react-core/esm/__chunks/ITI7HKP4.js
"use client";







// src/composite/composite.tsx







var ITI7HKP4_TagName = "div";
function isGrid(items) {
  return items.some((item) => !!item.rowId);
}
function isPrintableKey(event) {
  const target = event.target;
  if (target && !isTextField(target)) return false;
  return event.key.length === 1 && !event.ctrlKey && !event.metaKey;
}
function isModifierKey(event) {
  return event.key === "Shift" || event.key === "Control" || event.key === "Alt" || event.key === "Meta";
}
function useKeyboardEventProxy(store, onKeyboardEvent, previousElementRef) {
  return useEvent((event) => {
    var _a;
    onKeyboardEvent == null ? void 0 : onKeyboardEvent(event);
    if (event.defaultPrevented) return;
    if (event.isPropagationStopped()) return;
    if (!isSelfTarget(event)) return;
    if (isModifierKey(event)) return;
    if (isPrintableKey(event)) return;
    const state = store.getState();
    const activeElement = (_a = getEnabledItem(store, state.activeId)) == null ? void 0 : _a.element;
    if (!activeElement) return;
    const _b = event, { view } = _b, eventInit = __objRest(_b, ["view"]);
    const previousElement = previousElementRef == null ? void 0 : previousElementRef.current;
    if (activeElement !== previousElement) {
      activeElement.focus();
    }
    if (!fireKeyboardEvent(activeElement, event.type, eventInit)) {
      event.preventDefault();
    }
    if (event.currentTarget.contains(activeElement)) {
      event.stopPropagation();
    }
  });
}
function findFirstEnabledItemInTheLastRow(items) {
  return _5VQZOHHZ_findFirstEnabledItem(
    flatten2DArray(reverseArray(_5VQZOHHZ_groupItemsByRows(items)))
  );
}
function useScheduleFocus(store) {
  const [scheduled, setScheduled] = (0,external_React_.useState)(false);
  const schedule = (0,external_React_.useCallback)(() => setScheduled(true), []);
  const activeItem = store.useState(
    (state) => getEnabledItem(store, state.activeId)
  );
  (0,external_React_.useEffect)(() => {
    const activeElement = activeItem == null ? void 0 : activeItem.element;
    if (!scheduled) return;
    if (!activeElement) return;
    setScheduled(false);
    activeElement.focus({ preventScroll: true });
  }, [activeItem, scheduled]);
  return schedule;
}
var useComposite = createHook(
  function useComposite2(_a) {
    var _b = _a, {
      store,
      composite = true,
      focusOnMove = composite,
      moveOnKeyPress = true
    } = _b, props = __objRest(_b, [
      "store",
      "composite",
      "focusOnMove",
      "moveOnKeyPress"
    ]);
    const context = useCompositeProviderContext();
    store = store || context;
    invariant(
      store,
       false && 0
    );
    const ref = (0,external_React_.useRef)(null);
    const previousElementRef = (0,external_React_.useRef)(null);
    const scheduleFocus = useScheduleFocus(store);
    const moves = store.useState("moves");
    const [, setBaseElement] = useTransactionState(
      composite ? store.setBaseElement : null
    );
    (0,external_React_.useEffect)(() => {
      var _a2;
      if (!store) return;
      if (!moves) return;
      if (!composite) return;
      if (!focusOnMove) return;
      const { activeId: activeId2 } = store.getState();
      const itemElement = (_a2 = getEnabledItem(store, activeId2)) == null ? void 0 : _a2.element;
      if (!itemElement) return;
      focusIntoView(itemElement);
    }, [store, moves, composite, focusOnMove]);
    useSafeLayoutEffect(() => {
      if (!store) return;
      if (!moves) return;
      if (!composite) return;
      const { baseElement, activeId: activeId2 } = store.getState();
      const isSelfAcive = activeId2 === null;
      if (!isSelfAcive) return;
      if (!baseElement) return;
      const previousElement = previousElementRef.current;
      previousElementRef.current = null;
      if (previousElement) {
        fireBlurEvent(previousElement, { relatedTarget: baseElement });
      }
      if (!hasFocus(baseElement)) {
        baseElement.focus();
      }
    }, [store, moves, composite]);
    const activeId = store.useState("activeId");
    const virtualFocus = store.useState("virtualFocus");
    useSafeLayoutEffect(() => {
      var _a2;
      if (!store) return;
      if (!composite) return;
      if (!virtualFocus) return;
      const previousElement = previousElementRef.current;
      previousElementRef.current = null;
      if (!previousElement) return;
      const activeElement = (_a2 = getEnabledItem(store, activeId)) == null ? void 0 : _a2.element;
      const relatedTarget = activeElement || DTR5TSDJ_getActiveElement(previousElement);
      if (relatedTarget === previousElement) return;
      fireBlurEvent(previousElement, { relatedTarget });
    }, [store, activeId, virtualFocus, composite]);
    const onKeyDownCapture = useKeyboardEventProxy(
      store,
      props.onKeyDownCapture,
      previousElementRef
    );
    const onKeyUpCapture = useKeyboardEventProxy(
      store,
      props.onKeyUpCapture,
      previousElementRef
    );
    const onFocusCaptureProp = props.onFocusCapture;
    const onFocusCapture = useEvent((event) => {
      onFocusCaptureProp == null ? void 0 : onFocusCaptureProp(event);
      if (event.defaultPrevented) return;
      if (!store) return;
      const { virtualFocus: virtualFocus2 } = store.getState();
      if (!virtualFocus2) return;
      const previousActiveElement = event.relatedTarget;
      const isSilentlyFocused = silentlyFocused(event.currentTarget);
      if (isSelfTarget(event) && isSilentlyFocused) {
        event.stopPropagation();
        previousElementRef.current = previousActiveElement;
      }
    });
    const onFocusProp = props.onFocus;
    const onFocus = useEvent((event) => {
      onFocusProp == null ? void 0 : onFocusProp(event);
      if (event.defaultPrevented) return;
      if (!composite) return;
      if (!store) return;
      const { relatedTarget } = event;
      const { virtualFocus: virtualFocus2 } = store.getState();
      if (virtualFocus2) {
        if (isSelfTarget(event) && !isItem(store, relatedTarget)) {
          queueMicrotask(scheduleFocus);
        }
      } else if (isSelfTarget(event)) {
        store.setActiveId(null);
      }
    });
    const onBlurCaptureProp = props.onBlurCapture;
    const onBlurCapture = useEvent((event) => {
      var _a2;
      onBlurCaptureProp == null ? void 0 : onBlurCaptureProp(event);
      if (event.defaultPrevented) return;
      if (!store) return;
      const { virtualFocus: virtualFocus2, activeId: activeId2 } = store.getState();
      if (!virtualFocus2) return;
      const activeElement = (_a2 = getEnabledItem(store, activeId2)) == null ? void 0 : _a2.element;
      const nextActiveElement = event.relatedTarget;
      const nextActiveElementIsItem = isItem(store, nextActiveElement);
      const previousElement = previousElementRef.current;
      previousElementRef.current = null;
      if (isSelfTarget(event) && nextActiveElementIsItem) {
        if (nextActiveElement === activeElement) {
          if (previousElement && previousElement !== nextActiveElement) {
            fireBlurEvent(previousElement, event);
          }
        } else if (activeElement) {
          fireBlurEvent(activeElement, event);
        } else if (previousElement) {
          fireBlurEvent(previousElement, event);
        }
        event.stopPropagation();
      } else {
        const targetIsItem = isItem(store, event.target);
        if (!targetIsItem && activeElement) {
          fireBlurEvent(activeElement, event);
        }
      }
    });
    const onKeyDownProp = props.onKeyDown;
    const moveOnKeyPressProp = useBooleanEvent(moveOnKeyPress);
    const onKeyDown = useEvent((event) => {
      var _a2;
      onKeyDownProp == null ? void 0 : onKeyDownProp(event);
      if (event.defaultPrevented) return;
      if (!store) return;
      if (!isSelfTarget(event)) return;
      const { orientation, renderedItems, activeId: activeId2 } = store.getState();
      const activeItem = getEnabledItem(store, activeId2);
      if ((_a2 = activeItem == null ? void 0 : activeItem.element) == null ? void 0 : _a2.isConnected) return;
      const isVertical = orientation !== "horizontal";
      const isHorizontal = orientation !== "vertical";
      const grid = isGrid(renderedItems);
      const isHorizontalKey = event.key === "ArrowLeft" || event.key === "ArrowRight" || event.key === "Home" || event.key === "End";
      if (isHorizontalKey && isTextField(event.currentTarget)) return;
      const up = () => {
        if (grid) {
          const item = findFirstEnabledItemInTheLastRow(renderedItems);
          return item == null ? void 0 : item.id;
        }
        return store == null ? void 0 : store.last();
      };
      const keyMap = {
        ArrowUp: (grid || isVertical) && up,
        ArrowRight: (grid || isHorizontal) && store.first,
        ArrowDown: (grid || isVertical) && store.first,
        ArrowLeft: (grid || isHorizontal) && store.last,
        Home: store.first,
        End: store.last,
        PageUp: store.first,
        PageDown: store.last
      };
      const action = keyMap[event.key];
      if (action) {
        const id = action();
        if (id !== void 0) {
          if (!moveOnKeyPressProp(event)) return;
          event.preventDefault();
          store.move(id);
        }
      }
    });
    props = useWrapElement(
      props,
      (element) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(CompositeContextProvider, { value: store, children: element }),
      [store]
    );
    const activeDescendant = store.useState((state) => {
      var _a2;
      if (!store) return;
      if (!composite) return;
      if (!state.virtualFocus) return;
      return (_a2 = getEnabledItem(store, state.activeId)) == null ? void 0 : _a2.id;
    });
    props = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({
      "aria-activedescendant": activeDescendant
    }, props), {
      ref: useMergeRefs(ref, setBaseElement, props.ref),
      onKeyDownCapture,
      onKeyUpCapture,
      onFocusCapture,
      onFocus,
      onBlurCapture,
      onKeyDown
    });
    const focusable = store.useState(
      (state) => composite && (state.virtualFocus || state.activeId === null)
    );
    props = useFocusable(_3YLGPPWQ_spreadValues({ focusable }, props));
    return props;
  }
);
var Composite = forwardRef2(function Composite2(props) {
  const htmlProps = useComposite(props);
  return createElement(ITI7HKP4_TagName, htmlProps);
});



;// ./node_modules/@ariakit/react-core/esm/combobox/combobox.js
"use client";
















// src/combobox/combobox.tsx






var combobox_TagName = "input";
function isFirstItemAutoSelected(items, activeValue, autoSelect) {
  if (!autoSelect) return false;
  const firstItem = items.find((item) => !item.disabled && item.value);
  return (firstItem == null ? void 0 : firstItem.value) === activeValue;
}
function hasCompletionString(value, activeValue) {
  if (!activeValue) return false;
  if (value == null) return false;
  value = PBFD2E7P_normalizeString(value);
  return activeValue.length > value.length && activeValue.toLowerCase().indexOf(value.toLowerCase()) === 0;
}
function isInputEvent(event) {
  return event.type === "input";
}
function isAriaAutoCompleteValue(value) {
  return value === "inline" || value === "list" || value === "both" || value === "none";
}
function getDefaultAutoSelectId(items) {
  const item = items.find((item2) => {
    var _a;
    if (item2.disabled) return false;
    return ((_a = item2.element) == null ? void 0 : _a.getAttribute("role")) !== "tab";
  });
  return item == null ? void 0 : item.id;
}
var useCombobox = createHook(
  function useCombobox2(_a) {
    var _b = _a, {
      store,
      focusable = true,
      autoSelect: autoSelectProp = false,
      getAutoSelectId,
      setValueOnChange,
      showMinLength = 0,
      showOnChange,
      showOnMouseDown,
      showOnClick = showOnMouseDown,
      showOnKeyDown,
      showOnKeyPress = showOnKeyDown,
      blurActiveItemOnClick,
      setValueOnClick = true,
      moveOnKeyPress = true,
      autoComplete = "list"
    } = _b, props = __objRest(_b, [
      "store",
      "focusable",
      "autoSelect",
      "getAutoSelectId",
      "setValueOnChange",
      "showMinLength",
      "showOnChange",
      "showOnMouseDown",
      "showOnClick",
      "showOnKeyDown",
      "showOnKeyPress",
      "blurActiveItemOnClick",
      "setValueOnClick",
      "moveOnKeyPress",
      "autoComplete"
    ]);
    const context = useComboboxProviderContext();
    store = store || context;
    invariant(
      store,
       false && 0
    );
    const ref = (0,external_React_.useRef)(null);
    const [valueUpdated, forceValueUpdate] = useForceUpdate();
    const canAutoSelectRef = (0,external_React_.useRef)(false);
    const composingRef = (0,external_React_.useRef)(false);
    const autoSelect = store.useState(
      (state) => state.virtualFocus && autoSelectProp
    );
    const inline = autoComplete === "inline" || autoComplete === "both";
    const [canInline, setCanInline] = (0,external_React_.useState)(inline);
    useUpdateLayoutEffect(() => {
      if (!inline) return;
      setCanInline(true);
    }, [inline]);
    const storeValue = store.useState("value");
    const prevSelectedValueRef = (0,external_React_.useRef)();
    (0,external_React_.useEffect)(() => {
      return sync(store, ["selectedValue", "activeId"], (_, prev) => {
        prevSelectedValueRef.current = prev.selectedValue;
      });
    }, []);
    const inlineActiveValue = store.useState((state) => {
      var _a2;
      if (!inline) return;
      if (!canInline) return;
      if (state.activeValue && Array.isArray(state.selectedValue)) {
        if (state.selectedValue.includes(state.activeValue)) return;
        if ((_a2 = prevSelectedValueRef.current) == null ? void 0 : _a2.includes(state.activeValue)) return;
      }
      return state.activeValue;
    });
    const items = store.useState("renderedItems");
    const open = store.useState("open");
    const contentElement = store.useState("contentElement");
    const value = (0,external_React_.useMemo)(() => {
      if (!inline) return storeValue;
      if (!canInline) return storeValue;
      const firstItemAutoSelected = isFirstItemAutoSelected(
        items,
        inlineActiveValue,
        autoSelect
      );
      if (firstItemAutoSelected) {
        if (hasCompletionString(storeValue, inlineActiveValue)) {
          const slice = (inlineActiveValue == null ? void 0 : inlineActiveValue.slice(storeValue.length)) || "";
          return storeValue + slice;
        }
        return storeValue;
      }
      return inlineActiveValue || storeValue;
    }, [inline, canInline, items, inlineActiveValue, autoSelect, storeValue]);
    (0,external_React_.useEffect)(() => {
      const element = ref.current;
      if (!element) return;
      const onCompositeItemMove = () => setCanInline(true);
      element.addEventListener("combobox-item-move", onCompositeItemMove);
      return () => {
        element.removeEventListener("combobox-item-move", onCompositeItemMove);
      };
    }, []);
    (0,external_React_.useEffect)(() => {
      if (!inline) return;
      if (!canInline) return;
      if (!inlineActiveValue) return;
      const firstItemAutoSelected = isFirstItemAutoSelected(
        items,
        inlineActiveValue,
        autoSelect
      );
      if (!firstItemAutoSelected) return;
      if (!hasCompletionString(storeValue, inlineActiveValue)) return;
      let cleanup = PBFD2E7P_noop;
      queueMicrotask(() => {
        const element = ref.current;
        if (!element) return;
        const { start: prevStart, end: prevEnd } = getTextboxSelection(element);
        const nextStart = storeValue.length;
        const nextEnd = inlineActiveValue.length;
        setSelectionRange(element, nextStart, nextEnd);
        cleanup = () => {
          if (!hasFocus(element)) return;
          const { start, end } = getTextboxSelection(element);
          if (start !== nextStart) return;
          if (end !== nextEnd) return;
          setSelectionRange(element, prevStart, prevEnd);
        };
      });
      return () => cleanup();
    }, [
      valueUpdated,
      inline,
      canInline,
      inlineActiveValue,
      items,
      autoSelect,
      storeValue
    ]);
    const scrollingElementRef = (0,external_React_.useRef)(null);
    const getAutoSelectIdProp = useEvent(getAutoSelectId);
    const autoSelectIdRef = (0,external_React_.useRef)(null);
    (0,external_React_.useEffect)(() => {
      if (!open) return;
      if (!contentElement) return;
      const scrollingElement = getScrollingElement(contentElement);
      if (!scrollingElement) return;
      scrollingElementRef.current = scrollingElement;
      const onUserScroll = () => {
        canAutoSelectRef.current = false;
      };
      const onScroll = () => {
        if (!store) return;
        if (!canAutoSelectRef.current) return;
        const { activeId } = store.getState();
        if (activeId === null) return;
        if (activeId === autoSelectIdRef.current) return;
        canAutoSelectRef.current = false;
      };
      const options = { passive: true, capture: true };
      scrollingElement.addEventListener("wheel", onUserScroll, options);
      scrollingElement.addEventListener("touchmove", onUserScroll, options);
      scrollingElement.addEventListener("scroll", onScroll, options);
      return () => {
        scrollingElement.removeEventListener("wheel", onUserScroll, true);
        scrollingElement.removeEventListener("touchmove", onUserScroll, true);
        scrollingElement.removeEventListener("scroll", onScroll, true);
      };
    }, [open, contentElement, store]);
    useSafeLayoutEffect(() => {
      if (!storeValue) return;
      if (composingRef.current) return;
      canAutoSelectRef.current = true;
    }, [storeValue]);
    useSafeLayoutEffect(() => {
      if (autoSelect !== "always" && open) return;
      canAutoSelectRef.current = open;
    }, [autoSelect, open]);
    const resetValueOnSelect = store.useState("resetValueOnSelect");
    useUpdateEffect(() => {
      var _a2, _b2;
      const canAutoSelect = canAutoSelectRef.current;
      if (!store) return;
      if (!open) return;
      if (!canAutoSelect && !resetValueOnSelect) return;
      const { baseElement, contentElement: contentElement2, activeId } = store.getState();
      if (baseElement && !hasFocus(baseElement)) return;
      if (contentElement2 == null ? void 0 : contentElement2.hasAttribute("data-placing")) {
        const observer = new MutationObserver(forceValueUpdate);
        observer.observe(contentElement2, { attributeFilter: ["data-placing"] });
        return () => observer.disconnect();
      }
      if (autoSelect && canAutoSelect) {
        const userAutoSelectId = getAutoSelectIdProp(items);
        const autoSelectId = userAutoSelectId !== void 0 ? userAutoSelectId : (_a2 = getDefaultAutoSelectId(items)) != null ? _a2 : store.first();
        autoSelectIdRef.current = autoSelectId;
        store.move(autoSelectId != null ? autoSelectId : null);
      } else {
        const element = (_b2 = store.item(activeId || store.first())) == null ? void 0 : _b2.element;
        if (element && "scrollIntoView" in element) {
          element.scrollIntoView({ block: "nearest", inline: "nearest" });
        }
      }
      return;
    }, [
      store,
      open,
      valueUpdated,
      storeValue,
      autoSelect,
      resetValueOnSelect,
      getAutoSelectIdProp,
      items
    ]);
    (0,external_React_.useEffect)(() => {
      if (!inline) return;
      const combobox = ref.current;
      if (!combobox) return;
      const elements = [combobox, contentElement].filter(
        (value2) => !!value2
      );
      const onBlur2 = (event) => {
        if (elements.every((el) => isFocusEventOutside(event, el))) {
          store == null ? void 0 : store.setValue(value);
        }
      };
      for (const element of elements) {
        element.addEventListener("focusout", onBlur2);
      }
      return () => {
        for (const element of elements) {
          element.removeEventListener("focusout", onBlur2);
        }
      };
    }, [inline, contentElement, store, value]);
    const canShow = (event) => {
      const currentTarget = event.currentTarget;
      return currentTarget.value.length >= showMinLength;
    };
    const onChangeProp = props.onChange;
    const showOnChangeProp = useBooleanEvent(showOnChange != null ? showOnChange : canShow);
    const setValueOnChangeProp = useBooleanEvent(
      // If the combobox is combined with tags, the value will be set by the tag
      // input component.
      setValueOnChange != null ? setValueOnChange : !store.tag
    );
    const onChange = useEvent((event) => {
      onChangeProp == null ? void 0 : onChangeProp(event);
      if (event.defaultPrevented) return;
      if (!store) return;
      const currentTarget = event.currentTarget;
      const { value: value2, selectionStart, selectionEnd } = currentTarget;
      const nativeEvent = event.nativeEvent;
      canAutoSelectRef.current = true;
      if (isInputEvent(nativeEvent)) {
        if (nativeEvent.isComposing) {
          canAutoSelectRef.current = false;
          composingRef.current = true;
        }
        if (inline) {
          const textInserted = nativeEvent.inputType === "insertText" || nativeEvent.inputType === "insertCompositionText";
          const caretAtEnd = selectionStart === value2.length;
          setCanInline(textInserted && caretAtEnd);
        }
      }
      if (setValueOnChangeProp(event)) {
        const isSameValue = value2 === store.getState().value;
        store.setValue(value2);
        queueMicrotask(() => {
          setSelectionRange(currentTarget, selectionStart, selectionEnd);
        });
        if (inline && autoSelect && isSameValue) {
          forceValueUpdate();
        }
      }
      if (showOnChangeProp(event)) {
        store.show();
      }
      if (!autoSelect || !canAutoSelectRef.current) {
        store.setActiveId(null);
      }
    });
    const onCompositionEndProp = props.onCompositionEnd;
    const onCompositionEnd = useEvent((event) => {
      canAutoSelectRef.current = true;
      composingRef.current = false;
      onCompositionEndProp == null ? void 0 : onCompositionEndProp(event);
      if (event.defaultPrevented) return;
      if (!autoSelect) return;
      forceValueUpdate();
    });
    const onMouseDownProp = props.onMouseDown;
    const blurActiveItemOnClickProp = useBooleanEvent(
      blurActiveItemOnClick != null ? blurActiveItemOnClick : () => !!(store == null ? void 0 : store.getState().includesBaseElement)
    );
    const setValueOnClickProp = useBooleanEvent(setValueOnClick);
    const showOnClickProp = useBooleanEvent(showOnClick != null ? showOnClick : canShow);
    const onMouseDown = useEvent((event) => {
      onMouseDownProp == null ? void 0 : onMouseDownProp(event);
      if (event.defaultPrevented) return;
      if (event.button) return;
      if (event.ctrlKey) return;
      if (!store) return;
      if (blurActiveItemOnClickProp(event)) {
        store.setActiveId(null);
      }
      if (setValueOnClickProp(event)) {
        store.setValue(value);
      }
      if (showOnClickProp(event)) {
        queueBeforeEvent(event.currentTarget, "mouseup", store.show);
      }
    });
    const onKeyDownProp = props.onKeyDown;
    const showOnKeyPressProp = useBooleanEvent(showOnKeyPress != null ? showOnKeyPress : canShow);
    const onKeyDown = useEvent((event) => {
      onKeyDownProp == null ? void 0 : onKeyDownProp(event);
      if (!event.repeat) {
        canAutoSelectRef.current = false;
      }
      if (event.defaultPrevented) return;
      if (event.ctrlKey) return;
      if (event.altKey) return;
      if (event.shiftKey) return;
      if (event.metaKey) return;
      if (!store) return;
      const { open: open2 } = store.getState();
      if (open2) return;
      if (event.key === "ArrowUp" || event.key === "ArrowDown") {
        if (showOnKeyPressProp(event)) {
          event.preventDefault();
          store.show();
        }
      }
    });
    const onBlurProp = props.onBlur;
    const onBlur = useEvent((event) => {
      canAutoSelectRef.current = false;
      onBlurProp == null ? void 0 : onBlurProp(event);
      if (event.defaultPrevented) return;
    });
    const id = useId(props.id);
    const ariaAutoComplete = isAriaAutoCompleteValue(autoComplete) ? autoComplete : void 0;
    const isActiveItem = store.useState((state) => state.activeId === null);
    props = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({
      id,
      role: "combobox",
      "aria-autocomplete": ariaAutoComplete,
      "aria-haspopup": getPopupRole(contentElement, "listbox"),
      "aria-expanded": open,
      "aria-controls": contentElement == null ? void 0 : contentElement.id,
      "data-active-item": isActiveItem || void 0,
      value
    }, props), {
      ref: useMergeRefs(ref, props.ref),
      onChange,
      onCompositionEnd,
      onMouseDown,
      onKeyDown,
      onBlur
    });
    props = useComposite(_3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({
      store,
      focusable
    }, props), {
      // Enable inline autocomplete when the user moves from the combobox input
      // to an item.
      moveOnKeyPress: (event) => {
        if (isFalsyBooleanCallback(moveOnKeyPress, event)) return false;
        if (inline) setCanInline(true);
        return true;
      }
    }));
    props = usePopoverAnchor(_3YLGPPWQ_spreadValues({ store }, props));
    return _3YLGPPWQ_spreadValues({ autoComplete: "off" }, props);
  }
);
var Combobox = forwardRef2(function Combobox2(props) {
  const htmlProps = useCombobox(props);
  return createElement(combobox_TagName, htmlProps);
});


;// ./node_modules/@ariakit/react-core/esm/__chunks/VGCJ63VH.js
"use client";







// src/disclosure/disclosure-content.tsx




var VGCJ63VH_TagName = "div";
function afterTimeout(timeoutMs, cb) {
  const timeoutId = setTimeout(cb, timeoutMs);
  return () => clearTimeout(timeoutId);
}
function VGCJ63VH_afterPaint(cb) {
  let raf = requestAnimationFrame(() => {
    raf = requestAnimationFrame(cb);
  });
  return () => cancelAnimationFrame(raf);
}
function parseCSSTime(...times) {
  return times.join(", ").split(", ").reduce((longestTime, currentTimeString) => {
    const multiplier = currentTimeString.endsWith("ms") ? 1 : 1e3;
    const currentTime = Number.parseFloat(currentTimeString || "0s") * multiplier;
    if (currentTime > longestTime) return currentTime;
    return longestTime;
  }, 0);
}
function isHidden(mounted, hidden, alwaysVisible) {
  return !alwaysVisible && hidden !== false && (!mounted || !!hidden);
}
var useDisclosureContent = createHook(function useDisclosureContent2(_a) {
  var _b = _a, { store, alwaysVisible } = _b, props = __objRest(_b, ["store", "alwaysVisible"]);
  const context = useDisclosureProviderContext();
  store = store || context;
  invariant(
    store,
     false && 0
  );
  const ref = (0,external_React_.useRef)(null);
  const id = useId(props.id);
  const [transition, setTransition] = (0,external_React_.useState)(null);
  const open = store.useState("open");
  const mounted = store.useState("mounted");
  const animated = store.useState("animated");
  const contentElement = store.useState("contentElement");
  const otherElement = useStoreState(store.disclosure, "contentElement");
  useSafeLayoutEffect(() => {
    if (!ref.current) return;
    store == null ? void 0 : store.setContentElement(ref.current);
  }, [store]);
  useSafeLayoutEffect(() => {
    let previousAnimated;
    store == null ? void 0 : store.setState("animated", (animated2) => {
      previousAnimated = animated2;
      return true;
    });
    return () => {
      if (previousAnimated === void 0) return;
      store == null ? void 0 : store.setState("animated", previousAnimated);
    };
  }, [store]);
  useSafeLayoutEffect(() => {
    if (!animated) return;
    if (!(contentElement == null ? void 0 : contentElement.isConnected)) {
      setTransition(null);
      return;
    }
    return VGCJ63VH_afterPaint(() => {
      setTransition(open ? "enter" : mounted ? "leave" : null);
    });
  }, [animated, contentElement, open, mounted]);
  useSafeLayoutEffect(() => {
    if (!store) return;
    if (!animated) return;
    if (!transition) return;
    if (!contentElement) return;
    const stopAnimation = () => store == null ? void 0 : store.setState("animating", false);
    const stopAnimationSync = () => (0,external_ReactDOM_namespaceObject.flushSync)(stopAnimation);
    if (transition === "leave" && open) return;
    if (transition === "enter" && !open) return;
    if (typeof animated === "number") {
      const timeout2 = animated;
      return afterTimeout(timeout2, stopAnimationSync);
    }
    const {
      transitionDuration,
      animationDuration,
      transitionDelay,
      animationDelay
    } = getComputedStyle(contentElement);
    const {
      transitionDuration: transitionDuration2 = "0",
      animationDuration: animationDuration2 = "0",
      transitionDelay: transitionDelay2 = "0",
      animationDelay: animationDelay2 = "0"
    } = otherElement ? getComputedStyle(otherElement) : {};
    const delay = parseCSSTime(
      transitionDelay,
      animationDelay,
      transitionDelay2,
      animationDelay2
    );
    const duration = parseCSSTime(
      transitionDuration,
      animationDuration,
      transitionDuration2,
      animationDuration2
    );
    const timeout = delay + duration;
    if (!timeout) {
      if (transition === "enter") {
        store.setState("animated", false);
      }
      stopAnimation();
      return;
    }
    const frameRate = 1e3 / 60;
    const maxTimeout = Math.max(timeout - frameRate, 0);
    return afterTimeout(maxTimeout, stopAnimationSync);
  }, [store, animated, contentElement, otherElement, open, transition]);
  props = useWrapElement(
    props,
    (element) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(DialogScopedContextProvider, { value: store, children: element }),
    [store]
  );
  const hidden = isHidden(mounted, props.hidden, alwaysVisible);
  const styleProp = props.style;
  const style = (0,external_React_.useMemo)(() => {
    if (hidden) {
      return _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, styleProp), { display: "none" });
    }
    return styleProp;
  }, [hidden, styleProp]);
  props = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({
    id,
    "data-open": open || void 0,
    "data-enter": transition === "enter" || void 0,
    "data-leave": transition === "leave" || void 0,
    hidden
  }, props), {
    ref: useMergeRefs(id ? store.setContentElement : null, ref, props.ref),
    style
  });
  return removeUndefinedValues(props);
});
var DisclosureContentImpl = forwardRef2(function DisclosureContentImpl2(props) {
  const htmlProps = useDisclosureContent(props);
  return createElement(VGCJ63VH_TagName, htmlProps);
});
var DisclosureContent = forwardRef2(function DisclosureContent2(_a) {
  var _b = _a, {
    unmountOnHide
  } = _b, props = __objRest(_b, [
    "unmountOnHide"
  ]);
  const context = useDisclosureProviderContext();
  const store = props.store || context;
  const mounted = useStoreState(
    store,
    (state) => !unmountOnHide || (state == null ? void 0 : state.mounted)
  );
  if (mounted === false) return null;
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(DisclosureContentImpl, _3YLGPPWQ_spreadValues({}, props));
});



;// ./node_modules/@ariakit/react-core/esm/__chunks/HUWAI7RB.js
"use client";






// src/combobox/combobox-list.tsx



var HUWAI7RB_TagName = "div";
var useComboboxList = createHook(
  function useComboboxList2(_a) {
    var _b = _a, { store, alwaysVisible } = _b, props = __objRest(_b, ["store", "alwaysVisible"]);
    const scopedContext = useComboboxScopedContext(true);
    const context = useComboboxContext();
    store = store || context;
    const scopedContextSameStore = !!store && store === scopedContext;
    invariant(
      store,
       false && 0
    );
    const ref = (0,external_React_.useRef)(null);
    const id = useId(props.id);
    const mounted = store.useState("mounted");
    const hidden = isHidden(mounted, props.hidden, alwaysVisible);
    const style = hidden ? _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, props.style), { display: "none" }) : props.style;
    const multiSelectable = store.useState(
      (state) => Array.isArray(state.selectedValue)
    );
    const role = useAttribute(ref, "role", props.role);
    const isCompositeRole = role === "listbox" || role === "tree" || role === "grid";
    const ariaMultiSelectable = isCompositeRole ? multiSelectable || void 0 : void 0;
    const [hasListboxInside, setHasListboxInside] = (0,external_React_.useState)(false);
    const contentElement = store.useState("contentElement");
    useSafeLayoutEffect(() => {
      if (!mounted) return;
      const element = ref.current;
      if (!element) return;
      if (contentElement !== element) return;
      const callback = () => {
        setHasListboxInside(!!element.querySelector("[role='listbox']"));
      };
      const observer = new MutationObserver(callback);
      observer.observe(element, {
        subtree: true,
        childList: true,
        attributeFilter: ["role"]
      });
      callback();
      return () => observer.disconnect();
    }, [mounted, contentElement]);
    if (!hasListboxInside) {
      props = _3YLGPPWQ_spreadValues({
        role: "listbox",
        "aria-multiselectable": ariaMultiSelectable
      }, props);
    }
    props = useWrapElement(
      props,
      (element) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ComboboxScopedContextProvider, { value: store, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ComboboxListRoleContext.Provider, { value: role, children: element }) }),
      [store, role]
    );
    const setContentElement = id && (!scopedContext || !scopedContextSameStore) ? store.setContentElement : null;
    props = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({
      id,
      hidden
    }, props), {
      ref: useMergeRefs(setContentElement, ref, props.ref),
      style
    });
    return removeUndefinedValues(props);
  }
);
var ComboboxList = forwardRef2(function ComboboxList2(props) {
  const htmlProps = useComboboxList(props);
  return createElement(HUWAI7RB_TagName, htmlProps);
});



;// ./node_modules/@ariakit/react-core/esm/__chunks/UQQRIHDV.js
"use client";





// src/composite/composite-hover.tsx




var UQQRIHDV_TagName = "div";
function getMouseDestination(event) {
  const relatedTarget = event.relatedTarget;
  if ((relatedTarget == null ? void 0 : relatedTarget.nodeType) === Node.ELEMENT_NODE) {
    return relatedTarget;
  }
  return null;
}
function hoveringInside(event) {
  const nextElement = getMouseDestination(event);
  if (!nextElement) return false;
  return contains(event.currentTarget, nextElement);
}
var symbol = Symbol("composite-hover");
function movingToAnotherItem(event) {
  let dest = getMouseDestination(event);
  if (!dest) return false;
  do {
    if (PBFD2E7P_hasOwnProperty(dest, symbol) && dest[symbol]) return true;
    dest = dest.parentElement;
  } while (dest);
  return false;
}
var useCompositeHover = createHook(
  function useCompositeHover2(_a) {
    var _b = _a, {
      store,
      focusOnHover = true,
      blurOnHoverEnd = !!focusOnHover
    } = _b, props = __objRest(_b, [
      "store",
      "focusOnHover",
      "blurOnHoverEnd"
    ]);
    const context = useCompositeContext();
    store = store || context;
    invariant(
      store,
       false && 0
    );
    const isMouseMoving = useIsMouseMoving();
    const onMouseMoveProp = props.onMouseMove;
    const focusOnHoverProp = useBooleanEvent(focusOnHover);
    const onMouseMove = useEvent((event) => {
      onMouseMoveProp == null ? void 0 : onMouseMoveProp(event);
      if (event.defaultPrevented) return;
      if (!isMouseMoving()) return;
      if (!focusOnHoverProp(event)) return;
      if (!hasFocusWithin(event.currentTarget)) {
        const baseElement = store == null ? void 0 : store.getState().baseElement;
        if (baseElement && !hasFocus(baseElement)) {
          baseElement.focus();
        }
      }
      store == null ? void 0 : store.setActiveId(event.currentTarget.id);
    });
    const onMouseLeaveProp = props.onMouseLeave;
    const blurOnHoverEndProp = useBooleanEvent(blurOnHoverEnd);
    const onMouseLeave = useEvent((event) => {
      var _a2;
      onMouseLeaveProp == null ? void 0 : onMouseLeaveProp(event);
      if (event.defaultPrevented) return;
      if (!isMouseMoving()) return;
      if (hoveringInside(event)) return;
      if (movingToAnotherItem(event)) return;
      if (!focusOnHoverProp(event)) return;
      if (!blurOnHoverEndProp(event)) return;
      store == null ? void 0 : store.setActiveId(null);
      (_a2 = store == null ? void 0 : store.getState().baseElement) == null ? void 0 : _a2.focus();
    });
    const ref = (0,external_React_.useCallback)((element) => {
      if (!element) return;
      element[symbol] = true;
    }, []);
    props = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, props), {
      ref: useMergeRefs(ref, props.ref),
      onMouseMove,
      onMouseLeave
    });
    return removeUndefinedValues(props);
  }
);
var CompositeHover = memo2(
  forwardRef2(function CompositeHover2(props) {
    const htmlProps = useCompositeHover(props);
    return createElement(UQQRIHDV_TagName, htmlProps);
  })
);



;// ./node_modules/@ariakit/react-core/esm/__chunks/RZ4GPYOB.js
"use client";





// src/collection/collection-item.tsx


var RZ4GPYOB_TagName = "div";
var useCollectionItem = createHook(
  function useCollectionItem2(_a) {
    var _b = _a, {
      store,
      shouldRegisterItem = true,
      getItem = identity,
      element: element
    } = _b, props = __objRest(_b, [
      "store",
      "shouldRegisterItem",
      "getItem",
      // @ts-expect-error This prop may come from a collection renderer.
      "element"
    ]);
    const context = useCollectionContext();
    store = store || context;
    const id = useId(props.id);
    const ref = (0,external_React_.useRef)(element);
    (0,external_React_.useEffect)(() => {
      const element2 = ref.current;
      if (!id) return;
      if (!element2) return;
      if (!shouldRegisterItem) return;
      const item = getItem({ id, element: element2 });
      return store == null ? void 0 : store.renderItem(item);
    }, [id, shouldRegisterItem, getItem, store]);
    props = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, props), {
      ref: useMergeRefs(ref, props.ref)
    });
    return removeUndefinedValues(props);
  }
);
var CollectionItem = forwardRef2(function CollectionItem2(props) {
  const htmlProps = useCollectionItem(props);
  return createElement(RZ4GPYOB_TagName, htmlProps);
});



;// ./node_modules/@ariakit/react-core/esm/__chunks/KUU7WJ55.js
"use client";





// src/command/command.tsx





var KUU7WJ55_TagName = "button";
function isNativeClick(event) {
  if (!event.isTrusted) return false;
  const element = event.currentTarget;
  if (event.key === "Enter") {
    return isButton(element) || element.tagName === "SUMMARY" || element.tagName === "A";
  }
  if (event.key === " ") {
    return isButton(element) || element.tagName === "SUMMARY" || element.tagName === "INPUT" || element.tagName === "SELECT";
  }
  return false;
}
var KUU7WJ55_symbol = Symbol("command");
var useCommand = createHook(
  function useCommand2(_a) {
    var _b = _a, { clickOnEnter = true, clickOnSpace = true } = _b, props = __objRest(_b, ["clickOnEnter", "clickOnSpace"]);
    const ref = (0,external_React_.useRef)(null);
    const [isNativeButton, setIsNativeButton] = (0,external_React_.useState)(false);
    (0,external_React_.useEffect)(() => {
      if (!ref.current) return;
      setIsNativeButton(isButton(ref.current));
    }, []);
    const [active, setActive] = (0,external_React_.useState)(false);
    const activeRef = (0,external_React_.useRef)(false);
    const disabled = disabledFromProps(props);
    const [isDuplicate, metadataProps] = useMetadataProps(props, KUU7WJ55_symbol, true);
    const onKeyDownProp = props.onKeyDown;
    const onKeyDown = useEvent((event) => {
      onKeyDownProp == null ? void 0 : onKeyDownProp(event);
      const element = event.currentTarget;
      if (event.defaultPrevented) return;
      if (isDuplicate) return;
      if (disabled) return;
      if (!isSelfTarget(event)) return;
      if (isTextField(element)) return;
      if (element.isContentEditable) return;
      const isEnter = clickOnEnter && event.key === "Enter";
      const isSpace = clickOnSpace && event.key === " ";
      const shouldPreventEnter = event.key === "Enter" && !clickOnEnter;
      const shouldPreventSpace = event.key === " " && !clickOnSpace;
      if (shouldPreventEnter || shouldPreventSpace) {
        event.preventDefault();
        return;
      }
      if (isEnter || isSpace) {
        const nativeClick = isNativeClick(event);
        if (isEnter) {
          if (!nativeClick) {
            event.preventDefault();
            const _a2 = event, { view } = _a2, eventInit = __objRest(_a2, ["view"]);
            const click = () => fireClickEvent(element, eventInit);
            if (isFirefox()) {
              queueBeforeEvent(element, "keyup", click);
            } else {
              queueMicrotask(click);
            }
          }
        } else if (isSpace) {
          activeRef.current = true;
          if (!nativeClick) {
            event.preventDefault();
            setActive(true);
          }
        }
      }
    });
    const onKeyUpProp = props.onKeyUp;
    const onKeyUp = useEvent((event) => {
      onKeyUpProp == null ? void 0 : onKeyUpProp(event);
      if (event.defaultPrevented) return;
      if (isDuplicate) return;
      if (disabled) return;
      if (event.metaKey) return;
      const isSpace = clickOnSpace && event.key === " ";
      if (activeRef.current && isSpace) {
        activeRef.current = false;
        if (!isNativeClick(event)) {
          event.preventDefault();
          setActive(false);
          const element = event.currentTarget;
          const _a2 = event, { view } = _a2, eventInit = __objRest(_a2, ["view"]);
          queueMicrotask(() => fireClickEvent(element, eventInit));
        }
      }
    });
    props = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues(_3YLGPPWQ_spreadValues({
      "data-active": active || void 0,
      type: isNativeButton ? "button" : void 0
    }, metadataProps), props), {
      ref: useMergeRefs(ref, props.ref),
      onKeyDown,
      onKeyUp
    });
    props = useFocusable(props);
    return props;
  }
);
var Command = forwardRef2(function Command2(props) {
  const htmlProps = useCommand(props);
  return createElement(KUU7WJ55_TagName, htmlProps);
});



;// ./node_modules/@ariakit/react-core/esm/__chunks/P2CTZE2T.js
"use client";









// src/composite/composite-item.tsx






var P2CTZE2T_TagName = "button";
function isEditableElement(element) {
  if (isTextbox(element)) return true;
  return element.tagName === "INPUT" && !isButton(element);
}
function getNextPageOffset(scrollingElement, pageUp = false) {
  const height = scrollingElement.clientHeight;
  const { top } = scrollingElement.getBoundingClientRect();
  const pageSize = Math.max(height * 0.875, height - 40) * 1.5;
  const pageOffset = pageUp ? height - pageSize + top : pageSize + top;
  if (scrollingElement.tagName === "HTML") {
    return pageOffset + scrollingElement.scrollTop;
  }
  return pageOffset;
}
function getItemOffset(itemElement, pageUp = false) {
  const { top } = itemElement.getBoundingClientRect();
  if (pageUp) {
    return top + itemElement.clientHeight;
  }
  return top;
}
function findNextPageItemId(element, store, next, pageUp = false) {
  var _a;
  if (!store) return;
  if (!next) return;
  const { renderedItems } = store.getState();
  const scrollingElement = getScrollingElement(element);
  if (!scrollingElement) return;
  const nextPageOffset = getNextPageOffset(scrollingElement, pageUp);
  let id;
  let prevDifference;
  for (let i = 0; i < renderedItems.length; i += 1) {
    const previousId = id;
    id = next(i);
    if (!id) break;
    if (id === previousId) continue;
    const itemElement = (_a = getEnabledItem(store, id)) == null ? void 0 : _a.element;
    if (!itemElement) continue;
    const itemOffset = getItemOffset(itemElement, pageUp);
    const difference = itemOffset - nextPageOffset;
    const absDifference = Math.abs(difference);
    if (pageUp && difference <= 0 || !pageUp && difference >= 0) {
      if (prevDifference !== void 0 && prevDifference < absDifference) {
        id = previousId;
      }
      break;
    }
    prevDifference = absDifference;
  }
  return id;
}
function targetIsAnotherItem(event, store) {
  if (isSelfTarget(event)) return false;
  return isItem(store, event.target);
}
var useCompositeItem = createHook(
  function useCompositeItem2(_a) {
    var _b = _a, {
      store,
      rowId: rowIdProp,
      preventScrollOnKeyDown = false,
      moveOnKeyPress = true,
      tabbable = false,
      getItem: getItemProp,
      "aria-setsize": ariaSetSizeProp,
      "aria-posinset": ariaPosInSetProp
    } = _b, props = __objRest(_b, [
      "store",
      "rowId",
      "preventScrollOnKeyDown",
      "moveOnKeyPress",
      "tabbable",
      "getItem",
      "aria-setsize",
      "aria-posinset"
    ]);
    const context = useCompositeContext();
    store = store || context;
    const id = useId(props.id);
    const ref = (0,external_React_.useRef)(null);
    const row = (0,external_React_.useContext)(CompositeRowContext);
    const disabled = disabledFromProps(props);
    const trulyDisabled = disabled && !props.accessibleWhenDisabled;
    const {
      rowId,
      baseElement,
      isActiveItem,
      ariaSetSize,
      ariaPosInSet,
      isTabbable
    } = useStoreStateObject(store, {
      rowId(state) {
        if (rowIdProp) return rowIdProp;
        if (!state) return;
        if (!(row == null ? void 0 : row.baseElement)) return;
        if (row.baseElement !== state.baseElement) return;
        return row.id;
      },
      baseElement(state) {
        return (state == null ? void 0 : state.baseElement) || void 0;
      },
      isActiveItem(state) {
        return !!state && state.activeId === id;
      },
      ariaSetSize(state) {
        if (ariaSetSizeProp != null) return ariaSetSizeProp;
        if (!state) return;
        if (!(row == null ? void 0 : row.ariaSetSize)) return;
        if (row.baseElement !== state.baseElement) return;
        return row.ariaSetSize;
      },
      ariaPosInSet(state) {
        if (ariaPosInSetProp != null) return ariaPosInSetProp;
        if (!state) return;
        if (!(row == null ? void 0 : row.ariaPosInSet)) return;
        if (row.baseElement !== state.baseElement) return;
        const itemsInRow = state.renderedItems.filter(
          (item) => item.rowId === rowId
        );
        return row.ariaPosInSet + itemsInRow.findIndex((item) => item.id === id);
      },
      isTabbable(state) {
        if (!(state == null ? void 0 : state.renderedItems.length)) return true;
        if (state.virtualFocus) return false;
        if (tabbable) return true;
        if (state.activeId === null) return false;
        const item = store == null ? void 0 : store.item(state.activeId);
        if (item == null ? void 0 : item.disabled) return true;
        if (!(item == null ? void 0 : item.element)) return true;
        return state.activeId === id;
      }
    });
    const getItem = (0,external_React_.useCallback)(
      (item) => {
        var _a2;
        const nextItem = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, item), {
          id: id || item.id,
          rowId,
          disabled: !!trulyDisabled,
          children: (_a2 = item.element) == null ? void 0 : _a2.textContent
        });
        if (getItemProp) {
          return getItemProp(nextItem);
        }
        return nextItem;
      },
      [id, rowId, trulyDisabled, getItemProp]
    );
    const onFocusProp = props.onFocus;
    const hasFocusedComposite = (0,external_React_.useRef)(false);
    const onFocus = useEvent((event) => {
      onFocusProp == null ? void 0 : onFocusProp(event);
      if (event.defaultPrevented) return;
      if (isPortalEvent(event)) return;
      if (!id) return;
      if (!store) return;
      if (targetIsAnotherItem(event, store)) return;
      const { virtualFocus, baseElement: baseElement2 } = store.getState();
      store.setActiveId(id);
      if (isTextbox(event.currentTarget)) {
        selectTextField(event.currentTarget);
      }
      if (!virtualFocus) return;
      if (!isSelfTarget(event)) return;
      if (isEditableElement(event.currentTarget)) return;
      if (!(baseElement2 == null ? void 0 : baseElement2.isConnected)) return;
      if (isSafari() && event.currentTarget.hasAttribute("data-autofocus")) {
        event.currentTarget.scrollIntoView({
          block: "nearest",
          inline: "nearest"
        });
      }
      hasFocusedComposite.current = true;
      const fromComposite = event.relatedTarget === baseElement2 || isItem(store, event.relatedTarget);
      if (fromComposite) {
        focusSilently(baseElement2);
      } else {
        baseElement2.focus();
      }
    });
    const onBlurCaptureProp = props.onBlurCapture;
    const onBlurCapture = useEvent((event) => {
      onBlurCaptureProp == null ? void 0 : onBlurCaptureProp(event);
      if (event.defaultPrevented) return;
      const state = store == null ? void 0 : store.getState();
      if ((state == null ? void 0 : state.virtualFocus) && hasFocusedComposite.current) {
        hasFocusedComposite.current = false;
        event.preventDefault();
        event.stopPropagation();
      }
    });
    const onKeyDownProp = props.onKeyDown;
    const preventScrollOnKeyDownProp = useBooleanEvent(preventScrollOnKeyDown);
    const moveOnKeyPressProp = useBooleanEvent(moveOnKeyPress);
    const onKeyDown = useEvent((event) => {
      onKeyDownProp == null ? void 0 : onKeyDownProp(event);
      if (event.defaultPrevented) return;
      if (!isSelfTarget(event)) return;
      if (!store) return;
      const { currentTarget } = event;
      const state = store.getState();
      const item = store.item(id);
      const isGrid = !!(item == null ? void 0 : item.rowId);
      const isVertical = state.orientation !== "horizontal";
      const isHorizontal = state.orientation !== "vertical";
      const canHomeEnd = () => {
        if (isGrid) return true;
        if (isHorizontal) return true;
        if (!state.baseElement) return true;
        if (!isTextField(state.baseElement)) return true;
        return false;
      };
      const keyMap = {
        ArrowUp: (isGrid || isVertical) && store.up,
        ArrowRight: (isGrid || isHorizontal) && store.next,
        ArrowDown: (isGrid || isVertical) && store.down,
        ArrowLeft: (isGrid || isHorizontal) && store.previous,
        Home: () => {
          if (!canHomeEnd()) return;
          if (!isGrid || event.ctrlKey) {
            return store == null ? void 0 : store.first();
          }
          return store == null ? void 0 : store.previous(-1);
        },
        End: () => {
          if (!canHomeEnd()) return;
          if (!isGrid || event.ctrlKey) {
            return store == null ? void 0 : store.last();
          }
          return store == null ? void 0 : store.next(-1);
        },
        PageUp: () => {
          return findNextPageItemId(currentTarget, store, store == null ? void 0 : store.up, true);
        },
        PageDown: () => {
          return findNextPageItemId(currentTarget, store, store == null ? void 0 : store.down);
        }
      };
      const action = keyMap[event.key];
      if (action) {
        if (isTextbox(currentTarget)) {
          const selection = getTextboxSelection(currentTarget);
          const isLeft = isHorizontal && event.key === "ArrowLeft";
          const isRight = isHorizontal && event.key === "ArrowRight";
          const isUp = isVertical && event.key === "ArrowUp";
          const isDown = isVertical && event.key === "ArrowDown";
          if (isRight || isDown) {
            const { length: valueLength } = getTextboxValue(currentTarget);
            if (selection.end !== valueLength) return;
          } else if ((isLeft || isUp) && selection.start !== 0) return;
        }
        const nextId = action();
        if (preventScrollOnKeyDownProp(event) || nextId !== void 0) {
          if (!moveOnKeyPressProp(event)) return;
          event.preventDefault();
          store.move(nextId);
        }
      }
    });
    const providerValue = (0,external_React_.useMemo)(
      () => ({ id, baseElement }),
      [id, baseElement]
    );
    props = useWrapElement(
      props,
      (element) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(CompositeItemContext.Provider, { value: providerValue, children: element }),
      [providerValue]
    );
    props = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({
      id,
      "data-active-item": isActiveItem || void 0
    }, props), {
      ref: useMergeRefs(ref, props.ref),
      tabIndex: isTabbable ? props.tabIndex : -1,
      onFocus,
      onBlurCapture,
      onKeyDown
    });
    props = useCommand(props);
    props = useCollectionItem(_3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({
      store
    }, props), {
      getItem,
      shouldRegisterItem: id ? props.shouldRegisterItem : false
    }));
    return removeUndefinedValues(_3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, props), {
      "aria-setsize": ariaSetSize,
      "aria-posinset": ariaPosInSet
    }));
  }
);
var CompositeItem = memo2(
  forwardRef2(function CompositeItem2(props) {
    const htmlProps = useCompositeItem(props);
    return createElement(P2CTZE2T_TagName, htmlProps);
  })
);



;// ./node_modules/@ariakit/react-core/esm/__chunks/ZTDSJLD6.js
"use client";








// src/combobox/combobox-item.tsx






var ZTDSJLD6_TagName = "div";
function isSelected(storeValue, itemValue) {
  if (itemValue == null) return;
  if (storeValue == null) return false;
  if (Array.isArray(storeValue)) {
    return storeValue.includes(itemValue);
  }
  return storeValue === itemValue;
}
function getItemRole(popupRole) {
  var _a;
  const itemRoleByPopupRole = {
    menu: "menuitem",
    listbox: "option",
    tree: "treeitem"
  };
  const key = popupRole;
  return (_a = itemRoleByPopupRole[key]) != null ? _a : "option";
}
var useComboboxItem = createHook(
  function useComboboxItem2(_a) {
    var _b = _a, {
      store,
      value,
      hideOnClick,
      setValueOnClick,
      selectValueOnClick = true,
      resetValueOnSelect,
      focusOnHover = false,
      moveOnKeyPress = true,
      getItem: getItemProp
    } = _b, props = __objRest(_b, [
      "store",
      "value",
      "hideOnClick",
      "setValueOnClick",
      "selectValueOnClick",
      "resetValueOnSelect",
      "focusOnHover",
      "moveOnKeyPress",
      "getItem"
    ]);
    var _a2;
    const context = useComboboxScopedContext();
    store = store || context;
    invariant(
      store,
       false && 0
    );
    const { resetValueOnSelectState, multiSelectable, selected } = useStoreStateObject(store, {
      resetValueOnSelectState: "resetValueOnSelect",
      multiSelectable(state) {
        return Array.isArray(state.selectedValue);
      },
      selected(state) {
        return isSelected(state.selectedValue, value);
      }
    });
    const getItem = (0,external_React_.useCallback)(
      (item) => {
        const nextItem = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({}, item), { value });
        if (getItemProp) {
          return getItemProp(nextItem);
        }
        return nextItem;
      },
      [value, getItemProp]
    );
    setValueOnClick = setValueOnClick != null ? setValueOnClick : !multiSelectable;
    hideOnClick = hideOnClick != null ? hideOnClick : value != null && !multiSelectable;
    const onClickProp = props.onClick;
    const setValueOnClickProp = useBooleanEvent(setValueOnClick);
    const selectValueOnClickProp = useBooleanEvent(selectValueOnClick);
    const resetValueOnSelectProp = useBooleanEvent(
      (_a2 = resetValueOnSelect != null ? resetValueOnSelect : resetValueOnSelectState) != null ? _a2 : multiSelectable
    );
    const hideOnClickProp = useBooleanEvent(hideOnClick);
    const onClick = useEvent((event) => {
      onClickProp == null ? void 0 : onClickProp(event);
      if (event.defaultPrevented) return;
      if (isDownloading(event)) return;
      if (isOpeningInNewTab(event)) return;
      if (value != null) {
        if (selectValueOnClickProp(event)) {
          if (resetValueOnSelectProp(event)) {
            store == null ? void 0 : store.resetValue();
          }
          store == null ? void 0 : store.setSelectedValue((prevValue) => {
            if (!Array.isArray(prevValue)) return value;
            if (prevValue.includes(value)) {
              return prevValue.filter((v) => v !== value);
            }
            return [...prevValue, value];
          });
        }
        if (setValueOnClickProp(event)) {
          store == null ? void 0 : store.setValue(value);
        }
      }
      if (hideOnClickProp(event)) {
        store == null ? void 0 : store.hide();
      }
    });
    const onKeyDownProp = props.onKeyDown;
    const onKeyDown = useEvent((event) => {
      onKeyDownProp == null ? void 0 : onKeyDownProp(event);
      if (event.defaultPrevented) return;
      const baseElement = store == null ? void 0 : store.getState().baseElement;
      if (!baseElement) return;
      if (hasFocus(baseElement)) return;
      const printable = event.key.length === 1;
      if (printable || event.key === "Backspace" || event.key === "Delete") {
        queueMicrotask(() => baseElement.focus());
        if (isTextField(baseElement)) {
          store == null ? void 0 : store.setValue(baseElement.value);
        }
      }
    });
    if (multiSelectable && selected != null) {
      props = _3YLGPPWQ_spreadValues({
        "aria-selected": selected
      }, props);
    }
    props = useWrapElement(
      props,
      (element) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ComboboxItemValueContext.Provider, { value, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ComboboxItemCheckedContext.Provider, { value: selected != null ? selected : false, children: element }) }),
      [value, selected]
    );
    const popupRole = (0,external_React_.useContext)(ComboboxListRoleContext);
    props = _3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({
      role: getItemRole(popupRole),
      children: value
    }, props), {
      onClick,
      onKeyDown
    });
    const moveOnKeyPressProp = useBooleanEvent(moveOnKeyPress);
    props = useCompositeItem(_3YLGPPWQ_spreadProps(_3YLGPPWQ_spreadValues({
      store
    }, props), {
      getItem,
      // Dispatch a custom event on the combobox input when moving to an item
      // with the keyboard so the Combobox component can enable inline
      // autocompletion.
      moveOnKeyPress: (event) => {
        if (!moveOnKeyPressProp(event)) return false;
        const moveEvent = new Event("combobox-item-move");
        const baseElement = store == null ? void 0 : store.getState().baseElement;
        baseElement == null ? void 0 : baseElement.dispatchEvent(moveEvent);
        return true;
      }
    }));
    props = useCompositeHover(_3YLGPPWQ_spreadValues({ store, focusOnHover }, props));
    return props;
  }
);
var ComboboxItem = memo2(
  forwardRef2(function ComboboxItem2(props) {
    const htmlProps = useComboboxItem(props);
    return createElement(ZTDSJLD6_TagName, htmlProps);
  })
);



;// ./node_modules/@ariakit/react-core/esm/combobox/combobox-item-value.js
"use client";












// src/combobox/combobox-item-value.tsx




var combobox_item_value_TagName = "span";
function normalizeValue(value) {
  return PBFD2E7P_normalizeString(value).toLowerCase();
}
function getOffsets(string, values) {
  const offsets = [];
  for (const value of values) {
    let pos = 0;
    const length = value.length;
    while (string.indexOf(value, pos) !== -1) {
      const index = string.indexOf(value, pos);
      if (index !== -1) {
        offsets.push([index, length]);
      }
      pos = index + 1;
    }
  }
  return offsets;
}
function filterOverlappingOffsets(offsets) {
  return offsets.filter(([offset, length], i, arr) => {
    return !arr.some(
      ([o, l], j) => j !== i && o <= offset && o + l >= offset + length
    );
  });
}
function sortOffsets(offsets) {
  return offsets.sort(([a], [b]) => a - b);
}
function splitValue(itemValue, userValue) {
  if (!itemValue) return itemValue;
  if (!userValue) return itemValue;
  const userValues = toArray(userValue).filter(Boolean).map(normalizeValue);
  const parts = [];
  const span = (value, autocomplete = false) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    "span",
    {
      "data-autocomplete-value": autocomplete ? "" : void 0,
      "data-user-value": autocomplete ? void 0 : "",
      children: value
    },
    parts.length
  );
  const offsets = sortOffsets(
    filterOverlappingOffsets(
      // Convert userValues into a set to avoid duplicates
      getOffsets(normalizeValue(itemValue), new Set(userValues))
    )
  );
  if (!offsets.length) {
    parts.push(span(itemValue, true));
    return parts;
  }
  const [firstOffset] = offsets[0];
  const values = [
    itemValue.slice(0, firstOffset),
    ...offsets.flatMap(([offset, length], i) => {
      var _a;
      const value = itemValue.slice(offset, offset + length);
      const nextOffset = (_a = offsets[i + 1]) == null ? void 0 : _a[0];
      const nextValue = itemValue.slice(offset + length, nextOffset);
      return [value, nextValue];
    })
  ];
  values.forEach((value, i) => {
    if (!value) return;
    parts.push(span(value, i % 2 === 0));
  });
  return parts;
}
var useComboboxItemValue = createHook(function useComboboxItemValue2(_a) {
  var _b = _a, { store, value, userValue } = _b, props = __objRest(_b, ["store", "value", "userValue"]);
  const context = useComboboxScopedContext();
  store = store || context;
  const itemContext = (0,external_React_.useContext)(ComboboxItemValueContext);
  const itemValue = value != null ? value : itemContext;
  const inputValue = useStoreState(store, (state) => userValue != null ? userValue : state == null ? void 0 : state.value);
  const children = (0,external_React_.useMemo)(() => {
    if (!itemValue) return;
    if (!inputValue) return itemValue;
    return splitValue(itemValue, inputValue);
  }, [itemValue, inputValue]);
  props = _3YLGPPWQ_spreadValues({
    children
  }, props);
  return removeUndefinedValues(props);
});
var ComboboxItemValue = forwardRef2(function ComboboxItemValue2(props) {
  const htmlProps = useComboboxItemValue(props);
  return createElement(combobox_item_value_TagName, htmlProps);
});


;// ./node_modules/@wordpress/dataviews/build-module/components/dataviews-filters/utils.js
const utils_EMPTY_ARRAY = [];
const getCurrentValue = (filterDefinition, currentFilter) => {
  if (filterDefinition.singleSelection) {
    return currentFilter?.value;
  }
  if (Array.isArray(currentFilter?.value)) {
    return currentFilter.value;
  }
  if (!Array.isArray(currentFilter?.value) && !!currentFilter?.value) {
    return [currentFilter.value];
  }
  return utils_EMPTY_ARRAY;
};


;// ./node_modules/@wordpress/dataviews/build-module/components/dataviews-filters/search-widget.js











function search_widget_normalizeSearchInput(input = "") {
  return remove_accents_default()(input.trim().toLowerCase());
}
const getNewValue = (filterDefinition, currentFilter, value) => {
  if (filterDefinition.singleSelection) {
    return value;
  }
  if (Array.isArray(currentFilter?.value)) {
    return currentFilter.value.includes(value) ? currentFilter.value.filter((v) => v !== value) : [...currentFilter.value, value];
  }
  return [value];
};
function generateFilterElementCompositeItemId(prefix, filterElementValue) {
  return `${prefix}-${filterElementValue}`;
}
const MultiSelectionOption = ({ selected }) => {
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    "span",
    {
      className: dist_clsx(
        "dataviews-filters__search-widget-listitem-multi-selection",
        { "is-selected": selected }
      ),
      children: selected && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { icon: check_default })
    }
  );
};
const SingleSelectionOption = ({ selected }) => {
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    "span",
    {
      className: dist_clsx(
        "dataviews-filters__search-widget-listitem-single-selection",
        { "is-selected": selected }
      )
    }
  );
};
function ListBox({ view, filter, onChangeView }) {
  const baseId = (0,external_wp_compose_namespaceObject.useInstanceId)(ListBox, "dataviews-filter-list-box");
  const [activeCompositeId, setActiveCompositeId] = (0,external_wp_element_.useState)(
    // When there are one or less operators, the first item is set as active
    // (by setting the initial `activeId` to `undefined`).
    // With 2 or more operators, the focus is moved on the operators control
    // (by setting the initial `activeId` to `null`), meaning that there won't
    // be an active item initially. Focus is then managed via the
    // `onFocusVisible` callback.
    filter.operators?.length === 1 ? void 0 : null
  );
  const currentFilter = view.filters?.find(
    (f) => f.field === filter.field
  );
  const currentValue = getCurrentValue(filter, currentFilter);
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    external_wp_components_namespaceObject.Composite,
    {
      virtualFocus: true,
      focusLoop: true,
      activeId: activeCompositeId,
      setActiveId: setActiveCompositeId,
      role: "listbox",
      className: "dataviews-filters__search-widget-listbox",
      "aria-label": (0,external_wp_i18n_namespaceObject.sprintf)(
        /* translators: List of items for a filter. 1: Filter name. e.g.: "List of: Author". */
        (0,external_wp_i18n_namespaceObject.__)("List of: %1$s"),
        filter.name
      ),
      onFocusVisible: () => {
        if (!activeCompositeId && filter.elements.length) {
          setActiveCompositeId(
            generateFilterElementCompositeItemId(
              baseId,
              filter.elements[0].value
            )
          );
        }
      },
      render: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Composite.Typeahead, {}),
      children: filter.elements.map((element) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
        external_wp_components_namespaceObject.Composite.Hover,
        {
          render: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
            external_wp_components_namespaceObject.Composite.Item,
            {
              id: generateFilterElementCompositeItemId(
                baseId,
                element.value
              ),
              render: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
                "div",
                {
                  "aria-label": element.label,
                  role: "option",
                  className: "dataviews-filters__search-widget-listitem"
                }
              ),
              onClick: () => {
                const newFilters = currentFilter ? [
                  ...(view.filters ?? []).map(
                    (_filter) => {
                      if (_filter.field === filter.field) {
                        return {
                          ..._filter,
                          operator: currentFilter.operator || filter.operators[0],
                          value: getNewValue(
                            filter,
                            currentFilter,
                            element.value
                          )
                        };
                      }
                      return _filter;
                    }
                  )
                ] : [
                  ...view.filters ?? [],
                  {
                    field: filter.field,
                    operator: filter.operators[0],
                    value: getNewValue(
                      filter,
                      currentFilter,
                      element.value
                    )
                  }
                ];
                onChangeView({
                  ...view,
                  page: 1,
                  filters: newFilters
                });
              }
            }
          ),
          children: [
            filter.singleSelection && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
              SingleSelectionOption,
              {
                selected: currentValue === element.value
              }
            ),
            !filter.singleSelection && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
              MultiSelectionOption,
              {
                selected: currentValue.includes(element.value)
              }
            ),
            /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { children: element.label })
          ]
        },
        element.value
      ))
    }
  );
}
function search_widget_ComboboxList({ view, filter, onChangeView }) {
  const [searchValue, setSearchValue] = (0,external_wp_element_.useState)("");
  const deferredSearchValue = (0,external_wp_element_.useDeferredValue)(searchValue);
  const currentFilter = view.filters?.find(
    (_filter) => _filter.field === filter.field
  );
  const currentValue = getCurrentValue(filter, currentFilter);
  const matches = (0,external_wp_element_.useMemo)(() => {
    const normalizedSearch = search_widget_normalizeSearchInput(deferredSearchValue);
    return filter.elements.filter(
      (item) => search_widget_normalizeSearchInput(item.label).includes(normalizedSearch)
    );
  }, [filter.elements, deferredSearchValue]);
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
    ComboboxProvider,
    {
      selectedValue: currentValue,
      setSelectedValue: (value) => {
        const newFilters = currentFilter ? [
          ...(view.filters ?? []).map((_filter) => {
            if (_filter.field === filter.field) {
              return {
                ..._filter,
                operator: currentFilter.operator || filter.operators[0],
                value
              };
            }
            return _filter;
          })
        ] : [
          ...view.filters ?? [],
          {
            field: filter.field,
            operator: filter.operators[0],
            value
          }
        ];
        onChangeView({
          ...view,
          page: 1,
          filters: newFilters
        });
      },
      setValue: setSearchValue,
      children: [
        /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "dataviews-filters__search-widget-filter-combobox__wrapper", children: [
          /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
            ComboboxLabel,
            {
              render: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, { children: (0,external_wp_i18n_namespaceObject.__)("Search items") }),
              children: (0,external_wp_i18n_namespaceObject.__)("Search items")
            }
          ),
          /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
            Combobox,
            {
              autoSelect: "always",
              placeholder: (0,external_wp_i18n_namespaceObject.__)("Search"),
              className: "dataviews-filters__search-widget-filter-combobox__input"
            }
          ),
          /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "dataviews-filters__search-widget-filter-combobox__icon", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { icon: search_default }) })
        ] }),
        /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
          ComboboxList,
          {
            className: "dataviews-filters__search-widget-filter-combobox-list",
            alwaysVisible: true,
            children: [
              matches.map((element) => {
                return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
                  ComboboxItem,
                  {
                    resetValueOnSelect: false,
                    value: element.value,
                    className: "dataviews-filters__search-widget-listitem",
                    hideOnClick: false,
                    setValueOnClick: false,
                    focusOnHover: true,
                    children: [
                      filter.singleSelection && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
                        SingleSelectionOption,
                        {
                          selected: currentValue === element.value
                        }
                      ),
                      !filter.singleSelection && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
                        MultiSelectionOption,
                        {
                          selected: currentValue.includes(
                            element.value
                          )
                        }
                      ),
                      /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("span", { children: [
                        /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
                          ComboboxItemValue,
                          {
                            className: "dataviews-filters__search-widget-filter-combobox-item-value",
                            value: element.label
                          }
                        ),
                        !!element.description && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "dataviews-filters__search-widget-listitem-description", children: element.description })
                      ] })
                    ]
                  },
                  element.value
                );
              }),
              !matches.length && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { children: (0,external_wp_i18n_namespaceObject.__)("No results found") })
            ]
          }
        )
      ]
    }
  );
}
function SearchWidget(props) {
  const { elements, isLoading } = useElements({
    elements: props.filter.elements,
    getElements: props.filter.getElements
  });
  if (isLoading) {
    return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "dataviews-filters__search-widget-no-elements", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {}) });
  }
  if (elements.length === 0) {
    return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "dataviews-filters__search-widget-no-elements", children: (0,external_wp_i18n_namespaceObject.__)("No elements found") });
  }
  const Widget = elements.length > 10 ? search_widget_ComboboxList : ListBox;
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Widget, { ...props, filter: { ...props.filter, elements } });
}


// EXTERNAL MODULE: ./node_modules/fast-deep-equal/es6/index.js
var es6 = __webpack_require__(7734);
var es6_default = /*#__PURE__*/__webpack_require__.n(es6);
;// ./node_modules/@wordpress/dataviews/build-module/components/dataviews-filters/input-widget.js






function InputWidget({
  filter,
  view,
  onChangeView,
  fields
}) {
  const currentFilter = view.filters?.find(
    (f) => f.field === filter.field
  );
  const currentValue = getCurrentValue(filter, currentFilter);
  const field = (0,external_wp_element_.useMemo)(() => {
    const currentField = fields.find((f) => f.id === filter.field);
    if (currentField) {
      return {
        ...currentField,
        // Deactivate validation for filters.
        isValid: {
          required: false,
          custom: () => null
        },
        // Configure getValue/setValue as if Item was a plain object.
        getValue: ({ item }) => item[currentField.id],
        setValue: ({ value }) => ({
          [currentField.id]: value
        })
      };
    }
    return currentField;
  }, [fields, filter.field]);
  const data = (0,external_wp_element_.useMemo)(() => {
    return (view.filters ?? []).reduce(
      (acc, activeFilter) => {
        acc[activeFilter.field] = activeFilter.value;
        return acc;
      },
      {}
    );
  }, [view.filters]);
  const handleChange = (0,external_wp_compose_namespaceObject.useEvent)((updatedData) => {
    if (!field || !currentFilter) {
      return;
    }
    const nextValue = field.getValue({ item: updatedData });
    if (es6_default()(nextValue, currentValue)) {
      return;
    }
    onChangeView({
      ...view,
      filters: (view.filters ?? []).map(
        (_filter) => _filter.field === filter.field ? {
          ..._filter,
          operator: currentFilter.operator || filter.operators[0],
          // Consider empty strings as undefined:
          //
          // - undefined as value means the filter is unset: the filter widget displays no value and the search returns all records
          // - empty string as value means "search empty string": returns only the records that have an empty string as value
          //
          // In practice, this means the filter will not be able to find an empty string as the value.
          value: nextValue === "" ? void 0 : nextValue
        } : _filter
      )
    });
  });
  if (!field || !field.Edit || !currentFilter) {
    return null;
  }
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    external_wp_components_namespaceObject.Flex,
    {
      className: "dataviews-filters__user-input-widget",
      gap: 2.5,
      direction: "column",
      children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
        field.Edit,
        {
          hideLabelFromVision: true,
          data,
          field,
          operator: currentFilter.operator,
          onChange: handleChange
        }
      )
    }
  );
}


;// ./node_modules/@wordpress/dataviews/build-module/components/dataviews-filters/filter.js






const ENTER = "Enter";
const SPACE = " ";




const FilterText = ({
  activeElements,
  filterInView,
  filter
}) => {
  if (activeElements === void 0 || activeElements.length === 0) {
    return filter.name;
  }
  const filterTextWrappers = {
    Name: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "dataviews-filters__summary-filter-text-name" }),
    Value: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "dataviews-filters__summary-filter-text-value" })
  };
  if (filterInView?.operator === constants_OPERATOR_IS_ANY) {
    return (0,external_wp_element_.createInterpolateElement)(
      (0,external_wp_i18n_namespaceObject.sprintf)(
        /* translators: 1: Filter name. 2: Filter value. e.g.: "Author is any: Admin, Editor". */
        (0,external_wp_i18n_namespaceObject.__)("<Name>%1$s is any: </Name><Value>%2$s</Value>"),
        filter.name,
        activeElements.map((element) => element.label).join(", ")
      ),
      filterTextWrappers
    );
  }
  if (filterInView?.operator === constants_OPERATOR_IS_NONE) {
    return (0,external_wp_element_.createInterpolateElement)(
      (0,external_wp_i18n_namespaceObject.sprintf)(
        /* translators: 1: Filter name. 2: Filter value. e.g.: "Author is none: Admin, Editor". */
        (0,external_wp_i18n_namespaceObject.__)("<Name>%1$s is none: </Name><Value>%2$s</Value>"),
        filter.name,
        activeElements.map((element) => element.label).join(", ")
      ),
      filterTextWrappers
    );
  }
  if (filterInView?.operator === OPERATOR_IS_ALL) {
    return (0,external_wp_element_.createInterpolateElement)(
      (0,external_wp_i18n_namespaceObject.sprintf)(
        /* translators: 1: Filter name. 2: Filter value. e.g.: "Author is all: Admin, Editor". */
        (0,external_wp_i18n_namespaceObject.__)("<Name>%1$s is all: </Name><Value>%2$s</Value>"),
        filter.name,
        activeElements.map((element) => element.label).join(", ")
      ),
      filterTextWrappers
    );
  }
  if (filterInView?.operator === OPERATOR_IS_NOT_ALL) {
    return (0,external_wp_element_.createInterpolateElement)(
      (0,external_wp_i18n_namespaceObject.sprintf)(
        /* translators: 1: Filter name. 2: Filter value. e.g.: "Author is not all: Admin, Editor". */
        (0,external_wp_i18n_namespaceObject.__)("<Name>%1$s is not all: </Name><Value>%2$s</Value>"),
        filter.name,
        activeElements.map((element) => element.label).join(", ")
      ),
      filterTextWrappers
    );
  }
  if (filterInView?.operator === constants_OPERATOR_IS) {
    return (0,external_wp_element_.createInterpolateElement)(
      (0,external_wp_i18n_namespaceObject.sprintf)(
        /* translators: 1: Filter name. 2: Filter value. e.g.: "Author is: Admin". */
        (0,external_wp_i18n_namespaceObject.__)("<Name>%1$s is: </Name><Value>%2$s</Value>"),
        filter.name,
        activeElements[0].label
      ),
      filterTextWrappers
    );
  }
  if (filterInView?.operator === constants_OPERATOR_IS_NOT) {
    return (0,external_wp_element_.createInterpolateElement)(
      (0,external_wp_i18n_namespaceObject.sprintf)(
        /* translators: 1: Filter name. 2: Filter value. e.g.: "Author is not: Admin". */
        (0,external_wp_i18n_namespaceObject.__)("<Name>%1$s is not: </Name><Value>%2$s</Value>"),
        filter.name,
        activeElements[0].label
      ),
      filterTextWrappers
    );
  }
  if (filterInView?.operator === OPERATOR_LESS_THAN) {
    return (0,external_wp_element_.createInterpolateElement)(
      (0,external_wp_i18n_namespaceObject.sprintf)(
        /* translators: 1: Filter name. 2: Filter value. e.g.: "Price is less than: 10". */
        (0,external_wp_i18n_namespaceObject.__)("<Name>%1$s is less than: </Name><Value>%2$s</Value>"),
        filter.name,
        activeElements[0].label
      ),
      filterTextWrappers
    );
  }
  if (filterInView?.operator === OPERATOR_GREATER_THAN) {
    return (0,external_wp_element_.createInterpolateElement)(
      (0,external_wp_i18n_namespaceObject.sprintf)(
        /* translators: 1: Filter name. 2: Filter value. e.g.: "Price is greater than: 10". */
        (0,external_wp_i18n_namespaceObject.__)("<Name>%1$s is greater than: </Name><Value>%2$s</Value>"),
        filter.name,
        activeElements[0].label
      ),
      filterTextWrappers
    );
  }
  if (filterInView?.operator === OPERATOR_LESS_THAN_OR_EQUAL) {
    return (0,external_wp_element_.createInterpolateElement)(
      (0,external_wp_i18n_namespaceObject.sprintf)(
        /* translators: 1: Filter name. 2: Filter value. e.g.: "Price is less than or equal to: 10". */
        (0,external_wp_i18n_namespaceObject.__)(
          "<Name>%1$s is less than or equal to: </Name><Value>%2$s</Value>"
        ),
        filter.name,
        activeElements[0].label
      ),
      filterTextWrappers
    );
  }
  if (filterInView?.operator === OPERATOR_GREATER_THAN_OR_EQUAL) {
    return (0,external_wp_element_.createInterpolateElement)(
      (0,external_wp_i18n_namespaceObject.sprintf)(
        /* translators: 1: Filter name. 2: Filter value. e.g.: "Price is greater than or equal to: 10". */
        (0,external_wp_i18n_namespaceObject.__)(
          "<Name>%1$s is greater than or equal to: </Name><Value>%2$s</Value>"
        ),
        filter.name,
        activeElements[0].label
      ),
      filterTextWrappers
    );
  }
  if (filterInView?.operator === OPERATOR_CONTAINS) {
    return (0,external_wp_element_.createInterpolateElement)(
      (0,external_wp_i18n_namespaceObject.sprintf)(
        /* translators: 1: Filter name. 2: Filter value. e.g.: "Title contains: Mars". */
        (0,external_wp_i18n_namespaceObject.__)("<Name>%1$s contains: </Name><Value>%2$s</Value>"),
        filter.name,
        activeElements[0].label
      ),
      filterTextWrappers
    );
  }
  if (filterInView?.operator === OPERATOR_NOT_CONTAINS) {
    return (0,external_wp_element_.createInterpolateElement)(
      (0,external_wp_i18n_namespaceObject.sprintf)(
        /* translators: 1: Filter name. 2: Filter value. e.g.: "Description doesn't contain: photo". */
        (0,external_wp_i18n_namespaceObject.__)("<Name>%1$s doesn't contain: </Name><Value>%2$s</Value>"),
        filter.name,
        activeElements[0].label
      ),
      filterTextWrappers
    );
  }
  if (filterInView?.operator === OPERATOR_STARTS_WITH) {
    return (0,external_wp_element_.createInterpolateElement)(
      (0,external_wp_i18n_namespaceObject.sprintf)(
        /* translators: 1: Filter name. 2: Filter value. e.g.: "Title starts with: Mar". */
        (0,external_wp_i18n_namespaceObject.__)("<Name>%1$s starts with: </Name><Value>%2$s</Value>"),
        filter.name,
        activeElements[0].label
      ),
      filterTextWrappers
    );
  }
  if (filterInView?.operator === OPERATOR_BEFORE) {
    return (0,external_wp_element_.createInterpolateElement)(
      (0,external_wp_i18n_namespaceObject.sprintf)(
        /* translators: 1: Filter name. 2: Filter value. e.g.: "Date is before: 2024-01-01". */
        (0,external_wp_i18n_namespaceObject.__)("<Name>%1$s is before: </Name><Value>%2$s</Value>"),
        filter.name,
        activeElements[0].label
      ),
      filterTextWrappers
    );
  }
  if (filterInView?.operator === OPERATOR_AFTER) {
    return (0,external_wp_element_.createInterpolateElement)(
      (0,external_wp_i18n_namespaceObject.sprintf)(
        /* translators: 1: Filter name. 2: Filter value. e.g.: "Date is after: 2024-01-01". */
        (0,external_wp_i18n_namespaceObject.__)("<Name>%1$s is after: </Name><Value>%2$s</Value>"),
        filter.name,
        activeElements[0].label
      ),
      filterTextWrappers
    );
  }
  if (filterInView?.operator === OPERATOR_BEFORE_INC) {
    return (0,external_wp_element_.createInterpolateElement)(
      (0,external_wp_i18n_namespaceObject.sprintf)(
        /* translators: 1: Filter name. 2: Filter value. e.g.: "Date is on or before: 2024-01-01". */
        (0,external_wp_i18n_namespaceObject.__)("<Name>%1$s is on or before: </Name><Value>%2$s</Value>"),
        filter.name,
        activeElements[0].label
      ),
      filterTextWrappers
    );
  }
  if (filterInView?.operator === OPERATOR_AFTER_INC) {
    return (0,external_wp_element_.createInterpolateElement)(
      (0,external_wp_i18n_namespaceObject.sprintf)(
        /* translators: 1: Filter name. 2: Filter value. e.g.: "Date is on or after: 2024-01-01". */
        (0,external_wp_i18n_namespaceObject.__)("<Name>%1$s is on or after: </Name><Value>%2$s</Value>"),
        filter.name,
        activeElements[0].label
      ),
      filterTextWrappers
    );
  }
  if (filterInView?.operator === OPERATOR_BETWEEN) {
    const { label } = activeElements[0];
    return (0,external_wp_element_.createInterpolateElement)(
      (0,external_wp_i18n_namespaceObject.sprintf)(
        /* translators: 1: Filter name. 2: Min value. 3: Max value. e.g.: "Item count between (inc): 10 and 180". */
        (0,external_wp_i18n_namespaceObject.__)(
          "<Name>%1$s between (inc): </Name><Value>%2$s and %3$s</Value>"
        ),
        filter.name,
        label[0],
        label[1]
      ),
      filterTextWrappers
    );
  }
  if (filterInView?.operator === OPERATOR_ON) {
    return (0,external_wp_element_.createInterpolateElement)(
      (0,external_wp_i18n_namespaceObject.sprintf)(
        /* translators: 1: Filter name. 2: Filter value. e.g.: "Date is: 2024-01-01". */
        (0,external_wp_i18n_namespaceObject.__)("<Name>%1$s is: </Name><Value>%2$s</Value>"),
        filter.name,
        activeElements[0].label
      ),
      filterTextWrappers
    );
  }
  if (filterInView?.operator === OPERATOR_NOT_ON) {
    return (0,external_wp_element_.createInterpolateElement)(
      (0,external_wp_i18n_namespaceObject.sprintf)(
        /* translators: 1: Filter name. 2: Filter value. e.g.: "Date is not: 2024-01-01". */
        (0,external_wp_i18n_namespaceObject.__)("<Name>%1$s is not: </Name><Value>%2$s</Value>"),
        filter.name,
        activeElements[0].label
      ),
      filterTextWrappers
    );
  }
  if (filterInView?.operator === OPERATOR_IN_THE_PAST) {
    return (0,external_wp_element_.createInterpolateElement)(
      (0,external_wp_i18n_namespaceObject.sprintf)(
        /* translators: 1: Filter name. 2: Filter value. e.g.: "Date is in the past: 1 days". */
        (0,external_wp_i18n_namespaceObject.__)("<Name>%1$s is in the past: </Name><Value>%2$s</Value>"),
        filter.name,
        `${activeElements[0].value.value} ${activeElements[0].value.unit}`
      ),
      filterTextWrappers
    );
  }
  if (filterInView?.operator === OPERATOR_OVER) {
    return (0,external_wp_element_.createInterpolateElement)(
      (0,external_wp_i18n_namespaceObject.sprintf)(
        /* translators: 1: Filter name. 2: Filter value. e.g.: "Date is over: 1 days ago". */
        (0,external_wp_i18n_namespaceObject.__)("<Name>%1$s is over: </Name><Value>%2$s</Value> ago"),
        filter.name,
        `${activeElements[0].value.value} ${activeElements[0].value.unit}`
      ),
      filterTextWrappers
    );
  }
  return (0,external_wp_i18n_namespaceObject.sprintf)(
    /* translators: 1: Filter name e.g.: "Unknown status for Author". */
    (0,external_wp_i18n_namespaceObject.__)("Unknown status for %1$s"),
    filter.name
  );
};
function OperatorSelector({
  filter,
  view,
  onChangeView
}) {
  const operatorOptions = filter.operators?.map((operator) => ({
    value: operator,
    label: OPERATORS[operator]?.label
  }));
  const currentFilter = view.filters?.find(
    (_filter) => _filter.field === filter.field
  );
  const value = currentFilter?.operator || filter.operators[0];
  return operatorOptions.length > 1 && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
    external_wp_components_namespaceObject.__experimentalHStack,
    {
      spacing: 2,
      justify: "flex-start",
      className: "dataviews-filters__summary-operators-container",
      children: [
        /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { className: "dataviews-filters__summary-operators-filter-name", children: filter.name }),
        /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
          external_wp_components_namespaceObject.SelectControl,
          {
            className: "dataviews-filters__summary-operators-filter-select",
            label: (0,external_wp_i18n_namespaceObject.__)("Conditions"),
            value,
            options: operatorOptions,
            onChange: (newValue) => {
              const operator = newValue;
              const currentOperator = currentFilter?.operator;
              const newFilters = currentFilter ? [
                ...(view.filters ?? []).map(
                  (_filter) => {
                    if (_filter.field === filter.field) {
                      const OPERATORS_SHOULD_RESET_VALUE = [
                        OPERATOR_BETWEEN,
                        OPERATOR_IN_THE_PAST,
                        OPERATOR_OVER
                      ];
                      const shouldResetValue = currentOperator && (OPERATORS_SHOULD_RESET_VALUE.includes(
                        currentOperator
                      ) || OPERATORS_SHOULD_RESET_VALUE.includes(
                        operator
                      ));
                      return {
                        ..._filter,
                        value: shouldResetValue ? void 0 : _filter.value,
                        operator
                      };
                    }
                    return _filter;
                  }
                )
              ] : [
                ...view.filters ?? [],
                {
                  field: filter.field,
                  operator,
                  value: void 0
                }
              ];
              onChangeView({
                ...view,
                page: 1,
                filters: newFilters
              });
            },
            size: "small",
            variant: "minimal",
            __nextHasNoMarginBottom: true,
            hideLabelFromVision: true
          }
        )
      ]
    }
  );
}
function Filter({
  addFilterRef,
  openedFilter,
  fields,
  ...commonProps
}) {
  const toggleRef = (0,external_wp_element_.useRef)(null);
  const { filter, view, onChangeView } = commonProps;
  const filterInView = view.filters?.find(
    (f) => f.field === filter.field
  );
  let activeElements = [];
  const { elements } = useElements({
    elements: filter.elements,
    getElements: filter.getElements
  });
  if (elements.length > 0) {
    activeElements = elements.filter((element) => {
      if (filter.singleSelection) {
        return element.value === filterInView?.value;
      }
      return filterInView?.value?.includes(element.value);
    });
  } else if (filterInView?.value !== void 0) {
    activeElements = [
      {
        value: filterInView.value,
        label: filterInView.value
      }
    ];
  }
  const isPrimary = filter.isPrimary;
  const isLocked = filterInView?.isLocked;
  const hasValues = !isLocked && filterInView?.value !== void 0;
  const canResetOrRemove = !isLocked && (!isPrimary || hasValues);
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    external_wp_components_namespaceObject.Dropdown,
    {
      defaultOpen: openedFilter === filter.field,
      contentClassName: "dataviews-filters__summary-popover",
      popoverProps: { placement: "bottom-start", role: "dialog" },
      onClose: () => {
        toggleRef.current?.focus();
      },
      renderToggle: ({ isOpen, onToggle }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "dataviews-filters__summary-chip-container", children: [
        /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
          external_wp_components_namespaceObject.Tooltip,
          {
            text: (0,external_wp_i18n_namespaceObject.sprintf)(
              /* translators: 1: Filter name. */
              (0,external_wp_i18n_namespaceObject.__)("Filter by: %1$s"),
              filter.name.toLowerCase()
            ),
            placement: "top",
            children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
              "div",
              {
                className: dist_clsx(
                  "dataviews-filters__summary-chip",
                  {
                    "has-reset": canResetOrRemove,
                    "has-values": hasValues,
                    "is-not-clickable": isLocked
                  }
                ),
                role: "button",
                tabIndex: isLocked ? -1 : 0,
                onClick: () => {
                  if (!isLocked) {
                    onToggle();
                  }
                },
                onKeyDown: (event) => {
                  if (!isLocked && [ENTER, SPACE].includes(event.key)) {
                    onToggle();
                    event.preventDefault();
                  }
                },
                "aria-disabled": isLocked,
                "aria-pressed": isOpen,
                "aria-expanded": isOpen,
                ref: toggleRef,
                children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
                  FilterText,
                  {
                    activeElements,
                    filterInView,
                    filter
                  }
                )
              }
            )
          }
        ),
        canResetOrRemove && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
          external_wp_components_namespaceObject.Tooltip,
          {
            text: isPrimary ? (0,external_wp_i18n_namespaceObject.__)("Reset") : (0,external_wp_i18n_namespaceObject.__)("Remove"),
            placement: "top",
            children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
              "button",
              {
                className: dist_clsx(
                  "dataviews-filters__summary-chip-remove",
                  { "has-values": hasValues }
                ),
                onClick: () => {
                  onChangeView({
                    ...view,
                    page: 1,
                    filters: view.filters?.filter(
                      (_filter) => _filter.field !== filter.field
                    )
                  });
                  if (!isPrimary) {
                    addFilterRef.current?.focus();
                  } else {
                    toggleRef.current?.focus();
                  }
                },
                children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { icon: close_small_default })
              }
            )
          }
        )
      ] }),
      renderContent: () => {
        return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 0, justify: "flex-start", children: [
          /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(OperatorSelector, { ...commonProps }),
          commonProps.filter.hasElements ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
            SearchWidget,
            {
              ...commonProps,
              filter: {
                ...commonProps.filter,
                elements
              }
            }
          ) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(InputWidget, { ...commonProps, fields })
        ] });
      }
    }
  );
}


;// ./node_modules/@wordpress/dataviews/build-module/components/dataviews-filters/reset-filters.js



function ResetFilter({
  filters,
  view,
  onChangeView
}) {
  const isPrimary = (field) => filters.some(
    (_filter) => _filter.field === field && _filter.isPrimary
  );
  const isDisabled = !view.search && !view.filters?.some(
    (_filter) => !_filter.isLocked && (_filter.value !== void 0 || !isPrimary(_filter.field))
  );
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    external_wp_components_namespaceObject.Button,
    {
      disabled: isDisabled,
      accessibleWhenDisabled: true,
      size: "compact",
      variant: "tertiary",
      className: "dataviews-filters__reset-button",
      onClick: () => {
        onChangeView({
          ...view,
          page: 1,
          search: "",
          filters: view.filters?.filter((f) => !!f.isLocked) || []
        });
      },
      children: (0,external_wp_i18n_namespaceObject.__)("Reset")
    }
  );
}


;// ./node_modules/@wordpress/dataviews/build-module/components/dataviews-filters/use-filters.js


function useFilters(fields, view) {
  return (0,external_wp_element_.useMemo)(() => {
    const filters = [];
    fields.forEach((field) => {
      if (field.filterBy === false || !field.hasElements && !field.Edit) {
        return;
      }
      const operators = field.filterBy.operators;
      const isPrimary = !!field.filterBy?.isPrimary;
      const isLocked = view.filters?.some(
        (f) => f.field === field.id && !!f.isLocked
      ) ?? false;
      filters.push({
        field: field.id,
        name: field.label,
        elements: field.elements,
        getElements: field.getElements,
        hasElements: field.hasElements,
        singleSelection: operators.some(
          (op) => SINGLE_SELECTION_OPERATORS.includes(op)
        ),
        operators,
        isVisible: isLocked || isPrimary || !!view.filters?.some(
          (f) => f.field === field.id && ALL_OPERATORS.includes(f.operator)
        ),
        isPrimary,
        isLocked
      });
    });
    filters.sort((a, b) => {
      if (a.isLocked && !b.isLocked) {
        return -1;
      }
      if (!a.isLocked && b.isLocked) {
        return 1;
      }
      if (a.isPrimary && !b.isPrimary) {
        return -1;
      }
      if (!a.isPrimary && b.isPrimary) {
        return 1;
      }
      return a.name.localeCompare(b.name);
    });
    return filters;
  }, [fields, view]);
}
var use_filters_default = useFilters;


;// ./node_modules/@wordpress/dataviews/build-module/components/dataviews-filters/filters.js








function Filters({ className }) {
  const { fields, view, onChangeView, openedFilter, setOpenedFilter } = (0,external_wp_element_.useContext)(dataviews_context_default);
  const addFilterRef = (0,external_wp_element_.useRef)(null);
  const filters = use_filters_default(fields, view);
  const addFilter = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    add_filter_default,
    {
      filters,
      view,
      onChangeView,
      ref: addFilterRef,
      setOpenedFilter
    },
    "add-filter"
  );
  const visibleFilters = filters.filter((filter) => filter.isVisible);
  if (visibleFilters.length === 0) {
    return null;
  }
  const filterComponents = [
    ...visibleFilters.map((filter) => {
      return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
        Filter,
        {
          filter,
          view,
          fields,
          onChangeView,
          addFilterRef,
          openedFilter
        },
        filter.field
      );
    }),
    addFilter
  ];
  filterComponents.push(
    /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
      ResetFilter,
      {
        filters,
        view,
        onChangeView
      },
      "reset-filters"
    )
  );
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    external_wp_components_namespaceObject.__experimentalHStack,
    {
      justify: "flex-start",
      style: { width: "fit-content" },
      wrap: true,
      className,
      children: filterComponents
    }
  );
}
var filters_default = (0,external_wp_element_.memo)(Filters);


;// ./node_modules/@wordpress/dataviews/build-module/components/dataviews-filters/filters-toggled.js




function FiltersToggled(props) {
  const { isShowingFilter } = (0,external_wp_element_.useContext)(dataviews_context_default);
  if (!isShowingFilter) {
    return null;
  }
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(filters_default, { ...props });
}
var filters_toggled_default = FiltersToggled;


;// ./node_modules/@wordpress/dataviews/build-module/components/dataviews-layout/index.js





function DataViewsLayout({ className }) {
  const {
    actions = [],
    data,
    fields,
    getItemId,
    getItemLevel,
    isLoading,
    view,
    onChangeView,
    selection,
    onChangeSelection,
    setOpenedFilter,
    onClickItem,
    isItemClickable,
    renderItemLink,
    defaultLayouts,
    empty = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { children: (0,external_wp_i18n_namespaceObject.__)("No results") })
  } = (0,external_wp_element_.useContext)(dataviews_context_default);
  const ViewComponent = VIEW_LAYOUTS.find(
    (v) => v.type === view.type && defaultLayouts[v.type]
  )?.component;
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    ViewComponent,
    {
      className,
      actions,
      data,
      fields,
      getItemId,
      getItemLevel,
      isLoading,
      onChangeView,
      onChangeSelection,
      selection,
      setOpenedFilter,
      onClickItem,
      renderItemLink,
      isItemClickable,
      view,
      empty
    }
  );
}


;// ./node_modules/@wordpress/dataviews/build-module/components/dataviews-pagination/index.js






function dataviews_pagination_DataViewsPagination() {
  const {
    view,
    onChangeView,
    paginationInfo: { totalItems = 0, totalPages }
  } = (0,external_wp_element_.useContext)(dataviews_context_default);
  if (!totalItems || !totalPages || view.infiniteScrollEnabled) {
    return null;
  }
  const currentPage = view.page ?? 1;
  const pageSelectOptions = Array.from(Array(totalPages)).map(
    (_, i) => {
      const page = i + 1;
      return {
        value: page.toString(),
        label: page.toString(),
        "aria-label": currentPage === page ? (0,external_wp_i18n_namespaceObject.sprintf)(
          // translators: 1: current page number. 2: total number of pages.
          (0,external_wp_i18n_namespaceObject.__)("Page %1$d of %2$d"),
          currentPage,
          totalPages
        ) : page.toString()
      };
    }
  );
  return !!totalItems && totalPages !== 1 && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
    external_wp_components_namespaceObject.__experimentalHStack,
    {
      expanded: false,
      className: "dataviews-pagination",
      justify: "end",
      spacing: 6,
      children: [
        /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
          external_wp_components_namespaceObject.__experimentalHStack,
          {
            justify: "flex-start",
            expanded: false,
            spacing: 1,
            className: "dataviews-pagination__page-select",
            children: (0,external_wp_element_.createInterpolateElement)(
              (0,external_wp_i18n_namespaceObject.sprintf)(
                // translators: 1: Current page number, 2: Total number of pages.
                (0,external_wp_i18n_namespaceObject._x)(
                  "<div>Page</div>%1$s<div>of %2$d</div>",
                  "paging"
                ),
                "<CurrentPage />",
                totalPages
              ),
              {
                div: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { "aria-hidden": true }),
                CurrentPage: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
                  external_wp_components_namespaceObject.SelectControl,
                  {
                    "aria-label": (0,external_wp_i18n_namespaceObject.__)("Current page"),
                    value: currentPage.toString(),
                    options: pageSelectOptions,
                    onChange: (newValue) => {
                      onChangeView({
                        ...view,
                        page: +newValue
                      });
                    },
                    size: "small",
                    __nextHasNoMarginBottom: true,
                    variant: "minimal"
                  }
                )
              }
            )
          }
        ),
        /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { expanded: false, spacing: 1, children: [
          /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
            external_wp_components_namespaceObject.Button,
            {
              onClick: () => onChangeView({
                ...view,
                page: currentPage - 1
              }),
              disabled: currentPage === 1,
              accessibleWhenDisabled: true,
              label: (0,external_wp_i18n_namespaceObject.__)("Previous page"),
              icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? next_default : previous_default,
              showTooltip: true,
              size: "compact",
              tooltipPosition: "top"
            }
          ),
          /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
            external_wp_components_namespaceObject.Button,
            {
              onClick: () => onChangeView({ ...view, page: currentPage + 1 }),
              disabled: currentPage >= totalPages,
              accessibleWhenDisabled: true,
              label: (0,external_wp_i18n_namespaceObject.__)("Next page"),
              icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? previous_default : next_default,
              showTooltip: true,
              size: "compact",
              tooltipPosition: "top"
            }
          )
        ] })
      ]
    }
  );
}
var dataviews_pagination_default = (0,external_wp_element_.memo)(dataviews_pagination_DataViewsPagination);


;// ./node_modules/@wordpress/dataviews/build-module/components/dataviews-footer/index.js







const dataviews_footer_EMPTY_ARRAY = [];
function DataViewsFooter() {
  const {
    view,
    paginationInfo: { totalItems = 0, totalPages },
    data,
    actions = dataviews_footer_EMPTY_ARRAY
  } = (0,external_wp_element_.useContext)(dataviews_context_default);
  const hasBulkActions = useSomeItemHasAPossibleBulkAction(actions, data) && [constants_LAYOUT_TABLE, constants_LAYOUT_GRID].includes(view.type);
  if (!totalItems || !totalPages || totalPages <= 1 && !hasBulkActions) {
    return null;
  }
  return !!totalItems && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
    external_wp_components_namespaceObject.__experimentalHStack,
    {
      expanded: false,
      justify: "end",
      className: "dataviews-footer",
      children: [
        hasBulkActions && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(BulkActionsFooter, {}),
        /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(dataviews_pagination_default, {})
      ]
    }
  );
}


;// ./node_modules/@wordpress/dataviews/build-module/components/dataviews-search/index.js






const DataViewsSearch = (0,external_wp_element_.memo)(function Search({ label }) {
  const { view, onChangeView } = (0,external_wp_element_.useContext)(dataviews_context_default);
  const [search, setSearch, debouncedSearch] = (0,external_wp_compose_namespaceObject.useDebouncedInput)(
    view.search
  );
  (0,external_wp_element_.useEffect)(() => {
    setSearch(view.search ?? "");
  }, [view.search, setSearch]);
  const onChangeViewRef = (0,external_wp_element_.useRef)(onChangeView);
  const viewRef = (0,external_wp_element_.useRef)(view);
  (0,external_wp_element_.useEffect)(() => {
    onChangeViewRef.current = onChangeView;
    viewRef.current = view;
  }, [onChangeView, view]);
  (0,external_wp_element_.useEffect)(() => {
    if (debouncedSearch !== viewRef.current?.search) {
      onChangeViewRef.current({
        ...viewRef.current,
        page: 1,
        search: debouncedSearch
      });
    }
  }, [debouncedSearch]);
  const searchLabel = label || (0,external_wp_i18n_namespaceObject.__)("Search");
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    external_wp_components_namespaceObject.SearchControl,
    {
      className: "dataviews-search",
      __nextHasNoMarginBottom: true,
      onChange: setSearch,
      value: search,
      label: searchLabel,
      placeholder: searchLabel,
      size: "compact"
    }
  );
});
var dataviews_search_default = DataViewsSearch;


;// ./node_modules/@wordpress/icons/build-module/library/lock.js


var lock_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M17 10h-1.2V7c0-2.1-1.7-3.8-3.8-3.8-2.1 0-3.8 1.7-3.8 3.8v3H7c-.6 0-1 .4-1 1v8c0 .6.4 1 1 1h10c.6 0 1-.4 1-1v-8c0-.6-.4-1-1-1zm-2.8 0H9.8V7c0-1.2 1-2.2 2.2-2.2s2.2 1 2.2 2.2v3z" }) });


;// ./node_modules/@wordpress/icons/build-module/library/cog.js


var cog_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
  external_wp_primitives_namespaceObject.Path,
  {
    fillRule: "evenodd",
    d: "M10.289 4.836A1 1 0 0111.275 4h1.306a1 1 0 01.987.836l.244 1.466c.787.26 1.503.679 2.108 1.218l1.393-.522a1 1 0 011.216.437l.653 1.13a1 1 0 01-.23 1.273l-1.148.944a6.025 6.025 0 010 2.435l1.149.946a1 1 0 01.23 1.272l-.653 1.13a1 1 0 01-1.216.437l-1.394-.522c-.605.54-1.32.958-2.108 1.218l-.244 1.466a1 1 0 01-.987.836h-1.306a1 1 0 01-.986-.836l-.244-1.466a5.995 5.995 0 01-2.108-1.218l-1.394.522a1 1 0 01-1.217-.436l-.653-1.131a1 1 0 01.23-1.272l1.149-.946a6.026 6.026 0 010-2.435l-1.148-.944a1 1 0 01-.23-1.272l.653-1.131a1 1 0 011.217-.437l1.393.522a5.994 5.994 0 012.108-1.218l.244-1.466zM14.929 12a3 3 0 11-6 0 3 3 0 016 0z",
    clipRule: "evenodd"
  }
) });


;// external ["wp","warning"]
const external_wp_warning_namespaceObject = window["wp"]["warning"];
var external_wp_warning_default = /*#__PURE__*/__webpack_require__.n(external_wp_warning_namespaceObject);
;// ./node_modules/@wordpress/dataviews/build-module/components/dataviews-view-config/infinite-scroll-toggle.js





function InfiniteScrollToggle() {
  const context = (0,external_wp_element_.useContext)(dataviews_context_default);
  const { view, onChangeView } = context;
  const infiniteScrollEnabled = view.infiniteScrollEnabled ?? false;
  if (!context.hasInfiniteScrollHandler) {
    return null;
  }
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    external_wp_components_namespaceObject.ToggleControl,
    {
      __nextHasNoMarginBottom: true,
      label: (0,external_wp_i18n_namespaceObject.__)("Enable infinite scroll"),
      help: (0,external_wp_i18n_namespaceObject.__)(
        "Automatically load more content as you scroll, instead of showing pagination links."
      ),
      checked: infiniteScrollEnabled,
      onChange: (newValue) => {
        onChangeView({
          ...view,
          infiniteScrollEnabled: newValue
        });
      }
    }
  );
}


;// ./node_modules/@wordpress/dataviews/build-module/components/dataviews-view-config/index.js













const { Menu: dataviews_view_config_Menu } = lock_unlock_unlock(external_wp_components_namespaceObject.privateApis);
const DATAVIEWS_CONFIG_POPOVER_PROPS = {
  className: "dataviews-config__popover",
  placement: "bottom-end",
  offset: 9
};
function ViewTypeMenu() {
  const { view, onChangeView, defaultLayouts } = (0,external_wp_element_.useContext)(dataviews_context_default);
  const availableLayouts = Object.keys(defaultLayouts);
  if (availableLayouts.length <= 1) {
    return null;
  }
  const activeView = VIEW_LAYOUTS.find((v) => view.type === v.type);
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(dataviews_view_config_Menu, { children: [
    /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
      dataviews_view_config_Menu.TriggerButton,
      {
        render: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
          external_wp_components_namespaceObject.Button,
          {
            size: "compact",
            icon: activeView?.icon,
            label: (0,external_wp_i18n_namespaceObject.__)("Layout")
          }
        )
      }
    ),
    /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(dataviews_view_config_Menu.Popover, { children: availableLayouts.map((layout) => {
      const config = VIEW_LAYOUTS.find(
        (v) => v.type === layout
      );
      if (!config) {
        return null;
      }
      return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
        dataviews_view_config_Menu.RadioItem,
        {
          value: layout,
          name: "view-actions-available-view",
          checked: layout === view.type,
          hideOnClick: true,
          onChange: (e) => {
            switch (e.target.value) {
              case "list":
              case "grid":
              case "table":
              case "pickerGrid":
                const viewWithoutLayout = { ...view };
                if ("layout" in viewWithoutLayout) {
                  delete viewWithoutLayout.layout;
                }
                return onChangeView({
                  ...viewWithoutLayout,
                  type: e.target.value,
                  ...defaultLayouts[e.target.value]
                });
            }
            external_wp_warning_default()("Invalid dataview");
          },
          children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(dataviews_view_config_Menu.ItemLabel, { children: config.label })
        },
        layout
      );
    }) })
  ] });
}
function SortFieldControl() {
  const { view, fields, onChangeView } = (0,external_wp_element_.useContext)(dataviews_context_default);
  const orderOptions = (0,external_wp_element_.useMemo)(() => {
    const sortableFields = fields.filter(
      (field) => field.enableSorting !== false
    );
    return sortableFields.map((field) => {
      return {
        label: field.label,
        value: field.id
      };
    });
  }, [fields]);
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    external_wp_components_namespaceObject.SelectControl,
    {
      __nextHasNoMarginBottom: true,
      __next40pxDefaultSize: true,
      label: (0,external_wp_i18n_namespaceObject.__)("Sort by"),
      value: view.sort?.field,
      options: orderOptions,
      onChange: (value) => {
        onChangeView({
          ...view,
          sort: {
            direction: view?.sort?.direction || "desc",
            field: value
          },
          showLevels: false
        });
      }
    }
  );
}
function SortDirectionControl() {
  const { view, fields, onChangeView } = (0,external_wp_element_.useContext)(dataviews_context_default);
  const sortableFields = fields.filter(
    (field) => field.enableSorting !== false
  );
  if (sortableFields.length === 0) {
    return null;
  }
  let value = view.sort?.direction;
  if (!value && view.sort?.field) {
    value = "desc";
  }
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    external_wp_components_namespaceObject.__experimentalToggleGroupControl,
    {
      className: "dataviews-view-config__sort-direction",
      __nextHasNoMarginBottom: true,
      __next40pxDefaultSize: true,
      isBlock: true,
      label: (0,external_wp_i18n_namespaceObject.__)("Order"),
      value,
      onChange: (newDirection) => {
        if (newDirection === "asc" || newDirection === "desc") {
          onChangeView({
            ...view,
            sort: {
              direction: newDirection,
              field: view.sort?.field || // If there is no field assigned as the sorting field assign the first sortable field.
              fields.find(
                (field) => field.enableSorting !== false
              )?.id || ""
            },
            showLevels: false
          });
          return;
        }
        external_wp_warning_default()("Invalid direction");
      },
      children: SORTING_DIRECTIONS.map((direction) => {
        return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
          external_wp_components_namespaceObject.__experimentalToggleGroupControlOptionIcon,
          {
            value: direction,
            icon: sortIcons[direction],
            label: sortLabels[direction]
          },
          direction
        );
      })
    }
  );
}
function ItemsPerPageControl() {
  const { view, config, onChangeView } = (0,external_wp_element_.useContext)(dataviews_context_default);
  const { infiniteScrollEnabled } = view;
  if (!config || !config.perPageSizes || config.perPageSizes.length < 2 || config.perPageSizes.length > 6 || infiniteScrollEnabled) {
    return null;
  }
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    external_wp_components_namespaceObject.__experimentalToggleGroupControl,
    {
      __nextHasNoMarginBottom: true,
      __next40pxDefaultSize: true,
      isBlock: true,
      label: (0,external_wp_i18n_namespaceObject.__)("Items per page"),
      value: view.perPage || 10,
      disabled: !view?.sort?.field,
      onChange: (newItemsPerPage) => {
        const newItemsPerPageNumber = typeof newItemsPerPage === "number" || newItemsPerPage === void 0 ? newItemsPerPage : parseInt(newItemsPerPage, 10);
        onChangeView({
          ...view,
          perPage: newItemsPerPageNumber,
          page: 1
        });
      },
      children: config.perPageSizes.map((value) => {
        return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
          external_wp_components_namespaceObject.__experimentalToggleGroupControlOption,
          {
            value,
            label: value.toString()
          },
          value
        );
      })
    }
  );
}
function PreviewOptions({
  previewOptions,
  onChangePreviewOption,
  onMenuOpenChange,
  activeOption
}) {
  const focusPreviewOptionsField = (id) => {
    setTimeout(() => {
      const element = document.querySelector(
        `.dataviews-field-control__field-${id} .dataviews-field-control__field-preview-options-button`
      );
      if (element instanceof HTMLElement) {
        element.focus();
      }
    }, 50);
  };
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(dataviews_view_config_Menu, { onOpenChange: onMenuOpenChange, children: [
    /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
      dataviews_view_config_Menu.TriggerButton,
      {
        render: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
          external_wp_components_namespaceObject.Button,
          {
            className: "dataviews-field-control__field-preview-options-button",
            size: "compact",
            icon: more_vertical_default,
            label: (0,external_wp_i18n_namespaceObject.__)("Preview")
          }
        )
      }
    ),
    /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(dataviews_view_config_Menu.Popover, { children: previewOptions?.map(({ id, label }) => {
      return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
        dataviews_view_config_Menu.RadioItem,
        {
          value: id,
          checked: id === activeOption,
          onChange: () => {
            onChangePreviewOption?.(id);
            focusPreviewOptionsField(id);
          },
          children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(dataviews_view_config_Menu.ItemLabel, { children: label })
        },
        id
      );
    }) })
  ] });
}
function FieldItem({
  field,
  label,
  description,
  isVisible,
  isFirst,
  isLast,
  canMove = true,
  onToggleVisibility,
  onMoveUp,
  onMoveDown,
  previewOptions,
  onChangePreviewOption
}) {
  const [isChangingPreviewOption, setIsChangingPreviewOption] = (0,external_wp_element_.useState)(false);
  const focusVisibilityField = () => {
    setTimeout(() => {
      const element = document.querySelector(
        `.dataviews-field-control__field-${field.id} .dataviews-field-control__field-visibility-button`
      );
      if (element instanceof HTMLElement) {
        element.focus();
      }
    }, 50);
  };
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItem, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
    external_wp_components_namespaceObject.__experimentalHStack,
    {
      expanded: true,
      className: dist_clsx(
        "dataviews-field-control__field",
        `dataviews-field-control__field-${field.id}`,
        // The actions are hidden when the mouse is not hovering the item, or focus
        // is outside the item.
        // For actions that require a popover, a menu etc, that would mean that when the interactive element
        // opens and the focus goes there the actions would be hidden.
        // To avoid that we add a class to the item, that makes sure actions are visible while there is some
        // interaction with the item.
        { "is-interacting": isChangingPreviewOption }
      ),
      justify: "flex-start",
      children: [
        /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "dataviews-field-control__icon", children: !canMove && !field.enableHiding && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { icon: lock_default }) }),
        /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("span", { className: "dataviews-field-control__label-sub-label-container", children: [
          /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "dataviews-field-control__label", children: label || field.label }),
          description && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "dataviews-field-control__sub-label", children: description })
        ] }),
        /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
          external_wp_components_namespaceObject.__experimentalHStack,
          {
            justify: "flex-end",
            expanded: false,
            className: "dataviews-field-control__actions",
            children: [
              isVisible && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
                /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
                  external_wp_components_namespaceObject.Button,
                  {
                    disabled: isFirst || !canMove,
                    accessibleWhenDisabled: true,
                    size: "compact",
                    onClick: onMoveUp,
                    icon: chevron_up_default,
                    label: isFirst || !canMove ? (0,external_wp_i18n_namespaceObject.__)("This field can't be moved up") : (0,external_wp_i18n_namespaceObject.sprintf)(
                      /* translators: %s: field label */
                      (0,external_wp_i18n_namespaceObject.__)("Move %s up"),
                      field.label
                    )
                  }
                ),
                /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
                  external_wp_components_namespaceObject.Button,
                  {
                    disabled: isLast || !canMove,
                    accessibleWhenDisabled: true,
                    size: "compact",
                    onClick: onMoveDown,
                    icon: chevron_down_default,
                    label: isLast || !canMove ? (0,external_wp_i18n_namespaceObject.__)("This field can't be moved down") : (0,external_wp_i18n_namespaceObject.sprintf)(
                      /* translators: %s: field label */
                      (0,external_wp_i18n_namespaceObject.__)("Move %s down"),
                      field.label
                    )
                  }
                )
              ] }),
              onToggleVisibility && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
                external_wp_components_namespaceObject.Button,
                {
                  className: "dataviews-field-control__field-visibility-button",
                  disabled: !field.enableHiding,
                  accessibleWhenDisabled: true,
                  size: "compact",
                  onClick: () => {
                    onToggleVisibility();
                    focusVisibilityField();
                  },
                  icon: isVisible ? unseen_default : seen_default,
                  label: isVisible ? (0,external_wp_i18n_namespaceObject.sprintf)(
                    /* translators: %s: field label */
                    (0,external_wp_i18n_namespaceObject._x)("Hide %s", "field"),
                    field.label
                  ) : (0,external_wp_i18n_namespaceObject.sprintf)(
                    /* translators: %s: field label */
                    (0,external_wp_i18n_namespaceObject._x)("Show %s", "field"),
                    field.label
                  )
                }
              ),
              previewOptions && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
                PreviewOptions,
                {
                  previewOptions,
                  onChangePreviewOption,
                  onMenuOpenChange: setIsChangingPreviewOption,
                  activeOption: field.id
                }
              )
            ]
          }
        )
      ]
    }
  ) });
}
function RegularFieldItem({
  index,
  field,
  view,
  onChangeView
}) {
  const visibleFieldIds = view.fields ?? [];
  const isVisible = index !== void 0 && visibleFieldIds.includes(field.id);
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    FieldItem,
    {
      field,
      isVisible,
      isFirst: index !== void 0 && index < 1,
      isLast: index !== void 0 && index === visibleFieldIds.length - 1,
      onToggleVisibility: () => {
        onChangeView({
          ...view,
          fields: isVisible ? visibleFieldIds.filter(
            (fieldId) => fieldId !== field.id
          ) : [...visibleFieldIds, field.id]
        });
      },
      onMoveUp: index !== void 0 ? () => {
        onChangeView({
          ...view,
          fields: [
            ...visibleFieldIds.slice(
              0,
              index - 1
            ) ?? [],
            field.id,
            visibleFieldIds[index - 1],
            ...visibleFieldIds.slice(index + 1)
          ]
        });
      } : void 0,
      onMoveDown: index !== void 0 ? () => {
        onChangeView({
          ...view,
          fields: [
            ...visibleFieldIds.slice(0, index) ?? [],
            visibleFieldIds[index + 1],
            field.id,
            ...visibleFieldIds.slice(index + 2)
          ]
        });
      } : void 0
    }
  );
}
function dataviews_view_config_isDefined(item) {
  return !!item;
}
function FieldControl() {
  const { view, fields, onChangeView } = (0,external_wp_element_.useContext)(dataviews_context_default);
  const togglableFields = [
    view?.titleField,
    view?.mediaField,
    view?.descriptionField
  ].filter(Boolean);
  const visibleFieldIds = view.fields ?? [];
  const hiddenFields = fields.filter(
    (f) => !visibleFieldIds.includes(f.id) && !togglableFields.includes(f.id) && f.type !== "media" && f.enableHiding !== false
  );
  let visibleFields = visibleFieldIds.map((fieldId) => fields.find((f) => f.id === fieldId)).filter(dataviews_view_config_isDefined);
  if (!visibleFields?.length && !hiddenFields?.length) {
    return null;
  }
  const titleField = fields.find((f) => f.id === view.titleField);
  const previewField = fields.find((f) => f.id === view.mediaField);
  const descriptionField = fields.find(
    (f) => f.id === view.descriptionField
  );
  const previewFields = fields.filter((f) => f.type === "media");
  let previewFieldUI;
  if (previewFields.length > 1) {
    const isPreviewFieldVisible = dataviews_view_config_isDefined(previewField) && (view.showMedia ?? true);
    previewFieldUI = dataviews_view_config_isDefined(previewField) && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
      FieldItem,
      {
        field: previewField,
        label: (0,external_wp_i18n_namespaceObject.__)("Preview"),
        description: previewField.label,
        isVisible: isPreviewFieldVisible,
        onToggleVisibility: () => {
          onChangeView({
            ...view,
            showMedia: !isPreviewFieldVisible
          });
        },
        canMove: false,
        previewOptions: previewFields.map((field) => ({
          label: field.label,
          id: field.id
        })),
        onChangePreviewOption: (newPreviewId) => onChangeView({ ...view, mediaField: newPreviewId })
      },
      previewField.id
    );
  }
  const lockedFields = [
    {
      field: titleField,
      isVisibleFlag: "showTitle"
    },
    {
      field: previewField,
      isVisibleFlag: "showMedia",
      ui: previewFieldUI
    },
    {
      field: descriptionField,
      isVisibleFlag: "showDescription"
    }
  ].filter(({ field }) => dataviews_view_config_isDefined(field));
  let visibleLockedFields = lockedFields.filter(
    ({ field, isVisibleFlag }) => (
      // @ts-expect-error
      dataviews_view_config_isDefined(field) && (view[isVisibleFlag] ?? true)
    )
  );
  if (visibleLockedFields.length === 1) {
    visibleLockedFields = visibleLockedFields.map((locked) => ({
      ...locked,
      field: { ...locked.field, enableHiding: false }
    }));
  }
  if (visibleLockedFields.length === 0 && visibleFields.length === 1) {
    visibleFields = [{ ...visibleFields[0], enableHiding: false }];
  }
  const hiddenLockedFields = lockedFields.filter(
    ({ field, isVisibleFlag }) => (
      // @ts-expect-error
      dataviews_view_config_isDefined(field) && !(view[isVisibleFlag] ?? true)
    )
  );
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { className: "dataviews-field-control", spacing: 6, children: [
    /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, { className: "dataviews-view-config__properties", spacing: 0, children: (visibleLockedFields.length > 0 || !!visibleFields?.length) && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalItemGroup, { isBordered: true, isSeparated: true, children: [
      visibleLockedFields.map(
        ({ field, isVisibleFlag, ui }) => {
          return ui ?? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
            FieldItem,
            {
              field,
              isVisible: true,
              onToggleVisibility: () => {
                onChangeView({
                  ...view,
                  [isVisibleFlag]: false
                });
              },
              canMove: false
            },
            field.id
          );
        }
      ),
      visibleFields.map((field, index) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
        RegularFieldItem,
        {
          field,
          view,
          onChangeView,
          index
        },
        field.id
      ))
    ] }) }),
    (!!hiddenFields?.length || !!hiddenLockedFields.length) && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 4, children: [
      /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.BaseControl.VisualLabel, { style: { margin: 0 }, children: (0,external_wp_i18n_namespaceObject.__)("Hidden") }),
      /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
        external_wp_components_namespaceObject.__experimentalVStack,
        {
          className: "dataviews-view-config__properties",
          spacing: 0,
          children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalItemGroup, { isBordered: true, isSeparated: true, children: [
            hiddenLockedFields.length > 0 && hiddenLockedFields.map(
              ({ field, isVisibleFlag, ui }) => {
                return ui ?? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
                  FieldItem,
                  {
                    field,
                    isVisible: false,
                    onToggleVisibility: () => {
                      onChangeView({
                        ...view,
                        [isVisibleFlag]: true
                      });
                    },
                    canMove: false
                  },
                  field.id
                );
              }
            ),
            hiddenFields.map((field) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
              RegularFieldItem,
              {
                field,
                view,
                onChangeView
              },
              field.id
            ))
          ] })
        }
      )
    ] })
  ] });
}
function SettingsSection({
  title,
  description,
  children
}) {
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalGrid, { columns: 12, className: "dataviews-settings-section", gap: 4, children: [
    /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "dataviews-settings-section__sidebar", children: [
      /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
        external_wp_components_namespaceObject.__experimentalHeading,
        {
          level: 2,
          className: "dataviews-settings-section__title",
          children: title
        }
      ),
      description && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
        external_wp_components_namespaceObject.__experimentalText,
        {
          variant: "muted",
          className: "dataviews-settings-section__description",
          children: description
        }
      )
    ] }),
    /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
      external_wp_components_namespaceObject.__experimentalGrid,
      {
        columns: 8,
        gap: 4,
        className: "dataviews-settings-section__content",
        children
      }
    )
  ] });
}
function DataviewsViewConfigDropdown() {
  const { view } = (0,external_wp_element_.useContext)(dataviews_context_default);
  const popoverId = (0,external_wp_compose_namespaceObject.useInstanceId)(
    _DataViewsViewConfig,
    "dataviews-view-config-dropdown"
  );
  const activeLayout = VIEW_LAYOUTS.find(
    (layout) => layout.type === view.type
  );
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    external_wp_components_namespaceObject.Dropdown,
    {
      expandOnMobile: true,
      popoverProps: {
        ...DATAVIEWS_CONFIG_POPOVER_PROPS,
        id: popoverId
      },
      renderToggle: ({ onToggle, isOpen }) => {
        return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
          external_wp_components_namespaceObject.Button,
          {
            size: "compact",
            icon: cog_default,
            label: (0,external_wp_i18n_namespaceObject._x)("View options", "View is used as a noun"),
            onClick: onToggle,
            "aria-expanded": isOpen ? "true" : "false",
            "aria-controls": popoverId
          }
        );
      },
      renderContent: () => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
        external_wp_components_namespaceObject.__experimentalDropdownContentWrapper,
        {
          paddingSize: "medium",
          className: "dataviews-config__popover-content-wrapper",
          children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { className: "dataviews-view-config", spacing: 6, children: [
            /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(SettingsSection, { title: (0,external_wp_i18n_namespaceObject.__)("Appearance"), children: [
              /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { expanded: true, className: "is-divided-in-two", children: [
                /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SortFieldControl, {}),
                /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SortDirectionControl, {})
              ] }),
              !!activeLayout?.viewConfigOptions && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(activeLayout.viewConfigOptions, {}),
              /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(InfiniteScrollToggle, {}),
              /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ItemsPerPageControl, {})
            ] }),
            /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SettingsSection, { title: (0,external_wp_i18n_namespaceObject.__)("Properties"), children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(FieldControl, {}) })
          ] })
        }
      )
    }
  );
}
function _DataViewsViewConfig() {
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
    /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ViewTypeMenu, {}),
    /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(DataviewsViewConfigDropdown, {})
  ] });
}
const DataViewsViewConfig = (0,external_wp_element_.memo)(_DataViewsViewConfig);
var dataviews_view_config_default = DataViewsViewConfig;


;// ./node_modules/@wordpress/dataviews/build-module/components/dataviews/index.js














const defaultGetItemId = (item) => item.id;
const defaultIsItemClickable = () => true;
const dataviews_EMPTY_ARRAY = [];
const dataViewsLayouts = VIEW_LAYOUTS.filter(
  (viewLayout) => !viewLayout.isPicker
);
function DefaultUI({
  header,
  search = true,
  searchLabel = void 0
}) {
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
    /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
      external_wp_components_namespaceObject.__experimentalHStack,
      {
        alignment: "top",
        justify: "space-between",
        className: "dataviews__view-actions",
        spacing: 1,
        children: [
          /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
            external_wp_components_namespaceObject.__experimentalHStack,
            {
              justify: "start",
              expanded: false,
              className: "dataviews__search",
              children: [
                search && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(dataviews_search_default, { label: searchLabel }),
                /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(toggle_default, {})
              ]
            }
          ),
          /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
            external_wp_components_namespaceObject.__experimentalHStack,
            {
              spacing: 1,
              expanded: false,
              style: { flexShrink: 0 },
              children: [
                /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(dataviews_view_config_default, {}),
                header
              ]
            }
          )
        ]
      }
    ),
    /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(filters_toggled_default, { className: "dataviews-filters__container" }),
    /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(DataViewsLayout, {}),
    /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(DataViewsFooter, {})
  ] });
}
function DataViews({
  view,
  onChangeView,
  fields,
  search = true,
  searchLabel = void 0,
  actions = dataviews_EMPTY_ARRAY,
  data,
  getItemId = defaultGetItemId,
  getItemLevel,
  isLoading = false,
  paginationInfo,
  defaultLayouts: defaultLayoutsProperty,
  selection: selectionProperty,
  onChangeSelection,
  onClickItem,
  renderItemLink,
  isItemClickable = defaultIsItemClickable,
  header,
  children,
  config = { perPageSizes: [10, 20, 50, 100] },
  empty
}) {
  const { infiniteScrollHandler } = paginationInfo;
  const containerRef = (0,external_wp_element_.useRef)(null);
  const [containerWidth, setContainerWidth] = (0,external_wp_element_.useState)(0);
  const resizeObserverRef = (0,external_wp_compose_namespaceObject.useResizeObserver)(
    (resizeObserverEntries) => {
      setContainerWidth(
        resizeObserverEntries[0].borderBoxSize[0].inlineSize
      );
    },
    { box: "border-box" }
  );
  const [selectionState, setSelectionState] = (0,external_wp_element_.useState)([]);
  const isUncontrolled = selectionProperty === void 0 || onChangeSelection === void 0;
  const selection = isUncontrolled ? selectionState : selectionProperty;
  const [openedFilter, setOpenedFilter] = (0,external_wp_element_.useState)(null);
  function setSelectionWithChange(value) {
    const newValue = typeof value === "function" ? value(selection) : value;
    if (isUncontrolled) {
      setSelectionState(newValue);
    }
    if (onChangeSelection) {
      onChangeSelection(newValue);
    }
  }
  const _fields = (0,external_wp_element_.useMemo)(() => normalizeFields(fields), [fields]);
  const _selection = (0,external_wp_element_.useMemo)(() => {
    return selection.filter(
      (id) => data.some((item) => getItemId(item) === id)
    );
  }, [selection, data, getItemId]);
  const filters = use_filters_default(_fields, view);
  const hasPrimaryOrLockedFilters = (0,external_wp_element_.useMemo)(
    () => (filters || []).some(
      (filter) => filter.isPrimary || filter.isLocked
    ),
    [filters]
  );
  const [isShowingFilter, setIsShowingFilter] = (0,external_wp_element_.useState)(
    hasPrimaryOrLockedFilters
  );
  (0,external_wp_element_.useEffect)(() => {
    if (hasPrimaryOrLockedFilters && !isShowingFilter) {
      setIsShowingFilter(true);
    }
  }, [hasPrimaryOrLockedFilters, isShowingFilter]);
  (0,external_wp_element_.useEffect)(() => {
    if (!view.infiniteScrollEnabled || !containerRef.current) {
      return;
    }
    const handleScroll = (0,external_wp_compose_namespaceObject.throttle)((event) => {
      const target = event.target;
      const scrollTop = target.scrollTop;
      const scrollHeight = target.scrollHeight;
      const clientHeight = target.clientHeight;
      if (scrollTop + clientHeight >= scrollHeight - 100) {
        infiniteScrollHandler?.();
      }
    }, 100);
    const container = containerRef.current;
    container.addEventListener("scroll", handleScroll);
    return () => {
      container.removeEventListener("scroll", handleScroll);
      handleScroll.cancel();
    };
  }, [infiniteScrollHandler, view.infiniteScrollEnabled]);
  const defaultLayouts = (0,external_wp_element_.useMemo)(
    () => Object.fromEntries(
      Object.entries(defaultLayoutsProperty).filter(
        ([layoutType]) => {
          return dataViewsLayouts.some(
            (viewLayout) => viewLayout.type === layoutType
          );
        }
      )
    ),
    [defaultLayoutsProperty]
  );
  if (!defaultLayouts[view.type]) {
    return null;
  }
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    dataviews_context_default.Provider,
    {
      value: {
        view,
        onChangeView,
        fields: _fields,
        actions,
        data,
        isLoading,
        paginationInfo,
        selection: _selection,
        onChangeSelection: setSelectionWithChange,
        openedFilter,
        setOpenedFilter,
        getItemId,
        getItemLevel,
        isItemClickable,
        onClickItem,
        renderItemLink,
        containerWidth,
        containerRef,
        resizeObserverRef,
        defaultLayouts,
        filters,
        isShowingFilter,
        setIsShowingFilter,
        config,
        empty,
        hasInfiniteScrollHandler: !!infiniteScrollHandler
      },
      children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "dataviews-wrapper", ref: containerRef, children: children ?? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
        DefaultUI,
        {
          header,
          search,
          searchLabel
        }
      ) })
    }
  );
}
const DataViewsSubComponents = DataViews;
DataViewsSubComponents.BulkActionToolbar = BulkActionsFooter;
DataViewsSubComponents.Filters = filters_default;
DataViewsSubComponents.FiltersToggled = filters_toggled_default;
DataViewsSubComponents.FiltersToggle = toggle_default;
DataViewsSubComponents.Layout = DataViewsLayout;
DataViewsSubComponents.LayoutSwitcher = ViewTypeMenu;
DataViewsSubComponents.Pagination = dataviews_pagination_DataViewsPagination;
DataViewsSubComponents.Search = dataviews_search_default;
DataViewsSubComponents.ViewConfig = DataviewsViewConfigDropdown;
DataViewsSubComponents.Footer = DataViewsFooter;
var dataviews_default = DataViewsSubComponents;


// EXTERNAL MODULE: ./node_modules/@wordpress/views/build-module/index.js + 4 modules
var build_module = __webpack_require__(7951);
;// ./node_modules/@wordpress/edit-site/build-module/components/page-patterns/use-pattern-settings.js






function usePatternSettings() {
  const storedSettings = (0,external_wp_data_.useSelect)((select) => {
    const { getSettings } = unlock(select(store));
    return getSettings();
  }, []);
  const settingsBlockPatterns = storedSettings.__experimentalAdditionalBlockPatterns ?? // WP 6.0
  storedSettings.__experimentalBlockPatterns;
  const restBlockPatterns = (0,external_wp_data_.useSelect)(
    (select) => select(external_wp_coreData_namespaceObject.store).getBlockPatterns(),
    []
  );
  const blockPatterns = (0,external_wp_element_.useMemo)(
    () => [
      ...settingsBlockPatterns || [],
      ...restBlockPatterns || []
    ].filter(filterOutDuplicatesByName),
    [settingsBlockPatterns, restBlockPatterns]
  );
  const settings = (0,external_wp_element_.useMemo)(() => {
    const { __experimentalAdditionalBlockPatterns, ...restStoredSettings } = storedSettings;
    return {
      ...restStoredSettings,
      __experimentalBlockPatterns: blockPatterns,
      isPreviewMode: true
    };
  }, [storedSettings, blockPatterns]);
  return settings;
}


;// ./node_modules/@wordpress/icons/build-module/library/symbol-filled.js


var symbol_filled_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M21.3 10.8l-5.6-5.6c-.7-.7-1.8-.7-2.5 0l-5.6 5.6c-.7.7-.7 1.8 0 2.5l5.6 5.6c.3.3.8.5 1.2.5s.9-.2 1.2-.5l5.6-5.6c.8-.7.8-1.9.1-2.5zm-17.6 1L10 5.5l-1-1-6.3 6.3c-.7.7-.7 1.8 0 2.5L9 19.5l1.1-1.1-6.3-6.3c-.2 0-.2-.2-.1-.3z" }) });


;// ./node_modules/@wordpress/icons/build-module/library/upload.js


var upload_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M18.5 15v3.5H13V6.7l4.5 4.1 1-1.1-6.2-5.8-5.8 5.8 1 1.1 4-4v11.7h-6V15H4v5h16v-5z" }) });


;// ./node_modules/@wordpress/edit-site/build-module/components/add-new-pattern/index.js













const { useHistory: add_new_pattern_useHistory, useLocation: add_new_pattern_useLocation } = unlock(external_wp_router_namespaceObject.privateApis);
const { CreatePatternModal, useAddPatternCategory } = unlock(
  external_wp_patterns_namespaceObject.privateApis
);
const { CreateTemplatePartModal } = unlock(external_wp_editor_namespaceObject.privateApis);
function AddNewPattern() {
  const history = add_new_pattern_useHistory();
  const location = add_new_pattern_useLocation();
  const [showPatternModal, setShowPatternModal] = (0,external_wp_element_.useState)(false);
  const [showTemplatePartModal, setShowTemplatePartModal] = (0,external_wp_element_.useState)(false);
  const { createPatternFromFile } = unlock((0,external_wp_data_.useDispatch)(external_wp_patterns_namespaceObject.store));
  const { createSuccessNotice, createErrorNotice } = (0,external_wp_data_.useDispatch)(external_wp_notices_namespaceObject.store);
  const patternUploadInputRef = (0,external_wp_element_.useRef)();
  const {
    isBlockBasedTheme,
    addNewPatternLabel,
    addNewTemplatePartLabel,
    canCreatePattern,
    canCreateTemplatePart
  } = (0,external_wp_data_.useSelect)((select) => {
    const { getCurrentTheme, getPostType, canUser } = select(external_wp_coreData_namespaceObject.store);
    return {
      isBlockBasedTheme: getCurrentTheme()?.is_block_theme,
      addNewPatternLabel: getPostType(PATTERN_TYPES.user)?.labels?.add_new_item,
      addNewTemplatePartLabel: getPostType(TEMPLATE_PART_POST_TYPE)?.labels?.add_new_item,
      // Blocks refers to the wp_block post type, this checks the ability to create a post of that type.
      canCreatePattern: canUser("create", {
        kind: "postType",
        name: PATTERN_TYPES.user
      }),
      canCreateTemplatePart: canUser("create", {
        kind: "postType",
        name: TEMPLATE_PART_POST_TYPE
      })
    };
  }, []);
  function handleCreatePattern({ pattern }) {
    setShowPatternModal(false);
    history.navigate(
      `/${PATTERN_TYPES.user}/${pattern.id}?canvas=edit`
    );
  }
  function handleCreateTemplatePart(templatePart) {
    setShowTemplatePartModal(false);
    history.navigate(
      `/${TEMPLATE_PART_POST_TYPE}/${templatePart.id}?canvas=edit`
    );
  }
  function handleError() {
    setShowPatternModal(false);
    setShowTemplatePartModal(false);
  }
  const controls = [];
  if (canCreatePattern) {
    controls.push({
      icon: symbol_default,
      onClick: () => setShowPatternModal(true),
      title: addNewPatternLabel
    });
  }
  if (isBlockBasedTheme && canCreateTemplatePart) {
    controls.push({
      icon: symbol_filled_default,
      onClick: () => setShowTemplatePartModal(true),
      title: addNewTemplatePartLabel
    });
  }
  if (canCreatePattern) {
    controls.push({
      icon: upload_default,
      onClick: () => {
        patternUploadInputRef.current.click();
      },
      title: (0,external_wp_i18n_namespaceObject.__)("Import pattern from JSON")
    });
  }
  const { categoryMap, findOrCreateTerm } = useAddPatternCategory();
  if (controls.length === 0) {
    return null;
  }
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
    addNewPatternLabel && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
      external_wp_components_namespaceObject.DropdownMenu,
      {
        controls,
        icon: null,
        toggleProps: {
          variant: "primary",
          showTooltip: false,
          __next40pxDefaultSize: true
        },
        text: addNewPatternLabel,
        label: addNewPatternLabel
      }
    ),
    showPatternModal && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
      CreatePatternModal,
      {
        onClose: () => setShowPatternModal(false),
        onSuccess: handleCreatePattern,
        onError: handleError
      }
    ),
    showTemplatePartModal && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
      CreateTemplatePartModal,
      {
        closeModal: () => setShowTemplatePartModal(false),
        blocks: [],
        onCreate: handleCreateTemplatePart,
        onError: handleError
      }
    ),
    /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
      "input",
      {
        type: "file",
        accept: ".json",
        hidden: true,
        ref: patternUploadInputRef,
        onChange: async (event) => {
          const file = event.target.files?.[0];
          if (!file) {
            return;
          }
          try {
            let currentCategoryId;
            if (location.query.postType !== TEMPLATE_PART_POST_TYPE) {
              const currentCategory = Array.from(
                categoryMap.values()
              ).find(
                (term) => term.name === location.query.categoryId
              );
              if (currentCategory) {
                currentCategoryId = currentCategory.id || await findOrCreateTerm(
                  currentCategory.label
                );
              }
            }
            const pattern = await createPatternFromFile(
              file,
              currentCategoryId ? [currentCategoryId] : void 0
            );
            if (!currentCategoryId && location.query.categoryId !== "my-patterns") {
              history.navigate(
                `/pattern?categoryId=${PATTERN_DEFAULT_CATEGORY}`
              );
            }
            createSuccessNotice(
              (0,external_wp_i18n_namespaceObject.sprintf)(
                // translators: %s: The imported pattern's title.
                (0,external_wp_i18n_namespaceObject.__)('Imported "%s" from JSON.'),
                pattern.title.raw
              ),
              {
                type: "snackbar",
                id: "import-pattern-success"
              }
            );
          } catch (err) {
            createErrorNotice(err.message, {
              type: "snackbar",
              id: "import-pattern-error"
            });
          } finally {
            event.target.value = "";
          }
        }
      }
    )
  ] });
}


;// ./node_modules/@wordpress/edit-site/build-module/components/page-patterns/rename-category-menu-item.js







const { RenamePatternCategoryModal } = unlock(external_wp_patterns_namespaceObject.privateApis);
function RenameCategoryMenuItem({ category, onClose }) {
  const [isModalOpen, setIsModalOpen] = (0,external_wp_element_.useState)(false);
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
    /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { onClick: () => setIsModalOpen(true), children: (0,external_wp_i18n_namespaceObject.__)("Rename") }),
    isModalOpen && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
      rename_category_menu_item_RenameModal,
      {
        category,
        onClose: () => {
          setIsModalOpen(false);
          onClose();
        }
      }
    )
  ] });
}
function rename_category_menu_item_RenameModal({ category, onClose }) {
  const normalizedCategory = {
    id: category.id,
    slug: category.slug,
    name: category.label
  };
  const existingCategories = usePatternCategories();
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    RenamePatternCategoryModal,
    {
      category: normalizedCategory,
      existingCategories,
      onClose,
      overlayClassName: "edit-site-list__rename-modal",
      focusOnMount: "firstContentElement",
      size: "small"
    }
  );
}


;// ./node_modules/@wordpress/edit-site/build-module/components/page-patterns/delete-category-menu-item.js











const { useHistory: delete_category_menu_item_useHistory } = unlock(external_wp_router_namespaceObject.privateApis);
function DeleteCategoryMenuItem({ category, onClose }) {
  const [isModalOpen, setIsModalOpen] = (0,external_wp_element_.useState)(false);
  const history = delete_category_menu_item_useHistory();
  const { createSuccessNotice, createErrorNotice } = (0,external_wp_data_.useDispatch)(external_wp_notices_namespaceObject.store);
  const { deleteEntityRecord, invalidateResolution } = (0,external_wp_data_.useDispatch)(external_wp_coreData_namespaceObject.store);
  const onDelete = async () => {
    try {
      await deleteEntityRecord(
        "taxonomy",
        "wp_pattern_category",
        category.id,
        { force: true },
        { throwOnError: true }
      );
      invalidateResolution("getUserPatternCategories");
      invalidateResolution("getEntityRecords", [
        "postType",
        PATTERN_TYPES.user,
        { per_page: -1 }
      ]);
      createSuccessNotice(
        (0,external_wp_i18n_namespaceObject.sprintf)(
          /* translators: %s: The pattern category's name */
          (0,external_wp_i18n_namespaceObject._x)('"%s" deleted.', "pattern category"),
          category.label
        ),
        { type: "snackbar", id: "pattern-category-delete" }
      );
      onClose?.();
      history.navigate(
        `/pattern?categoryId=${PATTERN_DEFAULT_CATEGORY}`
      );
    } catch (error) {
      const errorMessage = error.message && error.code !== "unknown_error" ? error.message : (0,external_wp_i18n_namespaceObject.__)(
        "An error occurred while deleting the pattern category."
      );
      createErrorNotice(errorMessage, {
        type: "snackbar",
        id: "pattern-category-delete"
      });
    }
  };
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
    /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { isDestructive: true, onClick: () => setIsModalOpen(true), children: (0,external_wp_i18n_namespaceObject.__)("Delete") }),
    /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
      external_wp_components_namespaceObject.__experimentalConfirmDialog,
      {
        isOpen: isModalOpen,
        onConfirm: onDelete,
        onCancel: () => setIsModalOpen(false),
        confirmButtonText: (0,external_wp_i18n_namespaceObject.__)("Delete"),
        className: "edit-site-patterns__delete-modal",
        title: (0,external_wp_i18n_namespaceObject.sprintf)(
          // translators: %s: The pattern category's name.
          (0,external_wp_i18n_namespaceObject._x)('Delete "%s"?', "pattern category"),
          (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(category.label)
        ),
        size: "medium",
        __experimentalHideHeader: false,
        children: (0,external_wp_i18n_namespaceObject.sprintf)(
          // translators: %s: The pattern category's name.
          (0,external_wp_i18n_namespaceObject.__)(
            'Are you sure you want to delete the category "%s"? The patterns will not be deleted.'
          ),
          (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(category.label)
        )
      }
    )
  ] });
}


;// ./node_modules/@wordpress/edit-site/build-module/components/page-patterns/actions.js









function PatternsActions({ categoryId, type }) {
  const { patternCategories } = usePatternCategories();
  let patternCategory;
  if (type === PATTERN_TYPES.user && !!categoryId) {
    patternCategory = patternCategories.find(
      (category) => category.name === categoryId
    );
  }
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
    /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(AddNewPattern, {}),
    !!patternCategory?.id && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
      external_wp_components_namespaceObject.DropdownMenu,
      {
        icon: more_vertical_default,
        label: (0,external_wp_i18n_namespaceObject.__)("Actions"),
        toggleProps: {
          className: "edit-site-patterns__button",
          size: "compact"
        },
        children: ({ onClose }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.MenuGroup, { children: [
          /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
            RenameCategoryMenuItem,
            {
              category: patternCategory,
              onClose
            }
          ),
          /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
            DeleteCategoryMenuItem,
            {
              category: patternCategory,
              onClose
            }
          )
        ] })
      }
    )
  ] });
}


;// ./node_modules/@wordpress/icons/build-module/library/pencil.js


var pencil_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "m19 7-3-3-8.5 8.5-1 4 4-1L19 7Zm-7 11.5H5V20h7v-1.5Z" }) });


;// ./node_modules/@wordpress/edit-site/build-module/components/dataviews-actions/index.js






const { useHistory: dataviews_actions_useHistory } = unlock(external_wp_router_namespaceObject.privateApis);
const useEditPostAction = () => {
  const history = dataviews_actions_useHistory();
  return (0,external_wp_element_.useMemo)(
    () => ({
      id: "edit-post",
      label: (0,external_wp_i18n_namespaceObject.__)("Edit"),
      isPrimary: true,
      icon: pencil_default,
      isEligible(post) {
        if (post.status === "trash") {
          return false;
        }
        return post.type !== PATTERN_TYPES.theme;
      },
      callback(items) {
        const post = items[0];
        history.navigate(`/${post.type}/${post.id}?canvas=edit`);
      }
    }),
    [history]
  );
};


;// ./node_modules/@wordpress/icons/build-module/library/plugins.js


var plugins_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M10.5 4v4h3V4H15v4h1.5a1 1 0 011 1v4l-3 4v2a1 1 0 01-1 1h-3a1 1 0 01-1-1v-2l-3-4V9a1 1 0 011-1H9V4h1.5zm.5 12.5v2h2v-2l3-4v-3H8v3l3 4z" }) });


;// ./node_modules/@wordpress/icons/build-module/library/globe.js


var globe_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M12 4c-4.4 0-8 3.6-8 8s3.6 8 8 8 8-3.6 8-8-3.6-8-8-8Zm6.5 8c0 .6 0 1.2-.2 1.8h-2.7c0-.6.2-1.1.2-1.8s0-1.2-.2-1.8h2.7c.2.6.2 1.1.2 1.8Zm-.9-3.2h-2.4c-.3-.9-.7-1.8-1.1-2.4-.1-.2-.2-.4-.3-.5 1.6.5 3 1.6 3.8 3ZM12.8 17c-.3.5-.6 1-.8 1.3-.2-.3-.5-.8-.8-1.3-.3-.5-.6-1.1-.8-1.7h3.3c-.2.6-.5 1.2-.8 1.7Zm-2.9-3.2c-.1-.6-.2-1.1-.2-1.8s0-1.2.2-1.8H14c.1.6.2 1.1.2 1.8s0 1.2-.2 1.8H9.9ZM11.2 7c.3-.5.6-1 .8-1.3.2.3.5.8.8 1.3.3.5.6 1.1.8 1.7h-3.3c.2-.6.5-1.2.8-1.7Zm-1-1.2c-.1.2-.2.3-.3.5-.4.7-.8 1.5-1.1 2.4H6.4c.8-1.4 2.2-2.5 3.8-3Zm-1.8 8H5.7c-.2-.6-.2-1.1-.2-1.8s0-1.2.2-1.8h2.7c0 .6-.2 1.1-.2 1.8s0 1.2.2 1.8Zm-2 1.4h2.4c.3.9.7 1.8 1.1 2.4.1.2.2.4.3.5-1.6-.5-3-1.6-3.8-3Zm7.4 3c.1-.2.2-.3.3-.5.4-.7.8-1.5 1.1-2.4h2.4c-.8 1.4-2.2 2.5-3.8 3Z" }) });


;// ./node_modules/@wordpress/icons/build-module/library/comment-author-avatar.js


var comment_author_avatar_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
  external_wp_primitives_namespaceObject.Path,
  {
    fillRule: "evenodd",
    d: "M7.25 16.437a6.5 6.5 0 1 1 9.5 0V16A2.75 2.75 0 0 0 14 13.25h-4A2.75 2.75 0 0 0 7.25 16v.437Zm1.5 1.193a6.47 6.47 0 0 0 3.25.87 6.47 6.47 0 0 0 3.25-.87V16c0-.69-.56-1.25-1.25-1.25h-4c-.69 0-1.25.56-1.25 1.25v1.63ZM4 12a8 8 0 1 1 16 0 8 8 0 0 1-16 0Zm10-2a2 2 0 1 1-4 0 2 2 0 0 1 4 0Z",
    clipRule: "evenodd"
  }
) });


;// ./node_modules/@wordpress/edit-site/build-module/components/page-templates/hooks.js




function useAddedBy(postType, postId) {
  return (0,external_wp_data_.useSelect)(
    (select) => {
      const { getEntityRecord, getUser, getEditedEntityRecord } = select(external_wp_coreData_namespaceObject.store);
      const template = getEditedEntityRecord(
        "postType",
        postType,
        postId
      );
      const originalSource = template?.original_source;
      const authorText = template?.author_text;
      switch (originalSource) {
        case "theme": {
          return {
            type: originalSource,
            icon: layout_default,
            text: authorText,
            isCustomized: template.source === TEMPLATE_ORIGINS.custom
          };
        }
        case "plugin": {
          return {
            type: originalSource,
            icon: plugins_default,
            text: authorText,
            isCustomized: template.source === TEMPLATE_ORIGINS.custom
          };
        }
        case "site": {
          const siteData = getEntityRecord(
            "root",
            "__unstableBase"
          );
          return {
            type: originalSource,
            icon: globe_default,
            imageUrl: siteData?.site_logo ? getEntityRecord(
              "postType",
              "attachment",
              siteData.site_logo
            )?.source_url : void 0,
            text: authorText,
            isCustomized: false
          };
        }
        default: {
          const user = getUser(template.author);
          return {
            type: "user",
            icon: comment_author_avatar_default,
            imageUrl: user?.avatar_urls?.[48],
            text: authorText,
            isCustomized: false
          };
        }
      }
    },
    [postType, postId]
  );
}


;// ./node_modules/@wordpress/edit-site/build-module/components/page-patterns/fields.js











const { useGlobalStyle: fields_useGlobalStyle } = unlock(external_wp_blockEditor_namespaceObject.privateApis);
function PreviewField({ item }) {
  const descriptionId = (0,external_wp_element_.useId)();
  const description = item.description || item?.excerpt?.raw;
  const isTemplatePart = item.type === TEMPLATE_PART_POST_TYPE;
  const [backgroundColor] = fields_useGlobalStyle("color.background");
  const blocks = (0,external_wp_element_.useMemo)(() => {
    return item.blocks ?? (0,external_wp_blocks_namespaceObject.parse)(item.content.raw, {
      __unstableSkipMigrationLogs: true
    });
  }, [item?.content?.raw, item.blocks]);
  const isEmpty = !blocks?.length;
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
    "div",
    {
      className: "page-patterns-preview-field",
      style: { backgroundColor },
      "aria-describedby": !!description ? descriptionId : void 0,
      children: [
        isEmpty && isTemplatePart && (0,external_wp_i18n_namespaceObject.__)("Empty template part"),
        isEmpty && !isTemplatePart && (0,external_wp_i18n_namespaceObject.__)("Empty pattern"),
        !isEmpty && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockPreview.Async, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
          external_wp_blockEditor_namespaceObject.BlockPreview,
          {
            blocks,
            viewportWidth: item.viewportWidth
          }
        ) }),
        !!description && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { hidden: true, id: descriptionId, children: description })
      ]
    }
  );
}
const previewField = {
  label: (0,external_wp_i18n_namespaceObject.__)("Preview"),
  id: "preview",
  render: PreviewField,
  enableSorting: false
};
const SYNC_FILTERS = [
  {
    value: PATTERN_SYNC_TYPES.full,
    label: (0,external_wp_i18n_namespaceObject._x)("Synced", "pattern (singular)"),
    description: (0,external_wp_i18n_namespaceObject.__)("Patterns that are kept in sync across the site.")
  },
  {
    value: PATTERN_SYNC_TYPES.unsynced,
    label: (0,external_wp_i18n_namespaceObject._x)("Not synced", "pattern (singular)"),
    description: (0,external_wp_i18n_namespaceObject.__)(
      "Patterns that can be changed freely without affecting the site."
    )
  }
];
const patternStatusField = {
  label: (0,external_wp_i18n_namespaceObject.__)("Sync status"),
  id: "sync-status",
  render: ({ item }) => {
    const syncStatus = "wp_pattern_sync_status" in item ? item.wp_pattern_sync_status || PATTERN_SYNC_TYPES.full : PATTERN_SYNC_TYPES.unsynced;
    return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
      "span",
      {
        className: `edit-site-patterns__field-sync-status-${syncStatus}`,
        children: SYNC_FILTERS.find(({ value }) => value === syncStatus).label
      }
    );
  },
  elements: SYNC_FILTERS,
  filterBy: {
    operators: [OPERATOR_IS],
    isPrimary: true
  },
  enableSorting: false
};
function AuthorField({ item }) {
  const [isImageLoaded, setIsImageLoaded] = (0,external_wp_element_.useState)(false);
  const { text, icon, imageUrl } = useAddedBy(item.type, item.id);
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { alignment: "left", spacing: 0, children: [
    imageUrl && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
      "div",
      {
        className: dist_clsx("page-templates-author-field__avatar", {
          "is-loaded": isImageLoaded
        }),
        children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
          "img",
          {
            onLoad: () => setIsImageLoaded(true),
            alt: "",
            src: imageUrl
          }
        )
      }
    ),
    !imageUrl && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "page-templates-author-field__icon", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(icon_default, { icon }) }),
    /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "page-templates-author-field__name", children: text })
  ] });
}
const templatePartAuthorField = {
  label: (0,external_wp_i18n_namespaceObject.__)("Author"),
  id: "author",
  getValue: ({ item }) => item.author_text,
  render: AuthorField,
  filterBy: {
    isPrimary: true
  }
};


;// ./node_modules/@wordpress/edit-site/build-module/components/page-patterns/index.js





















const { ExperimentalBlockEditorProvider: page_patterns_ExperimentalBlockEditorProvider } = unlock(external_wp_blockEditor_namespaceObject.privateApis);
const { usePostActions, patternTitleField } = unlock(external_wp_editor_namespaceObject.privateApis);
const { useLocation: page_patterns_useLocation, useHistory: page_patterns_useHistory } = unlock(external_wp_router_namespaceObject.privateApis);
const page_patterns_EMPTY_ARRAY = [];
const defaultLayouts = {
  [LAYOUT_TABLE]: {
    layout: {
      styles: {
        author: {
          width: "1%"
        }
      }
    }
  },
  [LAYOUT_GRID]: {
    layout: {
      badgeFields: ["sync-status"]
    }
  }
};
const DEFAULT_VIEW = {
  type: LAYOUT_GRID,
  perPage: 20,
  titleField: "title",
  mediaField: "preview",
  fields: ["sync-status"],
  filters: [],
  ...defaultLayouts[LAYOUT_GRID]
};
function usePagePatternsHeader(type, categoryId) {
  const { patternCategories } = usePatternCategories();
  const templatePartAreas = (0,external_wp_data_.useSelect)(
    (select) => select(external_wp_coreData_namespaceObject.store).getCurrentTheme()?.default_template_part_areas || [],
    []
  );
  let title, description, patternCategory;
  if (type === TEMPLATE_PART_POST_TYPE) {
    const templatePartArea = templatePartAreas.find(
      (area) => area.area === categoryId
    );
    title = templatePartArea?.label || (0,external_wp_i18n_namespaceObject.__)("All Template Parts");
    description = templatePartArea?.description || (0,external_wp_i18n_namespaceObject.__)("Includes every template part defined for any area.");
  } else if (type === PATTERN_TYPES.user && !!categoryId) {
    patternCategory = patternCategories.find(
      (category) => category.name === categoryId
    );
    title = patternCategory?.label;
    description = patternCategory?.description;
  }
  return { title, description };
}
function DataviewsPatterns() {
  const { path, query } = page_patterns_useLocation();
  const { postType = "wp_block", categoryId: categoryIdFromURL } = query;
  const history = page_patterns_useHistory();
  const categoryId = categoryIdFromURL || PATTERN_DEFAULT_CATEGORY;
  const { view, updateView, isModified, resetToDefault } = (0,build_module.useView)({
    kind: "postType",
    name: postType,
    slug: categoryId,
    defaultView: DEFAULT_VIEW,
    queryParams: {
      page: query.pageNumber,
      search: query.search
    },
    onChangeQueryParams: (params) => {
      history.navigate(
        (0,external_wp_url_namespaceObject.addQueryArgs)(path, {
          ...query,
          pageNumber: params.page,
          search: params.search
        })
      );
    }
  });
  const viewSyncStatus = view.filters?.find(
    ({ field }) => field === "sync-status"
  )?.value;
  const { patterns, isResolving } = use_patterns_default(postType, categoryId, {
    search: view.search,
    syncStatus: viewSyncStatus
  });
  const { records } = (0,external_wp_coreData_namespaceObject.useEntityRecords)("postType", TEMPLATE_PART_POST_TYPE, {
    per_page: -1
  });
  const authors = (0,external_wp_element_.useMemo)(() => {
    if (!records) {
      return page_patterns_EMPTY_ARRAY;
    }
    const authorsSet = /* @__PURE__ */ new Set();
    records.forEach((template) => {
      authorsSet.add(template.author_text);
    });
    return Array.from(authorsSet).map((author) => ({
      value: author,
      label: author
    }));
  }, [records]);
  const fields = (0,external_wp_element_.useMemo)(() => {
    const _fields = [previewField, patternTitleField];
    if (postType === PATTERN_TYPES.user) {
      _fields.push(patternStatusField);
    } else if (postType === TEMPLATE_PART_POST_TYPE) {
      _fields.push({
        ...templatePartAuthorField,
        elements: authors
      });
    }
    return _fields;
  }, [postType, authors]);
  const { data, paginationInfo } = (0,external_wp_element_.useMemo)(() => {
    const viewWithoutFilters = { ...view };
    delete viewWithoutFilters.search;
    if (postType !== TEMPLATE_PART_POST_TYPE) {
      viewWithoutFilters.filters = [];
    }
    return filterSortAndPaginate(patterns, viewWithoutFilters, fields);
  }, [patterns, view, fields, postType]);
  const dataWithPermissions = useAugmentPatternsWithPermissions(data);
  const templatePartActions = usePostActions({
    postType: TEMPLATE_PART_POST_TYPE,
    context: "list"
  });
  const patternActions = usePostActions({
    postType: PATTERN_TYPES.user,
    context: "list"
  });
  const editAction = useEditPostAction();
  const actions = (0,external_wp_element_.useMemo)(() => {
    if (postType === TEMPLATE_PART_POST_TYPE) {
      return [editAction, ...templatePartActions].filter(Boolean);
    }
    return [editAction, ...patternActions].filter(Boolean);
  }, [editAction, postType, templatePartActions, patternActions]);
  const settings = usePatternSettings();
  const { title, description } = usePagePatternsHeader(
    postType,
    categoryId
  );
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(page_patterns_ExperimentalBlockEditorProvider, { settings, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    page_page_default,
    {
      className: "edit-site-page-patterns-dataviews",
      title,
      subTitle: description,
      actions: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
        isModified && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
          external_wp_components_namespaceObject.Button,
          {
            __next40pxDefaultSize: true,
            onClick: resetToDefault,
            children: (0,external_wp_i18n_namespaceObject.__)("Reset view")
          }
        ),
        /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
          PatternsActions,
          {
            categoryId,
            postType
          }
        )
      ] }),
      children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
        dataviews_default,
        {
          paginationInfo,
          fields,
          actions,
          data: dataWithPermissions || page_patterns_EMPTY_ARRAY,
          getItemId: (item) => item.name ?? item.id,
          isLoading: isResolving,
          isItemClickable: (item) => item.type !== PATTERN_TYPES.theme,
          onClickItem: (item) => {
            history.navigate(
              `/${item.type}/${[
                PATTERN_TYPES.user,
                TEMPLATE_PART_POST_TYPE
              ].includes(item.type) ? item.id : item.name}?canvas=edit`
            );
          },
          view,
          onChangeView: updateView,
          defaultLayouts
        },
        categoryId + postType
      )
    }
  ) });
}


;// ./node_modules/@wordpress/edit-site/build-module/components/site-editor-routes/patterns.js




const patternsRoute = {
  name: "patterns",
  path: "/pattern",
  areas: {
    sidebar({ siteData }) {
      const isBlockTheme = siteData.currentTheme?.is_block_theme;
      const backPath = isBlockTheme || isClassicThemeWithStyleBookSupport(siteData) ? "/" : void 0;
      return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenPatterns, { backPath });
    },
    content: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(DataviewsPatterns, {}),
    mobile({ siteData, query }) {
      const { categoryId } = query;
      const isBlockTheme = siteData.currentTheme?.is_block_theme;
      const backPath = isBlockTheme || isClassicThemeWithStyleBookSupport(siteData) ? "/" : void 0;
      return !!categoryId ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(DataviewsPatterns, {}) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenPatterns, { backPath });
    }
  }
};


;// ./node_modules/@wordpress/edit-site/build-module/components/site-editor-routes/pattern-item.js




const patternItemRoute = {
  name: "pattern-item",
  path: "/wp_block/:postId",
  areas: {
    sidebar({ siteData }) {
      const isBlockTheme = siteData.currentTheme?.is_block_theme;
      const backPath = isBlockTheme || isClassicThemeWithStyleBookSupport(siteData) ? "/" : void 0;
      return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenPatterns, { backPath });
    },
    mobile: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {}),
    preview: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {})
  }
};


;// ./node_modules/@wordpress/edit-site/build-module/components/site-editor-routes/template-part-item.js



const templatePartItemRoute = {
  name: "template-part-item",
  path: "/wp_template_part/*postId",
  areas: {
    sidebar: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenPatterns, { backPath: "/" }),
    mobile: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {}),
    preview: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {})
  }
};


;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-templates-browse/content.js












const { useLocation: content_useLocation } = unlock(external_wp_router_namespaceObject.privateApis);
const content_EMPTY_ARRAY = [];
function TemplateDataviewItem({ template, isActive }) {
  const { text, icon } = useAddedBy(template.type, template.id);
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    SidebarNavigationItem,
    {
      to: (0,external_wp_url_namespaceObject.addQueryArgs)("/template", { activeView: text }),
      icon,
      "aria-current": isActive,
      children: text
    }
  );
}
function DataviewsTemplatesSidebarContent() {
  const {
    query: { activeView = "all" }
  } = content_useLocation();
  const { records } = (0,external_wp_coreData_namespaceObject.useEntityRecords)("postType", TEMPLATE_POST_TYPE, {
    per_page: -1
  });
  const firstItemPerAuthorText = (0,external_wp_element_.useMemo)(() => {
    const firstItemPerAuthor = records?.reduce((acc, template) => {
      const author = template.author_text;
      if (author && !acc[author]) {
        acc[author] = template;
      }
      return acc;
    }, {});
    return (firstItemPerAuthor && Object.values(firstItemPerAuthor)) ?? content_EMPTY_ARRAY;
  }, [records]);
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalItemGroup, { className: "edit-site-sidebar-navigation-screen-templates-browse", children: [
    /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
      SidebarNavigationItem,
      {
        to: "/template",
        icon: layout_default,
        "aria-current": activeView === "all",
        children: (0,external_wp_i18n_namespaceObject.__)("All templates")
      }
    ),
    firstItemPerAuthorText.map((template) => {
      return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
        TemplateDataviewItem,
        {
          template,
          isActive: activeView === template.author_text
        },
        template.author_text
      );
    })
  ] });
}


;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-templates-browse/index.js




function SidebarNavigationScreenTemplatesBrowse({ backPath }) {
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    SidebarNavigationScreen,
    {
      title: (0,external_wp_i18n_namespaceObject.__)("Templates"),
      description: (0,external_wp_i18n_namespaceObject.__)(
        "Create new templates, or reset any customizations made to the templates supplied by your theme."
      ),
      backPath,
      content: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(DataviewsTemplatesSidebarContent, {})
    }
  );
}


;// ./node_modules/@wordpress/icons/build-module/library/home.js


var home_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M12 4L4 7.9V20h16V7.9L12 4zm6.5 14.5H14V13h-4v5.5H5.5V8.8L12 5.7l6.5 3.1v9.7z" }) });


;// ./node_modules/@wordpress/icons/build-module/library/verse.js


var verse_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M17.8 2l-.9.3c-.1 0-3.6 1-5.2 2.1C10 5.5 9.3 6.5 8.9 7.1c-.6.9-1.7 4.7-1.7 6.3l-.9 2.3c-.2.4 0 .8.4 1 .1 0 .2.1.3.1.3 0 .6-.2.7-.5l.6-1.5c.3 0 .7-.1 1.2-.2.7-.1 1.4-.3 2.2-.5.8-.2 1.6-.5 2.4-.8.7-.3 1.4-.7 1.9-1.2s.8-1.2 1-1.9c.2-.7.3-1.6.4-2.4.1-.8.1-1.7.2-2.5 0-.8.1-1.5.2-2.1V2zm-1.9 5.6c-.1.8-.2 1.5-.3 2.1-.2.6-.4 1-.6 1.3-.3.3-.8.6-1.4.9-.7.3-1.4.5-2.2.8-.6.2-1.3.3-1.8.4L15 7.5c.3-.3.6-.7 1-1.1 0 .4 0 .8-.1 1.2zM6 20h8v-1.5H6V20z" }) });


;// ./node_modules/@wordpress/icons/build-module/library/pin.js


var pin_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "m21.5 9.1-6.6-6.6-4.2 5.6c-1.2-.1-2.4.1-3.6.7-.1 0-.1.1-.2.1-.5.3-.9.6-1.2.9l3.7 3.7-5.7 5.7v1.1h1.1l5.7-5.7 3.7 3.7c.4-.4.7-.8.9-1.2.1-.1.1-.2.2-.3.6-1.1.8-2.4.6-3.6l5.6-4.1zm-7.3 3.5.1.9c.1.9 0 1.8-.4 2.6l-6-6c.8-.4 1.7-.5 2.6-.4l.9.1L15 4.9 19.1 9l-4.9 3.6z" }) });


;// ./node_modules/@wordpress/icons/build-module/library/archive.js


var archive_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
  external_wp_primitives_namespaceObject.Path,
  {
    fillRule: "evenodd",
    clipRule: "evenodd",
    d: "M11.934 7.406a1 1 0 0 0 .914.594H19a.5.5 0 0 1 .5.5v9a.5.5 0 0 1-.5.5H5a.5.5 0 0 1-.5-.5V6a.5.5 0 0 1 .5-.5h5.764a.5.5 0 0 1 .447.276l.723 1.63Zm1.064-1.216a.5.5 0 0 0 .462.31H19a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h5.764a2 2 0 0 1 1.789 1.106l.445 1.084ZM8.5 10.5h7V12h-7v-1.5Zm7 3.5h-7v1.5h7V14Z"
  }
) });


;// ./node_modules/@wordpress/icons/build-module/library/not-found.js


var not_found_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M19 5H5c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm.5 12c0 .3-.2.5-.5.5H5c-.3 0-.5-.2-.5-.5V7c0-.3.2-.5.5-.5h14c.3 0 .5.2.5.5v10zm-11-7.6h-.7l-3.1 4.3h2.8V15h1v-1.3h.7v-.8h-.7V9.4zm-.9 3.5H6.3l1.2-1.7v1.7zm5.6-3.2c-.4-.2-.8-.4-1.2-.4-.5 0-.9.1-1.2.4-.4.2-.6.6-.8 1-.2.4-.3.9-.3 1.5s.1 1.1.3 1.6c.2.4.5.8.8 1 .4.2.8.4 1.2.4.5 0 .9-.1 1.2-.4.4-.2.6-.6.8-1 .2-.4.3-1 .3-1.6 0-.6-.1-1.1-.3-1.5-.1-.5-.4-.8-.8-1zm0 3.6c-.1.3-.3.5-.5.7-.2.1-.4.2-.7.2-.3 0-.5-.1-.7-.2-.2-.1-.4-.4-.5-.7-.1-.3-.2-.7-.2-1.2 0-.7.1-1.2.4-1.5.3-.3.6-.5 1-.5s.7.2 1 .5c.3.3.4.8.4 1.5-.1.5-.1.9-.2 1.2zm5-3.9h-.7l-3.1 4.3h2.8V15h1v-1.3h.7v-.8h-.7V9.4zm-1 3.5H16l1.2-1.7v1.7z" }) });


;// ./node_modules/@wordpress/icons/build-module/library/list.js


var list_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M4 4v1.5h16V4H4zm8 8.5h8V11h-8v1.5zM4 20h16v-1.5H4V20zm4-8c0-1.1-.9-2-2-2s-2 .9-2 2 .9 2 2 2 2-.9 2-2z" }) });


;// ./node_modules/@wordpress/icons/build-module/library/block-meta.js


var block_meta_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
  external_wp_primitives_namespaceObject.Path,
  {
    fillRule: "evenodd",
    d: "M8.95 11.25H4v1.5h4.95v4.5H13V18c0 1.1.9 2 2 2h3c1.1 0 2-.9 2-2v-3c0-1.1-.9-2-2-2h-3c-1.1 0-2 .9-2 2v.75h-2.55v-7.5H13V9c0 1.1.9 2 2 2h3c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2h-3c-1.1 0-2 .9-2 2v.75H8.95v4.5ZM14.5 15v3c0 .3.2.5.5.5h3c.3 0 .5-.2.5-.5v-3c0-.3-.2-.5-.5-.5h-3c-.3 0-.5.2-.5.5Zm0-6V6c0-.3.2-.5.5-.5h3c.3 0 .5.2.5.5v3c0 .3-.2.5-.5.5h-3c-.3 0-.5-.2-.5-.5Z",
    clipRule: "evenodd"
  }
) });


;// ./node_modules/@wordpress/icons/build-module/library/calendar.js


var calendar_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm.5 16c0 .3-.2.5-.5.5H5c-.3 0-.5-.2-.5-.5V7h15v12zM9 10H7v2h2v-2zm0 4H7v2h2v-2zm4-4h-2v2h2v-2zm4 0h-2v2h2v-2zm-4 4h-2v2h2v-2zm4 0h-2v2h2v-2z" }) });


;// ./node_modules/@wordpress/icons/build-module/library/tag.js


var tag_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M4.75 4a.75.75 0 0 0-.75.75v7.826c0 .2.08.39.22.53l6.72 6.716a2.313 2.313 0 0 0 3.276-.001l5.61-5.611-.531-.53.532.528a2.315 2.315 0 0 0 0-3.264L13.104 4.22a.75.75 0 0 0-.53-.22H4.75ZM19 12.576a.815.815 0 0 1-.236.574l-5.61 5.611a.814.814 0 0 1-1.153 0L5.5 12.264V5.5h6.763l6.5 6.502a.816.816 0 0 1 .237.574ZM8.75 9.75a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z" }) });


;// ./node_modules/@wordpress/icons/build-module/library/media.js


var media_media_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: [
  /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "m7 6.5 4 2.5-4 2.5z" }),
  /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    external_wp_primitives_namespaceObject.Path,
    {
      fillRule: "evenodd",
      clipRule: "evenodd",
      d: "m5 3c-1.10457 0-2 .89543-2 2v14c0 1.1046.89543 2 2 2h14c1.1046 0 2-.8954 2-2v-14c0-1.10457-.8954-2-2-2zm14 1.5h-14c-.27614 0-.5.22386-.5.5v10.7072l3.62953-2.6465c.25108-.1831.58905-.1924.84981-.0234l2.92666 1.8969 3.5712-3.4719c.2911-.2831.7545-.2831 1.0456 0l2.9772 2.8945v-9.3568c0-.27614-.2239-.5-.5-.5zm-14.5 14.5v-1.4364l4.09643-2.987 2.99567 1.9417c.2936.1903.6798.1523.9307-.0917l3.4772-3.3806 3.4772 3.3806.0228-.0234v2.5968c0 .2761-.2239.5-.5.5h-14c-.27614 0-.5-.2239-.5-.5z"
    }
  )
] });


;// ./node_modules/@wordpress/icons/build-module/library/post.js


var post_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "m7.3 9.7 1.4 1.4c.2-.2.3-.3.4-.5 0 0 0-.1.1-.1.3-.5.4-1.1.3-1.6L12 7 9 4 7.2 6.5c-.6-.1-1.1 0-1.6.3 0 0-.1 0-.1.1-.3.1-.4.2-.6.4l1.4 1.4L4 11v1h1l2.3-2.3zM4 20h9v-1.5H4V20zm0-5.5V16h16v-1.5H4z" }) });


;// ./node_modules/@wordpress/edit-site/build-module/components/add-new-template/utils.js








const EMPTY_OBJECT = {};
const utils_getValueFromObjectPath = (object, path) => {
  let value = object;
  path.split(".").forEach((fieldName) => {
    value = value?.[fieldName];
  });
  return value;
};
function prefixSlug(prefix, slug) {
  return `${prefix}-${(0,external_wp_url_namespaceObject.safeDecodeURI)(slug)}`;
}
const mapToIHasNameAndId = (entities, path) => {
  return (entities || []).map((entity) => ({
    ...entity,
    name: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(utils_getValueFromObjectPath(entity, path))
  }));
};
const useExistingTemplates = () => {
  return (0,external_wp_data_.useSelect)(
    (select) => select(external_wp_coreData_namespaceObject.store).getEntityRecords(
      "postType",
      TEMPLATE_POST_TYPE,
      {
        per_page: -1
      }
    ),
    []
  );
};
const useDefaultTemplateTypes = () => {
  return (0,external_wp_data_.useSelect)(
    (select) => select(external_wp_coreData_namespaceObject.store).getCurrentTheme()?.default_template_types || [],
    []
  );
};
const usePublicPostTypes = () => {
  const postTypes = (0,external_wp_data_.useSelect)(
    (select) => select(external_wp_coreData_namespaceObject.store).getPostTypes({ per_page: -1 }),
    []
  );
  return (0,external_wp_element_.useMemo)(() => {
    const excludedPostTypes = ["attachment"];
    return postTypes?.filter(
      ({ viewable, slug }) => viewable && !excludedPostTypes.includes(slug)
    ).sort((a, b) => {
      if (a.slug === "post" || b.slug === "post") {
        return 0;
      }
      return a.name.localeCompare(b.name);
    });
  }, [postTypes]);
};
const usePublicTaxonomies = () => {
  const taxonomies = (0,external_wp_data_.useSelect)(
    (select) => select(external_wp_coreData_namespaceObject.store).getTaxonomies({ per_page: -1 }),
    []
  );
  return (0,external_wp_element_.useMemo)(() => {
    return taxonomies?.filter(
      ({ visibility }) => visibility?.publicly_queryable
    );
  }, [taxonomies]);
};
function usePostTypeArchiveMenuItems() {
  const publicPostTypes = usePublicPostTypes();
  const postTypesWithArchives = (0,external_wp_element_.useMemo)(
    () => publicPostTypes?.filter((postType) => postType.has_archive),
    [publicPostTypes]
  );
  const existingTemplates = useExistingTemplates();
  const postTypeLabels = (0,external_wp_element_.useMemo)(
    () => publicPostTypes?.reduce((accumulator, { labels }) => {
      const singularName = labels.singular_name.toLowerCase();
      accumulator[singularName] = (accumulator[singularName] || 0) + 1;
      return accumulator;
    }, {}),
    [publicPostTypes]
  );
  const needsUniqueIdentifier = (0,external_wp_element_.useCallback)(
    ({ labels, slug }) => {
      const singularName = labels.singular_name.toLowerCase();
      return postTypeLabels[singularName] > 1 && singularName !== slug;
    },
    [postTypeLabels]
  );
  return (0,external_wp_element_.useMemo)(
    () => postTypesWithArchives?.filter(
      (postType) => !(existingTemplates || []).some(
        (existingTemplate) => existingTemplate.slug === "archive-" + postType.slug
      )
    ).map((postType) => {
      let title;
      if (needsUniqueIdentifier(postType)) {
        title = (0,external_wp_i18n_namespaceObject.sprintf)(
          // translators: %1s: Name of the post type e.g: "Post"; %2s: Slug of the post type e.g: "book".
          (0,external_wp_i18n_namespaceObject.__)("Archive: %1$s (%2$s)"),
          postType.labels.singular_name,
          postType.slug
        );
      } else {
        title = (0,external_wp_i18n_namespaceObject.sprintf)(
          // translators: %s: Name of the post type e.g: "Post".
          (0,external_wp_i18n_namespaceObject.__)("Archive: %s"),
          postType.labels.singular_name
        );
      }
      return {
        slug: "archive-" + postType.slug,
        description: (0,external_wp_i18n_namespaceObject.sprintf)(
          // translators: %s: Name of the post type e.g: "Post".
          (0,external_wp_i18n_namespaceObject.__)(
            "Displays an archive with the latest posts of type: %s."
          ),
          postType.labels.singular_name
        ),
        title,
        // `icon` is the `menu_icon` property of a post type. We
        // only handle `dashicons` for now, even if the `menu_icon`
        // also supports urls and svg as values.
        icon: typeof postType.icon === "string" && postType.icon.startsWith("dashicons-") ? postType.icon.slice(10) : archive_default,
        templatePrefix: "archive"
      };
    }) || [],
    [postTypesWithArchives, existingTemplates, needsUniqueIdentifier]
  );
}
const usePostTypeMenuItems = (onClickMenuItem) => {
  const publicPostTypes = usePublicPostTypes();
  const existingTemplates = useExistingTemplates();
  const defaultTemplateTypes = useDefaultTemplateTypes();
  const templateLabels = (0,external_wp_element_.useMemo)(
    () => publicPostTypes?.reduce((accumulator, { labels }) => {
      const templateName = (labels.template_name || labels.singular_name).toLowerCase();
      accumulator[templateName] = (accumulator[templateName] || 0) + 1;
      return accumulator;
    }, {}),
    [publicPostTypes]
  );
  const needsUniqueIdentifier = (0,external_wp_element_.useCallback)(
    ({ labels, slug }) => {
      const templateName = (labels.template_name || labels.singular_name).toLowerCase();
      return templateLabels[templateName] > 1 && templateName !== slug;
    },
    [templateLabels]
  );
  const templatePrefixes = (0,external_wp_element_.useMemo)(
    () => publicPostTypes?.reduce((accumulator, { slug }) => {
      let suffix = slug;
      if (slug !== "page") {
        suffix = `single-${suffix}`;
      }
      accumulator[slug] = suffix;
      return accumulator;
    }, {}),
    [publicPostTypes]
  );
  const postTypesInfo = useEntitiesInfo("postType", templatePrefixes);
  const existingTemplateSlugs = (existingTemplates || []).map(
    ({ slug }) => slug
  );
  const menuItems = (publicPostTypes || []).reduce(
    (accumulator, postType) => {
      const { slug, labels, icon } = postType;
      const generalTemplateSlug = templatePrefixes[slug];
      const defaultTemplateType = defaultTemplateTypes?.find(
        ({ slug: _slug }) => _slug === generalTemplateSlug
      );
      const hasGeneralTemplate = existingTemplateSlugs?.includes(generalTemplateSlug);
      const _needsUniqueIdentifier = needsUniqueIdentifier(postType);
      let menuItemTitle = labels.template_name || (0,external_wp_i18n_namespaceObject.sprintf)(
        // translators: %s: Name of the post type e.g: "Post".
        (0,external_wp_i18n_namespaceObject.__)("Single item: %s"),
        labels.singular_name
      );
      if (_needsUniqueIdentifier) {
        menuItemTitle = labels.template_name ? (0,external_wp_i18n_namespaceObject.sprintf)(
          // translators: 1: Name of the template e.g: "Single Item: Post". 2: Slug of the post type e.g: "book".
          (0,external_wp_i18n_namespaceObject._x)("%1$s (%2$s)", "post type menu label"),
          labels.template_name,
          slug
        ) : (0,external_wp_i18n_namespaceObject.sprintf)(
          // translators: 1: Name of the post type e.g: "Post". 2: Slug of the post type e.g: "book".
          (0,external_wp_i18n_namespaceObject._x)(
            "Single item: %1$s (%2$s)",
            "post type menu label"
          ),
          labels.singular_name,
          slug
        );
      }
      const menuItem = defaultTemplateType ? {
        ...defaultTemplateType,
        templatePrefix: templatePrefixes[slug]
      } : {
        slug: generalTemplateSlug,
        title: menuItemTitle,
        description: (0,external_wp_i18n_namespaceObject.sprintf)(
          // translators: %s: Name of the post type e.g: "Post".
          (0,external_wp_i18n_namespaceObject.__)("Displays a single item: %s."),
          labels.singular_name
        ),
        // `icon` is the `menu_icon` property of a post type. We
        // only handle `dashicons` for now, even if the `menu_icon`
        // also supports urls and svg as values.
        icon: typeof icon === "string" && icon.startsWith("dashicons-") ? icon.slice(10) : post_default,
        templatePrefix: templatePrefixes[slug]
      };
      const hasEntities = postTypesInfo?.[slug]?.hasEntities;
      if (hasEntities) {
        menuItem.onClick = (template) => {
          onClickMenuItem({
            type: "postType",
            slug,
            config: {
              recordNamePath: "title.rendered",
              queryArgs: ({ search }) => {
                return {
                  _fields: "id,title,slug,link",
                  orderBy: search ? "relevance" : "modified",
                  exclude: postTypesInfo[slug].existingEntitiesIds
                };
              },
              getSpecificTemplate: (suggestion) => {
                const templateSlug = prefixSlug(
                  templatePrefixes[slug],
                  suggestion.slug
                );
                return {
                  title: templateSlug,
                  slug: templateSlug,
                  templatePrefix: templatePrefixes[slug]
                };
              }
            },
            labels,
            hasGeneralTemplate,
            template
          });
        };
      }
      if (!hasGeneralTemplate || hasEntities) {
        accumulator.push(menuItem);
      }
      return accumulator;
    },
    []
  );
  const postTypesMenuItems = (0,external_wp_element_.useMemo)(
    () => menuItems.reduce(
      (accumulator, postType) => {
        const { slug } = postType;
        let key = "postTypesMenuItems";
        if (slug === "page") {
          key = "defaultPostTypesMenuItems";
        }
        accumulator[key].push(postType);
        return accumulator;
      },
      { defaultPostTypesMenuItems: [], postTypesMenuItems: [] }
    ),
    [menuItems]
  );
  return postTypesMenuItems;
};
const useTaxonomiesMenuItems = (onClickMenuItem) => {
  const publicTaxonomies = usePublicTaxonomies();
  const existingTemplates = useExistingTemplates();
  const defaultTemplateTypes = useDefaultTemplateTypes();
  const templatePrefixes = (0,external_wp_element_.useMemo)(
    () => publicTaxonomies?.reduce((accumulator, { slug }) => {
      let suffix = slug;
      if (!["category", "post_tag"].includes(slug)) {
        suffix = `taxonomy-${suffix}`;
      }
      if (slug === "post_tag") {
        suffix = `tag`;
      }
      accumulator[slug] = suffix;
      return accumulator;
    }, {}),
    [publicTaxonomies]
  );
  const taxonomyLabels = publicTaxonomies?.reduce(
    (accumulator, { labels }) => {
      const templateName = (labels.template_name || labels.singular_name).toLowerCase();
      accumulator[templateName] = (accumulator[templateName] || 0) + 1;
      return accumulator;
    },
    {}
  );
  const needsUniqueIdentifier = (labels, slug) => {
    if (["category", "post_tag"].includes(slug)) {
      return false;
    }
    const templateName = (labels.template_name || labels.singular_name).toLowerCase();
    return taxonomyLabels[templateName] > 1 && templateName !== slug;
  };
  const taxonomiesInfo = useEntitiesInfo("taxonomy", templatePrefixes);
  const existingTemplateSlugs = (existingTemplates || []).map(
    ({ slug }) => slug
  );
  const menuItems = (publicTaxonomies || []).reduce(
    (accumulator, taxonomy) => {
      const { slug, labels } = taxonomy;
      const generalTemplateSlug = templatePrefixes[slug];
      const defaultTemplateType = defaultTemplateTypes?.find(
        ({ slug: _slug }) => _slug === generalTemplateSlug
      );
      const hasGeneralTemplate = existingTemplateSlugs?.includes(generalTemplateSlug);
      const _needsUniqueIdentifier = needsUniqueIdentifier(
        labels,
        slug
      );
      let menuItemTitle = labels.template_name || labels.singular_name;
      if (_needsUniqueIdentifier) {
        menuItemTitle = labels.template_name ? (0,external_wp_i18n_namespaceObject.sprintf)(
          // translators: 1: Name of the template e.g: "Products by Category". 2: Slug of the taxonomy e.g: "product_cat".
          (0,external_wp_i18n_namespaceObject._x)("%1$s (%2$s)", "taxonomy template menu label"),
          labels.template_name,
          slug
        ) : (0,external_wp_i18n_namespaceObject.sprintf)(
          // translators: 1: Name of the taxonomy e.g: "Category". 2: Slug of the taxonomy e.g: "product_cat".
          (0,external_wp_i18n_namespaceObject._x)("%1$s (%2$s)", "taxonomy menu label"),
          labels.singular_name,
          slug
        );
      }
      const menuItem = defaultTemplateType ? {
        ...defaultTemplateType,
        templatePrefix: templatePrefixes[slug]
      } : {
        slug: generalTemplateSlug,
        title: menuItemTitle,
        description: (0,external_wp_i18n_namespaceObject.sprintf)(
          // translators: %s: Name of the taxonomy e.g: "Product Categories".
          (0,external_wp_i18n_namespaceObject.__)("Displays taxonomy: %s."),
          labels.singular_name
        ),
        icon: block_meta_default,
        templatePrefix: templatePrefixes[slug]
      };
      const hasEntities = taxonomiesInfo?.[slug]?.hasEntities;
      if (hasEntities) {
        menuItem.onClick = (template) => {
          onClickMenuItem({
            type: "taxonomy",
            slug,
            config: {
              queryArgs: ({ search }) => {
                return {
                  _fields: "id,name,slug,link",
                  orderBy: search ? "name" : "count",
                  exclude: taxonomiesInfo[slug].existingEntitiesIds
                };
              },
              getSpecificTemplate: (suggestion) => {
                const templateSlug = prefixSlug(
                  templatePrefixes[slug],
                  suggestion.slug
                );
                return {
                  title: templateSlug,
                  slug: templateSlug,
                  templatePrefix: templatePrefixes[slug]
                };
              }
            },
            labels,
            hasGeneralTemplate,
            template
          });
        };
      }
      if (!hasGeneralTemplate || hasEntities) {
        accumulator.push(menuItem);
      }
      return accumulator;
    },
    []
  );
  const taxonomiesMenuItems = (0,external_wp_element_.useMemo)(
    () => menuItems.reduce(
      (accumulator, taxonomy) => {
        const { slug } = taxonomy;
        let key = "taxonomiesMenuItems";
        if (["category", "tag"].includes(slug)) {
          key = "defaultTaxonomiesMenuItems";
        }
        accumulator[key].push(taxonomy);
        return accumulator;
      },
      { defaultTaxonomiesMenuItems: [], taxonomiesMenuItems: [] }
    ),
    [menuItems]
  );
  return taxonomiesMenuItems;
};
const USE_AUTHOR_MENU_ITEM_TEMPLATE_PREFIX = { user: "author" };
const USE_AUTHOR_MENU_ITEM_QUERY_PARAMETERS = { user: { who: "authors" } };
function useAuthorMenuItem(onClickMenuItem) {
  const existingTemplates = useExistingTemplates();
  const defaultTemplateTypes = useDefaultTemplateTypes();
  const authorInfo = useEntitiesInfo(
    "root",
    USE_AUTHOR_MENU_ITEM_TEMPLATE_PREFIX,
    USE_AUTHOR_MENU_ITEM_QUERY_PARAMETERS
  );
  let authorMenuItem = defaultTemplateTypes?.find(
    ({ slug }) => slug === "author"
  );
  if (!authorMenuItem) {
    authorMenuItem = {
      description: (0,external_wp_i18n_namespaceObject.__)(
        "Displays latest posts written by a single author."
      ),
      slug: "author",
      title: "Author"
    };
  }
  const hasGeneralTemplate = !!existingTemplates?.find(
    ({ slug }) => slug === "author"
  );
  if (authorInfo.user?.hasEntities) {
    authorMenuItem = { ...authorMenuItem, templatePrefix: "author" };
    authorMenuItem.onClick = (template) => {
      onClickMenuItem({
        type: "root",
        slug: "user",
        config: {
          queryArgs: ({ search }) => {
            return {
              _fields: "id,name,slug,link",
              orderBy: search ? "name" : "registered_date",
              exclude: authorInfo.user.existingEntitiesIds,
              who: "authors"
            };
          },
          getSpecificTemplate: (suggestion) => {
            const templateSlug = prefixSlug(
              "author",
              suggestion.slug
            );
            return {
              title: templateSlug,
              slug: templateSlug,
              templatePrefix: "author"
            };
          }
        },
        labels: {
          singular_name: (0,external_wp_i18n_namespaceObject.__)("Author"),
          search_items: (0,external_wp_i18n_namespaceObject.__)("Search Authors"),
          not_found: (0,external_wp_i18n_namespaceObject.__)("No authors found."),
          all_items: (0,external_wp_i18n_namespaceObject.__)("All Authors")
        },
        hasGeneralTemplate,
        template
      });
    };
  }
  if (!hasGeneralTemplate || authorInfo.user?.hasEntities) {
    return authorMenuItem;
  }
}
const useExistingTemplateSlugs = (templatePrefixes) => {
  const existingTemplates = useExistingTemplates();
  const existingSlugs = (0,external_wp_element_.useMemo)(() => {
    return Object.entries(templatePrefixes || {}).reduce(
      (accumulator, [slug, prefix]) => {
        const slugsWithTemplates = (existingTemplates || []).reduce(
          (_accumulator, existingTemplate) => {
            const _prefix = `${prefix}-`;
            if (existingTemplate.slug.startsWith(_prefix)) {
              _accumulator.push(
                existingTemplate.slug.substring(
                  _prefix.length
                )
              );
            }
            return _accumulator;
          },
          []
        );
        if (slugsWithTemplates.length) {
          accumulator[slug] = slugsWithTemplates;
        }
        return accumulator;
      },
      {}
    );
  }, [templatePrefixes, existingTemplates]);
  return existingSlugs;
};
const useTemplatesToExclude = (entityName, templatePrefixes, additionalQueryParameters = {}) => {
  const slugsToExcludePerEntity = useExistingTemplateSlugs(templatePrefixes);
  const recordsToExcludePerEntity = (0,external_wp_data_.useSelect)(
    (select) => {
      return Object.entries(slugsToExcludePerEntity || {}).reduce(
        (accumulator, [slug, slugsWithTemplates]) => {
          const entitiesWithTemplates = select(
            external_wp_coreData_namespaceObject.store
          ).getEntityRecords(entityName, slug, {
            _fields: "id",
            context: "view",
            slug: slugsWithTemplates,
            ...additionalQueryParameters[slug]
          });
          if (entitiesWithTemplates?.length) {
            accumulator[slug] = entitiesWithTemplates;
          }
          return accumulator;
        },
        {}
      );
    },
    [slugsToExcludePerEntity]
  );
  return recordsToExcludePerEntity;
};
const useEntitiesInfo = (entityName, templatePrefixes, additionalQueryParameters = EMPTY_OBJECT) => {
  const recordsToExcludePerEntity = useTemplatesToExclude(
    entityName,
    templatePrefixes,
    additionalQueryParameters
  );
  const entitiesHasRecords = (0,external_wp_data_.useSelect)(
    (select) => {
      return Object.keys(templatePrefixes || {}).reduce(
        (accumulator, slug) => {
          const existingEntitiesIds = recordsToExcludePerEntity?.[slug]?.map(
            ({ id }) => id
          ) || [];
          accumulator[slug] = !!select(
            external_wp_coreData_namespaceObject.store
          ).getEntityRecords(entityName, slug, {
            per_page: 1,
            _fields: "id",
            context: "view",
            exclude: existingEntitiesIds,
            ...additionalQueryParameters[slug]
          })?.length;
          return accumulator;
        },
        {}
      );
    },
    [
      templatePrefixes,
      recordsToExcludePerEntity,
      entityName,
      additionalQueryParameters
    ]
  );
  const entitiesInfo = (0,external_wp_element_.useMemo)(() => {
    return Object.keys(templatePrefixes || {}).reduce(
      (accumulator, slug) => {
        const existingEntitiesIds = recordsToExcludePerEntity?.[slug]?.map(
          ({ id }) => id
        ) || [];
        accumulator[slug] = {
          hasEntities: entitiesHasRecords[slug],
          existingEntitiesIds
        };
        return accumulator;
      },
      {}
    );
  }, [templatePrefixes, recordsToExcludePerEntity, entitiesHasRecords]);
  return entitiesInfo;
};


;// ./node_modules/@wordpress/edit-site/build-module/components/add-new-template/add-custom-template-modal-content.js










const add_custom_template_modal_content_EMPTY_ARRAY = [];
function SuggestionListItem({
  suggestion,
  search,
  onSelect,
  entityForSuggestions
}) {
  const baseCssClass = "edit-site-custom-template-modal__suggestions_list__list-item";
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
    external_wp_components_namespaceObject.Composite.Item,
    {
      render: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
        external_wp_components_namespaceObject.Button,
        {
          __next40pxDefaultSize: true,
          role: "option",
          className: baseCssClass,
          onClick: () => onSelect(
            entityForSuggestions.config.getSpecificTemplate(
              suggestion
            )
          )
        }
      ),
      children: [
        /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
          external_wp_components_namespaceObject.__experimentalText,
          {
            size: "body",
            lineHeight: 1.53846153846,
            weight: 500,
            className: `${baseCssClass}__title`,
            children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
              external_wp_components_namespaceObject.TextHighlight,
              {
                text: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(suggestion.name),
                highlight: search
              }
            )
          }
        ),
        suggestion.link && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
          external_wp_components_namespaceObject.__experimentalText,
          {
            size: "body",
            lineHeight: 1.53846153846,
            className: `${baseCssClass}__info`,
            children: (0,external_wp_url_namespaceObject.safeDecodeURI)(suggestion.link)
          }
        )
      ]
    }
  );
}
function useSearchSuggestions(entityForSuggestions, search) {
  const { config } = entityForSuggestions;
  const query = (0,external_wp_element_.useMemo)(
    () => ({
      order: "asc",
      context: "view",
      search,
      per_page: search ? 20 : 10,
      ...config.queryArgs(search)
    }),
    [search, config]
  );
  const { records: searchResults, hasResolved: searchHasResolved } = (0,external_wp_coreData_namespaceObject.useEntityRecords)(
    entityForSuggestions.type,
    entityForSuggestions.slug,
    query
  );
  const [suggestions, setSuggestions] = (0,external_wp_element_.useState)(add_custom_template_modal_content_EMPTY_ARRAY);
  (0,external_wp_element_.useEffect)(() => {
    if (!searchHasResolved) {
      return;
    }
    let newSuggestions = add_custom_template_modal_content_EMPTY_ARRAY;
    if (searchResults?.length) {
      newSuggestions = searchResults;
      if (config.recordNamePath) {
        newSuggestions = mapToIHasNameAndId(
          newSuggestions,
          config.recordNamePath
        );
      }
    }
    setSuggestions(newSuggestions);
  }, [searchResults, searchHasResolved]);
  return suggestions;
}
function SuggestionList({ entityForSuggestions, onSelect }) {
  const [search, setSearch, debouncedSearch] = (0,external_wp_compose_namespaceObject.useDebouncedInput)();
  const suggestions = useSearchSuggestions(
    entityForSuggestions,
    debouncedSearch
  );
  const { labels } = entityForSuggestions;
  const [showSearchControl, setShowSearchControl] = (0,external_wp_element_.useState)(false);
  if (!showSearchControl && suggestions?.length > 9) {
    setShowSearchControl(true);
  }
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
    showSearchControl && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
      external_wp_components_namespaceObject.SearchControl,
      {
        __nextHasNoMarginBottom: true,
        onChange: setSearch,
        value: search,
        label: labels.search_items,
        placeholder: labels.search_items
      }
    ),
    !!suggestions?.length && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
      external_wp_components_namespaceObject.Composite,
      {
        orientation: "vertical",
        role: "listbox",
        className: "edit-site-custom-template-modal__suggestions_list",
        "aria-label": (0,external_wp_i18n_namespaceObject.__)("Suggestions list"),
        children: suggestions.map((suggestion) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
          SuggestionListItem,
          {
            suggestion,
            search: debouncedSearch,
            onSelect,
            entityForSuggestions
          },
          suggestion.slug
        ))
      }
    ),
    debouncedSearch && !suggestions?.length && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
      external_wp_components_namespaceObject.__experimentalText,
      {
        as: "p",
        className: "edit-site-custom-template-modal__no-results",
        children: labels.not_found
      }
    )
  ] });
}
function AddCustomTemplateModalContent({
  onSelect,
  entityForSuggestions,
  onBack,
  containerRef
}) {
  const [showSearchEntities, setShowSearchEntities] = (0,external_wp_element_.useState)(
    entityForSuggestions.hasGeneralTemplate
  );
  (0,external_wp_element_.useEffect)(() => {
    if (containerRef.current) {
      const [firstFocusable] = external_wp_dom_namespaceObject.focus.focusable.find(
        containerRef.current
      );
      firstFocusable?.focus();
    }
  }, [showSearchEntities]);
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
    external_wp_components_namespaceObject.__experimentalVStack,
    {
      spacing: 4,
      className: "edit-site-custom-template-modal__contents-wrapper",
      alignment: "left",
      children: [
        !showSearchEntities && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
          /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { as: "p", children: (0,external_wp_i18n_namespaceObject.__)(
            "Select whether to create a single template for all items or a specific one."
          ) }),
          /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
            external_wp_components_namespaceObject.Flex,
            {
              className: "edit-site-custom-template-modal__contents",
              gap: "4",
              align: "initial",
              children: [
                /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
                  external_wp_components_namespaceObject.FlexItem,
                  {
                    isBlock: true,
                    as: external_wp_components_namespaceObject.Button,
                    onClick: () => {
                      const {
                        slug,
                        title,
                        description,
                        templatePrefix
                      } = entityForSuggestions.template;
                      onSelect({
                        slug,
                        title,
                        description,
                        templatePrefix
                      });
                    },
                    children: [
                      /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
                        external_wp_components_namespaceObject.__experimentalText,
                        {
                          as: "span",
                          weight: 500,
                          lineHeight: 1.53846153846,
                          children: entityForSuggestions.labels.all_items
                        }
                      ),
                      /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
                        external_wp_components_namespaceObject.__experimentalText,
                        {
                          as: "span",
                          lineHeight: 1.53846153846,
                          // translators: The user is given the choice to set up a template for all items of a post type or taxonomy, or just a specific one.
                          children: (0,external_wp_i18n_namespaceObject.__)("For all items")
                        }
                      )
                    ]
                  }
                ),
                /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
                  external_wp_components_namespaceObject.FlexItem,
                  {
                    isBlock: true,
                    as: external_wp_components_namespaceObject.Button,
                    onClick: () => {
                      setShowSearchEntities(true);
                    },
                    children: [
                      /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
                        external_wp_components_namespaceObject.__experimentalText,
                        {
                          as: "span",
                          weight: 500,
                          lineHeight: 1.53846153846,
                          children: entityForSuggestions.labels.singular_name
                        }
                      ),
                      /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
                        external_wp_components_namespaceObject.__experimentalText,
                        {
                          as: "span",
                          lineHeight: 1.53846153846,
                          // translators: The user is given the choice to set up a template for all items of a post type or taxonomy, or just a specific one.
                          children: (0,external_wp_i18n_namespaceObject.__)("For a specific item")
                        }
                      )
                    ]
                  }
                )
              ]
            }
          ),
          /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Flex, { justify: "right", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
            external_wp_components_namespaceObject.Button,
            {
              __next40pxDefaultSize: true,
              variant: "tertiary",
              onClick: onBack,
              children: (0,external_wp_i18n_namespaceObject.__)("Back")
            }
          ) })
        ] }),
        showSearchEntities && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
          /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { as: "p", children: (0,external_wp_i18n_namespaceObject.__)(
            "This template will be used only for the specific item chosen."
          ) }),
          /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
            SuggestionList,
            {
              entityForSuggestions,
              onSelect
            }
          ),
          /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Flex, { justify: "right", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
            external_wp_components_namespaceObject.Button,
            {
              __next40pxDefaultSize: true,
              variant: "tertiary",
              onClick: () => {
                if (entityForSuggestions.hasGeneralTemplate) {
                  onBack();
                } else {
                  setShowSearchEntities(false);
                }
              },
              children: (0,external_wp_i18n_namespaceObject.__)("Back")
            }
          ) })
        ] })
      ]
    }
  );
}
var add_custom_template_modal_content_default = AddCustomTemplateModalContent;


;// ./node_modules/tslib/tslib.es6.mjs
/******************************************************************************
Copyright (c) Microsoft Corporation.

Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
/* global Reflect, Promise, SuppressedError, Symbol, Iterator */

var extendStatics = function(d, b) {
  extendStatics = Object.setPrototypeOf ||
      ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
      function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
  return extendStatics(d, b);
};

function __extends(d, b) {
  if (typeof b !== "function" && b !== null)
      throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
  extendStatics(d, b);
  function __() { this.constructor = d; }
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
}

var __assign = function() {
  __assign = Object.assign || function __assign(t) {
      for (var s, i = 1, n = arguments.length; i < n; i++) {
          s = arguments[i];
          for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
      }
      return t;
  }
  return __assign.apply(this, arguments);
}

function __rest(s, e) {
  var t = {};
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
      t[p] = s[p];
  if (s != null && typeof Object.getOwnPropertySymbols === "function")
      for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
          if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
              t[p[i]] = s[p[i]];
      }
  return t;
}

function __decorate(decorators, target, key, desc) {
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  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;
  return c > 3 && r && Object.defineProperty(target, key, r), r;
}

function __param(paramIndex, decorator) {
  return function (target, key) { decorator(target, key, paramIndex); }
}

function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
  function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
  var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
  var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
  var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
  var _, done = false;
  for (var i = decorators.length - 1; i >= 0; i--) {
      var context = {};
      for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
      for (var p in contextIn.access) context.access[p] = contextIn.access[p];
      context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
      var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
      if (kind === "accessor") {
          if (result === void 0) continue;
          if (result === null || typeof result !== "object") throw new TypeError("Object expected");
          if (_ = accept(result.get)) descriptor.get = _;
          if (_ = accept(result.set)) descriptor.set = _;
          if (_ = accept(result.init)) initializers.unshift(_);
      }
      else if (_ = accept(result)) {
          if (kind === "field") initializers.unshift(_);
          else descriptor[key] = _;
      }
  }
  if (target) Object.defineProperty(target, contextIn.name, descriptor);
  done = true;
};

function __runInitializers(thisArg, initializers, value) {
  var useValue = arguments.length > 2;
  for (var i = 0; i < initializers.length; i++) {
      value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
  }
  return useValue ? value : void 0;
};

function __propKey(x) {
  return typeof x === "symbol" ? x : "".concat(x);
};

function __setFunctionName(f, name, prefix) {
  if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : "";
  return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
};

function __metadata(metadataKey, metadataValue) {
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
}

function __awaiter(thisArg, _arguments, P, generator) {
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
  return new (P || (P = Promise))(function (resolve, reject) {
      function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
      function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
      function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
      step((generator = generator.apply(thisArg, _arguments || [])).next());
  });
}

function __generator(thisArg, body) {
  var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
  return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
  function verb(n) { return function (v) { return step([n, v]); }; }
  function step(op) {
      if (f) throw new TypeError("Generator is already executing.");
      while (g && (g = 0, op[0] && (_ = 0)), _) try {
          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;
          if (y = 0, t) op = [op[0] & 2, t.value];
          switch (op[0]) {
              case 0: case 1: t = op; break;
              case 4: _.label++; return { value: op[1], done: false };
              case 5: _.label++; y = op[1]; op = [0]; continue;
              case 7: op = _.ops.pop(); _.trys.pop(); continue;
              default:
                  if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
                  if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
                  if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
                  if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
                  if (t[2]) _.ops.pop();
                  _.trys.pop(); continue;
          }
          op = body.call(thisArg, _);
      } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
      if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
  }
}

var __createBinding = Object.create ? (function(o, m, k, k2) {
  if (k2 === undefined) k2 = k;
  var desc = Object.getOwnPropertyDescriptor(m, k);
  if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
      desc = { enumerable: true, get: function() { return m[k]; } };
  }
  Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
  if (k2 === undefined) k2 = k;
  o[k2] = m[k];
});

function __exportStar(m, o) {
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);
}

function __values(o) {
  var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
  if (m) return m.call(o);
  if (o && typeof o.length === "number") return {
      next: function () {
          if (o && i >= o.length) o = void 0;
          return { value: o && o[i++], done: !o };
      }
  };
  throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
}

function __read(o, n) {
  var m = typeof Symbol === "function" && o[Symbol.iterator];
  if (!m) return o;
  var i = m.call(o), r, ar = [], e;
  try {
      while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
  }
  catch (error) { e = { error: error }; }
  finally {
      try {
          if (r && !r.done && (m = i["return"])) m.call(i);
      }
      finally { if (e) throw e.error; }
  }
  return ar;
}

/** @deprecated */
function __spread() {
  for (var ar = [], i = 0; i < arguments.length; i++)
      ar = ar.concat(__read(arguments[i]));
  return ar;
}

/** @deprecated */
function __spreadArrays() {
  for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
  for (var r = Array(s), k = 0, i = 0; i < il; i++)
      for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
          r[k] = a[j];
  return r;
}

function __spreadArray(to, from, pack) {
  if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
      if (ar || !(i in from)) {
          if (!ar) ar = Array.prototype.slice.call(from, 0, i);
          ar[i] = from[i];
      }
  }
  return to.concat(ar || Array.prototype.slice.call(from));
}

function __await(v) {
  return this instanceof __await ? (this.v = v, this) : new __await(v);
}

function __asyncGenerator(thisArg, _arguments, generator) {
  if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
  var g = generator.apply(thisArg, _arguments || []), i, q = [];
  return i = Object.create((typeof AsyncIterator === "function" ? AsyncIterator : Object).prototype), verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i;
  function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; }
  function verb(n, f) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } }
  function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
  function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
  function fulfill(value) { resume("next", value); }
  function reject(value) { resume("throw", value); }
  function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
}

function __asyncDelegator(o) {
  var i, p;
  return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
  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; }
}

function __asyncValues(o) {
  if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
  var m = o[Symbol.asyncIterator], i;
  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);
  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); }); }; }
  function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
}

function __makeTemplateObject(cooked, raw) {
  if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
  return cooked;
};

var __setModuleDefault = Object.create ? (function(o, v) {
  Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
  o["default"] = v;
};

var ownKeys = function(o) {
  ownKeys = Object.getOwnPropertyNames || function (o) {
    var ar = [];
    for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
    return ar;
  };
  return ownKeys(o);
};

function __importStar(mod) {
  if (mod && mod.__esModule) return mod;
  var result = {};
  if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
  __setModuleDefault(result, mod);
  return result;
}

function __importDefault(mod) {
  return (mod && mod.__esModule) ? mod : { default: mod };
}

function __classPrivateFieldGet(receiver, state, kind, f) {
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
  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");
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
}

function __classPrivateFieldSet(receiver, state, value, kind, f) {
  if (kind === "m") throw new TypeError("Private method is not writable");
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
  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");
  return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
}

function __classPrivateFieldIn(state, receiver) {
  if (receiver === null || (typeof receiver !== "object" && typeof receiver !== "function")) throw new TypeError("Cannot use 'in' operator on non-object");
  return typeof state === "function" ? receiver === state : state.has(receiver);
}

function __addDisposableResource(env, value, async) {
  if (value !== null && value !== void 0) {
    if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
    var dispose, inner;
    if (async) {
      if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined.");
      dispose = value[Symbol.asyncDispose];
    }
    if (dispose === void 0) {
      if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined.");
      dispose = value[Symbol.dispose];
      if (async) inner = dispose;
    }
    if (typeof dispose !== "function") throw new TypeError("Object not disposable.");
    if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } };
    env.stack.push({ value: value, dispose: dispose, async: async });
  }
  else if (async) {
    env.stack.push({ async: true });
  }
  return value;
}

var _SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
  var e = new Error(message);
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
};

function __disposeResources(env) {
  function fail(e) {
    env.error = env.hasError ? new _SuppressedError(e, env.error, "An error was suppressed during disposal.") : e;
    env.hasError = true;
  }
  var r, s = 0;
  function next() {
    while (r = env.stack.pop()) {
      try {
        if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);
        if (r.dispose) {
          var result = r.dispose.call(r.value);
          if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); });
        }
        else s |= 1;
      }
      catch (e) {
        fail(e);
      }
    }
    if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();
    if (env.hasError) throw env.error;
  }
  return next();
}

function __rewriteRelativeImportExtension(path, preserveJsx) {
  if (typeof path === "string" && /^\.\.?\//.test(path)) {
      return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {
          return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : (d + ext + "." + cm.toLowerCase() + "js");
      });
  }
  return path;
}

/* harmony default export */ const tslib_es6 = ({
  __extends,
  __assign,
  __rest,
  __decorate,
  __param,
  __esDecorate,
  __runInitializers,
  __propKey,
  __setFunctionName,
  __metadata,
  __awaiter,
  __generator,
  __createBinding,
  __exportStar,
  __values,
  __read,
  __spread,
  __spreadArrays,
  __spreadArray,
  __await,
  __asyncGenerator,
  __asyncDelegator,
  __asyncValues,
  __makeTemplateObject,
  __importStar,
  __importDefault,
  __classPrivateFieldGet,
  __classPrivateFieldSet,
  __classPrivateFieldIn,
  __addDisposableResource,
  __disposeResources,
  __rewriteRelativeImportExtension,
});

;// ./node_modules/lower-case/dist.es2015/index.js
/**
 * Source: ftp://ftp.unicode.org/Public/UCD/latest/ucd/SpecialCasing.txt
 */
var SUPPORTED_LOCALE = {
    tr: {
        regexp: /\u0130|\u0049|\u0049\u0307/g,
        map: {
            İ: "\u0069",
            I: "\u0131",
            İ: "\u0069",
        },
    },
    az: {
        regexp: /\u0130/g,
        map: {
            İ: "\u0069",
            I: "\u0131",
            İ: "\u0069",
        },
    },
    lt: {
        regexp: /\u0049|\u004A|\u012E|\u00CC|\u00CD|\u0128/g,
        map: {
            I: "\u0069\u0307",
            J: "\u006A\u0307",
            Į: "\u012F\u0307",
            Ì: "\u0069\u0307\u0300",
            Í: "\u0069\u0307\u0301",
            Ĩ: "\u0069\u0307\u0303",
        },
    },
};
/**
 * Localized lower case.
 */
function localeLowerCase(str, locale) {
    var lang = SUPPORTED_LOCALE[locale.toLowerCase()];
    if (lang)
        return lowerCase(str.replace(lang.regexp, function (m) { return lang.map[m]; }));
    return lowerCase(str);
}
/**
 * Lower case as a function.
 */
function lowerCase(str) {
    return str.toLowerCase();
}

;// ./node_modules/no-case/dist.es2015/index.js

// Support camel case ("camelCase" -> "camel Case" and "CAMELCase" -> "CAMEL Case").
var DEFAULT_SPLIT_REGEXP = [/([a-z0-9])([A-Z])/g, /([A-Z])([A-Z][a-z])/g];
// Remove all non-word characters.
var DEFAULT_STRIP_REGEXP = /[^A-Z0-9]+/gi;
/**
 * Normalize the string into something other libraries can manipulate easier.
 */
function noCase(input, options) {
    if (options === void 0) { options = {}; }
    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;
    var result = replace(replace(input, splitRegexp, "$1\0$2"), stripRegexp, "\0");
    var start = 0;
    var end = result.length;
    // Trim the delimiter from around the output string.
    while (result.charAt(start) === "\0")
        start++;
    while (result.charAt(end - 1) === "\0")
        end--;
    // Transform each token independently.
    return result.slice(start, end).split("\0").map(transform).join(delimiter);
}
/**
 * Replace `re` in the input string with the replacement value.
 */
function replace(input, re, value) {
    if (re instanceof RegExp)
        return input.replace(re, value);
    return re.reduce(function (input, re) { return input.replace(re, value); }, input);
}

;// ./node_modules/dot-case/dist.es2015/index.js


function dotCase(input, options) {
    if (options === void 0) { options = {}; }
    return noCase(input, __assign({ delimiter: "." }, options));
}

;// ./node_modules/param-case/dist.es2015/index.js


function paramCase(input, options) {
    if (options === void 0) { options = {}; }
    return dotCase(input, __assign({ delimiter: "-" }, options));
}

;// ./node_modules/@wordpress/edit-site/build-module/components/add-new-template/add-custom-generic-template-modal-content.js





function AddCustomGenericTemplateModalContent({ createTemplate, onBack }) {
  const [title, setTitle] = (0,external_wp_element_.useState)("");
  const defaultTitle = (0,external_wp_i18n_namespaceObject.__)("Custom Template");
  const [isBusy, setIsBusy] = (0,external_wp_element_.useState)(false);
  const inputRef = (0,external_wp_element_.useRef)();
  (0,external_wp_element_.useEffect)(() => {
    if (inputRef.current) {
      inputRef.current.focus();
    }
  }, []);
  async function onCreateTemplate(event) {
    event.preventDefault();
    if (isBusy) {
      return;
    }
    setIsBusy(true);
    try {
      await createTemplate(
        {
          slug: paramCase(title || defaultTitle) || "wp-custom-template",
          title: title || defaultTitle
        },
        false
      );
    } finally {
      setIsBusy(false);
    }
  }
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("form", { onSubmit: onCreateTemplate, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 6, children: [
    /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
      external_wp_components_namespaceObject.TextControl,
      {
        __next40pxDefaultSize: true,
        __nextHasNoMarginBottom: true,
        label: (0,external_wp_i18n_namespaceObject.__)("Name"),
        value: title,
        onChange: setTitle,
        placeholder: defaultTitle,
        disabled: isBusy,
        ref: inputRef,
        help: (0,external_wp_i18n_namespaceObject.__)(
          // eslint-disable-next-line no-restricted-syntax -- 'sidebar' is a common web design term for layouts
          'Describe the template, e.g. "Post with sidebar". A custom template can be manually applied to any post or page.'
        )
      }
    ),
    /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
      external_wp_components_namespaceObject.__experimentalHStack,
      {
        className: "edit-site-custom-generic-template__modal-actions",
        justify: "right",
        children: [
          /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
            external_wp_components_namespaceObject.Button,
            {
              __next40pxDefaultSize: true,
              variant: "tertiary",
              onClick: onBack,
              children: (0,external_wp_i18n_namespaceObject.__)("Back")
            }
          ),
          /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
            external_wp_components_namespaceObject.Button,
            {
              __next40pxDefaultSize: true,
              variant: "primary",
              type: "submit",
              isBusy,
              "aria-disabled": isBusy,
              children: (0,external_wp_i18n_namespaceObject.__)("Create")
            }
          )
        ]
      }
    )
  ] }) });
}
var add_custom_generic_template_modal_content_default = AddCustomGenericTemplateModalContent;


;// ./node_modules/@wordpress/edit-site/build-module/components/add-new-template/index.js


















const { useHistory: add_new_template_useHistory } = unlock(external_wp_router_namespaceObject.privateApis);
const DEFAULT_TEMPLATE_SLUGS = [
  "front-page",
  "home",
  "single",
  "page",
  "index",
  "archive",
  "author",
  "category",
  "date",
  "tag",
  "search",
  "404"
];
const TEMPLATE_ICONS = {
  "front-page": home_default,
  home: verse_default,
  single: pin_default,
  page: page_default,
  archive: archive_default,
  search: search_default,
  404: not_found_default,
  index: list_default,
  category: category_default,
  author: comment_author_avatar_default,
  taxonomy: block_meta_default,
  date: calendar_default,
  tag: tag_default,
  attachment: media_media_default
};
function TemplateListItem({
  title,
  direction,
  className,
  description,
  icon,
  onClick,
  children
}) {
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    external_wp_components_namespaceObject.Button,
    {
      __next40pxDefaultSize: true,
      className,
      onClick,
      label: description,
      showTooltip: !!description,
      children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
        external_wp_components_namespaceObject.Flex,
        {
          as: "span",
          spacing: 2,
          align: "center",
          justify: "center",
          style: { width: "100%" },
          direction,
          children: [
            /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "edit-site-add-new-template__template-icon", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { icon }) }),
            /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
              external_wp_components_namespaceObject.__experimentalVStack,
              {
                className: "edit-site-add-new-template__template-name",
                alignment: "center",
                spacing: 0,
                children: [
                  /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
                    external_wp_components_namespaceObject.__experimentalText,
                    {
                      align: "center",
                      weight: 500,
                      lineHeight: 1.53846153846,
                      children: title
                    }
                  ),
                  children
                ]
              }
            )
          ]
        }
      )
    }
  );
}
const modalContentMap = {
  templatesList: 1,
  customTemplate: 2,
  customGenericTemplate: 3
};
function NewTemplateModal({ onClose }) {
  const [modalContent, setModalContent] = (0,external_wp_element_.useState)(
    modalContentMap.templatesList
  );
  const [entityForSuggestions, setEntityForSuggestions] = (0,external_wp_element_.useState)({});
  const [isSubmitting, setIsSubmitting] = (0,external_wp_element_.useState)(false);
  const missingTemplates = useMissingTemplates(
    setEntityForSuggestions,
    () => setModalContent(modalContentMap.customTemplate)
  );
  const history = add_new_template_useHistory();
  const { saveEntityRecord } = (0,external_wp_data_.useDispatch)(external_wp_coreData_namespaceObject.store);
  const { createErrorNotice, createSuccessNotice } = (0,external_wp_data_.useDispatch)(external_wp_notices_namespaceObject.store);
  const containerRef = (0,external_wp_element_.useRef)(null);
  const isMobile = (0,external_wp_compose_namespaceObject.useViewportMatch)("medium", "<");
  const homeUrl = (0,external_wp_data_.useSelect)((select) => {
    return select(external_wp_coreData_namespaceObject.store).getEntityRecord("root", "__unstableBase")?.home;
  }, []);
  const TEMPLATE_SHORT_DESCRIPTIONS = {
    "front-page": homeUrl,
    date: (0,external_wp_i18n_namespaceObject.sprintf)(
      // translators: %s: The homepage url.
      (0,external_wp_i18n_namespaceObject.__)("E.g. %s"),
      homeUrl + "/" + (/* @__PURE__ */ new Date()).getFullYear()
    )
  };
  (0,external_wp_element_.useEffect)(() => {
    if (containerRef.current && modalContent === modalContentMap.templatesList) {
      const [firstFocusable] = external_wp_dom_namespaceObject.focus.focusable.find(
        containerRef.current
      );
      firstFocusable?.focus();
    }
  }, [modalContent]);
  async function createTemplate(template, isWPSuggestion = true) {
    if (isSubmitting) {
      return;
    }
    setIsSubmitting(true);
    try {
      const { title, description, slug } = template;
      const newTemplate = await saveEntityRecord(
        "postType",
        TEMPLATE_POST_TYPE,
        {
          description,
          // Slugs need to be strings, so this is for template `404`
          slug: slug.toString(),
          status: "publish",
          title,
          // This adds a post meta field in template that is part of `is_custom` value calculation.
          is_wp_suggestion: isWPSuggestion
        },
        { throwOnError: true }
      );
      history.navigate(
        `/${TEMPLATE_POST_TYPE}/${newTemplate.id}?canvas=edit`
      );
      createSuccessNotice(
        (0,external_wp_i18n_namespaceObject.sprintf)(
          // translators: %s: Title of the created post or template, e.g: "Hello world".
          (0,external_wp_i18n_namespaceObject.__)('"%s" successfully created.'),
          (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(newTemplate.title?.rendered || title) || (0,external_wp_i18n_namespaceObject.__)("(no title)")
        ),
        {
          type: "snackbar"
        }
      );
    } catch (error) {
      const errorMessage = error.message && error.code !== "unknown_error" ? error.message : (0,external_wp_i18n_namespaceObject.__)("An error occurred while creating the template.");
      createErrorNotice(errorMessage, {
        type: "snackbar"
      });
    } finally {
      setIsSubmitting(false);
    }
  }
  const onModalClose = () => {
    onClose();
    setModalContent(modalContentMap.templatesList);
  };
  let modalTitle = (0,external_wp_i18n_namespaceObject.__)("Add template");
  if (modalContent === modalContentMap.customTemplate) {
    modalTitle = (0,external_wp_i18n_namespaceObject.sprintf)(
      // translators: %s: Name of the post type e.g: "Post".
      (0,external_wp_i18n_namespaceObject.__)("Add template: %s"),
      entityForSuggestions.labels.singular_name
    );
  } else if (modalContent === modalContentMap.customGenericTemplate) {
    modalTitle = (0,external_wp_i18n_namespaceObject.__)("Create custom template");
  }
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
    external_wp_components_namespaceObject.Modal,
    {
      title: modalTitle,
      className: dist_clsx("edit-site-add-new-template__modal", {
        "edit-site-add-new-template__modal_template_list": modalContent === modalContentMap.templatesList,
        "edit-site-custom-template-modal": modalContent === modalContentMap.customTemplate
      }),
      onRequestClose: onModalClose,
      overlayClassName: modalContent === modalContentMap.customGenericTemplate ? "edit-site-custom-generic-template__modal" : void 0,
      ref: containerRef,
      children: [
        modalContent === modalContentMap.templatesList && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
          external_wp_components_namespaceObject.__experimentalGrid,
          {
            columns: isMobile ? 2 : 3,
            gap: 4,
            align: "flex-start",
            justify: "center",
            className: "edit-site-add-new-template__template-list__contents",
            children: [
              /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Flex, { className: "edit-site-add-new-template__template-list__prompt", children: (0,external_wp_i18n_namespaceObject.__)(
                "Select what the new template should apply to:"
              ) }),
              missingTemplates.map((template) => {
                const { title, slug, onClick } = template;
                return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
                  TemplateListItem,
                  {
                    title,
                    direction: "column",
                    className: "edit-site-add-new-template__template-button",
                    description: TEMPLATE_SHORT_DESCRIPTIONS[slug],
                    icon: TEMPLATE_ICONS[slug] || layout_default,
                    onClick: () => onClick ? onClick(template) : createTemplate(template)
                  },
                  slug
                );
              }),
              /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
                TemplateListItem,
                {
                  title: (0,external_wp_i18n_namespaceObject.__)("Custom template"),
                  direction: "row",
                  className: "edit-site-add-new-template__custom-template-button",
                  icon: pencil_default,
                  onClick: () => setModalContent(
                    modalContentMap.customGenericTemplate
                  ),
                  children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
                    external_wp_components_namespaceObject.__experimentalText,
                    {
                      lineHeight: 1.53846153846,
                      children: (0,external_wp_i18n_namespaceObject.__)(
                        "A custom template can be manually applied to any post or page."
                      )
                    }
                  )
                }
              )
            ]
          }
        ),
        modalContent === modalContentMap.customTemplate && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
          add_custom_template_modal_content_default,
          {
            onSelect: createTemplate,
            entityForSuggestions,
            onBack: () => setModalContent(modalContentMap.templatesList),
            containerRef
          }
        ),
        modalContent === modalContentMap.customGenericTemplate && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
          add_custom_generic_template_modal_content_default,
          {
            createTemplate,
            onBack: () => setModalContent(modalContentMap.templatesList)
          }
        )
      ]
    }
  );
}
function NewTemplate() {
  const [showModal, setShowModal] = (0,external_wp_element_.useState)(false);
  const { postType } = (0,external_wp_data_.useSelect)((select) => {
    const { getPostType } = select(external_wp_coreData_namespaceObject.store);
    return {
      postType: getPostType(TEMPLATE_POST_TYPE)
    };
  }, []);
  if (!postType) {
    return null;
  }
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
    /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
      external_wp_components_namespaceObject.Button,
      {
        variant: "primary",
        onClick: () => setShowModal(true),
        label: postType.labels.add_new_item,
        __next40pxDefaultSize: true,
        children: postType.labels.add_new_item
      }
    ),
    showModal && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(NewTemplateModal, { onClose: () => setShowModal(false) })
  ] });
}
function useMissingTemplates(setEntityForSuggestions, onClick) {
  const existingTemplates = useExistingTemplates();
  const defaultTemplateTypes = useDefaultTemplateTypes();
  const existingTemplateSlugs = (existingTemplates || []).map(
    ({ slug }) => slug
  );
  const missingDefaultTemplates = (defaultTemplateTypes || []).filter(
    (template) => DEFAULT_TEMPLATE_SLUGS.includes(template.slug) && !existingTemplateSlugs.includes(template.slug)
  );
  const onClickMenuItem = (_entityForSuggestions) => {
    onClick?.();
    setEntityForSuggestions(_entityForSuggestions);
  };
  const enhancedMissingDefaultTemplateTypes = [...missingDefaultTemplates];
  const { defaultTaxonomiesMenuItems, taxonomiesMenuItems } = useTaxonomiesMenuItems(onClickMenuItem);
  const { defaultPostTypesMenuItems, postTypesMenuItems } = usePostTypeMenuItems(onClickMenuItem);
  const authorMenuItem = useAuthorMenuItem(onClickMenuItem);
  [
    ...defaultTaxonomiesMenuItems,
    ...defaultPostTypesMenuItems,
    authorMenuItem
  ].forEach((menuItem) => {
    if (!menuItem) {
      return;
    }
    const matchIndex = enhancedMissingDefaultTemplateTypes.findIndex(
      (template) => template.slug === menuItem.slug
    );
    if (matchIndex > -1) {
      enhancedMissingDefaultTemplateTypes[matchIndex] = menuItem;
    } else {
      enhancedMissingDefaultTemplateTypes.push(menuItem);
    }
  });
  enhancedMissingDefaultTemplateTypes?.sort((template1, template2) => {
    return DEFAULT_TEMPLATE_SLUGS.indexOf(template1.slug) - DEFAULT_TEMPLATE_SLUGS.indexOf(template2.slug);
  });
  const missingTemplates = [
    ...enhancedMissingDefaultTemplateTypes,
    ...usePostTypeArchiveMenuItems(),
    ...postTypesMenuItems,
    ...taxonomiesMenuItems
  ];
  return missingTemplates;
}
var add_new_template_default = (0,external_wp_element_.memo)(NewTemplate);


;// ./node_modules/@wordpress/edit-site/build-module/components/page-templates/fields.js












const { useGlobalStyle: page_templates_fields_useGlobalStyle } = unlock(external_wp_blockEditor_namespaceObject.privateApis);
function fields_PreviewField({ item }) {
  const settings = usePatternSettings();
  const [backgroundColor = "white"] = page_templates_fields_useGlobalStyle("color.background");
  const blocks = (0,external_wp_element_.useMemo)(() => {
    return (0,external_wp_blocks_namespaceObject.parse)(item.content.raw);
  }, [item.content.raw]);
  const isEmpty = !blocks?.length;
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_editor_namespaceObject.EditorProvider, { post: item, settings, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
    "div",
    {
      className: "page-templates-preview-field",
      style: { backgroundColor },
      children: [
        isEmpty && (0,external_wp_i18n_namespaceObject.__)("Empty template"),
        !isEmpty && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockPreview.Async, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockPreview, { blocks }) })
      ]
    }
  ) });
}
const fields_previewField = {
  label: (0,external_wp_i18n_namespaceObject.__)("Preview"),
  id: "preview",
  render: fields_PreviewField,
  enableSorting: false
};
const descriptionField = {
  label: (0,external_wp_i18n_namespaceObject.__)("Description"),
  id: "description",
  render: ({ item }) => {
    return item.description && (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(item.description);
  },
  enableSorting: false,
  enableGlobalSearch: true
};
function fields_AuthorField({ item }) {
  const [isImageLoaded, setIsImageLoaded] = (0,external_wp_element_.useState)(false);
  const { text, icon, imageUrl } = useAddedBy(item.type, item.id);
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { alignment: "left", spacing: 0, children: [
    imageUrl && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
      "div",
      {
        className: dist_clsx("page-templates-author-field__avatar", {
          "is-loaded": isImageLoaded
        }),
        children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
          "img",
          {
            onLoad: () => setIsImageLoaded(true),
            alt: "",
            src: imageUrl
          }
        )
      }
    ),
    !imageUrl && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "page-templates-author-field__icon", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { icon }) }),
    /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "page-templates-author-field__name", children: text })
  ] });
}
const authorField = {
  label: (0,external_wp_i18n_namespaceObject.__)("Author"),
  id: "author",
  getValue: ({ item }) => item.author_text,
  render: fields_AuthorField
};


;// ./node_modules/@wordpress/edit-site/build-module/components/page-templates/view-utils.js
const view_utils_defaultLayouts = {
  table: {
    showMedia: false
  },
  grid: {
    showMedia: true
  },
  list: {
    showMedia: false
  }
};
const view_utils_DEFAULT_VIEW = {
  type: "grid",
  perPage: 20,
  sort: {
    field: "title",
    direction: "asc"
  },
  titleField: "title",
  descriptionField: "description",
  mediaField: "preview",
  fields: ["author", "active", "slug"],
  filters: [],
  ...view_utils_defaultLayouts.grid
};
function getDefaultView(activeView) {
  return {
    ...view_utils_DEFAULT_VIEW,
    filters: !["active", "user"].includes(activeView) ? [
      {
        field: "author",
        operator: "isAny",
        value: [activeView]
      }
    ] : []
  };
}


;// ./node_modules/@wordpress/edit-site/build-module/components/page-templates/index.js


















const { usePostActions: page_templates_usePostActions, templateTitleField } = unlock(external_wp_editor_namespaceObject.privateApis);
const { useHistory: page_templates_useHistory, useLocation: page_templates_useLocation } = unlock(external_wp_router_namespaceObject.privateApis);
const { useEntityRecordsWithPermissions } = unlock(external_wp_coreData_namespaceObject.privateApis);
function PageTemplates() {
  const { path, query } = page_templates_useLocation();
  const { activeView = "active", postId } = query;
  const [selection, setSelection] = (0,external_wp_element_.useState)([postId]);
  const defaultView = (0,external_wp_element_.useMemo)(() => {
    return getDefaultView(activeView);
  }, [activeView]);
  const { view, updateView, isModified, resetToDefault } = (0,build_module.useView)({
    kind: "postType",
    name: TEMPLATE_POST_TYPE,
    slug: activeView,
    defaultView,
    queryParams: {
      page: query.pageNumber,
      search: query.search
    },
    onChangeQueryParams: (newQueryParams) => {
      history.navigate(
        (0,external_wp_url_namespaceObject.addQueryArgs)(path, {
          ...query,
          pageNumber: newQueryParams.page,
          search: newQueryParams.search || void 0
        })
      );
    }
  });
  const { records, isResolving: isLoadingData } = useEntityRecordsWithPermissions("postType", TEMPLATE_POST_TYPE, {
    per_page: -1
  });
  const history = page_templates_useHistory();
  const onChangeSelection = (0,external_wp_element_.useCallback)(
    (items) => {
      setSelection(items);
      if (view?.type === "list") {
        history.navigate(
          (0,external_wp_url_namespaceObject.addQueryArgs)(path, {
            postId: items.length === 1 ? items[0] : void 0
          })
        );
      }
    },
    [history, path, view?.type]
  );
  const authors = (0,external_wp_element_.useMemo)(() => {
    if (!records) {
      return [];
    }
    const authorsSet = /* @__PURE__ */ new Set();
    records.forEach((template) => {
      authorsSet.add(template.author_text);
    });
    return Array.from(authorsSet).map((author) => ({
      value: author,
      label: author
    }));
  }, [records]);
  const fields = (0,external_wp_element_.useMemo)(
    () => [
      fields_previewField,
      templateTitleField,
      descriptionField,
      {
        ...authorField,
        elements: authors
      }
    ],
    [authors]
  );
  const { data, paginationInfo } = (0,external_wp_element_.useMemo)(() => {
    return filterSortAndPaginate(records, view, fields);
  }, [records, view, fields]);
  const postTypeActions = page_templates_usePostActions({
    postType: TEMPLATE_POST_TYPE,
    context: "list"
  });
  const editAction = useEditPostAction();
  const actions = (0,external_wp_element_.useMemo)(
    () => [editAction, ...postTypeActions],
    [postTypeActions, editAction]
  );
  const onChangeView = (0,external_wp_compose_namespaceObject.useEvent)((newView) => {
    if (newView.type !== view.type) {
      history.invalidate();
    }
    updateView(newView);
  });
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    page_page_default,
    {
      className: "edit-site-page-templates",
      title: (0,external_wp_i18n_namespaceObject.__)("Templates"),
      actions: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
        isModified && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
          external_wp_components_namespaceObject.Button,
          {
            __next40pxDefaultSize: true,
            onClick: () => {
              resetToDefault();
              history.invalidate();
            },
            children: (0,external_wp_i18n_namespaceObject.__)("Reset view")
          }
        ),
        /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(add_new_template_default, {})
      ] }),
      children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
        dataviews_default,
        {
          paginationInfo,
          fields,
          actions,
          data,
          isLoading: isLoadingData,
          view,
          onChangeView,
          onChangeSelection,
          isItemClickable: () => true,
          onClickItem: ({ id }) => {
            history.navigate(`/wp_template/${id}?canvas=edit`);
          },
          selection,
          defaultLayouts: view_utils_defaultLayouts
        },
        activeView
      )
    }
  );
}


;// ./node_modules/@wordpress/edit-site/build-module/components/site-editor-routes/templates.js







async function isTemplateListView(query) {
  const { activeView = "active" } = query;
  const view = await (0,build_module.loadView)({
    kind: "postType",
    name: "wp_template",
    slug: activeView,
    defaultView: getDefaultView(activeView)
  });
  return view.type === "list";
}
const templatesRoute = {
  name: "templates",
  path: "/template",
  areas: {
    sidebar({ siteData }) {
      const isBlockTheme = siteData.currentTheme?.is_block_theme;
      return isBlockTheme ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenTemplatesBrowse, { backPath: "/" }) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenUnsupported, {});
    },
    content({ siteData }) {
      const isBlockTheme = siteData.currentTheme?.is_block_theme;
      return isBlockTheme ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PageTemplates, {}) : void 0;
    },
    async preview({ query, siteData }) {
      const isBlockTheme = siteData.currentTheme?.is_block_theme;
      if (!isBlockTheme) {
        return void 0;
      }
      const isListView = await isTemplateListView(query);
      return isListView ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {}) : void 0;
    },
    mobile({ siteData }) {
      const isBlockTheme = siteData.currentTheme?.is_block_theme;
      return isBlockTheme ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PageTemplates, {}) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenUnsupported, {});
    }
  },
  widths: {
    async content({ query }) {
      const isListView = await isTemplateListView(query);
      return isListView ? 380 : void 0;
    }
  }
};


;// ./node_modules/@wordpress/edit-site/build-module/components/site-editor-routes/template-item.js




const templateItemRoute = {
  name: "template-item",
  path: "/wp_template/*postId",
  areas: {
    sidebar({ siteData }) {
      const isBlockTheme = siteData.currentTheme?.is_block_theme;
      return isBlockTheme ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenTemplatesBrowse, { backPath: "/" }) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenUnsupported, {});
    },
    mobile({ siteData }) {
      const isBlockTheme = siteData.currentTheme?.is_block_theme;
      return isBlockTheme ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {}) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenUnsupported, {});
    },
    preview({ siteData }) {
      const isBlockTheme = siteData.currentTheme?.is_block_theme;
      return isBlockTheme ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {}) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenUnsupported, {});
    }
  }
};


;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-dataviews/dataview-item.js








const { useLocation: dataview_item_useLocation } = unlock(external_wp_router_namespaceObject.privateApis);
function DataViewItem({
  title,
  slug,
  type,
  icon,
  isActive,
  suffix
}) {
  const { path } = dataview_item_useLocation();
  const iconToUse = icon || VIEW_LAYOUTS.find((v) => v.type === type).icon;
  if (slug === "all") {
    slug = void 0;
  }
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
    external_wp_components_namespaceObject.__experimentalHStack,
    {
      justify: "flex-start",
      className: dist_clsx("edit-site-sidebar-dataviews-dataview-item", {
        "is-selected": isActive
      }),
      children: [
        /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
          SidebarNavigationItem,
          {
            icon: iconToUse,
            to: (0,external_wp_url_namespaceObject.addQueryArgs)(path, {
              activeView: slug
            }),
            "aria-current": isActive ? "true" : void 0,
            children: title
          }
        ),
        suffix
      ]
    }
  );
}


;// ./node_modules/@wordpress/icons/build-module/library/pages.js


var pages_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: [
  /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M14.5 5.5h-7V7h7V5.5ZM7.5 9h7v1.5h-7V9Zm7 3.5h-7V14h7v-1.5Z" }),
  /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M16 2H6a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2ZM6 3.5h10a.5.5 0 0 1 .5.5v12a.5.5 0 0 1-.5.5H6a.5.5 0 0 1-.5-.5V4a.5.5 0 0 1 .5-.5Z" }),
  /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M20 8v11c0 .69-.31 1-.999 1H6v1.5h13.001c1.52 0 2.499-.982 2.499-2.5V8H20Z" })
] });


;// ./node_modules/@wordpress/icons/build-module/library/published.js


var published_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
  external_wp_primitives_namespaceObject.Path,
  {
    fillRule: "evenodd",
    clipRule: "evenodd",
    d: "M12 18.5a6.5 6.5 0 1 1 0-13 6.5 6.5 0 0 1 0 13ZM4 12a8 8 0 1 1 16 0 8 8 0 0 1-16 0Zm11.53-1.47-1.06-1.06L11 12.94l-1.47-1.47-1.06 1.06L11 15.06l4.53-4.53Z"
  }
) });


;// ./node_modules/@wordpress/icons/build-module/library/scheduled.js


var scheduled_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
  external_wp_primitives_namespaceObject.Path,
  {
    fillRule: "evenodd",
    clipRule: "evenodd",
    d: "M12 18.5a6.5 6.5 0 1 1 0-13 6.5 6.5 0 0 1 0 13ZM4 12a8 8 0 1 1 16 0 8 8 0 0 1-16 0Zm9 1V8h-1.5v3.5h-2V13H13Z"
  }
) });


;// ./node_modules/@wordpress/icons/build-module/library/drafts.js


var drafts_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
  external_wp_primitives_namespaceObject.Path,
  {
    fillRule: "evenodd",
    clipRule: "evenodd",
    d: "M12 18.5a6.5 6.5 0 1 1 0-13 6.5 6.5 0 0 1 0 13ZM4 12a8 8 0 1 1 16 0 8 8 0 0 1-16 0Zm8 4a4 4 0 0 0 4-4H8a4 4 0 0 0 4 4Z"
  }
) });


;// ./node_modules/@wordpress/icons/build-module/library/pending.js


var pending_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
  external_wp_primitives_namespaceObject.Path,
  {
    fillRule: "evenodd",
    clipRule: "evenodd",
    d: "M12 18.5a6.5 6.5 0 1 1 0-13 6.5 6.5 0 0 1 0 13ZM4 12a8 8 0 1 1 16 0 8 8 0 0 1-16 0Zm8 4a4 4 0 0 1-4-4h4V8a4 4 0 0 1 0 8Z"
  }
) });


;// ./node_modules/@wordpress/icons/build-module/library/not-allowed.js


var not_allowed_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
  external_wp_primitives_namespaceObject.Path,
  {
    fillRule: "evenodd",
    clipRule: "evenodd",
    d: "M12 18.5A6.5 6.5 0 0 1 6.93 7.931l9.139 9.138A6.473 6.473 0 0 1 12 18.5Zm5.123-2.498a6.5 6.5 0 0 0-9.124-9.124l9.124 9.124ZM4 12a8 8 0 1 1 16 0 8 8 0 0 1-16 0Z"
  }
) });


;// ./node_modules/@wordpress/icons/build-module/library/trash.js


var trash_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
  external_wp_primitives_namespaceObject.Path,
  {
    fillRule: "evenodd",
    clipRule: "evenodd",
    d: "M12 5.5A2.25 2.25 0 0 0 9.878 7h4.244A2.251 2.251 0 0 0 12 5.5ZM12 4a3.751 3.751 0 0 0-3.675 3H5v1.5h1.27l.818 8.997a2.75 2.75 0 0 0 2.739 2.501h4.347a2.75 2.75 0 0 0 2.738-2.5L17.73 8.5H19V7h-3.325A3.751 3.751 0 0 0 12 4Zm4.224 4.5H7.776l.806 8.861a1.25 1.25 0 0 0 1.245 1.137h4.347a1.25 1.25 0 0 0 1.245-1.137l.805-8.861Z"
  }
) });


;// ./node_modules/@wordpress/edit-site/build-module/components/post-list/view-utils.js



const post_list_view_utils_defaultLayouts = {
  table: {},
  grid: {},
  list: {}
};
const DEFAULT_POST_BASE = {
  type: "list",
  filters: [],
  perPage: 20,
  sort: {
    field: "title",
    direction: "asc"
  },
  showLevels: true,
  titleField: "title",
  mediaField: "featured_media",
  fields: ["author", "status"],
  ...post_list_view_utils_defaultLayouts.list
};
function getDefaultViews(postType) {
  return [
    {
      title: postType?.labels?.all_items || (0,external_wp_i18n_namespaceObject.__)("All items"),
      slug: "all",
      icon: pages_default,
      view: DEFAULT_POST_BASE
    },
    {
      title: (0,external_wp_i18n_namespaceObject.__)("Published"),
      slug: "published",
      icon: published_default,
      view: {
        ...DEFAULT_POST_BASE,
        filters: [
          {
            field: "status",
            operator: OPERATOR_IS_ANY,
            value: "publish",
            isLocked: true
          }
        ]
      }
    },
    {
      title: (0,external_wp_i18n_namespaceObject.__)("Scheduled"),
      slug: "future",
      icon: scheduled_default,
      view: {
        ...DEFAULT_POST_BASE,
        filters: [
          {
            field: "status",
            operator: OPERATOR_IS_ANY,
            value: "future",
            isLocked: true
          }
        ]
      }
    },
    {
      title: (0,external_wp_i18n_namespaceObject.__)("Drafts"),
      slug: "drafts",
      icon: drafts_default,
      view: {
        ...DEFAULT_POST_BASE,
        filters: [
          {
            field: "status",
            operator: OPERATOR_IS_ANY,
            value: "draft",
            isLocked: true
          }
        ]
      }
    },
    {
      title: (0,external_wp_i18n_namespaceObject.__)("Pending"),
      slug: "pending",
      icon: pending_default,
      view: {
        ...DEFAULT_POST_BASE,
        filters: [
          {
            field: "status",
            operator: OPERATOR_IS_ANY,
            value: "pending",
            isLocked: true
          }
        ]
      }
    },
    {
      title: (0,external_wp_i18n_namespaceObject.__)("Private"),
      slug: "private",
      icon: not_allowed_default,
      view: {
        ...DEFAULT_POST_BASE,
        filters: [
          {
            field: "status",
            operator: OPERATOR_IS_ANY,
            value: "private",
            isLocked: true
          }
        ]
      }
    },
    {
      title: (0,external_wp_i18n_namespaceObject.__)("Trash"),
      slug: "trash",
      icon: trash_default,
      view: {
        ...DEFAULT_POST_BASE,
        type: "table",
        layout: post_list_view_utils_defaultLayouts.table.layout,
        filters: [
          {
            field: "status",
            operator: OPERATOR_IS_ANY,
            value: "trash",
            isLocked: true
          }
        ]
      }
    }
  ];
}
const view_utils_getDefaultView = (postType, activeView) => {
  return getDefaultViews(postType).find(
    ({ slug }) => slug === activeView
  )?.view;
};


;// ./node_modules/@wordpress/edit-site/build-module/components/sidebar-dataviews/index.js









const { useLocation: sidebar_dataviews_useLocation } = unlock(external_wp_router_namespaceObject.privateApis);
function DataViewsSidebarContent({ postType }) {
  const {
    query: { activeView = "all" }
  } = sidebar_dataviews_useLocation();
  const postTypeObject = (0,external_wp_data_.useSelect)(
    (select) => {
      const { getPostType } = select(external_wp_coreData_namespaceObject.store);
      return getPostType(postType);
    },
    [postType]
  );
  const defaultViews = (0,external_wp_element_.useMemo)(
    () => getDefaultViews(postTypeObject),
    [postTypeObject]
  );
  if (!postType) {
    return null;
  }
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItemGroup, { className: "edit-site-sidebar-dataviews", children: defaultViews.map((dataview) => {
    return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
      DataViewItem,
      {
        slug: dataview.slug,
        title: dataview.title,
        icon: dataview.icon,
        type: dataview.view.type,
        isActive: dataview.slug === activeView
      },
      dataview.slug
    );
  }) }) });
}


;// ./node_modules/@wordpress/icons/build-module/library/drawer-right.js


var drawer_right_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
  external_wp_primitives_namespaceObject.Path,
  {
    fillRule: "evenodd",
    clipRule: "evenodd",
    d: "M18 4H6c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm-4 14.5H6c-.3 0-.5-.2-.5-.5V6c0-.3.2-.5.5-.5h8v13zm4.5-.5c0 .3-.2.5-.5.5h-2.5v-13H18c.3 0 .5.2.5.5v12z"
  }
) });


;// ./node_modules/@wordpress/edit-site/build-module/components/add-new-post/index.js









function AddNewPostModal({ postType, onSave, onClose }) {
  const labels = (0,external_wp_data_.useSelect)(
    (select) => select(external_wp_coreData_namespaceObject.store).getPostType(postType)?.labels,
    [postType]
  );
  const [isCreatingPost, setIsCreatingPost] = (0,external_wp_element_.useState)(false);
  const [title, setTitle] = (0,external_wp_element_.useState)("");
  const { saveEntityRecord } = (0,external_wp_data_.useDispatch)(external_wp_coreData_namespaceObject.store);
  const { createErrorNotice, createSuccessNotice } = (0,external_wp_data_.useDispatch)(external_wp_notices_namespaceObject.store);
  const { resolveSelect } = (0,external_wp_data_.useRegistry)();
  async function createPost(event) {
    event.preventDefault();
    if (isCreatingPost) {
      return;
    }
    setIsCreatingPost(true);
    try {
      const postTypeObject = await resolveSelect(external_wp_coreData_namespaceObject.store).getPostType(postType);
      const newPage = await saveEntityRecord(
        "postType",
        postType,
        {
          status: "draft",
          title,
          slug: title ?? void 0,
          content: !!postTypeObject.template && postTypeObject.template.length ? (0,external_wp_blocks_namespaceObject.serialize)(
            (0,external_wp_blocks_namespaceObject.synchronizeBlocksWithTemplate)(
              [],
              postTypeObject.template
            )
          ) : void 0
        },
        { throwOnError: true }
      );
      onSave(newPage);
      createSuccessNotice(
        (0,external_wp_i18n_namespaceObject.sprintf)(
          // translators: %s: Title of the created post or template, e.g: "Hello world".
          (0,external_wp_i18n_namespaceObject.__)('"%s" successfully created.'),
          (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(newPage.title?.rendered || title) || (0,external_wp_i18n_namespaceObject.__)("(no title)")
        ),
        { type: "snackbar" }
      );
    } catch (error) {
      const errorMessage = error.message && error.code !== "unknown_error" ? error.message : (0,external_wp_i18n_namespaceObject.__)("An error occurred while creating the item.");
      createErrorNotice(errorMessage, {
        type: "snackbar"
      });
    } finally {
      setIsCreatingPost(false);
    }
  }
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    external_wp_components_namespaceObject.Modal,
    {
      title: (
        // translators: %s: post type singular_name label e.g: "Page".
        (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)("Draft new: %s"), labels?.singular_name)
      ),
      onRequestClose: onClose,
      focusOnMount: "firstContentElement",
      size: "small",
      children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("form", { onSubmit: createPost, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 4, children: [
        /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
          external_wp_components_namespaceObject.TextControl,
          {
            __next40pxDefaultSize: true,
            __nextHasNoMarginBottom: true,
            label: (0,external_wp_i18n_namespaceObject.__)("Title"),
            onChange: setTitle,
            placeholder: (0,external_wp_i18n_namespaceObject.__)("No title"),
            value: title
          }
        ),
        /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { spacing: 2, justify: "end", children: [
          /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
            external_wp_components_namespaceObject.Button,
            {
              __next40pxDefaultSize: true,
              variant: "tertiary",
              onClick: onClose,
              children: (0,external_wp_i18n_namespaceObject.__)("Cancel")
            }
          ),
          /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
            external_wp_components_namespaceObject.Button,
            {
              __next40pxDefaultSize: true,
              variant: "primary",
              type: "submit",
              isBusy: isCreatingPost,
              "aria-disabled": isCreatingPost,
              children: (0,external_wp_i18n_namespaceObject.__)("Create draft")
            }
          )
        ] })
      ] }) })
    }
  );
}


;// ./node_modules/@wordpress/edit-site/build-module/components/post-list/index.js



















const { usePostActions: post_list_usePostActions, usePostFields } = unlock(external_wp_editor_namespaceObject.privateApis);
const { useLocation: post_list_useLocation, useHistory: post_list_useHistory } = unlock(external_wp_router_namespaceObject.privateApis);
const { useEntityRecordsWithPermissions: post_list_useEntityRecordsWithPermissions } = unlock(external_wp_coreData_namespaceObject.privateApis);
const post_list_EMPTY_ARRAY = [];
const DEFAULT_STATUSES = "draft,future,pending,private,publish";
function getItemId(item) {
  return item.id.toString();
}
function getItemLevel(item) {
  return item.level;
}
function PostList({ postType }) {
  const { path, query } = post_list_useLocation();
  const { activeView = "all", postId, quickEdit = false } = query;
  const history = post_list_useHistory();
  const postTypeObject = (0,external_wp_data_.useSelect)(
    (select) => {
      const { getPostType } = select(external_wp_coreData_namespaceObject.store);
      return getPostType(postType);
    },
    [postType]
  );
  const { view, updateView, isModified, resetToDefault } = (0,build_module.useView)({
    kind: "postType",
    name: postType,
    slug: activeView,
    queryParams: {
      page: query.pageNumber,
      search: query.search
    },
    onChangeQueryParams: (newQueryParams) => {
      history.navigate(
        (0,external_wp_url_namespaceObject.addQueryArgs)(path, {
          ...query,
          pageNumber: newQueryParams.page,
          search: newQueryParams.search || void 0
        })
      );
    },
    defaultView: view_utils_getDefaultView(postTypeObject, activeView)
  });
  const onChangeView = (0,external_wp_compose_namespaceObject.useEvent)((newView) => {
    if (newView.type !== view.type) {
      history.invalidate();
    }
    updateView(newView);
  });
  const [selection, setSelection] = (0,external_wp_element_.useState)(postId?.split(",") ?? []);
  const onChangeSelection = (0,external_wp_element_.useCallback)(
    (items) => {
      setSelection(items);
      history.navigate(
        (0,external_wp_url_namespaceObject.addQueryArgs)(path, {
          postId: items.join(",")
        })
      );
    },
    [path, history]
  );
  const fields = usePostFields({
    postType
  });
  const queryArgs = (0,external_wp_element_.useMemo)(() => {
    const filters = {};
    view.filters?.forEach((filter) => {
      if (filter.field === "status" && filter.operator === OPERATOR_IS_ANY) {
        filters.status = filter.value;
      }
      if (filter.field === "author" && filter.operator === OPERATOR_IS_ANY) {
        filters.author = filter.value;
      } else if (filter.field === "author" && filter.operator === OPERATOR_IS_NONE) {
        filters.author_exclude = filter.value;
      }
    });
    if (!filters.status || filters.status === "") {
      filters.status = DEFAULT_STATUSES;
    }
    return {
      per_page: view.perPage,
      page: view.page,
      _embed: "author,wp:featuredmedia",
      order: view.sort?.direction,
      orderby: view.sort?.field,
      orderby_hierarchy: !!view.showLevels,
      search: view.search,
      ...filters
    };
  }, [view]);
  const {
    records,
    isResolving: isLoadingData,
    totalItems,
    totalPages
  } = post_list_useEntityRecordsWithPermissions("postType", postType, queryArgs);
  const data = (0,external_wp_element_.useMemo)(() => {
    if (view?.sort?.field === "author") {
      return filterSortAndPaginate(
        records,
        { sort: { ...view.sort } },
        fields
      ).data;
    }
    return records;
  }, [records, fields, view?.sort]);
  const ids = data?.map((record) => getItemId(record)) ?? [];
  const prevIds = (0,external_wp_compose_namespaceObject.usePrevious)(ids) ?? [];
  const deletedIds = prevIds.filter((id) => !ids.includes(id));
  const postIdWasDeleted = deletedIds.includes(postId);
  (0,external_wp_element_.useEffect)(() => {
    if (postIdWasDeleted) {
      history.navigate(
        (0,external_wp_url_namespaceObject.addQueryArgs)(path, {
          postId: void 0
        })
      );
    }
  }, [history, postIdWasDeleted, path]);
  const paginationInfo = (0,external_wp_element_.useMemo)(
    () => ({
      totalItems,
      totalPages
    }),
    [totalItems, totalPages]
  );
  const { labels, canCreateRecord } = (0,external_wp_data_.useSelect)(
    (select) => {
      const { getPostType, canUser } = select(external_wp_coreData_namespaceObject.store);
      return {
        labels: getPostType(postType)?.labels,
        canCreateRecord: canUser("create", {
          kind: "postType",
          name: postType
        })
      };
    },
    [postType]
  );
  const postTypeActions = post_list_usePostActions({
    postType,
    context: "list"
  });
  const editAction = useEditPostAction();
  const actions = (0,external_wp_element_.useMemo)(
    () => [editAction, ...postTypeActions],
    [postTypeActions, editAction]
  );
  const [showAddPostModal, setShowAddPostModal] = (0,external_wp_element_.useState)(false);
  const openModal = () => setShowAddPostModal(true);
  const closeModal = () => setShowAddPostModal(false);
  const handleNewPage = ({ type, id }) => {
    history.navigate(`/${type}/${id}?canvas=edit`);
    closeModal();
  };
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    page_page_default,
    {
      title: labels?.name,
      actions: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
        isModified && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
          external_wp_components_namespaceObject.Button,
          {
            __next40pxDefaultSize: true,
            onClick: () => {
              resetToDefault();
              history.invalidate();
            },
            children: (0,external_wp_i18n_namespaceObject.__)("Reset view")
          }
        ),
        labels?.add_new_item && canCreateRecord && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
          /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
            external_wp_components_namespaceObject.Button,
            {
              variant: "primary",
              onClick: openModal,
              __next40pxDefaultSize: true,
              children: labels.add_new_item
            }
          ),
          showAddPostModal && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
            AddNewPostModal,
            {
              postType,
              onSave: handleNewPage,
              onClose: closeModal
            }
          )
        ] })
      ] }),
      children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
        dataviews_default,
        {
          paginationInfo,
          fields,
          actions,
          data: data || post_list_EMPTY_ARRAY,
          isLoading: isLoadingData,
          view,
          onChangeView,
          selection,
          onChangeSelection,
          isItemClickable: (item) => item.status !== "trash",
          onClickItem: ({ id }) => {
            history.navigate(`/${postType}/${id}?canvas=edit`);
          },
          getItemId,
          getItemLevel,
          defaultLayouts: post_list_view_utils_defaultLayouts,
          header: window.__experimentalQuickEditDataViews && view.type !== LAYOUT_LIST && postType === "page" && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
            external_wp_components_namespaceObject.Button,
            {
              size: "compact",
              isPressed: quickEdit,
              icon: drawer_right_default,
              label: (0,external_wp_i18n_namespaceObject.__)("Details"),
              onClick: () => {
                history.navigate(
                  (0,external_wp_url_namespaceObject.addQueryArgs)(path, {
                    quickEdit: quickEdit ? void 0 : true
                  })
                );
              }
            }
          )
        },
        activeView
      )
    }
  );
}


;// ./node_modules/@wordpress/dataviews/build-module/components/dataform-context/index.js


const DataFormContext = (0,external_wp_element_.createContext)({
  fields: []
});
DataFormContext.displayName = "DataFormContext";
function DataFormProvider({
  fields,
  children
}) {
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(DataFormContext.Provider, { value: { fields }, children });
}
var dataform_context_default = DataFormContext;


;// ./node_modules/@wordpress/dataviews/build-module/dataform-layouts/is-combined-field.js
function isCombinedField(field) {
  return field.children !== void 0;
}


;// ./node_modules/@wordpress/dataviews/build-module/dataform-layouts/normalize-form-fields.js
const DEFAULT_LAYOUT = {
  type: "regular",
  labelPosition: "top"
};
const normalizeCardSummaryField = (sum) => {
  if (typeof sum === "string") {
    return [{ id: sum, visibility: "when-collapsed" }];
  }
  return sum.map((item) => {
    if (typeof item === "string") {
      return { id: item, visibility: "when-collapsed" };
    }
    return { id: item.id, visibility: item.visibility };
  });
};
function normalizeLayout(layout) {
  let normalizedLayout = DEFAULT_LAYOUT;
  if (layout?.type === "regular") {
    normalizedLayout = {
      type: "regular",
      labelPosition: layout?.labelPosition ?? "top"
    };
  } else if (layout?.type === "panel") {
    const summary = layout.summary ?? [];
    const normalizedSummary = Array.isArray(summary) ? summary : [summary];
    normalizedLayout = {
      type: "panel",
      labelPosition: layout?.labelPosition ?? "side",
      openAs: layout?.openAs ?? "dropdown",
      summary: normalizedSummary
    };
  } else if (layout?.type === "card") {
    if (layout.withHeader === false) {
      normalizedLayout = {
        type: "card",
        withHeader: false,
        isOpened: true,
        summary: []
      };
    } else {
      const summary = layout.summary ?? [];
      normalizedLayout = {
        type: "card",
        withHeader: true,
        isOpened: typeof layout.isOpened === "boolean" ? layout.isOpened : true,
        summary: normalizeCardSummaryField(summary)
      };
    }
  } else if (layout?.type === "row") {
    normalizedLayout = {
      type: "row",
      alignment: layout?.alignment ?? "center",
      styles: layout?.styles ?? {}
    };
  }
  return normalizedLayout;
}
function normalizeFormFields(form) {
  const formLayout = normalizeLayout(form?.layout);
  return (form.fields ?? []).map((field) => {
    if (typeof field === "string") {
      return {
        id: field,
        layout: formLayout
      };
    }
    const fieldLayout = field.layout ? normalizeLayout(field.layout) : formLayout;
    return {
      ...field,
      layout: fieldLayout
    };
  });
}


;// ./node_modules/@wordpress/dataviews/build-module/dataform-layouts/regular/index.js








function regular_Header({ title }) {
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, { className: "dataforms-layouts-regular__header", spacing: 4, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { alignment: "center", children: [
    /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHeading, { level: 2, size: 13, children: title }),
    /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, {})
  ] }) });
}
function FormRegularField({
  data,
  field,
  onChange,
  hideLabelFromVision,
  validity
}) {
  const { fields } = (0,external_wp_element_.useContext)(dataform_context_default);
  const form = (0,external_wp_element_.useMemo)(
    () => ({
      layout: DEFAULT_LAYOUT,
      fields: isCombinedField(field) ? field.children : []
    }),
    [field]
  );
  if (isCombinedField(field)) {
    return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
      !hideLabelFromVision && field.label && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(regular_Header, { title: field.label }),
      /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
        DataFormLayout,
        {
          data,
          form,
          onChange,
          validity: validity?.children
        }
      )
    ] });
  }
  const layout = normalizeLayout({
    ...field.layout,
    type: "regular"
  });
  const labelPosition = layout.labelPosition;
  const fieldDefinition = fields.find(
    (fieldDef) => fieldDef.id === field.id
  );
  if (!fieldDefinition || !fieldDefinition.Edit) {
    return null;
  }
  if (labelPosition === "side") {
    return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { className: "dataforms-layouts-regular__field", children: [
      /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
        "div",
        {
          className: dist_clsx(
            "dataforms-layouts-regular__field-label",
            `dataforms-layouts-regular__field-label--label-position-${labelPosition}`
          ),
          children: fieldDefinition.label
        }
      ),
      /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "dataforms-layouts-regular__field-control", children: fieldDefinition.readOnly === true ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
        fieldDefinition.render,
        {
          item: data,
          field: fieldDefinition
        }
      ) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
        fieldDefinition.Edit,
        {
          data,
          field: fieldDefinition,
          onChange,
          hideLabelFromVision: true,
          validity
        },
        fieldDefinition.id
      ) })
    ] });
  }
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "dataforms-layouts-regular__field", children: fieldDefinition.readOnly === true ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
    !hideLabelFromVision && labelPosition !== "none" && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.BaseControl.VisualLabel, { children: fieldDefinition.label }),
    /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
      fieldDefinition.render,
      {
        item: data,
        field: fieldDefinition
      }
    )
  ] }) }) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    fieldDefinition.Edit,
    {
      data,
      field: fieldDefinition,
      onChange,
      hideLabelFromVision: labelPosition === "none" ? true : hideLabelFromVision,
      validity
    }
  ) });
}


;// ./node_modules/@wordpress/dataviews/build-module/dataform-layouts/panel/summary-button.js



function SummaryButton({
  summaryFields,
  data,
  labelPosition,
  fieldLabel,
  disabled,
  onClick,
  "aria-expanded": ariaExpanded
}) {
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    external_wp_components_namespaceObject.Button,
    {
      className: "dataforms-layouts-panel__summary-button",
      size: "compact",
      variant: ["none", "top"].includes(labelPosition) ? "link" : "tertiary",
      "aria-expanded": ariaExpanded,
      "aria-label": (0,external_wp_i18n_namespaceObject.sprintf)(
        // translators: %s: Field name.
        (0,external_wp_i18n_namespaceObject._x)("Edit %s", "field"),
        fieldLabel || ""
      ),
      onClick,
      disabled,
      accessibleWhenDisabled: true,
      style: summaryFields.length > 1 ? {
        minHeight: "auto",
        height: "auto",
        alignItems: "flex-start"
      } : void 0,
      children: summaryFields.length > 1 ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
        "div",
        {
          style: {
            display: "flex",
            flexDirection: "column",
            alignItems: "flex-start",
            width: "100%",
            gap: "2px"
          },
          children: summaryFields.map((summaryField) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
            "div",
            {
              style: { width: "100%" },
              children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
                summaryField.render,
                {
                  item: data,
                  field: summaryField
                }
              )
            },
            summaryField.id
          ))
        }
      ) : summaryFields.map((summaryField) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
        summaryField.render,
        {
          item: data,
          field: summaryField
        },
        summaryField.id
      ))
    }
  );
}
var summary_button_default = SummaryButton;


;// ./node_modules/@wordpress/dataviews/build-module/dataform-layouts/panel/dropdown.js









function DropdownHeader({
  title,
  onClose
}) {
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    external_wp_components_namespaceObject.__experimentalVStack,
    {
      className: "dataforms-layouts-panel__dropdown-header",
      spacing: 4,
      children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { alignment: "center", children: [
        title && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHeading, { level: 2, size: 13, children: title }),
        /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, {}),
        onClose && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
          external_wp_components_namespaceObject.Button,
          {
            label: (0,external_wp_i18n_namespaceObject.__)("Close"),
            icon: close_small_default,
            onClick: onClose,
            size: "small"
          }
        )
      ] })
    }
  );
}
function PanelDropdown({
  data,
  field,
  onChange,
  validity,
  labelPosition = "side",
  summaryFields,
  fieldDefinition,
  popoverAnchor
}) {
  const fieldLabel = isCombinedField(field) ? field.label : fieldDefinition?.label;
  const form = (0,external_wp_element_.useMemo)(
    () => ({
      layout: DEFAULT_LAYOUT,
      fields: isCombinedField(field) ? field.children : (
        // If not explicit children return the field id itself.
        [{ id: field.id }]
      )
    }),
    [field]
  );
  const formValidity = (0,external_wp_element_.useMemo)(() => {
    if (validity === void 0) {
      return void 0;
    }
    if (isCombinedField(field)) {
      return validity?.children;
    }
    return { [field.id]: validity };
  }, [validity, field]);
  const popoverProps = (0,external_wp_element_.useMemo)(
    () => ({
      // Anchor the popover to the middle of the entire row so that it doesn't
      // move around when the label changes.
      anchor: popoverAnchor,
      placement: "left-start",
      offset: 36,
      shift: true
    }),
    [popoverAnchor]
  );
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    external_wp_components_namespaceObject.Dropdown,
    {
      contentClassName: "dataforms-layouts-panel__field-dropdown",
      popoverProps,
      focusOnMount: true,
      toggleProps: {
        size: "compact",
        variant: "tertiary",
        tooltipPosition: "middle left"
      },
      renderToggle: ({ isOpen, onToggle }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
        summary_button_default,
        {
          summaryFields,
          data,
          labelPosition,
          fieldLabel,
          disabled: fieldDefinition.readOnly === true,
          onClick: onToggle,
          "aria-expanded": isOpen
        }
      ),
      renderContent: ({ onClose }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
        /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(DropdownHeader, { title: fieldLabel, onClose }),
        /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
          DataFormLayout,
          {
            data,
            form,
            onChange,
            validity: formValidity,
            children: (FieldLayout, childField, childFieldValidity) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
              FieldLayout,
              {
                data,
                field: childField,
                onChange,
                hideLabelFromVision: (form?.fields ?? []).length < 2,
                validity: childFieldValidity
              },
              childField.id
            )
          }
        )
      ] })
    }
  );
}
var dropdown_default = PanelDropdown;


// EXTERNAL MODULE: ./node_modules/deepmerge/dist/cjs.js
var cjs = __webpack_require__(66);
var cjs_default = /*#__PURE__*/__webpack_require__.n(cjs);
;// ./node_modules/@wordpress/dataviews/build-module/hooks/use-form-validity.js





const isEmptyNullOrUndefined = (value) => [void 0, "", null].includes(value);
const isArrayOrElementsEmptyNullOrUndefined = (value) => {
  return !Array.isArray(value) || value.length === 0 || value.every((element) => isEmptyNullOrUndefined(element));
};
function isInvalidForRequired(fieldType, value) {
  if (fieldType === void 0 && isEmptyNullOrUndefined(value) || fieldType === "text" && isEmptyNullOrUndefined(value) || fieldType === "email" && isEmptyNullOrUndefined(value) || fieldType === "url" && isEmptyNullOrUndefined(value) || fieldType === "telephone" && isEmptyNullOrUndefined(value) || fieldType === "password" && isEmptyNullOrUndefined(value) || fieldType === "integer" && isEmptyNullOrUndefined(value) || fieldType === "number" && isEmptyNullOrUndefined(value) || fieldType === "array" && isArrayOrElementsEmptyNullOrUndefined(value) || fieldType === "boolean" && value !== true) {
    return true;
  }
  return false;
}
function isFormValid(formValidity) {
  if (!formValidity) {
    return true;
  }
  return Object.values(formValidity).every((fieldValidation) => {
    return Object.entries(fieldValidation).every(
      ([key, validation]) => {
        if (key === "children" && validation && typeof validation === "object") {
          return isFormValid(validation);
        }
        return validation.type === "valid";
      }
    );
  });
}
function updateFieldValidity(setFormValidity, parentFieldId, fieldId, newValidity) {
  if (parentFieldId) {
    setFormValidity((prev) => ({
      ...prev,
      [parentFieldId]: {
        ...prev?.[parentFieldId],
        children: {
          ...prev?.[parentFieldId]?.children,
          [fieldId]: {
            ...newValidity
          }
        }
      }
    }));
  } else {
    setFormValidity((prev) => ({
      ...prev,
      [fieldId]: {
        ...newValidity
      }
    }));
  }
}
function getFieldsToValidate(fields, form) {
  const formFields = normalizeFormFields(form);
  if (formFields.length === 0) {
    return { fields: [], fieldToParent: /* @__PURE__ */ new Map() };
  }
  const fieldToParent = /* @__PURE__ */ new Map();
  const fieldIdsToValidate = [];
  formFields.forEach((formField) => {
    if (!!formField.children) {
      formField.children.forEach((child) => {
        const childId = typeof child === "string" ? child : child.id;
        fieldIdsToValidate.push(childId);
        fieldToParent.set(childId, formField.id);
      });
    } else {
      fieldIdsToValidate.push(formField.id);
    }
  });
  return {
    fields: normalizeFields(
      fields.filter(
        (field) => fieldIdsToValidate.includes(field.id)
      )
    ),
    fieldToParent
  };
}
function useFormValidity(item, fields, form) {
  const [formValidity, setFormValidity] = (0,external_wp_element_.useState)();
  const previousValidatedValuesRef = (0,external_wp_element_.useRef)({});
  const customValidationCounterRef = (0,external_wp_element_.useRef)({});
  const elementsValidationCounterRef = (0,external_wp_element_.useRef)(
    {}
  );
  const validate = (0,external_wp_element_.useCallback)(() => {
    const { fields: fieldsToValidate, fieldToParent } = getFieldsToValidate(
      fields,
      form
    );
    if (fieldsToValidate.length === 0) {
      setFormValidity(void 0);
      return;
    }
    fieldsToValidate.forEach((field) => {
      const value = field.getValue({ item });
      if (previousValidatedValuesRef.current.hasOwnProperty(field.id) && value === previousValidatedValuesRef.current[field.id]) {
        return;
      }
      previousValidatedValuesRef.current[field.id] = value;
      const parentFieldId = fieldToParent.get(field.id);
      if (field.isValid.required && isInvalidForRequired(field.type, value)) {
        updateFieldValidity(setFormValidity, parentFieldId, field.id, {
          required: { type: "invalid" }
        });
        return;
      }
      if (field.isValid.elements && field.hasElements && !field.getElements && Array.isArray(field.elements)) {
        const validValues = field.elements.map((el) => el.value);
        if (field.type !== "array" && !validValues.includes(value)) {
          updateFieldValidity(
            setFormValidity,
            parentFieldId,
            field.id,
            {
              elements: {
                type: "invalid",
                message: "Value must be one of the elements."
              }
            }
          );
          return;
        }
        if (field.type === "array" && !Array.isArray(value)) {
          updateFieldValidity(
            setFormValidity,
            parentFieldId,
            field.id,
            {
              elements: {
                type: "invalid",
                message: "Value must be an array."
              }
            }
          );
          return;
        }
        if (field.type === "array" && value.some((v) => !validValues.includes(v))) {
          updateFieldValidity(
            setFormValidity,
            parentFieldId,
            field.id,
            {
              elements: {
                type: "invalid",
                message: "Value must be one of the elements."
              }
            }
          );
          return;
        }
      }
      if (field.isValid.elements && field.hasElements && typeof field.getElements === "function") {
        const currentToken = (elementsValidationCounterRef.current[field.id] || 0) + 1;
        elementsValidationCounterRef.current[field.id] = currentToken;
        updateFieldValidity(setFormValidity, parentFieldId, field.id, {
          elements: {
            type: "validating",
            message: "Validating..."
          }
        });
        field.getElements().then((result) => {
          if (elementsValidationCounterRef.current[field.id] !== currentToken) {
            return;
          }
          if (!Array.isArray(result)) {
            updateFieldValidity(
              setFormValidity,
              parentFieldId,
              field.id,
              {
                elements: {
                  type: "invalid",
                  message: "Could not validate elements."
                }
              }
            );
            return;
          }
          const validValues = result.map((el) => el.value);
          if (field.type !== "array" && !validValues.includes(value)) {
            updateFieldValidity(
              setFormValidity,
              parentFieldId,
              field.id,
              {
                elements: {
                  type: "invalid",
                  message: "Value must be one of the elements."
                }
              }
            );
            return;
          }
          if (field.type === "array" && !Array.isArray(value)) {
            updateFieldValidity(
              setFormValidity,
              parentFieldId,
              field.id,
              {
                elements: {
                  type: "invalid",
                  message: "Value must be an array."
                }
              }
            );
            return;
          }
          if (field.type === "array" && value.some(
            (v) => !validValues.includes(v)
          )) {
            updateFieldValidity(
              setFormValidity,
              parentFieldId,
              field.id,
              {
                elements: {
                  type: "invalid",
                  message: "Value must be one of the elements."
                }
              }
            );
          }
        }).catch((error) => {
          if (elementsValidationCounterRef.current[field.id] !== currentToken) {
            return;
          }
          updateFieldValidity(
            setFormValidity,
            parentFieldId,
            field.id,
            {
              elements: {
                type: "invalid",
                message: error.message
              }
            }
          );
        });
      }
      let customError;
      try {
        customError = field.isValid?.custom?.(
          cjs_default()(
            item,
            field.setValue({
              item,
              value
            })
          ),
          field
        );
      } catch (error) {
        let errorMessage;
        if (error instanceof Error) {
          errorMessage = error.message;
        } else {
          errorMessage = String(error) || (0,external_wp_i18n_namespaceObject.__)("Unknown error when running custom validation.");
        }
        updateFieldValidity(setFormValidity, parentFieldId, field.id, {
          custom: {
            type: "invalid",
            message: errorMessage
          }
        });
      }
      if (typeof customError === "string") {
        updateFieldValidity(setFormValidity, parentFieldId, field.id, {
          custom: {
            type: "invalid",
            message: customError
          }
        });
        return;
      }
      if (customError instanceof Promise) {
        const currentToken = (customValidationCounterRef.current[field.id] || 0) + 1;
        customValidationCounterRef.current[field.id] = currentToken;
        updateFieldValidity(setFormValidity, parentFieldId, field.id, {
          custom: {
            type: "validating",
            message: "Validating..."
          }
        });
        customError.then((result) => {
          if (customValidationCounterRef.current[field.id] !== currentToken) {
            return;
          }
          if (result === null) {
            updateFieldValidity(
              setFormValidity,
              parentFieldId,
              field.id,
              {
                custom: {
                  type: "valid",
                  message: "Valid"
                }
              }
            );
            return;
          }
          if (typeof result === "string") {
            updateFieldValidity(
              setFormValidity,
              parentFieldId,
              field.id,
              {
                custom: {
                  type: "invalid",
                  message: result
                }
              }
            );
          }
        }).catch((error) => {
          if (customValidationCounterRef.current[field.id] !== currentToken) {
            return;
          }
          updateFieldValidity(
            setFormValidity,
            parentFieldId,
            field.id,
            {
              custom: {
                type: "invalid",
                message: error.message
              }
            }
          );
        });
        return;
      }
      setFormValidity((prev) => {
        if (!prev) {
          return prev;
        }
        if (parentFieldId) {
          const parentField = prev[parentFieldId];
          if (!parentField?.children) {
            return prev;
          }
          const { [field.id]: removed2, ...restChildren } = parentField.children;
          if (Object.keys(restChildren).length === 0) {
            const { children, ...restParent } = parentField;
            if (Object.keys(restParent).length === 0) {
              const {
                [parentFieldId]: removedParent,
                ...restFields
              } = prev;
              return Object.keys(restFields).length === 0 ? void 0 : restFields;
            }
            return {
              ...prev,
              [parentFieldId]: restParent
            };
          }
          return {
            ...prev,
            [parentFieldId]: {
              ...parentField,
              children: restChildren
            }
          };
        }
        if (!prev[field.id]) {
          return prev;
        }
        const { [field.id]: removed, ...rest } = prev;
        if (Object.keys(rest).length === 0) {
          return void 0;
        }
        return rest;
      });
    });
  }, [item, fields, form]);
  (0,external_wp_element_.useEffect)(() => {
    validate();
  }, [validate]);
  return {
    validity: formValidity,
    isValid: isFormValid(formValidity)
  };
}
var use_form_validity_default = useFormValidity;


;// ./node_modules/@wordpress/dataviews/build-module/dataform-layouts/panel/modal.js











function ModalContent({
  data,
  field,
  onChange,
  fieldLabel,
  onClose
}) {
  const { fields } = (0,external_wp_element_.useContext)(dataform_context_default);
  const [changes, setChanges] = (0,external_wp_element_.useState)({});
  const modalData = (0,external_wp_element_.useMemo)(() => {
    return cjs_default()(data, changes);
  }, [data, changes]);
  const form = (0,external_wp_element_.useMemo)(
    () => ({
      layout: DEFAULT_LAYOUT,
      fields: isCombinedField(field) ? field.children : (
        // If not explicit children return the field id itself.
        [{ id: field.id }]
      )
    }),
    [field]
  );
  const { validity } = use_form_validity_default(
    modalData,
    fields,
    form
  );
  const onApply = () => {
    onChange(changes);
    onClose();
  };
  const handleOnChange = (newValue) => {
    setChanges((prev) => cjs_default()(prev, newValue));
  };
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
    external_wp_components_namespaceObject.Modal,
    {
      className: "dataforms-layouts-panel__modal",
      onRequestClose: onClose,
      isFullScreen: false,
      title: fieldLabel,
      size: "medium",
      children: [
        /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
          DataFormLayout,
          {
            data: modalData,
            form,
            onChange: handleOnChange,
            validity,
            children: (FieldLayout, childField, childFieldValidity) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
              FieldLayout,
              {
                data: modalData,
                field: childField,
                onChange: handleOnChange,
                hideLabelFromVision: (form?.fields ?? []).length < 2,
                validity: childFieldValidity
              },
              childField.id
            )
          }
        ),
        /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
          external_wp_components_namespaceObject.__experimentalHStack,
          {
            className: "dataforms-layouts-panel__modal-footer",
            spacing: 3,
            children: [
              /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, {}),
              /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
                external_wp_components_namespaceObject.Button,
                {
                  variant: "tertiary",
                  onClick: onClose,
                  __next40pxDefaultSize: true,
                  children: (0,external_wp_i18n_namespaceObject.__)("Cancel")
                }
              ),
              /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
                external_wp_components_namespaceObject.Button,
                {
                  variant: "primary",
                  onClick: onApply,
                  __next40pxDefaultSize: true,
                  children: (0,external_wp_i18n_namespaceObject.__)("Apply")
                }
              )
            ]
          }
        )
      ]
    }
  );
}
function PanelModal({
  data,
  field,
  onChange,
  labelPosition,
  summaryFields,
  fieldDefinition
}) {
  const [isOpen, setIsOpen] = (0,external_wp_element_.useState)(false);
  const fieldLabel = isCombinedField(field) ? field.label : fieldDefinition?.label;
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
    /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
      summary_button_default,
      {
        summaryFields,
        data,
        labelPosition,
        fieldLabel,
        disabled: fieldDefinition.readOnly === true,
        onClick: () => setIsOpen(true),
        "aria-expanded": isOpen
      }
    ),
    isOpen && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
      ModalContent,
      {
        data,
        field,
        onChange,
        fieldLabel: fieldLabel ?? "",
        onClose: () => setIsOpen(false)
      }
    )
  ] });
}
var modal_default = PanelModal;


;// ./node_modules/@wordpress/dataviews/build-module/dataform-layouts/get-summary-fields.js
function extractSummaryIds(summary) {
  if (Array.isArray(summary)) {
    return summary.map(
      (item) => typeof item === "string" ? item : item.id
    );
  }
  return [];
}
const getSummaryFields = (summaryField, fields) => {
  if (Array.isArray(summaryField) && summaryField.length > 0) {
    const summaryIds = extractSummaryIds(summaryField);
    return summaryIds.map(
      (summaryId) => fields.find((_field) => _field.id === summaryId)
    ).filter((_field) => _field !== void 0);
  }
  return [];
};


;// ./node_modules/@wordpress/dataviews/build-module/dataform-layouts/panel/index.js










const getFieldDefinition = (field, fields) => {
  const fieldDefinition = fields.find((_field) => _field.id === field.id);
  if (!fieldDefinition) {
    return fields.find((_field) => {
      if (isCombinedField(field)) {
        const simpleChildren = field.children.filter(
          (child) => typeof child === "string" || !isCombinedField(child)
        );
        if (simpleChildren.length === 0) {
          return false;
        }
        const firstChildFieldId = typeof simpleChildren[0] === "string" ? simpleChildren[0] : simpleChildren[0].id;
        return _field.id === firstChildFieldId;
      }
      return _field.id === field.id;
    });
  }
  return fieldDefinition;
};
const getFieldDefinitionAndSummaryFields = (layout, field, fields) => {
  const summaryFields = getSummaryFields(layout.summary, fields);
  const fieldDefinition = getFieldDefinition(field, fields);
  if (summaryFields.length === 0) {
    return {
      summaryFields: fieldDefinition ? [fieldDefinition] : [],
      fieldDefinition
    };
  }
  return {
    summaryFields,
    fieldDefinition
  };
};
function FormPanelField({
  data,
  field,
  onChange,
  validity
}) {
  const { fields } = (0,external_wp_element_.useContext)(dataform_context_default);
  const layout = normalizeLayout({
    ...field.layout,
    type: "panel"
  });
  const [popoverAnchor, setPopoverAnchor] = (0,external_wp_element_.useState)(
    null
  );
  const { fieldDefinition, summaryFields } = getFieldDefinitionAndSummaryFields(layout, field, fields);
  if (!fieldDefinition) {
    return null;
  }
  const labelPosition = layout.labelPosition;
  const labelClassName = dist_clsx(
    "dataforms-layouts-panel__field-label",
    `dataforms-layouts-panel__field-label--label-position-${labelPosition}`
  );
  const fieldLabel = isCombinedField(field) ? field.label : fieldDefinition?.label;
  const renderedControl = layout.openAs === "modal" ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    modal_default,
    {
      data,
      field,
      onChange,
      labelPosition,
      summaryFields,
      fieldDefinition
    }
  ) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    dropdown_default,
    {
      data,
      field,
      onChange,
      validity,
      labelPosition,
      summaryFields,
      fieldDefinition,
      popoverAnchor
    }
  );
  if (labelPosition === "top") {
    return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { className: "dataforms-layouts-panel__field", spacing: 0, children: [
      /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
        "div",
        {
          className: labelClassName,
          style: { paddingBottom: 0 },
          children: fieldLabel
        }
      ),
      /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "dataforms-layouts-panel__field-control", children: renderedControl })
    ] });
  }
  if (labelPosition === "none") {
    return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "dataforms-layouts-panel__field", children: renderedControl });
  }
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
    external_wp_components_namespaceObject.__experimentalHStack,
    {
      ref: setPopoverAnchor,
      className: "dataforms-layouts-panel__field",
      children: [
        /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: labelClassName, children: fieldLabel }),
        /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "dataforms-layouts-panel__field-control", children: renderedControl })
      ]
    }
  );
}


;// ./node_modules/@wordpress/dataviews/build-module/dataform-layouts/card/index.js










function useCollapsibleCard(initialIsOpen = true) {
  const [isOpen, setIsOpen] = (0,external_wp_element_.useState)(initialIsOpen);
  const toggle = (0,external_wp_element_.useCallback)(() => {
    setIsOpen((prev) => !prev);
  }, []);
  const CollapsibleCardHeader = (0,external_wp_element_.useCallback)(
    ({
      children,
      ...props
    }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
      external_wp_components_namespaceObject.CardHeader,
      {
        ...props,
        onClick: toggle,
        style: {
          cursor: "pointer",
          ...props.style
        },
        children: [
          /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
            "div",
            {
              style: {
                width: "100%",
                display: "flex",
                justifyContent: "space-between",
                alignItems: "center"
              },
              children
            }
          ),
          /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
            external_wp_components_namespaceObject.Button,
            {
              __next40pxDefaultSize: true,
              variant: "tertiary",
              icon: isOpen ? chevron_up_default : chevron_down_default,
              "aria-expanded": isOpen,
              "aria-label": isOpen ? "Collapse" : "Expand"
            }
          )
        ]
      }
    ),
    [toggle, isOpen]
  );
  return { isOpen, CollapsibleCardHeader };
}
function isSummaryFieldVisible(summaryField, summaryConfig, isOpen) {
  if (!summaryConfig || Array.isArray(summaryConfig) && summaryConfig.length === 0) {
    return false;
  }
  const summaryConfigArray = Array.isArray(summaryConfig) ? summaryConfig : [summaryConfig];
  const fieldConfig = summaryConfigArray.find((config) => {
    if (typeof config === "string") {
      return config === summaryField.id;
    }
    if (typeof config === "object" && "id" in config) {
      return config.id === summaryField.id;
    }
    return false;
  });
  if (!fieldConfig) {
    return false;
  }
  if (typeof fieldConfig === "string") {
    return true;
  }
  if (typeof fieldConfig === "object" && "visibility" in fieldConfig) {
    return fieldConfig.visibility === "always" || fieldConfig.visibility === "when-collapsed" && !isOpen;
  }
  return true;
}
function FormCardField({
  data,
  field,
  onChange,
  hideLabelFromVision,
  validity
}) {
  const { fields } = (0,external_wp_element_.useContext)(dataform_context_default);
  const layout = normalizeLayout({
    ...field.layout,
    type: "card"
  });
  const form = (0,external_wp_element_.useMemo)(
    () => ({
      layout: DEFAULT_LAYOUT,
      fields: isCombinedField(field) ? field.children : []
    }),
    [field]
  );
  const { isOpen, CollapsibleCardHeader } = useCollapsibleCard(
    layout.isOpened
  );
  const summaryFields = getSummaryFields(layout.summary, fields);
  const visibleSummaryFields = summaryFields.filter(
    (summaryField) => isSummaryFieldVisible(summaryField, layout.summary, isOpen)
  );
  if (isCombinedField(field)) {
    const withHeader2 = !!field.label && layout.withHeader;
    return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Card, { className: "dataforms-layouts-card__field", children: [
      withHeader2 && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(CollapsibleCardHeader, { className: "dataforms-layouts-card__field-header", children: [
        /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "dataforms-layouts-card__field-header-label", children: field.label }),
        visibleSummaryFields.length > 0 && layout.withHeader && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "dataforms-layouts-card__field-summary", children: visibleSummaryFields.map(
          (summaryField) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
            summaryField.render,
            {
              item: data,
              field: summaryField
            },
            summaryField.id
          )
        ) })
      ] }),
      (isOpen || !withHeader2) && // If it doesn't have a header, keep it open.
      // Otherwise, the card will not be visible.
      /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.CardBody, { className: "dataforms-layouts-card__field-control", children: [
        field.description && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "dataforms-layouts-card__field-description", children: field.description }),
        /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
          DataFormLayout,
          {
            data,
            form,
            onChange,
            validity: validity?.children
          }
        )
      ] })
    ] });
  }
  const fieldDefinition = fields.find(
    (fieldDef) => fieldDef.id === field.id
  );
  if (!fieldDefinition || !fieldDefinition.Edit) {
    return null;
  }
  const RegularLayout = getFormFieldLayout("regular")?.component;
  if (!RegularLayout) {
    return null;
  }
  const withHeader = !!fieldDefinition.label && layout.withHeader;
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Card, { className: "dataforms-layouts-card__field", children: [
    withHeader && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(CollapsibleCardHeader, { className: "dataforms-layouts-card__field-header", children: [
      /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "dataforms-layouts-card__field-header-label", children: fieldDefinition.label }),
      visibleSummaryFields.length > 0 && layout.withHeader && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "dataforms-layouts-card__field-summary", children: visibleSummaryFields.map((summaryField) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
        summaryField.render,
        {
          item: data,
          field: summaryField
        },
        summaryField.id
      )) })
    ] }),
    (isOpen || !withHeader) && // If it doesn't have a header, keep it open.
    // Otherwise, the card will not be visible.
    /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.CardBody, { className: "dataforms-layouts-card__field-control", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
      RegularLayout,
      {
        data,
        field,
        onChange,
        hideLabelFromVision: hideLabelFromVision || withHeader,
        validity
      }
    ) })
  ] });
}


;// ./node_modules/@wordpress/dataviews/build-module/dataform-layouts/row/index.js








function row_Header({ title }) {
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, { className: "dataforms-layouts-row__header", spacing: 4, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { alignment: "center", children: [
    /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHeading, { level: 2, size: 13, children: title }),
    /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, {})
  ] }) });
}
const EMPTY_WRAPPER = ({ children }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children });
function FormRowField({
  data,
  field,
  onChange,
  hideLabelFromVision,
  validity
}) {
  const { fields } = (0,external_wp_element_.useContext)(dataform_context_default);
  const layout = normalizeLayout({
    ...field.layout,
    type: "row"
  });
  if (isCombinedField(field)) {
    const form = {
      fields: field.children.map((child) => {
        if (typeof child === "string") {
          return { id: child };
        }
        return child;
      })
    };
    return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "dataforms-layouts-row__field", children: [
      !hideLabelFromVision && field.label && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(row_Header, { title: field.label }),
      /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHStack, { alignment: layout.alignment, spacing: 4, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
        DataFormLayout,
        {
          data,
          form,
          onChange,
          validity: validity?.children,
          as: EMPTY_WRAPPER,
          children: (FieldLayout, childField, childFieldValidity) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
            "div",
            {
              className: "dataforms-layouts-row__field-control",
              style: layout.styles[childField.id],
              children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
                FieldLayout,
                {
                  data,
                  field: childField,
                  onChange,
                  hideLabelFromVision,
                  validity: childFieldValidity
                }
              )
            },
            childField.id
          )
        }
      ) })
    ] });
  }
  const fieldDefinition = fields.find((f) => f.id === field.id);
  if (!fieldDefinition || !fieldDefinition.Edit) {
    return null;
  }
  const RegularLayout = getFormFieldLayout("regular")?.component;
  if (!RegularLayout) {
    return null;
  }
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "dataforms-layouts-row__field-control", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    RegularLayout,
    {
      data,
      field: fieldDefinition,
      onChange,
      validity
    }
  ) }) });
}


;// ./node_modules/@wordpress/dataviews/build-module/dataform-layouts/index.js






const FORM_FIELD_LAYOUTS = [
  {
    type: "regular",
    component: FormRegularField,
    wrapper: ({ children }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, { className: "dataforms-layouts__wrapper", spacing: 4, children })
  },
  {
    type: "panel",
    component: FormPanelField,
    wrapper: ({ children }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, { className: "dataforms-layouts__wrapper", spacing: 2, children })
  },
  {
    type: "card",
    component: FormCardField,
    wrapper: ({ children }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, { className: "dataforms-layouts__wrapper", spacing: 6, children })
  },
  {
    type: "row",
    component: FormRowField,
    wrapper: ({
      children,
      layout
    }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, { className: "dataforms-layouts__wrapper", spacing: 4, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "dataforms-layouts-row__field", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
      external_wp_components_namespaceObject.__experimentalHStack,
      {
        spacing: 4,
        alignment: layout.alignment,
        children
      }
    ) }) })
  }
];
function getFormFieldLayout(type) {
  return FORM_FIELD_LAYOUTS.find((layout) => layout.type === type);
}


;// ./node_modules/@wordpress/dataviews/build-module/dataform-layouts/data-form-layout.js







const DEFAULT_WRAPPER = ({ children }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, { className: "dataforms-layouts__wrapper", spacing: 4, children });
function DataFormLayout({
  data,
  form,
  onChange,
  validity,
  children,
  as
}) {
  const { fields: fieldDefinitions } = (0,external_wp_element_.useContext)(dataform_context_default);
  function getFieldDefinition(field) {
    const fieldId = typeof field === "string" ? field : field.id;
    return fieldDefinitions.find(
      (fieldDefinition) => fieldDefinition.id === fieldId
    );
  }
  const normalizedFormFields = (0,external_wp_element_.useMemo)(
    () => normalizeFormFields(form),
    [form]
  );
  const normalizedFormLayout = normalizeLayout(form.layout);
  const Wrapper = as ?? getFormFieldLayout(normalizedFormLayout.type)?.wrapper ?? DEFAULT_WRAPPER;
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Wrapper, { layout: normalizedFormLayout, children: normalizedFormFields.map((formField) => {
    const FieldLayout = getFormFieldLayout(formField.layout.type)?.component;
    if (!FieldLayout) {
      return null;
    }
    const fieldDefinition = !isCombinedField(formField) ? getFieldDefinition(formField) : void 0;
    if (fieldDefinition && fieldDefinition.isVisible && !fieldDefinition.isVisible(data)) {
      return null;
    }
    if (children) {
      return children(
        FieldLayout,
        formField,
        validity?.[formField.id]
      );
    }
    return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
      FieldLayout,
      {
        data,
        field: formField,
        onChange,
        validity: validity?.[formField.id]
      },
      formField.id
    );
  }) });
}


;// ./node_modules/@wordpress/dataviews/build-module/components/dataform/index.js





function DataForm({
  data,
  form,
  fields,
  onChange,
  validity
}) {
  const normalizedFields = (0,external_wp_element_.useMemo)(
    () => normalizeFields(fields),
    [fields]
  );
  if (!form.fields) {
    return null;
  }
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(DataFormProvider, { fields: normalizedFields, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    DataFormLayout,
    {
      data,
      form,
      onChange,
      validity
    }
  ) });
}


;// ./node_modules/@wordpress/edit-site/build-module/components/post-edit/index.js













const { usePostFields: post_edit_usePostFields, PostCardPanel } = unlock(external_wp_editor_namespaceObject.privateApis);
const fieldsWithBulkEditSupport = [
  "title",
  "status",
  "date",
  "author",
  "discussion"
];
function PostEditForm({ postType, postId }) {
  const ids = (0,external_wp_element_.useMemo)(() => postId.split(","), [postId]);
  const { record, hasFinishedResolution } = (0,external_wp_data_.useSelect)(
    (select) => {
      const args = ["postType", postType, ids[0]];
      const {
        getEditedEntityRecord,
        hasFinishedResolution: hasFinished
      } = select(external_wp_coreData_namespaceObject.store);
      return {
        record: ids.length === 1 ? getEditedEntityRecord(...args) : null,
        hasFinishedResolution: hasFinished(
          "getEditedEntityRecord",
          args
        )
      };
    },
    [postType, ids]
  );
  const [multiEdits, setMultiEdits] = (0,external_wp_element_.useState)({});
  const { editEntityRecord } = (0,external_wp_data_.useDispatch)(external_wp_coreData_namespaceObject.store);
  const _fields = post_edit_usePostFields({ postType });
  const fields = (0,external_wp_element_.useMemo)(
    () => _fields?.map((field) => {
      if (field.id === "status") {
        return {
          ...field,
          elements: field.elements.filter(
            (element) => element.value !== "trash"
          )
        };
      }
      return field;
    }),
    [_fields]
  );
  const form = (0,external_wp_element_.useMemo)(
    () => ({
      layout: {
        type: "panel"
      },
      fields: [
        {
          id: "featured_media",
          layout: {
            type: "regular"
          }
        },
        {
          id: "status",
          label: (0,external_wp_i18n_namespaceObject.__)("Status & Visibility"),
          children: ["status", "password"]
        },
        "author",
        "date",
        "slug",
        "parent",
        {
          id: "discussion",
          label: (0,external_wp_i18n_namespaceObject.__)("Discussion"),
          children: ["comment_status", "ping_status"]
        },
        {
          label: (0,external_wp_i18n_namespaceObject.__)("Template"),
          id: "template",
          layout: {
            type: "regular",
            labelPosition: "side"
          }
        }
      ].filter(
        (field) => ids.length === 1 || fieldsWithBulkEditSupport.includes(
          typeof field === "string" ? field : field.id
        )
      )
    }),
    [ids]
  );
  const onChange = (edits) => {
    for (const id of ids) {
      if (edits.status && edits.status !== "future" && record?.status === "future" && new Date(record.date) > /* @__PURE__ */ new Date()) {
        edits.date = null;
      }
      if (edits.status && edits.status === "private" && record.password) {
        edits.password = "";
      }
      editEntityRecord("postType", postType, id, edits);
      if (ids.length > 1) {
        setMultiEdits((prev) => ({
          ...prev,
          ...edits
        }));
      }
    }
  };
  (0,external_wp_element_.useEffect)(() => {
    setMultiEdits({});
  }, [ids]);
  const { ExperimentalBlockEditorProvider } = unlock(
    external_wp_blockEditor_namespaceObject.privateApis
  );
  const settings = usePatternSettings();
  const fieldsWithDependency = (0,external_wp_element_.useMemo)(() => {
    return fields.map((field) => {
      if (field.id === "template") {
        return {
          ...field,
          Edit: (data) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ExperimentalBlockEditorProvider, { settings, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(field.Edit, { ...data }) })
        };
      }
      return field;
    });
  }, [fields, settings]);
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 4, children: [
    /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PostCardPanel, { postType, postId: ids }),
    hasFinishedResolution && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
      DataForm,
      {
        data: ids.length === 1 ? record : multiEdits,
        fields: fieldsWithDependency,
        form,
        onChange
      }
    )
  ] });
}
function PostEdit({ postType, postId }) {
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(
    page_page_default,
    {
      className: dist_clsx("edit-site-post-edit", {
        "is-empty": !postId
      }),
      label: (0,external_wp_i18n_namespaceObject.__)("Post Edit"),
      children: [
        postId && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PostEditForm, { postType, postId }),
        !postId && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { children: (0,external_wp_i18n_namespaceObject.__)("Select a page to edit") })
      ]
    }
  );
}


;// ./node_modules/@wordpress/edit-site/build-module/components/site-editor-routes/pages.js














const { useLocation: pages_useLocation } = unlock(external_wp_router_namespaceObject.privateApis);
async function isListView(query) {
  const { activeView = "all" } = query;
  const postTypeObject = await (0,external_wp_data_.resolveSelect)(external_wp_coreData_namespaceObject.store).getPostType("page");
  const view = await (0,build_module.loadView)({
    kind: "postType",
    name: "page",
    slug: activeView,
    defaultView: view_utils_getDefaultView(postTypeObject, activeView)
  });
  return view.type === "list";
}
function MobilePagesView() {
  const { query = {} } = pages_useLocation();
  const { canvas = "view" } = query;
  return canvas === "edit" ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {}) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PostList, { postType: "page" });
}
const pagesRoute = {
  name: "pages",
  path: "/page",
  areas: {
    sidebar({ siteData }) {
      const isBlockTheme = siteData.currentTheme?.is_block_theme;
      return isBlockTheme ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
        SidebarNavigationScreen,
        {
          title: (0,external_wp_i18n_namespaceObject.__)("Pages"),
          backPath: "/",
          content: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(DataViewsSidebarContent, { postType: "page" })
        }
      ) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenUnsupported, {});
    },
    content({ siteData }) {
      const isBlockTheme = siteData.currentTheme?.is_block_theme;
      return isBlockTheme ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PostList, { postType: "page" }) : void 0;
    },
    async preview({ query, siteData }) {
      const isBlockTheme = siteData.currentTheme?.is_block_theme;
      if (!isBlockTheme) {
        return void 0;
      }
      const isList = await isListView(query);
      return isList ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {}) : void 0;
    },
    mobile({ siteData }) {
      const isBlockTheme = siteData.currentTheme?.is_block_theme;
      return isBlockTheme ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(MobilePagesView, {}) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenUnsupported, {});
    },
    async edit({ query }) {
      const isList = await isListView(query);
      const hasQuickEdit = !isList && !!query.quickEdit;
      return hasQuickEdit ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PostEdit, { postType: "page", postId: query.postId }) : void 0;
    }
  },
  widths: {
    async content({ query }) {
      const isList = await isListView(query);
      return isList ? 380 : void 0;
    },
    async edit({ query }) {
      const isList = await isListView(query);
      const hasQuickEdit = !isList && !!query.quickEdit;
      return hasQuickEdit ? 380 : void 0;
    }
  }
};


;// ./node_modules/@wordpress/edit-site/build-module/components/site-editor-routes/page-item.js






const pageItemRoute = {
  name: "page-item",
  path: "/page/:postId",
  areas: {
    sidebar({ siteData }) {
      const isBlockTheme = siteData.currentTheme?.is_block_theme;
      return isBlockTheme ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
        SidebarNavigationScreen,
        {
          title: (0,external_wp_i18n_namespaceObject.__)("Pages"),
          backPath: "/",
          content: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(DataViewsSidebarContent, { postType: "page" })
        }
      ) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenUnsupported, {});
    },
    mobile({ siteData }) {
      const isBlockTheme = siteData.currentTheme?.is_block_theme;
      return isBlockTheme ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {}) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenUnsupported, {});
    },
    preview({ siteData }) {
      const isBlockTheme = siteData.currentTheme?.is_block_theme;
      return isBlockTheme ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {}) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenUnsupported, {});
    }
  }
};


;// ./node_modules/@wordpress/edit-site/build-module/components/site-editor-routes/stylebook.js






const stylebookRoute = {
  name: "stylebook",
  path: "/stylebook",
  areas: {
    sidebar({ siteData }) {
      return isClassicThemeWithStyleBookSupport(siteData) ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
        SidebarNavigationScreen,
        {
          title: (0,external_wp_i18n_namespaceObject.__)("Styles"),
          backPath: "/",
          description: (0,external_wp_i18n_namespaceObject.__)(
            `Preview your website's visual identity: colors, typography, and blocks.`
          )
        }
      ) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenUnsupported, {});
    },
    preview({ siteData }) {
      return isClassicThemeWithStyleBookSupport(siteData) ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(StyleBookPreview, { isStatic: true }) : void 0;
    },
    mobile({ siteData }) {
      return isClassicThemeWithStyleBookSupport(siteData) ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(StyleBookPreview, { isStatic: true }) : void 0;
    }
  }
};


;// ./node_modules/@wordpress/edit-site/build-module/components/site-editor-routes/notfound.js




function NotFoundError() {
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Notice, { status: "error", isDismissible: false, children: (0,external_wp_i18n_namespaceObject.__)(
    "The requested page could not be found. Please check the URL."
  ) });
}
const notFoundRoute = {
  name: "notfound",
  path: "*",
  areas: {
    sidebar: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SidebarNavigationScreenMain, {}),
    mobile: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
      SidebarNavigationScreenMain,
      {
        customDescription: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(NotFoundError, {})
      }
    ),
    content: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { padding: 2, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(NotFoundError, {}) })
  }
};


;// ./node_modules/@wordpress/edit-site/build-module/components/site-editor-routes/index.js

















const site_editor_routes_routes = [
  pageItemRoute,
  pagesRoute,
  templateItemRoute,
  templatesRoute,
  templatePartItemRoute,
  patternItemRoute,
  patternsRoute,
  navigationItemRoute,
  navigationRoute,
  stylesRoute,
  homeRoute,
  stylebookRoute,
  notFoundRoute
];
function useRegisterSiteEditorRoutes() {
  const registry = (0,external_wp_data_.useRegistry)();
  const { registerRoute } = unlock((0,external_wp_data_.useDispatch)(store));
  (0,external_wp_element_.useEffect)(() => {
    registry.batch(() => {
      site_editor_routes_routes.forEach(registerRoute);
    });
  }, [registry, registerRoute]);
}


;// ./node_modules/@wordpress/edit-site/build-module/components/app/index.js












const { RouterProvider } = unlock(external_wp_router_namespaceObject.privateApis);
function AppLayout() {
  useCommonCommands();
  useSetCommandContext();
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(LayoutWithGlobalStylesProvider, {});
}
function App() {
  useRegisterSiteEditorRoutes();
  const { routes, currentTheme, editorSettings } = (0,external_wp_data_.useSelect)((select) => {
    return {
      routes: unlock(select(store)).getRoutes(),
      currentTheme: select(external_wp_coreData_namespaceObject.store).getCurrentTheme(),
      // This is a temp solution until the has_theme_json value is available for the current theme.
      editorSettings: select(store).getSettings()
    };
  }, []);
  const beforeNavigate = (0,external_wp_element_.useCallback)(({ path, query }) => {
    if (!isPreviewingTheme()) {
      return { path, query };
    }
    return {
      path,
      query: {
        ...query,
        wp_theme_preview: "wp_theme_preview" in query ? query.wp_theme_preview : currentlyPreviewingTheme()
      }
    };
  }, []);
  const matchResolverArgsValue = (0,external_wp_element_.useMemo)(
    () => ({
      siteData: { currentTheme, editorSettings }
    }),
    [currentTheme, editorSettings]
  );
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
    RouterProvider,
    {
      routes,
      pathArg: "p",
      beforeNavigate,
      matchResolverArgs: matchResolverArgsValue,
      children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(AppLayout, {})
    }
  );
}


;// ./node_modules/@wordpress/edit-site/build-module/deprecated.js




const isSiteEditor = (0,external_wp_url_namespaceObject.getPath)(window.location.href)?.includes(
  "site-editor.php"
);
const deprecateSlot = (name) => {
  external_wp_deprecated_default()(`wp.editPost.${name}`, {
    since: "6.6",
    alternative: `wp.editor.${name}`
  });
};
function PluginMoreMenuItem(props) {
  if (!isSiteEditor) {
    return null;
  }
  deprecateSlot("PluginMoreMenuItem");
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_editor_namespaceObject.PluginMoreMenuItem, { ...props });
}
function PluginSidebar(props) {
  if (!isSiteEditor) {
    return null;
  }
  deprecateSlot("PluginSidebar");
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_editor_namespaceObject.PluginSidebar, { ...props });
}
function PluginSidebarMoreMenuItem(props) {
  if (!isSiteEditor) {
    return null;
  }
  deprecateSlot("PluginSidebarMoreMenuItem");
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_editor_namespaceObject.PluginSidebarMoreMenuItem, { ...props });
}


;// ./node_modules/@wordpress/edit-site/build-module/components/posts-app-routes/posts.js













const { useLocation: posts_useLocation } = unlock(external_wp_router_namespaceObject.privateApis);
async function posts_isListView(query) {
  const { activeView = "all" } = query;
  const postTypeObject = await (0,external_wp_data_.resolveSelect)(external_wp_coreData_namespaceObject.store).getPostType("post");
  const view = await (0,build_module.loadView)({
    kind: "postType",
    name: "post",
    slug: activeView,
    defaultView: view_utils_getDefaultView(postTypeObject, activeView)
  });
  return view.type === "list";
}
function MobilePostsView() {
  const { query = {} } = posts_useLocation();
  const { canvas = "view" } = query;
  return canvas === "edit" ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, {}) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PostList, { postType: "post" });
}
const postsRoute = {
  name: "posts",
  path: "/",
  areas: {
    sidebar: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
      SidebarNavigationScreen,
      {
        title: (0,external_wp_i18n_namespaceObject.__)("Posts"),
        isRoot: true,
        content: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(DataViewsSidebarContent, { postType: "post" })
      }
    ),
    content: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PostList, { postType: "post" }),
    async preview({ query }) {
      const isList = await posts_isListView(query);
      return isList ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, { isPostsList: true }) : void 0;
    },
    mobile: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(MobilePostsView, {}),
    async edit({ query }) {
      const isList = await posts_isListView(query);
      const hasQuickEdit = !isList && !!query.quickEdit;
      return hasQuickEdit ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PostEdit, { postType: "post", postId: query.postId }) : void 0;
    }
  },
  widths: {
    async content({ query }) {
      const isList = await posts_isListView(query);
      return isList ? 380 : void 0;
    },
    async edit({ query }) {
      const isList = await posts_isListView(query);
      const hasQuickEdit = !isList && !!query.quickEdit;
      return hasQuickEdit ? 380 : void 0;
    }
  }
};


;// ./node_modules/@wordpress/edit-site/build-module/components/posts-app-routes/post-item.js





const postItemRoute = {
  name: "post-item",
  path: "/post/:postId",
  areas: {
    sidebar: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
      SidebarNavigationScreen,
      {
        title: (0,external_wp_i18n_namespaceObject.__)("Posts"),
        isRoot: true,
        content: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(DataViewsSidebarContent, { postType: "post" })
      }
    ),
    mobile: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, { isPostsList: true }),
    preview: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(EditSiteEditor, { isPostsList: true })
  }
};


;// ./node_modules/@wordpress/edit-site/build-module/components/posts-app-routes/index.js






const posts_app_routes_routes = [postItemRoute, postsRoute];
function useRegisterPostsAppRoutes() {
  const registry = (0,external_wp_data_.useRegistry)();
  const { registerRoute } = unlock((0,external_wp_data_.useDispatch)(store));
  (0,external_wp_element_.useEffect)(() => {
    registry.batch(() => {
      posts_app_routes_routes.forEach(registerRoute);
    });
  }, [registry, registerRoute]);
}


;// ./node_modules/@wordpress/edit-site/build-module/components/posts-app/index.js







const { RouterProvider: posts_app_RouterProvider } = unlock(external_wp_router_namespaceObject.privateApis);
function PostsApp() {
  useRegisterPostsAppRoutes();
  const routes = (0,external_wp_data_.useSelect)((select) => {
    return unlock(select(store)).getRoutes();
  }, []);
  return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(posts_app_RouterProvider, { routes, pathArg: "p", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(LayoutWithGlobalStylesProvider, {}) });
}


;// ./node_modules/@wordpress/edit-site/build-module/posts.js










function initializePostsDashboard(id, settings) {
  if (true) {
    return;
  }
  const target = document.getElementById(id);
  const root = (0,external_wp_element_.createRoot)(target);
  (0,external_wp_data_.dispatch)(external_wp_blocks_namespaceObject.store).reapplyBlockTypeFilters();
  const coreBlocks = (0,external_wp_blockLibrary_namespaceObject.__experimentalGetCoreBlocks)().filter(
    ({ name }) => name !== "core/freeform"
  );
  (0,external_wp_blockLibrary_namespaceObject.registerCoreBlocks)(coreBlocks);
  (0,external_wp_data_.dispatch)(external_wp_blocks_namespaceObject.store).setFreeformFallbackBlockName("core/html");
  (0,external_wp_widgets_namespaceObject.registerLegacyWidgetBlock)({ inserter: false });
  (0,external_wp_widgets_namespaceObject.registerWidgetGroupBlock)({ inserter: false });
  if (false) {}
  (0,external_wp_data_.dispatch)(external_wp_preferences_.store).setDefaults("core/edit-site", {
    welcomeGuide: true,
    welcomeGuideStyles: true,
    welcomeGuidePage: true,
    welcomeGuideTemplate: true
  });
  (0,external_wp_data_.dispatch)(external_wp_preferences_.store).setDefaults("core", {
    allowRightClickOverrides: true,
    distractionFree: false,
    editorMode: "visual",
    editorTool: "edit",
    fixedToolbar: false,
    focusMode: false,
    inactivePanels: [],
    keepCaretInsideBlock: false,
    openPanels: ["post-status"],
    showBlockBreadcrumbs: true,
    showListViewByDefault: false,
    enableChoosePatternModal: true
  });
  (0,external_wp_data_.dispatch)(store).updateSettings(settings);
  window.addEventListener("dragover", (e) => e.preventDefault(), false);
  window.addEventListener("drop", (e) => e.preventDefault(), false);
  root.render(
    /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_element_.StrictMode, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PostsApp, {}) })
  );
  return root;
}


;// ./node_modules/@wordpress/edit-site/build-module/index.js













const { registerCoreBlockBindingsSources } = unlock(external_wp_editor_namespaceObject.privateApis);
function initializeEditor(id, settings) {
  const target = document.getElementById(id);
  const root = (0,external_wp_element_.createRoot)(target);
  (0,external_wp_data_.dispatch)(external_wp_blocks_namespaceObject.store).reapplyBlockTypeFilters();
  const coreBlocks = (0,external_wp_blockLibrary_namespaceObject.__experimentalGetCoreBlocks)().filter(
    ({ name }) => name !== "core/freeform"
  );
  (0,external_wp_blockLibrary_namespaceObject.registerCoreBlocks)(coreBlocks);
  registerCoreBlockBindingsSources();
  (0,external_wp_data_.dispatch)(external_wp_blocks_namespaceObject.store).setFreeformFallbackBlockName("core/html");
  (0,external_wp_widgets_namespaceObject.registerLegacyWidgetBlock)({ inserter: false });
  (0,external_wp_widgets_namespaceObject.registerWidgetGroupBlock)({ inserter: false });
  if (false) {}
  (0,external_wp_data_.dispatch)(external_wp_preferences_.store).setDefaults("core/edit-site", {
    welcomeGuide: true,
    welcomeGuideStyles: true,
    welcomeGuidePage: true,
    welcomeGuideTemplate: true
  });
  (0,external_wp_data_.dispatch)(external_wp_preferences_.store).setDefaults("core", {
    allowRightClickOverrides: true,
    distractionFree: false,
    editorMode: "visual",
    editorTool: "edit",
    fixedToolbar: false,
    focusMode: false,
    inactivePanels: [],
    keepCaretInsideBlock: false,
    openPanels: ["post-status"],
    showBlockBreadcrumbs: true,
    showListViewByDefault: false,
    enableChoosePatternModal: true
  });
  if (window.__experimentalMediaProcessing) {
    (0,external_wp_data_.dispatch)(external_wp_preferences_.store).setDefaults("core/media", {
      requireApproval: true,
      optimizeOnUpload: true
    });
  }
  (0,external_wp_data_.dispatch)(store).updateSettings(settings);
  window.addEventListener("dragover", (e) => e.preventDefault(), false);
  window.addEventListener("drop", (e) => e.preventDefault(), false);
  root.render(
    /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_element_.StrictMode, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(App, {}) })
  );
  return root;
}
function reinitializeEditor() {
  external_wp_deprecated_default()("wp.editSite.reinitializeEditor", {
    since: "6.2",
    version: "6.3"
  });
}






})();

(window.wp = window.wp || {}).editSite = __webpack_exports__;
/******/ })()
;