WordPress/wp-includes/js/dist/edit-post.js
youknowriad be0d5b2534 Block Editor: Update the packages with a number of fixes targeted for Beta 4.
It includes fixes from these two backport PRs: 

 - https://github.com/WordPress/gutenberg/pull/32992
 - https://github.com/WordPress/gutenberg/pull/32956

Props gziolo, ryelle, ntsekouras, desrosj, jorgefilipecosta.
See #53397

Built from https://develop.svn.wordpress.org/trunk@51241


git-svn-id: http://core.svn.wordpress.org/trunk@50850 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-06-25 15:52:22 +00:00

19007 lines
662 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

this["wp"] = this["wp"] || {}; this["wp"]["editPost"] =
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
/******/ }
/******/ };
/******/
/******/ // define __esModule on exports
/******/ __webpack_require__.r = function(exports) {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/
/******/ // 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 & 8|1: behave like require
/******/ __webpack_require__.t = function(value, mode) {
/******/ if(mode & 1) value = __webpack_require__(value);
/******/ if(mode & 8) return value;
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
/******/ var ns = Object.create(null);
/******/ __webpack_require__.r(ns);
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
/******/ return ns;
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = "dSQ2");
/******/ })
/************************************************************************/
/******/ ({
/***/ "0dt7":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return STORE_NAME; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return VIEW_AS_LINK_SELECTOR; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return VIEW_AS_PREVIEW_LINK_SELECTOR; });
/**
* The identifier for the data store.
*
* @type {string}
*/
const STORE_NAME = 'core/edit-post';
/**
* CSS selector string for the admin bar view post link anchor tag.
*
* @type {string}
*/
const VIEW_AS_LINK_SELECTOR = '#wp-admin-bar-view a';
/**
* CSS selector string for the admin bar preview post link anchor tag.
*
* @type {string}
*/
const VIEW_AS_PREVIEW_LINK_SELECTOR = '#wp-admin-bar-preview a';
/***/ }),
/***/ "1ZqX":
/***/ (function(module, exports) {
(function() { module.exports = window["wp"]["data"]; }());
/***/ }),
/***/ "4qRI":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
function memoize(fn) {
var cache = {};
return function (arg) {
if (cache[arg] === undefined) cache[arg] = fn(arg);
return cache[arg];
};
}
/* harmony default export */ __webpack_exports__["a"] = (memoize);
/***/ }),
/***/ "51Zz":
/***/ (function(module, exports) {
(function() { module.exports = window["wp"]["dataControls"]; }());
/***/ }),
/***/ "6aBm":
/***/ (function(module, exports) {
(function() { module.exports = window["wp"]["mediaUtils"]; }());
/***/ }),
/***/ "8oxB":
/***/ (function(module, exports) {
// shim for using process in browser
var process = module.exports = {};
// cached from whatever global is present so that test runners that stub it
// don't break things. But we need to wrap it in a try catch in case it is
// wrapped in strict mode code which doesn't define any globals. It's inside a
// function because try/catches deoptimize in certain engines.
var cachedSetTimeout;
var cachedClearTimeout;
function defaultSetTimout() {
throw new Error('setTimeout has not been defined');
}
function defaultClearTimeout () {
throw new Error('clearTimeout has not been defined');
}
(function () {
try {
if (typeof setTimeout === 'function') {
cachedSetTimeout = setTimeout;
} else {
cachedSetTimeout = defaultSetTimout;
}
} catch (e) {
cachedSetTimeout = defaultSetTimout;
}
try {
if (typeof clearTimeout === 'function') {
cachedClearTimeout = clearTimeout;
} else {
cachedClearTimeout = defaultClearTimeout;
}
} catch (e) {
cachedClearTimeout = defaultClearTimeout;
}
} ())
function runTimeout(fun) {
if (cachedSetTimeout === setTimeout) {
//normal enviroments in sane situations
return setTimeout(fun, 0);
}
// if setTimeout wasn't available but was latter defined
if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
cachedSetTimeout = setTimeout;
return setTimeout(fun, 0);
}
try {
// when when somebody has screwed with setTimeout but no I.E. maddness
return cachedSetTimeout(fun, 0);
} catch(e){
try {
// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
return cachedSetTimeout.call(null, fun, 0);
} catch(e){
// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error
return cachedSetTimeout.call(this, fun, 0);
}
}
}
function runClearTimeout(marker) {
if (cachedClearTimeout === clearTimeout) {
//normal enviroments in sane situations
return clearTimeout(marker);
}
// if clearTimeout wasn't available but was latter defined
if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
cachedClearTimeout = clearTimeout;
return clearTimeout(marker);
}
try {
// when when somebody has screwed with setTimeout but no I.E. maddness
return cachedClearTimeout(marker);
} catch (e){
try {
// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
return cachedClearTimeout.call(null, marker);
} catch (e){
// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.
// Some versions of I.E. have different rules for clearTimeout vs setTimeout
return cachedClearTimeout.call(this, marker);
}
}
}
var queue = [];
var draining = false;
var currentQueue;
var queueIndex = -1;
function cleanUpNextTick() {
if (!draining || !currentQueue) {
return;
}
draining = false;
if (currentQueue.length) {
queue = currentQueue.concat(queue);
} else {
queueIndex = -1;
}
if (queue.length) {
drainQueue();
}
}
function drainQueue() {
if (draining) {
return;
}
var timeout = runTimeout(cleanUpNextTick);
draining = true;
var len = queue.length;
while(len) {
currentQueue = queue;
queue = [];
while (++queueIndex < len) {
if (currentQueue) {
currentQueue[queueIndex].run();
}
}
queueIndex = -1;
len = queue.length;
}
currentQueue = null;
draining = false;
runClearTimeout(timeout);
}
process.nextTick = function (fun) {
var args = new Array(arguments.length - 1);
if (arguments.length > 1) {
for (var i = 1; i < arguments.length; i++) {
args[i - 1] = arguments[i];
}
}
queue.push(new Item(fun, args));
if (queue.length === 1 && !draining) {
runTimeout(drainQueue);
}
};
// v8 likes predictible objects
function Item(fun, array) {
this.fun = fun;
this.array = array;
}
Item.prototype.run = function () {
this.fun.apply(null, this.array);
};
process.title = 'browser';
process.browser = true;
process.env = {};
process.argv = [];
process.version = ''; // empty string to avoid regexp issues
process.versions = {};
function noop() {}
process.on = noop;
process.addListener = noop;
process.once = noop;
process.off = noop;
process.removeListener = noop;
process.removeAllListeners = noop;
process.emit = noop;
process.prependListener = noop;
process.prependOnceListener = noop;
process.listeners = function (name) { return [] }
process.binding = function (name) {
throw new Error('process.binding is not supported');
};
process.cwd = function () { return '/' };
process.chdir = function (dir) {
throw new Error('process.chdir is not supported');
};
process.umask = function() { return 0; };
/***/ }),
/***/ "9uj6":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _emotion_memoize__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("4qRI");
var reactPropsRegex = /^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|accept|acceptCharset|accessKey|action|allow|allowUserMedia|allowPaymentRequest|allowFullScreen|allowTransparency|alt|async|autoComplete|autoPlay|capture|cellPadding|cellSpacing|challenge|charSet|checked|cite|classID|className|cols|colSpan|content|contentEditable|contextMenu|controls|controlsList|coords|crossOrigin|data|dateTime|decoding|default|defer|dir|disabled|disablePictureInPicture|download|draggable|encType|form|formAction|formEncType|formMethod|formNoValidate|formTarget|frameBorder|headers|height|hidden|high|href|hrefLang|htmlFor|httpEquiv|id|inputMode|integrity|is|keyParams|keyType|kind|label|lang|list|loading|loop|low|marginHeight|marginWidth|max|maxLength|media|mediaGroup|method|min|minLength|multiple|muted|name|nonce|noValidate|open|optimum|pattern|placeholder|playsInline|poster|preload|profile|radioGroup|readOnly|referrerPolicy|rel|required|reversed|role|rows|rowSpan|sandbox|scope|scoped|scrolling|seamless|selected|shape|size|sizes|slot|span|spellCheck|src|srcDoc|srcLang|srcSet|start|step|style|summary|tabIndex|target|title|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|inert|itemProp|itemScope|itemType|itemID|itemRef|on|results|security|unselectable|accentHeight|accumulate|additive|alignmentBaseline|allowReorder|alphabetic|amplitude|arabicForm|ascent|attributeName|attributeType|autoReverse|azimuth|baseFrequency|baselineShift|baseProfile|bbox|begin|bias|by|calcMode|capHeight|clip|clipPathUnits|clipPath|clipRule|colorInterpolation|colorInterpolationFilters|colorProfile|colorRendering|contentScriptType|contentStyleType|cursor|cx|cy|d|decelerate|descent|diffuseConstant|direction|display|divisor|dominantBaseline|dur|dx|dy|edgeMode|elevation|enableBackground|end|exponent|externalResourcesRequired|fill|fillOpacity|fillRule|filter|filterRes|filterUnits|floodColor|floodOpacity|focusable|fontFamily|fontSize|fontSizeAdjust|fontStretch|fontStyle|fontVariant|fontWeight|format|from|fr|fx|fy|g1|g2|glyphName|glyphOrientationHorizontal|glyphOrientationVertical|glyphRef|gradientTransform|gradientUnits|hanging|horizAdvX|horizOriginX|ideographic|imageRendering|in|in2|intercept|k|k1|k2|k3|k4|kernelMatrix|kernelUnitLength|kerning|keyPoints|keySplines|keyTimes|lengthAdjust|letterSpacing|lightingColor|limitingConeAngle|local|markerEnd|markerMid|markerStart|markerHeight|markerUnits|markerWidth|mask|maskContentUnits|maskUnits|mathematical|mode|numOctaves|offset|opacity|operator|order|orient|orientation|origin|overflow|overlinePosition|overlineThickness|panose1|paintOrder|pathLength|patternContentUnits|patternTransform|patternUnits|pointerEvents|points|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|r|radius|refX|refY|renderingIntent|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|result|rotate|rx|ry|scale|seed|shapeRendering|slope|spacing|specularConstant|specularExponent|speed|spreadMethod|startOffset|stdDeviation|stemh|stemv|stitchTiles|stopColor|stopOpacity|strikethroughPosition|strikethroughThickness|string|stroke|strokeDasharray|strokeDashoffset|strokeLinecap|strokeLinejoin|strokeMiterlimit|strokeOpacity|strokeWidth|surfaceScale|systemLanguage|tableValues|targetX|targetY|textAnchor|textDecoration|textRendering|textLength|to|transform|u1|u2|underlinePosition|underlineThickness|unicode|unicodeBidi|unicodeRange|unitsPerEm|vAlphabetic|vHanging|vIdeographic|vMathematical|values|vectorEffect|version|vertAdvY|vertOriginX|vertOriginY|viewBox|viewTarget|visibility|widths|wordSpacing|writingMode|x|xHeight|x1|x2|xChannelSelector|xlinkActuate|xlinkArcrole|xlinkHref|xlinkRole|xlinkShow|xlinkTitle|xlinkType|xmlBase|xmlns|xmlnsXlink|xmlLang|xmlSpace|y|y1|y2|yChannelSelector|z|zoomAndPan|for|class|autofocus)|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$/; // https://esbench.com/bench/5bfee68a4cd7e6009ef61d23
var index = Object(_emotion_memoize__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(function (prop) {
return reactPropsRegex.test(prop) || prop.charCodeAt(0) === 111
/* o */
&& prop.charCodeAt(1) === 110
/* n */
&& prop.charCodeAt(2) < 91;
}
/* Z+1 */
);
/* harmony default export */ __webpack_exports__["default"] = (index);
/***/ }),
/***/ "Cg8A":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId");
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("Tqx9");
/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__);
/**
* WordPress dependencies
*/
const cog = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["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"
}));
/* harmony default export */ __webpack_exports__["a"] = (cog);
/***/ }),
/***/ "Civd":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId");
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("Tqx9");
/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__);
/**
* WordPress dependencies
*/
const layout = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["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"
}));
/* harmony default export */ __webpack_exports__["a"] = (layout);
/***/ }),
/***/ "GRId":
/***/ (function(module, exports) {
(function() { module.exports = window["wp"]["element"]; }());
/***/ }),
/***/ "HSyU":
/***/ (function(module, exports) {
(function() { module.exports = window["wp"]["blocks"]; }());
/***/ }),
/***/ "K+tz":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId");
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("Tqx9");
/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__);
/**
* WordPress dependencies
*/
const external = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], {
d: "M18.2 17c0 .7-.6 1.2-1.2 1.2H7c-.7 0-1.2-.6-1.2-1.2V7c0-.7.6-1.2 1.2-1.2h3.2V4.2H7C5.5 4.2 4.2 5.5 4.2 7v10c0 1.5 1.2 2.8 2.8 2.8h10c1.5 0 2.8-1.2 2.8-2.8v-3.6h-1.5V17zM14.9 3v1.5h3.7l-6.4 6.4 1.1 1.1 6.4-6.4v3.7h1.5V3h-6.3z"
}));
/* harmony default export */ __webpack_exports__["a"] = (external);
/***/ }),
/***/ "K9lf":
/***/ (function(module, exports) {
(function() { module.exports = window["wp"]["compose"]; }());
/***/ }),
/***/ "KEfo":
/***/ (function(module, exports) {
(function() { module.exports = window["wp"]["viewport"]; }());
/***/ }),
/***/ "Mmq9":
/***/ (function(module, exports) {
(function() { module.exports = window["wp"]["url"]; }());
/***/ }),
/***/ "NWDH":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId");
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("Tqx9");
/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__);
/**
* WordPress dependencies
*/
const chevronDown = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], {
viewBox: "0 0 24 24",
xmlns: "http://www.w3.org/2000/svg"
}, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], {
d: "M17.5 11.6L12 16l-5.5-4.4.9-1.2L12 14l4.5-3.6 1 1.2z"
}));
/* harmony default export */ __webpack_exports__["a"] = (chevronDown);
/***/ }),
/***/ "OzlF":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId");
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("Tqx9");
/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__);
/**
* WordPress dependencies
*/
const listView = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], {
viewBox: "0 0 24 24",
xmlns: "http://www.w3.org/2000/svg"
}, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], {
d: "M13.8 5.2H3v1.5h10.8V5.2zm-3.6 12v1.5H21v-1.5H10.2zm7.2-6H6.6v1.5h10.8v-1.5z"
}));
/* harmony default export */ __webpack_exports__["a"] = (listView);
/***/ }),
/***/ "Q4Sy":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId");
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("Tqx9");
/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__);
/**
* WordPress dependencies
*/
const plus = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], {
d: "M18 11.2h-5.2V6h-1.6v5.2H6v1.6h5.2V18h1.6v-5.2H18z"
}));
/* harmony default export */ __webpack_exports__["a"] = (plus);
/***/ }),
/***/ "QyPg":
/***/ (function(module, exports) {
(function() { module.exports = window["wp"]["blockLibrary"]; }());
/***/ }),
/***/ "RMJe":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId");
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("Tqx9");
/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__);
/**
* WordPress dependencies
*/
const check = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], {
d: "M18.3 5.6L9.9 16.9l-4.6-3.4-.9 1.2 5.8 4.3 9.3-12.6z"
}));
/* harmony default export */ __webpack_exports__["a"] = (check);
/***/ }),
/***/ "RxS6":
/***/ (function(module, exports) {
(function() { module.exports = window["wp"]["keycodes"]; }());
/***/ }),
/***/ "T40v":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
// EXPORTS
__webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ store; });
// NAMESPACE OBJECT: ./node_modules/@wordpress/edit-post/build-module/store/actions.js
var actions_namespaceObject = {};
__webpack_require__.r(actions_namespaceObject);
__webpack_require__.d(actions_namespaceObject, "openGeneralSidebar", function() { return openGeneralSidebar; });
__webpack_require__.d(actions_namespaceObject, "closeGeneralSidebar", function() { return closeGeneralSidebar; });
__webpack_require__.d(actions_namespaceObject, "openModal", function() { return openModal; });
__webpack_require__.d(actions_namespaceObject, "closeModal", function() { return closeModal; });
__webpack_require__.d(actions_namespaceObject, "openPublishSidebar", function() { return openPublishSidebar; });
__webpack_require__.d(actions_namespaceObject, "closePublishSidebar", function() { return closePublishSidebar; });
__webpack_require__.d(actions_namespaceObject, "togglePublishSidebar", function() { return togglePublishSidebar; });
__webpack_require__.d(actions_namespaceObject, "toggleEditorPanelEnabled", function() { return toggleEditorPanelEnabled; });
__webpack_require__.d(actions_namespaceObject, "toggleEditorPanelOpened", function() { return toggleEditorPanelOpened; });
__webpack_require__.d(actions_namespaceObject, "removeEditorPanel", function() { return removeEditorPanel; });
__webpack_require__.d(actions_namespaceObject, "toggleFeature", function() { return toggleFeature; });
__webpack_require__.d(actions_namespaceObject, "switchEditorMode", function() { return switchEditorMode; });
__webpack_require__.d(actions_namespaceObject, "togglePinnedPluginItem", function() { return togglePinnedPluginItem; });
__webpack_require__.d(actions_namespaceObject, "hideBlockTypes", function() { return hideBlockTypes; });
__webpack_require__.d(actions_namespaceObject, "updatePreferredStyleVariations", function() { return updatePreferredStyleVariations; });
__webpack_require__.d(actions_namespaceObject, "__experimentalUpdateLocalAutosaveInterval", function() { return __experimentalUpdateLocalAutosaveInterval; });
__webpack_require__.d(actions_namespaceObject, "showBlockTypes", function() { return showBlockTypes; });
__webpack_require__.d(actions_namespaceObject, "setAvailableMetaBoxesPerLocation", function() { return setAvailableMetaBoxesPerLocation; });
__webpack_require__.d(actions_namespaceObject, "requestMetaBoxUpdates", function() { return requestMetaBoxUpdates; });
__webpack_require__.d(actions_namespaceObject, "metaBoxUpdatesSuccess", function() { return metaBoxUpdatesSuccess; });
__webpack_require__.d(actions_namespaceObject, "__experimentalSetPreviewDeviceType", function() { return __experimentalSetPreviewDeviceType; });
__webpack_require__.d(actions_namespaceObject, "setIsInserterOpened", function() { return setIsInserterOpened; });
__webpack_require__.d(actions_namespaceObject, "setIsListViewOpened", function() { return setIsListViewOpened; });
__webpack_require__.d(actions_namespaceObject, "setIsEditingTemplate", function() { return setIsEditingTemplate; });
__webpack_require__.d(actions_namespaceObject, "__unstableSwitchToTemplateMode", function() { return __unstableSwitchToTemplateMode; });
// NAMESPACE OBJECT: ./node_modules/@wordpress/edit-post/build-module/store/selectors.js
var selectors_namespaceObject = {};
__webpack_require__.r(selectors_namespaceObject);
__webpack_require__.d(selectors_namespaceObject, "getEditorMode", function() { return getEditorMode; });
__webpack_require__.d(selectors_namespaceObject, "isEditorSidebarOpened", function() { return isEditorSidebarOpened; });
__webpack_require__.d(selectors_namespaceObject, "isPluginSidebarOpened", function() { return isPluginSidebarOpened; });
__webpack_require__.d(selectors_namespaceObject, "getActiveGeneralSidebarName", function() { return getActiveGeneralSidebarName; });
__webpack_require__.d(selectors_namespaceObject, "getPreferences", function() { return getPreferences; });
__webpack_require__.d(selectors_namespaceObject, "getPreference", function() { return getPreference; });
__webpack_require__.d(selectors_namespaceObject, "isPublishSidebarOpened", function() { return isPublishSidebarOpened; });
__webpack_require__.d(selectors_namespaceObject, "isEditorPanelRemoved", function() { return isEditorPanelRemoved; });
__webpack_require__.d(selectors_namespaceObject, "isEditorPanelEnabled", function() { return isEditorPanelEnabled; });
__webpack_require__.d(selectors_namespaceObject, "isEditorPanelOpened", function() { return isEditorPanelOpened; });
__webpack_require__.d(selectors_namespaceObject, "isModalActive", function() { return isModalActive; });
__webpack_require__.d(selectors_namespaceObject, "isFeatureActive", function() { return isFeatureActive; });
__webpack_require__.d(selectors_namespaceObject, "isPluginItemPinned", function() { return isPluginItemPinned; });
__webpack_require__.d(selectors_namespaceObject, "getActiveMetaBoxLocations", function() { return getActiveMetaBoxLocations; });
__webpack_require__.d(selectors_namespaceObject, "isMetaBoxLocationVisible", function() { return isMetaBoxLocationVisible; });
__webpack_require__.d(selectors_namespaceObject, "isMetaBoxLocationActive", function() { return isMetaBoxLocationActive; });
__webpack_require__.d(selectors_namespaceObject, "getMetaBoxesPerLocation", function() { return getMetaBoxesPerLocation; });
__webpack_require__.d(selectors_namespaceObject, "getAllMetaBoxes", function() { return getAllMetaBoxes; });
__webpack_require__.d(selectors_namespaceObject, "hasMetaBoxes", function() { return hasMetaBoxes; });
__webpack_require__.d(selectors_namespaceObject, "isSavingMetaBoxes", function() { return selectors_isSavingMetaBoxes; });
__webpack_require__.d(selectors_namespaceObject, "__experimentalGetPreviewDeviceType", function() { return __experimentalGetPreviewDeviceType; });
__webpack_require__.d(selectors_namespaceObject, "isInserterOpened", function() { return isInserterOpened; });
__webpack_require__.d(selectors_namespaceObject, "__experimentalGetInsertionPoint", function() { return __experimentalGetInsertionPoint; });
__webpack_require__.d(selectors_namespaceObject, "isListViewOpened", function() { return isListViewOpened; });
__webpack_require__.d(selectors_namespaceObject, "isEditingTemplate", function() { return selectors_isEditingTemplate; });
__webpack_require__.d(selectors_namespaceObject, "getEditedPostTemplate", function() { return getEditedPostTemplate; });
// EXTERNAL MODULE: external ["wp","data"]
var external_wp_data_ = __webpack_require__("1ZqX");
// EXTERNAL MODULE: external ["wp","dataControls"]
var external_wp_dataControls_ = __webpack_require__("51Zz");
// EXTERNAL MODULE: external "lodash"
var external_lodash_ = __webpack_require__("YLtl");
// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/store/defaults.js
const PREFERENCES_DEFAULTS = {
editorMode: 'visual',
panels: {
'post-status': {
opened: true
}
},
features: {
fixedToolbar: false,
welcomeGuide: true,
fullscreenMode: true,
showIconLabels: false,
themeStyles: true,
showBlockBreadcrumbs: true,
welcomeGuideTemplate: true
},
hiddenBlockTypes: [],
preferredStyleVariations: {},
localAutosaveInterval: 15
};
// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/store/reducer.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* Higher-order reducer creator which provides the given initial state for the
* original reducer.
*
* @param {*} initialState Initial state to provide to reducer.
*
* @return {Function} Higher-order reducer.
*/
const createWithInitialState = initialState => reducer => {
return (state = initialState, action) => reducer(state, action);
};
/**
* Reducer returning the user preferences.
*
* @param {Object} state Current state.
* @param {string} state.mode Current editor mode, either
* "visual" or "text".
* @param {boolean} state.isGeneralSidebarDismissed Whether general sidebar is
* dismissed. False by default
* or when closing general
* sidebar, true when opening
* sidebar.
* @param {boolean} state.isSidebarOpened Whether the sidebar is
* opened or closed.
* @param {Object} state.panels The state of the different
* sidebar panels.
* @param {Object} action Dispatched action.
*
* @return {Object} Updated state.
*/
const preferences = Object(external_lodash_["flow"])([external_wp_data_["combineReducers"], createWithInitialState(PREFERENCES_DEFAULTS)])({
panels(state, action) {
switch (action.type) {
case 'TOGGLE_PANEL_ENABLED':
{
const {
panelName
} = action;
return { ...state,
[panelName]: { ...state[panelName],
enabled: !Object(external_lodash_["get"])(state, [panelName, 'enabled'], true)
}
};
}
case 'TOGGLE_PANEL_OPENED':
{
const {
panelName
} = action;
const isOpen = state[panelName] === true || Object(external_lodash_["get"])(state, [panelName, 'opened'], false);
return { ...state,
[panelName]: { ...state[panelName],
opened: !isOpen
}
};
}
}
return state;
},
features(state, action) {
if (action.type === 'TOGGLE_FEATURE') {
return { ...state,
[action.feature]: !state[action.feature]
};
}
return state;
},
editorMode(state, action) {
if (action.type === 'SWITCH_MODE') {
return action.mode;
}
return state;
},
hiddenBlockTypes(state, action) {
switch (action.type) {
case 'SHOW_BLOCK_TYPES':
return Object(external_lodash_["without"])(state, ...action.blockNames);
case 'HIDE_BLOCK_TYPES':
return Object(external_lodash_["union"])(state, action.blockNames);
}
return state;
},
preferredStyleVariations(state, action) {
switch (action.type) {
case 'UPDATE_PREFERRED_STYLE_VARIATIONS':
{
if (!action.blockName) {
return state;
}
if (!action.blockStyle) {
return Object(external_lodash_["omit"])(state, [action.blockName]);
}
return { ...state,
[action.blockName]: action.blockStyle
};
}
}
return state;
},
localAutosaveInterval(state, action) {
switch (action.type) {
case 'UPDATE_LOCAL_AUTOSAVE_INTERVAL':
return action.interval;
}
return state;
}
});
/**
* Reducer storing the list of all programmatically removed panels.
*
* @param {Array} state Current state.
* @param {Object} action Action object.
*
* @return {Array} Updated state.
*/
function removedPanels(state = [], action) {
switch (action.type) {
case 'REMOVE_PANEL':
if (!Object(external_lodash_["includes"])(state, action.panelName)) {
return [...state, action.panelName];
}
}
return state;
}
/**
* Reducer for storing the name of the open modal, or null if no modal is open.
*
* @param {Object} state Previous state.
* @param {Object} action Action object containing the `name` of the modal
*
* @return {Object} Updated state
*/
function activeModal(state = null, action) {
switch (action.type) {
case 'OPEN_MODAL':
return action.name;
case 'CLOSE_MODAL':
return null;
}
return state;
}
function publishSidebarActive(state = false, action) {
switch (action.type) {
case 'OPEN_PUBLISH_SIDEBAR':
return true;
case 'CLOSE_PUBLISH_SIDEBAR':
return false;
case 'TOGGLE_PUBLISH_SIDEBAR':
return !state;
}
return state;
}
/**
* Reducer keeping track of the meta boxes isSaving state.
* A "true" value means the meta boxes saving request is in-flight.
*
*
* @param {boolean} state Previous state.
* @param {Object} action Action Object.
*
* @return {Object} Updated state.
*/
function isSavingMetaBoxes(state = false, action) {
switch (action.type) {
case 'REQUEST_META_BOX_UPDATES':
return true;
case 'META_BOX_UPDATES_SUCCESS':
return false;
default:
return state;
}
}
/**
* Reducer keeping track of the meta boxes per location.
*
* @param {boolean} state Previous state.
* @param {Object} action Action Object.
*
* @return {Object} Updated state.
*/
function metaBoxLocations(state = {}, action) {
switch (action.type) {
case 'SET_META_BOXES_PER_LOCATIONS':
return action.metaBoxesPerLocation;
}
return state;
}
/**
* Reducer returning the editing canvas device type.
*
* @param {Object} state Current state.
* @param {Object} action Dispatched action.
*
* @return {Object} Updated state.
*/
function deviceType(state = 'Desktop', action) {
switch (action.type) {
case 'SET_PREVIEW_DEVICE_TYPE':
return action.deviceType;
}
return state;
}
/**
* Reducer to set the block inserter panel open or closed.
*
* Note: this reducer interacts with the list view panel reducer
* to make sure that only one of the two panels is open at the same time.
*
* @param {Object} state Current state.
* @param {Object} action Dispatched action.
*/
function blockInserterPanel(state = false, action) {
switch (action.type) {
case 'SET_IS_LIST_VIEW_OPENED':
return action.isOpen ? false : state;
case 'SET_IS_INSERTER_OPENED':
return action.value;
}
return state;
}
/**
* Reducer to set the list view panel open or closed.
*
* Note: this reducer interacts with the inserter panel reducer
* to make sure that only one of the two panels is open at the same time.
*
* @param {Object} state Current state.
* @param {Object} action Dispatched action.
*/
function listViewPanel(state = false, action) {
switch (action.type) {
case 'SET_IS_INSERTER_OPENED':
return action.value ? false : state;
case 'SET_IS_LIST_VIEW_OPENED':
return action.isOpen;
}
return state;
}
/**
* Reducer tracking whether the inserter is open.
*
* @param {boolean} state
* @param {Object} action
*/
function isEditingTemplate(state = false, action) {
switch (action.type) {
case 'SET_IS_EDITING_TEMPLATE':
return action.value;
}
return state;
}
const metaBoxes = Object(external_wp_data_["combineReducers"])({
isSaving: isSavingMetaBoxes,
locations: metaBoxLocations
});
/* harmony default export */ var reducer = (Object(external_wp_data_["combineReducers"])({
activeModal,
metaBoxes,
preferences,
publishSidebarActive,
removedPanels,
deviceType,
blockInserterPanel,
listViewPanel,
isEditingTemplate
}));
// EXTERNAL MODULE: external ["wp","i18n"]
var external_wp_i18n_ = __webpack_require__("l3Sj");
// EXTERNAL MODULE: ./node_modules/@wordpress/interface/build-module/index.js + 15 modules
var build_module = __webpack_require__("U60i");
// EXTERNAL MODULE: external ["wp","a11y"]
var external_wp_a11y_ = __webpack_require__("gdqT");
// EXTERNAL MODULE: external ["wp","notices"]
var external_wp_notices_ = __webpack_require__("onLe");
// EXTERNAL MODULE: external ["wp","coreData"]
var external_wp_coreData_ = __webpack_require__("jZUy");
// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/utils/meta-boxes.js
/**
* Function returning the current Meta Boxes DOM Node in the editor
* whether the meta box area is opened or not.
* If the MetaBox Area is visible returns it, and returns the original container instead.
*
* @param {string} location Meta Box location.
* @return {string} HTML content.
*/
const getMetaBoxContainer = location => {
const area = document.querySelector(`.edit-post-meta-boxes-area.is-${location} .metabox-location-${location}`);
if (area) {
return area;
}
return document.querySelector('#metaboxes .metabox-location-' + location);
};
// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/store/actions.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* Returns an action object used in signalling that the user opened an editor sidebar.
*
* @param {?string} name Sidebar name to be opened.
*
* @yield {Object} Action object.
*/
function* openGeneralSidebar(name) {
yield external_wp_data_["controls"].dispatch(build_module["g" /* store */].name, 'enableComplementaryArea', store.name, name);
}
/**
* Returns an action object signalling that the user closed the sidebar.
*
* @yield {Object} Action object.
*/
function* closeGeneralSidebar() {
yield external_wp_data_["controls"].dispatch(build_module["g" /* store */].name, 'disableComplementaryArea', store.name);
}
/**
* Returns an action object used in signalling that the user opened a modal.
*
* @param {string} name A string that uniquely identifies the modal.
*
* @return {Object} Action object.
*/
function openModal(name) {
return {
type: 'OPEN_MODAL',
name
};
}
/**
* Returns an action object signalling that the user closed a modal.
*
* @return {Object} Action object.
*/
function closeModal() {
return {
type: 'CLOSE_MODAL'
};
}
/**
* Returns an action object used in signalling that the user opened the publish
* sidebar.
*
* @return {Object} Action object
*/
function openPublishSidebar() {
return {
type: 'OPEN_PUBLISH_SIDEBAR'
};
}
/**
* Returns an action object used in signalling that the user closed the
* publish sidebar.
*
* @return {Object} Action object.
*/
function closePublishSidebar() {
return {
type: 'CLOSE_PUBLISH_SIDEBAR'
};
}
/**
* Returns an action object used in signalling that the user toggles the publish sidebar.
*
* @return {Object} Action object
*/
function togglePublishSidebar() {
return {
type: 'TOGGLE_PUBLISH_SIDEBAR'
};
}
/**
* Returns an action object used to enable or disable a panel in the editor.
*
* @param {string} panelName A string that identifies the panel to enable or disable.
*
* @return {Object} Action object.
*/
function toggleEditorPanelEnabled(panelName) {
return {
type: 'TOGGLE_PANEL_ENABLED',
panelName
};
}
/**
* Returns an action object used to open or close a panel in the editor.
*
* @param {string} panelName A string that identifies the panel to open or close.
*
* @return {Object} Action object.
*/
function toggleEditorPanelOpened(panelName) {
return {
type: 'TOGGLE_PANEL_OPENED',
panelName
};
}
/**
* Returns an action object used to remove a panel from the editor.
*
* @param {string} panelName A string that identifies the panel to remove.
*
* @return {Object} Action object.
*/
function removeEditorPanel(panelName) {
return {
type: 'REMOVE_PANEL',
panelName
};
}
/**
* Returns an action object used to toggle a feature flag.
*
* @param {string} feature Feature name.
*
* @return {Object} Action object.
*/
function toggleFeature(feature) {
return {
type: 'TOGGLE_FEATURE',
feature
};
}
function* switchEditorMode(mode) {
yield {
type: 'SWITCH_MODE',
mode
}; // Unselect blocks when we switch to the code editor.
if (mode !== 'visual') {
yield external_wp_data_["controls"].dispatch('core/block-editor', 'clearSelectedBlock');
}
const message = mode === 'visual' ? Object(external_wp_i18n_["__"])('Visual editor selected') : Object(external_wp_i18n_["__"])('Code editor selected');
Object(external_wp_a11y_["speak"])(message, 'assertive');
}
/**
* Returns an action object used to toggle a plugin name flag.
*
* @param {string} pluginName Plugin name.
*
* @return {Object} Action object.
*/
function togglePinnedPluginItem(pluginName) {
return {
type: 'TOGGLE_PINNED_PLUGIN_ITEM',
pluginName
};
}
/**
* Returns an action object used in signalling that block types by the given
* name(s) should be hidden.
*
* @param {string[]} blockNames Names of block types to hide.
*
* @return {Object} Action object.
*/
function hideBlockTypes(blockNames) {
return {
type: 'HIDE_BLOCK_TYPES',
blockNames: Object(external_lodash_["castArray"])(blockNames)
};
}
/**
* Returns an action object used in signaling that a style should be auto-applied when a block is created.
*
* @param {string} blockName Name of the block.
* @param {?string} blockStyle Name of the style that should be auto applied. If undefined, the "auto apply" setting of the block is removed.
*
* @return {Object} Action object.
*/
function updatePreferredStyleVariations(blockName, blockStyle) {
return {
type: 'UPDATE_PREFERRED_STYLE_VARIATIONS',
blockName,
blockStyle
};
}
/**
* Returns an action object used in signalling that the editor should attempt
* to locally autosave the current post every `interval` seconds.
*
* @param {number} interval The new interval, in seconds.
* @return {Object} Action object.
*/
function __experimentalUpdateLocalAutosaveInterval(interval) {
return {
type: 'UPDATE_LOCAL_AUTOSAVE_INTERVAL',
interval
};
}
/**
* Returns an action object used in signalling that block types by the given
* name(s) should be shown.
*
* @param {string[]} blockNames Names of block types to show.
*
* @return {Object} Action object.
*/
function showBlockTypes(blockNames) {
return {
type: 'SHOW_BLOCK_TYPES',
blockNames: Object(external_lodash_["castArray"])(blockNames)
};
}
let saveMetaboxUnsubscribe;
/**
* Returns an action object used in signaling
* what Meta boxes are available in which location.
*
* @param {Object} metaBoxesPerLocation Meta boxes per location.
*
* @yield {Object} Action object.
*/
function* setAvailableMetaBoxesPerLocation(metaBoxesPerLocation) {
yield {
type: 'SET_META_BOXES_PER_LOCATIONS',
metaBoxesPerLocation
};
const postType = yield external_wp_data_["controls"].select('core/editor', 'getCurrentPostType');
if (window.postboxes.page !== postType) {
window.postboxes.add_postbox_toggles(postType);
}
let wasSavingPost = yield external_wp_data_["controls"].select('core/editor', 'isSavingPost');
let wasAutosavingPost = yield external_wp_data_["controls"].select('core/editor', 'isAutosavingPost'); // Meta boxes are initialized once at page load. It is not necessary to
// account for updates on each state change.
//
// See: https://github.com/WordPress/WordPress/blob/5.1.1/wp-admin/includes/post.php#L2307-L2309
const hasActiveMetaBoxes = yield external_wp_data_["controls"].select(store.name, 'hasMetaBoxes'); // First remove any existing subscription in order to prevent multiple saves
if (!!saveMetaboxUnsubscribe) {
saveMetaboxUnsubscribe();
} // Save metaboxes when performing a full save on the post.
saveMetaboxUnsubscribe = Object(external_wp_data_["subscribe"])(() => {
const isSavingPost = Object(external_wp_data_["select"])('core/editor').isSavingPost();
const isAutosavingPost = Object(external_wp_data_["select"])('core/editor').isAutosavingPost(); // Save metaboxes on save completion, except for autosaves that are not a post preview.
const shouldTriggerMetaboxesSave = hasActiveMetaBoxes && wasSavingPost && !isSavingPost && !wasAutosavingPost; // Save current state for next inspection.
wasSavingPost = isSavingPost;
wasAutosavingPost = isAutosavingPost;
if (shouldTriggerMetaboxesSave) {
Object(external_wp_data_["dispatch"])(store.name).requestMetaBoxUpdates();
}
});
}
/**
* Returns an action object used to request meta box update.
*
* @yield {Object} Action object.
*/
function* requestMetaBoxUpdates() {
yield {
type: 'REQUEST_META_BOX_UPDATES'
}; // Saves the wp_editor fields
if (window.tinyMCE) {
window.tinyMCE.triggerSave();
} // Additional data needed for backward compatibility.
// If we do not provide this data, the post will be overridden with the default values.
const post = yield external_wp_data_["controls"].select('core/editor', 'getCurrentPost');
const additionalData = [post.comment_status ? ['comment_status', post.comment_status] : false, post.ping_status ? ['ping_status', post.ping_status] : false, post.sticky ? ['sticky', post.sticky] : false, post.author ? ['post_author', post.author] : false].filter(Boolean); // We gather all the metaboxes locations data and the base form data
const baseFormData = new window.FormData(document.querySelector('.metabox-base-form'));
const activeMetaBoxLocations = yield external_wp_data_["controls"].select(store.name, 'getActiveMetaBoxLocations');
const formDataToMerge = [baseFormData, ...activeMetaBoxLocations.map(location => new window.FormData(getMetaBoxContainer(location)))]; // Merge all form data objects into a single one.
const formData = Object(external_lodash_["reduce"])(formDataToMerge, (memo, currentFormData) => {
for (const [key, value] of currentFormData) {
memo.append(key, value);
}
return memo;
}, new window.FormData());
additionalData.forEach(([key, value]) => formData.append(key, value)); // Save the metaboxes
yield Object(external_wp_dataControls_["apiFetch"])({
url: window._wpMetaBoxUrl,
method: 'POST',
body: formData,
parse: false
});
yield external_wp_data_["controls"].dispatch(store.name, 'metaBoxUpdatesSuccess');
}
/**
* Returns an action object used signal a successful meta box update.
*
* @return {Object} Action object.
*/
function metaBoxUpdatesSuccess() {
return {
type: 'META_BOX_UPDATES_SUCCESS'
};
}
/**
* Returns an action object used to toggle the width of the editing canvas.
*
* @param {string} deviceType
*
* @return {Object} Action object.
*/
function __experimentalSetPreviewDeviceType(deviceType) {
return {
type: 'SET_PREVIEW_DEVICE_TYPE',
deviceType
};
}
/**
* Returns an action object used to open/close the inserter.
*
* @param {boolean|Object} value Whether the inserter should be
* opened (true) or closed (false).
* To specify an insertion point,
* use an object.
* @param {string} value.rootClientId The root client ID to insert at.
* @param {number} value.insertionIndex The index to insert at.
*
* @return {Object} Action object.
*/
function setIsInserterOpened(value) {
return {
type: 'SET_IS_INSERTER_OPENED',
value
};
}
/**
* Returns an action object used to open/close the list view.
*
* @param {boolean} isOpen A boolean representing whether the list view should be opened or closed.
* @return {Object} Action object.
*/
function setIsListViewOpened(isOpen) {
return {
type: 'SET_IS_LIST_VIEW_OPENED',
isOpen
};
}
/**
* Returns an action object used to switch to template editing.
*
* @param {boolean} value Is editing template.
* @return {Object} Action object.
*/
function setIsEditingTemplate(value) {
return {
type: 'SET_IS_EDITING_TEMPLATE',
value
};
}
/**
* Potentially create a block based template and switches to the template mode.
*
* @param {Object?} template template to create and assign before switching.
*/
function* __unstableSwitchToTemplateMode(template) {
if (!!template) {
const savedTemplate = yield external_wp_data_["controls"].dispatch(external_wp_coreData_["store"], 'saveEntityRecord', 'postType', 'wp_template', template);
const post = yield external_wp_data_["controls"].select('core/editor', 'getCurrentPost');
yield external_wp_data_["controls"].dispatch(external_wp_coreData_["store"], 'editEntityRecord', 'postType', post.type, post.id, {
template: savedTemplate.slug
});
}
yield setIsEditingTemplate(true);
const isWelcomeGuideActive = yield external_wp_data_["controls"].select('core/edit-post', 'isFeatureActive', 'welcomeGuideTemplate');
if (!isWelcomeGuideActive) {
const message = !!template ? Object(external_wp_i18n_["__"])("Custom template created. You're in template mode now.") : Object(external_wp_i18n_["__"])('Editing template. Changes made here affect all posts and pages that use the template.');
yield external_wp_data_["controls"].dispatch(external_wp_notices_["store"], 'createSuccessNotice', message, {
type: 'snackbar'
});
}
}
// EXTERNAL MODULE: ./node_modules/rememo/es/rememo.js
var rememo = __webpack_require__("pPDe");
// EXTERNAL MODULE: external ["wp","editor"]
var external_wp_editor_ = __webpack_require__("jSdM");
// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/store/selectors.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Returns the current editing mode.
*
* @param {Object} state Global application state.
*
* @return {string} Editing mode.
*/
function getEditorMode(state) {
return getPreference(state, 'editorMode', 'visual');
}
/**
* Returns true if the editor sidebar is opened.
*
* @param {Object} state Global application state
*
* @return {boolean} Whether the editor sidebar is opened.
*/
const isEditorSidebarOpened = Object(external_wp_data_["createRegistrySelector"])(select => () => {
const activeGeneralSidebar = select(build_module["g" /* store */]).getActiveComplementaryArea('core/edit-post');
return Object(external_lodash_["includes"])(['edit-post/document', 'edit-post/block'], activeGeneralSidebar);
});
/**
* Returns true if the plugin sidebar is opened.
*
* @param {Object} state Global application state
* @return {boolean} Whether the plugin sidebar is opened.
*/
const isPluginSidebarOpened = Object(external_wp_data_["createRegistrySelector"])(select => () => {
const activeGeneralSidebar = select(build_module["g" /* store */]).getActiveComplementaryArea('core/edit-post');
return !!activeGeneralSidebar && !Object(external_lodash_["includes"])(['edit-post/document', 'edit-post/block'], activeGeneralSidebar);
});
/**
* Returns the current active general sidebar name, or null if there is no
* general sidebar active. The active general sidebar is a unique name to
* identify either an editor or plugin sidebar.
*
* Examples:
*
* - `edit-post/document`
* - `my-plugin/insert-image-sidebar`
*
* @param {Object} state Global application state.
*
* @return {?string} Active general sidebar name.
*/
const getActiveGeneralSidebarName = Object(external_wp_data_["createRegistrySelector"])(select => () => {
return select(build_module["g" /* store */]).getActiveComplementaryArea('core/edit-post');
});
/**
* Returns the preferences (these preferences are persisted locally).
*
* @param {Object} state Global application state.
*
* @return {Object} Preferences Object.
*/
function getPreferences(state) {
return state.preferences;
}
/**
*
* @param {Object} state Global application state.
* @param {string} preferenceKey Preference Key.
* @param {*} defaultValue Default Value.
*
* @return {*} Preference Value.
*/
function getPreference(state, preferenceKey, defaultValue) {
const preferences = getPreferences(state);
const value = preferences[preferenceKey];
return value === undefined ? defaultValue : value;
}
/**
* Returns true if the publish sidebar is opened.
*
* @param {Object} state Global application state
*
* @return {boolean} Whether the publish sidebar is open.
*/
function isPublishSidebarOpened(state) {
return state.publishSidebarActive;
}
/**
* Returns true if the given panel was programmatically removed, or false otherwise.
* All panels are not removed by default.
*
* @param {Object} state Global application state.
* @param {string} panelName A string that identifies the panel.
*
* @return {boolean} Whether or not the panel is removed.
*/
function isEditorPanelRemoved(state, panelName) {
return Object(external_lodash_["includes"])(state.removedPanels, panelName);
}
/**
* Returns true if the given panel is enabled, or false otherwise. Panels are
* enabled by default.
*
* @param {Object} state Global application state.
* @param {string} panelName A string that identifies the panel.
*
* @return {boolean} Whether or not the panel is enabled.
*/
function isEditorPanelEnabled(state, panelName) {
const panels = getPreference(state, 'panels');
return !isEditorPanelRemoved(state, panelName) && Object(external_lodash_["get"])(panels, [panelName, 'enabled'], true);
}
/**
* Returns true if the given panel is open, or false otherwise. Panels are
* closed by default.
*
* @param {Object} state Global application state.
* @param {string} panelName A string that identifies the panel.
*
* @return {boolean} Whether or not the panel is open.
*/
function isEditorPanelOpened(state, panelName) {
const panels = getPreference(state, 'panels');
return Object(external_lodash_["get"])(panels, [panelName]) === true || Object(external_lodash_["get"])(panels, [panelName, 'opened']) === true;
}
/**
* Returns true if a modal is active, or false otherwise.
*
* @param {Object} state Global application state.
* @param {string} modalName A string that uniquely identifies the modal.
*
* @return {boolean} Whether the modal is active.
*/
function isModalActive(state, modalName) {
return state.activeModal === modalName;
}
/**
* Returns whether the given feature is enabled or not.
*
* @param {Object} state Global application state.
* @param {string} feature Feature slug.
*
* @return {boolean} Is active.
*/
function isFeatureActive(state, feature) {
return Object(external_lodash_["get"])(state.preferences.features, [feature], false);
}
/**
* Returns true if the plugin item is pinned to the header.
* When the value is not set it defaults to true.
*
* @param {Object} state Global application state.
* @param {string} pluginName Plugin item name.
*
* @return {boolean} Whether the plugin item is pinned.
*/
const isPluginItemPinned = Object(external_wp_data_["createRegistrySelector"])(select => pluginName => {
return select(build_module["g" /* store */]).isItemPinned('core/edit-post', pluginName);
});
/**
* Returns an array of active meta box locations.
*
* @param {Object} state Post editor state.
*
* @return {string[]} Active meta box locations.
*/
const getActiveMetaBoxLocations = Object(rememo["a" /* default */])(state => {
return Object.keys(state.metaBoxes.locations).filter(location => isMetaBoxLocationActive(state, location));
}, state => [state.metaBoxes.locations]);
/**
* Returns true if a metabox location is active and visible
*
* @param {Object} state Post editor state.
* @param {string} location Meta box location to test.
*
* @return {boolean} Whether the meta box location is active and visible.
*/
function isMetaBoxLocationVisible(state, location) {
return isMetaBoxLocationActive(state, location) && Object(external_lodash_["some"])(getMetaBoxesPerLocation(state, location), ({
id
}) => {
return isEditorPanelEnabled(state, `meta-box-${id}`);
});
}
/**
* Returns true if there is an active meta box in the given location, or false
* otherwise.
*
* @param {Object} state Post editor state.
* @param {string} location Meta box location to test.
*
* @return {boolean} Whether the meta box location is active.
*/
function isMetaBoxLocationActive(state, location) {
const metaBoxes = getMetaBoxesPerLocation(state, location);
return !!metaBoxes && metaBoxes.length !== 0;
}
/**
* Returns the list of all the available meta boxes for a given location.
*
* @param {Object} state Global application state.
* @param {string} location Meta box location to test.
*
* @return {?Array} List of meta boxes.
*/
function getMetaBoxesPerLocation(state, location) {
return state.metaBoxes.locations[location];
}
/**
* Returns the list of all the available meta boxes.
*
* @param {Object} state Global application state.
*
* @return {Array} List of meta boxes.
*/
const getAllMetaBoxes = Object(rememo["a" /* default */])(state => {
return Object(external_lodash_["flatten"])(Object(external_lodash_["values"])(state.metaBoxes.locations));
}, state => [state.metaBoxes.locations]);
/**
* Returns true if the post is using Meta Boxes
*
* @param {Object} state Global application state
*
* @return {boolean} Whether there are metaboxes or not.
*/
function hasMetaBoxes(state) {
return getActiveMetaBoxLocations(state).length > 0;
}
/**
* Returns true if the Meta Boxes are being saved.
*
* @param {Object} state Global application state.
*
* @return {boolean} Whether the metaboxes are being saved.
*/
function selectors_isSavingMetaBoxes(state) {
return state.metaBoxes.isSaving;
}
/**
* Returns the current editing canvas device type.
*
* @param {Object} state Global application state.
*
* @return {string} Device type.
*/
function __experimentalGetPreviewDeviceType(state) {
return state.deviceType;
}
/**
* Returns true if the inserter is opened.
*
* @param {Object} state Global application state.
*
* @return {boolean} Whether the inserter is opened.
*/
function isInserterOpened(state) {
return !!state.blockInserterPanel;
}
/**
* Get the insertion point for the inserter.
*
* @param {Object} state Global application state.
*
* @return {Object} The root client ID and index to insert at.
*/
function __experimentalGetInsertionPoint(state) {
const {
rootClientId,
insertionIndex
} = state.blockInserterPanel;
return {
rootClientId,
insertionIndex
};
}
/**
* Returns true if the list view is opened.
*
* @param {Object} state Global application state.
*
* @return {boolean} Whether the list view is opened.
*/
function isListViewOpened(state) {
return state.listViewPanel;
}
/**
* Returns true if the template editing mode is enabled.
*
* @param {Object} state Global application state.
*
* @return {boolean} Whether we're editing the template.
*/
function selectors_isEditingTemplate(state) {
return state.isEditingTemplate;
}
/**
* Retrieves the template of the currently edited post.
*
* @return {Object?} Post Template.
*/
const getEditedPostTemplate = Object(external_wp_data_["createRegistrySelector"])(select => () => {
const currentTemplate = select(external_wp_editor_["store"]).getEditedPostAttribute('template');
if (currentTemplate) {
var _select$getEntityReco;
const templateWithSameSlug = (_select$getEntityReco = select(external_wp_coreData_["store"]).getEntityRecords('postType', 'wp_template')) === null || _select$getEntityReco === void 0 ? void 0 : _select$getEntityReco.find(template => template.slug === currentTemplate);
if (!templateWithSameSlug) {
return templateWithSameSlug;
}
return select(external_wp_coreData_["store"]).getEditedEntityRecord('postType', 'wp_template', templateWithSameSlug.id);
}
const post = select(external_wp_editor_["store"]).getCurrentPost();
if (post.link && post.status !== 'auto-draft') {
return select(external_wp_coreData_["store"]).__experimentalGetTemplateForLink(post.link);
}
return null;
});
// EXTERNAL MODULE: ./node_modules/@wordpress/edit-post/build-module/store/constants.js
var constants = __webpack_require__("0dt7");
// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/store/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const storeConfig = {
reducer: reducer,
actions: actions_namespaceObject,
selectors: selectors_namespaceObject,
controls: external_wp_dataControls_["controls"],
persist: ['preferences']
};
/**
* Store definition for the edit post namespace.
*
* @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore
*
* @type {Object}
*/
const store = Object(external_wp_data_["createReduxStore"])(constants["a" /* STORE_NAME */], storeConfig); // Ideally we use register instead of register store.
Object(external_wp_data_["registerStore"])(constants["a" /* STORE_NAME */], storeConfig);
/***/ }),
/***/ "TSYQ":
/***/ (function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
Copyright (c) 2018 Jed Watson.
Licensed under the MIT License (MIT), see
http://jedwatson.github.io/classnames
*/
/* global define */
(function () {
'use strict';
var hasOwn = {}.hasOwnProperty;
function classNames() {
var classes = [];
for (var i = 0; i < arguments.length; i++) {
var arg = arguments[i];
if (!arg) continue;
var argType = typeof arg;
if (argType === 'string' || argType === 'number') {
classes.push(arg);
} else if (Array.isArray(arg)) {
if (arg.length) {
var inner = classNames.apply(null, arg);
if (inner) {
classes.push(inner);
}
}
} else if (argType === 'object') {
if (arg.toString === Object.prototype.toString) {
for (var key in arg) {
if (hasOwn.call(arg, key) && arg[key]) {
classes.push(key);
}
}
} else {
classes.push(arg.toString());
}
}
}
return classes.join(' ');
}
if ( true && module.exports) {
classNames.default = classNames;
module.exports = classNames;
} else if (true) {
// register as 'classnames', consistent with npm package name
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function () {
return classNames;
}).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
} else {}
}());
/***/ }),
/***/ "Tqx9":
/***/ (function(module, exports) {
(function() { module.exports = window["wp"]["primitives"]; }());
/***/ }),
/***/ "TvNi":
/***/ (function(module, exports) {
(function() { module.exports = window["wp"]["plugins"]; }());
/***/ }),
/***/ "U60i":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
// EXPORTS
__webpack_require__.d(__webpack_exports__, "g", function() { return /* reexport */ store; });
__webpack_require__.d(__webpack_exports__, "b", function() { return /* reexport */ complementary_area; });
__webpack_require__.d(__webpack_exports__, "c", function() { return /* reexport */ ComplementaryAreaMoreMenuItem; });
__webpack_require__.d(__webpack_exports__, "d", function() { return /* reexport */ fullscreen_mode; });
__webpack_require__.d(__webpack_exports__, "e", function() { return /* reexport */ interface_skeleton; });
__webpack_require__.d(__webpack_exports__, "f", function() { return /* reexport */ pinned_items; });
__webpack_require__.d(__webpack_exports__, "a", function() { return /* reexport */ action_item; });
// NAMESPACE OBJECT: ./node_modules/@wordpress/interface/build-module/store/actions.js
var actions_namespaceObject = {};
__webpack_require__.r(actions_namespaceObject);
__webpack_require__.d(actions_namespaceObject, "enableComplementaryArea", function() { return actions_enableComplementaryArea; });
__webpack_require__.d(actions_namespaceObject, "disableComplementaryArea", function() { return actions_disableComplementaryArea; });
__webpack_require__.d(actions_namespaceObject, "pinItem", function() { return actions_pinItem; });
__webpack_require__.d(actions_namespaceObject, "unpinItem", function() { return actions_unpinItem; });
// NAMESPACE OBJECT: ./node_modules/@wordpress/interface/build-module/store/selectors.js
var selectors_namespaceObject = {};
__webpack_require__.r(selectors_namespaceObject);
__webpack_require__.d(selectors_namespaceObject, "getActiveComplementaryArea", function() { return selectors_getActiveComplementaryArea; });
__webpack_require__.d(selectors_namespaceObject, "isItemPinned", function() { return selectors_isItemPinned; });
// EXTERNAL MODULE: external ["wp","data"]
var external_wp_data_ = __webpack_require__("1ZqX");
// EXTERNAL MODULE: external "lodash"
var external_lodash_ = __webpack_require__("YLtl");
// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/store/reducer.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Reducer to keep tract of the active area per scope.
*
* @param {boolean} state Previous state.
* @param {Object} action Action object.
* @param {string} action.type Action type.
* @param {string} action.itemType Type of item.
* @param {string} action.scope Item scope.
* @param {string} action.item Item name.
*
* @return {Object} Updated state.
*/
function singleEnableItems(state = {}, {
type,
itemType,
scope,
item
}) {
if (type !== 'SET_SINGLE_ENABLE_ITEM' || !itemType || !scope) {
return state;
}
return { ...state,
[itemType]: { ...state[itemType],
[scope]: item || null
}
};
}
/**
* Reducer keeping track of the "pinned" items per scope.
*
* @param {boolean} state Previous state.
* @param {Object} action Action object.
* @param {string} action.type Action type.
* @param {string} action.itemType Type of item.
* @param {string} action.scope Item scope.
* @param {string} action.item Item name.
* @param {boolean} action.isEnable Whether the item is pinned.
*
* @return {Object} Updated state.
*/
function multipleEnableItems(state = {}, {
type,
itemType,
scope,
item,
isEnable
}) {
if (type !== 'SET_MULTIPLE_ENABLE_ITEM' || !itemType || !scope || !item || Object(external_lodash_["get"])(state, [itemType, scope, item]) === isEnable) {
return state;
}
const currentTypeState = state[itemType] || {};
const currentScopeState = currentTypeState[scope] || {};
return { ...state,
[itemType]: { ...currentTypeState,
[scope]: { ...currentScopeState,
[item]: isEnable || false
}
}
};
}
const enableItems = Object(external_wp_data_["combineReducers"])({
singleEnableItems,
multipleEnableItems
});
/* harmony default export */ var reducer = (Object(external_wp_data_["combineReducers"])({
enableItems
}));
// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/store/actions.js
/**
* Returns an action object used in signalling that an active area should be changed.
*
* @param {string} itemType Type of item.
* @param {string} scope Item scope.
* @param {string} item Item identifier.
*
* @return {Object} Action object.
*/
function setSingleEnableItem(itemType, scope, item) {
return {
type: 'SET_SINGLE_ENABLE_ITEM',
itemType,
scope,
item
};
}
/**
* Returns an action object used in signalling that a complementary item should be enabled.
*
* @param {string} scope Complementary area scope.
* @param {string} area Area identifier.
*
* @return {Object} Action object.
*/
function actions_enableComplementaryArea(scope, area) {
return setSingleEnableItem('complementaryArea', scope, area);
}
/**
* Returns an action object used in signalling that the complementary area of a given scope should be disabled.
*
* @param {string} scope Complementary area scope.
*
* @return {Object} Action object.
*/
function actions_disableComplementaryArea(scope) {
return setSingleEnableItem('complementaryArea', scope, undefined);
}
/**
* Returns an action object to make an area enabled/disabled.
*
* @param {string} itemType Type of item.
* @param {string} scope Item scope.
* @param {string} item Item identifier.
* @param {boolean} isEnable Boolean indicating if an area should be pinned or not.
*
* @return {Object} Action object.
*/
function setMultipleEnableItem(itemType, scope, item, isEnable) {
return {
type: 'SET_MULTIPLE_ENABLE_ITEM',
itemType,
scope,
item,
isEnable
};
}
/**
* Returns an action object used in signalling that an item should be pinned.
*
* @param {string} scope Item scope.
* @param {string} itemId Item identifier.
*
* @return {Object} Action object.
*/
function actions_pinItem(scope, itemId) {
return setMultipleEnableItem('pinnedItems', scope, itemId, true);
}
/**
* Returns an action object used in signalling that an item should be unpinned.
*
* @param {string} scope Item scope.
* @param {string} itemId Item identifier.
*
* @return {Object} Action object.
*/
function actions_unpinItem(scope, itemId) {
return setMultipleEnableItem('pinnedItems', scope, itemId, false);
}
// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/store/selectors.js
/**
* External dependencies
*/
/**
* Returns the item that is enabled in a given scope.
*
* @param {Object} state Global application state.
* @param {string} itemType Type of item.
* @param {string} scope Item scope.
*
* @return {?string|null} The item that is enabled in the passed scope and type.
*/
function getSingleEnableItem(state, itemType, scope) {
return Object(external_lodash_["get"])(state.enableItems.singleEnableItems, [itemType, scope]);
}
/**
* Returns the complementary area that is active in a given scope.
*
* @param {Object} state Global application state.
* @param {string} scope Item scope.
*
* @return {string} The complementary area that is active in the given scope.
*/
function selectors_getActiveComplementaryArea(state, scope) {
return getSingleEnableItem(state, 'complementaryArea', scope);
}
/**
* Returns a boolean indicating if an item is enabled or not in a given scope.
*
* @param {Object} state Global application state.
* @param {string} itemType Type of item.
* @param {string} scope Scope.
* @param {string} item Item to check.
*
* @return {boolean|undefined} True if the item is enabled, false otherwise if the item is explicitly disabled, and undefined if there is no information for that item.
*/
function isMultipleEnabledItemEnabled(state, itemType, scope, item) {
return Object(external_lodash_["get"])(state.enableItems.multipleEnableItems, [itemType, scope, item]);
}
/**
* Returns a boolean indicating if an item is pinned or not.
*
* @param {Object} state Global application state.
* @param {string} scope Scope.
* @param {string} item Item to check.
*
* @return {boolean} True if the item is pinned and false otherwise.
*/
function selectors_isItemPinned(state, scope, item) {
return isMultipleEnabledItemEnabled(state, 'pinnedItems', scope, item) !== false;
}
// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/store/constants.js
/**
* The identifier for the data store.
*
* @type {string}
*/
const STORE_NAME = 'core/interface';
// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/store/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* Store definition for the interface namespace.
*
* @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore
*
* @type {Object}
*/
const store = Object(external_wp_data_["createReduxStore"])(STORE_NAME, {
reducer: reducer,
actions: actions_namespaceObject,
selectors: selectors_namespaceObject,
persist: ['enableItems']
}); // Once we build a more generic persistence plugin that works across types of stores
// we'd be able to replace this with a register call.
Object(external_wp_data_["registerStore"])(STORE_NAME, {
reducer: reducer,
actions: actions_namespaceObject,
selectors: selectors_namespaceObject,
persist: ['enableItems']
});
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/extends.js
var esm_extends = __webpack_require__("wx14");
// EXTERNAL MODULE: external ["wp","element"]
var external_wp_element_ = __webpack_require__("GRId");
// EXTERNAL MODULE: ./node_modules/classnames/index.js
var classnames = __webpack_require__("TSYQ");
var classnames_default = /*#__PURE__*/__webpack_require__.n(classnames);
// EXTERNAL MODULE: external ["wp","components"]
var external_wp_components_ = __webpack_require__("tI+e");
// EXTERNAL MODULE: external ["wp","i18n"]
var external_wp_i18n_ = __webpack_require__("l3Sj");
// EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/check.js
var check = __webpack_require__("RMJe");
// EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/star-filled.js
var star_filled = __webpack_require__("URob");
// EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/star-empty.js
var star_empty = __webpack_require__("Xxwi");
// EXTERNAL MODULE: external ["wp","viewport"]
var external_wp_viewport_ = __webpack_require__("KEfo");
// EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/close-small.js
var close_small = __webpack_require__("bWcr");
// EXTERNAL MODULE: external ["wp","plugins"]
var external_wp_plugins_ = __webpack_require__("TvNi");
// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/complementary-area-context/index.js
/**
* WordPress dependencies
*/
/* harmony default export */ var complementary_area_context = (Object(external_wp_plugins_["withPluginContext"])((context, ownProps) => {
return {
icon: ownProps.icon || context.icon,
identifier: ownProps.identifier || `${context.name}/${ownProps.name}`
};
}));
// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/complementary-area-toggle/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function ComplementaryAreaToggle({
as = external_wp_components_["Button"],
scope,
identifier,
icon,
selectedIcon,
...props
}) {
const ComponentToUse = as;
const isSelected = Object(external_wp_data_["useSelect"])(select => select(store).getActiveComplementaryArea(scope) === identifier, [identifier]);
const {
enableComplementaryArea,
disableComplementaryArea
} = Object(external_wp_data_["useDispatch"])(store);
return Object(external_wp_element_["createElement"])(ComponentToUse, Object(esm_extends["a" /* default */])({
icon: selectedIcon && isSelected ? selectedIcon : icon,
onClick: () => {
if (isSelected) {
disableComplementaryArea(scope);
} else {
enableComplementaryArea(scope, identifier);
}
}
}, Object(external_lodash_["omit"])(props, ['name'])));
}
/* harmony default export */ var complementary_area_toggle = (complementary_area_context(ComplementaryAreaToggle));
// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/complementary-area-header/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const ComplementaryAreaHeader = ({
smallScreenTitle,
children,
className,
toggleButtonProps
}) => {
const toggleButton = Object(external_wp_element_["createElement"])(complementary_area_toggle, Object(esm_extends["a" /* default */])({
icon: close_small["a" /* default */]
}, toggleButtonProps));
return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])("div", {
className: "components-panel__header interface-complementary-area-header__small"
}, smallScreenTitle && Object(external_wp_element_["createElement"])("span", {
className: "interface-complementary-area-header__small-title"
}, smallScreenTitle), toggleButton), Object(external_wp_element_["createElement"])("div", {
className: classnames_default()('components-panel__header', 'interface-complementary-area-header', className),
tabIndex: -1
}, children, toggleButton));
};
/* harmony default export */ var complementary_area_header = (ComplementaryAreaHeader);
// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/action-item/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
function ActionItemSlot({
name,
as: Component = external_wp_components_["ButtonGroup"],
fillProps = {},
bubblesVirtually,
...props
}) {
return Object(external_wp_element_["createElement"])(external_wp_components_["Slot"], {
name: name,
bubblesVirtually: bubblesVirtually,
fillProps: fillProps
}, fills => {
if (Object(external_lodash_["isEmpty"])(external_wp_element_["Children"].toArray(fills))) {
return null;
} // Special handling exists for backward compatibility.
// It ensures that menu items created by plugin authors aren't
// duplicated with automatically injected menu items coming
// from pinnable plugin sidebars.
// @see https://github.com/WordPress/gutenberg/issues/14457
const initializedByPlugins = [];
external_wp_element_["Children"].forEach(fills, ({
props: {
__unstableExplicitMenuItem,
__unstableTarget
}
}) => {
if (__unstableTarget && __unstableExplicitMenuItem) {
initializedByPlugins.push(__unstableTarget);
}
});
const children = external_wp_element_["Children"].map(fills, child => {
if (!child.props.__unstableExplicitMenuItem && initializedByPlugins.includes(child.props.__unstableTarget)) {
return null;
}
return child;
});
return Object(external_wp_element_["createElement"])(Component, props, children);
});
}
function ActionItem({
name,
as: Component = external_wp_components_["Button"],
onClick,
...props
}) {
return Object(external_wp_element_["createElement"])(external_wp_components_["Fill"], {
name: name
}, ({
onClick: fpOnClick
}) => {
return Object(external_wp_element_["createElement"])(Component, Object(esm_extends["a" /* default */])({
onClick: onClick || fpOnClick ? (...args) => {
(onClick || external_lodash_["noop"])(...args);
(fpOnClick || external_lodash_["noop"])(...args);
} : undefined
}, props));
});
}
ActionItem.Slot = ActionItemSlot;
/* harmony default export */ var action_item = (ActionItem);
// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/complementary-area-more-menu-item/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const PluginsMenuItem = props => // Menu item is marked with unstable prop for backward compatibility.
// They are removed so they don't leak to DOM elements.
// @see https://github.com/WordPress/gutenberg/issues/14457
Object(external_wp_element_["createElement"])(external_wp_components_["MenuItem"], Object(external_lodash_["omit"])(props, ['__unstableExplicitMenuItem', '__unstableTarget']));
function ComplementaryAreaMoreMenuItem({
scope,
target,
__unstableExplicitMenuItem,
...props
}) {
return Object(external_wp_element_["createElement"])(complementary_area_toggle, Object(esm_extends["a" /* default */])({
as: toggleProps => {
return Object(external_wp_element_["createElement"])(action_item, Object(esm_extends["a" /* default */])({
__unstableExplicitMenuItem: __unstableExplicitMenuItem,
__unstableTarget: `${scope}/${target}`,
as: PluginsMenuItem,
name: `${scope}/plugin-more-menu`
}, toggleProps));
},
role: "menuitemcheckbox",
selectedIcon: check["a" /* default */],
name: target,
scope: scope
}, props));
}
// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/pinned-items/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
function PinnedItems({
scope,
...props
}) {
return Object(external_wp_element_["createElement"])(external_wp_components_["Fill"], Object(esm_extends["a" /* default */])({
name: `PinnedItems/${scope}`
}, props));
}
function PinnedItemsSlot({
scope,
className,
...props
}) {
return Object(external_wp_element_["createElement"])(external_wp_components_["Slot"], Object(esm_extends["a" /* default */])({
name: `PinnedItems/${scope}`
}, props), fills => !Object(external_lodash_["isEmpty"])(fills) && Object(external_wp_element_["createElement"])("div", {
className: classnames_default()(className, 'interface-pinned-items')
}, fills));
}
PinnedItems.Slot = PinnedItemsSlot;
/* harmony default export */ var pinned_items = (PinnedItems);
// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/complementary-area/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function ComplementaryAreaSlot({
scope,
...props
}) {
return Object(external_wp_element_["createElement"])(external_wp_components_["Slot"], Object(esm_extends["a" /* default */])({
name: `ComplementaryArea/${scope}`
}, props));
}
function ComplementaryAreaFill({
scope,
children,
className
}) {
return Object(external_wp_element_["createElement"])(external_wp_components_["Fill"], {
name: `ComplementaryArea/${scope}`
}, Object(external_wp_element_["createElement"])("div", {
className: className
}, children));
}
function useAdjustComplementaryListener(scope, identifier, activeArea, isActive, isSmall) {
const previousIsSmall = Object(external_wp_element_["useRef"])(false);
const shouldOpenWhenNotSmall = Object(external_wp_element_["useRef"])(false);
const {
enableComplementaryArea,
disableComplementaryArea
} = Object(external_wp_data_["useDispatch"])(store);
Object(external_wp_element_["useEffect"])(() => {
// If the complementary area is active and the editor is switching from a big to a small window size.
if (isActive && isSmall && !previousIsSmall.current) {
// Disable the complementary area.
disableComplementaryArea(scope); // Flag the complementary area to be reopened when the window size goes from small to big.
shouldOpenWhenNotSmall.current = true;
} else if ( // If there is a flag indicating the complementary area should be enabled when we go from small to big window size
// and we are going from a small to big window size.
shouldOpenWhenNotSmall.current && !isSmall && previousIsSmall.current) {
// Remove the flag indicating the complementary area should be enabled.
shouldOpenWhenNotSmall.current = false; // Enable the complementary area.
enableComplementaryArea(scope, identifier);
} else if ( // If the flag is indicating the current complementary should be reopened but another complementary area becomes active,
// remove the flag.
shouldOpenWhenNotSmall.current && activeArea && activeArea !== identifier) {
shouldOpenWhenNotSmall.current = false;
}
if (isSmall !== previousIsSmall.current) {
previousIsSmall.current = isSmall;
}
}, [isActive, isSmall, scope, identifier, activeArea]);
}
function ComplementaryArea({
children,
className,
closeLabel = Object(external_wp_i18n_["__"])('Close plugin'),
identifier,
header,
headerClassName,
icon,
isPinnable = true,
panelClassName,
scope,
name,
smallScreenTitle,
title,
toggleShortcut,
isActiveByDefault,
showIconLabels = false
}) {
const {
isActive,
isPinned,
activeArea,
isSmall,
isLarge
} = Object(external_wp_data_["useSelect"])(select => {
const {
getActiveComplementaryArea,
isItemPinned
} = select(store);
const _activeArea = getActiveComplementaryArea(scope);
return {
isActive: _activeArea === identifier,
isPinned: isItemPinned(scope, identifier),
activeArea: _activeArea,
isSmall: select(external_wp_viewport_["store"]).isViewportMatch('< medium'),
isLarge: select(external_wp_viewport_["store"]).isViewportMatch('large')
};
}, [identifier, scope]);
useAdjustComplementaryListener(scope, identifier, activeArea, isActive, isSmall);
const {
enableComplementaryArea,
disableComplementaryArea,
pinItem,
unpinItem
} = Object(external_wp_data_["useDispatch"])(store);
Object(external_wp_element_["useEffect"])(() => {
if (isActiveByDefault && activeArea === undefined && !isSmall) {
enableComplementaryArea(scope, identifier);
}
}, [activeArea, isActiveByDefault, scope, identifier, isSmall]);
return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, isPinnable && Object(external_wp_element_["createElement"])(pinned_items, {
scope: scope
}, isPinned && Object(external_wp_element_["createElement"])(complementary_area_toggle, {
scope: scope,
identifier: identifier,
isPressed: isActive && (!showIconLabels || isLarge),
"aria-expanded": isActive,
label: title,
icon: showIconLabels ? check["a" /* default */] : icon,
showTooltip: !showIconLabels,
isTertiary: showIconLabels
})), name && isPinnable && Object(external_wp_element_["createElement"])(ComplementaryAreaMoreMenuItem, {
target: name,
scope: scope,
icon: icon
}, title), isActive && Object(external_wp_element_["createElement"])(ComplementaryAreaFill, {
className: classnames_default()('interface-complementary-area', className),
scope: scope
}, Object(external_wp_element_["createElement"])(complementary_area_header, {
className: headerClassName,
closeLabel: closeLabel,
onClose: () => disableComplementaryArea(scope),
smallScreenTitle: smallScreenTitle,
toggleButtonProps: {
label: closeLabel,
shortcut: toggleShortcut,
scope,
identifier
}
}, header || Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])("strong", null, title), isPinnable && Object(external_wp_element_["createElement"])(external_wp_components_["Button"], {
className: "interface-complementary-area__pin-unpin-item",
icon: isPinned ? star_filled["a" /* default */] : star_empty["a" /* default */],
label: isPinned ? Object(external_wp_i18n_["__"])('Unpin from toolbar') : Object(external_wp_i18n_["__"])('Pin to toolbar'),
onClick: () => (isPinned ? unpinItem : pinItem)(scope, identifier),
isPressed: isPinned,
"aria-expanded": isPinned
}))), Object(external_wp_element_["createElement"])(external_wp_components_["Panel"], {
className: panelClassName
}, children)));
}
const ComplementaryAreaWrapped = complementary_area_context(ComplementaryArea);
ComplementaryAreaWrapped.Slot = ComplementaryAreaSlot;
/* harmony default export */ var complementary_area = (ComplementaryAreaWrapped);
// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/fullscreen-mode/index.js
/**
* WordPress dependencies
*/
class fullscreen_mode_FullscreenMode extends external_wp_element_["Component"] {
componentDidMount() {
this.isSticky = false;
this.sync(); // `is-fullscreen-mode` is set in PHP as a body class by Gutenberg, and this causes
// `sticky-menu` to be applied by WordPress and prevents the admin menu being scrolled
// even if `is-fullscreen-mode` is then removed. Let's remove `sticky-menu` here as
// a consequence of the FullscreenMode setup
if (document.body.classList.contains('sticky-menu')) {
this.isSticky = true;
document.body.classList.remove('sticky-menu');
}
}
componentWillUnmount() {
if (this.isSticky) {
document.body.classList.add('sticky-menu');
}
if (this.props.isActive) {
document.body.classList.remove('is-fullscreen-mode');
}
}
componentDidUpdate(prevProps) {
if (this.props.isActive !== prevProps.isActive) {
this.sync();
}
}
sync() {
const {
isActive
} = this.props;
if (isActive) {
document.body.classList.add('is-fullscreen-mode');
} else {
document.body.classList.remove('is-fullscreen-mode');
}
}
render() {
return null;
}
}
/* harmony default export */ var fullscreen_mode = (fullscreen_mode_FullscreenMode);
// EXTERNAL MODULE: external ["wp","compose"]
var external_wp_compose_ = __webpack_require__("K9lf");
// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/interface-skeleton/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
function useHTMLClass(className) {
Object(external_wp_element_["useEffect"])(() => {
const element = document && document.querySelector(`html:not(.${className})`);
if (!element) {
return;
}
element.classList.toggle(className);
return () => {
element.classList.toggle(className);
};
}, [className]);
}
function InterfaceSkeleton({
footer,
header,
sidebar,
secondarySidebar,
content,
drawer,
actions,
labels,
className,
shortcuts
}, ref) {
const fallbackRef = Object(external_wp_element_["useRef"])();
const regionsClassName = Object(external_wp_components_["__unstableUseNavigateRegions"])(fallbackRef, shortcuts);
useHTMLClass('interface-interface-skeleton__html-container');
const defaultLabels = {
/* translators: accessibility text for the nav bar landmark region. */
drawer: Object(external_wp_i18n_["__"])('Drawer'),
/* translators: accessibility text for the top bar landmark region. */
header: Object(external_wp_i18n_["__"])('Header'),
/* translators: accessibility text for the content landmark region. */
body: Object(external_wp_i18n_["__"])('Content'),
/* translators: accessibility text for the secondary sidebar landmark region. */
secondarySidebar: Object(external_wp_i18n_["__"])('Block Library'),
/* translators: accessibility text for the settings landmark region. */
sidebar: Object(external_wp_i18n_["__"])('Settings'),
/* translators: accessibility text for the publish landmark region. */
actions: Object(external_wp_i18n_["__"])('Publish'),
/* translators: accessibility text for the footer landmark region. */
footer: Object(external_wp_i18n_["__"])('Footer')
};
const mergedLabels = { ...defaultLabels,
...labels
};
return Object(external_wp_element_["createElement"])("div", {
ref: Object(external_wp_compose_["useMergeRefs"])([ref, fallbackRef]),
className: classnames_default()(className, 'interface-interface-skeleton', regionsClassName, !!footer && 'has-footer')
}, !!drawer && Object(external_wp_element_["createElement"])("div", {
className: "interface-interface-skeleton__drawer",
role: "region",
"aria-label": mergedLabels.drawer
}, drawer), Object(external_wp_element_["createElement"])("div", {
className: "interface-interface-skeleton__editor"
}, !!header && Object(external_wp_element_["createElement"])("div", {
className: "interface-interface-skeleton__header",
role: "region",
"aria-label": mergedLabels.header,
tabIndex: "-1"
}, header), Object(external_wp_element_["createElement"])("div", {
className: "interface-interface-skeleton__body"
}, !!secondarySidebar && Object(external_wp_element_["createElement"])("div", {
className: "interface-interface-skeleton__secondary-sidebar",
role: "region",
"aria-label": mergedLabels.secondarySidebar,
tabIndex: "-1"
}, secondarySidebar), Object(external_wp_element_["createElement"])("div", {
className: "interface-interface-skeleton__content",
role: "region",
"aria-label": mergedLabels.body,
tabIndex: "-1"
}, content), !!sidebar && Object(external_wp_element_["createElement"])("div", {
className: "interface-interface-skeleton__sidebar",
role: "region",
"aria-label": mergedLabels.sidebar,
tabIndex: "-1"
}, sidebar), !!actions && Object(external_wp_element_["createElement"])("div", {
className: "interface-interface-skeleton__actions",
role: "region",
"aria-label": mergedLabels.actions,
tabIndex: "-1"
}, actions))), !!footer && Object(external_wp_element_["createElement"])("div", {
className: "interface-interface-skeleton__footer",
role: "region",
"aria-label": mergedLabels.footer,
tabIndex: "-1"
}, footer));
}
/* harmony default export */ var interface_skeleton = (Object(external_wp_element_["forwardRef"])(InterfaceSkeleton));
// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/index.js
// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/index.js
/***/ }),
/***/ "URob":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId");
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("Tqx9");
/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__);
/**
* WordPress dependencies
*/
const starFilled = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], {
d: "M11.776 4.454a.25.25 0 01.448 0l2.069 4.192a.25.25 0 00.188.137l4.626.672a.25.25 0 01.139.426l-3.348 3.263a.25.25 0 00-.072.222l.79 4.607a.25.25 0 01-.362.263l-4.138-2.175a.25.25 0 00-.232 0l-4.138 2.175a.25.25 0 01-.363-.263l.79-4.607a.25.25 0 00-.071-.222L4.754 9.881a.25.25 0 01.139-.426l4.626-.672a.25.25 0 00.188-.137l2.069-4.192z"
}));
/* harmony default export */ __webpack_exports__["a"] = (starFilled);
/***/ }),
/***/ "VKE3":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId");
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("Tqx9");
/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__);
/**
* WordPress dependencies
*/
const moreVertical = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], {
d: "M13 19h-2v-2h2v2zm0-6h-2v-2h2v2zm0-6h-2V5h2v2z"
}));
/* harmony default export */ __webpack_exports__["a"] = (moreVertical);
/***/ }),
/***/ "Xxwi":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId");
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("Tqx9");
/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__);
/**
* WordPress dependencies
*/
const starEmpty = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], {
fillRule: "evenodd",
d: "M9.706 8.646a.25.25 0 01-.188.137l-4.626.672a.25.25 0 00-.139.427l3.348 3.262a.25.25 0 01.072.222l-.79 4.607a.25.25 0 00.362.264l4.138-2.176a.25.25 0 01.233 0l4.137 2.175a.25.25 0 00.363-.263l-.79-4.607a.25.25 0 01.072-.222l3.347-3.262a.25.25 0 00-.139-.427l-4.626-.672a.25.25 0 01-.188-.137l-2.069-4.192a.25.25 0 00-.448 0L9.706 8.646zM12 7.39l-.948 1.921a1.75 1.75 0 01-1.317.957l-2.12.308 1.534 1.495c.412.402.6.982.503 1.55l-.362 2.11 1.896-.997a1.75 1.75 0 011.629 0l1.895.997-.362-2.11a1.75 1.75 0 01.504-1.55l1.533-1.495-2.12-.308a1.75 1.75 0 01-1.317-.957L12 7.39z",
clipRule: "evenodd"
}));
/* harmony default export */ __webpack_exports__["a"] = (starEmpty);
/***/ }),
/***/ "Y5n4":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
// EXPORTS
__webpack_require__.d(__webpack_exports__, "a", function() { return /* reexport */ enable_custom_fields; });
__webpack_require__.d(__webpack_exports__, "c", function() { return /* reexport */ enable_panel; });
__webpack_require__.d(__webpack_exports__, "d", function() { return /* reexport */ enable_plugin_document_setting_panel; });
__webpack_require__.d(__webpack_exports__, "e", function() { return /* reexport */ enable_publish_sidebar; });
__webpack_require__.d(__webpack_exports__, "b", function() { return /* reexport */ enable_feature; });
// EXTERNAL MODULE: external ["wp","element"]
var external_wp_element_ = __webpack_require__("GRId");
// EXTERNAL MODULE: external ["wp","i18n"]
var external_wp_i18n_ = __webpack_require__("l3Sj");
// EXTERNAL MODULE: external ["wp","components"]
var external_wp_components_ = __webpack_require__("tI+e");
// EXTERNAL MODULE: external ["wp","data"]
var external_wp_data_ = __webpack_require__("1ZqX");
// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/preferences-modal/options/base.js
/**
* WordPress dependencies
*/
function BaseOption({
help,
label,
isChecked,
onChange,
children
}) {
return Object(external_wp_element_["createElement"])("div", {
className: "edit-post-preferences-modal__option"
}, Object(external_wp_element_["createElement"])(external_wp_components_["ToggleControl"], {
help: help,
label: label,
checked: isChecked,
onChange: onChange
}), children);
}
/* harmony default export */ var base = (BaseOption);
// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/preferences-modal/options/enable-custom-fields.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function CustomFieldsConfirmation({
willEnable
}) {
const [isReloading, setIsReloading] = Object(external_wp_element_["useState"])(false);
return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])("p", {
className: "edit-post-preferences-modal__custom-fields-confirmation-message"
}, Object(external_wp_i18n_["__"])('A page reload is required for this change. Make sure your content is saved before reloading.')), Object(external_wp_element_["createElement"])(external_wp_components_["Button"], {
className: "edit-post-preferences-modal__custom-fields-confirmation-button",
isSecondary: true,
isBusy: isReloading,
disabled: isReloading,
onClick: () => {
setIsReloading(true);
document.getElementById('toggle-custom-fields-form').submit();
}
}, willEnable ? Object(external_wp_i18n_["__"])('Enable & Reload') : Object(external_wp_i18n_["__"])('Disable & Reload')));
}
function EnableCustomFieldsOption({
label,
areCustomFieldsEnabled
}) {
const [isChecked, setIsChecked] = Object(external_wp_element_["useState"])(areCustomFieldsEnabled);
return Object(external_wp_element_["createElement"])(base, {
label: label,
isChecked: isChecked,
onChange: setIsChecked
}, isChecked !== areCustomFieldsEnabled && Object(external_wp_element_["createElement"])(CustomFieldsConfirmation, {
willEnable: isChecked
}));
}
/* harmony default export */ var enable_custom_fields = (Object(external_wp_data_["withSelect"])(select => ({
areCustomFieldsEnabled: !!select('core/editor').getEditorSettings().enableCustomFields
}))(EnableCustomFieldsOption));
// EXTERNAL MODULE: external ["wp","compose"]
var external_wp_compose_ = __webpack_require__("K9lf");
// EXTERNAL MODULE: ./node_modules/@wordpress/edit-post/build-module/store/index.js + 5 modules
var store = __webpack_require__("T40v");
// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/preferences-modal/options/enable-panel.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/* harmony default export */ var enable_panel = (Object(external_wp_compose_["compose"])(Object(external_wp_data_["withSelect"])((select, {
panelName
}) => {
const {
isEditorPanelEnabled,
isEditorPanelRemoved
} = select(store["a" /* store */]);
return {
isRemoved: isEditorPanelRemoved(panelName),
isChecked: isEditorPanelEnabled(panelName)
};
}), Object(external_wp_compose_["ifCondition"])(({
isRemoved
}) => !isRemoved), Object(external_wp_data_["withDispatch"])((dispatch, {
panelName
}) => ({
onChange: () => dispatch(store["a" /* store */]).toggleEditorPanelEnabled(panelName)
})))(base));
// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/preferences-modal/options/enable-plugin-document-setting-panel.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const {
Fill,
Slot
} = Object(external_wp_components_["createSlotFill"])('EnablePluginDocumentSettingPanelOption');
const EnablePluginDocumentSettingPanelOption = ({
label,
panelName
}) => Object(external_wp_element_["createElement"])(Fill, null, Object(external_wp_element_["createElement"])(enable_panel, {
label: label,
panelName: panelName
}));
EnablePluginDocumentSettingPanelOption.Slot = Slot;
/* harmony default export */ var enable_plugin_document_setting_panel = (EnablePluginDocumentSettingPanelOption);
// EXTERNAL MODULE: external ["wp","viewport"]
var external_wp_viewport_ = __webpack_require__("KEfo");
// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/preferences-modal/options/enable-publish-sidebar.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/* harmony default export */ var enable_publish_sidebar = (Object(external_wp_compose_["compose"])(Object(external_wp_data_["withSelect"])(select => ({
isChecked: select('core/editor').isPublishSidebarEnabled()
})), Object(external_wp_data_["withDispatch"])(dispatch => {
const {
enablePublishSidebar,
disablePublishSidebar
} = dispatch('core/editor');
return {
onChange: isEnabled => isEnabled ? enablePublishSidebar() : disablePublishSidebar()
};
}), // In < medium viewports we override this option and always show the publish sidebar.
// See the edit-post's header component for the specific logic.
Object(external_wp_viewport_["ifViewportMatches"])('medium'))(base));
// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/preferences-modal/options/enable-feature.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/* harmony default export */ var enable_feature = (Object(external_wp_compose_["compose"])(Object(external_wp_data_["withSelect"])((select, {
featureName
}) => {
const {
isFeatureActive
} = select(store["a" /* store */]);
return {
isChecked: isFeatureActive(featureName)
};
}), Object(external_wp_data_["withDispatch"])((dispatch, {
featureName
}) => ({
onChange: () => dispatch(store["a" /* store */]).toggleFeature(featureName)
})))(base));
// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/preferences-modal/options/index.js
/***/ }),
/***/ "YLtl":
/***/ (function(module, exports) {
(function() { module.exports = window["lodash"]; }());
/***/ }),
/***/ "Z23Y":
/***/ (function(module, exports) {
(function() { module.exports = window["wp"]["warning"]; }());
/***/ }),
/***/ "axFQ":
/***/ (function(module, exports) {
(function() { module.exports = window["wp"]["blockEditor"]; }());
/***/ }),
/***/ "bWcr":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId");
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("Tqx9");
/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__);
/**
* WordPress dependencies
*/
const closeSmall = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["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"
}));
/* harmony default export */ __webpack_exports__["a"] = (closeSmall);
/***/ }),
/***/ "cDcd":
/***/ (function(module, exports) {
(function() { module.exports = window["React"]; }());
/***/ }),
/***/ "cjQ8":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId");
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("Tqx9");
/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__);
/**
* WordPress dependencies
*/
const arrowLeft = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], {
d: "M20 10.8H6.7l4.1-4.5-1.1-1.1-5.8 6.3 5.8 5.8 1.1-1.1-4-3.9H20z"
}));
/* harmony default export */ __webpack_exports__["a"] = (arrowLeft);
/***/ }),
/***/ "dSQ2":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
// ESM COMPAT FLAG
__webpack_require__.r(__webpack_exports__);
// EXPORTS
__webpack_require__.d(__webpack_exports__, "store", function() { return /* reexport */ store["a" /* store */]; });
__webpack_require__.d(__webpack_exports__, "reinitializeEditor", function() { return /* binding */ reinitializeEditor; });
__webpack_require__.d(__webpack_exports__, "initializeEditor", function() { return /* binding */ initializeEditor; });
__webpack_require__.d(__webpack_exports__, "PluginBlockSettingsMenuItem", function() { return /* reexport */ plugin_block_settings_menu_item; });
__webpack_require__.d(__webpack_exports__, "PluginDocumentSettingPanel", function() { return /* reexport */ plugin_document_setting_panel["a" /* default */]; });
__webpack_require__.d(__webpack_exports__, "PluginMoreMenuItem", function() { return /* reexport */ plugin_more_menu_item; });
__webpack_require__.d(__webpack_exports__, "PluginPostPublishPanel", function() { return /* reexport */ plugin_post_publish_panel; });
__webpack_require__.d(__webpack_exports__, "PluginPostStatusInfo", function() { return /* reexport */ plugin_post_status_info; });
__webpack_require__.d(__webpack_exports__, "PluginPrePublishPanel", function() { return /* reexport */ plugin_pre_publish_panel; });
__webpack_require__.d(__webpack_exports__, "PluginSidebar", function() { return /* reexport */ PluginSidebarEditPost; });
__webpack_require__.d(__webpack_exports__, "PluginSidebarMoreMenuItem", function() { return /* reexport */ PluginSidebarMoreMenuItem; });
__webpack_require__.d(__webpack_exports__, "__experimentalFullscreenModeClose", function() { return /* reexport */ fullscreen_mode_close; });
__webpack_require__.d(__webpack_exports__, "__experimentalMainDashboardButton", function() { return /* reexport */ main_dashboard_button; });
// EXTERNAL MODULE: external ["wp","element"]
var external_wp_element_ = __webpack_require__("GRId");
// EXTERNAL MODULE: external ["wp","coreData"]
var external_wp_coreData_ = __webpack_require__("jZUy");
// EXTERNAL MODULE: external ["wp","blockEditor"]
var external_wp_blockEditor_ = __webpack_require__("axFQ");
// EXTERNAL MODULE: external ["wp","editor"]
var external_wp_editor_ = __webpack_require__("jSdM");
// EXTERNAL MODULE: external ["wp","blockLibrary"]
var external_wp_blockLibrary_ = __webpack_require__("QyPg");
// EXTERNAL MODULE: external ["wp","hooks"]
var external_wp_hooks_ = __webpack_require__("g56x");
// EXTERNAL MODULE: external ["wp","mediaUtils"]
var external_wp_mediaUtils_ = __webpack_require__("6aBm");
// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/hooks/components/index.js
/**
* WordPress dependencies
*/
const replaceMediaUpload = () => external_wp_mediaUtils_["MediaUpload"];
Object(external_wp_hooks_["addFilter"])('editor.MediaUpload', 'core/edit-post/replace-media-upload', replaceMediaUpload);
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/extends.js
var esm_extends = __webpack_require__("wx14");
// EXTERNAL MODULE: external "lodash"
var external_lodash_ = __webpack_require__("YLtl");
// EXTERNAL MODULE: external ["wp","blocks"]
var external_wp_blocks_ = __webpack_require__("HSyU");
// EXTERNAL MODULE: external ["wp","components"]
var external_wp_components_ = __webpack_require__("tI+e");
// EXTERNAL MODULE: external ["wp","data"]
var external_wp_data_ = __webpack_require__("1ZqX");
// EXTERNAL MODULE: external ["wp","i18n"]
var external_wp_i18n_ = __webpack_require__("l3Sj");
// EXTERNAL MODULE: external ["wp","compose"]
var external_wp_compose_ = __webpack_require__("K9lf");
// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/hooks/validate-multiple-use/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
const enhance = Object(external_wp_compose_["compose"])(
/**
* For blocks whose block type doesn't support `multiple`, provides the
* wrapped component with `originalBlockClientId` -- a reference to the
* first block of the same type in the content -- if and only if that
* "original" block is not the current one. Thus, an inexisting
* `originalBlockClientId` prop signals that the block is valid.
*
* @param {WPComponent} WrappedBlockEdit A filtered BlockEdit instance.
*
* @return {WPComponent} Enhanced component with merged state data props.
*/
Object(external_wp_data_["withSelect"])((select, block) => {
const multiple = Object(external_wp_blocks_["hasBlockSupport"])(block.name, 'multiple', true); // For block types with `multiple` support, there is no "original
// block" to be found in the content, as the block itself is valid.
if (multiple) {
return {};
} // Otherwise, only pass `originalBlockClientId` if it refers to a different
// block from the current one.
const blocks = select(external_wp_blockEditor_["store"]).getBlocks();
const firstOfSameType = Object(external_lodash_["find"])(blocks, ({
name
}) => block.name === name);
const isInvalid = firstOfSameType && firstOfSameType.clientId !== block.clientId;
return {
originalBlockClientId: isInvalid && firstOfSameType.clientId
};
}), Object(external_wp_data_["withDispatch"])((dispatch, {
originalBlockClientId
}) => ({
selectFirst: () => dispatch(external_wp_blockEditor_["store"]).selectBlock(originalBlockClientId)
})));
const withMultipleValidation = Object(external_wp_compose_["createHigherOrderComponent"])(BlockEdit => {
return enhance(({
originalBlockClientId,
selectFirst,
...props
}) => {
if (!originalBlockClientId) {
return Object(external_wp_element_["createElement"])(BlockEdit, props);
}
const blockType = Object(external_wp_blocks_["getBlockType"])(props.name);
const outboundType = getOutboundType(props.name);
return [Object(external_wp_element_["createElement"])("div", {
key: "invalid-preview",
style: {
minHeight: '60px'
}
}, Object(external_wp_element_["createElement"])(BlockEdit, Object(esm_extends["a" /* default */])({
key: "block-edit"
}, props))), Object(external_wp_element_["createElement"])(external_wp_blockEditor_["Warning"], {
key: "multiple-use-warning",
actions: [Object(external_wp_element_["createElement"])(external_wp_components_["Button"], {
key: "find-original",
isSecondary: true,
onClick: selectFirst
}, Object(external_wp_i18n_["__"])('Find original')), Object(external_wp_element_["createElement"])(external_wp_components_["Button"], {
key: "remove",
isSecondary: true,
onClick: () => props.onReplace([])
}, Object(external_wp_i18n_["__"])('Remove')), outboundType && Object(external_wp_element_["createElement"])(external_wp_components_["Button"], {
key: "transform",
isSecondary: true,
onClick: () => props.onReplace(Object(external_wp_blocks_["createBlock"])(outboundType.name, props.attributes))
}, Object(external_wp_i18n_["__"])('Transform into:'), " ", outboundType.title)]
}, Object(external_wp_element_["createElement"])("strong", null, blockType.title, ": "), Object(external_wp_i18n_["__"])('This block can only be used once.'))];
});
}, 'withMultipleValidation');
/**
* Given a base block name, returns the default block type to which to offer
* transforms.
*
* @param {string} blockName Base block name.
*
* @return {?Object} The chosen default block type.
*/
function getOutboundType(blockName) {
// Grab the first outbound transform
const transform = Object(external_wp_blocks_["findTransform"])(Object(external_wp_blocks_["getBlockTransforms"])('to', blockName), ({
type,
blocks
}) => type === 'block' && blocks.length === 1 // What about when .length > 1?
);
if (!transform) {
return null;
}
return Object(external_wp_blocks_["getBlockType"])(transform.blocks[0]);
}
Object(external_wp_hooks_["addFilter"])('editor.BlockEdit', 'core/edit-post/validate-multiple-use/with-multiple-validation', withMultipleValidation);
// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/hooks/index.js
/**
* Internal dependencies
*/
// EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/external.js
var external = __webpack_require__("K+tz");
// EXTERNAL MODULE: external ["wp","plugins"]
var external_wp_plugins_ = __webpack_require__("TvNi");
// EXTERNAL MODULE: external ["wp","url"]
var external_wp_url_ = __webpack_require__("Mmq9");
// EXTERNAL MODULE: external ["wp","notices"]
var external_wp_notices_ = __webpack_require__("onLe");
// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/plugins/copy-content-menu-item/index.js
/**
* WordPress dependencies
*/
function CopyContentMenuItem() {
const {
createNotice
} = Object(external_wp_data_["useDispatch"])(external_wp_notices_["store"]);
const getText = Object(external_wp_data_["useSelect"])(select => () => select(external_wp_editor_["store"]).getEditedPostAttribute('content'), []);
function onSuccess() {
createNotice('info', Object(external_wp_i18n_["__"])('All content copied.'), {
isDismissible: true,
type: 'snackbar'
});
}
const ref = Object(external_wp_compose_["useCopyToClipboard"])(getText, onSuccess);
return Object(external_wp_element_["createElement"])(external_wp_components_["MenuItem"], {
ref: ref
}, Object(external_wp_i18n_["__"])('Copy all content'));
}
// EXTERNAL MODULE: ./node_modules/@wordpress/edit-post/build-module/store/index.js + 5 modules
var store = __webpack_require__("T40v");
// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/plugins/manage-blocks-menu-item/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function ManageBlocksMenuItem({
openModal
}) {
return Object(external_wp_element_["createElement"])(external_wp_components_["MenuItem"], {
onClick: () => {
openModal('edit-post/manage-blocks');
}
}, Object(external_wp_i18n_["__"])('Block Manager'));
}
/* harmony default export */ var manage_blocks_menu_item = (Object(external_wp_data_["withDispatch"])(dispatch => {
const {
openModal
} = dispatch(store["a" /* store */]);
return {
openModal
};
})(ManageBlocksMenuItem));
// EXTERNAL MODULE: external ["wp","keycodes"]
var external_wp_keycodes_ = __webpack_require__("RxS6");
// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/plugins/keyboard-shortcuts-help-menu-item/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function KeyboardShortcutsHelpMenuItem({
openModal
}) {
return Object(external_wp_element_["createElement"])(external_wp_components_["MenuItem"], {
onClick: () => {
openModal('edit-post/keyboard-shortcut-help');
},
shortcut: external_wp_keycodes_["displayShortcut"].access('h')
}, Object(external_wp_i18n_["__"])('Keyboard shortcuts'));
}
/* harmony default export */ var keyboard_shortcuts_help_menu_item = (Object(external_wp_data_["withDispatch"])(dispatch => {
const {
openModal
} = dispatch(store["a" /* store */]);
return {
openModal
};
})(KeyboardShortcutsHelpMenuItem));
// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/header/tools-more-menu-group/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
const {
Fill: ToolsMoreMenuGroup,
Slot
} = Object(external_wp_components_["createSlotFill"])('ToolsMoreMenuGroup');
ToolsMoreMenuGroup.Slot = ({
fillProps
}) => Object(external_wp_element_["createElement"])(Slot, {
fillProps: fillProps
}, fills => !Object(external_lodash_["isEmpty"])(fills) && Object(external_wp_element_["createElement"])(external_wp_components_["MenuGroup"], {
label: Object(external_wp_i18n_["__"])('Tools')
}, fills));
/* harmony default export */ var tools_more_menu_group = (ToolsMoreMenuGroup);
// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/plugins/welcome-guide-menu-item/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function WelcomeGuideMenuItem() {
const isTemplateMode = Object(external_wp_data_["useSelect"])(select => select(store["a" /* store */]).isEditingTemplate(), []);
const {
toggleFeature
} = Object(external_wp_data_["useDispatch"])(store["a" /* store */]);
return Object(external_wp_element_["createElement"])(external_wp_components_["MenuItem"], {
onClick: () => toggleFeature(isTemplateMode ? 'welcomeGuideTemplate' : 'welcomeGuide')
}, Object(external_wp_i18n_["__"])('Welcome Guide'));
}
// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/plugins/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
Object(external_wp_plugins_["registerPlugin"])('edit-post', {
render() {
return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(tools_more_menu_group, null, ({
onClose
}) => Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(manage_blocks_menu_item, {
onSelect: onClose
}), Object(external_wp_element_["createElement"])(external_wp_components_["MenuItem"], {
role: "menuitem",
href: Object(external_wp_url_["addQueryArgs"])('edit.php', {
post_type: 'wp_block'
})
}, Object(external_wp_i18n_["__"])('Manage Reusable blocks')), Object(external_wp_element_["createElement"])(keyboard_shortcuts_help_menu_item, {
onSelect: onClose
}), Object(external_wp_element_["createElement"])(WelcomeGuideMenuItem, null), Object(external_wp_element_["createElement"])(CopyContentMenuItem, null), Object(external_wp_element_["createElement"])(external_wp_components_["MenuItem"], {
role: "menuitem",
icon: external["a" /* default */],
href: Object(external_wp_i18n_["__"])('https://wordpress.org/support/article/wordpress-editor/'),
target: "_blank",
rel: "noopener noreferrer"
}, Object(external_wp_i18n_["__"])('Help'), Object(external_wp_element_["createElement"])(external_wp_components_["VisuallyHidden"], {
as: "span"
},
/* translators: accessibility text */
Object(external_wp_i18n_["__"])('(opens in a new tab)'))))));
}
});
// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/prevent-event-discovery.js
/* harmony default export */ var prevent_event_discovery = ({
't a l e s o f g u t e n b e r g': event => {
const {
ownerDocument
} = event.target;
if (!ownerDocument.activeElement.classList.contains('edit-post-visual-editor') && ownerDocument.activeElement !== ownerDocument.body) {
return;
}
event.preventDefault();
window.wp.data.dispatch('core/block-editor').insertBlock(window.wp.blocks.createBlock('core/paragraph', {
content: '🐡🐢🦀🐤🦋🐘🐧🐹🦁🦄🦍🐼🐿🎃🐴🐝🐆🦕🦔🌱🍇π🍌🐉💧🥨🌌🍂🍠🥦🥚🥝🎟🥥🥒🛵🥖🍒🍯🎾🎲🐺🐚🐮⌛️'
}));
}
});
// EXTERNAL MODULE: ./node_modules/classnames/index.js
var classnames = __webpack_require__("TSYQ");
var classnames_default = /*#__PURE__*/__webpack_require__.n(classnames);
// EXTERNAL MODULE: ./node_modules/@wordpress/interface/build-module/index.js + 15 modules
var build_module = __webpack_require__("U60i");
// EXTERNAL MODULE: external ["wp","keyboardShortcuts"]
var external_wp_keyboardShortcuts_ = __webpack_require__("hF7m");
// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/text-editor/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function TextEditor({
onExit,
isRichEditingEnabled
}) {
return Object(external_wp_element_["createElement"])("div", {
className: "edit-post-text-editor"
}, isRichEditingEnabled && Object(external_wp_element_["createElement"])("div", {
className: "edit-post-text-editor__toolbar"
}, Object(external_wp_element_["createElement"])("h2", null, Object(external_wp_i18n_["__"])('Editing code')), Object(external_wp_element_["createElement"])(external_wp_components_["Button"], {
isTertiary: true,
onClick: onExit,
shortcut: external_wp_keycodes_["displayShortcut"].secondary('m')
}, Object(external_wp_i18n_["__"])('Exit code editor')), Object(external_wp_element_["createElement"])(external_wp_editor_["TextEditorGlobalKeyboardShortcuts"], null)), Object(external_wp_element_["createElement"])("div", {
className: "edit-post-text-editor__body"
}, Object(external_wp_element_["createElement"])(external_wp_editor_["PostTitle"], null), Object(external_wp_element_["createElement"])(external_wp_editor_["PostTextEditor"], null)));
}
/* harmony default export */ var text_editor = (Object(external_wp_compose_["compose"])(Object(external_wp_data_["withSelect"])(select => ({
isRichEditingEnabled: select('core/editor').getEditorSettings().richEditingEnabled
})), Object(external_wp_data_["withDispatch"])(dispatch => {
return {
onExit() {
dispatch(store["a" /* store */]).switchEditorMode('visual');
}
};
}))(TextEditor));
// CONCATENATED MODULE: ./node_modules/framer-motion/node_modules/tslib/tslib.es6.js
/*! *****************************************************************************
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 */
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 __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;
return g = { next: verb(0), "throw": verb(1), "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 (_) 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;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (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 || 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 = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
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: n === "return" } : 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;
};
function __importStar(mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__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;
}
// EXTERNAL MODULE: external "React"
var external_React_ = __webpack_require__("cDcd");
var external_React_default = /*#__PURE__*/__webpack_require__.n(external_React_);
// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/motion/features/definitions.js
var createDefinition = function (propNames) { return ({
isEnabled: function (props) { return propNames.some(function (name) { return !!props[name]; }); },
}); };
var featureDefinitions = {
measureLayout: createDefinition([
"layout",
"layoutId",
"drag",
"_layoutResetTransform",
]),
animation: createDefinition([
"animate",
"exit",
"variants",
"whileHover",
"whileTap",
"whileFocus",
"whileDrag",
]),
exit: createDefinition(["exit"]),
drag: createDefinition(["drag", "dragControls"]),
focus: createDefinition(["whileFocus"]),
hover: createDefinition(["whileHover", "onHoverStart", "onHoverEnd"]),
tap: createDefinition(["whileTap", "onTap", "onTapStart", "onTapCancel"]),
pan: createDefinition([
"onPan",
"onPanStart",
"onPanSessionStart",
"onPanEnd",
]),
layoutAnimation: createDefinition(["layout", "layoutId"]),
};
function loadFeatures(features) {
for (var key in features) {
var Component = features[key];
if (Component !== null)
featureDefinitions[key].Component = Component;
}
}
// CONCATENATED MODULE: ./node_modules/hey-listen/dist/hey-listen.es.js
var warning = function () { };
var invariant = function () { };
if (false) {}
// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/context/LazyContext.js
var LazyContext = Object(external_React_["createContext"])({ strict: false });
// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/motion/features/use-features.js
var featureNames = Object.keys(featureDefinitions);
var numFeatures = featureNames.length;
/**
* Load features via renderless components based on the provided MotionProps.
*/
function useFeatures(props, visualElement, preloadedFeatures) {
var features = [];
var lazyContext = Object(external_React_["useContext"])(LazyContext);
if (!visualElement)
return null;
/**
* If we're in development mode, check to make sure we're not rendering a motion component
* as a child of LazyMotion, as this will break the file-size benefits of using it.
*/
if (false) {}
for (var i = 0; i < numFeatures; i++) {
var name_1 = featureNames[i];
var _a = featureDefinitions[name_1], isEnabled = _a.isEnabled, Component = _a.Component;
/**
* It might be possible in the future to use this moment to
* dynamically request functionality. In initial tests this
* was producing a lot of duplication amongst bundles.
*/
if (isEnabled(props) && Component) {
features.push(external_React_["createElement"](Component, __assign({ key: name_1 }, props, { visualElement: visualElement })));
}
}
return features;
}
// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/context/MotionConfigContext.js
/**
* @public
*/
var MotionConfigContext = Object(external_React_["createContext"])({
transformPagePoint: function (p) { return p; },
isStatic: false,
});
// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/context/MotionContext/index.js
var MotionContext = Object(external_React_["createContext"])({});
function useVisualElementContext() {
return Object(external_React_["useContext"])(MotionContext).visualElement;
}
// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/context/PresenceContext.js
/**
* @public
*/
var PresenceContext = Object(external_React_["createContext"])(null);
// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/utils/use-constant.js
/**
* Creates a constant value over the lifecycle of a component.
*
* Even if `useMemo` is provided an empty array as its final argument, it doesn't offer
* a guarantee that it won't re-run for performance reasons later on. By using `useConstant`
* you can ensure that initialisers don't execute twice or more.
*/
function useConstant(init) {
var ref = Object(external_React_["useRef"])(null);
if (ref.current === null) {
ref.current = init();
}
return ref.current;
}
// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/components/AnimatePresence/use-presence.js
/**
* When a component is the child of `AnimatePresence`, it can use `usePresence`
* to access information about whether it's still present in the React tree.
*
* ```jsx
* import { usePresence } from "framer-motion"
*
* export const Component = () => {
* const [isPresent, safeToRemove] = usePresence()
*
* useEffect(() => {
* !isPresent && setTimeout(safeToRemove, 1000)
* }, [isPresent])
*
* return <div />
* }
* ```
*
* If `isPresent` is `false`, it means that a component has been removed the tree, but
* `AnimatePresence` won't really remove it until `safeToRemove` has been called.
*
* @public
*/
function usePresence() {
var context = Object(external_React_["useContext"])(PresenceContext);
if (context === null)
return [true, null];
var isPresent = context.isPresent, onExitComplete = context.onExitComplete, register = context.register;
// It's safe to call the following hooks conditionally (after an early return) because the context will always
// either be null or non-null for the lifespan of the component.
// Replace with useOpaqueId when released in React
var id = useUniqueId();
Object(external_React_["useEffect"])(function () { return register(id); }, []);
var safeToRemove = function () { return onExitComplete === null || onExitComplete === void 0 ? void 0 : onExitComplete(id); };
return !isPresent && onExitComplete ? [false, safeToRemove] : [true];
}
/**
* Similar to `usePresence`, except `useIsPresent` simply returns whether or not the component is present.
* There is no `safeToRemove` function.
*
* ```jsx
* import { useIsPresent } from "framer-motion"
*
* export const Component = () => {
* const isPresent = useIsPresent()
*
* useEffect(() => {
* !isPresent && console.log("I've been removed!")
* }, [isPresent])
*
* return <div />
* }
* ```
*
* @public
*/
function useIsPresent() {
return use_presence_isPresent(Object(external_React_["useContext"])(PresenceContext));
}
function use_presence_isPresent(context) {
return context === null ? true : context.isPresent;
}
var counter = 0;
var incrementId = function () { return counter++; };
var useUniqueId = function () { return useConstant(incrementId); };
// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/context/LayoutGroupContext.js
/**
* @internal
*/
var LayoutGroupContext = Object(external_React_["createContext"])(null);
// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/utils/is-browser.js
var isBrowser = typeof window !== "undefined";
// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/utils/use-isomorphic-effect.js
var useIsomorphicLayoutEffect = isBrowser ? external_React_["useLayoutEffect"] : external_React_["useEffect"];
// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/motion/utils/use-visual-element.js
function useLayoutId(_a) {
var layoutId = _a.layoutId;
var layoutGroupId = Object(external_React_["useContext"])(LayoutGroupContext);
return layoutGroupId && layoutId !== undefined
? layoutGroupId + "-" + layoutId
: layoutId;
}
function useVisualElement(Component, visualState, props, createVisualElement) {
var config = Object(external_React_["useContext"])(MotionConfigContext);
var lazyContext = Object(external_React_["useContext"])(LazyContext);
var parent = useVisualElementContext();
var presenceContext = Object(external_React_["useContext"])(PresenceContext);
var layoutId = useLayoutId(props);
var visualElementRef = Object(external_React_["useRef"])(undefined);
/**
* If we haven't preloaded a renderer, check to see if we have one lazy-loaded
*/
if (!createVisualElement)
createVisualElement = lazyContext.renderer;
if (!visualElementRef.current && createVisualElement) {
visualElementRef.current = createVisualElement(Component, {
visualState: visualState,
parent: parent,
props: __assign(__assign({}, props), { layoutId: layoutId }),
presenceId: presenceContext === null || presenceContext === void 0 ? void 0 : presenceContext.id,
blockInitialAnimation: (presenceContext === null || presenceContext === void 0 ? void 0 : presenceContext.initial) === false,
});
}
var visualElement = visualElementRef.current;
useIsomorphicLayoutEffect(function () {
if (!visualElement)
return;
visualElement.setProps(__assign(__assign(__assign({}, config), props), { layoutId: layoutId }));
visualElement.isPresent = use_presence_isPresent(presenceContext);
visualElement.isPresenceRoot =
!parent || parent.presenceId !== (presenceContext === null || presenceContext === void 0 ? void 0 : presenceContext.id);
/**
* Fire a render to ensure the latest state is reflected on-screen.
*/
visualElement.syncRender();
});
Object(external_React_["useEffect"])(function () {
var _a;
if (!visualElement)
return;
/**
* In a future refactor we can replace the features-as-components and
* have this loop through them all firing "effect" listeners
*/
(_a = visualElement.animationState) === null || _a === void 0 ? void 0 : _a.animateChanges();
});
useIsomorphicLayoutEffect(function () { return function () { return visualElement === null || visualElement === void 0 ? void 0 : visualElement.notifyUnmount(); }; }, []);
return visualElement;
}
// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/utils/is-ref-object.js
function isRefObject(ref) {
return (typeof ref === "object" &&
Object.prototype.hasOwnProperty.call(ref, "current"));
}
// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/motion/utils/use-motion-ref.js
/**
* Creates a ref function that, when called, hydrates the provided
* external ref and VisualElement.
*/
function useMotionRef(visualState, visualElement, externalRef) {
return Object(external_React_["useCallback"])(function (instance) {
var _a;
instance && ((_a = visualState.mount) === null || _a === void 0 ? void 0 : _a.call(visualState, instance));
if (visualElement) {
instance
? visualElement.mount(instance)
: visualElement.unmount();
}
if (externalRef) {
if (typeof externalRef === "function") {
externalRef(instance);
}
else if (isRefObject(externalRef)) {
externalRef.current = instance;
}
}
},
/**
* Only pass a new ref callback to React if we've received a visual element
* factory. Otherwise we'll be mounting/remounting every time externalRef
* or other dependencies change.
*/
[visualElement]);
}
// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/utils/variants.js
/**
* Decides if the supplied variable is an array of variant labels
*/
function isVariantLabels(v) {
return Array.isArray(v);
}
/**
* Decides if the supplied variable is variant label
*/
function isVariantLabel(v) {
return typeof v === "string" || isVariantLabels(v);
}
/**
* Creates an object containing the latest state of every MotionValue on a VisualElement
*/
function getCurrent(visualElement) {
var current = {};
visualElement.forEachValue(function (value, key) { return (current[key] = value.get()); });
return current;
}
/**
* Creates an object containing the latest velocity of every MotionValue on a VisualElement
*/
function getVelocity(visualElement) {
var velocity = {};
visualElement.forEachValue(function (value, key) { return (velocity[key] = value.getVelocity()); });
return velocity;
}
function resolveVariantFromProps(props, definition, custom, currentValues, currentVelocity) {
var _a;
if (currentValues === void 0) { currentValues = {}; }
if (currentVelocity === void 0) { currentVelocity = {}; }
if (typeof definition === "string") {
definition = (_a = props.variants) === null || _a === void 0 ? void 0 : _a[definition];
}
return typeof definition === "function"
? definition(custom !== null && custom !== void 0 ? custom : props.custom, currentValues, currentVelocity)
: definition;
}
function resolveVariant(visualElement, definition, custom) {
var props = visualElement.getProps();
return resolveVariantFromProps(props, definition, custom !== null && custom !== void 0 ? custom : props.custom, getCurrent(visualElement), getVelocity(visualElement));
}
function checkIfControllingVariants(props) {
var _a;
return (typeof ((_a = props.animate) === null || _a === void 0 ? void 0 : _a.start) === "function" ||
isVariantLabel(props.initial) ||
isVariantLabel(props.animate) ||
isVariantLabel(props.whileHover) ||
isVariantLabel(props.whileDrag) ||
isVariantLabel(props.whileTap) ||
isVariantLabel(props.whileFocus) ||
isVariantLabel(props.exit));
}
function checkIfVariantNode(props) {
return Boolean(checkIfControllingVariants(props) || props.variants);
}
// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/context/MotionContext/utils.js
function getCurrentTreeVariants(props, context) {
if (checkIfControllingVariants(props)) {
var initial = props.initial, animate = props.animate;
return {
initial: initial === false || isVariantLabel(initial)
? initial
: undefined,
animate: isVariantLabel(animate) ? animate : undefined,
};
}
return props.inherit !== false ? context : {};
}
// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/context/MotionContext/create.js
function useCreateMotionContext(props, isStatic) {
var _a = getCurrentTreeVariants(props, Object(external_React_["useContext"])(MotionContext)), initial = _a.initial, animate = _a.animate;
return Object(external_React_["useMemo"])(function () { return ({ initial: initial, animate: animate }); },
/**
* Only break memoisation in static mode
*/
isStatic
? [
variantLabelsAsDependency(initial),
variantLabelsAsDependency(animate),
]
: []);
}
function variantLabelsAsDependency(prop) {
return Array.isArray(prop) ? prop.join(" ") : prop;
}
// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/motion/index.js
/**
* Create a `motion` component.
*
* This function accepts a Component argument, which can be either a string (ie "div"
* for `motion.div`), or an actual React component.
*
* Alongside this is a config option which provides a way of rendering the provided
* component "offline", or outside the React render cycle.
*
* @internal
*/
function createMotionComponent(_a) {
var preloadedFeatures = _a.preloadedFeatures, createVisualElement = _a.createVisualElement, useRender = _a.useRender, useVisualState = _a.useVisualState, Component = _a.Component;
preloadedFeatures && loadFeatures(preloadedFeatures);
function MotionComponent(props, externalRef) {
/**
* If we're rendering in a static environment, we only visually update the component
* as a result of a React-rerender rather than interactions or animations. This
* means we don't need to load additional memory structures like VisualElement,
* or any gesture/animation features.
*/
var isStatic = Object(external_React_["useContext"])(MotionConfigContext).isStatic;
var features = null;
/**
* Create the tree context. This is memoized and will only trigger renders
* when the current tree variant changes in static mode.
*/
var context = useCreateMotionContext(props, isStatic);
/**
*
*/
var visualState = useVisualState(props, isStatic);
if (!isStatic && isBrowser) {
/**
* Create a VisualElement for this component. A VisualElement provides a common
* interface to renderer-specific APIs (ie DOM/Three.js etc) as well as
* providing a way of rendering to these APIs outside of the React render loop
* for more performant animations and interactions
*/
context.visualElement = useVisualElement(Component, visualState, props, createVisualElement);
/**
* Load Motion gesture and animation features. These are rendered as renderless
* components so each feature can optionally make use of React lifecycle methods.
*
* TODO: The intention is to move these away from a React-centric to a
* VisualElement-centric lifecycle scheme.
*/
features = useFeatures(props, context.visualElement, preloadedFeatures);
}
/**
* The mount order and hierarchy is specific to ensure our element ref
* is hydrated by the time features fire their effects.
*/
return (external_React_["createElement"](external_React_["Fragment"], null,
external_React_["createElement"](MotionContext.Provider, { value: context }, useRender(Component, props, useMotionRef(visualState, context.visualElement, externalRef), visualState, isStatic)),
features));
}
return Object(external_React_["forwardRef"])(MotionComponent);
}
// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/dom/motion-proxy.js
/**
* Convert any React component into a `motion` component. The provided component
* **must** use `React.forwardRef` to the underlying DOM component you want to animate.
*
* ```jsx
* const Component = React.forwardRef((props, ref) => {
* return <div ref={ref} />
* })
*
* const MotionComponent = motion(Component)
* ```
*
* @public
*/
function createMotionProxy(createConfig) {
function custom(Component, customMotionComponentConfig) {
if (customMotionComponentConfig === void 0) { customMotionComponentConfig = {}; }
return createMotionComponent(createConfig(Component, customMotionComponentConfig));
}
/**
* A cache of generated `motion` components, e.g `motion.div`, `motion.input` etc.
* Rather than generating them anew every render.
*/
var componentCache = new Map();
return new Proxy(custom, {
/**
* Called when `motion` is referenced with a prop: `motion.div`, `motion.input` etc.
* The prop name is passed through as `key` and we can use that to generate a `motion`
* DOM component with that name.
*/
get: function (_target, key) {
/**
* If this element doesn't exist in the component cache, create it and cache.
*/
if (!componentCache.has(key)) {
componentCache.set(key, custom(key));
}
return componentCache.get(key);
},
});
}
// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/svg/lowercase-elements.js
/**
* We keep these listed seperately as we use the lowercase tag names as part
* of the runtime bundle to detect SVG components
*/
var lowercaseSVGElements = [
"animate",
"circle",
"defs",
"desc",
"ellipse",
"g",
"image",
"line",
"filter",
"marker",
"mask",
"metadata",
"path",
"pattern",
"polygon",
"polyline",
"rect",
"stop",
"svg",
"switch",
"symbol",
"text",
"tspan",
"use",
"view",
];
// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/dom/utils/is-svg-component.js
function isSVGComponent(Component) {
if (
/**
* If it's not a string, it's a custom React component. Currently we only support
* HTML custom React components.
*/
typeof Component !== "string" ||
/**
* If it contains a dash, the element is a custom HTML webcomponent.
*/
Component.includes("-")) {
return false;
}
else if (
/**
* If it's in our list of lowercase SVG tags, it's an SVG component
*/
lowercaseSVGElements.indexOf(Component) > -1 ||
/**
* If it contains a capital letter, it's an SVG component
*/
/[A-Z]/.test(Component)) {
return true;
}
return false;
}
// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/dom/projection/scale-correction.js
var valueScaleCorrection = {};
/**
* @internal
*/
function addScaleCorrection(correctors) {
for (var key in correctors) {
valueScaleCorrection[key] = correctors[key];
}
}
// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/html/utils/transform.js
/**
* A list of all transformable axes. We'll use this list to generated a version
* of each axes for each transform.
*/
var transformAxes = ["", "X", "Y", "Z"];
/**
* An ordered array of each transformable value. By default, transform values
* will be sorted to this order.
*/
var transform_order = ["translate", "scale", "rotate", "skew"];
/**
* Generate a list of every possible transform key.
*/
var transformProps = ["transformPerspective", "x", "y", "z"];
transform_order.forEach(function (operationKey) {
return transformAxes.forEach(function (axesKey) {
return transformProps.push(operationKey + axesKey);
});
});
/**
* A function to use with Array.sort to sort transform keys by their default order.
*/
function sortTransformProps(a, b) {
return transformProps.indexOf(a) - transformProps.indexOf(b);
}
/**
* A quick lookup for transform props.
*/
var transformPropSet = new Set(transformProps);
function isTransformProp(key) {
return transformPropSet.has(key);
}
/**
* A quick lookup for transform origin props
*/
var transformOriginProps = new Set(["originX", "originY", "originZ"]);
function isTransformOriginProp(key) {
return transformOriginProps.has(key);
}
// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/motion/utils/is-forced-motion-value.js
function isForcedMotionValue(key, _a) {
var layout = _a.layout, layoutId = _a.layoutId;
return (isTransformProp(key) ||
isTransformOriginProp(key) ||
((layout || layoutId !== undefined) &&
(!!valueScaleCorrection[key] || key === "opacity")));
}
// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/value/utils/is-motion-value.js
var isMotionValue = function (value) {
return value !== null && typeof value === "object" && value.getVelocity;
};
// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/html/utils/build-transform.js
var translateAlias = {
x: "translateX",
y: "translateY",
z: "translateZ",
transformPerspective: "perspective",
};
/**
* Build a CSS transform style from individual x/y/scale etc properties.
*
* This outputs with a default order of transforms/scales/rotations, this can be customised by
* providing a transformTemplate function.
*/
function buildTransform(_a, _b, transformIsDefault, transformTemplate) {
var transform = _a.transform, transformKeys = _a.transformKeys;
var _c = _b.enableHardwareAcceleration, enableHardwareAcceleration = _c === void 0 ? true : _c, _d = _b.allowTransformNone, allowTransformNone = _d === void 0 ? true : _d;
// The transform string we're going to build into.
var transformString = "";
// Transform keys into their default order - this will determine the output order.
transformKeys.sort(sortTransformProps);
// Track whether the defined transform has a defined z so we don't add a
// second to enable hardware acceleration
var transformHasZ = false;
// Loop over each transform and build them into transformString
var numTransformKeys = transformKeys.length;
for (var i = 0; i < numTransformKeys; i++) {
var key = transformKeys[i];
transformString += (translateAlias[key] || key) + "(" + transform[key] + ") ";
if (key === "z")
transformHasZ = true;
}
if (!transformHasZ && enableHardwareAcceleration) {
transformString += "translateZ(0)";
}
else {
transformString = transformString.trim();
}
// If we have a custom `transform` template, pass our transform values and
// generated transformString to that before returning
if (transformTemplate) {
transformString = transformTemplate(transform, transformIsDefault ? "" : transformString);
}
else if (allowTransformNone && transformIsDefault) {
transformString = "none";
}
return transformString;
}
/**
* Build a transformOrigin style. Uses the same defaults as the browser for
* undefined origins.
*/
function buildTransformOrigin(_a) {
var _b = _a.originX, originX = _b === void 0 ? "50%" : _b, _c = _a.originY, originY = _c === void 0 ? "50%" : _c, _d = _a.originZ, originZ = _d === void 0 ? 0 : _d;
return originX + " " + originY + " " + originZ;
}
// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/dom/utils/is-css-variable.js
/**
* Returns true if the provided key is a CSS variable
*/
function isCSSVariable(key) {
return key.startsWith("--");
}
// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/dom/value-types/get-as-type.js
/**
* Provided a value and a ValueType, returns the value as that value type.
*/
var getValueAsType = function (value, type) {
return type && typeof value === "number"
? type.transform(value)
: value;
};
// CONCATENATED MODULE: ./node_modules/style-value-types/node_modules/tslib/tslib.es6.js
/*! *****************************************************************************
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 */
var tslib_es6_extendStatics = function(d, b) {
tslib_es6_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 tslib_es6_extendStatics(d, b);
};
function tslib_es6_extends(d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
tslib_es6_extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
}
var tslib_es6_assign = function() {
tslib_es6_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 tslib_es6_assign.apply(this, arguments);
}
function tslib_es6_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 tslib_es6_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 tslib_es6_param(paramIndex, decorator) {
return function (target, key) { decorator(target, key, paramIndex); }
}
function tslib_es6_metadata(metadataKey, metadataValue) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
}
function tslib_es6_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 tslib_es6_generator(thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "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 (_) 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 tslib_es6_createBinding = Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
});
function tslib_es6_exportStar(m, o) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) tslib_es6_createBinding(o, m, p);
}
function tslib_es6_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 tslib_es6_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 tslib_es6_spread() {
for (var ar = [], i = 0; i < arguments.length; i++)
ar = ar.concat(tslib_es6_read(arguments[i]));
return ar;
}
/** @deprecated */
function tslib_es6_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 tslib_es6_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 || from);
}
function tslib_es6_await(v) {
return this instanceof tslib_es6_await ? (this.v = v, this) : new tslib_es6_await(v);
}
function tslib_es6_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 = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
function step(r) { r.value instanceof tslib_es6_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 tslib_es6_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: tslib_es6_await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
}
function tslib_es6_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 tslib_es6_values === "function" ? tslib_es6_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 tslib_es6_makeTemplateObject(cooked, raw) {
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
return cooked;
};
var tslib_es6_setModuleDefault = Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
};
function tslib_es6_importStar(mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) tslib_es6_createBinding(result, mod, k);
tslib_es6_setModuleDefault(result, mod);
return result;
}
function tslib_es6_importDefault(mod) {
return (mod && mod.__esModule) ? mod : { default: mod };
}
function tslib_es6_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 tslib_es6_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;
}
// CONCATENATED MODULE: ./node_modules/style-value-types/dist/es/utils.js
var clamp = function (min, max) { return function (v) {
return Math.max(Math.min(v, max), min);
}; };
var sanitize = function (v) { return (v % 1 ? Number(v.toFixed(5)) : v); };
var floatRegex = /(-)?([\d]*\.?[\d])+/g;
var colorRegex = /(#[0-9a-f]{6}|#[0-9a-f]{3}|#(?:[0-9a-f]{2}){2,4}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2,3}\s*\/*\s*[\d\.]+%?\))/gi;
var singleColorRegex = /^(#[0-9a-f]{3}|#(?:[0-9a-f]{2}){2,4}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2,3}\s*\/*\s*[\d\.]+%?\))$/i;
function isString(v) {
return typeof v === 'string';
}
// CONCATENATED MODULE: ./node_modules/style-value-types/dist/es/numbers/units.js
var createUnitType = function (unit) { return ({
test: function (v) {
return isString(v) && v.endsWith(unit) && v.split(' ').length === 1;
},
parse: parseFloat,
transform: function (v) { return "" + v + unit; },
}); };
var degrees = createUnitType('deg');
var percent = createUnitType('%');
var px = createUnitType('px');
var vh = createUnitType('vh');
var vw = createUnitType('vw');
var progressPercentage = tslib_es6_assign(tslib_es6_assign({}, percent), { parse: function (v) { return percent.parse(v) / 100; }, transform: function (v) { return percent.transform(v * 100); } });
// CONCATENATED MODULE: ./node_modules/style-value-types/dist/es/numbers/index.js
var numbers_number = {
test: function (v) { return typeof v === 'number'; },
parse: parseFloat,
transform: function (v) { return v; },
};
var numbers_alpha = tslib_es6_assign(tslib_es6_assign({}, numbers_number), { transform: clamp(0, 1) });
var numbers_scale = tslib_es6_assign(tslib_es6_assign({}, numbers_number), { default: 1 });
// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/dom/value-types/type-int.js
var type_int_int = __assign(__assign({}, numbers_number), { transform: Math.round });
// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/dom/value-types/number.js
var numberValueTypes = {
// Border props
borderWidth: px,
borderTopWidth: px,
borderRightWidth: px,
borderBottomWidth: px,
borderLeftWidth: px,
borderRadius: px,
radius: px,
borderTopLeftRadius: px,
borderTopRightRadius: px,
borderBottomRightRadius: px,
borderBottomLeftRadius: px,
// Positioning props
width: px,
maxWidth: px,
height: px,
maxHeight: px,
size: px,
top: px,
right: px,
bottom: px,
left: px,
// Spacing props
padding: px,
paddingTop: px,
paddingRight: px,
paddingBottom: px,
paddingLeft: px,
margin: px,
marginTop: px,
marginRight: px,
marginBottom: px,
marginLeft: px,
// Transform props
rotate: degrees,
rotateX: degrees,
rotateY: degrees,
rotateZ: degrees,
scale: numbers_scale,
scaleX: numbers_scale,
scaleY: numbers_scale,
scaleZ: numbers_scale,
skew: degrees,
skewX: degrees,
skewY: degrees,
distance: px,
translateX: px,
translateY: px,
translateZ: px,
x: px,
y: px,
z: px,
perspective: px,
transformPerspective: px,
opacity: numbers_alpha,
originX: progressPercentage,
originY: progressPercentage,
originZ: px,
// Misc
zIndex: type_int_int,
// SVG
fillOpacity: numbers_alpha,
strokeOpacity: numbers_alpha,
numOctaves: type_int_int,
};
// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/html/utils/build-styles.js
function buildHTMLStyles(state, latestValues, projection, layoutState, options, transformTemplate, buildProjectionTransform, buildProjectionTransformOrigin) {
var _a;
var style = state.style, vars = state.vars, transform = state.transform, transformKeys = state.transformKeys, transformOrigin = state.transformOrigin;
// Empty the transformKeys array. As we're throwing out refs to its items
// this might not be as cheap as suspected. Maybe using the array as a buffer
// with a manual incrementation would be better.
transformKeys.length = 0;
// Track whether we encounter any transform or transformOrigin values.
var hasTransform = false;
var hasTransformOrigin = false;
// Does the calculated transform essentially equal "none"?
var transformIsNone = true;
/**
* Loop over all our latest animated values and decide whether to handle them
* as a style or CSS variable.
*
* Transforms and transform origins are kept seperately for further processing.
*/
for (var key in latestValues) {
var value = latestValues[key];
/**
* If this is a CSS variable we don't do any further processing.
*/
if (isCSSVariable(key)) {
vars[key] = value;
continue;
}
// Convert the value to its default value type, ie 0 -> "0px"
var valueType = numberValueTypes[key];
var valueAsType = getValueAsType(value, valueType);
if (isTransformProp(key)) {
// If this is a transform, flag to enable further transform processing
hasTransform = true;
transform[key] = valueAsType;
transformKeys.push(key);
// If we already know we have a non-default transform, early return
if (!transformIsNone)
continue;
// Otherwise check to see if this is a default transform
if (value !== ((_a = valueType.default) !== null && _a !== void 0 ? _a : 0))
transformIsNone = false;
}
else if (isTransformOriginProp(key)) {
transformOrigin[key] = valueAsType;
// If this is a transform origin, flag and enable further transform-origin processing
hasTransformOrigin = true;
}
else {
/**
* If layout projection is on, and we need to perform scale correction for this
* value type, perform it.
*/
if ((projection === null || projection === void 0 ? void 0 : projection.isHydrated) &&
(layoutState === null || layoutState === void 0 ? void 0 : layoutState.isHydrated) &&
valueScaleCorrection[key]) {
var correctedValue = valueScaleCorrection[key].process(value, layoutState, projection);
/**
* Scale-correctable values can define a number of other values to break
* down into. For instance borderRadius needs applying to borderBottomLeftRadius etc
*/
var applyTo = valueScaleCorrection[key].applyTo;
if (applyTo) {
var num = applyTo.length;
for (var i = 0; i < num; i++) {
style[applyTo[i]] = correctedValue;
}
}
else {
style[key] = correctedValue;
}
}
else {
style[key] = valueAsType;
}
}
}
if (layoutState &&
projection &&
buildProjectionTransform &&
buildProjectionTransformOrigin) {
style.transform = buildProjectionTransform(layoutState.deltaFinal, layoutState.treeScale, hasTransform ? transform : undefined);
if (transformTemplate) {
style.transform = transformTemplate(transform, style.transform);
}
style.transformOrigin = buildProjectionTransformOrigin(layoutState);
}
else {
if (hasTransform) {
style.transform = buildTransform(state, options, transformIsNone, transformTemplate);
}
if (hasTransformOrigin) {
style.transformOrigin = buildTransformOrigin(transformOrigin);
}
}
}
// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/html/utils/create-render-state.js
var createHtmlRenderState = function () { return ({
style: {},
transform: {},
transformKeys: [],
transformOrigin: {},
vars: {},
}); };
// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/html/use-props.js
function copyRawValuesOnly(target, source, props) {
for (var key in source) {
if (!isMotionValue(source[key]) && !isForcedMotionValue(key, props)) {
target[key] = source[key];
}
}
}
function useInitialMotionValues(_a, visualState, isStatic) {
var transformTemplate = _a.transformTemplate;
return Object(external_React_["useMemo"])(function () {
var state = createHtmlRenderState();
buildHTMLStyles(state, visualState, undefined, undefined, { enableHardwareAcceleration: !isStatic }, transformTemplate);
var vars = state.vars, style = state.style;
return __assign(__assign({}, vars), style);
}, [visualState]);
}
function useStyle(props, visualState, isStatic) {
var styleProp = props.style || {};
var style = {};
/**
* Copy non-Motion Values straight into style
*/
copyRawValuesOnly(style, styleProp, props);
Object.assign(style, useInitialMotionValues(props, visualState, isStatic));
if (props.transformValues) {
style = props.transformValues(style);
}
return style;
}
function useHTMLProps(props, visualState, isStatic) {
// The `any` isn't ideal but it is the type of createElement props argument
var htmlProps = {};
var style = useStyle(props, visualState, isStatic);
if (Boolean(props.drag)) {
// Disable the ghost element when a user drags
htmlProps.draggable = false;
// Disable text selection
style.userSelect = style.WebkitUserSelect = style.WebkitTouchCallout =
"none";
// Disable scrolling on the draggable direction
style.touchAction =
props.drag === true
? "none"
: "pan-" + (props.drag === "x" ? "y" : "x");
}
htmlProps.style = style;
return htmlProps;
}
// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/motion/utils/valid-prop.js
/**
* A list of all valid MotionProps.
*
* @internalremarks
* This doesn't throw if a `MotionProp` name is missing - it should.
*/
var validMotionProps = new Set([
"initial",
"animate",
"exit",
"style",
"variants",
"transition",
"transformTemplate",
"transformValues",
"custom",
"inherit",
"layout",
"layoutId",
"_layoutResetTransform",
"onLayoutAnimationComplete",
"onViewportBoxUpdate",
"onLayoutMeasure",
"onBeforeLayoutMeasure",
"onAnimationStart",
"onAnimationComplete",
"onUpdate",
"onDragStart",
"onDrag",
"onDragEnd",
"onMeasureDragConstraints",
"onDirectionLock",
"onDragTransitionEnd",
"drag",
"dragControls",
"dragListener",
"dragConstraints",
"dragDirectionLock",
"_dragX",
"_dragY",
"dragElastic",
"dragMomentum",
"dragPropagation",
"dragTransition",
"whileDrag",
"onPan",
"onPanStart",
"onPanEnd",
"onPanSessionStart",
"onTap",
"onTapStart",
"onTapCancel",
"onHoverStart",
"onHoverEnd",
"whileFocus",
"whileTap",
"whileHover",
]);
/**
* Check whether a prop name is a valid `MotionProp` key.
*
* @param key - Name of the property to check
* @returns `true` is key is a valid `MotionProp`.
*
* @public
*/
function isValidMotionProp(key) {
return validMotionProps.has(key);
}
// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/dom/utils/filter-props.js
var shouldForward = function (key) { return !isValidMotionProp(key); };
/**
* Emotion and Styled Components both allow users to pass through arbitrary props to their components
* to dynamically generate CSS. They both use the `@emotion/is-prop-valid` package to determine which
* of these should be passed to the underlying DOM node.
*
* However, when styling a Motion component `styled(motion.div)`, both packages pass through *all* props
* as it's seen as an arbitrary component rather than a DOM node. Motion only allows arbitrary props
* passed through the `custom` prop so it doesn't *need* the payload or computational overhead of
* `@emotion/is-prop-valid`, however to fix this problem we need to use it.
*
* By making it an optionalDependency we can offer this functionality only in the situations where it's
* actually required.
*/
try {
var emotionIsPropValid_1 = __webpack_require__("9uj6").default;
shouldForward = function (key) {
// Handle events explicitly as Emotion validates them all as true
if (key.startsWith("on")) {
return !isValidMotionProp(key);
}
else {
return emotionIsPropValid_1(key);
}
};
}
catch (_a) {
// We don't need to actually do anything here - the fallback is the existing `isPropValid`.
}
function filterProps(props, isDom, forwardMotionProps) {
var filteredProps = {};
for (var key in props) {
if (shouldForward(key) ||
(forwardMotionProps === true && isValidMotionProp(key)) ||
(!isDom && !isValidMotionProp(key))) {
filteredProps[key] = props[key];
}
}
return filteredProps;
}
// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/svg/utils/transform-origin.js
function calcOrigin(origin, offset, size) {
return typeof origin === "string"
? origin
: px.transform(offset + size * origin);
}
/**
* The SVG transform origin defaults are different to CSS and is less intuitive,
* so we use the measured dimensions of the SVG to reconcile these.
*/
function calcSVGTransformOrigin(dimensions, originX, originY) {
var pxOriginX = calcOrigin(originX, dimensions.x, dimensions.width);
var pxOriginY = calcOrigin(originY, dimensions.y, dimensions.height);
return pxOriginX + " " + pxOriginY;
}
// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/svg/utils/path.js
// Convert a progress 0-1 to a pixels value based on the provided length
var progressToPixels = function (progress, length) {
return px.transform(progress * length);
};
var dashKeys = {
offset: "stroke-dashoffset",
array: "stroke-dasharray",
};
var camelKeys = {
offset: "strokeDashoffset",
array: "strokeDasharray",
};
/**
* Build SVG path properties. Uses the path's measured length to convert
* our custom pathLength, pathSpacing and pathOffset into stroke-dashoffset
* and stroke-dasharray attributes.
*
* This function is mutative to reduce per-frame GC.
*/
function buildSVGPath(attrs, totalLength, length, spacing, offset, useDashCase) {
if (spacing === void 0) { spacing = 1; }
if (offset === void 0) { offset = 0; }
if (useDashCase === void 0) { useDashCase = true; }
// We use dash case when setting attributes directly to the DOM node and camel case
// when defining props on a React component.
var keys = useDashCase ? dashKeys : camelKeys;
// Build the dash offset
attrs[keys.offset] = progressToPixels(-offset, totalLength);
// Build the dash array
var pathLength = progressToPixels(length, totalLength);
var pathSpacing = progressToPixels(spacing, totalLength);
attrs[keys.array] = pathLength + " " + pathSpacing;
}
// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/svg/utils/build-attrs.js
/**
* Build SVG visual attrbutes, like cx and style.transform
*/
function buildSVGAttrs(state, _a, projection, layoutState, options, transformTemplate, buildProjectionTransform, buildProjectionTransformOrigin) {
var attrX = _a.attrX, attrY = _a.attrY, originX = _a.originX, originY = _a.originY, pathLength = _a.pathLength, _b = _a.pathSpacing, pathSpacing = _b === void 0 ? 1 : _b, _c = _a.pathOffset, pathOffset = _c === void 0 ? 0 : _c,
// This is object creation, which we try to avoid per-frame.
latest = __rest(_a, ["attrX", "attrY", "originX", "originY", "pathLength", "pathSpacing", "pathOffset"]);
buildHTMLStyles(state, latest, projection, layoutState, options, transformTemplate, buildProjectionTransform, buildProjectionTransformOrigin);
state.attrs = state.style;
state.style = {};
var attrs = state.attrs, style = state.style, dimensions = state.dimensions, totalPathLength = state.totalPathLength;
/**
* However, we apply transforms as CSS transforms. So if we detect a transform we take it from attrs
* and copy it into style.
*/
if (attrs.transform) {
if (dimensions)
style.transform = attrs.transform;
delete attrs.transform;
}
// Parse transformOrigin
if (dimensions &&
(originX !== undefined || originY !== undefined || style.transform)) {
style.transformOrigin = calcSVGTransformOrigin(dimensions, originX !== undefined ? originX : 0.5, originY !== undefined ? originY : 0.5);
}
// Treat x/y not as shortcuts but as actual attributes
if (attrX !== undefined)
attrs.x = attrX;
if (attrY !== undefined)
attrs.y = attrY;
// Build SVG path if one has been measured
if (totalPathLength !== undefined && pathLength !== undefined) {
buildSVGPath(attrs, totalPathLength, pathLength, pathSpacing, pathOffset, false);
}
}
// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/svg/utils/create-render-state.js
var createSvgRenderState = function () { return (__assign(__assign({}, createHtmlRenderState()), { attrs: {} })); };
// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/svg/use-props.js
function useSVGProps(props, visualState) {
var visualProps = Object(external_React_["useMemo"])(function () {
var state = createSvgRenderState();
buildSVGAttrs(state, visualState, undefined, undefined, { enableHardwareAcceleration: false }, props.transformTemplate);
return __assign(__assign({}, state.attrs), { style: __assign({}, state.style) });
}, [visualState]);
if (props.style) {
var rawStyles = {};
copyRawValuesOnly(rawStyles, props.style, props);
visualProps.style = __assign(__assign({}, rawStyles), visualProps.style);
}
return visualProps;
}
// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/dom/use-render.js
function createUseRender(forwardMotionProps) {
if (forwardMotionProps === void 0) { forwardMotionProps = false; }
var useRender = function (Component, props, ref, _a, isStatic) {
var latestValues = _a.latestValues;
var useVisualProps = isSVGComponent(Component)
? useSVGProps
: useHTMLProps;
var visualProps = useVisualProps(props, latestValues, isStatic);
var filteredProps = filterProps(props, typeof Component === "string", forwardMotionProps);
var elementProps = __assign(__assign(__assign({}, filteredProps), visualProps), { ref: ref });
return Object(external_React_["createElement"])(Component, elementProps);
};
return useRender;
}
// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/dom/utils/camel-to-dash.js
var CAMEL_CASE_PATTERN = /([a-z])([A-Z])/g;
var REPLACE_TEMPLATE = "$1-$2";
/**
* Convert camelCase to dash-case properties.
*/
var camelToDash = function (str) {
return str.replace(CAMEL_CASE_PATTERN, REPLACE_TEMPLATE).toLowerCase();
};
// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/html/utils/render.js
function renderHTML(element, _a) {
var style = _a.style, vars = _a.vars;
// Directly assign style into the Element's style prop. In tests Object.assign is the
// fastest way to assign styles.
Object.assign(element.style, style);
// Loop over any CSS variables and assign those.
for (var key in vars) {
element.style.setProperty(key, vars[key]);
}
}
// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/svg/utils/camel-case-attrs.js
/**
* A set of attribute names that are always read/written as camel case.
*/
var camelCaseAttributes = new Set([
"baseFrequency",
"diffuseConstant",
"kernelMatrix",
"kernelUnitLength",
"keySplines",
"keyTimes",
"limitingConeAngle",
"markerHeight",
"markerWidth",
"numOctaves",
"targetX",
"targetY",
"surfaceScale",
"specularConstant",
"specularExponent",
"stdDeviation",
"tableValues",
"viewBox",
"gradientTransform",
]);
// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/svg/utils/render.js
function renderSVG(element, renderState) {
renderHTML(element, renderState);
for (var key in renderState.attrs) {
element.setAttribute(!camelCaseAttributes.has(key) ? camelToDash(key) : key, renderState.attrs[key]);
}
}
// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/html/utils/scrape-motion-values.js
function scrape_motion_values_scrapeMotionValuesFromProps(props) {
var style = props.style;
var newValues = {};
for (var key in style) {
if (isMotionValue(style[key]) || isForcedMotionValue(key, props)) {
newValues[key] = style[key];
}
}
return newValues;
}
// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/svg/utils/scrape-motion-values.js
function utils_scrape_motion_values_scrapeMotionValuesFromProps(props) {
var newValues = scrape_motion_values_scrapeMotionValuesFromProps(props);
for (var key in props) {
if (isMotionValue(props[key])) {
var targetKey = key === "x" || key === "y" ? "attr" + key.toUpperCase() : key;
newValues[targetKey] = props[key];
}
}
return newValues;
}
// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/animation/utils/is-animation-controls.js
function isAnimationControls(v) {
return typeof v === "object" && typeof v.start === "function";
}
// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/animation/utils/is-keyframes-target.js
var isKeyframesTarget = function (v) {
return Array.isArray(v);
};
// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/utils/resolve-value.js
var isCustomValue = function (v) {
return Boolean(v && typeof v === "object" && v.mix && v.toValue);
};
var resolveFinalValueInKeyframes = function (v) {
// TODO maybe throw if v.length - 1 is placeholder token?
return isKeyframesTarget(v) ? v[v.length - 1] || 0 : v;
};
// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/value/utils/resolve-motion-value.js
/**
* If the provided value is a MotionValue, this returns the actual value, otherwise just the value itself
*
* TODO: Remove and move to library
*
* @internal
*/
function resolveMotionValue(value) {
var unwrappedValue = isMotionValue(value) ? value.get() : value;
return isCustomValue(unwrappedValue)
? unwrappedValue.toValue()
: unwrappedValue;
}
// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/motion/utils/use-visual-state.js
function makeState(_a, props, context, presenceContext) {
var scrapeMotionValuesFromProps = _a.scrapeMotionValuesFromProps, createRenderState = _a.createRenderState, onMount = _a.onMount;
var state = {
latestValues: makeLatestValues(props, context, presenceContext, scrapeMotionValuesFromProps),
renderState: createRenderState(),
};
if (onMount) {
state.mount = function (instance) { return onMount(props, instance, state); };
}
return state;
}
var makeUseVisualState = function (config) { return function (props, isStatic) {
var context = Object(external_React_["useContext"])(MotionContext);
var presenceContext = Object(external_React_["useContext"])(PresenceContext);
return isStatic
? makeState(config, props, context, presenceContext)
: useConstant(function () { return makeState(config, props, context, presenceContext); });
}; };
function makeLatestValues(props, context, presenceContext, scrapeMotionValues) {
var values = {};
var blockInitialAnimation = (presenceContext === null || presenceContext === void 0 ? void 0 : presenceContext.initial) === false;
var motionValues = scrapeMotionValues(props);
for (var key in motionValues) {
values[key] = resolveMotionValue(motionValues[key]);
}
var initial = props.initial, animate = props.animate;
var isControllingVariants = checkIfControllingVariants(props);
var isVariantNode = checkIfVariantNode(props);
if (context &&
isVariantNode &&
!isControllingVariants &&
props.inherit !== false) {
initial !== null && initial !== void 0 ? initial : (initial = context.initial);
animate !== null && animate !== void 0 ? animate : (animate = context.animate);
}
var variantToSet = blockInitialAnimation || initial === false ? animate : initial;
if (variantToSet &&
typeof variantToSet !== "boolean" &&
!isAnimationControls(variantToSet)) {
var list = Array.isArray(variantToSet) ? variantToSet : [variantToSet];
list.forEach(function (definition) {
var resolved = resolveVariantFromProps(props, definition);
if (!resolved)
return;
var transitionEnd = resolved.transitionEnd; resolved.transition; var target = __rest(resolved, ["transitionEnd", "transition"]);
for (var key in target)
values[key] = target[key];
for (var key in transitionEnd)
values[key] = transitionEnd[key];
});
}
return values;
}
// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/svg/config-motion.js
var svgMotionConfig = {
useVisualState: makeUseVisualState({
scrapeMotionValuesFromProps: utils_scrape_motion_values_scrapeMotionValuesFromProps,
createRenderState: createSvgRenderState,
onMount: function (props, instance, _a) {
var renderState = _a.renderState, latestValues = _a.latestValues;
try {
renderState.dimensions =
typeof instance.getBBox ===
"function"
? instance.getBBox()
: instance.getBoundingClientRect();
}
catch (e) {
// Most likely trying to measure an unrendered element under Firefox
renderState.dimensions = {
x: 0,
y: 0,
width: 0,
height: 0,
};
}
if (isPath(instance)) {
renderState.totalPathLength = instance.getTotalLength();
}
buildSVGAttrs(renderState, latestValues, undefined, undefined, { enableHardwareAcceleration: false }, props.transformTemplate);
// TODO: Replace with direct assignment
renderSVG(instance, renderState);
},
}),
};
function isPath(element) {
return element.tagName === "path";
}
// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/html/config-motion.js
var htmlMotionConfig = {
useVisualState: makeUseVisualState({
scrapeMotionValuesFromProps: scrape_motion_values_scrapeMotionValuesFromProps,
createRenderState: createHtmlRenderState,
}),
};
// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/dom/utils/create-config.js
function createDomMotionConfig(Component, _a, preloadedFeatures, createVisualElement) {
var _b = _a.forwardMotionProps, forwardMotionProps = _b === void 0 ? false : _b;
var baseConfig = isSVGComponent(Component)
? svgMotionConfig
: htmlMotionConfig;
return __assign(__assign({}, baseConfig), { preloadedFeatures: preloadedFeatures, useRender: createUseRender(forwardMotionProps), createVisualElement: createVisualElement,
Component: Component });
}
// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/utils/types.js
var AnimationType;
(function (AnimationType) {
AnimationType["Animate"] = "animate";
AnimationType["Hover"] = "whileHover";
AnimationType["Tap"] = "whileTap";
AnimationType["Drag"] = "whileDrag";
AnimationType["Focus"] = "whileFocus";
AnimationType["Exit"] = "exit";
})(AnimationType || (AnimationType = {}));
// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/events/use-dom-event.js
function addDomEvent(target, eventName, handler, options) {
target.addEventListener(eventName, handler, options);
return function () { return target.removeEventListener(eventName, handler, options); };
}
/**
* Attaches an event listener directly to the provided DOM element.
*
* Bypassing React's event system can be desirable, for instance when attaching non-passive
* event handlers.
*
* ```jsx
* const ref = useRef(null)
*
* useDomEvent(ref, 'wheel', onWheel, { passive: false })
*
* return <div ref={ref} />
* ```
*
* @param ref - React.RefObject that's been provided to the element you want to bind the listener to.
* @param eventName - Name of the event you want listen for.
* @param handler - Function to fire when receiving the event.
* @param options - Options to pass to `Event.addEventListener`.
*
* @public
*/
function useDomEvent(ref, eventName, handler, options) {
Object(external_React_["useEffect"])(function () {
var element = ref.current;
if (handler && element) {
return addDomEvent(element, eventName, handler, options);
}
}, [ref, eventName, handler, options]);
}
// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/gestures/use-focus-gesture.js
/**
*
* @param props
* @param ref
* @internal
*/
function useFocusGesture(_a) {
var whileFocus = _a.whileFocus, visualElement = _a.visualElement;
var onFocus = function () {
var _a;
(_a = visualElement.animationState) === null || _a === void 0 ? void 0 : _a.setActive(AnimationType.Focus, true);
};
var onBlur = function () {
var _a;
(_a = visualElement.animationState) === null || _a === void 0 ? void 0 : _a.setActive(AnimationType.Focus, false);
};
useDomEvent(visualElement, "focus", whileFocus ? onFocus : undefined);
useDomEvent(visualElement, "blur", whileFocus ? onBlur : undefined);
}
// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/gestures/utils/event-type.js
function isMouseEvent(event) {
// PointerEvent inherits from MouseEvent so we can't use a straight instanceof check.
if (typeof PointerEvent !== "undefined" && event instanceof PointerEvent) {
return !!(event.pointerType === "mouse");
}
return event instanceof MouseEvent;
}
function isTouchEvent(event) {
var hasTouches = !!event.touches;
return hasTouches;
}
// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/events/event-info.js
/**
* Filters out events not attached to the primary pointer (currently left mouse button)
* @param eventHandler
*/
function filterPrimaryPointer(eventHandler) {
return function (event) {
var isMouseEvent = event instanceof MouseEvent;
var isPrimaryPointer = !isMouseEvent ||
(isMouseEvent && event.button === 0);
if (isPrimaryPointer) {
eventHandler(event);
}
};
}
var defaultPagePoint = { pageX: 0, pageY: 0 };
function pointFromTouch(e, pointType) {
if (pointType === void 0) { pointType = "page"; }
var primaryTouch = e.touches[0] || e.changedTouches[0];
var point = primaryTouch || defaultPagePoint;
return {
x: point[pointType + "X"],
y: point[pointType + "Y"],
};
}
function pointFromMouse(point, pointType) {
if (pointType === void 0) { pointType = "page"; }
return {
x: point[pointType + "X"],
y: point[pointType + "Y"],
};
}
function extractEventInfo(event, pointType) {
if (pointType === void 0) { pointType = "page"; }
return {
point: isTouchEvent(event)
? pointFromTouch(event, pointType)
: pointFromMouse(event, pointType),
};
}
function getViewportPointFromEvent(event) {
return extractEventInfo(event, "client");
}
var wrapHandler = function (handler, shouldFilterPrimaryPointer) {
if (shouldFilterPrimaryPointer === void 0) { shouldFilterPrimaryPointer = false; }
var listener = function (event) {
return handler(event, extractEventInfo(event));
};
return shouldFilterPrimaryPointer
? filterPrimaryPointer(listener)
: listener;
};
// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/events/utils.js
// We check for event support via functions in case they've been mocked by a testing suite.
var supportsPointerEvents = function () {
return isBrowser && window.onpointerdown === null;
};
var supportsTouchEvents = function () {
return isBrowser && window.ontouchstart === null;
};
var supportsMouseEvents = function () {
return isBrowser && window.onmousedown === null;
};
// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/events/use-pointer-event.js
var mouseEventNames = {
pointerdown: "mousedown",
pointermove: "mousemove",
pointerup: "mouseup",
pointercancel: "mousecancel",
pointerover: "mouseover",
pointerout: "mouseout",
pointerenter: "mouseenter",
pointerleave: "mouseleave",
};
var touchEventNames = {
pointerdown: "touchstart",
pointermove: "touchmove",
pointerup: "touchend",
pointercancel: "touchcancel",
};
function getPointerEventName(name) {
if (supportsPointerEvents()) {
return name;
}
else if (supportsTouchEvents()) {
return touchEventNames[name];
}
else if (supportsMouseEvents()) {
return mouseEventNames[name];
}
return name;
}
function addPointerEvent(target, eventName, handler, options) {
return addDomEvent(target, getPointerEventName(eventName), wrapHandler(handler, eventName === "pointerdown"), options);
}
function usePointerEvent(ref, eventName, handler, options) {
return useDomEvent(ref, getPointerEventName(eventName), handler && wrapHandler(handler, eventName === "pointerdown"), options);
}
// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/gestures/drag/utils/lock.js
function createLock(name) {
var lock = null;
return function () {
var openLock = function () {
lock = null;
};
if (lock === null) {
lock = name;
return openLock;
}
return false;
};
}
var globalHorizontalLock = createLock("dragHorizontal");
var globalVerticalLock = createLock("dragVertical");
function getGlobalLock(drag) {
var lock = false;
if (drag === "y") {
lock = globalVerticalLock();
}
else if (drag === "x") {
lock = globalHorizontalLock();
}
else {
var openHorizontal_1 = globalHorizontalLock();
var openVertical_1 = globalVerticalLock();
if (openHorizontal_1 && openVertical_1) {
lock = function () {
openHorizontal_1();
openVertical_1();
};
}
else {
// Release the locks because we don't use them
if (openHorizontal_1)
openHorizontal_1();
if (openVertical_1)
openVertical_1();
}
}
return lock;
}
function isDragActive() {
// Check the gesture lock - if we get it, it means no drag gesture is active
// and we can safely fire the tap gesture.
var openGestureLock = getGlobalLock(true);
if (!openGestureLock)
return true;
openGestureLock();
return false;
}
// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/gestures/use-hover-gesture.js
function createHoverEvent(visualElement, isActive, callback) {
return function (event, info) {
var _a;
if (!isMouseEvent(event) || isDragActive())
return;
callback === null || callback === void 0 ? void 0 : callback(event, info);
(_a = visualElement.animationState) === null || _a === void 0 ? void 0 : _a.setActive(AnimationType.Hover, isActive);
};
}
function useHoverGesture(_a) {
var onHoverStart = _a.onHoverStart, onHoverEnd = _a.onHoverEnd, whileHover = _a.whileHover, visualElement = _a.visualElement;
usePointerEvent(visualElement, "pointerenter", onHoverStart || whileHover
? createHoverEvent(visualElement, true, onHoverStart)
: undefined);
usePointerEvent(visualElement, "pointerleave", onHoverEnd || whileHover
? createHoverEvent(visualElement, false, onHoverEnd)
: undefined);
}
// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/gestures/utils/is-node-or-child.js
/**
* Recursively traverse up the tree to check whether the provided child node
* is the parent or a descendant of it.
*
* @param parent - Element to find
* @param child - Element to test against parent
*/
var isNodeOrChild = function (parent, child) {
if (!child) {
return false;
}
else if (parent === child) {
return true;
}
else {
return isNodeOrChild(parent, child.parentElement);
}
};
// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/utils/use-unmount-effect.js
function useUnmountEffect(callback) {
return Object(external_React_["useEffect"])(function () { return function () { return callback(); }; }, []);
}
// CONCATENATED MODULE: ./node_modules/popmotion/dist/es/utils/pipe.js
var combineFunctions = function (a, b) { return function (v) { return b(a(v)); }; };
var pipe = function () {
var transformers = [];
for (var _i = 0; _i < arguments.length; _i++) {
transformers[_i] = arguments[_i];
}
return transformers.reduce(combineFunctions);
};
// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/gestures/use-tap-gesture.js
/**
* @param handlers -
* @internal
*/
function useTapGesture(_a) {
var onTap = _a.onTap, onTapStart = _a.onTapStart, onTapCancel = _a.onTapCancel, whileTap = _a.whileTap, visualElement = _a.visualElement;
var hasPressListeners = onTap || onTapStart || onTapCancel || whileTap;
var isPressing = Object(external_React_["useRef"])(false);
var cancelPointerEndListeners = Object(external_React_["useRef"])(null);
function removePointerEndListener() {
var _a;
(_a = cancelPointerEndListeners.current) === null || _a === void 0 ? void 0 : _a.call(cancelPointerEndListeners);
cancelPointerEndListeners.current = null;
}
function checkPointerEnd() {
var _a;
removePointerEndListener();
isPressing.current = false;
(_a = visualElement.animationState) === null || _a === void 0 ? void 0 : _a.setActive(AnimationType.Tap, false);
return !isDragActive();
}
function onPointerUp(event, info) {
if (!checkPointerEnd())
return;
/**
* We only count this as a tap gesture if the event.target is the same
* as, or a child of, this component's element
*/
!isNodeOrChild(visualElement.getInstance(), event.target)
? onTapCancel === null || onTapCancel === void 0 ? void 0 : onTapCancel(event, info)
: onTap === null || onTap === void 0 ? void 0 : onTap(event, info);
}
function onPointerCancel(event, info) {
if (!checkPointerEnd())
return;
onTapCancel === null || onTapCancel === void 0 ? void 0 : onTapCancel(event, info);
}
function onPointerDown(event, info) {
var _a;
removePointerEndListener();
if (isPressing.current)
return;
isPressing.current = true;
cancelPointerEndListeners.current = pipe(addPointerEvent(window, "pointerup", onPointerUp), addPointerEvent(window, "pointercancel", onPointerCancel));
onTapStart === null || onTapStart === void 0 ? void 0 : onTapStart(event, info);
(_a = visualElement.animationState) === null || _a === void 0 ? void 0 : _a.setActive(AnimationType.Tap, true);
}
usePointerEvent(visualElement, "pointerdown", hasPressListeners ? onPointerDown : undefined);
useUnmountEffect(removePointerEndListener);
}
// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/motion/utils/make-renderless-component.js
var makeRenderlessComponent = function (hook) { return function (props) {
hook(props);
return null;
}; };
// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/motion/features/gestures.js
var gestureAnimations = {
tap: makeRenderlessComponent(useTapGesture),
focus: makeRenderlessComponent(useFocusGesture),
hover: makeRenderlessComponent(useHoverGesture),
};
// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/utils/shallow-compare.js
function shallowCompare(next, prev) {
if (!Array.isArray(prev))
return false;
var prevLength = prev.length;
if (prevLength !== next.length)
return false;
for (var i = 0; i < prevLength; i++) {
if (prev[i] !== next[i])
return false;
}
return true;
}
// CONCATENATED MODULE: ./node_modules/popmotion/node_modules/tslib/tslib.es6.js
/*! *****************************************************************************
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 */
var tslib_tslib_es6_extendStatics = function(d, b) {
tslib_tslib_es6_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 tslib_tslib_es6_extendStatics(d, b);
};
function tslib_tslib_es6_extends(d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
tslib_tslib_es6_extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
}
var tslib_tslib_es6_assign = function() {
tslib_tslib_es6_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 tslib_tslib_es6_assign.apply(this, arguments);
}
function tslib_tslib_es6_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 tslib_tslib_es6_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 tslib_tslib_es6_param(paramIndex, decorator) {
return function (target, key) { decorator(target, key, paramIndex); }
}
function tslib_tslib_es6_metadata(metadataKey, metadataValue) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
}
function tslib_tslib_es6_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 tslib_tslib_es6_generator(thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "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 (_) 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 tslib_tslib_es6_createBinding = Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
});
function tslib_tslib_es6_exportStar(m, o) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) tslib_tslib_es6_createBinding(o, m, p);
}
function tslib_tslib_es6_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 tslib_tslib_es6_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 tslib_tslib_es6_spread() {
for (var ar = [], i = 0; i < arguments.length; i++)
ar = ar.concat(tslib_tslib_es6_read(arguments[i]));
return ar;
}
/** @deprecated */
function tslib_tslib_es6_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 tslib_tslib_es6_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 || from);
}
function tslib_tslib_es6_await(v) {
return this instanceof tslib_tslib_es6_await ? (this.v = v, this) : new tslib_tslib_es6_await(v);
}
function tslib_tslib_es6_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 = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
function step(r) { r.value instanceof tslib_tslib_es6_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 tslib_tslib_es6_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: tslib_tslib_es6_await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
}
function tslib_tslib_es6_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 tslib_tslib_es6_values === "function" ? tslib_tslib_es6_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 tslib_tslib_es6_makeTemplateObject(cooked, raw) {
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
return cooked;
};
var tslib_tslib_es6_setModuleDefault = Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
};
function tslib_tslib_es6_importStar(mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) tslib_tslib_es6_createBinding(result, mod, k);
tslib_tslib_es6_setModuleDefault(result, mod);
return result;
}
function tslib_tslib_es6_importDefault(mod) {
return (mod && mod.__esModule) ? mod : { default: mod };
}
function tslib_tslib_es6_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 tslib_tslib_es6_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;
}
// CONCATENATED MODULE: ./node_modules/popmotion/dist/es/utils/clamp.js
var clamp_clamp = function (min, max, v) {
return Math.min(Math.max(v, min), max);
};
// CONCATENATED MODULE: ./node_modules/popmotion/dist/es/animations/utils/find-spring.js
var safeMin = 0.001;
var minDuration = 0.01;
var maxDuration = 10.0;
var minDamping = 0.05;
var maxDamping = 1;
function findSpring(_a) {
var _b = _a.duration, duration = _b === void 0 ? 800 : _b, _c = _a.bounce, bounce = _c === void 0 ? 0.25 : _c, _d = _a.velocity, velocity = _d === void 0 ? 0 : _d, _e = _a.mass, mass = _e === void 0 ? 1 : _e;
var envelope;
var derivative;
warning(duration <= maxDuration * 1000, "Spring duration must be 10 seconds or less");
var dampingRatio = 1 - bounce;
dampingRatio = clamp_clamp(minDamping, maxDamping, dampingRatio);
duration = clamp_clamp(minDuration, maxDuration, duration / 1000);
if (dampingRatio < 1) {
envelope = function (undampedFreq) {
var exponentialDecay = undampedFreq * dampingRatio;
var delta = exponentialDecay * duration;
var a = exponentialDecay - velocity;
var b = calcAngularFreq(undampedFreq, dampingRatio);
var c = Math.exp(-delta);
return safeMin - (a / b) * c;
};
derivative = function (undampedFreq) {
var exponentialDecay = undampedFreq * dampingRatio;
var delta = exponentialDecay * duration;
var d = delta * velocity + velocity;
var e = Math.pow(dampingRatio, 2) * Math.pow(undampedFreq, 2) * duration;
var f = Math.exp(-delta);
var g = calcAngularFreq(Math.pow(undampedFreq, 2), dampingRatio);
var factor = -envelope(undampedFreq) + safeMin > 0 ? -1 : 1;
return (factor * ((d - e) * f)) / g;
};
}
else {
envelope = function (undampedFreq) {
var a = Math.exp(-undampedFreq * duration);
var b = (undampedFreq - velocity) * duration + 1;
return -safeMin + a * b;
};
derivative = function (undampedFreq) {
var a = Math.exp(-undampedFreq * duration);
var b = (velocity - undampedFreq) * (duration * duration);
return a * b;
};
}
var initialGuess = 5 / duration;
var undampedFreq = approximateRoot(envelope, derivative, initialGuess);
duration = duration * 1000;
if (isNaN(undampedFreq)) {
return {
stiffness: 100,
damping: 10,
duration: duration,
};
}
else {
var stiffness = Math.pow(undampedFreq, 2) * mass;
return {
stiffness: stiffness,
damping: dampingRatio * 2 * Math.sqrt(mass * stiffness),
duration: duration,
};
}
}
var rootIterations = 12;
function approximateRoot(envelope, derivative, initialGuess) {
var result = initialGuess;
for (var i = 1; i < rootIterations; i++) {
result = result - envelope(result) / derivative(result);
}
return result;
}
function calcAngularFreq(undampedFreq, dampingRatio) {
return undampedFreq * Math.sqrt(1 - dampingRatio * dampingRatio);
}
// CONCATENATED MODULE: ./node_modules/popmotion/dist/es/animations/generators/spring.js
var durationKeys = ["duration", "bounce"];
var physicsKeys = ["stiffness", "damping", "mass"];
function isSpringType(options, keys) {
return keys.some(function (key) { return options[key] !== undefined; });
}
function getSpringOptions(options) {
var springOptions = tslib_tslib_es6_assign({ velocity: 0.0, stiffness: 100, damping: 10, mass: 1.0, isResolvedFromDuration: false }, options);
if (!isSpringType(options, physicsKeys) &&
isSpringType(options, durationKeys)) {
var derived = findSpring(options);
springOptions = tslib_tslib_es6_assign(tslib_tslib_es6_assign(tslib_tslib_es6_assign({}, springOptions), derived), { velocity: 0.0, mass: 1.0 });
springOptions.isResolvedFromDuration = true;
}
return springOptions;
}
function spring(_a) {
var _b = _a.from, from = _b === void 0 ? 0.0 : _b, _c = _a.to, to = _c === void 0 ? 1.0 : _c, _d = _a.restSpeed, restSpeed = _d === void 0 ? 2 : _d, restDelta = _a.restDelta, options = tslib_tslib_es6_rest(_a, ["from", "to", "restSpeed", "restDelta"]);
var state = { done: false, value: from };
var _e = getSpringOptions(options), stiffness = _e.stiffness, damping = _e.damping, mass = _e.mass, velocity = _e.velocity, duration = _e.duration, isResolvedFromDuration = _e.isResolvedFromDuration;
var resolveSpring = zero;
var resolveVelocity = zero;
function createSpring() {
var initialVelocity = velocity ? -(velocity / 1000) : 0.0;
var initialDelta = to - from;
var dampingRatio = damping / (2 * Math.sqrt(stiffness * mass));
var undampedAngularFreq = Math.sqrt(stiffness / mass) / 1000;
restDelta !== null && restDelta !== void 0 ? restDelta : (restDelta = Math.abs(to - from) <= 1 ? 0.01 : 0.4);
if (dampingRatio < 1) {
var angularFreq_1 = calcAngularFreq(undampedAngularFreq, dampingRatio);
resolveSpring = function (t) {
var envelope = Math.exp(-dampingRatio * undampedAngularFreq * t);
return (to -
envelope *
(((initialVelocity +
dampingRatio * undampedAngularFreq * initialDelta) /
angularFreq_1) *
Math.sin(angularFreq_1 * t) +
initialDelta * Math.cos(angularFreq_1 * t)));
};
resolveVelocity = function (t) {
var envelope = Math.exp(-dampingRatio * undampedAngularFreq * t);
return (dampingRatio *
undampedAngularFreq *
envelope *
((Math.sin(angularFreq_1 * t) *
(initialVelocity +
dampingRatio *
undampedAngularFreq *
initialDelta)) /
angularFreq_1 +
initialDelta * Math.cos(angularFreq_1 * t)) -
envelope *
(Math.cos(angularFreq_1 * t) *
(initialVelocity +
dampingRatio *
undampedAngularFreq *
initialDelta) -
angularFreq_1 *
initialDelta *
Math.sin(angularFreq_1 * t)));
};
}
else if (dampingRatio === 1) {
resolveSpring = function (t) {
return to -
Math.exp(-undampedAngularFreq * t) *
(initialDelta +
(initialVelocity + undampedAngularFreq * initialDelta) *
t);
};
}
else {
var dampedAngularFreq_1 = undampedAngularFreq * Math.sqrt(dampingRatio * dampingRatio - 1);
resolveSpring = function (t) {
var envelope = Math.exp(-dampingRatio * undampedAngularFreq * t);
var freqForT = Math.min(dampedAngularFreq_1 * t, 300);
return (to -
(envelope *
((initialVelocity +
dampingRatio * undampedAngularFreq * initialDelta) *
Math.sinh(freqForT) +
dampedAngularFreq_1 *
initialDelta *
Math.cosh(freqForT))) /
dampedAngularFreq_1);
};
}
}
createSpring();
return {
next: function (t) {
var current = resolveSpring(t);
if (!isResolvedFromDuration) {
var currentVelocity = resolveVelocity(t) * 1000;
var isBelowVelocityThreshold = Math.abs(currentVelocity) <= restSpeed;
var isBelowDisplacementThreshold = Math.abs(to - current) <= restDelta;
state.done =
isBelowVelocityThreshold && isBelowDisplacementThreshold;
}
else {
state.done = t >= duration;
}
state.value = state.done ? to : current;
return state;
},
flipTarget: function () {
var _a;
velocity = -velocity;
_a = [to, from], from = _a[0], to = _a[1];
createSpring();
},
};
}
spring.needsInterpolation = function (a, b) {
return typeof a === "string" || typeof b === "string";
};
var zero = function (_t) { return 0; };
// CONCATENATED MODULE: ./node_modules/popmotion/dist/es/utils/progress.js
var progress_progress = function (from, to, value) {
var toFromDifference = to - from;
return toFromDifference === 0 ? 1 : (value - from) / toFromDifference;
};
// CONCATENATED MODULE: ./node_modules/popmotion/dist/es/utils/mix.js
var mix = function (from, to, progress) {
return -progress * from + progress * to + from;
};
// CONCATENATED MODULE: ./node_modules/style-value-types/dist/es/color/utils.js
var isColorString = function (type, testProp) { return function (v) {
return Boolean((isString(v) && singleColorRegex.test(v) && v.startsWith(type)) ||
(testProp && Object.prototype.hasOwnProperty.call(v, testProp)));
}; };
var splitColor = function (aName, bName, cName) { return function (v) {
var _a;
if (!isString(v))
return v;
var _b = v.match(floatRegex), a = _b[0], b = _b[1], c = _b[2], alpha = _b[3];
return _a = {},
_a[aName] = parseFloat(a),
_a[bName] = parseFloat(b),
_a[cName] = parseFloat(c),
_a.alpha = alpha !== undefined ? parseFloat(alpha) : 1,
_a;
}; };
// CONCATENATED MODULE: ./node_modules/style-value-types/dist/es/color/rgba.js
var clampRgbUnit = clamp(0, 255);
var rgbUnit = tslib_es6_assign(tslib_es6_assign({}, numbers_number), { transform: function (v) { return Math.round(clampRgbUnit(v)); } });
var rgba = {
test: isColorString('rgb', 'red'),
parse: splitColor('red', 'green', 'blue'),
transform: function (_a) {
var red = _a.red, green = _a.green, blue = _a.blue, _b = _a.alpha, alpha$1 = _b === void 0 ? 1 : _b;
return 'rgba(' +
rgbUnit.transform(red) +
', ' +
rgbUnit.transform(green) +
', ' +
rgbUnit.transform(blue) +
', ' +
sanitize(numbers_alpha.transform(alpha$1)) +
')';
},
};
// CONCATENATED MODULE: ./node_modules/style-value-types/dist/es/color/hex.js
function parseHex(v) {
var r = '';
var g = '';
var b = '';
var a = '';
if (v.length > 5) {
r = v.substr(1, 2);
g = v.substr(3, 2);
b = v.substr(5, 2);
a = v.substr(7, 2);
}
else {
r = v.substr(1, 1);
g = v.substr(2, 1);
b = v.substr(3, 1);
a = v.substr(4, 1);
r += r;
g += g;
b += b;
a += a;
}
return {
red: parseInt(r, 16),
green: parseInt(g, 16),
blue: parseInt(b, 16),
alpha: a ? parseInt(a, 16) / 255 : 1,
};
}
var hex = {
test: isColorString('#'),
parse: parseHex,
transform: rgba.transform,
};
// CONCATENATED MODULE: ./node_modules/style-value-types/dist/es/color/hsla.js
var hsla = {
test: isColorString('hsl', 'hue'),
parse: splitColor('hue', 'saturation', 'lightness'),
transform: function (_a) {
var hue = _a.hue, saturation = _a.saturation, lightness = _a.lightness, _b = _a.alpha, alpha$1 = _b === void 0 ? 1 : _b;
return ('hsla(' +
Math.round(hue) +
', ' +
percent.transform(sanitize(saturation)) +
', ' +
percent.transform(sanitize(lightness)) +
', ' +
sanitize(numbers_alpha.transform(alpha$1)) +
')');
},
};
// CONCATENATED MODULE: ./node_modules/popmotion/dist/es/utils/mix-color.js
var mixLinearColor = function (from, to, v) {
var fromExpo = from * from;
var toExpo = to * to;
return Math.sqrt(Math.max(0, v * (toExpo - fromExpo) + fromExpo));
};
var colorTypes = [hex, rgba, hsla];
var getColorType = function (v) {
return colorTypes.find(function (type) { return type.test(v); });
};
var notAnimatable = function (color) {
return "'" + color + "' is not an animatable color. Use the equivalent color code instead.";
};
var mixColor = function (from, to) {
var fromColorType = getColorType(from);
var toColorType = getColorType(to);
invariant(!!fromColorType, notAnimatable(from));
invariant(!!toColorType, notAnimatable(to));
invariant(fromColorType.transform === toColorType.transform, "Both colors must be hex/RGBA, OR both must be HSLA.");
var fromColor = fromColorType.parse(from);
var toColor = toColorType.parse(to);
var blended = tslib_tslib_es6_assign({}, fromColor);
var mixFunc = fromColorType === hsla ? mix : mixLinearColor;
return function (v) {
for (var key in blended) {
if (key !== "alpha") {
blended[key] = mixFunc(fromColor[key], toColor[key], v);
}
}
blended.alpha = mix(fromColor.alpha, toColor.alpha, v);
return fromColorType.transform(blended);
};
};
// CONCATENATED MODULE: ./node_modules/style-value-types/dist/es/color/index.js
var color = {
test: function (v) { return rgba.test(v) || hex.test(v) || hsla.test(v); },
parse: function (v) {
if (rgba.test(v)) {
return rgba.parse(v);
}
else if (hsla.test(v)) {
return hsla.parse(v);
}
else {
return hex.parse(v);
}
},
transform: function (v) {
return isString(v)
? v
: v.hasOwnProperty('red')
? rgba.transform(v)
: hsla.transform(v);
},
};
// CONCATENATED MODULE: ./node_modules/style-value-types/dist/es/complex/index.js
var colorToken = '${c}';
var numberToken = '${n}';
function test(v) {
var _a, _b, _c, _d;
return (isNaN(v) &&
isString(v) &&
((_b = (_a = v.match(floatRegex)) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0) + ((_d = (_c = v.match(colorRegex)) === null || _c === void 0 ? void 0 : _c.length) !== null && _d !== void 0 ? _d : 0) > 0);
}
function analyse(v) {
var values = [];
var numColors = 0;
var colors = v.match(colorRegex);
if (colors) {
numColors = colors.length;
v = v.replace(colorRegex, colorToken);
values.push.apply(values, colors.map(color.parse));
}
var numbers = v.match(floatRegex);
if (numbers) {
v = v.replace(floatRegex, numberToken);
values.push.apply(values, numbers.map(numbers_number.parse));
}
return { values: values, numColors: numColors, tokenised: v };
}
function parse(v) {
return analyse(v).values;
}
function createTransformer(v) {
var _a = analyse(v), values = _a.values, numColors = _a.numColors, tokenised = _a.tokenised;
var numValues = values.length;
return function (v) {
var output = tokenised;
for (var i = 0; i < numValues; i++) {
output = output.replace(i < numColors ? colorToken : numberToken, i < numColors ? color.transform(v[i]) : sanitize(v[i]));
}
return output;
};
}
var convertNumbersToZero = function (v) {
return typeof v === 'number' ? 0 : v;
};
function getAnimatableNone(v) {
var parsed = parse(v);
var transformer = createTransformer(v);
return transformer(parsed.map(convertNumbersToZero));
}
var complex = { test: test, parse: parse, createTransformer: createTransformer, getAnimatableNone: getAnimatableNone };
// CONCATENATED MODULE: ./node_modules/popmotion/dist/es/utils/inc.js
var zeroPoint = {
x: 0,
y: 0,
z: 0
};
var isNum = function (v) { return typeof v === 'number'; };
// CONCATENATED MODULE: ./node_modules/popmotion/dist/es/utils/mix-complex.js
function getMixer(origin, target) {
if (isNum(origin)) {
return function (v) { return mix(origin, target, v); };
}
else if (color.test(origin)) {
return mixColor(origin, target);
}
else {
return mixComplex(origin, target);
}
}
var mixArray = function (from, to) {
var output = tslib_tslib_es6_spreadArray([], from);
var numValues = output.length;
var blendValue = from.map(function (fromThis, i) { return getMixer(fromThis, to[i]); });
return function (v) {
for (var i = 0; i < numValues; i++) {
output[i] = blendValue[i](v);
}
return output;
};
};
var mixObject = function (origin, target) {
var output = tslib_tslib_es6_assign(tslib_tslib_es6_assign({}, origin), target);
var blendValue = {};
for (var key in output) {
if (origin[key] !== undefined && target[key] !== undefined) {
blendValue[key] = getMixer(origin[key], target[key]);
}
}
return function (v) {
for (var key in blendValue) {
output[key] = blendValue[key](v);
}
return output;
};
};
function mix_complex_analyse(value) {
var parsed = complex.parse(value);
var numValues = parsed.length;
var numNumbers = 0;
var numRGB = 0;
var numHSL = 0;
for (var i = 0; i < numValues; i++) {
if (numNumbers || typeof parsed[i] === "number") {
numNumbers++;
}
else {
if (parsed[i].hue !== undefined) {
numHSL++;
}
else {
numRGB++;
}
}
}
return { parsed: parsed, numNumbers: numNumbers, numRGB: numRGB, numHSL: numHSL };
}
var mixComplex = function (origin, target) {
var template = complex.createTransformer(target);
var originStats = mix_complex_analyse(origin);
var targetStats = mix_complex_analyse(target);
invariant(originStats.numHSL === targetStats.numHSL &&
originStats.numRGB === targetStats.numRGB &&
originStats.numNumbers >= targetStats.numNumbers, "Complex values '" + origin + "' and '" + target + "' too different to mix. Ensure all colors are of the same type.");
return pipe(mixArray(originStats.parsed, targetStats.parsed), template);
};
// CONCATENATED MODULE: ./node_modules/popmotion/dist/es/utils/interpolate.js
var mixNumber = function (from, to) { return function (p) { return mix(from, to, p); }; };
function detectMixerFactory(v) {
if (typeof v === 'number') {
return mixNumber;
}
else if (typeof v === 'string') {
if (color.test(v)) {
return mixColor;
}
else {
return mixComplex;
}
}
else if (Array.isArray(v)) {
return mixArray;
}
else if (typeof v === 'object') {
return mixObject;
}
}
function createMixers(output, ease, customMixer) {
var mixers = [];
var mixerFactory = customMixer || detectMixerFactory(output[0]);
var numMixers = output.length - 1;
for (var i = 0; i < numMixers; i++) {
var mixer = mixerFactory(output[i], output[i + 1]);
if (ease) {
var easingFunction = Array.isArray(ease) ? ease[i] : ease;
mixer = pipe(easingFunction, mixer);
}
mixers.push(mixer);
}
return mixers;
}
function fastInterpolate(_a, _b) {
var from = _a[0], to = _a[1];
var mixer = _b[0];
return function (v) { return mixer(progress_progress(from, to, v)); };
}
function slowInterpolate(input, mixers) {
var inputLength = input.length;
var lastInputIndex = inputLength - 1;
return function (v) {
var mixerIndex = 0;
var foundMixerIndex = false;
if (v <= input[0]) {
foundMixerIndex = true;
}
else if (v >= input[lastInputIndex]) {
mixerIndex = lastInputIndex - 1;
foundMixerIndex = true;
}
if (!foundMixerIndex) {
var i = 1;
for (; i < inputLength; i++) {
if (input[i] > v || i === lastInputIndex) {
break;
}
}
mixerIndex = i - 1;
}
var progressInRange = progress_progress(input[mixerIndex], input[mixerIndex + 1], v);
return mixers[mixerIndex](progressInRange);
};
}
function interpolate(input, output, _a) {
var _b = _a === void 0 ? {} : _a, _c = _b.clamp, isClamp = _c === void 0 ? true : _c, ease = _b.ease, mixer = _b.mixer;
var inputLength = input.length;
invariant(inputLength === output.length, 'Both input and output ranges must be the same length');
invariant(!ease || !Array.isArray(ease) || ease.length === inputLength - 1, 'Array of easing functions must be of length `input.length - 1`, as it applies to the transitions **between** the defined values.');
if (input[0] > input[inputLength - 1]) {
input = [].concat(input);
output = [].concat(output);
input.reverse();
output.reverse();
}
var mixers = createMixers(output, ease, mixer);
var interpolator = inputLength === 2
? fastInterpolate(input, mixers)
: slowInterpolate(input, mixers);
return isClamp
? function (v) { return interpolator(clamp_clamp(input[0], input[inputLength - 1], v)); }
: interpolator;
}
// CONCATENATED MODULE: ./node_modules/popmotion/dist/es/easing/utils.js
var reverseEasing = function (easing) { return function (p) { return 1 - easing(1 - p); }; };
var mirrorEasing = function (easing) { return function (p) {
return p <= 0.5 ? easing(2 * p) / 2 : (2 - easing(2 * (1 - p))) / 2;
}; };
var createExpoIn = function (power) { return function (p) { return Math.pow(p, power); }; };
var createBackIn = function (power) { return function (p) {
return p * p * ((power + 1) * p - power);
}; };
var createAnticipate = function (power) {
var backEasing = createBackIn(power);
return function (p) {
return (p *= 2) < 1
? 0.5 * backEasing(p)
: 0.5 * (2 - Math.pow(2, -10 * (p - 1)));
};
};
// CONCATENATED MODULE: ./node_modules/popmotion/dist/es/easing/index.js
var DEFAULT_OVERSHOOT_STRENGTH = 1.525;
var BOUNCE_FIRST_THRESHOLD = 4.0 / 11.0;
var BOUNCE_SECOND_THRESHOLD = 8.0 / 11.0;
var BOUNCE_THIRD_THRESHOLD = 9.0 / 10.0;
var linear = function (p) { return p; };
var easeIn = createExpoIn(2);
var easeOut = reverseEasing(easeIn);
var easeInOut = mirrorEasing(easeIn);
var circIn = function (p) { return 1 - Math.sin(Math.acos(p)); };
var circOut = reverseEasing(circIn);
var circInOut = mirrorEasing(circOut);
var backIn = createBackIn(DEFAULT_OVERSHOOT_STRENGTH);
var backOut = reverseEasing(backIn);
var backInOut = mirrorEasing(backIn);
var anticipate = createAnticipate(DEFAULT_OVERSHOOT_STRENGTH);
var ca = 4356.0 / 361.0;
var cb = 35442.0 / 1805.0;
var cc = 16061.0 / 1805.0;
var bounceOut = function (p) {
if (p === 1 || p === 0)
return p;
var p2 = p * p;
return p < BOUNCE_FIRST_THRESHOLD
? 7.5625 * p2
: p < BOUNCE_SECOND_THRESHOLD
? 9.075 * p2 - 9.9 * p + 3.4
: p < BOUNCE_THIRD_THRESHOLD
? ca * p2 - cb * p + cc
: 10.8 * p * p - 20.52 * p + 10.72;
};
var bounceIn = reverseEasing(bounceOut);
var bounceInOut = function (p) {
return p < 0.5
? 0.5 * (1.0 - bounceOut(1.0 - p * 2.0))
: 0.5 * bounceOut(p * 2.0 - 1.0) + 0.5;
};
// CONCATENATED MODULE: ./node_modules/popmotion/dist/es/animations/generators/keyframes.js
function defaultEasing(values, easing) {
return values.map(function () { return easing || easeInOut; }).splice(0, values.length - 1);
}
function defaultOffset(values) {
var numValues = values.length;
return values.map(function (_value, i) {
return i !== 0 ? i / (numValues - 1) : 0;
});
}
function convertOffsetToTimes(offset, duration) {
return offset.map(function (o) { return o * duration; });
}
function keyframes(_a) {
var _b = _a.from, from = _b === void 0 ? 0 : _b, _c = _a.to, to = _c === void 0 ? 1 : _c, ease = _a.ease, offset = _a.offset, _d = _a.duration, duration = _d === void 0 ? 300 : _d;
var state = { done: false, value: from };
var values = Array.isArray(to) ? to : [from, to];
var times = convertOffsetToTimes(offset && offset.length === values.length
? offset
: defaultOffset(values), duration);
function createInterpolator() {
return interpolate(times, values, {
ease: Array.isArray(ease) ? ease : defaultEasing(values, ease),
});
}
var interpolator = createInterpolator();
return {
next: function (t) {
state.value = interpolator(t);
state.done = t >= duration;
return state;
},
flipTarget: function () {
values.reverse();
interpolator = createInterpolator();
},
};
}
// CONCATENATED MODULE: ./node_modules/popmotion/dist/es/animations/generators/decay.js
function decay(_a) {
var _b = _a.velocity, velocity = _b === void 0 ? 0 : _b, _c = _a.from, from = _c === void 0 ? 0 : _c, _d = _a.power, power = _d === void 0 ? 0.8 : _d, _e = _a.timeConstant, timeConstant = _e === void 0 ? 350 : _e, _f = _a.restDelta, restDelta = _f === void 0 ? 0.5 : _f, modifyTarget = _a.modifyTarget;
var state = { done: false, value: from };
var amplitude = power * velocity;
var ideal = from + amplitude;
var target = modifyTarget === undefined ? ideal : modifyTarget(ideal);
if (target !== ideal)
amplitude = target - from;
return {
next: function (t) {
var delta = -amplitude * Math.exp(-t / timeConstant);
state.done = !(delta > restDelta || delta < -restDelta);
state.value = state.done ? target : target + delta;
return state;
},
flipTarget: function () { },
};
}
// CONCATENATED MODULE: ./node_modules/popmotion/dist/es/animations/utils/detect-animation-from-options.js
var types = { keyframes: keyframes, spring: spring, decay: decay };
function detectAnimationFromOptions(config) {
if (Array.isArray(config.to)) {
return keyframes;
}
else if (types[config.type]) {
return types[config.type];
}
var keys = new Set(Object.keys(config));
if (keys.has("ease") ||
(keys.has("duration") && !keys.has("dampingRatio"))) {
return keyframes;
}
else if (keys.has("dampingRatio") ||
keys.has("stiffness") ||
keys.has("mass") ||
keys.has("damping") ||
keys.has("restSpeed") ||
keys.has("restDelta")) {
return spring;
}
return keyframes;
}
// CONCATENATED MODULE: ./node_modules/framesync/dist/es/on-next-frame.js
var defaultTimestep = (1 / 60) * 1000;
var getCurrentTime = typeof performance !== "undefined"
? function () { return performance.now(); }
: function () { return Date.now(); };
var onNextFrame = typeof window !== "undefined"
? function (callback) {
return window.requestAnimationFrame(callback);
}
: function (callback) {
return setTimeout(function () { return callback(getCurrentTime()); }, defaultTimestep);
};
// CONCATENATED MODULE: ./node_modules/framesync/dist/es/create-render-step.js
function createRenderStep(runNextFrame) {
var toRun = [];
var toRunNextFrame = [];
var numToRun = 0;
var isProcessing = false;
var toKeepAlive = new WeakSet();
var step = {
schedule: function (callback, keepAlive, immediate) {
if (keepAlive === void 0) { keepAlive = false; }
if (immediate === void 0) { immediate = false; }
var addToCurrentFrame = immediate && isProcessing;
var buffer = addToCurrentFrame ? toRun : toRunNextFrame;
if (keepAlive)
toKeepAlive.add(callback);
if (buffer.indexOf(callback) === -1) {
buffer.push(callback);
if (addToCurrentFrame && isProcessing)
numToRun = toRun.length;
}
return callback;
},
cancel: function (callback) {
var index = toRunNextFrame.indexOf(callback);
if (index !== -1)
toRunNextFrame.splice(index, 1);
toKeepAlive.delete(callback);
},
process: function (frameData) {
var _a;
isProcessing = true;
_a = [toRunNextFrame, toRun], toRun = _a[0], toRunNextFrame = _a[1];
toRunNextFrame.length = 0;
numToRun = toRun.length;
if (numToRun) {
for (var i = 0; i < numToRun; i++) {
var callback = toRun[i];
callback(frameData);
if (toKeepAlive.has(callback)) {
step.schedule(callback);
runNextFrame();
}
}
}
isProcessing = false;
},
};
return step;
}
// CONCATENATED MODULE: ./node_modules/framesync/dist/es/index.js
var maxElapsed = 40;
var useDefaultElapsed = true;
var runNextFrame = false;
var isProcessing = false;
var es_frame = {
delta: 0,
timestamp: 0
};
var stepsOrder = ["read", "update", "preRender", "render", "postRender"];
var steps = /*#__PURE__*/stepsOrder.reduce(function (acc, key) {
acc[key] = createRenderStep(function () {
return runNextFrame = true;
});
return acc;
}, {});
var sync = /*#__PURE__*/stepsOrder.reduce(function (acc, key) {
var step = steps[key];
acc[key] = function (process, keepAlive, immediate) {
if (keepAlive === void 0) {
keepAlive = false;
}
if (immediate === void 0) {
immediate = false;
}
if (!runNextFrame) startLoop();
return step.schedule(process, keepAlive, immediate);
};
return acc;
}, {});
var cancelSync = /*#__PURE__*/stepsOrder.reduce(function (acc, key) {
acc[key] = steps[key].cancel;
return acc;
}, {});
var flushSync = /*#__PURE__*/stepsOrder.reduce(function (acc, key) {
acc[key] = function () {
return steps[key].process(es_frame);
};
return acc;
}, {});
var processStep = function (stepId) {
return steps[stepId].process(es_frame);
};
var processFrame = function (timestamp) {
runNextFrame = false;
es_frame.delta = useDefaultElapsed ? defaultTimestep : Math.max(Math.min(timestamp - es_frame.timestamp, maxElapsed), 1);
es_frame.timestamp = timestamp;
isProcessing = true;
stepsOrder.forEach(processStep);
isProcessing = false;
if (runNextFrame) {
useDefaultElapsed = false;
onNextFrame(processFrame);
}
};
var startLoop = function () {
runNextFrame = true;
useDefaultElapsed = true;
if (!isProcessing) onNextFrame(processFrame);
};
var getFrameData = function () {
return es_frame;
};
/* harmony default export */ var es = (sync);
// CONCATENATED MODULE: ./node_modules/popmotion/dist/es/animations/utils/elapsed.js
function loopElapsed(elapsed, duration, delay) {
if (delay === void 0) { delay = 0; }
return elapsed - duration - delay;
}
function reverseElapsed(elapsed, duration, delay, isForwardPlayback) {
if (delay === void 0) { delay = 0; }
if (isForwardPlayback === void 0) { isForwardPlayback = true; }
return isForwardPlayback
? loopElapsed(duration + -elapsed, duration, delay)
: duration - (elapsed - duration) + delay;
}
function hasRepeatDelayElapsed(elapsed, duration, delay, isForwardPlayback) {
return isForwardPlayback ? elapsed >= duration + delay : elapsed <= -delay;
}
// CONCATENATED MODULE: ./node_modules/popmotion/dist/es/animations/index.js
var framesync = function (update) {
var passTimestamp = function (_a) {
var delta = _a.delta;
return update(delta);
};
return {
start: function () { return es.update(passTimestamp, true); },
stop: function () { return cancelSync.update(passTimestamp); },
};
};
function animations_animate(_a) {
var _b, _c;
var from = _a.from, _d = _a.autoplay, autoplay = _d === void 0 ? true : _d, _e = _a.driver, driver = _e === void 0 ? framesync : _e, _f = _a.elapsed, elapsed = _f === void 0 ? 0 : _f, _g = _a.repeat, repeatMax = _g === void 0 ? 0 : _g, _h = _a.repeatType, repeatType = _h === void 0 ? "loop" : _h, _j = _a.repeatDelay, repeatDelay = _j === void 0 ? 0 : _j, onPlay = _a.onPlay, onStop = _a.onStop, onComplete = _a.onComplete, onRepeat = _a.onRepeat, onUpdate = _a.onUpdate, options = tslib_tslib_es6_rest(_a, ["from", "autoplay", "driver", "elapsed", "repeat", "repeatType", "repeatDelay", "onPlay", "onStop", "onComplete", "onRepeat", "onUpdate"]);
var to = options.to;
var driverControls;
var repeatCount = 0;
var computedDuration = options.duration;
var latest;
var isComplete = false;
var isForwardPlayback = true;
var interpolateFromNumber;
var animator = detectAnimationFromOptions(options);
if ((_c = (_b = animator).needsInterpolation) === null || _c === void 0 ? void 0 : _c.call(_b, from, to)) {
interpolateFromNumber = interpolate([0, 100], [from, to], {
clamp: false,
});
from = 0;
to = 100;
}
var animation = animator(tslib_tslib_es6_assign(tslib_tslib_es6_assign({}, options), { from: from, to: to }));
function repeat() {
repeatCount++;
if (repeatType === "reverse") {
isForwardPlayback = repeatCount % 2 === 0;
elapsed = reverseElapsed(elapsed, computedDuration, repeatDelay, isForwardPlayback);
}
else {
elapsed = loopElapsed(elapsed, computedDuration, repeatDelay);
if (repeatType === "mirror")
animation.flipTarget();
}
isComplete = false;
onRepeat && onRepeat();
}
function complete() {
driverControls.stop();
onComplete && onComplete();
}
function update(delta) {
if (!isForwardPlayback)
delta = -delta;
elapsed += delta;
if (!isComplete) {
var state = animation.next(Math.max(0, elapsed));
latest = state.value;
if (interpolateFromNumber)
latest = interpolateFromNumber(latest);
isComplete = isForwardPlayback ? state.done : elapsed <= 0;
}
onUpdate === null || onUpdate === void 0 ? void 0 : onUpdate(latest);
if (isComplete) {
if (repeatCount === 0)
computedDuration !== null && computedDuration !== void 0 ? computedDuration : (computedDuration = elapsed);
if (repeatCount < repeatMax) {
hasRepeatDelayElapsed(elapsed, computedDuration, repeatDelay, isForwardPlayback) && repeat();
}
else {
complete();
}
}
}
function play() {
onPlay === null || onPlay === void 0 ? void 0 : onPlay();
driverControls = driver(update);
driverControls.start();
}
autoplay && play();
return {
stop: function () {
onStop === null || onStop === void 0 ? void 0 : onStop();
driverControls.stop();
},
};
}
// CONCATENATED MODULE: ./node_modules/popmotion/dist/es/utils/velocity-per-second.js
function velocityPerSecond(velocity, frameDuration) {
return frameDuration ? velocity * (1000 / frameDuration) : 0;
}
// CONCATENATED MODULE: ./node_modules/popmotion/dist/es/animations/inertia.js
function inertia_inertia(_a) {
var _b = _a.from, from = _b === void 0 ? 0 : _b, _c = _a.velocity, velocity = _c === void 0 ? 0 : _c, min = _a.min, max = _a.max, _d = _a.power, power = _d === void 0 ? 0.8 : _d, _e = _a.timeConstant, timeConstant = _e === void 0 ? 750 : _e, _f = _a.bounceStiffness, bounceStiffness = _f === void 0 ? 500 : _f, _g = _a.bounceDamping, bounceDamping = _g === void 0 ? 10 : _g, _h = _a.restDelta, restDelta = _h === void 0 ? 1 : _h, modifyTarget = _a.modifyTarget, driver = _a.driver, onUpdate = _a.onUpdate, onComplete = _a.onComplete;
var currentAnimation;
function isOutOfBounds(v) {
return (min !== undefined && v < min) || (max !== undefined && v > max);
}
function boundaryNearest(v) {
if (min === undefined)
return max;
if (max === undefined)
return min;
return Math.abs(min - v) < Math.abs(max - v) ? min : max;
}
function startAnimation(options) {
currentAnimation === null || currentAnimation === void 0 ? void 0 : currentAnimation.stop();
currentAnimation = animations_animate(tslib_tslib_es6_assign(tslib_tslib_es6_assign({}, options), { driver: driver, onUpdate: function (v) {
var _a;
onUpdate === null || onUpdate === void 0 ? void 0 : onUpdate(v);
(_a = options.onUpdate) === null || _a === void 0 ? void 0 : _a.call(options, v);
}, onComplete: onComplete }));
}
function startSpring(options) {
startAnimation(tslib_tslib_es6_assign({ type: "spring", stiffness: bounceStiffness, damping: bounceDamping, restDelta: restDelta }, options));
}
if (isOutOfBounds(from)) {
startSpring({ from: from, velocity: velocity, to: boundaryNearest(from) });
}
else {
var target = power * velocity + from;
if (typeof modifyTarget !== "undefined")
target = modifyTarget(target);
var boundary_1 = boundaryNearest(target);
var heading_1 = boundary_1 === min ? -1 : 1;
var prev_1;
var current_1;
var checkBoundary = function (v) {
prev_1 = current_1;
current_1 = v;
velocity = velocityPerSecond(v - prev_1, getFrameData().delta);
if ((heading_1 === 1 && v > boundary_1) ||
(heading_1 === -1 && v < boundary_1)) {
startSpring({ from: v, to: boundary_1, velocity: velocity });
}
};
startAnimation({
type: "decay",
from: from,
velocity: velocity,
timeConstant: timeConstant,
power: power,
restDelta: restDelta,
modifyTarget: modifyTarget,
onUpdate: isOutOfBounds(target) ? checkBoundary : undefined,
});
}
return {
stop: function () { return currentAnimation === null || currentAnimation === void 0 ? void 0 : currentAnimation.stop(); },
};
}
// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/utils/time-conversion.js
/**
* Converts seconds to milliseconds
*
* @param seconds - Time in seconds.
* @return milliseconds - Converted time in milliseconds.
*/
var secondsToMilliseconds = function (seconds) { return seconds * 1000; };
// CONCATENATED MODULE: ./node_modules/popmotion/dist/es/easing/cubic-bezier.js
var cubic_bezier_a = function (a1, a2) { return 1.0 - 3.0 * a2 + 3.0 * a1; };
var cubic_bezier_b = function (a1, a2) { return 3.0 * a2 - 6.0 * a1; };
var cubic_bezier_c = function (a1) { return 3.0 * a1; };
var calcBezier = function (t, a1, a2) {
return ((cubic_bezier_a(a1, a2) * t + cubic_bezier_b(a1, a2)) * t + cubic_bezier_c(a1)) * t;
};
var getSlope = function (t, a1, a2) {
return 3.0 * cubic_bezier_a(a1, a2) * t * t + 2.0 * cubic_bezier_b(a1, a2) * t + cubic_bezier_c(a1);
};
var subdivisionPrecision = 0.0000001;
var subdivisionMaxIterations = 10;
function binarySubdivide(aX, aA, aB, mX1, mX2) {
var currentX;
var currentT;
var i = 0;
do {
currentT = aA + (aB - aA) / 2.0;
currentX = calcBezier(currentT, mX1, mX2) - aX;
if (currentX > 0.0) {
aB = currentT;
}
else {
aA = currentT;
}
} while (Math.abs(currentX) > subdivisionPrecision &&
++i < subdivisionMaxIterations);
return currentT;
}
var newtonIterations = 8;
var newtonMinSlope = 0.001;
function newtonRaphsonIterate(aX, aGuessT, mX1, mX2) {
for (var i = 0; i < newtonIterations; ++i) {
var currentSlope = getSlope(aGuessT, mX1, mX2);
if (currentSlope === 0.0) {
return aGuessT;
}
var currentX = calcBezier(aGuessT, mX1, mX2) - aX;
aGuessT -= currentX / currentSlope;
}
return aGuessT;
}
var kSplineTableSize = 11;
var kSampleStepSize = 1.0 / (kSplineTableSize - 1.0);
function cubicBezier(mX1, mY1, mX2, mY2) {
if (mX1 === mY1 && mX2 === mY2)
return linear;
var sampleValues = new Float32Array(kSplineTableSize);
for (var i = 0; i < kSplineTableSize; ++i) {
sampleValues[i] = calcBezier(i * kSampleStepSize, mX1, mX2);
}
function getTForX(aX) {
var intervalStart = 0.0;
var currentSample = 1;
var lastSample = kSplineTableSize - 1;
for (; currentSample !== lastSample && sampleValues[currentSample] <= aX; ++currentSample) {
intervalStart += kSampleStepSize;
}
--currentSample;
var dist = (aX - sampleValues[currentSample]) /
(sampleValues[currentSample + 1] - sampleValues[currentSample]);
var guessForT = intervalStart + dist * kSampleStepSize;
var initialSlope = getSlope(guessForT, mX1, mX2);
if (initialSlope >= newtonMinSlope) {
return newtonRaphsonIterate(aX, guessForT, mX1, mX2);
}
else if (initialSlope === 0.0) {
return guessForT;
}
else {
return binarySubdivide(aX, intervalStart, intervalStart + kSampleStepSize, mX1, mX2);
}
}
return function (t) {
return t === 0 || t === 1 ? t : calcBezier(getTForX(t), mY1, mY2);
};
}
// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/animation/utils/easing.js
var easingLookup = {
linear: linear,
easeIn: easeIn,
easeInOut: easeInOut,
easeOut: easeOut,
circIn: circIn,
circInOut: circInOut,
circOut: circOut,
backIn: backIn,
backInOut: backInOut,
backOut: backOut,
anticipate: anticipate,
bounceIn: bounceIn,
bounceInOut: bounceInOut,
bounceOut: bounceOut,
};
var easingDefinitionToFunction = function (definition) {
if (Array.isArray(definition)) {
// If cubic bezier definition, create bezier curve
invariant(definition.length === 4, "Cubic bezier arrays must contain four numerical values.");
var _a = __read(definition, 4), x1 = _a[0], y1 = _a[1], x2 = _a[2], y2 = _a[3];
return cubicBezier(x1, y1, x2, y2);
}
else if (typeof definition === "string") {
// Else lookup from table
invariant(easingLookup[definition] !== undefined, "Invalid easing type '" + definition + "'");
return easingLookup[definition];
}
return definition;
};
var isEasingArray = function (ease) {
return Array.isArray(ease) && typeof ease[0] !== "number";
};
// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/animation/utils/is-animatable.js
/**
* Check if a value is animatable. Examples:
*
* ✅: 100, "100px", "#fff"
* ❌: "block", "url(2.jpg)"
* @param value
*
* @internal
*/
var isAnimatable = function (key, value) {
// If the list of keys tat might be non-animatable grows, replace with Set
if (key === "zIndex")
return false;
// If it's a number or a keyframes array, we can animate it. We might at some point
// need to do a deep isAnimatable check of keyframes, or let Popmotion handle this,
// but for now lets leave it like this for performance reasons
if (typeof value === "number" || Array.isArray(value))
return true;
if (typeof value === "string" && // It's animatable if we have a string
complex.test(value) && // And it contains numbers and/or colors
!value.startsWith("url(") // Unless it starts with "url("
) {
return true;
}
return false;
};
// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/animation/utils/default-transitions.js
var underDampedSpring = function () { return ({
type: "spring",
stiffness: 500,
damping: 25,
restDelta: 0.5,
restSpeed: 10,
}); };
var criticallyDampedSpring = function (to) { return ({
type: "spring",
stiffness: 550,
damping: to === 0 ? 2 * Math.sqrt(550) : 30,
restDelta: 0.01,
restSpeed: 10,
}); };
var linearTween = function () { return ({
type: "keyframes",
ease: "linear",
duration: 0.3,
}); };
var default_transitions_keyframes = function (values) { return ({
type: "keyframes",
duration: 0.8,
values: values,
}); };
var defaultTransitions = {
x: underDampedSpring,
y: underDampedSpring,
z: underDampedSpring,
rotate: underDampedSpring,
rotateX: underDampedSpring,
rotateY: underDampedSpring,
rotateZ: underDampedSpring,
scaleX: criticallyDampedSpring,
scaleY: criticallyDampedSpring,
scale: criticallyDampedSpring,
opacity: linearTween,
backgroundColor: linearTween,
color: linearTween,
default: criticallyDampedSpring,
};
var getDefaultTransition = function (valueKey, to) {
var transitionFactory;
if (isKeyframesTarget(to)) {
transitionFactory = default_transitions_keyframes;
}
else {
transitionFactory =
defaultTransitions[valueKey] || defaultTransitions.default;
}
return __assign({ to: to }, transitionFactory(to));
};
// CONCATENATED MODULE: ./node_modules/style-value-types/dist/es/complex/filter.js
var maxDefaults = new Set(['brightness', 'contrast', 'saturate', 'opacity']);
function applyDefaultFilter(v) {
var _a = v.slice(0, -1).split('('), name = _a[0], value = _a[1];
if (name === 'drop-shadow')
return v;
var number = (value.match(floatRegex) || [])[0];
if (!number)
return v;
var unit = value.replace(number, '');
var defaultValue = maxDefaults.has(name) ? 1 : 0;
if (number !== value)
defaultValue *= 100;
return name + '(' + defaultValue + unit + ')';
}
var functionRegex = /([a-z-]*)\(.*?\)/g;
var filter = tslib_es6_assign(tslib_es6_assign({}, complex), { getAnimatableNone: function (v) {
var functions = v.match(functionRegex);
return functions ? functions.map(applyDefaultFilter).join(' ') : v;
} });
// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/dom/value-types/defaults.js
/**
* A map of default value types for common values
*/
var defaultValueTypes = __assign(__assign({}, numberValueTypes), {
// Color props
color: color, backgroundColor: color, outlineColor: color, fill: color, stroke: color,
// Border props
borderColor: color, borderTopColor: color, borderRightColor: color, borderBottomColor: color, borderLeftColor: color, filter: filter, WebkitFilter: filter });
/**
* Gets the default ValueType for the provided value key
*/
var getDefaultValueType = function (key) { return defaultValueTypes[key]; };
// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/dom/value-types/animatable-none.js
function animatable_none_getAnimatableNone(key, value) {
var _a;
var defaultValueType = getDefaultValueType(key);
if (defaultValueType !== filter)
defaultValueType = complex;
// If value is not recognised as animatable, ie "none", create an animatable version origin based on the target
return (_a = defaultValueType.getAnimatableNone) === null || _a === void 0 ? void 0 : _a.call(defaultValueType, value);
}
// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/animation/utils/transitions.js
/**
* Decide whether a transition is defined on a given Transition.
* This filters out orchestration options and returns true
* if any options are left.
*/
function isTransitionDefined(_a) {
_a.when; _a.delay; _a.delayChildren; _a.staggerChildren; _a.staggerDirection; _a.repeat; _a.repeatType; _a.repeatDelay; _a.from; var transition = __rest(_a, ["when", "delay", "delayChildren", "staggerChildren", "staggerDirection", "repeat", "repeatType", "repeatDelay", "from"]);
return !!Object.keys(transition).length;
}
var legacyRepeatWarning = false;
/**
* Convert Framer Motion's Transition type into Popmotion-compatible options.
*/
function convertTransitionToAnimationOptions(_a) {
var ease = _a.ease, times = _a.times, yoyo = _a.yoyo, flip = _a.flip, loop = _a.loop, transition = __rest(_a, ["ease", "times", "yoyo", "flip", "loop"]);
var options = __assign({}, transition);
if (times)
options["offset"] = times;
/**
* Convert any existing durations from seconds to milliseconds
*/
if (transition.duration)
options["duration"] = secondsToMilliseconds(transition.duration);
if (transition.repeatDelay)
options.repeatDelay = secondsToMilliseconds(transition.repeatDelay);
/**
* Map easing names to Popmotion's easing functions
*/
if (ease) {
options["ease"] = isEasingArray(ease)
? ease.map(easingDefinitionToFunction)
: easingDefinitionToFunction(ease);
}
/**
* Support legacy transition API
*/
if (transition.type === "tween")
options.type = "keyframes";
/**
* TODO: These options are officially removed from the API.
*/
if (yoyo || loop || flip) {
warning(!legacyRepeatWarning, "yoyo, loop and flip have been removed from the API. Replace with repeat and repeatType options.");
legacyRepeatWarning = true;
if (yoyo) {
options.repeatType = "reverse";
}
else if (loop) {
options.repeatType = "loop";
}
else if (flip) {
options.repeatType = "mirror";
}
options.repeat = loop || yoyo || flip || transition.repeat;
}
/**
* TODO: Popmotion 9 has the ability to automatically detect whether to use
* a keyframes or spring animation, but does so by detecting velocity and other spring options.
* It'd be good to introduce a similar thing here.
*/
if (transition.type !== "spring")
options.type = "keyframes";
return options;
}
/**
* Get the delay for a value by checking Transition with decreasing specificity.
*/
function getDelayFromTransition(transition, key) {
var _a;
var valueTransition = getValueTransition(transition, key) || {};
return (_a = valueTransition.delay) !== null && _a !== void 0 ? _a : 0;
}
function hydrateKeyframes(options) {
if (Array.isArray(options.to) && options.to[0] === null) {
options.to = __spreadArray([], __read(options.to));
options.to[0] = options.from;
}
return options;
}
function getPopmotionAnimationOptions(transition, options, key) {
var _a;
if (Array.isArray(options.to)) {
(_a = transition.duration) !== null && _a !== void 0 ? _a : (transition.duration = 0.8);
}
hydrateKeyframes(options);
/**
* Get a default transition if none is determined to be defined.
*/
if (!isTransitionDefined(transition)) {
transition = __assign(__assign({}, transition), getDefaultTransition(key, options.to));
}
return __assign(__assign({}, options), convertTransitionToAnimationOptions(transition));
}
/**
*
*/
function transitions_getAnimation(key, value, target, transition, onComplete) {
var _a;
var valueTransition = getValueTransition(transition, key);
var origin = (_a = valueTransition.from) !== null && _a !== void 0 ? _a : value.get();
var isTargetAnimatable = isAnimatable(key, target);
if (origin === "none" && isTargetAnimatable && typeof target === "string") {
/**
* If we're trying to animate from "none", try and get an animatable version
* of the target. This could be improved to work both ways.
*/
origin = animatable_none_getAnimatableNone(key, target);
}
else if (isZero(origin) && typeof target === "string") {
origin = getZeroUnit(target);
}
else if (!Array.isArray(target) &&
isZero(target) &&
typeof origin === "string") {
target = getZeroUnit(origin);
}
var isOriginAnimatable = isAnimatable(key, origin);
warning(isOriginAnimatable === isTargetAnimatable, "You are trying to animate " + key + " from \"" + origin + "\" to \"" + target + "\". " + origin + " is not an animatable value - to enable this animation set " + origin + " to a value animatable to " + target + " via the `style` property.");
function start() {
var options = {
from: origin,
to: target,
velocity: value.getVelocity(),
onComplete: onComplete,
onUpdate: function (v) { return value.set(v); },
};
return valueTransition.type === "inertia" ||
valueTransition.type === "decay"
? inertia_inertia(__assign(__assign({}, options), valueTransition))
: animations_animate(__assign(__assign({}, getPopmotionAnimationOptions(valueTransition, options, key)), { onUpdate: function (v) {
var _a;
options.onUpdate(v);
(_a = valueTransition.onUpdate) === null || _a === void 0 ? void 0 : _a.call(valueTransition, v);
}, onComplete: function () {
var _a;
options.onComplete();
(_a = valueTransition.onComplete) === null || _a === void 0 ? void 0 : _a.call(valueTransition);
} }));
}
function set() {
var _a;
value.set(target);
onComplete();
(_a = valueTransition === null || valueTransition === void 0 ? void 0 : valueTransition.onComplete) === null || _a === void 0 ? void 0 : _a.call(valueTransition);
return { stop: function () { } };
}
return !isOriginAnimatable ||
!isTargetAnimatable ||
valueTransition.type === false
? set
: start;
}
function isZero(value) {
return (value === 0 ||
(typeof value === "string" &&
parseFloat(value) === 0 &&
value.indexOf(" ") === -1));
}
function getZeroUnit(potentialUnitType) {
return typeof potentialUnitType === "number"
? 0
: animatable_none_getAnimatableNone("", potentialUnitType);
}
function getValueTransition(transition, key) {
return transition[key] || transition["default"] || transition;
}
/**
* Start animation on a MotionValue. This function is an interface between
* Framer Motion and Popmotion
*
* @internal
*/
function transitions_startAnimation(key, value, target, transition) {
if (transition === void 0) { transition = {}; }
return value.start(function (onComplete) {
var delayTimer;
var controls;
var animation = transitions_getAnimation(key, value, target, transition, onComplete);
var delay = getDelayFromTransition(transition, key);
var start = function () { return (controls = animation()); };
if (delay) {
delayTimer = setTimeout(start, secondsToMilliseconds(delay));
}
else {
start();
}
return function () {
clearTimeout(delayTimer);
controls === null || controls === void 0 ? void 0 : controls.stop();
};
});
}
// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/utils/is-numerical-string.js
/**
* Check if value is a numerical string, ie a string that is purely a number eg "100" or "-100.1"
*/
var isNumericalString = function (v) { return /^\-?\d*\.?\d+$/.test(v); };
// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/utils/array.js
function addUniqueItem(arr, item) {
arr.indexOf(item) === -1 && arr.push(item);
}
function removeItem(arr, item) {
var index = arr.indexOf(item);
index > -1 && arr.splice(index, 1);
}
// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/utils/subscription-manager.js
var subscription_manager_SubscriptionManager = /** @class */ (function () {
function SubscriptionManager() {
this.subscriptions = [];
}
SubscriptionManager.prototype.add = function (handler) {
var _this = this;
addUniqueItem(this.subscriptions, handler);
return function () { return removeItem(_this.subscriptions, handler); };
};
SubscriptionManager.prototype.notify = function (a, b, c) {
var numSubscriptions = this.subscriptions.length;
if (!numSubscriptions)
return;
if (numSubscriptions === 1) {
/**
* If there's only a single handler we can just call it without invoking a loop.
*/
this.subscriptions[0](a, b, c);
}
else {
for (var i = 0; i < numSubscriptions; i++) {
/**
* Check whether the handler exists before firing as it's possible
* the subscriptions were modified during this loop running.
*/
var handler = this.subscriptions[i];
handler && handler(a, b, c);
}
}
};
SubscriptionManager.prototype.getSize = function () {
return this.subscriptions.length;
};
SubscriptionManager.prototype.clear = function () {
this.subscriptions.length = 0;
};
return SubscriptionManager;
}());
// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/value/index.js
var isFloat = function (value) {
return !isNaN(parseFloat(value));
};
/**
* `MotionValue` is used to track the state and velocity of motion values.
*
* @public
*/
var value_MotionValue = /** @class */ (function () {
/**
* @param init - The initiating value
* @param config - Optional configuration options
*
* - `transformer`: A function to transform incoming values with.
*
* @internal
*/
function MotionValue(init) {
var _this = this;
/**
* Duration, in milliseconds, since last updating frame.
*
* @internal
*/
this.timeDelta = 0;
/**
* Timestamp of the last time this `MotionValue` was updated.
*
* @internal
*/
this.lastUpdated = 0;
/**
* Functions to notify when the `MotionValue` updates.
*
* @internal
*/
this.updateSubscribers = new subscription_manager_SubscriptionManager();
/**
* Functions to notify when the velocity updates.
*
* @internal
*/
this.velocityUpdateSubscribers = new subscription_manager_SubscriptionManager();
/**
* Functions to notify when the `MotionValue` updates and `render` is set to `true`.
*
* @internal
*/
this.renderSubscribers = new subscription_manager_SubscriptionManager();
/**
* Tracks whether this value can output a velocity. Currently this is only true
* if the value is numerical, but we might be able to widen the scope here and support
* other value types.
*
* @internal
*/
this.canTrackVelocity = false;
this.updateAndNotify = function (v, render) {
if (render === void 0) { render = true; }
_this.prev = _this.current;
_this.current = v;
// Update timestamp
var _a = getFrameData(), delta = _a.delta, timestamp = _a.timestamp;
if (_this.lastUpdated !== timestamp) {
_this.timeDelta = delta;
_this.lastUpdated = timestamp;
es.postRender(_this.scheduleVelocityCheck);
}
// Update update subscribers
if (_this.prev !== _this.current) {
_this.updateSubscribers.notify(_this.current);
}
// Update velocity subscribers
if (_this.velocityUpdateSubscribers.getSize()) {
_this.velocityUpdateSubscribers.notify(_this.getVelocity());
}
// Update render subscribers
if (render) {
_this.renderSubscribers.notify(_this.current);
}
};
/**
* Schedule a velocity check for the next frame.
*
* This is an instanced and bound function to prevent generating a new
* function once per frame.
*
* @internal
*/
this.scheduleVelocityCheck = function () { return es.postRender(_this.velocityCheck); };
/**
* Updates `prev` with `current` if the value hasn't been updated this frame.
* This ensures velocity calculations return `0`.
*
* This is an instanced and bound function to prevent generating a new
* function once per frame.
*
* @internal
*/
this.velocityCheck = function (_a) {
var timestamp = _a.timestamp;
if (timestamp !== _this.lastUpdated) {
_this.prev = _this.current;
_this.velocityUpdateSubscribers.notify(_this.getVelocity());
}
};
this.hasAnimated = false;
this.prev = this.current = init;
this.canTrackVelocity = isFloat(this.current);
}
/**
* Adds a function that will be notified when the `MotionValue` is updated.
*
* It returns a function that, when called, will cancel the subscription.
*
* When calling `onChange` inside a React component, it should be wrapped with the
* `useEffect` hook. As it returns an unsubscribe function, this should be returned
* from the `useEffect` function to ensure you don't add duplicate subscribers..
*
* @library
*
* ```jsx
* function MyComponent() {
* const x = useMotionValue(0)
* const y = useMotionValue(0)
* const opacity = useMotionValue(1)
*
* useEffect(() => {
* function updateOpacity() {
* const maxXY = Math.max(x.get(), y.get())
* const newOpacity = transform(maxXY, [0, 100], [1, 0])
* opacity.set(newOpacity)
* }
*
* const unsubscribeX = x.onChange(updateOpacity)
* const unsubscribeY = y.onChange(updateOpacity)
*
* return () => {
* unsubscribeX()
* unsubscribeY()
* }
* }, [])
*
* return <Frame x={x} />
* }
* ```
*
* @motion
*
* ```jsx
* export const MyComponent = () => {
* const x = useMotionValue(0)
* const y = useMotionValue(0)
* const opacity = useMotionValue(1)
*
* useEffect(() => {
* function updateOpacity() {
* const maxXY = Math.max(x.get(), y.get())
* const newOpacity = transform(maxXY, [0, 100], [1, 0])
* opacity.set(newOpacity)
* }
*
* const unsubscribeX = x.onChange(updateOpacity)
* const unsubscribeY = y.onChange(updateOpacity)
*
* return () => {
* unsubscribeX()
* unsubscribeY()
* }
* }, [])
*
* return <motion.div style={{ x }} />
* }
* ```
*
* @internalremarks
*
* We could look into a `useOnChange` hook if the above lifecycle management proves confusing.
*
* ```jsx
* useOnChange(x, () => {})
* ```
*
* @param subscriber - A function that receives the latest value.
* @returns A function that, when called, will cancel this subscription.
*
* @public
*/
MotionValue.prototype.onChange = function (subscription) {
return this.updateSubscribers.add(subscription);
};
MotionValue.prototype.clearListeners = function () {
this.updateSubscribers.clear();
};
/**
* Adds a function that will be notified when the `MotionValue` requests a render.
*
* @param subscriber - A function that's provided the latest value.
* @returns A function that, when called, will cancel this subscription.
*
* @internal
*/
MotionValue.prototype.onRenderRequest = function (subscription) {
// Render immediately
subscription(this.get());
return this.renderSubscribers.add(subscription);
};
/**
* Attaches a passive effect to the `MotionValue`.
*
* @internal
*/
MotionValue.prototype.attach = function (passiveEffect) {
this.passiveEffect = passiveEffect;
};
/**
* Sets the state of the `MotionValue`.
*
* @remarks
*
* ```jsx
* const x = useMotionValue(0)
* x.set(10)
* ```
*
* @param latest - Latest value to set.
* @param render - Whether to notify render subscribers. Defaults to `true`
*
* @public
*/
MotionValue.prototype.set = function (v, render) {
if (render === void 0) { render = true; }
if (!render || !this.passiveEffect) {
this.updateAndNotify(v, render);
}
else {
this.passiveEffect(v, this.updateAndNotify);
}
};
/**
* Returns the latest state of `MotionValue`
*
* @returns - The latest state of `MotionValue`
*
* @public
*/
MotionValue.prototype.get = function () {
return this.current;
};
/**
* @public
*/
MotionValue.prototype.getPrevious = function () {
return this.prev;
};
/**
* Returns the latest velocity of `MotionValue`
*
* @returns - The latest velocity of `MotionValue`. Returns `0` if the state is non-numerical.
*
* @public
*/
MotionValue.prototype.getVelocity = function () {
// This could be isFloat(this.prev) && isFloat(this.current), but that would be wasteful
return this.canTrackVelocity
? // These casts could be avoided if parseFloat would be typed better
velocityPerSecond(parseFloat(this.current) -
parseFloat(this.prev), this.timeDelta)
: 0;
};
/**
* Registers a new animation to control this `MotionValue`. Only one
* animation can drive a `MotionValue` at one time.
*
* ```jsx
* value.start()
* ```
*
* @param animation - A function that starts the provided animation
*
* @internal
*/
MotionValue.prototype.start = function (animation) {
var _this = this;
this.stop();
return new Promise(function (resolve) {
_this.hasAnimated = true;
_this.stopAnimation = animation(resolve);
}).then(function () { return _this.clearAnimation(); });
};
/**
* Stop the currently active animation.
*
* @public
*/
MotionValue.prototype.stop = function () {
if (this.stopAnimation)
this.stopAnimation();
this.clearAnimation();
};
/**
* Returns `true` if this value is currently animating.
*
* @public
*/
MotionValue.prototype.isAnimating = function () {
return !!this.stopAnimation;
};
MotionValue.prototype.clearAnimation = function () {
this.stopAnimation = null;
};
/**
* Destroy and clean up subscribers to this `MotionValue`.
*
* The `MotionValue` hooks like `useMotionValue` and `useTransform` automatically
* handle the lifecycle of the returned `MotionValue`, so this method is only necessary if you've manually
* created a `MotionValue` via the `motionValue` function.
*
* @public
*/
MotionValue.prototype.destroy = function () {
this.updateSubscribers.clear();
this.renderSubscribers.clear();
this.stop();
};
return MotionValue;
}());
/**
* @internal
*/
function motionValue(init) {
return new value_MotionValue(init);
}
// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/dom/value-types/test.js
/**
* Tests a provided value against a ValueType
*/
var testValueType = function (v) { return function (type) { return type.test(v); }; };
// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/dom/value-types/type-auto.js
/**
* ValueType for "auto"
*/
var auto = {
test: function (v) { return v === "auto"; },
parse: function (v) { return v; },
};
// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/dom/value-types/dimensions.js
/**
* A list of value types commonly used for dimensions
*/
var dimensionValueTypes = [numbers_number, px, percent, degrees, vw, vh, auto];
/**
* Tests a dimensional value against the list of dimension ValueTypes
*/
var findDimensionValueType = function (v) {
return dimensionValueTypes.find(testValueType(v));
};
// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/dom/value-types/find.js
/**
* A list of all ValueTypes
*/
var valueTypes = __spreadArray(__spreadArray([], __read(dimensionValueTypes)), [color, complex]);
/**
* Tests a value against the list of ValueTypes
*/
var findValueType = function (v) { return valueTypes.find(testValueType(v)); };
// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/utils/setters.js
/**
* Set VisualElement's MotionValue, creating a new MotionValue for it if
* it doesn't exist.
*/
function setMotionValue(visualElement, key, value) {
if (visualElement.hasValue(key)) {
visualElement.getValue(key).set(value);
}
else {
visualElement.addValue(key, motionValue(value));
}
}
function setTarget(visualElement, definition) {
var resolved = resolveVariant(visualElement, definition);
var _a = resolved
? visualElement.makeTargetAnimatable(resolved, false)
: {}, _b = _a.transitionEnd, transitionEnd = _b === void 0 ? {} : _b; _a.transition; var target = __rest(_a, ["transitionEnd", "transition"]);
target = __assign(__assign({}, target), transitionEnd);
for (var key in target) {
var value = resolveFinalValueInKeyframes(target[key]);
setMotionValue(visualElement, key, value);
}
}
function setVariants(visualElement, variantLabels) {
var reversedLabels = __spreadArray([], __read(variantLabels)).reverse();
reversedLabels.forEach(function (key) {
var _a;
var variant = visualElement.getVariant(key);
variant && setTarget(visualElement, variant);
(_a = visualElement.variantChildren) === null || _a === void 0 ? void 0 : _a.forEach(function (child) {
setVariants(child, variantLabels);
});
});
}
function setValues(visualElement, definition) {
if (Array.isArray(definition)) {
return setVariants(visualElement, definition);
}
else if (typeof definition === "string") {
return setVariants(visualElement, [definition]);
}
else {
setTarget(visualElement, definition);
}
}
function checkTargetForNewValues(visualElement, target, origin) {
var _a, _b, _c;
var _d;
var newValueKeys = Object.keys(target).filter(function (key) { return !visualElement.hasValue(key); });
var numNewValues = newValueKeys.length;
if (!numNewValues)
return;
for (var i = 0; i < numNewValues; i++) {
var key = newValueKeys[i];
var targetValue = target[key];
var value = null;
/**
* If the target is a series of keyframes, we can use the first value
* in the array. If this first value is null, we'll still need to read from the DOM.
*/
if (Array.isArray(targetValue)) {
value = targetValue[0];
}
/**
* If the target isn't keyframes, or the first keyframe was null, we need to
* first check if an origin value was explicitly defined in the transition as "from",
* if not read the value from the DOM. As an absolute fallback, take the defined target value.
*/
if (value === null) {
value = (_b = (_a = origin[key]) !== null && _a !== void 0 ? _a : visualElement.readValue(key)) !== null && _b !== void 0 ? _b : target[key];
}
/**
* If value is still undefined or null, ignore it. Preferably this would throw,
* but this was causing issues in Framer.
*/
if (value === undefined || value === null)
continue;
if (typeof value === "string" && isNumericalString(value)) {
// If this is a number read as a string, ie "0" or "200", convert it to a number
value = parseFloat(value);
}
else if (!findValueType(value) && complex.test(targetValue)) {
value = animatable_none_getAnimatableNone(key, targetValue);
}
visualElement.addValue(key, motionValue(value));
(_c = (_d = origin)[key]) !== null && _c !== void 0 ? _c : (_d[key] = value);
visualElement.setBaseTarget(key, value);
}
}
function getOriginFromTransition(key, transition) {
if (!transition)
return;
var valueTransition = transition[key] || transition["default"] || transition;
return valueTransition.from;
}
function getOrigin(target, transition, visualElement) {
var _a, _b;
var origin = {};
for (var key in target) {
origin[key] =
(_a = getOriginFromTransition(key, transition)) !== null && _a !== void 0 ? _a : (_b = visualElement.getValue(key)) === null || _b === void 0 ? void 0 : _b.get();
}
return origin;
}
// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/utils/animation.js
/**
* @internal
*/
function animateVisualElement(visualElement, definition, options) {
if (options === void 0) { options = {}; }
visualElement.notifyAnimationStart();
var animation;
if (Array.isArray(definition)) {
var animations = definition.map(function (variant) {
return animateVariant(visualElement, variant, options);
});
animation = Promise.all(animations);
}
else if (typeof definition === "string") {
animation = animateVariant(visualElement, definition, options);
}
else {
var resolvedDefinition = typeof definition === "function"
? resolveVariant(visualElement, definition, options.custom)
: definition;
animation = animateTarget(visualElement, resolvedDefinition, options);
}
return animation.then(function () {
return visualElement.notifyAnimationComplete(definition);
});
}
function animateVariant(visualElement, variant, options) {
var _a;
if (options === void 0) { options = {}; }
var resolved = resolveVariant(visualElement, variant, options.custom);
var _b = (resolved || {}).transition, transition = _b === void 0 ? visualElement.getDefaultTransition() || {} : _b;
if (options.transitionOverride) {
transition = options.transitionOverride;
}
/**
* If we have a variant, create a callback that runs it as an animation.
* Otherwise, we resolve a Promise immediately for a composable no-op.
*/
var getAnimation = resolved
? function () { return animateTarget(visualElement, resolved, options); }
: function () { return Promise.resolve(); };
/**
* If we have children, create a callback that runs all their animations.
* Otherwise, we resolve a Promise immediately for a composable no-op.
*/
var getChildAnimations = ((_a = visualElement.variantChildren) === null || _a === void 0 ? void 0 : _a.size)
? function (forwardDelay) {
if (forwardDelay === void 0) { forwardDelay = 0; }
var _a = transition.delayChildren, delayChildren = _a === void 0 ? 0 : _a, staggerChildren = transition.staggerChildren, staggerDirection = transition.staggerDirection;
return animateChildren(visualElement, variant, delayChildren + forwardDelay, staggerChildren, staggerDirection, options);
}
: function () { return Promise.resolve(); };
/**
* If the transition explicitly defines a "when" option, we need to resolve either
* this animation or all children animations before playing the other.
*/
var when = transition.when;
if (when) {
var _c = __read(when === "beforeChildren"
? [getAnimation, getChildAnimations]
: [getChildAnimations, getAnimation], 2), first = _c[0], last = _c[1];
return first().then(last);
}
else {
return Promise.all([getAnimation(), getChildAnimations(options.delay)]);
}
}
/**
* @internal
*/
function animateTarget(visualElement, definition, _a) {
var _b;
var _c = _a === void 0 ? {} : _a, _d = _c.delay, delay = _d === void 0 ? 0 : _d, transitionOverride = _c.transitionOverride, type = _c.type;
var _e = visualElement.makeTargetAnimatable(definition), _f = _e.transition, transition = _f === void 0 ? visualElement.getDefaultTransition() : _f, transitionEnd = _e.transitionEnd, target = __rest(_e, ["transition", "transitionEnd"]);
if (transitionOverride)
transition = transitionOverride;
var animations = [];
var animationTypeState = type && ((_b = visualElement.animationState) === null || _b === void 0 ? void 0 : _b.getState()[type]);
for (var key in target) {
var value = visualElement.getValue(key);
var valueTarget = target[key];
if (!value ||
valueTarget === undefined ||
(animationTypeState &&
shouldBlockAnimation(animationTypeState, key))) {
continue;
}
var animation = transitions_startAnimation(key, value, valueTarget, __assign({ delay: delay }, transition));
animations.push(animation);
}
return Promise.all(animations).then(function () {
transitionEnd && setTarget(visualElement, transitionEnd);
});
}
function animateChildren(visualElement, variant, delayChildren, staggerChildren, staggerDirection, options) {
if (delayChildren === void 0) { delayChildren = 0; }
if (staggerChildren === void 0) { staggerChildren = 0; }
if (staggerDirection === void 0) { staggerDirection = 1; }
var animations = [];
var maxStaggerDuration = (visualElement.variantChildren.size - 1) * staggerChildren;
var generateStaggerDuration = staggerDirection === 1
? function (i) {
if (i === void 0) { i = 0; }
return i * staggerChildren;
}
: function (i) {
if (i === void 0) { i = 0; }
return maxStaggerDuration - i * staggerChildren;
};
Array.from(visualElement.variantChildren)
.sort(sortByTreeOrder)
.forEach(function (child, i) {
animations.push(animateVariant(child, variant, __assign(__assign({}, options), { delay: delayChildren + generateStaggerDuration(i) })).then(function () { return child.notifyAnimationComplete(variant); }));
});
return Promise.all(animations);
}
function stopAnimation(visualElement) {
visualElement.forEachValue(function (value) { return value.stop(); });
}
function sortByTreeOrder(a, b) {
return a.sortNodePosition(b);
}
/**
* Decide whether we should block this animation. Previously, we achieved this
* just by checking whether the key was listed in protectedKeys, but this
* posed problems if an animation was triggered by afterChildren and protectedKeys
* had been set to true in the meantime.
*/
function shouldBlockAnimation(_a, key) {
var protectedKeys = _a.protectedKeys, needsAnimating = _a.needsAnimating;
var shouldBlock = protectedKeys.hasOwnProperty(key) && needsAnimating[key] !== true;
needsAnimating[key] = false;
return shouldBlock;
}
// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/utils/animation-state.js
var variantPriorityOrder = [
AnimationType.Animate,
AnimationType.Hover,
AnimationType.Tap,
AnimationType.Drag,
AnimationType.Focus,
AnimationType.Exit,
];
var reversePriorityOrder = __spreadArray([], __read(variantPriorityOrder)).reverse();
var numAnimationTypes = variantPriorityOrder.length;
function animateList(visualElement) {
return function (animations) {
return Promise.all(animations.map(function (_a) {
var animation = _a.animation, options = _a.options;
return animateVisualElement(visualElement, animation, options);
}));
};
}
function createAnimationState(visualElement) {
var animate = animateList(visualElement);
var state = createState();
var allAnimatedKeys = {};
var isInitialRender = true;
/**
* This function will be used to reduce the animation definitions for
* each active animation type into an object of resolved values for it.
*/
var buildResolvedTypeValues = function (acc, definition) {
var resolved = resolveVariant(visualElement, definition);
if (resolved) {
resolved.transition; var transitionEnd = resolved.transitionEnd, target = __rest(resolved, ["transition", "transitionEnd"]);
acc = __assign(__assign(__assign({}, acc), target), transitionEnd);
}
return acc;
};
function isAnimated(key) {
return allAnimatedKeys[key] !== undefined;
}
/**
* This just allows us to inject mocked animation functions
* @internal
*/
function setAnimateFunction(makeAnimator) {
animate = makeAnimator(visualElement);
}
/**
* When we receive new props, we need to:
* 1. Create a list of protected keys for each type. This is a directory of
* value keys that are currently being "handled" by types of a higher priority
* so that whenever an animation is played of a given type, these values are
* protected from being animated.
* 2. Determine if an animation type needs animating.
* 3. Determine if any values have been removed from a type and figure out
* what to animate those to.
*/
function animateChanges(options, changedActiveType) {
var _a;
var props = visualElement.getProps();
var context = visualElement.getVariantContext(true) || {};
/**
* A list of animations that we'll build into as we iterate through the animation
* types. This will get executed at the end of the function.
*/
var animations = [];
/**
* Keep track of which values have been removed. Then, as we hit lower priority
* animation types, we can check if they contain removed values and animate to that.
*/
var removedKeys = new Set();
/**
* A dictionary of all encountered keys. This is an object to let us build into and
* copy it without iteration. Each time we hit an animation type we set its protected
* keys - the keys its not allowed to animate - to the latest version of this object.
*/
var encounteredKeys = {};
/**
* If a variant has been removed at a given index, and this component is controlling
* variant animations, we want to ensure lower-priority variants are forced to animate.
*/
var removedVariantIndex = Infinity;
var _loop_1 = function (i) {
var type = reversePriorityOrder[i];
var typeState = state[type];
var prop = (_a = props[type]) !== null && _a !== void 0 ? _a : context[type];
var propIsVariant = isVariantLabel(prop);
/**
* If this type has *just* changed isActive status, set activeDelta
* to that status. Otherwise set to null.
*/
var activeDelta = type === changedActiveType ? typeState.isActive : null;
if (activeDelta === false)
removedVariantIndex = i;
/**
* If this prop is an inherited variant, rather than been set directly on the
* component itself, we want to make sure we allow the parent to trigger animations.
*
* TODO: Can probably change this to a !isControllingVariants check
*/
var isInherited = prop === context[type] && prop !== props[type] && propIsVariant;
/**
*
*/
if (isInherited &&
isInitialRender &&
visualElement.manuallyAnimateOnMount) {
isInherited = false;
}
/**
* Set all encountered keys so far as the protected keys for this type. This will
* be any key that has been animated or otherwise handled by active, higher-priortiy types.
*/
typeState.protectedKeys = __assign({}, encounteredKeys);
// Check if we can skip analysing this prop early
if (
// If it isn't active and hasn't *just* been set as inactive
(!typeState.isActive && activeDelta === null) ||
// If we didn't and don't have any defined prop for this animation type
(!prop && !typeState.prevProp) ||
// Or if the prop doesn't define an animation
isAnimationControls(prop) ||
typeof prop === "boolean") {
return "continue";
}
/**
* As we go look through the values defined on this type, if we detect
* a changed value or a value that was removed in a higher priority, we set
* this to true and add this prop to the animation list.
*/
var shouldAnimateType = variantsHaveChanged(typeState.prevProp, prop) ||
// If we're making this variant active, we want to always make it active
(type === changedActiveType &&
typeState.isActive &&
!isInherited &&
propIsVariant) ||
// If we removed a higher-priority variant (i is in reverse order)
(i > removedVariantIndex && propIsVariant);
/**
* As animations can be set as variant lists, variants or target objects, we
* coerce everything to an array if it isn't one already
*/
var definitionList = Array.isArray(prop) ? prop : [prop];
/**
* Build an object of all the resolved values. We'll use this in the subsequent
* animateChanges calls to determine whether a value has changed.
*/
var resolvedValues = definitionList.reduce(buildResolvedTypeValues, {});
if (activeDelta === false)
resolvedValues = {};
/**
* Now we need to loop through all the keys in the prev prop and this prop,
* and decide:
* 1. If the value has changed, and needs animating
* 2. If it has been removed, and needs adding to the removedKeys set
* 3. If it has been removed in a higher priority type and needs animating
* 4. If it hasn't been removed in a higher priority but hasn't changed, and
* needs adding to the type's protectedKeys list.
*/
var _b = typeState.prevResolvedValues, prevResolvedValues = _b === void 0 ? {} : _b;
var allKeys = __assign(__assign({}, prevResolvedValues), resolvedValues);
var markToAnimate = function (key) {
shouldAnimateType = true;
removedKeys.delete(key);
typeState.needsAnimating[key] = true;
};
for (var key in allKeys) {
var next = resolvedValues[key];
var prev = prevResolvedValues[key];
// If we've already handled this we can just skip ahead
if (encounteredKeys.hasOwnProperty(key))
continue;
/**
* If the value has changed, we probably want to animate it.
*/
if (next !== prev) {
/**
* If both values are keyframes, we need to shallow compare them to
* detect whether any value has changed. If it has, we animate it.
*/
if (isKeyframesTarget(next) && isKeyframesTarget(prev)) {
if (!shallowCompare(next, prev)) {
markToAnimate(key);
}
else {
/**
* If it hasn't changed, we want to ensure it doesn't animate by
* adding it to the list of protected keys.
*/
typeState.protectedKeys[key] = true;
}
}
else if (next !== undefined) {
// If next is defined and doesn't equal prev, it needs animating
markToAnimate(key);
}
else {
// If it's undefined, it's been removed.
removedKeys.add(key);
}
}
else if (next !== undefined && removedKeys.has(key)) {
/**
* If next hasn't changed and it isn't undefined, we want to check if it's
* been removed by a higher priority
*/
markToAnimate(key);
}
else {
/**
* If it hasn't changed, we add it to the list of protected values
* to ensure it doesn't get animated.
*/
typeState.protectedKeys[key] = true;
}
}
/**
* Update the typeState so next time animateChanges is called we can compare the
* latest prop and resolvedValues to these.
*/
typeState.prevProp = prop;
typeState.prevResolvedValues = resolvedValues;
/**
*
*/
if (typeState.isActive) {
encounteredKeys = __assign(__assign({}, encounteredKeys), resolvedValues);
}
if (isInitialRender && visualElement.blockInitialAnimation) {
shouldAnimateType = false;
}
/**
* If this is an inherited prop we want to hard-block animations
* TODO: Test as this should probably still handle animations triggered
* by removed values?
*/
if (shouldAnimateType && !isInherited) {
animations.push.apply(animations, __spreadArray([], __read(definitionList.map(function (animation) { return ({
animation: animation,
options: __assign({ type: type }, options),
}); }))));
}
};
/**
* Iterate through all animation types in reverse priority order. For each, we want to
* detect which values it's handling and whether or not they've changed (and therefore
* need to be animated). If any values have been removed, we want to detect those in
* lower priority props and flag for animation.
*/
for (var i = 0; i < numAnimationTypes; i++) {
_loop_1(i);
}
allAnimatedKeys = __assign({}, encounteredKeys);
/**
* If there are some removed value that haven't been dealt with,
* we need to create a new animation that falls back either to the value
* defined in the style prop, or the last read value.
*/
if (removedKeys.size) {
var fallbackAnimation_1 = {};
removedKeys.forEach(function (key) {
var fallbackTarget = visualElement.getBaseTarget(key);
if (fallbackTarget !== undefined) {
fallbackAnimation_1[key] = fallbackTarget;
}
});
animations.push({ animation: fallbackAnimation_1 });
}
var shouldAnimate = Boolean(animations.length);
if (isInitialRender &&
props.initial === false &&
!visualElement.manuallyAnimateOnMount) {
shouldAnimate = false;
}
isInitialRender = false;
return shouldAnimate ? animate(animations) : Promise.resolve();
}
/**
* Change whether a certain animation type is active.
*/
function setActive(type, isActive, options) {
var _a;
// If the active state hasn't changed, we can safely do nothing here
if (state[type].isActive === isActive)
return Promise.resolve();
// Propagate active change to children
(_a = visualElement.variantChildren) === null || _a === void 0 ? void 0 : _a.forEach(function (child) { var _a; return (_a = child.animationState) === null || _a === void 0 ? void 0 : _a.setActive(type, isActive); });
state[type].isActive = isActive;
return animateChanges(options, type);
}
return {
isAnimated: isAnimated,
animateChanges: animateChanges,
setActive: setActive,
setAnimateFunction: setAnimateFunction,
getState: function () { return state; },
};
}
function variantsHaveChanged(prev, next) {
if (typeof next === "string") {
return next !== prev;
}
else if (isVariantLabels(next)) {
return !shallowCompare(next, prev);
}
return false;
}
function createTypeState(isActive) {
if (isActive === void 0) { isActive = false; }
return {
isActive: isActive,
protectedKeys: {},
needsAnimating: {},
prevResolvedValues: {},
};
}
function createState() {
var _a;
return _a = {},
_a[AnimationType.Animate] = createTypeState(true),
_a[AnimationType.Hover] = createTypeState(),
_a[AnimationType.Tap] = createTypeState(),
_a[AnimationType.Drag] = createTypeState(),
_a[AnimationType.Focus] = createTypeState(),
_a[AnimationType.Exit] = createTypeState(),
_a;
}
// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/motion/features/animations.js
var animations_animations = {
animation: makeRenderlessComponent(function (_a) {
var visualElement = _a.visualElement, animate = _a.animate;
/**
* We dynamically generate the AnimationState manager as it contains a reference
* to the underlying animation library. We only want to load that if we load this,
* so people can optionally code split it out using the `m` component.
*/
visualElement.animationState || (visualElement.animationState = createAnimationState(visualElement));
/**
* Subscribe any provided AnimationControls to the component's VisualElement
*/
if (isAnimationControls(animate)) {
Object(external_React_["useEffect"])(function () { return animate.subscribe(visualElement); }, [animate]);
}
}),
exit: makeRenderlessComponent(function (props) {
var custom = props.custom, visualElement = props.visualElement;
var _a = __read(usePresence(), 2), isPresent = _a[0], onExitComplete = _a[1];
var presenceContext = Object(external_React_["useContext"])(PresenceContext);
Object(external_React_["useEffect"])(function () {
var _a, _b;
var animation = (_a = visualElement.animationState) === null || _a === void 0 ? void 0 : _a.setActive(AnimationType.Exit, !isPresent, { custom: (_b = presenceContext === null || presenceContext === void 0 ? void 0 : presenceContext.custom) !== null && _b !== void 0 ? _b : custom });
!isPresent && (animation === null || animation === void 0 ? void 0 : animation.then(onExitComplete));
}, [isPresent]);
}),
};
// CONCATENATED MODULE: ./node_modules/popmotion/dist/es/utils/is-point.js
var isPoint = function (point) {
return point.hasOwnProperty('x') && point.hasOwnProperty('y');
};
// CONCATENATED MODULE: ./node_modules/popmotion/dist/es/utils/is-point-3d.js
var isPoint3D = function (point) {
return isPoint(point) && point.hasOwnProperty('z');
};
// CONCATENATED MODULE: ./node_modules/popmotion/dist/es/utils/distance.js
var distance1D = function (a, b) { return Math.abs(a - b); };
function distance(a, b) {
if (isNum(a) && isNum(b)) {
return distance1D(a, b);
}
else if (isPoint(a) && isPoint(b)) {
var xDelta = distance1D(a.x, b.x);
var yDelta = distance1D(a.y, b.y);
var zDelta = isPoint3D(a) && isPoint3D(b) ? distance1D(a.z, b.z) : 0;
return Math.sqrt(Math.pow(xDelta, 2) + Math.pow(yDelta, 2) + Math.pow(zDelta, 2));
}
}
// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/gestures/PanSession.js
/**
* @internal
*/
var PanSession_PanSession = /** @class */ (function () {
function PanSession(event, handlers, _a) {
var _this = this;
var _b = _a === void 0 ? {} : _a, transformPagePoint = _b.transformPagePoint;
/**
* @internal
*/
this.startEvent = null;
/**
* @internal
*/
this.lastMoveEvent = null;
/**
* @internal
*/
this.lastMoveEventInfo = null;
/**
* @internal
*/
this.handlers = {};
this.updatePoint = function () {
if (!(_this.lastMoveEvent && _this.lastMoveEventInfo))
return;
var info = getPanInfo(_this.lastMoveEventInfo, _this.history);
var isPanStarted = _this.startEvent !== null;
// Only start panning if the offset is larger than 3 pixels. If we make it
// any larger than this we'll want to reset the pointer history
// on the first update to avoid visual snapping to the cursoe.
var isDistancePastThreshold = distance(info.offset, { x: 0, y: 0 }) >= 3;
if (!isPanStarted && !isDistancePastThreshold)
return;
var point = info.point;
var timestamp = getFrameData().timestamp;
_this.history.push(__assign(__assign({}, point), { timestamp: timestamp }));
var _a = _this.handlers, onStart = _a.onStart, onMove = _a.onMove;
if (!isPanStarted) {
onStart && onStart(_this.lastMoveEvent, info);
_this.startEvent = _this.lastMoveEvent;
}
onMove && onMove(_this.lastMoveEvent, info);
};
this.handlePointerMove = function (event, info) {
_this.lastMoveEvent = event;
_this.lastMoveEventInfo = PanSession_transformPoint(info, _this.transformPagePoint);
// Because Safari doesn't trigger mouseup events when it's above a `<select>`
if (isMouseEvent(event) && event.buttons === 0) {
_this.handlePointerUp(event, info);
return;
}
// Throttle mouse move event to once per frame
es.update(_this.updatePoint, true);
};
this.handlePointerUp = function (event, info) {
_this.end();
var _a = _this.handlers, onEnd = _a.onEnd, onSessionEnd = _a.onSessionEnd;
var panInfo = getPanInfo(PanSession_transformPoint(info, _this.transformPagePoint), _this.history);
if (_this.startEvent && onEnd) {
onEnd(event, panInfo);
}
onSessionEnd && onSessionEnd(event, panInfo);
};
// If we have more than one touch, don't start detecting this gesture
if (isTouchEvent(event) && event.touches.length > 1)
return;
this.handlers = handlers;
this.transformPagePoint = transformPagePoint;
var info = extractEventInfo(event);
var initialInfo = PanSession_transformPoint(info, this.transformPagePoint);
var point = initialInfo.point;
var timestamp = getFrameData().timestamp;
this.history = [__assign(__assign({}, point), { timestamp: timestamp })];
var onSessionStart = handlers.onSessionStart;
onSessionStart &&
onSessionStart(event, getPanInfo(initialInfo, this.history));
this.removeListeners = pipe(addPointerEvent(window, "pointermove", this.handlePointerMove), addPointerEvent(window, "pointerup", this.handlePointerUp), addPointerEvent(window, "pointercancel", this.handlePointerUp));
}
PanSession.prototype.updateHandlers = function (handlers) {
this.handlers = handlers;
};
PanSession.prototype.end = function () {
this.removeListeners && this.removeListeners();
cancelSync.update(this.updatePoint);
};
return PanSession;
}());
function PanSession_transformPoint(info, transformPagePoint) {
return transformPagePoint ? { point: transformPagePoint(info.point) } : info;
}
function subtractPoint(a, b) {
return { x: a.x - b.x, y: a.y - b.y };
}
function getPanInfo(_a, history) {
var point = _a.point;
return {
point: point,
delta: subtractPoint(point, lastDevicePoint(history)),
offset: subtractPoint(point, startDevicePoint(history)),
velocity: PanSession_getVelocity(history, 0.1),
};
}
function startDevicePoint(history) {
return history[0];
}
function lastDevicePoint(history) {
return history[history.length - 1];
}
function PanSession_getVelocity(history, timeDelta) {
if (history.length < 2) {
return { x: 0, y: 0 };
}
var i = history.length - 1;
var timestampedPoint = null;
var lastPoint = lastDevicePoint(history);
while (i >= 0) {
timestampedPoint = history[i];
if (lastPoint.timestamp - timestampedPoint.timestamp >
secondsToMilliseconds(timeDelta)) {
break;
}
i--;
}
if (!timestampedPoint) {
return { x: 0, y: 0 };
}
var time = (lastPoint.timestamp - timestampedPoint.timestamp) / 1000;
if (time === 0) {
return { x: 0, y: 0 };
}
var currentVelocity = {
x: (lastPoint.x - timestampedPoint.x) / time,
y: (lastPoint.y - timestampedPoint.y) / time,
};
if (currentVelocity.x === Infinity) {
currentVelocity.x = 0;
}
if (currentVelocity.y === Infinity) {
currentVelocity.y = 0;
}
return currentVelocity;
}
// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/utils/noop.js
function noop(any) {
return any;
}
// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/utils/geometry/index.js
/**
* Bounding boxes tend to be defined as top, left, right, bottom. For various operations
* it's easier to consider each axis individually. This function returns a bounding box
* as a map of single-axis min/max values.
*/
function convertBoundingBoxToAxisBox(_a) {
var top = _a.top, left = _a.left, right = _a.right, bottom = _a.bottom;
return {
x: { min: left, max: right },
y: { min: top, max: bottom },
};
}
function convertAxisBoxToBoundingBox(_a) {
var x = _a.x, y = _a.y;
return {
top: y.min,
bottom: y.max,
left: x.min,
right: x.max,
};
}
/**
* Applies a TransformPoint function to a bounding box. TransformPoint is usually a function
* provided by Framer to allow measured points to be corrected for device scaling. This is used
* when measuring DOM elements and DOM event points.
*/
function transformBoundingBox(_a, transformPoint) {
var top = _a.top, left = _a.left, bottom = _a.bottom, right = _a.right;
if (transformPoint === void 0) { transformPoint = noop; }
var topLeft = transformPoint({ x: left, y: top });
var bottomRight = transformPoint({ x: right, y: bottom });
return {
top: topLeft.y,
left: topLeft.x,
bottom: bottomRight.y,
right: bottomRight.x,
};
}
/**
* Create an empty axis box of zero size
*/
function axisBox() {
return { x: { min: 0, max: 1 }, y: { min: 0, max: 1 } };
}
function copyAxisBox(box) {
return {
x: __assign({}, box.x),
y: __assign({}, box.y),
};
}
/**
* Create an empty box delta
*/
var zeroDelta = {
translate: 0,
scale: 1,
origin: 0,
originPoint: 0,
};
function geometry_delta() {
return {
x: __assign({}, zeroDelta),
y: __assign({}, zeroDelta),
};
}
// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/utils/each-axis.js
// Call a handler once for each axis
function eachAxis(handler) {
return [handler("x"), handler("y")];
}
// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/gestures/drag/utils/constraints.js
/**
* Apply constraints to a point. These constraints are both physical along an
* axis, and an elastic factor that determines how much to constrain the point
* by if it does lie outside the defined parameters.
*/
function applyConstraints(point, _a, elastic) {
var min = _a.min, max = _a.max;
if (min !== undefined && point < min) {
// If we have a min point defined, and this is outside of that, constrain
point = elastic ? mix(min, point, elastic.min) : Math.max(point, min);
}
else if (max !== undefined && point > max) {
// If we have a max point defined, and this is outside of that, constrain
point = elastic ? mix(max, point, elastic.max) : Math.min(point, max);
}
return point;
}
/**
* Calculates a min projection point based on a pointer, pointer progress
* within the drag target, and constraints.
*
* For instance if an element was 100px width, we were dragging from 0.25
* along this axis, the pointer is at 200px, and there were no constraints,
* we would calculate a min projection point of 175px.
*/
function calcConstrainedMinPoint(point, length, progress, constraints, elastic) {
// Calculate a min point for this axis and apply it to the current pointer
var min = point - length * progress;
return constraints ? applyConstraints(min, constraints, elastic) : min;
}
/**
* Calculate constraints in terms of the viewport when defined relatively to the
* measured axis. This is measured from the nearest edge, so a max constraint of 200
* on an axis with a max value of 300 would return a constraint of 500 - axis length
*/
function calcRelativeAxisConstraints(axis, min, max) {
return {
min: min !== undefined ? axis.min + min : undefined,
max: max !== undefined
? axis.max + max - (axis.max - axis.min)
: undefined,
};
}
/**
* Calculate constraints in terms of the viewport when
* defined relatively to the measured bounding box.
*/
function calcRelativeConstraints(layoutBox, _a) {
var top = _a.top, left = _a.left, bottom = _a.bottom, right = _a.right;
return {
x: calcRelativeAxisConstraints(layoutBox.x, left, right),
y: calcRelativeAxisConstraints(layoutBox.y, top, bottom),
};
}
/**
* Calculate viewport constraints when defined as another viewport-relative axis
*/
function calcViewportAxisConstraints(layoutAxis, constraintsAxis) {
var _a;
var min = constraintsAxis.min - layoutAxis.min;
var max = constraintsAxis.max - layoutAxis.max;
// If the constraints axis is actually smaller than the layout axis then we can
// flip the constraints
if (constraintsAxis.max - constraintsAxis.min <
layoutAxis.max - layoutAxis.min) {
_a = __read([max, min], 2), min = _a[0], max = _a[1];
}
return {
min: layoutAxis.min + min,
max: layoutAxis.min + max,
};
}
/**
* Calculate viewport constraints when defined as another viewport-relative box
*/
function calcViewportConstraints(layoutBox, constraintsBox) {
return {
x: calcViewportAxisConstraints(layoutBox.x, constraintsBox.x),
y: calcViewportAxisConstraints(layoutBox.y, constraintsBox.y),
};
}
/**
* Calculate the an axis position based on two axes and a progress value.
*/
function calcPositionFromProgress(axis, constraints, progress) {
var axisLength = axis.max - axis.min;
var min = mix(constraints.min, constraints.max - axisLength, progress);
return { min: min, max: min + axisLength };
}
/**
* Rebase the calculated viewport constraints relative to the layout.min point.
*/
function rebaseAxisConstraints(layout, constraints) {
var relativeConstraints = {};
if (constraints.min !== undefined) {
relativeConstraints.min = constraints.min - layout.min;
}
if (constraints.max !== undefined) {
relativeConstraints.max = constraints.max - layout.min;
}
return relativeConstraints;
}
var defaultElastic = 0.35;
/**
* Accepts a dragElastic prop and returns resolved elastic values for each axis.
*/
function resolveDragElastic(dragElastic) {
if (dragElastic === false) {
dragElastic = 0;
}
else if (dragElastic === true) {
dragElastic = defaultElastic;
}
return {
x: resolveAxisElastic(dragElastic, "left", "right"),
y: resolveAxisElastic(dragElastic, "top", "bottom"),
};
}
function resolveAxisElastic(dragElastic, minLabel, maxLabel) {
return {
min: resolvePointElastic(dragElastic, minLabel),
max: resolvePointElastic(dragElastic, maxLabel),
};
}
function resolvePointElastic(dragElastic, label) {
var _a;
return typeof dragElastic === "number"
? dragElastic
: (_a = dragElastic[label]) !== null && _a !== void 0 ? _a : 0;
}
// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/dom/projection/measure.js
/**
* Measure and return the element bounding box.
*
* We convert the box into an AxisBox2D to make it easier to work with each axis
* individually and programmatically.
*
* This function optionally accepts a transformPagePoint function which allows us to compensate
* for, for instance, measuring the element within a scaled plane like a Framer devivce preview component.
*/
function getBoundingBox(element, transformPagePoint) {
var box = element.getBoundingClientRect();
return convertBoundingBoxToAxisBox(transformBoundingBox(box, transformPagePoint));
}
// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/utils/geometry/delta-calc.js
var clampProgress = function (v) { return clamp_clamp(0, 1, v); };
/**
* Returns true if the provided value is within maxDistance of the provided target
*/
function isNear(value, target, maxDistance) {
if (target === void 0) { target = 0; }
if (maxDistance === void 0) { maxDistance = 0.01; }
return distance(value, target) < maxDistance;
}
function calcLength(axis) {
return axis.max - axis.min;
}
/**
* Calculate a transform origin relative to the source axis, between 0-1, that results
* in an asthetically pleasing scale/transform needed to project from source to target.
*/
function delta_calc_calcOrigin(source, target) {
var origin = 0.5;
var sourceLength = calcLength(source);
var targetLength = calcLength(target);
if (targetLength > sourceLength) {
origin = progress_progress(target.min, target.max - sourceLength, source.min);
}
else if (sourceLength > targetLength) {
origin = progress_progress(source.min, source.max - targetLength, target.min);
}
return clampProgress(origin);
}
/**
* Update the AxisDelta with a transform that projects source into target.
*
* The transform `origin` is optional. If not provided, it'll be automatically
* calculated based on the relative positions of the two bounding boxes.
*/
function updateAxisDelta(delta, source, target, origin) {
if (origin === void 0) { origin = 0.5; }
delta.origin = origin;
delta.originPoint = mix(source.min, source.max, delta.origin);
delta.scale = calcLength(target) / calcLength(source);
if (isNear(delta.scale, 1, 0.0001))
delta.scale = 1;
delta.translate =
mix(target.min, target.max, delta.origin) - delta.originPoint;
if (isNear(delta.translate))
delta.translate = 0;
}
/**
* Update the BoxDelta with a transform that projects the source into the target.
*
* The transform `origin` is optional. If not provided, it'll be automatically
* calculated based on the relative positions of the two bounding boxes.
*/
function updateBoxDelta(delta, source, target, origin) {
updateAxisDelta(delta.x, source.x, target.x, defaultOrigin(origin.originX));
updateAxisDelta(delta.y, source.y, target.y, defaultOrigin(origin.originY));
}
/**
* Currently this only accepts numerical origins, measured as 0-1, but could
* accept pixel values by comparing to the target axis.
*/
function defaultOrigin(origin) {
return typeof origin === "number" ? origin : 0.5;
}
function calcRelativeAxis(target, relative, parent) {
target.min = parent.min + relative.min;
target.max = target.min + calcLength(relative);
}
function calcRelativeBox(projection, parentProjection) {
calcRelativeAxis(projection.target.x, projection.relativeTarget.x, parentProjection.target.x);
calcRelativeAxis(projection.target.y, projection.relativeTarget.y, parentProjection.target.y);
}
// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/utils/compare-by-depth.js
var compareByDepth = function (a, b) {
return a.depth - b.depth;
};
// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/dom/projection/utils.js
function isProjecting(visualElement) {
var isEnabled = visualElement.projection.isEnabled;
return isEnabled || visualElement.shouldResetTransform();
}
function collectProjectingAncestors(visualElement, ancestors) {
if (ancestors === void 0) { ancestors = []; }
var parent = visualElement.parent;
if (parent)
collectProjectingAncestors(parent, ancestors);
if (isProjecting(visualElement))
ancestors.push(visualElement);
return ancestors;
}
function collectProjectingChildren(visualElement) {
var children = [];
var addChild = function (child) {
if (isProjecting(child))
children.push(child);
child.children.forEach(addChild);
};
visualElement.children.forEach(addChild);
return children.sort(compareByDepth);
}
/**
* Update the layoutState by measuring the DOM layout. This
* should be called after resetting any layout-affecting transforms.
*/
function updateLayoutMeasurement(visualElement) {
if (visualElement.shouldResetTransform())
return;
var layoutState = visualElement.getLayoutState();
visualElement.notifyBeforeLayoutMeasure(layoutState.layout);
layoutState.isHydrated = true;
layoutState.layout = visualElement.measureViewportBox();
layoutState.layoutCorrected = copyAxisBox(layoutState.layout);
visualElement.notifyLayoutMeasure(layoutState.layout, visualElement.prevViewportBox || layoutState.layout);
es.update(function () { return visualElement.rebaseProjectionTarget(); });
}
/**
* Record the viewport box as it was before an expected mutation/re-render
*/
function snapshotViewportBox(visualElement) {
if (visualElement.shouldResetTransform())
return;
visualElement.prevViewportBox = visualElement.measureViewportBox(false);
/**
* Update targetBox to match the prevViewportBox. This is just to ensure
* that targetBox is affected by scroll in the same way as the measured box
*/
visualElement.rebaseProjectionTarget(false, visualElement.prevViewportBox);
}
// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/motion/features/layout/utils.js
function tweenAxis(target, prev, next, p) {
target.min = mix(prev.min, next.min, p);
target.max = mix(prev.max, next.max, p);
}
function calcRelativeOffsetAxis(parent, child) {
return {
min: child.min - parent.min,
max: child.max - parent.min,
};
}
function calcRelativeOffset(parent, child) {
return {
x: calcRelativeOffsetAxis(parent.x, child.x),
y: calcRelativeOffsetAxis(parent.y, child.y),
};
}
function checkIfParentHasChanged(prev, next) {
var prevId = prev.getLayoutId();
var nextId = next.getLayoutId();
return prevId !== nextId || (nextId === undefined && prev !== next);
}
// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/utils/is-draggable.js
function isDraggable(visualElement) {
var _a = visualElement.getProps(), drag = _a.drag, _dragX = _a._dragX;
return drag && !_dragX;
}
// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/utils/geometry/delta-apply.js
/**
* Reset an axis to the provided origin box.
*
* This is a mutative operation.
*/
function resetAxis(axis, originAxis) {
axis.min = originAxis.min;
axis.max = originAxis.max;
}
/**
* Reset a box to the provided origin box.
*
* This is a mutative operation.
*/
function resetBox(box, originBox) {
resetAxis(box.x, originBox.x);
resetAxis(box.y, originBox.y);
}
/**
* Scales a point based on a factor and an originPoint
*/
function scalePoint(point, scale, originPoint) {
var distanceFromOrigin = point - originPoint;
var scaled = scale * distanceFromOrigin;
return originPoint + scaled;
}
/**
* Applies a translate/scale delta to a point
*/
function applyPointDelta(point, translate, scale, originPoint, boxScale) {
if (boxScale !== undefined) {
point = scalePoint(point, boxScale, originPoint);
}
return scalePoint(point, scale, originPoint) + translate;
}
/**
* Applies a translate/scale delta to an axis
*/
function applyAxisDelta(axis, translate, scale, originPoint, boxScale) {
if (translate === void 0) { translate = 0; }
if (scale === void 0) { scale = 1; }
axis.min = applyPointDelta(axis.min, translate, scale, originPoint, boxScale);
axis.max = applyPointDelta(axis.max, translate, scale, originPoint, boxScale);
}
/**
* Applies a translate/scale delta to a box
*/
function applyBoxDelta(box, _a) {
var x = _a.x, y = _a.y;
applyAxisDelta(box.x, x.translate, x.scale, x.originPoint);
applyAxisDelta(box.y, y.translate, y.scale, y.originPoint);
}
/**
* Apply a transform to an axis from the latest resolved motion values.
* This function basically acts as a bridge between a flat motion value map
* and applyAxisDelta
*/
function applyAxisTransforms(final, axis, transforms, _a) {
var _b = __read(_a, 3), key = _b[0], scaleKey = _b[1], originKey = _b[2];
// Copy the current axis to the final axis before mutation
final.min = axis.min;
final.max = axis.max;
var axisOrigin = transforms[originKey] !== undefined ? transforms[originKey] : 0.5;
var originPoint = mix(axis.min, axis.max, axisOrigin);
// Apply the axis delta to the final axis
applyAxisDelta(final, transforms[key], transforms[scaleKey], originPoint, transforms.scale);
}
/**
* The names of the motion values we want to apply as translation, scale and origin.
*/
var xKeys = ["x", "scaleX", "originX"];
var yKeys = ["y", "scaleY", "originY"];
/**
* Apply a transform to a box from the latest resolved motion values.
*/
function applyBoxTransforms(finalBox, box, transforms) {
applyAxisTransforms(finalBox.x, box.x, transforms, xKeys);
applyAxisTransforms(finalBox.y, box.y, transforms, yKeys);
}
/**
* Remove a delta from a point. This is essentially the steps of applyPointDelta in reverse
*/
function removePointDelta(point, translate, scale, originPoint, boxScale) {
point -= translate;
point = scalePoint(point, 1 / scale, originPoint);
if (boxScale !== undefined) {
point = scalePoint(point, 1 / boxScale, originPoint);
}
return point;
}
/**
* Remove a delta from an axis. This is essentially the steps of applyAxisDelta in reverse
*/
function removeAxisDelta(axis, translate, scale, origin, boxScale) {
if (translate === void 0) { translate = 0; }
if (scale === void 0) { scale = 1; }
if (origin === void 0) { origin = 0.5; }
var originPoint = mix(axis.min, axis.max, origin) - translate;
axis.min = removePointDelta(axis.min, translate, scale, originPoint, boxScale);
axis.max = removePointDelta(axis.max, translate, scale, originPoint, boxScale);
}
/**
* Remove a transforms from an axis. This is essentially the steps of applyAxisTransforms in reverse
* and acts as a bridge between motion values and removeAxisDelta
*/
function removeAxisTransforms(axis, transforms, _a) {
var _b = __read(_a, 3), key = _b[0], scaleKey = _b[1], originKey = _b[2];
removeAxisDelta(axis, transforms[key], transforms[scaleKey], transforms[originKey], transforms.scale);
}
/**
* Remove a transforms from an box. This is essentially the steps of applyAxisBox in reverse
* and acts as a bridge between motion values and removeAxisDelta
*/
function removeBoxTransforms(box, transforms) {
removeAxisTransforms(box.x, transforms, xKeys);
removeAxisTransforms(box.y, transforms, yKeys);
}
/**
* Apply a tree of deltas to a box. We do this to calculate the effect of all the transforms
* in a tree upon our box before then calculating how to project it into our desired viewport-relative box
*
* This is the final nested loop within updateLayoutDelta for future refactoring
*/
function applyTreeDeltas(box, treeScale, treePath) {
var treeLength = treePath.length;
if (!treeLength)
return;
// Reset the treeScale
treeScale.x = treeScale.y = 1;
var node;
var delta;
for (var i = 0; i < treeLength; i++) {
node = treePath[i];
delta = node.getLayoutState().delta;
// Incoporate each ancestor's scale into a culmulative treeScale for this component
treeScale.x *= delta.x.scale;
treeScale.y *= delta.y.scale;
// Apply each ancestor's calculated delta into this component's recorded layout box
applyBoxDelta(box, delta);
// If this is a draggable ancestor, also incorporate the node's transform to the layout box
if (isDraggable(node)) {
applyBoxTransforms(box, box, node.getLatestValues());
}
}
}
// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/dom/projection/convert-to-relative.js
/**
* Returns a boolean stating whether or not we converted the projection
* to relative projection.
*/
function convertToRelativeProjection(visualElement, isLayoutDrag) {
if (isLayoutDrag === void 0) { isLayoutDrag = true; }
var projectionParent = visualElement.getProjectionParent();
if (!projectionParent)
return false;
var offset;
if (isLayoutDrag) {
offset = calcRelativeOffset(projectionParent.projection.target, visualElement.projection.target);
removeBoxTransforms(offset, projectionParent.getLatestValues());
}
else {
offset = calcRelativeOffset(projectionParent.getLayoutState().layout, visualElement.getLayoutState().layout);
}
eachAxis(function (axis) {
return visualElement.setProjectionTargetAxis(axis, offset[axis].min, offset[axis].max, true);
});
return true;
}
// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/dom/utils/batch-layout.js
var unresolvedJobs = new Set();
function pushJob(stack, job, pointer) {
if (!stack[pointer])
stack[pointer] = [];
stack[pointer].push(job);
}
function batchLayout(callback) {
unresolvedJobs.add(callback);
return function () { return unresolvedJobs.delete(callback); };
}
function flushLayout() {
if (!unresolvedJobs.size)
return;
var pointer = 0;
var reads = [[]];
var writes = [];
var setRead = function (job) { return pushJob(reads, job, pointer); };
var setWrite = function (job) {
pushJob(writes, job, pointer);
pointer++;
};
/**
* Resolve jobs into their array stacks
*/
unresolvedJobs.forEach(function (callback) {
callback(setRead, setWrite);
pointer = 0;
});
unresolvedJobs.clear();
/**
* Execute jobs
*/
var numStacks = writes.length;
for (var i = 0; i <= numStacks; i++) {
reads[i] && reads[i].forEach(executeJob);
writes[i] && writes[i].forEach(executeJob);
}
}
var executeJob = function (job) { return job(); };
// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/gestures/drag/VisualElementDragControls.js
var elementDragControls = new WeakMap();
/**
*
*/
var lastPointerEvent;
var VisualElementDragControls_VisualElementDragControls = /** @class */ (function () {
function VisualElementDragControls(_a) {
var visualElement = _a.visualElement;
/**
* Track whether we're currently dragging.
*
* @internal
*/
this.isDragging = false;
/**
* The current direction of drag, or `null` if both.
*
* @internal
*/
this.currentDirection = null;
/**
* The permitted boundaries of travel, in pixels.
*
* @internal
*/
this.constraints = false;
/**
* The per-axis resolved elastic values.
*
* @internal
*/
this.elastic = axisBox();
/**
* A reference to the host component's latest props.
*
* @internal
*/
this.props = {};
/**
* @internal
*/
this.hasMutatedConstraints = false;
/**
* Track the initial position of the cursor relative to the dragging element
* when dragging starts as a value of 0-1 on each axis. We then use this to calculate
* an ideal bounding box for the VisualElement renderer to project into every frame.
*
* @internal
*/
this.cursorProgress = {
x: 0.5,
y: 0.5,
};
// When updating _dragX, or _dragY instead of the VisualElement,
// persist their values between drag gestures.
this.originPoint = {};
// This is a reference to the global drag gesture lock, ensuring only one component
// can "capture" the drag of one or both axes.
// TODO: Look into moving this into pansession?
this.openGlobalLock = null;
/**
* @internal
*/
this.panSession = null;
this.visualElement = visualElement;
this.visualElement.enableLayoutProjection();
elementDragControls.set(visualElement, this);
}
/**
* Instantiate a PanSession for the drag gesture
*
* @public
*/
VisualElementDragControls.prototype.start = function (originEvent, _a) {
var _this = this;
var _b = _a === void 0 ? {} : _a, _c = _b.snapToCursor, snapToCursor = _c === void 0 ? false : _c, cursorProgress = _b.cursorProgress;
var onSessionStart = function (event) {
var _a;
// Stop any animations on both axis values immediately. This allows the user to throw and catch
// the component.
_this.stopMotion();
/**
* Save the initial point. We'll use this to calculate the pointer's position rather
* than the one we receive when the gesture actually starts. By then, the pointer will
* have already moved, and the perception will be of the pointer "slipping" across the element
*/
var initialPoint = getViewportPointFromEvent(event).point;
(_a = _this.cancelLayout) === null || _a === void 0 ? void 0 : _a.call(_this);
_this.cancelLayout = batchLayout(function (read, write) {
var ancestors = collectProjectingAncestors(_this.visualElement);
var children = collectProjectingChildren(_this.visualElement);
var tree = __spreadArray(__spreadArray([], __read(ancestors)), __read(children));
var hasManuallySetCursorOrigin = false;
/**
* Apply a simple lock to the projection target. This ensures no animations
* can run on the projection box while this lock is active.
*/
_this.isLayoutDrag() && _this.visualElement.lockProjectionTarget();
write(function () {
tree.forEach(function (element) { return element.resetTransform(); });
});
read(function () {
updateLayoutMeasurement(_this.visualElement);
children.forEach(updateLayoutMeasurement);
});
write(function () {
tree.forEach(function (element) { return element.restoreTransform(); });
if (snapToCursor) {
hasManuallySetCursorOrigin = _this.snapToCursor(initialPoint);
}
});
read(function () {
var isRelativeDrag = Boolean(_this.getAxisMotionValue("x") && !_this.isExternalDrag());
if (!isRelativeDrag) {
_this.visualElement.rebaseProjectionTarget(true, _this.visualElement.measureViewportBox(false));
}
_this.visualElement.scheduleUpdateLayoutProjection();
/**
* When dragging starts, we want to find where the cursor is relative to the bounding box
* of the element. Every frame, we calculate a new bounding box using this relative position
* and let the visualElement renderer figure out how to reproject the element into this bounding
* box.
*
* By doing it this way, rather than applying an x/y transform directly to the element,
* we can ensure the component always visually sticks to the cursor as we'd expect, even
* if the DOM element itself changes layout as a result of React updates the user might
* make based on the drag position.
*/
var projection = _this.visualElement.projection;
eachAxis(function (axis) {
if (!hasManuallySetCursorOrigin) {
var _a = projection.target[axis], min = _a.min, max = _a.max;
_this.cursorProgress[axis] = cursorProgress
? cursorProgress[axis]
: progress_progress(min, max, initialPoint[axis]);
}
/**
* If we have external drag MotionValues, record their origin point. On pointermove
* we'll apply the pan gesture offset directly to this value.
*/
var axisValue = _this.getAxisMotionValue(axis);
if (axisValue) {
_this.originPoint[axis] = axisValue.get();
}
});
});
write(function () {
flushSync.update();
flushSync.preRender();
flushSync.render();
flushSync.postRender();
});
read(function () { return _this.resolveDragConstraints(); });
});
};
var onStart = function (event, info) {
var _a, _b, _c;
// Attempt to grab the global drag gesture lock - maybe make this part of PanSession
var _d = _this.props, drag = _d.drag, dragPropagation = _d.dragPropagation;
if (drag && !dragPropagation) {
if (_this.openGlobalLock)
_this.openGlobalLock();
_this.openGlobalLock = getGlobalLock(drag);
// If we don 't have the lock, don't start dragging
if (!_this.openGlobalLock)
return;
}
flushLayout();
// Set current drag status
_this.isDragging = true;
_this.currentDirection = null;
// Fire onDragStart event
(_b = (_a = _this.props).onDragStart) === null || _b === void 0 ? void 0 : _b.call(_a, event, info);
(_c = _this.visualElement.animationState) === null || _c === void 0 ? void 0 : _c.setActive(AnimationType.Drag, true);
};
var onMove = function (event, info) {
var _a, _b, _c, _d;
var _e = _this.props, dragPropagation = _e.dragPropagation, dragDirectionLock = _e.dragDirectionLock;
// If we didn't successfully receive the gesture lock, early return.
if (!dragPropagation && !_this.openGlobalLock)
return;
var offset = info.offset;
// Attempt to detect drag direction if directionLock is true
if (dragDirectionLock && _this.currentDirection === null) {
_this.currentDirection = getCurrentDirection(offset);
// If we've successfully set a direction, notify listener
if (_this.currentDirection !== null) {
(_b = (_a = _this.props).onDirectionLock) === null || _b === void 0 ? void 0 : _b.call(_a, _this.currentDirection);
}
return;
}
// Update each point with the latest position
_this.updateAxis("x", info.point, offset);
_this.updateAxis("y", info.point, offset);
// Fire onDrag event
(_d = (_c = _this.props).onDrag) === null || _d === void 0 ? void 0 : _d.call(_c, event, info);
// Update the last pointer event
lastPointerEvent = event;
};
var onSessionEnd = function (event, info) {
return _this.stop(event, info);
};
var transformPagePoint = this.props.transformPagePoint;
this.panSession = new PanSession_PanSession(originEvent, {
onSessionStart: onSessionStart,
onStart: onStart,
onMove: onMove,
onSessionEnd: onSessionEnd,
}, { transformPagePoint: transformPagePoint });
};
VisualElementDragControls.prototype.resolveDragConstraints = function () {
var _this = this;
var _a = this.props, dragConstraints = _a.dragConstraints, dragElastic = _a.dragElastic;
var layout = this.visualElement.getLayoutState().layoutCorrected;
if (dragConstraints) {
this.constraints = isRefObject(dragConstraints)
? this.resolveRefConstraints(layout, dragConstraints)
: calcRelativeConstraints(layout, dragConstraints);
}
else {
this.constraints = false;
}
this.elastic = resolveDragElastic(dragElastic);
/**
* If we're outputting to external MotionValues, we want to rebase the measured constraints
* from viewport-relative to component-relative.
*/
if (this.constraints && !this.hasMutatedConstraints) {
eachAxis(function (axis) {
if (_this.getAxisMotionValue(axis)) {
_this.constraints[axis] = rebaseAxisConstraints(layout[axis], _this.constraints[axis]);
}
});
}
};
VisualElementDragControls.prototype.resolveRefConstraints = function (layoutBox, constraints) {
var _a = this.props, onMeasureDragConstraints = _a.onMeasureDragConstraints, transformPagePoint = _a.transformPagePoint;
var constraintsElement = constraints.current;
invariant(constraintsElement !== null, "If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.");
this.constraintsBox = getBoundingBox(constraintsElement, transformPagePoint);
var measuredConstraints = calcViewportConstraints(layoutBox, this.constraintsBox);
/**
* If there's an onMeasureDragConstraints listener we call it and
* if different constraints are returned, set constraints to that
*/
if (onMeasureDragConstraints) {
var userConstraints = onMeasureDragConstraints(convertAxisBoxToBoundingBox(measuredConstraints));
this.hasMutatedConstraints = !!userConstraints;
if (userConstraints) {
measuredConstraints = convertBoundingBoxToAxisBox(userConstraints);
}
}
return measuredConstraints;
};
VisualElementDragControls.prototype.cancelDrag = function () {
var _a, _b;
this.visualElement.unlockProjectionTarget();
(_a = this.cancelLayout) === null || _a === void 0 ? void 0 : _a.call(this);
this.isDragging = false;
this.panSession && this.panSession.end();
this.panSession = null;
if (!this.props.dragPropagation && this.openGlobalLock) {
this.openGlobalLock();
this.openGlobalLock = null;
}
(_b = this.visualElement.animationState) === null || _b === void 0 ? void 0 : _b.setActive(AnimationType.Drag, false);
};
VisualElementDragControls.prototype.stop = function (event, info) {
var _a, _b, _c;
(_a = this.panSession) === null || _a === void 0 ? void 0 : _a.end();
this.panSession = null;
var isDragging = this.isDragging;
this.cancelDrag();
if (!isDragging)
return;
var velocity = info.velocity;
this.animateDragEnd(velocity);
(_c = (_b = this.props).onDragEnd) === null || _c === void 0 ? void 0 : _c.call(_b, event, info);
};
VisualElementDragControls.prototype.snapToCursor = function (point) {
var _this = this;
return eachAxis(function (axis) {
var drag = _this.props.drag;
// If we're not dragging this axis, do an early return.
if (!shouldDrag(axis, drag, _this.currentDirection))
return;
var axisValue = _this.getAxisMotionValue(axis);
if (axisValue) {
var box = _this.visualElement.getLayoutState().layout;
var length_1 = box[axis].max - box[axis].min;
var center = box[axis].min + length_1 / 2;
var offset = point[axis] - center;
_this.originPoint[axis] = point[axis];
axisValue.set(offset);
}
else {
_this.cursorProgress[axis] = 0.5;
return true;
}
}).includes(true);
};
/**
* Update the specified axis with the latest pointer information.
*/
VisualElementDragControls.prototype.updateAxis = function (axis, point, offset) {
var drag = this.props.drag;
// If we're not dragging this axis, do an early return.
if (!shouldDrag(axis, drag, this.currentDirection))
return;
return this.getAxisMotionValue(axis)
? this.updateAxisMotionValue(axis, offset)
: this.updateVisualElementAxis(axis, point);
};
VisualElementDragControls.prototype.updateAxisMotionValue = function (axis, offset) {
var axisValue = this.getAxisMotionValue(axis);
if (!offset || !axisValue)
return;
var nextValue = this.originPoint[axis] + offset[axis];
var update = this.constraints
? applyConstraints(nextValue, this.constraints[axis], this.elastic[axis])
: nextValue;
axisValue.set(update);
};
VisualElementDragControls.prototype.updateVisualElementAxis = function (axis, point) {
var _a;
// Get the actual layout bounding box of the element
var axisLayout = this.visualElement.getLayoutState().layout[axis];
// Calculate its current length. In the future we might want to lerp this to animate
// between lengths if the layout changes as we change the DOM
var axisLength = axisLayout.max - axisLayout.min;
// Get the initial progress that the pointer sat on this axis on gesture start.
var axisProgress = this.cursorProgress[axis];
// Calculate a new min point based on the latest pointer position, constraints and elastic
var min = calcConstrainedMinPoint(point[axis], axisLength, axisProgress, (_a = this.constraints) === null || _a === void 0 ? void 0 : _a[axis], this.elastic[axis]);
// Update the axis viewport target with this new min and the length
this.visualElement.setProjectionTargetAxis(axis, min, min + axisLength);
};
VisualElementDragControls.prototype.setProps = function (_a) {
var _b = _a.drag, drag = _b === void 0 ? false : _b, _c = _a.dragDirectionLock, dragDirectionLock = _c === void 0 ? false : _c, _d = _a.dragPropagation, dragPropagation = _d === void 0 ? false : _d, _e = _a.dragConstraints, dragConstraints = _e === void 0 ? false : _e, _f = _a.dragElastic, dragElastic = _f === void 0 ? defaultElastic : _f, _g = _a.dragMomentum, dragMomentum = _g === void 0 ? true : _g, remainingProps = __rest(_a, ["drag", "dragDirectionLock", "dragPropagation", "dragConstraints", "dragElastic", "dragMomentum"]);
this.props = __assign({ drag: drag,
dragDirectionLock: dragDirectionLock,
dragPropagation: dragPropagation,
dragConstraints: dragConstraints,
dragElastic: dragElastic,
dragMomentum: dragMomentum }, remainingProps);
};
/**
* Drag works differently depending on which props are provided.
*
* - If _dragX and _dragY are provided, we output the gesture delta directly to those motion values.
* - If the component will perform layout animations, we output the gesture to the component's
* visual bounding box
* - Otherwise, we apply the delta to the x/y motion values.
*/
VisualElementDragControls.prototype.getAxisMotionValue = function (axis) {
var _a = this.props, layout = _a.layout, layoutId = _a.layoutId;
var dragKey = "_drag" + axis.toUpperCase();
if (this.props[dragKey]) {
return this.props[dragKey];
}
else if (!layout && layoutId === undefined) {
return this.visualElement.getValue(axis, 0);
}
};
VisualElementDragControls.prototype.isLayoutDrag = function () {
return !this.getAxisMotionValue("x");
};
VisualElementDragControls.prototype.isExternalDrag = function () {
var _a = this.props, _dragX = _a._dragX, _dragY = _a._dragY;
return _dragX || _dragY;
};
VisualElementDragControls.prototype.animateDragEnd = function (velocity) {
var _this = this;
var _a = this.props, drag = _a.drag, dragMomentum = _a.dragMomentum, dragElastic = _a.dragElastic, dragTransition = _a.dragTransition;
/**
* Everything beyond the drag gesture should be performed with
* relative projection so children stay in sync with their parent element.
*/
var isRelative = convertToRelativeProjection(this.visualElement, this.isLayoutDrag() && !this.isExternalDrag());
/**
* If we had previously resolved constraints relative to the viewport,
* we need to also convert those to a relative coordinate space for the animation
*/
var constraints = this.constraints || {};
if (isRelative &&
Object.keys(constraints).length &&
this.isLayoutDrag()) {
var projectionParent = this.visualElement.getProjectionParent();
if (projectionParent) {
var relativeConstraints_1 = calcRelativeOffset(projectionParent.projection.targetFinal, constraints);
eachAxis(function (axis) {
var _a = relativeConstraints_1[axis], min = _a.min, max = _a.max;
constraints[axis] = {
min: isNaN(min) ? undefined : min,
max: isNaN(max) ? undefined : max,
};
});
}
}
var momentumAnimations = eachAxis(function (axis) {
var _a;
if (!shouldDrag(axis, drag, _this.currentDirection)) {
return;
}
var transition = (_a = constraints === null || constraints === void 0 ? void 0 : constraints[axis]) !== null && _a !== void 0 ? _a : {};
/**
* Overdamp the boundary spring if `dragElastic` is disabled. There's still a frame
* of spring animations so we should look into adding a disable spring option to `inertia`.
* We could do something here where we affect the `bounceStiffness` and `bounceDamping`
* using the value of `dragElastic`.
*/
var bounceStiffness = dragElastic ? 200 : 1000000;
var bounceDamping = dragElastic ? 40 : 10000000;
var inertia = __assign(__assign({ type: "inertia", velocity: dragMomentum ? velocity[axis] : 0, bounceStiffness: bounceStiffness,
bounceDamping: bounceDamping, timeConstant: 750, restDelta: 1, restSpeed: 10 }, dragTransition), transition);
// If we're not animating on an externally-provided `MotionValue` we can use the
// component's animation controls which will handle interactions with whileHover (etc),
// otherwise we just have to animate the `MotionValue` itself.
return _this.getAxisMotionValue(axis)
? _this.startAxisValueAnimation(axis, inertia)
: _this.visualElement.startLayoutAnimation(axis, inertia, isRelative);
});
// Run all animations and then resolve the new drag constraints.
return Promise.all(momentumAnimations).then(function () {
var _a, _b;
(_b = (_a = _this.props).onDragTransitionEnd) === null || _b === void 0 ? void 0 : _b.call(_a);
});
};
VisualElementDragControls.prototype.stopMotion = function () {
var _this = this;
eachAxis(function (axis) {
var axisValue = _this.getAxisMotionValue(axis);
axisValue
? axisValue.stop()
: _this.visualElement.stopLayoutAnimation();
});
};
VisualElementDragControls.prototype.startAxisValueAnimation = function (axis, transition) {
var axisValue = this.getAxisMotionValue(axis);
if (!axisValue)
return;
var currentValue = axisValue.get();
axisValue.set(currentValue);
axisValue.set(currentValue); // Set twice to hard-reset velocity
return transitions_startAnimation(axis, axisValue, 0, transition);
};
VisualElementDragControls.prototype.scalePoint = function () {
var _this = this;
var _a = this.props, drag = _a.drag, dragConstraints = _a.dragConstraints;
if (!isRefObject(dragConstraints) || !this.constraintsBox)
return;
// Stop any current animations as there can be some visual glitching if we resize mid animation
this.stopMotion();
// Record the relative progress of the targetBox relative to the constraintsBox
var boxProgress = { x: 0, y: 0 };
eachAxis(function (axis) {
boxProgress[axis] = delta_calc_calcOrigin(_this.visualElement.projection.target[axis], _this.constraintsBox[axis]);
});
/**
* For each axis, calculate the current progress of the layout axis within the constraints.
* Then, using the latest layout and constraints measurements, reposition the new layout axis
* proportionally within the constraints.
*/
this.updateConstraints(function () {
eachAxis(function (axis) {
if (!shouldDrag(axis, drag, null))
return;
// Calculate the position of the targetBox relative to the constraintsBox using the
// previously calculated progress
var _a = calcPositionFromProgress(_this.visualElement.projection.target[axis], _this.constraintsBox[axis], boxProgress[axis]), min = _a.min, max = _a.max;
_this.visualElement.setProjectionTargetAxis(axis, min, max);
});
});
/**
* If any other draggable components are queuing the same tasks synchronously
* this will wait until they've all been scheduled before flushing.
*/
setTimeout(flushLayout, 1);
};
VisualElementDragControls.prototype.updateConstraints = function (onReady) {
var _this = this;
this.cancelLayout = batchLayout(function (read, write) {
var ancestors = collectProjectingAncestors(_this.visualElement);
write(function () {
return ancestors.forEach(function (element) { return element.resetTransform(); });
});
read(function () { return updateLayoutMeasurement(_this.visualElement); });
write(function () {
return ancestors.forEach(function (element) { return element.restoreTransform(); });
});
read(function () {
_this.resolveDragConstraints();
});
if (onReady)
write(onReady);
});
};
VisualElementDragControls.prototype.mount = function (visualElement) {
var _this = this;
var element = visualElement.getInstance();
/**
* Attach a pointerdown event listener on this DOM element to initiate drag tracking.
*/
var stopPointerListener = addPointerEvent(element, "pointerdown", function (event) {
var _a = _this.props, drag = _a.drag, _b = _a.dragListener, dragListener = _b === void 0 ? true : _b;
drag && dragListener && _this.start(event);
});
/**
* Attach a window resize listener to scale the draggable target within its defined
* constraints as the window resizes.
*/
var stopResizeListener = addDomEvent(window, "resize", function () {
_this.scalePoint();
});
/**
* Ensure drag constraints are resolved correctly relative to the dragging element
* whenever its layout changes.
*/
var stopLayoutUpdateListener = visualElement.onLayoutUpdate(function () {
if (_this.isDragging) {
_this.resolveDragConstraints();
}
});
/**
* If the previous component with this same layoutId was dragging at the time
* it was unmounted, we want to continue the same gesture on this component.
*/
var prevDragCursor = visualElement.prevDragCursor;
if (prevDragCursor) {
this.start(lastPointerEvent, { cursorProgress: prevDragCursor });
}
/**
* Return a function that will teardown the drag gesture
*/
return function () {
stopPointerListener === null || stopPointerListener === void 0 ? void 0 : stopPointerListener();
stopResizeListener === null || stopResizeListener === void 0 ? void 0 : stopResizeListener();
stopLayoutUpdateListener === null || stopLayoutUpdateListener === void 0 ? void 0 : stopLayoutUpdateListener();
_this.cancelDrag();
};
};
return VisualElementDragControls;
}());
function shouldDrag(direction, drag, currentDirection) {
return ((drag === true || drag === direction) &&
(currentDirection === null || currentDirection === direction));
}
/**
* Based on an x/y offset determine the current drag direction. If both axis' offsets are lower
* than the provided threshold, return `null`.
*
* @param offset - The x/y offset from origin.
* @param lockThreshold - (Optional) - the minimum absolute offset before we can determine a drag direction.
*/
function getCurrentDirection(offset, lockThreshold) {
if (lockThreshold === void 0) { lockThreshold = 10; }
var direction = null;
if (Math.abs(offset.y) > lockThreshold) {
direction = "y";
}
else if (Math.abs(offset.x) > lockThreshold) {
direction = "x";
}
return direction;
}
// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/gestures/drag/use-drag.js
/**
* A hook that allows an element to be dragged.
*
* @internal
*/
function useDrag(props) {
var groupDragControls = props.dragControls, visualElement = props.visualElement;
var transformPagePoint = Object(external_React_["useContext"])(MotionConfigContext).transformPagePoint;
var dragControls = useConstant(function () {
return new VisualElementDragControls_VisualElementDragControls({
visualElement: visualElement,
});
});
dragControls.setProps(__assign(__assign({}, props), { transformPagePoint: transformPagePoint }));
// If we've been provided a DragControls for manual control over the drag gesture,
// subscribe this component to it on mount.
Object(external_React_["useEffect"])(function () { return groupDragControls && groupDragControls.subscribe(dragControls); }, [dragControls]);
// Mount the drag controls with the visualElement
Object(external_React_["useEffect"])(function () { return dragControls.mount(visualElement); }, []);
}
// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/gestures/use-pan-gesture.js
/**
*
* @param handlers -
* @param ref -
*
* @internalremarks
* Currently this sets new pan gesture functions every render. The memo route has been explored
* in the past but ultimately we're still creating new functions every render. An optimisation
* to explore is creating the pan gestures and loading them into a `ref`.
*
* @internal
*/
function usePanGesture(_a) {
var onPan = _a.onPan, onPanStart = _a.onPanStart, onPanEnd = _a.onPanEnd, onPanSessionStart = _a.onPanSessionStart, visualElement = _a.visualElement;
var hasPanEvents = onPan || onPanStart || onPanEnd || onPanSessionStart;
var panSession = Object(external_React_["useRef"])(null);
var transformPagePoint = Object(external_React_["useContext"])(MotionConfigContext).transformPagePoint;
var handlers = {
onSessionStart: onPanSessionStart,
onStart: onPanStart,
onMove: onPan,
onEnd: function (event, info) {
panSession.current = null;
onPanEnd && onPanEnd(event, info);
},
};
Object(external_React_["useEffect"])(function () {
if (panSession.current !== null) {
panSession.current.updateHandlers(handlers);
}
});
function onPointerDown(event) {
panSession.current = new PanSession_PanSession(event, handlers, {
transformPagePoint: transformPagePoint,
});
}
usePointerEvent(visualElement, "pointerdown", hasPanEvents && onPointerDown);
useUnmountEffect(function () { return panSession.current && panSession.current.end(); });
}
// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/motion/features/drag.js
var drag_drag = {
pan: makeRenderlessComponent(usePanGesture),
drag: makeRenderlessComponent(useDrag),
};
// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/components/AnimateSharedLayout/types.js
/**
* @public
*/
var Presence;
(function (Presence) {
Presence[Presence["Entering"] = 0] = "Entering";
Presence[Presence["Present"] = 1] = "Present";
Presence[Presence["Exiting"] = 2] = "Exiting";
})(Presence || (Presence = {}));
/**
* @public
*/
var VisibilityAction;
(function (VisibilityAction) {
VisibilityAction[VisibilityAction["Hide"] = 0] = "Hide";
VisibilityAction[VisibilityAction["Show"] = 1] = "Show";
})(VisibilityAction || (VisibilityAction = {}));
// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/dom/utils/css-variables-conversion.js
function css_variables_conversion_isCSSVariable(value) {
return typeof value === "string" && value.startsWith("var(--");
}
/**
* Parse Framer's special CSS variable format into a CSS token and a fallback.
*
* ```
* `var(--foo, #fff)` => [`--foo`, '#fff']
* ```
*
* @param current
*/
var cssVariableRegex = /var\((--[a-zA-Z0-9-_]+),? ?([a-zA-Z0-9 ()%#.,-]+)?\)/;
function parseCSSVariable(current) {
var match = cssVariableRegex.exec(current);
if (!match)
return [,];
var _a = __read(match, 3), token = _a[1], fallback = _a[2];
return [token, fallback];
}
var maxDepth = 4;
function getVariableValue(current, element, depth) {
if (depth === void 0) { depth = 1; }
invariant(depth <= maxDepth, "Max CSS variable fallback depth detected in property \"" + current + "\". This may indicate a circular fallback dependency.");
var _a = __read(parseCSSVariable(current), 2), token = _a[0], fallback = _a[1];
// No CSS variable detected
if (!token)
return;
// Attempt to read this CSS variable off the element
var resolved = window.getComputedStyle(element).getPropertyValue(token);
if (resolved) {
return resolved.trim();
}
else if (css_variables_conversion_isCSSVariable(fallback)) {
// The fallback might itself be a CSS variable, in which case we attempt to resolve it too.
return getVariableValue(fallback, element, depth + 1);
}
else {
return fallback;
}
}
/**
* Resolve CSS variables from
*
* @internal
*/
function resolveCSSVariables(visualElement, _a, transitionEnd) {
var _b;
var target = __rest(_a, []);
var element = visualElement.getInstance();
if (!(element instanceof HTMLElement))
return { target: target, transitionEnd: transitionEnd };
// If `transitionEnd` isn't `undefined`, clone it. We could clone `target` and `transitionEnd`
// only if they change but I think this reads clearer and this isn't a performance-critical path.
if (transitionEnd) {
transitionEnd = __assign({}, transitionEnd);
}
// Go through existing `MotionValue`s and ensure any existing CSS variables are resolved
visualElement.forEachValue(function (value) {
var current = value.get();
if (!css_variables_conversion_isCSSVariable(current))
return;
var resolved = getVariableValue(current, element);
if (resolved)
value.set(resolved);
});
// Cycle through every target property and resolve CSS variables. Currently
// we only read single-var properties like `var(--foo)`, not `calc(var(--foo) + 20px)`
for (var key in target) {
var current = target[key];
if (!css_variables_conversion_isCSSVariable(current))
continue;
var resolved = getVariableValue(current, element);
if (!resolved)
continue;
// Clone target if it hasn't already been
target[key] = resolved;
// If the user hasn't already set this key on `transitionEnd`, set it to the unresolved
// CSS variable. This will ensure that after the animation the component will reflect
// changes in the value of the CSS variable.
if (transitionEnd)
(_b = transitionEnd[key]) !== null && _b !== void 0 ? _b : (transitionEnd[key] = current);
}
return { target: target, transitionEnd: transitionEnd };
}
// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/dom/projection/default-scale-correctors.js
function pixelsToPercent(pixels, axis) {
return (pixels / (axis.max - axis.min)) * 100;
}
/**
* We always correct borderRadius as a percentage rather than pixels to reduce paints.
* For example, if you are projecting a box that is 100px wide with a 10px borderRadius
* into a box that is 200px wide with a 20px borderRadius, that is actually a 10%
* borderRadius in both states. If we animate between the two in pixels that will trigger
* a paint each time. If we animate between the two in percentage we'll avoid a paint.
*/
function correctBorderRadius(latest, _layoutState, _a) {
var target = _a.target;
/**
* If latest is a string, if it's a percentage we can return immediately as it's
* going to be stretched appropriately. Otherwise, if it's a pixel, convert it to a number.
*/
if (typeof latest === "string") {
if (px.test(latest)) {
latest = parseFloat(latest);
}
else {
return latest;
}
}
/**
* If latest is a number, it's a pixel value. We use the current viewportBox to calculate that
* pixel value as a percentage of each axis
*/
var x = pixelsToPercent(latest, target.x);
var y = pixelsToPercent(latest, target.y);
return x + "% " + y + "%";
}
var varToken = "_$css";
function correctBoxShadow(latest, _a) {
var delta = _a.delta, treeScale = _a.treeScale;
var original = latest;
/**
* We need to first strip and store CSS variables from the string.
*/
var containsCSSVariables = latest.includes("var(");
var cssVariables = [];
if (containsCSSVariables) {
latest = latest.replace(cssVariableRegex, function (match) {
cssVariables.push(match);
return varToken;
});
}
var shadow = complex.parse(latest);
// TODO: Doesn't support multiple shadows
if (shadow.length > 5)
return original;
var template = complex.createTransformer(latest);
var offset = typeof shadow[0] !== "number" ? 1 : 0;
// Calculate the overall context scale
var xScale = delta.x.scale * treeScale.x;
var yScale = delta.y.scale * treeScale.y;
shadow[0 + offset] /= xScale;
shadow[1 + offset] /= yScale;
/**
* Ideally we'd correct x and y scales individually, but because blur and
* spread apply to both we have to take a scale average and apply that instead.
* We could potentially improve the outcome of this by incorporating the ratio between
* the two scales.
*/
var averageScale = mix(xScale, yScale, 0.5);
// Blur
if (typeof shadow[2 + offset] === "number")
shadow[2 + offset] /= averageScale;
// Spread
if (typeof shadow[3 + offset] === "number")
shadow[3 + offset] /= averageScale;
var output = template(shadow);
if (containsCSSVariables) {
var i_1 = 0;
output = output.replace(varToken, function () {
var cssVariable = cssVariables[i_1];
i_1++;
return cssVariable;
});
}
return output;
}
var borderCorrectionDefinition = {
process: correctBorderRadius,
};
var defaultScaleCorrectors = {
borderRadius: __assign(__assign({}, borderCorrectionDefinition), { applyTo: [
"borderTopLeftRadius",
"borderTopRightRadius",
"borderBottomLeftRadius",
"borderBottomRightRadius",
] }),
borderTopLeftRadius: borderCorrectionDefinition,
borderTopRightRadius: borderCorrectionDefinition,
borderBottomLeftRadius: borderCorrectionDefinition,
borderBottomRightRadius: borderCorrectionDefinition,
boxShadow: {
process: correctBoxShadow,
},
};
// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/motion/features/layout/Animate.js
var progressTarget = 1000;
var Animate_Animate = /** @class */ (function (_super) {
__extends(Animate, _super);
function Animate() {
var _this = _super !== null && _super.apply(this, arguments) || this;
/**
* A mutable object that tracks the target viewport box
* for the current animation frame.
*/
_this.frameTarget = axisBox();
/**
* The current animation target, we use this to check whether to start
* a new animation or continue the existing one.
*/
_this.currentAnimationTarget = axisBox();
/**
* Track whether we're animating this axis.
*/
_this.isAnimating = {
x: false,
y: false,
};
_this.stopAxisAnimation = {
x: undefined,
y: undefined,
};
_this.isAnimatingTree = false;
_this.animate = function (target, origin, _a) {
if (_a === void 0) { _a = {}; }
var originBox = _a.originBox, targetBox = _a.targetBox, visibilityAction = _a.visibilityAction, shouldStackAnimate = _a.shouldStackAnimate, onComplete = _a.onComplete, prevParent = _a.prevParent, config = __rest(_a, ["originBox", "targetBox", "visibilityAction", "shouldStackAnimate", "onComplete", "prevParent"]);
var _b = _this.props, visualElement = _b.visualElement, layout = _b.layout;
/**
* Early return if we've been instructed not to animate this render.
*/
if (shouldStackAnimate === false) {
_this.isAnimatingTree = false;
return _this.safeToRemove();
}
/**
* Prioritise tree animations
*/
if (_this.isAnimatingTree && shouldStackAnimate !== true) {
return;
}
else if (shouldStackAnimate) {
_this.isAnimatingTree = true;
}
/**
* Allow the measured origin (prev bounding box) and target (actual layout) to be
* overridden by the provided config.
*/
origin = originBox || origin;
target = targetBox || target;
/**
* If this element has a projecting parent, there's an opportunity to animate
* it relatively to that parent rather than relatively to the viewport. This
* allows us to add orchestrated animations.
*/
var isRelative = false;
var projectionParent = visualElement.getProjectionParent();
if (projectionParent) {
var prevParentViewportBox = projectionParent.prevViewportBox;
var parentLayout = projectionParent.getLayoutState().layout;
/**
* If we're being provided a previous parent VisualElement by AnimateSharedLayout
*/
if (prevParent) {
/**
* If we've been provided an explicit target box it means we're animating back
* to this previous parent. So we can make a relative box by comparing to the previous
* parent's layout
*/
if (targetBox) {
parentLayout = prevParent.getLayoutState().layout;
}
/**
* Likewise if we've been provided an explicit origin box it means we're
* animating out from a different element. So we should figure out where that was
* on screen relative to the new parent element.
*/
if (originBox &&
!checkIfParentHasChanged(prevParent, projectionParent) &&
prevParent.prevViewportBox) {
prevParentViewportBox = prevParent.prevViewportBox;
}
}
if (prevParentViewportBox &&
isProvidedCorrectDataForRelativeSharedLayout(prevParent, originBox, targetBox)) {
isRelative = true;
origin = calcRelativeOffset(prevParentViewportBox, origin);
target = calcRelativeOffset(parentLayout, target);
}
}
var boxHasMoved = hasMoved(origin, target);
var animations = eachAxis(function (axis) {
var _a, _b;
/**
* If layout is set to "position", we can resize the origin box based on the target
* box and only animate its position.
*/
if (layout === "position") {
var targetLength = target[axis].max - target[axis].min;
origin[axis].max = origin[axis].min + targetLength;
}
if (visualElement.projection.isTargetLocked) {
return;
}
else if (visibilityAction !== undefined) {
visualElement.setVisibility(visibilityAction === VisibilityAction.Show);
}
else if (boxHasMoved) {
// If the box has moved, animate between it's current visual state and its
// final state
return _this.animateAxis(axis, target[axis], origin[axis], __assign(__assign({}, config), { isRelative: isRelative }));
}
else {
(_b = (_a = _this.stopAxisAnimation)[axis]) === null || _b === void 0 ? void 0 : _b.call(_a);
// If the box has remained in the same place, immediately set the axis target
// to the final desired state
return visualElement.setProjectionTargetAxis(axis, target[axis].min, target[axis].max, isRelative);
}
});
// Force a render to ensure there's no flash of uncorrected bounding box.
visualElement.syncRender();
/**
* If this visualElement isn't present (ie it's been removed from the tree by the user but
* kept in by the tree by AnimatePresence) then call safeToRemove when all axis animations
* have successfully finished.
*/
return Promise.all(animations).then(function () {
_this.isAnimatingTree = false;
onComplete && onComplete();
visualElement.notifyLayoutAnimationComplete();
});
};
return _this;
}
Animate.prototype.componentDidMount = function () {
var _this = this;
var visualElement = this.props.visualElement;
visualElement.animateMotionValue = transitions_startAnimation;
visualElement.enableLayoutProjection();
this.unsubLayoutReady = visualElement.onLayoutUpdate(this.animate);
visualElement.layoutSafeToRemove = function () { return _this.safeToRemove(); };
addScaleCorrection(defaultScaleCorrectors);
};
Animate.prototype.componentWillUnmount = function () {
var _this = this;
this.unsubLayoutReady();
eachAxis(function (axis) { var _a, _b; return (_b = (_a = _this.stopAxisAnimation)[axis]) === null || _b === void 0 ? void 0 : _b.call(_a); });
};
/**
* TODO: This manually performs animations on the visualElement's layout progress
* values. It'd be preferable to amend the startLayoutAxisAnimation
* API to accept more custom animations like this.
*/
Animate.prototype.animateAxis = function (axis, target, origin, _a) {
var _this = this;
var _b, _c;
var _d = _a === void 0 ? {} : _a, transition = _d.transition, isRelative = _d.isRelative;
/**
* If we're not animating to a new target, don't run this animation
*/
if (this.isAnimating[axis] &&
axisIsEqual(target, this.currentAnimationTarget[axis])) {
return;
}
(_c = (_b = this.stopAxisAnimation)[axis]) === null || _c === void 0 ? void 0 : _c.call(_b);
this.isAnimating[axis] = true;
var visualElement = this.props.visualElement;
var frameTarget = this.frameTarget[axis];
var layoutProgress = visualElement.getProjectionAnimationProgress()[axis];
/**
* Set layout progress back to 0. We set it twice to hard-reset any velocity that might
* be re-incoporated into a subsequent spring animation.
*/
layoutProgress.clearListeners();
layoutProgress.set(0);
layoutProgress.set(0);
/**
* Create an animation function to run once per frame. This will tween the visual bounding box from
* origin to target using the latest progress value.
*/
var frame = function () {
// Convert the latest layoutProgress, which is a value from 0-1000, into a 0-1 progress
var p = layoutProgress.get() / progressTarget;
// Tween the axis and update the visualElement with the latest values
tweenAxis(frameTarget, origin, target, p);
visualElement.setProjectionTargetAxis(axis, frameTarget.min, frameTarget.max, isRelative);
};
// Synchronously run a frame to ensure there's no flash of the uncorrected bounding box.
frame();
// Create a function to stop animation on this specific axis
var unsubscribeProgress = layoutProgress.onChange(frame);
this.stopAxisAnimation[axis] = function () {
_this.isAnimating[axis] = false;
layoutProgress.stop();
unsubscribeProgress();
};
this.currentAnimationTarget[axis] = target;
var layoutTransition = transition ||
visualElement.getDefaultTransition() ||
defaultLayoutTransition;
// Start the animation on this axis
var animation = transitions_startAnimation(axis === "x" ? "layoutX" : "layoutY", layoutProgress, progressTarget, layoutTransition && getValueTransition(layoutTransition, "layout")).then(this.stopAxisAnimation[axis]);
return animation;
};
Animate.prototype.safeToRemove = function () {
var _a, _b;
(_b = (_a = this.props).safeToRemove) === null || _b === void 0 ? void 0 : _b.call(_a);
};
Animate.prototype.render = function () {
return null;
};
return Animate;
}(external_React_["Component"]));
function AnimateLayoutContextProvider(props) {
var _a = __read(usePresence(), 2), safeToRemove = _a[1];
return external_React_["createElement"](Animate_Animate, __assign({}, props, { safeToRemove: safeToRemove }));
}
function hasMoved(a, b) {
return (!isZeroBox(a) &&
!isZeroBox(b) &&
(!axisIsEqual(a.x, b.x) || !axisIsEqual(a.y, b.y)));
}
var zeroAxis = { min: 0, max: 0 };
function isZeroBox(a) {
return axisIsEqual(a.x, zeroAxis) && axisIsEqual(a.y, zeroAxis);
}
function axisIsEqual(a, b) {
return a.min === b.min && a.max === b.max;
}
var defaultLayoutTransition = {
duration: 0.45,
ease: [0.4, 0, 0.1, 1],
};
function isProvidedCorrectDataForRelativeSharedLayout(prevParent, originBox, targetBox) {
return prevParent || (!prevParent && !(originBox || targetBox));
}
// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/components/AnimateSharedLayout/utils/batcher.js
/**
* Default handlers for batching VisualElements
*/
var defaultHandler = {
layoutReady: function (child) { return child.notifyLayoutReady(); },
};
/**
* Create a batcher to process VisualElements
*/
function createBatcher() {
var queue = new Set();
return {
add: function (child) { return queue.add(child); },
flush: function (_a) {
var _b = _a === void 0 ? defaultHandler : _a, layoutReady = _b.layoutReady, parent = _b.parent;
batchLayout(function (read, write) {
var order = Array.from(queue).sort(compareByDepth);
var ancestors = parent
? collectProjectingAncestors(parent)
: [];
write(function () {
var allElements = __spreadArray(__spreadArray([], __read(ancestors)), __read(order));
allElements.forEach(function (element) { return element.resetTransform(); });
});
read(function () {
order.forEach(updateLayoutMeasurement);
});
write(function () {
ancestors.forEach(function (element) { return element.restoreTransform(); });
order.forEach(layoutReady);
});
read(function () {
/**
* After all children have started animating, ensure any Entering components are set to Present.
* If we add deferred animations (set up all animations and then start them in two loops) this
* could be moved to the start loop. But it needs to happen after all the animations configs
* are generated in AnimateSharedLayout as this relies on presence data
*/
order.forEach(function (child) {
if (child.isPresent)
child.presence = Presence.Present;
});
});
write(function () {
/**
* Starting these animations will have queued jobs on the frame loop. In some situations,
* like when removing an element, these will be processed too late after the DOM is manipulated,
* leaving a flash of incorrectly-projected content. By manually flushing these jobs
* we ensure there's no flash.
*/
flushSync.preRender();
flushSync.render();
});
read(function () {
/**
* Schedule a callback at the end of the following frame to assign the latest projection
* box to the prevViewportBox snapshot. Once global batching is in place this could be run
* synchronously. But for now it ensures that if any nested `AnimateSharedLayout` top-level
* child attempts to calculate its previous relative position against a prevViewportBox
* it will be against its latest projection box instead, as the snapshot is useless beyond this
* render.
*/
es.postRender(function () {
return order.forEach(assignProjectionToSnapshot);
});
queue.clear();
});
});
// TODO: Need to find a layout-synchronous way of flushing this
flushLayout();
},
};
}
function assignProjectionToSnapshot(child) {
child.prevViewportBox = child.projection.target;
}
// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/context/SharedLayoutContext.js
var SharedLayoutContext = Object(external_React_["createContext"])(createBatcher());
/**
* @internal
*/
var FramerTreeLayoutContext = Object(external_React_["createContext"])(createBatcher());
function isSharedLayout(context) {
return !!context.forceUpdate;
}
// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/motion/features/layout/Measure.js
/**
* This component is responsible for scheduling the measuring of the motion component
*/
var Measure_Measure = /** @class */ (function (_super) {
__extends(Measure, _super);
function Measure() {
return _super !== null && _super.apply(this, arguments) || this;
}
/**
* If this is a child of a SyncContext, register the VisualElement with it on mount.
*/
Measure.prototype.componentDidMount = function () {
var _a = this.props, syncLayout = _a.syncLayout, framerSyncLayout = _a.framerSyncLayout, visualElement = _a.visualElement;
isSharedLayout(syncLayout) && syncLayout.register(visualElement);
isSharedLayout(framerSyncLayout) &&
framerSyncLayout.register(visualElement);
visualElement.onUnmount(function () {
if (isSharedLayout(syncLayout)) {
syncLayout.remove(visualElement);
}
if (isSharedLayout(framerSyncLayout)) {
framerSyncLayout.remove(visualElement);
}
});
};
/**
* If this is a child of a SyncContext, notify it that it needs to re-render. It will then
* handle the snapshotting.
*
* If it is stand-alone component, add it to the batcher.
*/
Measure.prototype.getSnapshotBeforeUpdate = function () {
var _a = this.props, syncLayout = _a.syncLayout, visualElement = _a.visualElement;
if (isSharedLayout(syncLayout)) {
syncLayout.syncUpdate();
}
else {
snapshotViewportBox(visualElement);
syncLayout.add(visualElement);
}
return null;
};
Measure.prototype.componentDidUpdate = function () {
var syncLayout = this.props.syncLayout;
if (!isSharedLayout(syncLayout))
syncLayout.flush();
};
Measure.prototype.render = function () {
return null;
};
return Measure;
}(external_React_default.a.Component));
function MeasureContextProvider(props) {
var syncLayout = Object(external_React_["useContext"])(SharedLayoutContext);
var framerSyncLayout = Object(external_React_["useContext"])(FramerTreeLayoutContext);
return (external_React_default.a.createElement(Measure_Measure, __assign({}, props, { syncLayout: syncLayout, framerSyncLayout: framerSyncLayout })));
}
// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/motion/features/layout/index.js
var layoutAnimations = {
measureLayout: MeasureContextProvider,
layoutAnimation: AnimateLayoutContextProvider,
};
// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/utils/state.js
var createProjectionState = function () { return ({
isEnabled: false,
isHydrated: false,
isTargetLocked: false,
target: axisBox(),
targetFinal: axisBox(),
}); };
function createLayoutState() {
return {
isHydrated: false,
layout: axisBox(),
layoutCorrected: axisBox(),
treeScale: { x: 1, y: 1 },
delta: geometry_delta(),
deltaFinal: geometry_delta(),
deltaTransform: "",
};
}
var zeroLayout = createLayoutState();
// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/html/utils/build-projection-transform.js
/**
* Build a transform style that takes a calculated delta between the element's current
* space on screen and projects it into the desired space.
*/
function buildLayoutProjectionTransform(_a, treeScale, latestTransform) {
var x = _a.x, y = _a.y;
/**
* The translations we use to calculate are always relative to the viewport coordinate space.
* But when we apply scales, we also scale the coordinate space of an element and its children.
* For instance if we have a treeScale (the culmination of all parent scales) of 0.5 and we need
* to move an element 100 pixels, we actually need to move it 200 in within that scaled space.
*/
var xTranslate = x.translate / treeScale.x;
var yTranslate = y.translate / treeScale.y;
var transform = "translate3d(" + xTranslate + "px, " + yTranslate + "px, 0) ";
if (latestTransform) {
var rotate = latestTransform.rotate, rotateX = latestTransform.rotateX, rotateY = latestTransform.rotateY;
if (rotate)
transform += "rotate(" + rotate + ") ";
if (rotateX)
transform += "rotateX(" + rotateX + ") ";
if (rotateY)
transform += "rotateY(" + rotateY + ") ";
}
transform += "scale(" + x.scale + ", " + y.scale + ")";
return !latestTransform && transform === identityProjection ? "" : transform;
}
/**
* Take the calculated delta origin and apply it as a transform string.
*/
function buildLayoutProjectionTransformOrigin(_a) {
var deltaFinal = _a.deltaFinal;
return deltaFinal.x.origin * 100 + "% " + deltaFinal.y.origin * 100 + "% 0";
}
var identityProjection = buildLayoutProjectionTransform(zeroLayout.delta, zeroLayout.treeScale, { x: 1, y: 1 });
// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/utils/lifecycles.js
var names = [
"LayoutMeasure",
"BeforeLayoutMeasure",
"LayoutUpdate",
"ViewportBoxUpdate",
"Update",
"Render",
"AnimationComplete",
"LayoutAnimationComplete",
"AnimationStart",
"SetAxisTarget",
"Unmount",
];
function createLifecycles() {
var managers = names.map(function () { return new subscription_manager_SubscriptionManager(); });
var propSubscriptions = {};
var lifecycles = {
clearAllListeners: function () { return managers.forEach(function (manager) { return manager.clear(); }); },
updatePropListeners: function (props) {
return names.forEach(function (name) {
var _a;
(_a = propSubscriptions[name]) === null || _a === void 0 ? void 0 : _a.call(propSubscriptions);
var on = "on" + name;
var propListener = props[on];
if (propListener) {
propSubscriptions[name] = lifecycles[on](propListener);
}
});
},
};
managers.forEach(function (manager, i) {
lifecycles["on" + names[i]] = function (handler) { return manager.add(handler); };
lifecycles["notify" + names[i]] = function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
return manager.notify.apply(manager, __spreadArray([], __read(args)));
};
});
return lifecycles;
}
// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/utils/motion-values.js
function updateMotionValuesFromProps(element, next, prev) {
var _a;
for (var key in next) {
var nextValue = next[key];
var prevValue = prev[key];
if (isMotionValue(nextValue)) {
/**
* If this is a motion value found in props or style, we want to add it
* to our visual element's motion value map.
*/
element.addValue(key, nextValue);
}
else if (isMotionValue(prevValue)) {
/**
* If we're swapping to a new motion value, create a new motion value
* from that
*/
element.addValue(key, motionValue(nextValue));
}
else if (prevValue !== nextValue) {
/**
* If this is a flat value that has changed, update the motion value
* or create one if it doesn't exist. We only want to do this if we're
* not handling the value with our animation state.
*/
if (element.hasValue(key)) {
var existingValue = element.getValue(key);
// TODO: Only update values that aren't being animated or even looked at
!existingValue.hasAnimated && existingValue.set(nextValue);
}
else {
element.addValue(key, motionValue((_a = element.getStaticValue(key)) !== null && _a !== void 0 ? _a : nextValue));
}
}
}
// Handle removed values
for (var key in prev) {
if (next[key] === undefined)
element.removeValue(key);
}
return next;
}
// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/utils/projection.js
function updateLayoutDeltas(_a, _b, treePath, transformOrigin) {
var delta = _a.delta, layout = _a.layout, layoutCorrected = _a.layoutCorrected, treeScale = _a.treeScale;
var target = _b.target;
/**
* Reset the corrected box with the latest values from box, as we're then going
* to perform mutative operations on it.
*/
resetBox(layoutCorrected, layout);
/**
* Apply all the parent deltas to this box to produce the corrected box. This
* is the layout box, as it will appear on screen as a result of the transforms of its parents.
*/
applyTreeDeltas(layoutCorrected, treeScale, treePath);
/**
* Update the delta between the corrected box and the target box before user-set transforms were applied.
* This will allow us to calculate the corrected borderRadius and boxShadow to compensate
* for our layout reprojection, but still allow them to be scaled correctly by the user.
* It might be that to simplify this we may want to accept that user-set scale is also corrected
* and we wouldn't have to keep and calc both deltas, OR we could support a user setting
* to allow people to choose whether these styles are corrected based on just the
* layout reprojection or the final bounding box.
*/
updateBoxDelta(delta, layoutCorrected, target, transformOrigin);
}
// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/utils/flat-tree.js
var flat_tree_FlatTree = /** @class */ (function () {
function FlatTree() {
this.children = [];
this.isDirty = false;
}
FlatTree.prototype.add = function (child) {
addUniqueItem(this.children, child);
this.isDirty = true;
};
FlatTree.prototype.remove = function (child) {
removeItem(this.children, child);
this.isDirty = true;
};
FlatTree.prototype.forEach = function (callback) {
this.isDirty && this.children.sort(compareByDepth);
this.isDirty = false;
this.children.forEach(callback);
};
return FlatTree;
}());
// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/dom/projection/relative-set.js
function setCurrentViewportBox(visualElement) {
var projectionParent = visualElement.getProjectionParent();
if (!projectionParent) {
visualElement.rebaseProjectionTarget();
return;
}
var relativeOffset = calcRelativeOffset(projectionParent.getLayoutState().layout, visualElement.getLayoutState().layout);
eachAxis(function (axis) {
visualElement.setProjectionTargetAxis(axis, relativeOffset[axis].min, relativeOffset[axis].max, true);
});
}
// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/index.js
var render_visualElement = function (_a) {
var _b = _a.treeType, treeType = _b === void 0 ? "" : _b, build = _a.build, getBaseTarget = _a.getBaseTarget, makeTargetAnimatable = _a.makeTargetAnimatable, measureViewportBox = _a.measureViewportBox, renderInstance = _a.render, readValueFromInstance = _a.readValueFromInstance, resetTransform = _a.resetTransform, restoreTransform = _a.restoreTransform, removeValueFromRenderState = _a.removeValueFromRenderState, sortNodePosition = _a.sortNodePosition, scrapeMotionValuesFromProps = _a.scrapeMotionValuesFromProps;
return function (_a, options) {
var parent = _a.parent, props = _a.props, presenceId = _a.presenceId, blockInitialAnimation = _a.blockInitialAnimation, visualState = _a.visualState;
if (options === void 0) { options = {}; }
var latestValues = visualState.latestValues, renderState = visualState.renderState;
/**
* The instance of the render-specific node that will be hydrated by the
* exposed React ref. So for example, this visual element can host a
* HTMLElement, plain object, or Three.js object. The functions provided
* in VisualElementConfig allow us to interface with this instance.
*/
var instance;
/**
* Manages the subscriptions for a visual element's lifecycle, for instance
* onRender and onViewportBoxUpdate.
*/
var lifecycles = createLifecycles();
/**
*
*/
var projection = createProjectionState();
/**
* A reference to the nearest projecting parent. This is either
* undefined if we haven't looked for the nearest projecting parent,
* false if there is no parent performing layout projection, or a reference
* to the projecting parent.
*/
var projectionParent;
/**
* This is a reference to the visual state of the "lead" visual element.
* Usually, this will be this visual element. But if it shares a layoutId
* with other visual elements, only one of them will be designated lead by
* AnimateSharedLayout. All the other visual elements will take on the visual
* appearance of the lead while they crossfade to it.
*/
var leadProjection = projection;
var leadLatestValues = latestValues;
var unsubscribeFromLeadVisualElement;
/**
* The latest layout measurements and calculated projections. This
* is seperate from the target projection data in visualState as
* many visual elements might point to the same piece of visualState as
* a target, whereas they might each have different layouts and thus
* projection calculations needed to project into the same viewport box.
*/
var layoutState = createLayoutState();
/**
*
*/
var crossfader;
/**
* Keep track of whether the viewport box has been updated since the
* last time the layout projection was re-calculated.
*/
var hasViewportBoxUpdated = false;
/**
* A map of all motion values attached to this visual element. Motion
* values are source of truth for any given animated value. A motion
* value might be provided externally by the component via props.
*/
var values = new Map();
/**
* A map of every subscription that binds the provided or generated
* motion values onChange listeners to this visual element.
*/
var valueSubscriptions = new Map();
/**
* A reference to the previously-provided motion values as returned
* from scrapeMotionValuesFromProps. We use the keys in here to determine
* if any motion values need to be removed after props are updated.
*/
var prevMotionValues = {};
/**
* x/y motion values that track the progress of initiated layout
* animations.
*
* TODO: Target for removal
*/
var projectionTargetProgress;
/**
* When values are removed from all animation props we need to search
* for a fallback value to animate to. These values are tracked in baseTarget.
*/
var baseTarget = __assign({}, latestValues);
// Internal methods ========================
/**
* On mount, this will be hydrated with a callback to disconnect
* this visual element from its parent on unmount.
*/
var removeFromVariantTree;
/**
*
*/
function render() {
if (!instance)
return;
if (element.isProjectionReady()) {
/**
* Apply the latest user-set transforms to the targetBox to produce the targetBoxFinal.
* This is the final box that we will then project into by calculating a transform delta and
* applying it to the corrected box.
*/
applyBoxTransforms(leadProjection.targetFinal, leadProjection.target, leadLatestValues);
/**
* Update the delta between the corrected box and the final target box, after
* user-set transforms are applied to it. This will be used by the renderer to
* create a transform style that will reproject the element from its actual layout
* into the desired bounding box.
*/
updateBoxDelta(layoutState.deltaFinal, layoutState.layoutCorrected, leadProjection.targetFinal, latestValues);
}
triggerBuild();
renderInstance(instance, renderState);
}
function triggerBuild() {
var valuesToRender = latestValues;
if (crossfader && crossfader.isActive()) {
var crossfadedValues = crossfader.getCrossfadeState(element);
if (crossfadedValues)
valuesToRender = crossfadedValues;
}
build(element, renderState, valuesToRender, leadProjection, layoutState, options, props);
}
function update() {
lifecycles.notifyUpdate(latestValues);
}
function updateLayoutProjection() {
if (!element.isProjectionReady())
return;
var delta = layoutState.delta, treeScale = layoutState.treeScale;
var prevTreeScaleX = treeScale.x;
var prevTreeScaleY = treeScale.y;
var prevDeltaTransform = layoutState.deltaTransform;
updateLayoutDeltas(layoutState, leadProjection, element.path, latestValues);
hasViewportBoxUpdated &&
element.notifyViewportBoxUpdate(leadProjection.target, delta);
hasViewportBoxUpdated = false;
var deltaTransform = buildLayoutProjectionTransform(delta, treeScale);
if (deltaTransform !== prevDeltaTransform ||
// Also compare calculated treeScale, for values that rely on this only for scale correction
prevTreeScaleX !== treeScale.x ||
prevTreeScaleY !== treeScale.y) {
element.scheduleRender();
}
layoutState.deltaTransform = deltaTransform;
}
function updateTreeLayoutProjection() {
element.layoutTree.forEach(fireUpdateLayoutProjection);
}
/**
*
*/
function bindToMotionValue(key, value) {
var removeOnChange = value.onChange(function (latestValue) {
latestValues[key] = latestValue;
props.onUpdate && es.update(update, false, true);
});
var removeOnRenderRequest = value.onRenderRequest(element.scheduleRender);
valueSubscriptions.set(key, function () {
removeOnChange();
removeOnRenderRequest();
});
}
/**
* Any motion values that are provided to the element when created
* aren't yet bound to the element, as this would technically be impure.
* However, we iterate through the motion values and set them to the
* initial values for this component.
*
* TODO: This is impure and we should look at changing this to run on mount.
* Doing so will break some tests but this isn't neccessarily a breaking change,
* more a reflection of the test.
*/
var initialMotionValues = scrapeMotionValuesFromProps(props);
for (var key in initialMotionValues) {
var value = initialMotionValues[key];
if (latestValues[key] !== undefined && isMotionValue(value)) {
value.set(latestValues[key], false);
}
}
/**
* Determine what role this visual element should take in the variant tree.
*/
var isControllingVariants = checkIfControllingVariants(props);
var isVariantNode = checkIfVariantNode(props);
var element = __assign(__assign({ treeType: treeType,
/**
* This is a mirror of the internal instance prop, which keeps
* VisualElement type-compatible with React's RefObject.
*/
current: null,
/**
* The depth of this visual element within the visual element tree.
*/
depth: parent ? parent.depth + 1 : 0, parent: parent, children: new Set(),
/**
* An ancestor path back to the root visual element. This is used
* by layout projection to quickly recurse back up the tree.
*/
path: parent ? __spreadArray(__spreadArray([], __read(parent.path)), [parent]) : [], layoutTree: parent ? parent.layoutTree : new flat_tree_FlatTree(),
/**
*
*/
presenceId: presenceId,
projection: projection,
/**
* If this component is part of the variant tree, it should track
* any children that are also part of the tree. This is essentially
* a shadow tree to simplify logic around how to stagger over children.
*/
variantChildren: isVariantNode ? new Set() : undefined,
/**
* Whether this instance is visible. This can be changed imperatively
* by AnimateSharedLayout, is analogous to CSS's visibility in that
* hidden elements should take up layout, and needs enacting by the configured
* render function.
*/
isVisible: undefined,
/**
* Normally, if a component is controlled by a parent's variants, it can
* rely on that ancestor to trigger animations further down the tree.
* However, if a component is created after its parent is mounted, the parent
* won't trigger that mount animation so the child needs to.
*
* TODO: This might be better replaced with a method isParentMounted
*/
manuallyAnimateOnMount: Boolean(parent === null || parent === void 0 ? void 0 : parent.isMounted()),
/**
* This can be set by AnimatePresence to force components that mount
* at the same time as it to mount as if they have initial={false} set.
*/
blockInitialAnimation: blockInitialAnimation,
/**
* Determine whether this component has mounted yet. This is mostly used
* by variant children to determine whether they need to trigger their
* own animations on mount.
*/
isMounted: function () { return Boolean(instance); }, mount: function (newInstance) {
instance = element.current = newInstance;
element.pointTo(element);
if (isVariantNode && parent && !isControllingVariants) {
removeFromVariantTree = parent === null || parent === void 0 ? void 0 : parent.addVariantChild(element);
}
parent === null || parent === void 0 ? void 0 : parent.children.add(element);
},
/**
*
*/
unmount: function () {
cancelSync.update(update);
cancelSync.render(render);
cancelSync.preRender(element.updateLayoutProjection);
valueSubscriptions.forEach(function (remove) { return remove(); });
element.stopLayoutAnimation();
element.layoutTree.remove(element);
removeFromVariantTree === null || removeFromVariantTree === void 0 ? void 0 : removeFromVariantTree();
parent === null || parent === void 0 ? void 0 : parent.children.delete(element);
unsubscribeFromLeadVisualElement === null || unsubscribeFromLeadVisualElement === void 0 ? void 0 : unsubscribeFromLeadVisualElement();
lifecycles.clearAllListeners();
},
/**
* Add a child visual element to our set of children.
*/
addVariantChild: function (child) {
var _a;
var closestVariantNode = element.getClosestVariantNode();
if (closestVariantNode) {
(_a = closestVariantNode.variantChildren) === null || _a === void 0 ? void 0 : _a.add(child);
return function () { return closestVariantNode.variantChildren.delete(child); };
}
},
sortNodePosition: function (other) {
/**
* If these nodes aren't even of the same type we can't compare their depth.
*/
if (!sortNodePosition || treeType !== other.treeType)
return 0;
return sortNodePosition(element.getInstance(), other.getInstance());
},
/**
* Returns the closest variant node in the tree starting from
* this visual element.
*/
getClosestVariantNode: function () {
return isVariantNode ? element : parent === null || parent === void 0 ? void 0 : parent.getClosestVariantNode();
},
/**
* A method that schedules an update to layout projections throughout
* the tree. We inherit from the parent so there's only ever one
* job scheduled on the next frame - that of the root visual element.
*/
scheduleUpdateLayoutProjection: parent
? parent.scheduleUpdateLayoutProjection
: function () {
return es.preRender(element.updateTreeLayoutProjection, false, true);
},
/**
* Expose the latest layoutId prop.
*/
getLayoutId: function () { return props.layoutId; },
/**
* Returns the current instance.
*/
getInstance: function () { return instance; },
/**
* Get/set the latest static values.
*/
getStaticValue: function (key) { return latestValues[key]; }, setStaticValue: function (key, value) { return (latestValues[key] = value); },
/**
* Returns the latest motion value state. Currently only used to take
* a snapshot of the visual element - perhaps this can return the whole
* visual state
*/
getLatestValues: function () { return latestValues; },
/**
* Set the visiblity of the visual element. If it's changed, schedule
* a render to reflect these changes.
*/
setVisibility: function (visibility) {
if (element.isVisible === visibility)
return;
element.isVisible = visibility;
element.scheduleRender();
},
/**
* Make a target animatable by Popmotion. For instance, if we're
* trying to animate width from 100px to 100vw we need to measure 100vw
* in pixels to determine what we really need to animate to. This is also
* pluggable to support Framer's custom value types like Color,
* and CSS variables.
*/
makeTargetAnimatable: function (target, canMutate) {
if (canMutate === void 0) { canMutate = true; }
return makeTargetAnimatable(element, target, props, canMutate);
},
// Motion values ========================
/**
* Add a motion value and bind it to this visual element.
*/
addValue: function (key, value) {
// Remove existing value if it exists
if (element.hasValue(key))
element.removeValue(key);
values.set(key, value);
latestValues[key] = value.get();
bindToMotionValue(key, value);
},
/**
* Remove a motion value and unbind any active subscriptions.
*/
removeValue: function (key) {
var _a;
values.delete(key);
(_a = valueSubscriptions.get(key)) === null || _a === void 0 ? void 0 : _a();
valueSubscriptions.delete(key);
delete latestValues[key];
removeValueFromRenderState(key, renderState);
},
/**
* Check whether we have a motion value for this key
*/
hasValue: function (key) { return values.has(key); },
/**
* Get a motion value for this key. If called with a default
* value, we'll create one if none exists.
*/
getValue: function (key, defaultValue) {
var value = values.get(key);
if (value === undefined && defaultValue !== undefined) {
value = motionValue(defaultValue);
element.addValue(key, value);
}
return value;
},
/**
* Iterate over our motion values.
*/
forEachValue: function (callback) { return values.forEach(callback); },
/**
* If we're trying to animate to a previously unencountered value,
* we need to check for it in our state and as a last resort read it
* directly from the instance (which might have performance implications).
*/
readValue: function (key) { var _a; return (_a = latestValues[key]) !== null && _a !== void 0 ? _a : readValueFromInstance(instance, key, options); },
/**
* Set the base target to later animate back to. This is currently
* only hydrated on creation and when we first read a value.
*/
setBaseTarget: function (key, value) {
baseTarget[key] = value;
},
/**
* Find the base target for a value thats been removed from all animation
* props.
*/
getBaseTarget: function (key) {
if (getBaseTarget) {
var target = getBaseTarget(props, key);
if (target !== undefined && !isMotionValue(target))
return target;
}
return baseTarget[key];
} }, lifecycles), {
/**
* Build the renderer state based on the latest visual state.
*/
build: function () {
triggerBuild();
return renderState;
},
/**
* Schedule a render on the next animation frame.
*/
scheduleRender: function () {
es.render(render, false, true);
},
/**
* Synchronously fire render. It's prefered that we batch renders but
* in many circumstances, like layout measurement, we need to run this
* synchronously. However in those instances other measures should be taken
* to batch reads/writes.
*/
syncRender: render,
/**
* Update the provided props. Ensure any newly-added motion values are
* added to our map, old ones removed, and listeners updated.
*/
setProps: function (newProps) {
props = newProps;
lifecycles.updatePropListeners(newProps);
prevMotionValues = updateMotionValuesFromProps(element, scrapeMotionValuesFromProps(props), prevMotionValues);
}, getProps: function () { return props; },
// Variants ==============================
/**
* Returns the variant definition with a given name.
*/
getVariant: function (name) { var _a; return (_a = props.variants) === null || _a === void 0 ? void 0 : _a[name]; },
/**
* Returns the defined default transition on this component.
*/
getDefaultTransition: function () { return props.transition; },
/**
* Used by child variant nodes to get the closest ancestor variant props.
*/
getVariantContext: function (startAtParent) {
if (startAtParent === void 0) { startAtParent = false; }
if (startAtParent)
return parent === null || parent === void 0 ? void 0 : parent.getVariantContext();
if (!isControllingVariants) {
var context_1 = (parent === null || parent === void 0 ? void 0 : parent.getVariantContext()) || {};
if (props.initial !== undefined) {
context_1.initial = props.initial;
}
return context_1;
}
var context = {};
for (var i = 0; i < numVariantProps; i++) {
var name_1 = variantProps[i];
var prop = props[name_1];
if (isVariantLabel(prop) || prop === false) {
context[name_1] = prop;
}
}
return context;
},
// Layout projection ==============================
/**
* Enable layout projection for this visual element. Won't actually
* occur until we also have hydrated layout measurements.
*/
enableLayoutProjection: function () {
projection.isEnabled = true;
element.layoutTree.add(element);
},
/**
* Lock the projection target, for instance when dragging, so
* nothing else can try and animate it.
*/
lockProjectionTarget: function () {
projection.isTargetLocked = true;
},
unlockProjectionTarget: function () {
element.stopLayoutAnimation();
projection.isTargetLocked = false;
}, getLayoutState: function () { return layoutState; }, setCrossfader: function (newCrossfader) {
crossfader = newCrossfader;
}, isProjectionReady: function () {
return projection.isEnabled &&
projection.isHydrated &&
layoutState.isHydrated;
},
/**
* Start a layout animation on a given axis.
*/
startLayoutAnimation: function (axis, transition, isRelative) {
if (isRelative === void 0) { isRelative = false; }
var progress = element.getProjectionAnimationProgress()[axis];
var _a = isRelative
? projection.relativeTarget[axis]
: projection.target[axis], min = _a.min, max = _a.max;
var length = max - min;
progress.clearListeners();
progress.set(min);
progress.set(min); // Set twice to hard-reset velocity
progress.onChange(function (v) {
element.setProjectionTargetAxis(axis, v, v + length, isRelative);
});
return element.animateMotionValue(axis, progress, 0, transition);
},
/**
* Stop layout animations.
*/
stopLayoutAnimation: function () {
eachAxis(function (axis) {
return element.getProjectionAnimationProgress()[axis].stop();
});
},
/**
* Measure the current viewport box with or without transforms.
* Only measures axis-aligned boxes, rotate and skew must be manually
* removed with a re-render to work.
*/
measureViewportBox: function (withTransform) {
if (withTransform === void 0) { withTransform = true; }
var viewportBox = measureViewportBox(instance, options);
if (!withTransform)
removeBoxTransforms(viewportBox, latestValues);
return viewportBox;
},
/**
* Get the motion values tracking the layout animations on each
* axis. Lazy init if not already created.
*/
getProjectionAnimationProgress: function () {
projectionTargetProgress || (projectionTargetProgress = {
x: motionValue(0),
y: motionValue(0),
});
return projectionTargetProgress;
},
/**
* Update the projection of a single axis. Schedule an update to
* the tree layout projection.
*/
setProjectionTargetAxis: function (axis, min, max, isRelative) {
if (isRelative === void 0) { isRelative = false; }
var target;
if (isRelative) {
if (!projection.relativeTarget) {
projection.relativeTarget = axisBox();
}
target = projection.relativeTarget[axis];
}
else {
projection.relativeTarget = undefined;
target = projection.target[axis];
}
projection.isHydrated = true;
target.min = min;
target.max = max;
// Flag that we want to fire the onViewportBoxUpdate event handler
hasViewportBoxUpdated = true;
lifecycles.notifySetAxisTarget();
},
/**
* Rebase the projection target on top of the provided viewport box
* or the measured layout. This ensures that non-animating elements
* don't fall out of sync differences in measurements vs projections
* after a page scroll or other relayout.
*/
rebaseProjectionTarget: function (force, box) {
if (box === void 0) { box = layoutState.layout; }
var _a = element.getProjectionAnimationProgress(), x = _a.x, y = _a.y;
var shouldRebase = !projection.relativeTarget &&
!projection.isTargetLocked &&
!x.isAnimating() &&
!y.isAnimating();
if (force || shouldRebase) {
eachAxis(function (axis) {
var _a = box[axis], min = _a.min, max = _a.max;
element.setProjectionTargetAxis(axis, min, max);
});
}
},
/**
* Notify the visual element that its layout is up-to-date.
* Currently Animate.tsx uses this to check whether a layout animation
* needs to be performed.
*/
notifyLayoutReady: function (config) {
setCurrentViewportBox(element);
element.notifyLayoutUpdate(layoutState.layout, element.prevViewportBox || layoutState.layout, config);
},
/**
* Temporarily reset the transform of the instance.
*/
resetTransform: function () { return resetTransform(element, instance, props); }, restoreTransform: function () { return restoreTransform(instance, renderState); }, updateLayoutProjection: updateLayoutProjection,
updateTreeLayoutProjection: function () {
element.layoutTree.forEach(fireResolveRelativeTargetBox);
/**
* Schedule the projection updates at the end of the current preRender
* step. This will ensure that all layout trees will first resolve
* relative projection boxes into viewport boxes, and *then*
* update projections.
*/
es.preRender(updateTreeLayoutProjection, false, true);
// sync.postRender(() => element.scheduleUpdateLayoutProjection())
},
getProjectionParent: function () {
if (projectionParent === undefined) {
var foundParent = false;
// Search backwards through the tree path
for (var i = element.path.length - 1; i >= 0; i--) {
var ancestor = element.path[i];
if (ancestor.projection.isEnabled) {
foundParent = ancestor;
break;
}
}
projectionParent = foundParent;
}
return projectionParent;
},
resolveRelativeTargetBox: function () {
var relativeParent = element.getProjectionParent();
if (!projection.relativeTarget || !relativeParent)
return;
calcRelativeBox(projection, relativeParent.projection);
if (isDraggable(relativeParent)) {
var target = projection.target;
applyBoxTransforms(target, target, relativeParent.getLatestValues());
}
},
shouldResetTransform: function () {
return Boolean(props._layoutResetTransform);
},
/**
*
*/
pointTo: function (newLead) {
leadProjection = newLead.projection;
leadLatestValues = newLead.getLatestValues();
/**
* Subscribe to lead component's layout animations
*/
unsubscribeFromLeadVisualElement === null || unsubscribeFromLeadVisualElement === void 0 ? void 0 : unsubscribeFromLeadVisualElement();
unsubscribeFromLeadVisualElement = pipe(newLead.onSetAxisTarget(element.scheduleUpdateLayoutProjection), newLead.onLayoutAnimationComplete(function () {
var _a;
if (element.isPresent) {
element.presence = Presence.Present;
}
else {
(_a = element.layoutSafeToRemove) === null || _a === void 0 ? void 0 : _a.call(element);
}
}));
},
// TODO: Clean this up
isPresent: true, presence: Presence.Entering });
return element;
};
};
function fireResolveRelativeTargetBox(child) {
child.resolveRelativeTargetBox();
}
function fireUpdateLayoutProjection(child) {
child.updateLayoutProjection();
}
var variantProps = __spreadArray(["initial"], __read(variantPriorityOrder));
var numVariantProps = variantProps.length;
// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/dom/utils/unit-conversion.js
var positionalKeys = new Set([
"width",
"height",
"top",
"left",
"right",
"bottom",
"x",
"y",
]);
var isPositionalKey = function (key) { return positionalKeys.has(key); };
var hasPositionalKey = function (target) {
return Object.keys(target).some(isPositionalKey);
};
var setAndResetVelocity = function (value, to) {
// Looks odd but setting it twice doesn't render, it'll just
// set both prev and current to the latest value
value.set(to, false);
value.set(to);
};
var isNumOrPxType = function (v) {
return v === numbers_number || v === px;
};
var BoundingBoxDimension;
(function (BoundingBoxDimension) {
BoundingBoxDimension["width"] = "width";
BoundingBoxDimension["height"] = "height";
BoundingBoxDimension["left"] = "left";
BoundingBoxDimension["right"] = "right";
BoundingBoxDimension["top"] = "top";
BoundingBoxDimension["bottom"] = "bottom";
})(BoundingBoxDimension || (BoundingBoxDimension = {}));
var getPosFromMatrix = function (matrix, pos) {
return parseFloat(matrix.split(", ")[pos]);
};
var getTranslateFromMatrix = function (pos2, pos3) { return function (_bbox, _a) {
var transform = _a.transform;
if (transform === "none" || !transform)
return 0;
var matrix3d = transform.match(/^matrix3d\((.+)\)$/);
if (matrix3d) {
return getPosFromMatrix(matrix3d[1], pos3);
}
else {
var matrix = transform.match(/^matrix\((.+)\)$/);
if (matrix) {
return getPosFromMatrix(matrix[1], pos2);
}
else {
return 0;
}
}
}; };
var unit_conversion_transformKeys = new Set(["x", "y", "z"]);
var nonTranslationalTransformKeys = transformProps.filter(function (key) { return !unit_conversion_transformKeys.has(key); });
function removeNonTranslationalTransform(visualElement) {
var removedTransforms = [];
nonTranslationalTransformKeys.forEach(function (key) {
var value = visualElement.getValue(key);
if (value !== undefined) {
removedTransforms.push([key, value.get()]);
value.set(key.startsWith("scale") ? 1 : 0);
}
});
// Apply changes to element before measurement
if (removedTransforms.length)
visualElement.syncRender();
return removedTransforms;
}
var positionalValues = {
// Dimensions
width: function (_a) {
var x = _a.x;
return x.max - x.min;
},
height: function (_a) {
var y = _a.y;
return y.max - y.min;
},
top: function (_bbox, _a) {
var top = _a.top;
return parseFloat(top);
},
left: function (_bbox, _a) {
var left = _a.left;
return parseFloat(left);
},
bottom: function (_a, _b) {
var y = _a.y;
var top = _b.top;
return parseFloat(top) + (y.max - y.min);
},
right: function (_a, _b) {
var x = _a.x;
var left = _b.left;
return parseFloat(left) + (x.max - x.min);
},
// Transform
x: getTranslateFromMatrix(4, 13),
y: getTranslateFromMatrix(5, 14),
};
var convertChangedValueTypes = function (target, visualElement, changedKeys) {
var originBbox = visualElement.measureViewportBox();
var element = visualElement.getInstance();
var elementComputedStyle = getComputedStyle(element);
var display = elementComputedStyle.display, top = elementComputedStyle.top, left = elementComputedStyle.left, bottom = elementComputedStyle.bottom, right = elementComputedStyle.right, transform = elementComputedStyle.transform;
var originComputedStyle = { top: top, left: left, bottom: bottom, right: right, transform: transform };
// If the element is currently set to display: "none", make it visible before
// measuring the target bounding box
if (display === "none") {
visualElement.setStaticValue("display", target.display || "block");
}
// Apply the latest values (as set in checkAndConvertChangedValueTypes)
visualElement.syncRender();
var targetBbox = visualElement.measureViewportBox();
changedKeys.forEach(function (key) {
// Restore styles to their **calculated computed style**, not their actual
// originally set style. This allows us to animate between equivalent pixel units.
var value = visualElement.getValue(key);
setAndResetVelocity(value, positionalValues[key](originBbox, originComputedStyle));
target[key] = positionalValues[key](targetBbox, elementComputedStyle);
});
return target;
};
var checkAndConvertChangedValueTypes = function (visualElement, target, origin, transitionEnd) {
if (origin === void 0) { origin = {}; }
if (transitionEnd === void 0) { transitionEnd = {}; }
target = __assign({}, target);
transitionEnd = __assign({}, transitionEnd);
var targetPositionalKeys = Object.keys(target).filter(isPositionalKey);
// We want to remove any transform values that could affect the element's bounding box before
// it's measured. We'll reapply these later.
var removedTransformValues = [];
var hasAttemptedToRemoveTransformValues = false;
var changedValueTypeKeys = [];
targetPositionalKeys.forEach(function (key) {
var value = visualElement.getValue(key);
if (!visualElement.hasValue(key))
return;
var from = origin[key];
var to = target[key];
var fromType = findDimensionValueType(from);
var toType;
// TODO: The current implementation of this basically throws an error
// if you try and do value conversion via keyframes. There's probably
// a way of doing this but the performance implications would need greater scrutiny,
// as it'd be doing multiple resize-remeasure operations.
if (isKeyframesTarget(to)) {
var numKeyframes = to.length;
for (var i = to[0] === null ? 1 : 0; i < numKeyframes; i++) {
if (!toType) {
toType = findDimensionValueType(to[i]);
invariant(toType === fromType ||
(isNumOrPxType(fromType) && isNumOrPxType(toType)), "Keyframes must be of the same dimension as the current value");
}
else {
invariant(findDimensionValueType(to[i]) === toType, "All keyframes must be of the same type");
}
}
}
else {
toType = findDimensionValueType(to);
}
if (fromType !== toType) {
// If they're both just number or px, convert them both to numbers rather than
// relying on resize/remeasure to convert (which is wasteful in this situation)
if (isNumOrPxType(fromType) && isNumOrPxType(toType)) {
var current = value.get();
if (typeof current === "string") {
value.set(parseFloat(current));
}
if (typeof to === "string") {
target[key] = parseFloat(to);
}
else if (Array.isArray(to) && toType === px) {
target[key] = to.map(parseFloat);
}
}
else if ((fromType === null || fromType === void 0 ? void 0 : fromType.transform) &&
(toType === null || toType === void 0 ? void 0 : toType.transform) &&
(from === 0 || to === 0)) {
// If one or the other value is 0, it's safe to coerce it to the
// type of the other without measurement
if (from === 0) {
value.set(toType.transform(from));
}
else {
target[key] = fromType.transform(to);
}
}
else {
// If we're going to do value conversion via DOM measurements, we first
// need to remove non-positional transform values that could affect the bbox measurements.
if (!hasAttemptedToRemoveTransformValues) {
removedTransformValues = removeNonTranslationalTransform(visualElement);
hasAttemptedToRemoveTransformValues = true;
}
changedValueTypeKeys.push(key);
transitionEnd[key] =
transitionEnd[key] !== undefined
? transitionEnd[key]
: target[key];
setAndResetVelocity(value, to);
}
}
});
if (changedValueTypeKeys.length) {
var convertedTarget = convertChangedValueTypes(target, visualElement, changedValueTypeKeys);
// If we removed transform values, reapply them before the next render
if (removedTransformValues.length) {
removedTransformValues.forEach(function (_a) {
var _b = __read(_a, 2), key = _b[0], value = _b[1];
visualElement.getValue(key).set(value);
});
}
// Reapply original values
visualElement.syncRender();
return { target: convertedTarget, transitionEnd: transitionEnd };
}
else {
return { target: target, transitionEnd: transitionEnd };
}
};
/**
* Convert value types for x/y/width/height/top/left/bottom/right
*
* Allows animation between `'auto'` -> `'100%'` or `0` -> `'calc(50% - 10vw)'`
*
* @internal
*/
function unitConversion(visualElement, target, origin, transitionEnd) {
return hasPositionalKey(target)
? checkAndConvertChangedValueTypes(visualElement, target, origin, transitionEnd)
: { target: target, transitionEnd: transitionEnd };
}
// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/dom/utils/parse-dom-variant.js
/**
* Parse a DOM variant to make it animatable. This involves resolving CSS variables
* and ensuring animations like "20%" => "calc(50vw)" are performed in pixels.
*/
var parseDomVariant = function (visualElement, target, origin, transitionEnd) {
var resolved = resolveCSSVariables(visualElement, target, transitionEnd);
target = resolved.target;
transitionEnd = resolved.transitionEnd;
return unitConversion(visualElement, target, origin, transitionEnd);
};
// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/html/visual-element.js
function visual_element_getComputedStyle(element) {
return window.getComputedStyle(element);
}
var htmlConfig = {
treeType: "dom",
readValueFromInstance: function (domElement, key) {
if (isTransformProp(key)) {
var defaultType = getDefaultValueType(key);
return defaultType ? defaultType.default || 0 : 0;
}
else {
var computedStyle = visual_element_getComputedStyle(domElement);
return ((isCSSVariable(key)
? computedStyle.getPropertyValue(key)
: computedStyle[key]) || 0);
}
},
sortNodePosition: function (a, b) {
/**
* compareDocumentPosition returns a bitmask, by using the bitwise &
* we're returning true if 2 in that bitmask is set to true. 2 is set
* to true if b preceeds a.
*/
return a.compareDocumentPosition(b) & 2 ? 1 : -1;
},
getBaseTarget: function (props, key) {
var _a;
return (_a = props.style) === null || _a === void 0 ? void 0 : _a[key];
},
measureViewportBox: function (element, _a) {
var transformPagePoint = _a.transformPagePoint;
return getBoundingBox(element, transformPagePoint);
},
/**
* Reset the transform on the current Element. This is called as part
* of a batched process across the entire layout tree. To remove this write
* cycle it'd be interesting to see if it's possible to "undo" all the current
* layout transforms up the tree in the same way this.getBoundingBoxWithoutTransforms
* works
*/
resetTransform: function (element, domElement, props) {
var transformTemplate = props.transformTemplate;
domElement.style.transform = transformTemplate
? transformTemplate({}, "")
: "none";
// Ensure that whatever happens next, we restore our transform on the next frame
element.scheduleRender();
},
restoreTransform: function (instance, mutableState) {
instance.style.transform = mutableState.style.transform;
},
removeValueFromRenderState: function (key, _a) {
var vars = _a.vars, style = _a.style;
delete vars[key];
delete style[key];
},
/**
* Ensure that HTML and Framer-specific value types like `px`->`%` and `Color`
* can be animated by Motion.
*/
makeTargetAnimatable: function (element, _a, _b, isMounted) {
var transformValues = _b.transformValues;
if (isMounted === void 0) { isMounted = true; }
var transition = _a.transition, transitionEnd = _a.transitionEnd, target = __rest(_a, ["transition", "transitionEnd"]);
var origin = getOrigin(target, transition || {}, element);
/**
* If Framer has provided a function to convert `Color` etc value types, convert them
*/
if (transformValues) {
if (transitionEnd)
transitionEnd = transformValues(transitionEnd);
if (target)
target = transformValues(target);
if (origin)
origin = transformValues(origin);
}
if (isMounted) {
checkTargetForNewValues(element, target, origin);
var parsed = parseDomVariant(element, target, origin, transitionEnd);
transitionEnd = parsed.transitionEnd;
target = parsed.target;
}
return __assign({ transition: transition,
transitionEnd: transitionEnd }, target);
},
scrapeMotionValuesFromProps: scrape_motion_values_scrapeMotionValuesFromProps,
build: function (element, renderState, latestValues, projection, layoutState, options, props) {
if (element.isVisible !== undefined) {
renderState.style.visibility = element.isVisible
? "visible"
: "hidden";
}
var isProjectionTranform = projection.isEnabled && layoutState.isHydrated;
buildHTMLStyles(renderState, latestValues, projection, layoutState, options, props.transformTemplate, isProjectionTranform ? buildLayoutProjectionTransform : undefined, isProjectionTranform
? buildLayoutProjectionTransformOrigin
: undefined);
},
render: renderHTML,
};
var htmlVisualElement = render_visualElement(htmlConfig);
// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/svg/visual-element.js
var svgVisualElement = render_visualElement(__assign(__assign({}, htmlConfig), { getBaseTarget: function (props, key) {
return props[key];
},
readValueFromInstance: function (domElement, key) {
var _a;
if (isTransformProp(key)) {
return ((_a = getDefaultValueType(key)) === null || _a === void 0 ? void 0 : _a.default) || 0;
}
key = !camelCaseAttributes.has(key) ? camelToDash(key) : key;
return domElement.getAttribute(key);
},
scrapeMotionValuesFromProps: utils_scrape_motion_values_scrapeMotionValuesFromProps,
build: function (_element, renderState, latestValues, projection, layoutState, options, props) {
var isProjectionTranform = projection.isEnabled && layoutState.isHydrated;
buildSVGAttrs(renderState, latestValues, projection, layoutState, options, props.transformTemplate, isProjectionTranform ? buildLayoutProjectionTransform : undefined, isProjectionTranform
? buildLayoutProjectionTransformOrigin
: undefined);
}, render: renderSVG }));
// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/dom/create-visual-element.js
var createDomVisualElement = function (Component, options) {
return isSVGComponent(Component)
? svgVisualElement(options, { enableHardwareAcceleration: false })
: htmlVisualElement(options, { enableHardwareAcceleration: true });
};
// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/dom/motion.js
var featureBundle = __assign(__assign(__assign(__assign({}, animations_animations), gestureAnimations), drag_drag), layoutAnimations);
/**
* HTML & SVG components, optimised for use with gestures and animation. These can be used as
* drop-in replacements for any HTML & SVG component, all CSS & SVG properties are supported.
*
* @public
*/
var motion = /*@__PURE__*/ createMotionProxy(function (Component, config) {
return createDomMotionConfig(Component, config, featureBundle, createDomVisualElement);
});
/**
* Create a DOM `motion` component with the provided string. This is primarily intended
* as a full alternative to `motion` for consumers who have to support environments that don't
* support `Proxy`.
*
* ```javascript
* import { createDomMotionComponent } from "framer-motion"
*
* const motion = {
* div: createDomMotionComponent('div')
* }
* ```
*
* @public
*/
function createDomMotionComponent(key) {
return createMotionComponent(createDomMotionConfig(key, { forwardMotionProps: false }, featureBundle, createDomVisualElement));
}
// EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/arrow-left.js
var arrow_left = __webpack_require__("cjQ8");
// EXTERNAL MODULE: external ["wp","a11y"]
var external_wp_a11y_ = __webpack_require__("gdqT");
// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/visual-editor/block-inspector-button.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function BlockInspectorButton({
onClick = external_lodash_["noop"],
small = false
}) {
const {
shortcut,
areAdvancedSettingsOpened
} = Object(external_wp_data_["useSelect"])(select => ({
shortcut: select(external_wp_keyboardShortcuts_["store"]).getShortcutRepresentation('core/edit-post/toggle-sidebar'),
areAdvancedSettingsOpened: select(store["a" /* store */]).getActiveGeneralSidebarName() === 'edit-post/block'
}), []);
const {
openGeneralSidebar,
closeGeneralSidebar
} = Object(external_wp_data_["useDispatch"])(store["a" /* store */]);
const speakMessage = () => {
if (areAdvancedSettingsOpened) {
Object(external_wp_a11y_["speak"])(Object(external_wp_i18n_["__"])('Block settings closed'));
} else {
Object(external_wp_a11y_["speak"])(Object(external_wp_i18n_["__"])('Additional settings are now available in the Editor block settings sidebar'));
}
};
const label = areAdvancedSettingsOpened ? Object(external_wp_i18n_["__"])('Hide more settings') : Object(external_wp_i18n_["__"])('Show more settings');
return Object(external_wp_element_["createElement"])(external_wp_components_["MenuItem"], {
onClick: () => {
if (areAdvancedSettingsOpened) {
closeGeneralSidebar();
} else {
openGeneralSidebar('edit-post/block');
speakMessage();
onClick();
}
},
shortcut: shortcut
}, !small && label);
}
/* harmony default export */ var block_inspector_button = (BlockInspectorButton);
// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/visual-editor/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function MaybeIframe({
children,
contentRef,
isTemplateMode,
styles,
style
}) {
const ref = Object(external_wp_blockEditor_["__unstableUseMouseMoveTypingReset"])();
if (!isTemplateMode) {
return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(external_wp_blockEditor_["__unstableEditorStyles"], {
styles: styles
}), Object(external_wp_element_["createElement"])("div", {
ref: contentRef,
className: "editor-styles-wrapper",
style: {
flex: '1',
...style
}
}, children));
}
return Object(external_wp_element_["createElement"])(external_wp_blockEditor_["__unstableIframe"], {
head: Object(external_wp_element_["createElement"])(external_wp_blockEditor_["__unstableEditorStyles"], {
styles: styles
}),
ref: ref,
contentRef: contentRef,
style: {
width: '100%',
height: '100%',
display: 'block'
}
}, children);
}
function VisualEditor({
styles
}) {
const {
deviceType,
isTemplateMode,
wrapperBlockName,
wrapperUniqueId
} = Object(external_wp_data_["useSelect"])(select => {
const {
isEditingTemplate,
__experimentalGetPreviewDeviceType
} = select(store["a" /* store */]);
const {
getCurrentPostId,
getCurrentPostType
} = select(external_wp_editor_["store"]);
const _isTemplateMode = isEditingTemplate();
let _wrapperBlockName;
if (getCurrentPostType() === 'wp_block') {
_wrapperBlockName = 'core/block';
} else if (!_isTemplateMode) {
_wrapperBlockName = 'core/post-content';
}
return {
deviceType: __experimentalGetPreviewDeviceType(),
isTemplateMode: _isTemplateMode,
wrapperBlockName: _wrapperBlockName,
wrapperUniqueId: getCurrentPostId()
};
}, []);
const hasMetaBoxes = Object(external_wp_data_["useSelect"])(select => select(store["a" /* store */]).hasMetaBoxes(), []);
const themeSupportsLayout = Object(external_wp_data_["useSelect"])(select => {
const {
getSettings
} = select(external_wp_blockEditor_["store"]);
return getSettings().supportsLayout;
}, []);
const {
clearSelectedBlock
} = Object(external_wp_data_["useDispatch"])(external_wp_blockEditor_["store"]);
const {
setIsEditingTemplate
} = Object(external_wp_data_["useDispatch"])(store["a" /* store */]);
const desktopCanvasStyles = {
height: '100%',
width: '100%',
margin: 0,
display: 'flex',
flexFlow: 'column',
// Default background color so that grey
// .edit-post-editor-regions__content color doesn't show through.
background: 'white'
};
const templateModeStyles = { ...desktopCanvasStyles,
borderRadius: '2px 2px 0 0',
border: '1px solid #ddd',
borderBottom: 0
};
const resizedCanvasStyles = Object(external_wp_blockEditor_["__experimentalUseResizeCanvas"])(deviceType, isTemplateMode);
const defaultLayout = Object(external_wp_blockEditor_["useSetting"])('layout');
const {
contentSize,
wideSize
} = defaultLayout || {};
let animatedStyles = isTemplateMode ? templateModeStyles : desktopCanvasStyles;
if (resizedCanvasStyles) {
animatedStyles = resizedCanvasStyles;
}
let paddingBottom; // Add a constant padding for the typewritter effect. When typing at the
// bottom, there needs to be room to scroll up.
if (!hasMetaBoxes && !resizedCanvasStyles && !isTemplateMode) {
paddingBottom = '40vh';
}
const ref = Object(external_wp_element_["useRef"])();
const contentRef = Object(external_wp_compose_["useMergeRefs"])([ref, Object(external_wp_blockEditor_["__unstableUseClipboardHandler"])(), Object(external_wp_blockEditor_["__unstableUseCanvasClickRedirect"])(), Object(external_wp_blockEditor_["__unstableUseTypewriter"])(), Object(external_wp_blockEditor_["__unstableUseTypingObserver"])(), Object(external_wp_blockEditor_["__unstableUseBlockSelectionClearer"])()]);
const blockSelectionClearerRef = Object(external_wp_blockEditor_["__unstableUseBlockSelectionClearer"])();
const [, RecursionProvider] = Object(external_wp_blockEditor_["__experimentalUseNoRecursiveRenders"])(wrapperUniqueId, wrapperBlockName);
const layout = Object(external_wp_element_["useMemo"])(() => {
if (isTemplateMode) {
return {
type: 'default'
};
}
if (themeSupportsLayout) {
const alignments = contentSize || wideSize ? ['wide', 'full', 'left', 'center', 'right'] : ['left', 'center', 'right'];
return {
type: 'default',
// Find a way to inject this in the support flag code (hooks).
alignments
};
}
return undefined;
}, [isTemplateMode, themeSupportsLayout, contentSize, wideSize]);
return Object(external_wp_element_["createElement"])("div", {
className: classnames_default()('edit-post-visual-editor', {
'is-template-mode': isTemplateMode
})
}, Object(external_wp_element_["createElement"])(external_wp_editor_["VisualEditorGlobalKeyboardShortcuts"], null), Object(external_wp_element_["createElement"])(external_wp_blockEditor_["BlockTools"], {
__unstableContentRef: ref
}, Object(external_wp_element_["createElement"])(motion.div, {
className: "edit-post-visual-editor__content-area",
animate: {
padding: isTemplateMode ? '48px 48px 0' : '0'
},
ref: blockSelectionClearerRef
}, isTemplateMode && Object(external_wp_element_["createElement"])(external_wp_components_["Button"], {
className: "edit-post-visual-editor__exit-template-mode",
icon: arrow_left["a" /* default */],
onClick: () => {
clearSelectedBlock();
setIsEditingTemplate(false);
}
}, Object(external_wp_i18n_["__"])('Back')), Object(external_wp_element_["createElement"])(motion.div, {
animate: animatedStyles,
initial: desktopCanvasStyles
}, Object(external_wp_element_["createElement"])(MaybeIframe, {
isTemplateMode: isTemplateMode,
contentRef: contentRef,
styles: styles,
style: {
paddingBottom
}
}, themeSupportsLayout && !isTemplateMode && Object(external_wp_element_["createElement"])(external_wp_blockEditor_["__experimentalLayoutStyle"], {
selector: ".edit-post-visual-editor__post-title-wrapper, .block-editor-block-list__layout.is-root-container",
layout: defaultLayout
}), Object(external_wp_element_["createElement"])(external_wp_blockEditor_["WritingFlow"], null, !isTemplateMode && Object(external_wp_element_["createElement"])("div", {
className: "edit-post-visual-editor__post-title-wrapper"
}, Object(external_wp_element_["createElement"])(external_wp_editor_["PostTitle"], null)), Object(external_wp_element_["createElement"])(RecursionProvider, null, Object(external_wp_element_["createElement"])(external_wp_blockEditor_["BlockList"], {
__experimentalLayout: layout
}))))))), Object(external_wp_element_["createElement"])(external_wp_blockEditor_["__unstableBlockSettingsMenuFirstItem"], null, ({
onClose
}) => Object(external_wp_element_["createElement"])(block_inspector_button, {
onClick: onClose
})));
}
// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/keyboard-shortcuts/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function KeyboardShortcuts() {
const {
getBlockSelectionStart
} = Object(external_wp_data_["useSelect"])(external_wp_blockEditor_["store"]);
const {
getEditorMode,
isEditorSidebarOpened,
isListViewOpened
} = Object(external_wp_data_["useSelect"])(store["a" /* store */]);
const isModeToggleDisabled = Object(external_wp_data_["useSelect"])(select => {
const {
richEditingEnabled,
codeEditingEnabled
} = select(external_wp_editor_["store"]).getEditorSettings();
return !richEditingEnabled || !codeEditingEnabled;
}, []);
const {
switchEditorMode,
openGeneralSidebar,
closeGeneralSidebar,
toggleFeature,
setIsListViewOpened
} = Object(external_wp_data_["useDispatch"])(store["a" /* store */]);
const {
registerShortcut
} = Object(external_wp_data_["useDispatch"])(external_wp_keyboardShortcuts_["store"]);
Object(external_wp_element_["useEffect"])(() => {
registerShortcut({
name: 'core/edit-post/toggle-mode',
category: 'global',
description: Object(external_wp_i18n_["__"])('Switch between visual editor and code editor.'),
keyCombination: {
modifier: 'secondary',
character: 'm'
}
});
registerShortcut({
name: 'core/edit-post/toggle-fullscreen',
category: 'global',
description: Object(external_wp_i18n_["__"])('Toggle fullscreen mode.'),
keyCombination: {
modifier: 'secondary',
character: 'f'
}
});
registerShortcut({
name: 'core/edit-post/toggle-block-navigation',
category: 'global',
description: Object(external_wp_i18n_["__"])('Open the block list view.'),
keyCombination: {
modifier: 'access',
character: 'o'
}
});
registerShortcut({
name: 'core/edit-post/toggle-sidebar',
category: 'global',
description: Object(external_wp_i18n_["__"])('Show or hide the settings sidebar.'),
keyCombination: {
modifier: 'primaryShift',
character: ','
}
});
registerShortcut({
name: 'core/edit-post/next-region',
category: 'global',
description: Object(external_wp_i18n_["__"])('Navigate to the next part of the editor.'),
keyCombination: {
modifier: 'ctrl',
character: '`'
},
aliases: [{
modifier: 'access',
character: 'n'
}]
});
registerShortcut({
name: 'core/edit-post/previous-region',
category: 'global',
description: Object(external_wp_i18n_["__"])('Navigate to the previous part of the editor.'),
keyCombination: {
modifier: 'ctrlShift',
character: '`'
},
aliases: [{
modifier: 'access',
character: 'p'
}]
});
registerShortcut({
name: 'core/edit-post/keyboard-shortcuts',
category: 'main',
description: Object(external_wp_i18n_["__"])('Display these keyboard shortcuts.'),
keyCombination: {
modifier: 'access',
character: 'h'
}
});
}, []);
Object(external_wp_keyboardShortcuts_["useShortcut"])('core/edit-post/toggle-mode', () => {
switchEditorMode(getEditorMode() === 'visual' ? 'text' : 'visual');
}, {
bindGlobal: true,
isDisabled: isModeToggleDisabled
});
Object(external_wp_keyboardShortcuts_["useShortcut"])('core/edit-post/toggle-fullscreen', () => {
toggleFeature('fullscreenMode');
}, {
bindGlobal: true
});
Object(external_wp_keyboardShortcuts_["useShortcut"])('core/edit-post/toggle-sidebar', event => {
// This shortcut has no known clashes, but use preventDefault to prevent any
// obscure shortcuts from triggering.
event.preventDefault();
if (isEditorSidebarOpened()) {
closeGeneralSidebar();
} else {
const sidebarToOpen = getBlockSelectionStart() ? 'edit-post/block' : 'edit-post/document';
openGeneralSidebar(sidebarToOpen);
}
}, {
bindGlobal: true
});
Object(external_wp_keyboardShortcuts_["useShortcut"])('core/edit-post/toggle-block-navigation', () => setIsListViewOpened(!isListViewOpened()), {
bindGlobal: true
});
return null;
}
/* harmony default export */ var keyboard_shortcuts = (KeyboardShortcuts);
// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/keyboard-shortcut-help-modal/config.js
/**
* WordPress dependencies
*/
const textFormattingShortcuts = [{
keyCombination: {
modifier: 'primary',
character: 'b'
},
description: Object(external_wp_i18n_["__"])('Make the selected text bold.')
}, {
keyCombination: {
modifier: 'primary',
character: 'i'
},
description: Object(external_wp_i18n_["__"])('Make the selected text italic.')
}, {
keyCombination: {
modifier: 'primary',
character: 'k'
},
description: Object(external_wp_i18n_["__"])('Convert the selected text into a link.')
}, {
keyCombination: {
modifier: 'primaryShift',
character: 'k'
},
description: Object(external_wp_i18n_["__"])('Remove a link.')
}, {
keyCombination: {
modifier: 'primary',
character: 'u'
},
description: Object(external_wp_i18n_["__"])('Underline the selected text.')
}];
// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/keyboard-shortcut-help-modal/shortcut.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
function KeyCombination({
keyCombination,
forceAriaLabel
}) {
const shortcut = keyCombination.modifier ? external_wp_keycodes_["displayShortcutList"][keyCombination.modifier](keyCombination.character) : keyCombination.character;
const ariaLabel = keyCombination.modifier ? external_wp_keycodes_["shortcutAriaLabel"][keyCombination.modifier](keyCombination.character) : keyCombination.character;
return Object(external_wp_element_["createElement"])("kbd", {
className: "edit-post-keyboard-shortcut-help-modal__shortcut-key-combination",
"aria-label": forceAriaLabel || ariaLabel
}, Object(external_lodash_["castArray"])(shortcut).map((character, index) => {
if (character === '+') {
return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], {
key: index
}, character);
}
return Object(external_wp_element_["createElement"])("kbd", {
key: index,
className: "edit-post-keyboard-shortcut-help-modal__shortcut-key"
}, character);
}));
}
function Shortcut({
description,
keyCombination,
aliases = [],
ariaLabel
}) {
return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])("div", {
className: "edit-post-keyboard-shortcut-help-modal__shortcut-description"
}, description), Object(external_wp_element_["createElement"])("div", {
className: "edit-post-keyboard-shortcut-help-modal__shortcut-term"
}, Object(external_wp_element_["createElement"])(KeyCombination, {
keyCombination: keyCombination,
forceAriaLabel: ariaLabel
}), aliases.map((alias, index) => Object(external_wp_element_["createElement"])(KeyCombination, {
keyCombination: alias,
forceAriaLabel: ariaLabel,
key: index
}))));
}
/* harmony default export */ var keyboard_shortcut_help_modal_shortcut = (Shortcut);
// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function DynamicShortcut({
name
}) {
const {
keyCombination,
description,
aliases
} = Object(external_wp_data_["useSelect"])(select => {
const {
getShortcutKeyCombination,
getShortcutDescription,
getShortcutAliases
} = select(external_wp_keyboardShortcuts_["store"]);
return {
keyCombination: getShortcutKeyCombination(name),
aliases: getShortcutAliases(name),
description: getShortcutDescription(name)
};
});
if (!keyCombination) {
return null;
}
return Object(external_wp_element_["createElement"])(keyboard_shortcut_help_modal_shortcut, {
keyCombination: keyCombination,
description: description,
aliases: aliases
});
}
/* harmony default export */ var dynamic_shortcut = (DynamicShortcut);
// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/keyboard-shortcut-help-modal/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const MODAL_NAME = 'edit-post/keyboard-shortcut-help';
const ShortcutList = ({
shortcuts
}) =>
/*
* Disable reason: The `list` ARIA role is redundant but
* Safari+VoiceOver won't announce the list otherwise.
*/
/* eslint-disable jsx-a11y/no-redundant-roles */
Object(external_wp_element_["createElement"])("ul", {
className: "edit-post-keyboard-shortcut-help-modal__shortcut-list",
role: "list"
}, shortcuts.map((shortcut, index) => Object(external_wp_element_["createElement"])("li", {
className: "edit-post-keyboard-shortcut-help-modal__shortcut",
key: index
}, Object(external_lodash_["isString"])(shortcut) ? Object(external_wp_element_["createElement"])(dynamic_shortcut, {
name: shortcut
}) : Object(external_wp_element_["createElement"])(keyboard_shortcut_help_modal_shortcut, shortcut))))
/* eslint-enable jsx-a11y/no-redundant-roles */
;
const ShortcutSection = ({
title,
shortcuts,
className
}) => Object(external_wp_element_["createElement"])("section", {
className: classnames_default()('edit-post-keyboard-shortcut-help-modal__section', className)
}, !!title && Object(external_wp_element_["createElement"])("h2", {
className: "edit-post-keyboard-shortcut-help-modal__section-title"
}, title), Object(external_wp_element_["createElement"])(ShortcutList, {
shortcuts: shortcuts
}));
const ShortcutCategorySection = ({
title,
categoryName,
additionalShortcuts = []
}) => {
const categoryShortcuts = Object(external_wp_data_["useSelect"])(select => {
return select(external_wp_keyboardShortcuts_["store"]).getCategoryShortcuts(categoryName);
}, [categoryName]);
return Object(external_wp_element_["createElement"])(ShortcutSection, {
title: title,
shortcuts: categoryShortcuts.concat(additionalShortcuts)
});
};
function KeyboardShortcutHelpModal({
isModalActive,
toggleModal
}) {
Object(external_wp_keyboardShortcuts_["useShortcut"])('core/edit-post/keyboard-shortcuts', toggleModal, {
bindGlobal: true
});
if (!isModalActive) {
return null;
}
return Object(external_wp_element_["createElement"])(external_wp_components_["Modal"], {
className: "edit-post-keyboard-shortcut-help-modal",
title: Object(external_wp_i18n_["__"])('Keyboard shortcuts'),
closeLabel: Object(external_wp_i18n_["__"])('Close'),
onRequestClose: toggleModal
}, Object(external_wp_element_["createElement"])(ShortcutSection, {
className: "edit-post-keyboard-shortcut-help-modal__main-shortcuts",
shortcuts: ['core/edit-post/keyboard-shortcuts']
}), Object(external_wp_element_["createElement"])(ShortcutCategorySection, {
title: Object(external_wp_i18n_["__"])('Global shortcuts'),
categoryName: "global"
}), Object(external_wp_element_["createElement"])(ShortcutCategorySection, {
title: Object(external_wp_i18n_["__"])('Selection shortcuts'),
categoryName: "selection"
}), Object(external_wp_element_["createElement"])(ShortcutCategorySection, {
title: Object(external_wp_i18n_["__"])('Block shortcuts'),
categoryName: "block",
additionalShortcuts: [{
keyCombination: {
character: '/'
},
description: Object(external_wp_i18n_["__"])('Change the block type after adding a new paragraph.'),
/* translators: The forward-slash character. e.g. '/'. */
ariaLabel: Object(external_wp_i18n_["__"])('Forward-slash')
}]
}), Object(external_wp_element_["createElement"])(ShortcutSection, {
title: Object(external_wp_i18n_["__"])('Text formatting'),
shortcuts: textFormattingShortcuts
}));
}
/* harmony default export */ var keyboard_shortcut_help_modal = (Object(external_wp_compose_["compose"])([Object(external_wp_data_["withSelect"])(select => ({
isModalActive: select(store["a" /* store */]).isModalActive(MODAL_NAME)
})), Object(external_wp_data_["withDispatch"])((dispatch, {
isModalActive
}) => {
const {
openModal,
closeModal
} = dispatch(store["a" /* store */]);
return {
toggleModal: () => isModalActive ? closeModal() : openModal(MODAL_NAME)
};
})])(KeyboardShortcutHelpModal));
// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/manage-blocks-modal/checklist.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
function BlockTypesChecklist({
blockTypes,
value,
onItemChange
}) {
return Object(external_wp_element_["createElement"])("ul", {
className: "edit-post-manage-blocks-modal__checklist"
}, blockTypes.map(blockType => Object(external_wp_element_["createElement"])("li", {
key: blockType.name,
className: "edit-post-manage-blocks-modal__checklist-item"
}, Object(external_wp_element_["createElement"])(external_wp_components_["CheckboxControl"], {
label: Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, blockType.title, Object(external_wp_element_["createElement"])(external_wp_blockEditor_["BlockIcon"], {
icon: blockType.icon
})),
checked: value.includes(blockType.name),
onChange: Object(external_lodash_["partial"])(onItemChange, blockType.name)
}))));
}
/* harmony default export */ var checklist = (BlockTypesChecklist);
// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/edit-post-settings/index.js
/**
* WordPress dependencies
*/
const EditPostSettings = Object(external_wp_element_["createContext"])({});
/* harmony default export */ var edit_post_settings = (EditPostSettings);
// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/manage-blocks-modal/category.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function BlockManagerCategory({
instanceId,
title,
blockTypes,
hiddenBlockTypes,
toggleVisible,
toggleAllVisible
}) {
const settings = Object(external_wp_element_["useContext"])(edit_post_settings);
const {
allowedBlockTypes
} = settings;
const filteredBlockTypes = Object(external_wp_element_["useMemo"])(() => {
if (allowedBlockTypes === true) {
return blockTypes;
}
return blockTypes.filter(({
name
}) => {
return Object(external_lodash_["includes"])(allowedBlockTypes || [], name);
});
}, [allowedBlockTypes, blockTypes]);
if (!filteredBlockTypes.length) {
return null;
}
const checkedBlockNames = Object(external_lodash_["without"])(Object(external_lodash_["map"])(filteredBlockTypes, 'name'), ...hiddenBlockTypes);
const titleId = 'edit-post-manage-blocks-modal__category-title-' + instanceId;
const isAllChecked = checkedBlockNames.length === filteredBlockTypes.length;
let ariaChecked;
if (isAllChecked) {
ariaChecked = 'true';
} else if (checkedBlockNames.length > 0) {
ariaChecked = 'mixed';
} else {
ariaChecked = 'false';
}
return Object(external_wp_element_["createElement"])("div", {
role: "group",
"aria-labelledby": titleId,
className: "edit-post-manage-blocks-modal__category"
}, Object(external_wp_element_["createElement"])(external_wp_components_["CheckboxControl"], {
checked: isAllChecked,
onChange: toggleAllVisible,
className: "edit-post-manage-blocks-modal__category-title",
"aria-checked": ariaChecked,
label: Object(external_wp_element_["createElement"])("span", {
id: titleId
}, title)
}), Object(external_wp_element_["createElement"])(checklist, {
blockTypes: filteredBlockTypes,
value: checkedBlockNames,
onItemChange: toggleVisible
}));
}
/* harmony default export */ var manage_blocks_modal_category = (Object(external_wp_compose_["compose"])([external_wp_compose_["withInstanceId"], Object(external_wp_data_["withSelect"])(select => {
const {
getPreference
} = select(store["a" /* store */]);
return {
hiddenBlockTypes: getPreference('hiddenBlockTypes')
};
}), Object(external_wp_data_["withDispatch"])((dispatch, ownProps) => {
const {
showBlockTypes,
hideBlockTypes
} = dispatch(store["a" /* store */]);
return {
toggleVisible(blockName, nextIsChecked) {
if (nextIsChecked) {
showBlockTypes(blockName);
} else {
hideBlockTypes(blockName);
}
},
toggleAllVisible(nextIsChecked) {
const blockNames = Object(external_lodash_["map"])(ownProps.blockTypes, 'name');
if (nextIsChecked) {
showBlockTypes(blockNames);
} else {
hideBlockTypes(blockNames);
}
}
};
})])(BlockManagerCategory));
// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/manage-blocks-modal/manager.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function BlockManager({
search,
setState,
blockTypes,
categories,
hasBlockSupport,
isMatchingSearchTerm,
numberOfHiddenBlocks
}) {
// Filtering occurs here (as opposed to `withSelect`) to avoid
// wasted renders by consequence of `Array#filter` producing
// a new value reference on each call.
blockTypes = blockTypes.filter(blockType => hasBlockSupport(blockType, 'inserter', true) && (!search || isMatchingSearchTerm(blockType, search)) && (!blockType.parent || Object(external_lodash_["includes"])(blockType.parent, 'core/post-content')));
return Object(external_wp_element_["createElement"])("div", {
className: "edit-post-manage-blocks-modal__content"
}, Object(external_wp_element_["createElement"])(external_wp_components_["TextControl"], {
type: "search",
label: Object(external_wp_i18n_["__"])('Search for a block'),
value: search,
onChange: nextSearch => setState({
search: nextSearch
}),
className: "edit-post-manage-blocks-modal__search"
}), !!numberOfHiddenBlocks && Object(external_wp_element_["createElement"])("div", {
className: "edit-post-manage-blocks-modal__disabled-blocks-count"
}, Object(external_wp_i18n_["sprintf"])(
/* translators: %d: number of blocks. */
Object(external_wp_i18n_["_n"])('%d block is disabled.', '%d blocks are disabled.', numberOfHiddenBlocks), numberOfHiddenBlocks)), Object(external_wp_element_["createElement"])("div", {
tabIndex: "0",
role: "region",
"aria-label": Object(external_wp_i18n_["__"])('Available block types'),
className: "edit-post-manage-blocks-modal__results"
}, blockTypes.length === 0 && Object(external_wp_element_["createElement"])("p", {
className: "edit-post-manage-blocks-modal__no-results"
}, Object(external_wp_i18n_["__"])('No blocks found.')), categories.map(category => Object(external_wp_element_["createElement"])(manage_blocks_modal_category, {
key: category.slug,
title: category.title,
blockTypes: Object(external_lodash_["filter"])(blockTypes, {
category: category.slug
})
})), Object(external_wp_element_["createElement"])(manage_blocks_modal_category, {
title: Object(external_wp_i18n_["__"])('Uncategorized'),
blockTypes: Object(external_lodash_["filter"])(blockTypes, ({
category
}) => !category)
})));
}
/* harmony default export */ var manage_blocks_modal_manager = (Object(external_wp_compose_["compose"])([Object(external_wp_compose_["withState"])({
search: ''
}), Object(external_wp_data_["withSelect"])(select => {
const {
getBlockTypes,
getCategories,
hasBlockSupport,
isMatchingSearchTerm
} = select(external_wp_blocks_["store"]);
const {
getPreference
} = select(store["a" /* store */]);
const hiddenBlockTypes = getPreference('hiddenBlockTypes');
const numberOfHiddenBlocks = Object(external_lodash_["isArray"])(hiddenBlockTypes) && hiddenBlockTypes.length;
return {
blockTypes: getBlockTypes(),
categories: getCategories(),
hasBlockSupport,
isMatchingSearchTerm,
numberOfHiddenBlocks
};
})])(BlockManager));
// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/manage-blocks-modal/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* Unique identifier for Manage Blocks modal.
*
* @type {string}
*/
const manage_blocks_modal_MODAL_NAME = 'edit-post/manage-blocks';
function ManageBlocksModal({
isActive,
closeModal
}) {
if (!isActive) {
return null;
}
return Object(external_wp_element_["createElement"])(external_wp_components_["Modal"], {
className: "edit-post-manage-blocks-modal",
title: Object(external_wp_i18n_["__"])('Block Manager'),
closeLabel: Object(external_wp_i18n_["__"])('Close'),
onRequestClose: closeModal
}, Object(external_wp_element_["createElement"])(manage_blocks_modal_manager, null));
}
/* harmony default export */ var manage_blocks_modal = (Object(external_wp_compose_["compose"])([Object(external_wp_data_["withSelect"])(select => {
const {
isModalActive
} = select(store["a" /* store */]);
return {
isActive: isModalActive(manage_blocks_modal_MODAL_NAME)
};
}), Object(external_wp_data_["withDispatch"])(dispatch => {
const {
closeModal
} = dispatch(store["a" /* store */]);
return {
closeModal
};
})])(ManageBlocksModal));
// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/preferences-modal/section.js
const Section = ({
description,
title,
children
}) => Object(external_wp_element_["createElement"])("section", {
className: "edit-post-preferences-modal__section"
}, Object(external_wp_element_["createElement"])("h2", {
className: "edit-post-preferences-modal__section-title"
}, title), description && Object(external_wp_element_["createElement"])("p", {
className: "edit-post-preferences-modal__section-description"
}, description), children);
/* harmony default export */ var preferences_modal_section = (Section);
// EXTERNAL MODULE: ./node_modules/@wordpress/edit-post/build-module/components/preferences-modal/options/index.js + 6 modules
var preferences_modal_options = __webpack_require__("Y5n4");
// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/preferences-modal/meta-boxes-section.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function MetaBoxesSection({
areCustomFieldsRegistered,
metaBoxes,
...sectionProps
}) {
// The 'Custom Fields' meta box is a special case that we handle separately.
const thirdPartyMetaBoxes = Object(external_lodash_["filter"])(metaBoxes, ({
id
}) => id !== 'postcustom');
if (!areCustomFieldsRegistered && thirdPartyMetaBoxes.length === 0) {
return null;
}
return Object(external_wp_element_["createElement"])(preferences_modal_section, sectionProps, areCustomFieldsRegistered && Object(external_wp_element_["createElement"])(preferences_modal_options["a" /* EnableCustomFieldsOption */], {
label: Object(external_wp_i18n_["__"])('Custom fields')
}), Object(external_lodash_["map"])(thirdPartyMetaBoxes, ({
id,
title
}) => Object(external_wp_element_["createElement"])(preferences_modal_options["c" /* EnablePanelOption */], {
key: id,
label: title,
panelName: `meta-box-${id}`
})));
}
/* harmony default export */ var meta_boxes_section = (Object(external_wp_data_["withSelect"])(select => {
const {
getEditorSettings
} = select('core/editor');
const {
getAllMetaBoxes
} = select(store["a" /* store */]);
return {
// This setting should not live in the block editor's store.
areCustomFieldsRegistered: getEditorSettings().enableCustomFields !== undefined,
metaBoxes: getAllMetaBoxes()
};
})(MetaBoxesSection));
// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/preferences-modal/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const preferences_modal_MODAL_NAME = 'edit-post/preferences';
const PREFERENCES_MENU = 'preferences-menu';
function PreferencesModal() {
const isLargeViewport = Object(external_wp_compose_["useViewportMatch"])('medium');
const {
closeModal
} = Object(external_wp_data_["useDispatch"])(store["a" /* store */]);
const {
isModalActive,
isViewable
} = Object(external_wp_data_["useSelect"])(select => {
const {
getEditedPostAttribute
} = select(external_wp_editor_["store"]);
const {
getPostType
} = select(external_wp_coreData_["store"]);
const postType = getPostType(getEditedPostAttribute('type'));
return {
isModalActive: select(store["a" /* store */]).isModalActive(preferences_modal_MODAL_NAME),
isViewable: Object(external_lodash_["get"])(postType, ['viewable'], false)
};
}, []);
const showBlockBreadcrumbsOption = Object(external_wp_data_["useSelect"])(select => {
const {
getEditorSettings
} = select(external_wp_editor_["store"]);
const {
getEditorMode,
isFeatureActive
} = select(store["a" /* store */]);
const mode = getEditorMode();
const isRichEditingEnabled = getEditorSettings().richEditingEnabled;
const hasReducedUI = isFeatureActive('reducedUI');
return !hasReducedUI && isLargeViewport && isRichEditingEnabled && mode === 'visual';
}, [isLargeViewport]);
const sections = Object(external_wp_element_["useMemo"])(() => [{
name: 'general',
tabLabel: Object(external_wp_i18n_["__"])('General'),
content: Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, isLargeViewport && Object(external_wp_element_["createElement"])(preferences_modal_section, {
title: Object(external_wp_i18n_["__"])('Choose your own experience')
}, Object(external_wp_element_["createElement"])(preferences_modal_options["e" /* EnablePublishSidebarOption */], {
help: Object(external_wp_i18n_["__"])('Review settings such as categories and tags.'),
label: Object(external_wp_i18n_["__"])('Include pre-publish checklist')
})), Object(external_wp_element_["createElement"])(preferences_modal_section, {
title: Object(external_wp_i18n_["__"])('Decide what to focus on')
}, Object(external_wp_element_["createElement"])(preferences_modal_options["b" /* EnableFeature */], {
featureName: "reducedUI",
help: Object(external_wp_i18n_["__"])('Compacts options and outlines in the toolbar.'),
label: Object(external_wp_i18n_["__"])('Reduce the interface')
}), Object(external_wp_element_["createElement"])(preferences_modal_options["b" /* EnableFeature */], {
featureName: "focusMode",
help: Object(external_wp_i18n_["__"])('Highlights the current block and fades other content.'),
label: Object(external_wp_i18n_["__"])('Spotlight mode')
}), showBlockBreadcrumbsOption && Object(external_wp_element_["createElement"])(preferences_modal_options["b" /* EnableFeature */], {
featureName: "showBlockBreadcrumbs",
help: Object(external_wp_i18n_["__"])('Shows block breadcrumbs at the bottom of the editor.'),
label: Object(external_wp_i18n_["__"])('Display block breadcrumbs')
})))
}, {
name: 'appearance',
tabLabel: Object(external_wp_i18n_["__"])('Appearance'),
content: Object(external_wp_element_["createElement"])(preferences_modal_section, {
title: Object(external_wp_i18n_["__"])('Choose the way it looks')
}, Object(external_wp_element_["createElement"])(preferences_modal_options["b" /* EnableFeature */], {
featureName: "showIconLabels",
help: Object(external_wp_i18n_["__"])('Shows text instead of icons in toolbar.'),
label: Object(external_wp_i18n_["__"])('Display button labels')
}), Object(external_wp_element_["createElement"])(preferences_modal_options["b" /* EnableFeature */], {
featureName: "themeStyles",
help: Object(external_wp_i18n_["__"])('Make the editor look like your theme.'),
label: Object(external_wp_i18n_["__"])('Use theme styles')
}))
}, {
name: 'blocks',
tabLabel: Object(external_wp_i18n_["__"])('Blocks'),
content: Object(external_wp_element_["createElement"])(preferences_modal_section, {
title: Object(external_wp_i18n_["__"])('Choose how you interact with blocks')
}, Object(external_wp_element_["createElement"])(preferences_modal_options["b" /* EnableFeature */], {
featureName: "mostUsedBlocks",
help: Object(external_wp_i18n_["__"])('Places the most frequent blocks in the block library.'),
label: Object(external_wp_i18n_["__"])('Show most used blocks')
}), Object(external_wp_element_["createElement"])(preferences_modal_options["b" /* EnableFeature */], {
featureName: "keepCaretInsideBlock",
help: Object(external_wp_i18n_["__"])('Aids screen readers by stopping text caret from leaving blocks.'),
label: Object(external_wp_i18n_["__"])('Contain text cursor inside block')
}))
}, {
name: 'panels',
tabLabel: Object(external_wp_i18n_["__"])('Panels'),
content: Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(preferences_modal_section, {
title: Object(external_wp_i18n_["__"])('Document settings'),
description: Object(external_wp_i18n_["__"])('Choose what displays in the panel.')
}, Object(external_wp_element_["createElement"])(preferences_modal_options["d" /* EnablePluginDocumentSettingPanelOption */].Slot, null), isViewable && Object(external_wp_element_["createElement"])(preferences_modal_options["c" /* EnablePanelOption */], {
label: Object(external_wp_i18n_["__"])('Permalink'),
panelName: "post-link"
}), isViewable && Object(external_wp_element_["createElement"])(preferences_modal_options["c" /* EnablePanelOption */], {
label: Object(external_wp_i18n_["__"])('Template'),
panelName: "template"
}), Object(external_wp_element_["createElement"])(external_wp_editor_["PostTaxonomies"], {
taxonomyWrapper: (content, taxonomy) => Object(external_wp_element_["createElement"])(preferences_modal_options["c" /* EnablePanelOption */], {
label: Object(external_lodash_["get"])(taxonomy, ['labels', 'menu_name']),
panelName: `taxonomy-panel-${taxonomy.slug}`
})
}), Object(external_wp_element_["createElement"])(external_wp_editor_["PostFeaturedImageCheck"], null, Object(external_wp_element_["createElement"])(preferences_modal_options["c" /* EnablePanelOption */], {
label: Object(external_wp_i18n_["__"])('Featured image'),
panelName: "featured-image"
})), Object(external_wp_element_["createElement"])(external_wp_editor_["PostExcerptCheck"], null, Object(external_wp_element_["createElement"])(preferences_modal_options["c" /* EnablePanelOption */], {
label: Object(external_wp_i18n_["__"])('Excerpt'),
panelName: "post-excerpt"
})), Object(external_wp_element_["createElement"])(external_wp_editor_["PostTypeSupportCheck"], {
supportKeys: ['comments', 'trackbacks']
}, Object(external_wp_element_["createElement"])(preferences_modal_options["c" /* EnablePanelOption */], {
label: Object(external_wp_i18n_["__"])('Discussion'),
panelName: "discussion-panel"
})), Object(external_wp_element_["createElement"])(external_wp_editor_["PageAttributesCheck"], null, Object(external_wp_element_["createElement"])(preferences_modal_options["c" /* EnablePanelOption */], {
label: Object(external_wp_i18n_["__"])('Page attributes'),
panelName: "page-attributes"
}))), Object(external_wp_element_["createElement"])(preferences_modal_section, {
title: Object(external_wp_i18n_["__"])('Additional'),
description: Object(external_wp_i18n_["__"])('Add extra areas to the editor.')
}, Object(external_wp_element_["createElement"])(meta_boxes_section, null)))
}], [isViewable, isLargeViewport, showBlockBreadcrumbsOption]); // This is also used to sync the two different rendered components
// between small and large viewports.
const [activeMenu, setActiveMenu] = Object(external_wp_element_["useState"])(PREFERENCES_MENU);
/**
* Create helper objects from `sections` for easier data handling.
* `tabs` is used for creating the `TabPanel` and `sectionsContentMap`
* is used for easier access to active tab's content.
*/
const {
tabs,
sectionsContentMap
} = Object(external_wp_element_["useMemo"])(() => sections.reduce((accumulator, {
name,
tabLabel: title,
content
}) => {
accumulator.tabs.push({
name,
title
});
accumulator.sectionsContentMap[name] = content;
return accumulator;
}, {
tabs: [],
sectionsContentMap: {}
}), [sections]);
const getCurrentTab = Object(external_wp_element_["useCallback"])(tab => sectionsContentMap[tab.name] || null, [sectionsContentMap]);
if (!isModalActive) {
return null;
}
let modalContent; // We render different components based on the viewport size.
if (isLargeViewport) {
modalContent = Object(external_wp_element_["createElement"])(external_wp_components_["TabPanel"], {
className: "edit-post-preferences__tabs",
tabs: tabs,
initialTabName: activeMenu !== PREFERENCES_MENU ? activeMenu : undefined,
onSelect: setActiveMenu,
orientation: "vertical"
}, getCurrentTab);
} else {
modalContent = Object(external_wp_element_["createElement"])(external_wp_components_["__experimentalNavigation"], {
activeMenu: activeMenu,
onActivateMenu: setActiveMenu
}, Object(external_wp_element_["createElement"])(external_wp_components_["__experimentalNavigationMenu"], {
menu: PREFERENCES_MENU
}, tabs.map(tab => {
return Object(external_wp_element_["createElement"])(external_wp_components_["__experimentalNavigationItem"], {
key: tab.name,
title: tab.title,
navigateToMenu: tab.name
});
})), sections.map(section => {
return Object(external_wp_element_["createElement"])(external_wp_components_["__experimentalNavigationMenu"], {
key: `${section.name}-menu`,
menu: section.name,
title: section.tabLabel,
parentMenu: PREFERENCES_MENU
}, Object(external_wp_element_["createElement"])(external_wp_components_["__experimentalNavigationItem"], null, section.content));
}));
}
return Object(external_wp_element_["createElement"])(external_wp_components_["Modal"], {
className: "edit-post-preferences-modal",
title: Object(external_wp_i18n_["__"])('Preferences'),
closeLabel: Object(external_wp_i18n_["__"])('Close'),
onRequestClose: closeModal
}, modalContent);
}
// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/browser-url/index.js
/**
* WordPress dependencies
*/
/**
* Returns the Post's Edit URL.
*
* @param {number} postId Post ID.
*
* @return {string} Post edit URL.
*/
function getPostEditURL(postId) {
return Object(external_wp_url_["addQueryArgs"])('post.php', {
post: postId,
action: 'edit'
});
}
/**
* Returns the Post's Trashed URL.
*
* @param {number} postId Post ID.
* @param {string} postType Post Type.
*
* @return {string} Post trashed URL.
*/
function getPostTrashedURL(postId, postType) {
return Object(external_wp_url_["addQueryArgs"])('edit.php', {
trashed: 1,
post_type: postType,
ids: postId
});
}
class browser_url_BrowserURL extends external_wp_element_["Component"] {
constructor() {
super(...arguments);
this.state = {
historyId: null
};
}
componentDidUpdate(prevProps) {
const {
postId,
postStatus,
postType,
isSavingPost
} = this.props;
const {
historyId
} = this.state; // Posts are still dirty while saving so wait for saving to finish
// to avoid the unsaved changes warning when trashing posts.
if (postStatus === 'trash' && !isSavingPost) {
this.setTrashURL(postId, postType);
return;
}
if ((postId !== prevProps.postId || postId !== historyId) && postStatus !== 'auto-draft' && postId) {
this.setBrowserURL(postId);
}
}
/**
* Navigates the browser to the post trashed URL to show a notice about the trashed post.
*
* @param {number} postId Post ID.
* @param {string} postType Post Type.
*/
setTrashURL(postId, postType) {
window.location.href = getPostTrashedURL(postId, postType);
}
/**
* Replaces the browser URL with a post editor link for the given post ID.
*
* Note it is important that, since this function may be called when the
* editor first loads, the result generated `getPostEditURL` matches that
* produced by the server. Otherwise, the URL will change unexpectedly.
*
* @param {number} postId Post ID for which to generate post editor URL.
*/
setBrowserURL(postId) {
window.history.replaceState({
id: postId
}, 'Post ' + postId, getPostEditURL(postId));
this.setState(() => ({
historyId: postId
}));
}
render() {
return null;
}
}
/* harmony default export */ var browser_url = (Object(external_wp_data_["withSelect"])(select => {
const {
getCurrentPost,
isSavingPost
} = select('core/editor');
const post = getCurrentPost();
let {
id,
status,
type
} = post;
const isTemplate = ['wp_template', 'wp_template_part'].includes(type);
if (isTemplate) {
id = post.wp_id;
}
return {
postId: id,
postStatus: status,
postType: type,
isSavingPost: isSavingPost()
};
})(browser_url_BrowserURL));
// EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/wordpress.js
var wordpress = __webpack_require__("wduq");
// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/header/fullscreen-mode-close/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function FullscreenModeClose({
showTooltip,
icon,
href
}) {
const {
isActive,
isRequestingSiteIcon,
postType,
siteIconUrl
} = Object(external_wp_data_["useSelect"])(select => {
const {
getCurrentPostType
} = select('core/editor');
const {
isFeatureActive
} = select(store["a" /* store */]);
const {
isResolving
} = select('core/data');
const {
getEntityRecord,
getPostType
} = select('core');
const siteData = getEntityRecord('root', '__unstableBase', undefined) || {};
return {
isActive: isFeatureActive('fullscreenMode'),
isRequestingSiteIcon: isResolving('core', 'getEntityRecord', ['root', '__unstableBase', undefined]),
postType: getPostType(getCurrentPostType()),
siteIconUrl: siteData.site_icon_url
};
}, []);
if (!isActive || !postType) {
return null;
}
let buttonIcon = Object(external_wp_element_["createElement"])(external_wp_components_["Icon"], {
size: "36px",
icon: wordpress["a" /* default */]
});
if (siteIconUrl) {
buttonIcon = Object(external_wp_element_["createElement"])("img", {
alt: Object(external_wp_i18n_["__"])('Site Icon'),
className: "edit-post-fullscreen-mode-close_site-icon",
src: siteIconUrl
});
}
if (isRequestingSiteIcon) {
buttonIcon = null;
} // Override default icon if custom icon is provided via props.
if (icon) {
buttonIcon = Object(external_wp_element_["createElement"])(external_wp_components_["Icon"], {
size: "36px",
icon: icon
});
}
return Object(external_wp_element_["createElement"])(external_wp_components_["Button"], {
className: "edit-post-fullscreen-mode-close has-icon",
href: href !== null && href !== void 0 ? href : Object(external_wp_url_["addQueryArgs"])('edit.php', {
post_type: postType.slug
}),
label: Object(external_lodash_["get"])(postType, ['labels', 'view_items'], Object(external_wp_i18n_["__"])('Back')),
showTooltip: showTooltip
}, buttonIcon);
}
/* harmony default export */ var fullscreen_mode_close = (FullscreenModeClose);
// EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/list-view.js
var list_view = __webpack_require__("OzlF");
// EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/plus.js
var plus = __webpack_require__("Q4Sy");
// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/header/header-toolbar/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function HeaderToolbar() {
const inserterButton = Object(external_wp_element_["useRef"])();
const {
setIsInserterOpened,
setIsListViewOpened
} = Object(external_wp_data_["useDispatch"])(store["a" /* store */]);
const {
isInserterEnabled,
isInserterOpened,
isTextModeEnabled,
showIconLabels,
isListViewOpen,
listViewShortcut
} = Object(external_wp_data_["useSelect"])(select => {
const {
hasInserterItems,
getBlockRootClientId,
getBlockSelectionEnd
} = select(external_wp_blockEditor_["store"]);
const {
getEditorSettings
} = select(external_wp_editor_["store"]);
const {
getEditorMode,
isFeatureActive,
isListViewOpened
} = select(store["a" /* store */]);
const {
getShortcutRepresentation
} = select(external_wp_keyboardShortcuts_["store"]);
return {
// This setting (richEditingEnabled) should not live in the block editor's setting.
isInserterEnabled: getEditorMode() === 'visual' && getEditorSettings().richEditingEnabled && hasInserterItems(getBlockRootClientId(getBlockSelectionEnd())),
isInserterOpened: select(store["a" /* store */]).isInserterOpened(),
isTextModeEnabled: getEditorMode() === 'text',
showIconLabels: isFeatureActive('showIconLabels'),
isListViewOpen: isListViewOpened(),
listViewShortcut: getShortcutRepresentation('core/edit-post/toggle-block-navigation')
};
}, []);
const isLargeViewport = Object(external_wp_compose_["useViewportMatch"])('medium');
const isWideViewport = Object(external_wp_compose_["useViewportMatch"])('wide');
/* translators: accessibility text for the editor toolbar */
const toolbarAriaLabel = Object(external_wp_i18n_["__"])('Document tools');
const overflowItems = Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(external_wp_components_["ToolbarItem"], {
as: external_wp_editor_["TableOfContents"],
hasOutlineItemsDisabled: isTextModeEnabled,
repositionDropdown: showIconLabels && !isWideViewport,
showTooltip: !showIconLabels,
isTertiary: showIconLabels
}), Object(external_wp_element_["createElement"])(external_wp_components_["ToolbarItem"], {
as: external_wp_components_["Button"],
className: "edit-post-header-toolbar__list-view-toggle",
icon: list_view["a" /* default */],
disabled: isTextModeEnabled,
isPressed: isListViewOpen
/* translators: button label text should, if possible, be under 16 characters. */
,
label: Object(external_wp_i18n_["__"])('List View'),
onClick: () => setIsListViewOpened(!isListViewOpen),
shortcut: listViewShortcut,
showTooltip: !showIconLabels
}));
return Object(external_wp_element_["createElement"])(external_wp_blockEditor_["NavigableToolbar"], {
className: "edit-post-header-toolbar",
"aria-label": toolbarAriaLabel
}, Object(external_wp_element_["createElement"])("div", {
className: "edit-post-header-toolbar__left"
}, Object(external_wp_element_["createElement"])(external_wp_components_["ToolbarItem"], {
ref: inserterButton,
as: external_wp_components_["Button"],
className: "edit-post-header-toolbar__inserter-toggle",
isPrimary: true,
isPressed: isInserterOpened,
onMouseDown: event => {
event.preventDefault();
},
onClick: () => {
if (isInserterOpened) {
// Focusing the inserter button closes the inserter popover
inserterButton.current.focus();
} else {
setIsInserterOpened(true);
}
},
disabled: !isInserterEnabled,
icon: plus["a" /* default */]
/* translators: button label text should, if possible, be under 16
characters. */
,
label: Object(external_wp_i18n_["_x"])('Toggle block inserter', 'Generic label for block inserter button'),
showTooltip: !showIconLabels
}, showIconLabels && Object(external_wp_i18n_["__"])('Add')), (isWideViewport || !showIconLabels) && Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, isLargeViewport && Object(external_wp_element_["createElement"])(external_wp_components_["ToolbarItem"], {
as: external_wp_blockEditor_["ToolSelector"],
showTooltip: !showIconLabels,
isTertiary: showIconLabels,
disabled: isTextModeEnabled
}), Object(external_wp_element_["createElement"])(external_wp_components_["ToolbarItem"], {
as: external_wp_editor_["EditorHistoryUndo"],
showTooltip: !showIconLabels,
isTertiary: showIconLabels
}), Object(external_wp_element_["createElement"])(external_wp_components_["ToolbarItem"], {
as: external_wp_editor_["EditorHistoryRedo"],
showTooltip: !showIconLabels,
isTertiary: showIconLabels
}), overflowItems)));
}
/* harmony default export */ var header_toolbar = (HeaderToolbar);
// EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/more-vertical.js
var more_vertical = __webpack_require__("VKE3");
// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/header/mode-switcher/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* Set of available mode options.
*
* @type {Array}
*/
const MODES = [{
value: 'visual',
label: Object(external_wp_i18n_["__"])('Visual editor')
}, {
value: 'text',
label: Object(external_wp_i18n_["__"])('Code editor')
}];
function ModeSwitcher() {
const {
shortcut,
isRichEditingEnabled,
isCodeEditingEnabled,
mode
} = Object(external_wp_data_["useSelect"])(select => ({
shortcut: select(external_wp_keyboardShortcuts_["store"]).getShortcutRepresentation('core/edit-post/toggle-mode'),
isRichEditingEnabled: select('core/editor').getEditorSettings().richEditingEnabled,
isCodeEditingEnabled: select('core/editor').getEditorSettings().codeEditingEnabled,
mode: select(store["a" /* store */]).getEditorMode()
}), []);
const {
switchEditorMode
} = Object(external_wp_data_["useDispatch"])(store["a" /* store */]);
if (!isRichEditingEnabled || !isCodeEditingEnabled) {
return null;
}
const choices = MODES.map(choice => {
if (choice.value !== mode) {
return { ...choice,
shortcut
};
}
return choice;
});
return Object(external_wp_element_["createElement"])(external_wp_components_["MenuGroup"], {
label: Object(external_wp_i18n_["__"])('Editor')
}, Object(external_wp_element_["createElement"])(external_wp_components_["MenuItemsChoice"], {
choices: choices,
value: mode,
onSelect: switchEditorMode
}));
}
/* harmony default export */ var mode_switcher = (ModeSwitcher);
// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/header/preferences-menu-item/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function PreferencesMenuItem() {
const {
openModal
} = Object(external_wp_data_["useDispatch"])(store["a" /* store */]);
return Object(external_wp_element_["createElement"])(external_wp_components_["MenuItem"], {
onClick: () => {
openModal('edit-post/preferences');
}
}, Object(external_wp_i18n_["__"])('Preferences'));
}
// EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/check.js
var check = __webpack_require__("RMJe");
// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/header/feature-toggle/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function FeatureToggle({
onToggle,
isActive,
label,
info,
messageActivated,
messageDeactivated,
shortcut
}) {
const speakMessage = () => {
if (isActive) {
Object(external_wp_a11y_["speak"])(messageDeactivated || Object(external_wp_i18n_["__"])('Feature deactivated'));
} else {
Object(external_wp_a11y_["speak"])(messageActivated || Object(external_wp_i18n_["__"])('Feature activated'));
}
};
return Object(external_wp_element_["createElement"])(external_wp_components_["MenuItem"], {
icon: isActive && check["a" /* default */],
isSelected: isActive,
onClick: Object(external_lodash_["flow"])(onToggle, speakMessage),
role: "menuitemcheckbox",
info: info,
shortcut: shortcut
}, label);
}
/* harmony default export */ var feature_toggle = (Object(external_wp_compose_["compose"])([Object(external_wp_data_["withSelect"])((select, {
feature
}) => ({
isActive: select(store["a" /* store */]).isFeatureActive(feature)
})), Object(external_wp_data_["withDispatch"])((dispatch, ownProps) => ({
onToggle() {
dispatch(store["a" /* store */]).toggleFeature(ownProps.feature);
}
}))])(FeatureToggle));
// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/header/writing-menu/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function WritingMenu() {
const isLargeViewport = Object(external_wp_compose_["useViewportMatch"])('medium');
if (!isLargeViewport) {
return null;
}
return Object(external_wp_element_["createElement"])(external_wp_components_["MenuGroup"], {
label: Object(external_wp_i18n_["_x"])('View', 'noun')
}, Object(external_wp_element_["createElement"])(feature_toggle, {
feature: "fixedToolbar",
label: Object(external_wp_i18n_["__"])('Top toolbar'),
info: Object(external_wp_i18n_["__"])('Access all block and document tools in a single place'),
messageActivated: Object(external_wp_i18n_["__"])('Top toolbar activated'),
messageDeactivated: Object(external_wp_i18n_["__"])('Top toolbar deactivated')
}), Object(external_wp_element_["createElement"])(feature_toggle, {
feature: "focusMode",
label: Object(external_wp_i18n_["__"])('Spotlight mode'),
info: Object(external_wp_i18n_["__"])('Focus on one block at a time'),
messageActivated: Object(external_wp_i18n_["__"])('Spotlight mode activated'),
messageDeactivated: Object(external_wp_i18n_["__"])('Spotlight mode deactivated')
}), Object(external_wp_element_["createElement"])(feature_toggle, {
feature: "fullscreenMode",
label: Object(external_wp_i18n_["__"])('Fullscreen mode'),
info: Object(external_wp_i18n_["__"])('Work without distraction'),
messageActivated: Object(external_wp_i18n_["__"])('Fullscreen mode activated'),
messageDeactivated: Object(external_wp_i18n_["__"])('Fullscreen mode deactivated'),
shortcut: external_wp_keycodes_["displayShortcut"].secondary('f')
}));
}
/* harmony default export */ var writing_menu = (WritingMenu);
// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/header/more-menu/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const POPOVER_PROPS = {
className: 'edit-post-more-menu__content',
position: 'bottom left'
};
const TOGGLE_PROPS = {
tooltipPosition: 'bottom'
};
const MoreMenu = ({
showIconLabels
}) => {
const isLargeViewport = Object(external_wp_compose_["useViewportMatch"])('large');
return Object(external_wp_element_["createElement"])(external_wp_components_["DropdownMenu"], {
className: "edit-post-more-menu",
icon: more_vertical["a" /* default */]
/* translators: button label text should, if possible, be under 16 characters. */
,
label: Object(external_wp_i18n_["__"])('Options'),
popoverProps: POPOVER_PROPS,
toggleProps: {
showTooltip: !showIconLabels,
isTertiary: showIconLabels,
...TOGGLE_PROPS
}
}, ({
onClose
}) => Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, showIconLabels && !isLargeViewport && Object(external_wp_element_["createElement"])(build_module["f" /* PinnedItems */].Slot, {
className: showIconLabels && 'show-icon-labels',
scope: "core/edit-post"
}), Object(external_wp_element_["createElement"])(writing_menu, null), Object(external_wp_element_["createElement"])(mode_switcher, null), Object(external_wp_element_["createElement"])(build_module["a" /* ActionItem */].Slot, {
name: "core/edit-post/plugin-more-menu",
label: Object(external_wp_i18n_["__"])('Plugins'),
as: external_wp_components_["MenuGroup"],
fillProps: {
onClick: onClose
}
}), Object(external_wp_element_["createElement"])(tools_more_menu_group.Slot, {
fillProps: {
onClose
}
}), Object(external_wp_element_["createElement"])(external_wp_components_["MenuGroup"], null, Object(external_wp_element_["createElement"])(PreferencesMenuItem, null))));
};
/* harmony default export */ var more_menu = (MoreMenu);
// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/header/post-publish-button-or-toggle.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function PostPublishButtonOrToggle({
forceIsDirty,
forceIsSaving,
hasPublishAction,
isBeingScheduled,
isPending,
isPublished,
isPublishSidebarEnabled,
isPublishSidebarOpened,
isScheduled,
togglePublishSidebar,
setEntitiesSavedStatesCallback
}) {
const IS_TOGGLE = 'toggle';
const IS_BUTTON = 'button';
const isSmallerThanMediumViewport = Object(external_wp_compose_["useViewportMatch"])('medium', '<');
let component;
/**
* Conditions to show a BUTTON (publish directly) or a TOGGLE (open publish sidebar):
*
* 1) We want to show a BUTTON when the post status is at the _final stage_
* for a particular role (see https://wordpress.org/support/article/post-status/):
*
* - is published
* - is scheduled to be published
* - is pending and can't be published (but only for viewports >= medium).
* Originally, we considered showing a button for pending posts that couldn't be published
* (for example, for an author with the contributor role). Some languages can have
* long translations for "Submit for review", so given the lack of UI real estate available
* we decided to take into account the viewport in that case.
* See: https://github.com/WordPress/gutenberg/issues/10475
*
* 2) Then, in small viewports, we'll show a TOGGLE.
*
* 3) Finally, we'll use the publish sidebar status to decide:
*
* - if it is enabled, we show a TOGGLE
* - if it is disabled, we show a BUTTON
*/
if (isPublished || isScheduled && isBeingScheduled || isPending && !hasPublishAction && !isSmallerThanMediumViewport) {
component = IS_BUTTON;
} else if (isSmallerThanMediumViewport) {
component = IS_TOGGLE;
} else if (isPublishSidebarEnabled) {
component = IS_TOGGLE;
} else {
component = IS_BUTTON;
}
return Object(external_wp_element_["createElement"])(external_wp_editor_["PostPublishButton"], {
forceIsDirty: forceIsDirty,
forceIsSaving: forceIsSaving,
isOpen: isPublishSidebarOpened,
isToggle: component === IS_TOGGLE,
onToggle: togglePublishSidebar,
setEntitiesSavedStatesCallback: setEntitiesSavedStatesCallback
});
}
/* harmony default export */ var post_publish_button_or_toggle = (Object(external_wp_compose_["compose"])(Object(external_wp_data_["withSelect"])(select => ({
hasPublishAction: Object(external_lodash_["get"])(select('core/editor').getCurrentPost(), ['_links', 'wp:action-publish'], false),
isBeingScheduled: select('core/editor').isEditedPostBeingScheduled(),
isPending: select('core/editor').isCurrentPostPending(),
isPublished: select('core/editor').isCurrentPostPublished(),
isPublishSidebarEnabled: select('core/editor').isPublishSidebarEnabled(),
isPublishSidebarOpened: select(store["a" /* store */]).isPublishSidebarOpened(),
isScheduled: select('core/editor').isCurrentPostScheduled()
})), Object(external_wp_data_["withDispatch"])(dispatch => {
const {
togglePublishSidebar
} = dispatch(store["a" /* store */]);
return {
togglePublishSidebar
};
}))(PostPublishButtonOrToggle));
// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/device-preview/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function DevicePreview() {
const {
hasActiveMetaboxes,
isPostSaveable,
isSaving,
deviceType
} = Object(external_wp_data_["useSelect"])(select => ({
hasActiveMetaboxes: select(store["a" /* store */]).hasMetaBoxes(),
isSaving: select(store["a" /* store */]).isSavingMetaBoxes(),
isPostSaveable: select('core/editor').isEditedPostSaveable(),
deviceType: select(store["a" /* store */]).__experimentalGetPreviewDeviceType()
}), []);
const {
__experimentalSetPreviewDeviceType: setPreviewDeviceType
} = Object(external_wp_data_["useDispatch"])(store["a" /* store */]);
return Object(external_wp_element_["createElement"])(external_wp_blockEditor_["__experimentalPreviewOptions"], {
isEnabled: isPostSaveable,
className: "edit-post-post-preview-dropdown",
deviceType: deviceType,
setDeviceType: setPreviewDeviceType
}, Object(external_wp_element_["createElement"])(external_wp_components_["MenuGroup"], null, Object(external_wp_element_["createElement"])("div", {
className: "edit-post-header-preview__grouping-external"
}, Object(external_wp_element_["createElement"])(external_wp_editor_["PostPreviewButton"], {
className: 'edit-post-header-preview__button-external',
role: "menuitem",
forceIsAutosaveable: hasActiveMetaboxes,
forcePreviewLink: isSaving ? null : undefined,
textContent: Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_i18n_["__"])('Preview in new tab'), Object(external_wp_element_["createElement"])(external_wp_components_["Icon"], {
icon: external["a" /* default */]
}))
}))));
}
// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/header/main-dashboard-button/index.js
/**
* WordPress dependencies
*/
const slotName = '__experimentalMainDashboardButton';
const {
Fill,
Slot: MainDashboardButtonSlot
} = Object(external_wp_components_["createSlotFill"])(slotName);
const MainDashboardButton = Fill;
const main_dashboard_button_Slot = ({
children
}) => {
const slot = Object(external_wp_components_["__experimentalUseSlot"])(slotName);
const hasFills = Boolean(slot.fills && slot.fills.length);
if (!hasFills) {
return children;
}
return Object(external_wp_element_["createElement"])(MainDashboardButtonSlot, {
bubblesVirtually: true
});
};
MainDashboardButton.Slot = main_dashboard_button_Slot;
/* harmony default export */ var main_dashboard_button = (MainDashboardButton);
// EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/chevron-down.js
var chevron_down = __webpack_require__("NWDH");
// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/header/template-title/delete-template.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function DeleteTemplate() {
const {
clearSelectedBlock
} = Object(external_wp_data_["useDispatch"])(external_wp_blockEditor_["store"]);
const {
setIsEditingTemplate
} = Object(external_wp_data_["useDispatch"])(store["a" /* store */]);
const {
getEditorSettings
} = Object(external_wp_data_["useSelect"])(external_wp_editor_["store"]);
const {
updateEditorSettings,
editPost
} = Object(external_wp_data_["useDispatch"])(external_wp_editor_["store"]);
const {
deleteEntityRecord
} = Object(external_wp_data_["useDispatch"])(external_wp_coreData_["store"]);
const {
template
} = Object(external_wp_data_["useSelect"])(select => {
const {
isEditingTemplate,
getEditedPostTemplate
} = select(store["a" /* store */]);
const _isEditing = isEditingTemplate();
return {
template: _isEditing ? getEditedPostTemplate() : null
};
}, []);
if (!template || !template.wp_id) {
return null;
}
let templateTitle = template.slug;
if (template !== null && template !== void 0 && template.title) {
templateTitle = template.title;
}
return Object(external_wp_element_["createElement"])(external_wp_components_["MenuGroup"], {
className: "edit-post-template-top-area__second-menu-group"
}, Object(external_wp_element_["createElement"])(external_wp_components_["MenuItem"], {
className: "edit-post-template-top-area__delete-template-button",
isDestructive: true,
isSecondary: true,
"aria-label": Object(external_wp_i18n_["__"])('Delete template'),
onClick: () => {
if ( // eslint-disable-next-line no-alert
window.confirm(Object(external_wp_i18n_["sprintf"])(
/* translators: %s: template name */
Object(external_wp_i18n_["__"])('Are you sure you want to delete the %s template? It may be used by other pages or posts.'), templateTitle))) {
clearSelectedBlock();
setIsEditingTemplate(false);
editPost({
template: ''
});
const settings = getEditorSettings();
const newAvailableTemplates = Object(external_lodash_["pickBy"])(settings.availableTemplates, (_title, id) => {
return id !== template.slug;
});
updateEditorSettings({ ...settings,
availableTemplates: newAvailableTemplates
});
deleteEntityRecord('postType', 'wp_template', template.id);
}
}
}, Object(external_wp_i18n_["__"])('Delete template')));
}
// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/header/template-title/edit-template-title.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function EditTemplateTitle() {
const {
template
} = Object(external_wp_data_["useSelect"])(select => {
const {
getEditedPostTemplate
} = select(store["a" /* store */]);
return {
template: getEditedPostTemplate()
};
}, []);
const {
editEntityRecord
} = Object(external_wp_data_["useDispatch"])(external_wp_coreData_["store"]);
const {
getEditorSettings
} = Object(external_wp_data_["useSelect"])(external_wp_editor_["store"]);
const {
updateEditorSettings
} = Object(external_wp_data_["useDispatch"])(external_wp_editor_["store"]);
let templateTitle = Object(external_wp_i18n_["__"])('Default');
if (template !== null && template !== void 0 && template.title) {
templateTitle = template.title;
} else if (!!template) {
templateTitle = template.slug;
}
return Object(external_wp_element_["createElement"])(external_wp_components_["TextControl"], {
label: Object(external_wp_i18n_["__"])('Title'),
value: templateTitle,
help: Object(external_wp_i18n_["__"])('Give the template a title that indicates its purpose, e.g. "Full Width".'),
onChange: newTitle => {
const settings = getEditorSettings();
const newAvailableTemplates = Object(external_lodash_["mapValues"])(settings.availableTemplates, (existingTitle, id) => {
if (id !== template.slug) {
return existingTitle;
}
return newTitle;
});
updateEditorSettings({ ...settings,
availableTemplates: newAvailableTemplates
});
editEntityRecord('postType', 'wp_template', template.id, {
title: newTitle
});
}
});
}
// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/header/template-title/template-description.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function TemplateDescription() {
const {
description
} = Object(external_wp_data_["useSelect"])(select => {
const {
getEditedPostTemplate
} = select(store["a" /* store */]);
return {
description: getEditedPostTemplate().description
};
}, []);
if (!description) {
return null;
}
return Object(external_wp_element_["createElement"])(external_wp_components_["__experimentalText"], {
size: "body"
}, description);
}
// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/header/template-title/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function TemplateTitle() {
const {
template,
isEditing,
title
} = Object(external_wp_data_["useSelect"])(select => {
const {
isEditingTemplate,
getEditedPostTemplate
} = select(store["a" /* store */]);
const {
getEditedPostAttribute
} = select(external_wp_editor_["store"]);
const _isEditing = isEditingTemplate();
return {
template: _isEditing ? getEditedPostTemplate() : null,
isEditing: _isEditing,
title: getEditedPostAttribute('title')
};
}, []);
const {
clearSelectedBlock
} = Object(external_wp_data_["useDispatch"])(external_wp_blockEditor_["store"]);
const {
setIsEditingTemplate
} = Object(external_wp_data_["useDispatch"])(store["a" /* store */]);
if (!isEditing || !template) {
return null;
}
let templateTitle = Object(external_wp_i18n_["__"])('Default');
if (template !== null && template !== void 0 && template.title) {
templateTitle = template.title;
} else if (!!template) {
templateTitle = template.slug;
}
return Object(external_wp_element_["createElement"])("div", {
className: "edit-post-template-top-area"
}, Object(external_wp_element_["createElement"])(external_wp_components_["Button"], {
className: "edit-post-template-post-title",
isLink: true,
showTooltip: true,
label: Object(external_wp_i18n_["sprintf"])(
/* translators: %s: Title of the referring post, e.g: "Hello World!" */
Object(external_wp_i18n_["__"])('Edit %s'), title),
onClick: () => {
clearSelectedBlock();
setIsEditingTemplate(false);
}
}, title), Object(external_wp_element_["createElement"])(external_wp_components_["Dropdown"], {
position: "bottom center",
contentClassName: "edit-post-template-top-area__popover",
renderToggle: ({
onToggle
}) => Object(external_wp_element_["createElement"])(external_wp_components_["Button"], {
className: "edit-post-template-title",
isLink: true,
icon: chevron_down["a" /* default */],
showTooltip: true,
onClick: onToggle,
label: Object(external_wp_i18n_["__"])('Template Options')
}, templateTitle),
renderContent: () => Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, template.has_theme_file ? Object(external_wp_element_["createElement"])(TemplateDescription, null) : Object(external_wp_element_["createElement"])(EditTemplateTitle, null), Object(external_wp_element_["createElement"])(DeleteTemplate, null))
}));
}
/* harmony default export */ var template_title = (TemplateTitle);
// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/header/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function Header({
setEntitiesSavedStatesCallback
}) {
const {
hasActiveMetaboxes,
isPublishSidebarOpened,
isSaving,
showIconLabels,
hasReducedUI
} = Object(external_wp_data_["useSelect"])(select => ({
hasActiveMetaboxes: select(store["a" /* store */]).hasMetaBoxes(),
isPublishSidebarOpened: select(store["a" /* store */]).isPublishSidebarOpened(),
isSaving: select(store["a" /* store */]).isSavingMetaBoxes(),
showIconLabels: select(store["a" /* store */]).isFeatureActive('showIconLabels'),
hasReducedUI: select(store["a" /* store */]).isFeatureActive('reducedUI')
}), []);
const isLargeViewport = Object(external_wp_compose_["useViewportMatch"])('large');
const classes = classnames_default()('edit-post-header', {
'has-reduced-ui': hasReducedUI
});
return Object(external_wp_element_["createElement"])("div", {
className: classes
}, Object(external_wp_element_["createElement"])(main_dashboard_button.Slot, null, Object(external_wp_element_["createElement"])(fullscreen_mode_close, null)), Object(external_wp_element_["createElement"])("div", {
className: "edit-post-header__toolbar"
}, Object(external_wp_element_["createElement"])(header_toolbar, null), Object(external_wp_element_["createElement"])(template_title, null)), Object(external_wp_element_["createElement"])("div", {
className: "edit-post-header__settings"
}, !isPublishSidebarOpened && // This button isn't completely hidden by the publish sidebar.
// We can't hide the whole toolbar when the publish sidebar is open because
// we want to prevent mounting/unmounting the PostPublishButtonOrToggle DOM node.
// We track that DOM node to return focus to the PostPublishButtonOrToggle
// when the publish sidebar has been closed.
Object(external_wp_element_["createElement"])(external_wp_editor_["PostSavedState"], {
forceIsDirty: hasActiveMetaboxes,
forceIsSaving: isSaving,
showIconLabels: showIconLabels
}), Object(external_wp_element_["createElement"])(DevicePreview, null), Object(external_wp_element_["createElement"])(external_wp_editor_["PostPreviewButton"], {
forceIsAutosaveable: hasActiveMetaboxes,
forcePreviewLink: isSaving ? null : undefined
}), Object(external_wp_element_["createElement"])(post_publish_button_or_toggle, {
forceIsDirty: hasActiveMetaboxes,
forceIsSaving: isSaving,
setEntitiesSavedStatesCallback: setEntitiesSavedStatesCallback
}), (isLargeViewport || !showIconLabels) && Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(build_module["f" /* PinnedItems */].Slot, {
scope: "core/edit-post"
}), Object(external_wp_element_["createElement"])(more_menu, {
showIconLabels: showIconLabels
})), showIconLabels && !isLargeViewport && Object(external_wp_element_["createElement"])(more_menu, {
showIconLabels: showIconLabels
})));
}
/* harmony default export */ var header = (Header);
// EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/close.js
var library_close = __webpack_require__("w95h");
// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/secondary-sidebar/inserter-sidebar.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function InserterSidebar() {
const {
insertionPoint,
showMostUsedBlocks
} = Object(external_wp_data_["useSelect"])(select => {
const {
isFeatureActive,
__experimentalGetInsertionPoint
} = select(store["a" /* store */]);
return {
insertionPoint: __experimentalGetInsertionPoint(),
showMostUsedBlocks: isFeatureActive('mostUsedBlocks')
};
}, []);
const {
setIsInserterOpened
} = Object(external_wp_data_["useDispatch"])(store["a" /* store */]);
const isMobileViewport = Object(external_wp_compose_["useViewportMatch"])('medium', '<');
const [inserterDialogRef, inserterDialogProps] = Object(external_wp_compose_["__experimentalUseDialog"])({
onClose: () => setIsInserterOpened(false)
});
return Object(external_wp_element_["createElement"])("div", Object(esm_extends["a" /* default */])({
ref: inserterDialogRef
}, inserterDialogProps, {
className: "edit-post-editor__inserter-panel"
}), Object(external_wp_element_["createElement"])("div", {
className: "edit-post-editor__inserter-panel-header"
}, Object(external_wp_element_["createElement"])(external_wp_components_["Button"], {
icon: library_close["a" /* default */],
onClick: () => setIsInserterOpened(false)
})), Object(external_wp_element_["createElement"])("div", {
className: "edit-post-editor__inserter-panel-content"
}, Object(external_wp_element_["createElement"])(external_wp_blockEditor_["__experimentalLibrary"], {
showMostUsedBlocks: showMostUsedBlocks,
showInserterHelpPanel: true,
shouldFocusBlock: isMobileViewport,
rootClientId: insertionPoint.rootClientId,
__experimentalInsertionIndex: insertionPoint.insertionIndex
})));
}
// EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/close-small.js
var close_small = __webpack_require__("bWcr");
// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/secondary-sidebar/list-view-sidebar.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function ListViewSidebar() {
const {
setIsListViewOpened
} = Object(external_wp_data_["useDispatch"])(store["a" /* store */]);
const {
clearSelectedBlock,
selectBlock
} = Object(external_wp_data_["useDispatch"])(external_wp_blockEditor_["store"]);
async function selectEditorBlock(clientId) {
await clearSelectedBlock();
selectBlock(clientId, -1);
}
const focusOnMountRef = Object(external_wp_compose_["useFocusOnMount"])('firstElement');
const focusReturnRef = Object(external_wp_compose_["useFocusReturn"])();
function closeOnEscape(event) {
if (event.keyCode === external_wp_keycodes_["ESCAPE"]) {
event.stopPropagation();
setIsListViewOpened(false);
}
}
const instanceId = Object(external_wp_compose_["useInstanceId"])(ListViewSidebar);
const labelId = `edit-post-editor__list-view-panel-label-${instanceId}`;
return (// eslint-disable-next-line jsx-a11y/no-static-element-interactions
Object(external_wp_element_["createElement"])("div", {
"aria-labelledby": labelId,
className: "edit-post-editor__list-view-panel",
onKeyDown: closeOnEscape
}, Object(external_wp_element_["createElement"])("div", {
className: "edit-post-editor__list-view-panel-header"
}, Object(external_wp_element_["createElement"])("strong", {
id: labelId
}, Object(external_wp_i18n_["__"])('List view')), Object(external_wp_element_["createElement"])(external_wp_components_["Button"], {
icon: close_small["a" /* default */],
label: Object(external_wp_i18n_["__"])('Close list view sidebar'),
onClick: () => setIsListViewOpened(false)
})), Object(external_wp_element_["createElement"])("div", {
className: "edit-post-editor__list-view-panel-content",
ref: Object(external_wp_compose_["useMergeRefs"])([focusReturnRef, focusOnMountRef])
}, Object(external_wp_element_["createElement"])(external_wp_blockEditor_["__experimentalBlockNavigationTree"], {
onSelect: selectEditorBlock,
showNestedBlocks: true,
__experimentalPersistentListViewFeatures: true
})))
);
}
// EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/cog.js
var cog = __webpack_require__("Cg8A");
// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/settings-header/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const SettingsHeader = ({
sidebarName
}) => {
const {
openGeneralSidebar
} = Object(external_wp_data_["useDispatch"])(store["a" /* store */]);
const openDocumentSettings = () => openGeneralSidebar('edit-post/document');
const openBlockSettings = () => openGeneralSidebar('edit-post/block');
const {
documentLabel,
isTemplateMode
} = Object(external_wp_data_["useSelect"])(select => {
var _postType$labels$sing, _postType$labels;
const currentPostType = select('core/editor').getCurrentPostType();
const postType = select('core').getPostType(currentPostType);
return {
documentLabel: // Disable reason: Post type labels object is shaped like this.
// eslint-disable-next-line camelcase
(_postType$labels$sing = postType === null || postType === void 0 ? void 0 : (_postType$labels = postType.labels) === null || _postType$labels === void 0 ? void 0 : _postType$labels.singular_name) !== null && _postType$labels$sing !== void 0 ? _postType$labels$sing : // translators: Default label for the Document sidebar tab, not selected.
Object(external_wp_i18n_["__"])('Document'),
isTemplateMode: select(store["a" /* store */]).isEditingTemplate()
};
}, []);
const [documentAriaLabel, documentActiveClass] = sidebarName === 'edit-post/document' ? // translators: ARIA label for the Document sidebar tab, selected. %s: Document label.
[Object(external_wp_i18n_["sprintf"])(Object(external_wp_i18n_["__"])('%s (selected)'), documentLabel), 'is-active'] : [documentLabel, ''];
const [blockAriaLabel, blockActiveClass] = sidebarName === 'edit-post/block' ? // translators: ARIA label for the Block Settings Sidebar tab, selected.
[Object(external_wp_i18n_["__"])('Block (selected)'), 'is-active'] : // translators: ARIA label for the Block Settings Sidebar tab, not selected.
[Object(external_wp_i18n_["__"])('Block'), ''];
const [templateAriaLabel, templateActiveClass] = sidebarName === 'edit-post/document' ? [Object(external_wp_i18n_["__"])('Template (selected)'), 'is-active'] : [Object(external_wp_i18n_["__"])('Template'), ''];
/* Use a list so screen readers will announce how many tabs there are. */
return Object(external_wp_element_["createElement"])("ul", null, !isTemplateMode && Object(external_wp_element_["createElement"])("li", null, Object(external_wp_element_["createElement"])(external_wp_components_["Button"], {
onClick: openDocumentSettings,
className: `edit-post-sidebar__panel-tab ${documentActiveClass}`,
"aria-label": documentAriaLabel,
"data-label": documentLabel
}, documentLabel)), isTemplateMode && Object(external_wp_element_["createElement"])("li", null, Object(external_wp_element_["createElement"])(external_wp_components_["Button"], {
onClick: openDocumentSettings,
className: `edit-post-sidebar__panel-tab ${templateActiveClass}`,
"aria-label": templateAriaLabel,
"data-label": Object(external_wp_i18n_["__"])('Template')
}, Object(external_wp_i18n_["__"])('Template'))), Object(external_wp_element_["createElement"])("li", null, Object(external_wp_element_["createElement"])(external_wp_components_["Button"], {
onClick: openBlockSettings,
className: `edit-post-sidebar__panel-tab ${blockActiveClass}`,
"aria-label": blockAriaLabel // translators: Data label for the Block Settings Sidebar tab.
,
"data-label": Object(external_wp_i18n_["__"])('Block')
}, // translators: Text label for the Block Settings Sidebar tab.
Object(external_wp_i18n_["__"])('Block'))));
};
/* harmony default export */ var settings_header = (SettingsHeader);
// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/post-visibility/index.js
/**
* WordPress dependencies
*/
function PostVisibility() {
return Object(external_wp_element_["createElement"])(external_wp_editor_["PostVisibilityCheck"], {
render: ({
canEdit
}) => Object(external_wp_element_["createElement"])(external_wp_components_["PanelRow"], {
className: "edit-post-post-visibility"
}, Object(external_wp_element_["createElement"])("span", null, Object(external_wp_i18n_["__"])('Visibility')), !canEdit && Object(external_wp_element_["createElement"])("span", null, Object(external_wp_element_["createElement"])(external_wp_editor_["PostVisibilityLabel"], null)), canEdit && Object(external_wp_element_["createElement"])(external_wp_components_["Dropdown"], {
position: "bottom left",
contentClassName: "edit-post-post-visibility__dialog",
renderToggle: ({
isOpen,
onToggle
}) => Object(external_wp_element_["createElement"])(external_wp_components_["Button"], {
"aria-expanded": isOpen,
className: "edit-post-post-visibility__toggle",
onClick: onToggle,
isTertiary: true
}, Object(external_wp_element_["createElement"])(external_wp_editor_["PostVisibilityLabel"], null)),
renderContent: () => Object(external_wp_element_["createElement"])(external_wp_editor_["PostVisibility"], null)
}))
});
}
/* harmony default export */ var post_visibility = (PostVisibility);
// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/post-trash/index.js
/**
* WordPress dependencies
*/
function PostTrash() {
return Object(external_wp_element_["createElement"])(external_wp_editor_["PostTrashCheck"], null, Object(external_wp_element_["createElement"])(external_wp_components_["PanelRow"], null, Object(external_wp_element_["createElement"])(external_wp_editor_["PostTrash"], null)));
}
// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/post-schedule/index.js
/**
* WordPress dependencies
*/
function PostSchedule() {
const anchorRef = Object(external_wp_element_["useRef"])();
return Object(external_wp_element_["createElement"])(external_wp_editor_["PostScheduleCheck"], null, Object(external_wp_element_["createElement"])(external_wp_components_["PanelRow"], {
className: "edit-post-post-schedule",
ref: anchorRef
}, Object(external_wp_element_["createElement"])("span", null, Object(external_wp_i18n_["__"])('Publish')), Object(external_wp_element_["createElement"])(external_wp_components_["Dropdown"], {
popoverProps: {
anchorRef: anchorRef.current
},
position: "bottom left",
contentClassName: "edit-post-post-schedule__dialog",
renderToggle: ({
onToggle,
isOpen
}) => Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(external_wp_components_["Button"], {
className: "edit-post-post-schedule__toggle",
onClick: onToggle,
"aria-expanded": isOpen,
isTertiary: true
}, Object(external_wp_element_["createElement"])(external_wp_editor_["PostScheduleLabel"], null))),
renderContent: () => Object(external_wp_element_["createElement"])(external_wp_editor_["PostSchedule"], null)
})));
}
/* harmony default export */ var post_schedule = (PostSchedule);
// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/post-sticky/index.js
/**
* WordPress dependencies
*/
function PostSticky() {
return Object(external_wp_element_["createElement"])(external_wp_editor_["PostStickyCheck"], null, Object(external_wp_element_["createElement"])(external_wp_components_["PanelRow"], null, Object(external_wp_element_["createElement"])(external_wp_editor_["PostSticky"], null)));
}
/* harmony default export */ var post_sticky = (PostSticky);
// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/post-author/index.js
/**
* WordPress dependencies
*/
function PostAuthor() {
return Object(external_wp_element_["createElement"])(external_wp_editor_["PostAuthorCheck"], null, Object(external_wp_element_["createElement"])(external_wp_components_["PanelRow"], null, Object(external_wp_element_["createElement"])(external_wp_editor_["PostAuthor"], null)));
}
/* harmony default export */ var post_author = (PostAuthor);
// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/post-slug/index.js
/**
* WordPress dependencies
*/
function PostSlug() {
return Object(external_wp_element_["createElement"])(external_wp_editor_["PostSlugCheck"], null, Object(external_wp_element_["createElement"])(external_wp_components_["PanelRow"], null, Object(external_wp_element_["createElement"])(external_wp_editor_["PostSlug"], null)));
}
/* harmony default export */ var post_slug = (PostSlug);
// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/post-format/index.js
/**
* WordPress dependencies
*/
function PostFormat() {
return Object(external_wp_element_["createElement"])(external_wp_editor_["PostFormatCheck"], null, Object(external_wp_element_["createElement"])(external_wp_components_["PanelRow"], null, Object(external_wp_element_["createElement"])(external_wp_editor_["PostFormat"], null)));
}
/* harmony default export */ var post_format = (PostFormat);
// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/post-pending-status/index.js
/**
* WordPress dependencies
*/
function PostPendingStatus() {
return Object(external_wp_element_["createElement"])(external_wp_editor_["PostPendingStatusCheck"], null, Object(external_wp_element_["createElement"])(external_wp_components_["PanelRow"], null, Object(external_wp_element_["createElement"])(external_wp_editor_["PostPendingStatus"], null)));
}
/* harmony default export */ var post_pending_status = (PostPendingStatus);
// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/plugin-post-status-info/index.js
/**
* Defines as extensibility slot for the Status & visibility panel.
*/
/**
* WordPress dependencies
*/
const {
Fill: plugin_post_status_info_Fill,
Slot: plugin_post_status_info_Slot
} = Object(external_wp_components_["createSlotFill"])('PluginPostStatusInfo');
/**
* Renders a row in the Status & visibility panel of the Document sidebar.
* It should be noted that this is named and implemented around the function it serves
* and not its location, which may change in future iterations.
*
* @param {Object} props Component properties.
* @param {string} [props.className] An optional class name added to the row.
* @param {WPElement} props.children Children to be rendered.
*
* @example
* ```js
* // Using ES5 syntax
* var __ = wp.i18n.__;
* var PluginPostStatusInfo = wp.editPost.PluginPostStatusInfo;
*
* function MyPluginPostStatusInfo() {
* return wp.element.createElement(
* PluginPostStatusInfo,
* {
* className: 'my-plugin-post-status-info',
* },
* __( 'My post status info' )
* )
* }
* ```
*
* @example
* ```jsx
* // Using ESNext syntax
* import { __ } from '@wordpress/i18n';
* import { PluginPostStatusInfo } from '@wordpress/edit-post';
*
* const MyPluginPostStatusInfo = () => (
* <PluginPostStatusInfo
* className="my-plugin-post-status-info"
* >
* { __( 'My post status info' ) }
* </PluginPostStatusInfo>
* );
* ```
*
* @return {WPComponent} The component to be rendered.
*/
const PluginPostStatusInfo = ({
children,
className
}) => Object(external_wp_element_["createElement"])(plugin_post_status_info_Fill, null, Object(external_wp_element_["createElement"])(external_wp_components_["PanelRow"], {
className: className
}, children));
PluginPostStatusInfo.Slot = plugin_post_status_info_Slot;
/* harmony default export */ var plugin_post_status_info = (PluginPostStatusInfo);
// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/post-status/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* Module Constants
*/
const PANEL_NAME = 'post-status';
function PostStatus({
isOpened,
onTogglePanel
}) {
return Object(external_wp_element_["createElement"])(external_wp_components_["PanelBody"], {
className: "edit-post-post-status",
title: Object(external_wp_i18n_["__"])('Status & visibility'),
opened: isOpened,
onToggle: onTogglePanel
}, Object(external_wp_element_["createElement"])(plugin_post_status_info.Slot, null, fills => Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(post_visibility, null), Object(external_wp_element_["createElement"])(post_schedule, null), Object(external_wp_element_["createElement"])(post_format, null), Object(external_wp_element_["createElement"])(post_sticky, null), Object(external_wp_element_["createElement"])(post_pending_status, null), Object(external_wp_element_["createElement"])(post_slug, null), Object(external_wp_element_["createElement"])(post_author, null), fills, Object(external_wp_element_["createElement"])(PostTrash, null))));
}
/* harmony default export */ var post_status = (Object(external_wp_compose_["compose"])([Object(external_wp_data_["withSelect"])(select => {
// We use isEditorPanelRemoved to hide the panel if it was programatically removed. We do
// not use isEditorPanelEnabled since this panel should not be disabled through the UI.
const {
isEditorPanelRemoved,
isEditorPanelOpened
} = select(store["a" /* store */]);
return {
isRemoved: isEditorPanelRemoved(PANEL_NAME),
isOpened: isEditorPanelOpened(PANEL_NAME)
};
}), Object(external_wp_compose_["ifCondition"])(({
isRemoved
}) => !isRemoved), Object(external_wp_data_["withDispatch"])(dispatch => ({
onTogglePanel() {
return dispatch(store["a" /* store */]).toggleEditorPanelOpened(PANEL_NAME);
}
}))])(PostStatus));
// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/last-revision/index.js
/**
* WordPress dependencies
*/
function LastRevision() {
return Object(external_wp_element_["createElement"])(external_wp_editor_["PostLastRevisionCheck"], null, Object(external_wp_element_["createElement"])(external_wp_components_["PanelBody"], {
className: "edit-post-last-revision__panel"
}, Object(external_wp_element_["createElement"])(external_wp_editor_["PostLastRevision"], null)));
}
/* harmony default export */ var last_revision = (LastRevision);
// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/post-taxonomies/taxonomy-panel.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function TaxonomyPanel({
isEnabled,
taxonomy,
isOpened,
onTogglePanel,
children
}) {
if (!isEnabled) {
return null;
}
const taxonomyMenuName = Object(external_lodash_["get"])(taxonomy, ['labels', 'menu_name']);
if (!taxonomyMenuName) {
return null;
}
return Object(external_wp_element_["createElement"])(external_wp_components_["PanelBody"], {
title: taxonomyMenuName,
opened: isOpened,
onToggle: onTogglePanel
}, children);
}
/* harmony default export */ var taxonomy_panel = (Object(external_wp_compose_["compose"])(Object(external_wp_data_["withSelect"])((select, ownProps) => {
const slug = Object(external_lodash_["get"])(ownProps.taxonomy, ['slug']);
const panelName = slug ? `taxonomy-panel-${slug}` : '';
return {
panelName,
isEnabled: slug ? select(store["a" /* store */]).isEditorPanelEnabled(panelName) : false,
isOpened: slug ? select(store["a" /* store */]).isEditorPanelOpened(panelName) : false
};
}), Object(external_wp_data_["withDispatch"])((dispatch, ownProps) => ({
onTogglePanel: () => {
dispatch(store["a" /* store */]).toggleEditorPanelOpened(ownProps.panelName);
}
})))(TaxonomyPanel));
// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/post-taxonomies/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function PostTaxonomies() {
return Object(external_wp_element_["createElement"])(external_wp_editor_["PostTaxonomiesCheck"], null, Object(external_wp_element_["createElement"])(external_wp_editor_["PostTaxonomies"], {
taxonomyWrapper: (content, taxonomy) => {
return Object(external_wp_element_["createElement"])(taxonomy_panel, {
taxonomy: taxonomy
}, content);
}
}));
}
/* harmony default export */ var post_taxonomies = (PostTaxonomies);
// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/featured-image/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* Module Constants
*/
const featured_image_PANEL_NAME = 'featured-image';
function FeaturedImage({
isEnabled,
isOpened,
postType,
onTogglePanel
}) {
if (!isEnabled) {
return null;
}
return Object(external_wp_element_["createElement"])(external_wp_editor_["PostFeaturedImageCheck"], null, Object(external_wp_element_["createElement"])(external_wp_components_["PanelBody"], {
title: Object(external_lodash_["get"])(postType, ['labels', 'featured_image'], Object(external_wp_i18n_["__"])('Featured image')),
opened: isOpened,
onToggle: onTogglePanel
}, Object(external_wp_element_["createElement"])(external_wp_editor_["PostFeaturedImage"], null)));
}
const applyWithSelect = Object(external_wp_data_["withSelect"])(select => {
const {
getEditedPostAttribute
} = select('core/editor');
const {
getPostType
} = select('core');
const {
isEditorPanelEnabled,
isEditorPanelOpened
} = select(store["a" /* store */]);
return {
postType: getPostType(getEditedPostAttribute('type')),
isEnabled: isEditorPanelEnabled(featured_image_PANEL_NAME),
isOpened: isEditorPanelOpened(featured_image_PANEL_NAME)
};
});
const applyWithDispatch = Object(external_wp_data_["withDispatch"])(dispatch => {
const {
toggleEditorPanelOpened
} = dispatch(store["a" /* store */]);
return {
onTogglePanel: Object(external_lodash_["partial"])(toggleEditorPanelOpened, featured_image_PANEL_NAME)
};
});
/* harmony default export */ var featured_image = (Object(external_wp_compose_["compose"])(applyWithSelect, applyWithDispatch)(FeaturedImage));
// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/post-excerpt/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* Module Constants
*/
const post_excerpt_PANEL_NAME = 'post-excerpt';
function PostExcerpt({
isEnabled,
isOpened,
onTogglePanel
}) {
if (!isEnabled) {
return null;
}
return Object(external_wp_element_["createElement"])(external_wp_editor_["PostExcerptCheck"], null, Object(external_wp_element_["createElement"])(external_wp_components_["PanelBody"], {
title: Object(external_wp_i18n_["__"])('Excerpt'),
opened: isOpened,
onToggle: onTogglePanel
}, Object(external_wp_element_["createElement"])(external_wp_editor_["PostExcerpt"], null)));
}
/* harmony default export */ var post_excerpt = (Object(external_wp_compose_["compose"])([Object(external_wp_data_["withSelect"])(select => {
return {
isEnabled: select(store["a" /* store */]).isEditorPanelEnabled(post_excerpt_PANEL_NAME),
isOpened: select(store["a" /* store */]).isEditorPanelOpened(post_excerpt_PANEL_NAME)
};
}), Object(external_wp_data_["withDispatch"])(dispatch => ({
onTogglePanel() {
return dispatch(store["a" /* store */]).toggleEditorPanelOpened(post_excerpt_PANEL_NAME);
}
}))])(PostExcerpt));
// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/post-link/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* Module Constants
*/
const post_link_PANEL_NAME = 'post-link';
function PostLink({
isOpened,
onTogglePanel,
isEditable,
postLink,
permalinkPrefix,
permalinkSuffix,
editPermalink,
forceEmptyField,
setState,
postSlug,
postTypeLabel
}) {
let prefixElement, postNameElement, suffixElement;
if (isEditable) {
prefixElement = permalinkPrefix && Object(external_wp_element_["createElement"])("span", {
className: "edit-post-post-link__link-prefix"
}, permalinkPrefix);
postNameElement = postSlug && Object(external_wp_element_["createElement"])("span", {
className: "edit-post-post-link__link-post-name"
}, postSlug);
suffixElement = permalinkSuffix && Object(external_wp_element_["createElement"])("span", {
className: "edit-post-post-link__link-suffix"
}, permalinkSuffix);
}
return Object(external_wp_element_["createElement"])(external_wp_components_["PanelBody"], {
title: Object(external_wp_i18n_["__"])('Permalink'),
opened: isOpened,
onToggle: onTogglePanel
}, isEditable && Object(external_wp_element_["createElement"])("div", {
className: "editor-post-link"
}, Object(external_wp_element_["createElement"])(external_wp_components_["TextControl"], {
label: Object(external_wp_i18n_["__"])('URL Slug'),
value: forceEmptyField ? '' : postSlug,
onChange: newValue => {
editPermalink(newValue); // When we delete the field the permalink gets
// reverted to the original value.
// The forceEmptyField logic allows the user to have
// the field temporarily empty while typing.
if (!newValue) {
if (!forceEmptyField) {
setState({
forceEmptyField: true
});
}
return;
}
if (forceEmptyField) {
setState({
forceEmptyField: false
});
}
},
onBlur: event => {
editPermalink(Object(external_wp_editor_["cleanForSlug"])(event.target.value));
if (forceEmptyField) {
setState({
forceEmptyField: false
});
}
}
}), Object(external_wp_element_["createElement"])("p", null, Object(external_wp_i18n_["__"])('The last part of the URL.'), ' ', Object(external_wp_element_["createElement"])(external_wp_components_["ExternalLink"], {
href: "https://wordpress.org/support/article/writing-posts/#post-field-descriptions"
}, Object(external_wp_i18n_["__"])('Read about permalinks')))), Object(external_wp_element_["createElement"])("h3", {
className: "edit-post-post-link__preview-label"
}, postTypeLabel || Object(external_wp_i18n_["__"])('View post')), Object(external_wp_element_["createElement"])("div", {
className: "edit-post-post-link__preview-link-container"
}, Object(external_wp_element_["createElement"])(external_wp_components_["ExternalLink"], {
className: "edit-post-post-link__link",
href: postLink,
target: "_blank"
}, isEditable ? Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, prefixElement, postNameElement, suffixElement) : postLink)));
}
/* harmony default export */ var post_link = (Object(external_wp_compose_["compose"])([Object(external_wp_data_["withSelect"])(select => {
const {
isPermalinkEditable,
getCurrentPost,
isCurrentPostPublished,
getPermalinkParts,
getEditedPostAttribute,
getEditedPostSlug
} = select('core/editor');
const {
isEditorPanelEnabled,
isEditorPanelOpened
} = select(store["a" /* store */]);
const {
getPostType
} = select('core');
const {
link
} = getCurrentPost();
const postTypeName = getEditedPostAttribute('type');
const postType = getPostType(postTypeName);
const permalinkParts = getPermalinkParts();
return {
postLink: link,
isEditable: isPermalinkEditable(),
isPublished: isCurrentPostPublished(),
isOpened: isEditorPanelOpened(post_link_PANEL_NAME),
isEnabled: isEditorPanelEnabled(post_link_PANEL_NAME),
isViewable: Object(external_lodash_["get"])(postType, ['viewable'], false),
postSlug: Object(external_wp_url_["safeDecodeURIComponent"])(getEditedPostSlug()),
postTypeLabel: Object(external_lodash_["get"])(postType, ['labels', 'view_item']),
hasPermalinkParts: !!permalinkParts,
permalinkPrefix: permalinkParts === null || permalinkParts === void 0 ? void 0 : permalinkParts.prefix,
permalinkSuffix: permalinkParts === null || permalinkParts === void 0 ? void 0 : permalinkParts.suffix
};
}), Object(external_wp_compose_["ifCondition"])(({
isEnabled,
postLink,
isViewable,
hasPermalinkParts
}) => {
return isEnabled && postLink && isViewable && hasPermalinkParts;
}), Object(external_wp_data_["withDispatch"])(dispatch => {
const {
toggleEditorPanelOpened
} = dispatch(store["a" /* store */]);
const {
editPost
} = dispatch('core/editor');
return {
onTogglePanel: () => toggleEditorPanelOpened(post_link_PANEL_NAME),
editPermalink: newSlug => {
editPost({
slug: newSlug
});
}
};
}), Object(external_wp_compose_["withState"])({
forceEmptyField: false
})])(PostLink));
// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/discussion-panel/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* Module Constants
*/
const discussion_panel_PANEL_NAME = 'discussion-panel';
function DiscussionPanel({
isEnabled,
isOpened,
onTogglePanel
}) {
if (!isEnabled) {
return null;
}
return Object(external_wp_element_["createElement"])(external_wp_editor_["PostTypeSupportCheck"], {
supportKeys: ['comments', 'trackbacks']
}, Object(external_wp_element_["createElement"])(external_wp_components_["PanelBody"], {
title: Object(external_wp_i18n_["__"])('Discussion'),
opened: isOpened,
onToggle: onTogglePanel
}, Object(external_wp_element_["createElement"])(external_wp_editor_["PostTypeSupportCheck"], {
supportKeys: "comments"
}, Object(external_wp_element_["createElement"])(external_wp_components_["PanelRow"], null, Object(external_wp_element_["createElement"])(external_wp_editor_["PostComments"], null))), Object(external_wp_element_["createElement"])(external_wp_editor_["PostTypeSupportCheck"], {
supportKeys: "trackbacks"
}, Object(external_wp_element_["createElement"])(external_wp_components_["PanelRow"], null, Object(external_wp_element_["createElement"])(external_wp_editor_["PostPingbacks"], null)))));
}
/* harmony default export */ var discussion_panel = (Object(external_wp_compose_["compose"])([Object(external_wp_data_["withSelect"])(select => {
return {
isEnabled: select(store["a" /* store */]).isEditorPanelEnabled(discussion_panel_PANEL_NAME),
isOpened: select(store["a" /* store */]).isEditorPanelOpened(discussion_panel_PANEL_NAME)
};
}), Object(external_wp_data_["withDispatch"])(dispatch => ({
onTogglePanel() {
return dispatch(store["a" /* store */]).toggleEditorPanelOpened(discussion_panel_PANEL_NAME);
}
}))])(DiscussionPanel));
// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/page-attributes/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* Module Constants
*/
const page_attributes_PANEL_NAME = 'page-attributes';
function PageAttributes() {
const {
isEnabled,
isOpened,
postType
} = Object(external_wp_data_["useSelect"])(select => {
const {
getEditedPostAttribute
} = select(external_wp_editor_["store"]);
const {
isEditorPanelEnabled,
isEditorPanelOpened
} = select(store["a" /* store */]);
const {
getPostType
} = select(external_wp_coreData_["store"]);
return {
isEnabled: isEditorPanelEnabled(page_attributes_PANEL_NAME),
isOpened: isEditorPanelOpened(page_attributes_PANEL_NAME),
postType: getPostType(getEditedPostAttribute('type'))
};
}, []);
const {
toggleEditorPanelOpened
} = Object(external_wp_data_["useDispatch"])(store["a" /* store */]);
if (!isEnabled || !postType) {
return null;
}
const onTogglePanel = Object(external_lodash_["partial"])(toggleEditorPanelOpened, page_attributes_PANEL_NAME);
return Object(external_wp_element_["createElement"])(external_wp_editor_["PageAttributesCheck"], null, Object(external_wp_element_["createElement"])(external_wp_components_["PanelBody"], {
title: Object(external_lodash_["get"])(postType, ['labels', 'attributes'], Object(external_wp_i18n_["__"])('Page attributes')),
opened: isOpened,
onToggle: onTogglePanel
}, Object(external_wp_element_["createElement"])(external_wp_editor_["PageAttributesParent"], null), Object(external_wp_element_["createElement"])(external_wp_components_["PanelRow"], null, Object(external_wp_element_["createElement"])(external_wp_editor_["PageAttributesOrder"], null))));
}
/* harmony default export */ var page_attributes = (PageAttributes);
// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/meta-boxes/meta-boxes-area/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
class meta_boxes_area_MetaBoxesArea extends external_wp_element_["Component"] {
/**
* @inheritdoc
*/
constructor() {
super(...arguments);
this.bindContainerNode = this.bindContainerNode.bind(this);
}
/**
* @inheritdoc
*/
componentDidMount() {
this.form = document.querySelector('.metabox-location-' + this.props.location);
if (this.form) {
this.container.appendChild(this.form);
}
}
/**
* Get the meta box location form from the original location.
*/
componentWillUnmount() {
if (this.form) {
document.querySelector('#metaboxes').appendChild(this.form);
}
}
/**
* Binds the metabox area container node.
*
* @param {Element} node DOM Node.
*/
bindContainerNode(node) {
this.container = node;
}
/**
* @inheritdoc
*/
render() {
const {
location,
isSaving
} = this.props;
const classes = classnames_default()('edit-post-meta-boxes-area', `is-${location}`, {
'is-loading': isSaving
});
return Object(external_wp_element_["createElement"])("div", {
className: classes
}, isSaving && Object(external_wp_element_["createElement"])(external_wp_components_["Spinner"], null), Object(external_wp_element_["createElement"])("div", {
className: "edit-post-meta-boxes-area__container",
ref: this.bindContainerNode
}), Object(external_wp_element_["createElement"])("div", {
className: "edit-post-meta-boxes-area__clear"
}));
}
}
/* harmony default export */ var meta_boxes_area = (Object(external_wp_data_["withSelect"])(select => {
return {
isSaving: select(store["a" /* store */]).isSavingMetaBoxes()
};
})(meta_boxes_area_MetaBoxesArea));
// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/meta-boxes/meta-box-visibility.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
class meta_box_visibility_MetaBoxVisibility extends external_wp_element_["Component"] {
componentDidMount() {
this.updateDOM();
}
componentDidUpdate(prevProps) {
if (this.props.isVisible !== prevProps.isVisible) {
this.updateDOM();
}
}
updateDOM() {
const {
id,
isVisible
} = this.props;
const element = document.getElementById(id);
if (!element) {
return;
}
if (isVisible) {
element.classList.remove('is-hidden');
} else {
element.classList.add('is-hidden');
}
}
render() {
return null;
}
}
/* harmony default export */ var meta_box_visibility = (Object(external_wp_data_["withSelect"])((select, {
id
}) => ({
isVisible: select(store["a" /* store */]).isEditorPanelEnabled(`meta-box-${id}`)
}))(meta_box_visibility_MetaBoxVisibility));
// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/meta-boxes/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function MetaBoxes({
location,
isVisible,
metaBoxes
}) {
return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_lodash_["map"])(metaBoxes, ({
id
}) => Object(external_wp_element_["createElement"])(meta_box_visibility, {
key: id,
id: id
})), isVisible && Object(external_wp_element_["createElement"])(meta_boxes_area, {
location: location
}));
}
/* harmony default export */ var meta_boxes = (Object(external_wp_data_["withSelect"])((select, {
location
}) => {
const {
isMetaBoxLocationVisible,
getMetaBoxesPerLocation
} = select(store["a" /* store */]);
return {
metaBoxes: getMetaBoxesPerLocation(location),
isVisible: isMetaBoxLocationVisible(location)
};
})(MetaBoxes));
// EXTERNAL MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/plugin-document-setting-panel/index.js
var plugin_document_setting_panel = __webpack_require__("xrib");
// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/plugin-sidebar/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* Renders a sidebar when activated. The contents within the `PluginSidebar` will appear as content within the sidebar.
* It also automatically renders a corresponding `PluginSidebarMenuItem` component when `isPinnable` flag is set to `true`.
* If you wish to display the sidebar, you can with use the `PluginSidebarMoreMenuItem` component or the `wp.data.dispatch` API:
*
* ```js
* wp.data.dispatch( 'core/edit-post' ).openGeneralSidebar( 'plugin-name/sidebar-name' );
* ```
*
* @see PluginSidebarMoreMenuItem
*
* @param {Object} props Element props.
* @param {string} props.name A string identifying the sidebar. Must be unique for every sidebar registered within the scope of your plugin.
* @param {string} [props.className] An optional class name added to the sidebar body.
* @param {string} props.title Title displayed at the top of the sidebar.
* @param {boolean} [props.isPinnable=true] Whether to allow to pin sidebar to the toolbar. When set to `true` it also automatically renders a corresponding menu item.
* @param {WPBlockTypeIconRender} [props.icon=inherits from the plugin] The [Dashicon](https://developer.wordpress.org/resource/dashicons/) icon slug string, or an SVG WP element, to be rendered when the sidebar is pinned to toolbar.
*
* @example
* ```js
* // Using ES5 syntax
* var __ = wp.i18n.__;
* var el = wp.element.createElement;
* var PanelBody = wp.components.PanelBody;
* var PluginSidebar = wp.editPost.PluginSidebar;
* var moreIcon = wp.element.createElement( 'svg' ); //... svg element.
*
* function MyPluginSidebar() {
* return el(
* PluginSidebar,
* {
* name: 'my-sidebar',
* title: 'My sidebar title',
* icon: moreIcon,
* },
* el(
* PanelBody,
* {},
* __( 'My sidebar content' )
* )
* );
* }
* ```
*
* @example
* ```jsx
* // Using ESNext syntax
* import { __ } from '@wordpress/i18n';
* import { PanelBody } from '@wordpress/components';
* import { PluginSidebar } from '@wordpress/edit-post';
* import { more } from '@wordpress/icons';
*
* const MyPluginSidebar = () => (
* <PluginSidebar
* name="my-sidebar"
* title="My sidebar title"
* icon={ more }
* >
* <PanelBody>
* { __( 'My sidebar content' ) }
* </PanelBody>
* </PluginSidebar>
* );
* ```
*/
function PluginSidebarEditPost({
className,
...props
}) {
const {
postTitle,
shortcut,
showIconLabels
} = Object(external_wp_data_["useSelect"])(select => {
return {
postTitle: select('core/editor').getEditedPostAttribute('title'),
shortcut: select(external_wp_keyboardShortcuts_["store"]).getShortcutRepresentation('core/edit-post/toggle-sidebar'),
showIconLabels: select(store["a" /* store */]).isFeatureActive('showIconLabels')
};
});
return Object(external_wp_element_["createElement"])(build_module["b" /* ComplementaryArea */], Object(esm_extends["a" /* default */])({
panelClassName: className,
className: "edit-post-sidebar",
smallScreenTitle: postTitle || Object(external_wp_i18n_["__"])('(no title)'),
scope: "core/edit-post",
toggleShortcut: shortcut,
showIconLabels: showIconLabels
}, props));
}
// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/template/actions.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function PostTemplateActions() {
const [isModalOpen, setIsModalOpen] = Object(external_wp_element_["useState"])(false);
const [title, setTitle] = Object(external_wp_element_["useState"])('');
const {
template,
supportsTemplateMode,
defaultTemplate
} = Object(external_wp_data_["useSelect"])(select => {
var _getPostType$viewable, _getPostType;
const {
getCurrentPostType,
getEditorSettings
} = select(external_wp_editor_["store"]);
const {
getPostType
} = select(external_wp_coreData_["store"]);
const {
getEditedPostTemplate
} = select(store["a" /* store */]);
const isViewable = (_getPostType$viewable = (_getPostType = getPostType(getCurrentPostType())) === null || _getPostType === void 0 ? void 0 : _getPostType.viewable) !== null && _getPostType$viewable !== void 0 ? _getPostType$viewable : false;
const _supportsTemplateMode = getEditorSettings().supportsTemplateMode && isViewable;
return {
template: _supportsTemplateMode && getEditedPostTemplate(),
supportsTemplateMode: _supportsTemplateMode,
defaultTemplate: getEditorSettings().defaultBlockTemplate
};
}, []);
const {
__unstableSwitchToTemplateMode
} = Object(external_wp_data_["useDispatch"])(store["a" /* store */]);
if (!supportsTemplateMode) {
return null;
}
const defaultTitle = Object(external_wp_i18n_["__"])('Custom Template');
return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])("div", {
className: "edit-post-template__actions"
}, !!template && Object(external_wp_element_["createElement"])(external_wp_components_["Button"], {
isLink: true,
onClick: () => __unstableSwitchToTemplateMode()
}, Object(external_wp_i18n_["__"])('Edit')), Object(external_wp_element_["createElement"])(external_wp_components_["Button"], {
isLink: true,
onClick: () => setIsModalOpen(true)
}, Object(external_wp_i18n_["__"])('New'))), isModalOpen && Object(external_wp_element_["createElement"])(external_wp_components_["Modal"], {
title: Object(external_wp_i18n_["__"])('Create custom template'),
closeLabel: Object(external_wp_i18n_["__"])('Close'),
onRequestClose: () => {
setIsModalOpen(false);
setTitle('');
},
overlayClassName: "edit-post-template__modal"
}, Object(external_wp_element_["createElement"])("form", {
onSubmit: event => {
event.preventDefault();
const newTemplateContent = defaultTemplate !== null && defaultTemplate !== void 0 ? defaultTemplate : Object(external_wp_blocks_["serialize"])([Object(external_wp_blocks_["createBlock"])('core/group', {
tagName: 'header',
layout: {
inherit: true
}
}, [Object(external_wp_blocks_["createBlock"])('core/site-title'), Object(external_wp_blocks_["createBlock"])('core/site-tagline')]), Object(external_wp_blocks_["createBlock"])('core/separator'), Object(external_wp_blocks_["createBlock"])('core/group', {
tagName: 'main'
}, [Object(external_wp_blocks_["createBlock"])('core/group', {
layout: {
inherit: true
}
}, [Object(external_wp_blocks_["createBlock"])('core/post-title')]), Object(external_wp_blocks_["createBlock"])('core/post-content', {
layout: {
inherit: true
}
})])]);
__unstableSwitchToTemplateMode({
slug: 'wp-custom-template-' + Object(external_lodash_["kebabCase"])(title || defaultTitle),
content: newTemplateContent,
title: title || defaultTitle
});
setIsModalOpen(false);
}
}, Object(external_wp_element_["createElement"])(external_wp_components_["Flex"], {
align: "flex-start",
gap: 8
}, Object(external_wp_element_["createElement"])(external_wp_components_["FlexItem"], null, Object(external_wp_element_["createElement"])(external_wp_components_["TextControl"], {
label: Object(external_wp_i18n_["__"])('Name'),
value: title,
onChange: setTitle,
placeholder: defaultTitle,
help: Object(external_wp_i18n_["__"])('Describe the purpose of the template, e.g. "Full Width". Custom templates can be applied to any post or page.')
}))), Object(external_wp_element_["createElement"])(external_wp_components_["Flex"], {
className: "edit-post-template__modal-actions",
justify: "flex-end",
expanded: false
}, Object(external_wp_element_["createElement"])(external_wp_components_["FlexItem"], null, Object(external_wp_element_["createElement"])(external_wp_components_["Button"], {
isTertiary: true,
onClick: () => {
setIsModalOpen(false);
setTitle('');
}
}, Object(external_wp_i18n_["__"])('Cancel'))), Object(external_wp_element_["createElement"])(external_wp_components_["FlexItem"], null, Object(external_wp_element_["createElement"])(external_wp_components_["Button"], {
isPrimary: true,
type: "submit"
}, Object(external_wp_i18n_["__"])('Create')))))));
}
/* harmony default export */ var actions = (PostTemplateActions);
// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/template/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* Module Constants
*/
const template_PANEL_NAME = 'template';
function TemplatePanel() {
const {
isEnabled,
isOpened,
selectedTemplate,
availableTemplates,
fetchedTemplates,
isViewable,
template,
supportsTemplateMode
} = Object(external_wp_data_["useSelect"])(select => {
var _getPostType$viewable, _getPostType;
const {
isEditorPanelEnabled,
isEditorPanelOpened,
getEditedPostTemplate
} = select(store["a" /* store */]);
const {
getEditedPostAttribute,
getEditorSettings,
getCurrentPostType
} = select(external_wp_editor_["store"]);
const {
getPostType,
getEntityRecords
} = select(external_wp_coreData_["store"]);
const _isViewable = (_getPostType$viewable = (_getPostType = getPostType(getCurrentPostType())) === null || _getPostType === void 0 ? void 0 : _getPostType.viewable) !== null && _getPostType$viewable !== void 0 ? _getPostType$viewable : false;
const _supportsTemplateMode = select(external_wp_editor_["store"]).getEditorSettings().supportsTemplateMode && _isViewable;
const wpTemplates = getEntityRecords('postType', 'wp_template', {
per_page: -1
});
const newAvailableTemplates = Object(external_lodash_["fromPairs"])((wpTemplates || []).map(({
slug,
title
}) => [slug, title.rendered]));
return {
isEnabled: isEditorPanelEnabled(template_PANEL_NAME),
isOpened: isEditorPanelOpened(template_PANEL_NAME),
selectedTemplate: getEditedPostAttribute('template'),
availableTemplates: getEditorSettings().availableTemplates,
fetchedTemplates: newAvailableTemplates,
template: _supportsTemplateMode && getEditedPostTemplate(),
isViewable: _isViewable,
supportsTemplateMode: _supportsTemplateMode
};
}, []);
const templates = Object(external_wp_element_["useMemo"])(() => {
return { ...availableTemplates,
...fetchedTemplates
};
}, [availableTemplates, fetchedTemplates]);
const {
toggleEditorPanelOpened
} = Object(external_wp_data_["useDispatch"])(store["a" /* store */]);
const {
editPost
} = Object(external_wp_data_["useDispatch"])(external_wp_editor_["store"]);
if (!isEnabled || !isViewable || Object(external_lodash_["isEmpty"])(availableTemplates) && !supportsTemplateMode) {
return null;
}
const onTogglePanel = Object(external_lodash_["partial"])(toggleEditorPanelOpened, template_PANEL_NAME);
let panelTitle = Object(external_wp_i18n_["__"])('Template');
if (!!template) {
var _template$title;
panelTitle = Object(external_wp_i18n_["sprintf"])(
/* translators: %s: template title */
Object(external_wp_i18n_["__"])('Template: %s'), (_template$title = template === null || template === void 0 ? void 0 : template.title) !== null && _template$title !== void 0 ? _template$title : template.slug);
}
return Object(external_wp_element_["createElement"])(external_wp_components_["PanelBody"], {
title: panelTitle,
opened: isOpened,
onToggle: onTogglePanel
}, Object(external_wp_element_["createElement"])(external_wp_components_["SelectControl"], {
hideLabelFromVision: true,
label: Object(external_wp_i18n_["__"])('Template:'),
value: Object.keys(templates).includes(selectedTemplate) ? selectedTemplate : '',
onChange: templateSlug => {
editPost({
template: templateSlug || ''
});
},
options: Object(external_lodash_["map"])(templates, (templateName, templateSlug) => ({
value: templateSlug,
label: templateName
}))
}), Object(external_wp_element_["createElement"])(actions, null));
}
/* harmony default export */ var sidebar_template = (TemplatePanel);
// EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/icon/index.js
var build_module_icon = __webpack_require__("iClF");
// EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/layout.js
var library_layout = __webpack_require__("Civd");
// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/template-summary/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function TemplateSummary() {
const template = Object(external_wp_data_["useSelect"])(select => {
const {
getEditedPostTemplate
} = select(store["a" /* store */]);
return getEditedPostTemplate();
}, []);
if (!template) {
return null;
}
return Object(external_wp_element_["createElement"])(external_wp_components_["PanelBody"], null, Object(external_wp_element_["createElement"])(external_wp_components_["Flex"], {
align: "flex-start"
}, Object(external_wp_element_["createElement"])(external_wp_components_["FlexItem"], null, Object(external_wp_element_["createElement"])(build_module_icon["a" /* default */], {
icon: library_layout["a" /* default */]
})), Object(external_wp_element_["createElement"])(external_wp_components_["FlexBlock"], null, Object(external_wp_element_["createElement"])("h2", {
className: "edit-post-template-summary__title"
}, (template === null || template === void 0 ? void 0 : template.title) || (template === null || template === void 0 ? void 0 : template.slug)), Object(external_wp_element_["createElement"])("p", null, template === null || template === void 0 ? void 0 : template.description))));
}
/* harmony default export */ var template_summary = (TemplateSummary);
// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/settings-sidebar/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const SIDEBAR_ACTIVE_BY_DEFAULT = external_wp_element_["Platform"].select({
web: true,
native: false
});
const SettingsSidebar = () => {
const {
sidebarName,
keyboardShortcut,
isTemplateMode
} = Object(external_wp_data_["useSelect"])(select => {
// The settings sidebar is used by the edit-post/document and edit-post/block sidebars.
// sidebarName represents the sidebar that is active or that should be active when the SettingsSidebar toggle button is pressed.
// If one of the two sidebars is active the component will contain the content of that sidebar.
// When neither of the the two sidebars is active we can not simply return null, because the PluginSidebarEditPost
// component, besides being used to render the sidebar, also renders the toggle button. In that case sidebarName
// should contain the sidebar that will be active when the toggle button is pressed. If a block
// is selected, that should be edit-post/block otherwise it's edit-post/document.
let sidebar = select(build_module["g" /* store */]).getActiveComplementaryArea(store["a" /* store */].name);
if (!['edit-post/document', 'edit-post/block'].includes(sidebar)) {
if (select(external_wp_blockEditor_["store"]).getBlockSelectionStart()) {
sidebar = 'edit-post/block';
}
sidebar = 'edit-post/document';
}
const shortcut = select(external_wp_keyboardShortcuts_["store"]).getShortcutRepresentation('core/edit-post/toggle-sidebar');
return {
sidebarName: sidebar,
keyboardShortcut: shortcut,
isTemplateMode: select(store["a" /* store */]).isEditingTemplate()
};
}, []);
return Object(external_wp_element_["createElement"])(PluginSidebarEditPost, {
identifier: sidebarName,
header: Object(external_wp_element_["createElement"])(settings_header, {
sidebarName: sidebarName
}),
closeLabel: Object(external_wp_i18n_["__"])('Close settings'),
headerClassName: "edit-post-sidebar__panel-tabs"
/* translators: button label text should, if possible, be under 16 characters. */
,
title: Object(external_wp_i18n_["__"])('Settings'),
toggleShortcut: keyboardShortcut,
icon: cog["a" /* default */],
isActiveByDefault: SIDEBAR_ACTIVE_BY_DEFAULT
}, !isTemplateMode && sidebarName === 'edit-post/document' && Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(post_status, null), Object(external_wp_element_["createElement"])(sidebar_template, null), Object(external_wp_element_["createElement"])(plugin_document_setting_panel["a" /* default */].Slot, null), Object(external_wp_element_["createElement"])(last_revision, null), Object(external_wp_element_["createElement"])(post_link, null), Object(external_wp_element_["createElement"])(post_taxonomies, null), Object(external_wp_element_["createElement"])(featured_image, null), Object(external_wp_element_["createElement"])(post_excerpt, null), Object(external_wp_element_["createElement"])(discussion_panel, null), Object(external_wp_element_["createElement"])(page_attributes, null), Object(external_wp_element_["createElement"])(meta_boxes, {
location: "side"
})), isTemplateMode && sidebarName === 'edit-post/document' && Object(external_wp_element_["createElement"])(template_summary, null), sidebarName === 'edit-post/block' && Object(external_wp_element_["createElement"])(external_wp_blockEditor_["BlockInspector"], null));
};
/* harmony default export */ var settings_sidebar = (SettingsSidebar);
// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/welcome-guide/image.js
function WelcomeGuideImage({
nonAnimatedSrc,
animatedSrc
}) {
return Object(external_wp_element_["createElement"])("picture", {
className: "edit-post-welcome-guide__image"
}, Object(external_wp_element_["createElement"])("source", {
srcSet: nonAnimatedSrc,
media: "(prefers-reduced-motion: reduce)"
}), Object(external_wp_element_["createElement"])("img", {
src: animatedSrc,
width: "312",
height: "240",
alt: ""
}));
}
// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/welcome-guide/default.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function WelcomeGuideDefault() {
const {
toggleFeature
} = Object(external_wp_data_["useDispatch"])(store["a" /* store */]);
return Object(external_wp_element_["createElement"])(external_wp_components_["Guide"], {
className: "edit-post-welcome-guide",
contentLabel: Object(external_wp_i18n_["__"])('Welcome to the block editor'),
finishButtonText: Object(external_wp_i18n_["__"])('Get started'),
onFinish: () => toggleFeature('welcomeGuide'),
pages: [{
image: Object(external_wp_element_["createElement"])(WelcomeGuideImage, {
nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-canvas.svg",
animatedSrc: "https://s.w.org/images/block-editor/welcome-canvas.gif"
}),
content: Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])("h1", {
className: "edit-post-welcome-guide__heading"
}, Object(external_wp_i18n_["__"])('Welcome to the block editor')), Object(external_wp_element_["createElement"])("p", {
className: "edit-post-welcome-guide__text"
}, Object(external_wp_i18n_["__"])('In the WordPress editor, each paragraph, image, or video is presented as a distinct “block” of content.')))
}, {
image: Object(external_wp_element_["createElement"])(WelcomeGuideImage, {
nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-editor.svg",
animatedSrc: "https://s.w.org/images/block-editor/welcome-editor.gif"
}),
content: Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])("h1", {
className: "edit-post-welcome-guide__heading"
}, Object(external_wp_i18n_["__"])('Make each block your own')), Object(external_wp_element_["createElement"])("p", {
className: "edit-post-welcome-guide__text"
}, Object(external_wp_i18n_["__"])('Each block comes with its own set of controls for changing things like color, width, and alignment. These will show and hide automatically when you have a block selected.')))
}, {
image: Object(external_wp_element_["createElement"])(WelcomeGuideImage, {
nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-library.svg",
animatedSrc: "https://s.w.org/images/block-editor/welcome-library.gif"
}),
content: Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])("h1", {
className: "edit-post-welcome-guide__heading"
}, Object(external_wp_i18n_["__"])('Get to know the block library')), Object(external_wp_element_["createElement"])("p", {
className: "edit-post-welcome-guide__text"
}, Object(external_wp_element_["createInterpolateElement"])(Object(external_wp_i18n_["__"])('All of the blocks available to you live in the block library. Youll find it wherever you see the <InserterIconImage /> icon.'), {
InserterIconImage: Object(external_wp_element_["createElement"])("img", {
alt: Object(external_wp_i18n_["__"])('inserter'),
src: "data:image/svg+xml,%3Csvg width='18' height='18' viewBox='0 0 18 18' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Crect width='18' height='18' rx='2' fill='%231E1E1E'/%3E%3Cpath d='M9.22727 4V14M4 8.77273H14' stroke='white' stroke-width='1.5'/%3E%3C/svg%3E%0A"
})
})))
}, {
image: Object(external_wp_element_["createElement"])(WelcomeGuideImage, {
nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-documentation.svg",
animatedSrc: "https://s.w.org/images/block-editor/welcome-documentation.gif"
}),
content: Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])("h1", {
className: "edit-post-welcome-guide__heading"
}, Object(external_wp_i18n_["__"])('Learn how to use the block editor')), Object(external_wp_element_["createElement"])("p", {
className: "edit-post-welcome-guide__text"
}, Object(external_wp_i18n_["__"])('New to the block editor? Want to learn more about using it? '), Object(external_wp_element_["createElement"])(external_wp_components_["ExternalLink"], {
href: Object(external_wp_i18n_["__"])('https://wordpress.org/support/article/wordpress-editor/')
}, Object(external_wp_i18n_["__"])("Here's a detailed guide."))))
}]
});
}
// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/welcome-guide/template.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function WelcomeGuideTemplate() {
const {
toggleFeature
} = Object(external_wp_data_["useDispatch"])(store["a" /* store */]);
return Object(external_wp_element_["createElement"])(external_wp_components_["Guide"], {
className: "edit-post-welcome-guide",
contentLabel: Object(external_wp_i18n_["__"])('Welcome to the template editor'),
finishButtonText: Object(external_wp_i18n_["__"])('Get started'),
onFinish: () => toggleFeature('welcomeGuideTemplate'),
pages: [{
image: Object(external_wp_element_["createElement"])(WelcomeGuideImage, {
nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-template-editor.svg",
animatedSrc: "https://s.w.org/images/block-editor/welcome-template-editor.gif"
}),
content: Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])("h1", {
className: "edit-post-welcome-guide__heading"
}, Object(external_wp_i18n_["__"])('Welcome to the template editor')), Object(external_wp_element_["createElement"])("p", {
className: "edit-post-welcome-guide__text"
}, Object(external_wp_i18n_["__"])('Templates express the layout of the site. Customize all aspects of your posts and pages using the tools of blocks and patterns.')))
}]
});
}
// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/welcome-guide/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function WelcomeGuide() {
const {
isActive,
isTemplateMode
} = Object(external_wp_data_["useSelect"])(select => {
const {
isFeatureActive,
isEditingTemplate
} = select(store["a" /* store */]);
const _isTemplateMode = isEditingTemplate();
const feature = _isTemplateMode ? 'welcomeGuideTemplate' : 'welcomeGuide';
return {
isActive: isFeatureActive(feature),
isTemplateMode: _isTemplateMode
};
}, []);
if (!isActive) {
return null;
}
return isTemplateMode ? Object(external_wp_element_["createElement"])(WelcomeGuideTemplate, null) : Object(external_wp_element_["createElement"])(WelcomeGuideDefault, null);
}
// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/plugin-post-publish-panel/index.js
/**
* WordPress dependencies
*/
const {
Fill: plugin_post_publish_panel_Fill,
Slot: plugin_post_publish_panel_Slot
} = Object(external_wp_components_["createSlotFill"])('PluginPostPublishPanel');
const PluginPostPublishPanelFill = ({
children,
className,
title,
initialOpen = false,
icon
}) => Object(external_wp_element_["createElement"])(plugin_post_publish_panel_Fill, null, Object(external_wp_element_["createElement"])(external_wp_components_["PanelBody"], {
className: className,
initialOpen: initialOpen || !title,
title: title,
icon: icon
}, children));
/**
* Renders provided content to the post-publish panel in the publish flow
* (side panel that opens after a user publishes the post).
*
* @param {Object} props Component properties.
* @param {string} [props.className] An optional class name added to the panel.
* @param {string} [props.title] Title displayed at the top of the panel.
* @param {boolean} [props.initialOpen=false] Whether to have the panel initially opened. When no title is provided it is always opened.
* @param {WPBlockTypeIconRender} [props.icon=inherits from the plugin] The [Dashicon](https://developer.wordpress.org/resource/dashicons/) icon slug string, or an SVG WP element, to be rendered when the sidebar is pinned to toolbar.
*
* @example
* ```js
* // Using ES5 syntax
* var __ = wp.i18n.__;
* var PluginPostPublishPanel = wp.editPost.PluginPostPublishPanel;
*
* function MyPluginPostPublishPanel() {
* return wp.element.createElement(
* PluginPostPublishPanel,
* {
* className: 'my-plugin-post-publish-panel',
* title: __( 'My panel title' ),
* initialOpen: true,
* },
* __( 'My panel content' )
* );
* }
* ```
*
* @example
* ```jsx
* // Using ESNext syntax
* import { __ } from '@wordpress/i18n';
* import { PluginPostPublishPanel } from '@wordpress/edit-post';
*
* const MyPluginPostPublishPanel = () => (
* <PluginPostPublishPanel
* className="my-plugin-post-publish-panel"
* title={ __( 'My panel title' ) }
* initialOpen={ true }
* >
* { __( 'My panel content' ) }
* </PluginPostPublishPanel>
* );
* ```
*
* @return {WPComponent} The component to be rendered.
*/
const PluginPostPublishPanel = Object(external_wp_compose_["compose"])(Object(external_wp_plugins_["withPluginContext"])((context, ownProps) => {
return {
icon: ownProps.icon || context.icon
};
}))(PluginPostPublishPanelFill);
PluginPostPublishPanel.Slot = plugin_post_publish_panel_Slot;
/* harmony default export */ var plugin_post_publish_panel = (PluginPostPublishPanel);
// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/plugin-pre-publish-panel/index.js
/**
* WordPress dependencies
*/
const {
Fill: plugin_pre_publish_panel_Fill,
Slot: plugin_pre_publish_panel_Slot
} = Object(external_wp_components_["createSlotFill"])('PluginPrePublishPanel');
const PluginPrePublishPanelFill = ({
children,
className,
title,
initialOpen = false,
icon
}) => Object(external_wp_element_["createElement"])(plugin_pre_publish_panel_Fill, null, Object(external_wp_element_["createElement"])(external_wp_components_["PanelBody"], {
className: className,
initialOpen: initialOpen || !title,
title: title,
icon: icon
}, children));
/**
* Renders provided content to the pre-publish side panel in the publish flow
* (side panel that opens when a user first pushes "Publish" from the main editor).
*
* @param {Object} props Component props.
* @param {string} [props.className] An optional class name added to the panel.
* @param {string} [props.title] Title displayed at the top of the panel.
* @param {boolean} [props.initialOpen=false] Whether to have the panel initially opened.
* When no title is provided it is always opened.
* @param {WPBlockTypeIconRender} [props.icon=inherits from the plugin] The [Dashicon](https://developer.wordpress.org/resource/dashicons/)
* icon slug string, or an SVG WP element, to be rendered when
* the sidebar is pinned to toolbar.
*
* @example
* ```js
* // Using ES5 syntax
* var __ = wp.i18n.__;
* var PluginPrePublishPanel = wp.editPost.PluginPrePublishPanel;
*
* function MyPluginPrePublishPanel() {
* return wp.element.createElement(
* PluginPrePublishPanel,
* {
* className: 'my-plugin-pre-publish-panel',
* title: __( 'My panel title' ),
* initialOpen: true,
* },
* __( 'My panel content' )
* );
* }
* ```
*
* @example
* ```jsx
* // Using ESNext syntax
* import { __ } from '@wordpress/i18n';
* import { PluginPrePublishPanel } from '@wordpress/edit-post';
*
* const MyPluginPrePublishPanel = () => (
* <PluginPrePublishPanel
* className="my-plugin-pre-publish-panel"
* title={ __( 'My panel title' ) }
* initialOpen={ true }
* >
* { __( 'My panel content' ) }
* </PluginPrePublishPanel>
* );
* ```
*
* @return {WPComponent} The component to be rendered.
*/
const PluginPrePublishPanel = Object(external_wp_compose_["compose"])(Object(external_wp_plugins_["withPluginContext"])((context, ownProps) => {
return {
icon: ownProps.icon || context.icon
};
}))(PluginPrePublishPanelFill);
PluginPrePublishPanel.Slot = plugin_pre_publish_panel_Slot;
/* harmony default export */ var plugin_pre_publish_panel = (PluginPrePublishPanel);
// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/layout/actions-panel.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const {
Fill: actions_panel_Fill,
Slot: actions_panel_Slot
} = Object(external_wp_components_["createSlotFill"])('ActionsPanel');
const ActionsPanelFill = actions_panel_Fill;
function ActionsPanel({
setEntitiesSavedStatesCallback,
closeEntitiesSavedStates,
isEntitiesSavedStatesOpen
}) {
const {
closePublishSidebar,
togglePublishSidebar
} = Object(external_wp_data_["useDispatch"])(store["a" /* store */]);
const {
publishSidebarOpened,
hasActiveMetaboxes,
isSavingMetaBoxes,
hasNonPostEntityChanges
} = Object(external_wp_data_["useSelect"])(select => {
return {
publishSidebarOpened: select(store["a" /* store */]).isPublishSidebarOpened(),
hasActiveMetaboxes: select(store["a" /* store */]).hasMetaBoxes(),
isSavingMetaBoxes: select(store["a" /* store */]).isSavingMetaBoxes(),
hasNonPostEntityChanges: select('core/editor').hasNonPostEntityChanges()
};
}, []);
const openEntitiesSavedStates = Object(external_wp_element_["useCallback"])(() => setEntitiesSavedStatesCallback(true), []); // It is ok for these components to be unmounted when not in visual use.
// We don't want more than one present at a time, decide which to render.
let unmountableContent;
if (publishSidebarOpened) {
unmountableContent = Object(external_wp_element_["createElement"])(external_wp_editor_["PostPublishPanel"], {
onClose: closePublishSidebar,
forceIsDirty: hasActiveMetaboxes,
forceIsSaving: isSavingMetaBoxes,
PrePublishExtension: plugin_pre_publish_panel.Slot,
PostPublishExtension: plugin_post_publish_panel.Slot
});
} else if (hasNonPostEntityChanges) {
unmountableContent = Object(external_wp_element_["createElement"])("div", {
className: "edit-post-layout__toggle-entities-saved-states-panel"
}, Object(external_wp_element_["createElement"])(external_wp_components_["Button"], {
isSecondary: true,
className: "edit-post-layout__toggle-entities-saved-states-panel-button",
onClick: openEntitiesSavedStates,
"aria-expanded": false
}, Object(external_wp_i18n_["__"])('Open save panel')));
} else {
unmountableContent = Object(external_wp_element_["createElement"])("div", {
className: "edit-post-layout__toggle-publish-panel"
}, Object(external_wp_element_["createElement"])(external_wp_components_["Button"], {
isSecondary: true,
className: "edit-post-layout__toggle-publish-panel-button",
onClick: togglePublishSidebar,
"aria-expanded": false
}, Object(external_wp_i18n_["__"])('Open publish panel')));
} // Since EntitiesSavedStates controls its own panel, we can keep it
// always mounted to retain its own component state (such as checkboxes).
return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, isEntitiesSavedStatesOpen && Object(external_wp_element_["createElement"])(external_wp_editor_["EntitiesSavedStates"], {
close: closeEntitiesSavedStates
}), Object(external_wp_element_["createElement"])(actions_panel_Slot, {
bubblesVirtually: true
}), !isEntitiesSavedStatesOpen && unmountableContent);
}
// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/layout/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const interfaceLabels = {
secondarySidebar: Object(external_wp_i18n_["__"])('Block library'),
/* translators: accessibility text for the editor top bar landmark region. */
header: Object(external_wp_i18n_["__"])('Editor top bar'),
/* translators: accessibility text for the editor content landmark region. */
body: Object(external_wp_i18n_["__"])('Editor content'),
/* translators: accessibility text for the editor settings landmark region. */
sidebar: Object(external_wp_i18n_["__"])('Editor settings'),
/* translators: accessibility text for the editor publish landmark region. */
actions: Object(external_wp_i18n_["__"])('Editor publish'),
/* translators: accessibility text for the editor footer landmark region. */
footer: Object(external_wp_i18n_["__"])('Editor footer')
};
function Layout({
styles
}) {
const isMobileViewport = Object(external_wp_compose_["useViewportMatch"])('medium', '<');
const isHugeViewport = Object(external_wp_compose_["useViewportMatch"])('huge', '>=');
const {
openGeneralSidebar,
closeGeneralSidebar,
setIsInserterOpened
} = Object(external_wp_data_["useDispatch"])(store["a" /* store */]);
const {
mode,
isFullscreenActive,
isRichEditingEnabled,
sidebarIsOpened,
hasActiveMetaboxes,
hasFixedToolbar,
previousShortcut,
nextShortcut,
hasBlockSelected,
isInserterOpened,
isListViewOpened,
showIconLabels,
hasReducedUI,
showBlockBreadcrumbs,
isTemplateMode
} = Object(external_wp_data_["useSelect"])(select => {
const editorSettings = select(external_wp_editor_["store"]).getEditorSettings();
return {
isTemplateMode: select(store["a" /* store */]).isEditingTemplate(),
hasFixedToolbar: select(store["a" /* store */]).isFeatureActive('fixedToolbar'),
sidebarIsOpened: !!(select(build_module["g" /* store */]).getActiveComplementaryArea(store["a" /* store */].name) || select(store["a" /* store */]).isPublishSidebarOpened()),
isFullscreenActive: select(store["a" /* store */]).isFeatureActive('fullscreenMode'),
isInserterOpened: select(store["a" /* store */]).isInserterOpened(),
isListViewOpened: select(store["a" /* store */]).isListViewOpened(),
mode: select(store["a" /* store */]).getEditorMode(),
isRichEditingEnabled: editorSettings.richEditingEnabled,
hasActiveMetaboxes: select(store["a" /* store */]).hasMetaBoxes(),
previousShortcut: select(external_wp_keyboardShortcuts_["store"]).getAllShortcutRawKeyCombinations('core/edit-post/previous-region'),
nextShortcut: select(external_wp_keyboardShortcuts_["store"]).getAllShortcutRawKeyCombinations('core/edit-post/next-region'),
showIconLabels: select(store["a" /* store */]).isFeatureActive('showIconLabels'),
hasReducedUI: select(store["a" /* store */]).isFeatureActive('reducedUI'),
showBlockBreadcrumbs: select(store["a" /* store */]).isFeatureActive('showBlockBreadcrumbs')
};
}, []);
const className = classnames_default()('edit-post-layout', 'is-mode-' + mode, {
'is-sidebar-opened': sidebarIsOpened,
'has-fixed-toolbar': hasFixedToolbar,
'has-metaboxes': hasActiveMetaboxes,
'show-icon-labels': showIconLabels
});
const openSidebarPanel = () => openGeneralSidebar(hasBlockSelected ? 'edit-post/block' : 'edit-post/document'); // Inserter and Sidebars are mutually exclusive
Object(external_wp_element_["useEffect"])(() => {
if (sidebarIsOpened && !isHugeViewport) {
setIsInserterOpened(false);
}
}, [sidebarIsOpened, isHugeViewport]);
Object(external_wp_element_["useEffect"])(() => {
if (isInserterOpened && !isHugeViewport) {
closeGeneralSidebar();
}
}, [isInserterOpened, isHugeViewport]); // Local state for save panel.
// Note 'truthy' callback implies an open panel.
const [entitiesSavedStatesCallback, setEntitiesSavedStatesCallback] = Object(external_wp_element_["useState"])(false);
const closeEntitiesSavedStates = Object(external_wp_element_["useCallback"])(arg => {
if (typeof entitiesSavedStatesCallback === 'function') {
entitiesSavedStatesCallback(arg);
}
setEntitiesSavedStatesCallback(false);
}, [entitiesSavedStatesCallback]);
const secondarySidebar = () => {
if (mode === 'visual' && isInserterOpened) {
return Object(external_wp_element_["createElement"])(InserterSidebar, null);
}
if (mode === 'visual' && isListViewOpened) {
return Object(external_wp_element_["createElement"])(external_wp_data_["AsyncModeProvider"], {
value: "true"
}, Object(external_wp_element_["createElement"])(ListViewSidebar, null));
}
return null;
};
return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(build_module["d" /* FullscreenMode */], {
isActive: isFullscreenActive
}), Object(external_wp_element_["createElement"])(browser_url, null), Object(external_wp_element_["createElement"])(external_wp_editor_["UnsavedChangesWarning"], null), Object(external_wp_element_["createElement"])(external_wp_editor_["AutosaveMonitor"], null), Object(external_wp_element_["createElement"])(external_wp_editor_["LocalAutosaveMonitor"], null), Object(external_wp_element_["createElement"])(keyboard_shortcuts, null), Object(external_wp_element_["createElement"])(external_wp_editor_["EditorKeyboardShortcutsRegister"], null), Object(external_wp_element_["createElement"])(settings_sidebar, null), Object(external_wp_element_["createElement"])(build_module["e" /* InterfaceSkeleton */], {
className: className,
labels: interfaceLabels,
header: Object(external_wp_element_["createElement"])(header, {
setEntitiesSavedStatesCallback: setEntitiesSavedStatesCallback
}),
secondarySidebar: secondarySidebar(),
sidebar: (!isMobileViewport || sidebarIsOpened) && Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, !isMobileViewport && !sidebarIsOpened && Object(external_wp_element_["createElement"])("div", {
className: "edit-post-layout__toggle-sidebar-panel"
}, Object(external_wp_element_["createElement"])(external_wp_components_["Button"], {
isSecondary: true,
className: "edit-post-layout__toggle-sidebar-panel-button",
onClick: openSidebarPanel,
"aria-expanded": false
}, hasBlockSelected ? Object(external_wp_i18n_["__"])('Open block settings') : Object(external_wp_i18n_["__"])('Open document settings'))), Object(external_wp_element_["createElement"])(build_module["b" /* ComplementaryArea */].Slot, {
scope: "core/edit-post"
})),
content: Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(external_wp_editor_["EditorNotices"], null), (mode === 'text' || !isRichEditingEnabled) && Object(external_wp_element_["createElement"])(text_editor, null), isRichEditingEnabled && mode === 'visual' && Object(external_wp_element_["createElement"])(VisualEditor, {
styles: styles
}), !isTemplateMode && Object(external_wp_element_["createElement"])("div", {
className: "edit-post-layout__metaboxes"
}, Object(external_wp_element_["createElement"])(meta_boxes, {
location: "normal"
}), Object(external_wp_element_["createElement"])(meta_boxes, {
location: "advanced"
})), isMobileViewport && sidebarIsOpened && Object(external_wp_element_["createElement"])(external_wp_components_["ScrollLock"], null)),
footer: !hasReducedUI && showBlockBreadcrumbs && !isMobileViewport && isRichEditingEnabled && mode === 'visual' && Object(external_wp_element_["createElement"])("div", {
className: "edit-post-layout__footer"
}, Object(external_wp_element_["createElement"])(external_wp_blockEditor_["BlockBreadcrumb"], null)),
actions: Object(external_wp_element_["createElement"])(ActionsPanel, {
closeEntitiesSavedStates: closeEntitiesSavedStates,
isEntitiesSavedStatesOpen: entitiesSavedStatesCallback,
setEntitiesSavedStatesCallback: setEntitiesSavedStatesCallback
}),
shortcuts: {
previous: previousShortcut,
next: nextShortcut
}
}), Object(external_wp_element_["createElement"])(manage_blocks_modal, null), Object(external_wp_element_["createElement"])(PreferencesModal, null), Object(external_wp_element_["createElement"])(keyboard_shortcut_help_modal, null), Object(external_wp_element_["createElement"])(WelcomeGuide, null), Object(external_wp_element_["createElement"])(external_wp_components_["Popover"].Slot, null), Object(external_wp_element_["createElement"])(external_wp_plugins_["PluginArea"], null));
}
/* harmony default export */ var components_layout = (Layout);
// EXTERNAL MODULE: ./node_modules/@wordpress/edit-post/build-module/store/constants.js
var constants = __webpack_require__("0dt7");
// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/editor-initialization/listener-hooks.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* This listener hook monitors for block selection and triggers the appropriate
* sidebar state.
*
* @param {number} postId The current post id.
*/
const useBlockSelectionListener = postId => {
const {
hasBlockSelection,
isEditorSidebarOpened
} = Object(external_wp_data_["useSelect"])(select => ({
hasBlockSelection: !!select('core/block-editor').getBlockSelectionStart(),
isEditorSidebarOpened: select(constants["a" /* STORE_NAME */]).isEditorSidebarOpened()
}), [postId]);
const {
openGeneralSidebar
} = Object(external_wp_data_["useDispatch"])(constants["a" /* STORE_NAME */]);
Object(external_wp_element_["useEffect"])(() => {
if (!isEditorSidebarOpened) {
return;
}
if (hasBlockSelection) {
openGeneralSidebar('edit-post/block');
} else {
openGeneralSidebar('edit-post/document');
}
}, [hasBlockSelection, isEditorSidebarOpened]);
};
/**
* This listener hook monitors any change in permalink and updates the view
* post link in the admin bar.
*
* @param {number} postId
*/
const useUpdatePostLinkListener = postId => {
const {
newPermalink
} = Object(external_wp_data_["useSelect"])(select => ({
newPermalink: select('core/editor').getCurrentPost().link
}), [postId]);
const nodeToUpdate = Object(external_wp_element_["useRef"])();
Object(external_wp_element_["useEffect"])(() => {
nodeToUpdate.current = document.querySelector(constants["c" /* VIEW_AS_PREVIEW_LINK_SELECTOR */]) || document.querySelector(constants["b" /* VIEW_AS_LINK_SELECTOR */]);
}, [postId]);
Object(external_wp_element_["useEffect"])(() => {
if (!newPermalink || !nodeToUpdate.current) {
return;
}
nodeToUpdate.current.setAttribute('href', newPermalink);
}, [newPermalink]);
};
// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/editor-initialization/index.js
/**
* Internal dependencies
*/
/**
* Data component used for initializing the editor and re-initializes
* when postId changes or on unmount.
*
* @param {number} postId The id of the post.
* @return {null} This is a data component so does not render any ui.
*/
function EditorInitialization({
postId
}) {
useBlockSelectionListener(postId);
useUpdatePostLinkListener(postId);
return null;
}
// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/editor.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function Editor({
postId,
postType,
settings,
initialEdits,
onError,
...props
}) {
const {
hasFixedToolbar,
focusMode,
hasReducedUI,
hasThemeStyles,
post,
preferredStyleVariations,
hiddenBlockTypes,
blockTypes,
__experimentalLocalAutosaveInterval,
keepCaretInsideBlock,
isTemplateMode,
template
} = Object(external_wp_data_["useSelect"])(select => {
var _getPostType$viewable, _getPostType;
const {
isFeatureActive,
getPreference,
__experimentalGetPreviewDeviceType,
isEditingTemplate,
getEditedPostTemplate
} = select(store["a" /* store */]);
const {
getEntityRecord,
getPostType,
getEntityRecords
} = select('core');
const {
getEditorSettings
} = select('core/editor');
const {
getBlockTypes
} = select(external_wp_blocks_["store"]);
const isTemplate = ['wp_template', 'wp_template_part'].includes(postType); // Ideally the initializeEditor function should be called using the ID of the REST endpoint.
// to avoid the special case.
let postObject;
if (isTemplate) {
const posts = getEntityRecords('postType', postType, {
wp_id: postId
});
postObject = posts === null || posts === void 0 ? void 0 : posts[0];
} else {
postObject = getEntityRecord('postType', postType, postId);
}
const supportsTemplateMode = getEditorSettings().supportsTemplateMode;
const isViewable = (_getPostType$viewable = (_getPostType = getPostType(postType)) === null || _getPostType === void 0 ? void 0 : _getPostType.viewable) !== null && _getPostType$viewable !== void 0 ? _getPostType$viewable : false;
return {
hasFixedToolbar: isFeatureActive('fixedToolbar') || __experimentalGetPreviewDeviceType() !== 'Desktop',
focusMode: isFeatureActive('focusMode'),
hasReducedUI: isFeatureActive('reducedUI'),
hasThemeStyles: isFeatureActive('themeStyles'),
preferredStyleVariations: getPreference('preferredStyleVariations'),
hiddenBlockTypes: getPreference('hiddenBlockTypes'),
blockTypes: getBlockTypes(),
__experimentalLocalAutosaveInterval: getPreference('localAutosaveInterval'),
keepCaretInsideBlock: isFeatureActive('keepCaretInsideBlock'),
isTemplateMode: isEditingTemplate(),
template: supportsTemplateMode && isViewable ? getEditedPostTemplate() : null,
post: postObject
};
});
const {
updatePreferredStyleVariations,
setIsInserterOpened
} = Object(external_wp_data_["useDispatch"])(store["a" /* store */]);
const editorSettings = Object(external_wp_element_["useMemo"])(() => {
const result = { ...Object(external_lodash_["omit"])(settings, ['styles']),
__experimentalPreferredStyleVariations: {
value: preferredStyleVariations,
onChange: updatePreferredStyleVariations
},
hasFixedToolbar,
focusMode,
hasReducedUI,
__experimentalLocalAutosaveInterval,
// This is marked as experimental to give time for the quick inserter to mature.
__experimentalSetIsInserterOpened: setIsInserterOpened,
keepCaretInsideBlock
}; // Omit hidden block types if exists and non-empty.
if (Object(external_lodash_["size"])(hiddenBlockTypes) > 0) {
// Defer to passed setting for `allowedBlockTypes` if provided as
// anything other than `true` (where `true` is equivalent to allow
// all block types).
const defaultAllowedBlockTypes = true === settings.allowedBlockTypes ? Object(external_lodash_["map"])(blockTypes, 'name') : settings.allowedBlockTypes || [];
result.allowedBlockTypes = Object(external_lodash_["without"])(defaultAllowedBlockTypes, ...hiddenBlockTypes);
}
return result;
}, [settings, hasFixedToolbar, focusMode, hasReducedUI, hiddenBlockTypes, blockTypes, preferredStyleVariations, __experimentalLocalAutosaveInterval, setIsInserterOpened, updatePreferredStyleVariations, keepCaretInsideBlock]);
const styles = Object(external_wp_element_["useMemo"])(() => {
return hasThemeStyles ? settings.styles : [];
}, [settings, hasThemeStyles]);
if (!post) {
return null;
}
return Object(external_wp_element_["createElement"])(external_wp_element_["StrictMode"], null, Object(external_wp_element_["createElement"])(edit_post_settings.Provider, {
value: settings
}, Object(external_wp_element_["createElement"])(external_wp_components_["SlotFillProvider"], null, Object(external_wp_element_["createElement"])(external_wp_editor_["EditorProvider"], Object(esm_extends["a" /* default */])({
settings: editorSettings,
post: post,
initialEdits: initialEdits,
useSubRegistry: false,
__unstableTemplate: isTemplateMode ? template : undefined
}, props), Object(external_wp_element_["createElement"])(external_wp_editor_["ErrorBoundary"], {
onError: onError
}, Object(external_wp_element_["createElement"])(EditorInitialization, {
postId: postId
}), Object(external_wp_element_["createElement"])(components_layout, {
styles: styles
}), Object(external_wp_element_["createElement"])(external_wp_components_["KeyboardShortcuts"], {
shortcuts: prevent_event_discovery
})), Object(external_wp_element_["createElement"])(external_wp_editor_["PostLockedModal"], null)))));
}
/* harmony default export */ var editor = (Editor);
// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/block-settings-menu/plugin-block-settings-menu-item.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
const isEverySelectedBlockAllowed = (selected, allowed) => Object(external_lodash_["difference"])(selected, allowed).length === 0;
/**
* Plugins may want to add an item to the menu either for every block
* or only for the specific ones provided in the `allowedBlocks` component property.
*
* If there are multiple blocks selected the item will be rendered if every block
* is of one allowed type (not necessarily the same).
*
* @param {string[]} selectedBlocks Array containing the names of the blocks selected
* @param {string[]} allowedBlocks Array containing the names of the blocks allowed
* @return {boolean} Whether the item will be rendered or not.
*/
const shouldRenderItem = (selectedBlocks, allowedBlocks) => !Array.isArray(allowedBlocks) || isEverySelectedBlockAllowed(selectedBlocks, allowedBlocks);
/**
* Renders a new item in the block settings menu.
*
* @param {Object} props Component props.
* @param {Array} [props.allowedBlocks] An array containing a list of block names for which the item should be shown. If not present, it'll be rendered for any block. If multiple blocks are selected, it'll be shown if and only if all of them are in the allowed list.
* @param {WPBlockTypeIconRender} [props.icon] The [Dashicon](https://developer.wordpress.org/resource/dashicons/) icon slug string, or an SVG WP element.
* @param {string} props.label The menu item text.
* @param {Function} props.onClick Callback function to be executed when the user click the menu item.
* @param {boolean} [props.small] Whether to render the label or not.
* @param {string} [props.role] The ARIA role for the menu item.
*
* @example
* ```js
* // Using ES5 syntax
* var __ = wp.i18n.__;
* var PluginBlockSettingsMenuItem = wp.editPost.PluginBlockSettingsMenuItem;
*
* function doOnClick(){
* // To be called when the user clicks the menu item.
* }
*
* function MyPluginBlockSettingsMenuItem() {
* return wp.element.createElement(
* PluginBlockSettingsMenuItem,
* {
* allowedBlocks: [ 'core/paragraph' ],
* icon: 'dashicon-name',
* label: __( 'Menu item text' ),
* onClick: doOnClick,
* }
* );
* }
* ```
*
* @example
* ```jsx
* // Using ESNext syntax
* import { __ } from '@wordpress/i18n';
* import { PluginBlockSettingsMenuItem } from '@wordpress/edit-post';
*
* const doOnClick = ( ) => {
* // To be called when the user clicks the menu item.
* };
*
* const MyPluginBlockSettingsMenuItem = () => (
* <PluginBlockSettingsMenuItem
* allowedBlocks={ [ 'core/paragraph' ] }
* icon='dashicon-name'
* label={ __( 'Menu item text' ) }
* onClick={ doOnClick } />
* );
* ```
*
* @return {WPComponent} The component to be rendered.
*/
const PluginBlockSettingsMenuItem = ({
allowedBlocks,
icon,
label,
onClick,
small,
role
}) => Object(external_wp_element_["createElement"])(external_wp_blockEditor_["BlockSettingsMenuControls"], null, ({
selectedBlocks,
onClose
}) => {
if (!shouldRenderItem(selectedBlocks, allowedBlocks)) {
return null;
}
return Object(external_wp_element_["createElement"])(external_wp_components_["MenuItem"], {
onClick: Object(external_wp_compose_["compose"])(onClick, onClose),
icon: icon,
label: small ? label : undefined,
role: role
}, !small && label);
});
/* harmony default export */ var plugin_block_settings_menu_item = (PluginBlockSettingsMenuItem);
// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/header/plugin-more-menu-item/index.js
/**
* WordPress dependencies
*/
/**
* Renders a menu item in `Plugins` group in `More Menu` drop down, and can be used to as a button or link depending on the props provided.
* The text within the component appears as the menu item label.
*
* @param {Object} props Component properties.
* @param {string} [props.href] When `href` is provided then the menu item is represented as an anchor rather than button. It corresponds to the `href` attribute of the anchor.
* @param {WPBlockTypeIconRender} [props.icon=inherits from the plugin] The [Dashicon](https://developer.wordpress.org/resource/dashicons/) icon slug string, or an SVG WP element, to be rendered to the left of the menu item label.
* @param {Function} [props.onClick=noop] The callback function to be executed when the user clicks the menu item.
* @param {...*} [props.other] Any additional props are passed through to the underlying [MenuItem](/packages/components/src/menu-item/README.md) component.
*
* @example
* ```js
* // Using ES5 syntax
* var __ = wp.i18n.__;
* var PluginMoreMenuItem = wp.editPost.PluginMoreMenuItem;
* var moreIcon = wp.element.createElement( 'svg' ); //... svg element.
*
* function onButtonClick() {
* alert( 'Button clicked.' );
* }
*
* function MyButtonMoreMenuItem() {
* return wp.element.createElement(
* PluginMoreMenuItem,
* {
* icon: moreIcon,
* onClick: onButtonClick,
* },
* __( 'My button title' )
* );
* }
* ```
*
* @example
* ```jsx
* // Using ESNext syntax
* import { __ } from '@wordpress/i18n';
* import { PluginMoreMenuItem } from '@wordpress/edit-post';
* import { more } from '@wordpress/icons';
*
* function onButtonClick() {
* alert( 'Button clicked.' );
* }
*
* const MyButtonMoreMenuItem = () => (
* <PluginMoreMenuItem
* icon={ more }
* onClick={ onButtonClick }
* >
* { __( 'My button title' ) }
* </PluginMoreMenuItem>
* );
* ```
*
* @return {WPComponent} The component to be rendered.
*/
/* harmony default export */ var plugin_more_menu_item = (Object(external_wp_compose_["compose"])(Object(external_wp_plugins_["withPluginContext"])((context, ownProps) => {
return {
icon: ownProps.icon || context.icon,
name: 'core/edit-post/plugin-more-menu'
};
}))(build_module["a" /* ActionItem */]));
// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/header/plugin-sidebar-more-menu-item/index.js
/**
* WordPress dependencies
*/
/**
* Renders a menu item in `Plugins` group in `More Menu` drop down,
* and can be used to activate the corresponding `PluginSidebar` component.
* The text within the component appears as the menu item label.
*
* @param {Object} props Component props.
* @param {string} props.target A string identifying the target sidebar you wish to be activated by this menu item. Must be the same as the `name` prop you have given to that sidebar.
* @param {WPBlockTypeIconRender} [props.icon=inherits from the plugin] The [Dashicon](https://developer.wordpress.org/resource/dashicons/) icon slug string, or an SVG WP element, to be rendered to the left of the menu item label.
*
* @example
* ```js
* // Using ES5 syntax
* var __ = wp.i18n.__;
* var PluginSidebarMoreMenuItem = wp.editPost.PluginSidebarMoreMenuItem;
* var moreIcon = wp.element.createElement( 'svg' ); //... svg element.
*
* function MySidebarMoreMenuItem() {
* return wp.element.createElement(
* PluginSidebarMoreMenuItem,
* {
* target: 'my-sidebar',
* icon: moreIcon,
* },
* __( 'My sidebar title' )
* )
* }
* ```
*
* @example
* ```jsx
* // Using ESNext syntax
* import { __ } from '@wordpress/i18n';
* import { PluginSidebarMoreMenuItem } from '@wordpress/edit-post';
* import { more } from '@wordpress/icons';
*
* const MySidebarMoreMenuItem = () => (
* <PluginSidebarMoreMenuItem
* target="my-sidebar"
* icon={ more }
* >
* { __( 'My sidebar title' ) }
* </PluginSidebarMoreMenuItem>
* );
* ```
*
* @return {WPComponent} The component to be rendered.
*/
function PluginSidebarMoreMenuItem(props) {
return Object(external_wp_element_["createElement"])(build_module["c" /* ComplementaryAreaMoreMenuItem */] // Menu item is marked with unstable prop for backward compatibility.
// @see https://github.com/WordPress/gutenberg/issues/14457
, Object(esm_extends["a" /* default */])({
__unstableExplicitMenuItem: true,
scope: "core/edit-post"
}, props));
}
// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* Reinitializes the editor after the user chooses to reboot the editor after
* an unhandled error occurs, replacing previously mounted editor element using
* an initial state from prior to the crash.
*
* @param {Object} postType Post type of the post to edit.
* @param {Object} postId ID of the post to edit.
* @param {Element} target DOM node in which editor is rendered.
* @param {?Object} settings Editor settings object.
* @param {Object} initialEdits Programmatic edits to apply initially, to be
* considered as non-user-initiated (bypass for
* unsaved changes prompt).
*/
function reinitializeEditor(postType, postId, target, settings, initialEdits) {
Object(external_wp_element_["unmountComponentAtNode"])(target);
const reboot = reinitializeEditor.bind(null, postType, postId, target, settings, initialEdits);
Object(external_wp_element_["render"])(Object(external_wp_element_["createElement"])(editor, {
settings: settings,
onError: reboot,
postId: postId,
postType: postType,
initialEdits: initialEdits,
recovery: true
}), target);
}
/**
* Initializes and returns an instance of Editor.
*
* The return value of this function is not necessary if we change where we
* call initializeEditor(). This is due to metaBox timing.
*
* @param {string} id Unique identifier for editor instance.
* @param {Object} postType Post type of the post to edit.
* @param {Object} postId ID of the post to edit.
* @param {?Object} settings Editor settings object.
* @param {Object} initialEdits Programmatic edits to apply initially, to be
* considered as non-user-initiated (bypass for
* unsaved changes prompt).
*/
function initializeEditor(id, postType, postId, settings, initialEdits) {
const target = document.getElementById(id);
const reboot = reinitializeEditor.bind(null, postType, postId, target, settings, initialEdits);
Object(external_wp_blockLibrary_["registerCoreBlocks"])();
if (false) {} // Show a console log warning if the browser is not in Standards rendering mode.
const documentMode = document.compatMode === 'CSS1Compat' ? 'Standards' : 'Quirks';
if (documentMode !== 'Standards') {
// eslint-disable-next-line no-console
console.warn("Your browser is using Quirks Mode. \nThis can cause rendering issues such as blocks overlaying meta boxes in the editor. Quirks Mode can be triggered by PHP errors or HTML code appearing before the opening <!DOCTYPE html>. Try checking the raw page source or your site's PHP error log and resolving errors there, removing any HTML before the doctype, or disabling plugins.");
} // This is a temporary fix for a couple of issues specific to Webkit on iOS.
// Without this hack the browser scrolls the mobile toolbar off-screen.
// Once supported in Safari we can replace this in favor of preventScroll.
// For details see issue #18632 and PR #18686
// Specifically, we scroll `interface-interface-skeleton__body` to enable a fixed top toolbar.
// But Mobile Safari forces the `html` element to scroll upwards, hiding the toolbar.
const isIphone = window.navigator.userAgent.indexOf('iPhone') !== -1;
if (isIphone) {
window.addEventListener('scroll', event => {
const editorScrollContainer = document.getElementsByClassName('interface-interface-skeleton__body')[0];
if (event.target === document) {
// Scroll element into view by scrolling the editor container by the same amount
// that Mobile Safari tried to scroll the html element upwards.
if (window.scrollY > 100) {
editorScrollContainer.scrollTop = editorScrollContainer.scrollTop + window.scrollY;
} // Undo unwanted scroll on html element, but only in the visual editor.
if (document.getElementsByClassName('is-mode-visual')[0]) {
window.scrollTo(0, 0);
}
}
});
}
Object(external_wp_element_["render"])(Object(external_wp_element_["createElement"])(editor, {
settings: settings,
onError: reboot,
postId: postId,
postType: postType,
initialEdits: initialEdits
}), target);
}
/***/ }),
/***/ "g56x":
/***/ (function(module, exports) {
(function() { module.exports = window["wp"]["hooks"]; }());
/***/ }),
/***/ "gdqT":
/***/ (function(module, exports) {
(function() { module.exports = window["wp"]["a11y"]; }());
/***/ }),
/***/ "hF7m":
/***/ (function(module, exports) {
(function() { module.exports = window["wp"]["keyboardShortcuts"]; }());
/***/ }),
/***/ "iClF":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId");
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__);
/**
* WordPress dependencies
*/
/** @typedef {{icon: JSX.Element, size?: number} & import('@wordpress/primitives').SVGProps} IconProps */
/**
* Return an SVG icon.
*
* @param {IconProps} props icon is the SVG component to render
* size is a number specifiying the icon size in pixels
* Other props will be passed to wrapped SVG component
*
* @return {JSX.Element} Icon component
*/
function Icon({
icon,
size = 24,
...props
}) {
return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["cloneElement"])(icon, {
width: size,
height: size,
...props
});
}
/* harmony default export */ __webpack_exports__["a"] = (Icon);
/***/ }),
/***/ "jSdM":
/***/ (function(module, exports) {
(function() { module.exports = window["wp"]["editor"]; }());
/***/ }),
/***/ "jZUy":
/***/ (function(module, exports) {
(function() { module.exports = window["wp"]["coreData"]; }());
/***/ }),
/***/ "l3Sj":
/***/ (function(module, exports) {
(function() { module.exports = window["wp"]["i18n"]; }());
/***/ }),
/***/ "onLe":
/***/ (function(module, exports) {
(function() { module.exports = window["wp"]["notices"]; }());
/***/ }),
/***/ "pPDe":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
var LEAF_KEY, hasWeakMap;
/**
* Arbitrary value used as key for referencing cache object in WeakMap tree.
*
* @type {Object}
*/
LEAF_KEY = {};
/**
* Whether environment supports WeakMap.
*
* @type {boolean}
*/
hasWeakMap = typeof WeakMap !== 'undefined';
/**
* Returns the first argument as the sole entry in an array.
*
* @param {*} value Value to return.
*
* @return {Array} Value returned as entry in array.
*/
function arrayOf( value ) {
return [ value ];
}
/**
* Returns true if the value passed is object-like, or false otherwise. A value
* is object-like if it can support property assignment, e.g. object or array.
*
* @param {*} value Value to test.
*
* @return {boolean} Whether value is object-like.
*/
function isObjectLike( value ) {
return !! value && 'object' === typeof value;
}
/**
* Creates and returns a new cache object.
*
* @return {Object} Cache object.
*/
function createCache() {
var cache = {
clear: function() {
cache.head = null;
},
};
return cache;
}
/**
* Returns true if entries within the two arrays are strictly equal by
* reference from a starting index.
*
* @param {Array} a First array.
* @param {Array} b Second array.
* @param {number} fromIndex Index from which to start comparison.
*
* @return {boolean} Whether arrays are shallowly equal.
*/
function isShallowEqual( a, b, fromIndex ) {
var i;
if ( a.length !== b.length ) {
return false;
}
for ( i = fromIndex; i < a.length; i++ ) {
if ( a[ i ] !== b[ i ] ) {
return false;
}
}
return true;
}
/**
* Returns a memoized selector function. The getDependants function argument is
* called before the memoized selector and is expected to return an immutable
* reference or array of references on which the selector depends for computing
* its own return value. The memoize cache is preserved only as long as those
* dependant references remain the same. If getDependants returns a different
* reference(s), the cache is cleared and the selector value regenerated.
*
* @param {Function} selector Selector function.
* @param {Function} getDependants Dependant getter returning an immutable
* reference or array of reference used in
* cache bust consideration.
*
* @return {Function} Memoized selector.
*/
/* harmony default export */ __webpack_exports__["a"] = (function( selector, getDependants ) {
var rootCache, getCache;
// Use object source as dependant if getter not provided
if ( ! getDependants ) {
getDependants = arrayOf;
}
/**
* Returns the root cache. If WeakMap is supported, this is assigned to the
* root WeakMap cache set, otherwise it is a shared instance of the default
* cache object.
*
* @return {(WeakMap|Object)} Root cache object.
*/
function getRootCache() {
return rootCache;
}
/**
* Returns the cache for a given dependants array. When possible, a WeakMap
* will be used to create a unique cache for each set of dependants. This
* is feasible due to the nature of WeakMap in allowing garbage collection
* to occur on entries where the key object is no longer referenced. Since
* WeakMap requires the key to be an object, this is only possible when the
* dependant is object-like. The root cache is created as a hierarchy where
* each top-level key is the first entry in a dependants set, the value a
* WeakMap where each key is the next dependant, and so on. This continues
* so long as the dependants are object-like. If no dependants are object-
* like, then the cache is shared across all invocations.
*
* @see isObjectLike
*
* @param {Array} dependants Selector dependants.
*
* @return {Object} Cache object.
*/
function getWeakMapCache( dependants ) {
var caches = rootCache,
isUniqueByDependants = true,
i, dependant, map, cache;
for ( i = 0; i < dependants.length; i++ ) {
dependant = dependants[ i ];
// Can only compose WeakMap from object-like key.
if ( ! isObjectLike( dependant ) ) {
isUniqueByDependants = false;
break;
}
// Does current segment of cache already have a WeakMap?
if ( caches.has( dependant ) ) {
// Traverse into nested WeakMap.
caches = caches.get( dependant );
} else {
// Create, set, and traverse into a new one.
map = new WeakMap();
caches.set( dependant, map );
caches = map;
}
}
// We use an arbitrary (but consistent) object as key for the last item
// in the WeakMap to serve as our running cache.
if ( ! caches.has( LEAF_KEY ) ) {
cache = createCache();
cache.isUniqueByDependants = isUniqueByDependants;
caches.set( LEAF_KEY, cache );
}
return caches.get( LEAF_KEY );
}
// Assign cache handler by availability of WeakMap
getCache = hasWeakMap ? getWeakMapCache : getRootCache;
/**
* Resets root memoization cache.
*/
function clear() {
rootCache = hasWeakMap ? new WeakMap() : createCache();
}
// eslint-disable-next-line jsdoc/check-param-names
/**
* The augmented selector call, considering first whether dependants have
* changed before passing it to underlying memoize function.
*
* @param {Object} source Source object for derivation.
* @param {...*} extraArgs Additional arguments to pass to selector.
*
* @return {*} Selector result.
*/
function callSelector( /* source, ...extraArgs */ ) {
var len = arguments.length,
cache, node, i, args, dependants;
// Create copy of arguments (avoid leaking deoptimization).
args = new Array( len );
for ( i = 0; i < len; i++ ) {
args[ i ] = arguments[ i ];
}
dependants = getDependants.apply( null, args );
cache = getCache( dependants );
// If not guaranteed uniqueness by dependants (primitive type or lack
// of WeakMap support), shallow compare against last dependants and, if
// references have changed, destroy cache to recalculate result.
if ( ! cache.isUniqueByDependants ) {
if ( cache.lastDependants && ! isShallowEqual( dependants, cache.lastDependants, 0 ) ) {
cache.clear();
}
cache.lastDependants = dependants;
}
node = cache.head;
while ( node ) {
// Check whether node arguments match arguments
if ( ! isShallowEqual( node.args, args, 1 ) ) {
node = node.next;
continue;
}
// At this point we can assume we've found a match
// Surface matched node to head if not already
if ( node !== cache.head ) {
// Adjust siblings to point to each other.
node.prev.next = node.next;
if ( node.next ) {
node.next.prev = node.prev;
}
node.next = cache.head;
node.prev = null;
cache.head.prev = node;
cache.head = node;
}
// Return immediately
return node.val;
}
// No cached value found. Continue to insertion phase:
node = {
// Generate the result from original function
val: selector.apply( null, args ),
};
// Avoid including the source object in the cache.
args[ 0 ] = null;
node.args = args;
// Don't need to check whether node is already head, since it would
// have been returned above already if it was
// Shift existing head down list
if ( cache.head ) {
cache.head.prev = node;
node.next = cache.head;
}
cache.head = node;
return node.val;
}
callSelector.getDependants = getDependants;
callSelector.clear = clear;
clear();
return callSelector;
});
/***/ }),
/***/ "tI+e":
/***/ (function(module, exports) {
(function() { module.exports = window["wp"]["components"]; }());
/***/ }),
/***/ "w95h":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId");
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("Tqx9");
/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__);
/**
* WordPress dependencies
*/
const close = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], {
d: "M13 11.8l6.1-6.3-1-1-6.1 6.2-6.1-6.2-1 1 6.1 6.3-6.5 6.7 1 1 6.5-6.6 6.5 6.6 1-1z"
}));
/* harmony default export */ __webpack_exports__["a"] = (close);
/***/ }),
/***/ "wduq":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId");
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("Tqx9");
/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__);
/**
* WordPress dependencies
*/
const wordpress = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "-2 -2 24 24"
}, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["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"
}));
/* harmony default export */ __webpack_exports__["a"] = (wordpress);
/***/ }),
/***/ "wx14":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _extends; });
function _extends() {
_extends = Object.assign || function (target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
return target;
};
return _extends.apply(this, arguments);
}
/***/ }),
/***/ "xrib":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* WEBPACK VAR INJECTION */(function(process) {/* unused harmony export Fill */
/* unused harmony export Slot */
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId");
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("tI+e");
/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _wordpress_compose__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("K9lf");
/* harmony import */ var _wordpress_compose__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_compose__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _wordpress_plugins__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("TvNi");
/* harmony import */ var _wordpress_plugins__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_plugins__WEBPACK_IMPORTED_MODULE_3__);
/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__("1ZqX");
/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_wordpress_data__WEBPACK_IMPORTED_MODULE_4__);
/* harmony import */ var _wordpress_warning__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__("Z23Y");
/* harmony import */ var _wordpress_warning__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_wordpress_warning__WEBPACK_IMPORTED_MODULE_5__);
/* harmony import */ var _preferences_modal_options__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__("Y5n4");
/* harmony import */ var _store__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__("T40v");
/**
* Defines as extensibility slot for the Settings sidebar
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const {
Fill,
Slot
} = Object(_wordpress_components__WEBPACK_IMPORTED_MODULE_1__["createSlotFill"])('PluginDocumentSettingPanel');
const PluginDocumentSettingFill = ({
isEnabled,
panelName,
opened,
onToggle,
className,
title,
icon,
children
}) => {
return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["Fragment"], null, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_preferences_modal_options__WEBPACK_IMPORTED_MODULE_6__[/* EnablePluginDocumentSettingPanelOption */ "d"], {
label: title,
panelName: panelName
}), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(Fill, null, isEnabled && Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_components__WEBPACK_IMPORTED_MODULE_1__["PanelBody"], {
className: className,
title: title,
icon: icon,
opened: opened,
onToggle: onToggle
}, children)));
};
/**
* Renders items below the Status & Availability panel in the Document Sidebar.
*
* @param {Object} props Component properties.
* @param {string} [props.name] The machine-friendly name for the panel.
* @param {string} [props.className] An optional class name added to the row.
* @param {string} [props.title] The title of the panel
* @param {WPBlockTypeIconRender} [props.icon=inherits from the plugin] The [Dashicon](https://developer.wordpress.org/resource/dashicons/) icon slug string, or an SVG WP element, to be rendered when the sidebar is pinned to toolbar.
*
* @example
* ```js
* // Using ES5 syntax
* var el = wp.element.createElement;
* var __ = wp.i18n.__;
* var registerPlugin = wp.plugins.registerPlugin;
* var PluginDocumentSettingPanel = wp.editPost.PluginDocumentSettingPanel;
*
* function MyDocumentSettingPlugin() {
* return el(
* PluginDocumentSettingPanel,
* {
* className: 'my-document-setting-plugin',
* title: 'My Panel',
* },
* __( 'My Document Setting Panel' )
* );
* }
*
* registerPlugin( 'my-document-setting-plugin', {
* render: MyDocumentSettingPlugin
* } );
* ```
*
* @example
* ```jsx
* // Using ESNext syntax
* import { registerPlugin } from '@wordpress/plugins';
* import { PluginDocumentSettingPanel } from '@wordpress/edit-post';
*
* const MyDocumentSettingTest = () => (
* <PluginDocumentSettingPanel className="my-document-setting-plugin" title="My Panel">
* <p>My Document Setting Panel</p>
* </PluginDocumentSettingPanel>
* );
*
* registerPlugin( 'document-setting-test', { render: MyDocumentSettingTest } );
* ```
*
* @return {WPComponent} The component to be rendered.
*/
const PluginDocumentSettingPanel = Object(_wordpress_compose__WEBPACK_IMPORTED_MODULE_2__["compose"])(Object(_wordpress_plugins__WEBPACK_IMPORTED_MODULE_3__["withPluginContext"])((context, ownProps) => {
if (undefined === ownProps.name) {
typeof process !== "undefined" && process.env && "production" !== "production" ? _wordpress_warning__WEBPACK_IMPORTED_MODULE_5___default()('PluginDocumentSettingPanel requires a name property.') : void 0;
}
return {
icon: ownProps.icon || context.icon,
panelName: `${context.name}/${ownProps.name}`
};
}), Object(_wordpress_data__WEBPACK_IMPORTED_MODULE_4__["withSelect"])((select, {
panelName
}) => {
return {
opened: select(_store__WEBPACK_IMPORTED_MODULE_7__[/* store */ "a"]).isEditorPanelOpened(panelName),
isEnabled: select(_store__WEBPACK_IMPORTED_MODULE_7__[/* store */ "a"]).isEditorPanelEnabled(panelName)
};
}), Object(_wordpress_data__WEBPACK_IMPORTED_MODULE_4__["withDispatch"])((dispatch, {
panelName
}) => ({
onToggle() {
return dispatch(_store__WEBPACK_IMPORTED_MODULE_7__[/* store */ "a"]).toggleEditorPanelOpened(panelName);
}
})))(PluginDocumentSettingFill);
PluginDocumentSettingPanel.Slot = Slot;
/* harmony default export */ __webpack_exports__["a"] = (PluginDocumentSettingPanel);
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__("8oxB")))
/***/ })
/******/ });